From a89a311abfda385b1c1a9a0bb654180681c23d74 Mon Sep 17 00:00:00 2001 From: Colin Leroy-Mira Date: Wed, 30 Aug 2023 20:51:48 +0200 Subject: [PATCH] Serial: Micro-optimisation for apple2enh On 65C02 we can spare one cycle on sta (abs); we also not have to care about the 6502 false reads --- libsrc/apple2/ser/a2.ssc.s | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/libsrc/apple2/ser/a2.ssc.s b/libsrc/apple2/ser/a2.ssc.s index 7705f0933..12e975965 100644 --- a/libsrc/apple2/ser/a2.ssc.s +++ b/libsrc/apple2/ser/a2.ssc.s @@ -26,6 +26,7 @@ .include "ser-error.inc" .macpack module + .macpack cpu ; ------------------------------------------------------------------------ ; Header. Includes jump table @@ -57,9 +58,13 @@ ;---------------------------------------------------------------------------- ; I/O definitions +.if (.cpu .bitand CPU_ISET_65C02) +ACIA = $C088 +.else Offset = $8F ; Move 6502 false read out of I/O to page $BF - ACIA = $C088-Offset +.endif + ACIA_DATA = ACIA+0 ; Data register ACIA_STATUS = ACIA+1 ; Status register ACIA_CMD = ACIA+2 ; Command register @@ -200,7 +205,9 @@ SER_OPEN: asl asl asl +.if .not (.cpu .bitand CPU_ISET_65C02) adc #Offset ; Assume carry to be clear +.endif tax ; Check if the handshake setting is valid @@ -315,7 +322,11 @@ SER_GET: inc RecvHead inc RecvFreeCnt ldx #$00 ; (59) +.if (.cpu .bitand CPU_ISET_65C02) + sta (ptr1) +.else sta (ptr1,x) +.endif txa ; Return code = 0 rts