Classic Computer Magazine Archive A.N.A.L.O.G. ISSUE 67 / DECEMBER 1988 / PAGE 20

BASIC
to
Binary

Once you have
your BASIC
program made
into a binary
load file, you can
start appending
data and M/L
routines to your
main program
freely, as long as
the data you
append has
binary load
pointers.




by Matthew Arrington

BASIC to Binary is a utility program that will convert a file written and saved under Atari BASIC or BASIC XL into a binary load file. Binary load files are usually machine language programs that are loaded from DOS or a quick menu, or they are sometimes named AUTORUN.SYS, and then automatically load when the computer is turned on.
    BASIC to Binary will also let you determine what action to take if the reset key should be pressed while your program is running. You can have Reset do one of three things: reset and re-run the program, coldstart or simply reset the computer and return to BASIC's READY prompt. The break key can similarly be enabled or disabled. Disabling Break along with trapping Reset will, of course, make the program unlistable.
    Another feature of BASIC to Binary is the ability to have a load title. If you choose to have one, a program title will be displayed while the program is loading in. Last, and certainly not least, is the ability to "relocate" your BASIC program to run anywhere (almost) in memory. This is accomplished by giving BASIC to Binary an address which will be stored at MEMLO (743, 744) during program initialization. This is an ideal way to reserve memory for machine-language subroutines, character sets, etc.
    One thing BASIC to Binary won't do, unfortunately, is make your BASIC programs run faster. A compiler this ain't!
    Listing 1 is the BASIC data used to create your copy of BASIC to Binary. You should type this data using the M/L Editor in this issue.
    Listing 2 is the assembly source code for BASIC to Binary. You don't have to type it to use the program. It is included for those people who have an interest in assemblylanguage programming.

Why binary?
    Atari's binary load process is great for getting things off the disk and into memory with minimum hassle. For example, let's say you're writing a BASIC program and you have a custom character set or some other large amount of data you need to get into memory. Normally your options would be to manually type the data into DATA statements (no thanks) or bring it in from a disk file. Using a disk file is fine while developing a program, but it's a lot nicer having everything in one file for the finished product. Once you have your BASIC program made into a binary load file, you can start appending data and M/L routines to your main program freely, as long as the data you append has binary load pointers.
    A set of binary load pointers looks like this:



    That's all there is to it!
    Another plus to these hybrid files is that they can be loaded from one of the many three-sector quick menus. If you don't have a quick-menu program in your library, I'd suggest getting a hold of one. There is no faster or easier way to load a file from disk than with a quick menu.

Program operation
    BASIC to Binary is written in machine language; so it will need to be loaded from the DOS menu. A quick menu won't work, since this program requires DOS for disk access.
    After loading you should see the main menu. Options are: 1) Display/Set options, 2) Convert a file, 3) Disk Directory and 4) Return to DOS. Pressing 1 will take you to the "Control Pad." In the Control Pad, the select key is used to select a setting to change. The settings are: Reset, Break, Title and MEMLO. An inverse block will highlight the setting that will be affected when you press Option. Each time Option is pressed, you'll change the highlighted setting's function.
    For example, press Select to choose the title setting, then press Option. You will be prompted for a load title. Enter the title, and hit Return. You will then see "ON" in front of the title setting. Note that when entering a title you don't have to worry about centering the title between the prompts. The program will automatically center the title on the screen for you. Once everything is set to your liking, press Start, and you'll be returned to the main menu. You're now ready to turn your BASIC code into binary.
    From the main menu press 2 to convert your BASIC program. You'll see the "INPUT FILE -" prompt. Enter the filename of the program you wish to convert. If the program is on a drive other than Drive 1, you'll need to enter the device number too ("D2:MYPROG.BAS").
    After you have entered the filename and pressed Return, the specified file will be opened and read in. This is the first pass, which consists of reading and counting bytes to find the exact size of your program. When completed, you will be asked for an output file. Use the same procedure to enter the output file as you did for the input file. The output file will be opened, the machine code required to run your BASIC program will be written (two or three sectors), and finally your BASIC program will be copied over. When the copy has completed, you'll be returned to the main menu. From here you can return to DOS and, if BASIC is in the machine, you can try out your newly converted program.

Things to watch out for
    Disk swapping isn't supported. If you have only one disk drive, be sure you have enough free sectors on the disk for the conversion.
    If you need to change the MEMLO address, be sure not to enter an address lower than the address originally shown. Let's say you need to reserve 1K, and from the Control Pad you see "MEMLO - 10000." Use the Select key to select MEMLO, and press Option to get the "New address" prompt. Then add 1024 (1K) to 10000 and enter "11024." Locations 10000 to 11023 will then be reserved for your use, and your program will run starting at location 11024.

LISTING 1

1000 DATA 255,255,0,6,10,6,0,0,0,0,0,0
,0,0,0,0,1875
1010 DATA 0,0,37,115,37,169,0,141,198,
2,133,82,169,97,141,200,7027
1020 DATA 2,169,1,141,240,2,76,70,37,1
25,29,29,29,29,29,29,8163
1030 DATA 29,29,29,29,32,66,97,115,105
,99,32,116,111,32,66,105,1715
1040 DATA 110,97,114,121,32,98,121,58,
32,77,97,116,116,104,101,119,4129
1050 DATA 32,65,114,114,105,110,103,11
6,111,110,0,160,0,132,0,185,3671
1060 DATA 20,37,201,96,208,2,169,155,1
32,0,168,162,0,169,11,157,5639
1070 DATA 66,3,169,0,157,72,3,157,73,3
,152,32,86,228,164,0,3656
1080 DATA 164,0,200,185,20,37,208,213,
96,226,2,227,2,0,37,0,2517
1090 DATA 39,5,39,255,255,6,39,233,39,
8,39,3,40,32,32,32,8580
1100 DATA 32,32,32,32,32,32,32,32,32,3
2,32,32,32,32,32,32,5452
1110 DATA 32,8,8,0,0,8,45,41,165,6,288
,102,169,1,141,240,5008
1120 DATA 2,169,0,133,82,76,93,39,125,
160,160,160,160,208,210,207,1680
1130 DATA 199,218,193,205,160,210,197,
209,213,201,210,197,211,160,194,193,78
41
1140 DATA 211,201,195,174,160,160,210,
197,194,207,207,212,160,160,168,160,57
57
1150 DATA 160,0,168,8,132,0,185,51,39,
201,96,208,2,169,155,132,6895
1160 DATA 0,168,162,0,169,11,157,66,3,
169,0,157,72,3,157,73,2622
1170 DATA 3,152,32,86,228,164,8,164,0,
200,185,51,39,208,213,76,7830
1180 DATA 138,39,173,31,39,248,87,162,
96,76,152,39,83,169,151,157,7565
1190 DATA 68,3,169,39,157,69,3,169,12,
157,74,3,169,1,157,75,2793
1200 DATA 3,169,3,157,66 3,32,86,228,1
69,10,133,84,169,0,133,472
1210 DATA 85,160,0,132,8,185,8,39,201,
96,208,2,169,155,132,0,5049
1220 DATA 168,162,96,169,11,157,66,3,1
69,0,157,72,3,157,73,3,1651
1230 DATA 152,32,86,228,164,0,164,0,20
0,185,8,39,288,213,96,226,9532
1240 DATA 2,227,2,35,39,244,39,44,41,1
60,8,173,33,39,141,231,4957
1250 DATA 2,24,185,242,133,203,173,34,
39,4,40,255,48,141,232,2,5846
1260 DATA 105,0,133,204,173,29,39,240,
12,201,2,208,43,169,1,141,5644
1270 DATA 68,2,76,63,40,165,13,281,8,1
76,11,169,136,133,12,169,5206
1280 DATA 40,133,13,76,63,40,165,12,14

