Search code examples
intel-8080cpm

Building ROM images on CP/M


I'm trying to use the venerable M80 and L80 tools on CP/M to build a ROM image. (It's for a CP/M emulator, hence why I'm using CP/M tools.)

Unfortunately L80 seems to be really crude --- AFAICT it just loads each object file at its absolute address, fixes it up, and then dumps everything from 0x0100 up out to disk. This means that object files that are based at addresses outside its own workspace don't appear to work at all (just producing an error message). My ROM has a base address of 0xd000, which is well outside this.

Does anyone know if it's possible to use M80 and L80 to do this, and if so, how? Alternatively can anyone recommend (and point me at!) a CP/M assembler/linker suite that will?

(Note that I'd like to avoid cross compiling, if possible.)


Solution

  • If you're just assembling one file, then you can use M80's .phase directive to have the assembler locate the output.

      .phase 0D000h
    

    If you want to build several source files and link them at the end, then you can still use M80 but you'll need DRI's linker LINK.COM, which can be found in http://www.cpm.z80.de/download/pli80_13.zip. The LINK command line to use would be

    LINK result=module1,module2,module3[LD000
    

    (The nearest L80 equivalent would, I think, be

    L80 /P:D000,module1,module2,module3,result/N/E
    

    but then you have to remove 0xCF00 bytes from the start of the resulting file).