From 58bfe28244d1edc96d73c43dd9716ee05fafad5f Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Wed, 31 Jan 2018 23:52:08 +0100 Subject: [PATCH 01/20] Updated AppleCommander URL. --- doc/apple2.sgml | 2 +- doc/apple2enh.sgml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/apple2.sgml b/doc/apple2.sgml index 33a878223..05b4ef9ba 100644 --- a/doc/apple2.sgml +++ b/doc/apple2.sgml @@ -39,7 +39,7 @@ containing the load address and load length. The default load address is $803. ) includes the option ) includes the option ) includes the option ) includes the option Date: Thu, 1 Feb 2018 00:18:07 +0100 Subject: [PATCH 02/20] Mention the recently added linker configs. --- doc/apple2.sgml | 39 +++++++++++++++++++++++++++++++++++++-- doc/apple2enh.sgml | 39 +++++++++++++++++++++++++++++++++++++-- 2 files changed, 74 insertions(+), 4 deletions(-) diff --git a/doc/apple2.sgml b/doc/apple2.sgml index 05b4ef9ba..822dd564e 100644 --- a/doc/apple2.sgml +++ b/doc/apple2.sgml @@ -168,9 +168,44 @@ Parameters:

+ + +Configuration for a program including a hires page. See testcode/lib/apple/hgrtest.c +for an example of such a program. + +Parameters: + + + + + Default: $803. Use + Default: DOS 3.3 header (address and length). Use + Default: $800. Use + Default: $9600. Use + Default: $D400. Use + Default: $C00. Use

+ + -Configuration for overlay programs with the up to nine overlays. The overlay files +Configuration for an overlay program with up to nine overlays. The overlay files don't include the DOS 3.3 header. See samples/overlaydemo.c for more information on overlays. @@ -210,7 +245,7 @@ Parameters: -Configuration for a assembler programs which don't need a special setup. +Configuration for an assembler program that doesn't need a special setup. Parameters: diff --git a/doc/apple2enh.sgml b/doc/apple2enh.sgml index 136f074b5..3a53b6b8c 100644 --- a/doc/apple2enh.sgml +++ b/doc/apple2enh.sgml @@ -168,9 +168,44 @@ Parameters:

+ + +Configuration for a program including a hires page. See testcode/lib/apple/hgrtest.c +for an example of such a program. + +Parameters: + + + + + Default: $803. Use + Default: DOS 3.3 header (address and length). Use + Default: $800. Use + Default: $9600. Use + Default: $D400. Use + Default: $C00. Use

