From 40ed729b08154ef13a4b6ea8ae9413bcada31d84 Mon Sep 17 00:00:00 2001
From: Oliver Schmidt
Date: Wed, 8 Jul 2015 15:46:28 +0200
Subject: [PATCH] Added option to set ethernet slot on the Apple 2.
---
drivers/Makefile | 8 +++---
drivers/a2slot.s | 47 ++++++++++++++++++++++++++++++++++
drivers/a2slotcombo.s | 59 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 110 insertions(+), 4 deletions(-)
create mode 100644 drivers/a2slot.s
create mode 100644 drivers/a2slotcombo.s
diff --git a/drivers/Makefile b/drivers/Makefile
index afede6d..58d7084 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -60,16 +60,16 @@ c64wiz811.lib: wiz811mj.o w5100.o w5100driver.o ethernet.o $(C64OBJS)
c64combo.lib: rr-net.o cs8900a.o eth64.o lan91c96.o wiz811mj.o w5100.o ethernetcombo.o $(C64OBJS)
ar65 a $@ $^
-a2uther.lib: uthernet.o cs8900a.o cs8900adriver.o ethernet.o $(A2OBJS)
+a2uther.lib: uthernet.o cs8900a.o cs8900adriver.o ethernet.o a2slot.o $(A2OBJS)
ar65 a $@ $^
-a2lancegs.lib: lancegs.o lan91c96.o lan91c96driver.o ethernet.o $(A2OBJS)
+a2lancegs.lib: lancegs.o lan91c96.o lan91c96driver.o ethernet.o a2slot.o $(A2OBJS)
ar65 a $@ $^
-a2uther2.lib: uthernet2.o w5100.o w5100driver.o ethernet.o $(A2OBJS)
+a2uther2.lib: uthernet2.o w5100.o w5100driver.o ethernet.o a2slot.o $(A2OBJS)
ar65 a $@ $^
-a2combo.lib: uthernet.o cs8900a.o lancegs.o lan91c96.o uthernet2.o w5100.o ethernetcombo.o $(A2OBJS)
+a2combo.lib: uthernet.o cs8900a.o lancegs.o lan91c96.o uthernet2.o w5100.o ethernetcombo.o a2slotcombo.o $(A2OBJS)
ar65 a $@ $^
vic20rrnet.lib: vic20-rr-net.o cs8900a.o cs8900adriver.o ethernet.o $(VIC20OBJS)
diff --git a/drivers/a2slot.s b/drivers/a2slot.s
new file mode 100644
index 0000000..62197af
--- /dev/null
+++ b/drivers/a2slot.s
@@ -0,0 +1,47 @@
+.include "zeropage.inc"
+
+.export a2_set_slot
+
+.import eth_driver_io_base
+
+
+.code
+
+; set Apple 2 ethernet adaptor slot
+; inputs:
+; A: slot number (1-7)
+; outputs:
+; none
+a2_set_slot:
+ asl
+ asl
+ asl
+ asl
+ sta tmp1
+
+ lda eth_driver_io_base
+ and #%10001111
+ ora tmp1
+ sta eth_driver_io_base
+ rts
+
+
+
+; -- LICENSE FOR a2slot.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/a2slotcombo.s b/drivers/a2slotcombo.s
new file mode 100644
index 0000000..2193e24
--- /dev/null
+++ b/drivers/a2slotcombo.s
@@ -0,0 +1,59 @@
+.include "zeropage.inc"
+
+.export a2_set_slot
+
+.import _cs8900a_driver_io_base
+.import _lan91c96_driver_io_base
+.import _w5100_driver_io_base
+
+
+.code
+
+; set Apple 2 ethernet adaptor slot
+; inputs:
+; A: slot number (1-7)
+; outputs:
+; none
+a2_set_slot:
+ asl
+ asl
+ asl
+ asl
+ sta tmp1
+
+ lda _cs8900a_driver_io_base
+ and #%10001111
+ ora tmp1
+ sta _cs8900a_driver_io_base
+
+ lda _lan91c96_driver_io_base
+ and #%10001111
+ ora tmp1
+ sta _lan91c96_driver_io_base
+
+ lda _w5100_driver_io_base
+ and #%10001111
+ ora tmp1
+ sta _w5100_driver_io_base
+ rts
+
+
+
+; -- LICENSE FOR a2slotcombo.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 --