From 3d16c0a4e04c2e0efef49942350835ea11a0fc62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9rald=20DeGroote?= Date: Mon, 7 Nov 2016 11:11:05 +0100 Subject: [PATCH 1/2] optimised _PrintUInt & _FillScreen Slight optimisation of _PrintUInt, Propose to include a faster fillscreen when color is null --- .../lib/src/graphics/graphx/v2/graphics_lib.asm | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/CEdev/lib/src/graphics/graphx/v2/graphics_lib.asm b/CEdev/lib/src/graphics/graphx/v2/graphics_lib.asm index 809fa2de4..70a8fb693 100644 --- a/CEdev/lib/src/graphics/graphx/v2/graphics_lib.asm +++ b/CEdev/lib/src/graphics/graphx/v2/graphics_lib.asm @@ -238,14 +238,22 @@ _FillScreen: ld hl,3 add hl,sp ld a,(hl) ; get the color index to use - ld bc,lcdSize-1 ld de,(currDrawBuffer) ; de -> current buffer + or a,a + jr z,_FastFillScreen sbc hl,hl add hl,de inc de ld (hl),a ; store the new color + ld bc,lcdSize-1 ldir ; fill the screen with color ret +_FastFillScreen: + ld hl,$e40000 + ld bc,lcdSize + ldir + ret + ;------------------------------------------------------------------------------- _SetPalette: @@ -2630,10 +2638,9 @@ _PrintUInt_ASM: ld a,8 sub a,c ret c ; make sure less than 8 - ld c,a - ld b,8 - mlt bc - ld a,c + rla + rla + rla ld (Offset_SMC),a \.r ; select the jump we need Offset_SMC =$+1 jr $ From ac35e947255a7a31d368d5903c865cea277724cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9rald=20DeGroote?= Date: Mon, 7 Nov 2016 13:59:41 +0100 Subject: [PATCH 2/2] A few minor optimisations here & there --- CEdev/lib/src/graphics/graphx/v2/graphics_lib.asm | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/CEdev/lib/src/graphics/graphx/v2/graphics_lib.asm b/CEdev/lib/src/graphics/graphx/v2/graphics_lib.asm index 70a8fb693..ec1138aea 100644 --- a/CEdev/lib/src/graphics/graphx/v2/graphics_lib.asm +++ b/CEdev/lib/src/graphics/graphx/v2/graphics_lib.asm @@ -141,12 +141,12 @@ _SetClipRegion: ; None call _SetFullScrnClip_ASM \.r ; clip against the actual LCD screen ld iy,0 + lea bc,iy+12 add iy,sp call _ClipRectRegion_ASM \.r ; iy points to the start of the arguments - lea hl,iy ret c + lea hl,iy ld de,_xmin \.r ; copy the variables in - ld bc,12 ldir ; copy in the new structure ret @@ -981,11 +981,11 @@ _FillCircle_NoClip: ; Returns: ; None ld iy,0 + lea bc,iy+0 add iy,sp ld a,(iy+9) ; radius or a,a ret z - ld bc,0 ld c,a ld hl,(currDrawBuffer) ld d,lcdWidth/2 @@ -1991,13 +1991,13 @@ _ClipDraw_ASM: ; DE : New X coordinate ; NC : If offscreen ld ix,6 ; get pointer to arguments + ld iy,ix-6 add ix,sp ld hl,(ix+3) ld a,(hl) ld de,tmpWidth \.r ld (de),a ; save tmpWidth ld (tmpSpriteWidth),a \.r ; save tmpSpriteWidth - ld iy,0 add iy,de inc hl ld a,(hl) @@ -2179,9 +2179,9 @@ _: srl h sbc hl,hl ld l,(iy+14) ld bc,(ix+12) + ld (ix+-3),h sbc hl,bc ld (ix+-12),hl - ld (ix+-3),0 jp _Y_Loop_ASM \.r _X_Res_SMC =$+3 @@ -3202,11 +3202,10 @@ _LZDecompress: ; None push ix ld ix,0 - lea bc,ix + lea bc,ix+1 add ix,sp lea hl,ix+-20 ld sp,hl - inc bc ld hl,(ix+12) or a,a sbc hl,bc