Skip to content

Commit ed733ca

Browse files
Add - (dash) command for INT/BIN/SYS files
1 parent daca2d5 commit ed733ca

File tree

3 files changed

+56
-16
lines changed

3 files changed

+56
-16
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ This is a version of Steve Wozniak's Integer BASIC for the Apple II, with a wrap
1919
* `BRUN path[,A<address>]"` runs a `BIN` file.
2020
* `LOCK path` and `UNLOCK path` lock/unlock the specified file.
2121
* `STORE path` and `RESTORE path` save/load variables to the specified `IVR` file.
22+
* `-path` runs `INT`, `BIN` or `SYS` files
2223
* `BYE` exits back to ProDOS.
2324

2425
2. When invoked as an "interpreter" for an `INT` file from a program selector (such as [Bitsy Bye](https://prodos8.com/bitsy-bye/) or [Apple II DeskTop](https://a2desktop.com)), the file is loaded and executed.

intbasic.system.s

Lines changed: 48 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ message:
684684
scrcode "*** PRODOS ERR $"
685685
.byte 0
686686

687-
NUM_CMDS = 20
687+
NUM_CMDS = 21
688688

689689
cmdtable:
690690
scrcode "RUN" ; must be 0 for special handling
@@ -727,14 +727,16 @@ cmdtable:
727727
.byte 0
728728
scrcode "RESTORE"
729729
.byte 0
730+
scrcode "-"
731+
.byte 0
730732
.byte 0 ; sentinel
731733

732734
MonCmd := 0 ; ignored
733735
NomonCmd := 0
734736
cmdproclo:
735-
.byte <RunCmd,<QuitCmd,<SaveCmd,<LoadCmd,<ChainCmd,<PrefixCmd,<CatCmd,<CatCmd,<DeleteCmd,<RenameCmd,<BSaveCmd,<BLoadCmd,<BRunCmd,<PRCmd,<MonCmd,<NomonCmd,<LockCmd,<UnlockCmd,<StoreCmd,<RestoreCmd
737+
.byte <RunCmd,<QuitCmd,<SaveCmd,<LoadCmd,<ChainCmd,<PrefixCmd,<CatCmd,<CatCmd,<DeleteCmd,<RenameCmd,<BSaveCmd,<BLoadCmd,<BRunCmd,<PRCmd,<MonCmd,<NomonCmd,<LockCmd,<UnlockCmd,<StoreCmd,<RestoreCmd,<DashCmd
736738
cmdprochi:
737-
.byte >RunCmd,>QuitCmd,>SaveCmd,>LoadCmd,>ChainCmd,>PrefixCmd,>CatCmd,>CatCmd,>DeleteCmd,>RenameCmd,>BSaveCmd,>BLoadCmd,>BRunCmd,>PRCmd,>MonCmd,>NomonCmd,>LockCmd,>UnlockCmd,>StoreCmd,>RestoreCmd
739+
.byte >RunCmd,>QuitCmd,>SaveCmd,>LoadCmd,>ChainCmd,>PrefixCmd,>CatCmd,>CatCmd,>DeleteCmd,>RenameCmd,>BSaveCmd,>BLoadCmd,>BRunCmd,>PRCmd,>MonCmd,>NomonCmd,>LockCmd,>UnlockCmd,>StoreCmd,>RestoreCmd,>DashCmd
738740
.assert * - cmdproclo = NUM_CMDS * 2, error, "table size"
739741

740742
cmdparse:
@@ -758,6 +760,7 @@ cmdparse:
758760
.byte ParseFlags::path ; UNLOCK
759761
.byte ParseFlags::path ; STORE
760762
.byte ParseFlags::path ; RESTORE
763+
.byte ParseFlags::path ; -
761764
.assert * - cmdparse = NUM_CMDS, error, "table size"
762765

763766
parse_flags:
@@ -1142,19 +1145,6 @@ ret: rts
11421145
ret: rts
11431146
.endproc ; LoadCmd
11441147

1145-
;;; ============================================================
1146-
;;; "RUN pathname"
1147-
1148-
.proc RunCmd
1149-
jsr LoadINTFile
1150-
bne LoadCmd::ret
1151-
1152-
jsr SwapZP ; ProDOS > IntBASIC
1153-
LDXY intbasic::LOMEM ; reset vars
1154-
STXY intbasic::PV
1155-
jmp intbasic::RUN
1156-
.endproc ; RunCmd
1157-
11581148
;;; ============================================================
11591149
;;; "STORE pathname"
11601150

@@ -1508,6 +1498,48 @@ finish:
15081498
rts
15091499
.endproc ; LoadBINFile
15101500

1501+
;;; ============================================================
1502+
;;; "-<file>"
1503+
1504+
.proc DashCmd
1505+
jsr GetFileInfo
1506+
bne ret
1507+
lda gfi_file_type
1508+
cmp #FT_BIN
1509+
beq BRunCmd
1510+
cmp #FT_INT
1511+
beq RunCmd
1512+
cmp #FT_SYS
1513+
bne err
1514+
1515+
LDXY CSWHook__orig
1516+
STXY CSWL
1517+
1518+
LDXY #$2000
1519+
STXY rw_data_buffer
1520+
LDXY #$FFFF ; read everything
1521+
STXY rw_request_count
1522+
jsr OpenReadClose
1523+
bne ret
1524+
jmp $2000
1525+
1526+
err: lda #ERR_INCOMPATIBLE_FILE_FORMAT
1527+
ret: rts
1528+
.endproc ; DashCmd
1529+
1530+
;;; ============================================================
1531+
;;; "RUN pathname"
1532+
1533+
.proc RunCmd
1534+
jsr LoadINTFile
1535+
bne DashCmd::ret
1536+
1537+
jsr SwapZP ; ProDOS > IntBASIC
1538+
LDXY intbasic::LOMEM ; reset vars
1539+
STXY intbasic::PV
1540+
jmp intbasic::RUN
1541+
.endproc ; RunCmd
1542+
15111543
;;; ============================================================
15121544
;;; "BRUN pathname[,A<address>]"
15131545

res/tests.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,13 @@ NEW
180180
506 TEST$ = "STORE/RESTORE #2"
181181
507 A=(E=5678) : GOSUB VERIFY
182182

183+
510 TEST$ = "- (dash)"
184+
511 RTS = 96 : POKE 8192,RTS
185+
512 PRINT D$;"BSAVE BIN,A8192,L1"
186+
513 POKE 8192,0
187+
514 PRINT D$;"-BIN"
188+
515 A = PEEK(8192) = RTS : GOSUB VERIFY
189+
183190
9000 REM ******************************
184191
9001 REM CLEANUP
185192
9002 REM ******************************

0 commit comments

Comments
 (0)