Jeremy
Jeremy

Reputation: 1

Having difficulty when incrementing

I have an issue with incrementing the number. It will come out as a love symbol. I don't know why.

reservationID dw 0 

.code

main proc
     mov ax,@data
     mov ds,ax

     mov ah,02h
     lea dx,reservationID
     add dx,30h  
     int 21h

Upvotes: 0

Views: 44

Answers (1)

Sep Roland
Sep Roland

Reputation: 39176

The DOS function that you use (02h) outputs the character in the DL register. What you did is loading the address of the reservationID variable in DX. That's not correct.

Seeing that you are adding 30h to convert to ASCII, I would suggest to define the variable using db instead of the larger than necessary dw.

.data

reservationID db 0

.code

main proc

  mov  ax, @data
  mov  ds, ax
  mov  dl, reservationID
  add  dl, 30h
  mov  ah, 02h
  int  21h

Upvotes: 1

Related Questions