mirror of
https://github.com/cc65/cc65.git
synced 2024-08-28 18:29:20 +00:00
Merge remote-tracking branch 'upstream/master' into soft80
This commit is contained in:
commit
df3549f502
@ -6,6 +6,8 @@
|
|||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; Zero page, Commodore stuff
|
; 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
|
TXTPTR := $7A ; Pointer into BASIC source code
|
||||||
TIME := $A0 ; 60 HZ clock
|
TIME := $A0 ; 60 HZ clock
|
||||||
FNAM_LEN := $B7 ; Length of filename
|
FNAM_LEN := $B7 ; Length of filename
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; Zero page, Commodore stuff
|
; Zero page, Commodore stuff
|
||||||
|
|
||||||
|
VARTAB := $2A ; Pointer to start of BASIC variables
|
||||||
MEMSIZE := $34 ; Size of memory installed
|
MEMSIZE := $34 ; Size of memory installed
|
||||||
TXTPTR := $77 ; Pointer into BASIC source code
|
TXTPTR := $77 ; Pointer into BASIC source code
|
||||||
TIME := $8D ; 60HZ clock
|
TIME := $8D ; 60HZ clock
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
; Zero page, Commodore stuff
|
; Zero page, Commodore stuff
|
||||||
|
|
||||||
TMPPTR := $22 ; Temporary ptr used by BASIC
|
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
|
TXTPTR := $3B ; Pointer into BASIC source code
|
||||||
TIME := $A3 ; 60HZ clock
|
TIME := $A3 ; 60HZ clock
|
||||||
FNAM_LEN := $AB ; Length of filename
|
FNAM_LEN := $AB ; Length of filename
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
; Zero page, Commodore stuff
|
; 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
|
TXTPTR := $7A ; Pointer into BASIC source code
|
||||||
TIME := $A0 ; 60HZ clock
|
TIME := $A0 ; 60HZ clock
|
||||||
FNAM_LEN := $B7 ; Length of filename
|
FNAM_LEN := $B7 ; Length of filename
|
||||||
|
10
doc/nes.sgml
10
doc/nes.sgml
@ -69,7 +69,7 @@ Programs containing NES specific code may use the <tt/nes.h/ header file.
|
|||||||
<sect1>NES specific functions<p>
|
<sect1>NES specific functions<p>
|
||||||
|
|
||||||
<itemize>
|
<itemize>
|
||||||
<item>waitvblank
|
<item>waitvblank - wait until the start of vblank
|
||||||
<item>get_tv
|
<item>get_tv
|
||||||
</itemize>
|
</itemize>
|
||||||
|
|
||||||
@ -123,6 +123,14 @@ No extended memory drivers are currently available for the NES.
|
|||||||
|
|
||||||
</descrip><p>
|
</descrip><p>
|
||||||
|
|
||||||
|
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:
|
||||||
|
<tscreen><verb>
|
||||||
|
if (joy_read(0) & KEY_A)
|
||||||
|
</verb></tscreen>
|
||||||
|
|
||||||
|
|
||||||
<sect1>Mouse drivers<p>
|
<sect1>Mouse drivers<p>
|
||||||
|
|
||||||
|
@ -122,6 +122,16 @@ struct mouse_callbacks {
|
|||||||
/* The default mouse callbacks */
|
/* The default mouse callbacks */
|
||||||
extern const struct mouse_callbacks mouse_def_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 */
|
/* The name of the standard mouse driver for a platform */
|
||||||
extern const char mouse_stddrv[];
|
extern const char mouse_stddrv[];
|
||||||
|
|
||||||
@ -208,6 +218,3 @@ unsigned char __fastcall__ mouse_ioctl (unsigned char code, void* data);
|
|||||||
|
|
||||||
/* End of mouse.h */
|
/* End of mouse.h */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,7 +90,15 @@
|
|||||||
/* No support for dynamically loadable drivers */
|
/* No support for dynamically loadable drivers */
|
||||||
#define DYN_DRV 0
|
#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 */
|
/* The addresses of the static drivers */
|
||||||
extern void nes_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
|
extern void nes_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
;
|
;
|
||||||
|
|
||||||
.include "atari.inc"
|
.include "atari.inc"
|
||||||
.constructor detect,26
|
.constructor detect, 26
|
||||||
.export __dos_type
|
.export __dos_type
|
||||||
|
|
||||||
; ------------------------------------------------------------------------
|
; ------------------------------------------------------------------------
|
||||||
|
@ -15,7 +15,7 @@ SPACE = 32 ; SPACE char.
|
|||||||
.import __argc, __argv
|
.import __argc, __argv
|
||||||
.importzp ptr1
|
.importzp ptr1
|
||||||
.import __dos_type
|
.import __dos_type
|
||||||
.constructor initmainargs,25
|
.constructor initmainargs, 25
|
||||||
|
|
||||||
; --------------------------------------------------------------------------
|
; --------------------------------------------------------------------------
|
||||||
; Get command line
|
; Get command line
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
.export __getdefdev ; get default device
|
.export __getdefdev ; get default device
|
||||||
.export __defdev ; this is the default device string (e.g. "D1:")
|
.export __defdev ; this is the default device string (e.g. "D1:")
|
||||||
.ifdef DYNAMIC_DD
|
.ifdef DYNAMIC_DD
|
||||||
.constructor __getdefdev,24
|
.constructor __getdefdev, 24
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
; Get default device (LBUF will be destroyed!!)
|
; Get default device (LBUF will be destroyed!!)
|
||||||
|
@ -10,8 +10,8 @@
|
|||||||
.include "atari.inc"
|
.include "atari.inc"
|
||||||
.importzp sp
|
.importzp sp
|
||||||
.export _mouse_pm_callbacks
|
.export _mouse_pm_callbacks
|
||||||
.constructor pm_init,27
|
.constructor pm_init, 27
|
||||||
.destructor pm_down,7
|
.destructor pm_down
|
||||||
|
|
||||||
; get mouse shape data
|
; get mouse shape data
|
||||||
.import mouse_pm_bits
|
.import mouse_pm_bits
|
||||||
|
@ -7,9 +7,10 @@
|
|||||||
SCREEN_BUF_SIZE = 20 * 24
|
SCREEN_BUF_SIZE = 20 * 24
|
||||||
SCREEN_BUF = $4000 - SCREEN_BUF_SIZE
|
SCREEN_BUF = $4000 - SCREEN_BUF_SIZE
|
||||||
|
|
||||||
.code
|
|
||||||
.export screen_setup_20x24
|
.export screen_setup_20x24
|
||||||
|
|
||||||
|
.segment "INIT"
|
||||||
|
|
||||||
screen_setup_20x24:
|
screen_setup_20x24:
|
||||||
|
|
||||||
; initialize SAVMSC
|
; initialize SAVMSC
|
||||||
@ -79,5 +80,4 @@ dlist: .repeat 3
|
|||||||
|
|
||||||
.assert ((* >> 10) = (dlist >> 10)), error, "Display list crosses 1K boundary"
|
.assert ((* >> 10) = (dlist >> 10)), error, "Display list crosses 1K boundary"
|
||||||
|
|
||||||
|
|
||||||
.end
|
.end
|
||||||
|
@ -7,7 +7,10 @@
|
|||||||
; be called from an interrupt handler
|
; be called from an interrupt handler
|
||||||
;
|
;
|
||||||
|
|
||||||
|
.constructor initmcb
|
||||||
.export _mouse_def_callbacks
|
.export _mouse_def_callbacks
|
||||||
|
.import _mouse_def_pointershape
|
||||||
|
.import _mouse_def_pointercolor
|
||||||
|
|
||||||
.include "mouse-kernel.inc"
|
.include "mouse-kernel.inc"
|
||||||
.include "c128.inc"
|
.include "c128.inc"
|
||||||
@ -15,16 +18,45 @@
|
|||||||
.macpack generic
|
.macpack generic
|
||||||
|
|
||||||
; Sprite definitions. The first value can be changed to adjust the number
|
; 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 = 0 ; Sprite used for the mouse
|
||||||
|
MOUSE_SPR_MEM = $0E00 ; Memory location
|
||||||
MOUSE_SPR_MASK = $01 .shl MOUSE_SPR ; Positive mask
|
MOUSE_SPR_MASK = $01 .shl MOUSE_SPR ; Positive mask
|
||||||
MOUSE_SPR_NMASK = .lobyte(.not MOUSE_SPR_MASK) ; Negative 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_X = (VIC_SPR0_X + 2*MOUSE_SPR) ; Sprite X register
|
||||||
VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y 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.
|
; Hide the mouse pointer. Always called with interrupts disabled.
|
||||||
|
|
||||||
|
.code
|
||||||
|
|
||||||
hide:
|
hide:
|
||||||
lda #MOUSE_SPR_NMASK
|
lda #MOUSE_SPR_NMASK
|
||||||
and VIC_SPR_ENA
|
and VIC_SPR_ENA
|
||||||
|
@ -63,6 +63,7 @@ BCD2dec:tax
|
|||||||
; Constructor that writes to the 1/10 sec register of the TOD to kick it
|
; 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
|
; 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.
|
; and write it again, ignoring a possible change in between.
|
||||||
|
.segment "INIT"
|
||||||
|
|
||||||
.proc initsystime
|
.proc initsystime
|
||||||
|
|
||||||
@ -78,7 +79,6 @@ BCD2dec:tax
|
|||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
;----------------------------------------------------------------------------
|
;----------------------------------------------------------------------------
|
||||||
; TM struct with date set to 1970-01-01
|
; TM struct with date set to 1970-01-01
|
||||||
.data
|
.data
|
||||||
@ -92,4 +92,3 @@ TM: .word 0 ; tm_sec
|
|||||||
.word 0 ; tm_wday
|
.word 0 ; tm_wday
|
||||||
.word 0 ; tm_yday
|
.word 0 ; tm_yday
|
||||||
.word 0 ; tm_isdst
|
.word 0 ; tm_isdst
|
||||||
|
|
||||||
|
@ -7,7 +7,12 @@
|
|||||||
; be called from an interrupt handler
|
; be called from an interrupt handler
|
||||||
;
|
;
|
||||||
|
|
||||||
|
.constructor initmcb
|
||||||
.export _mouse_def_callbacks
|
.export _mouse_def_callbacks
|
||||||
|
.import _mouse_def_pointershape
|
||||||
|
.import _mouse_def_pointercolor
|
||||||
|
.import mcb_spritememory
|
||||||
|
.import mcb_spritepointer
|
||||||
|
|
||||||
.include "mouse-kernel.inc"
|
.include "mouse-kernel.inc"
|
||||||
.include "c64.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_X = (VIC_SPR0_X + 2*MOUSE_SPR) ; Sprite X register
|
||||||
VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y 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.
|
; Hide the mouse pointer. Always called with interrupts disabled.
|
||||||
|
|
||||||
|
.code
|
||||||
|
|
||||||
hide:
|
hide:
|
||||||
lda #MOUSE_SPR_NMASK
|
lda #MOUSE_SPR_NMASK
|
||||||
and VIC_SPR_ENA
|
and VIC_SPR_ENA
|
||||||
|
4
libsrc/c64/mcbspritedata.s
Normal file
4
libsrc/c64/mcbspritedata.s
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
; VIC sprite data for the mouse pointer
|
||||||
|
|
||||||
|
.export mcb_spritememory := $0340
|
||||||
|
.export mcb_spritepointer := $07F8
|
@ -63,6 +63,7 @@ BCD2dec:tax
|
|||||||
; Constructor that writes to the 1/10 sec register of the TOD to kick it
|
; 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
|
; 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.
|
; and write it again, ignoring a possible change in between.
|
||||||
|
.segment "INIT"
|
||||||
|
|
||||||
.proc initsystime
|
.proc initsystime
|
||||||
|
|
||||||
@ -81,7 +82,6 @@ BCD2dec:tax
|
|||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
|
||||||
;----------------------------------------------------------------------------
|
;----------------------------------------------------------------------------
|
||||||
; TM struct with date set to 1970-01-01
|
; TM struct with date set to 1970-01-01
|
||||||
.data
|
.data
|
||||||
@ -95,4 +95,3 @@ TM: .word 0 ; tm_sec
|
|||||||
.word 0 ; tm_wday
|
.word 0 ; tm_wday
|
||||||
.word 0 ; tm_yday
|
.word 0 ; tm_yday
|
||||||
.word 0 ; tm_isdst
|
.word 0 ; tm_isdst
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
** Program-chaining function for Commodore platforms.
|
** 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.
|
** This function exploits the program-chaining feature in CBM BASIC's ROM.
|
||||||
**
|
**
|
||||||
@ -32,40 +32,44 @@
|
|||||||
/* The struct below is a line of BASIC code. It sits in the LOWCODE segment
|
/* 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.
|
** to make sure that it won't be hidden by a ROM when BASIC is re-enabled.
|
||||||
** The line is:
|
** The line is:
|
||||||
** 0 LOAD""+"" ,01
|
** 0 CLR:LOAD""+"" ,01
|
||||||
** After this function has written into the line, it might look like this:
|
** 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
|
** 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
|
** 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.
|
** 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
|
** 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
|
** (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
|
** 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 ""+
|
** 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.
|
** in this BASIC line guarantees that argv[0] will get a name from a safe place.
|
||||||
*/
|
*/
|
||||||
#pragma data-name(push, "LOWCODE")
|
#pragma data-name(push, "LOWCODE")
|
||||||
static struct line {
|
static struct line {
|
||||||
const char end_of_line;
|
const char end_of_line; /* fake previous line */
|
||||||
const struct line *const next;
|
const struct line* const next;
|
||||||
const unsigned line_num;
|
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];
|
char name[21];
|
||||||
const char comma;
|
const char comma;
|
||||||
char unit[3];
|
char unit[3];
|
||||||
} basic = {
|
} basic = {
|
||||||
'\0', &basic + 1, /* high byte of link must be non-zero */
|
'\0', &basic + 1, /* high byte of link must be non-zero */
|
||||||
0, 0x93, "\"\"", 0xaa, '\"',
|
0, 0x9C, ':', 0x93, "\"\"", 0xAA, '\"',
|
||||||
"\" ", /* format: "123:1234567890123456\"" */
|
"\" ", /* format: "123:1234567890123456\"" */
|
||||||
',', "01"
|
',', "01"
|
||||||
};
|
};
|
||||||
#pragma data-name(pop)
|
#pragma data-name(pop)
|
||||||
|
|
||||||
/* These values are platform-specific. */
|
/* 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")
|
#pragma zpsym("txtptr")
|
||||||
extern char basbuf[]; /* BASIC's input buffer */
|
extern char basbuf[]; /* BASIC's input buffer */
|
||||||
extern void basbuf_len[];
|
extern void basbuf_len[];
|
||||||
@ -75,22 +79,27 @@ extern void basbuf_len[];
|
|||||||
int __fastcall__ exec (const char* progname, const char* cmdline)
|
int __fastcall__ exec (const char* progname, const char* cmdline)
|
||||||
{
|
{
|
||||||
static int fd;
|
static int fd;
|
||||||
static unsigned char dv, n = 0;
|
static unsigned char dv, n;
|
||||||
|
|
||||||
/* Exclude devices that can't load files. */
|
/* Exclude devices that can't load files. */
|
||||||
|
/* (Use hand optimization, to make smaller code.) */
|
||||||
dv = getcurrentdevice ();
|
dv = getcurrentdevice ();
|
||||||
if (dv < 8 && dv != 1 || dv > 30) {
|
if (dv < 8 && __AX__ != 1 || __AX__ > 30) {
|
||||||
return _mappederrno (9); /* illegal device number */
|
return _mappederrno (9); /* illegal device number */
|
||||||
}
|
}
|
||||||
utoa (dv, basic.unit, 10);
|
utoa (dv, basic.unit, 10);
|
||||||
|
|
||||||
|
/* 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. */
|
/* Don't try to run a program that can't be found. */
|
||||||
fd = open (progname, O_RDONLY);
|
fd = open (progname, O_RDONLY);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
return fd;
|
return -1;
|
||||||
}
|
}
|
||||||
close (fd);
|
close (fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
n = 0;
|
||||||
do {
|
do {
|
||||||
if ((basic.name[n] = progname[n]) == '\0') {
|
if ((basic.name[n] = progname[n]) == '\0') {
|
||||||
break;
|
break;
|
||||||
@ -98,20 +107,34 @@ int __fastcall__ exec (const char* progname, const char* cmdline)
|
|||||||
} while (++n < 20); /* truncate long names */
|
} while (++n < 20); /* truncate long names */
|
||||||
basic.name[n] = '\"';
|
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. */
|
/* Build the next program's argument list. */
|
||||||
basbuf[0] = 0x8f; /* REM token */
|
basbuf[0] = 0x8F; /* REM token */
|
||||||
basbuf[1] = '\0';
|
basbuf[1] = '\0';
|
||||||
if (cmdline != NULL) {
|
if (cmdline != NULL) {
|
||||||
strncat (basbuf, cmdline, (size_t)basbuf_len - 2);
|
strncat (basbuf, cmdline, (size_t)basbuf_len - 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Tell the ROM where to find that BASIC program. */
|
||||||
#if defined(__CBM510__) || defined(__CBM610__)
|
#if defined(__CBM510__) || defined(__CBM610__)
|
||||||
pokewsys ((unsigned)&txtptr, (unsigned)&basic);
|
pokewsys ((unsigned)&txtptr, (unsigned)&basic);
|
||||||
#else
|
#else
|
||||||
txtptr = &basic;
|
txtptr = &basic;
|
||||||
#endif
|
#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.)
|
** So, don't bother to set it here.)
|
||||||
*/
|
*/
|
||||||
exit (__AX__);
|
exit (__AX__);
|
||||||
|
@ -20,9 +20,15 @@
|
|||||||
.include "vic20.inc"
|
.include "vic20.inc"
|
||||||
.endif
|
.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
|
.exportzp _txtptr := TXTPTR
|
||||||
_basbuf_len = BASIC_BUF_LEN
|
|
||||||
|
.export _basbuf := BASIC_BUF
|
||||||
|
.exportzp _basbuf_len = BASIC_BUF_LEN
|
||||||
|
10
libsrc/cbm/mcbpointercolor.s
Normal file
10
libsrc/cbm/mcbpointercolor.s
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
; VIC sprite color for the mouse pointer
|
||||||
|
|
||||||
|
.export _mouse_def_pointercolor
|
||||||
|
|
||||||
|
|
||||||
|
.segment "INIT"
|
||||||
|
|
||||||
|
_mouse_def_pointercolor:
|
||||||
|
|
||||||
|
.byte $01 ; White
|
30
libsrc/cbm/mcbpointershape.s
Normal file
30
libsrc/cbm/mcbpointershape.s
Normal file
@ -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
|
@ -8,7 +8,10 @@
|
|||||||
; be called from an interrupt handler.
|
; be called from an interrupt handler.
|
||||||
;
|
;
|
||||||
|
|
||||||
|
.constructor initmcb
|
||||||
.export _mouse_def_callbacks
|
.export _mouse_def_callbacks
|
||||||
|
.import _mouse_def_pointershape
|
||||||
|
.import _mouse_def_pointercolor
|
||||||
.import vic:zp
|
.import vic:zp
|
||||||
|
|
||||||
.include "mouse-kernel.inc"
|
.include "mouse-kernel.inc"
|
||||||
@ -19,14 +22,50 @@
|
|||||||
; Sprite definitions. The first value can be changed to adjust the number
|
; 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.
|
; of the sprite used for the mouse. All others depend on that value.
|
||||||
MOUSE_SPR = 0 ; Sprite used for the mouse
|
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_MASK = $01 .shl MOUSE_SPR ; Positive mask
|
||||||
MOUSE_SPR_NMASK = .lobyte(.not MOUSE_SPR_MASK) ; Negative 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_X = (VIC_SPR0_X + 2*MOUSE_SPR) ; Sprite X register
|
||||||
VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y 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.
|
; Hide the mouse pointer. Always called with interrupts disabled.
|
||||||
|
|
||||||
|
.code
|
||||||
|
|
||||||
hide:
|
hide:
|
||||||
ldy #15
|
ldy #15
|
||||||
sty IndReg
|
sty IndReg
|
||||||
|
@ -11,12 +11,14 @@
|
|||||||
.include "zeropage.inc"
|
.include "zeropage.inc"
|
||||||
|
|
||||||
; Initialize one-character buffer that is filled by kbhit()
|
; Initialize one-character buffer that is filled by kbhit()
|
||||||
|
.segment "INIT"
|
||||||
initcgetc:
|
initcgetc:
|
||||||
lda #$00
|
lda #$00
|
||||||
sta CHARBUF ; No character in buffer initially
|
sta CHARBUF ; No character in buffer initially
|
||||||
rts
|
rts
|
||||||
|
|
||||||
; Input routine from 65V PROM MONITOR, show cursor if enabled
|
; Input routine from 65V PROM MONITOR, show cursor if enabled
|
||||||
|
.code
|
||||||
_cgetc:
|
_cgetc:
|
||||||
lda CHARBUF ; character in buffer available?
|
lda CHARBUF ; character in buffer available?
|
||||||
beq nobuffer
|
beq nobuffer
|
||||||
|
@ -5,9 +5,11 @@
|
|||||||
.include "pce.inc"
|
.include "pce.inc"
|
||||||
.include "extzp.inc"
|
.include "extzp.inc"
|
||||||
|
|
||||||
.forceimport ticktock
|
|
||||||
.export _clock
|
.export _clock
|
||||||
|
.forceimport ticktock
|
||||||
.importzp sreg
|
.importzp sreg
|
||||||
|
.constructor initclock
|
||||||
|
|
||||||
|
|
||||||
.proc _clock
|
.proc _clock
|
||||||
|
|
||||||
@ -21,8 +23,7 @@
|
|||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
.constructor initclock, 24
|
.segment "INIT"
|
||||||
|
|
||||||
initclock:
|
initclock:
|
||||||
lda #0
|
lda #0
|
||||||
ldx #3
|
ldx #3
|
||||||
|
@ -3,12 +3,14 @@
|
|||||||
|
|
||||||
.import vce_init
|
.import vce_init
|
||||||
.import psg_init
|
.import psg_init
|
||||||
.import vdc_init
|
.import colors
|
||||||
|
.importzp ptr1, tmp1
|
||||||
|
|
||||||
.constructor initconio, 24
|
.constructor initconio
|
||||||
|
|
||||||
.macpack longbranch
|
.macpack longbranch
|
||||||
|
|
||||||
|
.segment "INIT"
|
||||||
initconio:
|
initconio:
|
||||||
jsr vce_init
|
jsr vce_init
|
||||||
jsr psg_init
|
jsr psg_init
|
||||||
@ -20,7 +22,6 @@ initconio:
|
|||||||
st2 #>$0088
|
st2 #>$0088
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.import colors
|
|
||||||
set_palette:
|
set_palette:
|
||||||
stz VCE_ADDR_LO
|
stz VCE_ADDR_LO
|
||||||
stz VCE_ADDR_HI
|
stz VCE_ADDR_HI
|
||||||
@ -48,11 +49,6 @@ set_palette:
|
|||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
;----------------------------------------------------------------------------
|
|
||||||
;
|
|
||||||
;----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
.importzp ptr1, tmp1
|
|
||||||
conio_init:
|
conio_init:
|
||||||
; Load font
|
; Load font
|
||||||
st0 #VDC_MAWR
|
st0 #VDC_MAWR
|
||||||
@ -80,13 +76,11 @@ conio_init:
|
|||||||
sta tmp1
|
sta tmp1
|
||||||
jsr copy
|
jsr copy
|
||||||
|
|
||||||
|
|
||||||
ldx #0
|
ldx #0
|
||||||
stx BGCOLOR
|
stx BGCOLOR
|
||||||
inx
|
inx
|
||||||
stx CHARCOLOR
|
stx CHARCOLOR
|
||||||
|
|
||||||
|
|
||||||
rts
|
rts
|
||||||
|
|
||||||
copy:
|
copy:
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
.include "pce.inc"
|
.include "pce.inc"
|
||||||
|
|
||||||
.export psg_init
|
.export psg_init
|
||||||
|
|
||||||
|
.segment "INIT"
|
||||||
psg_init:
|
psg_init:
|
||||||
clx
|
clx
|
||||||
stz PSG_GLOBAL_PAN ; Clear global balance
|
stz PSG_GLOBAL_PAN ; Clear global balance
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
.include "pce.inc"
|
.include "pce.inc"
|
||||||
|
|
||||||
.export vce_init
|
.export vce_init
|
||||||
|
|
||||||
|
.segment "INIT"
|
||||||
vce_init:
|
vce_init:
|
||||||
; Set CTA to zero
|
; Set CTA to zero
|
||||||
stz VCE_ADDR_LO
|
stz VCE_ADDR_LO
|
||||||
|
@ -40,44 +40,11 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(__C64__) || defined(__C128__) || defined(__CBM510__)
|
#ifdef __CBM__
|
||||||
|
|
||||||
/* Addresses of data for sprite 0 */
|
/* Set dark-on-light colors. */
|
||||||
#if defined(__C64__)
|
const unsigned char mouse_def_pointercolor = COLOR_BLACK;
|
||||||
# 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
|
|
||||||
|
|
||||||
/* 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
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -159,25 +126,6 @@ int main (void)
|
|||||||
cursor (0);
|
cursor (0);
|
||||||
clrscr ();
|
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
|
/* 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,
|
** 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.
|
** the value will be put into this file, for the next time.
|
||||||
|
Loading…
Reference in New Issue
Block a user