********************************
*                              *
* MAKEEXEC                     *
*                              *
* CREATES AN EXEC FILE THAT    *
* RUNS A BINARY. NECESSARY FOR *
* ANY FILE OPERATIONS.         *
*                              *
* NOTE THAT IRONICALLY, THIS   *
* PROGRAM ITSELF HAS TO BE RUN *
* THROUGH AN EXEC FILE...      *
*                              *
********************************
*
** ASSEMBLER DIRECTIVES
*
         CYC   AVE
         EXP   ONLY       ; TURN OFF LATER
         DSK   MAKEEXEC
         TR    ON
         OBJ   $BFE0
         ORG   $6000
*
********************************
*                              *
* HEADER, HOOKS AND MACROS     *
*                              *
********************************
*
         PUT   MIN.VARS.REQUIRED
         USE   MIN.MAC.STRINGS
         USE   MIN.MAC.REQUIRED
         USE   MIN.MAC.FILEIO
         USE   MIN.MAC.STDIO
         PUT   MIN.HOOKS.REQUIRED
         PUT   MIN.HOOKS.STDIO
         PUT   MIN.HOOKS.FILEIO
         PUT   MIN.HOOKS.STRINGS
*
********************************
*                              *
* CONSTANT DECLARATIONS        *
*                              *
********************************
*
*
********************************
*                              *
* MAIN PROGRAM LOOP            *
*                              *
********************************
*
         JSR   HOME
         PRN   "************************",8D
         PRN   "*                      *",8D
         PRN   "* EXEC FILE MAKER FOR  *",8D
         PRN   "* BINARY PROGRAMS THAT *",8D
         PRN   "* USE APPLESOFT.       *",8D
         PRN   "*                      * ",8D
         PRN   "************************",8D8D8D
*
         PRN   "BIN FILENAME: "
         INP
         LDA   RETLEN
         GRET  BNAME      ; TRANSFER RETURN TO BNAME
*
         PRN   "BIN STARTING ADDRESS: "
         INP
         LDA   RETLEN
         GRET  BLOC
*
         SCAT  "GO.";BNAME;#20 ; PREFIX NAME WITH GO.
*
         GRET  TNAME      ; STORE RESULTING STRING IN TNAME
*
         PRN   " ",8D
         PRN   "BUILDING FILE: "
         SPRN  TNAME
         PRN   " ",8D8D
*
** OPEN FILE FOR WRITING
*
         SCAT  "OPEN ";TNAME;#255
         CMD   RETURN
         SCAT  "WRITE ";TNAME;#255
         CMD   RETURN
*
** PRINT TO FILE
*
         SCAT  "BLOAD ";BNAME;#255
         FPRN  RETURN
         LDA   #$8D
         JSR   FCOUT
         FPRN  "CALL -151"
         SCAT  BLOC;"G";#255
         FPRN  RETURN
*
** CLOSE FILE
*
         SCAT  "CLOSE ";TNAME;#255
         CMD   RETURN
*
         PRN   "DONE!",8D8D
         JMP   REENTRY
*
********************************
*                              *
* VARIABLES                    *
*                              *
********************************
*
BNAME    DS    20
TNAME    DS    20
BLOC     DS    10
LINE     DS    40
HEAD     ASC   "REM ** THIS FILES BLOADS",8D
         ASC   "REM ** A BINARY PROGRAM INTO",8D
         ASC   "REM ** MEMORY THEN EXECUTES IT",8D
         ASC   "REM ** VIA THE MONITOR. THIS IS",8D
         ASC   "REM ** NECESSARY FOR CERTAIN ",8D
         ASC   "REM ** EXECUTABLES THAT USE APPLESOFT",8D
         ASC   "REM ** ROUTINES.",8D
         ASC   "REM **",8D00
*
********************************
*                              *
*  LOW-LEVEL ROUTINES          *
*                              *
********************************
*
         PUT   MIN.LIB.REQUIRED
*
** INDIVIDUAL SUBROUTINES
*
*** FILEIO
*
         PUT   MIN.SUB.FPRINT
         PUT   MIN.SUB.DOSCMD
         PUT   MIN.SUB.FPSTR
*
*** STDIO
*
         PUT   MIN.SUB.DPRINT
         PUT   MIN.SUB.XPRINT
         PUT   MIN.SUB.SINPUT
*
*** STRINGS
*
         PUT   MIN.SUB.STRCAT
         PUT   MIN.SUB.PRNSTR
*
