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