Menu

#3088 sdldgb produces invalid files for objects that contain _CODE_N and _DATA_N areas.

open
gbz80 (9)
GBZ80
5
2022-03-05
2020-07-17
Tony Pavlov
No

SDLDGB produces invalid files for objects that contain _CODE_N and _DATA_N areas. Generating of rom files with MAKEBIN utility was artificially limited to 32K in it's code. Banked code support is fixed in z80 port and is usable, but the problem with the linker remains.

Here is a description, what is wrong with the linker exactly and what should be done to bring sdldgb back to life.

Offsets generated by sdldgb inside _CODE_N areas are invalid, because all _CODE_N areas are concatenated to _CODE, instead of having 0x4000 as base address for each _CODE_N area. If you try to workaround that by specifying 0x4000 for every _CODE_N in commandline, then the code and constant data of different _DATA_N areas simply become overwritten in the resulting file.

The same problem is also with _DATA_N areas which are concatenated with _DATA. Base address for every _DATA_N must be 0xA000 instead.

How that should work:

  1. Every _CODE_N area must have the same base address == 0x4000 (rom banks are mapped from 0x4000).
  2. _CODE_N position in ihx file should be at N * 0x4000
  3. Every _DATA_N must have the same base address == 0xA000 (ram banks are mapped from 0xA000).
  4. There is also a minor bug: https://sourceforge.net/p/sdcc/bugs/3004/ related with (3): -baN switch does not make global variables to be generated in _DATA_N area (we have a workaround with __addressmod for now, but that is not correct).
  5. artificial limit for 32k roms only in makebin utility should be removed

Discussion

  • Sebastian Riedel

    I gonna to try if I can teach makebin to handle virtual addresses -> https://sourceforge.net/p/sdcc/support-requests/115/

     
  • Sebastian Riedel

    • labels: --> gbz80
    • assigned_to: Sebastian Riedel
     
  • Sebastian Riedel

    That should be fully fixed by now

     

Log in to post a comment.

Monday.com Logo