diff --git a/asminc/c64.inc b/asminc/c64.inc index f450fcc0b..5815bebf9 100644 --- a/asminc/c64.inc +++ b/asminc/c64.inc @@ -6,6 +6,8 @@ ; --------------------------------------------------------------------------- ; Zero page, Commodore stuff +VARTAB := $2D ; Pointer to start of BASIC variables +MEMSIZE := $37 ; Pointer to highest BASIC RAM location (+1) TXTPTR := $7A ; Pointer into BASIC source code TIME := $A0 ; 60 HZ clock FNAM_LEN := $B7 ; Length of filename diff --git a/asminc/pet.inc b/asminc/pet.inc index 1ebf391f9..a745a89c8 100644 --- a/asminc/pet.inc +++ b/asminc/pet.inc @@ -6,6 +6,7 @@ ; --------------------------------------------------------------------------- ; Zero page, Commodore stuff +VARTAB := $2A ; Pointer to start of BASIC variables MEMSIZE := $34 ; Size of memory installed TXTPTR := $77 ; Pointer into BASIC source code TIME := $8D ; 60HZ clock diff --git a/asminc/plus4.inc b/asminc/plus4.inc index 17e250508..69b2298a3 100644 --- a/asminc/plus4.inc +++ b/asminc/plus4.inc @@ -7,6 +7,8 @@ ; Zero page, Commodore stuff TMPPTR := $22 ; Temporary ptr used by BASIC +VARTAB := $2D ; Pointer to start of BASIC variables +MEMSIZE := $37 ; Pointer to highest BASIC RAM location (+1) TXTPTR := $3B ; Pointer into BASIC source code TIME := $A3 ; 60HZ clock FNAM_LEN := $AB ; Length of filename diff --git a/asminc/vic20.inc b/asminc/vic20.inc index c42db4258..12424dc11 100644 --- a/asminc/vic20.inc +++ b/asminc/vic20.inc @@ -6,6 +6,8 @@ ; --------------------------------------------------------------------------- ; Zero page, Commodore stuff +VARTAB := $2D ; Pointer to start of BASIC variables +MEMSIZE := $37 ; Pointer to highest BASIC RAM location (+1) TXTPTR := $7A ; Pointer into BASIC source code TIME := $A0 ; 60HZ clock FNAM_LEN := $B7 ; Length of filename diff --git a/doc/nes.sgml b/doc/nes.sgml index ca9ce72b3..98c25b6af 100644 --- a/doc/nes.sgml +++ b/doc/nes.sgml @@ -69,7 +69,7 @@ Programs containing NES specific code may use the NES specific functions
+The generic interface doesn't export the start and select buttons. To
+test for those, use the defines in nes.h instead of the generic masks.
+
+Example:
+
diff --git a/include/mouse.h b/include/mouse.h
index ac75956c0..8bd9a00ff 100644
--- a/include/mouse.h
+++ b/include/mouse.h
@@ -122,6 +122,16 @@ struct mouse_callbacks {
/* The default mouse callbacks */
extern const struct mouse_callbacks mouse_def_callbacks;
+#if defined(__CBM__)
+
+/* The default mouse pointer shape used by the default mouse callbacks */
+extern const unsigned char mouse_def_pointershape[63];
+
+/* The default mouse pointer color used by the default mouse callbacks */
+extern const unsigned char mouse_def_pointercolor;
+
+#endif
+
/* The name of the standard mouse driver for a platform */
extern const char mouse_stddrv[];
@@ -208,6 +218,3 @@ unsigned char __fastcall__ mouse_ioctl (unsigned char code, void* data);
/* End of mouse.h */
#endif
-
-
-
diff --git a/include/nes.h b/include/nes.h
index 3ad442280..7bf56c995 100644
--- a/include/nes.h
+++ b/include/nes.h
@@ -90,7 +90,15 @@
/* No support for dynamically loadable drivers */
#define DYN_DRV 0
-
+/* The joystick keys - all keys are supported */
+#define KEY_A 0x01
+#define KEY_B 0x02
+#define KEY_SELECT 0x04
+#define KEY_START 0x08
+#define KEY_UP 0x10
+#define KEY_DOWN 0x20
+#define KEY_LEFT 0x40
+#define KEY_RIGHT 0x80
/* The addresses of the static drivers */
extern void nes_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
diff --git a/libsrc/atari/dosdetect.s b/libsrc/atari/dosdetect.s
index c60ac479b..654da55b5 100644
--- a/libsrc/atari/dosdetect.s
+++ b/libsrc/atari/dosdetect.s
@@ -5,7 +5,7 @@
;
.include "atari.inc"
- .constructor detect,26
+ .constructor detect, 26
.export __dos_type
; ------------------------------------------------------------------------
diff --git a/libsrc/atari/getargs.s b/libsrc/atari/getargs.s
index fdae55364..fb3b7bc03 100644
--- a/libsrc/atari/getargs.s
+++ b/libsrc/atari/getargs.s
@@ -15,7 +15,7 @@ SPACE = 32 ; SPACE char.
.import __argc, __argv
.importzp ptr1
.import __dos_type
- .constructor initmainargs,25
+ .constructor initmainargs, 25
; --------------------------------------------------------------------------
; Get command line
diff --git a/libsrc/atari/getdefdev.s b/libsrc/atari/getdefdev.s
index 13aa12e04..47d8714e6 100644
--- a/libsrc/atari/getdefdev.s
+++ b/libsrc/atari/getdefdev.s
@@ -19,7 +19,7 @@
.export __getdefdev ; get default device
.export __defdev ; this is the default device string (e.g. "D1:")
.ifdef DYNAMIC_DD
- .constructor __getdefdev,24
+ .constructor __getdefdev, 24
.endif
; Get default device (LBUF will be destroyed!!)
diff --git a/libsrc/atari/mcbpm.s b/libsrc/atari/mcbpm.s
index b546faced..c5c5dd433 100644
--- a/libsrc/atari/mcbpm.s
+++ b/libsrc/atari/mcbpm.s
@@ -10,8 +10,8 @@
.include "atari.inc"
.importzp sp
.export _mouse_pm_callbacks
- .constructor pm_init,27
- .destructor pm_down,7
+ .constructor pm_init, 27
+ .destructor pm_down
; get mouse shape data
.import mouse_pm_bits
diff --git a/libsrc/atari5200/conioscreen.s b/libsrc/atari5200/conioscreen.s
index 412dd582d..660276675 100644
--- a/libsrc/atari5200/conioscreen.s
+++ b/libsrc/atari5200/conioscreen.s
@@ -7,9 +7,10 @@
SCREEN_BUF_SIZE = 20 * 24
SCREEN_BUF = $4000 - SCREEN_BUF_SIZE
- .code
.export screen_setup_20x24
+ .segment "INIT"
+
screen_setup_20x24:
; initialize SAVMSC
@@ -79,5 +80,4 @@ dlist: .repeat 3
.assert ((* >> 10) = (dlist >> 10)), error, "Display list crosses 1K boundary"
-
.end
diff --git a/libsrc/c128/mcbdefault.s b/libsrc/c128/mcbdefault.s
index 01c54efca..1951129a6 100644
--- a/libsrc/c128/mcbdefault.s
+++ b/libsrc/c128/mcbdefault.s
@@ -7,7 +7,10 @@
; be called from an interrupt handler
;
+ .constructor initmcb
.export _mouse_def_callbacks
+ .import _mouse_def_pointershape
+ .import _mouse_def_pointercolor
.include "mouse-kernel.inc"
.include "c128.inc"
@@ -15,16 +18,45 @@
.macpack generic
; Sprite definitions. The first value can be changed to adjust the number
-; of the sprite used for the mouse.
+; of the sprite used for the mouse. All others depend on this value.
MOUSE_SPR = 0 ; Sprite used for the mouse
+MOUSE_SPR_MEM = $0E00 ; Memory location
MOUSE_SPR_MASK = $01 .shl MOUSE_SPR ; Positive mask
MOUSE_SPR_NMASK = .lobyte(.not MOUSE_SPR_MASK) ; Negative mask
VIC_SPR_X = (VIC_SPR0_X + 2*MOUSE_SPR) ; Sprite X register
VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
+; --------------------------------------------------------------------------
+; Initialize the mouse sprite.
+
+.segment "INIT"
+
+initmcb:
+
+; Copy the mouse sprite data
+
+ ldx #64 - 1
+@L0: lda _mouse_def_pointershape,x
+ sta MOUSE_SPR_MEM,x
+ dex
+ bpl @L0
+
+; Set the mouse sprite pointer
+
+ lda #<(MOUSE_SPR_MEM / 64)
+ sta $07F8 + MOUSE_SPR
+
+; Set the mouse sprite color
+
+ lda _mouse_def_pointercolor
+ sta VIC_SPR0_COLOR + MOUSE_SPR
+ rts
+
; --------------------------------------------------------------------------
; Hide the mouse pointer. Always called with interrupts disabled.
+.code
+
hide:
lda #MOUSE_SPR_NMASK
and VIC_SPR_ENA
diff --git a/libsrc/c128/systime.s b/libsrc/c128/systime.s
index 0a7f8f367..e12d016b8 100644
--- a/libsrc/c128/systime.s
+++ b/libsrc/c128/systime.s
@@ -63,6 +63,7 @@ BCD2dec:tax
; Constructor that writes to the 1/10 sec register of the TOD to kick it
; into action. If this is not done, the clock hangs. We will read the register
; and write it again, ignoring a possible change in between.
+.segment "INIT"
.proc initsystime
@@ -78,7 +79,6 @@ BCD2dec:tax
.endproc
-
;----------------------------------------------------------------------------
; TM struct with date set to 1970-01-01
.data
@@ -92,4 +92,3 @@ TM: .word 0 ; tm_sec
.word 0 ; tm_wday
.word 0 ; tm_yday
.word 0 ; tm_isdst
-
diff --git a/libsrc/c64/mcbdefault.s b/libsrc/c64/mcbdefault.s
index ffeed45b3..cd36d8515 100644
--- a/libsrc/c64/mcbdefault.s
+++ b/libsrc/c64/mcbdefault.s
@@ -7,7 +7,12 @@
; be called from an interrupt handler
;
+ .constructor initmcb
.export _mouse_def_callbacks
+ .import _mouse_def_pointershape
+ .import _mouse_def_pointercolor
+ .import mcb_spritememory
+ .import mcb_spritepointer
.include "mouse-kernel.inc"
.include "c64.inc"
@@ -22,9 +27,49 @@ MOUSE_SPR_NMASK = .lobyte(.not MOUSE_SPR_MASK) ; Negative mask
VIC_SPR_X = (VIC_SPR0_X + 2*MOUSE_SPR) ; Sprite X register
VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
+; --------------------------------------------------------------------------
+; Initialize the mouse sprite.
+
+.segment "INIT"
+
+initmcb:
+
+; Make all RAM accessible
+
+ lda #$30
+ ldy $01
+ sei
+ sta $01
+
+; Copy the mouse sprite data
+
+ ldx #64 - 1
+@L0: lda _mouse_def_pointershape,x
+ sta mcb_spritememory,x
+ dex
+ bpl @L0
+
+; Set the mouse sprite pointer
+
+ lda #<(mcb_spritememory / 64)
+ sta mcb_spritepointer + MOUSE_SPR
+
+; Restore memory configuration
+
+ sty $01
+ cli
+
+; Set the mouse sprite color
+
+ lda _mouse_def_pointercolor
+ sta VIC_SPR0_COLOR + MOUSE_SPR
+ rts
+
; --------------------------------------------------------------------------
; Hide the mouse pointer. Always called with interrupts disabled.
+.code
+
hide:
lda #MOUSE_SPR_NMASK
and VIC_SPR_ENA
diff --git a/libsrc/c64/mcbspritedata.s b/libsrc/c64/mcbspritedata.s
new file mode 100644
index 000000000..2c7aa1491
--- /dev/null
+++ b/libsrc/c64/mcbspritedata.s
@@ -0,0 +1,4 @@
+; VIC sprite data for the mouse pointer
+
+ .export mcb_spritememory := $0340
+ .export mcb_spritepointer := $07F8
diff --git a/libsrc/c64/systime.s b/libsrc/c64/systime.s
index a00df1397..f8cd1b714 100644
--- a/libsrc/c64/systime.s
+++ b/libsrc/c64/systime.s
@@ -63,6 +63,7 @@ BCD2dec:tax
; Constructor that writes to the 1/10 sec register of the TOD to kick it
; into action. If this is not done, the clock hangs. We will read the register
; and write it again, ignoring a possible change in between.
+.segment "INIT"
.proc initsystime
@@ -81,7 +82,6 @@ BCD2dec:tax
.endproc
-
;----------------------------------------------------------------------------
; TM struct with date set to 1970-01-01
.data
@@ -95,4 +95,3 @@ TM: .word 0 ; tm_sec
.word 0 ; tm_wday
.word 0 ; tm_yday
.word 0 ; tm_isdst
-
diff --git a/libsrc/cbm/exec.c b/libsrc/cbm/exec.c
index 36c3afe00..b9c1bdc96 100644
--- a/libsrc/cbm/exec.c
+++ b/libsrc/cbm/exec.c
@@ -1,7 +1,7 @@
/*
** Program-chaining function for Commodore platforms.
**
-** 2013-09-04, Greg King
+** 2015-09-27, Greg King
**
** This function exploits the program-chaining feature in CBM BASIC's ROM.
**
@@ -32,42 +32,46 @@
/* The struct below is a line of BASIC code. It sits in the LOWCODE segment
** to make sure that it won't be hidden by a ROM when BASIC is re-enabled.
** The line is:
-** 0 LOAD""+"" ,01
+** 0 CLR:LOAD""+"" ,01
** After this function has written into the line, it might look like this:
-** 0 LOAD""+"program name" ,08
+** 0 CLR:LOAD""+"program name" ,08
**
** When BASIC's LOAD command asks the Kernal to load a file, it gives the
** Kernal a pointer to a file-name string. CC65's CBM programs use that
** pointer to give a copy of the program's name to main()'s argv[0] parameter.
-** But, when BASIC uses a string literal that's in a program, it points
+** But, when BASIC uses a string literal that is in a program, it points
** directly to that literal -- in the models that don't use banked RAM
** (Pet/CBM, VIC-20, and 64). The literal is overwritten by the next program
-** that's loaded. So, argv[0] would point to machine code. String operations
+** that is loaded. So, argv[0] would point to machine code. String operations
** create a new result string -- even when that operation changes nothing. The
** result is put in the string space at the top of BASIC's memory. So, the ""+
** in this BASIC line guarantees that argv[0] will get a name from a safe place.
*/
#pragma data-name(push, "LOWCODE")
static struct line {
- const char end_of_line;
- const struct line *const next;
+ const char end_of_line; /* fake previous line */
+ const struct line* const next;
const unsigned line_num;
- const char load_token, quotes[2], add_token, quote;
+ const char CLR_token, colon, LOAD_token, quotes[2], add_token, quote;
char name[21];
const char comma;
char unit[3];
} basic = {
- '\0', &basic + 1, /* high byte of link must be non-zero */
- 0, 0x93, "\"\"", 0xaa, '\"',
- "\" ", /* format: "123:1234567890123456\"" */
+ '\0', &basic + 1, /* high byte of link must be non-zero */
+ 0, 0x9C, ':', 0x93, "\"\"", 0xAA, '\"',
+ "\" ", /* format: "123:1234567890123456\"" */
',', "01"
};
#pragma data-name(pop)
/* These values are platform-specific. */
-extern const struct line *txtptr;
+extern const void* vartab; /* points to BASIC program variables */
+#pragma zpsym("vartab")
+extern const void* memsize; /* points to top of BASIC RAM */
+#pragma zpsym("memsize")
+extern const struct line* txtptr; /* points to BASIC code */
#pragma zpsym("txtptr")
-extern char basbuf[]; /* BASIC's input buffer */
+extern char basbuf[]; /* BASIC's input buffer */
extern void basbuf_len[];
#pragma zpsym("basbuf_len")
@@ -75,43 +79,62 @@ extern void basbuf_len[];
int __fastcall__ exec (const char* progname, const char* cmdline)
{
static int fd;
- static unsigned char dv, n = 0;
+ static unsigned char dv, n;
/* Exclude devices that can't load files. */
+ /* (Use hand optimization, to make smaller code.) */
dv = getcurrentdevice ();
- if (dv < 8 && dv != 1 || dv > 30) {
+ if (dv < 8 && __AX__ != 1 || __AX__ > 30) {
return _mappederrno (9); /* illegal device number */
}
utoa (dv, basic.unit, 10);
- /* Don't try to run a program that can't be found. */
- fd = open (progname, O_RDONLY);
- if (fd < 0) {
- return fd;
+ /* Tape files can be openned only once; skip this test for the Datasette. */
+ if (dv != 1) {
+ /* Don't try to run a program that can't be found. */
+ fd = open (progname, O_RDONLY);
+ if (fd < 0) {
+ return -1;
+ }
+ close (fd);
}
- close (fd);
+ n = 0;
do {
if ((basic.name[n] = progname[n]) == '\0') {
break;
}
- } while (++n < 20); /* truncate long names */
+ } while (++n < 20); /* truncate long names */
basic.name[n] = '\"';
+/* This next part isn't needed by machines that put
+** BASIC source and variables in different RAM banks.
+*/
+#if !defined(__CBM510__) && !defined(__CBM610__) && !defined(__C128__)
+ /* cc65 program loads might extend beyond the end of the RAM that is allowed
+ ** for BASIC. Then, the LOAD statement would complain that it is "out of
+ ** memory". Some pointers that say where to put BASIC program variables
+ ** must be changed, so that we do not get that error. One pointer is
+ ** changed here; a BASIC CLR statement changes the others.
+ */
+ vartab = (char*)memsize - 256;
+#endif
+
/* Build the next program's argument list. */
- basbuf[0] = 0x8f; /* REM token */
+ basbuf[0] = 0x8F; /* REM token */
basbuf[1] = '\0';
if (cmdline != NULL) {
strncat (basbuf, cmdline, (size_t)basbuf_len - 2);
}
+ /* Tell the ROM where to find that BASIC program. */
#if defined(__CBM510__) || defined(__CBM610__)
pokewsys ((unsigned)&txtptr, (unsigned)&basic);
#else
txtptr = &basic;
#endif
- /* (The return code, in ST, will be destroyed by LOAD.
+ /* (The return code, in ST [status], will be destroyed by LOAD.
** So, don't bother to set it here.)
*/
exit (__AX__);
diff --git a/libsrc/cbm/execvars.s b/libsrc/cbm/execvars.s
index 02eabc12e..68f8a5d64 100644
--- a/libsrc/cbm/execvars.s
+++ b/libsrc/cbm/execvars.s
@@ -20,9 +20,15 @@
.include "vic20.inc"
.endif
- .export _txtptr:zp, _basbuf, _basbuf_len:zp
+; exec() is written in C.
+; Provide the spellings that the C compiler wants to use.
-_txtptr := TXTPTR
+.ifdef VARTAB
+.exportzp _vartab := VARTAB
+.exportzp _memsize := MEMSIZE
+.endif
-_basbuf := BASIC_BUF
-_basbuf_len = BASIC_BUF_LEN
+.exportzp _txtptr := TXTPTR
+
+.export _basbuf := BASIC_BUF
+.exportzp _basbuf_len = BASIC_BUF_LEN
diff --git a/libsrc/cbm/mcbpointercolor.s b/libsrc/cbm/mcbpointercolor.s
new file mode 100644
index 000000000..c9cb6330e
--- /dev/null
+++ b/libsrc/cbm/mcbpointercolor.s
@@ -0,0 +1,10 @@
+; VIC sprite color for the mouse pointer
+
+ .export _mouse_def_pointercolor
+
+
+.segment "INIT"
+
+_mouse_def_pointercolor:
+
+ .byte $01 ; White
diff --git a/libsrc/cbm/mcbpointershape.s b/libsrc/cbm/mcbpointershape.s
new file mode 100644
index 000000000..7364201b1
--- /dev/null
+++ b/libsrc/cbm/mcbpointershape.s
@@ -0,0 +1,30 @@
+; VIC sprite data for the mouse pointer (an arrow)
+
+ .export _mouse_def_pointershape
+
+
+.segment "INIT"
+
+_mouse_def_pointershape:
+
+ .byte %11111110, %00000000, %00000000
+ .byte %11111100, %00000000, %00000000
+ .byte %11111000, %00000000, %00000000
+ .byte %11111100, %00000000, %00000000
+ .byte %11011110, %00000000, %00000000
+ .byte %10001111, %00000000, %00000000
+ .byte %00000111, %10000000, %00000000
+ .byte %00000011, %11000000, %00000000
+ .byte %00000001, %11100000, %00000000
+ .byte %00000000, %11110000, %00000000
+ .byte %00000000, %01111000, %00000000
+ .byte %00000000, %00111000, %00000000
+ .byte %00000000, %00000000, %00000000
+ .byte %00000000, %00000000, %00000000
+ .byte %00000000, %00000000, %00000000
+ .byte %00000000, %00000000, %00000000
+ .byte %00000000, %00000000, %00000000
+ .byte %00000000, %00000000, %00000000
+ .byte %00000000, %00000000, %00000000
+ .byte %00000000, %00000000, %00000000
+ .byte %00000000, %00000000, %00000000
diff --git a/libsrc/cbm510/mcbdefault.s b/libsrc/cbm510/mcbdefault.s
index 028fb4ec1..0db753e92 100644
--- a/libsrc/cbm510/mcbdefault.s
+++ b/libsrc/cbm510/mcbdefault.s
@@ -8,7 +8,10 @@
; be called from an interrupt handler.
;
+ .constructor initmcb
.export _mouse_def_callbacks
+ .import _mouse_def_pointershape
+ .import _mouse_def_pointercolor
.import vic:zp
.include "mouse-kernel.inc"
@@ -19,14 +22,50 @@
; Sprite definitions. The first value can be changed to adjust the number
; of the sprite used for the mouse. All others depend on that value.
MOUSE_SPR = 0 ; Sprite used for the mouse
+MOUSE_SPR_MEM = $F400 ; Memory location
MOUSE_SPR_MASK = $01 .shl MOUSE_SPR ; Positive mask
MOUSE_SPR_NMASK = .lobyte(.not MOUSE_SPR_MASK) ; Negative mask
VIC_SPR_X = (VIC_SPR0_X + 2*MOUSE_SPR) ; Sprite X register
VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register
+; --------------------------------------------------------------------------
+; Initialize the mouse sprite.
+
+.segment "INIT"
+
+initmcb:
+
+; Copy the mouse sprite data
+
+ ldx #64 - 1
+@L0: lda _mouse_def_pointershape,x
+ sta MOUSE_SPR_MEM,x
+ dex
+ bpl @L0
+
+; Set the mouse sprite pointer
+
+ lda #<(MOUSE_SPR_MEM / 64)
+ sta $F3F8 + MOUSE_SPR
+
+; Set the mouse sprite color
+
+ ldx IndReg
+ lda #15
+ sta IndReg
+
+ lda _mouse_def_pointercolor
+ ldy #VIC_SPR0_COLOR + MOUSE_SPR
+ sta (vic),y
+
+ stx IndReg
+ rts
+
; --------------------------------------------------------------------------
; Hide the mouse pointer. Always called with interrupts disabled.
+.code
+
hide:
ldy #15
sty IndReg
diff --git a/libsrc/osic1p/cgetc.s b/libsrc/osic1p/cgetc.s
index 0c7c69488..5ddca2870 100644
--- a/libsrc/osic1p/cgetc.s
+++ b/libsrc/osic1p/cgetc.s
@@ -11,12 +11,14 @@
.include "zeropage.inc"
; Initialize one-character buffer that is filled by kbhit()
+ .segment "INIT"
initcgetc:
lda #$00
sta CHARBUF ; No character in buffer initially
rts
; Input routine from 65V PROM MONITOR, show cursor if enabled
+ .code
_cgetc:
lda CHARBUF ; character in buffer available?
beq nobuffer
diff --git a/libsrc/pce/clock.s b/libsrc/pce/clock.s
index c6d6fb7fb..261739df8 100644
--- a/libsrc/pce/clock.s
+++ b/libsrc/pce/clock.s
@@ -5,9 +5,11 @@
.include "pce.inc"
.include "extzp.inc"
- .forceimport ticktock
.export _clock
+ .forceimport ticktock
.importzp sreg
+ .constructor initclock
+
.proc _clock
@@ -21,8 +23,7 @@
.endproc
- .constructor initclock, 24
-
+ .segment "INIT"
initclock:
lda #0
ldx #3
diff --git a/libsrc/pce/conio.s b/libsrc/pce/conio.s
index bcfc600a7..64df87018 100644
--- a/libsrc/pce/conio.s
+++ b/libsrc/pce/conio.s
@@ -1,14 +1,16 @@
.include "pce.inc"
.include "extzp.inc"
- .import vce_init
- .import psg_init
- .import vdc_init
+ .import vce_init
+ .import psg_init
+ .import colors
+ .importzp ptr1, tmp1
- .constructor initconio, 24
+ .constructor initconio
.macpack longbranch
+ .segment "INIT"
initconio:
jsr vce_init
jsr psg_init
@@ -20,7 +22,6 @@ initconio:
st2 #>$0088
rts
- .import colors
set_palette:
stz VCE_ADDR_LO
stz VCE_ADDR_HI
@@ -48,11 +49,6 @@ set_palette:
rts
-;----------------------------------------------------------------------------
-;
-;----------------------------------------------------------------------------
-
- .importzp ptr1, tmp1
conio_init:
; Load font
st0 #VDC_MAWR
@@ -80,13 +76,11 @@ conio_init:
sta tmp1
jsr copy
-
ldx #0
stx BGCOLOR
inx
stx CHARCOLOR
-
rts
copy:
diff --git a/libsrc/pce/psg.s b/libsrc/pce/psg.s
index 17d26b941..b1d610fa1 100644
--- a/libsrc/pce/psg.s
+++ b/libsrc/pce/psg.s
@@ -1,8 +1,8 @@
-
.include "pce.inc"
.export psg_init
+ .segment "INIT"
psg_init:
clx
stz PSG_GLOBAL_PAN ; Clear global balance
diff --git a/libsrc/pce/vce.s b/libsrc/pce/vce.s
index 3c19fd55b..af69c5ed1 100644
--- a/libsrc/pce/vce.s
+++ b/libsrc/pce/vce.s
@@ -1,8 +1,8 @@
-
.include "pce.inc"
.export vce_init
+ .segment "INIT"
vce_init:
; Set CTA to zero
stz VCE_ADDR_LO
diff --git a/samples/mousetest.c b/samples/mousetest.c
index 7d9409659..4a849cb98 100644
--- a/samples/mousetest.c
+++ b/samples/mousetest.c
@@ -40,44 +40,11 @@
-#if defined(__C64__) || defined(__C128__) || defined(__CBM510__)
+#ifdef __CBM__
-/* Addresses of data for sprite 0 */
-#if defined(__C64__)
-# define SPRITE0_DATA ((unsigned char[64])0x0340)
-# define SPRITE0_PTR ((unsigned char *)0x07F8)
-#elif defined(__C128__)
-# define SPRITE0_DATA ((unsigned char[64])0x0E00)
-# define SPRITE0_PTR ((unsigned char *)0x07F8)
-#elif defined(__CBM510__)
-# define SPRITE0_DATA ((unsigned char[64])0xF400)
-# define SPRITE0_PTR ((unsigned char *)0xF3F8)
-#endif
+/* Set dark-on-light colors. */
+const unsigned char mouse_def_pointercolor = COLOR_BLACK;
-/* The mouse sprite (an arrow) */
-static const unsigned char MouseSprite[64] = {
- 0xFE, 0x00, 0x00,
- 0xFC, 0x00, 0x00,
- 0xF8, 0x00, 0x00,
- 0xFC, 0x00, 0x00,
- 0xDE, 0x00, 0x00,
- 0x8F, 0x00, 0x00,
- 0x07, 0x80, 0x00,
- 0x03, 0xC0, 0x00,
- 0x01, 0xE0, 0x00,
- 0x00, 0xF0, 0x00,
- 0x00, 0x78, 0x00,
- 0x00, 0x38, 0x00,
- 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00
-};
#endif
@@ -159,25 +126,6 @@ int main (void)
cursor (0);
clrscr ();
- /* The pointer should be created before the driver is installed,
- ** in case a lightpen driver needs it during calibration.
- */
-
-#if defined(__C64__) || defined(__C128__) || defined(__CBM510__)
- /* Copy the sprite data */
- memcpy ((void*) SPRITE0_DATA, MouseSprite, sizeof (MouseSprite));
-
- /* Set the VIC-II sprite pointer. */
- *SPRITE0_PTR = ((unsigned) SPRITE0_DATA & 0x3FFF) / sizeof SPRITE0_DATA;
-
- /* Set the color of sprite 0 */
-# ifdef __CBM510__
- pokebsys ((unsigned) &VIC.spr0_color, COLOR_BLACK);
-# else
- VIC.spr0_color = COLOR_BLACK;
-# endif
-#endif
-
/* If a lightpen driver is installed, then it can get a calibration value
** from this file (if it exists). Or, the user can adjust the pen; and,
** the value will be put into this file, for the next time.