使用 CBM Studio 的 6510 程序集 - 带有分支错误的页面边界

问题描述

我在运行程序时遇到错误页面边界。在适用于 Windows 10 的 CBM prg studio 应用程序帮助中,没有任何地方解释我如何增加这个边界,或者我需要做什么来避免这些错误

它发生在同一条指令上,位于标签 E1cycle 和 E2cycle 内的第 110 行和第 127 行...


**Line 110:** BEQ space2reset     ; branch/jump if the result in A is 0

**Line 127:** BEQ space2reset     ; branch/jump if the result in A is 0

The errors...
**Line 110**:Page boundary crossed.   -   F:\C64\UltimateTests\test.asm

**Line 127**:Page boundary crossed.   -   F:\C64\UltimateTests\test.asm

[Error] Line 72:Invalid branch (200 bytes) "BEQ Name2    ; if we find it we branch using BEQ to name2 for msg2 "

[Error] Line 143:Invalid branch (-275 bytes) "BEQ StartBlackOut"

另外,正如你在上面看到的,我收到了这些奇怪的(200 字节)和(-275 字节)的无效分支错误——这是代码部分......

getnameb
        jsr $FF9F   ;SCNKEY,place ASCII character into keyboard queue
        jsr $FFE4   ;GETIN,this places the ASCII value into the Accumulator 

        BEQ getnameb ;loop until keys are pressed. (Branch if equal to zero)
        
        JSR $FFD2    ; CHROUT,print it to the screen as it is being typed in.
        CMP #13      ; CMP looks for the carrige return
        BEQ Name2    ; if we find it we branch using BEQ to name2 for msg2 
        
        CMP #32         ; Looking for space bar. If true error 1 is returned
        BEQ ErrorInput1

        ldx $0900    ; load into x the value at $0900 - replace what was there from JSRs
        STA $0019,x  ; also store what is being typed in consecutively? 
        INX          ; X IS INCREASED BY 1.
        stx $0900    ; Store X back to $0900,avoid being molested by the above JSRs
                     ; The value at $0900 is the length of the string!
        
        LDA $0900        ; Load into A the current length of the string 
        CMP #08          ; Looking for max 8 chars. If true error 2 is returned
        BEQ ErrorInput2
        
        JMP getnameb     ; if we don't we loop! 


;PRINT ERRORS 1 OR 2

;-----1
ErrorInput1   
        LDX #00       ; load into the x registry zero


E1cycle  
        LDA E1msg,x    ; load into A the E1msg,the x sequence.
        CMP #00        ; compare memory and accumulator to the value 0?    
        BEQ space2reset     ; branch/jump if the result in A is 0
        STA 1424,x     ; where on the screen does E1msg start?
        INX            ; inc x to move the print along 1 space?
        
        JMP E1cycle    ; jump back to the beginning of cycle and do it all again.

E1msg   text 'ERROR: NO SPACES PERMITTED - SPACE TO RESET'
        byte 0
;-----2

ErrorInput2  
        LDX #00       ; load into the x registry zero


E2cycle  
        LDA E2msg,x     ; where on the screen does E1msg start?
        INX            ; inc x to move the print along 1 space?
        
        JMP E2cycle    ; jump back to the beginning of cycle and do it all again.

E2msg   text 'ERROR: MAX 8 CHaraCTERS PERMITTED - SPACE TO RESET'
        byte 0

space2reset    
        jsr $FF9F   ;SCNKEY,this places the ASCII value into the Accumulator 

        BEQ space2reset ;loop until keys are pressed. (Branch if equal to zero)
        
        CMP #32
        BEQ StartBlackOut ; Go to the very beginning of the programming and reset the whole thing!       

我需要用非常简单的术语向我解释这一点,因为我仍在学习,有时发现术语有点难以理解。谢谢!

解决方法

我在运行程序时遇到错误页面边界。在适用于 Windows 10 的 CBM prg studio 应用程序帮助中,没有任何地方解释我如何增加这个边界,或者我需要做什么来避免这些错误。

您不能增加边界,这是硬件限制。相反,您应该确保条件分支的目标(即跳转到的位置)离分支指令本身不会太远。换句话说,分支指令不能跳转到太远的目的地。 (太远意味着相隔 128 ish 字节或更多)。

解决此问题的方法可能是重新排列您的代码,使目标更接近分支指令。但如果失败,你可以这样做:

    bne n
    jmp where_you_want_to_go
n:  ; label for the next instruction after the jump

代替这个

    beq where_you_want_to_go

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...