Skip to content

Commit d8f6a4b

Browse files
Run HELLO automatically if present
Just like BASIC.SYSTEM will automatically run STARTUP if present, INTBASIC.SYSTEM will now run HELLO if present (and an INT file), if the invoker didn't specify another path. * If a file named HELLO is present but not an INT file, INTBASIC will exit immediately back to the program selector. Hold down Open Apple or Solid Apple to drop to the > prompt instead. * If a file name HELLO is present and an INT file, INTBASIC will run it, then exit back to the program selector when the program exits. Hold Open Apple or Solid Apple to drop to the > prompt instead. * If a file named HELLO is not present, INTBASIC will show the > prompt. Resolves #13
1 parent e20828c commit d8f6a4b

File tree

2 files changed

+49
-26
lines changed

2 files changed

+49
-26
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ This is a version of Steve Wozniak's Integer BASIC for the Apple II, with a wrap
2828
* Pressing <kbd>Control</kbd>+<kbd>C</kbd> will usually exit a program as well.
2929
* Optionally, hold down <kbd>Open Apple</kbd> or <kbd>Solid Apple</kbd> when starting to allow exiting the program to remain at the `>` prompt.
3030

31+
3. When invoked directly, if a `INT` file named `HELLO` is present, will be run automatically.
32+
3133
> ⚠️ Note that while Integer BASIC programs do have the ability to execute commands from BASIC with `PRINT "<control-D>..."`, only the above commands are supported. Commands for operating on text files (`OPEN`, `READ`, etc) are not supported.
3234
3335
## Integer BASIC

intbasic.system.s

+47-26
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,33 @@ ZP_SAVE_LEN = $15
150150
PATHBUF := $280
151151
PATH2 := $2C0
152152

153+
.define STARTUP_FILE_NAME "HELLO"
154+
153155
;;; ProDOS Interpreter Protocol
154156
;;; ProDOS 8 Technical Reference Manual
155157
;;; 5.1.5.1 - Starting System Programs
156158
.org $2000
157159
jmp start
158160
.byte $EE, $EE ; Interpreter signature
159161
.byte $41 ; path buffer length
160-
path: .res $41,0 ; path buffer
161-
162+
path: .byte .strlen(STARTUP_FILE_NAME), STARTUP_FILE_NAME
163+
.res path+$41-*,0 ; path buffer
164+
165+
;;; Just used to test if startup file exists
166+
gfi_startup:
167+
.byte $A ; param_count (in)
168+
.addr PATHBUF ; pathname (in)
169+
.byte 0 ; access (out)
170+
.byte 0 ; file_type (out)
171+
.word 0 ; aux_type (out)
172+
.byte 0 ; storage_type (out)
173+
.word 0 ; blocks_used (out)
174+
.word 0 ; mod_date (out)
175+
.word 0 ; mod_time (out)
176+
.word 0 ; create_date (out)
177+
.word 0 ; create_time (out)
178+
179+
;;; Shown if startup file does not exist
162180
banner:
163181
;; "----------------------------------------"
164182
scrcode " INTEGER BASIC"
@@ -169,20 +187,6 @@ banner:
169187

170188
start:
171189

172-
;;; --------------------------------------------------
173-
;;; Display banner
174-
175-
jsr HOME
176-
lda path
177-
bne done_banner
178-
ldx #0
179-
: lda banner,x
180-
beq done_banner
181-
jsr COUT
182-
inx
183-
bne :- ; always
184-
done_banner:
185-
186190
;;; --------------------------------------------------
187191
;;; Copy path somewhere safe
188192

@@ -196,16 +200,6 @@ done_banner:
196200
dex
197201
bpl :-
198202

199-
;; Unless Open- or Solid-Apple is down, hook END/ERRMESS to QUIT
200-
lda BUTN0
201-
ora BUTN1
202-
bmi done_path
203-
204-
lda #OPC_JMP_abs
205-
LDXY #reloc__QuitFromIntBASIC
206-
sta reloc + (intbasic__WARM - BASIC_START)
207-
STXY reloc + (intbasic__WARM+1 - BASIC_START)
208-
209203
done_path:
210204

211205
;;; --------------------------------------------------
@@ -228,6 +222,33 @@ done_path:
228222
MLI_CALL SET_PREFIX, prefix_params
229223
prefix_ok:
230224

225+
;;; --------------------------------------------------
226+
;;; Display banner (if startup file not present)
227+
228+
MLI_CALL GET_FILE_INFO, gfi_startup
229+
beq skip_banner
230+
231+
do_banner:
232+
jsr HOME
233+
ldx #0
234+
: lda banner,x
235+
beq done_banner
236+
jsr COUT
237+
inx
238+
bne :- ; always
239+
240+
skip_banner:
241+
;; Unless Open- or Solid-Apple is down, hook END/ERRMESS to QUIT
242+
lda BUTN0
243+
ora BUTN1
244+
bmi done_banner
245+
246+
lda #OPC_JMP_abs
247+
LDXY #reloc__QuitFromIntBASIC
248+
sta reloc + (intbasic__WARM - BASIC_START)
249+
STXY reloc + (intbasic__WARM+1 - BASIC_START)
250+
done_banner:
251+
231252
;;; --------------------------------------------------
232253
;;; Bug fixes
233254

0 commit comments

Comments
 (0)