1,134,40,165,13,141,135,40,3572
1290 DATA 169,133,133,12,169,40,133,13
173,231,2,24,113,203,153,128,7123
1300 DATA 0,200,173,232,2,113,203,153,
128,0,200,192,14,208,233,165,1365
1310 DATA 140,133,142,133,144,165,141,
133,143,133,145,169,8,133,146,133,8855
1320 DATA 202,162,255,154,216,173,34,2
141,131,40,173,35,2,141,132,5404
1330 DATA 40,76,136,40,169,64,133,16,1
41,14,210,76,0,0,32,0,9489
1340 DATA 0,162,0,173,30,39,208,10,169
,123,141,34,2,169,40,141,4234
1350 DATA 35,2,189,26,3,201,69,240,5,2
32,232,232,208,244,232,142,5257
1360 DATA 25,41,189,26,3,133,203,169,2
7,157,26,3,232,189,26,3,3959
1370 DATA 133,204,169,41,157,26,3,160,
0,162,4,177,203,153,27,41,4454
1380 DATA 200,202,208,247,160,8,162,7,
177,203,153,27,41,280,202,208,955
1390 DATA 247,169,2,141,26,41,169,1,13
3,9,133,8,173,250,191,141,7828
1400 DATA 240,40,173,251,191,141,241,4
0,76,0,0,172,26,41,192,255,7671
1410 DATA 240,9,185,42,41,206,26,41,16
0,0,41,54,41,1,96,138,1076
1420 DATA 72,174,25,41,165,203,157,26,
3,232,165,204,157,26,3,104,6153
1430 DATA 170,169,155,160,1,96,0,0,0,0
,0,0,241,40,0,0,7317
1440 DATA 0,0,0,0,0,0,0,78,85,82,224,2
,225,2,244,39,3374
1450 DATA 0,0,0,0,55,41,50,42,112,112,
112,66,64,156,66,104,2479
1460 DATA 156,66,144,156,66,184,156,66
224,156,66,8,157,66,48,157,6453
1470 DATA 66,88,157,66,128,157,66,168,
157,66,208,157,66,248,157,66,9821
1480 DATA 32,158,66,72,158,66,112,158,
66,152,158,66,192,158,66,232,9602
1490 DATA 158,66,16,159,66,56,159,66,9
6,159,66,136,159,66,176,159,7758
1500 DATA 66,216,159,65,55,41,125,96,9
6,96,96,96,32,32,32,32,787
1510 DATA 32,32,32,32,32,18,18,18,18,2
3,18,18,18,18,32,32,4652
1520 DATA 32,32,96,32,32,32,32,32,32,3
2,32,32,32,32,32,32,6064
1530 DATA 124,32,32,32,32,32,32,32,32,
96,32,32,32,32,32,17,6374
1540 DATA 18,18,18,18,18,18,18,24,18,1
8,18,18,18,18,18,5,3828
1550 DATA 96,32,32,32,32,32,124,194,22
5,243,233,227,160,244,239,160,6089
1560 DATA 194,233,238,225,242,249,124,
96,17,18,18,18,18,24,18,18,49
1570 DATA 18,18,18,18,18,18,18,18,18,1
8,18,18,18,24,18,18,4102
1580 DATA 18,18,5,96,124,32,32,32,32,3
2,32,32,32,32,32,32,6525
1590 DATA 32,32,32,32,32,32,32,32,32,3
2,32,32,32,32,124,96,8346
1600 DATA 124,32,49,58,32,68,105,115,1
12,188,97,121,47,83,101,116,4141
1610 DATA 32,79,112,116,51,42,28,43,10
5,111,118,115,32,32,124,96,2552
1620 DATA 124,32,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,6064
1630 DATA 32,32,32,32,32,32,32,32,32,3
2,124,96,124,32,58,58,9644
1640 DATA 32,67,111,110,118,101,114,11
6,32,66,97,115,105,99,32,182,3759
1650 DATA 105,108,101,32,32,32,124,96,
0,124,32,32,32,32,32,32,8222
1660 DATA 32,32,32,32,32,32,32,32,32,3
2,32,32,32,32,32,32,6012
1670 DATA 32,32,32,124,96,124,32,51,58
,32,70,105,108,101,32,68,1472
1680 DATA 105,114,101,99,116,111,114,1
21,32,32,32,32,32,32,32,124,396
1690 DATA 96,124,32,32,32,32,32,32,32,
32,32,32,32,32,32,32,6290
1700 DATA 32,32,32,32,32,32,32,32,32,3
2,32,124,96,124,32,52,9596
1710 DATA 58,32,69,120,105,116,32,116,
111,32,68,79,83,32,32,32,426
1720 DATA 32,32,32,32,32,32,32,124,96,
124,32,32,32,32,32,32,8304
1730 DATA 32,32,32,32,32,32,32,32,32,3
2,32,32,32,32,32,32,6082
1740 DATA 32,32,32,124,96,26,18,18,18,
18,18,18,18,18,18,18,5134
1750 DATA 18,18,18,18,18,18,18,18,18,1
8,18,18,18,18,18,3,3958
1760 DATA 96,0,29,43,24,44,169,0,141,1
,6,169,10,141,24,2,9551
1770 DATA 173,252,2,201,255,240,54,76,
52,43,95,30,0,160,0,132,3613
1780 DATA 0,185,49,43,201,96,208,2,169
,155,132,0,168,162,0,169,7201
1790 DATA 11,157,66,3,169,0,157,72,3,1
57,73,3,152,32,86,228,4643
1800 DATA 164,0,164,0,200,185,49,43,20
8,213,76,228,43,173,24,2,6200
1810 DATA 208,190,173,2,6,240,59,76,11
6,43,95,38,0,160,0,132,2647
1820 DATA 0,185,113,43,281,96,208,2,16
9,155,132,8,168,162,0,169,7433
1830 DATA 11,157,66,3,169,0,157,72,3,1
57,73,3,152,32,86,228,4683
1840 DATA 164,0,164,0,200,185,113,43,2
08,213,169,0,141,2,6,76,4769
1850 DATA 34,43,76,175,43,32,30,8,160,
8,132,8,185,172,43,281,5881
1860 DATA 96,208,2,169,155,132,8,168,1
62,0,169,11,157,66,3,169,5128
1870 DATA 0,157,72,3,157,73,3,152,32,8
6,228,164,0,164,0,280,5992
1880 DATA 185,172,43,208,213,169,1,141
,2,6,76,34,43,162,48,169,4157
1890 DATA 7,157,66,3,169,0,157,72,3,15
7,73,3,32,86,228,201,5633
1900 DATA 126,208,11,174,1,6,208,3,76,
34,43,76,86,44,201,156,4346
1910 DATA 208,11,174,1,6,208,3,76,34,4
3,76,121,44,201,155,208,6636
1920 DATA 3,76,25,44,28,45,158,44,174,
116,65,288,9,41,127,201,5903
1930 DATA 97,144,3,56,233,32,174,1,6,2
36,0,6,288,3,76,34,2047
1940 DATA 43,157,126,5,232,142,1,6,132
,0,168,162,8,169,11,157,4785
1950 DATA 66,3,169,0,157,72,3,157,73,3
,152,32,86,228,164,8,4536
1960 DATA 76,34,43,32,193,44,169,126,1
32,0,168,162,8,169,11,157,5804
1970 DATA 66,3,169,0,157,72,3,157,73,3
,152,32,86,228,164,8,4556
1980 DATA 206,1,6,76,34,43,32,193,44,1
69,126,132,8,168,162,8,4544
1990 DATA 169,11,157,66,3,169,0,157,72
,3,157,73,3,152,32,86,2505
2000 DATA 228,164,0,286,1,6,208,225,76
,34,43,169,156,132,0,168,6766
2010 DATA 162,8,169,11,157,66,3,169,0,
157,72,3,157,73,3,152,3215
2020 DATA 32,86,228,164,0,174,1,6,169,
0,157,126,5,96,76,199,5156
2030 DATA 44,31,126,8,168,0,132,0,185,
196,44,201,96,208,2,169,7653
2040 DATA 155,132,8,168,162,8,169,11,1
57,66,3,169,0,157,72,3,2672
2050 DATA 157,73,3,152,32,86,228,164,0
,164,0,208,185,196,44,288,9731
2060 DATA 213,96,162,0,132,8,168,169,1
1,157,66,3,169,8,157,72,4274
2070 DATA 3,157,73,3,152,32,86,228,164
,0,96,160,8,185,ll7,65,5833
2080 DATA 153,188,21,45,94,45,65,200,1
92,3,288,245,173,127,5,281,9775
2090 DATA 58,208,5,160,2,76,56,45,160,
8,173,128,5,281,58,208,6393
2100 DATA 8,173,127,5,141,181,65,160,3
,162,3,185,126,5,157,180,5464
2110 DATA 65,240,4,208,232,208,244,96,
165,226,56,229,224,141,8,6,562
2120 DATA 165,227,229,225,141,9,6,238,
8,6,288,3,238,9,6,96,4333
2130 DATA 116,65,111,66,8,68,49,58,68,
48,58,42,46,42,162,48,806
2140 DATA 76,133,65,75,58,169,131,157,
68,3,169,65,157,69,3,169,5491
2150 DATA 4,157,74,3,169,8,157,75,3,16
9,3,157,66,3,32,86,1636
2160 DATA 228,169,55,141,48,2,169,41,1
41,49,2,169,64,133,88,169,5745
2170 DATA 156,133,89,169,1,141,240,2,1
69,31,133,83,169,0,141,47,5436
2180 DATA 2,141,198,2,169,97,141,208,2
,169,2,133,82,160,0,132,5824
2190 DATA 0,185,133,41,201,96,208,2,16
9,155,132,0,168,162,0,169,7855
2200 DATA 11,157,66,3,169,0,157,72,3,1
57,73,3,152,32,86,228,5053
2210 DATA 164,8,164,8,200,185,133,41,2
08,213,160,8,132,0,185,116,8344
2220 DATA 42,201,96,208,2,169,155,132,
0,168,162,0,169,11,157,66,6173
2230 DATA 3,169,8,157,72,3,157,73,3,15
2,32,86,228,164,0,164,6075
2240 DATA 0,200,185,116,42,208,213,169
,33,141,47,2,169,69,141,4,5550
2250 DATA 6,169,90,141,5,6,160,11,169,
8,162,3,157,16,157,153,5184
2260 DATA 16,157,172,4,6,173,5,6,140,5
,6,141,4,6,162,4,9971
2270 DATA 160,18,189,16,157,141,3,6,17
3,4,6,157,16,157,185,16,3765
2280 DATA 157,133,203,173,5,6,153,16,1
57,169,0,133,20,165,28,201,6049
2290 DATA 112,66,107,67,3,208,250,169,
8,32,147,66,157,16,157,169,7541
2300 DATA 1,32,147,66,153,16,157,173,2
52,2,201,255,208,92,232,136,3621
2310 DATA 192,2,208,194,76,54,66,201,1
,240,6,173,3,6,76,159,5038
2320 DATA 66,165,203,281,90,208,3,76,1
97,66,201,69,208,3,76,197,8966
2330 DATA 66,201,67,208,3,76,197,66,20
1,81,288,3,76,197,66,201,9104
2340 DATA 82,248,3,169,82,96,169,0,96,
173,4,6,201,90,208,13,5667
2350 DATA 169,67,141,4,6,169,81,141,5,
6,76,227,66,169,69,141,6011
2360 DATA 4,6,169,90,141,5,6,169,87,96
,169,0,133,82,162,48,5049
2370 DATA 169,7,157,66,3,169,0,157,72,
3,157,73,3,32,86,228,4279
2380 DATA 41,127,201,97,144,3,56,233,3
2,201,50,288,6,32,49,67,4337
2390 DATA 76,188,65,201,49,208,6,32,79
,69,76,188,65,201,51,208,7877
2400 DATA 6,32,118,76,76,126,65,201,52
,240,3,76,188,65,169,39,6653
2410 DATA 133,83,108,10,0,169,125,32,2
45,44,169,16,141,0,6,169,4541
2420 DATA 10,133,84,169,0,133,85,76,84
,67,73,78,80,85,84,32,2792
2430 DATA 70,73,76,69,32,45,32,0,160,0
,132,0,185,78,67,281,4302
2440 DATA 96,288,2,169,155,132,0,168,1
62,0,169,11,157,66,3,169,5788
2450 DATA 108,67,103,68,8,157,72,3,157
,73,3,152,32,86,228,164,6407
2460 DATA 0,164,0,280,185,78,67,208,21
3,32,29,43,173,1,6,208,5819
2470 DATA 1,96,32,14,45,162,16,169,12,
157,66,3,32,86,228,162,5548
2480 DATA 16,169,100,157,68,3,169,65,1
57,69,3,169,4,157,74,3,3395
2490 DATA 169,0,157,75,3,169,3,157,66,
3,32,86,228,48,140,169,6184
2500 DATA 0,141,6,39,141,7,39,162,16,1
69,7,157,66,3,169,8,2502
2510 DATA 157,72,3,157,73,3,32,86,228,
192,136,248,18,238,6,39,7267
2520 DATA 288,229,238,7,39,288,224,162
,16,169,12,157,66,3,32,86,4841
2530 DATA 228,162,16,169,180,157,68,3,
169,65,157,69,3,169,4,157,5451
2540 DATA 74,3,169,0,157,75,3,169,3,15
7,66,3,32,86,228,76,4350
2550 DATA 25,68,79,85,84,80,85,84,32,7
0,73,76,69,32,45,32,698
2560 DATA 0,168,8,132,0,185,18,68,281,
96,208,2,169,155,132,8,6568
2570 DATA 168,162,0,169,11,157,66,3,16
9,0,157,72,3,157,73,3,2713
2580 DATA 152,32,86,228,164,8,164,0,20
0,185,18,68,208,213,32,29,7148
2590 DATA 43,173,1,6,208,1,96,32,14,45
,162,32,169,12,157,66,3498
2600 DATA 3,32,86,228,162,32,169,100,1
57,68,3,169,65,157,69,3,5182
2610 DATA 104,68,99,69,169,8,157,74,3,
169,0,157,75,3,169,3,3208
2620 DATA 157,66,3,32,86,228,48,139,16
9,8,133,224,169,39,133,225,302
2630 DATA 169,54,133,226,169,41,133,22
7,32,71,45,173,33,39,24,185,4632
2640 DATA 242,133,203,173,34,39,105,0,
133,204,165,283,141,51,41,24,6622
2650 DATA 109,6,39,141,53,41,165,204,1
41,52,41,109,7,39,141,54,3914
2660 DATA 41,173,53,41,56,233,1,141,53
,41,173,54,41,233,8,141,5672
2670 DATA 54,41,162,32,169,11,157,66,3
,169,0,157,68,3,169,39,3644
2680 DATA 157,69,3,173,8,6,157,72,3,17
3,9,6,157,73,3,32,975
2690 DATA 86,228,162,16,169,7,157,66,3
,169,95,157,68,3,169,45,5123
2700 DATA 157,69,3,169,5,157,72,3,169,
20,157,73,3,32,86,228,4924
2710 DATA 189,72,3,141,8,6,189,73,3,14
1,9,6,148,10,6,162,1849
2720 DATA 32,169,11,157,66,3,169,95,15
7,68,3,169,45,157,69,3,4062
2730 DATA 173,8,6,157,72,3,173,9,6,157
,73,3,32,86,228,172,5481
2740 DATA 10,6,192,136,288,172,162,16,
169,12,157,66,3,32,86,228,6801
2750 DATA 162,32,169,12,157,66,3,32,86
,228,96,169,125,32,245,44,7579
2760 DATA 169,8,133,82,76,122,69,32,32
,66,97,115,105,99,32,116,3989
2770 DATA 100,69,95,70,111,32,66,185,1
18,97,114,121,32,67,111,110,5067
2780 DATA 116,114,111,108,32,88,97,100
,96,0,160,8,132,0,185,91,4579
2790 DATA 69,201,96,288,2,169,155,132,
8,168,162,0,169,11,157,66,6770
2800 DATA 3,169,8,157,72,3,157,73,3,15
2,32,86,228,164,8,164,6645
2810 DATA 0,280,185,91,69,208,213,76,2
81,69,32,32,13,13,13,13,1818
2820 DATA 13,13,13,13,13,13,13,13,13,1
3,13,13,13,13,13,13,4588
2830 DATA 13,13,13,13,13,13,13,96,B,16
0,0,132,8,185,178,69,3390
2840 DATA 201,96,288,2,169,155,132,0,1
68,162,0,169,11,157,66,3,5103
2850 DATA 169,0,157,72,3,157,73,3,152,
32,86,228,164,0,164,0,5232
2860 DATA 280,185,170,69,208,213,76,28
70,32,32,211,197,204,197,195,2552
2870 DATA 212,32,58,32,73,116,101,109,
32,116,111,32,99,184,97,11B,5099
2880 DATA 103,101,96,8,160,0,132,0,185
,249,69,201,96,208,2,169,9417
2890 DATA 155,132,8,168,162,0,169,11,1
57,66,3,169,0,157,72,3,3522
2900 DATA 157,73,3,152,32,86,228,164,0
,164,0,200,185,249,69,288,1698
2910 DATA 213,76,93,78,32,32,287,208,2
12,281,287,286,32,58,32,67,8746
2920 DATA l04,97,11B,1B3,181,1l5,32,73
116,181,189,96,B,16O,8,132,4720
2930 DATA 96,70,91,71,0,185,68,78,281,
96,208,2,169,155,132,0,7297
2940 DATA 168,162,8,169,11,157,66,3,16
9,8,157,72,3,157,73,3,3083
2950 DATA 152,32,86,228,164,0,164,8,20
8,185,68,70,288,213,76,162,968
2960 DATA 70,32,32,211,212,193,218,212
160,32,58,32,69,120,185,116,8208
2970 DATA 115,96,96,96,96,0,168,0,132,
0,185,141,70,281,96,288,8956
2980 DATA 2,169,155,132,8,168,162,8,16
9,11,157,66,3,169,8,157,5522
2990 DATA 72,3,157,73,3,152,32,86,228,
164,0,164,0,208,185,141,9161
3000 DATA 70,208,213,76,245,70,210,197
,211,197,212,32,45,96,96,66,130
3010 DATA 82,69,65,75,32,45,96,96,84,7
3,84,76,69,32,45,96,2473
3020 DATA 96,77,69,77,76,79,32,45,8,16
0,0,132,8,185,210,78,5267
3030 DATA 201,96,288,2,169,155,132,8,1
68,162,8,169,11,157,66,3,5293
3040 DATA 169,8,157,72,3,157,73,3,152,
32,86,228,164,8,164,0,5422
3050 DATA 200,185,210,78,208,213,169,8
,141,3,6,141,6,6,178,169,6504
3060 DATA 8,141,7,6,32,220,71,174,3,6,
232,142,3,6,224,4,4654
3070 DATA 208,242,169,8,141,31,208,173
31,288,201,7,176,244,168,169,3614
3080 DATA 8,141,31,208,141,10,212,169,
8,141,31,208,173,31,208,201,1226
3090 DATA 92,71,87,72,7,208,244,169,10
,141,30,2,173,30,2,208,6097
3100 DATA 251,152,201,5,240,8,201,3,28
8,3,76,94,76,96,165,88,7038
3110 DATA 133,203,165,89,133,204,173,7
6,170,165,203,24,105,40,133,8171
3120 DATA 203,165,284,105,8,133,204,20
2,208,240,160,0,177,203,240,7,3414
3130 DATA 41,127,145,203,200,208,245,1
73,6,6,201,3,208,28,169,0,8011
3140 DATA 141,6,6,169,8,141,7,6,165,28
3,56,233,240,133,203,165,2564
3150 DATA 204,233,0,133,284,160,0,76,2
05,71,238,6,6,238,7,6,5796
3160 DATA 238,7,6,168,80,177,203,240,8
24,105,128,145,283,280,288,2931
3170 DATA 244,76,62,71,169,0,133,203,1
33,284,189,29,39,168,202,224,2573
3180 DATA 255,240,18,165,203,24,105,6,
133,203,76,230,71,136,192,255,3157
3190 DATA 240,18,165,204,24,105,2,133,
204,76,245,71,165,204,24,101,9709
3200 DATA 203,178,189,78,76,141,23,72,
189,71,76,141,24,72,76,0,3952
3210 DATA 0,169,8,133,84,169,8,133,85,
76,58,72,84,114,97,112,5620
3220 DATA 32,38,32,82,101,45,82,117,11
8,32,80,114,111,103,114,97,5742
3230 DATA 109,0,168,8,132,8,185,36,72,
201,96,208,2,169,155,132,9101
3240 DATA 0,168,162,0,169,11,157,66,3,
169,8,157,72,3,157,73,4702
3250 DATA 88,72,83,73,3,152,32,86,228,
164,8,164,0,200,185,36,7673
3260 DATA 72,288,213,96,169,8,133,84,1
69,8,133,85,76,137,72,82,6649
3270 DATA 101,115,181,116,32,78,111,11
4,109,97,108,108,121,32,32,32,4133
3280 DATA 32,32,32,32,8,160,0,132,0,18
5,115,72,281,96,208,2,6704
3290 DATA 169,155,132,0,168,162,0,169,
11,157,66,3,169,0,157,72,5464
3300 DATA 3,157,73,3,152,32,86,228,164
,8,164,0,200,185,115,72,8573
3310 DATA 208,213,96,169,8,133,84,169,
8,133,85,76,216,72,67,111,7532
3320 DATA 108,100,32,83,116,97,114,116
,32,32,32,32,32,32,32,32,144
3330 DATA 32,32,32,0,160,8,132,8,185,1
94,72,201,96,208,2,169,8949
3340 DATA 155,132,0,168,162,0,169,11,1
57,66,3,169,0,157,72,3,3972
3350 DATA 157,73,3,152,32,86,228,164,8
,164,0,200,185,194,72,208,1423

