When an Apple II/II+ has a card with ROM in slot 3, it always sets the 80-column bit of MACHID.
Expected Behavior
If a terminal card is not identified in slot 3 of an Apple II/II+, the 80-column bit of MACHID should be cleared.
Actual Behavior
If there is any card with ROM in slot 3 of an Apple II/II+, the 80-column bit of MACHID is set. While ProDOS does not identify the card as a terminal card, the Aux RAM test that follows convinces ProDOS that an 80-column mode is available.
Possible Fix
If the MACHID indicates an Apple II/II+, the Aux RAM test should be skipped or qualified. However, could this be an issue for the VidHD? Does it pass the terminal card identification test? Or does it rely on passing the Aux RAM test?
Steps to Reproduce
Place any card with ROM in slot 3 of an Apple II+ and boot ProDOS 2.4.3. Check MACHID ($BF98) and observe that it is $62 instead of the expected $60 when the card is not an 80-column card.
This is the relevant section of code in ProDOS 2.4.3:
; PROLDR.S
isromin3:
;*
;* we've seen a rom in slot 3. is it an external, identifiable
;* 80-col card with interrupt routines? if so, enable it. if not,
;* switch in the internal $c300 firmware.
;*
2208 : 8D 0B C0 : STA $C00B SETC3ROM ;switch in slot 3 rom
220B : AD 05 C3 : LDA $C305 ;1st generic terminal card id byte
220E : C9 38 : CMP #$38
2210 : D0 23 : BNE $2235 hitswtch ;branch if not a terminal card.
2212 : AD 07 C3 : LDA $C307 ;2nd generic terminal card id byte
2215 : C9 18 : CMP #$18
2217 : D0 1C : BNE $2235 hitswtch ;branch if not a terminal card.
2219 : AD 0B C3 : LDA $C30B ;3rd generic terminal card id byte
221C : C9 01 : CMP #$01
221E : D0 15 : BNE $2235 hitswtch ;branch if not a terminal card.
2220 : AD 0C C3 : LDA $C30C ;is it an apple 80-col card compatible?
2223 : 29 F0 : AND #$F0 ;mask off lo nibble
2225 : C9 80 : CMP #$80 ; and check for $8n
2227 : D0 0C : BNE $2235 hitswtch ;branch if not an 80-col card.
2229 : AD 98 BF : LDA $BF98 machid ;get the machine id
222C : 10 34 : BPL $2262 docard ;branch if II/II+
222E : AD FA C3 : LDA $C3FA ;check for interrupt handler routine
2231 : C9 2C : CMP #$2C ; in the magic $c3fa spot.
2233 : F0 2D : BEQ $2262 docard ;branch if interrupt handler is there!
hitswtch:
;*
;* verify that the card in the aux slot is actually there.
;*
2235 : 8D 0A C0 : STA $C00A CLRC3ROM ;internal $c300 rom
2238 : 8D 01 C0 : STA $C001 SET80STOR ;80-store
223B : 8D 55 C0 : STA $C055 SETPAGE2 ;page2
223E : A9 EE : LDA #$EE
2240 : 8D 78 04 : STA $0478
2243 : 0A : ASL A
2244 : 0E 78 04 : ASL $0478
2247 : CD 78 04 : CMP $0478
224A : D0 07 : BNE $2253 maybe ;branch if not there
224C : 4A : LSR A
224D : 4E 78 04 : LSR $0478
2250 : CD 78 04 : CMP $0478
maybe:
2253 : 8D 54 C0 : STA $C054 CLRPAGE2 ;main memory
2256 : 8D 00 C0 : STA $C000 CLR80STOR ;80-store off
2259 : F0 07 : BEQ $2262 docard ;branch if card is there
225B : AD 98 BF : LDA $BF98 ;get machine id byte
225E : 29 FD : AND #$FD ;mask off 80-col bit
2260 : D0 05 : BNE $2267 docard1 ;always..
;*
;* ok, the card's good. leave it enabled and update the machid.
;*
docard:
2262 : AD 98 BF : LDA $BF98 ;get machine id byte
2265 : 09 02 : ORA #$02 ;turn bit 2 on to show 80-col card
docard1:
2267 : 8D 98 BF : STA $BF98
This is the execution of the code. It appears to ProDOS that Aux RAM exists in an Apple II/II+ and it asserts the 80-column bit of MACHID.
The initial MACHID 80-column reporting bug was discovered by Oliver Schmidt through AppleWin's emulated Uthernet II card. I produced the same bug with AppleWin's emulated VidHD card. I found and fixed the bug in AppleWin's Uthernet II emulation that exposed the problem. I confirmed the MACHID bug in another emulator with a Disk II FDC in slot 3. I later confirmed it in a real Apple II+ with a Super Serial Card in slot 3. AppleWin's VidHD issues are complicated and beyond the scope of this report.
Your Environment
Hardware:
AppleWin 1.30.19 emulating an Apple II+ with either an Uthernet II or a VidHD installed in slot 3.
Personal emulator emulating an Apple II+ with a Disk II FDC in slot 3.
Description
When an Apple II/II+ has a card with ROM in slot 3, it always sets the 80-column bit of MACHID.
Expected Behavior
If a terminal card is not identified in slot 3 of an Apple II/II+, the 80-column bit of MACHID should be cleared.
Actual Behavior
If there is any card with ROM in slot 3 of an Apple II/II+, the 80-column bit of MACHID is set. While ProDOS does not identify the card as a terminal card, the Aux RAM test that follows convinces ProDOS that an 80-column mode is available.
Possible Fix
If the MACHID indicates an Apple II/II+, the Aux RAM test should be skipped or qualified. However, could this be an issue for the VidHD? Does it pass the terminal card identification test? Or does it rely on passing the Aux RAM test?
Steps to Reproduce
Place any card with ROM in slot 3 of an Apple II+ and boot ProDOS 2.4.3. Check MACHID ($BF98) and observe that it is $62 instead of the expected $60 when the card is not an 80-column card.
This is the relevant section of code in ProDOS 2.4.3:
This is the execution of the code. It appears to ProDOS that Aux RAM exists in an Apple II/II+ and it asserts the 80-column bit of MACHID.
Context
The initial MACHID 80-column reporting bug was discovered by Oliver Schmidt through AppleWin's emulated Uthernet II card. I produced the same bug with AppleWin's emulated VidHD card. I found and fixed the bug in AppleWin's Uthernet II emulation that exposed the problem. I confirmed the MACHID bug in another emulator with a Disk II FDC in slot 3. I later confirmed it in a real Apple II+ with a Super Serial Card in slot 3. AppleWin's VidHD issues are complicated and beyond the scope of this report.
Your Environment
Hardware:
ProDOS8 version:
P8 2.4.3
Non-Operating System release software being used: