]> git.sur5r.net Git - cc65/commitdiff
Create static drivers directly from source files.
authorOliver Schmidt <ol.sc@web.de>
Wed, 4 Jun 2014 21:50:18 +0000 (23:50 +0200)
committerOliver Schmidt <ol.sc@web.de>
Wed, 4 Jun 2014 21:50:18 +0000 (23:50 +0200)
Up to now static drivers were created via co65 from dynamic drivers. However there was an issue with that approach:

The dynamic drivers are "o65 simple files" which obligates that they start with the 'code' segment. However dynamic drivers need to start with the module header - which is written to. For dynamic drivers this isn't more than a conceptual issue because they are always contain a 'data' segment and may therefore only be loaded into writable memory.

However when dynamic drivers are converted to static drivers using co65 then that issue becomes a real problem as then the 'code' segment may end up in non-writable memory - and thus writing to the module header fails.

Instead of changing the way dynamic drivers work I opted to rather make static driver creation totally independent from dynamic drivers. This allows to place the module header in the 'data' segment (see 'module.mac').

79 files changed:
asminc/module.mac [new file with mode: 0644]
doc/ca65.sgml
libsrc/Makefile
libsrc/apple2/emd/a2.auxmem.s
libsrc/apple2/joy/a2.stdjoy.s
libsrc/apple2/mou/a2.stdmou.s
libsrc/apple2/ser/a2.ssc.s
libsrc/apple2/tgi/a2.hi.s
libsrc/apple2/tgi/a2.lo.s
libsrc/atari/emd/atr130.s
libsrc/atari/joy/atrmj8.s
libsrc/atari/joy/atrstd.s
libsrc/atari/mou/atrjoy.s
libsrc/atari/mou/atrst.s
libsrc/atari/mou/atrtt.s
libsrc/atari/ser/atrrdev.s
libsrc/atari/tgi/atari_tgi_common.inc
libsrc/atari5200/joy/atr5200std.s
libsrc/atmos/joy/atmos-pase.s
libsrc/atmos/ser/atmos-acia.s
libsrc/atmos/tgi/atmos-228-200-3.s
libsrc/atmos/tgi/atmos-240-200-2.s
libsrc/c128/emd/c128-georam.s
libsrc/c128/emd/c128-ram.s
libsrc/c128/emd/c128-ram2.s
libsrc/c128/emd/c128-ramcart.s
libsrc/c128/emd/c128-reu.s
libsrc/c128/emd/c128-vdc.s
libsrc/c128/joy/c128-ptvjoy.s
libsrc/c128/joy/c128-stdjoy.s
libsrc/c128/mou/c128-1351.s
libsrc/c128/mou/c128-inkwell.s
libsrc/c128/mou/c128-joy.s
libsrc/c128/mou/c128-pot.s
libsrc/c128/ser/c128-swlink.s
libsrc/c128/tgi/c128-vdc.s
libsrc/c128/tgi/c128-vdc2.s
libsrc/c16/emd/c16-ram.s
libsrc/c16/joy/c16-stdjoy.s
libsrc/c64/emd/c64-c256k.s
libsrc/c64/emd/c64-dqbb.s
libsrc/c64/emd/c64-georam.s
libsrc/c64/emd/c64-isepic.s
libsrc/c64/emd/c64-ram.s
libsrc/c64/emd/c64-ramcart.s
libsrc/c64/emd/c64-reu.s
libsrc/c64/emd/c64-vdc.s
libsrc/c64/emd/dtv-himem.s
libsrc/c64/joy/c64-hitjoy.s
libsrc/c64/joy/c64-numpad.s
libsrc/c64/joy/c64-ptvjoy.s
libsrc/c64/joy/c64-stdjoy.s
libsrc/c64/mou/c64-1351.s
libsrc/c64/mou/c64-inkwell.s
libsrc/c64/mou/c64-joy.s
libsrc/c64/mou/c64-pot.s
libsrc/c64/ser/c64-swlink.s
libsrc/c64/tgi/c64-hi.s
libsrc/cbm510/emd/cbm510-ram.s
libsrc/cbm510/joy/cbm510-std.s
libsrc/cbm510/mou/cbm510-inkwl.s
libsrc/cbm510/mou/cbm510-joy.s
libsrc/cbm510/ser/cbm510-std.s
libsrc/cbm610/emd/cbm610-ram.s
libsrc/cbm610/ser/cbm610-std.s
libsrc/geos-cbm/emd/geos-vdc.s
libsrc/geos-cbm/joy/geos-stdjoy.s
libsrc/geos-cbm/tgi/geos-tgi.s
libsrc/lynx/joy/lynx-stdjoy.s
libsrc/lynx/ser/lynx-comlynx.s
libsrc/lynx/tgi/lynx-160-102-16.s
libsrc/nes/joy/nes-stdjoy.s
libsrc/nes/tgi/nes-64-56-2.s
libsrc/pet/joy/pet-ptvjoy.s
libsrc/pet/joy/pet-stdjoy.s
libsrc/plus4/joy/plus4-stdjoy.s
libsrc/plus4/ser/plus4-stdser.s
libsrc/vic20/joy/vic20-ptvjoy.s
libsrc/vic20/joy/vic20-stdjoy.s

