68K Emulator integration

The CPU update

At this point, Pukka had been working hard to update the 68K emulator to work with the new environment. With 64-bit support, cross-platform standard C and POSIX compatibility as requirements, we had already discussed how to interface the emulator with the virtual memory system.

First integration test

To make a simple test case for the 68K emulator, we created a short 68K assembly program which we wrote manually to the memory using the C code below, and ran the CPU:

First successful 68K emulator integration test

Quite simple test, but it not only displayed that the 68K emulator worked, but also that our trap dispatcher was also working as intended! Which meant that the calls from 68K to native C code worked, arguments got translated correctly, return value got transferred to 68K stack and it just…worked!

…Which was a bit ironic, as soon after this we noticed that we forgot to allocate space on stack for the return value of Random trap (0x558F = SUBQ.L #2,A7). The MOVEA._L -1,A0 and MOVE.L A0,-(A7) was supposed to put return address for RTS but somehow it worked! I guess we got lucky this time…