TomHarte / CLK

A latency-hating emulator of: the Acorn Electron and Archimedes, Amstrad CPC, Apple II/II+/IIe and early Macintosh, Atari 2600 and ST, ColecoVision, Enterprise 64/128, Commodore Vic-20 and Amiga, MSX 1/2, Oric 1/Atmos, early PC compatibles, Sega Master System, Sinclair ZX80/81 and ZX Spectrum.
MIT License
931 stars 52 forks source link

Add an inaccurate, basic Archimedes. #1355

Closed TomHarte closed 5 months ago

TomHarte commented 7 months ago

Archimedes objective: a high-level CPU emulation with low-level emulated support components. At least as a first step.

Additionally cleans up several compiler warnings for CI platforms.

Included ARM fixes:

* since I'm trying to maintain an implementation separation between my version of ARM operations and any specific ARM implementation I want this to be codified separately rather than flowing naturally from the ARM2's pipeline.

TomHarte commented 6 months ago

Noting that current CI failures appear to be a brew installation failure; taking them as transient for the time being.

TomHarte commented 6 months ago

Noting that I've reduced coverage of the scons/SDL build on macOS because brew seems no longer to succeed at installing the necessary dependencies. Since I don't really intend to support SDL build on the Mac I'm not too displeased about this.

TomHarte commented 6 months ago

This finally, finally seems to get across the line of the emulated machine setting up meaningful VIDC[/IOC] parameters — non-black colours and address bounds. So it's probably time to head into actual video output next.

TomHarte commented 6 months ago

Not what one might hope for from first screen output, but it's a start.

Screenshot 2024-03-22 at 10 18 51
TomHarte commented 6 months ago

The emulator now proceeds to the command line, which on a real machine usually means the non-volatile RAM is misconfigured but I don't currently see any I2C reads so here probably means something else as well as that.

Regardless, the next step is probably to implement enough keyboard activity to get typing, hopefully allowing me to launch BASIC and the desktop.

Screenshot 2024-03-22 at 22 00 27
TomHarte commented 6 months ago

Noting that even with a seemingly fully-working keyboard (i.e. empirically it never gets into a position where it requests a reset, and one is never requested of it) and some minor initial frame-synchronisation issues ironed out, I now seem to be stuck at:

Screenshot 2024-03-23 at 20 34 06

i.e. none of the star commands actually seems to work.

TomHarte commented 6 months ago

With the MEMC changes just in, the Archimedes now passes its power-on self-test, i.e. it doesn't feel the need to report any of the following:

RISC OS boot

Sadly boot still hangs; having wilfully corrupted the CMOS RAM in order to get the supervisor prompt and switched to RISC OS 3.11 because *BASIC works from there, I see a bunch of oddities that — best guess — suggest issues still lurking in my ARM.

TomHarte commented 6 months ago

Switching my guess about carry after use of an unshifted immediate means that the emulator — which currently has a bug causing slightly shimmering pixels in high-resolution mode (i.e. whenever it uses more than one pixel buffer in a line) that I've yet seriously to diagnose — now gets to:

Screenshot 2024-04-01 at 21 36 34

German is my second language but I've no idea why what should be the default CMOS values are seemingly producing German, and it's a safe guess that's not the proper SWI number regardless.

TomHarte commented 6 months ago

Just the briefest bit of research reveals that RISC OS 3.19 was just the German-language version of RISC OS 3.11. Even though I read German moderately well, I've switched to English; at least I can say that there wasn't an invalid detection of locale or anything like that.

Screenshot 2024-04-01 at 21 43 50

... and, as an aside: having a much more functional supervisor prompt allows me to perform a *COMMANDS and finally cause the machine to attempt to access the floppy drive. So I've an avenue to get that last piece of the original system into play, which will probably be my cut-off for merging — i.e. when remaining fixes are likely to be small and localised.

TomHarte commented 6 months ago

Without the time immediately to act on it, I think the meaningless-SWI issue is likely block data transfers:

Combine that with the somewhat hacky way I've ensured STMs obey the rule that "write back affects what is output only if it isn't the first thing to be output" and it's not a surprise that the weird SWI looks currently like a simple improper jump. The immediately preceding code is:

ldm sp!, {r0, r1, r2, r3, r4, r5, r6, r7, r8, sb, sl, fp, ip, sp, lr} ^
mov r0, r0
ldm sp!, {pc} ^

So my current belief is: given that the processor is in supervisor mode, the first should load user registers r0–14 from the stack and then update the supervisor stack pointer; the mov r0, r0 is possibly a pipeline pause to allow for the register mode to switch back?, and then the final ldm should load the PC from the updated supervisor stack register.

As currently written, the initial stack pointer load will overwrite whatever was loaded into the user stack pointer with an improper write back of the modified supervisor stack pointer, then switch back to the previous pointer. So it's doing two things wrong.

TomHarte commented 6 months ago

... and that's a desktop:

Screenshot 2024-04-04 at 22 03 18

Big todos:

TomHarte commented 5 months ago

Surprisingly, that seemed just to work:

Clock Signal Screen Shot 08-04-2024, 21 22 59 GMT-4

So, off the top of my head, definite outstanding issues:

TomHarte commented 5 months ago

With the cursor still not appearing correctly over the borders but now always correctly positioned on the display, I think I'm happy to say that adding audio is the sole remaining item before I merge this to master and start dealing with dangling issues as follow-ups.