Optimizations: sla a -> add a, a

This commit is contained in:
Randy Thiemann 2023-11-13 03:09:57 +01:00
parent 304a5f739b
commit 932666b5bb
8 changed files with 4996 additions and 4996 deletions

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -103,7 +103,7 @@ BlitField::
REPT 7
; Wait until start of drawing, then insert nops.
: ldh a, [rSTAT]
or a, ~STATF_LCD
or a, $FF - STATF_LCD
inc a
jr nz, :-
REPT 40
@ -160,7 +160,7 @@ BigBlitField::
REPT 7
; Wait until start of drawing, then insert nops.
: ldh a, [rSTAT]
or a, ~STATF_LCD
or a, $FF - STATF_LCD
inc a
jr nz, :-
REPT 40
@ -310,10 +310,10 @@ FromShadowField:
; corresponding to that piece's zero rotation.
SetPieceData:
ldh a, [hCurrentPiece]
sla a
sla a
sla a
sla a
add a, a
add a, a
add a, a
add a, a
ld c, a
ld b, 0
@ -336,8 +336,8 @@ SetPieceData:
; The rotation state is a further offset of 4 bytes.
SetPieceDataOffset:
ldh a, [hCurrentPieceRotationState]
sla a
sla a
add a, a
add a, a
ldh [hPieceDataOffset], a
ret
@ -989,8 +989,8 @@ FieldProcess::
ldh a, [hPieceDataBase+1]
ld h, a
ldh a, [hWantRotation]
sla a
sla a
add a, a
add a, a
push bc
ld c, a
xor a, a
@ -1070,8 +1070,8 @@ FieldProcess::
ldh a, [hPieceDataBaseFast+1]
ld h, a
ldh a, [hWantRotation]
sla a
sla a
add a, a
add a, a
push bc
ld c, a
xor a, a
@ -1110,8 +1110,8 @@ FieldProcess::
ldh a, [hPieceDataBaseFast+1]
ld h, a
ldh a, [hWantRotation]
sla a
sla a
add a, a
add a, a
push bc
ld c, a
xor a, a
@ -1159,8 +1159,8 @@ FieldProcess::
ldh a, [hPieceDataBaseFast+1]
ld h, a
ldh a, [hWantRotation]
sla a
sla a
add a, a
add a, a
push bc
ld c, a
xor a, a
@ -1221,8 +1221,8 @@ FieldProcess::
ldh a, [hPieceDataBaseFast+1]
ld h, a
ldh a, [hWantRotation]
sla a
sla a
add a, a
add a, a
push bc
ld c, a
xor a, a
@ -1266,8 +1266,8 @@ FieldProcess::
ldh a, [hPieceDataBaseFast+1]
ld h, a
ldh a, [hWantRotation]
sla a
sla a
add a, a
add a, a
push bc
ld c, a
xor a, a
@ -1312,8 +1312,8 @@ FieldProcess::
ldh a, [hPieceDataBaseFast+1]
ld h, a
ldh a, [hWantRotation]
sla a
sla a
add a, a
add a, a
push bc
ld c, a
xor a, a
@ -2559,10 +2559,10 @@ BigFromShadowField:
; corresponding to that piece's zero rotation.
BigSetPieceData:
ldh a, [hCurrentPiece]
sla a
sla a
sla a
sla a
add a, a
add a, a
add a, a
add a, a
ld c, a
ld b, 0
@ -2585,8 +2585,8 @@ BigSetPieceData:
; The rotation state is a further offset of 4 bytes.
BigSetPieceDataOffset:
ldh a, [hCurrentPieceRotationState]
sla a
sla a
add a, a
add a, a
ldh [hPieceDataOffset], a
ret
@ -3238,8 +3238,8 @@ BigFieldProcess::
ldh a, [hPieceDataBase+1]
ld h, a
ldh a, [hWantRotation]
sla a
sla a
add a, a
add a, a
push bc
ld c, a
xor a, a
@ -3319,8 +3319,8 @@ BigFieldProcess::
ldh a, [hPieceDataBaseFast+1]
ld h, a
ldh a, [hWantRotation]
sla a
sla a
add a, a
add a, a
push bc
ld c, a
xor a, a
@ -3359,8 +3359,8 @@ BigFieldProcess::
ldh a, [hPieceDataBaseFast+1]
ld h, a
ldh a, [hWantRotation]
sla a
sla a
add a, a
add a, a
push bc
ld c, a
xor a, a
@ -3408,8 +3408,8 @@ BigFieldProcess::
ldh a, [hPieceDataBaseFast+1]
ld h, a
ldh a, [hWantRotation]
sla a
sla a
add a, a
add a, a
push bc
ld c, a
xor a, a
@ -3469,8 +3469,8 @@ BigFieldProcess::
ldh a, [hPieceDataBaseFast+1]
ld h, a
ldh a, [hWantRotation]
sla a
sla a
add a, a
add a, a
push bc
ld c, a
xor a, a
@ -3514,8 +3514,8 @@ BigFieldProcess::
ldh a, [hPieceDataBaseFast+1]
ld h, a
ldh a, [hWantRotation]
sla a
sla a
add a, a
add a, a
push bc
ld c, a
xor a, a
@ -3560,8 +3560,8 @@ BigFieldProcess::
ldh a, [hPieceDataBaseFast+1]
ld h, a
ldh a, [hWantRotation]
sla a
sla a
add a, a
add a, a
push bc
ld c, a
xor a, a

