- Assembly Code for Addition of 1 digit number(0-9).
org 100h
; Addition of 1 digit
.code
; input 1
mov ah, 01h ; first character input function
int 21h
mov bl, al ; move the content of al (1st number) to bl register
; new line
mov ah, 02h ; character ouput function
mov dl, 0Ah ; line feed
int 21h
mov dl, 0Dh ; carriage return
int 21h
; Input 2
mov ah, 01h ; second character input function
int 21h
mov cl, al ; move the content of al (2nd number) to cl register
add bl, cl ; addition of two numbers
; Newline
mov ah, 02h ; character ouput function
mov dl, 0Ah ; line feed
int 21h
mov dl, 0Dh ; carriage return
int 21h
; Output
sub bl, 30h ; convert to real number entered
mov dl, bl ; move the content of bl (2nd number) to dl register
int 21h
endp
ret
No comments:
Post a Comment