1

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
4

1 回答 1

1

您需要该对ds:false指向 的地址false,因此您需要设置一个数据段(通过ds寄存器)。由于您的[ORG 0x7c00]指令,标签的值false已经在它需要的位置,因此您可以设置ds为 0。

xor ax,ax
mov ds,ax

只需将其放在代码的开头即可。

于 2013-07-09T13:58:01.310 回答