Added support for loading programs from Apple-1 Cartridge

This commit is contained in:
flowenol 2021-01-28 23:28:59 +01:00
parent a1e942851f
commit 943d2298f4
4 changed files with 78 additions and 6 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
*.bin
*.o
*.label

View File

@ -1,7 +1,8 @@
AFLAGS =
LFLAGS = -C apple1cartridge.cfg
AFLAGS = -g
LFLAGS = -C apple1cartridge.cfg -Ln applesoft-lite.label
BINFILE = applesoft-lite.bin
OBJS = applesoft-lite.o io.o apple1serial.o
LABELS = applesoft-lite.label
$(BINFILE): $(OBJS)
ld65 $(LFLAGS) $(OBJS) -o $(BINFILE)
@ -19,4 +20,4 @@ io.o: io.s
ca65 $(AFLAGS) $<
clean:
rm $(OBJS) $(BINFILE)
rm $(OBJS) $(BINFILE) $(LABELS)

View File

@ -6,12 +6,19 @@ See https://cowgod.org/replica1/applesoft/
# apple1serial
This branch has been modified to perform LOAD and SAVE operations via Apple-1 Serial interface
https://github.com/flowenol/apple1serial
This fork has been modified to perform LOAD and SAVE operations via Apple-1 Serial interface.
See https://github.com/flowenol/apple1serial
# How to use LOAD?
The LOAD command implemented on this branch takes as an argument the length of the program
as a decimal value, e.g.,
]LOAD 1024
`]LOAD 1024`
# apple1cartridge
This fork has been modified to allow loading programs from Apple-1 RAM/ROM Cartridge via the `STARTFROMCART` routine.
See https://github.com/flowenol/apple1cartridge

View File

@ -602,6 +602,8 @@ FIX_LINKS:
jmp RESTART
@2: ldy #4 ; FIND END OF THIS LINE
@3: iny ; (NOTE MAXIMUM LENGTH < 256)
;lda #'C'
;jsr OUTDO
lda (INDEX),y
bne @3
iny ; COMPUTE ADDRESS OF NEXT LINE
@ -5498,3 +5500,64 @@ RESUME: lda ERRLIN ; RESTORE LINE # AND TXTPTR
ldx ERRSTK ; RETRIEVE STACK PNTR AS IT WAS
txs ; BEFORE STATEMENT SCANNED
jmp NEWSTT ; DO STATEMENT AGAIN
; ----------------------------------------------------------------------------
; START FROM CARTRIDGE ROUTINE
; ----------------------------------------------------------------------------
STARTFROMCART:
ldx #$FF ; SET DIRECT MODE FLAG
stx CURLIN+1
ldx #$FB ; SET STACK POINTER, LEAVING ROOM FOR
txs ; LINE BUFFER DURING PARSING
lda #<COLDSTART ; SET RESTART TO COLD.START
ldy #>COLDSTART ; UNTIL COLDSTART IS COMPLETED
sta GOWARM+1
sty GOWARM+2
sta GOSTROUTZ+1 ; ALSO SECOND USER VECTOR...
sty GOSTROUTZ+2 ; ..WE SIMPLY MUST FINISH COLD.START!
lda #$4C ; "JMP" OPCODE FOR 4 VECTORS
sta GOWARM ; WARM START
sta GOSTROUTZ ; ANYONE EVER USE THIS ONE?
sta JMPADRS ; USED BY FUNCTIONS (JSR JMPADRS)
; ----------------------------------------------------------------------------
; MOVE GENERIC CHRGET AND RANDOM SEED INTO PLACE
;
; NOTE THAT LOOP VALUE IS WRONG!
; THE LAST BYTE OF THE RANDOM SEED IS NOT
; COPIED INTO PAGE ZERO!
; ----------------------------------------------------------------------------
ldx #GENERIC_END-GENERIC_CHRGET-1
@1: lda GENERIC_CHRGET-1,x
sta CHRGET-1,x
dex
bne @1
; ----------------------------------------------------------------------------
txa ; A=0
sta SHIFTSIGNEXT
sta LASTPT+1
pha ; PUT $00 ON STACK (WHAT FOR?)
lda #3 ; SET LENGTH OF TEMP. STRING DESCRIPTORS
sta DSCLEN ; FOR GARBAGE COLLECTION SUBROUTINE
jsr CRDO ; PRINT <RETURN>
lda #1 ; SET UP FAKE FORWARD LINK
sta INPUTBUFFER-3
sta INPUTBUFFER-4
ldx #TEMPST ; INIT INDEX TO TEMP STRING DESCRIPTORS
stx TEMPPT
jsr STXTPT ; SET TXTPTR TO TXTTAB-1
ldy #0
lda #0
sta (TXTPTR),y ; ZERO THE TXTPTR - FOR SAKE OF RUN STATEMENT
lda #<STROUT ; PUT CORRECT ADDRESSES IN TWO
ldy #>STROUT ; USER VECTORS
sta GOSTROUTZ+1
sty GOSTROUTZ+2
lda #<RESTART
ldy #>RESTART
sta GOWARM+1
sty GOWARM+2
lda #$00
sta CURLIN
sta CURLIN+1
jmp FIX_LINKS ; FIX LINKS FOR PROGRAM