Menu

How to have RAM/HEAP in page 0 and ROM/CODE in page 1?

bengalack
2024-12-07
2024-12-07
  • bengalack

    bengalack - 2024-12-07

    I'm on z80/MSX and try to have RAM in 0x0000-0x3FFF and ROM in 0x4000-07FFF

    I'm on SDCC 4.2 and I was trying this:
    sdcc --code-loc 0x4000 --data-loc 0x0000 -mz80 --no-std-crt0 empty_reverse_crt.rel ...

    I thought I had to place RAM before ROM in my CRT, so my empty_reverse_crt.s is like ( I have barely no idea what I'm doing here):

    .area _HEADER (ABS)
    .area _HEAP
    .area _DATA
    .area _HOME
    .area _GSINIT
    .area _GSFINAL
    .area _INITIALIZER
    .area _ROMDATA
    .area _INITIALIZED
    .area _CODE
    

    Also, there is no code in the CRT, no use of initializers.

    But, still, RAM is placed AFTER my code. Any tips?

     
    • Janko Stamenović

      My example needed data-loc non-zero: so --data-loc 0x1 worked as I wanted, as it was zero there, not. Also, just tangential: later, take care about the order of other areas later (that is relevant only if your compiled code uses them and you need specific placement, otherwise, you can ignore that).

       
      • bengalack

        bengalack - 2024-12-07

        Thank you so much! will test ASAP when back at the computer.

         
      • bengalack

        bengalack - 2024-12-07
         

        Last edit: bengalack 2024-12-07
      • bengalack

        bengalack - 2024-12-07

        Yes. Great. It works very well! No change from my normal crt.s file was needed either: no need to place .area _DATA or _HEAP in front of _CODE, it seems.

         
        👍
        2

Log in to post a comment.