Answer to Question #163621 in Assembler for Tharun Seemakurthi

Question #163621

1 Write an assembly program for division of two eight bit no. at 4000H=2CH and 4001H=30H and save result at 4002H=quotient and 4003H= remainder.


1
Expert's answer
2021-02-15T00:01:51-0500

; DosBox

DATA SEGMENT

DATA ENDS

 

CODE SEGMENT

ASSUME DS:DATA,CS:CODE

START:

    MOV AX,DATA

    MOV DS,AX

 

; 4000H=2CH

    mov di,4000h       ; address

    mov al,2Ch           ; al = number1=2Ch

    mov [di],al            ; save number1 in memory: 4000H=2Ch

 

; 4001H=30H

    mov di,4001h           ; address

    mov al,30h                ; al = number2=30h

    mov [di],al                ; save number2 in memory: 4001H=30h

 

    mov si,4000h           ; address

    mov al,[si]                ; number1= al=2Ch

    mov si,4001h           ; address       

    mov cl,[si]                ; number2= cl=30h

           

; number1/number2  

; 4002H = quotient and 4003H = remainder

    div cl                          ; al=al/cl,    ah=al%cl

    mov di,4002h           ; address

    mov [di],al                ; save al=quotient: 4002H=quotient

    mov di,4003h            ; address

    mov [di],ah                ; save ah=remainder: 4003H=remainder

 

EXIT_PROG:                     ; Program is terminated

    MOV AH,4CH

    INT 21H

 

CODE ENDS

END START


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS