Well, another weekend and another chance to work on the project. I made some upgrades, but I may need some help to make sure I implemented everything properly. The first thing I did upgrade the emulation core. I can now service BRK interrupts, and added a few unimplemented opcodes. After that, I implemented the 65C02 instruction set. However, as my code-fu is quite week, I was wondering if anyone can look over the emulation core code just to make sure I implemented it correctly. Here is a list of what has changed
6502 opcodes I implemented:
00 BRK (?)
6C JSR (ind) (?)
78 SEI
58 CLI
40 RTI
New 65C02 opcodes I implemented:
ADC (zp) #done
AND (zp) #done
CMP (zp) #done
EOR (zp) #done
LDA (zp) #done
ORA (zp) #done
SBC (zp) #done
STA (zp) #done
BIT imm #done(?)
BIT zp,X #done
BIT abs,X #done
DEC A #done
INC A #done
JMP (abs,X) #done(?)
BRA LABEL #done
PHX #done
PHY #done
PLX #done
PLY #done
STZ zp #done
STZ zp,X #done
STZ abs #done
STZ abs,X #done
TRB zp #done(???)
TRB abs #done(???)
TSB zp #done(???)
TSB abs #done(???)
If you notice, some of the opcodes have question marks after the #done. This means I'm not quite sure I implemented it properly and might need to have someone check if I botched it up. I also didn't implement the Rockwell-only 65C02 opcodes either.
The other big thing is I found a way to import a binary compiled with ca65 into the code so I can implement my own "rom" now. As a test case I created this program.
Code: Select all
bsout = $fc ; KERNAL ROM, output a character to current device.
.org $0200
ldx #0 ; Starting index 0 in X register.
printnext:
lda text,x ; Get character from string.
beq done ; If we read a 0 we're done.
sta bsout ; Output character.
inx ; Increment index to next character.
bne printnext ; Repeat if index doesn't overflow to 0.
done:
jmp done ; loop forever
.rodata
text:
.byte "Hello World!",0

I attached the new core... I hope it proves useful. Could use some feedback too. I'm one of the things I'm thinking of is moving the "hardware" registers out of the zero page and putting them at 0x200. I also may add the ability to read/write to the 4k EEPROM in the system as well.
