我是组装和图形的初学者,任何帮助将不胜感激。我得到了 svga 信息,但是当我打印它时,它不会打印任何内容。如果有人能解释为什么那就太好了。这是代码。如果我所做的事情需要更多解释,请告诉我
.MODEL SMALL
.STACK 64
.DATA
getinfo:
VbeSignature db 'VESA' ; VESA
VbeVersion dw 0000h ; Version
OemStringPtr dd ? ; Producer
Capabilities db 4 dup (?); Reserved
VideoModePtr dd ? ; Modes
TotalMemory dw ? ; Blocks
OemSoftwareRev dw ?
OemVendorNamePtr dd ?
OemProductNamePtr dd ?
OemProductRevPtr dd ?
_Reserved_ db 222 dup (?)
OemData db 256 dup (?)
.CODE
Entry:
mov ax, @data ;make DS point to our DATA ;segment
mov es, ax
mov ax, offset getinfo
mov es, ax
mov ax, 4f00h ;this is the call to read the svga info, and im assuming it is
;stored in getinfo
mov di, offset getinfo
int 10h
xor bx, bx ;make bx zero
mov si, offset getinfo
loopy:
mov dl, [si + bx] ;dl is the char to print
cmp dl, 24h
je done
push dx ;before calling print put all the arguments on the stack
call print
inc bx ;point to next char
jmp loopy ;loop if string not finished
jmp done
print:
pop cx ;take the return address out of the stack
pop dx ;take the character to print out of the stack
mov ah, 02h
int 21h ;ask DOS to output a single char
jmp cx ;jump back to the return address
done:
mov ax, 4c00h
int 21h ;DOS exit program with al = exit code
END Entry
正如人们在评论中建议的那样,您的代码存在一些问题。
首先你错过了getinfo
存储数据的结构我挖掘了一些使用 SVGA 的旧代码并发现了这个结构(我假设这不是 VESA 2.0)
getinfo:
VbeSignature db 'VESA' ; VESA
VbeVersion dw 0000h ; Version
OemStringPtr dd ? ; Producer
Capabilities db 4 dup (?); Reserved
VideoModePtr dd ? ; Modes
TotalMemory dw ? ; Blocks
OemSoftwareRev dw ?
OemVendorNamePtr dd ?
OemProductNamePtr dd ?
OemProductRevPtr dd ?
_Reserved_ db 222 dup (?)
OemData db 256 dup (?)
因此,您需要添加该内容并修复尝试将偏移量添加到该结构的错误dl
。应该放入DI
正如玛格丽特·布鲁姆建议的那样。这也是不正确的
mov ax, offset getinfo
mov es, ax
因为你想把数据段放到es
不是结构的偏移量。所以代替这个
mov ax, @data
mov es, ax
我不确定 TASM 是否理解这个 @data 表示法。
至于您的打印例程,不确定要打印什么,因为结构中的数据将是二进制的,首先您需要将它们转换为某种可打印的形式(除了 VESA 字符串)。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)