diff --git a/asminc/module.mac b/asminc/module.mac
new file mode 100644 (file)
index 0000000..d844ec1
--- /dev/null
@@ -0,0 +1,13 @@
+.ifndef DYN_DRV
+        DYN_DRV = 1
+.endif
+
+.macro  module_header   module_label
+        .if DYN_DRV
+                .segment        "HEADER"
+        .else
+                .data
+                .export         module_label
+                module_label:
+        .endif
+.endmacro
index b222b4aac5e5e692d6311c5d3bb871fdd4cf6019..32cf0b80b6eec3a9570ac0de0fa4b01fbc1bd916 100644 (file)
@@ -4321,16 +4321,14 @@ The package defines the following macros:
 
 <sect1><tt>.MACPACK atari</tt><p>
 
-The atari macro package will define a macro named <tt/scrcode/. It takes a
-string as argument and places this string into memory translated into screen
-codes.
+This macro package defines a macro named <tt/scrcode/. It takes a string
+as argument and places this string into memory translated into screen codes.
 
 
 <sect1><tt>.MACPACK cbm</tt><p>
 
-The cbm macro package will define a macro named <tt/scrcode/. It takes a
-string as argument and places this string into memory translated into screen
-codes.
+This macro package defines a macro named <tt/scrcode/. It takes a string
+as argument and places this string into memory translated into screen codes.
 
 
 <sect1><tt>.MACPACK cpu</tt><p>
@@ -4386,6 +4384,13 @@ it is possible to determine if the
 instruction is supported, which is the case for the 65SC02, 65C02 and 65816
 CPUs (the latter two are upwards compatible to the 65SC02).
 
+  
+<sect1><tt>.MACPACK module</tt><p>
+
+This macro package defines a macro named <tt/module_header/. It takes an
+identifier as argument and is used to define the header of a module both
+in the dynamic and static variant.
+
 
 
 <sect>Predefined constants<label id="predefined-constants"><p>
index 75e5c36817d5be5d36c9821dfb6b3d4b2637b0f1..6a801695a444f982bb478f03eefe151e3baeb948 100644 (file)
@@ -207,38 +207,39 @@ endif
 define DRVTYPE_template
 
 $1_SRCDIR = $$(SRCDIR)/$1
-$1_OBJDIR = ../libwrk/$$(TARGET)/$1
+$1_STCDIR = ../libwrk/$$(TARGET)
+$1_DYNDIR = ../libwrk/$$(TARGET)/$1
 $1_DRVDIR = ../$1
 
-$1_OBJPAT = $$($1_OBJDIR)/$$(OBJPFX)%.o
+$1_SRCPAT = $$($1_SRCDIR)/$$(OBJPFX)%.s
+$1_STCPAT = $$($1_STCDIR)/$$(OBJPFX)%-$1.o
+$1_DYNPAT = $$($1_DYNDIR)/$$(OBJPFX)%.o
 $1_DRVPAT = $$($1_DRVDIR)/$$(DRVPFX)%.$1
-$1_STCPAT = ../libwrk/$$(TARGET)/$$(DRVPFX)%-$1.o
 
