@@ -2709,31 +2709,30 @@ gfx_TransparentSprite:
2709
2709
push ix ; save ix sp
2710
2710
call _ClipCoordinates
2711
2711
jr nc , .culled
2712
+ ; iyl = new width (next)
2713
+ ; iyh = new height
2712
2714
ld (.amount) , a
2713
- ld a , c ; new width
2714
- ld (.next) , a
2715
- ld ixh , b ; new height
2716
- ld b , 0
2717
2715
.transparent_color := $ + 1
2718
2716
ld a , TRASPARENT_COLOR
2719
2717
smcByte _TransparentColor
2720
2718
wait_quick
2721
2719
. loop :
2722
- ld c , 0
2723
- .next := $ - 1
2724
- lea de , iy
2720
+ ld c , iyl ; next
2721
+ lea de , ix
2725
2722
call _TransparentPlot ; call the transparent routine
2726
2723
ld c , 0
2727
2724
.amount := $ - 1
2728
2725
add hl , bc
2729
2726
ld de , ti.lcdWidth ; move to next row
2730
- add iy , de
2731
- dec ixh
2727
+ add ix , de
2728
+ dec iyh
2732
2729
jr nz , . loop
2733
2730
.culled:
2734
2731
pop ix
2735
2732
ret
2736
2733
2734
+ ; Opaque unrolled 4 times
2735
+ ; Transparent unrolled 4 times
2737
2736
_TransparentPlot_Opaque: ; routine to handle transparent plotting
2738
2737
ldi
2739
2738
ret po
@@ -2790,26 +2789,22 @@ gfx_Sprite:
2790
2789
; None
2791
2790
push ix ; save ix sp
2792
2791
call _ClipCoordinates
2793
- pop ix ; restore ix sp
2794
- ret nc
2795
- ld (.amount) , a
2796
- ld a , c ; new width
2797
- ld (.next) , a
2798
- ld a , b ; new height
2799
- ld b , 0
2792
+ jr nc , .culled
2793
+ ; iyl = new width (next)
2794
+ ; iyh = new height
2800
2795
wait_quick
2801
2796
. loop :
2802
- ld c , 0
2803
- .next := $ - 1
2804
- lea de , iy
2797
+ ld c , iyl ; next
2798
+ lea de , ix
2805
2799
ldir
2806
2800
ld de , ti.lcdWidth
2807
- add iy , de
2808
- ld c , 0
2809
- .amount := $ - 1
2801
+ add ix , de
2802
+ ld c , a ; amount
2810
2803
add hl , bc ; move to next line
2811
- dec a
2804
+ dec iyh
2812
2805
jr nz , . loop
2806
+ .culled:
2807
+ pop ix ; restore ix sp
2813
2808
ret
2814
2809
2815
2810
;-------------------------------------------------------------------------------
@@ -2928,33 +2923,33 @@ gfx_TransparentSprite_NoClip:
2928
2923
add iy , sp
2929
2924
ld hl , (iy + 6 ) ; hl = x coordinate
2930
2925
ld c , (iy + 9 ) ; c = y coordinate
2931
- ld iy , (iy + 3 ) ; iy -> sprite struct
2932
2926
ld de , (CurrentBuffer)
2933
2927
add hl , de
2934
2928
ld b , ti.lcdWidth / 2
2935
2929
mlt bc
2936
2930
add hl , bc
2937
2931
add hl , bc ; hl -> place to draw
2938
2932
push hl
2939
- ld a , (iy + 0 )
2933
+ ld hl , (iy + 3 ) ; hl -> sprite struct
2934
+ ld a , (hl)
2935
+ inc hl
2940
2936
ld (.next) , a
2941
- ld a , (iy + 1 )
2942
- lea hl , iy + 2
2943
- pop iy
2944
- push ix
2945
- ld ixh , a ; ixh = height of sprite
2937
+ ld a , (hl)
2938
+ inc hl
2939
+ ex ( sp ) , ix ; preserve ix and load it with (sp)
2940
+ ld iyh , a ; ixh = height of sprite
2946
2941
ld b , 0 ; zero mid byte
2947
2942
ld a , TRASPARENT_COLOR
2948
2943
smcByte _TransparentColor
2949
2944
wait_quick
2950
2945
. loop :
2951
2946
ld c , 0
2952
2947
.next := $ - 1
2953
- lea de , iy
2948
+ lea de , ix
2954
2949
call _TransparentPlot ; call the plotter
2955
2950
ld de , ti.lcdWidth
2956
- add iy , de
2957
- dec ixh ; loop for height
2951
+ add ix , de
2952
+ dec iyh ; loop for height
2958
2953
jr nz , . loop
2959
2954
pop ix ; restore stack pointer
2960
2955
ret
@@ -2969,10 +2964,11 @@ _ClipCoordinates:
2969
2964
; Returns:
2970
2965
; A : How much to add to the sprite per iteration
2971
2966
; BCU: 0
2972
- ; B : New sprite height
2973
- ; C : New sprite width
2967
+ ; B : 0
2968
+ ; IYH: New sprite height
2969
+ ; IYL: New sprite width
2974
2970
; HL : Sprite pixel pointer
2975
- ; IY : Buffer pixel pointer
2971
+ ; IX : Buffer pixel pointer
2976
2972
; NC : If offscreen
2977
2973
ld ix , 6 ; get pointer to arguments
2978
2974
add ix , sp
@@ -3070,19 +3066,19 @@ smcWord _XMin
3070
3066
sub a , e ; calculate bytes to add per iteration
3071
3067
.xclipped:
3072
3068
3073
- lea .s bc , iy
3074
3069
ld l , (ix + 9 ) ; l = y coordinate
3075
3070
ld h , ti.lcdWidth / 2
3076
3071
mlt hl
3077
3072
add hl , hl
3078
3073
ld de , (ix + 6 ) ; de = x coordinate
3079
3074
add hl , de
3080
3075
ex de , hl
3081
- ld iy , (CurrentBuffer)
3082
- add iy , de
3083
3076
ld hl , (ix + 3 ) ; hl -> sprite data
3084
3077
inc hl
3085
3078
inc hl
3079
+ ld ix , (CurrentBuffer)
3080
+ add ix , de
3081
+ ld b , 0
3086
3082
scf ; set carry for success
3087
3083
ret
3088
3084
0 commit comments