Hi!

Recommended Answers

All 4 Replies

Hi.

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

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
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.