a6502 - an emulator in ARM assembly (for STM32F4Discovery)
Posted: Sun Jun 24, 2012 7:09 pm
Inspired by Chris' stm6502 project as announced here, I went ahead and built a similar project, but written in assembly.
The result is on github as the a6502 project - it has much the same flavour as stm6502, but runs a bit faster and is somewhat harder to code up enhancements. (However, it's quite possible to call C from assembly, so enhancements could be written in C.)
There are a few rough spots: decimal mode is not even attempted, and the four non-essential bits of the status register are not modelled. Both are feasible to fix.
On the 168MHz cpu found on the $15 STM32F4DISCOVERY, the emulated speed is about 18MHz. (Which adds a datapoint to the question raised here)
The only 'peripheral' available to the emulated software is serial i/o, over USB, initiated by use of the WDM opcode 42. The code patches supermon64, figforth and EhBASIC to use this mechanism (from a starting point of Chris' versions which are already modified to use LDA and STA absolute on address FFF0)
All the above three programs appear to work correctly, with the exception of EhBASIC's HEX$() function which needs decimal mode.
Any bugs or feedback, please let me know! And thanks to Chris for the inspiration.
Cheers
Ed
The result is on github as the a6502 project - it has much the same flavour as stm6502, but runs a bit faster and is somewhat harder to code up enhancements. (However, it's quite possible to call C from assembly, so enhancements could be written in C.)
There are a few rough spots: decimal mode is not even attempted, and the four non-essential bits of the status register are not modelled. Both are feasible to fix.
On the 168MHz cpu found on the $15 STM32F4DISCOVERY, the emulated speed is about 18MHz. (Which adds a datapoint to the question raised here)
The only 'peripheral' available to the emulated software is serial i/o, over USB, initiated by use of the WDM opcode 42. The code patches supermon64, figforth and EhBASIC to use this mechanism (from a starting point of Chris' versions which are already modified to use LDA and STA absolute on address FFF0)
All the above three programs appear to work correctly, with the exception of EhBASIC's HEX$() function which needs decimal mode.
Any bugs or feedback, please let me know! And thanks to Chris for the inspiration.
Cheers
Ed