1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-07 23:29:39 +00:00

Merge pull request #529 from polluks/master

Added standard joystick driver for the Supervision.
This commit is contained in:
Oliver Schmidt 2017-11-21 10:09:53 +00:00 committed by GitHub
commit 3f8de9f026
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 161 additions and 28 deletions

View File

@ -4,7 +4,7 @@
<title>cc65 function reference
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline>
<url url="mailto:greg.king5@verizon.net" name="Greg King">
<date>2017-09-02
<date>2017-11-21
<abstract>
cc65 is a C compiler for 6502 based systems. This function reference describes
@ -352,10 +352,10 @@ function.
<sect1><tt/gamate.h/<label id="gamate.h"><p>
<!-- <itemize> -->
<itemize>
<!-- <item><ref id="get_tv" name="get_tv"> -->
<!-- <item><ref id="waitvblank" name="waitvblank"> -->
<!-- </itemize> -->
<item><ref id="waitvsync" name="waitvsync">
</itemize>
(incomplete)
@ -437,10 +437,10 @@ function.
<sect1><tt/nes.h/<label id="nes.h"><p>
<!-- <itemize> -->
<itemize>
<!-- <item><ref id="get_tv" name="get_tv"> -->
<!-- <item><ref id="waitvsync" name="waitvsync"> -->
<!-- </itemize> -->
<item><ref id="waitvsync" name="waitvsync">
</itemize>
(incomplete)
@ -455,10 +455,10 @@ It does not declare any functions.
<sect1><tt/pce.h/<label id="pce.h"><p>
<!-- <itemize> -->
<itemize>
<!-- <item><ref id="get_tv" name="get_tv"> -->
<!-- <item><ref id="waitvblank" name="waitvblank"> -->
<!-- </itemize> -->
<item><ref id="waitvsync" name="waitvsync">
</itemize>
(incomplete)
@ -7612,6 +7612,23 @@ used in presence of a prototype.
</quote>
<sect1>waitvsync<label id="waitvsync"><p>
<quote>
<descrip>
<tag/Function/Wait until the start of the next frame.
<tag/Header/
<tt/<ref id="gamate.h" name="gamate.h">/,
<tt/<ref id="nes.h" name="nes.h">/,
<tt/<ref id="pce.h" name="pce.h">/
<tag/Declaration/<tt/void waitvsync (void);/
<tag/Description/Wait for vertical sync to reduce flickering.
<tag/Availability/Platforms above
<tag/Example/None.
</descrip>
</quote>
<sect1>wherex<label id="wherex"><p>
<quote>

View File

@ -44,6 +44,13 @@ by an external program. Such an utility is provided in util/gamate/gamate-fixcar
Programs containing Gamate specific code may use the <tt/gamate.h/ header file.
<sect1>Gamate specific functions<p>
<itemize>
<item>waitvsync</item>
</itemize>
<sect1>Hardware access<p>
The following pseudo variables declared in the <tt/gamate.inc/ include file do

View File

@ -4,7 +4,7 @@
<title>Watara Supervision specific information for cc65
<author><url url="mailto:polluks@sdf.lonestar.org" name="Stefan A. Haubenthal">
<date>2014-04-12
<date>2017-11-21
<abstract>
An overview over the Supervision runtime system as it is implemented for the
@ -63,14 +63,6 @@ Special locations:
Programs containing Supervision specific code may use the <tt/supervision.h/ header file.
<sect1>Supervision specific functions<p>
<itemize>
<item>waitvsync</item>
</itemize>
<sect1>Hardware access<p>
The following pseudo variables declared in the <tt/supervision.inc/ include file do
@ -102,11 +94,12 @@ No extended memory drivers are currently available for the Supervision.
<sect1>Joystick drivers<p>
No joystick drivers are currently available for the Supervision.
<!--A joystick driver for the standard buttons is available, but must be
statically linked, because no file I/O is available. See the documentation for
the <url url="co65.html" name="co65 utility"> for information on how to do
that.-->
<descrip>
<tag><tt/supervision-stdjoy.joy (supervision_stdjoy_joy)/</tag>
A joystick driver for the standard two buttons joypad is available.
</descrip><p>
<sect1>Mouse drivers<p>