3360 DATA 213,96,169,10,133,84,169,8,1
33,85,76,26,73,68,105,115,5239
3370 DATA 97,98,108,101,188,8,168,0,13
2,0,185,17,73,201,96,208,7969
3380 DATA 2,169,155,132,0,168,162,0,16

9,11,157,66,3,169,0,157,5922
3390 DATA 72,3,157,73,3,152,32,86,228,
164,0,164,0,200,185,17,7577
3400 DATA 73,208,213,96,169,10,133,84,
169,8,133,85,76,92,73,69,5979
3410 DATA 84,73,79,74,110,97,98,188,10
1,100,32,8,160,0,132,0,3176
3420 DATA 185,83,73,201,96,208,2,169,1
55,132,0,168,162,0,169,11,7436
3430 DATA 157,66,3,169,0,157,72,3,157,
73,3,152,32,86,228,164,7538
3440 DATA 0,164,0,288,185,83,73,208,21
3,96,169,12,133,84,169,8,8614
3450 DATA 133,85,76,153,73,79,102,102,
8,160,8,132,0,185,149,73,6139
3460 DATA 201,96,208,2,169,155,132,8,1
68,162,0,169,11,157,66,3,5723
3470 DATA 169,0,157,72,3,157,73,3,152,
32,86,228,164,0,164,0,5852
3480 DATA 200,185,149,73,208,213,96,16
9,12,133,84,169,8,133,85,76,7978
3490 DATA 214,73,79,110,32,0,160,0,132
,0,185,210,73,201,96,208,81
3500 DATA 2,169,155,132,0,168,162,8,16
9,11,157,66,3,169,0,157,6042
3510 DATA 72,3,157,73,3,152,32,86,228,
164,0,164,0,200,185,210,785
3520 DATA 73,208,213,238,116,65,169,16
,133,84,169,0,133,85,76,32,6348
3530 DATA 74,69,78,84,69,82,32,84,73,8
4,76,69,58,96,96,0,2744
3540 DATA 160,0,132,0,185,17,74,201,96
,208,2,169,155,132,0,168,8794
3550 DATA 162,0,169,11,157,66,3,169,0,
157,72,3,157,73,3,152,4755
3560 DATA 32,86,228,164,0,164,0,200,18
5,17,74,208,213,76,124,74,9710
3570 DATA 80,74,75,75,91,32,32,32,32,3
2,32,32,32,32,32,32,8650
3580 DATA 32,32,32,32,32,32,32,32,32,9
3,30,30,30,30,30,30,8380
3590 DATA 30,30,30,30,30,30,30,30,30,3
0,30,30,30,30,30,0,7190
3600 DATA 160,0,132,0,185,80,74,201,96
,208,2,169,155,132,0,168,9232
3610 DATA 162,0,169,11,157,66,3,169,0,
157,72,3,157,73,3,152,4815
3620 DATA 32,86,228,164,0,164,0,200,13
5,80,74,208,213,169,19,141,1199
3630 DATA 0,6,32,29,43,169,16,133,84,1
69,0,133,85,76,190,74,6504
3540 DATA 156,0,160,0,132,0,185,188,74
,201,96,208,2,169,155,132,792
3650 DATA 0,168,162,0,169,11,157,66,3,
169,0,157,72,3,157,73,5112
3660 DATA 3,152,32,86,228,164,0,164,0,
208,185,188,74,288,213,173,3971
3670 DATA 1,6,208,6,206,116,65,76,59,7
6,160,19,169,32,153,8,5467
3680 DATA 39,136,192,255,208,248,162,1
0,173,1,6,202,56,233,2,176,222
3690 DATA 258,224,11,144,2,162,0,168,0
,185,126,5,240,8,157,8,6270
3700 DATA 39,200,232,76,21,75,206,116,
65,96,169,14,133,84,169,8,7204
3710 DATA 133,85,76,55,75,32,32,32,32,
32,0,160,0,132,0,185,2844
3720 DATA 49,75,201,96,208,2,169,155,1
32,0,168,162,0,169,11,157,8404
3730 DATA 76,75,71,76,66,3,169,8,157,7
2,3,157,73,3,152,32,3837
3740 DATA 86,228,164,0,164,0,200,185,4
9,75,208,213,169,14,133,84,241
3750 DATA 169,8,133,85,173,33,39,133,2
12,173,34,39,133,213,32,170,9465
3760 DATA 217,169,212,133,243,169,0,13
3,244,133,242,32,230,216,160,255,7842
3770 DATA 200,185,128,5,41,127,153,128
,5,201,46,208,243,169,0,153,836
3780 DATA 128,5,160,0,132,0,177,243,20
1,96,208,2,169,155,132,8,9669
3790 DATA 168,162,0,169,11,157,66,3,16
9,0,157,72,3,157,73,3,3933
3800 DATA 152,32,86,228,164,0,164,0,20
8,177,243,288,215,96,169,16,2823
3810 DATA 133,84,169,0,133,85,76,229,7
5,78,69,87,32,77,69,77,5176
3820 DATA 76,79,32,86,65,76,85,69,32,7
3,83,58,0,160,0,132,3401
3830 DATA 8,185,209,75,201,96,208,2,16
9,155,132,0,168,162,0,169,9859
3840 DATA 11,157,66,3,169,0,157,72,3,1
57,73,3,152,32,86,228,6693
3850 DATA 164,0,164,0,280,185,209,75,2
08,213,169,5,141,0,6,32,7035
3860 DATA 29,43,173,1,6,240,28,169,126
,133,243,169,5,133,244,169,2972
3870 DATA 0,133,242,32,0,216,32,210,21
7,165,212,141,33,39,165,213,2675
3880 DATA 141,34,39,174,6,6,169,8,157,
29,39,76,220,71,25,72,4576
3890 DATA 72,76,67,77,104,72,183,72,6,
73,72,73,59,76,138,73,4953
3900 DATA 199,73,59,76,38,75,198,75,59
,76,174,6,6,254,29,39,5322
3910 DATA 189,29,39,201,3,208,5,169,0,
157,29,39,32,220,71,76,5862
3920 DATA 62,71,169,125,32,245,44,169,
8,141,121,65,76,151,76,96,7720
3930 DATA 96,96,87,104,105,99,104,32,1
08,114,105,118,101,63,32,177,7116
3940 DATA 45,184,8,160,0,132,0,185,131
,76,201,96,208,2,169,155,314
3950 DATA 132,8,168,162,8,169,11,157,6
6,3,169,8,157,72,3,157,5670
3960 DATA 73,3,152,32,86,228,164,0,164
,0,200,185,131,76,208,213,2760
3970 DATA 162,48,169,7,157,66,3,169,8,
157,72,3,157,73,3,32,3335
3980 DATA 86,228,141,121,65,162,16.169
,12,157,66,3,32,86,228,162,8262
3990 DATA 16,169,120,157,68,3,169,65,1
57,69,3,169,6,157,74,3,4991
4000 DATA 169,0,157,75,3,169,3,157,66,
3,32,86,228,16,1,96,3993
4010 DATA 162,0,169,12,157,66,3,32,86,
228,162,0,76,20,77,69,4548
4020 DATA 169,19,157,68,3,169,77,157,6
9,3,169,12,157,74,3,169,6274
4030 DATA 0,157,75,3,169,3,157,66,3,32
,86,228,169,0,141,198,8580
4040 DATA 2,162,16,169,7,157,66,3,169,
0,157,72,3,157,73,3,4045
4050 DATA 68,77,192,77,32,86,228,48,26
,132,8,168,162,0,169,11,6199
4060 DATA 157,66,3,169,8,157,72,3,157,
73,3,152,32,86,228,164,8168
4070 DATA 8,16,210,162,16,169,12,157,6
6,3,32,86,228,76,129,77,7017
4080 DATA 96,96,84,121,112,101,32,97,1
10,121,32,107,101,121,46,96,6339
4090 DATA 8,160,0,132,8,185,112,77,201
,96,288,2,169,155,132,0,8876
4100 DATA 168,162,8,169,11,157,66,3,16
9,0,157,72,3,157,73,3,4243
4110 DATA 152,32,86,228,164,0,164,8,20
8,185,112,77,288,213,162,48,2154
4120 DATA 169,7,157,66,3,169,8,157,72,
3,157,73,3,32,86,228,6029
4130 DATA 96,226,2,227,2,126,65,8,0,0,
0,0,0,0,8,0,6813