+ + -Configuration for overlay programs with the up to nine overlays. The overlay files +Configuration for an overlay program with up to nine overlays. The overlay files don't include the DOS 3.3 header. See samples/overlaydemo.c for more information on overlays. @@ -210,7 +245,7 @@ Parameters: -Configuration for a assembler programs which don't need a special setup. +Configuration for an assembler program that doesn't need a special setup. Parameters: From 5145235b978e42ffe49641477ef6427de51c1cc0 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Thu, 1 Feb 2018 21:46:56 +0100 Subject: [PATCH 03/20] Updated AppleCommander URL. --- samples/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/Makefile b/samples/Makefile index 59841d655..2bcfa08c3 100644 --- a/samples/Makefile +++ b/samples/Makefile @@ -44,7 +44,7 @@ ifneq ($(filter disk samples.%,$(MAKECMDGOALS)),) # This one comes with VICE C1541 ?= c1541 - # For this one see http://applecommander.sourceforge.net/ + # For this one see https://applecommander.github.io/ AC ?= ac.jar # For this one see http://www.horus.com/~hias/atari/ From 9031320dff93ea93c97f82b3890d79558086ec79 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Thu, 1 Feb 2018 21:50:54 +0100 Subject: [PATCH 04/20] Added Makefile for recently added linker config test program. --- testcode/lib/apple2/Makefile | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 testcode/lib/apple2/Makefile diff --git a/testcode/lib/apple2/Makefile b/testcode/lib/apple2/Makefile new file mode 100644 index 000000000..87dadcbe7 --- /dev/null +++ b/testcode/lib/apple2/Makefile @@ -0,0 +1,12 @@ +# For this one see https://applecommander.github.io/ +AC ?= ac.jar + +CL = cl65 +CLFLAGS = -t apple2 -C apple2-hgr.cfg -Oirs + +hgrtest.dsk: hgrtest + cp prodos.dsk $@ + java -jar $(AC) -cc65 $@ hgrtest bin Date: Thu, 1 Feb 2018 22:06:59 +0100 Subject: [PATCH 05/20] Added missing dummy libref. --- libsrc/supervision/libref.s | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 libsrc/supervision/libref.s diff --git a/libsrc/supervision/libref.s b/libsrc/supervision/libref.s new file mode 100644 index 000000000..e4afa7eb1 --- /dev/null +++ b/libsrc/supervision/libref.s @@ -0,0 +1,8 @@ +; +; Oliver Schmidt, 2013-05-31 +; + + .export joy_libref + .import _exit + +joy_libref := _exit From 1976d6cd32f909babc5f6f26c9c068f47abb95bc Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Thu, 1 Feb 2018 22:38:36 +0100 Subject: [PATCH 06/20] Removed IRQ support from joystick drivers. All but one joystick drivers didn't use IRQs. Espsecially when the joystick driver kernel was the only .interruptor this meant quite some unnecessary overhead because it pulled in the whole IRQ infrastructure. I was told that the one driver using IRQs (the DXS/HIT-4 Player joystick driver for the C64) can be reworked to not do it. Until this is done that driver is defunct. --- asminc/joy-kernel.inc | 3 +-- libsrc/apple2/joy/a2.stdjoy.s | 1 - libsrc/atari/joy/atrmj8.s | 1 - libsrc/atari/joy/atrstd.s | 1 - libsrc/atari5200/joy/atr5200std.s | 1 - libsrc/atmos/joy/atmos-ijk.s | 12 ------------ libsrc/atmos/joy/atmos-pase.s | 1 - libsrc/c128/joy/c128-ptvjoy.s | 1 - libsrc/c128/joy/c128-stdjoy.s | 1 - libsrc/c64/joy/c64-hitjoy.s | 1 - libsrc/c64/joy/c64-numpad.s | 1 - libsrc/c64/joy/c64-ptvjoy.s | 1 - libsrc/c64/joy/c64-stdjoy.s | 1 - libsrc/cbm510/joy/cbm510-std.s | 1 - libsrc/creativision/joy/creativision-stdjoy.s | 1 - libsrc/gamate/joy/gamate-stdjoy.s | 1 - libsrc/joystick/joy-kernel.s | 18 +----------------- libsrc/joystick/joy_read.s | 2 -- libsrc/lynx/joy/lynx-stdjoy.s | 1 - libsrc/nes/joy/nes-stdjoy.s | 1 - libsrc/pce/joy/pce-stdjoy.s | 1 - libsrc/pet/joy/pet-ptvjoy.s | 1 - libsrc/pet/joy/pet-stdjoy.s | 1 - libsrc/plus4/joy/plus4-stdjoy.s | 1 - libsrc/supervision/joy/supervision-stdjoy.s | 1 - libsrc/vic20/joy/vic20-ptvjoy.s | 1 - libsrc/vic20/joy/vic20-stdjoy.s | 1 - 27 files changed, 2 insertions(+), 56 deletions(-) diff --git a/asminc/joy-kernel.inc b/asminc/joy-kernel.inc index c8cc29820..ef729fe3c 100644 --- a/asminc/joy-kernel.inc +++ b/asminc/joy-kernel.inc @@ -48,14 +48,13 @@ UNINSTALL .addr ; UNINSTALL routine COUNT .addr ; COUNT routine READ .addr ; READ routine - IRQ .addr ; IRQ routine .endstruct .endstruct ;------------------------------------------------------------------------------ ; The JOY API version, stored in JOY_HDR::VERSION -JOY_API_VERSION = $04 +JOY_API_VERSION = $05 ;------------------------------------------------------------------------------ ; Variables diff --git a/libsrc/apple2/joy/a2.stdjoy.s b/libsrc/apple2/joy/a2.stdjoy.s index ed2083255..7e90f7b98 100644 --- a/libsrc/apple2/joy/a2.stdjoy.s +++ b/libsrc/apple2/joy/a2.stdjoy.s @@ -52,7 +52,6 @@ PREAD := $FB1E ; Read paddle in X, return AD conv. value in Y .addr UNINSTALL .addr COUNT .addr READJOY - .addr 0 ; IRQ not used ; ------------------------------------------------------------------------ diff --git a/libsrc/atari/joy/atrmj8.s b/libsrc/atari/joy/atrmj8.s index 0e8cd2a0a..9b02485d6 100644 --- a/libsrc/atari/joy/atrmj8.s +++ b/libsrc/atari/joy/atrmj8.s @@ -41,7 +41,6 @@ .addr UNINSTALL .addr COUNT .addr READJOY - .addr 0 ; IRQ entry not used ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/atari/joy/atrstd.s b/libsrc/atari/joy/atrstd.s index 0c8799e21..0c49499f8 100644 --- a/libsrc/atari/joy/atrstd.s +++ b/libsrc/atari/joy/atrstd.s @@ -40,7 +40,6 @@ .addr UNINSTALL .addr COUNT .addr READJOY - .addr 0 ; IRQ entry not used ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/atari5200/joy/atr5200std.s b/libsrc/atari5200/joy/atr5200std.s index 0b8b93b63..041dc6830 100644 --- a/libsrc/atari5200/joy/atr5200std.s +++ b/libsrc/atari5200/joy/atr5200std.s @@ -33,7 +33,6 @@ .addr UNINSTALL .addr COUNT .addr READJOY - .addr 0 ; IRQ entry not used .code diff --git a/libsrc/atmos/joy/atmos-ijk.s b/libsrc/atmos/joy/atmos-ijk.s index f59f6b96a..6e75a3e0b 100644 --- a/libsrc/atmos/joy/atmos-ijk.s +++ b/libsrc/atmos/joy/atmos-ijk.s @@ -27,24 +27,12 @@ .addr $0000 -; Button state masks (8 values) - - .byte $10 ; JOY_UP - .byte $08 ; JOY_DOWN - .byte $01 ; JOY_LEFT - .byte $02 ; JOY_RIGHT - .byte $20 ; JOY_FIRE - .byte $00 ; Future expansion - .byte $00 ; Future expansion - .byte $00 ; Future expansion - ; Jump table. .addr INSTALL .addr UNINSTALL .addr COUNT .addr READ - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/atmos/joy/atmos-pase.s b/libsrc/atmos/joy/atmos-pase.s index 637571c04..fd64901c9 100644 --- a/libsrc/atmos/joy/atmos-pase.s +++ b/libsrc/atmos/joy/atmos-pase.s @@ -34,7 +34,6 @@ .addr UNINSTALL .addr COUNT .addr READ - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/c128/joy/c128-ptvjoy.s b/libsrc/c128/joy/c128-ptvjoy.s index c9ae39a47..180f7667d 100644 --- a/libsrc/c128/joy/c128-ptvjoy.s +++ b/libsrc/c128/joy/c128-ptvjoy.s @@ -36,7 +36,6 @@ .addr UNINSTALL .addr COUNT .addr READ - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/c128/joy/c128-stdjoy.s b/libsrc/c128/joy/c128-stdjoy.s index 943361da5..bf2e2fea7 100644 --- a/libsrc/c128/joy/c128-stdjoy.s +++ b/libsrc/c128/joy/c128-stdjoy.s @@ -36,7 +36,6 @@ .addr UNINSTALL .addr COUNT .addr READ - .addr 0 ; IRQ entry not used ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/c64/joy/c64-hitjoy.s b/libsrc/c64/joy/c64-hitjoy.s index 10c936399..9f6c0b4dd 100644 --- a/libsrc/c64/joy/c64-hitjoy.s +++ b/libsrc/c64/joy/c64-hitjoy.s @@ -35,7 +35,6 @@ .addr UNINSTALL .addr COUNT .addr READ - .addr IRQ ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/c64/joy/c64-numpad.s b/libsrc/c64/joy/c64-numpad.s index 5ed7af187..0ccdc4fcd 100644 --- a/libsrc/c64/joy/c64-numpad.s +++ b/libsrc/c64/joy/c64-numpad.s @@ -36,7 +36,6 @@ .addr UNINSTALL .addr COUNT .addr READ - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/c64/joy/c64-ptvjoy.s b/libsrc/c64/joy/c64-ptvjoy.s index af5c27e13..a772fb5f6 100644 --- a/libsrc/c64/joy/c64-ptvjoy.s +++ b/libsrc/c64/joy/c64-ptvjoy.s @@ -35,7 +35,6 @@ .addr UNINSTALL .addr COUNT .addr READ - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/c64/joy/c64-stdjoy.s b/libsrc/c64/joy/c64-stdjoy.s index 930ad6227..c983d81bb 100644 --- a/libsrc/c64/joy/c64-stdjoy.s +++ b/libsrc/c64/joy/c64-stdjoy.s @@ -35,7 +35,6 @@ .addr UNINSTALL .addr COUNT .addr READ - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/cbm510/joy/cbm510-std.s b/libsrc/cbm510/joy/cbm510-std.s index 0c2efc12d..4e47fc1a0 100644 --- a/libsrc/cbm510/joy/cbm510-std.s +++ b/libsrc/cbm510/joy/cbm510-std.s @@ -36,7 +36,6 @@ .addr UNINSTALL .addr COUNT .addr READ - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/creativision/joy/creativision-stdjoy.s b/libsrc/creativision/joy/creativision-stdjoy.s index 9a5afc42b..5cf46c39f 100644 --- a/libsrc/creativision/joy/creativision-stdjoy.s +++ b/libsrc/creativision/joy/creativision-stdjoy.s @@ -33,7 +33,6 @@ .addr UNINSTALL .addr COUNT .addr READJOY - .addr 0 ; IRQ entry not used ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/gamate/joy/gamate-stdjoy.s b/libsrc/gamate/joy/gamate-stdjoy.s index 801b40acd..8f927cdf5 100644 --- a/libsrc/gamate/joy/gamate-stdjoy.s +++ b/libsrc/gamate/joy/gamate-stdjoy.s @@ -30,7 +30,6 @@ .addr UNINSTALL .addr COUNT .addr READJOY - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/joystick/joy-kernel.s b/libsrc/joystick/joy-kernel.s index 0746709e9..c2d50c8d8 100644 --- a/libsrc/joystick/joy-kernel.s +++ b/libsrc/joystick/joy-kernel.s @@ -6,7 +6,6 @@ .import joy_libref .importzp ptr1 - .interruptor joy_irq ; Export as IRQ handler .include "joy-kernel.inc" .include "joy-error.inc" @@ -26,7 +25,6 @@ joy_install: jmp $0000 joy_uninstall: jmp $0000 joy_count: jmp $0000 joy_read: jmp $0000 -joy_irq: .byte $60, $00, $00 ; RTS plus two dummy bytes ; Driver header signature .rodata @@ -73,18 +71,7 @@ _joy_install: cpy #(JOY_HDR::JUMPTAB + .sizeof(JOY_HDR::JUMPTAB)) bne @L1 - jsr joy_install ; Call driver install routine - tay ; Test error code - bne @L2 ; Bail out if install had errors - -; Install the IRQ vector if the driver needs it. A/X contains the error code -; from joy_install, so don't use it. - - ldy joy_irq+2 ; Check high byte of IRQ vector - beq @L2 ; Jump if vector invalid - ldy #$4C ; JMP opcode - sty joy_irq ; Activate IRQ routine -@L2: rts + jmp joy_install ; Call driver install routine ; Driver signature invalid @@ -108,9 +95,6 @@ copy: lda (ptr1),y ; */ _joy_uninstall: - lda #$60 ; RTS opcode - sta joy_irq ; Disable IRQ entry point - jsr joy_uninstall ; Call the driver routine _joy_clear_ptr: ; External entry point diff --git a/libsrc/joystick/joy_read.s b/libsrc/joystick/joy_read.s index f76d9dfb7..151600aee 100644 --- a/libsrc/joystick/joy_read.s +++ b/libsrc/joystick/joy_read.s @@ -8,5 +8,3 @@ .include "joy-kernel.inc" _joy_read = joy_read ; Use driver entry - - diff --git a/libsrc/lynx/joy/lynx-stdjoy.s b/libsrc/lynx/joy/lynx-stdjoy.s index 2e91cc43b..c81a97dbf 100644 --- a/libsrc/lynx/joy/lynx-stdjoy.s +++ b/libsrc/lynx/joy/lynx-stdjoy.s @@ -37,7 +37,6 @@ .addr UNINSTALL .addr COUNT .addr READ - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/nes/joy/nes-stdjoy.s b/libsrc/nes/joy/nes-stdjoy.s index 3032e9330..63caf364b 100644 --- a/libsrc/nes/joy/nes-stdjoy.s +++ b/libsrc/nes/joy/nes-stdjoy.s @@ -35,7 +35,6 @@ .addr UNINSTALL .addr COUNT .addr READJOY - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/pce/joy/pce-stdjoy.s b/libsrc/pce/joy/pce-stdjoy.s index ab25134dd..c0f338f90 100644 --- a/libsrc/pce/joy/pce-stdjoy.s +++ b/libsrc/pce/joy/pce-stdjoy.s @@ -30,7 +30,6 @@ .addr UNINSTALL .addr COUNT .addr READJOY - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/pet/joy/pet-ptvjoy.s b/libsrc/pet/joy/pet-ptvjoy.s index 3bb368355..7620013be 100644 --- a/libsrc/pet/joy/pet-ptvjoy.s +++ b/libsrc/pet/joy/pet-ptvjoy.s @@ -34,7 +34,6 @@ .addr UNINSTALL .addr COUNT .addr READ - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/pet/joy/pet-stdjoy.s b/libsrc/pet/joy/pet-stdjoy.s index 29c6de627..85b742302 100644 --- a/libsrc/pet/joy/pet-stdjoy.s +++ b/libsrc/pet/joy/pet-stdjoy.s @@ -33,7 +33,6 @@ .addr UNINSTALL .addr COUNT .addr READ - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/plus4/joy/plus4-stdjoy.s b/libsrc/plus4/joy/plus4-stdjoy.s index d998b2699..e8e85fedc 100644 --- a/libsrc/plus4/joy/plus4-stdjoy.s +++ b/libsrc/plus4/joy/plus4-stdjoy.s @@ -37,7 +37,6 @@ .addr UNINSTALL .addr COUNT .addr READ - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/supervision/joy/supervision-stdjoy.s b/libsrc/supervision/joy/supervision-stdjoy.s index f6a325740..d233a8600 100644 --- a/libsrc/supervision/joy/supervision-stdjoy.s +++ b/libsrc/supervision/joy/supervision-stdjoy.s @@ -29,7 +29,6 @@ .addr UNINSTALL .addr COUNT .addr READJOY - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/vic20/joy/vic20-ptvjoy.s b/libsrc/vic20/joy/vic20-ptvjoy.s index 3b1db402a..bf0ff128e 100644 --- a/libsrc/vic20/joy/vic20-ptvjoy.s +++ b/libsrc/vic20/joy/vic20-ptvjoy.s @@ -36,7 +36,6 @@ .addr UNINSTALL .addr COUNT .addr READ - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants diff --git a/libsrc/vic20/joy/vic20-stdjoy.s b/libsrc/vic20/joy/vic20-stdjoy.s index 67299cc1a..e5539c653 100644 --- a/libsrc/vic20/joy/vic20-stdjoy.s +++ b/libsrc/vic20/joy/vic20-stdjoy.s @@ -36,7 +36,6 @@ .addr UNINSTALL .addr COUNT .addr READ - .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants From f15cd3e468f68454706b44ff167570f7fea5886b Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Fri, 2 Feb 2018 12:02:52 +0100 Subject: [PATCH 07/20] Removed IRQ support from joystick drivers. --- include/joystick/joy-kernel.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/joystick/joy-kernel.h b/include/joystick/joy-kernel.h index e984291f7..783508247 100644 --- a/include/joystick/joy-kernel.h +++ b/include/joystick/joy-kernel.h @@ -59,7 +59,6 @@ typedef struct { void* uninstall; /* UNINSTALL routine */ void* count; /* COUNT routine */ void* read; /* READ routine */ - void* irq; /* IRQ routine */ } joy_drv_header; From 935f68f686ae13b93522d73bb0f9996eb9527489 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Fri, 2 Feb 2018 12:28:22 +0100 Subject: [PATCH 08/20] Harmonized the style of including headers from headers. We surely don't care about some file I/O on host machines in 2018 ;-) --- include/ace.h | 2 -- include/apple2.h | 3 ++- include/apple2enh.h | 5 +---- include/atari.h | 2 ++ include/atari2600.h | 8 +++++++- include/c16.h | 2 -- include/cbm.h | 5 +---- include/geos.h | 37 ++----------------------------------- include/geos/gdisk.h | 2 -- include/geos/gfile.h | 2 -- include/geos/ggraph.h | 2 -- include/geos/gmemory.h | 2 -- include/geos/gmenu.h | 2 -- include/geos/gprocess.h | 2 -- include/geos/gsym.h | 2 -- include/lynx.h | 5 +++++ include/plus4.h | 2 -- include/stdio.h | 11 ++--------- 18 files changed, 22 insertions(+), 74 deletions(-) diff --git a/include/ace.h b/include/ace.h index fba672227..8ce86e18f 100644 --- a/include/ace.h +++ b/include/ace.h @@ -45,9 +45,7 @@ -#ifndef _STDDEF_H #include -#endif diff --git a/include/apple2.h b/include/apple2.h index 31e56a95a..f217ad04c 100644 --- a/include/apple2.h +++ b/include/apple2.h @@ -41,9 +41,10 @@ # error This module may only be used when compiling for the Apple ][! #endif - #include + + /*****************************************************************************/ /* Data */ /*****************************************************************************/ diff --git a/include/apple2enh.h b/include/apple2enh.h index cc62f70b7..77328b5ed 100644 --- a/include/apple2enh.h +++ b/include/apple2enh.h @@ -42,10 +42,7 @@ -/* If not already done, include the apple2.h header file */ -#if !defined(_APPLE2_H) -# include -#endif +#include diff --git a/include/atari.h b/include/atari.h index bf1af7d7b..4bed8d7a7 100644 --- a/include/atari.h +++ b/include/atari.h @@ -355,5 +355,7 @@ struct __iocb { #define IOCB_GETCWD 0x30 /* get current directory (MyDOS/SpartaDOS) */ #define IOCB_FORMAT 0xFE /* format */ + + /* End of atari.h */ #endif diff --git a/include/atari2600.h b/include/atari2600.h index 1eb51a2dd..a6b5cda47 100644 --- a/include/atari2600.h +++ b/include/atari2600.h @@ -8,9 +8,13 @@ /* */ /*****************************************************************************/ + + #ifndef _ATARI2600_H #define _ATARI2600_H + + /* Check for errors */ #if !defined(__ATARI2600__) # error This module may only be used when compiling for the Atari 2600! @@ -22,5 +26,7 @@ #include <_riot.h> #define RIOT (*(struct __riot*)0x0280) + + /* End of atari2600.h */ -#endif /* #ifndef _ATARI2600_H */ +#endif diff --git a/include/c16.h b/include/c16.h index d49ca6fd4..c039218f9 100644 --- a/include/c16.h +++ b/include/c16.h @@ -47,9 +47,7 @@ /* Include the base header file for the 264 series. include file. */ -#ifndef _CBM264_H #include -#endif diff --git a/include/cbm.h b/include/cbm.h index da63375b2..1395f700f 100644 --- a/include/cbm.h +++ b/include/cbm.h @@ -46,10 +46,7 @@ /* We need NULL. */ - -#if !defined(_STDDEF_H) -# include -#endif +#include /* Load the system-specific files here, if needed. */ #if defined(__C64__) && !defined(_C64_H) diff --git a/include/geos.h b/include/geos.h index ae356d679..3f760b6ad 100644 --- a/include/geos.h +++ b/include/geos.h @@ -19,53 +19,19 @@ -#ifndef _GCONST_H #include -#endif - -#ifndef _GSTRUCT_H #include -#endif - -#ifndef _GSYM_H #include -#endif - -#ifndef _GDISK_H #include -#endif - -#ifndef _GFILE_H #include -#endif - -#ifndef _GPROCESS_H #include -#endif - -#ifndef _GGRAPH_H #include -#endif - -#ifndef _GMENU_H #include -#endif - -#ifndef _GSPRITE_H #include -#endif - -#ifndef _GMEMORY_H #include -#endif - -#ifndef _GSYS_H #include -#endif - -#ifndef _GDLGBOX_H #include -#endif + #define CH_ULCORNER '+' @@ -140,5 +106,6 @@ #define JOY_BTN_1_MASK 0x10 + /* End of geos.h */ #endif diff --git a/include/geos/gdisk.h b/include/geos/gdisk.h index f65d7d301..30305a2fc 100644 --- a/include/geos/gdisk.h +++ b/include/geos/gdisk.h @@ -7,9 +7,7 @@ #ifndef _GDISK_H #define _GDISK_H -#ifndef _GSTRUCT_H #include -#endif char __fastcall__ ReadBuff(struct tr_se *myTrSe); char __fastcall__ WriteBuff(struct tr_se *myTrSe); diff --git a/include/geos/gfile.h b/include/geos/gfile.h index d7667d8ec..ec7a75bbc 100644 --- a/include/geos/gfile.h +++ b/include/geos/gfile.h @@ -7,9 +7,7 @@ #ifndef _GFILE_H #define _GFILE_H -#ifndef _GSTRUCT_H #include -#endif struct filehandle *Get1stDirEntry(void); struct filehandle *GetNxtDirEntry(void); diff --git a/include/geos/ggraph.h b/include/geos/ggraph.h index 961ec2d80..35e02c198 100644 --- a/include/geos/ggraph.h +++ b/include/geos/ggraph.h @@ -7,9 +7,7 @@ #ifndef _GGRAPH_H #define _GGRAPH_H -#ifndef _GSTRUCT_H #include -#endif void __fastcall__ SetPattern(char newpattern); diff --git a/include/geos/gmemory.h b/include/geos/gmemory.h index 3fba5cb5b..ba8e9f211 100644 --- a/include/geos/gmemory.h +++ b/include/geos/gmemory.h @@ -7,9 +7,7 @@ #ifndef _GMEMORY_H #define _GMEMORY_H -#ifndef _GSTRUCT_H #include -#endif void __fastcall__ CopyString(char *dest, const char *source); char __fastcall__ CmpString(const char *dest, const char *source); diff --git a/include/geos/gmenu.h b/include/geos/gmenu.h index 3175b6cf3..89caa2c02 100644 --- a/include/geos/gmenu.h +++ b/include/geos/gmenu.h @@ -7,9 +7,7 @@ #ifndef _GMENU_H #define _GMENU_H -#ifndef _GSTRUCT_H #include -#endif void __fastcall__ DoMenu(struct menu *myMenu); void ReDoMenu(void); diff --git a/include/geos/gprocess.h b/include/geos/gprocess.h index 6fab2ecfa..000003f32 100644 --- a/include/geos/gprocess.h +++ b/include/geos/gprocess.h @@ -7,9 +7,7 @@ #ifndef _GPROCESS_H #define _GPROCESS_H -#ifndef _GSTRUCT_H #include -#endif void __fastcall__ InitProcesses(char number, struct process *proctab); void __fastcall__ RestartProcess(char number); diff --git a/include/geos/gsym.h b/include/geos/gsym.h index 085046674..2b2c8fbb2 100644 --- a/include/geos/gsym.h +++ b/include/geos/gsym.h @@ -7,9 +7,7 @@ #ifndef _GSYM_H #define _GSYM_H -#ifndef _GSTRUCT_H #include -#endif #define r0 (*(unsigned*)(R_BASE + 0x00)) #define r0L (*(char*)(R_BASE + 0x00)) diff --git a/include/lynx.h b/include/lynx.h index 3629f322e..4b0390a13 100644 --- a/include/lynx.h +++ b/include/lynx.h @@ -123,6 +123,8 @@ extern void lynx_160_102_16_tgi[]; /* Referred to by tgi_static_stddrv[] */ /* Sound support */ /*****************************************************************************/ + + void lynx_snd_init (void); /* Initialize the sound driver */ @@ -144,6 +146,8 @@ void __fastcall__ lynx_snd_stop_channel (unsigned char channel); unsigned char lynx_snd_active(void); /* Show which channels are active */ + + /*****************************************************************************/ /* Accessing the cart */ /*****************************************************************************/ @@ -209,5 +213,6 @@ unsigned __fastcall__ lynx_eewrite (unsigned cell, unsigned val); #define SUZY (*(struct __suzy*)0xFC00) + /* End of lynx.h */ #endif diff --git a/include/plus4.h b/include/plus4.h index 840e8b342..81e3c5286 100644 --- a/include/plus4.h +++ b/include/plus4.h @@ -47,9 +47,7 @@ /* Include the base header file for the 264 series. include file. */ -#ifndef _CBM264_H #include -#endif /* Define hardware */ #include <_6551.h> diff --git a/include/stdio.h b/include/stdio.h index a3facd513..73dc05bdb 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -38,12 +38,8 @@ -#ifndef _STDDEF_H -# include -#endif -#ifndef _STDARG_H -# include -#endif +#include +#include @@ -147,6 +143,3 @@ void __fastcall__ _poserror (const char* msg); /* cc65 */ /* End of stdio.h */ #endif - - - From 2cf1bb89be0fec491d3c24cd238325651d0e55fb Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Fri, 2 Feb 2018 12:35:40 +0100 Subject: [PATCH 09/20] Removed ACE header. There's no code in the tool chain to set __ACE__ nor is there an ace.lib C library. --- include/ace.h | 117 -------------------------------------------------- 1 file changed, 117 deletions(-) delete mode 100644 include/ace.h diff --git a/include/ace.h b/include/ace.h deleted file mode 100644 index 8ce86e18f..000000000 --- a/include/ace.h +++ /dev/null @@ -1,117 +0,0 @@ -/*****************************************************************************/ -/* */ -/* ace.h */ -/* */ -/* ACE system-specific definitions */ -/* */ -/* */ -/* */ -/* (C) 1998-2015, Ullrich von Bassewitz */ -/* Roemerstrasse 52 */ -/* D-70794 Filderstadt */ -/* EMail: uz@cc65.org */ -/* */ -/* */ -/* This software is provided 'as-is', without any expressed or implied */ -/* warranty. In no event will the authors be held liable for any damages */ -/* arising from the use of this software. */ -/* */ -/* Permission is granted to anyone to use this software for any purpose, */ -/* including commercial applications, and to alter it and redistribute it */ -/* freely, subject to the following restrictions: */ -/* */ -/* 1. The origin of this software must not be misrepresented; you must not */ -/* claim that you wrote the original software. If you use this software */ -/* in a product, an acknowledgment in the product documentation would be */ -/* appreciated but is not required. */ -/* 2. Altered source versions must be plainly marked as such, and must not */ -/* be misrepresented as being the original software. */ -/* 3. This notice may not be removed or altered from any source */ -/* distribution. */ -/* */ -/*****************************************************************************/ - - - -#ifndef _ACE_H -#define _ACE_H - - - -/* Check for errors */ -#if !defined(__ACE__) -# error This module may only be used when compiling for the ACE os! -#endif - - - -#include - - - -struct aceDirentBuf { - unsigned long ad_size; /* Size in bytes */ - unsigned char ad_date [8]; /* YY:YY:MM:DD:HH:MM:SS:TW */ - char ad_type [4]; /* File type as ASCIIZ string */ - unsigned char ad_flags; /* File flags */ - unsigned char ad_usage; /* More flags */ - unsigned char ad_namelen; /* Length of name */ - char ad_name [17]; /* Name itself, ASCIIZ */ -}; - -int __cdecl__ aceDirOpen (char* dir); -int __cdecl__ aceDirClose (int handle); -int __cdecl__ aceDirRead (int handle, struct aceDirentBuf* buf); - -/* Type of an ACE key. Key in low byte, shift mask in high byte */ -typedef unsigned int aceKey; - -/* #defines for the shift mask returned by aceConGetKey */ -#define aceSH_KEY 0x00FF /* Mask key itself */ -#define aceSH_MASK 0xFF00 /* Mask shift mask */ -#define aceSH_EXT 0x2000 /* Extended key */ -#define aceSH_CAPS 0x1000 /* Caps lock key */ -#define aceSH_ALT 0x0800 /* Alternate key */ -#define aceSH_CTRL 0x0400 /* Ctrl key */ -#define aceSH_CBM 0x0200 /* Commodore key */ -#define aceSH_SHIFT 0x0100 /* Shift key */ - -/* #defines for the options in aceConSetOpt/aceConGetOpt */ -#define aceOP_PUTMASK 1 /* Console put mask */ -#define aceOP_CHARCOLOR 2 /* Character color */ -#define aceOP_CHARATTR 3 /* Character attribute */ -#define aceOP_FILLCOLOR 4 /* Fill color */ -#define aceOP_FILLATTR 5 /* Fill attribute */ -#define aceOP_CRSCOLOR 6 /* Cursor color */ -#define aceOP_CRSWRAP 7 /* Force cursor wrap */ -#define aceOP_SHSCROLL 8 /* Shift keys for scrolling */ -#define aceOP_MOUSCALE 9 /* Mouse scaling */ -#define aceOP_RPTDELAY 10 /* Key repeat delay */ -#define aceOP_RPTRATE 11 /* Key repeat rate */ - -/* Console functions */ -void __cdecl__ aceConWrite (char* buf, size_t count); -void __cdecl__ aceConPutLit (int c); -void __cdecl__ aceConPos (unsigned x, unsigned y); -void __cdecl__ aceConGetPos (unsigned* x, unsigned* y); -unsigned aceConGetX (void); -unsigned aceConGetY (void); -char __cdecl__* aceConInput (char* buf, unsigned initial); -int aceConStopKey (void); -aceKey aceConGetKey (void); -int __cdecl__ aceConKeyAvail (aceKey* key); -void __cdecl__ aceConKeyMat (char* matrix); -void __cdecl__ aceConSetOpt (unsigned char opt, unsigned char val); -int __cdecl__ aceConGetOpt (unsigned char opt); - -/* Misc stuff */ -int __cdecl__ aceMiscIoPeek (unsigned addr); -void __cdecl__ aceMiscIoPoke (unsigned addr, unsigned char val); - - - -/* End of ace.h */ -#endif - - - From d7afadb2fe62a2154ad5bcb949644da17e4ac7c6 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Fri, 2 Feb 2018 12:59:05 +0100 Subject: [PATCH 10/20] Factored out target specific inclusion of target header. So far conio.h included the target header to get the CH_... and COLOR_... macros. However tgi.h never did the same to get the TGI_COLOR_... macros. And some time ago the JOY_..._MASK macros moved from joystick.h into the target header yet joystick.h didn't include the target header. Why wasn't that issue detected so far? Because about every program using TGI and/or the joystick uses CONIO too and therefore includes the target header that way. However, conceptually it's clean to factor out the target header inclusion and have tgi.h and joystick.h do it like conio.h. Apart from that user code may make direct use of target.h too. --- include/conio.h | 44 ++++------------------------ include/joystick.h | 7 +++-- include/target.h | 73 ++++++++++++++++++++++++++++++++++++++++++++++ include/tgi.h | 6 +--- 4 files changed, 84 insertions(+), 46 deletions(-) create mode 100644 include/target.h diff --git a/include/conio.h b/include/conio.h index 9cd505766..72421af86 100644 --- a/include/conio.h +++ b/include/conio.h @@ -54,40 +54,8 @@ -#if !defined(_STDARG_H) -# include -#endif - -/* Include the correct machine-specific file */ -#if defined(__APPLE2ENH__) -# include -#elif defined(__APPLE2__) -# include -#elif defined(__ATARI5200__) -# include -#elif defined(__ATARI__) -# include -#elif defined(__ATMOS__) -# include -#elif defined(__CBM__) -# include -#elif defined(__CREATIVISION__) -# include -#elif defined(__GAMATE__) -# include -#elif defined(__GEOS__) -# include -#elif defined(__LUNIX__) -# include -#elif defined(__LYNX__) -# include -#elif defined(__NES__) -# include -#elif defined(__OSIC1P__) -# include -#elif defined(__PCE__) -# include -#endif +#include +#include @@ -232,16 +200,16 @@ void __fastcall__ cputhex16 (unsigned val); ** the macro will give access to the actual function. */ -#if defined(_textcolor) +#ifdef _textcolor # define textcolor(x) _textcolor(x) #endif -#if defined(_bgcolor) +#ifdef _bgcolor # define bgcolor(x) _bgcolor(x) #endif -#if defined(_bordercolor) +#ifdef _bordercolor # define bordercolor(x) _bordercolor(x) #endif -#if defined(_cpeekcolor) +#ifdef _cpeekcolor # define cpeekcolor(x) _cpeekcolor(x) #endif diff --git a/include/joystick.h b/include/joystick.h index 26f339fe4..b6771c381 100644 --- a/include/joystick.h +++ b/include/joystick.h @@ -38,6 +38,10 @@ +#include + + + /*****************************************************************************/ /* Definitions */ /*****************************************************************************/ @@ -103,6 +107,3 @@ unsigned char __fastcall__ joy_read (unsigned char joystick); /* End of joystick.h */ #endif - - - diff --git a/include/target.h b/include/target.h new file mode 100644 index 000000000..af401ec35 --- /dev/null +++ b/include/target.h @@ -0,0 +1,73 @@ +/*****************************************************************************/ +/* */ +/* target.h */ +/* */ +/* Target specific definitions */ +/* */ +/* */ +/* */ +/* This software is provided 'as-is', without any expressed or implied */ +/* warranty. In no event will the authors be held liable for any damages */ +/* arising from the use of this software. */ +/* */ +/* Permission is granted to anyone to use this software for any purpose, */ +/* including commercial applications, and to alter it and redistribute it */ +/* freely, subject to the following restrictions: */ +/* */ +/* 1. The origin of this software must not be misrepresented; you must not */ +/* claim that you wrote the original software. If you use this software */ +/* in a product, an acknowledgment in the product documentation would be */ +/* appreciated but is not required. */ +/* 2. Altered source versions must be plainly marked as such, and must not */ +/* be misrepresented as being the original software. */ +/* 3. This notice may not be removed or altered from any source */ +/* distribution. */ +/* */ +/*****************************************************************************/ + + + +#ifndef _TARGET_H +#define _TARGET_H + + + +/* Include the correct target specific file */ +#if defined(__APPLE2ENH__) +# include +#elif defined(__APPLE2__) +# include +#elif defined(__ATARI__) +# include +#elif defined(__ATARI2600__) +# include +#elif defined(__ATARI5200__) +# include +#elif defined(__ATMOS__) +# include +#elif defined(__CBM__) +# include +#elif defined(__CREATIVISION__) +# include +#elif defined(__GAMATE__) +# include +#elif defined(__GEOS__) +# include +#elif defined(__LYNX__) +# include +#elif defined(__NES__) +# include +#elif defined(__OSIC1P__) +# include +#elif defined(__PCE__) +# include +#elif defined(__SUPERVISION__) +# include +#elif defined(__TELESTRAT__) +# include +#endif + + + +/* End of target.h */ +#endif diff --git a/include/tgi.h b/include/tgi.h index 02dff8868..f458180c5 100644 --- a/include/tgi.h +++ b/include/tgi.h @@ -38,9 +38,8 @@ -#ifndef _TGI_ERROR_H #include -#endif +#include @@ -284,6 +283,3 @@ int __fastcall__ tgi_imulround (int rhs, int lhs); /* End of tgi.h */ #endif - - - From 7521ae888a5a0f40273d554fb06355fc3572f57d Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Fri, 2 Feb 2018 14:46:57 +0100 Subject: [PATCH 11/20] Marked Apple II EXEHDR segment as optional. The docs say "Use -D __EXEHDR__=0 to omit the header." so it should work without generating a linker warning. --- cfg/apple2-hgr.cfg | 2 +- cfg/apple2-overlay.cfg | 2 +- cfg/apple2.cfg | 2 +- cfg/apple2enh-hgr.cfg | 2 +- cfg/apple2enh-overlay.cfg | 2 +- cfg/apple2enh.cfg | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cfg/apple2-hgr.cfg b/cfg/apple2-hgr.cfg index 536491c67..b11dd12bc 100644 --- a/cfg/apple2-hgr.cfg +++ b/cfg/apple2-hgr.cfg @@ -19,7 +19,7 @@ MEMORY { } SEGMENTS { ZEROPAGE: load = ZP, type = zp; - EXEHDR: load = HEADER, type = ro; + EXEHDR: load = HEADER, type = ro, optional = yes; STARTUP: load = MAIN, type = ro; LOWCODE: load = MAIN, type = ro, optional = yes; HGR: load = MAIN, type = rw, optional = yes, start = $2000; diff --git a/cfg/apple2-overlay.cfg b/cfg/apple2-overlay.cfg index e6a5ae25c..d5476d264 100644 --- a/cfg/apple2-overlay.cfg +++ b/cfg/apple2-overlay.cfg @@ -36,7 +36,7 @@ MEMORY { } SEGMENTS { ZEROPAGE: load = ZP, type = zp; - EXEHDR: load = HEADER, type = ro; + EXEHDR: load = HEADER, type = ro, optional = yes; STARTUP: load = MAIN, type = ro, define = yes; LOWCODE: load = MAIN, type = ro, optional = yes; CODE: load = MAIN, type = ro; diff --git a/cfg/apple2.cfg b/cfg/apple2.cfg index eba2a0e66..bbe45839d 100644 --- a/cfg/apple2.cfg +++ b/cfg/apple2.cfg @@ -19,7 +19,7 @@ MEMORY { } SEGMENTS { ZEROPAGE: load = ZP, type = zp; - EXEHDR: load = HEADER, type = ro; + EXEHDR: load = HEADER, type = ro, optional = yes; STARTUP: load = MAIN, type = ro; LOWCODE: load = MAIN, type = ro, optional = yes; CODE: load = MAIN, type = ro; diff --git a/cfg/apple2enh-hgr.cfg b/cfg/apple2enh-hgr.cfg index 536491c67..b11dd12bc 100644 --- a/cfg/apple2enh-hgr.cfg +++ b/cfg/apple2enh-hgr.cfg @@ -19,7 +19,7 @@ MEMORY { } SEGMENTS { ZEROPAGE: load = ZP, type = zp; - EXEHDR: load = HEADER, type = ro; + EXEHDR: load = HEADER, type = ro, optional = yes; STARTUP: load = MAIN, type = ro; LOWCODE: load = MAIN, type = ro, optional = yes; HGR: load = MAIN, type = rw, optional = yes, start = $2000; diff --git a/cfg/apple2enh-overlay.cfg b/cfg/apple2enh-overlay.cfg index e6a5ae25c..d5476d264 100644 --- a/cfg/apple2enh-overlay.cfg +++ b/cfg/apple2enh-overlay.cfg @@ -36,7 +36,7 @@ MEMORY { } SEGMENTS { ZEROPAGE: load = ZP, type = zp; - EXEHDR: load = HEADER, type = ro; + EXEHDR: load = HEADER, type = ro, optional = yes; STARTUP: load = MAIN, type = ro, define = yes; LOWCODE: load = MAIN, type = ro, optional = yes; CODE: load = MAIN, type = ro; diff --git a/cfg/apple2enh.cfg b/cfg/apple2enh.cfg index eba2a0e66..bbe45839d 100644 --- a/cfg/apple2enh.cfg +++ b/cfg/apple2enh.cfg @@ -19,7 +19,7 @@ MEMORY { } SEGMENTS { ZEROPAGE: load = ZP, type = zp; - EXEHDR: load = HEADER, type = ro; + EXEHDR: load = HEADER, type = ro, optional = yes; STARTUP: load = MAIN, type = ro; LOWCODE: load = MAIN, type = ro, optional = yes; CODE: load = MAIN, type = ro; From dacee3b9edd1167a050add3dc5be4e661d1d877c Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Fri, 2 Feb 2018 18:15:45 +0100 Subject: [PATCH 12/20] Removed IRQ support from TGI drivers. All but one TGI drivers didn't use IRQs. Especially when the TGI driver kernel was the only .interruptor this meant quite some unnecessary overhead because it pulled in the whole IRQ infrastructure. The one driver using IRQs (the graphics driver for the 160x102x16 mode on the Lynx) now uses a library reference to set up a JMP to its IRQ handler. --- asminc/tgi-kernel.inc | 3 +-- libsrc/apple2/tgi/a2.hi.s | 1 - libsrc/apple2/tgi/a2.lo.s | 1 - libsrc/atari/tgi/atari_tgi_common.inc | 1 - libsrc/atmos/tgi/atmos-228-200-3.s | 1 - libsrc/atmos/tgi/atmos-240-200-2.s | 1 - libsrc/c128/tgi/c128-vdc.s | 1 - libsrc/c128/tgi/c128-vdc2.s | 1 - libsrc/c64/tgi/c64-hi.s | 1 - libsrc/geos-cbm/tgi/geos-tgi.s | 1 - libsrc/lynx/libref.s | 3 +-- libsrc/lynx/tgi/lynx-160-102-16.s | 30 +++++++++++++++------- libsrc/lynx/tgi_irq.s | 11 ++++++++ libsrc/nes/tgi/nes-64-56-2.s | 1 - libsrc/telestrat/tgi/telestrat-228-200-3.s | 1 - libsrc/telestrat/tgi/telestrat-240-200-2.s | 1 - libsrc/tgi/tgi-kernel.s | 18 +++---------- 17 files changed, 37 insertions(+), 40 deletions(-) create mode 100644 libsrc/lynx/tgi_irq.s diff --git a/asminc/tgi-kernel.inc b/asminc/tgi-kernel.inc index e9f2f6aa9..fba78afff 100644 --- a/asminc/tgi-kernel.inc +++ b/asminc/tgi-kernel.inc @@ -70,14 +70,13 @@ BAR .addr ; BAR routine TEXTSTYLE .addr ; TEXTSTYLE routine OUTTEXT .addr ; OUTTEXT routine - IRQ .addr ; IRQ routine .endstruct .endstruct ;------------------------------------------------------------------------------ ; The TGI API version, stored at TGI_HDR_VERSION -TGI_API_VERSION = $05 +TGI_API_VERSION = $06 ;------------------------------------------------------------------------------ ; Bitmapped tgi driver flags, stored in TGI_HDR::VARS::FLAGS. diff --git a/libsrc/apple2/tgi/a2.hi.s b/libsrc/apple2/tgi/a2.hi.s index 18f5724b5..e06b4a617 100644 --- a/libsrc/apple2/tgi/a2.hi.s +++ b/libsrc/apple2/tgi/a2.hi.s @@ -115,7 +115,6 @@ pages: .byte 2 ; Number of screens available .addr BAR .addr TEXTSTYLE .addr OUTTEXT - .addr 0 ; IRQ entry is unused ; ------------------------------------------------------------------------ diff --git a/libsrc/apple2/tgi/a2.lo.s b/libsrc/apple2/tgi/a2.lo.s index 045b0044f..7238463a9 100644 --- a/libsrc/apple2/tgi/a2.lo.s +++ b/libsrc/apple2/tgi/a2.lo.s @@ -85,7 +85,6 @@ Y2 := ptr4 .addr BAR .addr TEXTSTYLE .addr OUTTEXT - .addr 0 ; IRQ entry is unused ; ------------------------------------------------------------------------ diff --git a/libsrc/atari/tgi/atari_tgi_common.inc b/libsrc/atari/tgi/atari_tgi_common.inc index f4ef68165..cd486d91b 100644 --- a/libsrc/atari/tgi/atari_tgi_common.inc +++ b/libsrc/atari/tgi/atari_tgi_common.inc @@ -68,7 +68,6 @@ libref: .addr $0000 ; Library reference .addr BAR .addr TEXTSTYLE .addr OUTTEXT - .addr 0 ; IRQ entry is unused ; ****************************************************************************** diff --git a/libsrc/atmos/tgi/atmos-228-200-3.s b/libsrc/atmos/tgi/atmos-228-200-3.s index ae9b0f775..98d2cef96 100644 --- a/libsrc/atmos/tgi/atmos-228-200-3.s +++ b/libsrc/atmos/tgi/atmos-228-200-3.s @@ -59,7 +59,6 @@ YSIZE = 8 ; System font height .addr BAR .addr TEXTSTYLE .addr OUTTEXT - .addr 0 ; IRQ entry is unused ; ------------------------------------------------------------------------ ; Data. diff --git a/libsrc/atmos/tgi/atmos-240-200-2.s b/libsrc/atmos/tgi/atmos-240-200-2.s index 943ec5389..2643e08fd 100644 --- a/libsrc/atmos/tgi/atmos-240-200-2.s +++ b/libsrc/atmos/tgi/atmos-240-200-2.s @@ -59,7 +59,6 @@ YSIZE = 8 ; System font height .addr BAR .addr TEXTSTYLE .addr OUTTEXT - .addr 0 ; IRQ entry is unused ; ------------------------------------------------------------------------ ; Data. diff --git a/libsrc/c128/tgi/c128-vdc.s b/libsrc/c128/tgi/c128-vdc.s index 5100f7f7d..f48b530f6 100644 --- a/libsrc/c128/tgi/c128-vdc.s +++ b/libsrc/c128/tgi/c128-vdc.s @@ -88,7 +88,6 @@ pages: .byte 1 ; Number of screens available .addr BAR .addr TEXTSTYLE .addr OUTTEXT - .addr 0 ; IRQ entry is unused ; ------------------------------------------------------------------------ ; Data. diff --git a/libsrc/c128/tgi/c128-vdc2.s b/libsrc/c128/tgi/c128-vdc2.s index a7238e877..4b7b17c57 100644 --- a/libsrc/c128/tgi/c128-vdc2.s +++ b/libsrc/c128/tgi/c128-vdc2.s @@ -89,7 +89,6 @@ pages: .byte 0 ; Number of screens available .addr BAR .addr TEXTSTYLE .addr OUTTEXT - .addr 0 ; IRQ entry is unused ; ------------------------------------------------------------------------ ; Data. diff --git a/libsrc/c64/tgi/c64-hi.s b/libsrc/c64/tgi/c64-hi.s index 580220ecc..8368c6ba2 100644 --- a/libsrc/c64/tgi/c64-hi.s +++ b/libsrc/c64/tgi/c64-hi.s @@ -57,7 +57,6 @@ .addr BAR .addr TEXTSTYLE .addr OUTTEXT - .addr 0 ; IRQ entry is unused ; ------------------------------------------------------------------------ ; Data. diff --git a/libsrc/geos-cbm/tgi/geos-tgi.s b/libsrc/geos-cbm/tgi/geos-tgi.s index 5a1af65e4..08927e6c1 100644 --- a/libsrc/geos-cbm/tgi/geos-tgi.s +++ b/libsrc/geos-cbm/tgi/geos-tgi.s @@ -74,7 +74,6 @@ aspect: .word $00D4 ; Aspect ratio (based on 4/3 display) .addr BAR .addr TEXTSTYLE .addr OUTTEXT - .addr 0 ; IRQ entry is unused ; ------------------------------------------------------------------------ ; Data. diff --git a/libsrc/lynx/libref.s b/libsrc/lynx/libref.s index 62c78b8c5..0bda1e7e8 100644 --- a/libsrc/lynx/libref.s +++ b/libsrc/lynx/libref.s @@ -2,9 +2,8 @@ ; Oliver Schmidt, 2013-05-31 ; - .export joy_libref, ser_libref, tgi_libref + .export joy_libref, ser_libref .import _exit joy_libref := _exit ser_libref := _exit -tgi_libref := _exit diff --git a/libsrc/lynx/tgi/lynx-160-102-16.s b/libsrc/lynx/tgi/lynx-160-102-16.s index e6659631b..04bdaae04 100644 --- a/libsrc/lynx/tgi/lynx-160-102-16.s +++ b/libsrc/lynx/tgi/lynx-160-102-16.s @@ -29,7 +29,7 @@ .byte $74, $67, $69 ; "tgi" .byte TGI_API_VERSION ; TGI API version number - .addr $0000 ; Library reference +libref: .addr $0000 ; Library reference .word 160 ; X resolution .word 102 ; Y resolution .byte 16 ; Number of drawing colors @@ -64,7 +64,6 @@ .addr BAR .addr TEXTSTYLE .addr OUTTEXT - .addr IRQ ; ------------------------------------------------------------------------ @@ -164,6 +163,18 @@ INSTALL: stz BGINDEX stz DRAWPAGE stz SWAPREQUEST + lda libref + ldx libref+1 + sta ptr1 + stx ptr1+1 + ldy #1 + lda #irq + sta (ptr1),y + lda #$4C ; Jump opcode + sta (ptr1) ; Activate IRQ routine rts @@ -175,6 +186,12 @@ INSTALL: ; UNINSTALL: + lda libref + ldx libref+1 + sta ptr1 + stx ptr1+1 + lda #$60 ; RTS opcode + sta (ptr1) ; Disable IRQ routine rts @@ -466,14 +483,10 @@ SETDRAWPAGE: stx DRAWPAGEH rts -; ------------------------------------------------------------------------ -; IRQ: VBL interrupt handler -; - -IRQ: +irq: lda INTSET ; Poll all pending interrupts and #VBL_INTERRUPT - beq IRQEND ; Exit if not a VBL interrupt + beq @L0 ; Exit if not a VBL interrupt lda SWAPREQUEST beq @L0 @@ -485,7 +498,6 @@ IRQ: jsr SETDRAWPAGE stz SWAPREQUEST @L0: -IRQEND: clc rts diff --git a/libsrc/lynx/tgi_irq.s b/libsrc/lynx/tgi_irq.s new file mode 100644 index 000000000..3968dc0b5 --- /dev/null +++ b/libsrc/lynx/tgi_irq.s @@ -0,0 +1,11 @@ +; +; Oliver Schmidt, 2018-02-02 +; + + .export tgi_libref + .interruptor tgi_irq ; Export as IRQ handler + + .data + +tgi_libref: +tgi_irq: .byte $60, $00, $00 ; RTS plus two dummy bytes diff --git a/libsrc/nes/tgi/nes-64-56-2.s b/libsrc/nes/tgi/nes-64-56-2.s index 70e23e119..e4dcb56ce 100644 --- a/libsrc/nes/tgi/nes-64-56-2.s +++ b/libsrc/nes/tgi/nes-64-56-2.s @@ -60,7 +60,6 @@ yres: .word 56 ; Max Y resolution .addr BAR .addr TEXTSTYLE .addr OUTTEXT - .addr 0 ; IRQ entry is unused ; ------------------------------------------------------------------------ ; Data. diff --git a/libsrc/telestrat/tgi/telestrat-228-200-3.s b/libsrc/telestrat/tgi/telestrat-228-200-3.s index 09c308e26..ce501f0bf 100644 --- a/libsrc/telestrat/tgi/telestrat-228-200-3.s +++ b/libsrc/telestrat/tgi/telestrat-228-200-3.s @@ -58,7 +58,6 @@ YSIZE = 8 ; System font height .addr CIRCLE .addr TEXTSTYLE .addr OUTTEXT - .addr 0 ; IRQ entry is unused ; ------------------------------------------------------------------------ ; Data. diff --git a/libsrc/telestrat/tgi/telestrat-240-200-2.s b/libsrc/telestrat/tgi/telestrat-240-200-2.s index 8a30ddd45..3ee918c4f 100644 --- a/libsrc/telestrat/tgi/telestrat-240-200-2.s +++ b/libsrc/telestrat/tgi/telestrat-240-200-2.s @@ -58,7 +58,6 @@ YSIZE = 8 ; System font height .addr BAR .addr TEXTSTYLE .addr OUTTEXT - .addr 0 ; IRQ entry is unused ; ------------------------------------------------------------------------ ; Data. diff --git a/libsrc/tgi/tgi-kernel.s b/libsrc/tgi/tgi-kernel.s index ed65760af..3a388b6dc 100644 --- a/libsrc/tgi/tgi-kernel.s +++ b/libsrc/tgi/tgi-kernel.s @@ -6,7 +6,6 @@ .import tgi_libref .importzp ptr1 - .interruptor tgi_irq ; Export as IRQ handler .include "tgi-kernel.inc" .include "tgi-error.inc" @@ -81,7 +80,6 @@ tgi_line: jmp $0000 tgi_bar: jmp $0000 tgi_textstyle: jmp $0000 tgi_outtext: jmp $0000 -tgi_irq: .byte $60, $00, $00 ; RTS plus two dummy bytes ; Driver header signature .rodata @@ -144,20 +142,13 @@ _tgi_install: dex bpl @L3 -; Install the IRQ vector if the driver needs it. - - lda tgi_irq+2 ; Check high byte of IRQ vector - beq @L4 ; Jump if vector invalid - lda #$4C ; Jump opcode - sta tgi_irq ; Activate IRQ routine - ; Initialize some other variables lda #$00 -@L4: ldx #csize-1 -@L5: sta cstart,x ; Clear error/mode/curx/cury/... + ldx #csize-1 +@L4: sta cstart,x ; Clear error/mode/curx/cury/... dex - bpl @L5 + bpl @L4 rts @@ -206,9 +197,6 @@ _tgi_uninstall: jsr tgi_uninstall ; Allow the driver to clean up - lda #$60 ; RTS opcode - sta tgi_irq ; Disable IRQ entry point - ; Clear driver pointer and error code tgi_clear_ptr: From ae4e9fab8c1156a15b6db2250ad23356f1909611 Mon Sep 17 00:00:00 2001 From: Christian Groessler Date: Fri, 2 Feb 2018 18:28:52 +0100 Subject: [PATCH 13/20] Atari: CONSOL port of GTIA is readable and writable. Adjust include/_gtia.h accordingly. --- include/_gtia.h | 108 ++++++++++++++++++++++++------------------------ 1 file changed, 55 insertions(+), 53 deletions(-) diff --git a/include/_gtia.h b/include/_gtia.h index 424628f19..0542efa2f 100644 --- a/include/_gtia.h +++ b/include/_gtia.h @@ -34,63 +34,65 @@ /* Define a structure with the gtia register offsets */ struct __gtia_write { - unsigned char hposp0; /* horizontal position player 0 */ - unsigned char hposp1; /* horizontal position player 1 */ - unsigned char hposp2; /* horizontal position player 2 */ - unsigned char hposp3; /* horizontal position player 3 */ - unsigned char hposm0; /* horizontal position missile 0 */ - unsigned char hposm1; /* horizontal position missile 1 */ - unsigned char hposm2; /* horizontal position missile 2 */ - unsigned char hposm3; /* horizontal position missile 3 */ - unsigned char sizep0; /* size of player 0 */ - unsigned char sizep1; /* size of player 1 */ - unsigned char sizep2; /* size of player 2 */ - unsigned char sizep3; /* size of player 3 */ - unsigned char sizem; /* size of missiles */ - unsigned char grafp0; /* graphics shape player 0 */ - unsigned char grafp1; /* graphics shape player 1 */ - unsigned char grafp2; /* graphics shape player 2 */ - unsigned char grafp3; /* graphics shape player 3 */ - unsigned char grafm; /* graphics shape missiles */ - unsigned char colpm0; /* color player and missile 0 */ - unsigned char colpm1; /* color player and missile 1 */ - unsigned char colpm2; /* color player and missile 2 */ - unsigned char colpm3; /* color player and missile 3 */ - unsigned char colpf0; /* color playfield 0 */ - unsigned char colpf1; /* color playfield 1 */ - unsigned char colpf2; /* color playfield 2 */ - unsigned char colpf3; /* color playfield 3 */ - unsigned char colbk; /* color background */ - unsigned char prior; /* priority selection */ - unsigned char vdelay; /* vertical delay */ - unsigned char gractl; /* stick/paddle latch, p/m control */ - unsigned char hitclr; /* clear p/m collision */ - unsigned char consol; /* console buttons */ + unsigned char hposp0; /* 0x00: horizontal position player 0 */ + unsigned char hposp1; /* 0x01: horizontal position player 1 */ + unsigned char hposp2; /* 0x02: horizontal position player 2 */ + unsigned char hposp3; /* 0x03: horizontal position player 3 */ + unsigned char hposm0; /* 0x04: horizontal position missile 0 */ + unsigned char hposm1; /* 0x05: horizontal position missile 1 */ + unsigned char hposm2; /* 0x06: horizontal position missile 2 */ + unsigned char hposm3; /* 0x07: horizontal position missile 3 */ + unsigned char sizep0; /* 0x08: size of player 0 */ + unsigned char sizep1; /* 0x09: size of player 1 */ + unsigned char sizep2; /* 0x0A: size of player 2 */ + unsigned char sizep3; /* 0x0B: size of player 3 */ + unsigned char sizem; /* 0x0C: size of missiles */ + unsigned char grafp0; /* 0x0D: graphics shape player 0 */ + unsigned char grafp1; /* 0x0E: graphics shape player 1 */ + unsigned char grafp2; /* 0x0F: graphics shape player 2 */ + unsigned char grafp3; /* 0x10: graphics shape player 3 */ + unsigned char grafm; /* 0x11: graphics shape missiles */ + unsigned char colpm0; /* 0x12: color player and missile 0 */ + unsigned char colpm1; /* 0x13: color player and missile 1 */ + unsigned char colpm2; /* 0x14: color player and missile 2 */ + unsigned char colpm3; /* 0x15: color player and missile 3 */ + unsigned char colpf0; /* 0x16: color playfield 0 */ + unsigned char colpf1; /* 0x17: color playfield 1 */ + unsigned char colpf2; /* 0x18: color playfield 2 */ + unsigned char colpf3; /* 0x19: color playfield 3 */ + unsigned char colbk; /* 0x1A: color background */ + unsigned char prior; /* 0x1B: priority selection */ + unsigned char vdelay; /* 0x1C: vertical delay */ + unsigned char gractl; /* 0x1D: stick/paddle latch, p/m control */ + unsigned char hitclr; /* 0x1E: clear p/m collision */ + unsigned char consol; /* 0x1F: builtin speaker */ }; /* Define a structure with the gtia register offsets */ struct __gtia_read { - unsigned char m0pf; /* missile 0 to playfield collision */ - unsigned char m1pf; /* missile 1 to playfield collision */ - unsigned char m2pf; /* missile 2 to playfield collision */ - unsigned char m3pf; /* missile 3 to playfield collision */ - unsigned char p0pf; /* player 0 to playfield collision */ - unsigned char p1pf; /* player 1 to playfield collision */ - unsigned char p2pf; /* player 2 to playfield collision */ - unsigned char p3pf; /* player 3 to playfield collision */ - unsigned char m0pl; /* missile 0 to player collision */ - unsigned char m1pl; /* missile 1 to player collision */ - unsigned char m2pl; /* missile 2 to player collision */ - unsigned char m3pl; /* missile 3 to player collision */ - unsigned char p0pl; /* player 0 to player collision */ - unsigned char p1pl; /* player 1 to player collision */ - unsigned char p2pl; /* player 2 to player collision */ - unsigned char p3pl; /* player 3 to player collision */ - unsigned char trig0; /* joystick trigger 0 */ - unsigned char trig1; /* joystick trigger 1 */ - unsigned char trig2; /* joystick trigger 2 */ - unsigned char trig3; /* joystick trigger 3 */ - unsigned char pal; /* pal/ntsc flag */ + unsigned char m0pf; /* 0x00: missile 0 to playfield collision */ + unsigned char m1pf; /* 0x01: missile 1 to playfield collision */ + unsigned char m2pf; /* 0x02: missile 2 to playfield collision */ + unsigned char m3pf; /* 0x03: missile 3 to playfield collision */ + unsigned char p0pf; /* 0x04: player 0 to playfield collision */ + unsigned char p1pf; /* 0x05: player 1 to playfield collision */ + unsigned char p2pf; /* 0x06: player 2 to playfield collision */ + unsigned char p3pf; /* 0x07: player 3 to playfield collision */ + unsigned char m0pl; /* 0x08: missile 0 to player collision */ + unsigned char m1pl; /* 0x09: missile 1 to player collision */ + unsigned char m2pl; /* 0x0A: missile 2 to player collision */ + unsigned char m3pl; /* 0x0B: missile 3 to player collision */ + unsigned char p0pl; /* 0x0C: player 0 to player collision */ + unsigned char p1pl; /* 0x0D: player 1 to player collision */ + unsigned char p2pl; /* 0x0E: player 2 to player collision */ + unsigned char p3pl; /* 0x0F: player 3 to player collision */ + unsigned char trig0; /* 0x10: joystick trigger 0 */ + unsigned char trig1; /* 0x11: joystick trigger 1 */ + unsigned char trig2; /* 0x12: joystick trigger 2 */ + unsigned char trig3; /* 0x13: joystick trigger 3 */ + unsigned char pal; /* 0x14: pal/ntsc flag */ + unsigned char unused[10]; + unsigned char consol; /* 0x1F: console buttons */ }; /* End of _gtia.h */ From e9cbd42b18510e0de5c7f6c563a6eed643db33ff Mon Sep 17 00:00:00 2001 From: Greg King Date: Tue, 6 Feb 2018 08:52:36 -0500 Subject: [PATCH 14/20] Normalized the definitions of structs in . The change matches the way that I/O register structures are defined in other headers. The names are defined as "struct", instead of as "pointer to struct". --- include/supervision.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/supervision.h b/include/supervision.h index f3ae1c25e..cce037910 100644 --- a/include/supervision.h +++ b/include/supervision.h @@ -54,28 +54,28 @@ struct __sv_lcd { unsigned char xpos; unsigned char ypos; }; -#define SV_LCD ((struct __sv_lcd*)0x2000) +#define SV_LCD (*(struct __sv_lcd*)0x2000) struct __sv_tone { unsigned delay; unsigned char control; unsigned char timer; }; -#define SV_RIGHT ((struct __sv_tone*)0x2010) -#define SV_LEFT ((struct __sv_tone*)0x2014) +#define SV_RIGHT (*(struct __sv_tone*)0x2010) +#define SV_LEFT (*(struct __sv_tone*)0x2014) struct __sv_noise { unsigned char volume; /* and frequency */ unsigned char timer; unsigned char control; }; -#define SV_NOISE ((struct __sv_noise*)0x2028) +#define SV_NOISE (*(struct __sv_noise*)0x2028) struct __io_port { unsigned char in; unsigned char out; }; -#define IO_PORT ((struct __io_port*)(0x2021) +#define IO_PORT (*(struct __io_port*)0x2021) struct __sv_dma { unsigned start; @@ -83,7 +83,7 @@ struct __sv_dma { unsigned char control; unsigned char on; }; -#define SV_DMA ((struct __sv_dma*)0x2018) +#define SV_DMA (*(struct __sv_dma*)0x2018) #define SV_CONTROL (*(unsigned char*)0x2020) From b65981fc3a0d4a7903c9b2800b03959c9f368b89 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Sat, 10 Feb 2018 11:29:50 +0100 Subject: [PATCH 15/20] Reduced default stack size to a reasonable value. The unexpanded Creativision has only $206 bytes of RAM available to cc65 programs. So it's a bad idea(tm) to reserve $180 bytes for the software stack. $40 bytes seems a much better default (aka guess). --- cfg/creativision.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cfg/creativision.cfg b/cfg/creativision.cfg index 289984df0..2eb9ac427 100644 --- a/cfg/creativision.cfg +++ b/cfg/creativision.cfg @@ -1,5 +1,5 @@ SYMBOLS { - __STACKSIZE__: type = weak, value = $0180; + __STACKSIZE__: type = weak, value = $0040; } MEMORY { ZP: file = "", define = yes, start = $0020, size = $00E0; From 6f6fd33caef12e2ecd14d5e15fb200f6cda47529 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Sat, 10 Feb 2018 11:45:50 +0100 Subject: [PATCH 16/20] Added size_t. --- include/device.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/device.h b/include/device.h index 68b1c807a..b0a5f5e76 100644 --- a/include/device.h +++ b/include/device.h @@ -35,6 +35,13 @@ +#ifndef _HAVE_size_t +typedef unsigned size_t; +#define _HAVE_size_t +#endif + + + /*****************************************************************************/ /* Data */ /*****************************************************************************/ From 33f05d1162d987b653ce03f0edf427c779ef1a53 Mon Sep 17 00:00:00 2001 From: Greg King Date: Sat, 10 Feb 2018 16:14:53 -0500 Subject: [PATCH 17/20] Added a definition for the CBM610's first CIA chip. --- include/cbm610.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/cbm610.h b/include/cbm610.h index b0486044b..de7aa50f8 100644 --- a/include/cbm610.h +++ b/include/cbm610.h @@ -85,7 +85,8 @@ #define SID (*(struct __sid*)0xDA00) #include <_6526.h> -#define CIA (*(struct __6526*)0xDC00) +#define CIA1 (*(struct __6526*)0xDB00) +#define CIA2 (*(struct __6526*)0xDC00) #include <_6551.h> #define ACIA (*(struct __6551*)0xDD00) From d93f84f4bc079e9ea20542a492101bf4dc3730ec Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel Date: Tue, 13 Feb 2018 19:19:40 -0800 Subject: [PATCH 18/20] Improved GeOS version detection. --- include/geos/gsys.h | 2 + libsrc/geos-cbm/geossym2.inc | 2 + libsrc/geos-cbm/system/get_ostype.s | 18 ++++++++- samples/geos/geosver.c | 58 +++++++++++++++++++++++++++++ samples/geos/geosverres.grc | 8 ++++ 5 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 samples/geos/geosver.c create mode 100644 samples/geos/geosverres.grc diff --git a/include/geos/gsys.h b/include/geos/gsys.h index 284c38b63..b60c9884b 100644 --- a/include/geos/gsys.h +++ b/include/geos/gsys.h @@ -31,6 +31,8 @@ char get_ostype(void); #define GEOS4 0x04 /* plus4 geos is not or'ed with version */ #define GEOS128 0x80 /* version flags */ +#define MEGAPATCH3 0x03 +#define GATEWAY 0x08 #define GEOS_V10 0x10 #define GEOS_V11 0x11 #define GEOS_V12 0x12 /* ??? not sure */ diff --git a/libsrc/geos-cbm/geossym2.inc b/libsrc/geos-cbm/geossym2.inc index cdcbc24dc..c756280a9 100644 --- a/libsrc/geos-cbm/geossym2.inc +++ b/libsrc/geos-cbm/geossym2.inc @@ -4,8 +4,10 @@ ;4-2-99 bootName = $c006 +gatewayFlag = $c007 version = $c00f nationality = $c010 sysFlgCopy = $c012 c128Flag = $c013 +mp3Flag = $c014 dateCopy = $c018 \ No newline at end of file diff --git a/libsrc/geos-cbm/system/get_ostype.s b/libsrc/geos-cbm/system/get_ostype.s index 492ce132d..827630f0b 100644 --- a/libsrc/geos-cbm/system/get_ostype.s +++ b/libsrc/geos-cbm/system/get_ostype.s @@ -3,8 +3,8 @@ ; ; 10.09.2001 ; -; Plus4 and GEOS 1.1 detection by -; Marco van den Heuvel, 2010-02-02 +; Plus4, Gateway, MP3 and GEOS 1.1 detection by +; Marco van den Heuvel, 2018-02-07 ; ; unsigned char get_ostype (void); @@ -26,6 +26,12 @@ _get_ostype: and #%11110000 cmp #$10 beq geos10 + lda gatewayFlag + cmp #$41 + beq gateway + lda mp3Flag + cmp #$4d + beq megapatch3 lda c128Flag ; we're on at least 2.0 cmp #$18 beq geos_on_plus4 @@ -40,6 +46,14 @@ geos11: geos_on_plus4: lda #$04 rts +gateway: + lda #$08 + ora c128Flag + rts +megapatch3: + lda #$03 + ora c128Flag + rts _get_tv: jsr _get_ostype diff --git a/samples/geos/geosver.c b/samples/geos/geosver.c new file mode 100644 index 000000000..673b7e1f7 --- /dev/null +++ b/samples/geos/geosver.c @@ -0,0 +1,58 @@ +#include +#include + +// Let's define the window we're operating +struct window wholeScreen = {0, SC_PIX_HEIGHT-1, 0, SC_PIX_WIDTH-1}; + + +void main (void) +{ + unsigned char os = get_ostype(); + unsigned char *machine = NULL; + unsigned char *version = NULL; + unsigned char good = 1; + + SetPattern(0); + InitDrawWindow(&wholeScreen); + Rectangle(); + gotoxy(0, 4); + if (os == GEOS4) { + machine = "plus4"; + version = "GeOS v3.5"; + } else { + if ((os & GEOS128) == GEOS128) { + machine = "c128"; + } else { + machine = "c64"; + } + os &= 0x7f; + if (os == GEOS_V10) { + version = "GeOS v1.0"; + } else if (os == GEOS_V11) { + version = "GeOS v1.1"; + } else if (os == GEOS_V12) { + version = "GeOS v1.2"; + } else if (os == GEOS_V20) { + version = "GeOS v2.0"; + } else if (os == MEGAPATCH3) { + version = "MegaPatch 3"; + } else if (os == GATEWAY) { + version = "GateWay"; + } else if ((os & WHEELS) == WHEELS) { + version = "Wheels"; + } else { + version = "Unknown GeOS version"; + good = 0; + } + } + + if (good) { + cprintf("%s (%s)", version, machine); + } else { + cprintf("%s (%s) (%d)", version, machine, os); + } + + Sleep(10*50); + + return; +} diff --git a/samples/geos/geosverres.grc b/samples/geos/geosverres.grc new file mode 100644 index 000000000..cac9ed698 --- /dev/null +++ b/samples/geos/geosverres.grc @@ -0,0 +1,8 @@ + +; this is the resource file for geosver.c, a GEOS application example + +HEADER APPLICATION "geosver" "GeOSver" "V1.0" { +dostype USR +author "Marco van den Heuvel" +info "This is a C prog compiled with cc65 and GEOSLib." +} From e17b9177dea44ed453a1ad77e0c9a2ea9569938d Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel Date: Wed, 14 Feb 2018 10:22:10 -0800 Subject: [PATCH 19/20] Fixed GeOS -> GEOS and added newline to geossym2.inc. --- libsrc/geos-cbm/geossym2.inc | 3 ++- samples/geos/geosver.c | 12 ++++++------ samples/geos/geosverres.grc | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/libsrc/geos-cbm/geossym2.inc b/libsrc/geos-cbm/geossym2.inc index c756280a9..02a2fd44b 100644 --- a/libsrc/geos-cbm/geossym2.inc +++ b/libsrc/geos-cbm/geossym2.inc @@ -10,4 +10,5 @@ nationality = $c010 sysFlgCopy = $c012 c128Flag = $c013 mp3Flag = $c014 -dateCopy = $c018 \ No newline at end of file +dateCopy = $c018 + diff --git a/samples/geos/geosver.c b/samples/geos/geosver.c index 673b7e1f7..77a15ada7 100644 --- a/samples/geos/geosver.c +++ b/samples/geos/geosver.c @@ -18,7 +18,7 @@ void main (void) gotoxy(0, 4); if (os == GEOS4) { machine = "plus4"; - version = "GeOS v3.5"; + version = "GEOS v3.5"; } else { if ((os & GEOS128) == GEOS128) { machine = "c128"; @@ -27,13 +27,13 @@ void main (void) } os &= 0x7f; if (os == GEOS_V10) { - version = "GeOS v1.0"; + version = "GEOS v1.0"; } else if (os == GEOS_V11) { - version = "GeOS v1.1"; + version = "GEOS v1.1"; } else if (os == GEOS_V12) { - version = "GeOS v1.2"; + version = "GEOS v1.2"; } else if (os == GEOS_V20) { - version = "GeOS v2.0"; + version = "GEOS v2.0"; } else if (os == MEGAPATCH3) { version = "MegaPatch 3"; } else if (os == GATEWAY) { @@ -41,7 +41,7 @@ void main (void) } else if ((os & WHEELS) == WHEELS) { version = "Wheels"; } else { - version = "Unknown GeOS version"; + version = "Unknown GEOS version"; good = 0; } } diff --git a/samples/geos/geosverres.grc b/samples/geos/geosverres.grc index cac9ed698..9a3d72a26 100644 --- a/samples/geos/geosverres.grc +++ b/samples/geos/geosverres.grc @@ -1,7 +1,7 @@ ; this is the resource file for geosver.c, a GEOS application example -HEADER APPLICATION "geosver" "GeOSver" "V1.0" { +HEADER APPLICATION "geosver" "GEOSver" "V1.0" { dostype USR author "Marco van den Heuvel" info "This is a C prog compiled with cc65 and GEOSLib." From b0ef67d14cf90c1ec12dea7f79f97884ea708981 Mon Sep 17 00:00:00 2001 From: Marco van den Heuvel Date: Thu, 15 Feb 2018 15:24:58 -0800 Subject: [PATCH 20/20] Added GEOS 1.3 and 1.5 detection. --- include/geos/gsys.h | 4 +++- libsrc/geos-cbm/system/get_ostype.s | 10 ++++++++++ samples/geos/geosver.c | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/include/geos/gsys.h b/include/geos/gsys.h index b60c9884b..1753492e5 100644 --- a/include/geos/gsys.h +++ b/include/geos/gsys.h @@ -35,7 +35,9 @@ char get_ostype(void); #define GATEWAY 0x08 #define GEOS_V10 0x10 #define GEOS_V11 0x11 -#define GEOS_V12 0x12 /* ??? not sure */ +#define GEOS_V12 0x12 +#define GEOS_V13 0x13 +#define GEOS_V15 0x15 #define GEOS_V20 0x20 #define WHEELS 0x40 /* only Wheels? */ diff --git a/libsrc/geos-cbm/system/get_ostype.s b/libsrc/geos-cbm/system/get_ostype.s index 827630f0b..6e6731952 100644 --- a/libsrc/geos-cbm/system/get_ostype.s +++ b/libsrc/geos-cbm/system/get_ostype.s @@ -26,6 +26,8 @@ _get_ostype: and #%11110000 cmp #$10 beq geos10 + cmp #$13 ; either 1.3 or 1.5 + beq geos13check lda gatewayFlag cmp #$41 beq gateway @@ -37,6 +39,7 @@ _get_ostype: beq geos_on_plus4 ora version rts +geos13: geos10: lda version rts @@ -54,6 +57,13 @@ megapatch3: lda #$03 ora c128Flag rts +geos13check: + lda mp3Flag + cmp #$03 + bne geos13 +geos15: + lda #$15 + rts _get_tv: jsr _get_ostype diff --git a/samples/geos/geosver.c b/samples/geos/geosver.c index 77a15ada7..1402d148e 100644 --- a/samples/geos/geosver.c +++ b/samples/geos/geosver.c @@ -32,6 +32,10 @@ void main (void) version = "GEOS v1.1"; } else if (os == GEOS_V12) { version = "GEOS v1.2"; + } else if (os == GEOS_V13) { + version = "GEOS v1.3"; + } else if (os == GEOS_V15) { + version = "GEOS v1.5"; } else if (os == GEOS_V20) { version = "GEOS v2.0"; } else if (os == MEGAPATCH3) {