Skip to content

Commit 2e7664d

Browse files
Merge pull request #40 from grosged/master
optimised _PrintUInt & _FillScreen
2 parents 0ee9b56 + ac35e94 commit 2e7664d

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

CEdev/lib/src/graphics/graphx/v2/graphics_lib.asm

+18-12
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,12 @@ _SetClipRegion:
141141
; None
142142
call _SetFullScrnClip_ASM \.r ; clip against the actual LCD screen
143143
ld iy,0
144+
lea bc,iy+12
144145
add iy,sp
145146
call _ClipRectRegion_ASM \.r ; iy points to the start of the arguments
146-
lea hl,iy
147147
ret c
148+
lea hl,iy
148149
ld de,_xmin \.r ; copy the variables in
149-
ld bc,12
150150
ldir ; copy in the new structure
151151
ret
152152

@@ -238,14 +238,22 @@ _FillScreen:
238238
ld hl,3
239239
add hl,sp
240240
ld a,(hl) ; get the color index to use
241-
ld bc,lcdSize-1
242241
ld de,(currDrawBuffer) ; de -> current buffer
242+
or a,a
243+
jr z,_FastFillScreen
243244
sbc hl,hl
244245
add hl,de
245246
inc de
246247
ld (hl),a ; store the new color
248+
ld bc,lcdSize-1
247249
ldir ; fill the screen with color
248250
ret
251+
_FastFillScreen:
252+
ld hl,$e40000
253+
ld bc,lcdSize
254+
ldir
255+
ret
256+
249257

250258
;-------------------------------------------------------------------------------
251259
_SetPalette:
@@ -973,11 +981,11 @@ _FillCircle_NoClip:
973981
; Returns:
974982
; None
975983
ld iy,0
984+
lea bc,iy+0
976985
add iy,sp
977986
ld a,(iy+9) ; radius
978987
or a,a
979988
ret z
980-
ld bc,0
981989
ld c,a
982990
ld hl,(currDrawBuffer)
983991
ld d,lcdWidth/2
@@ -1983,13 +1991,13 @@ _ClipDraw_ASM:
19831991
; DE : New X coordinate
19841992
; NC : If offscreen
19851993
ld ix,6 ; get pointer to arguments
1994+
ld iy,ix-6
19861995
add ix,sp
19871996
ld hl,(ix+3)
19881997
ld a,(hl)
19891998
ld de,tmpWidth \.r
19901999
ld (de),a ; save tmpWidth
19912000
ld (tmpSpriteWidth),a \.r ; save tmpSpriteWidth
1992-
ld iy,0
19932001
add iy,de
19942002
inc hl
19952003
ld a,(hl)
@@ -2171,9 +2179,9 @@ _: srl h
21712179
sbc hl,hl
21722180
ld l,(iy+14)
21732181
ld bc,(ix+12)
2182+
ld (ix+-3),h
21742183
sbc hl,bc
21752184
ld (ix+-12),hl
2176-
ld (ix+-3),0
21772185
jp _Y_Loop_ASM \.r
21782186

21792187
_X_Res_SMC =$+3
@@ -2630,10 +2638,9 @@ _PrintUInt_ASM:
26302638
ld a,8
26312639
sub a,c
26322640
ret c ; make sure less than 8
2633-
ld c,a
2634-
ld b,8
2635-
mlt bc
2636-
ld a,c
2641+
rla
2642+
rla
2643+
rla
26372644
ld (Offset_SMC),a \.r ; select the jump we need
26382645
Offset_SMC =$+1
26392646
jr $
@@ -3195,11 +3202,10 @@ _LZDecompress:
31953202
; None
31963203
push ix
31973204
ld ix,0
3198-
lea bc,ix
3205+
lea bc,ix+1
31993206
add ix,sp
32003207
lea hl,ix+-20
32013208
ld sp,hl
3202-
inc bc
32033209
ld hl,(ix+12)
32043210
or a,a
32053211
sbc hl,bc

0 commit comments

Comments
 (0)