@@ -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
@@ -3220,20 +3218,7 @@ _Tilemap:
3220
3218
ld (ix - 3 ) , h
3221
3219
sbc hl , bc
3222
3220
ld (ix - 12 ) , hl
3223
- jp .yloop
3224
-
3225
- .xres := $ + 3
3226
- . loop :
3227
- ld (ix - 1 ) , 0
3228
- ld hl , 0
3229
- .xoffset := $ - 3
3230
- ld (ix - 7 ) , hl
3231
- ld l , (iy + t_width)
3232
- ld h , (ix - 4 )
3233
- mlt hl
3234
- ld (.ynext) , hl
3235
- xor a , a
3236
- jr .xloop
3221
+ jr .yloop
3237
3222
3238
3223
.xloopinner:
3239
3224
or a , a
@@ -3289,7 +3274,20 @@ _Tilemap:
3289
3274
.yloop:
3290
3275
ld a , (iy + t_draw_height)
3291
3276
cp a , (ix - 3 )
3292
- jp nz , . loop
3277
+ jr z , .finish_loop
3278
+ .xres := $ + 3
3279
+ ; .loop:
3280
+ ld (ix - 1 ) , 0
3281
+ ld hl , 0
3282
+ .xoffset := $ - 3
3283
+ ld (ix - 7 ) , hl
3284
+ ld l , (iy + t_width)
3285
+ ld h , (ix - 4 )
3286
+ mlt hl
3287
+ ld (.ynext) , hl
3288
+ xor a , a
3289
+ jr .xloop
3290
+ .finish_loop:
3293
3291
ld sp , ix
3294
3292
pop ix
3295
3293
ret
@@ -3856,8 +3854,7 @@ gfx_GetStringWidth:
3856
3854
; Returns:
3857
3855
; Width of string in pixels
3858
3856
pop de
3859
- pop hl
3860
- push hl ; hl -> string
3857
+ ex ( sp ) , hl ; hl -> string
3861
3858
push de
3862
3859
ld de , 0
3863
3860
. loop :
@@ -3881,10 +3878,11 @@ gfx_GetCharWidth:
3881
3878
; arg0 : Character
3882
3879
; Returns:
3883
3880
; Width of character in pixels
3884
- ld iy , 0
3885
- lea de , iy
3886
- add iy , sp
3887
- ld a , (iy + 3 ) ; a = character
3881
+ ld hl , 3
3882
+ add hl , sp
3883
+ ld a , (hl) ; a = character
3884
+ sbc hl , hl
3885
+ ex de , hl
3888
3886
_GetCharWidth:
3889
3887
sbc hl , hl
3890
3888
ld l , a
@@ -3997,8 +3995,7 @@ gfx_SetFontData:
3997
3995
; Returns:
3998
3996
; Pointer to previous font data
3999
3997
pop de
4000
- pop hl
4001
- push hl ; hl -> custom font data
3998
+ ex ( sp ) , hl ; hl -> custom font data
4002
3999
push de
4003
4000
add hl , de
4004
4001
or a , a
@@ -4049,8 +4046,7 @@ gfx_SetFontSpacing:
4049
4046
; Returns:
4050
4047
; None
4051
4048
pop de
4052
- pop hl
4053
- push hl ; hl -> custom font width
4049
+ ex ( sp ) , hl ; hl -> custom font width
4054
4050
push de
4055
4051
add hl , de
4056
4052
or a , a
@@ -4071,10 +4067,9 @@ gfx_SetMonospaceFont:
4071
4067
pop hl
4072
4068
pop de
4073
4069
push de
4074
- push hl
4075
4070
ld a , e ; a = width
4076
4071
ld (_TextFixedWidth) , a ; store the value of the monospace width
4077
- ret
4072
+ jp (hl)
4078
4073
4079
4074
;-------------------------------------------------------------------------------
4080
4075
gfx_FillTriangle_NoClip:
@@ -4146,7 +4141,7 @@ _FillTriangle:
4146
4141
ld hl , (ix + 9 )
4147
4142
or a , a
4148
4143
sbc hl , de
4149
- jp nz , .notfl at
4144
+ jr nz , .notfl at
4150
4145
ld bc , (ix + 6 ) ; x0
4151
4146
ld (ix - 6 ) , bc ; a = x0
4152
4147
ld (ix - 3 ) , bc ; b = x0;
@@ -4197,29 +4192,6 @@ _FillTriangle:
4197
4192
jp p , .cmp30
4198
4193
jp pe , .cmp31
4199
4194
jr .cmp32
4200
- .cmp30:
4201
- jp po , .cmp31
4202
- .cmp32:
4203
- ld bc , (ix + 18 )
4204
- ld (ix - 6 ) , bc
4205
- .cmp31:
4206
- ld de , (ix - 3 )
4207
- ld hl , (ix - 6 )
4208
- or a , a
4209
- sbc hl , de
4210
- inc hl
4211
- push hl
4212
- ld bc , (ix + 9 )
4213
- push bc
4214
- push de
4215
- call 0 ; horizline(a, y0, b-a+1);
4216
- .line0 := $ - 3
4217
- pop bc
4218
- pop bc
4219
- pop bc
4220
- ld sp , ix
4221
- pop ix
4222
- ret ; return;
4223
4195
.notfl at :
4224
4196
ld bc , (ix + 6 ) ; x0
4225
4197
ld hl , (ix + 12 )
@@ -4252,14 +4224,34 @@ _FillTriangle:
4252
4224
jr nz , .elselast ; if (y1 == y2) { last = y1; }
4253
4225
ld (ix - 24 ) , bc
4254
4226
jr .sublast
4227
+ .cmp30:
4228
+ jp po , .cmp31
4229
+ .cmp32:
4230
+ ld bc , (ix + 18 )
4231
+ ld (ix - 6 ) , bc
4232
+ .cmp31:
4233
+ ld de , (ix - 3 )
4234
+ ld hl , (ix - 6 )
4235
+ or a , a
4236
+ sbc hl , de
4237
+ inc hl
4238
+ push hl
4239
+ ld bc , (ix + 9 )
4240
+ push bc
4241
+ push de
4242
+ call 0 ; horizline(a, y0, b-a+1);
4243
+ .line0 := $ - 3
4244
+ ld sp , ix
4245
+ pop ix
4246
+ ret ; return;
4255
4247
.elselast:
4256
4248
ld bc , (ix + 15 ) ; else { last = y1-1; }
4257
4249
dec bc
4258
4250
ld (ix - 24 ) , bc
4259
4251
.sublast:
4260
4252
ld bc , (ix + 9 )
4261
4253
ld (ix - 12 ) , bc ; for (y = y0; y <= last; y++)
4262
- jp .firstloopstart
4254
+ jr .firstloopstart
4263
4255
.firstloop:
4264
4256
ld hl , (ix - 15 )
4265
4257
ld bc , (ix - 33 )
@@ -4336,7 +4328,7 @@ _FillTriangle:
4336
4328
ld de , (ix - 21 )
4337
4329
call _MultiplyHLDE ; sb = dx02 * (y - y0);
4338
4330
ld (ix - 18 ) , hl
4339
- jp .secondloopstart ; for(; y <= y2; y++)
4331
+ jr .secondloopstart ; for(; y <= y2; y++)
4340
4332
.secondloop:
4341
4333
ld hl , (ix - 15 )
4342
4334
ld bc , (ix - 39 )
@@ -4837,8 +4829,7 @@ gfx_ScaleSprite:
4837
4829
pop de ; de->tgt_data
4838
4830
ld iy , 0
4839
4831
ld iyl , a
4840
- ld a , c ; du = bc:iyl
4841
- ld (du) , a ; ixl = target_height
4832
+ ld ixh , c ; (.du) = bc:iyl, ixl = target_height
4842
4833
4843
4834
; b = out_loop_times
4844
4835
; de = target buffer adress
@@ -4848,9 +4839,9 @@ ScaleWidth := $+2
4848
4839
ld iyh , 0
4849
4840
xor a , a
4850
4841
ld b , a
4851
- ld c , 0
4852
- du := $ - 1
4853
- . loop : ldi
4842
+ ld c , ixh ; (.du)
4843
+ . loop :
4844
+ ldi
4854
4845
add a , iyl
4855
4846
adc hl , bc ; xu += du
4856
4847
inc bc ; bc:iyl is du
@@ -6410,6 +6401,7 @@ _Maximum:
6410
6401
; Oututs:
6411
6402
; HL=max number
6412
6403
or a , a
6404
+ .no_carry:
6413
6405
sbc hl , de
6414
6406
add hl , de
6415
6407
jp p , .skip
@@ -6428,6 +6420,7 @@ _Minimum:
6428
6420
; Oututs:
6429
6421
; HL=min number
6430
6422
or a , a
6423
+ .no_carry:
6431
6424
sbc hl , de
6432
6425
ex de , hl
6433
6426
jp p , .skip
@@ -6465,7 +6458,7 @@ smcWord _XMax
6465
6458
smcWord _YMin
6466
6459
.YMin := $ - 3
6467
6460
ld de , (iy + 6 )
6468
- call _Maximum
6461
+ call _Maximum.no_carry
6469
6462
ld (iy + 6 ) , hl
6470
6463
ld hl , ti.lcdHeight
6471
6464
smcWord _YMax
@@ -6734,7 +6727,7 @@ _DefaultCharSpacing:
6734
6727
db 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8
6735
6728
6736
6729
_DefaultTextData:
6737
- db $ 00 , $ 00 , $ 00 , $ 00 , $ 00 , $ 00 , $ 00 , $ 00 ;
6730
+ db $ 00 , $ 00 , $ 00 , $ 00 , $ 00 , $ 00 , $ 00 , $ 00 ; 0
6738
6731
db $ 7E , $ 81 , $ A5 , $ 81 , $ BD , $ BD , $ 81 , $ 7E ; ☺
6739
6732
db $ 7E , $ FF , $ DB , $ FF , $ C3 , $ C3 , $ FF , $ 7E ; ☻
6740
6733
db $ 6C , $ FE , $ FE , $ FE , $ 7C , $ 38 , $ 10 , $ 00 ; ♥
@@ -6766,7 +6759,7 @@ _DefaultTextData:
6766
6759
db $ 00 , $ 24 , $ 66 , $ FF , $ 66 , $ 24 , $ 00 , $ 00 ; ↔
6767
6760
db $ 00 , $ 18 , $ 3C , $ 7E , $ FF , $ FF , $ 00 , $ 00 ; ▲
6768
6761
db $ 00 , $ FF , $ FF , $ 7E , $ 3C , $ 18 , $ 00 , $ 00 ; ▼
6769
- db $ 00 , $ 00 , $ 00 , $ 00 , $ 00 , $ 00 , $ 00 , $ 00 ;
6762
+ db $ 00 , $ 00 , $ 00 , $ 00 , $ 00 , $ 00 , $ 00 , $ 00 ; _
6770
6763
db $ C0 , $ C0 , $ C0 , $ C0 , $ C0 , $ 00 , $ C0 , $ 00 ; !
6771
6764
db $ D8 , $ D8 , $ D8 , $ 00 , $ 00 , $ 00 , $ 00 , $ 00 ; "
6772
6765
db $ 6C , $ 6C , $ FE , $ 6C , $ FE , $ 6C , $ 6C , $ 00 ; #
@@ -6861,7 +6854,7 @@ _DefaultTextData:
6861
6854
db $ C0 , $ C0 , $ C0 , $ 00 , $ C0 , $ C0 , $ C0 , $ 00 ; |
6862
6855
db $ E0 , $ 30 , $ 30 , $ 1C , $ 30 , $ 30 , $ E0 , $ 00 ; }
6863
6856
db $ 76 , $ DC , $ 00 , $ 00 , $ 00 , $ 00 , $ 00 , $ 00 ; ~
6864
- db $ 00 , $ 10 , $ 38 , $ 6C , $ C6 , $ C6 , $ FE , $ 00 ; △
6857
+ db $ 00 , $ 10 , $ 38 , $ 6C , $ C6 , $ C6 , $ FE , $ 00 ; Δ
6865
6858
6866
6859
_LcdTiming:
6867
6860
; db 14 shl 2 ; PPL shl 2
0 commit comments