Macro to check for crossing page boundary (using VASM)
Posted: Wed Jun 10, 2020 11:08 am
Hi all this is my first post. I am new to the 6502 (previously worked with the Z80 and a few other processors)
I am busy making a 6502 Single board computer which will use Sram for program memory loaded from serial link. (i.e. Eprom emulator)
I have read warnings about the page boundary bug when using jump instructions (I'm probably going to use an older 6502 device)
I am using Vasm assembler to generate the binary file to be uploaded. (Although am open to other suggestions)
Now I found a macro example for checking crossing page boundaries, but am not sure how to associate it with my code.
The macro is:
An example of my code is:
firstly, I tried placing the macro at the start of my code and then trying to use it with :
wbeq <address> e.g. wbeq loop1
It gives an error - unknown opcode <warn>
So among other things - Does Vasm assembler use another directive to print a console message? (I tried looking in the documentation)
And is my implementation of how to use this macro correct?
I also saw some info at:https://atariage.com/forums/topic/14764 ... ct-access/
What do you all out there do to avoid this issue - if using the older devices?
thanks all
regards
Russell
I am busy making a 6502 Single board computer which will use Sram for program memory loaded from serial link. (i.e. Eprom emulator)
I have read warnings about the page boundary bug when using jump instructions (I'm probably going to use an older 6502 device)
I am using Vasm assembler to generate the binary file to be uploaded. (Although am open to other suggestions)
Now I found a macro example for checking crossing page boundaries, but am not sure how to associate it with my code.
The macro is:
Code: Select all
wbeq macro dst
beq dst
if (($ ^ dst) & $ff00) != 0
warn "Branch crossed page"
endif
endmCode: Select all
CONFIG8255: EQU $2003
PORTA : EQU $2000
PORTB : EQU $2001
PORTC : EQU $2002
ORG $FF00
reset:
LDA #$80
STA CONFIG8255
loop1:
LDA #$77
STA PORTA
STA PORTB
STA PORTC
JSR delay; delay here
LDA #$EC
STA PORTA
STA PORTB
STA PORTC
JSR delay; delay here
JMP loop1
delay:
back: LDX $FF
loopx: LDY $FF
loopy: DEY
BNE loopy
DEX
BNE loopx
RTSwbeq <address> e.g. wbeq loop1
It gives an error - unknown opcode <warn>
So among other things - Does Vasm assembler use another directive to print a console message? (I tried looking in the documentation)
And is my implementation of how to use this macro correct?
I also saw some info at:https://atariage.com/forums/topic/14764 ... ct-access/
What do you all out there do to avoid this issue - if using the older devices?
thanks all
regards
Russell