Reputation: 760
I'm trying to learn assembly language and made some simple steps so far. I can display characters on the screen using their ascii-id, but now I want to store the ids of specific characters into a variable and print them. Unfortunately this does not work :) My code only displays a space on the screen. Thank you for each kind of help!
[BITS 16]
[ORG 0x7C00]
; MOV AL, 48 (works)
MOV AL, [false]
CALL PrintCharacter
JMP $
PrintCharacter:
MOV AH, 0x0E
MOV BH, 0x00
MOV BL, 0x07
INT 0x10
RET
false db 48
true db 49
TIMES 510 - ($ - $$) db 0
DW 0xAA55
Upvotes: 1
Views: 2046
Reputation: 11706
You need the pair ds:false
to point to the address of false
, so you need to setup a data segment (via the ds
register). Because of your [ORG 0x7c00]
directive, the value of the label false
is already where it needs to be, so you can just set ds
to 0.
xor ax,ax
mov ds,ax
Just put that at the beginning of your code.
Upvotes: 1