-$1_OBJS := $$(patsubst $$($1_SRCDIR)/%.s,$$($1_OBJDIR)/%.o,$$(wildcard $$($1_SRCDIR)/*.s))
+$1_SRCS := $$(wildcard $$($1_SRCDIR)/*.s)
+$1_STCS = $$(patsubst $$($1_SRCPAT),$$($1_STCPAT),$$($1_SRCS))
+$1_DYNS = $$(patsubst $$($1_SRCPAT),$$($1_DYNPAT),$$($1_SRCS))
+$1_DRVS = $$(patsubst $$($1_DYNPAT),$$($1_DRVPAT),$$($1_DYNS))
 
-$1_DRVS = $$(patsubst $$($1_OBJPAT),$$($1_DRVPAT),$$($1_OBJS))
+$$($1_STCPAT): $$($1_SRCPAT)
+       @echo $$(TARGET) - $$< - static
+       @$$(CA65) -t $$(TARGET) -D DYN_DRV=0 $$(CA65FLAGS) --create-dep $$(@:.o=.d) -o $$@ $$<
 
-$1_STCS = $$(patsubst $$($1_DRVPAT),$$($1_STCPAT),$$($1_DRVS))
+OBJS += $$($1_STCS)
+DEPS += $$($1_STCS:.o=.d)
 
-$$($1_OBJS): | $$($1_OBJDIR)
+$$($1_DYNS): | $$($1_DYNDIR)
 
-$$($1_DRVPAT): $$($1_OBJPAT) $$(ZPOBJ) | $$($1_DRVDIR)
+$$($1_DRVPAT): $$($1_DYNPAT) $$(ZPOBJ) | $$($1_DRVDIR)
        @echo $$(TARGET) - $$(<F)
        @$$(LD65) -o $$@ -t module $$^
 
-$$($1_OBJDIR) $$($1_DRVDIR):
+$$($1_DYNDIR) $$($1_DRVDIR):
        @$$(call MKDIR,$$@)
 
 $(TARGET): $$($1_DRVS)
 
-$$($1_STCPAT): $$($1_DRVPAT)
-       @echo $$(TARGET) - $$(<F)
-       @$$(CO65) -o $$(@:.o=.s) --code-label _$$(subst -,_,$$(subst .,_,$$(<F))) $$<
-       @$$(CA65) -t $$(TARGET) -o $$@ $$(@:.o=.s)
-
-OBJS += $$($1_STCS)
-
-DEPS += $$($1_OBJS:.o=.d)
+DEPS += $$($1_DYNS:.o=.d)
 
 endef # DRVTYPE_template
 
@@ -247,7 +248,6 @@ $(foreach drvtype,$(DRVTYPES),$(eval $(call DRVTYPE_template,$(drvtype))))
 AR65 := $(if $(wildcard ../bin/ar65*),../bin/ar65,ar65)
 CA65 := $(if $(wildcard ../bin/ca65*),../bin/ca65,ca65)
 CC65 := $(if $(wildcard ../bin/cc65*),../bin/cc65,cc65)
-CO65 := $(if $(wildcard ../bin/co65*),../bin/co65,co65)
 LD65 := $(if $(wildcard ../bin/ld65*),../bin/ld65,ld65)
 
 export CC65_HOME := $(abspath ..)
index b48090638661721753d0b7c1f605d45c3ecaded6..5ef2564b1d7cd24921474ed933c1179e33568af3 100644 (file)
         .include        "em-kernel.inc"
         .include        "em-error.inc"
 
+        .macpack        module
+
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        .ifdef  __APPLE2ENH__
+        module_header   _a2e_auxmem_emd
+        .else
+        module_header   _a2_auxmem_emd
+        .endif
 
 ; Driver signature
 
index f8261627587b4523c3ef30cc21251f94c0a6c628..e4097e04319f2bc2651655b0483efe597af7a5f1 100644 (file)
@@ -13,6 +13,8 @@
         .include        "joy-error.inc"
         .include        "apple2.inc"
 
+        .macpack        module
+
 ; ------------------------------------------------------------------------
 
 ; Constants
@@ -29,7 +31,11 @@ PREAD   :=      $FB1E   ; Read paddle in X, return AD conv. value in Y
 
 ; Header. Includes jump table.
 
-        .segment        "HEADER"
+        .ifdef  __APPLE2ENH__
+        module_header   _a2e_stdjoy_joy
+        .else
+        module_header   _a2_stdjoy_joy
+        .endif
 
 ; Driver signature
 
index cb2f35fd52e2d695fb593a21cebaefafff2b18db..c3d10f0579facada02eb947c06ba55b29ad78ef0 100644 (file)
@@ -8,6 +8,8 @@
         .include        "mouse-kernel.inc"
         .include        "apple2.inc"
 
+        .macpack        module
+
 ; ------------------------------------------------------------------------
 
 SETMOUSE        = $12   ; Sets mouse mode
@@ -28,7 +30,11 @@ status          := $0778
 
 ; ------------------------------------------------------------------------
 
-        .segment        "HEADER"
+        .ifdef  __APPLE2ENH__
+        module_header   _a2e_stdmou_mou
+        .else
+        module_header   _a2_stdmou_mou
+        .endif
 
         ; Driver signature
         .byte   $6D, $6F, $75           ; "mou"
index 6cd8d65fea48910eedbbf6f79f8637e1164184b1..d5c5671653dae6b2febb916250992d0618a8ac03 100644 (file)
         .include        "ser-kernel.inc"
         .include        "ser-error.inc"
 
+        .macpack        module
+
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-        .segment        "HEADER"
+        .ifdef  __APPLE2ENH__
+        module_header   _a2e_ssc_ser
+        .else
+        module_header   _a2_ssc_ser
+        .endif
 
         ; Driver signature
         .byte   $73, $65, $72           ; "ser"
index 6454e1972628fd85e358376140ab8524dd914afc..18f5724b5bf5b9069ffaf2e9b1982e9a4e978cea 100644 (file)
@@ -11,6 +11,8 @@
         .include        "tgi-error.inc"
         .include        "apple2.inc"
 
+        .macpack        module
+
 ; ------------------------------------------------------------------------
 
 ; Zero page stuff
@@ -68,7 +70,11 @@ Y2      :=      ptr4
 
 ; ------------------------------------------------------------------------
 
-        .segment        "HEADER"
+        .ifdef  __APPLE2ENH__
+        module_header   _a2e_hi_tgi
+        .else
+        module_header   _a2_hi_tgi
+        .endif
 
 ; Header. Includes jump table and constants.
 
index d7d53d255461aa47b6f6736af2cbb585c9a36e20..045b0044fec01913fb258899f3cc1d4330ee5495 100644 (file)
@@ -11,6 +11,8 @@
         .include        "tgi-error.inc"
         .include        "apple2.inc"
 
+        .macpack        module
+
 ; ------------------------------------------------------------------------
 
 ; Zero page stuff
@@ -38,7 +40,11 @@ Y2      :=      ptr4
 
 ; ------------------------------------------------------------------------
 
-        .segment        "HEADER"
+        .ifdef  __APPLE2ENH__
+        module_header   _a2e_lo_tgi
+        .else
+        module_header   _a2_lo_tgi
+        .endif
 
 ; Header. Includes jump table and constants.
 
index 7082609bb55bb5505fba18b41cf94eef5b43bb53..f2d5777d5d8dcc82adf2e0e856df2be305f579bc 100644 (file)
 
 
         .macpack        generic
+        .macpack        module
 
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+.ifdef __ATARIXL__
+        module_header   _atrx130_emd
+.else
+        module_header   _atr130_emd
+.endif
 
 ; Driver signature
 
index 6aa3eda15da34bbd23805f1e21924e5f24c4ef05..46766070b4c9335c84a3112d2e2c3d1150a287cc 100644 (file)
         .include        "atari.inc"
 
         .macpack        generic
+        .macpack        module
 
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+.ifdef __ATARIXL__
+        module_header   _atrxmj8_joy
+.else
+        module_header   _atrmj8_joy
+.endif
 
 ; Driver signature
 
index f2331aa9aaa7bba385bd4f787753253827826fc6..fc7aa55f4cf04c49d885cf0c550fd6e02f6b1947 100644 (file)
         .include        "atari.inc"
 
         .macpack        generic
+        .macpack        module
 
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+.ifdef __ATARIXL__
+        module_header   _atrxstd_joy
+.else
+        module_header   _atrstd_joy
+.endif
 
 ; Driver signature
 
index 2f77ac8dbf9147ff09778ece85fdd1a72103721d..7f1085fb87bdbf140f8808f6269fa35ec95306f4 100644 (file)
         .include        "atari.inc"
 
         .macpack        generic
+        .macpack        module
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+.ifdef __ATARIXL__
+        module_header   _atrxjoy_mou
+.else
+        module_header   _atrjoy_mou
+.endif
 
 HEADER:
 
index 4f475f9b6a578436f3bded22faa888053d509e05..17d2affb5af77e4abf88bf25435a07b44a016a71 100644 (file)
@@ -23,6 +23,7 @@ DISABLE_TIMEOUT =       30              ; # of vertical blank interrupts after w
         .include        "atari.inc"
 
         .macpack        generic
+        .macpack        module
 
 .if .not ( .defined (AMIGA_MOUSE) .or .defined (TRAK_MOUSE))
         ST_MOUSE = 1
@@ -31,7 +32,31 @@ DISABLE_TIMEOUT =       30              ; # of vertical blank interrupts after w
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+.if .defined (ST_MOUSE)
+
+.ifdef __ATARIXL__
+        module_header   _atrxst_mou
+.else
+        module_header   _atrst_mou
+.endif
+
+.elseif .defined (AMIGA_MOUSE)
+
+.ifdef __ATARIXL__
+        module_header   _atrxami_mou
+.else
+        module_header   _atrami_mou
+.endif
+
+.elseif .defined (TRAK_MOUSE)
+
+.ifdef __ATARIXL__
+        module_header   _atrxtrk_mou
+.else
+        module_header   _atrtrk_mou
+.endif
+
+.endif
 
 HEADER:
 
index 56f62636c4a154cd63f4e107b436736066837106..f1f2cde63872bb82d4b1f72719fcbaab8cbfa560 100644 (file)
@@ -9,11 +9,16 @@
         .include        "atari.inc"
 
         .macpack        generic
+        .macpack        module
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+.ifdef __ATARIXL__
+        module_header   _atrxtt_mou
+.else
+        module_header   _atrtt_mou
+.endif
 
 HEADER:
 
index 714d3edb6c242693381898fc7470fab529a1ccb3..3a7bc21c2737622814cd16fd06914fd825f88ef1 100644 (file)
         .include        "ser-error.inc"
         .include        "atari.inc"
 
+        .macpack        module
+
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+.ifdef __ATARIXL__
+        module_header   _atrxrdev_ser
+.else
+        module_header   _atrrdev_ser
+.endif
 
 ; Driver signature
 
index 5d45e495c57a3c925c6dc99cca4414297a726f77..f4ef68165ae5c425fad88adebb00454393df61d5 100644 (file)
@@ -3,6 +3,7 @@
 ;
 
 .macpack longbranch
+.macpack module
 
 .ifdef __ATARIXL__
         CIO_vec := my_CIOV
         ;
         ; ----------------------------------------------------------------------
 
-.segment        "HEADER"
+.ifdef __ATARIXL__
+        .define LABEL_X "x"
+.else
+        .define LABEL_X ""
+.endif
+
+.if pages = 2
+        .define LABEL_P2 "p2"
+.else
+        .define LABEL_P2 ""
+.endif
+
+        module_header   .ident (.sprintf ("_atr%s%d%s_tgi", LABEL_X, ::grmode, LABEL_P2))
 
 ; Header
 
index 890e1ff61b094b3490cc5d67706318f2223e3b6d..3483cc11aed1109414ed641550d7357fd9f77f8a 100644 (file)
         .include        "joy-error.inc"
         .include        "atari5200.inc"
 
+        .macpack        module
+
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _atr5200std_joy
 
 ; Driver signature
 
index 920fa1698fd33220f284a78540bdc9b375371b57..26d7c74d8be4b545de2a921673629a0bcdc50e74 100644 (file)
         .include        "joy-error.inc"
         .include        "atmos.inc"
 
+        .macpack        module
+
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _atmos_pase_joy
 
 ; Driver signature
 
index 20bea595f131c8c6b9076922a4d0b9d0c1c9e277..79fbc1bbe4d4a2805943e84b53b2943181c3d143 100644 (file)
         .include        "ser-error.inc"
         .include        "atmos.inc"
 
+        .macpack        module
+
+
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-        .segment        "HEADER"
+        module_header   _atmos_acia_ser
 
         ; Driver signature
         .byte   $73, $65, $72           ; "ser"
index f00f502f761b8e1aec2f4ec3fe7f5500218b5e9a..30b7ca65fa9cbf64673a3401d3f35d50f0e48571 100644 (file)
@@ -12,6 +12,7 @@
         .include        "atmos.inc"
 
         .macpack        generic
+        .macpack        module
 
 XSIZE   =       6               ; System font width
 YSIZE   =       8               ; System font height
@@ -19,7 +20,7 @@ YSIZE   =       8               ; System font height
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table and constants.
 
-.segment        "HEADER"
+        module_header   _atmos_228_200_3_tgi
 
 ; The first part of the header is a structure that has a signature,
 ; and defines the capabilities of the driver.
index 7c4c05b7875dd88af4134d916b0eb591a0ea994b..600d93193e4d8df506e49ad74dc19a14e21ed718 100644 (file)
@@ -12,6 +12,7 @@
         .include        "atmos.inc"
 
         .macpack        generic
+        .macpack        module
 
 XSIZE   =       6                       ; System font width
 YSIZE   =       8                       ; System font height
@@ -19,7 +20,7 @@ YSIZE   =       8                       ; System font height
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table and constants.
 
-.segment        "HEADER"
+        module_header   _atmos_240_200_2_tgi
 
 ; First part of the header is a structure that has a magic and defines the
 ; capabilities of the driver
index 23ae86852694a8b38b182ed5f62237035752ef33..7511c684151562f4f0bc7b2666334131aec01cf7 100644 (file)
         .include        "em-kernel.inc"
         .include        "em-error.inc"
 
-
         .macpack        generic
+        .macpack        module
 
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _c128_georam_emd
 
 ; Driver signature
 
index bd1984333ce0eaa551bc3ad98d4b8dfda024be1a..bef0a15ee3f2b3f3a358ca1f3c7b3ef0321d717e 100644 (file)
         .include        "em-error.inc"
         .include        "c128.inc"
 
-
         .macpack        generic
+        .macpack        module
 
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _c128_ram_emd
 
 ; Driver signature
 
index d15b794f633c26d78006f0edffcd41ff88ad9d66..7d2703fa5d531e05c603217b5943dce36820020c 100644 (file)
         .include        "em-error.inc"
         .include        "c128.inc"
 
-
         .macpack        generic
+        .macpack        module
 
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _c128_ram2_emd
 
 ; Driver signature
 
index 2d632a869cfdc388db5a7299e383732b2714bf40..e72d053ac96e9e33fc32ba896a44e7a0cf071d93 100644 (file)
         .include        "em-kernel.inc"
         .include        "em-error.inc"
 
-
         .macpack        generic
+        .macpack        module
 
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _c128_ramcart_emd
 
 ; Driver signature
 
index 786974f4d4fb1fdf2184b191be85bb0c84960539..a858c591eefba3ce35c7438c9e11e30fb956df38 100644 (file)
         .include        "em-error.inc"
         .include        "c128.inc"
 
-
         .macpack        generic
+        .macpack        module
 
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _c128_reu_emd
 
 ; Driver signature
 
index af7dfaf02ac1bcf13ce1140b255740426cfd6061..d915fdf25596ec2f998647931410f02396b49129 100644 (file)
@@ -9,14 +9,14 @@
         .include        "em-kernel.inc"
         .include        "em-error.inc"
 
-
         .macpack        generic
+        .macpack        module
 
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _c128_vdc_emd
 
 ; Driver signature
 
index 3490a0217311e52afc0486e6940f3bb1d7c23525..6f65ce5eb4fef09198e9ca15072ffc89621a81ed 100644 (file)
         .include "c128.inc"
 
         .macpack generic
+        .macpack module
+
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-        .segment "HEADER"
+        module_header   _c128_ptvjoy_joy
 
 ; Driver signature
 
index 7694f23a0f08676ccf4d8f227ddf5ed8e2ef6459..119d3784f5b25aef7778e67fb7e3c8fe4facc057 100644 (file)
         .include        "c128.inc"
 
         .macpack        generic
+        .macpack        module
 
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _c128_stdjoy_joy
 
 ; Driver signature
 
index 8469ba8e35d49c3b97952e922e53defd56d73ea4..d06e942c45a571e807ee2e3687b82da8ea6a7c60 100644 (file)
         .include        "c128.inc"
 
         .macpack        generic
+        .macpack        module
+
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _c128_1351_mou
 
 HEADER:
 
index f7b844f4d76aed106b1eff5b218699491e2c22cb..8583e4bfe32d47e1de02186e0333cfafcc711c02 100644 (file)
         .include        "c128.inc"
 
         .macpack        generic
+        .macpack        module
+
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table.
 
-.segment        "HEADER"
+        module_header   _c128_inkwell_mou
 
 HEADER:
 
index 2bedd772eee13dc406d095e3fad1e40e74764e69..7718b89b76148f55a70781b0d566628b42f84bf7 100644 (file)
         .include        "c128.inc"
 
         .macpack        generic
+        .macpack        module
+
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _c128_joy_mou
 
 HEADER:
 
index 3d5dd6fe417a51452f950fa49479337910057e0a..f61f88d5d78684e81b906f20c549edc517d2b8f5 100644 (file)
         .include        "c128.inc"
 
         .macpack        generic
+        .macpack        module
+
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _c128_pot_mou
 
 HEADER:
 
index 89bf2f072e0d32c0ed09d552c551bfc80ecaf672..98411d4f88fdbc3e998b706ade4269b4a78b0b8b 100644 (file)
         .include        "ser-error.inc"
         .include        "c128.inc"
 
+        .macpack        module
+
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _c128_swlink_ser
 
 ; Driver signature
 
index aaf022debc220481a7c77d1bd6b3c2b79cf405f0..5100f7f7d0fef66f54f18759c1dd5707e023a761 100644 (file)
@@ -25,8 +25,9 @@
         .include        "tgi-kernel.inc"
         .include        "tgi-error.inc"
 
-
         .macpack        generic
+        .macpack        module
+
 
 ; ------------------------------------------------------------------------
 ; Constants
@@ -48,7 +49,7 @@ VDC_DATA          = 31
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table and constants.
 
-.segment        "HEADER"
+        module_header   _c128_vdc_tgi
 
 ; First part of the header is a structure that has a magic and defines the
 ; capabilities of the driver
index 1f293da4160761810b09a927393f18c9375e54c5..a7238e87788470d8e75c3cd6d8b2eebff83136e5 100644 (file)
@@ -26,8 +26,9 @@
         .include        "tgi-kernel.inc"
         .include        "tgi-error.inc"
 
-
         .macpack        generic
+        .macpack        module
+
 
 ; ------------------------------------------------------------------------
 ; Constants
@@ -49,7 +50,7 @@ VDC_DATA          = 31
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table and constants.
 
-.segment        "HEADER"
+        module_header   _c128_vdc2_tgi
 
 ; First part of the header is a structure that has a magic and defines the
 ; capabilities of the driver
index fd1a16831baa0d446b9bfe6456da033a014e305c..a8083aca445fc970523ee640dcbd5c103384b37c 100644 (file)
         .include        "plus4.inc"
 
         .macpack        generic
+        .macpack        module
 
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _c16_ram_emd
 
 ; Driver signature
 
index 54ba47e1949d93b52db848729cd0e1e1c7aad6ed..0b99d93a3faee3b1015f8832fcf6d5f173be547c 100644 (file)
@@ -5,5 +5,6 @@
 ; Ullrich von Bassewitz, 2002-12-21
 ;
 
-        .include        "../../plus4/joy/plus4-stdjoy.s"
+        .define         MODULE_LABEL    _c16_stdjoy_joy
 
+        .include        "../../plus4/joy/plus4-stdjoy.s"
index 4996aca225d65155317ed67b6a9c333f51cce93e..79706e8fb7d6983d9ed39bb94e96a2903b1e0680 100644 (file)
 
 
         .macpack        generic
+        .macpack        module
 
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _c64_c256k_emd
 
 ; Driver signature
 
index 479f06b60328ef6e398a81477e1350ce386ba84c..986c5939d39d68fd337d05db667a8dee899ef0f1 100644 (file)
 
 
         .macpack        generic
+        .macpack        module
 
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _c64_dqbb_emd
 
 ; Driver signature
 
index 23ae86852694a8b38b182ed5f62237035752ef33..97f1a7cc4149cb00c3abae324d18fa2ba919b0c5 100644 (file)
 
 
         .macpack        generic
+        .macpack        module
 
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _c64_georam_emd
 
 ; Driver signature
 
index cb084864f27a821d59bd766e74c49a57a800749f..3764443e2e81d9c4d2531860f6810c643d4c38cb 100644 (file)
 
 
         .macpack        generic
+        .macpack        module
 
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _c64_isepic_emd
 
 ; Driver signature
 
index 54542636c09b8e01f2d57ebd93b0d3c4b721fb9e..f8a4a1819b284c07ac8ef4ee533657322121233c 100644 (file)
 
 
         .macpack        generic
+        .macpack        module
 
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _c64_ram_emd
 
 ; Driver signature
 
index 9c9c53e3b972cb96e8215686ba360b698c519d75..8998bb6d69d0840c54b137a976e5955c276b33aa 100644 (file)
 
 
         .macpack        generic
+        .macpack        module
 
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _c64_ramcart_emd
 
 ; Driver signature
 
index 4d9888e4854d3141495506dff346a299f7d82ffb..0779505be9be5cdbde0348f89c25244f7d4b2bdc 100644 (file)
 
 
         .macpack        generic
+        .macpack        module
 
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _c64_reu_emd
 
 ; Driver signature
 
index 3d9da30646205441692f53281af19a72a9bc416c..2448f09d4e9ab6a89eb7ecc376ca6b249cb0d5ba 100644 (file)
 
 
         .macpack        generic
+        .macpack        module
 
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _c64_vdc_emd
 
 ; Driver signature
 
index 1354ff12e46e7c87b807fbeb9176d0fd3ef235b7..6dde874f793b41be6e51a9ddfe93ee8ef25947ad 100644 (file)
 
 
         .macpack        generic
+        .macpack        module
 
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _dtv_himem_emd
 
 ; Driver signature
 
index 0bde0b3204fd187c6698782a4305190aa2535279..a798100a79283fbcd83efaa5ea0acb4f7145d858 100644 (file)
         .include "c64.inc"
 
         .macpack generic
+        .macpack module
+
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-        .segment "HEADER"
+        module_header   _c64_hitjoy_joy
 
 ; Driver signature
 
index 1d89dc0510110ab325ca23d5db5dd4a267c75541..5f6464215648cf8fe7075293ddf42d74204459d5 100644 (file)
         .include        "c64.inc"
 
         .macpack        generic
+        .macpack        module
 
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _c64_numpad_joy
 
 ; Driver signature
 
index 2bfe7fd5d010482872e4d02b7db14833754a35dd..31850488c44dbb98ed7effbc905155ae5abd3d36 100644 (file)
         .include "c64.inc"
 
         .macpack generic
+        .macpack module
+
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-        .segment "HEADER"
+        module_header   _c64_ptvjoy_joy
 
 ; Driver signature
 
index b9d6845dac56149583aee20050b9ee8ec2a71496..2932c77fdd34d06c3b174c941547e79c1eea0036 100644 (file)
         .include        "c64.inc"
 
         .macpack        generic
+        .macpack        module
 
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _c64_stdjoy_joy
 
 ; Driver signature
 
index 9fbbff296c182a27fe7007e0692ce7c5c478d28e..a7d042c7b13b0eea19db23d9e4fa0c74d631a6e2 100644 (file)
         .include        "c64.inc"
 
         .macpack        generic
+        .macpack        module
+
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _c64_1351_mou
 
 HEADER:
 
index 52dd114a440b264f8504e3601ceb30234e26b9f2..a48d7d15eb7a8fc4b8177464226059d595bc99f0 100644 (file)
@@ -9,11 +9,13 @@
         .include        "c64.inc"
 
         .macpack        generic
+        .macpack        module
+
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table.
 
-.segment        "HEADER"
+        module_header   _c64_inkwell_mou
 
 HEADER:
 
index 37276c79296e570bceb10f8c6e967de8a86eaac3..f2a501000943a9affc2bee1928887c6e6c973f98 100644 (file)
         .include        "c64.inc"
 
         .macpack        generic
+        .macpack        module
+
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _c64_joy_mou
 
 HEADER:
 
index 0906b624513091d58a99e8adb443d370602b6eea..102ca351c0661c002769f7c140a85a8a21a5161e 100644 (file)
         .include        "c64.inc"
 
         .macpack        generic
+        .macpack        module
+
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _c64_pot_mou
 
 HEADER:
 
index 4751a24ae0120a57f500dedc6be66e8bbd73dc72..813067239842078abe98d9a534608a8213e621ed 100644 (file)
         .include        "ser-error.inc"
         .include        "c64.inc"
 
+        .macpack        module
+
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _c64_swlink_ser
 
 ; Driver signature
 
index a6f50649a80dab8e8269ef7fedb67f8aa5239837..6d33f00a82d529aa86e64d37678e7dd0adb6b7d4 100644 (file)
@@ -9,14 +9,14 @@
         .include        "tgi-kernel.inc"
         .include        "tgi-error.inc"
 
-
         .macpack        generic
+        .macpack        module
 
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table and constants.
 
-.segment        "HEADER"
+        module_header   _c64_hi_tgi
 
 ; First part of the header is a structure that has a magic and defines the
 ; capabilities of the driver
index 063489cd084b6475bcb0fe5a93c39379f64d7c08..f724c7360279a25e255b64a0000d4ce2a4d3cee2 100644 (file)
         .include        "cbm510.inc"
 
         .macpack        generic
+        .macpack        module
 
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _cbm510_ram_emd
 
 ; Driver signature
 
index a9fe7cb693c7386ac8931eddfc9a0fd700d40ffa..7133f9379a83203361dbe01048201e3b5503b681 100644 (file)
         .include        "cbm510.inc"
 
         .macpack        generic
+        .macpack        module
 
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _cbm510_std_joy
 
 ; Driver signature
 
index 50af974dd085992ab4e7decde2105c779c3b5c9b..b17f6408aa14d314a57d5e740323752710952ec9 100644 (file)
         .include        "cbm510.inc"
 
         .macpack        generic
+        .macpack        module
+
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table.
 
-.segment        "HEADER"
+        module_header   _cbm510_inkwl_mou
 
 HEADER:
 
index 3ea1b5e116d6bc34036d279004c53cef97981a55..af53b7c239608f150d178fe00ac121472087dc47 100644 (file)
         .include        "cbm510.inc"
 
         .macpack        generic
+        .macpack        module
+
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _cbm510_joy_mou
 
 HEADER:
 
index d3067a9e9f8379e6ce67133fd3c7f084516096c3..7629892e0fc032aaf65f7814b92119b46e02ed6a 100644 (file)
         .include        "ser-error.inc"
         .include        "cbm510.inc"
 
+        .macpack        module
+
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _cbm510_std_ser
 
 ; Driver signature
 
index 5b8906cd27e099ee061f13d80e922776f17bea55..5c67df7a4fad5994520c6581a8de036de00ea8a3 100644 (file)
         .include        "cbm610.inc"
 
         .macpack        generic
+        .macpack        module
 
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _cbm610_ram_emd
 
 ; Driver signature
 
index 9e2992023da555ecb9ffdffac54a19db5a065d10..1b2d38aa57eec9f2e4e6dc92cc00329596ad6387 100644 (file)
         .include        "ser-error.inc"
         .include        "cbm610.inc"
 
+        .macpack        module
+
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _cbm610_std_ser
 
 ; Driver signature
 
index 0e94ce2074643f7e231ce1bac7c254997f1d5d30..791d2a0a8696185c40c4806a2877fb6bc20f1c58 100644 (file)
             .include "em-error.inc"
 
             .macpack generic
+            .macpack module
+
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _geos_vdc_emd
 
 ; Driver signature
 
index fd62d3306b2ef75b565046856a7b4aaefeeec53b..6afe4609296be4f69e302179068fdbc2de33afc2 100644 (file)
             .include "geossym.inc"
 
             .macpack generic
+            .macpack module
+
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
-                                             
+        module_header   _geos_stdjoy_joy
+
 ; Driver signature
 
         .byte $6A, $6F, $79     ; "joy"
index de2bf51fcd80fb3f19d0177f4f88aecd63294a3e..5a1af65e412212be4b3a848f0b366d805bfc23d3 100644 (file)
             .include "jumptab.inc"
             .include "geossym.inc"
             .include "geossym2.inc"
-            
+
             .macpack generic
+            .macpack module
+
 
 ; ------------------------------------------------------------------------
 ; Constants
@@ -33,7 +35,7 @@ VDC_DATA        = 31
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table and constants.
 
-.segment        "HEADER"
+        module_header   _geos_tgi_tgi
 
 ; First part of the header is a structure that has a magic signature,
 ; and defines the capabilities of the driver.
index 6535ce5537028c41c4a5234a714880d5eda3f819..1146470726760a1a33ec5373b6b220e76169f419 100644 (file)
         .include        "lynx.inc"
 
         .macpack        generic
+        .macpack        module
 
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _lynx_stdjoy_joy
 
 ; Driver signature
 
index 50c685db93d935640bfd529fede2faad27bd87e6..1fd24ad94c8b21698e736a3ecae06c6adc36df81 100644 (file)
@@ -9,10 +9,13 @@
         .include        "ser-kernel.inc"
         .include        "ser-error.inc"
 
+        .macpack        module
+
+
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-        .segment        "HEADER"
+        module_header   _lynx_comlynx_ser
 
         ; Driver signature
         .byte   $73, $65, $72           ; "ser"
index 2e5483b362ab04942cadf370f346e1ebed7c7012..e6659631bd27af6a66ffad453d867f82b81a5fc9 100644 (file)
         .include        "lynx.inc"
 
         .macpack        generic
+        .macpack        module
+
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table and constants.
 
-.segment        "HEADER"
+        module_header   _lynx_160_102_16_tgi
 
 ; First part of the header is a structure that has a magic and defines the
 ; capabilities of the driver
index abd21373774e417677dad2bea935c4a3b9b52e30..b50c2124d3e73f81b344d3c5faebdd5e1f72b128 100644 (file)
         .include        "joy-error.inc"
         .include        "nes.inc"
 
+        .macpack        module
+
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _nes_stdjoy_joy
 
 ; Driver signature
 
index 23d7a0e4786170520b4a0ee934e1a7b3c8e23a40..70e23e1193bf29482d5d0f55181e6bfce38241ee 100644 (file)
         .import         paldata
 
         .macpack        generic
+        .macpack        module
+
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table and constants.
 
-.segment        "HEADER"
+        module_header   _nes_64_56_2_tgi
 
 ; First part of the header is a structure that has a magic and defines the
 ; capabilities of the driver
index 21dd7f1535a406b610e26aa32230313334ab13e0..229055fcb75d08ac28e4a97556ad90b5f2e09cce 100644 (file)
 
         .include "joy-kernel.inc"
         .include "joy-error.inc"
-;       .include "pet.inc"
-VIA_PRA         := $E841                ; Port register A
-VIA_DDRA        := $E843                ; Data direction register A
+
+        .macpack module
+
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-        .segment "HEADER"
+        module_header   _pet_ptvjoy_joy
 
 ; Driver signature
 
@@ -50,7 +50,10 @@ VIA_DDRA        := $E843                ; Data direction register A
 ; ------------------------------------------------------------------------
 ; Constants
 
-JOY_COUNT       = 2             ; Number of joysticks we support
+JOY_COUNT       = 2                     ; Number of joysticks we support
+
+VIA_PRA         := $E841                ; Port register A
+VIA_DDRA        := $E843                ; Data direction register A
 
 
 .code
index c1b568feab8c021774669f9794418f8405147e02..5847c2b094f44773a4a991f34ceacbc95c66ef0f 100644 (file)
         .include        "joy-error.inc"
         .include        "pet.inc"
 
+        .macpack        module
+
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-        .segment "HEADER"
+        module_header   _pet_stdjoy_joy
 
 ; Driver signature
 
index 283ea38cd84d70e59d70049323b085a701c336fe..29316bf2266091a20e1aa869e9396cc1931c4553 100644 (file)
         .include        "plus4.inc"
 
         .macpack        generic
+        .macpack        module
 
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        .if .xmatch ("MODULE_LABEL", .string(MODULE_LABEL))
+        module_header   _plus4_stdjoy_joy
+        .else
+        module_header   MODULE_LABEL
+        .endif
 
 ; Driver signature
 
index 4c720e3af40268b1d168f910f1440f1376f6bdd2..47dd96042dee52fc30abbf88e66554ef48e9bd46 100644 (file)
         .include        "ser-error.inc"
         .include        "plus4.inc"
 
+        .macpack        module
+
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _plus4_stdser_ser
 
 ; Driver signature
 
index 07027c290f9bce12d975ee12065be2a3be18c28b..cdd4c274f8dfd64b4ae468b0e377186a3000effd 100644 (file)
         .include "joy-error.inc"
         .include "vic20.inc"
 
+        .macpack module
+
+
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-        .segment "HEADER"
+        module_header   _vic20_ptvjoy_joy
 
 ; Driver signature
 
index db1a0beccae9ccb0061457048a1289dfa907170b..56fb35ae43d885cc6fb533b884b735f43734cbb0 100644 (file)
         .include        "vic20.inc"
 
         .macpack        generic
+        .macpack        module
 
 
 ; ------------------------------------------------------------------------
 ; Header. Includes jump table
 
-.segment        "HEADER"
+        module_header   _vic20_stdjoy_joy
 
 ; Driver signature