From ae5cb754fb9540794bdb5465a77e1263ca257539 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Mon, 8 Aug 2022 15:09:42 +0200 Subject: [PATCH] Avoid unwanted i/o access. Depending on the 6502, LDA addr,X and/or STA addr,X produce additional phantom reads. In order to avoid those phantom reads to do i/o access, I used the "classic" approach of moving those reads from page $C0 to page $BF. --- Apple2/RPi.Command.asm | 18 ++++++++++++------ Apple2/Shell.asm | 17 +++++++++++------ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/Apple2/RPi.Command.asm b/Apple2/RPi.Command.asm index 56316e7..b5e1db9 100644 --- a/Apple2/RPi.Command.asm +++ b/Apple2/RPi.Command.asm @@ -17,10 +17,15 @@ XLEN = $BE52 ;length of command string-1. XCNUM = $BE53 ;CI cmd no. (ext cmd - 0). PBITS = $BE54 ;Command parameter bits. XRETURN = $FF58 ;Known RTS instruction. -InputByte = $c08e -OutputByte = $c08d -InputFlags = $c08b -OutputFlags = $c087 + +; have 6502 absolute indexed access phantom reads +; happen on page $bf to avoid unwanted i/o access +IndexOffset = $8f + +InputByte = $c08e - IndexOffset +OutputByte = $c08d - IndexOffset +InputFlags = $c08b - IndexOffset +OutputFlags = $c087 - IndexOffset ReadBlockCommand = $01 WriteBlockCommand = $02 @@ -76,9 +81,10 @@ DetectSlot: asl asl asl - tax clc - bcc Start + adc #IndexOffset + tax + bcc Start ;always nextSlot: dex bne DetectSlot diff --git a/Apple2/Shell.asm b/Apple2/Shell.asm index 7a613b3..67cd253 100755 --- a/Apple2/Shell.asm +++ b/Apple2/Shell.asm @@ -19,10 +19,14 @@ IOError = $27 NoDevice = $28 WriteProtect = $2B -InputByte = $c08e -OutputByte = $c08d -InputFlags = $c08b -OutputFlags = $c087 +; have 6502 absolute indexed access phantom reads +; happen on page $bf to avoid unwanted i/o access +IndexOffset = $8f + +InputByte = $c08e - IndexOffset +OutputByte = $c08d - IndexOffset +InputFlags = $c08b - IndexOffset +OutputFlags = $c087 - IndexOffset ResetCommand = $00 ReadBlockCommand = $01 @@ -85,9 +89,10 @@ DetectSlot: asl asl asl - tax clc - bcc Init + adc #IndexOffset + tax + bcc Init ;always nextSlot: dex bne DetectSlot