Log in

No account? Create an account
penrose orange



cat /var/log/stephen >/dev/eyes

Previous Entry Share Next Entry
penrose orange
It's been all quiet on this LiveJournal lately; my free time has been occupied with Z80 assembly language. I've been writing a tape loader for the ZX Spectrum. It's a totally different mindset from the business programming I do for my day job, and I'm enjoying it a lot, despite not being very good at it (yet?)

I've put some demo videos on my Google Drive. They may or may not play directly from there, but you can download them.

"standard_loader.mp4" demonstrates a test screen being loaded by the Spectrum's standard tape loader. "47loader_simple_demo.mp4" shows my loader doing the equivalent. You can hear that it sounds quite different to the standard loader; this is partly because it's faster, and partly because the data stream is encoded xor 0x90 (i.e. bits 4 and 7 of each byte are toggled: zeros are represented by ones in the data stream and vice-versa). This has the effect of breaking up long runs of zeros that are quite common, and gives the loader a busier, slightly harsher sound that I like a lot; it's a deliberate attempt to imitate the sound of the Speedlock loader that was used on a lot of games.

"47loader_direction_demo.mp4" shows the loader changing direction mid-load: it loads the pixels backwards but the colours forwards. This is quite easy to do. "47loader_ldir_demo.mp4" is a touch trickier: without missing a beat, the loader loads the colours first, off-screen, then copies them into the video RAM so they appear instantly, then the pixels are loaded directly into the video RAM. It's harder than it looks because copying 768 bytes takes a finite amount of time, but the tape doesn't stop moving; so a tiny delay has to be inserted, then the loader has to resynchronize with the data stream before resuming the load.

I'm documenting my progress in a thread on the World of Spectrum forums. This is my first attempt in a while to join an online community, and I seem to be fitting right in, even though I'm splashing around in the shallow end compared with some of the coders there. One of the chaps has kindly been trying my code on a real Spectrum; having done all my testing so far in the ideal environment of an emulator with a virtual tape, the initial results with a real tape were... not promising. But I'll get there!

  • 1
I've honestly never considered doing any kind of low-level work in anything approaching a professional capacity. I'm not convinced I have any kind of talent for it; all I'm doing in Z80 is playing around compared with what some of the guys on World of Spectrum are capable of.

I do find it quite fascinating, though.

Part of me wants to go further in retro assembly, to the point that I'm able to genuinely contribute to the Spectrum scene in some way; the rest of me is quite overwhelmed by the prospect. I think my risk-averse side is going to win, it usually does.

This afternoon's project was a small but genuinely useful mod for one of my favourite games.


  • 1