Fixed and improved some pce comments.
This commit is contained in:
parent
2cc822b44e
commit
959eff34a3
15 changed files with 61 additions and 55 deletions
|
@ -13,8 +13,8 @@ CH_VLINE = 2
|
||||||
|
|
||||||
VDC_MAWR = 0 ; Memory Address Write Register
|
VDC_MAWR = 0 ; Memory Address Write Register
|
||||||
VDC_MARR = 1 ; Memory Address Read Register
|
VDC_MARR = 1 ; Memory Address Read Register
|
||||||
VDC_VWR = 2 ; VRAM Write Register (write only)
|
VDC_VWR = 2 ; VRAM Write Register
|
||||||
VDC_VRR = 2 ; VRAM Read Register (read only)
|
VDC_VRR = 2 ; VRAM Read Register
|
||||||
VDC_UNK03 = 3 ; (unknown)
|
VDC_UNK03 = 3 ; (unknown)
|
||||||
VDC_UNK04 = 4 ; (unknown)
|
VDC_UNK04 = 4 ; (unknown)
|
||||||
VDC_CR = 5 ; Control Register
|
VDC_CR = 5 ; Control Register
|
||||||
|
@ -35,8 +35,7 @@ VDC_SATB = 19 ; Sprite Attribute Table
|
||||||
|
|
||||||
; VDC port
|
; VDC port
|
||||||
; Note: The zero-page addressing mode is redirected to page $20.
|
; Note: The zero-page addressing mode is redirected to page $20.
|
||||||
; Therefore, absolute addressing mode must be used when writing to this port.
|
; We avoid it by using mirror locations that are outside of the zero page.
|
||||||
; We force it by using mirror locations that are outside of zero page.
|
|
||||||
|
|
||||||
VDC_CTRL := $0200
|
VDC_CTRL := $0200
|
||||||
VDC_DATA_LO := $0202
|
VDC_DATA_LO := $0202
|
||||||
|
@ -45,7 +44,7 @@ VDC_DATA_HI := $0203
|
||||||
; HuC6260 -- Video Color Encoder (VCE)
|
; HuC6260 -- Video Color Encoder (VCE)
|
||||||
|
|
||||||
; The DAC has a palette of 512 colours.
|
; The DAC has a palette of 512 colours.
|
||||||
; The bitmap of the palette data is this: 0000000gggrrrbbb.
|
; The bitmap of that data is 0000000gggrrrbbb (Green, Red, Blue).
|
||||||
; You can read and write the DAC registers.
|
; You can read and write the DAC registers.
|
||||||
|
|
||||||
VCE := $0400 ; base
|
VCE := $0400 ; base
|
||||||
|
@ -86,8 +85,8 @@ IRQ_STATUS := $1403
|
||||||
CDR_MEM_DISABLE := $1803
|
CDR_MEM_DISABLE := $1803
|
||||||
CDR_MEM_ENABLE := $1807
|
CDR_MEM_ENABLE := $1807
|
||||||
|
|
||||||
; Write VDC register
|
; Write to a VDC register.
|
||||||
.macro VREG arg1,arg2
|
.macro VREG arg1, arg2
|
||||||
st0 #arg1
|
st0 #arg1
|
||||||
st1 #<(arg2)
|
st1 #<(arg2)
|
||||||
st2 #>(arg2)
|
st2 #>(arg2)
|
||||||
|
|
|
@ -4,9 +4,9 @@ SYMBOLS {
|
||||||
__STACKSIZE__: type = weak, value = $0300; # 3 pages stack
|
__STACKSIZE__: type = weak, value = $0300; # 3 pages stack
|
||||||
}
|
}
|
||||||
MEMORY {
|
MEMORY {
|
||||||
ZP: file = "", start = $0000, size = $0100, define = yes;
|
ZP: file = "", start = $0000, define = yes, size = $0100;
|
||||||
# RAM bank
|
# RAM bank
|
||||||
MAIN: file = "", start = $2200, size = $1E00 - __STACKSIZE__, define = yes;
|
MAIN: file = "", start = $2200, define = yes, size = $1E00 - __STACKSIZE__;
|
||||||
# ROM banks, before swapping, and after mapping
|
# ROM banks, before swapping, and after mapping
|
||||||
ROM: file = %O, start = $10000 - __CARTSIZE__, size = __CARTSIZE__, fill = yes, fillval = $FF;
|
ROM: file = %O, start = $10000 - __CARTSIZE__, size = __CARTSIZE__, fill = yes, fillval = $FF;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,9 @@
|
||||||
;
|
;
|
||||||
|
|
||||||
.export _clock
|
.export _clock
|
||||||
.constructor initclock, 24
|
.constructor initclock
|
||||||
|
|
||||||
.forceimport ticktock
|
.forceimport ticktock ; make sure that tickcount changes
|
||||||
.importzp sreg
|
.importzp sreg
|
||||||
|
|
||||||
.include "extzp.inc"
|
.include "extzp.inc"
|
||||||
|
@ -20,6 +20,9 @@
|
||||||
rts
|
rts
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
|
; Make the process clock start at zero.
|
||||||
|
|
||||||
.segment "ONCE"
|
.segment "ONCE"
|
||||||
initclock:
|
initclock:
|
||||||
lda #0
|
lda #0
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
;
|
||||||
|
; Clear (erase) the screen.
|
||||||
|
;
|
||||||
|
; Support the full 128- x 64-tile background.
|
||||||
|
;
|
||||||
|
|
||||||
.export _clrscr
|
.export _clrscr
|
||||||
|
|
||||||
.import plot
|
.import plot
|
||||||
|
@ -15,9 +21,9 @@ _clrscr:
|
||||||
rowloop:
|
rowloop:
|
||||||
ldx #$80
|
ldx #$80
|
||||||
colloop:
|
colloop:
|
||||||
lda #' '
|
lda #' ' ; low byte of char. index
|
||||||
sta VDC_DATA_LO
|
sta VDC_DATA_LO
|
||||||
lda #$02
|
lda #$02 ; background color, high nybble of char. index
|
||||||
sta VDC_DATA_HI
|
sta VDC_DATA_HI
|
||||||
|
|
||||||
dex
|
dex
|
||||||
|
|
|
@ -12,17 +12,17 @@
|
||||||
.include "pce.inc"
|
.include "pce.inc"
|
||||||
.include "extzp.inc"
|
.include "extzp.inc"
|
||||||
|
|
||||||
_bordercolor := return0
|
_bordercolor := return0 ; always black
|
||||||
|
|
||||||
_textcolor:
|
_textcolor:
|
||||||
ldx CHARCOLOR ; get old value
|
ldx CHARCOLOR ; get old value
|
||||||
sta CHARCOLOR ; set new value
|
sta CHARCOLOR ; set new value
|
||||||
txa
|
txa
|
||||||
rts
|
rts
|
||||||
|
|
||||||
_bgcolor:
|
_bgcolor:
|
||||||
ldx BGCOLOR ; get old value
|
ldx BGCOLOR ; get old value
|
||||||
sta BGCOLOR ; set new value
|
sta BGCOLOR ; set new value
|
||||||
asl a
|
asl a
|
||||||
tay
|
tay
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ colors: .word ((0<<6)+(0<<3)+(0)) ; $0 black
|
||||||
.word ((7<<6)+(7<<3)+(7)) ; $1 white
|
.word ((7<<6)+(7<<3)+(7)) ; $1 white
|
||||||
.word ((0<<6)+(7<<3)+(0)) ; $2 red
|
.word ((0<<6)+(7<<3)+(0)) ; $2 red
|
||||||
.word ((7<<6)+(0<<3)+(7)) ; $3 cyan
|
.word ((7<<6)+(0<<3)+(7)) ; $3 cyan
|
||||||
.word ((0<<6)+(5<<3)+(7)) ; $4 violett
|
.word ((0<<6)+(5<<3)+(7)) ; $4 violet
|
||||||
.word ((7<<6)+(0<<3)+(0)) ; $5 green
|
.word ((7<<6)+(0<<3)+(0)) ; $5 green
|
||||||
.word ((0<<6)+(0<<3)+(7)) ; $6 blue
|
.word ((0<<6)+(0<<3)+(7)) ; $6 blue
|
||||||
.word ((7<<6)+(7<<3)+(0)) ; $7 yellow
|
.word ((7<<6)+(7<<3)+(0)) ; $7 yellow
|
||||||
|
|
|
@ -28,7 +28,7 @@ set_palette:
|
||||||
|
|
||||||
ldx #0
|
ldx #0
|
||||||
@lp:
|
@lp:
|
||||||
ldy #16
|
ldy #16 ; size of a pallette
|
||||||
@lp1:
|
@lp1:
|
||||||
lda colors,x
|
lda colors,x
|
||||||
sta VCE_DATA_LO
|
sta VCE_DATA_LO
|
||||||
|
@ -42,6 +42,8 @@ set_palette:
|
||||||
cpx #16 * 2
|
cpx #16 * 2
|
||||||
jne @lp
|
jne @lp
|
||||||
|
|
||||||
|
; Set background to black.
|
||||||
|
|
||||||
stz VCE_ADDR_LO
|
stz VCE_ADDR_LO
|
||||||
stz VCE_ADDR_HI
|
stz VCE_ADDR_HI
|
||||||
stz VCE_DATA_LO
|
stz VCE_DATA_LO
|
||||||
|
@ -49,13 +51,18 @@ set_palette:
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
;----------------------------------------------------------------------------
|
||||||
|
; 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.
|
||||||
|
|
||||||
conio_init:
|
conio_init:
|
||||||
; Load font
|
; Load font
|
||||||
st0 #VDC_MAWR
|
st0 #VDC_MAWR
|
||||||
st1 #<$2000
|
st1 #<$2000
|
||||||
st2 #>$2000
|
st2 #>$2000
|
||||||
|
|
||||||
; ptr to font data
|
; pointer to font data
|
||||||
lda #<font
|
lda #<font
|
||||||
sta ptr1
|
sta ptr1
|
||||||
lda #>font
|
lda #>font
|
||||||
|
@ -76,7 +83,7 @@ conio_init:
|
||||||
sta tmp1
|
sta tmp1
|
||||||
jsr copy
|
jsr copy
|
||||||
|
|
||||||
ldx #0
|
ldx #0 ; white on black
|
||||||
stx BGCOLOR
|
stx BGCOLOR
|
||||||
inx
|
inx
|
||||||
stx CHARCOLOR
|
stx CHARCOLOR
|
||||||
|
@ -101,11 +108,11 @@ lineloop:
|
||||||
adc #$00
|
adc #$00
|
||||||
sta ptr1+1
|
sta ptr1+1
|
||||||
dex
|
dex
|
||||||
bne lineloop ; next bitplane 0 byte
|
bne lineloop ; next bitplane-0 byte
|
||||||
ldx #$08 ; fill bitplane 2/3 with 0
|
ldx #$08 ; fill bitplanes 2 and 3 with 0
|
||||||
fillloop:
|
fillloop:
|
||||||
st1 #$00
|
st1 #<$0000
|
||||||
st2 #$00
|
st2 #>$0000
|
||||||
dex
|
dex
|
||||||
bne fillloop ; next byte
|
bne fillloop ; next byte
|
||||||
dey
|
dey
|
||||||
|
|
|
@ -25,10 +25,10 @@ _cputc: cmp #$0D ; CR?
|
||||||
bne L1
|
bne L1
|
||||||
lda #0
|
lda #0
|
||||||
sta CURS_X
|
sta CURS_X
|
||||||
beq plot ; Recalculate pointers
|
beq plot ; Recalculate pointer
|
||||||
|
|
||||||
L1: cmp #$0A ; LF?
|
L1: cmp #$0A ; LF?
|
||||||
beq newline ; Recalculate pointers
|
beq newline ; Recalculate pointer
|
||||||
|
|
||||||
; Printable char of some sort
|
; Printable char of some sort
|
||||||
|
|
||||||
|
@ -50,23 +50,21 @@ L3: sty CURS_X
|
||||||
newline:
|
newline:
|
||||||
inc CURS_Y
|
inc CURS_Y
|
||||||
|
|
||||||
; Set cursor position, calculate RAM pointers
|
; Set cursor position; calculate VRAM pointer.
|
||||||
|
|
||||||
plot: ldy CURS_X
|
plot: ldy CURS_X
|
||||||
ldx CURS_Y
|
ldx CURS_Y
|
||||||
clc
|
clc
|
||||||
jmp PLOT ; Set the new cursor
|
jmp PLOT ; Set the new cursor
|
||||||
|
|
||||||
; Write one character to the screen without doing anything else, return X
|
; Write one character to the screen without doing anything else.
|
||||||
; position in Y
|
|
||||||
|
|
||||||
putchar:
|
putchar:
|
||||||
|
|
||||||
ora RVS ; Set revers bit
|
ora RVS ; Set revers bit
|
||||||
|
|
||||||
tax
|
tax
|
||||||
|
|
||||||
st0 #VDC_MAWR ; Memory Adress Write
|
st0 #VDC_MAWR ; Memory Address Write
|
||||||
|
|
||||||
lda SCREEN_PTR
|
lda SCREEN_PTR
|
||||||
sta VDC_DATA_LO
|
sta VDC_DATA_LO
|
||||||
|
@ -79,8 +77,7 @@ putchar:
|
||||||
txa
|
txa
|
||||||
sta VDC_DATA_LO ; character
|
sta VDC_DATA_LO ; character
|
||||||
|
|
||||||
lda CHARCOLOR
|
lda CHARCOLOR ; pallette number
|
||||||
|
|
||||||
asl a
|
asl a
|
||||||
asl a
|
asl a
|
||||||
asl a
|
asl a
|
||||||
|
|
|
@ -36,7 +36,7 @@ start: sei
|
||||||
csh ; Set high-speed CPU mode
|
csh ; Set high-speed CPU mode
|
||||||
nop
|
nop
|
||||||
|
|
||||||
; Set up stack and memory mapping
|
; Set up stack and memory mapping.
|
||||||
ldx #$FF ; Stack top ($21FF)
|
ldx #$FF ; Stack top ($21FF)
|
||||||
txs
|
txs
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ start: sei
|
||||||
|
|
||||||
; Turn on background and VD interrupt/IRQ1
|
; Turn on background and VD interrupt/IRQ1
|
||||||
lda #$05
|
lda #$05
|
||||||
sta IRQ_MASK ; IRQ1=on
|
sta IRQ_MASK ; IRQ1 = on
|
||||||
|
|
||||||
; Copy the .data segment to RAM
|
; Copy the .data segment to RAM
|
||||||
tii __DATA_LOAD__, __DATA_RUN__, __DATA_SIZE__
|
tii __DATA_LOAD__, __DATA_RUN__, __DATA_SIZE__
|
||||||
|
@ -87,7 +87,7 @@ start: sei
|
||||||
lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
|
lda #<(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
|
||||||
ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
|
ldx #>(__MAIN_START__ + __MAIN_SIZE__ + __STACKSIZE__)
|
||||||
sta sp
|
sta sp
|
||||||
stx sp + 1
|
stx sp+1
|
||||||
|
|
||||||
; Call module constructors
|
; Call module constructors
|
||||||
jsr initlib
|
jsr initlib
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
.include "ctype.inc"
|
.include "ctype.inc"
|
||||||
|
|
||||||
; The tables are readonly, put them into the rodata segment
|
; The tables are read-only; put them into the RODATA segment.
|
||||||
|
|
||||||
.rodata
|
.rodata
|
||||||
|
|
||||||
|
@ -23,7 +23,6 @@
|
||||||
;
|
;
|
||||||
; * We save some code in the isxxx functions.
|
; * We save some code in the isxxx functions.
|
||||||
|
|
||||||
|
|
||||||
__ctype:
|
__ctype:
|
||||||
.repeat 2
|
.repeat 2
|
||||||
.byte CT_CTRL ; 0/00 ___ctrl_@___
|
.byte CT_CTRL ; 0/00 ___ctrl_@___
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
;
|
;
|
||||||
; void gotoxy (unsigned char x, unsigned char y);
|
; void __fastcall__ gotoxy (unsigned char x, unsigned char y);
|
||||||
;
|
;
|
||||||
|
|
||||||
.export gotoxy, _gotoxy
|
.export gotoxy, _gotoxy
|
||||||
|
|
|
@ -7,8 +7,7 @@
|
||||||
;
|
;
|
||||||
|
|
||||||
.export _joy_static_stddrv
|
.export _joy_static_stddrv
|
||||||
|
|
||||||
.import _pce_stdjoy_joy
|
.import _pce_stdjoy_joy
|
||||||
|
|
||||||
.rodata
|
|
||||||
|
|
||||||
_joy_static_stddrv := _pce_stdjoy_joy
|
_joy_static_stddrv := _pce_stdjoy_joy
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
.segment "ONCE"
|
.segment "ONCE"
|
||||||
psg_init:
|
psg_init:
|
||||||
clx
|
clx
|
||||||
stz PSG_GLOBAL_PAN ; Clear global balance
|
stz PSG_GLOBAL_PAN ; Silence global balance
|
||||||
|
|
||||||
psg_clear_loop:
|
psg_clear_loop:
|
||||||
stx PSG_CHAN_SELECT ; Select channel
|
stx PSG_CHAN_SELECT ; Select channel
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
|
;
|
||||||
|
; Ullrich von Bassewitz, 07.08.1998
|
||||||
|
;
|
||||||
|
; unsigned char revers (unsigned char onoff);
|
||||||
|
;
|
||||||
|
|
||||||
.export _revers
|
.export _revers
|
||||||
|
|
||||||
.include "pce.inc"
|
|
||||||
.include "extzp.inc"
|
.include "extzp.inc"
|
||||||
|
|
||||||
.proc _revers
|
.proc _revers
|
||||||
|
@ -18,9 +22,3 @@ L2: ldx #$00 ; Load high byte of result
|
||||||
tya ; Load low byte, set CC
|
tya ; Load low byte, set CC
|
||||||
rts
|
rts
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
;-------------------------------------------------------------------------------
|
|
||||||
; force the init constructor to be imported
|
|
||||||
|
|
||||||
.import initconio
|
|
||||||
conio_init = initconio
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
.export vdc_init
|
.export vdc_init
|
||||||
|
|
||||||
.include "pce.inc"
|
.include "pce.inc"
|
||||||
|
@ -15,7 +14,7 @@ vdc_init:
|
||||||
VREG $06, $0000 ; RCR
|
VREG $06, $0000 ; RCR
|
||||||
VREG $07, $0000 ; BXR
|
VREG $07, $0000 ; BXR
|
||||||
VREG $08, $0000 ; BYR
|
VREG $08, $0000 ; BYR
|
||||||
VREG $09, $0070 ; MAWR
|
VREG $09, $0070 ; MWR
|
||||||
VREG $0C, $1702 ; CRTC - VSR
|
VREG $0C, $1702 ; CRTC - VSR
|
||||||
VREG $0D, $00DF ; CRTC - VDS
|
VREG $0D, $00DF ; CRTC - VDS
|
||||||
VREG $0E, $000C ; CRTC - VDE
|
VREG $0E, $000C ; CRTC - VDE
|
||||||
|
|
|
@ -6,9 +6,8 @@
|
||||||
|
|
||||||
.export _waitvsync
|
.export _waitvsync
|
||||||
|
|
||||||
.forceimport ticktock
|
.forceimport ticktock ; make sure that tickcount changes
|
||||||
|
|
||||||
.include "pce.inc"
|
|
||||||
.include "extzp.inc"
|
.include "extzp.inc"
|
||||||
|
|
||||||
.proc _waitvsync
|
.proc _waitvsync
|
||||||
|
|
Loading…
Add table
Reference in a new issue