snes: validate all rep/sep setting register size

URGH I hate how they did this, and it would be nicer if it
had a better mnemonic.  I guess I could redefine myself.

anyway all of them should be proper now
This commit is contained in:
Vince Weaver 2013-02-05 16:07:02 -05:00
parent 5f10b61fa8
commit b61b08fa60
5 changed files with 45 additions and 34 deletions

View File

@ -1,2 +1,2 @@
.word $186d ; Complement of checksum .word $9ae ; Complement of checksum
.word $e792 ; Unsigned 16-bit sum of ROM .word $f651 ; Unsigned 16-bit sum of ROM

View File

@ -499,6 +499,8 @@ new_level:
;+ MAIN LEVEL1 LOOP + ;+ MAIN LEVEL1 LOOP +
;+ + ;+ +
;\========================/ ;\========================/
.a8
.i16
level1_loop: level1_loop:
@ -790,11 +792,35 @@ setup_enemy_defaults:
store_enemy_kind: store_enemy_kind:
; Xxxxxxxxx yyyyyyy cccccccc vhoo pppN
clc clc
adc #$60 ; Use pal2 enemies for now adc #$60 ; Use pal2 enemies for now
pha ; store type for later
; Y = $20+enemies
; want to store to $200 + (Y*4)
rep #$20 ; set A to 16-bit
.a16
tya ; copy Y to A
asl
asl ; multiply by 4
clc
adc #$200 ; add in $200
tax
sep #$20 ; set A back to 8-bit
.a8
pla ; restore A
sta $282 ; $200 + $20*4 + 2 sta $282 ; $200 + $20*4 + 2
; Xxxxxxxxx yyyyyyy cccccccc vhoo pppN
lda #$24 lda #$24
sta $283 ; noflip, pal2, priority=2 sta $283 ; noflip, pal2, priority=2
@ -2067,32 +2093,13 @@ level_print_loop:
lda star_scroll_h lda star_scroll_h
sta $2110 sta $2110
rep #$20 ; A/mem=16 bit rep #$20 ; A/mem=16 bit
.a16 .a16
dec star_scroll dec star_scroll
sep #$20 ; A/mem=8 bit sep #$20 ; A/mem=8 bit
.a8 .a8
; handle keypress
; lda joypad1
check_left:
; bit #$02
; beq check_right
; dec shipx
; bpl check_right
; stz shipx
check_right:
; bit #$01
; beq no_keypress
; inc shipx
;no_keypress:
;======================== ;========================
; update OAM ; update OAM
;======================== ;========================
@ -2107,7 +2114,7 @@ check_right:
done_game: done_game:
ldx #30 ; ldx #30
; jsr wait_X_100msec ; pause for 3 seconds ; jsr wait_X_100msec ; pause for 3 seconds
; bit KEYRESET ; clear keyboard ; bit KEYRESET ; clear keyboard
@ -2334,6 +2341,7 @@ level1_vblank:
php ; save status register php ; save status register
rep #$30 ; Set A/mem=16 bits, X/Y=16 bits (to push all 16 bits) rep #$30 ; Set A/mem=16 bits, X/Y=16 bits (to push all 16 bits)
.a16 ; tell assembler the A is 16-bits .a16 ; tell assembler the A is 16-bits
.i16
phb ; save b phb ; save b
pha ; save A pha ; save A
phx ; save X phx ; save X
@ -2348,7 +2356,7 @@ joypad_read:
and #$01 ; if joy is not ready and #$01 ; if joy is not ready
bne joypad_read ; wait bne joypad_read ; wait
rep #$20 rep #$20 ; A 16-bit
.a16 .a16
ldx joypad1_raw ; load previous raw value ldx joypad1_raw ; load previous raw value
@ -2367,7 +2375,7 @@ joypad_read:
and joypad1_raw ; find buttons being held and joypad1_raw ; find buttons being held
sta joypad1_held ; store held down buttons sta joypad1_held ; store held down buttons
sep #$20 sep #$20 ; A=8bit
.a8 .a8
@ -2385,6 +2393,7 @@ done_vblank:
rep #$30 ; A/Mem=16 bits, X/Y=16 bits rep #$30 ; A/Mem=16 bits, X/Y=16 bits
.a16 .a16
.i16
pld ; restore saved vaules from stack pld ; restore saved vaules from stack
ply ply
plx plx

View File

@ -100,7 +100,7 @@ display_opening:
; BG2 tile data starts at VRAM e000 ; BG2 tile data starts at VRAM e000
rep #$20 ; mem/A = 8 bit rep #$20 ; mem/A = 16 bit
.a16 .a16

View File

@ -148,8 +148,9 @@ ClearVRAM:
phx phx
php php
rep #$30 ; mem/A = 8 bit, X/Y = 16 bit rep #$10 ; X/Y = 16 bit
sep #$20 .i16
sep #$20 ; A = 8 bit
.a8 .a8
lda #$80 lda #$80
sta $2115 ; Set VRAM port to word access sta $2115 ; Set VRAM port to word access
@ -175,8 +176,9 @@ ClearVRAM:
ClearPalette: ClearPalette:
phx phx
php php
rep #$30 ; mem/A = 8 bit, X/Y = 16 bit rep #$10 ; X/Y = 16 bit
sep #$20 .i16
sep #$20 ; A = 8 bit
.a8 .a8
stz $2121 stz $2121
ldx #$0100 ldx #$0100

View File

@ -285,7 +285,7 @@ is_sprite_active:
php ; save status php ; save status
rep #$30 rep #$30 ; A=16bit X/Y=16bit
.i16 .i16
.a16 .a16
@ -312,7 +312,7 @@ is_sprite_active:
and $0400,Y ; sprite on screen when bit is 0 and $0400,Y ; sprite on screen when bit is 0
rep #$20 rep #$20 ; A=16 bit
.a16 .a16
beq sprite_is_active beq sprite_is_active