Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Khaos

Annoying (N)ASM problem...

This topic is 6151 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was making the change from MASM to NASM. I wrote this program in NASM to experiment with. When I compile it, it works up until the result, then it displays some garbage. The program worked until I added "+" and "=" support, then it became a problem. Any help is greatly appreciated. Thanks very much.
  
org 100h

;clear ax
xor ax, ax

;read a digit
mov ah, 1
int 21h

;convert to a number
sub al, 30h

;display "+"
mov dl, 2Bh
mov ah, 2
int 21h

;save it in dl
mov dl, al

;read second digit
mov ah, 1
int 21h

;convert to a number
sub al, 30h

;add the two
add al, dl

;convert to a digit
xor ah, ah
add al, 30h
push ax

;display "="
mov dl, 3Dh
mov ah, 2
int 21h

;swap ax and dx
pop ax
mov [holdon], ax
mov dx, holdon

;display the number
mov ah, 9
int 21h

;message
mov dx, msg
mov ah,9
int 21h

;return to dos
mov ah, 4ch
int 21h

msg db ''Calculation Complete!'', 0Dh, 0Ah,''$''
holdon dw ''00$''
  
===== Khaos =====

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!