5
Contributors
4
Replies
7
Views
9 Years
Discussion Span
Last Post by Jamalm
0

I know...
Only a newbie wouldn't know that you couldn't print
out the result of a arithmetic operation directly to the screen.

mov ah,6
mov dl,6
add dl,ah
mov ah,02h ; WHY NOT PRINT OUT 12 TO SCREEN, IM NEWBIE
int 21h

why not try adding ah to dl and viceversa using runtime code modification?

start:
zaddz db 00h,e2
xor byte [zadda],2
0

Hi I am trying to add two numbers in assembly but im lost now and my prompts don't work right. Here is my code could someone help me out?

.model small
.stack 100h
.data
    msg1 db 13,10, 'Enter first number:$'
    msg2 db 13,10, 'Enter second number:$'
    sum db 13,10, 'The sum is:$'

.code
.startup
    mov ax, @data
    mov ds,ax
    
    lea dx, msg1
    mov ah, 09h
    int 21h
    
    mov ah, 01h
    int 21h
    sub al,30h
    mov bl, al
    
    lea dx, msg2
    mov ah, 09h
    int 21h
    mov ah,01h
    int 21
    sub al, 30h
    add bl,al
    
    lea dx, sum
    mov ah, 09h
    int 21h
    
    mov ah,4ch
    int 21h
;main endp
end
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.