Beyond the work on completing the
M65C02A project, I am working on these projects:
1) Cleaning up and adding to the M65C02 wiki
2) Completing the port of the Mak 8086 Pascal Compiler to the M65C02A
3) Working toward implementing an M65C02A assembler for Py65
4) Continuing to work on the MiniCPU-S
5) Converting the M65C02A and M16C5x (or on anycpu.org: M16C5x) into a Symmetrical Multi-Threaded (SMT) or Barrel processors
6) Doing a lot of study on computer architectures, programming languages, operating systems, etc.
7) Writing up the work that I've been doing the past few years in a blog on FPGARelated
I expect to release something on the M65C02A version of the Mak Pascal compiler soon. I'm in the process of completing the code generator modules/functions. I do this in small steps. Professor Mak has provided a number of reference programs that he used to test his compiler. I am slowly building up the code generator with these programs in order to get the fundamentals correct, and then add in some of the more advanced functions that may finally require me to complete the design and implement the co-processor module for the M65C02A.
I have added to instructions to support the operations required by the Pascal compiler:
The xma instruction exchanges memory with the accumulator. The location is a 16-bit offset from the stack pointer. It specifically addresses a problem I encountered processing arguments for a subtraction operation when the left and right operands are in the wrong order on the stack because of the left to right evaluation of expressions performed by the recursive descent Mak Pascal compiler. XMA is more general purpose, and can be used to easily implement FORTH stack operations.
The adj instruction adds a signed immediate value (which defaults to 8-bits, but can be extended to 16-bits) to the system stack pointer. The instruction provides an easy way to remove the parameters and local variables allocated on the stack by a procedure/function. Instead of supporting the Pascal stack clean up mechanism where the procedure/function cleans up the stack, I decided it would be more appropriate to support the C stack clean up mechanism: the caller cleans up the stack. The 8086 subroutine return instruction provides direct support for the stack frame clean up, but I did not want to add anymore temporary registers to the core in order to support the Pascal stack frame clean up mechanism directly.
I have three (maybe four) unused/reserved opcodes remaining in the instruction set map of the M65C02A. I may use one of these opcodes to implement a second Load Effective Address (LEA) instruction. The first lea instruction is the M65C02A PSH #imm16 instruction (otherwise known as the '816 PEA #imm16 instruction), but this instruction only supports the Load Effective Address mechanism for global, level 1 variables and constants. Within Pascal, the address of most variables is relative to the stack frame base pointer. The frequent use of the 8086 lea instruction for this case means that there is a significant amount of code (or subroutine calls) to compute the effective address of variables at different levels in the stack. Therefore, I am thinking of implementing an lea bp,B instruction with support for 8-bit or 16-bit offsets. For a memory restricted processor like the 6502/65C02, it makes some sense that the local variable space within a subroutine/function will be less than 128 16-bit memory locations. But if the microprogram memory is available, I'll try and provide a more general solution by supporting 8-bit and 16-bit offsets.
Another operation not directly supported by the 6502/65C02 is negation. Unary minus operations are not the frequent, so this would be a nice to have instruction. Finally, I've had to add php/plp instructions around the accumulator load instructions that set up the boolean values used for logical tests. I may think about adding a load instruction that does not modify the processor status word to simplify the construction of the boolean test results in the accumulator.