LDH where possible.
This commit is contained in:
parent
ac28205be4
commit
91d99e45f4
BIN
DMGTRIS.GB
BIN
DMGTRIS.GB
Binary file not shown.
|
@ -667,10 +667,10 @@ FieldProcess::
|
||||||
|
|
||||||
|
|
||||||
; Check if we're about to hold.
|
; Check if we're about to hold.
|
||||||
ld a, [hSelectState]
|
ldh a, [hSelectState]
|
||||||
cp a, 1
|
cp a, 1
|
||||||
jr nz, :+
|
jr nz, :+
|
||||||
ld a, [hHoldSpent]
|
ldh a, [hHoldSpent]
|
||||||
cp a, $FF
|
cp a, $FF
|
||||||
ret nz
|
ret nz
|
||||||
|
|
||||||
|
@ -746,14 +746,14 @@ FieldProcess::
|
||||||
; We check rotation first.
|
; We check rotation first.
|
||||||
; Want rotate CCW?
|
; Want rotate CCW?
|
||||||
.wantrotccw
|
.wantrotccw
|
||||||
ld a, [hSwapAB]
|
ldh a, [hSwapAB]
|
||||||
cp a, 0
|
cp a, 0
|
||||||
jr z, .ldb1
|
jr z, .ldb1
|
||||||
.lda1
|
.lda1
|
||||||
ld a, [hAState]
|
ldh a, [hAState]
|
||||||
jr .cp1
|
jr .cp1
|
||||||
.ldb1
|
.ldb1
|
||||||
ld a, [hBState]
|
ldh a, [hBState]
|
||||||
.cp1
|
.cp1
|
||||||
cp a, 1
|
cp a, 1
|
||||||
jr nz, .wantrotcw
|
jr nz, .wantrotcw
|
||||||
|
@ -766,14 +766,14 @@ FieldProcess::
|
||||||
|
|
||||||
; Want rotate CW?
|
; Want rotate CW?
|
||||||
.wantrotcw
|
.wantrotcw
|
||||||
ld a, [hSwapAB]
|
ldh a, [hSwapAB]
|
||||||
cp a, 0
|
cp a, 0
|
||||||
jr z, .lda2
|
jr z, .lda2
|
||||||
.ldb2
|
.ldb2
|
||||||
ld a, [hBState]
|
ldh a, [hBState]
|
||||||
jr .cp2
|
jr .cp2
|
||||||
.lda2
|
.lda2
|
||||||
ld a, [hAState]
|
ldh a, [hAState]
|
||||||
.cp2
|
.cp2
|
||||||
cp a, 1
|
cp a, 1
|
||||||
jp nz, .norot
|
jp nz, .norot
|
||||||
|
@ -1101,7 +1101,7 @@ GetTileShade:
|
||||||
jp z, .max2
|
jp z, .max2
|
||||||
ret
|
ret
|
||||||
.max30
|
.max30
|
||||||
ld a, [hCurrentLockDelayRemaining]
|
ldh a, [hCurrentLockDelayRemaining]
|
||||||
cp a, 4
|
cp a, 4
|
||||||
ret c
|
ret c
|
||||||
cp a, 8
|
cp a, 8
|
||||||
|
@ -1118,7 +1118,7 @@ GetTileShade:
|
||||||
jp c, .s1
|
jp c, .s1
|
||||||
jp .s0
|
jp .s0
|
||||||
.max25
|
.max25
|
||||||
ld a, [hCurrentLockDelayRemaining]
|
ldh a, [hCurrentLockDelayRemaining]
|
||||||
cp a, 3
|
cp a, 3
|
||||||
ret c
|
ret c
|
||||||
cp a, 6
|
cp a, 6
|
||||||
|
@ -1135,7 +1135,7 @@ GetTileShade:
|
||||||
jp c, .s1
|
jp c, .s1
|
||||||
jp .s0
|
jp .s0
|
||||||
.max20
|
.max20
|
||||||
ld a, [hCurrentLockDelayRemaining]
|
ldh a, [hCurrentLockDelayRemaining]
|
||||||
cp a, 2
|
cp a, 2
|
||||||
ret c
|
ret c
|
||||||
cp a, 5
|
cp a, 5
|
||||||
|
@ -1152,7 +1152,7 @@ GetTileShade:
|
||||||
jp c, .s1
|
jp c, .s1
|
||||||
jp .s0
|
jp .s0
|
||||||
.max18
|
.max18
|
||||||
ld a, [hCurrentLockDelayRemaining]
|
ldh a, [hCurrentLockDelayRemaining]
|
||||||
cp a, 2
|
cp a, 2
|
||||||
ret c
|
ret c
|
||||||
cp a, 4
|
cp a, 4
|
||||||
|
@ -1169,7 +1169,7 @@ GetTileShade:
|
||||||
jp c, .s1
|
jp c, .s1
|
||||||
jp .s0
|
jp .s0
|
||||||
.max16
|
.max16
|
||||||
ld a, [hCurrentLockDelayRemaining]
|
ldh a, [hCurrentLockDelayRemaining]
|
||||||
cp a, 2
|
cp a, 2
|
||||||
ret c
|
ret c
|
||||||
cp a, 4
|
cp a, 4
|
||||||
|
@ -1186,7 +1186,7 @@ GetTileShade:
|
||||||
jp c, .s1
|
jp c, .s1
|
||||||
jp .s0
|
jp .s0
|
||||||
.max14
|
.max14
|
||||||
ld a, [hCurrentLockDelayRemaining]
|
ldh a, [hCurrentLockDelayRemaining]
|
||||||
cp a, 2
|
cp a, 2
|
||||||
ret c
|
ret c
|
||||||
cp a, 4
|
cp a, 4
|
||||||
|
@ -1203,7 +1203,7 @@ GetTileShade:
|
||||||
jp c, .s1
|
jp c, .s1
|
||||||
jp .s0
|
jp .s0
|
||||||
.max12
|
.max12
|
||||||
ld a, [hCurrentLockDelayRemaining]
|
ldh a, [hCurrentLockDelayRemaining]
|
||||||
cp a, 1
|
cp a, 1
|
||||||
ret c
|
ret c
|
||||||
cp a, 3
|
cp a, 3
|
||||||
|
@ -1220,7 +1220,7 @@ GetTileShade:
|
||||||
jp c, .s1
|
jp c, .s1
|
||||||
jp .s0
|
jp .s0
|
||||||
.max10
|
.max10
|
||||||
ld a, [hCurrentLockDelayRemaining]
|
ldh a, [hCurrentLockDelayRemaining]
|
||||||
cp a, 1
|
cp a, 1
|
||||||
ret c
|
ret c
|
||||||
cp a, 2
|
cp a, 2
|
||||||
|
@ -1237,7 +1237,7 @@ GetTileShade:
|
||||||
jr c, .s1
|
jr c, .s1
|
||||||
jr .s0
|
jr .s0
|
||||||
.max8
|
.max8
|
||||||
ld a, [hCurrentLockDelayRemaining]
|
ldh a, [hCurrentLockDelayRemaining]
|
||||||
cp a, 1
|
cp a, 1
|
||||||
ret c
|
ret c
|
||||||
cp a, 2
|
cp a, 2
|
||||||
|
@ -1254,7 +1254,7 @@ GetTileShade:
|
||||||
jr c, .s1
|
jr c, .s1
|
||||||
jr .s0
|
jr .s0
|
||||||
.max6
|
.max6
|
||||||
ld a, [hCurrentLockDelayRemaining]
|
ldh a, [hCurrentLockDelayRemaining]
|
||||||
cp a, 1
|
cp a, 1
|
||||||
ret c
|
ret c
|
||||||
cp a, 2
|
cp a, 2
|
||||||
|
@ -1267,14 +1267,13 @@ GetTileShade:
|
||||||
jr c, .s1
|
jr c, .s1
|
||||||
jr .s0
|
jr .s0
|
||||||
.max4
|
.max4
|
||||||
ld a, [hCurrentLockDelayRemaining]
|
ldh a, [hCurrentLockDelayRemaining]
|
||||||
cp a, 1
|
cp a, 1
|
||||||
ret c
|
ret c
|
||||||
cp a, 2
|
cp a, 2
|
||||||
jr c, .s4
|
jr c, .s4
|
||||||
jr .s0
|
jr .s0
|
||||||
.max2
|
.max2
|
||||||
ld a, [hCurrentLockDelayRemaining]
|
|
||||||
jr .s4
|
jr .s4
|
||||||
.s0
|
.s0
|
||||||
ldh a, [hCurrentPiece]
|
ldh a, [hCurrentPiece]
|
||||||
|
@ -1495,7 +1494,7 @@ FindClearedLines:
|
||||||
|
|
||||||
|
|
||||||
MarkClear:
|
MarkClear:
|
||||||
ld a, [hClearedLines]
|
ldh a, [hClearedLines]
|
||||||
cp a, $FF
|
cp a, $FF
|
||||||
ret z
|
ret z
|
||||||
ld hl, wField+(24*10)
|
ld hl, wField+(24*10)
|
||||||
|
@ -1508,7 +1507,7 @@ MarkClear:
|
||||||
ld d, TILE_CLEARING
|
ld d, TILE_CLEARING
|
||||||
call UnsafeMemSet
|
call UnsafeMemSet
|
||||||
|
|
||||||
ld a, [hClearedLines+1]
|
ldh a, [hClearedLines+1]
|
||||||
cp a, $FF
|
cp a, $FF
|
||||||
ret z
|
ret z
|
||||||
ld hl, wField+(24*10)
|
ld hl, wField+(24*10)
|
||||||
|
@ -1521,7 +1520,7 @@ MarkClear:
|
||||||
ld d, TILE_CLEARING
|
ld d, TILE_CLEARING
|
||||||
call UnsafeMemSet
|
call UnsafeMemSet
|
||||||
|
|
||||||
ld a, [hClearedLines+2]
|
ldh a, [hClearedLines+2]
|
||||||
cp a, $FF
|
cp a, $FF
|
||||||
ret z
|
ret z
|
||||||
ld hl, wField+(24*10)
|
ld hl, wField+(24*10)
|
||||||
|
@ -1534,7 +1533,7 @@ MarkClear:
|
||||||
ld d, TILE_CLEARING
|
ld d, TILE_CLEARING
|
||||||
call UnsafeMemSet
|
call UnsafeMemSet
|
||||||
|
|
||||||
ld a, [hClearedLines+3]
|
ldh a, [hClearedLines+3]
|
||||||
cp a, $FF
|
cp a, $FF
|
||||||
ret z
|
ret z
|
||||||
ld hl, wField+(24*10)
|
ld hl, wField+(24*10)
|
||||||
|
|
|
@ -263,7 +263,7 @@ LevelUp::
|
||||||
.leveljinglemaybe
|
.leveljinglemaybe
|
||||||
ldh a, [hPrevHundreds]
|
ldh a, [hPrevHundreds]
|
||||||
ld b, a
|
ld b, a
|
||||||
ld a, [hCLevel+1]
|
ldh a, [hCLevel+1]
|
||||||
cp a, b
|
cp a, b
|
||||||
jr z, .checkspeedup
|
jr z, .checkspeedup
|
||||||
ld a, SFX_LEVEL_UP
|
ld a, SFX_LEVEL_UP
|
||||||
|
|
|
@ -26,7 +26,7 @@ SECTION "Memory Functions", ROM0
|
||||||
; Copies data from de to hl, bc bytes
|
; Copies data from de to hl, bc bytes
|
||||||
UnsafeMemCopy::
|
UnsafeMemCopy::
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
ld [hli], a
|
ld [hl+], a
|
||||||
inc de
|
inc de
|
||||||
dec bc
|
dec bc
|
||||||
ld a, b
|
ld a, b
|
||||||
|
@ -39,7 +39,7 @@ UnsafeMemCopy::
|
||||||
SafeMemCopy::
|
SafeMemCopy::
|
||||||
wait_vram
|
wait_vram
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
ld [hli], a
|
ld [hl+], a
|
||||||
inc de
|
inc de
|
||||||
dec bc
|
dec bc
|
||||||
ld a, b
|
ld a, b
|
||||||
|
|
|
@ -49,11 +49,11 @@ RNGInit::
|
||||||
|
|
||||||
; Initialize the next history.
|
; Initialize the next history.
|
||||||
ld a, PIECE_Z
|
ld a, PIECE_Z
|
||||||
ld [hPieceHistory], a
|
ldh [hPieceHistory], a
|
||||||
ld [hPieceHistory+1], a
|
ldh [hPieceHistory+1], a
|
||||||
ld a, PIECE_S
|
ld a, PIECE_S
|
||||||
ld [hPieceHistory+2], a
|
ldh [hPieceHistory+2], a
|
||||||
ld [hPieceHistory+3], a
|
ldh [hPieceHistory+3], a
|
||||||
|
|
||||||
; Get the first piece and make sure it's not Z, S or O.
|
; Get the first piece and make sure it's not Z, S or O.
|
||||||
: call NextPiece
|
: call NextPiece
|
||||||
|
|
|
@ -110,7 +110,7 @@ SwitchToGameplay::
|
||||||
|
|
||||||
GamePlayEventLoopHandler::
|
GamePlayEventLoopHandler::
|
||||||
; What mode are we in?
|
; What mode are we in?
|
||||||
ld a, [hMode]
|
ldh a, [hMode]
|
||||||
cp MODE_LEADY
|
cp MODE_LEADY
|
||||||
jr z, leadyMode
|
jr z, leadyMode
|
||||||
cp MODE_GO
|
cp MODE_GO
|
||||||
|
@ -230,11 +230,11 @@ fetchPieceMode:
|
||||||
call SFXEnqueue
|
call SFXEnqueue
|
||||||
|
|
||||||
.checkIRSB
|
.checkIRSB
|
||||||
ld a, [hSwapAB]
|
ldh a, [hSwapAB]
|
||||||
cp a, 0
|
cp a, 0
|
||||||
jr z, .ldb2
|
jr z, .ldb2
|
||||||
.lda2
|
.lda2
|
||||||
ld a, [hAState]
|
ldh a, [hAState]
|
||||||
cp a, 0
|
cp a, 0
|
||||||
jr z, .checkJingle
|
jr z, .checkJingle
|
||||||
ld a, $FF
|
ld a, $FF
|
||||||
|
@ -253,7 +253,7 @@ fetchPieceMode:
|
||||||
call SFXEnqueue
|
call SFXEnqueue
|
||||||
|
|
||||||
.checkJingle
|
.checkJingle
|
||||||
ld a, [hSkipJingle]
|
ldh a, [hSkipJingle]
|
||||||
cp a, 0
|
cp a, 0
|
||||||
jr nz, .skipJingle
|
jr nz, .skipJingle
|
||||||
.playNextJingle
|
.playNextJingle
|
||||||
|
@ -292,10 +292,10 @@ pieceInMotionMode:
|
||||||
: call FieldProcess
|
: call FieldProcess
|
||||||
|
|
||||||
; Do we hold?
|
; Do we hold?
|
||||||
ld a, [hSelectState]
|
ldh a, [hSelectState]
|
||||||
cp a, 1
|
cp a, 1
|
||||||
jr nz, :+
|
jr nz, :+
|
||||||
ld a, [hHoldSpent]
|
ldh a, [hHoldSpent]
|
||||||
cp a, $FF
|
cp a, $FF
|
||||||
jr z, :+
|
jr z, :+
|
||||||
; Reset position and rotation.
|
; Reset position and rotation.
|
||||||
|
|
Loading…
Reference in New Issue