@@ -907,7 +907,7 @@ gfx_Rectangle_NoClip:
907
907
; de = ti.lcdWidth
908
908
sbc hl , de ; hl = &buf[y+height-1][x]
909
909
pop bc ; bc = width
910
- jp _HorizLine_NoClip_Draw ; draw bottom horizontal line
910
+ jr _HorizLine_NoClip_Draw ; draw bottom horizontal line
911
911
912
912
;-------------------------------------------------------------------------------
913
913
gfx_HorizLine:
@@ -1233,7 +1233,7 @@ gfx_FillEllipse:
1233
1233
ld hl , _ellipse_ret
1234
1234
ld (_ellipse_loop_draw_1) , hl
1235
1235
jr _Ellipse
1236
-
1236
+
1237
1237
;-------------------------------------------------------------------------------
1238
1238
gfx_Ellipse_NoClip:
1239
1239
ld hl , _SetPixel_NoClip_NoWait
@@ -1281,7 +1281,7 @@ _Ellipse:
1281
1281
add ix , sp
1282
1282
lea hl , ix - 42
1283
1283
ld sp , hl
1284
-
1284
+
1285
1285
; First, setup all the variables
1286
1286
ld a , (ix + 12 )
1287
1287
or a , a
@@ -1366,7 +1366,7 @@ _Ellipse:
1366
1366
ld de , (ix - el_y)
1367
1367
call _MultiplyHLDE
1368
1368
ld (ix - el_comp_b) , hl
1369
-
1369
+
1370
1370
wait_quick
1371
1371
1372
1372
.main_loop1:
@@ -2512,9 +2512,7 @@ gfx_GetClipRegion:
2512
2512
ld hl , 3
2513
2513
add hl , sp
2514
2514
ld iy , (hl)
2515
- dec iy
2516
- dec iy
2517
- dec iy
2515
+ lea iy , iy - 3
2518
2516
call _ClipRegion ; get the clipping region
2519
2517
sbc a , a ; return false if offscreen (0)
2520
2518
inc a
@@ -2899,15 +2897,15 @@ gfx_GetSprite:
2899
2897
sbc a , a
2900
2898
inc a
2901
2899
ld b , a ; the amount to add to get to the next line
2902
- ld (.offset) , bc
2900
+ push bc
2901
+ pop iy
2903
2902
ld a , (de)
2904
2903
inc de
2905
2904
. loop :
2906
2905
ld bc , 0
2907
2906
.amount := $ - 3
2908
2907
ldir ; copy the data into the struct data
2909
- ld bc , 0
2910
- .offset := $ - 3
2908
+ lea bc , iy ; (.offset)
2911
2909
add hl , bc
2912
2910
dec a
2913
2911
jr nz , . loop
@@ -3219,20 +3217,7 @@ _Tilemap:
3219
3217
ld (ix - 3 ) , h
3220
3218
sbc hl , bc
3221
3219
ld (ix - 12 ) , hl
3222
- jp .yloop
3223
-
3224
- .xres := $ + 3
3225
- . loop :
3226
- ld (ix - 1 ) , 0
3227
- ld hl , 0
3228
- .xoffset := $ - 3
3229
- ld (ix - 7 ) , hl
3230
- ld l , (iy + t_width)
3231
- ld h , (ix - 4 )
3232
- mlt hl
3233
- ld (.ynext) , hl
3234
- xor a , a
3235
- jr .xloop
3220
+ jr .yloop
3236
3221
3237
3222
.xloopinner:
3238
3223
or a , a
@@ -3288,7 +3273,20 @@ _Tilemap:
3288
3273
.yloop:
3289
3274
ld a , (iy + t_draw_height)
3290
3275
cp a , (ix - 3 )
3291
- jp nz , . loop
3276
+ jr z , .finish_loop
3277
+ .xres := $ + 3
3278
+ ; .loop:
3279
+ ld (ix - 1 ) , 0
3280
+ ld hl , 0
3281
+ .xoffset := $ - 3
3282
+ ld (ix - 7 ) , hl
3283
+ ld l , (iy + t_width)
3284
+ ld h , (ix - 4 )
3285
+ mlt hl
3286
+ ld (.ynext) , hl
3287
+ xor a , a
3288
+ jr .xloop
3289
+ .finish_loop:
3292
3290
ld sp , ix
3293
3291
pop ix
3294
3292
ret
@@ -3855,8 +3853,7 @@ gfx_GetStringWidth:
3855
3853
; Returns:
3856
3854
; Width of string in pixels
3857
3855
pop de
3858
- pop hl
3859
- push hl ; hl -> string
3856
+ ex ( sp ) , hl ; hl -> string
3860
3857
push de
3861
3858
ld de , 0
3862
3859
. loop :
@@ -3880,10 +3877,11 @@ gfx_GetCharWidth:
3880
3877
; arg0 : Character
3881
3878
; Returns:
3882
3879
; Width of character in pixels
3883
- ld iy , 0
3884
- lea de , iy
3885
- add iy , sp
3886
- ld a , (iy + 3 ) ; a = character
3880
+ ld hl , 3
3881
+ add hl , sp
3882
+ ld a , (hl) ; a = character
3883
+ sbc hl , hl
3884
+ ex de , hl
3887
3885
_GetCharWidth:
3888
3886
sbc hl , hl
3889
3887
ld l , a
@@ -3996,8 +3994,7 @@ gfx_SetFontData:
3996
3994
; Returns:
3997
3995
; Pointer to previous font data
3998
3996
pop de
3999
- pop hl
4000
- push hl ; hl -> custom font data
3997
+ ex ( sp ) , hl ; hl -> custom font data
4001
3998
push de
4002
3999
add hl , de
4003
4000
or a , a
@@ -4048,8 +4045,7 @@ gfx_SetFontSpacing:
4048
4045
; Returns:
4049
4046
; None
4050
4047
pop de
4051
- pop hl
4052
- push hl ; hl -> custom font width
4048
+ ex ( sp ) , hl ; hl -> custom font width
4053
4049
push de
4054
4050
add hl , de
4055
4051
or a , a
@@ -4070,10 +4066,9 @@ gfx_SetMonospaceFont:
4070
4066
pop hl
4071
4067
pop de
4072
4068
push de
4073
- push hl
4074
4069
ld a , e ; a = width
4075
4070
ld (_TextFixedWidth) , a ; store the value of the monospace width
4076
- ret
4071
+ jp (hl)
4077
4072
4078
4073
;-------------------------------------------------------------------------------
4079
4074
gfx_FillTriangle_NoClip:
@@ -4145,7 +4140,7 @@ _FillTriangle:
4145
4140
ld hl , (ix + 9 )
4146
4141
or a , a
4147
4142
sbc hl , de
4148
- jp nz , .notfl at
4143
+ jr nz , .notfl at
4149
4144
ld bc , (ix + 6 ) ; x0
4150
4145
ld (ix - 6 ) , bc ; a = x0
4151
4146
ld (ix - 3 ) , bc ; b = x0;
@@ -4196,29 +4191,6 @@ _FillTriangle:
4196
4191
jp p , .cmp30
4197
4192
jp pe , .cmp31
4198
4193
jr .cmp32
4199
- .cmp30:
4200
- jp po , .cmp31
4201
- .cmp32:
4202
- ld bc , (ix + 18 )
4203
- ld (ix - 6 ) , bc
4204
- .cmp31:
4205
- ld de , (ix - 3 )
4206
- ld hl , (ix - 6 )
4207
- or a , a
4208
- sbc hl , de
4209
- inc hl
4210
- push hl
4211
- ld bc , (ix + 9 )
4212
- push bc
4213
- push de
4214
- call 0 ; horizline(a, y0, b-a+1);
4215
- .line0 := $ - 3
4216
- pop bc
4217
- pop bc
4218
- pop bc
4219
- ld sp , ix
4220
- pop ix
4221
- ret ; return;
4222
4194
.notfl at :
4223
4195
ld bc , (ix + 6 ) ; x0
4224
4196
ld hl , (ix + 12 )
@@ -4251,14 +4223,34 @@ _FillTriangle:
4251
4223
jr nz , .elselast ; if (y1 == y2) { last = y1; }
4252
4224
ld (ix - 24 ) , bc
4253
4225
jr .sublast
4226
+ .cmp30:
4227
+ jp po , .cmp31
4228
+ .cmp32:
4229
+ ld bc , (ix + 18 )
4230
+ ld (ix - 6 ) , bc
4231
+ .cmp31:
4232
+ ld de , (ix - 3 )
4233
+ ld hl , (ix - 6 )
4234
+ or a , a
4235
+ sbc hl , de
4236
+ inc hl
4237
+ push hl
4238
+ ld bc , (ix + 9 )
4239
+ push bc
4240
+ push de
4241
+ call 0 ; horizline(a, y0, b-a+1);
4242
+ .line0 := $ - 3
4243
+ ld sp , ix
4244
+ pop ix
4245
+ ret ; return;
4254
4246
.elselast:
4255
4247
ld bc , (ix + 15 ) ; else { last = y1-1; }
4256
4248
dec bc
4257
4249
ld (ix - 24 ) , bc
4258
4250
.sublast:
4259
4251
ld bc , (ix + 9 )
4260
4252
ld (ix - 12 ) , bc ; for (y = y0; y <= last; y++)
4261
- jp .firstloopstart
4253
+ jr .firstloopstart
4262
4254
.firstloop:
4263
4255
ld hl , (ix - 15 )
4264
4256
ld bc , (ix - 33 )
@@ -4335,7 +4327,7 @@ _FillTriangle:
4335
4327
ld de , (ix - 21 )
4336
4328
call _MultiplyHLDE ; sb = dx02 * (y - y0);
4337
4329
ld (ix - 18 ) , hl
4338
- jp .secondloopstart ; for(; y <= y2; y++)
4330
+ jr .secondloopstart ; for(; y <= y2; y++)
4339
4331
.secondloop:
4340
4332
ld hl , (ix - 15 )
4341
4333
ld bc , (ix - 39 )
@@ -4836,8 +4828,7 @@ gfx_ScaleSprite:
4836
4828
pop de ; de->tgt_data
4837
4829
ld iy , 0
4838
4830
ld iyl , a
4839
- ld a , c ; du = bc:iyl
4840
- ld (du) , a ; ixl = target_height
4831
+ ld ixh , c ; (.du) = bc:iyl, ixl = target_height
4841
4832
4842
4833
; b = out_loop_times
4843
4834
; de = target buffer adress
@@ -4847,9 +4838,9 @@ ScaleWidth := $+2
4847
4838
ld iyh , 0
4848
4839
xor a , a
4849
4840
ld b , a
4850
- ld c , 0
4851
- du := $ - 1
4852
- . loop : ldi
4841
+ ld c , ixh ; (.du)
4842
+ . loop :
4843
+ ldi
4853
4844
add a , iyl
4854
4845
adc hl , bc ; xu += du
4855
4846
inc bc ; bc:iyl is du
@@ -6409,6 +6400,7 @@ _Maximum:
6409
6400
; Oututs:
6410
6401
; HL=max number
6411
6402
or a , a
6403
+ .no_carry:
6412
6404
sbc hl , de
6413
6405
add hl , de
6414
6406
jp p , .skip
@@ -6427,6 +6419,7 @@ _Minimum:
6427
6419
; Oututs:
6428
6420
; HL=min number
6429
6421
or a , a
6422
+ .no_carry:
6430
6423
sbc hl , de
6431
6424
ex de , hl
6432
6425
jp p , .skip
@@ -6464,7 +6457,7 @@ smcWord _XMax
6464
6457
smcWord _YMin
6465
6458
.YMin := $ - 3
6466
6459
ld de , (iy + 6 )
6467
- call _Maximum
6460
+ call _Maximum.no_carry
6468
6461
ld (iy + 6 ) , hl
6469
6462
ld hl , ti.lcdHeight
6470
6463
smcWord _YMax
@@ -6733,7 +6726,7 @@ _DefaultCharSpacing:
6733
6726
db 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8
6734
6727
6735
6728
_DefaultTextData:
6736
- db $ 00 , $ 00 , $ 00 , $ 00 , $ 00 , $ 00 , $ 00 , $ 00 ;
6729
+ db $ 00 , $ 00 , $ 00 , $ 00 , $ 00 , $ 00 , $ 00 , $ 00 ; 0
6737
6730
db $ 7E , $ 81 , $ A5 , $ 81 , $ BD , $ BD , $ 81 , $ 7E ; ☺
6738
6731
db $ 7E , $ FF , $ DB , $ FF , $ C3 , $ C3 , $ FF , $ 7E ; ☻
6739
6732
db $ 6C , $ FE , $ FE , $ FE , $ 7C , $ 38 , $ 10 , $ 00 ; ♥
@@ -6765,7 +6758,7 @@ _DefaultTextData:
6765
6758
db $ 00 , $ 24 , $ 66 , $ FF , $ 66 , $ 24 , $ 00 , $ 00 ; ↔
6766
6759
db $ 00 , $ 18 , $ 3C , $ 7E , $ FF , $ FF , $ 00 , $ 00 ; ▲
6767
6760
db $ 00 , $ FF , $ FF , $ 7E , $ 3C , $ 18 , $ 00 , $ 00 ; ▼
6768
- db $ 00 , $ 00 , $ 00 , $ 00 , $ 00 , $ 00 , $ 00 , $ 00 ;
6761
+ db $ 00 , $ 00 , $ 00 , $ 00 , $ 00 , $ 00 , $ 00 , $ 00 ; _
6769
6762
db $ C0 , $ C0 , $ C0 , $ C0 , $ C0 , $ 00 , $ C0 , $ 00 ; !
6770
6763
db $ D8 , $ D8 , $ D8 , $ 00 , $ 00 , $ 00 , $ 00 , $ 00 ; "
6771
6764
db $ 6C , $ 6C , $ FE , $ 6C , $ FE , $ 6C , $ 6C , $ 00 ; #
@@ -6860,7 +6853,7 @@ _DefaultTextData:
6860
6853
db $ C0 , $ C0 , $ C0 , $ 00 , $ C0 , $ C0 , $ C0 , $ 00 ; |
6861
6854
db $ E0 , $ 30 , $ 30 , $ 1C , $ 30 , $ 30 , $ E0 , $ 00 ; }
6862
6855
db $ 76 , $ DC , $ 00 , $ 00 , $ 00 , $ 00 , $ 00 , $ 00 ; ~
6863
- db $ 00 , $ 10 , $ 38 , $ 6C , $ C6 , $ C6 , $ FE , $ 00 ; △
6856
+ db $ 00 , $ 10 , $ 38 , $ 6C , $ C6 , $ C6 , $ FE , $ 00 ; Δ
6864
6857
6865
6858
_LcdTiming:
6866
6859
; db 14 shl 2 ; PPL shl 2
0 commit comments