Add a spin loop that does something

Namely, poke register $2100 to set the brightness
This commit is contained in:
greg 2016-12-04 03:16:15 -08:00
parent 3a4cca2c33
commit a5c3313651

View File

@ -5,6 +5,30 @@
.org 0
.section "Vblank"
.MACRO Spin_Loop ARGS XCOUNT
; it is fucktarded that this macro doesn't work properly with immediates
;ldx XCOUNT
ldx #$04
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
VBlank:
rti
@ -118,7 +142,7 @@ stx $2118 ;data for VRAM write register
; set up the screen
lda #%00110000 ; 16x16 tiles, mode 0
sta $2105
sta $2105 ; $2105 is the mode for bg mode + tile size
lda #%01000000 ; data starts from $4000
sta $2107 ; for bg1
@ -152,19 +176,20 @@ sta $2100
lda #%10000001 ; enable NMI and joypads
sta $4200
Spin_Loop
;sep #$30 ; get 8-bit registers
;stz $2121 ; write to CGRAM from $0
;lda #%10000000 ; this is
;ldx #%00111100 ; a green color
;sta $2122 ; write it
;stx $2122 ; to CGRAM
;lda #%00001111 ; turn on screen
;sta $2100 ; here
lda #%00000011
sta $2100
mainloop:
Spin_Loop
lda #%00000011
sta $2100
Spin_Loop
lda #$0f
sta $2100
jmp mainloop
.ENDS