RGBDS "data" segment
Page 1 of 1

Author:  slembcke [ Sun Oct 21, 2018 9:48 am ]
Post subject:  RGBDS "data" segment

Is there any way to implement something like a "data" segment using RGBDS? Specificall, it would be really nice to define and declare data once and end up with a block in the ROM I can just memcpy into place. Not really a big deal, I'm just coming to a realization how handy that is in more sophisticated assemblers.

Author:  tepples [ Sun Oct 21, 2018 10:06 am ]
Post subject:  Re: RGBDS "data" segment

Upvote issue #274.

Author:  slembcke [ Sun Oct 21, 2018 4:58 pm ]
Post subject:  Re: RGBDS "data" segment

Hmm. Ok. Good to know I'm not the only one.

Author:  nitro2k01 [ Sun Nov 18, 2018 2:17 pm ]
Post subject:  Re: RGBDS "data" segment

I've solved this by having a bunch of macros that cover all relevant instructions.

;; Relocated code macros
JPR:   MACRO      ; Relocated jump absolute
   jp   \1+(RCODE-RCODE_S)

JPRC:   MACRO      ; Relocated jump absolute conditional
   jp   \1,\2+(RCODE-RCODE_S)

CALLR:   MACRO      ; Relocated call
   call   \1+(RCODE-RCODE_S)

CALLRC:   MACRO      ; Relocated call conditional
   call   \1,\2+(RCODE-RCODE_S)

LDHLR:   MACRO      ; Relocated ld   HL,addr
   ld   HL,\1+(RCODE-RCODE_S)

LDBCR:   MACRO      ; Relocated ld   BC,addr
   ld   BC,\1+(RCODE-RCODE_S)

LDDER:   MACRO      ; Relocated ld   DE,addr
   ld   DE,\1+(RCODE-RCODE_S)

LDAR:   MACRO      ; Relocated ld   A,[addr]
   ld   A,[\1+(RCODE-RCODE_S)]

DWR:   MACRO      ; Relocated dw   addr
   DW   \1+(RCODE-RCODE_S)

STAR:   MACRO      ; Relocated ld   [addr],A
   ld   [\1+(RCODE-RCODE_S)],A

        ld      HL,RCODE_S    ; Src
        ld      BC,(RCODE_S_END-RCODE_S)    ; Size
        ld      DE,RCODE        ; Dest
        call    COPYPROC




Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group