From 12bfed04b1cc7cf224e95afebe13d75d7978730f Mon Sep 17 00:00:00 2001 From: Stefan Date: Tue, 21 Nov 2017 06:53:26 +0100 Subject: [PATCH 01/10] Create supervision-stdjoy.s --- libsrc/supervision/joy/supervision-stdjoy.s | 93 +++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 libsrc/supervision/joy/supervision-stdjoy.s diff --git a/libsrc/supervision/joy/supervision-stdjoy.s b/libsrc/supervision/joy/supervision-stdjoy.s new file mode 100644 index 000000000..2d89aa6cb --- /dev/null +++ b/libsrc/supervision/joy/supervision-stdjoy.s @@ -0,0 +1,93 @@ +; +; 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 + +; Button state masks (8 values) + + .byte $08 ; JOY_UP + .byte $04 ; JOY_DOWN + .byte $02 ; JOY_LEFT + .byte $01 ; JOY_RIGHT + .byte $20 ; JOY_FIRE_A + .byte $10 ; JOY_FIRE_B + .byte $40 ; JOY_SELECT + .byte $80 ; JOY_START + +; 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 + +; 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 + rts + +; ------------------------------------------------------------------------ +; READ: Read a particular joystick passed in A. +; +;unsigned char __fastcall__ joy_read (unsigned char joystick); + +READJOY: + lda sv_control + ldx #0 + rts From 949c2aa76f9bd0178567786530afbcbde6f45320 Mon Sep 17 00:00:00 2001 From: Stefan Date: Tue, 21 Nov 2017 06:57:02 +0100 Subject: [PATCH 02/10] Add files via upload --- libsrc/supervision/joy_stat_stddrv.s | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 libsrc/supervision/joy_stat_stddrv.s diff --git a/libsrc/supervision/joy_stat_stddrv.s b/libsrc/supervision/joy_stat_stddrv.s new file mode 100644 index 000000000..345b5f164 --- /dev/null +++ b/libsrc/supervision/joy_stat_stddrv.s @@ -0,0 +1,14 @@ +; +; 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 + +.rodata + +_joy_static_stddrv := _supervision_stdjoy_joy From e9c16e62e76ab0e9fde2e836451be72418234350 Mon Sep 17 00:00:00 2001 From: Stefan Date: Tue, 21 Nov 2017 09:51:35 +0100 Subject: [PATCH 03/10] Fix docs for #453 --- doc/funcref.sgml | 37 +++++++++++++++++++++++++++---------- doc/gamate.sgml | 7 +++++++ doc/supervision.sgml | 19 ++++++------------- 3 files changed, 40 insertions(+), 23 deletions(-) diff --git a/doc/funcref.sgml b/doc/funcref.sgml index 1d5ee7c19..e634a4f6f 100644 --- a/doc/funcref.sgml +++ b/doc/funcref.sgml @@ -4,7 +4,7 @@ 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> diff --git a/doc/gamate.sgml b/doc/gamate.sgml index 14b1a27e9..0948c20c4 100644 --- a/doc/gamate.sgml +++ b/doc/gamate.sgml @@ -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 diff --git a/doc/supervision.sgml b/doc/supervision.sgml index cf2af7967..c2ed425dd 100644 --- a/doc/supervision.sgml +++ b/doc/supervision.sgml @@ -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> From 40f960f7336b306c4d4d44fc88bed428a5a3ff19 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Tue, 21 Nov 2017 09:59:31 +0100 Subject: [PATCH 04/10] Date --- doc/supervision.sgml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/supervision.sgml b/doc/supervision.sgml index c2ed425dd..153746025 100644 --- a/doc/supervision.sgml +++ b/doc/supervision.sgml @@ -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 From f9b4e0b574e290a13ffa9e4ea580a2dcff48acab Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Tue, 21 Nov 2017 10:12:35 +0100 Subject: [PATCH 05/10] Update supervision.h --- include/supervision.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/supervision.h b/include/supervision.h index ffece4ecb..464c59e05 100644 --- a/include/supervision.h +++ b/include/supervision.h @@ -105,9 +105,10 @@ extern unsigned char sv_nmi_counter; extern unsigned char sv_timer_irq_counter; extern unsigned char sv_timer_dma_counter; +/* The addresses of the static drivers */ +extern void supervision_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */ + /* End of supervision.h */ #endif - - From e49744ecd065a958efd9d8ed90993f60b6fdf656 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Tue, 21 Nov 2017 10:22:53 +0100 Subject: [PATCH 06/10] New API --- include/supervision.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/supervision.h b/include/supervision.h index 464c59e05..492346492 100644 --- a/include/supervision.h +++ b/include/supervision.h @@ -105,6 +105,26 @@ 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) + /* The addresses of the static drivers */ extern void supervision_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */ From f8f464846aff3fd1c1fbedb2cb4a05073fe14541 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Tue, 21 Nov 2017 10:27:08 +0100 Subject: [PATCH 07/10] directive removed --- libsrc/supervision/joy_stat_stddrv.s | 2 -- 1 file changed, 2 deletions(-) diff --git a/libsrc/supervision/joy_stat_stddrv.s b/libsrc/supervision/joy_stat_stddrv.s index 345b5f164..4daa13e34 100644 --- a/libsrc/supervision/joy_stat_stddrv.s +++ b/libsrc/supervision/joy_stat_stddrv.s @@ -9,6 +9,4 @@ .export _joy_static_stddrv .import _supervision_stdjoy_joy -.rodata - _joy_static_stddrv := _supervision_stdjoy_joy From c4baf9588e1ef203bc49fe34a8cfc83a8c5942b5 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Tue, 21 Nov 2017 10:29:35 +0100 Subject: [PATCH 08/10] directive removed --- libsrc/gamate/joy_stat_stddrv.s | 2 -- 1 file changed, 2 deletions(-) diff --git a/libsrc/gamate/joy_stat_stddrv.s b/libsrc/gamate/joy_stat_stddrv.s index 75016450a..94537b210 100644 --- a/libsrc/gamate/joy_stat_stddrv.s +++ b/libsrc/gamate/joy_stat_stddrv.s @@ -9,6 +9,4 @@ .export _joy_static_stddrv .import _gamate_stdjoy_joy -.rodata - _joy_static_stddrv := _gamate_stdjoy_joy From 7d1c92dc129da98ec113817095f169d7266049ee Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Tue, 21 Nov 2017 10:33:48 +0100 Subject: [PATCH 09/10] New API --- libsrc/supervision/joy/supervision-stdjoy.s | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/libsrc/supervision/joy/supervision-stdjoy.s b/libsrc/supervision/joy/supervision-stdjoy.s index 2d89aa6cb..f6a325740 100644 --- a/libsrc/supervision/joy/supervision-stdjoy.s +++ b/libsrc/supervision/joy/supervision-stdjoy.s @@ -23,17 +23,6 @@ .addr $0000 -; Button state masks (8 values) - - .byte $08 ; JOY_UP - .byte $04 ; JOY_DOWN - .byte $02 ; JOY_LEFT - .byte $01 ; JOY_RIGHT - .byte $20 ; JOY_FIRE_A - .byte $10 ; JOY_FIRE_B - .byte $40 ; JOY_SELECT - .byte $80 ; JOY_START - ; Jump table. .addr INSTALL From f2e12b4715519787214639f718a442708f142e25 Mon Sep 17 00:00:00 2001 From: Stefan <stefan.haubenthal@gmail.com> Date: Tue, 21 Nov 2017 10:56:35 +0100 Subject: [PATCH 10/10] defined DYN_DRV --- include/supervision.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/supervision.h b/include/supervision.h index 492346492..f3ae1c25e 100644 --- a/include/supervision.h +++ b/include/supervision.h @@ -125,6 +125,9 @@ extern unsigned char sv_timer_dma_counter; #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[] */