首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >汇编程序语言:错误A2075跳转目标太远: 30字节

汇编程序语言:错误A2075跳转目标太远: 30字节
EN

Stack Overflow用户
提问于 2014-04-24 20:16:09
回答 1查看 1.7K关注 0票数 1

如果跳得太远,检查和调试的最佳方法是什么?

所以我有一个变量inBuffer,它包含一个BYTE长度为115。我将其移动到bufSize中,并尝试对一组3密钥对xor‘进行解密。我的代码编译,但我无法构建,除了这个部分,它说我跳得太远了。

代码语言:javascript
复制
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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-04-24 21:11:08

下次您应该知道是哪一行导致了错误。我猜它是loop指令,因为它只存在一个8位偏移量。由于优化的原因,它是建议避免使用它无论如何,这将解决您的跳转范围问题。所以,只需用一个dec ecx; jnz top替换它。

您也可以优化您的检查,但这是另一个故事。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/23278909

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档