View File

@ -105,9 +105,33 @@ extern unsigned char sv_nmi_counter;
extern unsigned char sv_timer_irq_counter;
extern unsigned char sv_timer_dma_counter;
/* Masks for joy_read */
#define JOY_UP_MASK 0x08
#define JOY_DOWN_MASK 0x04
#define JOY_LEFT_MASK 0x02
#define JOY_RIGHT_MASK 0x01
#define JOY_BTN_1_MASK 0x20
#define JOY_BTN_2_MASK 0x10
#define JOY_BTN_3_MASK 0x80
#define JOY_BTN_4_MASK 0x40
#define JOY_BTN_A_MASK JOY_BTN_1_MASK
#define JOY_BTN_B_MASk JOY_BTN_2_MASK
#define JOY_START_MASK JOY_BTN_3_MASK
#define JOY_SELECT_MASK JOY_BTN_4_MASK
#define JOY_BTN_A(v) ((v) & JOY_BTN_A_MASK)
#define JOY_BTN_B(v) ((v) & JOY_BTN_B_MASK)
#define JOY_START(v) ((v) & JOY_START_MASK)
#define JOY_SELECT(v) ((v) & JOY_SELECT_MASK)
/* No support for dynamically loadable drivers */
#define DYN_DRV 0
/* The addresses of the static drivers */
extern void supervision_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
/* End of supervision.h */
#endif

View File

@ -9,6 +9,4 @@
.export _joy_static_stddrv
.import _gamate_stdjoy_joy
.rodata
_joy_static_stddrv := _gamate_stdjoy_joy

View File

@ -0,0 +1,82 @@
;
; Standard joystick driver for the Supervision
;
.include "joy-kernel.inc"
.include "joy-error.inc"
.include "supervision.inc"
.macpack module
; ------------------------------------------------------------------------
; Header. Includes jump table
module_header _supervision_stdjoy_joy
; Driver signature
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
; Library reference
.addr $0000
; Jump table.
.addr INSTALL
.addr UNINSTALL
.addr COUNT
.addr READJOY
.addr 0 ; IRQ entry unused
; ------------------------------------------------------------------------
; Constants
JOY_COUNT = 1 ; Number of joysticks we support
.code
; ------------------------------------------------------------------------
; INSTALL routine. Is called after the driver is loaded into memory. If
; possible, check if the hardware is present and determine the amount of
; memory available.
; Must return an JOY_ERR_xx code in a/x.
;
INSTALL:
lda #<JOY_ERR_OK
ldx #>JOY_ERR_OK
; rts ; Run into UNINSTALL instead
; ------------------------------------------------------------------------
; DEINSTALL routine. Is called before the driver is removed from memory.
; Can do cleanup or whatever. Must not return anything.
;
UNINSTALL:
rts
; ------------------------------------------------------------------------
; COUNT: Return the total number of available joysticks in a/x.
;
;unsigned char __fastcall__ joy_count (void);
COUNT:
lda #<JOY_COUNT
ldx #>JOY_COUNT
rts
; ------------------------------------------------------------------------
; READ: Read a particular joystick passed in A.
;
;unsigned char __fastcall__ joy_read (unsigned char joystick);
READJOY:
lda sv_control
ldx #0
rts

View File

@ -0,0 +1,12 @@
;
; Address of the static standard joystick driver
;
; Oliver Schmidt, 2012-11-01
;
; const void joy_static_stddrv[];
;
.export _joy_static_stddrv
.import _supervision_stdjoy_joy
_joy_static_stddrv := _supervision_stdjoy_joy