Question: Convert following assembly language to procedure 2 Set a counter to zero. Get number into the dividend registers for proper size. Divide the dividend by

Convert following assembly language to procedure 2

  1. Set a counter to zero.

  2. Get number into the dividend registers for proper size.

  3. Divide the dividend by the 16 bit divisor of 10.

  4. Add ASCII value of 0x30 to the remainder digit. This is how to convert to ASCII

  5. Save remainder digit on stack. (use PUSH instruction)

  6. Add to counter of digits saved on stack

  7. Zero out remainder register.

  8. Test the quotient (next dividend) to see if its zero.

  9. No then go to step 3

  10. Yes print the digits from the stack one by one. (Use POP operation and Output char system call.)

----------

currently this code is for procedure 1, would like it to be converted to procedure 2

-----------

;procedure 1 code

.model small .stack 100h .data

NUM DB 0FFH RES DB 10 DUP ('$') DATA ENDS CODE SEGMENT ASSUME DS:DATA,CS:CODE START: MOV AX,DATA MOV DS,AX MOV AH,0 MOV AL,NUM LEA SI,RES CALL HEX2DEC LEA DX,RES MOV AH,9 INT 21H MOV AH,4CH INT 21H CODE ENDS HEX2DEC PROC NEAR MOV CX,0 MOV BX,10 LOOP1: MOV DX,0 DIV BX ADD DL,30H PUSH DX INC CX CMP AX,9 JG LOOP1 ADD AL,30H MOV [SI],AL LOOP2: POP AX INC SI MOV [SI],AL LOOP LOOP2 RET HEX2DEC ENDP END START

 Convert following assembly language to procedure 2 Set a counter to

Procedure:1 a) Write an assembly program which computes the following: int W, X, Y, loc, sum X=60 loc = Y * 160 + X * 2 Y-1000 Y-Y-1 Sum- loc/8 Y+Y/4Y/100 Output the number W on the screen Note: This program is similar to the last lab. Sum should be modified and value of W nust be output to the screen Note: You may not use any library functions, only DOS/BIOS functions can be used. You can use the following code to write a single ASCII character to the screen. It assumes that register AL contains the ASCII character to be printed mov ah,06h DOS code for output or input mov dl, al : display char on screen int 21h Procedure: 2 a) Write an assembly program which computes the following int W, X, Y, loc, sum; X 40 Y = 24 loc = Y * 160 X * 2 Y 2000 Y-Y-1 Sum = loc/16 + Y +Y/4 Y/200 W-Sun % 7+5 Procedure:1 a) Write an assembly program which computes the following: int W, X, Y, loc, sum X=60 loc = Y * 160 + X * 2 Y-1000 Y-Y-1 Sum- loc/8 Y+Y/4Y/100 Output the number W on the screen Note: This program is similar to the last lab. Sum should be modified and value of W nust be output to the screen Note: You may not use any library functions, only DOS/BIOS functions can be used. You can use the following code to write a single ASCII character to the screen. It assumes that register AL contains the ASCII character to be printed mov ah,06h DOS code for output or input mov dl, al : display char on screen int 21h Procedure: 2 a) Write an assembly program which computes the following int W, X, Y, loc, sum; X 40 Y = 24 loc = Y * 160 X * 2 Y 2000 Y-Y-1 Sum = loc/16 + Y +Y/4 Y/200 W-Sun % 7+5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!