News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

Unassembled CPC6128 Firmware Now Available

Started by Bread80, 15:46, 17 October 21

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bread80

I've been working recently to 'unassemble' the Amstrad ROMs (firmware and BASIC). 'Unassemble' meaning that I'm taking the existing commented disassemblies and turning them back into source code which can be modified and assembled back into functional code. Including assembly to a different target address.


The firmware portion is now available at https://github.com/Bread80/CPC6128-Firmware-Source


I'm hoping this will be a useful starting point for anyone who wants to build a modified CPC, including support for additional hardware, or to port the CPC's 'OS' to other Z80 based systems.


The BASIC code should be available in the next couple of weeks.

m_dr_m

Great work, thanks!


I'm likely to use this very neat modularisation when I'm ready to tackle: https://www.cpcwiki.eu/forum/applications/new-customisable-firmware-(lower-rom)/

robcfg


abalore


Golem13


Excellent work, very clean, which I applaud.
Thank you! :-*

Bread80

#5

And the BASIC is now uploaded https://github.com/Bread80/Amstrad-CPC-BASIC-Source


There's still much reverse engineering to do, mostly around the memory management and string handling stuff (also memory management  ;) ).


And you can't really expand it because there's no spare bytes in the ROM. So I'd like to split it across two ROMs, which means a lot of disentangling of command prompt and run-time code. But if you want so how BASIC does it's thing then it's worth a look, and I'd added quite a few notes in the readme to guide you.

pelrun

No spare bytes in the rom? What about that block of rst 0's hiding at the end of Errors.asm?  ;D

Bread80

Well, yes. I'm not entirely sure if they're there for a reason I've not discovered and they'll break something if I remove them, or if they're just padding so they could say they've filled up the ROM and claim their paycheck  ;D

pelrun

If it was filled with literally anything other than the "single byte reset" opcode, I'd agree. But it's the smartest choice for a byte to fill unused ROM space on the CPC, rather than 0x00 (which would act as a NOP-sled, executing whatever random code/data was at the end of the block) or 0xFF (which looks like RST #38, jumping to the interrupt vector instead.)
Any buggy code which manages to jump to that block will immediately reset the machine back to a good state.

zhulien

Quote from: pelrun on 04:37, 01 November 21
No spare bytes in the rom? What about that block of rst 0's hiding at the end of Errors.asm?  ;D


If you boot with Amstrad brand, you can likely use those other brand bytes. 

Bread80

The firmware ROM it's easy to free up some space - just delete the printer related stuff  ;D


BASIC ROM isn't so easy. You could delete functions you don't use, but many of the maths one are still used internally anyway.


In either case you could split some stuff off into another ROM, which I want to try and do, but calling between banks adds a lot of complexity.

Bread80

I've updated the BASIC repository with reverse engineering of the variables, DEF FNs and arrays storage areas plus a few other areas. https://github.com/Bread80/Amstrad-CPC-BASIC-Source
There's now an example program which walks the variables/DEF FNs/arrays storage areas - see the Examples folder.
And I've written an article describing how the variables/DEF FNs/arrays storage areas function at http://bread80.com/2021/11/20/variables-def-fn-definitions-and-arrays-storage-in-amstrad-cpc-locomotive-basic/

Powered by SMFPacks Menu Editor Mod