Understanding Microprocessor and Assembly Language at University of Basrah

Slide Note
Embed
Share

Discover the world of Microprocessor and Assembly Language through lectures and practical examples at the University of Basrah. Topics include memory segmentation, data registers, arithmetic operations, control structures, and implementing programs to find the maximum of two elements. Dive into the intricate workings of computer systems with hands-on learning experiences.


Uploaded on Sep 28, 2024 | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

E N D

Presentation Transcript


  1. 2rd Grade Computer Science Dept/ College of Education for Pure Sciences Special Topics: Microprocessor & Assembly Language lecture2 Instructor: Ghazwan Abdulnabi Al-Ali University of Basrah, Iraq

  2. Microprocessor & Assembly Language University of Basrah Memory Segmentation and Segments Register Code Segment (CS). Data Segment (DS). Stack Segment (SS) . Extra Segment (ES). 2

  3. Microprocessor & Assembly Language University of Basrah Data Register AX 16 bits AL,AH 8bit, 8bit AX AH, AL BX BH,BL CX CH,CL DX DH,DL 3

  4. Microprocessor & Assembly Language University of Basrah Assembly Language C++ code x=10 y=5 x=x+y ASM Mov aL,5 Mov bL,4 Add aL,bL 4

  5. Microprocessor & Assembly Language University of Basrah arithmetic operations add Add al,bl X=x+y sub sub al,bl X=x-y inc Inc cl i++ i=i+1 5

  6. Microprocessor & Assembly Language University of Basrah compare Cmp bh,ch jmp 100 JE JG JEG JL JLE 6

  7. Microprocessor & Assembly Language University of Basrah Implementing control structures using in assembly language if C++ structures If(Condition) Statment1 Else Statment2 Assembly structures cmp Reg1,Reg2 (je ,jl,jle,jg,jge, ) if1 Statment2 jmp Continue1 if1:Statment1 continue1: 7

  8. Microprocessor & Assembly Language University of Basrah EX: Write a program in assembly language to find the max of two elements C++ X=5 Y=3 If(x>=y) Max=x Else Max=y Assembly mov al,5 mov bl,3 cmp al,bl jge if1 mov ah,bl jmp cont1 if1:mov ah,al cont1: 8

  9. Microprocessor & Assembly Language University of Basrah For in assembly language C++ n=5 Assembly mov reg1,5 mov cl,0 rep1:Statements inc cl cmp cl,reg1 jle rep1: For( i=0;i <=n ; i++) { Statements } 9

  10. Microprocessor & Assembly Language University of Basrah EX/ Write a program in assembly language to sum elements from 0-5 C++ n=5 Sum=0 For( i=0;i <=n ; i++) { sum=sum +i } Assembly mov bl,5 mov bh,0 mov cl,0 rep1:add bh,cl inc cl cmp cl,bl jle rep1: 10

  11. Microprocessor & Assembly Language University of Basrah H.W write an assembly program to find x*y using repeated addition: 11

  12. Microprocessor & Assembly Language University of Basrah Solution: Assembly mov cl,0 mov bl,5 mov bh,3 mov ah,0 rep1:add ah,bh inc cl cmp cl,bl jl rep1: Assembly mov cl,5 mov bh,3 mov ah,0 rep1:add ah,bh dec cl cmp cl,0 jg rep1: 12

  13. Microprocessor & Assembly Language University of Basrah H.W write an assembly program to find x/y using repeated subtraction : 13

  14. Microprocessor & Assembly Language University of Basrah Thank You 14

Related


More Related Content