vhelin / wla-dx

WLA DX - Yet Another GB-Z80/Z80/Z80N/6502/65C02/65CE02/65816/68000/6800/6801/6809/8008/8080/HUC6280/SPC-700/SuperFX Multi Platform Cross Assembler Package
Other
546 stars 98 forks source link

1 byte CP/M program generating 63KB .com file #591

Closed Kroc closed 1 year ago

Kroc commented 1 year ago

I'm not sure how to output only the bytes assembled, rather than the entire "ROM".

This is a minimal Z80 CP/M program. Code always starts at $0100. The amount of space available varies from system to system but it is not likely to be more than 60K.

.MEMORYMAP
    DEFAULTSLOT 0
    ; RUNCPM 60K, BDOS @ $FD00, BIOS @ $FE00
    SLOT 0 START $0100 SIZE $FD00-$0100 NAME "TPA"
.ENDME

.ROMBANKSIZE $FD00-$0100
.ROMBANKS 1

.BANK 0 SLOT "TPA"
.ORG $0100
    ret

When I assemble this I'm getting a 63KB ".com" binary. How to output only the bytes assembled?

vhelin commented 1 year ago

WLA DX targets mostly platforms where everything is put into ROM banks. Like multiples of 16KBs etc. But you can use -b with WLALINK to output "programs". Programs, in this context, are pieces of occupied ROM banks. So define the .MEMORYMAP etc. like usual, covering the whole system's memory. Then give -b for WLALINK to get out only the piece of "ROM BANK" where code/data is put.

If the program file requires headers etc., what -t CBMPRG for WLALINK would do, then we'll need to add support for such header/platform.

Kroc commented 1 year ago

Ah, thank you for the reminder! I'm wondering if some auto-detection could be done for output file names ending in ".com" for CP/M binaries and ".prg" (with header) /".seq" (without header) for CBM files?

vhelin commented 1 year ago

I have to admit that I don't know that much about different target platforms that I could say that such autodetection would be possible. Maybe multiple platforms share a .prg file postfix? Anyway, if you want support for new headers for new platforms, please submit a specific issue!