我正在尝试读取可以在地址 0000h:044Ch 中找到的值 1000h 并ax
使用该mov
指令将其放入寄存器中。每次我得到比预期的 1000h 另一个值。
这是我在 TASM 中使用的指令:
mov ax, [word ptr 0000h:044Ch]
我已经ax
在调试器中检查了值。
我正在尝试读取可以在地址 0000h:044Ch 中找到的值 1000h 并ax
使用该mov
指令将其放入寄存器中。每次我得到比预期的 1000h 另一个值。
这是我在 TASM 中使用的指令:
mov ax, [word ptr 0000h:044Ch]
我已经ax
在调试器中检查了值。
您必须将其中一个段寄存器设置为 0x0000,然后通过该段寄存器访问偏移量 044ch 处的字。像这样的东西应该工作:
xor ax, ax ; XOR register with itself same as setting register to 0
mov es, ax ; ES = 0
mov ax, [es:044ch] ; Get size of text video page of current display mode in bytes
; AX now has the 16-bit WORD value at 0000h:044ch
shr ax, 4 ; Divide by 16 to get size in paragraphs
add ax, 0b800h ; Add to the base of text video memory segment to get page 1 segment
; Then you can put AX in a segment like ES to access text video memory
mov es, ax ; ES = segment of page 1 of current text video mode