.segment "code"
; VMEM map
- ; 0000: tilemap for BG1 (32x32 4bpp: 512b)
+ ; 0000: tilemap for BG1 (32x32 word tile refs, 2kb)
; 2048: BG3-base (h/v offsets)
; 8192: tile data (16k)
vmem_tiles_offs = 4096 ; 4k words
vmem_voffs_offs = vmem_hoffs_offs + 32
sei
+ ; get out of 6502 emulation mode
clc
xce
+ ; initialize stack
I16
ldx #$1fff
txs
ldx ncol
bne @per_tile_offs
; global scroll for the first column
- ;sta REG_BG1VOFS
sta vscroll
- ;stz REG_BG1VOFS
bra @end
@per_tile_offs:
asl
tax ; x = ncol << 1
pla
- ;sta REG_VMDATAL
- ;lda #$20 ; enable for BG1
- ;sta REG_VMDATAH
sta shadow_voffs,x
inx
lda #$20
A16
jmp mainloop
- ; copy_vmem(vmem_offset, src, num_words)
+ ; copy_vmem(vmem_offset, src, num_bytes)
copy_vmem:
rep #$30 ; 16bit accumulator and index registers
.a16
; $3 return address
; $5 vmem_offs
; $7 src
- ; $9 num_words
+ ; $9 num_bytes
lda #$80 ; auto incerment after wiriting high byte
sta REG_VMAINC