Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimised _PrintUInt & _FillScreen #40

Merged
merged 2 commits into from Nov 7, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions CEdev/lib/src/graphics/graphx/v2/graphics_lib.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -973,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
Expand Down Expand Up @@ -1983,13 +1991,13 @@ _ClipDraw_ASM:
; DE : New X coordinate
; NC : If offscreen
ld ix,6 ; get pointer to arguments
ld iy,ix-6
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't exist :D

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just going to merge anyway and fix myself

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, I meant LEA 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)
Expand Down Expand Up @@ -2171,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
Expand Down Expand Up @@ -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 $
Expand Down Expand Up @@ -3195,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
Expand Down