@@ -5174,7 +5174,7 @@ gfx_RotateScaleSprite:
5174
5174
; sinf = _SineTable[angle] * 128 / scale;
5175
5175
ld a , (ix + 12 ) ; angle
5176
5176
call calcSinCosSMC
5177
- push hl ; ld (ix - 3), _smc_dsrs_sinf_1_plus_offset_ix
5177
+ push hl ; ld (ix - 3), _smc_dsrs_sinf_1_plus_offset_ix
5178
5178
; ld (_smc_dsrs_sinf_1_plus_offset_ix),hl ; write smc
5179
5179
5180
5180
; The previous code does ~HL instead of -HL. Unsure if intentional.
@@ -5210,12 +5210,12 @@ gfx_RotateScaleSprite:
5210
5210
5211
5211
; carry is cleared here
5212
5212
ld de , (ix - 6 ) ; dsrs_dys_0
5213
- sbc.s hl , de ; make sure UHL is zero
5214
- ld (iy + (_smc_dsrs_size128_1_minus_dys_0 - _smc_dsrs_base_address)) , hl ; write smc
5213
+ sbc hl , de
5214
+ push hl ; ld (ix - 12), _smc_dsrs_size128_1_minus_dys_0
5215
5215
add hl , de ; restore HL
5216
5216
ld de , (ix - 9 ) ; dsrs_dyc_0
5217
5217
add hl , de
5218
- ld (iy + (_smc_dsrs_size128_0_plus_dyc_0 - _smc_dsrs_base_address)) , hl ; write smc
5218
+ push hl ; ld (ix - 15), _smc_dsrs_size128_0_plus_dyc_0
5219
5219
; carry might be set, but that shouldn't matter for rl c
5220
5220
5221
5221
ld a , b
@@ -5240,7 +5240,7 @@ gfx_RotateScaleSprite:
5240
5240
ld a , d
5241
5241
add a , l
5242
5242
ld d , a
5243
- ld hl , (ix - 3 )
5243
+ ld hl , (ix - 3 ) ; _smc_dsrs_sinf_1_plus_offset_ix
5244
5244
or a , a
5245
5245
sbc.s hl , de ; make sure UHL is zero
5246
5246
ld (iy + (_smc_dsrs_sinf_1_plus_offset_ix - _smc_dsrs_base_address)) , hl
@@ -5268,29 +5268,34 @@ gfx_RotateScaleSprite:
5268
5268
ld iy , (ix + 9 ) ; sprite storing to
5269
5269
ld b , c
5270
5270
ld (iy + 0 ) , bc
5271
- lea de , iy + 2
5272
5271
5272
+ ; by popping these off the stack in a werid way, we can reduce SMC useage
5273
+
5274
+ pop ix ; _smc_dsrs_size128_0_plus_dyc_0
5275
+ pop de ; _smc_dsrs_size128_1_minus_dys_0
5273
5276
pop hl ; smc = dxc start
5274
- pop ix ; smc = dxs start
5275
5277
5276
- ex ( sp ) , iy ; pop reg24 \ push iy
5278
+ ; ys = (dxc - dys) + (size * 128)
5279
+ add hl , de ; HL = (dxc - dys) + (size * 128)
5277
5280
5278
- ld iyh , c ; size * scale / 64
5281
+ pop de ; smc = dxs start
5279
5282
5280
- ld bc , $ 000000 ; xs = (dxs + dyc) + (size * 128)
5281
- _smc_dsrs_size128_0_plus_dyc_0 := $ - 3
5282
- _smc_dsrs_base_address := _smc_dsrs_size128_0_plus_dyc_0
5283
- add ix , bc ; de = (dxs + dyc) + (size * 128)
5283
+ ; xs = (dxs + dyc) + (size * 128)
5284
+ add ix , de ; IX = (dxs + dyc) + (size * 128)
5284
5285
5285
- ld bc , $ 000000 ; ys = (dxc - dys) + (size * 128)
5286
- _smc_dsrs_size128_1_minus_dys_0 := $ - 3
5287
- add hl , bc ; hl = (dxc - dys) + (size * 128)
5286
+ lea de , iy + 2
5287
+
5288
+ ex ( sp ) , iy ; pop reg24 \ push iy
5289
+
5290
+ ld iyh , c ; size * scale / 64
5288
5291
5292
+ ; UBC was set to zero from mlt bc awhile back
5289
5293
jr drawSpriteRotateScale_Begin
5290
5294
;-------------------------------------------------------------------------------
5291
5295
_yloop:
5292
5296
ld bc , $ 000000 ; smc = cosf
5293
5297
_smc_dsrs_cosf_1_plus_offset_hl := $ - 3
5298
+ _smc_dsrs_base_address := _smc_dsrs_cosf_1_plus_offset_hl
5294
5299
add hl , bc ; dxc += cosf
5295
5300
5296
5301
ld bc , $ 000000 ; smc = sinf
0 commit comments