我正在尝试读取可以在地址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