Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Code works 100% but doesnt print numbers more than 0-9. After 9, it starts print

ID: 3739905 • Letter: C

Question

Code works 100% but doesnt print numbers more than 0-9. After 9, it starts printing ascii chart values which i do not want. I simply want it to print however many numbner i input along with the message and the statement that tells how many times the loop is running. Please help!!

cseg segment code assume cs:cseg, ds:cseg, ss:cseg, es:cseg org 100h start: mov [Num_msg], 30h mov cx, 20 mov ah,9 mov dx, offset header int 21h again: mov dx, offset Hello int 21h mov dx, offset Num_msg int 21h inc byte ptr Num_msg loopne again done: mov ah,4ch int 21h

Explanation / Answer

Modified code

assume cs:cseg, ds:cseg, ss:cseg, es:cseg

org 100h

start:

mov ah, 09

mov dx, offset Intro

int 21h

mov ah, 01

int 21h

sub al, 30h

mov bl,0Ah

mul bl

mov bl, al

mov ah, 01

int 21h

sub al, 30h

add bl, al

mov cl, bl

jmp again

again:

mov ah, 09

mov dx, offset Hello

int 21h

mov dx, offset msg1

int 21h

mov dx, offset msg

int 21h

inc byte ptr msg

mov al, msg

cmp al, 3ah

jg reset

loopne again

reset:mov byte ptr msg, 30h

inc byte ptr msg1

cmp cx, 0

jg again

jmp done

done:

mov ah, 4ch

int 21h

org 200h

Intro db "Please input how many times you would like the loop to run." , 20h, 20h, "$"

Hello db "Ehsan Halterman" , 20h, 20h, "$"

msg db 30h, 13, 10, "$"

msg1 db 30h, "$"

cseg ends

end start