From 38f7daf40e13696cf5db56874a8fee38ce76db8a Mon Sep 17 00:00:00 2001 From: Colin Leroy-Mira Date: Sun, 10 Sep 2023 21:13:27 +0200 Subject: [PATCH] Make sure not to load ACIA driver on IIgs' Z8530 The Pascal Firmware Protocol Bytes ID are not enough to differentiate an SSC card from a IIgs serial firmware: http://www.1000bit.it/support/manuali/apple/technotes/misc/tn.misc.08.html Loading a2(e).ssc.ser on a IIgs succeeds, then goes to limbo when one tries to use the serial port. Check first byte on the slot's firmware in addition to the four existing ones, as it's supposed to be $2C (BIT instruction) on an SSC card, and $EF (65C816 SEP instruction) on the IIgs' serial firmware (ROM revisions 0, 1, 3). --- libsrc/apple2/ser/a2.ssc.s | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/libsrc/apple2/ser/a2.ssc.s b/libsrc/apple2/ser/a2.ssc.s index 5942d43e9..b58afb7d0 100644 --- a/libsrc/apple2/ser/a2.ssc.s +++ b/libsrc/apple2/ser/a2.ssc.s @@ -132,16 +132,33 @@ ParityTable: .byte $60 ; SER_PAR_EVEN .byte $A0 ; SER_PAR_MARK .byte $E0 ; SER_PAR_SPACE + + ; (*): The first byte we'll check at offset 0 is + ; expected to be a BIT instruction on any Apple2 + ; machine with an ACIA 6551, including the //c + ; and //c+. + ; The IIgs, on the other hand, has a + ; Zilog Z8530 chip and its firmware starts with + ; a SEP instruction. We don't want to load this + ; driver on the IIgs' serial port. + ; + ; The next four bytes we check are the Pascal + ; Firmware Protocol Bytes that identify a + ; serial card. + IdOfsTable: + .byte $00 ; First instruction .byte $05 ; Pascal 1.0 ID byte .byte $07 ; Pascal 1.0 ID byte .byte $0B ; Pascal 1.1 generic signature byte .byte $0C ; Device signature byte IdValTable: - .byte $38 ; Fixed - .byte $18 ; Fixed - .byte $01 ; Fixed - .byte $31 ; Serial or parallel I/O card type 1 + .byte $2C ; BIT + .byte $38 ; ID Byte 0 (from Pascal 1.0), fixed + .byte $18 ; ID Byte 1 (from Pascal 1.0), fixed + .byte $01 ; Generic signature for Pascal 1.1, fixed + .byte $31 ; Device signature byte (serial or + ; parallel I/O card type 1) IdTableLen = * - IdValTable