You need something like the following. I did this in an editor so you'll have to debug it! Note the comments!
.model small
.stack
.data
.code
start:
mov ah,1
int 21h ; DOS - Read character from StdIn (Key)
; al=char read
; mov ah,2
; mov dl,0ah ; WRITE LineFeed ????
; int 21h ; DOS - Write character to StdOut
; ; NOTE: AL is now destroyed! as LineFeed was written!
;;; BASED upon your error, and this next push....
mov ah,2
mov dl,al
int 21h
push ax ; Save Old Character
mov ah,1
int 21h ; DOS - Read character from StdIn (Key)
; al = char read
mov ah,2
int 21h ; DOS - Write character to StdOut
pop bx ; Restore Old Character
; al = 2nd char bl = 1st char
; You aren't doing BCD so why are you using the instruction AAA ?
;;; add ax,bx
;;; aaa
mov ah,0
add al,bl
daa ; Decimal adjust High Nibble, Low Nibble
;ah=high digit, al=low digit
mov dh,al ; Save lower digit
mov dl,ah ; Upper digit
add dl,30h
mov ah,2
int 21h ; DOS - Write Digit Upper ASCII
mov dl,dh ; Lower Digit
add dl,30h
mov ah,2
int 21h ; DOS - Write digit Lower ASCII
end start wildgoose
Practically a Posting Shark
896 posts since Jun 2009
Reputation Points: 546
Solved Threads: 99