AppleWin / AppleWin

Apple II emulator for Windows
GNU General Public License v2.0
704 stars 162 forks source link

Why doesn't this GPIO Utility DSK work for II or II+ models? #1196

Closed tomcw closed 1 year ago

tomcw commented 1 year ago

Repro:

  1. Configure AppleWin's model as either II or II+
  2. "Y" to run the utility, then you just get a blank screen

GPIO_Brd_v1p0.zip

univta0001 commented 1 year ago

The utility is checking for a card installed at slot 3 with the following code. If the card is not installed, it will loop forever.

269D: LDY #$08 269F: LDA $C305 26A2: CMP $C305 26A5: BNE 269D 26A7: DEY 26A8: BNE 26A2 26AA: RTS

Currently, one way to make in run in Apple ][ is to patch the address 269D with RTS (0x60)

tomcw commented 1 year ago

I see, these get called periodically during the whole runtime of the utility...

266D:  JSR 269D
  :
269C:  JSR 269D

On a //e or enhanced //e, the C3 ROM is switched in at this point, so the reads always return a fixed value. On a II or II+, the default is an empty slot, so it just returns the floating bus.

You'd need to put a card with a $Csxx ROM into slot 3 (eg. SSC, Disk II). AppleWin Config UI currently only supports cards (in slot 3) with I/O at $C080+n*$10 (eg. Uthernet I/II, 4Play, SNESMAX). NB. VidHD does have a ROM at $Csxx, but AppleWin only supports ROM location $Cs00-$Cs02 (for card ID), and floating bus for the remainder!

tomcw commented 1 year ago

Here's the source code for $269D from the source file GPIB10A (on the disk image):

;-Smart Watch (No-Slot-Clock) Read
;The following code is based on
;SMARTWATCH (DS1216E) ROUTINES
;WRITTEN 11/20/87 BY MATTHEW LEE STIER

 :

SW.Clos LDY #8 ;Close SmartWatch
 LDA SW.READ
SW.ClL2 CMP SW.READ
 BNE SW.Clos
 DEY
 BNE SW.ClL2
 RTS

And from GPIB10D:

T.M5 ASC '== Real Time Clock Log ==='
 ASC 'This function requires a  '
 ASC 'No-Slot-Clock installed   '
 ASC 'under the 28-pin CD or CF '
 ASC 'ROM or //c Monitor ROM.   '
 ASC 'Using the NSC we can log  '
 ASC 'when a pushbutton was     '
 ASC 'pressed and released.     '

NB.

tomcw commented 1 year ago
;-No-Slot-clock Yes or No
;Determine if the computer has a No Slot Clock
NSC.Flg DFB 0 ;NSC Flag 0=no 1=yes
NSC.YN JSR SWtime ;Smart Watch time
 LDX #0
 LDA SW.Mth ;get Month Value {1..12}
 BEQ NSC.No ;if 0 then no NSC
 INX
NSC.No STX NSC.Flg ;set flag
 RTS

And...

SWtime JSR SW.Clos ;Reset comparison counter
 :

So the problem is that the NSC detection function NSC.YN calls SWtime which calls SW.Clos which hangs on a II/II+ with an empty slot 3 (or slot 3 with a card that has no ROM at $C3nn).

Closing this as it's a bug in the GPIO Utility code.