Skip to content

Commit

Permalink
Allows passing file names in command line to FBC.
Browse files Browse the repository at this point in the history
  • Loading branch information
dmsc committed Aug 4, 2024
1 parent b01f3e9 commit 85f4780
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
10 changes: 5 additions & 5 deletions manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,11 @@ distribute them alone without the IDE.

You can also compile a program directly
from DOS by using the included command
line compiler `FBC.COM`. The compiler
prompts for the input file name, loads
the BASIC source, compiles it, and
prompts for a executable output filename
to write the compiled program to.
line compiler `FBC.COM`. You can provide
the BASIC source and the compiled output
file names in the command line; if not
given the compiler will prompt you to
input a file name.


Advanced Editor Usage
Expand Down
22 changes: 20 additions & 2 deletions src/cmdline.bas
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,28 @@ PROC FileError
ENDPROC

'-------------------------------------
' Adds "D:" and extension to file name
' Gets a file name from command line or input
'
PROC InputFileName
input " File Name? "; FileName$
' Clear file name
poke &FileName$, 0
? " File Name ";
' Detect Sparta compatible DOS
if peek($700) = $53
' Try to get file name from command line
i = usr(dpeek(10)+3)
for i=0 to 27
if peek(dpeek(10)+33+i) = $9B then Exit
next
if i >= 4
move dpeek(10)+33, &FileName$ + 1, 28
poke &FileName$,i
? FileName$
endif
endif
' No file name, input from console
if not Len(FileName$) then input FileName$
' Adds "D:" and extension to file name if not there
if Len(FileName$) < 3 OR (Asc(FileName$[2]) <> $3A AND Asc(FileName$[3]) <> $3A)
' Don't use string operations to avoid allocations!!!
-move Adr(FileName$) + 1, Adr(FileName$) + 3, Len(FileName$)
Expand Down

0 comments on commit 85f4780

Please sign in to comment.