RetroChallenge 2024/10 reflections
I started this year's project with a challenge from an old Sharp Users Club magazine.
"Who on earth would want to emulate an MZ-80K ... ?"
We do hobbies for enjoyment and to learn something - about the subject matter, ourselves or both. So I want to answer the "why" question by answering two different questions - did I enjoy the experience and what did I learn? I think this is a useful way of judging the success or otherwise of the last month.
Did I enjoy RetroChallenge?
Very much so. I enjoyed the problems the project posed and working through my "to do" list. Speaking of which, here's what my original list looks like at the end of this month.
| Item | 1st October Status | 31st October Status | Notes |
|---|---|---|---|
| Implement a file handling solution for retrieving and storing MZ tape files (.mzf format) from/to SD card. | 0% | 100% | Found, learned about and implemented the FatFs library to support the emulator. |
| Complete βtapeβ reading functions. | 60% | 100% | Integrated what I had already written to read a hardcoded .mzf file to read any .mzf file from SD card. |
| Implement 'tape' writing functions. | 0% | 100% | Worked out how to deal with a quirk of the MZ-80K where it's monitor tried to read a tape before starting to write to it! |
| Complete USB keyboard to MZ-80K keyboard mappings. | 60% | 100% | I wasn't 60% complete at the start of the month as I found I needed two different mappings depending on whether keyboard input was from a real keyboard or through a terminal emulator. |
| /VBLANK and /VGATE implementation. | 50% | 100% | Not difficult to accomplish. |
| Implement sound chip. | 0% | 100% | As this is just a tone generator it was surprisingly straightforward once I'd figured out how the pulse width modulator on the Pico worked. |
| Implement a creative use for the bottom 40 raster lines of the screen that are not required by the actual emulation. | 0% | 100% | I'm rather pleased with my virtual tape counter, although I've already thought of a way to improve it! |
| Rationalise code comments. | 50% | 100% | The rubber duck was very helpful. Hopefully others think this is well-commented code. |
| Write / collate programmer and user documentation for the emulator. | 0% | 100% | I have more than sufficient for the v1.0.0 release, but documentation, like code, is never really finished. |
| Pico over clocking to replicate the 2MHz Z80 as accurately as possible. | 75% | 100% | A moving target as the code developed, but satisfactory in v1.0.0 |
| Thoroughly test emulator with machine code, BASIC and other programs, document what works! | 0% | 100% | Fun! I even found an early example of erotic (?!) ASCII art, but I'm not going to say in which program I found it! |
| Z80 core code review and corrections. | 75% | 100% | Rubber duck approved. |
| Migrate from Pico SDK 1.5.1 to 2.0.0 | 0% | 90% | The code works, but for some reason around 8% more slowly. It's also far less stable. I'm going to wait until the next version of the Pico SDK is released before migrating fully. |
| First release packaging. | 0% | 100% | It's all there at https://github.com/psychotimmy/picomz-80k/ for your enjoyment. |
I also managed one of my "release 2" goals, to implement a fast memory save / load capability.
Just as important as the "to do" list was enjoying seeing other people working on their projects and following their progress. An unexpected bonus was finding other people who were enjoying what I did too - although as I was enjoying other people's work I guess this shouldn't have been unexpected!
What did I learn?
Lots of things, but perhaps the most significant were:
- How to write programs for the Pico. It's more challenging than I thought it was going to be, mostly due to the lack of documented and/or commented examples of how to use the various features of the impressively extensive sdk and associated libraries. Simply pointing novice Pico programmers like me at undocumented examples and suggesting that they 'read the code' is unhelpful. This seems to be a general issue with a lot of code today. I want the Pico MZ-80K to buck this trend!
- A lot about the internal workings of the MZ-80K. I may have owned one for more than 40 years, but it's only when you start to write an emulator and things don't work quite as you expect, that you begin to appreciate the design challenges faced and overcome by the original engineers - hardware and software.
- That my decision to stop writing code for a living in about 1997 and move into consultancy/sales/marketing roles was fully justified, given the patchy standard of the code I've written! I still have time to improve I guess π
- That I have found my tribe. Thank you to everyone who has encouraged me with Mastodon comments, likes and boosts along the way.
What next?
A short break from writing emulator code, so that I can explore more of the contemporary MZ-80K software catalogue, and, of course, preparing a gift-wrapped version!
And there's always Advent of Code to look forward to in a month's time π
1st November 2024
... and of course, as soon as you finalise a release you find a bug! There's an issue with some (but not all) machine code games picking up keyboard presses. I think I know where the problem may be ...
Developing software and painting the Forth Bridge have more in common than you'd think.
2nd November 2024
I've improved this (the change also improves the responsiveness of BASIC games like Road-Shooter and Duck Shoot), but the solution isn't perfect. But I'm not going to let that be the enemy of the good.
Release 1.0.1 has escaped!
5th November 2024
... as did 1.0.2, to be replaced rapidly by 1.0.3. I did say that I was going to take a break from all this :D