ProDOS-8 / ProDOS8-Testing

QA and Testing for ProDOS-8 Releases
MIT License
29 stars 1 forks source link

Prodos8 incorrectly tests for AUX RAM #64

Closed rallepalaveev closed 2 years ago

rallepalaveev commented 2 years ago

TITLE: Prodos8 incorrectly tests for AUX RAM

LABEL: Aux RAM detect

PROJECT: Prodos8 2.4.2

Description

While testing my NVRAM drive project I noticed that the subroutine for establishing 64 or 128 kB RAM is not functioning properly in all cases. The subroutine is at address $25D8 and executed at address $0080.

Expected Behavior

Subroutine should return flag carry set if 64kB only present or flag carry clear if 128kB in the system.

Actual Behavior

Flag carry is returned cleared, even if 64kB only present in the system.

Possible Fix

Changed "OLD CODE" below to "NEW CODE" and it resolved the issue:

OLD CODE: 25D8- A9 EE LDA #$EE 25DA- 8D 05 C0 STA $C005 w:WRCARDRAM 25DD- 8D 03 C0 STA $C003 w:RDCARDRAM 25E0- 8D 00 0C STA $0C00 25E3- 8D 00 08 STA $0800 25E6- AD 00 0C LDA $0C00 25E9- C9 EE CMP #$EE 25EB- D0 0E BNE $25FB 25ED- 0E 00 0C ASL $0C00 25F0- 0A ASL 25F1- CD 00 0C CMP $0C00 25F4- D0 05 BNE $25FB 25F6- CD 00 08 CMP $0800 25F9- D0 03 BNE $25FE 25FB- 38 SEC 25FC- B0 01 BCS $25FF 25FE- 18 CLC 25FF- 8D 04 C0 STA $C004 w:WRMAINRAM 2602- 8D 02 C0 STA $C002 w:RDMAINRAM

NEW CODE: 25D8- A9 55 LDA #$55 25DA- 8D 00 0C STA $0C00 25DD- 8D 05 C0 STA $C005 w:WRCARDRAM 25E0- 8D 03 C0 STA $C003 w:RDCARDRAM 25E3- 0A ASL 25E4- 8D 00 0C STA $0C00 25E7- 8D 04 C0 STA $C004 w:WRMAINRAM 25EA- 8D 02 C0 STA $C002 w:RDMAINRAM 25ED- AD 00 0C LDA $0C00 25F0- C9 55 CMP #$55 25F2- F0 03 BEQ $25F7 25F4- 38 SEC 25F5- B0 01 BCS $25F8 25F7- 18 CLC 25F8- EA NOP 25F9- EA NOP 25FA- EA NOP 25FB- EA NOP 25FC- EA NOP 25FD- EA NOP 25FE- EA NOP 25FF- EA NOP 2600- EA NOP 2601- EA NOP 2602- EA NOP 2603- EA NOP 2604- EA NOP

Steps to Reproduce

  1. Run "OLD CODE" at address $0080 and test carry flag.

Context

I have developed a NVRAM drive card for Apple2 in 2 modifications - 512bB and 4096kB. I noticed that it works properly on machines with 128kB RAM, but ProDOS loads properly and then crashes on 64kB machines. The crash occurs at memory high addresses - $FFxx, which looked like a ProDOS relocation error, affected by the different memory size.

Your Environment

Apple IIe with NVRAM Drive https://github.com/rallepalaveev/nvramcard

Hardware:

Apple IIe with and without 80 Column Card

ProDOS8 version:

2.4.2, but I noticed that the same subroutine is used in 2.5.a8

Non-Operating System release software being used:

None

JohnMBrooks commented 2 years ago

Some questions: 1) Did you test with ProDOS 2.0.3 which was the last version released by Apple? 2) Did you test with the 1K (original 80 column) card and the 64K (extended 80 column) card? 3) Did you test with only Apple hardware (Apple IIe, Apple 80 column card, Apple Disk ][)? 4) How does your NEW CODE differentiate between a 1K card and a 64K card without checking both $0800 and $0C00? 5) Why is NEW CODE comparing main 64K vs aux 64K, unlike Apple's detection routine? If no aux mem card is installed then aux mem reads should return floating bus values, not main 64K data.

rallepalaveev commented 2 years ago

Hi,

Thanks for looking into this.

  1. I only tested with 2.4.2

  2. My card is 128kB with C073 switching of banks. With it all is well. The problem is when the card is not in the system and only 64kB are available.

  3. I tested on a Taiwan and Bulgaria clones.

  4. I agree I have not tested all possible scenarios. $0800 can easily be added.

  5. In my systems when AUX memory is absent the AUX reads and writes access the main memory and not floating bus. However, if the intention of the original hardware is that the system returns floats when AUX RAM missing, then the original code makes much more sense to me. This means that it has to be kept with an addition to check if writes to AUX make changes to the MAIN memory, which would cover cases like mine. I will try to fit this improvement in the same space.