Replace some REPT with FOR Loops

Apply dannye suggestion
This commit is contained in:
vulcandth 2022-05-12 19:40:16 -05:00
parent 30fadfdd4c
commit fe12beaeb0
5 changed files with 25 additions and 39 deletions

View File

@ -1,12 +1,8 @@
MACRO macro_9800
DEF x = 0
rept \1
DEF y = 0
rept $100 / \1
db (x + y) & $ff
DEF y = y + \1
FOR X, \1
FOR Y, 0, $100, \1
db (X + Y) & $ff
endr
DEF x = x + 1
endr
endm

View File

@ -543,19 +543,17 @@ Func_f8d5: ; 0xf8d5
ret
AddBigBCD6: ; 0xf902
DEF x = 0
rept 6
FOR X, 6
ld a, [de]
if x == 0
add [hl]
else
adc [hl]
endc
DEF x = x + 1
if X == 0
add [hl]
else
adc [hl]
endc
daa
ld [hli], a
inc de
endr
ENDR
ret
PointsPerPokemonCaught: ; 0xf921

View File

@ -83,20 +83,18 @@ AddBigBCD6FromQueue: ; 0x8588
ld b, $1
asm_8592:
push hl
DEF x = 0
rept 6
FOR X, 6
ld a, [de]
if x == 0
add [hl]
else
adc [hl]
endc
if X == 0
add [hl]
else
adc [hl]
endc
daa
ld [de], a
inc de
inc hl
DEF x = x + 1
endr
ENDR
ld a, e
cp wAddScoreQueueEnd % $100
jr nz, .okay

View File

@ -3301,16 +3301,12 @@ BottomRightBonusStageCollisionMasks:
; These two squares data arrays must be aligned to $100 bytes and appear contiguously.
SquaresLow:
DEF x = 0
rept 256
db (x * x) % $100
DEF x = x + 1
endr
FOR X, 256
db (X * X) % $100
ENDR
SquaresHigh:
DEF x = 0
rept 256
db (x * x) / $100
DEF x = x + 1
endr
FOR X, 256
db (X * X) / $100
ENDR

View File

@ -131,8 +131,6 @@ EvensAndOdds:
; The first 128 bytes are the first 128 even numbers starting at 0.
; The next 128 bytes are the first 128 odd numbers starting at 1.
; The (a)th element is essentially what you'd get from rlca.
DEF x = 0
REPT 128
db x | ((x >> 7) & 1)
DEF x = x + 2
FOR X, 0, 256, 2
db X | ((X >> 7) & 1)
ENDR