LISTING 2
blue indicates inverse video

10 ;BASIC TO BINARY -10/16 ;

20 ;BY: MATTHEW ARRINGTON  ;
30 ;                       ;
40 ; OSS. MAC-65 SOURCE    ;
50 ;
60       .OPT NO LIST
70 ;
80 ;
90 ; MACROS
0100 ;
0110     .MACRO @PT
0120 ;
0130 ; PUT TO DEVICE
0140 ; " PUT IOCB#, BYTE "
0150 ;
0160     STY 0
0170     TAY
0180       .IF %0=1
0190       LDX #%1*16
0200       .ENDIF
0210     LDA #ll
0220     STA 834,X    ; COMMAND PUT=11
0230     LDA #0
0240     STA 840,X
0250     STA 841,X
0260     TYA
0270     JSR 58454
0280     LDY 0
0290     .ENDM
0300 ;
0310 ;
0320 ;
0330     .MACRO LGT
0340 ;
0350 ; GET FROM DEVICE (INTERNAL)
0360 ; " GET IOCB# "
0370 ;
0380       .IF %0=1
0390       LDX #%1*16
0400 ENDIF
0410    LDA #7
0420    STA 834,X    ; COMMAND GET=7
0430    LDA #O
0440    STA 840,X
0450    STA 841,X
0460    JSR 58454
0470 ENDM
0480 ;
0490 ; PUT BYTE
0500 ;
0510 ;
0520    .MACRO PUT
0530      .IF %0=0
0540       @PT
0550      .ELSE
0560       @PT %1
0570      .ENDIF
0580    .ENDM
0590 ;
0600 ;  GET  EX. "GET 0"
0610 ;
0620     .MACRO GET
0630       .IF %0=0
0640        @GT
0650       .ELSE
0660        @GT %1
0670       .ENDIF
0680     .ENDM
0690 ;
0700 ;  PRINT
0710 ;
0720     .MACRO PRINT
0730 ;
0740     JMP @OVER
0750 @TEXT .BYTE %$2,0
0760 @OVER LDY #0
0770 @LOOP STY 0
0780     LDA @TEXT,Y
0790     CMP #'
0800     BNE @CIO
0810     LDA #155
0820 @CIO  @PT  %1
0830     LDY 0
0840     INY
0850     LDA @TEXT,Y
0860     BNE @LOOP
0870     .ENDM
0880 ;
0890 ; PRINT BUFFER
0900     .MACRO PRINTB
0910     LDY #0
0920 @LO STY 0
0930 ;
0940       .IF %2<256
0950       LDA (%2),Y
0960       .ELSE
0970 ;
8980       LDA X2, Y
0990       .ENDIF
1000 ;
1010     CMP #'
1020     BNE @CO
1030     LDA #155
1040 @CO  @PT %1
1050     LDY 0
1060     INY
1070       .IF %2<256
1080       LDA (%2),Y
1090       .ELSE
1180       LDA X2, Y
1110       .ENDIF
1120     BNE @LO
1130     .ENDM
1140 ;
1150 ; INPUT RECORD/ SAVE EOL
1160 ; EX. "INPUT IOCB#"
1170 ;
1180     .MACRO INPUT
1190 ;
1200     LDX #%1*16
1210     LDA #%2&255 ; INBUF LO
1220     STA 836,X
1230     LDA #%2/256 ; INBUF LO
1240     STA 837,X
1250     LDA #5      ; GET RECORD
1260     STA 834,X
1270     LDA #40     ; BUF LEN
1280     STA 840,X
1290     LDA #0
1300     STA 841,X
1310     JSR 58454
1320     LDY 840,X
1330     LDA #0
1340     STA %2,Y
1350     .ENDM
1360 ;
1370     .MACRO OPEN
1380 ;
1390     LDX #%1*16 ; IOCB #
1400       .IF %4<256
1410       JMP LEXC
1420 @OPEN .BYTE %$4
1430 @EXC  LDA #@OPEN&255 ;(S:,D:)
1440       STA 836,X
1450       LDA #@OPEN/256
1460       STA 837,X
1470       .ELSE
1480       LDA #%4&255
1490       STA 836,X
1500       LDA #%4/256
1510       STA 837,X
1520       .ENDIF
1530     LDA #%2
1540     STA 842,X    ; OPEN (8,12,41
1550     LDA #%3
1560     STA 843,X    ; AUX1
1570     LDA #3       ; COMMAND OPEN
1580     STA 834,X
1590     JSR 58454
1600     .ENDM
1610 ;
1620     .MACRO RWSECT
1630 ;
1640 ; DUNIT,DCOM,DBUFF,5IZE,5ECT
1650 ;
1660     LDA #49
1670     STA 768     ; DDEUIC
1680       .IF %1>4
1690       LDA %1
1700       .ELSE
1710       LDA #%1
1720       .ENDIF
1730     STA 769     ; DUNIT
1740     LDA #%2
1750     STA 770
1760     LDA #%6
1770     STA 771
1780     LDA #%3&255
1790     STA 772
1800     LDA #%3/256
1810     STA 773
1820     LDA #31
1830     STA 774
1840     LDA #%4&255
1850     STA 776
1860     LDA #%4/256
1870     STA 777
1880     LDA #%5&255
1890     STA 778
1900     LDA #%5/256
1910     STA 779
1920     JSR 58457
1930     .ENDM
1940 ;
1950 ; MACRO CLOSE IOCB
1960 ;
1970     .MACRO CLOSE
1980 ;
1990     LDX #%1*16
2000     LDA #12     ; COMMAND CLOSE
2010     STA 834,X
2020     JSR 58454   ; CIO
2030     .ENDM
2040 ;
2050     .MACRO XIO
2060 ;
2070     LDX #%2*16  ; IOCB
2080     LDA #%1     ; COMMAND
2090     STA 834,X
2100     LDA #%3
2110     STA 842,X   ; AUX1
2120     LDA #%4
2130     STA 843,X   ; AUX2
2140     LDA #%5&255
2150     STA 836,X
2160     LDA #%5/256
2170     STA 837,X
2180     J5R 58454   ; CIOV
2190 ;
2280     .ENDM
2210 ;
2220     .MACRO POS
2230 ;.EX POS COL,ROW
2240 ;
2250     LDA #%1
2260     STA 84
2270     LDA #%2
2280     STA 85
2290 ;
2300     .ENDM
2310 ;
2320     .MACRO BGET
2330 ;
2340 ; EX. BGET 1,BUFFER,10000,LEN
2350 ;
2360     LDX #%1*16
2370     LDA #7
2380     STA 834 X    ; COMMAND
2390     LDA #%2&255
2400     STA 836,X
2410     LDA #%2/256
2420     STA 837 X
2430     LDA #%3&255
2440     STA 840,X
2450     LDA #%3/256
2460     STA 841,X
2470     JSR $E456    ;CIO
2480 ;
2490     LDA 840,X
2500     STA %4
2510     LDA 841,X
2520     STA %4+1
2530     .ENDM
2540 ;
2550 ; EX. BPUT 1,BUFFER,LEN
2560 ;
2570     .MACRO BPUT
2580     LDX #%1*16
2590     LDA #ll
2600     STA 834 X    ; COMMAND
2610     LDA #%2&255
2620     STA 836,X
2630     LDA #%2/256
2640     STA 837,X
2650     LDA %3
2660     STA 840,X
2670     LDA %3+1
2680     STA 841,X
2690     JSR $E456    ;CIO
2700 ;
2710     .ENDM
2720 ;
2730 ;
2740 ; WORK BYTES
2750 ;
2760     *= $0600
2770 ;
2780 MARLINE .BYTE 0
2790 INLINE .BYTE 0
2800 FLASH .BYTE 0
2810 TEMP1 .BYTE 0
2820 CHR1 .BYTE 0
2830 CHR2 .BYTE 0
2840 OPTION .BYTE 0
2850 SCRN .BYTE 0
2860 LEN .BYTE 0,0
2870 TEMY .BYTE 0
2880 ;
2890 LBUFF = $057E
2900 HATAB5 = $031A
2910 ;
2920 ; ZERO PAGE
2930 ;
2940 TEMP2 = 203
2950 TEMP3 = 204
2960 PSTART = 224
2970 PEND = 226
2980 MEMBOT = 228
2990 AMOUNT = 230
3000 ;
3010     *= $2700
3020 ;
3030 ; LOAD SCREEN
3040 ;
3050 INIT LDA #0    ; BLACK
3060     STA 710    ; SCREEN
3070     STA 82
3080     LDA #97    ; RED
3090     STA 712    ; BORDER
3100     LDA #l     ; NO CURSOR
3110     STA 752
3120      PRINT  0," Basic
to Binary by: Matthew Arrington"
3130     RTS         ; CONTINUE LOAD
3140 ;
3150     *= 738
3160     .WORD INIT  ; FOR BIN LOAD
3170 ;
3180     *= $2700
3190 ;
3200 ;
3210 ; EXECUTE & RUN BASIC PROGRAM
3220 ;
3230 ; THIS ROUTINE GETS SAVED ALONG
3240 ; WITH BASIC PROGRAM.
3250 ;
3260 ;
3270 BASRUN .BYTE "" ; BIN LOAD HEAD
ER
3280     .WORD FILELEN ; LOAD START
3290     .WORD RN3   ; LOAD END
3300 ;
3310 ;
3320 FILELEN *= *+2  ; BASIC FILE LEN
3330 ;
3340 TLINE .BYTE "
" ; TITLE STORED HERE
3350 ;
3360 RESET .BYTE 0    ; OPTION FLAGS
3370 BREAK .BYTE 0
3380 TITLE2 .BYTE 0,0
3390 MEMLO .WORD LA12+3
3400 ;
3410 GO  LDA 6       ; CART PRESENT?
3420     BNE RN2     ; YES CONTINUE
3430 ;
3440     LDA #l      ; CURSOR OFF
3450     STA 752
3460     LDA #0      ; ZERO MARGIN
3470     STA 82
3480      PRINT 0,"     PROGRAM REQUI
RES BASIC,  REBOOT     "
3490 X2  JMP X2      ; LOOP FOREVER
3500 ;
3510 RN2 LDA TITLE2  ; DISPLAY TITLE?
3520     BEQ RN3     ; NO
3530 ;
3540      OPEN  6,12,1,"5" ; GR. 1
3550      POS 10,0
3560      PRINTB 6,TLINE
3570 RN3 RT5        ; COUNTINE LOAD
3580 ;
3590 ; MORE BIN POINTERS
3600 ;
3610     .WORD 738,739 ; INIT ADD.
3620     .WORD GO
3630 ;
3640     .WORD X1,LA12+2
3650 ;
3660 ;
3670 ; INIT MEMLO
3680 ;
3690 X1  LDY #0
3700     LDA MEMLO    ; SET REAL MEMLO
3710     STA 743
3720 ;
3730     CLC
3740     ADC #242
3750     STA TEMP2
3760 ;
3770     LDA MEMLO+1
3780     STA 744
3790 ;
3800     ADC #0
3810     STA TEMP3
3820 ;
3830 ; INIT RESET VECTORS
3840 ;
3850     LDA RESET   ; TRAP RESET?
3860     BEQ TRAP    ; BR. IF YES
3870 ;
3880     CMP #2      ; COLD START?
3890     BNE MOVEPOINT ;NO, RESET NORM
AL
3900     LDA #1      ; DIE ON RESET
3910     STA 580     ; COLST
3920     JMP MOUEPOINT
3930 ;
3940 TRAP LDA 13     ; TRAP RESET
3950     CMP #8      ; DOS PRESENT?
3960     BCS DODOS   ;BR. IF SO
3970     LDA #INITAL&255 ; SET RESET V
ECTOR
3980     STA 12
3990     LDA #INITAL/256
4000     STA 13
4010     JMP MOVEPOINT
4020 ;
4030 DODOS LDA 12    ; 5AUE DOS INIT V
EC
4040     STA RESET1+1
4050     LDA 13
4060     STA RESET1+2
4070 ;
4080     LDA #RESET1&255 ; SET NEW RES
ET VEC
4090     STA 12
4100     LDA #RESET1/256
4110     STA 13
4120 ;
4130 ; ADD VALUE OF MEMLO TO BASIC'S
4140 ; PROGRAM POINTERS.
4150 ;
4160 MOVEPOINT LDA 743
4170     CLC
4180     ADC (TEMP2),Y
4190     STA 128,Y
4200     INY
4210 ;
4220     LDA 744
4230     ADC (TEMP2),Y
4240     STA 128,Y
4250     INY
4260     CPY #4
4270     BNE MOUEPOINT
4280 ;
4290     LDA 140    ; COPY STARP TO:
4300     STA 142    ; RUNSTAK
4310     STA 144    ; MEMTOP (LOW)
4320 ;
4330     LDA 141    ; (HIGH)
4340     STA 143
4350     STA 145
4360 ;
4370 ;
4380 ;    SET UP TO RUN
4390 ;
4400     LDA #0
4410     STA $92    ; BASIC DOES THIS
4420     STA $CA    ; ON COLD START
4430     LDX #$FF
4440     TXS
4450     CLD
4460 ;
4470     LDA $0222  ; SAVE VBI VEC
4480     STA VBIX+1
4490     LDA $0223
4500     STA VBIX+2
4510     JMP INITAL
4520 ;
4530 ; IMMEDIATE VBI TO DISSABLE
4540 ; BREAK.
4550 ;
4560 BRK LDA #64
4570     STA 16
4580     STA 53774
4590 VBIX BYTE $4C,0,0
4600 ;
4610 ;
4620 RESET1 BYTE $20,0,0 ; JSR INIT D
05
4630 INITAL LDX #0
4640     LDA BREAK  ; DISSABLE BREAK?
4650     BNE LA2    ; BR. IF NOT
4660 ;
4670     LDA #BRK&255 ; SET IMM. VBI
4680     STA $0222    ; VECTOR
4690     LDA #BRK/256
4700     STA $0223
4710 ;
4720 ; PATCH THE "E:" INPUT COMMAND
4730 ; WILL FORCE A "RUN" WHEN BASIC
4740 ; GOES TO THE "READY" PROMPT.
4750 ;
4760 LA2 LDA HATABS,X ; GET A BYTE
4770     CMP #'E     ; LOOK FOR E
4780     BEQ LA1     ; FOUND YA
4790 ;
4800     INX         ; NEXT HANDLER
4810     INX         ; ADDRE55
4820     INX
4830     BNE LA2     ; KNOW ITS THERE
4840 ;
4850 LA1 INX
4860     STX LA3     ; SAVE OFFSET
4870 ;
4880     LDA HATABS,X ; SAVE OLD
4890     STA TEMP2
4900     LDA #VTBLE&255 ; REPLACE WITH
 
NEW
4910     STA HATABS,X ;$031A
4920 ;
4930     INX         ; NOW HI BYTES
4940 ;
4950     LDA HATABS,X ; SAVE OLD
4960     STA TEMP2+1
4970     LDA #VTBLE/256 ; REPLACE WITH
 
NEW
4980     STA HATABS,X
4990 ;
5000     LDY #0      ; COPY UTABLE
5010     LDX #4
5020 LA7 LDA (TEMP2),Y
5030     STA VTBLE,Y
5040     INY
5050     DEX
5060     BNE LA7
5070     LDY #8
5080     LDX #7
5090 LA8 LDA (TEMP2),Y
5100     STA VTBLE,Y
5110     INY
5120     DEX
5130     BNE LA8
5140 ;
5150     LDA #2     ; COUNTER
5160     STA LA10
5170 ;
5180     LDA #l     ; BOOT SUCCESSFUL
5190     STA 9      ; BOOT
5200     STA 8      ; WARMST
5210 ;
5220     LDA 49146  ; CART RUN ADD.
5230     STA CART+1
5240     LDA 49147
5250     STA CART+2
5260 CART .BYTE $4C,0,0 ; JMP TO BASIC
5270 ;
5280 EINPUT LDY LA10 ; GET OFFSET
5290     CPY #255    ; END?
5300     BEQ LA11    ; YES
5310 ;
5320     LDA LA12,Y
5330     DEC LA10
5340     LDY #l
5350     RTS
5360 ;
5370 LA11 TXA
5380     PHA
5390     LDX LA3
5400     LDA TEMP2
5410     STA HATABS,X ;$031A
5420     INX
5430     LDA TEMP2+1
5440     STA HATABS,X ;$031A
5450     PLA
5460     TAX
5470     LDA #155     ; C/R
5480     LDY #l       ; SUCCESS
5490     RTS          ; DONE
5500 LA3 .BYTE 0
5510 LA10 .BYTE 0
5520 ;
5530 VTBLE .BYTE 0,0 ; CLOSE
5540     .BYTE 0,0   ; OPEN
5550     .WORD EINPUT-1 ; GET
5560     .BYTE 0,0   ; PUT
5570     .BYTE 0,0   ; STATUS
5580     .BYTE 0,0   ; SPECIAL
5590     .BYTE 0,0,0 ; JMP INIT
5680 ;
5618 LA12 .BYTE "NUR"
5628 ;
5630     .BYTE "" ;RUN POINTERS
5640     .WORD X1   ;FOR BAS RUN
5650 ;
5660 BASICSTART .BYTE 0,0
5670     .BYTE 0
5680 ENDRUN .BYTE 0
5690 ;
5700 ; DISPLAY LIST
5710 ;
5720 DLIST .BYTE 112,112,112,66,64,156
5730     .BYTE 66,104,156,66,144,156,6
6,184,156
5740     .BYTE 66,224,156,66,8,157,66,
48,157
5750     .BYTE 66,88,157,66,128,157,66
,168,157
5760     .BYTE 66,208,157,66,248,157,6
6,32,158
5770     .BYTE 66,72,158,66,112,158,66
,152,158
5780     .BYTE 66,192,158,66,232,158,6
6,16,159
5790     .BYTE 66,56,159,66,96,159,66,
136,159
5800     .BYTE 66,176,159,66,216,159,6
5
5810     .WORD DLIST
5820 MENU .BYTE ""
5830     .BYTE "        
"
5840     .BYTE "            |
5850     .BYTE "     
5860     .BYTE "     |Basic to Binary|
"
5870     .BYTE "
"
5880     .BYTE "|
    |
"
5890     .BYTE "|1: Display/Set Optio
ns  |
"
5900     .BYTE "|
    |
"
5910     .BYTE "| 2: Convert Basic fil
e   |
"
5920 MENU2 .BYTE "|
      |
"
5930     .BYTE "| 3: File Directory
    |
"
5940     .BYTE "|
    |
"
5950     .BYTE "| 4: Exit to DOS
    |
"
5960     .BYTE "|
    |
"
5970     .BYTE "
"
5980 ;
5990 ;
6000 ;
6010 ; EVERYDAY TYPE SUBROUTINES
6020 ;
6030 ;
6040 ; INPUT A LINE
6050 ;
6060 GETLINE LDA #0  ; LINE INDEX &
6070     STA INLINE  ; LINE LEN=0
6080 ;
6090 GLOOP LDA #10   ; 1/6 SEC
6100     STA 536     ; SYS TIMER
6110 TIMLOOP LDA 764 ; STAT KEYBOARD
6120     CMP #255    ; KEY IN?
6130     BEQ CHECKTIME ; BR. IF NO
6140      PRINT  0,"_←" ; PRINT CURSOR
6150     JMP GCHR    ; GET KEY
6160 ;
6170 CHECKTIME LDA 536 ; SYS TIMER=0?
6180     BNE TIMLOOP ; NO, LOOP
6190     LDA FLASH   ; FLASH ON OR OFF
6200     BEQ OFF     ; TURN IT OFF
6210      PRINT  0,"-" ; CUR50R ON
6220     LDA #0      ; FLASH OFF=0
6230     STA FLASH   ; FOR NEXT TIME
6240     JMP GLOOP   ; LOOP
6250 ;
6260 OFF  PRINT  0," ←" ; CUR0SRO OFF
6270     LDA #1      ; FLASH ON=1
6280     STA FLASH   ; FOR NEXT TIME
6290     JMP GLOOP   ; LOOP
6300 ;
6310 GCHR GET 3      ; GET A CHAR
6320 ;
6330     CMP #'     ; BACKSPACE?
6340     BNE DL      ; BR. IF NOT
6350 ;
6360     LDX INLINE  ; SOMTHING TO B5?
6370     BNE OK1     ; BR. IF YES
6380     JMP GLOOP   ; NOTHING THERE
6390 OK1 JMP BACKSPACE ; DO BACKSPACE
6400 ;
6410 DL  CMP #'     ; DELETE LINE?
6420     BNE ENDL    ; OR. IF NOT
6430     LDX INLINE  ; SOMTHING TO DEL
?
6440     BNE OK2     ; BR. IF YES
6450     JMP GLOOP   ; ELSE IGNORE R L
OOP
6460 OK2 JMP DLINE   ; DO DELETE LINE
6470 ;
6480 ENDL CMP #155   ; END OF LINE?
6490     BNE NOCTRL  ; NO
6500     JMP EOL     ; DO ENDLINE
6510 NOCTRL LDX STRIP ; FILTER CHARS?
6520     BNE OK3     ; BR. IF NO
6530 ;
6540 ;
6550     AND #127    ; STRIP INVERSE
6560     CMP #97     ; LOWWER CASE??
6570     BCC OK3     ; BRANCH IF NOT
6580     SEC
6590     SBC #32     ; MAKE IT UPPER
6600 OK3 LDX INLINE  ; RESTORE X
6610     CPX MARLINE ; LINE TOO LONG?
6620     BNE OK5     ; BR. AND SAVE
6630     JMP GLOOP   ; IGNORE KEY & LO
OP
6640 ;
6650 OK5 STA 1406,X  ; SAVE BYTE
6660     INX         ; FOR NEXT SAVE
6670     STX INLINE  ; SAVE X
6680      PUT  0     ; PRINT CHAR
6690     JMP GLOOP   ; GET NEXT BYTE
6700 ;
6710 ;
6720 BACKSPACE JSR ST
6730 ;
6740 DOBS LDA #'    ; BS CHAR
6750      PUT 0      ; PRINT IT
6760     DEC INLINE  ; DEC LINE LEN
6770     JMP GLOOP   ; NEXT KEY
6780 ;
6790 ;
6800 DLINE JSR 5T
6810 ;
6820 DODL LDA #'    ; BS CHAR
6830      PUT 0      ; PRINT IT
6840     DEC INLINE  ; DEC LINE LEN
6850     BNE DODL    ; LOOP TILL GONE
6860     JMP GLOOP   ; START AGAIN
6870 ;
6880 ;
6890 EOL LOA #'     ; DELETE PROMPT
6900      PUT 0
6910     LDX INLINE  ; GET LINE LEN
6920     LDA #0
6930     STA 1406,X  ; MARK EOL
6940     RTS         ; RETURN
6950 ;
6960 ;
6970 ST   PRINT 0,"→" ; ERASE CURSOR
5980     RTS
6990 ;
7000 ;
7010 PUTBYTE LDX #0  ; IOCB #0
7020 PUTD PUT        ; PUT A
7030     RTS         ; RETURN
7040 ;
7050 ;                      ;
7060 ; VALIDATE A FILENAME  ;
7070 ;                      ;
7080 SETNAME LDY #0  ; SET DEFUALT
7090 L8  LDA DEF,Y   ; TO DRIVE ONE
7100     STA FNAME,Y
7110     INY
7120     CPY #3
7130     BNE L8
7140 ;
7150     LDA LBUFF+1 ; "D:FNAME"?
7160     CMP #':
7170     BNE L5      ; BR. IF NOT
7180     LDY #2      ; SET OFFSET
7190     JMP MOVENAME ; COPY NAME OVER
7200 ;
7210 L5  LDY #0      ; "DX:FNAME"??
7220     LDA LBUFF+2
7230     CMP #':
7240     BNE MOVENAME ;NO, ASSUME "D1:
"
7250     LDA LBUFF+1 ; GET D# BYTE
7260     STA FNAME+1 ; SAVE IT
7270     LDY #3      ; OFFSET
7280 ;
7290 MOVENAME LDX #3 ; COPY FILE NAME
7300 L6  LDA LBUFF,Y ; FROM LBUFF.
7310     STA FNAME,X
7320     BEQ L7
7330     INY
7340     INX
7350     BNE L6
7360 ;
7370 L7  RTS
7380 ;
7390 ; CALCULATE THE DISTANCE BETWEEN
7400 ; TO ADRESS'S...
7410 ;
7420 SUBTRACT LDA PEND
7430     SEC
7440     SBC PSTART
7450     STA LEN
7460 ;
7470     LDA PEND+l
7480     SBC PSTART+l
7490     STA LEN+1
7580 ;
7510     INC LEN
7520     BNE L15
7530     INC LEN+l
7540 L15 RTS
7550 ;
7560 BUF *=  *+5125 ; 5K BUFFER
7570 ;
7580 FNAME *= *+16
7590 STRIP .BYTE 0
7600 DEF .BYTE "D1:" ; DEFUALT DRIVE
7610 DIR .BYTE "D0:*.*" ; DIRECTORY
7620 ;
7630 RUN OPEN 3,4,0,"K:"
7640     LDA #DLIST&255 ; POINT TO
7650     STA 568     ; MY DIS. LIST
7660     LDA #DLIST/256
7670     STA 561
7680 ;
7690     LDA #64     ; LET THE "E:"
7700     STA 88      ; IN ON THE CHANG
E.
7710     LDA #156
7720     STA 89
7730     LDA #l      ; CURSOR OFF
7740     STA 752
7750     LDA #31     ; RIGHT MARGIN
7760     STA 83
7770 ;
7780 ;
7790 MAINMENU LDA #0 ; SCREEN OFF
7800     STA 559
7810     STA 718     ; CHANGE COLOR
7820     LDA #97
7830     STA 712
7840     LDA #2      ; LEFT MARGIN
7850     STA 82
7860      PRINTB  0,MENU ; PRINT MENU
7870      PRINTB  0,MENU2
7880     LDA #33     ; SCREEN ON
7890     STA 559
7900 ;
7910 ; TWIRLING THING
7920 ;
7930     LDA #69
7940     STA CHR1
7950     LDA #90
7960     STA CHR2
7970 TITLE LDY #ll
7980     LDA #0
7990     LDX #3
8000     STA 48208,X
8010     STA 40208,Y
8020     LDY CHR1
8030     LDA CHR2
8040     STY CHR2
8050     STA CHR1
8060     LDX #4
8070     LDY #10
8080 TLOOP LDA 40208,X
8090     STA TEMP1
8100     LDA CHR1
8110     STA 40208,X
8120     LDA 40208,Y
8130     STA TEMP2
8140     LDA CHR2
8150     STA 40208,Y
8160     LDA #8
8170     STA 20
8180 #IME LDA 20
8190     CMP #3
8200     BNE #TTIME
8210     LDA #0
8220     JSR TWIST
8230     STA 40288,X
8240     LDA #1
8250     JSR TWIST
8260     STA 40208,Y
8270 ;
8280     LDA 764
8290     CMP #255
8300     BNE GOPT
8310 ;
8320     INX
8330     DEY
8340     CPY #2
8350     BNE TLOOP
8360     JMP TITLE
8370 TWIST CMP #l
8380     BEQ OVER
8390     LDA TEMP1
8400     JMP SWAP
8410 OVER LDA TEMP2
8420 ;
8430 SWAP CMP #90
8440     BNE F1
8450     JMP SWITCH
8460 F1  CMP #69
8470     BNE F2
8480     JMP SWITCH
8490 F2  CMP #67
8500     BNE F3
8510     JMP SWITCH
8520 F3  CMP #81
8530     BNE F4
8540     JMP SWITCH
8550 F4  CMP #82
8560     BEQ ZERO
8570     LDA #82
8580     RTS
8590 ZERO LDA #0
8600     RTS
8610 SWITCH LDA CHR1
8620     CMP #90
8630     BNE OTHER
8640     LDA #67
8650     STA CHR1
8660     LDA #81
8670     STA CHR2
8680     JMP EXIT
8690 ;
8700 OTHER LDA #69
8710     STA CHR1
8720     LDA #90
8730     STA CHR2
8740 EXIT LDA #87
8750     RTS
8760 ;
8770 ; GET OPTION FROM KEYBOARD
8780 ;
8790 GOPT LDA #0     ; ZERO MARGIN
8800     STA 82
8810      GET  3     ; GET KEY
8820     AND #127    ; STRIP INVERSE
8830     CMP #97     ; LOWWER CASE?
8840     BCC A6      ; BR. IF NOT
8850     SEC         ; ELSE....
8860     SBC #32     ; MAKE IT UPPER
8870 ;
8880 A6  CMP #'2     ; OPTION 2?
8890     BNE Al      ; NO
8900     JSR CONVERT ; GO CONVERT
8910     JMP MAINMENU ;
8920 ;
8930 Al  CMP #'1     ; OPTION 1?
8940     BNE A2      ; NO
8950     J5R PAD     ; CONTROL PAD
8960     JMP MAINMENU
8970 ;
8980 A2  CMP #'3     ; HOW ABOUT 3?
8990     BNE A4    ; NO
9000     JSR FILES   ; DIRECTORY
9010     JMP RUN     ; REINIT SCREEN
9020 ;
9030 A4  CMP #'4     ;    OPTION    4?
9040     BEQ A5      ; YES...
9050     JMP MAINMENU ; BAD INPUT
9060 ;
9070 A5  LDA #39     ; RESET RIGHT
9080     STA 83      ; MARGIN
9090     JMP (10)    ; GO TO DOS
9100 ;
9110 ; CONVERT A FILE TO BINARY
9120 ;
9130 CONVERT LDA #125
9140     JSR PUTBYTE ; CLEAR SCREEN
9150     LDA #16
9160     STA MAXLINE ; INPUT LINE LEN.
9170 ;
9180      POS 10,0
9190 L11 PRINT 0,"INPUT FILE - "
9200     JSR GETLINE ; GET INPUT NAME
9210     LDA INLINE  ; NAME ENTERED?
9220     BNE L10     ; BR. IF YES
9230     RTS         ; NO, RETURN
9240 ;
9250 L10 JSR SETNAME ; VALIDATE NAME
9260      CLOSE 1
9270      OPEN 1,4,0,FNAME
9280     BMI L11     ; ERROR TRY AGAIN
9290 ;
9380 ; PASS 1, COUNT BYTES
9310 ;
9320 ; MUST KNOW EXACT LEN OF BASIC
9330 ; FILE.
9340 ;
9350     LDA #0      ; ZERO BASIC
9360     STA FILELEN ; FILE LENGTH
9370     STA FILELEN+1
9380 ;
9390 L13 GET 1       ; GET A BYTE
9400     CPY #36     ; CHECK FOR EOF
9410     BEQ PASS2   ; BR. EOF REACHED
9420 ;
9430     INC FILELEN ; COUNT BYTES.
9440     BNE L13
9450     INC FILELEN+1
9460     BNE L13
9470 ;
9480 ; PASS2 SAVE ROUTINE THAT RUNS
9490 ; THE BASIC. THEN COPY BASIC
9500 ; PROGRAM OVER TO THE NEW FILE.
9510 ;
9520 PASS2  CLOSE  1 ; REOPEN INPUT FI
LE
9530      OPEN  1,4,0,FNAME
9540 ;
9550 L3   PRINT 0,"OUTPUT FILE - "
9560     JSR GETLINE ; GET FILENAME
9570     LDA INLINE  ; NAME ENTERED?
9580     BNE L12     ; BR. IF SO
9590     RTS    ; RETURN - ABORT
9600 ;
9610 L12 JSR SETNAME ; VALIDATE NAME
9620      CLOSE  2
9630      OPEN  2,8,0,FNAME
9640     BMI L3
9650 ;
9660 ; CALCULATE LENGTH OF THE ROUTINE
9670 ; THAT'LL EXECUTE THE BASIC
9680 ; PROGRAM. SAVE RESULT IN "LEN"
9690 ;
9700     LDA #BASRUN&255
9710     STA PSTART
9720     LDA #BASRUN/256
9730     STA PSTART+1
9740 ;
9750     LDA #ENDRUN&255
9760     STA PEND
9770     LDA #ENDRUN/256
9780     STA PEND+1
9790     JSR SUBTRACT ; GET LENGTH
9800 ;
9810 ; MAKE BIN LOAD POINTERS
9820 ;
9830 ; ADD THE LEN. OF THE BA5 PROGRAM
9840 ; TO THE ADDRESS WHERE IT FIRST
9850 ; LOADS IN MEMORY.
9860 ;
9870     LDA MEMLO   ; START ADDRESS
9880     CLC
9890     ADC #242    ; BAS. BUFFER OFF
SET
9900     STA TEMP2
9910     LDA MEMLO+l
9920     ADC #0
9930     STA TEMP3
9940 ;
9950 ; LOW BYTES
9960 ;
9970     LDA TEMP2   ; SAVE START POIN
T
9980     STA BASICSTART
9990     CLC         ; ADD IN FILE LEN
GTH
010000   ADC FILELEN
010010   STA ENDRUN-1 ;SAVE END POINT
010020 ;
010030 ; HIGH BYTES
010040 ;
010050   LDA TEMP3    ; SAVE START
010060   STA BASICSTART+1
010070   ADC FILELEN+1 ; ADD IN LEN
010080   STA ENDRUN  ; SAVE END
010090 ;
010100   LDA ENDRUN-1 ; SUBTRACT 1
010110   SEC         ; FROM END POINT
010120   SBC #1      ; (FUDGE)
010130   STA ENDRUN-1
010140   LDA ENDRUN
010150   SBC #0
010160   STA ENDRUN
010170 ;
010180 ; SAVE THE EXECUTE ROUTINE
010190 ; ALONG WITH ALL BIN POINTERS
010200 ;
010210    BPUT  2,BASRUN,LEN
010220 ;
010230 ; COPY BASIC FILE OVER
010240 ;
010250 L4  BGET  1,BUF,5125,LEN
010260   STY TEMY  ; SAVE ERROR FLAG
010270    BPUT  2,BUF,LEN
010280 ;
010290   LDY TEMY    ; GET ERROR FLAG
010300   CPY #136    ; EOF REACHED?
010310   BNE L4      ; BR. IF NOT
010320 ;
010330    CLOSE  1   ; CLEAN UP
010340    CLOSE  2
010350   RTS         ; ALL DONE
010360 ;
010370 ; CONTROL PAD?!
010380 ;
010390 PAD LDA #125  ; CLEAR SCREEN
010400   JSR PUTBYTE
010410   LDA #8      ; ZERO MARGIN
010420   STA 82
010430 ;
010440    PRINT  0,"  Basic to Binary
Control Pad"
010450    PRINT  0," 
"
010460    PRINT  0,"  SELECT : Item to
 
change"
010470    PRINT  0,"  OPTION : Changes
 
Item"
010480    PRINT  0,"  START  : Exits
"
010490    PRINT  0,"RESET -BREAK -
TITLE -MEMLO -"
010500 ;
010510 ;
010520   LDA #0      ; ZERO VARIABLES
010530   STA TEMP1
010540   STA OPTION
010550   TAX
010560 ;
010570   LDA #8
010580   STA SCRN
010590 PRINTITEM JSR PITEM ; PRINT OPT
ION
010600   LDX TEMP1   ; GET X
010610   INX         ; ADD 1
010620   STX TEMP1   ; SAVE IT
010630   CPX #4      ; ALL DONE?
010640   BNE PRINTITEM ; NO.
010650 ;
010660 STATCON LDA #8 ; CLEAR CONSOL
010670   STA 53279
010680   LDA 53279   ; STATUS CON50L
010690   CMP #7      ; PRESSED?
010700   BCS STATCON ; BR. IF NOT
010710   TAY         ; SAVE A
010720   LDA #0      ;
010730   STA 53279   ; CLICK
010740   STA 54282   ; WAIT
010750 ;
010760 CN1 LDA #8    ; CLEAR CON
010770   STA 53279
010780   LDA 53279   ; STATUS CON
010790   CMP #7      ; HANDS OFF?
010800   BNE CN1     ; N0, PEOPLE ARE
SLOW
010810 ;
010820   LDA #10     ; 1/6 SEC DELAY
010830   STA 542
010840 CN2 LDA 542
010850   BNE CN2     ; LOOP TIL ZERO
010860 ;
010870   TYA         ; RESTORE A
010880 ;
010890   CMP #5      ; SELECT PRESSED?
010900   BEQ CON1    ; YES
010910 ;
010920   CMP #3      ; OPTION PRESSED?
010930   BNE EXITPAD ; NO, EXIT
010940 ;
010950   JMP OPT
010960 EXITPAD RTS
010970 ;
010980 CON1 LDA 88    ; GET SCREEN ADDR
010990   STA TEMP2
011000   LDA 89
011010   STA TEMP3
011020 ;
011030   LDA SCRN     ; CALC. SCREEN
011040   TAX          ; POSITON
011050 Z1 LDA TEMP2
011060   CLC
011070   ADC #40
011080   STA TEMP2
011090   LDA TEMP3
011100   ADC #0
011110   STA TEMP3
011120   DEX
011130   BNE Z1
011140 ;
011150   LDY #0
011160 Z2 LDA (TEMP2),Y ; GET BYTE
011170   BEQ Z7      ; END OF BLOCK
011180   AND #127    ; INVERSE OFF
011190   STA (TEMP2),Y ; PUT IT BACK
011200   INY         ; NEXT BYTE
011210   BNE Z2      ; NO
011220 ;
011230 Z7 LDA OPTION ; LAST OPTION?
011240   CMP #3
011250   BNE Z3      ; NO
011260 ;
011270   LDA #0      ; YES LOOP TO FIR
ST
011280   STA OPTION
011290   LDA #8      ; RESET POSITION
011300   STA SCRN
011310   LDA TEMP2
011320   SEC
011330   SBC #240
011340   STA TEMP2
011350   LDA TEMP3
011360   SBC #0
011370   STA TEMP3
011380   LDY #0
011390   JMP Z4
011400 ;
011410 Z3 INC OPTION ; NEXT OPTION
011420   INC SCRN
011430   INC SCRN
011440   LDY #80
011450 ;
011460 Z4 LDA (TEMP2),Y ; GET BYTE
011470   BEQ Z6      ; END OF BLOCK
011480   CLC
011490   ADC #128    ; INVERSE ON
011500   STA (TEMP2),Y ; PUT IT BACK
011510   INY         ; NEXT BYTE
011520   BNE Z4      ; LOOP
011530 Z6 JMP STATCON ; DONE
011540 ;
011550 ; PRINT SELECTED ITEM.
011560 ;
011570 PITEM LDA #0  ; ZERO VARIABLES
011580   STA TEMP2
011590   STA TEMP3
011600 ;
011610   LDA RESET,X ; GET Y VALUE
011620   TAY
011630 ;
011640 ; (X*6)+(Y*2)=JMP ADDR
011650 ; X=OPTION Y=ITEM
011660 ;
011670 ; MULTIPLY X*6
011680 ;
011690 DOX DEX
011700   CPX #255
011710   BEQ DOY
011720   LDA TEMP2
011730   CLC
011740   ADC #6
011750   STA TEMP2
011760   JMP DOX
011770 ;
011780 ; MULTIPLY Y*2
011790 ;
011800 DOY DEY
011810   CPY #255
011820   BEQ ADDEM
011830   LDA TEMP3
011840   CLC
011850   ADC #2
011860   STA TEMP3
011870   JMP DOY
011880 ;
011890 ADDEM LDA TEMP3
011900   CLC
011910   ADC TEMP2
011920   TAX
011930 ;
011940   LDA TABLE1,X
011950   STA GOPRNT+1
011960   LDA TABLE1+1,X
011970   STA GOPRNT+2
011980 ;
011990 GOPRNT BYTE $4C,0,0 ; JMP XX
012000 ;
012010 ; PRINT'S TO MAKE TABLE1
012020 ;
012030 O0I0  POS  8,8
012040    PRINT  0,"Trap & Re-Run Prog
ram"
012050   RTS
012060 O0I1  POS  8,8
012070    PRINT  0,"Reset Normally
   "
012080   RTS
012090 O0I2  POS  8,8
012100    PRINT  0,"Cold Start
   "

012110   RTS
012120 ;
012130 ;
012140 O1I0  POS  10,8
012150    PRINT  0,"Disabled"
012160   RTS
012170 O1I1  POS 10,8
012180    PRINT 0,"Enabled "
012190   RTS
012200 ;
012210 O2I0  POS  12,8
012220    PRINT  0,"Off"
012230   RTS
012240 O2I1  POS  12,8
012250    PRINT  0,"On "
012260   INC STRIP   ; STRIP CHR OFF
012270    POS  16,0
012280    PRINT  0,"ENTER TITLE:"
012290    PRINT  0,"[
   ]
