Skip to content

[theNestruo] .rom directive not suitable for 48kB ROM #5

@ghost

Description

From: Libertium/asmsx-license-gpl#3


What steps will reproduce the problem?

  • Assemble the next source:
    .page 1
    .rom
    .size 48
    .start INIT
    .db "PAGE 1"
    INIT:
    ret

    .page 2
    .db "PAGE 2"

    .page 0
    .db "PAGE 0"
    ; EOF

What is the expected output?

  • Page 0 has no cartridge header
  • Page 1 has cartridge header ("AB" + INIT + padding up to 16 bytes)

What do you see instead?

  • Page 0 has no cartridge header, but bytes 3 and 4 are overwritten by INIT
  • Page 1 has cartridge header ("AB" + padding), but misses INIT

What version of the product are you using?

  • asMSX v0.16 WIP / v0.17 WiP.
    On what operating system?
  • Windows 7 Starter.

Please provide any additional information below.

  • Possible solution: .start directive should write INIT value where the .rom
    wrote the header, instead of 3rd/4th bytes of output file
    Bonus points:
  • As .rom directive is already locating the header at page 1, should it ensure
    there is no cartridge header at page 0? (is a ROM with cartridge header in page
    0 legal?)
  • Allow .rom directive to be preceeded by code, so the code can be in natural
    order: .page 0 / .page 1 / .rom / .page 2

Workaround:

  • (note that, as there is no .rom directive, output file extension is .z80
    instead of .rom):
    .size 48

    .page 0
    .db $00, $00 ; (ensure no ROM header in page 0)
    .db "PAGE 0"

    .page 1
    ROM_HEADER: ; (manual ROM header)
    .db "AB" ; ID ("AB")
    .dw INIT ; INIT
    .org ROM_HEADER +$10 ; STATEMENT, DEVICE, TEXT, Reserved
    .db "PAGE 1"
    INIT:
    ret

    .page 2
    .db "PAGE 2"
    ; EOF

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions