Style changes.
This commit is contained in:
parent
203200e259
commit
b5d939c858
23 changed files with 142 additions and 159 deletions
|
@ -9,7 +9,7 @@ charsperline = 61
|
||||||
CH_HLINE = 1
|
CH_HLINE = 1
|
||||||
CH_VLINE = 2
|
CH_VLINE = 2
|
||||||
|
|
||||||
; huc6270 - Video Display Controller (VDC)
|
; HuC6270 - Video Display Controller (VDC)
|
||||||
|
|
||||||
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
|
||||||
|
@ -42,21 +42,21 @@ VDC_CTRL := $0200
|
||||||
VDC_DATA_LO := $0202
|
VDC_DATA_LO := $0202
|
||||||
VDC_DATA_HI := $0203
|
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.
|
||||||
; bitmap of the palette data is this: 0000000gggrrrbbb.
|
; The bitmap of the palette data is this: 0000000gggrrrbbb.
|
||||||
; You can read and write the DAC-registers.
|
; You can read and write the DAC registers.
|
||||||
|
|
||||||
VCE = $0400 ; base
|
VCE = $0400 ; base
|
||||||
|
|
||||||
VCE_CTRL = $0400 ; write$00 to reset
|
VCE_CTRL = $0400 ; write $00 to reset
|
||||||
VCE_ADDR_LO = $0402 ; LSB of byte offset into palette
|
VCE_ADDR_LO = $0402 ; LSB of byte offset into palette
|
||||||
VCE_ADDR_HI = $0403 ; MSB of byte offset into palette
|
VCE_ADDR_HI = $0403 ; MSB of byte offset into palette
|
||||||
VCE_DATA_LO = $0404 ; LSB of 16-bit palette data
|
VCE_DATA_LO = $0404 ; LSB of 16-bit palette data
|
||||||
VCE_DATA_HI = $0405 ; MSB of 16-bit palette data
|
VCE_DATA_HI = $0405 ; MSB of 16-bit palette data
|
||||||
|
|
||||||
; programmable sound generator (PSG)
|
; Programmable Sound Generator (PSG)
|
||||||
|
|
||||||
PSG = $0800 ; base
|
PSG = $0800 ; base
|
||||||
|
|
||||||
|
@ -71,12 +71,12 @@ PSG_NOISE = $0807
|
||||||
PSG_LFO_FREQ = $0808
|
PSG_LFO_FREQ = $0808
|
||||||
PSG_LFO_CTRL = $0809
|
PSG_LFO_CTRL = $0809
|
||||||
|
|
||||||
; timer
|
; Timer
|
||||||
|
|
||||||
TIMER = $0c00 ; base
|
TIMER = $0C00 ; base
|
||||||
|
|
||||||
TIMER_COUNT = $0c00
|
TIMER_COUNT = $0C00
|
||||||
TIMER_CTRL = $0c01
|
TIMER_CTRL = $0C01
|
||||||
|
|
||||||
JOY_CTRL = $1000
|
JOY_CTRL = $1000
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# linker config. to produce a NEC PC-Engine 8K, 16K, or 32K image (.bin)
|
# Linker config. to produce a NEC PC-Engine 8K, 16K, or 32K image (.bin)
|
||||||
SYMBOLS {
|
SYMBOLS {
|
||||||
__CARTSIZE__: type = weak, value = $2000; # $2000, $4000, or $8000
|
__CARTSIZE__: type = weak, value = $2000; # $2000, $4000, or $8000
|
||||||
__STACKSIZE__: type = weak, value = $0300; # 3 pages stack
|
__STACKSIZE__: type = weak, value = $0300; # 3 pages stack
|
||||||
|
|
58
doc/pce.sgml
58
doc/pce.sgml
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
<article>
|
<article>
|
||||||
|
|
||||||
<title>PC-Engine (TurboGrafx) System specific information for cc65
|
<title>PC-Engine (TurboGrafx 16) System-specific information for cc65
|
||||||
<author><url url="mailto:groepaz@gmx.net" name="Groepaz/Hitmen">,<newline>
|
<author><url url="mailto:groepaz@gmx.net" name="Groepaz/Hitmen">,<newline>
|
||||||
<url url="mailto:greg.king5@verizon.net" name="Greg King">
|
<url url="mailto:greg.king5@verizon.net" name="Greg King">
|
||||||
<date>2018-02-12
|
<date>2018-02-24
|
||||||
|
|
||||||
<abstract>
|
<abstract>
|
||||||
An overview over the PCE runtime system as it is implemented for the
|
An overview over the PCE runtime system as it is implemented for the
|
||||||
|
@ -20,12 +20,12 @@ cc65 C compiler.
|
||||||
<sect>Overview<p>
|
<sect>Overview<p>
|
||||||
|
|
||||||
This file contains an overview of the PCE runtime system as it comes
|
This file contains an overview of the PCE runtime system as it comes
|
||||||
with the cc65 C compiler. It describes the memory layout, PCE specific header
|
with the cc65 C compiler. It describes the memory layout, PCE-specific header
|
||||||
files, available drivers, and any pitfalls specific to that platform.
|
files, available drivers, and any pitfalls specific to that platform.
|
||||||
|
|
||||||
Please note that PCE specific functions are just mentioned here, they are
|
Please note that PCE-specific functions are just mentioned here; they are
|
||||||
described in detail in the separate <url url="funcref.html" name="function
|
described, in detail, in the separate <url url="funcref.html" name="function
|
||||||
reference">. Even functions marked as "platform dependent" may be available on
|
reference">. Even functions marked as "platform dependent" might be available on
|
||||||
more than one platform. Please see the function reference for more
|
more than one platform. Please see the function reference for more
|
||||||
information.
|
information.
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ actually see when they execute the code in that cartridge.
|
||||||
|
|
||||||
<sect>Memory layout<p>
|
<sect>Memory layout<p>
|
||||||
|
|
||||||
cc65 generated programs with the default setup run with the I/O area and a
|
cc65-generated programs with the default setup run with the I/O area and a
|
||||||
CHR bank enabled, which gives a usable memory range of $8000 - $FFF3.
|
CHR bank enabled, which gives a usable memory range of $8000 - $FFF3.
|
||||||
All boot ROM entry points may be called directly without additional code.
|
All boot ROM entry points may be called directly without additional code.
|
||||||
|
|
||||||
|
@ -71,11 +71,11 @@ Special locations:
|
||||||
|
|
||||||
<descrip>
|
<descrip>
|
||||||
<tag/Text screen and Font/
|
<tag/Text screen and Font/
|
||||||
The text screen is located at VRAM $0000,
|
The text screen is located at VRAM $0000;
|
||||||
the Font is located at VRAM $2000.
|
the Font is located at VRAM $2000.
|
||||||
|
|
||||||
<tag/Stack/
|
<tag/Stack/
|
||||||
The C runtime stack is located in system RAM at $3FFF and growing downwards.
|
The C runtime stack is located in system RAM at $3FFF; and, grows downwards.
|
||||||
|
|
||||||
<tag/Data and BSS/
|
<tag/Data and BSS/
|
||||||
The Data (initialized variables) and BSS (uninitialized variables) sections are
|
The Data (initialized variables) and BSS (uninitialized variables) sections are
|
||||||
|
@ -98,12 +98,12 @@ Special locations:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<sect>Platform specific header files<p>
|
<sect>Platform-specific header files<p>
|
||||||
|
|
||||||
Programs containing PCE specific code may use the <tt/pce.h/ header file.
|
Programs containing PCE-specific code may use the <tt/pce.h/ header file.
|
||||||
|
|
||||||
|
|
||||||
<sect1>PCE specific functions<p>
|
<sect1>PCE-specific functions<p>
|
||||||
|
|
||||||
<itemize>
|
<itemize>
|
||||||
<item>waitvsync</item>
|
<item>waitvsync</item>
|
||||||
|
@ -111,11 +111,10 @@ Programs containing PCE specific code may use the <tt/pce.h/ header file.
|
||||||
</itemize>
|
</itemize>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<sect1>Hardware access<p>
|
<sect1>Hardware access<p>
|
||||||
|
|
||||||
The following pseudo variables declared in the <tt/pce.inc/ include file do
|
The following pseudo variables, declared in the <tt/pce.inc/ include file, do
|
||||||
allow access to hardware located in the address space.
|
allow access to hardware that is located in the address space.
|
||||||
|
|
||||||
<descrip>
|
<descrip>
|
||||||
|
|
||||||
|
@ -153,9 +152,9 @@ No extended memory drivers are currently available for the PCE.
|
||||||
<descrip>
|
<descrip>
|
||||||
|
|
||||||
<tag><tt/pce-stdjoy.joy (pce_stdjoy)/</tag>
|
<tag><tt/pce-stdjoy.joy (pce_stdjoy)/</tag>
|
||||||
A joystick driver for the standard two buttons joypad is available.
|
A joystick driver for the standard two-button joypad is available.
|
||||||
|
|
||||||
Note that the japanese 6-button pad is currently not supported.
|
Note that the Japanese 6-button pad currently is not supported.
|
||||||
|
|
||||||
</descrip><p>
|
</descrip><p>
|
||||||
|
|
||||||
|
@ -177,6 +176,7 @@ No serial drivers are currently available for the PCE.
|
||||||
<item>interruptor support in crt0 (and cfg) is missing
|
<item>interruptor support in crt0 (and cfg) is missing
|
||||||
</itemize>
|
</itemize>
|
||||||
|
|
||||||
|
|
||||||
<sect1>Disk I/O<p>
|
<sect1>Disk I/O<p>
|
||||||
|
|
||||||
The existing library for the PCE doesn't implement C file
|
The existing library for the PCE doesn't implement C file
|
||||||
|
@ -197,6 +197,8 @@ following functions (and a few others):
|
||||||
<item>...
|
<item>...
|
||||||
</itemize>
|
</itemize>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<sect>Other hints<p>
|
<sect>Other hints<p>
|
||||||
|
|
||||||
<itemize>
|
<itemize>
|
||||||
|
@ -204,7 +206,7 @@ following functions (and a few others):
|
||||||
emulator to use for the PC-Engine.
|
emulator to use for the PC-Engine.
|
||||||
</itemize>
|
</itemize>
|
||||||
|
|
||||||
some useful resources on PCE coding:
|
Some useful resources on PCE coding:
|
||||||
|
|
||||||
<itemize>
|
<itemize>
|
||||||
<item><url url="http://blog.blockos.org/?tag=pc-engine">
|
<item><url url="http://blog.blockos.org/?tag=pc-engine">
|
||||||
|
@ -218,9 +220,11 @@ some useful resources on PCE coding:
|
||||||
<item><url url="http://www.zeograd.com/parse.php?src=hucf">
|
<item><url url="http://www.zeograd.com/parse.php?src=hucf">
|
||||||
</itemize>
|
</itemize>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<sect>License<p>
|
<sect>License<p>
|
||||||
|
|
||||||
This software is provided 'as-is', without any expressed or implied
|
This software is provided "as-is", without any expressed or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
arising from the use of this software.
|
arising from the use of this software.
|
||||||
|
|
||||||
|
@ -229,14 +233,14 @@ including commercial applications, and to alter it and redistribute it
|
||||||
freely, subject to the following restrictions:
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
<enum>
|
<enum>
|
||||||
<item> The origin of this software must not be misrepresented; you must not
|
<item>The origin of this software must not be misrepresented; you must not
|
||||||
claim that you wrote the original software. If you use this software
|
claim that you wrote the original software. If you use this software
|
||||||
in a product, an acknowledgment in the product documentation would be
|
in a product, an acknowledgment in the product documentation would be
|
||||||
appreciated but is not required.
|
appreciated, but is not required.
|
||||||
<item> Altered source versions must be plainly marked as such, and must not
|
<item>Altered source versions must be marked plainly as such; and, must not
|
||||||
be misrepresented as being the original software.
|
be misrepresented as being the original software.
|
||||||
<item> This notice may not be removed or altered from any source
|
<item>This notice may not be removed or altered from any source
|
||||||
distribution.
|
distribution.
|
||||||
</enum>
|
</enum>
|
||||||
|
|
||||||
</article>
|
</article>
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
/* */
|
/* */
|
||||||
/* pce.h */
|
/* pce.h */
|
||||||
/* */
|
/* */
|
||||||
/* PC-Engine system specific definitions */
|
/* PC-Engine system-specific definitions */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 2015 Groepaz/Hitmen */
|
/* (C) 2015, Groepaz/Hitmen */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* This software is provided 'as-is', without any expressed or implied */
|
/* This software is provided 'as-is', without any expressed or implied */
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
#define CH_ENTER 13
|
#define CH_ENTER 13
|
||||||
#define CH_PI 18
|
#define CH_PI 18
|
||||||
|
|
||||||
/* Color defines (CBM compatible, for conio) */
|
/* Color defines (CBM-compatible, for conio) */
|
||||||
#define COLOR_BLACK 0x00
|
#define COLOR_BLACK 0x00
|
||||||
#define COLOR_WHITE 0x01
|
#define COLOR_WHITE 0x01
|
||||||
#define COLOR_RED 0x02
|
#define COLOR_RED 0x02
|
||||||
|
@ -102,7 +102,7 @@ extern void pce_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
|
||||||
void waitvsync (void);
|
void waitvsync (void);
|
||||||
/* Wait for start of the next frame */
|
/* Wait for start of the next frame */
|
||||||
|
|
||||||
/* NOTE: all PCE are NTSC */
|
/* NOTE: all PCEs are NTSC. */
|
||||||
#define get_tv() TV_NTSC
|
#define get_tv() TV_NTSC
|
||||||
/* Return the video mode the machine is using. */
|
/* Return the video mode the machine is using. */
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
;
|
;
|
||||||
; Screen size variables
|
; Screen size variables
|
||||||
;
|
;
|
||||||
|
.export screensize
|
||||||
|
.export xsize, ysize
|
||||||
|
|
||||||
.include "pce.inc"
|
.include "pce.inc"
|
||||||
|
|
||||||
.export screensize
|
|
||||||
screensize:
|
screensize:
|
||||||
ldx xsize
|
ldx xsize
|
||||||
ldy ysize
|
ldy ysize
|
||||||
|
@ -12,7 +14,6 @@ screensize:
|
||||||
; FIXME: changing the video mode allows for different screen sizes
|
; FIXME: changing the video mode allows for different screen sizes
|
||||||
|
|
||||||
.rodata
|
.rodata
|
||||||
.export xsize, ysize
|
|
||||||
|
|
||||||
xsize: .byte charsperline
|
xsize: .byte charsperline
|
||||||
ysize: .byte screenrows
|
ysize: .byte screenrows
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
;
|
;
|
||||||
|
|
||||||
.export _chlinexy, _chline
|
.export _chlinexy, _chline
|
||||||
|
|
||||||
.import gotoxy, cputdirect
|
.import gotoxy, cputdirect
|
||||||
.importzp tmp1
|
.importzp tmp1
|
||||||
|
|
||||||
|
@ -25,7 +26,3 @@ L1: lda #CH_HLINE ; Horizontal line, screen code
|
||||||
dec tmp1
|
dec tmp1
|
||||||
bne L1
|
bne L1
|
||||||
L9: rts
|
L9: rts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2,17 +2,15 @@
|
||||||
; clock_t clock (void);
|
; clock_t clock (void);
|
||||||
;
|
;
|
||||||
|
|
||||||
.include "pce.inc"
|
|
||||||
.include "extzp.inc"
|
|
||||||
|
|
||||||
.export _clock
|
.export _clock
|
||||||
|
.constructor initclock, 24
|
||||||
|
|
||||||
.forceimport ticktock
|
.forceimport ticktock
|
||||||
.importzp sreg
|
.importzp sreg
|
||||||
.constructor initclock
|
|
||||||
|
|
||||||
|
.include "extzp.inc"
|
||||||
|
|
||||||
.proc _clock
|
.proc _clock
|
||||||
|
|
||||||
lda tickcount+3
|
lda tickcount+3
|
||||||
sta sreg+1
|
sta sreg+1
|
||||||
lda tickcount+2
|
lda tickcount+2
|
||||||
|
@ -20,7 +18,6 @@
|
||||||
ldx tickcount+1
|
ldx tickcount+1
|
||||||
lda tickcount
|
lda tickcount
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
.segment "ONCE"
|
.segment "ONCE"
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
|
.export _clrscr
|
||||||
|
|
||||||
|
.import plot
|
||||||
|
|
||||||
.include "pce.inc"
|
.include "pce.inc"
|
||||||
.include "extzp.inc"
|
.include "extzp.inc"
|
||||||
|
|
||||||
.import plot
|
|
||||||
.export _clrscr
|
|
||||||
_clrscr:
|
_clrscr:
|
||||||
|
|
||||||
st0 #VDC_MAWR
|
st0 #VDC_MAWR
|
||||||
st1 #<$0000
|
st1 #<$0000
|
||||||
st2 #>$0000
|
st2 #>$0000
|
||||||
|
|
|
@ -4,14 +4,15 @@
|
||||||
; unsigned char __fastcall__ bordercolor (unsigned char color);
|
; unsigned char __fastcall__ bordercolor (unsigned char color);
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
.export _textcolor, _bgcolor, _bordercolor
|
.export _textcolor, _bgcolor, _bordercolor
|
||||||
|
.export colors
|
||||||
|
|
||||||
.import return0
|
.import return0
|
||||||
|
|
||||||
.include "pce.inc"
|
.include "pce.inc"
|
||||||
.include "extzp.inc"
|
.include "extzp.inc"
|
||||||
|
|
||||||
_bordercolor = return0
|
_bordercolor := return0
|
||||||
|
|
||||||
_textcolor:
|
_textcolor:
|
||||||
ldx CHARCOLOR ; get old value
|
ldx CHARCOLOR ; get old value
|
||||||
|
@ -35,27 +36,25 @@ _bgcolor:
|
||||||
txa
|
txa
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.rodata
|
.rodata
|
||||||
.export colors
|
|
||||||
|
|
||||||
colors:
|
; G R B
|
||||||
; G R B
|
colors: .word ((0<<6)+(0<<3)+(0)) ; $0 black
|
||||||
.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 violett
|
.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
|
.word ((5<<6)+(7<<3)+(0)) ; $8 orange
|
||||||
.word ((5<<6)+(7<<3)+(0)) ; 8 orange
|
.word ((3<<6)+(4<<3)+(3)) ; $9 brown
|
||||||
.word ((3<<6)+(4<<3)+(3)) ; 9 brown
|
.word ((4<<6)+(7<<3)+(4)) ; $A light red
|
||||||
.word ((4<<6)+(7<<3)+(4)) ; a light red
|
.word ((3<<6)+(3<<3)+(3)) ; $B dark grey
|
||||||
.word ((3<<6)+(3<<3)+(3)) ; b dark grey
|
.word ((4<<6)+(4<<3)+(4)) ; $C middle grey
|
||||||
.word ((4<<6)+(4<<3)+(4)) ; c middle grey
|
.word ((7<<6)+(4<<3)+(4)) ; $D light green
|
||||||
.word ((7<<6)+(4<<3)+(4)) ; d light green
|
.word ((4<<6)+(4<<3)+(7)) ; $E light blue
|
||||||
.word ((4<<6)+(4<<3)+(7)) ; e light blue
|
.word ((6<<6)+(6<<3)+(6)) ; $F light gray
|
||||||
.word ((6<<6)+(6<<3)+(6)) ; f light gray
|
|
||||||
|
|
||||||
;-------------------------------------------------------------------------------
|
;-------------------------------------------------------------------------------
|
||||||
; force the init constructor to be imported
|
; force the init constructor to be imported
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
.include "pce.inc"
|
.constructor initconio, 24
|
||||||
.include "extzp.inc"
|
|
||||||
|
|
||||||
.import vce_init
|
.import vce_init
|
||||||
.import psg_init
|
.import psg_init
|
||||||
|
.import vdc_init
|
||||||
.import colors
|
.import colors
|
||||||
.importzp ptr1, tmp1
|
.importzp ptr1, tmp1
|
||||||
|
|
||||||
.constructor initconio
|
.include "pce.inc"
|
||||||
|
.include "extzp.inc"
|
||||||
.macpack longbranch
|
.macpack longbranch
|
||||||
|
|
||||||
.segment "ONCE"
|
.segment "ONCE"
|
||||||
|
@ -39,7 +39,7 @@ set_palette:
|
||||||
|
|
||||||
inx
|
inx
|
||||||
inx
|
inx
|
||||||
cpx #16*2
|
cpx #16 * 2
|
||||||
jne @lp
|
jne @lp
|
||||||
|
|
||||||
stz VCE_ADDR_LO
|
stz VCE_ADDR_LO
|
||||||
|
@ -72,7 +72,7 @@ conio_init:
|
||||||
lda #>font
|
lda #>font
|
||||||
sta ptr1+1
|
sta ptr1+1
|
||||||
|
|
||||||
lda #$ff
|
lda #$FF
|
||||||
sta tmp1
|
sta tmp1
|
||||||
jsr copy
|
jsr copy
|
||||||
|
|
||||||
|
@ -113,5 +113,5 @@ fillloop:
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
font:
|
.rodata
|
||||||
.include "vga.inc"
|
font: .include "vga.inc"
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
|
|
||||||
.export _cputcxy, _cputc, cputdirect, putchar
|
.export _cputcxy, _cputc, cputdirect, putchar
|
||||||
.export newline, plot
|
.export newline, plot
|
||||||
|
|
||||||
.import gotoxy
|
.import gotoxy
|
||||||
.import PLOT
|
.import PLOT
|
||||||
.import xsize
|
.import xsize
|
||||||
|
.importzp tmp3, tmp4
|
||||||
.importzp tmp3,tmp4
|
|
||||||
|
|
||||||
.include "pce.inc"
|
.include "pce.inc"
|
||||||
.include "extzp.inc"
|
.include "extzp.inc"
|
||||||
|
@ -21,13 +21,13 @@ _cputcxy:
|
||||||
|
|
||||||
; Plot a character - also used as internal function
|
; Plot a character - also used as internal function
|
||||||
|
|
||||||
_cputc: cmp #$0d ; CR?
|
_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 pointers
|
||||||
|
|
||||||
L1: cmp #$0a ; LF?
|
L1: cmp #$0A ; LF?
|
||||||
beq newline ; Recalculate pointers
|
beq newline ; Recalculate pointers
|
||||||
|
|
||||||
; Printable char of some sort
|
; Printable char of some sort
|
||||||
|
@ -43,7 +43,7 @@ advance:
|
||||||
cpy xsize
|
cpy xsize
|
||||||
bne L3
|
bne L3
|
||||||
jsr newline ; new line
|
jsr newline ; new line
|
||||||
ldy #0 ; + cr
|
ldy #0 ; + CR
|
||||||
L3: sty CURS_X
|
L3: sty CURS_X
|
||||||
jmp plot
|
jmp plot
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ putchar:
|
||||||
lda SCREEN_PTR
|
lda SCREEN_PTR
|
||||||
sta VDC_DATA_LO
|
sta VDC_DATA_LO
|
||||||
|
|
||||||
lda SCREEN_PTR + 1
|
lda SCREEN_PTR+1
|
||||||
sta VDC_DATA_HI
|
sta VDC_DATA_HI
|
||||||
|
|
||||||
st0 #VDC_VWR ; VWR
|
st0 #VDC_VWR ; VWR
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
;
|
;
|
||||||
; Startup code for cc65 (PCEngine version)
|
; Startup code for cc65 (PCEngine version)
|
||||||
;
|
;
|
||||||
; by Groepaz/Hitmen <groepaz@gmx.net>
|
; by Groepaz/Hitmen <groepaz@gmx.net>,
|
||||||
; based on code by Ullrich von Bassewitz <uz@cc65.org>
|
; based on code by Ullrich von Bassewitz <uz@cc65.org>.
|
||||||
;
|
;
|
||||||
; 2018-02-11, Greg King
|
; 2018-02-11, Greg King
|
||||||
;
|
;
|
||||||
|
@ -28,16 +28,12 @@
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; Place the startup code in a special segment.
|
; Place the startup code in a special segment.
|
||||||
|
|
||||||
.segment "STARTUP"
|
.segment "STARTUP"
|
||||||
|
|
||||||
start:
|
|
||||||
|
|
||||||
; Set up the CPU and System-IRQ
|
|
||||||
|
|
||||||
; Initialize CPU
|
; Initialize CPU
|
||||||
sei
|
start: sei
|
||||||
nop
|
nop
|
||||||
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
|
||||||
|
@ -64,7 +60,7 @@ start:
|
||||||
inc a
|
inc a
|
||||||
@L1: tam #%01000000 ; $C000-$DFFF = ROM bank 3 (32K) or 1 (16K)
|
@L1: tam #%01000000 ; $C000-$DFFF = ROM bank 3 (32K) or 1 (16K)
|
||||||
;lda #$00 ; (The reset default)
|
;lda #$00 ; (The reset default)
|
||||||
;tam #%10000000 ; $E000-$FFFF hucard/syscard bank 0
|
;tam #%10000000 ; $E000-$FFFF Hucard/Syscard bank 0
|
||||||
|
|
||||||
; Initialize hardware
|
; Initialize hardware
|
||||||
stz TIMER_CTRL ; Timer off
|
stz TIMER_CTRL ; Timer off
|
||||||
|
@ -72,7 +68,7 @@ start:
|
||||||
sta IRQ_MASK ; Interrupts off
|
sta IRQ_MASK ; Interrupts off
|
||||||
stz IRQ_STATUS ; Acknowledge timer
|
stz IRQ_STATUS ; Acknowledge timer
|
||||||
|
|
||||||
; FIXME; i dont know why the heck this one doesnt work when called from a constructor :/
|
; FIXME; I don't know why the heck this one doesn't work when called from a constructor. :/
|
||||||
.import vdc_init
|
.import vdc_init
|
||||||
jsr vdc_init
|
jsr vdc_init
|
||||||
|
|
||||||
|
@ -96,24 +92,22 @@ start:
|
||||||
; Call module constructors
|
; Call module constructors
|
||||||
jsr initlib
|
jsr initlib
|
||||||
|
|
||||||
cli ; allow IRQ only after constructors have run
|
cli ; allow IRQ only after constructors have run
|
||||||
|
|
||||||
; Pass an empty command line
|
; Pass an empty command line
|
||||||
jsr push0 ; argc
|
jsr push0 ; argc
|
||||||
jsr push0 ; argv
|
jsr push0 ; argv
|
||||||
|
|
||||||
ldy #4 ; Argument size
|
ldy #4 ; Argument size
|
||||||
jsr _main ; Call the users code
|
jsr _main ; Call the user's code
|
||||||
|
|
||||||
; Call module destructors. This is also the _exit entry.
|
; Call module destructors. This is also the _exit entry.
|
||||||
_exit:
|
_exit: jsr donelib ; Run module destructors
|
||||||
jsr donelib ; Run module destructors
|
|
||||||
|
|
||||||
; reset the PCEngine (start over)
|
; reset the PCEngine (start over)
|
||||||
jmp start
|
jmp start
|
||||||
|
|
||||||
_nmi:
|
_nmi: rti
|
||||||
rti
|
|
||||||
|
|
||||||
.export initmainargs
|
.export initmainargs
|
||||||
initmainargs:
|
initmainargs:
|
||||||
|
@ -122,10 +116,10 @@ initmainargs:
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
; hardware vectors
|
; hardware vectors
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
.segment "VECTORS"
|
.segment "VECTORS"
|
||||||
|
|
||||||
.word IRQStub ; $fff6 IRQ2 (External IRQ, BRK)
|
.word IRQStub ; $FFF6 IRQ2 (External IRQ, BRK)
|
||||||
.word IRQStub ; $fff8 IRQ1 (VDC)
|
.word IRQStub ; $FFF8 IRQ1 (VDC)
|
||||||
.word IRQStub ; $fffa Timer
|
.word IRQStub ; $FFFA Timer
|
||||||
.word _nmi ; $fffc NMI
|
.word _nmi ; $FFFC NMI
|
||||||
.word start ; $fffe reset
|
.word start ; $FFFE reset
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
.rodata
|
.rodata
|
||||||
|
|
||||||
; The following 256 byte wide table specifies attributes for the isxxx type
|
; The following 256-byte-wide table specifies attributes for the isxxx type
|
||||||
; of functions. Doing it by a table means some overhead in space, but it
|
; of functions. Doing it by a table means some overhead in space, but it
|
||||||
; has major advantages:
|
; has major advantages:
|
||||||
;
|
;
|
||||||
|
@ -157,5 +157,3 @@ __ctype:
|
||||||
.byte CT_NONE ; 126/7e _____~_____
|
.byte CT_NONE ; 126/7e _____~_____
|
||||||
.byte CT_OTHER_WS ; 127/7f ____DEL____
|
.byte CT_OTHER_WS ; 127/7f ____DEL____
|
||||||
.endrepeat
|
.endrepeat
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
;
|
;
|
||||||
|
|
||||||
.export _cvlinexy, _cvline
|
.export _cvlinexy, _cvline
|
||||||
|
|
||||||
.import gotoxy, putchar, newline
|
.import gotoxy, putchar, newline
|
||||||
.importzp tmp1
|
.importzp tmp1
|
||||||
|
|
||||||
|
@ -26,6 +27,3 @@ L1: lda #CH_VLINE ; Vertical bar
|
||||||
dec tmp1
|
dec tmp1
|
||||||
bne L1
|
bne L1
|
||||||
L9: rts
|
L9: rts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,15 +4,15 @@
|
||||||
; zeropage locations for exclusive use by the library
|
; zeropage locations for exclusive use by the library
|
||||||
;
|
;
|
||||||
|
|
||||||
.include "extzp.inc"
|
.include "extzp.inc"
|
||||||
|
|
||||||
.segment "EXTZP" : zeropage
|
.segment "EXTZP" : zeropage
|
||||||
|
|
||||||
CURS_X: .res 1
|
CURS_X: .res 1
|
||||||
CURS_Y: .res 1
|
CURS_Y: .res 1
|
||||||
SCREEN_PTR: .res 2
|
SCREEN_PTR: .res 2
|
||||||
CHARCOLOR: .res 1
|
CHARCOLOR: .res 1
|
||||||
RVS: .res 1
|
RVS: .res 1
|
||||||
BGCOLOR: .res 1
|
BGCOLOR: .res 1
|
||||||
tickcount: .res 4
|
tickcount: .res 4
|
||||||
vdc_flags: .res 1
|
vdc_flags: .res 1
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
;
|
;
|
||||||
|
|
||||||
.export gotoxy, _gotoxy
|
.export gotoxy, _gotoxy
|
||||||
|
|
||||||
.import popa, plot
|
.import popa, plot
|
||||||
|
|
||||||
.include "pce.inc"
|
.include "pce.inc"
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
;
|
;
|
||||||
; Standard joystick driver for the PCEngine
|
; Standard joystick driver for the PCEngine
|
||||||
;
|
;
|
||||||
|
@ -17,8 +16,8 @@
|
||||||
|
|
||||||
; Driver signature
|
; Driver signature
|
||||||
|
|
||||||
.byte $6A, $6F, $79 ; "joy"
|
.byte $6A, $6F, $79 ; "joy"
|
||||||
.byte JOY_API_VERSION ; Driver API version number
|
.byte JOY_API_VERSION ; Driver API version number
|
||||||
|
|
||||||
; Library reference
|
; Library reference
|
||||||
|
|
||||||
|
@ -43,7 +42,7 @@ JOY_COUNT = 4 ; Number of joysticks we support
|
||||||
; INSTALL routine. Is called after the driver is loaded into memory. If
|
; INSTALL routine. Is called after the driver is loaded into memory. If
|
||||||
; possible, check if the hardware is present and determine the amount of
|
; possible, check if the hardware is present and determine the amount of
|
||||||
; memory available.
|
; memory available.
|
||||||
; Must return an JOY_ERR_xx code in a/x.
|
; Must return a JOY_ERR_xx code in a/x.
|
||||||
;
|
;
|
||||||
|
|
||||||
INSTALL:
|
INSTALL:
|
||||||
|
@ -90,7 +89,7 @@ joy1:
|
||||||
rts
|
rts
|
||||||
|
|
||||||
read_joy:
|
read_joy:
|
||||||
; reset multitap counter
|
; Reset Multitap counter.
|
||||||
lda #$01
|
lda #$01
|
||||||
sta JOY_CTRL
|
sta JOY_CTRL
|
||||||
pha
|
pha
|
||||||
|
@ -108,7 +107,7 @@ read_joy:
|
||||||
cly
|
cly
|
||||||
nextpad:
|
nextpad:
|
||||||
lda #$01
|
lda #$01
|
||||||
sta JOY_CTRL ; sel = 1
|
sta JOY_CTRL ; sel = 1
|
||||||
pha
|
pha
|
||||||
pla
|
pla
|
||||||
nop ; some delay is required
|
nop ; some delay is required
|
||||||
|
@ -119,21 +118,20 @@ nextpad:
|
||||||
asl a
|
asl a
|
||||||
asl a
|
asl a
|
||||||
asl a
|
asl a
|
||||||
sta padbuffer, y ; store new value
|
sta padbuffer,y ; store new value
|
||||||
|
|
||||||
stz JOY_CTRL
|
stz JOY_CTRL
|
||||||
pha
|
pha
|
||||||
pla
|
pla
|
||||||
|
|
||||||
nop ; some delay is required
|
nop ; some delay is required
|
||||||
nop
|
nop
|
||||||
|
|
||||||
lda JOY_CTRL
|
lda JOY_CTRL
|
||||||
and #$0F
|
and #$0F
|
||||||
ora padbuffer, y ; second half of new value
|
ora padbuffer,y ; second half of new value
|
||||||
|
|
||||||
eor #$FF
|
eor #$FF
|
||||||
sta padbuffer, y ; store new value
|
sta padbuffer,y ; store new value
|
||||||
|
|
||||||
iny
|
iny
|
||||||
cpy #$05
|
cpy #$05
|
||||||
|
@ -144,4 +142,3 @@ nextpad:
|
||||||
|
|
||||||
padbuffer:
|
padbuffer:
|
||||||
.res 4
|
.res 4
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ PLOT:
|
||||||
ldy CURS_X
|
ldy CURS_X
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.rodata
|
.rodata
|
||||||
|
|
||||||
_plotlo:
|
_plotlo:
|
||||||
.repeat screenrows,line
|
.repeat screenrows,line
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
.include "pce.inc"
|
|
||||||
|
|
||||||
.export psg_init
|
.export psg_init
|
||||||
|
|
||||||
|
.include "pce.inc"
|
||||||
|
|
||||||
.segment "ONCE"
|
.segment "ONCE"
|
||||||
psg_init:
|
psg_init:
|
||||||
clx
|
clx
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
|
|
||||||
|
.export _revers
|
||||||
|
|
||||||
.include "pce.inc"
|
.include "pce.inc"
|
||||||
.include "extzp.inc"
|
.include "extzp.inc"
|
||||||
|
|
||||||
.export _revers
|
|
||||||
|
|
||||||
.proc _revers
|
.proc _revers
|
||||||
|
|
||||||
ldx #$00 ; Assume revers off
|
ldx #$00 ; Assume revers off
|
||||||
tay ; Test onoff
|
tay ; Test onoff
|
||||||
beq L1 ; Jump if off
|
beq L1 ; Jump if off
|
||||||
|
@ -18,7 +17,6 @@ L1: lda RVS ; Load old value
|
||||||
L2: ldx #$00 ; Load high byte of result
|
L2: ldx #$00 ; Load high byte of result
|
||||||
tya ; Load low byte, set CC
|
tya ; Load low byte, set CC
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
;-------------------------------------------------------------------------------
|
;-------------------------------------------------------------------------------
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
.include "pce.inc"
|
|
||||||
|
|
||||||
.export vce_init
|
.export vce_init
|
||||||
|
|
||||||
|
.include "pce.inc"
|
||||||
|
|
||||||
.segment "ONCE"
|
.segment "ONCE"
|
||||||
vce_init:
|
vce_init:
|
||||||
; Set CTA to zero
|
; Set CTA to zero
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
|
|
||||||
|
.export vdc_init
|
||||||
|
|
||||||
.include "pce.inc"
|
.include "pce.inc"
|
||||||
|
|
||||||
; FIXME: implement selection of different video modes at runtime
|
; FIXME: implement selection of different video modes at runtime
|
||||||
HIRES = 1
|
HIRES = 1
|
||||||
|
|
||||||
.export vdc_init
|
|
||||||
|
|
||||||
vdc_init:
|
vdc_init:
|
||||||
lda VDC_CTRL
|
lda VDC_CTRL
|
||||||
|
|
||||||
|
|
|
@ -4,17 +4,16 @@
|
||||||
; void waitvsync (void);
|
; void waitvsync (void);
|
||||||
;
|
;
|
||||||
|
|
||||||
|
.export _waitvsync
|
||||||
|
|
||||||
|
.forceimport ticktock
|
||||||
|
|
||||||
.include "pce.inc"
|
.include "pce.inc"
|
||||||
.include "extzp.inc"
|
.include "extzp.inc"
|
||||||
|
|
||||||
.forceimport ticktock
|
|
||||||
.export _waitvsync
|
|
||||||
|
|
||||||
.proc _waitvsync
|
.proc _waitvsync
|
||||||
|
|
||||||
lda tickcount
|
lda tickcount
|
||||||
@lp: cmp tickcount
|
@lp: cmp tickcount
|
||||||
beq @lp
|
beq @lp
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
Loading…
Add table
Reference in a new issue