Just to try it out I've been trying to translate the source code of fig-forth for 6502 to CA65. I've created a 6502 emulator with a NES-like memory map, but with RAM everywhere instead of ROM, and an extra IO port in the $4xxx area for reading from the keyboard and outputting to the console. The idea is that this emulator is the "developer cart", and after the forth code is finished, I will freeze the RAM into a ROM file with a tiny bit of reset code. I'm working on writing my own forth which uses a mix of subroutine threading and inline code, but I want to get fig forth running first.
The original source is here.
I don't know what assembler it was created for, but it's pretty straightforward. I've just had to add : for labels and convert ' into ". There are a couple lines I'm not sure how to handle:
Line 66:
I assume that this is basically
Line 93:
I understand the intent: the remaining code must be aligned correctly, because the indirect threaded interpreter invokes jump indirect on each address in the byte code. Does this mean that another .res 2 will give the right padding?
The original source is here.
I don't know what assembler it was created for, but it's pretty straightforward. I've just had to add : for labels and convert ' into ". There are a couple lines I'm not sure how to handle:
Line 66:
Code:
* = * + 2
I assume that this is basically
Code:
.res 2
?Line 93:
Code:
; The following offset adjusts all code fields to avoid an
; address ending $XXFF. This must be checked and altered on
; any alteration , for the indirect jump at W-1 to operate !
;
.ORIGIN *+2
; address ending $XXFF. This must be checked and altered on
; any alteration , for the indirect jump at W-1 to operate !
;
.ORIGIN *+2
I understand the intent: the remaining code must be aligned correctly, because the indirect threaded interpreter invokes jump indirect on each address in the byte code. Does this mean that another .res 2 will give the right padding?