From ddad73176b077cebe081c92ddea7ad551c71733e Mon Sep 17 00:00:00 2001 From: arbee Date: Tue, 22 Sep 2020 21:54:33 -0400 Subject: [PATCH] apple2: Sider updates [Peter Ferrie, R. Belmont] - Renamed cards. The card we were calling "Xebec" was actually the Sider 1, which used 256 byte blocks and a special on-disk format. - Removed ROM patches for the Sider 1 card. - Included source of short program to convert standard disk images to Sider 2 format. --- src/devices/bus/a2bus/sider.cpp | 101 +++++++++++++++++++------------- src/devices/bus/a2bus/sider.h | 18 ++---- src/mame/drivers/apple2e.cpp | 4 +- src/mame/drivers/apple2gs.cpp | 4 +- 4 files changed, 70 insertions(+), 57 deletions(-) diff --git a/src/devices/bus/a2bus/sider.cpp b/src/devices/bus/a2bus/sider.cpp index 97826b9b3d5..93d8a50350f 100644 --- a/src/devices/bus/a2bus/sider.cpp +++ b/src/devices/bus/a2bus/sider.cpp @@ -4,10 +4,55 @@ sider.cpp - Implementation of the First Class Peripherals / Advanced Tech Services / Xebec SASI Card + Implementation of the First Class Peripherals / Advanced Tech Services / Xebec Sider cards - The original card was by Xebec; the Sider's relationship with Xebec is not clear, but - the Sider version of the firmware is quite different (and much more compact). + Sider 1: based on Xebec SASI hardware, with Xebec firmware. Requires HDD with 256 byte sectors + and special formatting - not compatible with standard .po/.hdv type images. + + Sider 2: Same hardware, new firmware that's fully ProDOS compliant including 512 byte sectors. + Sectors are interleaved: the first byte is the byte that would be at 0, the second byte is the byte that would be at $100, + the third is the byte at $1, the fourth at $101, and so on. So this is also not compatible with standard images. + + This command-line program will convert a standard image to work with Sider 2. First parameter is the input filename, + second parameter is the output filename. No error checking is done, if the input file doesn't exist it'll probably crash. + + #include + #include + #include + + static char block[512]; + static char blockout[512]; + + int main(int argc, char *argv[]) + { + FILE *in, *out; + + in = fopen(argv[1], "rb"); + out = fopen(argv[2], "wb"); + + int len = 0; + fseek(in, 0, SEEK_END); + len = ftell(in); + fseek(in, 0, SEEK_SET); + + for (int bnum = 0; bnum < (len / 512); bnum++) + { + fread(block, 512, 1, in); + for (int byte = 0; byte < 256; byte++) + { + blockout[byte*2] = block[byte]; + blockout[(byte*2)+1] = block[byte+256]; + } + fwrite(blockout, 512, 1, out); + printf("block %d\n", bnum); + } + + fclose(out); + fclose(in); + return 0; + } + + -------------------------------------- $C0(n+8)X space: $0: read state / write latch @@ -41,17 +86,17 @@ // GLOBAL VARIABLES //************************************************************************** -DEFINE_DEVICE_TYPE(A2BUS_SIDER, a2bus_sidercard_device, "a2sider", "First Class Peripherals Sider SASI Card") -DEFINE_DEVICE_TYPE(A2BUS_XEBEC, a2bus_xebeccard_device, "a2xebec", "Xebec SASI Card") +DEFINE_DEVICE_TYPE(A2BUS_SIDER2, a2bus_sider2card_device, "a2sider2", "First Class Peripherals Sider 2 SASI Card") +DEFINE_DEVICE_TYPE(A2BUS_SIDER1, a2bus_sider1card_device, "a2sider1", "First Class Peripherals Sider 1 SASI Card") #define SASI_ROM_REGION "sasi_rom" -ROM_START( sider ) +ROM_START( sider2 ) ROM_REGION(0x800, SASI_ROM_REGION, 0) ROM_LOAD( "atsv22_a02a9baad2262a8a49ecea843f602124.bin", 0x000000, 0x000800, CRC(97773a0b) SHA1(8d0a5d6ce3b9a236771126033c4aba6c0cc5e704) ) ROM_END -ROM_START( xebec ) +ROM_START( sider1 ) ROM_REGION(0x800, SASI_ROM_REGION, 0) ROM_LOAD( "xebec-103684c-1986.bin", 0x000000, 0x000800, CRC(9e62e15f) SHA1(7f50b5e00cac4960204f50448a6e2d623b1a41e2) ) ROM_END @@ -81,14 +126,14 @@ void a2bus_sider_device::device_add_mconfig(machine_config &config) // rom_region - device-specific ROM region //------------------------------------------------- -const tiny_rom_entry *a2bus_sidercard_device::device_rom_region() const +const tiny_rom_entry *a2bus_sider2card_device::device_rom_region() const { - return ROM_NAME( sider ); + return ROM_NAME( sider2 ); } -const tiny_rom_entry *a2bus_xebeccard_device::device_rom_region() const +const tiny_rom_entry *a2bus_sider1card_device::device_rom_region() const { - return ROM_NAME( xebec ); + return ROM_NAME( sider1 ); } //************************************************************************** @@ -106,13 +151,13 @@ a2bus_sider_device::a2bus_sider_device(const machine_config &mconfig, device_typ { } -a2bus_sidercard_device::a2bus_sidercard_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - a2bus_sider_device(mconfig, A2BUS_SIDER, tag, owner, clock) +a2bus_sider2card_device::a2bus_sider2card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + a2bus_sider_device(mconfig, A2BUS_SIDER2, tag, owner, clock) { } -a2bus_xebeccard_device::a2bus_xebeccard_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - a2bus_sider_device(mconfig, A2BUS_XEBEC, tag, owner, clock) +a2bus_sider1card_device::a2bus_sider1card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + a2bus_sider_device(mconfig, A2BUS_SIDER1, tag, owner, clock) { } @@ -132,32 +177,6 @@ void a2bus_sider_device::device_reset() m_control = 0; } -void a2bus_xebeccard_device::device_start() -{ - a2bus_sider_device::device_start(); - - m_rom[0x42] = 0x01; // correct boot block jump to $801 - m_rom[0x492] = 0x01; // correct ProDOS READ_BLOCK to read one block, not two - m_rom[0x497] = 0xea; // fix various weird stuff done to the READ_BLOCK parameters - m_rom[0x498] = 0xea; - m_rom[0x499] = 0xea; - m_rom[0x49a] = 0xea; - m_rom[0x49b] = 0xea; - m_rom[0x49c] = 0xea; - m_rom[0x4b4] = 0xea; - m_rom[0x4b5] = 0xea; - m_rom[0x4b9] = 0xea; - m_rom[0x4ba] = 0xea; - m_rom[0x4bf] = 0xea; - m_rom[0x4c0] = 0xea; - m_rom[0x4c7] = 0xea; - m_rom[0x4c8] = 0xea; - m_rom[0x4c9] = 0xea; - m_rom[0x4ca] = 0xea; - m_rom[0x4cb] = 0xea; - m_rom[0x4cc] = 0xea; -} - /*------------------------------------------------- read_c0nx - called for reads from this card's c0nx space -------------------------------------------------*/ diff --git a/src/devices/bus/a2bus/sider.h b/src/devices/bus/a2bus/sider.h index 36452c6d3e1..6bb5ed3c036 100644 --- a/src/devices/bus/a2bus/sider.h +++ b/src/devices/bus/a2bus/sider.h @@ -50,28 +50,22 @@ private: u8 m_control; }; -class a2bus_sidercard_device: public a2bus_sider_device +class a2bus_sider2card_device: public a2bus_sider_device { public: - a2bus_sidercard_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + a2bus_sider2card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual const tiny_rom_entry *device_rom_region() const override; }; -class a2bus_xebeccard_device: public a2bus_sider_device +class a2bus_sider1card_device: public a2bus_sider_device { public: - a2bus_xebeccard_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + a2bus_sider1card_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual const tiny_rom_entry *device_rom_region() const override; - - // the Xebec version of the firmware doesn't work; it appears to have some bytes corrupted. - static constexpr feature_type unemulated_features() { return feature::DISK; } - -protected: - virtual void device_start() override; }; // device type definition -DECLARE_DEVICE_TYPE(A2BUS_SIDER, a2bus_sidercard_device) -DECLARE_DEVICE_TYPE(A2BUS_XEBEC, a2bus_xebeccard_device) +DECLARE_DEVICE_TYPE(A2BUS_SIDER2, a2bus_sider2card_device) +DECLARE_DEVICE_TYPE(A2BUS_SIDER1, a2bus_sider1card_device) #endif // MAME_BUS_A2BUS_SIDER_H diff --git a/src/mame/drivers/apple2e.cpp b/src/mame/drivers/apple2e.cpp index 68b3afa9dd6..6b304075b2a 100644 --- a/src/mame/drivers/apple2e.cpp +++ b/src/mame/drivers/apple2e.cpp @@ -4503,8 +4503,8 @@ static void apple2_cards(device_slot_interface &device) device.option_add("byte8251", A2BUS_BYTE8251); /* BYTE Magazine 8251 serial card */ device.option_add("cmsscsi", A2BUS_CMSSCSI); /* CMS Apple II SCSI Card */ device.option_add("uthernet", A2BUS_UTHERNET); /* A2RetroSystems Uthernet card */ - device.option_add("sider", A2BUS_SIDER); /* First Class Peripherals / Advanced Tech Systems Sider SASI card */ - device.option_add("xebec", A2BUS_XEBEC); /* Xebec SASI card */ + device.option_add("sider2", A2BUS_SIDER2); /* Advanced Tech Systems / First Class Peripherals Sider 2 SASI card */ + device.option_add("sider1", A2BUS_SIDER1); /* Advanced Tech Systems / First Class Peripherals Sider 1 SASI card */ } static void apple2eaux_cards(device_slot_interface &device) diff --git a/src/mame/drivers/apple2gs.cpp b/src/mame/drivers/apple2gs.cpp index 464133ef4b4..6fba7c03c29 100644 --- a/src/mame/drivers/apple2gs.cpp +++ b/src/mame/drivers/apple2gs.cpp @@ -4583,8 +4583,8 @@ static void apple2_cards(device_slot_interface &device) // device.option_add("ramfast", A2BUS_RAMFAST); /* C.V. Technologies RAMFast SCSI card */ device.option_add("cmsscsi", A2BUS_CMSSCSI); /* CMS Apple II SCSI Card */ device.option_add("uthernet", A2BUS_UTHERNET); /* A2RetroSystems Uthernet card */ - device.option_add("sider", A2BUS_SIDER); /* Advanced Tech Systems / First Class Peripherals Sider SASI card */ - device.option_add("xebec", A2BUS_XEBEC); /* Xebec SASI card */ + device.option_add("sider2", A2BUS_SIDER2); /* Advanced Tech Systems / First Class Peripherals Sider 2 SASI card */ + device.option_add("sider1", A2BUS_SIDER1); /* Advanced Tech Systems / First Class Peripherals Sider 1 SASI card */ } void apple2gs_state::apple2gs(machine_config &config)