Classic Computer Magazine Archive A.N.A.L.O.G. ISSUE 72 / MAY 1989 / PAGE 36

SUPER COMMAND PROCESSOR

by Bryan Schappel

    Do you use DOS 2.0 or 2.5? If so, this article is for you. If you tire of waiting for DUP.SYS to load, and hate MEM.SAV, you will enjoy this memory-resident DUP.SYS file, The BBK Command Processor.
    The idea of a command processor is not new; they have been around for quite some time. Have you ever used UNIX, OSS A+ or SpartaDOS? All these operating systems use a system of input called Command Processing. Put simply, you type in commands, followed by a string of arguments which are then interpreted by the computer. This is what the BBK Command Processor does and what is better is that it gives you most of the functions of DUP.SYS (and some DUP never thought of) in less than 2,000 bytes!

Typing It In
    Listing 1 is the data used to create the AUTORUN.SYS file of BBKCP. Please refer to the M/L Editor, found elsewhere in this issue, for typing instructions.
    Listing 2 is the MAC/65 source code which need not be typed in to use the program, but is provided so you can see how the program works and so we can refer to it in later discussions.

About the BBKCP
    BBKCP has ten internal commands and can have an extensive library of external commands. The built-in commands are given, with syntax, below:

     COMMAND DESCRIPTION
