Skip to content

Commit 18df619

Browse files
ZERICO2005mateoconlechuga
authored andcommitted
fix GetFontByStyle carry flag bug
1 parent ed6bb79 commit 18df619

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

src/fontlibc/fontlibc.asm

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1990,34 +1990,33 @@ fontlib_GetFontByStyleRaw:
19901990
.badFont:
19911991
pop ix
19921992
ret
1993+
19931994
.checkStyle:
19941995
ld a,(ix + strucFont.height)
1995-
cp (iy + arg1)
1996+
cp a, (iy + arg1)
19961997
ccf
19971998
ret nc
1998-
cp (iy + arg2)
1999+
cp a, (iy + arg2)
19992000
jr z,.sizeOK
20002001
ret nc
20012002
.sizeOK:
20022003
ld a,(ix + strucFont.weight)
2003-
cp (iy + arg3)
2004+
cp a, (iy + arg3)
20042005
ccf
20052006
ret nc
2006-
cp (iy + arg4)
2007+
cp a, (iy + arg4)
20072008
jr z,.weightOK
20082009
ret nc
20092010
.weightOK:
2010-
; TODO: I think the CP here might sometimes SET carry when it shouldn't be?
2011-
ld a,(ix + strucFont.style)
2012-
ld c,(iy + arg5)
2013-
and a,c
2014-
cp a,c
2011+
ld c, (ix + strucFont.style)
2012+
ld a, (iy + arg5)
2013+
; test for required set bits
2014+
and a, c
2015+
xor a, c
20152016
ret nz
2016-
ld a,(ix + strucFont.style)
2017-
ld c,(iy + arg6)
2018-
and a,c
2019-
xor a,c
2020-
cp a,c
2017+
ld a, (iy + arg6)
2018+
; test for required cleared bits
2019+
and a, c
20212020
ret nz
20222021
scf
20232022
ret

0 commit comments

Comments
 (0)