View File

@ -824,9 +824,9 @@ GetSection::
; Multiply by 10, which is equal to multiply by 8 + multiply by 2
ld b, a
sla b
sla a
sla a
sla a
add a, a
add a, a
add a, a
add a, b
; Add hundreds.
@ -854,9 +854,9 @@ GetAdjustedSection::
; Multiply by 10, which is equal to multiply by 8 + multiply by 2
ld b, a
sla b
sla a
sla a
sla a
add a, a
add a, a
add a, a
add a, b
; Add hundreds.

View File

@ -296,7 +296,7 @@ ApplyNext::
ldh a, [hUpcomingPiece1]
ld [wSPRQueue1A+3], a
ld [wSPRQueue1B+3], a
sla a
add a, a
add a, TILE_PIECE_SMALL_0
ld [wSPRQueue1A+2], a
inc a
@ -305,7 +305,7 @@ ApplyNext::
ldh a, [hUpcomingPiece2]
ld [wSPRQueue2A+3], a
ld [wSPRQueue2B+3], a
sla a
add a, a
add a, TILE_PIECE_SMALL_0
ld [wSPRQueue2A+2], a
inc a

View File

@ -636,8 +636,8 @@ TitleVBlankHandlerB:
; RNG mode.
ld b, 0
ld a, [wRNGModeState]
sla a
sla a
add a, a
add a, a
ld c, a
ld hl, sRNGMode
add hl, bc
@ -650,8 +650,8 @@ TitleVBlankHandlerB:
; ROT mode.
ld b, 0
ld a, [wRotModeState]
sla a
sla a
add a, a
add a, a
ld c, a
ld hl, sROTMode
add hl, bc
@ -664,8 +664,8 @@ TitleVBlankHandlerB:
; DROP mode.
ld b, 0
ld a, [wDropModeState]
sla a
sla a
add a, a
add a, a
ld c, a
ld hl, sDROPMode
add hl, bc
@ -678,8 +678,8 @@ TitleVBlankHandlerB:
; CURVE mode.
ld b, 0
ld a, [wSpeedCurveState]
sla a
sla a
add a, a
add a, a
ld c, a
ld hl, sCURVEMode
add hl, bc
@ -698,8 +698,8 @@ TitleVBlankHandlerB:
xor a, a
ld b, a
ld a, [wAlways20GState]
sla a
sla a
add a, a
add a, a
ld c, a
ld hl, sHIGMode
add hl, bc
@ -785,8 +785,8 @@ TitleVBlankHandlerB:
; RNG mode.
ld b, 0
ld a, [wRNGModeState]
sla a
sla a
add a, a
add a, a
ld c, a
ld hl, sRNGMode
add hl, bc
@ -799,8 +799,8 @@ TitleVBlankHandlerB:
; ROT mode.
ld b, 0
ld a, [wRotModeState]
sla a
sla a
add a, a
add a, a
ld c, a
ld hl, sROTMode
add hl, bc
@ -813,8 +813,8 @@ TitleVBlankHandlerB:
; DROP mode.
ld b, 0
ld a, [wDropModeState]
sla a
sla a
add a, a
add a, a
ld c, a
ld hl, sDROPMode
add hl, bc
@ -827,8 +827,8 @@ TitleVBlankHandlerB:
; CURVE mode.
ld b, 0
ld a, [wSpeedCurveState]
sla a
sla a
add a, a
add a, a
ld c, a
ld hl, sCURVEMode
add hl, bc
@ -847,8 +847,8 @@ TitleVBlankHandlerB:
xor a, a
ld b, a
ld a, [wAlways20GState]
sla a
sla a
add a, a
add a, a
ld c, a
ld hl, sHIGMode
add hl, bc
@ -867,8 +867,8 @@ TitleVBlankHandlerB:
.buttons
ld b, 0
ld a, [wSwapABState]
sla a
sla a
add a, a
add a, a
ld c, a
ld hl, sBUTTONSMode
add hl, bc
@ -881,8 +881,8 @@ TitleVBlankHandlerB:
.filter
ld b, 0
ldh a, [hFilterMode]
sla a
sla a
add a, a
add a, a
ld c, a
ld hl, sFilterMode
add hl, bc
@ -1661,8 +1661,8 @@ RenderScores:
; Draw the mode.
: ld b, 0
ld a, [wSelected]
sla a
sla a
add a, a
add a, a
ld c, a
ld hl, sCURVEMode
add hl, bc