2016-12-06 02:11:21 -08:00
|
|
|
|
|
|
|
.MACRO Spin_Loop ARGS XCOUNT
|
|
|
|
|
|
|
|
ldx #XCOUNT
|
|
|
|
lvl3\@:
|
|
|
|
lda #$ff
|
|
|
|
lvl2\@:
|
|
|
|
xba
|
|
|
|
lda #$ff
|
|
|
|
lvl1\@:
|
|
|
|
dea
|
|
|
|
cmp #$00
|
|
|
|
bne lvl1\@
|
|
|
|
xba
|
|
|
|
dea
|
|
|
|
cmp #$00
|
|
|
|
bne lvl2\@
|
|
|
|
dex
|
|
|
|
txa
|
|
|
|
cmp #$00
|
|
|
|
bne lvl3\@
|
|
|
|
.ENDM
|
|
|
|
|
2016-12-07 01:13:29 -08:00
|
|
|
.MACRO Set_A_8_XY_16
|
|
|
|
; 16-bit xy, 8-bit a
|
|
|
|
rep #%00010000
|
|
|
|
sep #%00100000
|
|
|
|
.ENDM
|
2016-12-06 02:11:21 -08:00
|
|
|
|
|
|
|
.MACRO Reset_Palette_Offset
|
|
|
|
stz $2121
|
|
|
|
.ENDM
|
|
|
|
|
|
|
|
.MACRO Load_Palette_Color ARGS BYTE1 BYTE2
|
|
|
|
|
|
|
|
lda #BYTE1
|
|
|
|
sta $2122
|
2016-12-15 20:14:46 -08:00
|
|
|
lda #BYTE2
|
|
|
|
sta $2122
|
2016-12-06 02:11:21 -08:00
|
|
|
|
|
|
|
.ENDM
|
2016-12-06 02:51:01 -08:00
|
|
|
|
|
|
|
.MACRO Set_Screen_Brightness
|
|
|
|
lda #\1
|
2016-12-07 01:13:29 -08:00
|
|
|
sta $2100 ; $2100 is the screen brightness register
|
2016-12-07 10:41:33 -08:00
|
|
|
.ENDM
|
|
|
|
|
|
|
|
.MACRO Enable_NMI_And_Joypad
|
|
|
|
lda #%10000001
|
|
|
|
sta $4200
|
2016-12-06 02:51:01 -08:00
|
|
|
|
|
|
|
.ENDM
|
2016-12-15 00:01:32 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; loads, in a loop, an alternating grid of tiles
|
|
|
|
.MACRO Tile_Load_Loop
|
|
|
|
|
|
|
|
ldx #$0400 ; load $0400 (VRAM address of tile data)
|
|
|
|
TileLoadLoop:
|
|
|
|
|
|
|
|
stx $2116 ; store VRAM address of tile data to VRAM address word-sized register
|
|
|
|
|
|
|
|
lda #$01 ; smile tile
|
|
|
|
sta $2118 ;store tile map entry to the address specified in $2116 - this increments or not based on 2115
|
|
|
|
|
|
|
|
inx
|
|
|
|
stx $2116
|
|
|
|
|
|
|
|
lda #$00 ; blank tile
|
|
|
|
sta $2118
|
|
|
|
|
|
|
|
inx
|
|
|
|
|
|
|
|
cpx #$0780 ; $400 - $780 seems to be limit of snes screen tile memory
|
|
|
|
bne TileLoadLoop
|
|
|
|
|
|
|
|
.ENDM
|