操作码和操作数的组合无效
SEGMENT .data
print db "%d %d %d %d This is a test of printf", 10, 0
rowm dw 160 ;row multiplier
iterations db 80 ;number of columns to set
SEGMENT .bss
offs resd 1 ;offset
SEGMENT .text
attribute equ 47h ;color attribute
global _VText
global _VPage
extern _vm_buffer
extern _printf
_VText:
push ebp
mov ebp, esp
push edi
push esi
push eax
push es
push ecx
push edx
mov esi, [ebp+8] ;message
mov es, [_vm_buffer]
mov dword [offs], 0
mov ax, [ebp+12] ;row
mul dword[rowm] ;multiply row by 160, result stored in dx:ax
add [offs], dx ;add dx:ax to offset
shl dword [offs], 16
add [offs], ax
mov ax, [ebp+16] ;column
shl ax, 1 ;multiply column by 2
add [offs], ax ;add ax to offset
mov ax, [ebp+24] ;page
shl ax, 12 ;multiply page by 2^12 (4096)
add [offs], ax ;add ax to offset
mov edi, offs ;set offset
mov ah, [ebp+20] ;attribute
sub byte[iterations], [ebp+16] ;so that we don't write too many columns
mov ecx, iterations
next_char:
lodsb ;get the input string type
cmp al, 00h ;check for null character
je null_ch ;if null, then quit (null character indicates end of the string)
stosw ;store ax to video memory
loop next_char ;will loop 80 times
null_ch:
pop edx
pop ecx
pop es
pop eax
pop esi
pop edi
pop ebp
ret
_VPage:
ret
我之前研究过这个错误,它说添加括号,我这样做了,但它没有修复。
请帮忙。
SEGMENT .data
print db "%d %d %d %d This is a test of printf", 10, 0
rowm dw 160 ;row multiplier
iterations db 80 ;number of columns to set
SEGMENT .bss
offs resd 1 ;offset
SEGMENT .text
attribute equ 47h ;color attribute
global _VText
global _VPage
extern _vm_buffer
extern _printf
_VText:
push ebp
mov ebp, esp
push edi
push esi
push eax
push es
push ecx
push edx
mov esi, [ebp+8] ;message
mov es, [_vm_buffer]
mov dword [offs], 0
mov ax, [ebp+12] ;row
mul dword[rowm] ;multiply row by 160, result stored in dx:ax
add [offs], dx ;add dx:ax to offset
shl dword [offs], 16
add [offs], ax
mov ax, [ebp+16] ;column
shl ax, 1 ;multiply column by 2
add [offs], ax ;add ax to offset
mov ax, [ebp+24] ;page
shl ax, 12 ;multiply page by 2^12 (4096)
add [offs], ax ;add ax to offset
mov edi, offs ;set offset
mov ah, [ebp+20] ;attribute
sub byte[iterations], [ebp+16] ;so that we don't write too many columns
mov ecx, iterations
next_char:
lodsb ;get the input string type
cmp al, 00h ;check for null character
je null_ch ;if null, then quit (null character indicates end of the string)
stosw ;store ax to video memory
loop next_char ;will loop 80 times
null_ch:
pop edx
pop ecx
pop es
pop eax
pop esi
pop edi
pop ebp
ret
_VPage:
ret
i researched this error earlier and it said add the bracket i did that and it's not fixing.
help please.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是哪种架构,哪种汇编器?对我来说,看起来像 Intel/NASM-ish 语法中的 i386(但这只是一个小片段)。错误出现在哪一行代码上?无论如何你都不能这样做:
你不能直接从内存到内存进行减法。您必须通过中间寄存器,例如:
但是您的错误也可能指的是另一行。
Which architecture is this, and which assembler? Looks like i386 in Intel/NASM-ish syntax to me (but it's just a small snippet). Which line of code is the error on? In any case you can't do this:
You can't do a subtract directly from memory to memory. You have to go through an intermediate register, e.g:
But your error might be referring to another line too.