Hi,
I'm a beginner of 16-bit programming and have a problem that I'm not able to give account.
There are no errors, but there is alway printed "You pressed 'i'.".
This is my code:
DATA SEGMENT
Message db "You pressed 'i'.", "$"
Message2 db "You didn't press 'i'", "$"
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE, DS:DATA
start:
mov ah, 0
int 16h ; al = pressed key
cmp al, 'i'
jne ng
g:
mov dx, offset Message
mov ah, 9
int 21h
jmp _end
ng:
mov dx, offset Message2
mov ah, 9
int 21h
jmp start
_end:
mov ah, 0
int 16h
mov ah, 4Ch
int 21h
CODE ENDS
END start
Thx for your replies
Assume is not sufficient - you need to load the register.
start:
mov ax, @DATA ; set the DS register to DGROUP
mov ds, ax ; for ds:si (lods)
Check also the macros included in DosBasic (http://www.masm32.com/board/index.php?topic=17991.msg151620#msg151620).
Wow, this is great, it works fine. :)
Thank you very much! :U