More testing code.

This commit is contained in:
Randy Thiemann 2023-10-17 07:59:54 +02:00
parent 75a916f370
commit b6a703e0b2
9 changed files with 85 additions and 4 deletions

View File

@ -108,6 +108,7 @@ DEF SFX_IRS EQU 7
DEF SFX_DROP EQU 8
DEF SFX_LOCK EQU 9
DEF SFX_BELL EQU 10
DEF SFX_MOVE EQU 11
ENDC

Binary file not shown.

Binary file not shown.

View File

@ -159,7 +159,8 @@ sfx_names = [
"sSFXIRS",
"sSFXDrop",
"sSFXLock",
"sSFXBell"
"sSFXBell",
"sSFXMove"
]
def chunks(lst, n):

View File

@ -832,3 +832,40 @@ sSFXBell::
db $FF, $FF, $FF, $FF, $FF, $FF, $FE
sSFXBellEnd::
sSFXMove::
db REG_NR42_CH4_VOLEV, $21, REG_NR41_CH4_LENGT, $3F, REG_NR42_CH4_VOLEV, $21, REG_NR43_CH4_FQRND, $00
db REG_NR44_CH4_CNTRL, $80, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
db $FF, $FF, $FE
sSFXMoveEnd::

View File

@ -572,6 +572,10 @@ sSFXBell::
db REG_NR22_CH2_VOLEV, $08, REG_NR23_CH2_FRQLO, $97, REG_NR24_CH2_FRQHI, $87, $FE
sSFXBellEnd::
sSFXMove::
db REG_NR42_CH4_VOLEV, $21, REG_NR41_CH4_LENGT, $3F, REG_NR42_CH4_VOLEV, $21, REG_NR43_CH4_FQRND, $00
db REG_NR44_CH4_CNTRL, $80, $FE
sSFXMoveEnd::
SECTION "SFX Variables", HRAM
@ -762,7 +766,7 @@ SFXEnqueue::
ret
: cp a, SFX_BELL
ret nz
jr nz, :+
ld a, LOW(sSFXBell)
ldh [hPlayhead], a
ld a, HIGH(sSFXBell)
@ -770,6 +774,15 @@ SFXEnqueue::
call SFXPlay
ret
: cp a, SFX_MOVE
ret nz
ld a, LOW(sSFXMove)
ldh [hPlayhead], a
ld a, HIGH(sSFXMove)
ldh [hPlayhead+1], a
call SFXPlay
ret
; This play routine must be called every frame.
SFXPlay::

View File

@ -160,6 +160,32 @@ fetchPieceMode:
spawnPieceMode:
; todo
ld a, [hUpState]
cp a, 1
jr nz, :+
ld a, MODE_FETCH_PIECE
ld [wMode], a
jp drawStaticInfo
: ld a, [hLeftState]
cp a, 1
jr z, :++
cp a, 12
jr nc, :+
ld a, [hRightState]
cp a, 1
jr z, :++
cp a, 12
jr nc, :+
jp drawStaticInfo
: ldh a, [hFrameCtr]
and %00000111
cp 4
jp nz, drawStaticInfo
: ld a, SFX_MOVE
call SFXEnqueue
jp drawStaticInfo
; Always draw the score, level, next piece, and held piece.
drawStaticInfo:

View File

@ -6,6 +6,7 @@ INCLUDE "globals.asm"
SECTION "Time Variables", HRAM
hFrameCtr:: ds 1
hEvenFrame:: ds 1
@ -13,11 +14,13 @@ SECTION "Time Functions", ROM0
TimeInit::
xor a, a
ldh [hEvenFrame], a
ldh [hFrameCtr], a
ret
HandleTimers::
ldh a, [hEvenFrame]
ldh a, [hFrameCtr]
inc a
ldh [hFrameCtr], a
and 1
ldh [hEvenFrame], a
ret

View File

@ -1,5 +1,5 @@
#Emulicious settings file
#Tue Oct 17 07:32:01 CEST 2023
#Tue Oct 17 07:59:30 CEST 2023
WindowEventViewerWindowHeight=861
WindowEventViewerWindowDivider=309
WindowMemoryTracerWindowY=631