Porting FIG Forth 6502 to ca65 and UK101
Posted: Mon Mar 30, 2026 3:09 pm
I recently bought a single board clone of a UK101 (I owned an original OSI C1E which was the donor for the clone).
I've ported what I believe to be an original listing of FIG Forth v1.1 (bugs and all) to ca65.
Code is here:https://github.com/v6ops/FIG-Forth-UK101/tree/UK101
This works as far as I can tell on the hardware UK101, but not on the run6502 simulator library. I'm probably doing something wrong there. It prompts and echos the line, but doesn't seem to exec (CR/LF issues??).
Q1. I had to add an extra line to BRAN: to get that working, because the branch offsets weren't being calculated correctly.
Was anyone else impacted by this?
L89 .BYTE $86,'BRANC',$C8
.WORD L75 ; link to EXCECUTE
BRAN .WORD *+2
; Y reg looks undefined. Assume Bug.
LDY #0 ; set offset to IP to 0. Doesn't change C bit.
; end
CLC
LDA (IP),Y
ADC IP
PHA
INY
LDA (IP),Y
ADC IP+1
STA IP+1
PLA
STA IP
JMP NEXT +2
;
Q2. Any idea why the hardware code runs, but the emulated code doesn't? I' normally expect the other way on.
Thanks
I've ported what I believe to be an original listing of FIG Forth v1.1 (bugs and all) to ca65.
Code is here:https://github.com/v6ops/FIG-Forth-UK101/tree/UK101
This works as far as I can tell on the hardware UK101, but not on the run6502 simulator library. I'm probably doing something wrong there. It prompts and echos the line, but doesn't seem to exec (CR/LF issues??).
Q1. I had to add an extra line to BRAN: to get that working, because the branch offsets weren't being calculated correctly.
Was anyone else impacted by this?
L89 .BYTE $86,'BRANC',$C8
.WORD L75 ; link to EXCECUTE
BRAN .WORD *+2
; Y reg looks undefined. Assume Bug.
LDY #0 ; set offset to IP to 0. Doesn't change C bit.
; end
CLC
LDA (IP),Y
ADC IP
PHA
INY
LDA (IP),Y
ADC IP+1
STA IP+1
PLA
STA IP
JMP NEXT +2
;
Q2. Any idea why the hardware code runs, but the emulated code doesn't? I' normally expect the other way on.
Thanks