Assembly 汇编语言:错误A2075跳转目标太远:30字节
如果跳得太远,检查和调试的最佳方法是什么 所以我有一个varAssembly 汇编语言:错误A2075跳转目标太远:30字节,assembly,byte,Assembly,Byte,如果跳得太远,检查和调试的最佳方法是什么 所以我有一个varinBuffer,它包含一个长度为115的字节。 我将其移动到bufSize中,并尝试用一组3个密钥对其进行异或以解密消息。 我的代码可以编译,但我无法构建,除了这一部分,它说我跳得太远了 bufSize DWORD ? mov eax,115 mov bufSize,eax ;------------------------------------------------- AnalyzeBuffer PROC ;receives
inBuffer
,它包含一个长度为115的字节。
我将其移动到bufSize
中,并尝试用一组3个密钥对其进行异或以解密消息。
我的代码可以编译,但我无法构建,除了这一部分,它说我跳得太远了
bufSize DWORD ?
mov eax,115
mov bufSize,eax
;-------------------------------------------------
AnalyzeBuffer PROC
;receives nothing
;returns nothing
;-------------------------------------------------
pushad ; pushes all data in this method into a stack
mov ecx,bufSize ; loop count
mov esi,0 ; start at index 0 in translated buffer
top:
cmp buffer[esi],20h ; checks if character is space which is ok
je yes
cmp buffer[esi],2ch ; checks if character is comma wich is okay
je yes
cmp buffer[esi],2eh ; checks if character is period which is okay
je yes
cmp buffer[esi],41h ; checks if character is above A in the ascii chart
jb no
;the following are all unacceptable characters
cmp buffer[esi],5bh ;checks if character is [
je no
cmp buffer[esi],5ch ; checks if character is \
je no
cmp buffer[esi],5dh ;checks if character is ]
je no
cmp buffer[esi],5eh ; checks if character is ^
je no
cmp buffer[esi],5fh ; checks if character is _
je no
cmp buffer[esi],60h ; checks if character is `
je no
cmp buffer[esi],7bh ; checks if characre is {
je no
cmp buffer[esi],7ch ; checks if character is |
je no
cmp buffer[esi],7dh ; checks if }
je no
cmp buffer[esi],7eh ; checks if ~
je no
cmp buffer[esi],7fh ; checks if
je no
yes:
inc esi ; going to next character
loop top
;getting to this step means these keys worked for all characters in buffer
mov edx,OFFSET goodMsg
call WriteString
call DisplayAllKeys ; shows 3 keys used
call Crlf
call Crlf
mov edx,OFFSET buffer ; displays decrypted message
call WriteString
call Crlf
call Crlf
no:
;the current character wasnt good so trying next key
popad
ret
AnalyzeBuffer ENDP
下一次,您应该知道是哪一行导致了错误。我猜是循环
指令,因为它只存在8位偏移量。由于优化的原因,建议无论如何避免使用它,这也将解决您的跳跃范围问题。因此,只需将其替换为dec ecx;jnz顶部
您还可以优化您的检查,但这是另一回事。通常在发生这种情况时,您会将跳转指令切换到另一种情况,并在跳转指令后立即处理另一种情况。我不确定这是否适用于您的情况,因为您有很多跳转…第133行是循环顶部
,因此可能是inc esi
哪一个可能是问题?循环
是问题,正如我所说的。