Skip to content

Commit e7a0982

Browse files
committed
Fix BRIGHT setting
BRIGHT 8 was not being set (transparent mode). Also BRIGHT 0 is now 0 and any other value is BRIGHT 1.
1 parent ce4bb53 commit e7a0982

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

library-asm/bright.asm

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,38 @@
66
BRIGHT:
77
ld de, ATTR_P
88

9+
PROC
10+
LOCAL IS_TR
11+
LOCAL IS_ZERO
12+
913
__SET_BRIGHT:
1014
; Another entry. This will set the bright flag at location pointer by DE
11-
and 1 ; # Convert to 0/1
15+
cp 8
16+
jr z, IS_TR
17+
18+
; # Convert to 0/1
19+
or a
20+
jr z, IS_ZERO
21+
ld a, 0x40
1222

13-
rrca
14-
rrca
23+
IS_ZERO:
1524
ld b, a ; Saves the color
1625
ld a, (de)
1726
and 0BFh ; Clears previous value
1827
or b
1928
ld (de), a
2029
ret
2130

31+
IS_TR: ; transparent
32+
inc de ; Points DE to MASK_T or MASK_P
33+
ld a, (de)
34+
or 0x40; Set bit 6 to enable transparency
35+
ld (de), a
36+
ret
37+
2238

2339
; Sets the BRIGHT flag passed in A register in the ATTR_T variable
2440
BRIGHT_TMP:
2541
ld de, ATTR_T
2642
jr __SET_BRIGHT
27-
43+
ENDP

0 commit comments

Comments
 (0)