Hello!
I'm working on a "level switch room", I just load my background in this way:
everything works ok if I change the addressing from level_0_room_0 to level_0_room_1, but I need to do that dynamically but I don't know how. I tried to put "level_0_room_1" on an address but it seems it doesn't work.
So, what's the best way to put the address of a label "level_0_room_X" in a variable so I can load dynamically at run time?
Thanks!
I'm working on a "level switch room", I just load my background in this way:
Code:
level_0_room_0:
.db $30,$31,$30,$31,$30,$31,$30,$31,$30,$31,$30,$31,$30,$31,$30,$31
......
.db $40,$41,$40,$41,$40,$41,$40,$41,$40,$41,$40,$41,$40,$41,$40,$41
level_0_room_1:
.db $D0,$D1,$D0,$D1,$D0,$D1,$D0,$00,$01,$D1,$D0,$D1,$D0,$D1,$D0,$D1
......
.db $D0,$D1,$D0,$D1,$D0,$D1,$D0,$00,$01,$D1,$D0,$D1,$D0,$D1,$D0,$D1
lda #low( level_0_room_0 )
sta MATRIX_LVL_ROOM_ADDR + 0
lda #high( level_0_room_0 )
sta MATRIX_LVL_ROOM_ADDR + 1
.db $30,$31,$30,$31,$30,$31,$30,$31,$30,$31,$30,$31,$30,$31,$30,$31
......
.db $40,$41,$40,$41,$40,$41,$40,$41,$40,$41,$40,$41,$40,$41,$40,$41
level_0_room_1:
.db $D0,$D1,$D0,$D1,$D0,$D1,$D0,$00,$01,$D1,$D0,$D1,$D0,$D1,$D0,$D1
......
.db $D0,$D1,$D0,$D1,$D0,$D1,$D0,$00,$01,$D1,$D0,$D1,$D0,$D1,$D0,$D1
lda #low( level_0_room_0 )
sta MATRIX_LVL_ROOM_ADDR + 0
lda #high( level_0_room_0 )
sta MATRIX_LVL_ROOM_ADDR + 1
everything works ok if I change the addressing from level_0_room_0 to level_0_room_1, but I need to do that dynamically but I don't know how. I tried to put "level_0_room_1" on an address but it seems it doesn't work.
Code:
lda #low( level_0_room_0 )
sta ROOM_TO_LOAD + 0
lda #high( level_0_room_0 )
sta ROOM_TO_LOAD + 1
....
lda #low( ROOM_TO_LOAD )
sta MATRIX_LVL_ROOM_ADDR + 0
lda #high( ROOM_TO_LOAD )
sta MATRIX_LVL_ROOM_ADDR + 1
sta ROOM_TO_LOAD + 0
lda #high( level_0_room_0 )
sta ROOM_TO_LOAD + 1
....
lda #low( ROOM_TO_LOAD )
sta MATRIX_LVL_ROOM_ADDR + 0
lda #high( ROOM_TO_LOAD )
sta MATRIX_LVL_ROOM_ADDR + 1
So, what's the best way to put the address of a label "level_0_room_X" in a variable so I can load dynamically at run time?
Thanks!