1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-25 17:29:50 +00:00
cc65/libsrc/pce/conio.s

90 lines
2.1 KiB
ArmAsm
Raw Normal View History

2015-10-02 14:50:22 +00:00
.constructor initconio, 24
2015-10-02 14:50:22 +00:00
.import vdc_init
.import psg_init
.import colors
.importzp ptr1, tmp1
2015-10-02 14:50:22 +00:00
.include "pce.inc"
.include "extzp.inc"
2015-07-12 12:27:24 +00:00
.segment "ONCE"
initconio:
jsr vdc_init
2015-08-29 13:58:57 +00:00
jsr psg_init
jsr load_font
2015-08-29 13:58:57 +00:00
set_palette:
2015-08-29 13:58:57 +00:00
stz VCE_ADDR_LO
stz VCE_ADDR_HI
clx
@lp: ldy #16 ; size of a palette
@lp1: lda colors,x
2015-08-29 13:58:57 +00:00
sta VCE_DATA_LO
lda colors+1,x
sta VCE_DATA_HI
dey
bne @lp1
2015-07-12 12:27:24 +00:00
2015-08-29 13:58:57 +00:00
inx
inx
cpx #16 * 2 ; 16 palettes
bne @lp
2015-07-12 12:27:24 +00:00
sty BGCOLOR ; white on black
iny
sty CHARCOLOR
2015-07-12 12:27:24 +00:00
VREG VDC_CR, $0088 ; enable background and vertical-blank interrupt
2015-08-29 13:58:57 +00:00
rts
; Load the conio font into the VDC.
load_font:
VREG VDC_MAWR, $2000
st0 #VDC_VWR
2015-07-12 12:27:24 +00:00
stz tmp1 ; #%00000000
bsr copy ; make normal characters
dec tmp1 ; #%11111111
; bsr copy ; make reversed characters
; rts ; (fall through)
; Point to the font data.
copy: lda #<font
ldx #>font
2015-08-29 13:58:57 +00:00
sta ptr1
stx ptr1+1
2015-08-29 13:58:57 +00:00
ldy #$80 ; 128 chars
charloop:
ldx #$08 ; 8 bytes/char
2015-07-12 12:27:24 +00:00
lineloop:
2015-08-29 13:58:57 +00:00
lda (ptr1)
eor tmp1
sta VDC_DATA_LO ; bitplane 0
st2 #>$0000 ; bitplane 1
2015-08-29 13:58:57 +00:00
inc ptr1 ; increment font pointer
bne @noC
inc ptr1+1
@noC: dex
2015-11-17 14:14:15 +00:00
bne lineloop ; next bitplane-0 byte
2015-11-17 14:14:15 +00:00
ldx #$08 ; fill bitplanes 2 and 3 with 0
2015-08-29 13:58:57 +00:00
fillloop:
2015-11-17 14:14:15 +00:00
st1 #<$0000
st2 #>$0000
2015-08-29 13:58:57 +00:00
dex
bne fillloop ; next byte
2015-08-29 13:58:57 +00:00
dey
bne charloop ; next character
rts
2015-10-02 14:50:22 +00:00
.rodata
font: .include "vga.inc"