;COLOR=(c,r,g,b)

func_setcolor:

PUSH AF
PUSH BC
PUSH DE
LD IX,$149
CALL $15F
POP DE
LD L,C
LD A,B
RLCA
RLCA
RLCA
RLCA
AND $F
LD E,A
LD A,B
POP BC
AND $F
LD C,A
LD A,D
INC A
JR NZ,func_setcolor_1
LD D,E

func_setcolor_1:
LD A,H
INC A
JR NZ,func_setcolor_2
LD H,L

func_setcolor_2:
LD A,B
INC A
JR NZ,func_setcolor_3
LD B,C

func_setcolor_3:
LD A,D
ADD A,A
ADD A,A
ADD A,A
ADD A,A
OR B
POP DE
LD E,H
LD IX,$14D
JP $15F
