Added support for alternative memory locations of Apple-1 Serial Interface Card

This commit is contained in:
flowenol 2023-01-15 02:40:58 +01:00
parent 943d2298f4
commit 3e759e4d21
2 changed files with 64 additions and 18 deletions

View File

@ -1,5 +1,5 @@
MEMORY {
BASROM: start = $6000, size = $2000, fill = yes, file = %O;
BASROM: start = $6000, size = $200A, fill = yes, file = %O;
}
SEGMENTS {

View File

@ -7,11 +7,20 @@
.import ERROR, FIX_LINKS, OUTDO
.export SerialLoad, SerialSave, SerialMenu
SERIAL_MONITOR := $C100
SERIAL_READY := $C000
SERIAL_ID := $C0FC
SERIAL_API_READ := $C1EC
SERIAL_API_WRITE := $C213
SERIAL_MONITOR_C000 := $C100
SERIAL_READY_C000 := $C000
SERIAL_ID_C000 := $C0FC
SERIAL_API_READ_C000 := $C1EC
SERIAL_API_WRITE_C000 := $C213
SERIAL_MONITOR_C300 := $C400
SERIAL_READY_C300 := $C300
SERIAL_ID_C300 := $C3FC
SERIAL_API_READ_C300 := $C4EC
SERIAL_API_WRITE_C300 := $C513
; 0 - $C000, 1 - $C300
SERIAL_VARIANT := $40
; ZP locations get backed up here
ZPTemp := $0380
@ -34,18 +43,37 @@ STR2INT_END := $0A
; See if Apple-1 Serial Interface card is present and display error if not
; ----------------------------------------------------------------------------
CheckSerial:
ldy SERIAL_ID
ldy SERIAL_ID_C000
cpy #'A'
bne @1
ldy SERIAL_ID_C000 + 1
cpy #'1'
bne @1
ldy SERIAL_ID_C000 + 2
cpy #'S'
bne @1
ldy SERIAL_ID_C000 + 3
cpy #'I'
bne @1
lda #$00
sta SERIAL_VARIANT
rts
@1:
ldy SERIAL_ID_C300
cpy #'A'
bne SerialErr
ldy SERIAL_ID + 1
ldy SERIAL_ID_C300 + 1
cpy #'1'
bne SerialErr
ldy SERIAL_ID + 2
ldy SERIAL_ID_C300 + 2
cpy #'S'
bne SerialErr
ldy SERIAL_ID + 3
ldy SERIAL_ID_C300 + 3
cpy #'I'
bne SerialErr
lda #$01
sta SERIAL_VARIANT
rts
SerialErr:
@ -61,8 +89,13 @@ SynErr:
; ----------------------------------------------------------------------------
SerialMenu:
jsr CheckSerial
jsr SERIAL_MONITOR
lda SERIAL_VARIANT
bne SerialMenuAlt
jsr SERIAL_MONITOR_C000
rts
SerialMenuAlt:
jsr SERIAL_MONITOR_C300
rts
; ----------------------------------------------------------------------------
; Save program via the Apple-1 Serial Interface
@ -87,10 +120,15 @@ SerialSave:
lda TXTTAB+1
sta BEG_ADDR_H
jsr SERIAL_API_WRITE
lda SERIAL_VARIANT
bne @2
jsr SERIAL_API_WRITE_C000
jmp @3
@2:
jsr SERIAL_API_WRITE_C300
@3:
jsr RestoreZPForSave ; Put the zero page back
rts
; ----------------------------------------------------------------------------
; Restores the 4 bytes of the ZP which were saved during SerialSave
; ----------------------------------------------------------------------------
@ -137,15 +175,17 @@ GetLength: ; Get file name from input line
@2:
cpy #0 ; Read 6 chars or EOL, did we get anything?
beq SynErr
bne @3
jmp SynErr
@3:
lda #STR2INT_END ; append integer string end marker
sta STR2INT_BUF,y
jsr String2Int
lda STR2INT_INT
bne @3
bne @4
dec STR2INT_INT+1
@3:
@4:
dec STR2INT_INT
clc
SetLoadAddresses:
@ -164,7 +204,13 @@ SetLoadAddresses:
lda TXTTAB+1
sta BEG_ADDR_H
jsr SERIAL_API_READ
lda SERIAL_VARIANT
bne @1
jsr SERIAL_API_READ_C000
jmp @2
@1:
jsr SERIAL_API_READ_C300
@2:
jsr RestoreZPForLoad ; Put the zero page back
jmp FIX_LINKS