I'm new to the group but a long time 6502 enthusiast. (Although, admittedly, a bit rusty.)
I was cranking through Grant Searle's simple 6502 build:
http://searle.hostei.com/grant/6502/Simple6502.htmlI like the fact that it uses OSI BASIC--my first computer was an OSI C1P, my second a C4P-MF, and I worked my way through college doing hardware and software work mainly on OSI C3 machines. Now I want to scratch build a 6502 (actually probably a 65c816) machine.
In the OSI BASIC code, there is a section that reads:
Code:
ldx #TEMP1-FAC+1
L230B:
pla
sta FAC,x
inx
bmi L230B
I have been using 64tass and when I tried to assemble the code (after some edits to make it assemble), I am left with one error message that really troubled me:
Code:
pup_osi_bas.asm:588:17: error: can't convert to a 8 bit unsigned integer '-8'
ldx #TEMP1-FAC+1
^
At first, I assumed I had messed up something with the labels for the tables. But Grant provided the listing code, so eventually I decided to check that and found it had, indeed, put the "-8" in as the value of X which, in turn, was then used to index from label FAC.
Code:
00C236 1 A2 F8 ldx #TEMP1-FAC+1
00C238 1 L230B:
00C238 1 68 pla
00C239 1 95 AC sta FAC,x
00C23B 1 E8 inx
00C23C 1 30 FA bmi L230B
I can't find it explicitly, but so far as I can remember the indexing is strictly assuming the register is a value between 0 and 255, not -128 to 127.
Am I missing something or is there a deeper issue with that section of code that I need to dig into?
Any insight would be appreciated.
Thanks,
Jim W4JBM