From 0b281a93f9d1c1cf7af52d52d786ba8dd4a69c73 Mon Sep 17 00:00:00 2001 From: Terence Boldt Date: Fri, 2 Jul 2021 07:55:24 -0400 Subject: [PATCH] Add basic source from drive image --- Apple2/Exec.Command.bas | 48 ++++++++++++++++++++++++++++++++++ Apple2/Load.File..bas | 58 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 Apple2/Exec.Command.bas create mode 100644 Apple2/Load.File..bas diff --git a/Apple2/Exec.Command.bas b/Apple2/Exec.Command.bas new file mode 100644 index 0000000..7eecd97 --- /dev/null +++ b/Apple2/Exec.Command.bas @@ -0,0 +1,48 @@ +1000 PRINT "Slot number? " +1010 INPUT S +1015 REM Set up InputByte, OutputByte, InputFlags and OutputFlags +1020 IB = 49294 + S * 16 +1030 OB = 49293 + S * 16 +1040 FI = 49291 + S * 16 +1050 OF = 49287 + S * 16 +1060 POKE OF,15: REM set to bank zero with flags high +1070 GOSUB 2000 +1999 END +2000 REM Execute Command +2010 PRINT "$"; +2020 INPUT CM$ +2030 A = 5: GOSUB 8000: REM ExecCommand +2040 FOR X = 1 TO LEN (CM$) +2050 A = ASC ( MID$ (CM$,X,1)) +2060 GOSUB 8000 +2070 NEXT +2080 A = 0: GOSUB 8000 +2100 GOSUB 9000 +2101 PRINT CHR$ (A); +2110 IF A = 0 THEN RETURN +2130 GOTO 2100 +7000 REM Get Flags +7010 F = PEEK (FI) +7020 RF = 0 +7025 WF = 0 +7030 IF F > 128 THEN WF = 1:F = F - 128 +7040 IF F > 64 THEN RF = 1 +7050 RETURN +8000 REM Send Byte +8010 GOSUB 7000: REM Wait for read flag low +8020 IF RF = 1 THEN GOTO 8010 +8030 POKE OB,A +8040 POKE OF,14: REM Set write flag low +8050 GOSUB 7000: REM Wait for read flag high +8060 IF RF = 0 GOTO 8050 +8070 POKE OF,15: REM Set flags high +8080 RETURN +9000 REM Get Byte +9010 POKE OF,13: REM Set read flag low +9020 GOSUB 7000: REM Wait for write flag low +9030 IF WF = 1 THEN GOTO 9020 +9040 A = PEEK (IB) +9050 POKE OF,15: REM Set flags high +9060 GOSUB 7000: REM Wait for write flag high +9070 IF WF = 0 THEN GOTO 9060 +9080 RETURN diff --git a/Apple2/Load.File..bas b/Apple2/Load.File..bas new file mode 100644 index 0000000..5777d2f --- /dev/null +++ b/Apple2/Load.File..bas @@ -0,0 +1,58 @@ +1000 PRINT "Slot number? " +1010 INPUT S +1015 REM Set up InputByte, OutputByte, InputFlags and OutputFlags +1020 IB = 49294 + S * 16 +1030 OB = 49293 + S * 16 +1040 FI = 49291 + S * 16 +1050 OF = 49287 + S * 16 +1060 POKE OF,15: REM set to bank zero with flags high +1070 GOSUB 2000 +1999 END +2000 REM Load File +2010 PRINT "Filename to load: "; +2020 INPUT CM$ +2030 A = 6: GOSUB 8000: REM LoadFileCommand +2040 FOR X = 1 TO LEN (CM$) +2050 A = ASC ( MID$ (CM$,X,1)) +2060 GOSUB 8000 +2070 NEXT +2080 A = 0: GOSUB 8000 +2100 GOSUB 9000 +2110 LO = A +2120 GOSUB 9000 +2130 HI = A +2140 FS = HI * 256 + LO +2150 PRINT "FileSize: "FS +2155 AD = 8192 +2160 FOR X = 0 TO FS - 1 +2170 GOSUB 9000 +2180 PRINT "."; +2185 POKE AD,A +2186 AD = AD + 1 +2190 NEXT +2200 RETURN +7000 REM Get Flags +7010 F = PEEK (FI) +7020 RF = 0 +7025 WF = 0 +7030 IF F > 128 THEN WF = 1:F = F - 128 +7040 IF F > 64 THEN RF = 1 +7050 RETURN +8000 REM Send Byte +8010 GOSUB 7000: REM Wait for read flag low +8020 IF RF = 1 THEN GOTO 8010 +8030 POKE OB,A +8040 POKE OF,14: REM Set write flag low +8050 GOSUB 7000: REM Wait for read flag high +8060 IF RF = 0 GOTO 8050 +8070 POKE OF,15: REM Set flags high +8080 RETURN +9000 REM Get Byte +9010 POKE OF,13: REM Set read flag low +9020 GOSUB 7000: REM Wait for write flag low +9030 IF WF = 1 THEN GOTO 9020 +9040 A = PEEK (IB) +9050 POKE OF,15: REM Set flags high +9060 GOSUB 7000: REM Wait for write flag high +9070 IF WF = 0 THEN GOTO 9060 +9080 RETURN