menu progress (text engine)
This commit is contained in:
101
snes/text.a65
Normal file
101
snes/text.a65
Normal file
@@ -0,0 +1,101 @@
|
||||
.text
|
||||
#include "memmap.i65"
|
||||
print:
|
||||
rep #$30 : .xl : .al
|
||||
lda !print_x
|
||||
and #$00ff
|
||||
lsr
|
||||
bcs print_bg1
|
||||
ldx #!BG1_TILE_BUF ; for 2nd loop
|
||||
phx
|
||||
ldx #!BG2_TILE_BUF ; for 1st loop
|
||||
phx
|
||||
bra print_bg_cont
|
||||
print_bg1
|
||||
ldx #!BG2_TILE_BUF+1 ; for 2nd loop
|
||||
phx
|
||||
ldx #!BG1_TILE_BUF ; for 1st loop da whoop
|
||||
phx
|
||||
bra print_bg_cont
|
||||
print_bg_cont
|
||||
sta !print_x
|
||||
lda !print_y
|
||||
and #$00ff
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
asl
|
||||
clc
|
||||
adc !print_x
|
||||
asl ; double the offset for WRAM addressing
|
||||
tay ; zonday
|
||||
plx
|
||||
phy ; offset from tilemap start
|
||||
stx !print_x
|
||||
clc
|
||||
adc !print_x
|
||||
; we need to transfer to WRAM and from there to VRAM via DMA during VBLANK
|
||||
; because VRAM can only be accessed during VBLANK and forced blanking.
|
||||
sta $2181
|
||||
sep #$20 : .as
|
||||
lda #$7f ;we really only need the lsb. full bank for clarity
|
||||
sta $2183
|
||||
print_loop
|
||||
ldx !print_src
|
||||
lda !print_bank
|
||||
pha
|
||||
plb
|
||||
phx ; source addr
|
||||
print_loop_inner
|
||||
lda !0,x
|
||||
asl
|
||||
sta @$2180
|
||||
lda #$00
|
||||
adc #$00
|
||||
sta @$2180
|
||||
inx
|
||||
lda !0,x
|
||||
beq print_loop2
|
||||
inx
|
||||
lda !0,x
|
||||
beq print_loop2
|
||||
bra print_loop_inner
|
||||
print_loop2
|
||||
lda #$00
|
||||
pha
|
||||
plb
|
||||
rep #$30 : .al : .xl
|
||||
ply ; source addr
|
||||
iny
|
||||
pla ; offset from tilemap start
|
||||
plx ; other tilemap addr
|
||||
stx !print_x
|
||||
clc
|
||||
adc print_x ; tilemap+offset
|
||||
sta $2181
|
||||
tyx
|
||||
sep #$20 : .as
|
||||
lda print_bank
|
||||
pha
|
||||
plb
|
||||
print_loop2_inner
|
||||
lda !0,x
|
||||
asl
|
||||
sta @$2180
|
||||
lda #$00
|
||||
adc #$00
|
||||
sta @$2180
|
||||
inx
|
||||
lda !0,x
|
||||
beq print_end
|
||||
inx
|
||||
lda !0,x
|
||||
beq print_end
|
||||
bra print_loop2_inner
|
||||
print_end
|
||||
lda #$00
|
||||
pha
|
||||
plb
|
||||
rts
|
||||
|
||||
Reference in New Issue
Block a user