horo
Experienced Member
- Joined
- Jan 22, 2025
- Messages
- 86
While working on the WozMon for the Z80-MBC2, I wondered how many methods there are for generating an Intel HEX file from CP/M source code – apart from the obvious options (Linux: zasm -uw --target=ram -x wozmon.z80 -o wozmon.hex – it also handles undocumented opcodes such as LD A,IXL) and (CP/M: z80asm wozmon/fh – which only handles the documented ones and needs macros to add the undocs), I ended up with the CP/M variant zsm4 wozmon,wozmon=wozmon.z80, which understands undocumented opcodes but generates a wozmon.rel file.
OK, so how do I create a HEX file from that?
Microsoft L80 is supposed to be able to generate HEX (l80 wozmon/n/x/e), but always reports
DR’s link80 and SLR’s slrnk do not generate HEX.
Right, what does the (MS or DR) REL format look like? Let’s ask the AI. My current go-to, DeepSeek, is having an incredibly hard time finding the specification and is spitting out URLs (→404) and non-existent documents – so what does the market leader, ChatGPT, have to say? It finds the specs straight away, but can’t put together anything that can even remotely analyse a REL file; it can’t even manage to work out the name of the module when I pointed it to the relevant part of the spec.
Deepseek, on the other hand, when fed the spec and womon.rel attached as a hexdump, delivered a rel2hex.py that created an almost perfect HEX file (only with 0x100 offset to the addresses; the LLM apparently had it ‘in the back of its mind’ that CP/M always starts at 100h.) It also ‘optimised’ away three data bytes preset with 00 at the end of the program; apparently, the ‘idea’ of padded sectors came into play there.
After my two hints, rel2hex ran smoothly and produced a HEX file identical to the zasm and z80asm results. Also the handling of ASEG, CSEG, DSEG was ok.
Not bad at all.
Why would anyone do something like this? In the course of my computer archaeology, I am constantly amazed at how much functionality can be crammed into so few bytes, which are then processed at a snail’s pace by a processor that is practically mathematically illiterate.
Sometimes I think the upcoming generation should look at these oldie Z80s and learn to walk before they start running.
OK, so how do I create a HEX file from that?
Microsoft L80 is supposed to be able to generate HEX (l80 wozmon/n/x/e), but always reports
Code:
Link-80 3.44 09-Dec-81 Copyright (c) 1981 Microsoft
?Nothing Loaded
*
Right, what does the (MS or DR) REL format look like? Let’s ask the AI. My current go-to, DeepSeek, is having an incredibly hard time finding the specification and is spitting out URLs (→404) and non-existent documents – so what does the market leader, ChatGPT, have to say? It finds the specs straight away, but can’t put together anything that can even remotely analyse a REL file; it can’t even manage to work out the name of the module when I pointed it to the relevant part of the spec.
Deepseek, on the other hand, when fed the spec and womon.rel attached as a hexdump, delivered a rel2hex.py that created an almost perfect HEX file (only with 0x100 offset to the addresses; the LLM apparently had it ‘in the back of its mind’ that CP/M always starts at 100h.) It also ‘optimised’ away three data bytes preset with 00 at the end of the program; apparently, the ‘idea’ of padded sectors came into play there.
After my two hints, rel2hex ran smoothly and produced a HEX file identical to the zasm and z80asm results. Also the handling of ASEG, CSEG, DSEG was ok.
Not bad at all.
Why would anyone do something like this? In the course of my computer archaeology, I am constantly amazed at how much functionality can be crammed into so few bytes, which are then processed at a snail’s pace by a processor that is practically mathematically illiterate.
Sometimes I think the upcoming generation should look at these oldie Z80s and learn to walk before they start running.