2015-10-02 14:50:22 +00:00
|
|
|
.constructor initconio, 24
|
2014-11-29 13:18:48 +00:00
|
|
|
|
2015-10-09 19:44:20 +00:00
|
|
|
.import vce_init
|
|
|
|
.import psg_init
|
2015-10-02 14:50:22 +00:00
|
|
|
.import vdc_init
|
2015-10-09 19:44:20 +00:00
|
|
|
.import colors
|
|
|
|
.importzp ptr1, tmp1
|
2014-11-29 13:18:48 +00:00
|
|
|
|
2015-10-02 14:50:22 +00:00
|
|
|
.include "pce.inc"
|
|
|
|
.include "extzp.inc"
|
2015-08-29 13:58:57 +00:00
|
|
|
.macpack longbranch
|
2015-07-12 12:27:24 +00:00
|
|
|
|
2016-03-06 20:26:22 +00:00
|
|
|
.segment "ONCE"
|
2014-11-29 13:18:48 +00:00
|
|
|
initconio:
|
2015-08-29 13:58:57 +00:00
|
|
|
jsr vce_init
|
|
|
|
jsr psg_init
|
|
|
|
jsr conio_init
|
|
|
|
jsr set_palette
|
|
|
|
|
2015-09-07 10:55:36 +00:00
|
|
|
st0 #VDC_CR
|
2015-08-29 13:58:57 +00:00
|
|
|
st1 #<$0088
|
|
|
|
st2 #>$0088
|
|
|
|
rts
|
|
|
|
|
2014-11-29 13:18:48 +00:00
|
|
|
set_palette:
|
2015-08-29 13:58:57 +00:00
|
|
|
stz VCE_ADDR_LO
|
|
|
|
stz VCE_ADDR_HI
|
2014-11-29 13:18:48 +00:00
|
|
|
|
2015-08-29 13:58:57 +00:00
|
|
|
ldx #0
|
2014-11-29 13:18:48 +00:00
|
|
|
@lp:
|
2015-11-17 14:14:15 +00:00
|
|
|
ldy #16 ; size of a pallette
|
2015-07-15 11:18:12 +00:00
|
|
|
@lp1:
|
2015-08-29 13:58:57 +00:00
|
|
|
lda colors,x
|
|
|
|
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
|
2015-10-02 14:50:22 +00:00
|
|
|
cpx #16 * 2
|
2015-08-29 13:58:57 +00:00
|
|
|
jne @lp
|
2015-07-12 12:27:24 +00:00
|
|
|
|
2015-11-17 14:14:15 +00:00
|
|
|
; Set background to black.
|
|
|
|
|
2015-08-29 13:58:57 +00:00
|
|
|
stz VCE_ADDR_LO
|
|
|
|
stz VCE_ADDR_HI
|
|
|
|
stz VCE_DATA_LO
|
|
|
|
stz VCE_DATA_HI
|
2015-07-12 12:27:24 +00:00
|
|
|
|
2015-08-29 13:58:57 +00:00
|
|
|
rts
|
2014-11-29 13:18:48 +00:00
|
|
|
|
2015-11-17 14:14:15 +00:00
|
|
|
;----------------------------------------------------------------------------
|
|
|
|
; The character tiles use only two colors from each pallette. Color zero
|
|
|
|
; comes from pallette zero; color one is different in each pallette. The
|
|
|
|
; color of a character is set by choosing one of the 16 pallettes.
|
|
|
|
|
2014-11-29 13:18:48 +00:00
|
|
|
conio_init:
|
2015-08-29 13:58:57 +00:00
|
|
|
; Load font
|
|
|
|
st0 #VDC_MAWR
|
|
|
|
st1 #<$2000
|
|
|
|
st2 #>$2000
|
2015-07-12 12:27:24 +00:00
|
|
|
|
2015-11-17 14:14:15 +00:00
|
|
|
; pointer to font data
|
2015-08-29 13:58:57 +00:00
|
|
|
lda #<font
|
|
|
|
sta ptr1
|
|
|
|
lda #>font
|
|
|
|
sta ptr1+1
|
2015-07-12 12:27:24 +00:00
|
|
|
|
2015-08-29 13:58:57 +00:00
|
|
|
st0 #VDC_VWR ; VWR
|
2015-07-16 14:00:32 +00:00
|
|
|
|
2015-08-29 13:58:57 +00:00
|
|
|
lda #0
|
|
|
|
sta tmp1
|
|
|
|
jsr copy
|
2015-07-16 14:00:32 +00:00
|
|
|
|
2015-08-29 13:58:57 +00:00
|
|
|
lda #<font
|
|
|
|
sta ptr1
|
|
|
|
lda #>font
|
|
|
|
sta ptr1+1
|
2015-07-16 14:00:32 +00:00
|
|
|
|
2015-10-02 14:50:22 +00:00
|
|
|
lda #$FF
|
2015-08-29 13:58:57 +00:00
|
|
|
sta tmp1
|
|
|
|
jsr copy
|
2015-07-16 14:00:32 +00:00
|
|
|
|
2015-11-17 14:14:15 +00:00
|
|
|
ldx #0 ; white on black
|
2015-08-29 13:58:57 +00:00
|
|
|
stx BGCOLOR
|
|
|
|
inx
|
|
|
|
stx CHARCOLOR
|
2015-07-16 14:00:32 +00:00
|
|
|
|
2015-08-29 13:58:57 +00:00
|
|
|
rts
|
2015-07-16 14:00:32 +00:00
|
|
|
|
|
|
|
copy:
|
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
|
2015-09-29 16:39:58 +00:00
|
|
|
sta VDC_DATA_LO ; bitplane 0
|
|
|
|
stz VDC_DATA_HI ; bitplane 1
|
2015-08-29 13:58:57 +00:00
|
|
|
|
|
|
|
clc ; increment font pointer
|
|
|
|
lda ptr1
|
|
|
|
adc #$01
|
|
|
|
sta ptr1
|
|
|
|
lda ptr1+1
|
|
|
|
adc #$00
|
|
|
|
sta ptr1+1
|
|
|
|
dex
|
2015-11-17 14:14:15 +00:00
|
|
|
bne lineloop ; next bitplane-0 byte
|
|
|
|
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
|
|
|
|
dey
|
|
|
|
bne charloop ; next character
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
2015-10-02 14:50:22 +00:00
|
|
|
.rodata
|
|
|
|
font: .include "vga.inc"
|