Skip to content
This repository was archived by the owner on Nov 22, 2023. It is now read-only.

Commit 9742d9c

Browse files
committed
Issue z88dk#2432: Add mapping for pc88 since it only has 8 colours
1 parent 40dee95 commit 9742d9c

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

libsrc/target/pc88/pc88.lst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ target/pc88/pc88_cursoron
1212
target/pc88/pc88_locate
1313
target/pc88/pc88_crtset
1414
target/pc88/pc88_wait_vblank
15+
target/pc88/stdio/conio_map_colour
1516
target/pc88/stdio/fgetc_cons
1617
target/pc88/stdio/getk
1718
target/pc88/stdio/fputc_cons
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
; Platform specific colour transformation
2+
;
3+
; Entry: a = colour
4+
; Exit: a = colour to use on screen
5+
; Used: hl,bc,f
6+
;
7+
8+
MODULE code_clib
9+
PUBLIC conio_map_colour
10+
11+
EXTERN __CLIB_CONIO_NATIVE_COLOUR
12+
13+
conio_map_colour:
14+
ld c,__CLIB_CONIO_NATIVE_COLOUR
15+
rr c
16+
ret c
17+
and 15
18+
ld c,a
19+
ld b,0
20+
ld hl,table
21+
add hl,bc
22+
ld a,(hl)
23+
ret
24+
25+
SECTION rodata_clib
26+
table:
27+
defb $0 ;BLACK -> BLACK
28+
defb $1 ;BLUE -> BLUE
29+
defb $4 ;GREEN -> GREEN
30+
defb $5 ;CYAN -> CYAN
31+
defb $2 ;RED -> RED
32+
defb $3 ;MAGENTA -> MAGENTA
33+
defb $2 ;BROWN -> RED
34+
defb $7 ;LIGHTGRAY -> WHITE
35+
defb $7 ;DARKGRAY -> WHITE
36+
defb $1 ;LIGHTBLUE -> BLUE
37+
defb $4 ;LIGHTGREEN -> GREEN
38+
defb $5 ;LIGHTCYAN -> CYAN
39+
defb $2 ;LIGHTRED -> RED
40+
defb $3 ;LIGHTMAGENTA -> MAGENTA
41+
defb $6 ;YELLOW -> YELLOW
42+
defb $7 ;WHITE -> WHITE
43+

libsrc/target/pc88/stdio/generic_console.asm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
EXTERN generic_console_flags
3131
EXTERN __console_x
3232
EXTERN __CLIB_PC8800_V2_ENABLED
33+
EXTERN conio_map_colour
3334

3435
INCLUDE "target/pc88/def/pc88.def"
3536

@@ -38,11 +39,13 @@
3839

3940

4041
generic_console_set_paper:
42+
call conio_map_colour
4143
and 7
4244
ld (__pc88_paper),a
4345
ret
4446

4547
generic_console_set_ink:
48+
call conio_map_colour
4649
and 7
4750
ld (__pc88_ink),a
4851
rrca

0 commit comments

Comments
 (0)