From 0fb3869716779041901e408233d968e70c8dd4f4 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Wed, 8 May 2019 17:23:00 +0200 Subject: [PATCH] Added support for the upcoming 'Dracarys' ATARI PBI device. See https://atariage.com/forums/topic/287376-preannouncement-dragon-cart-ii/ --- apps/Makefile | 3 +- drivers/Makefile | 38 ++++++++++++--------- drivers/atrcombo.s | 24 ++++++++++++++ drivers/atrinit.s | 2 +- drivers/dracarys.s | 36 ++++++++++++++++++++ drivers/ethernetcombo.s | 5 ++- drivers/w5100.s | 73 ++++++++++++++++++++++++++++++++++++++++- inc/ip65.h | 4 ++- test/Makefile | 3 +- 9 files changed, 167 insertions(+), 21 deletions(-) create mode 100644 drivers/atrcombo.s create mode 100644 drivers/dracarys.s diff --git a/apps/Makefile b/apps/Makefile index d3db82b..150da4a 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -16,10 +16,11 @@ else ifeq ($(eth),sm) A2DRIVERLIB = ../drivers/a2lancegs.lib else ifeq ($(eth),wn) A2DRIVERLIB = ../drivers/a2uther2.lib + ATRDRIVERLIB = ../drivers/atrdracarys.lib else C64DRIVERLIB = ../drivers/c64combo.lib A2DRIVERLIB = ../drivers/a2combo.lib - ATRDRIVERLIB = ../drivers/atrdragon.lib + ATRDRIVERLIB = ../drivers/atrcombo.lib endif C64_DRIVERLIB = ../drivers/ip65_c64.lib diff --git a/drivers/Makefile b/drivers/Makefile index 50b872a..292d718 100644 --- a/drivers/Makefile +++ b/drivers/Makefile @@ -1,21 +1,23 @@ # For assembler programs # ---------------------- -# c64rrnet.lib : C64 with RR-Net (or clone) -# c64eth64.lib : C64 with ETH64 -# c64combo.lib : C64 with RR-Net or ETH64 -# a2uther.lib : Apple ][ with Uthernet (default slot: #3) -# a2lancegs.lib : Apple ][ with LANceGS (default slot: #3) -# a2uther2.lib : Apple ][ with Uthernet II (default slot: #3) -# a2combo.lib : Apple ][ with Uthernet or LANceGS or Uthernet II (default slot: #3) -# atrdragon.lib : ATARI 8-bit with Dragon Cart -# vic20rrnet.lib : VIC20 with RR-Net (or clone) +# c64rrnet.lib : C64 with RR-Net (or clone) +# c64eth64.lib : C64 with ETH64 +# c64combo.lib : C64 with RR-Net or ETH64 +# a2uther.lib : Apple ][ with Uthernet (default slot: #3) +# a2lancegs.lib : Apple ][ with LANceGS (default slot: #3) +# a2uther2.lib : Apple ][ with Uthernet II (default slot: #3) +# a2combo.lib : Apple ][ with Uthernet or LANceGS or Uthernet II (default slot: #3) +# atrdragon.lib : ATARI 8-bit with Dragon Cart +# atrdracarys.lib : ATARI 8-bit with Dracarys (default PBI device ID: #8) +# atrcombo.lib : ATARI 8-bit with Dragon Cart or Dracarys (default PBI device ID: #8) +# vic20rrnet.lib : VIC20 with RR-Net (or clone) # For C programs # -------------- # ip65_c64.lib : C64 with RR-Net or ETH64 # ip65_apple2.lib : Apple ][ with Uthernet or LANceGS or Uthernet II (default slot: #3) -# ip65_atari.lib : ATARI 8-bit with Dragon Cart -# ip65_atarixl.lib : ATARI XL with Dragon Cart +# ip65_atari.lib : ATARI 8-bit with Dragon Cart or Dracarys (default PBI device ID: #8) +# ip65_atarixl.lib : ATARI XL with Dragon Cart or Dracarys (default PBI device ID: #8) DRIVERS=\ c64rrnet.lib \ @@ -29,6 +31,8 @@ DRIVERS=\ ip65_apple2.lib \ ip65_apple2_uther2.lib \ atrdragon.lib \ + atrdracarys.lib \ + atrcombo.lib \ ip65_atari.lib \ ip65_atarixl.lib \ vic20rrnet.lib @@ -114,9 +118,9 @@ rr-net.o uthernet.o dragoncart.o vic20-rr-net.o: cs8900a.s eth64.o lancegs.o: lan91c96.s -uthernet2.o: w5100.s +uthernet2.o dracarys.o: w5100.s -c64combo.o a2combo.o: ethernetcombo.s +c64combo.o a2combo.o atrcombo.o: ethernetcombo.s c64rrnet.lib: rr-net.o $(CS8900AOBJS) c64init.o $(C64OBJS) @@ -140,9 +144,13 @@ ip65_apple2_uther2.lib: uthernet2.o $(W5100OBJS) a2init.o $(A2_OBJS) atrdragon.lib: dragoncart.o $(CS8900AOBJS) atrinit.o $(ATROBJS) -ip65_atari.lib: dragoncart.o $(CS8900AOBJS) atrinit.o $(ATR_OBJS) +atrdracarys.lib: dracarys.o $(W5100OBJS) atrinit.o $(ATROBJS) -ip65_atarixl.lib: dragoncart.o $(CS8900AOBJS) atrinit.o $(ATRXL_OBJS) +atrcombo.lib: dragoncart.o dracarys.o atrcombo.o atrinit.o $(ATROBJS) + +ip65_atari.lib: dragoncart.o dracarys.o atrcombo.o atrinit.o $(ATR_OBJS) + +ip65_atarixl.lib: dragoncart.o dracarys.o atrcombo.o atrinit.o $(ATRXL_OBJS) vic20rrnet.lib: vic20-rr-net.o $(CS8900AOBJS) vic20init.o $(VIC20OBJS) diff --git a/drivers/atrcombo.s b/drivers/atrcombo.s new file mode 100644 index 0000000..ef9bbb8 --- /dev/null +++ b/drivers/atrcombo.s @@ -0,0 +1,24 @@ +__ATARI__ = 1 + +.include "ethernetcombo.s" + + + +; -- LICENSE FOR atrcombo.s -- +; The contents of this file are subject to the Mozilla Public License +; Version 1.1 (the "License"); you may not use this file except in +; compliance with the License. You may obtain a copy of the License at +; http://www.mozilla.org/MPL/ +; +; Software distributed under the License is distributed on an "AS IS" +; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +; License for the specific language governing rights and limitations +; under the License. +; +; The Original Code is ip65. +; +; The Initial Developer of the Original Code is Jonno Downes, +; jonno@jamtronix.com. +; Portions created by the Initial Developer are Copyright (C) 2009 +; Jonno Downes. All Rights Reserved. +; -- LICENSE END -- diff --git a/drivers/atrinit.s b/drivers/atrinit.s index 83abea7..4279c4b 100644 --- a/drivers/atrinit.s +++ b/drivers/atrinit.s @@ -1 +1 @@ -.exportzp eth_init_default = 0 +.exportzp eth_init_default = 8 ; PBI default device ID diff --git a/drivers/dracarys.s b/drivers/dracarys.s new file mode 100644 index 0000000..9fd16c8 --- /dev/null +++ b/drivers/dracarys.s @@ -0,0 +1,36 @@ +; Dracarys driver + +.export _w5100_name + + +__ATARI__ = 1 +DYN_DRV = 0 + +.include "w5100.s" + + +.rodata + +_w5100_name: + .byte "Dracarys",0 + + + +; -- LICENSE FOR dracarys.s -- +; The contents of this file are subject to the Mozilla Public License +; Version 1.1 (the "License"); you may not use this file except in +; compliance with the License. You may obtain a copy of the License at +; http://www.mozilla.org/MPL/ +; +; Software distributed under the License is distributed on an "AS IS" +; basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +; License for the specific language governing rights and limitations +; under the License. +; +; The Original Code is ip65. +; +; The Initial Developer of the Original Code is Jonno Downes, +; jonno@jamtronix.com. +; Portions created by the Initial Developer are Copyright (C) 2009 +; Jonno Downes. All Rights Reserved. +; -- LICENSE END -- diff --git a/drivers/ethernetcombo.s b/drivers/ethernetcombo.s index 249554c..9b78b98 100644 --- a/drivers/ethernetcombo.s +++ b/drivers/ethernetcombo.s @@ -132,7 +132,7 @@ set_name: eth_init: sta eth_init_value -.ifdef __APPLE2__ +.if .defined (__APPLE2__) .or .defined (__ATARI__) ldax #_w5100 jsr patch_wrapper ldax #_w5100_name @@ -148,11 +148,14 @@ eth_init: jsr init_adaptor bcc @done +.if .defined (__C64__) .or .defined (__APPLE2__) ldax #_lan91c96 jsr patch_wrapper ldax #_lan91c96_name jsr set_name jsr init_adaptor +.endif + @done: rts diff --git a/drivers/w5100.s b/drivers/w5100.s index 7007dc9..796f3c6 100644 --- a/drivers/w5100.s +++ b/drivers/w5100.s @@ -41,7 +41,12 @@ ; Ethernet address mac: .byte $00, $08, $DC ; OUI of WIZnet + .ifdef __APPLE2__ .byte $A2, $A2, $A2 + .endif + .ifdef __ATARI__ + .byte $A8, $A8, $A8 + .endif ; Buffer attributes bufaddr:.res 2 ; Address @@ -84,7 +89,9 @@ tmp := tmp4 ; Temporary value .endif -;--------------------------------------------------------------------- +;===================================================================== + + .ifdef __APPLE2__ .rodata @@ -148,6 +155,56 @@ init: bcs :- ; Always : + .endif + +;===================================================================== + + .ifdef __ATARI__ + + .rodata + +pdtab: .byte %00000001 + .byte %00000010 + .byte %00000100 + .byte %00001000 + .byte %00010000 + .byte %00100000 + .byte %01000000 + .byte %10000000 + +;--------------------------------------------------------------------- + + .bss + +pdbit: .res 1 + +;--------------------------------------------------------------------- + +mode := $D1F0 +addr := $D1F1 +data := $D1F3 + +pdvs := $D1FF ; parallel device select +shpdvs := $0248 ; shadow parallel device select + +;--------------------------------------------------------------------- + + .code + +init: + ; Convert parallel device ID (1-8) to parallel device bit + tay + lda pdtab-1,y + sta pdbit + + ; Select parallel device + sta shpdvs + sta pdvs + + .endif + +;===================================================================== + ; Indirect Bus I/F mode, Address Auto-Increment fixup01:lda mode ora #$03 @@ -230,6 +287,13 @@ fixup14:sta data ;--------------------------------------------------------------------- poll: + .ifdef __ATARI__ + ; Select parallel device + lda pdbit + sta shpdvs + sta pdvs + .endif + ; Check for completion of previous command ; Socket 0 Command Register: = 0 ? jsr set_addrcmdreg0 @@ -337,6 +401,13 @@ send: sta adv stx adv+1 + .ifdef __ATARI__ + ; Select parallel device + lda pdbit + sta shpdvs + sta pdvs + .endif + ; Set parameters for transmitting data lda #>$4000 ; Socket 0 TX Base Address ldx #$01 ; Write diff --git a/inc/ip65.h b/inc/ip65.h index 01be24e..5b9b414 100644 --- a/inc/ip65.h +++ b/inc/ip65.h @@ -25,8 +25,10 @@ extern uint8_t ip65_error; // Ethernet driver initialization parameter values // -#ifdef __APPLE2__ +#if defined(__APPLE2__) #define ETH_INIT_DEFAULT 3 // Apple II slot number +#elif defined(__ATARI__) +#define ETH_INIT_DEFAULT 8 // ATARI PBI device ID #else #define ETH_INIT_DEFAULT 0 // Unused #endif diff --git a/test/Makefile b/test/Makefile index 4c9d4ec..ade6fef 100644 --- a/test/Makefile +++ b/test/Makefile @@ -17,10 +17,11 @@ else ifeq ($(eth),sm) A2DRIVERLIB = ../drivers/a2lancegs.lib else ifeq ($(eth),wn) A2DRIVERLIB = ../drivers/a2uther2.lib + ATRDRIVERLIB = ../drivers/atrdracarys.lib else C64DRIVERLIB = ../drivers/c64combo.lib A2DRIVERLIB = ../drivers/a2combo.lib - ATRDRIVERLIB = ../drivers/atrdragon.lib + ATRDRIVERLIB = ../drivers/atrcombo.lib VICDRIVERLIB = ../drivers/vic20rrnet.lib endif