←"
012300   LDA #19
012310   STA MAXLINE ; 19 CHR LIMIT
012320   JSR GETLINE ; GET TITLE
012330    POS  16,0
012340    PRINT  0,"" ; ERASE PROMPT
012350   LDA INLINE  ; TITLE ENTERED?
012360   BNE TI5     ; OR IF SO
012370   DEC STRIP   ; NO TITLE
012380   JMP NULL
012390 ;
012400 TI5 LDY #19   ; TITLE LEN-1
012410   LDA #32     ; SPACE CHR
012420 ;
012430 TI4 STA TLINE,Y ; ERASE OLD TIT
LE
012440   DEY
012450   CPY #255
012460   BNE TI4
012470 ;
012480 ; CENTER TITLE
012490 ;
012500   LDX #10     ; MAX TITLE LEN/2
012510   LDA INLINE  ; TITLE LEN
012520 ;
012530 TI1 DEX       ; DIVIDE TITLE
012540   SEC         ; LEN BY 2
012550   SBC #2
012560   BC5 TI1
012570 ;
012580   CPX #ll     ; X>10 ?
012590   BCC T19     ; NO
012600 ;
012610   LDX #0      ; YES
012620 ;
012630 TI9 LDY #0    ; MOVE TITLE
012640 TI3 LDA LBUFF,Y ; GET BYTE
012650   BEQ TI2     ; BR IF END
012660   STA TLINE,X ; SAVE BYTE
012670   INY         ; NEXT BYTE
012680   INX
012690   JMP TI3     ; LOOP
012700 TI2 DEC STRIP ; STRIP CHR ON
012710   RTS         ; DONE
012720 ;
012730 O3I0  POS  14,8
012740    PRINT  0,"     "
012750    POS  14,8
012760    PNUM  0,MEML0
012770   RTS
012780 ;
012790 O3I1 POS  16,0
012800    PRINT  0,"NEW MEMLO VALUE IS
;"
012810   LDA #5      ; 5 CHRS MAX
012820   STA MAXLINE
012830 ;
012840   JSR GETLINE ; GET NUMBER
012850   LDA INLINE  ; CHECK LEN
012860   BEQ NULL    ; NOTHING THERE
012870    ASCIINUM  LBUFF,MEMLO ; ASCI
I->FP
012880 ;
012890 NULL LDX OPTION ; NULL ITEM
012900   LDA #0      ; LOOP TO VALID
012910   STA RESET,X ; ITEM
012920   JMP PITEM
012930 ;
012940 TABLE1 .WORD O0I0,O0I1,O0I2
012950   .WORD O1I0,O1I1,NULL
012960   .WORD O2I0,O2I1,NULL
012970   .WORD O3I0,O3I1,NULL
012980 ;
012990 ;
013000 ;
013010 OPT LDX OPTION ; GET OFFSET
013020   INC RESET,X ; NEXT ITEM
013030   LDA RESET,X
013040   CMP #3      ; INC TO FAR?
013050   BNE Z5      ; BR. IF NOT
013060   LDA #0      ; LOOP TO FIRST
013070   STA RESET,X ; ITEM.
013880 Z5 JSR PITEM  ; PRINT NEW ITEM
013090   JMP STATCON ; CHECK CONSOL
013100 ;
013110 ; FILES
013120 ;
013130 FILES LDA #125
013140   JSR PUTBYTE
013150 ;
013160   LDA #0      ; ZERO DRIVE BYTE
013170   STA DIR+1
013180 ;
013190    PRINT  0,"Which drive? 1-
8"
013200    GET  3     ; GET A KEY
013210   STA DIR+1   ; STORE AT D#
013220    CLOSE  1
013230    OPEN  1,6,0,DIR
013240   BPL DD1     ; BR. IF SUCCESSF
UL
013250   RTS         ; ERROR, RETURN
013260 ;
013270 DD1  CLOSE  0 ; CLOSE EDITOR
013280    OPEN  0,12,0,"E" ; GR. 0
013290   LDA #0      ; CHANGE COLOR
013300   STA 710
013310 DD3 GET  1    ; GET A BYTE
013320   BMI DD2     ; BR. ON ERROR
013330    PUT  0     ; PRINT BYTE
013340   BPL DD3     ; LOOP
013350 ;
013360 DD2  CLOSE  1
013370    PRINT  0,"Type any key"
013380    GET  3     ; GET KEY
013390   RTS
013400 ;
013410   *=  736     ; BIN LOAD RUN
013420   .WORD RUN