ERASE fname delete file
PROTECT fname lock file
UNPROTECT fname unlock file
RENAME old new rename file
DIR [Dx:] disk directory
COPY fnl fn2 copy file
RUN [hex addr] run at address
CAR run cartridge
TYPE fname type file
KILL kill BBKCP

    In the table above, fname stands for any legal DOS filename in the format of [Dx:]filename.ext, where x is any legal drive number. Anything in brackets is considered optional. For optional arguments, certain default conditions will be used. For example, just giving a filename following a command will tell BBKCP that this command is issued to the default device. (The default device is used as the prompt.) So if you typed PROTECT MYFILE.BAS, BBKCP would expand this to PROTECT D1:MYFILE.BAS-assuming Dl: is the default device.
    To change the default device, just enter it on the command line. For example, if the prompt is Dl:, and you type D2:, you are now prompted with D2:.
    Any legal Atari device may be used for the default device, such as P:, E:, S: and C:. You should remember, though, that most of the commands are used for disk operation and will give errors with another device.
    BBKCP uses the Space (ATASCII 32) as a delimiter to separate commands and arguments on the command line. You may put as many spaces between arguments as you like, however there may be no spaces before a command.
    To enter the BBKCP from BASIC or MAC/65 (or any other language cartridge), simply use the DOS command. Any program currently in memory will remain safe unless you use the COPY command or use an external command. (We'll discuss external commands in a little while.)

About the Commands
    You are only required to enter the first three letters of any internal command, but in all examples the entire command name will be used.
    ERASE. This command accepts a filename as the argument (wildcards are allowed) and will delete the matching file(s) from your disk. You are not asked for verification, so be careful with this command.
    PROTECT. Again only specify the file to be used, and voila, it's locked. Use UNPROTECT to reverse the locking process. Wildcards are allowed.
    RENAME. This requires two arguments, namely the current name of the file and its new name. Separate the names by at least one space to ensure the rename will function correctly. Wildcards are allowed-but be careful not to rename two files with the same name.
    Do not supply a device prefix for the new filename with a rename command, as it will cause unpredictable results. It will not destroy your disk, but it will cause some headaches. It is, however, perfectly legal to put a device prefix on the old filename.
    DIR. This command takes an optional argument, the directory specifier. The default specifier is [*].[*], but you may use D2:[*].BAS or anything else you may think of. To get the directory from anything but the default device, just type the device name after the DIR command.
    COPY. This command will copy one file to another disk drive or file. Wildcards will produce strange results-Don't use them. COPY will make as many passes as needed to duplicate the file. COPY is mainly for a two-drive system; if used with a one-drive system, it can only duplicate the file to the same disk under a separate name. (Note: If you are using one drive with COPY, make certain that you use unique filenames for the source and destination files. Otherwise you could loose the source file forever!)
    Another great use for COPY is to copy a text file to the screen or printer. To do this your commands would look like this:

COPY MYFILEXXT E: (screen)
COPY MYFILEXXT P: (printer)

    Using the COPY command will destroy any program in memory, so save your work before performing a COPY.
    RUN. This command takes an optional hexadecimal address as its parameter and is used to execute a machine-language program in memory. If an address is supplied, RUN will execute at the supplied address. If no address is given, the last run address will be used. At the end of your machine-language routine, execute an RTS instruction to return to BBKCP.
    RUN (with no argument) may also be used to re-run the last external command, assuming it still resides in memory.
    The RUN command checks to see if the address given as an argument contains only legal hexadecimal digits and that the number contains no more than four digits. If these conditions are not met, an ERROR 180 is given, and control passes back to BBKCP.
    CAR. This command will attempt to pass control to the left cartridge, if it is present. (In the case of an XL or XE, the "left" cartridge is either the built-in BASIC or whatever cartridge is plugged into the computer.) If no cartridge exists, the message "No Cart" will appear, and you are returned to BBKCP; otherwise, the cartridge will be entered.
    TYPE. This command will print the contents of a text file (the name of which you supply) to the screen, assuming each line of the text has a maximum of 64 characters per line. Mainly this is used to show the contents of a BATCH file. (More on BATCH files later.)
    KILL. Use of this command will (1) remove BBKCP from memory, (2) wipe out any program in memory and (3) pass control to either a cartridge (if present) or go to DOS.

External Commands
    If you enter something that BBKCP does not understand, it assumes that it is an external command, and BBKCP attempts to binary load the file. If what you typed has no filename extension, BBKCP adds on a .COM extension. Executing an external command is destructive to memory, in most cases.
    External commands must be binary, loadand-go machine-language files. If the file doesn't begin with a $FF $FF header, an ERROR 181 is given and control passes back to BBKCP.
    Next month, a library of external commands will be published.

Batch Files
    Batch files are a wonderful way of automating certain processes. A batch file is simply a text file full of commands that either BBKCP understands or commands that the left cartridge understands. You may use a batch file to perform simple operations like copying a few files or running other external commands.
    Use any text editor to make a batch file or simply use the COPY command like this:

COPY El: Dl:MYBATCH.BAT

    When using this command, type your text one line at a time (maximum length is 64 characters), and press Return after each line. When you are finished press Control-3 to terminate the COPY.
    To execute a batch file, type a "[*]" before the filename at the prompt. You are also allowed to chain batch files if the last line in the batch file looks like "[*] batfile".
    If no file extension is supplied on the file name a BAT extension is used.
    Here is a sample batch file:

;BATCH FILE TO GIVE DIRECTORY AND
;RUN THE CART.
;ANY LINE STARTING WITH A ';'
;IS IGNORED BY BBKCP!
;
DIR
CAR

    Upon power-up, after it has loaded, BBKCP will attempt to run the batch file called AUTDRUN.BAT from Drive 1. If the file does not exist you are left in BBKCP, or control is passed to a cartridge (if present).
    The AUTDRUN.BAT file is extremely powerful. You could use it to copy files to a RAMdisk or go to the cartridge and run a program or simply print a "hello" message whenever you boot up your system. You can think of this file as giving you an infinite number of AUTDRUN.SYS files.

Next Month
    Next time around, we will provide some library functions and tell you how to interface into BBKCP so you can write your own commands!

    By the time you read this, Bryan and Carol will have been happily married for a while. Their new (read: same) apartment contains a new Mega ST2, which shares the computer room with the 800XL. The compu-kids get along very well-if you overlook the constant battle for the printer.


LISTING 1: M/L EDITOR DATA

1000 DATA 255,255,124,29,198,35,160,0,
,132,226,140,224,2,140,225,2,7642
1010 DATA 32,212,31,160,0,32,237,33,16
69,121,160,35,32,163,32,32,2915
1020 DATA 221,30,32,195,34,32,149,31,1
169,4,157,74,3,32,86,228,3431
1030 DATA 16,7,76,165,31,160,181,208,2
249,32,81,30,166,220,232,208,1852
1040 DATA 244,166,221,232,208,239,32,1
158,32,169,118,141,226,2,169,30,8118
1050 DATA 141,227,2,32,81,30,166,220,2
232,208,8,166,221,232,208,3,823
1060 DATA 32,81,30,165,220,133,216,165
5,221,133,217,166,226,208,10,230,4112
1070 DATA 226,141,182,35,165,216,141,1
181,35,32,81,30,165,220,56,229,8435
1080 DATA 216,133,218,165,221,229,217,
,133,219,230,218,208,2,230,219,32,4146
6
1090 DATA 43,30,48,9,32,16,30,76,191,2
29,188,226,2,32,221,30,2625
1100 DATA 173,224,2,170,13,225,2,240,9
9,142,181,35,173,225,2,141,7353
1110 DATA 182,35,108,181,35,165,216,13
33,214,165,217,133,215,162,16,169,1717
7
1120 DATA 7,157,66,3,165,214,157,68,3,
,165,215,157,69,3,165,218,8231
1130 DATA 157,72,3,165,219,157,73,3,76
6,86,228,169,220,133,214,169,1388
1140 DATA 8,133,215,133,219,169,2,133,
,218,208,210,133,212,132,213,160,4077
1150 DATA 0,177,212,240,11,32,119,30,2
230,212,208,243,230,213,208,239,6730
1160 DATA 96,168,173,7,228,72,173,6,22
28,72,152,96,162,0,169,64,6231
1170 DATA 141,190,2,169,0,133,214,133,
,219,169,64,133,218,169,5,133,9097
1180 DATA 215,76,55,30,169,0,133,226,1
133,212,133,213,185,0,5,201,8448
1190 DATA 155,208,8,165,226,240,2,24,9
96,56,96,162,15,221,105,35,5069
1200 DATA 240,5,202,16,248,48,242,6,21
12,38,213,6,212,38,213,6,6672
1210 DATA 212,38,213,6,212,38,213,138,
,5,212,133,212,230,226,200,165,4010
1220 DATA 226,201,5,176,212,144,197,16
62,16,208,2,162,32,138,72,169,7488
1230 DATA 12,157,66,3,32,86,228,104,17
70,96,169,81,160,35,32,97,4793
1240 DATA 30,32,130,30,16,6,32,165,31,
,76,248,30,173,0,5,201,3083
1250 DATA 155,240,231,96,165,6,208,7,1
169,72,160,35,76,97,30,108,4280
1260 DATA 250,191,32,35,31,133,8,32,10
0,31,108,10,0,169,255,133,3420
1270 DATA 10,169,255,133,11,173,194,32
2,133,12,173,195,32,133,13,172,6407
1280 DATA 216,35,169,0,153,26,3,169,22
28,153,27,3,169,255,141,231,9860
1290 DATA 2,169,255,141,232,2,169,0,14
41,217,35,96,169,33,208,40,6709
1300 DATA 169,35,208,36,169,36,208,32,
,32,212,31,164,223,32,237,33,7227
1310 DATA 166,222,169,44,157,186,35,18
85,0,5,157,187,35,232,200,201,169
1320 DATA 155,208,244,169,32,72,208,4,
,72,32,212,31,32,221,30,104,4675
1330 DATA 157,66,3,32,149,31,157,74,3,
,32,86,228,48,17,96,169,3413
1340 DATA 183,157,68,3,169,35,157,69,3
3,169,0,157,75,3,96,132,2929
1350 DATA 212,169,0,133,213,32,221,30,
,32,170,217,32,230,216,160,255,2729
1360 DATA 200,177,243,153,100,35,16,24
48,41,127,153,100,35,169,155,153,8177
1370 DATA 181,35,169,8,153,102,35,169,
,93,160,35,76,97,30,173,82,4344
1380 DATA 35,141,183,35,173,83,35,141,
,184,35,162,0,185,1,5,201,4620
1390 DATA 58,240,24,185,2,5,201,58,208
8,25,185,1,5,141,184,35,4179
1400 DATA 185,0,5,141,183,35,208,200,2
200,208,8,185,0,5,141,183,7590
1410 DATA 35,200,200,185,0,5,157,186,3
35,201,155,240,10,201,32,240,9976
1420 DATA 6,200,232,224,13,208,236,169
9,155,157,186,35,169,0,157,187,710
1430 DATA 35,134,222,96,185,0,5,201,15
55,240,15,32,154,30,176,13,4965
1440 DATA 165,212,141,181,35,165,213,1
141,182,35,108,181,35,160,180,76,8919
1450 DATA 165,31,169,6,208,2,169,4,141
1,112,32,32,212,31,173,186,6361
1460 DATA 35,201,155,208,11,162,3,189,
,86,35,157,186,35,202,16,247,8312
1470 DATA 32,221,30,32,195,34,32,149,3
31,169,6,157,74,3,32,86,1536
1480 DATA 228,48,204,162,16,32,137,38,
,48,27,160,8,185,8,5,201,2693
1490 DATA 155,240,3,208,208,246,169,8,
,153,1,5,169,8,160,5,32,2930
1500 DATA 97,30,76,121,32,76,221,38,16
69,0,133,8,96,133,212,132,6254
1510 DATA 213,162,255,168,4,232,189,18
86,35,201,46,240,13,201,155,208,2822
1520 DATA 244,177,212,157,186,35,232,1
136,16,247,96,32,255,255,32,35,9213
1530 DATA 31,162,0,32,227,38,32,195,34
4,169,90,141,68,3,169,35,3811
1540 DATA 141,69,3,142,75,3,169,12,141
1,74,3,32,86,228,216,172,6796
1550 DATA 4,228,174,5,228,208,208,1,23
32,140,82,34,142,83,34,160,7232
1560 DATA 0,185,26,3,201,69,240,7,208,
,200,200,192,33,144,242,200,2754
1570 DATA 140,216,35,169,234,153,26,3,
,169,35,153,27,3,162,80,32,3114
1580 DATA 227,30,168,15,185,0,228,153,
,234,35,185,144,3,153,258,35,8862
1590 DATA 136,16,241,169,71,141,238,35
5,169,34,141,239,35,173,217,35,9276
1600 DATA 288,61,238,217,35,165,12,141
1,194,32,165,13,141,195,32,169,7673
1610 DATA 193,133,12,169,32,133,13,165
5,10,141,36,31,165,11,141,40,2472
1620 DATA 31,169,118,133,18,169,33,133
3,11,173,231,2,141,67,31,173,5632
1630 DATA 232,2,141,72,31,169,10,141,2
231,2,169,36,141,232,2,96,5981
1640 DATA 32,228,32,169,255,133,8,216,
,32,240,30,173,0,5,201,42,5608
1650 DATA 208,3,76,8,34,201,59,240,238
8,168,8,32,212,31,173,186,8720
1660 DATA 35,201,155,208,15,173,183,35
5,141,82,35,173,184,35,141,83,6943
1670 DATA 35,76,125,33,169,131,133,212
2,169,35,133,213,162,0,160,8,7018
1680 DATA 185,0,5,209,212,208,26,200,1
192,3,288,244,189,161,35,141,1272
1690 DATA 210,33,189,171,35,141,211,33
3,32,237,33,32,255,255,76,125,9409
1700 DATA 33,165,212,24,105,3,133,212,
,144,2,230,213,232,224,10,208,1997
1710 DATA 285,32,124,29,76,125,33,185,
,0,5,201,32,248,7,201,155,6666
1720 DATA 240,3,280,208,242,185,0,5,20
01,32,208,3,200,208,246,132,1525
1730 DATA 223,96,160,0,169,32,141,0,5,
,32,237,33,32,212,31,169,4570
1740 DATA 126,168,35,32,163,32,169,12,
,32,112,34,169,183,141,254,35,7238
1750 DATA 169,35,141,255,35,169,4,141,
,4,36,169,3,32,112,34,16,818
1760 DATA 10,169,12,132,212,32,112,34,
,32,167,31,76,125,33,169,155,5293
1770 DATA 208,35,173,250,35,16,7,162,0
0,168,1,76,255,255,169,0,7126
1780 DATA 141,2,36,141,3,36,169,7,32,1
112,34,48,234,173,233,35,5944
1790 DATA 72,32,119,30,184,162,0,160,1
1,96,141,252,35,32,137,34,4221
1800 DATA 162,80,32,86,228,141,233,35,
,16,9,152,72,162,88,32,227,6567
1810 DATA 30,184,168,152,72,160,15,185
5,32,8,72,185,218,35,153,32,5496
1820 DATA 0,184,153,218,35,185,144,3,7
72,185,258,35,153,144,3,104,7058
1830 DATA 153,250,35,136,16,225,104,16
68,96,157,66,3,169,0,157,72,5534
1840 DATA 3,157,68,3,169,48,157,73,3,1
157,69,3,96,169,3,157,3752
1850 DATA 66,3,96,32,165,31,76,225,30,
,32,212,31,32,221,30,32,3447
1860 DATA 149,31,32,195,34,169,4,157,7
74,3,32,86,228,48,228,169,7255
1870 DATA 183,160,35,32,97,38,164,223,
,32,237,33,32,212,31,32,225,6878
1880 DATA 30,32,149,31,32,195,34,169,8
8,157,74,3,32,86,228,48,3765
1890 DATA 194,32,158,32,162,16,169,7,3
32,175,34,32,86,228,48,6,2817
1900 DATA 169,1,133,226,288,4,169,0,13
33,226,189,72,3,133,224,189,306
1910 DATA 73,3,133,225,162,32,169,11,3
32,175,34,165,224,157,72,3,6191
1920 DATA 165,225,157,73,3,32,86,228,1
165,226,208,200,32,221,30,76,9540
1930 DATA 225,30,78,111,32,67,97,114,1
116,155,0,155,68,49,58,8,1940
1940 DATA 42,46,42,155,69,58,155,69,11
14,114,111,114,45,32,32,32,1930
1950 DATA 32,155,0,48,49,50,51,52,53,5
54,55,56,57,65,66,67,9889
1960 DATA 68,69,70,155,77,79,67,46,155
5,84,65,66,46,69,82,65,2268
1970 DATA 80,82,79,85,78,80,82,69,78,6
68,73,82,67,79,80,82,2445
1980 DATA 85,78,67,65,82,84,89,80,75,7
73,76,82,86,90,94,72,3024
1990 DATA 207,42,10,76,24,31,31,31,31,
,32,34,32,31,32,31,118,7947
2000 DATA 30,68,49,58,65,85,84,79,82,8
85,78,46,66,65,84,155,3106
2010 DATA 0,10,36,139,36,162,0,142,217
7,35,134,8,232,134,9,32,4394
2020 DATA 199,32,169,83,160,36,32,97,3
30,32,225,30,32,195,34,32,2731
2030 DATA 149,31,169,4,157,74,3,32,86,
,228,8,32,225,38,48,16,1997
2040 DATA 18,165,6,208,3,108,18,0,188,
,250,191,169,81,160,35,32,5894
2050 DATA 97,30,169,186,160,35,32,97,3
38,104,104,76,28,34,125,155,4029
2060 DATA 66,66,75,32,67,80,32,45,32,4
40,67,41,32,49,57,56,8780
2070 DATA 55,32,65,78,65,76,79,71,32,6
67,111,109,112,117,116,105,4599
2080 DATA 110,183,155,98,121,58,32,66,
,114,121,97,110,32,83,99,184,4308
2090 DATA 97,112,112,101,108,155,0,226
6,2,227,2,10,36,0,0,0,9327


LISTING 2: ASSEMBLY

0100     .OPT NO LIST
0110 ;-------------------------------
0120 ;
0130 ;Super Command Processor
0140 ;
0150 ;by: Bryan Schappel
0160 ;
0170 ;If the typed line does not
0180 ;contain a command, then the
0190 ;filename entered will be loaded
0200 ;as a binary file.
0210 ;
0220 ;-------------------------------
0230 ;
0240 ;*** Commands ***
0250 ;
0260 ;ERA [fname] = delete file
0270 ;REN [f1,f2] = rename f1 to f2
0280 ;PRO [fname] = lock file
0290 ;UNP [fname] = unlock file
0300 ;DIR [Dn:]   = directory of D#:
0310 ;RUN [adr]   = run at address
0320 ;COPY        = copy a File
0330 ;CAR         = enter Cart
0340 ;TYPE        = read BATCH file
0350 ;KILL        = KILL BBK CP
0360 ;
0370 NUMCOM = 10     ;# OF COMMANDS
0380 IOCB5 = $0398   ;Adr of IOCB5
0390 MYBUF = $0500   ;I/0 Buffer
0400 ZIOCB = $20     ;Zpage IOCB
0410 ;
0420 ;Zero Page Variables
0430 ;
0440     *=  $D6
0450 SL  .DS 1       ;Load adr to
0460 SH  .DS 1       ;Load adr hi
0470 STL .DS 1       ;start adr to
0480 STH .DS 1       ;start adr hi
0490 BLL .DS 1       ;length to
0500 BLH .DS 1       ;length hi
0510 BAL .DS 1       ;buffer byte 1
0520 BAH .DS 1       ;buffer byte 2
0530 XSAV .DS 1      ;save loc
0540 LNPOS .DS 1     ;CP line pos
0550 LENSAV .DS 2    ;COPY length
0560 COUNT .DS 1     ;counter
0570 ;
0580 ;OS Equates
0590 ;
0600 CIOV =  $E456   ;CIO Vector
0610 ICCOM = $0342   ;CIO Command
0620 ICBAL = $0344   ;CIO buffer lo
0630 ICBAH = $0345   ;CIO buffer hi
0640 ICBLL = $0348   ;CIO length lo
0650 ICBLH = $0349   ;CIO length hi
0660 AUX1 =  $0348   ;CIO aux 1
0670 AUX2 =  $0340   ;CIO aux 2
0680 RUNAD = $02E0   ;run address
0690 EOL =   $9B     ;end of line
0700 FRO =   $D4     ;FP number
0710 TRAMSZ = $06    ;cart in?
0720 BOOT? = $09     ;boot flag
0730 D05VEC = $0A    ;DOS Vector
0740 DOSINI = $0C    ;init vec
0750 WARMST = $08    ;warm st flag
0760 MEMLO = $02E7   ;lo mem pntr
0770 INITAD = $02E2  ;init addr
0780 HATABS = $031A  ;Handler Table
0790 SHFLOK = $02BE  ;Caps toggle
0800 IFP =   $D9AA   ;Int to FP
0810 FASC =  $DBE6   ;FP to ASC
0820 INBUFF = $F3    ;FP pntr
0830 EDITRV = $E400  ;E: Handler Tab
0840 ;
0850 ;BUMP Macro
0860 ;
0878     .MACRO BUMP
0880     INC %1+1
0890     BNE @BUMP
0900     INC Y.i+1
0910 eBUMP
0920     .ENDM
0930 ;
0940 ;PRINT Macro
0950 ;
0960     .MACRO PRINT
0970     LDA # <%1
0980     LDY # >%1
0990     JSR EPRINT
1000     .ENDM
1010 ;
1020 ORIGIN = $1D7C
1030     *=  ORIGIN
1040 ;
1050 ;This routine attempts to
1060 ;Binary Load a file.
1070 ;If the file is not Binary an
1080 ;Error =81 is given.
1090 ;
1100 ;ENTER:
1110 ;MYBUF=Filename to load minus
1120 ;      a COM extension.
1130 ;      Load is on IOCB tt1
1140 ;
1150 LOADIT LDY #0
1160     STY COUNT
1170     STY RUNAD
1180     STY RUNAD+1
1190     JSR FINDFILE
1200     LDY #0
1210     JSR FINDARG
1220     LDA # <COM
1230     LDY # >COM
1240     JSR ADD_EXT
1250     JSR CLOSE1
1260 ;
1270     JSR SET_OPN
1280     JSR SET_DEV
1290     JSR SET_4
1300     BPL LOAD_MAIN
1310 GO_ERR JMP IOERROR
1320 NO_BIN LDY #181
1330     BNE GO_ERR
1340 ;
1350 ;Main load Loop
1360 ;
1370 LOAD_MAIN JSR READ2
1380     LDX BAL
1390     INX
1400     BNE NO_BIN
1410     LDX BAH
1420     INX
1430     BNE NO_BIN
1440     JSR SET_DEST
1450 ;
1460 GET_FIL LDA # <EPRDN
1470     STA INITAD
1480     LDA # >EPRDN
1490     STA INITAD+1
1500     JSR READ2
1510     LDX BAL
1520     INX
1530     BNE NOT_FF
1540     LDX BAH
1550     INX
1560     BNE NOT_FF
1570     JSR READ2
1580 NOT_FF LDA DAL
1590     STA STL
1600     LDA BAH
1610     STA STH
1620     LDX COUNT
1630     BNE PASS2
1640     INC COUNT
1650     STA ADDRESS+1
1660     LDA STL
1670     STA ADDRESS
1680 PASS2 JSR READ2
1690     LDA BAL
1700     SEC
1710     SBC STL
1720     STA BLL
1730     LDA BAH
1740     SBC STH
1750     STA BLH
1760      BUMP  BLL
1770     JSR GET_DATA
1780     BMI JSTART
1790     JSR JINIT
1800     JMP GET_FIL
1810 ;
1820 JINIT JMP (INITAD)
1830 JSTART JSR CLOSE1
1840     LDA RUNAD
1850     TAX
1860     ORA RUNAD+1
1870     BEG LDAD_GO
1880     STX ADDRESS
1890     LDA RUNAD+1
1900     STA ADDRESS+1
1910 LOAD_GO JMP (ADDRESS)
1920 ;
1930 ;Get DATA from file
1940 ;
1950 GET_DATA LDA STL
1960     STA SL
1970     LDA STH
1980     STA SH
1990 ;
2000 GET_REC LDX #$10
2010     LDA #7
2020 CALL_CIO STA ICCOM,X
2030     LDA SL
2040     STA ICBAL,X
2050     LDA SH
2060     STA ICBAH,X
2070     LDA BLL
2080     STA ICBLL,X
2090     LDA BLH
2100     STA ICBLH,X
2110     JMP CIOV
2120 ;
2130 ;Read 2 bytes from file
2140 ;
2150 READ2 LDA # <BAL
2160     STA SL
2170     LDA #0
2180     STA SH
2190     STA BLH
2200     LDA #2
2210     STA BLL
2220     BNE GET_REC
2230 ;
2240 ;Set AUX1 to 4
2250 ,•,
2260 SET_4 LDA #4
2270     STA AUX1,X
2280     JMP CIOV
2290 ;
2300 ;E: Print Routine
2310 ;
2320 ;ENTER:
2330 ;A=LSB of string
2340 ;Y=MSB of string
2350 ;
2360 ;EXIT:
2370 ;A=zero
2380 ;
2390 EPRINT STA FR0
2400     STY FR0+1
2410 EPL LDY #0
2420     LDA (FR0),Y
2430     BEQ EPRDN
2440     JSR EPUT
2450     INC FR0
2460     BNE EPL
2470     INC FR0+1
2480     BNE EPL
2490 EPRDN RTS
2500 ;
2510 ;E: Put Byte Routine
2520 ;
2530 ;ENTER:
2540 ;A=character to print
2550 ;
2560 EPUT TAY
2570     LDA EDITRV+7
2580     PHA
2590     LDA EDITRV+6
2600     PHA
2610     TYA
2620     RTS
2630 ;
2640 ;E: Input Routine
2650 ;
2660 EINPUT LDX #$00
2670     LDA #$40
2680     STA SHFLOK
2690 ;
2700 ;Get a 64 byte line in MYBUF
2710 ;
2720 ;ENTER:
2730 ;X=IOCB Index ($18,$28,...)
2740 ;
2750 INP_MYB LDA #0
2760     STA SL
2770     STA BLH
2780     LDA #64
2790     STA BLL
2800     LDA #5
2810     STA SH
2820     JMP CALL_CIO
2830 ;
2840 ;Get a Hex # from MYBUF
2850 ;
2860 ;ENTER:
2870 ;Y=offset into MYBUF where
2880 ;  the Hex # starts
2890 ;
2900 ;EXIT:
2910 ;FR0,FR0+1 = binary number
2920 ;
2930 ;
2940 GRAB_HEX LDA #0
2950     STA COUNT
2960     STA FR0
2970     STA FR0+1
2980 G4LOOP LDA MYBUF,Y
2990     CMP #EOL
3000     BEQ HEX_OUT
3010     CMP #$20
3020     BNE TESTIT
3030 HEX_OUT LDA COUNT
3040     BEQ HEX_BAD
3050 HEX_GOOD CLC
3060     RTS
3070 HEX_BAD SEC
3080     RTS
3090 ;
3100 TESTIT LDX #$0F
3110 G4SCAN CMP HEXDIG,X
3120     BEQ GOTG4D
3130     DEX
3140     BPL G45CAN
3150     BMI HEX_BAD
3160 ;
3170 GOTG4D ASL FR0
3180     ROL FR0+1
3190     ASL FR0
3200     ROL FR0+1
3210     ASL FR0
3220     ROL FR0+1
3230     ASL FR0
3240     ROL FR0+1
3250     TXA
3260     ORA FR0
3270     STA FR0
3280     INC COUNT
3290     INY
3300     LDA COUNT
3310     CMP #5
3320     BCS HEX_BAD
3330     BCC G4LOOP
3340 ;
3350 ;Close IOCB #1
3360 ;
3370 CLOSE1 LDX #$10
3380     BNE CLOSEIT
3390 ;
3400 ;Close IOCB #2
3418 ;
3420 CLOSE2 LDX #$20
3438 ;
3440 ;Close Any IOCB
3450 ;
3460 ;ENTER:
3470 ;X=IOCB Index ($10,$20,...)
3480 ;
3490 ;EXIT:
3500 ;X=IOCB Index
3510 ;
3520 CLOSEIT TXA
3530     PHA
3548     LDA #$0C
3550     STA ICCOM,X
3560     JSR CIOV
3570     PLA
3580     TAX
3590     RTS
3600 ;
3610 ;CP's PROMPT + INPUT Routini
3620 ;
3630 INPUT PRINT PROMPT
3640     JSR EINPUT
3650     BPL INPUTLV
3660     JSR IOERROR
3670     JMP INPUT
3680 INPUTLV LDA MYBUF
3690     CMP #EOL
3700     BEQ INPUT
3710     RTS
3720 ;
3730 ;#######################
3740 ;
3750 ;Start of Commands
3760 ;
3770 ;#######################
3780 ;
3790 ;Enter Cart
3800 ;
3810 GOCART LDA TRAMSZ
3820     BNE TRY_CART
3830     LDA # <NOCART
3840     LDY # >NOCART
3850     JMP EPRINT
3860 TRY_CART JMP ($BFFA)
3870 ;
3880 ;Kill CP
3890 ;
3900 KILL JSR UNHOOK
3910     STA WARMST
3920     JSR GOCART
3930     JMP (DOSVEC)
3940 ;
3950 ;Un-Hook OS Patches
3960 ;
3970 UNHOOK LDA #$FF
3980     STA DOSVEC
3990 CP_HI LDA #$FF
4000     STA DOSVEC+1
4010     LDA RESET+1
4020     STA DOSINI
4030     LDA RESET+2
4040     STA DOSINI+1
4050     LDY INDEX
4060     LDA # <EDITRV
4070     STA HATABS,Y
4080     LDA # >EDITRV
4090     STA HATABS+1,Y
4100 OLD_ML LDA #$FF
4110     STA MEMLO
4120 OLD_MH LDA #$FF
4130     STA MEMLO+1
4140     LDA #0
4150     STA SETFLAG
4160     RTS
4170 ;
4180 ;Erase a File
4190 ;
4200 ERASE LDA #33
4210     BNE DOXIO
4220 ;
4230 ;Lock a File
4240 ;
4250 PROTECT LDA #35
4260     BNE DOXIO
4270 ;
4280 ;Unlock a File
4290 ;
4300 UNPROTECT LDA #36
4310     BNE DOXIO
4320 ;
4330 ;Rename a File
4340 ;
4350 RENAME JSR FINDFILE
4360     LDY LNPOS
4370     JSR FINDARG
4380     LDH XSAV
4390     LDA #',
4400     STA FNAME,X
4410 REN_LP LDA MYBUF,Y
4420     STA FNAME+1,X
4430     INX
4440     INY
4450     CMP #EOL
4460     BNE REN_LP
4470     LDA #32
4480     PHA
4490     BNE XIO_ENT
4500 ;
4510 ;Perform an XIO
4520 ;
4530 ;ENTER:
4540 ;A=XIO Number
4550 ;Y=Offset to Filename in MYBUF
4560 ;
4570 DOXIO PHA
4580     JSR FINDFILE
4590 XIO-ENT JSR CLOSE1
4600     PLA
4610     STA ICCOM,X
4620     JSR SET_DEV
4630     STA AUX1,X
4640     JSR CIOV
4650     BMI IOERROR
4660     RTS
4670 ;
4680 ;Set ICBAL/H to DEVICE
4690 ;
4700 ;ENTER:
4710 ;X=IOCB Index
4720 ;
4730 SET_DEV LDA # <DEVICE
4740     STA ICBAL,X
4750     LDA # >DEVICE
4760     STA ICBAH,X
4770     LDA #0
4780     STA AUX2,X
4790     RTS
4800 ;
4810 ;Handle I/O error
4820 ;
4830 ;ENTER:
4840 ;Y=I/O Error #
4850 ;
4860 ;EXIT:
4870 ;Channel #1 is closed
4880 ;
4890 IOERROR STY FR0
4900 IO_ERR LDA #0
4910     STA FR0+1
4920     JSR CLOSE1
4930     JSR IFP
4940     JSR FASC
4950     LDY #$FF
4960 IOERR INY
4970     LDA (INBUFF),Y
4980     STA ERBUF,Y
4990     BPL IOERR
5000     AND #$7F
5010     STA ERBUF,Y
5020     LDA #EOL
5030     STA ERBUF+1,Y
5040     LDA #0
5050     STA ERBUF+2,Y
5060     LDA # <ERTXT
5070     LDY # >ERTXT
5080     JMP EPRINT
5090 ;
5100 ;This will grab a filename from
5110 ;MYBUF and put it in the
5120 ;device buffer.
5130 ;
5140 ;ENTER:
5150 ;Y=Offset to Filename in MYBUF
5160 ;
5170 FINDFILE LDA DEFDEV
5180     STA DEVICE
5190     LDA DEFDEV+1
5200     STA DEVICE+1
5210 ;
5220 FIND1 LDX #0
5230     LDA MYBUF+1,Y
5240     CMP #':
5250     BEQ X2
5260     LDA MYBUF+2,Y
5270     CMP #':
5280     BNE FIND2
5290     LDA MYSUF+1,Y
5300     STA DEVICE+1
5310     LDA MYBUF,Y
5320     STA DEVICE
5330     INY
5340     INY
5350     INY
5360     BNE FIND2
5370 ;
5380 X2  LDA MYBUF,Y
5390     STA DEVICE
5400     INY
5410     INY
5420 ;
5430 FIND2 LDA MYBUF,Y
5440     STA FNAME,X
5450     CMP #EOL
5460     BEQ FIND3
5470     CMP #$20
5480     BEQ FIND3
5490     INY
5500     INX
5510     CPX #13
5520     BNE FIND2
5530 FIND3 LDA #EOL
5540     STA FNAME,X
5550     LDA #0
5560     STA FHAME+1,X
5570     STX XSAV
5580     RTS
5590 ;
5600 ;This handles the 'RUN' command
5610 ;
5620 MEMRUN LDA MYBUF,Y
5630     CMP #EOL
5640     BEQ RUN_IT
5650 ;
5660 PULL_IT JSR GRAB_HEX
5670     BCS BAD_RUN
5680     LDA FR0
5690     STA ADDRESS
5700     LDA FR0+1
5710     STA ADDRESS+1
5720 RUN_IT JMP (ADDRESS)
5730 BAD_RUN LDY #180
5740 MEM_ERR JMP IOERROR
5750 ;
5760 ;Get disk Directory
5770 ;
5780 DIRECT LDA #6
5790     BNE DIR_GO
5800 ;
5810 ;Get a TYPE of a File
5820 ;
5830 TYPE LDA #4
5840 DIR_GO STA DIR_COM+1
5850     JSR FINDFILE
5860     LDA DEVICE+3
5870     CMP #EOL
5880     BNE OPEN_DIR
5890     LDX #3
5900 CP_DIR LDA DIRNAM,X
5910     STA DEVICE+3,X
5920     DEX
5930     BPL CP_DIR
5940 ;
5950 OPEN_DIR JSR CLOSE1
5960     JSR SET_OPN
5970     JSR SET_DEV
5980 DIR-COM LDA #6
5990     STA AUX1,X
6000     JSR CIOV
6010     BMI MEM_ERR
6020 ;
6030 DIROK LOX #$10
6040     JSR INP_MYB
6050     BMI DIRDONE
6060     LDY #0
6070 DIRCKI LDA MYBUF,Y
6080     CMP #EOL
6090     BEQ DIRCK2
6100     INY
6110     BNE DIRCK1
6120 DIRCK2 LDA #0
6130     STA MYBUF+1,Y
6140      PRINT MYBUF
6150     JMP DIROK
6160 DIRDONE JMP CLOSE1
6170 ;
6180 ;Set Destroy Flag
6190 ;
6200 SET_DEST LDA #0
6210     STA WARMST
6220     RTS
6230 ;
6240 ;Add File Extension
6250 ;
6260 ;ENTER:
6270 ;A=LSB of extension
6280 ;Y=MSB of extension
6290 ;
6300 ADD_EXT STA FR0
6310     STY FR0+1
6320     LDX #$FF
6330     LDY #4
6340 ;
6350 EXT_SCAN INX
6360     LDA FNAME,X
6370     CMP #'.
6380     BEQ EXT_RTS
6390     CMP #EOL
6400     BNE EXT_SCAN
6410 EXT_ADD LDA (FR0),Y
6420     STA FNAME,X
6430     INX
6440     DEY
6450     BPL EXT_ADD
6460 EXT_RTS RTS
6470 ;
6480 ;This is where RESET comes
6490 ;
6500 RESET JSR $FFFF
6510     JSR UNHOOK
6520 ;
6530 HOOKUP LDX #$00
6540     JSR CLOSEIT
6550     JSR SET_OPN
6560     LDA # <EDEV
6570     STA ICBAL
6580     LDA # >EDEV
6590     STA ICBAH
6600     STX AUX2
6610     LDA #12
6620     STA AUX1
6630     JSR CIOV
6640 ;
6650 HOOK1 CLD
6660     LDY EDITRV+4
6670     LDX EDITRV+5
6680     INY
6690     BNE NO_UPX
6700     INX
6710 NO_UPX STY EGET+1
6720     STX EGET+2
6730     LDY #0
6740 ;
6750 FIND_E LDA HATABS,Y
6760     CMP #'E
6770     BEQ GOT_E
6780     INY
6790     INY
6800     INY
6810     CPY #33
6820     BCC FIND_E
6830 ;
6840 GOT_E INY
6850     STY INDEX
6860     LDA # <NEW_E.HAN
6870     STA HATABS,Y
6880     LDA # >NEW_E.HAN
6890     STA HATABS+1,Y
6900 ;
6918     LDX #$50
6920     JSR CLOSEIT
6930     LDY #$0F
6940 COPY_E LDA EDITRV,Y
6950     STA NEW_E.HAN,Y
6960     LDA IOCB5,Y
6970     STA BAT_IOCB,Y
6980     DEY
6990     BPL COPY_E
7000 ;
7010     LDA # <[EBAT_GET-1]
7020     STA NEW_E.HAN+4
7030     LDA # >[EBAT_GET-1]
7040     STA NEW_E.HAN+5
7050 ;
7060 SKIP_BAT LDA SETFLAG
7070     BNE INIT_RTS
7080     INC SETFLAG
7090     LDA DOSINI
7100     STA RESET+1
7110     LDA DOSINI+1
7120     STA RESET+2
7130     LDA # <RESET
7140     STA DOSINI
7150     LDA # >RESET
7160     STA DOSINI+1
7170 ;
7180     LDA DOSVEC
7190     STA UNHOOK+1
7200     LDA DOSVEC+1
7210     STA CP_HI+1
7220     LDA # <GO_CP
7230     STA DOSVEC
7240     LDA # >GO_CP
7250     STA DOSVEC+1
7260 ;
7270     LDA MEMLO
7280     STA OLD_ML+1
7290     LDA MEMLO+1
7300     STA OLD_MH+1
7310     LDA # <PROGEND
7320     STA MEMLO
7330     LDA # >PROGEND
7340     STA MEMLO+1
7350 INIT_RTS RTS
7360 ;
7370 ;COMMAND PROCESSOR ENTRY
7380 ;
7390 GO_CP JSR HOOK1
7400     LDA #$FF
7410     STA WARMST
7420 ;
7430 MAIN CLD
7440     JSR INPUT    ;get line
7450     LDA MYBUF
7460     CMP #'*      ;Batch?
7470     BNE NO_BAT
7480     JMP BATCH
7490 ;
7500 NO_BAT CMP #';
7518     BEQ MAIN
7520     LDY #0
7530     JSR FINDFILE
7540     LDA DEVICE+3
7550     CMP #EOL
7560     BNE NO_REM
7570     LDA DEVICE
7580     STA DEFDEV
7590     LDA DEVICE+1
7600     STA DEFDEV+1
7610     JMP MAIN
7620 ;
7630 NO_REM LDA # <COMTAB
7640     STA FR0
7650     LDA # >COMTAB
7660     STA FR0+1
7670     LDX #0
7680 COMLP LDY #0
7690 COMCK LDA MYBUF,Y
7700     CMP (FR0),Y
7710     BNE TRYNEXT
7720     INY
7730     CPY #3
7740     BNE COMCK
7750 ;
7760     LDA COMADRL,X
7770     STA COMJSR+1
7780     LDA COMADRH,X
7790     STA COMJSR+2
7800     JSR FINDARG
7810 COMJSR JSR $FFFF
7820     JMP MAIN
7830 ;
7840 TRYNEXT LDA FR0
7850     CLC
7860     ADC #3
7870     STA FR0
7880     BCC TRY_NH
7890     INC FR0+1
7900 TRY-NH INX
7910     CPX #NUMCOM
7920     BNE COMLP
7930     JSR LOADIT
7940     JMP MAIN
7950 ;
7960 ;Find an Argument on Line
7970 ;
7980 ;ENTER:
7990 ;Y=Offset to start search
8000 ;
8010 ;EXIT:
8020 ;Y=1st char of argument
8030 ;
8040 FINDARG LDA MYBUF,Y
8050     CMP #$20
8060     BEQ NEXTARG
8070     CMP #EOL
8080     BEQ NEXTARG
8090     INY
8100     BNE FINDARG
8110 NEXTARG LDA MYOUF,Y
8120     CMP #$20
8130     BNE FOUNDARG
8140     INY
8150     BNE NEXTARG
8160 FOUNDARG STY LNPOS
8170     RTS
8180 ;
8190 ;Handle a BATCH File
8200 ;
8210 BATCH LDY #0
8220     LDA #$20
8230     STA MYBUF
8240     JSR FINDARG
8250     JSR FINDFILE
8260     LDA # <BAT
8270     LDY # >BAT
8280     JSR ADD_EXT
8290 BAT_GO LDA #12
8300     JSR BAT_CIO
8310 ;
8320     LDA # <DEVICE
8330     STA ICBALB
8340     LDA # >DEVICE
8350     STA ICBAHB
8360     LDA #4
8370     STA AUX1B
8380     LDA #3
8390     JSR BAT_CIO
8400     BPL BAT_MAIN
8410     LDA #12
8420     STY FR0
8430     JSR BAT_CIO
8440     JSR IO_ERR
8450 BAT_MAIN JMP MAIN
8460 BAT_9B LDA #EOL
8470     BNE BAT_XIT
8480 ;
8490 BAT_GET LDA BAT_IOCB
8500     BPL BAT_PROC
8510 BAT_NORM LDX #$00
8520     LDY #1
8530 EGET JMP $FFFF
8540 ;
8550 BAT-PROC LDA #0
8560     STA ICBLLB
8570     STA ICBLHB
8580     LDA #7
8590     JSR BAT_CIO
8600     BMI BAT_NORM
8610     LDA BAT_ZIO+15
8620     PHA
8630     JSR EPUT
8640     PLA
8650 BAT_XIT LDX #$00
8660     LDY #1
8670     RTS
8680 ;
8690 ;Perform BATCH CIO
8700 ;
8710 BAT_CIO STA ICCOMB
8720     JSR BAT_SWAP
8730     LDX #$50
8740     JSR CIOV
8750     STA BAT_ZIO+15
8760     BPL BAT_SWAP
8770     TYA
8780     PHA
8790     LDX #$50
8800     JSR CLOSEIT
8810     PLA
8820     TAY
8830 ;
8840 ;Swap IOCB Blocks
8850 ;
8860 BAT_SWAP TYA
8870     PHA
8880     LDY #S0F
8890 BAT_SLP LDA ZIOCB,Y
8900     PHA
8910     LDA BAT_ZIO,Y
8920     STA ZIOCB,Y
8930     PLA
8940     STA BAT_ZIO,Y
8950     LDA IOCB5,Y
8960     PHA
8970     LDA BAT_IOCB,Y
8980     STA IOCB5,Y
8990     PLA
9000     STA BAT_IOCB,Y
9010     DEY
9020     BPL BAT_SLP
9030     PLA
9040     TAY
9050     RTS
9060 ;
9070 ;Set COPY IOCS
9080 ;
9090 ;ENTER:
9100 ;X=IOCB Index
9110 ;A=CIO Command
9120 ;
9130 ;EXIT:
9140 ;CIO set for I/0 of 12K block
9150 ;at $3000
9160 ;
9170 SET_CPY STA ICCOM,X
9180     LDA #0
9190     STA ICBLL,X
9200     STA ICBAL,X
9210     LDA #$30
9220     STA ICBLH,X
9230     STA ICBAH,X
9240     RTS
9250 ;
9260 ;Set ICCOM for Open
9270 ;
9280 ;ENTER:
9290 ;X=IOCB Index
9300 ;
9310 SET_OPH LDA #3
9320     STA ICCOM,X
9330     RTS
9340 ;
9350 ;Copy I/0 Error
9360 ;
9370 ;ENTER:
9380 ;Y=CIO Error #
9390 ;
9400 ;EXIT:
9410 ;Channels #1 and #2 are closed
9420 ;
9430 CPY_IOR JSR IOERROR
9440     JMP CLOSE2
9450 ;
9460 ;Handle COPY Verb
9470 ;
9480 COPY JSR FINDFILE
9490     JSR CLOSE1
9500     JSR SET_DEV
9510     JSR SET_OPN
9520     JSR SET_4
9530     BMI CPY_IOR
9540      PRINT DEVICE
9550     LDY LNPOS
9560     JSR FINDARG
9570     JSR FINDFILE
9580     JSR CLOSE2
9590     JSR SET_DEV
9600     JSR SET_OPN
9610     LDA #8
9620     STA AUX1,X
9630     JSR CIOV
9640     BMI CPY_IOR
9650 ;
9660     JSR SET_DEST
9678 COPY.2 LDX #$10
9680     LDA #7
9690     JSR SET_CPY
9700     JSR CIOV
9710     BMI EOF
9720     LDA #l
9730     STA COUNT
9740     BNE SAVLEN
9750 ;
9760 EOF LDA #0
9770     STA COUNT
9780 ;
9790 SAVLEN LDA ICBLL,X
9800     STA LENSAV
9810     LDA ICBLH,X
9820     STA LENSAV+1
9830     LDX #$20
9840     LDA #11
9850     JSR SET_CPY
9860     LDA LENSAV
9870     STA ICBLL,X
9880     LDA LENSAV+1
9890     STA ICBLH,X
9900     JSR CIOV
9910     LDA COUNT
9920     BNE COPY.2
9930     JSR CLOSE1
9940     JMP CLOSE2
9950 ;
9960 ;Program Text/Buffers
9970 ;
9980 NOCART .BYTE "No Cart",EOL,0
9990 PROMPT .BYTE EOL
010000 DEFDEV .BYTE "D1:",0
010010 DIRNAM .BYTE "*.*",EOL
010020 EDEV .BYTE "E:",EOL
010030 ERTXT  .BYTE "Error- "
010040 ERBUF  .BYTE "   ",EOL,0
010050 HEXDIG  .BYTE "0123456789"
010060   .BYTE "ABCDEF"
010070 COM .BYTE EOL,"MOC."
010080 BAT .BYTE EOL,"TAB."
010090 ;
010100 ;Command Tables
010110 ;
010120 COMTAB .BYTE "ERAPROUNPREN"
010130   .BYTE "DIRCOPRUN"
010140   .BYTE "CARTYPKIL"
010150 ;
010160 COMADRL .BYTE  <ERASE
010170   .BYTE  <PROTECT
010180   .BYTE  <UNPROTECT
010190   .BYTE  <RENAME
010200   .BYTE <DIRECT
010210   .BYTE <COPY
010220   .BYTE <MEMRUN
010230   .BYTE <GOCART
010240   .BYTE <TYPE
010250   .BYTE <KILL
010260 ;
010270 COMADRH BYTE )ERASE
010280   .BYTE >PROTECT
010290   .BYTE >UNPROTECT
010300   .BYTE >RENAME
010310   .BYTE >DIRECT
010320   .BYTE >COPY
010330   .BYTE >MEMRUN
010340   .BYTE >GOCART
010350   .BYTE >TYPE
010360   .BYTE >KILL
010370 ;
010380 ADDRESS .WORD EPRDN ;RUN Addr
010390 DEVICE .BYTE "D1:"
010400 ;
010410 ;Buffers
010420 ;
010430 FNAME .BYTE "AUTORUN.BAT"
810440   .BYTE EOL,0
810450   .DS 17
010460 INDEX .DS 1    ;HATABS Index
010470 SETFLAG .DS 1  ;set up?
010480 ;
010490 ;Wedge/Handler Space
010500 ;
010510 ;For Batch Processing
010520 ;
010530 BAT_ZIO .DS 16 ;Zpage IOCB
010540 NEW_E.HAN .DS 16 ;E: Handler
010550 BAT_IOCB .DS 16 ;IOCB #5 Copy
010560 ICCOMB = BAT_IOCB+2
010570 ICBALB = BAT_IOCB+4
010580 ICBAHB = BAT_IOCB+5
010590 ICBLLB = BAT-IOCB+8
010600 ICBLHB = BAT_IOCB+9
010610 AUXIS = BAT_IOCB+10
010620 ;
010630 PROGEND = *
010640 T_LENGTH = PROGEND-ORIGIN
010650 ;
010660 ;Entry Point to Start CP
010670 ;
010680 ENTRY LDX #0
010690   STR SETFLAG
010700   STH WARMST
010710   INX
010720   STX BOOT?
010730   JSR HOOKUP
010740    PRINT CREDITS
010750   JSR CLOSE2
010760   JSR SET_OPN
010770   JSR SET_DEV
010780   JSR SET_4
010790   PHP
010800   JSR CLOSE2
010810   PLP
010820   BPL HAV_BAT
010830   LDA TRAMSZ
010840   BNE G_CART
010850   JMP (DOSVEC)
010860 G_CART JMP ($BFFA)
010870 HAV_BAT PRINT PROMPT
010880    PRINT FNAME
010890   PLA
010900   PLA
010910   JMP BAT_GO
010920 ;
010930 CREDITS .BYTE $7D,EOL
010940   .BYTE "BBK CP - (C) 1987 "
010950   .BYTE "ANALOG Computing",EOL
010960   .BYTE "by: Bryan Schappel"
010970   .BYTE EOL,0
010980 ;
010990 ;Set Run Address
011000 ;
011010   *=  RUNAD
011020   .WORD ENTRY
011030   .OPT LIST
011040   .END