A spreadsheet so easy to use that you don't need this article! Well, almost. But seriously, BCALC has many features that make it easy to use, the kind of ease of use you enjoyed with Atariwriter.
Typing
it in
Listing 1 contains the BASIC data statements used to
create the BCALC file on
your disk. Please refer to the M/L
Editor found elsewhere in this issue
for instructions in keying in BCALC.Once the BCALC file has been created, simply binary load it from DOS. Refer to your DOS manual on how to do this if you are not sure. Please remove the cartridge from your 800 computer or turn BASIC off on your XL/XE computer by holding the option key down when booting up. When the program loads there will be a credit line at the top of the screen. Press any key to begin.
General
information
BCALC (hereafter referred to as BC) is a spreadsheet
using about 8K of memory. This leaves around 24K for data. BC has many
of the features you would find in a commercial spreadsheet. The BC
sheet is 64 columns wide (lettered AA-CL) and has 64 rows (numbered
01-64). The intersection of each column and row is called a cells. So
if my arithmetic is still correct that means there are 64 x 64 or 4096
cell. Each cell has an overhead of at least four bytes plus whatever
data is entered.There are three kinds of information you can store in a cell. The type of data entered is displayed on the right side of the top screen line.
1. Text Data: This is anything that does not begin with a number 0-9 or the "=" or " -" sign. It's possible to put numbers in as text (see below).
2. Numeric data: a number that begins with 0-9, " -" or ". " Numbers can be entered in scientific notation. For example, 3.45E-45. BC only accepts that part of input which is a valid number. For example, if you type: "-.234fgh" BC takes the "- .234" and ignores the rest. You may not type in commas. To display commas use the formatting commands which are discussed later.
3. Functions: An arithmetic or algebraic expression starting with the "=" sign (inversed also works). You mean I have to know algebra? Was my math teacher right in that there is a use for algebra? Perish the thought!
Entering functions is quite easy if one follows the rules. The five operations of ^ (exponentiation), * (multiplication), / (division), + (addition) and - (subtraction) are used. These are used as operators between numbers, cells or built-in functions. Be aware of the order of operations. My Dear Aunt Sally Huh? This is a mnemonic to remember the order of operations: multiplications and divisions are done first in order from left to right. Next, additions and subtractions in order from left to right. Exponents and parentheses are done first however. You want an example? Sure thing.
=3+((2+7) ^ 2-4*6)/6
The innermost parentheses are done first: (2 + 7) becomes 9. The 9 is
then squared ( ^ 2) yielding 81. Next 4*6=24 is done. Then the
difference 81 - 24 = 57 is calculated. Dividing by 6 yields 9.5. Add to
3 equals 12.5. Remember that each number above could be replaced by a
cell or a built-in function. For example:=@RND((1 +AB24/12) ^ 36) - BQ12
Always make sure that the cells used do not have text data or an error will result.
We
have tried to crash
this program in every
way we can think of.
this program in every
way we can think of.
Since you might enter text data in lower case, BC also allows you to enter functions in lower case; so you won't have to toggle that CAPS key. Just type away!
Console
keys
OPTION displays a status screen in the text window.
The current filename, number of free bytes, recalculation status
(on/off) and recalculation mode (row/column) are shown. Hit a key to
exit.SELECT puts you in the driver's seat. Well, actually in command mode. The text window will change color in this mode. You may use upper- or lowercase letters and even inverse video in commands. Some commands require an argument such as a cell reference (e.g., BG24) or a number. Zeros are necessary in cell references (e.g., CD02).
The commands are:
[DIR]ECTORY n displays up to 16 files on the screen. If you do not type a drive number 'n;' Drive 1 is the default. Make sure there is a space between "DIR" and 'n:' That is also true for the other commands. Press a key to read more filenames. If there are exactly 16 files read in you will need to hit a key twice.
[WID]th ccrr sets the width of column cc to width rr. The width rr must be greater than one but less than 32.
[SAV]E Dn:filespec is used to save the sheet. You must type a complete filespec including the "Dn:". Multiple drives are supported as well as a RAMDisk. If you attempt to save a sheet using the name of a file that already exists, you are asked if you wish to replace it. Merely hit the "Y" or "N" key to make your choice.
[LOA]D Dn:filespec is used to load a sheet that was saved. Seems reasonable.
[GOT]O ccrr is the fast way to go from here to there or at least to cell ccrr. cc must be in the range AA-CB and rr in the range 01-47.
[SET] ccrr sets the column and row references that are displayed at the bottom of the text window. An example is definitely called for. If we type SET AA02 and the cursor is on DE12 we see that data from cell AA12 and from DE02 displayed.
If I were doing my grades (after all, I am a teacher), I might have student names in column AA. But when I'm entering data in cell AG12, column AA is nowhere to be seen. However, if I use SET AA12 the student name from column AA row 12 appears on the last text window line. Also shown is heading for column AG row 02.
[LIS]T Dn:filespec lists the spreadsheet to the disk so the information can be used with a word processor like Atariwriter. Use the cursor keys to define the block of information you would like listed on disk. If you define a bad block an error results. The information listed will be in exactly the same format as you see it on the screen.
LISTed files cannot be reloaded into the sheet. Doing so will probably cause the computer to lockup, and you will likely see a very unusual screen staring at you! Use the SAVE command to store the sheet on disk. Just in case you try to do something clever, like LIST to the same filename that was used to SAVE the sheet, you're told if the file already exists. You then may overwrite it if you wish. I'd recommend using a LST extension on LISTED files.
START is used to abort input in either input mode, edit mode or command mode.
Special
keys
These keys are used with the CONTROL key pressed
simultaneously:[-] (Arrow up) moves the cursor up one row.
[=] (Arrow down) moves cursor down one line.
[ + ] (Arrow left) moves one cell to the left.
[*] (Arrow right) moves one cell to the right.
The name of the current cell (e.g., AA01) occupied by the cursor is displayed in the center of the top screen line. To the right of it is a message showing the type of data in the cell. This is good to know since a number on the screen could be a stored number or it could be the result of a function.
These keys can be used in input mode to terminate input and send the cursor to the next cell. For example, if you are on cell AA01 and you type NAMES(CTRL - *), "NAMES" is entered in cell AA01 and the cursor will move to cell AB01. RETURN keeps the cursor on the current cell. In edit mode these keys move you around the text window to give you full-screen editing.
[H] takes the cursor to AA01.
[D] deletes a block of cells. Follow the prompts. Specifying an improper block results in an error.
[C] copies a block of cells. See below.
[M] moves a block of cells. See below.
[T] forces text mode. This allows you to enter numbers, etc., as text. For example, 342-48-2333 as a number would result in just 342 being entered. In forced text mode it is entered as text.
[G] changes the global format of the column the cursor is on.
[L,C,R] keys control Left, Center and Right justification.
[D] toggles the "$" symbol.
[,] toggles commas on and off.
[0-9] chooses the number of places displayed to the right of the decimal point.
[ESCAPE] makes the choice final and exits.
All new data entered in this column will take on the new format. Formatting information is stored with cell data when it is entered. So data already there has its own individual format. To change it use CTRL-E
[F] formats an individual cell. Enter the data normally. Press CTRL-E The global format information is displayed in the text window. Make the changes you desire as above in G. ESCAPE reformats the cell and makes the changes on the screen.
[E] displays the current cell data in the text window and allows you to edit the cell much as you are used to doing in Atari BASIC.
[P] prints the sheet. Follow the prompts in defining a block to be printed. The information will be printed exactly as you see it on the screen. So check your column widths, etc. The printing is done by rows. If you have an 80-column printer and select columns whose widths add to more than 80 there will be some wraparound. Therefore you might want to print left and right halves of your sheet.
It's possible to send printer codes out by typing them into a cell. Since some of these codes might conflict with the way BC handles input you might need to type a space first and then the codes.
[O] toggles the recalculation on/off flag. Turn it off to type in data. Otherwise the whole sheet is recalculated every time you enter data, which takes some time to do.
[R] changes recalculation order from by rows to by columns or vice-versa.
[K] erases a cell from the sheet.
[CAPS] toggles between upper and lowercase letters. This key can be used in any input mode.
[A] recalculates the whole sheet immediately. Use CTRL -E and RETURN to recalculate a particular cell.
[ESC] aborts the delete, copy, move and print options.
Let's discuss copy and move. Copy makes an exact duplicate of the block of cells you chose. Move does the same thing but cell references are changed. For example:
Cell | contents |
---- |
-------- |
AA01 | 12.35 |
AA02 | 4 |
AA03 | =AA01+3 |
Cell AA03 has 15.35 as a result. Copying cells AA02 and AA03 to AM23 results in:
cell | contents |
---- |
-------- |
AM22 | 32 (this cell existed before. |
AM23 | 4 |
AM24 | =AA01+3 |
The result in AM24 is 15.35 (the same as before). If you move the same cells to AM23 the result is:
cell | contents |
---- |
-------- |
AM22 | 32 |
AM23 | 4 |
AM24 | =AM22+3 |
Here AM24 will contain 35. Notice how the cell reference was changed in cell AM24.
After a copy or move some cells will be overwritten. None of the source cells are deleted in either except those that are overwritten. Clean up any cells not wanted using the delete option (CTRL -D).
We'd suggest that before doing a copy or move you save the sheet. It's just prudent practice. We have tried to crash this program in every way we can think of, but there is always the unknown. Maybe a circuit gets a little overheated and causes a crash. I even got SynCalc to crash once. Fortunately, I was just fooling around with it. The old adage "Better SAVE than sorry" applies here.
Built-in
functions
The built-in functions are typed in this format:
@CNT(AA03,BX24) or @SQR(23.45) or @SQR(BD23). Parentheses must be used
and cells must be separated by a comma.The following functions require one argument which could be a cell or a number:
function | operation |
-------- |
------------- |
SQU |
squaring |
SQR |
square root |
ABS |
absolute value |
RND |
round value |
EXP |
exponentiation base 10 |
LOG |
logarithm base 10 |
INT |
greatest integer |
These functions require two arguments and they must be cells.
function | operation |
-------- |
---------------- |
CNT | count the number of cells in a block. |
SUM | add the entries in a block. |
AVE | find the average of all the entries in a block |
You
mean I have to
know algebra? Was my
math teacher right in
that there is a use for
algebra? Perish the
thought!
know algebra? Was my
math teacher right in
that there is a use for
algebra? Perish the
thought!
CNT counts all the cells that have entries in a block whether they be text, numbers or functions. SUM however, adds up only the values in cells containing a numeric result. Text cells are treated as a zero. Empty cells result in the word "Error" displayed on the screen. AVE operates like SUM. However, AVE uses the CNT and SUM routines to get its value. So if you try to average cells containing RENT,400,500,600, the result will be (0(RENT) + 400 + 500 + 600)/4 = 375, an incorrect result.
Functions can be mixed in with any arithmetic expression as in:
=AA01 +(4*@AVE(CD24,CE32)^ @ RND(AG12))-(2 + @SQR(AA02))
However, functions are not nestable, i.e., you can not type = @ABS(@ EXP (AA01)).
Error
messages
We used standard error numbers wherever we could to
keep the program as small as possible. The most common errors are:2-out of memory. You have used all available memory. Save the sheet as it is.
138 or 139-Device does not respond or malfunctions. This probably will refer to the printer not being on.
141-cursor out of range. Used in copy, move, delete, print and list if the defined block is incorrect.
144-disk error, probably write protected.
160-drive number not known.
162-disk full.
165-bad filename. You must specify the "Dn:" in the filespec.
167-file locked.
170-file not found.
Wrap-up
There's an easy way to duplicate a forfnula in a
column or row: Use the move command. For example, cell AC02 might have
the formula =SQU(AB02). If I would like that formula in cells AC03 to
AC23, I would first move cell AC02 to AC03. Then move the block AC02,
AC03 to AC04. Next move AC02, AC04 to AC05, etc., until done. Then
column AC has the squares of the numbers in column AB.In this manner special formulas-statistical, financial or others-can be built up. For example, one formula for standard deviation is:
Square root of (mean of X^ 2 - (mean of X)^2)
Assume that the column AB02, AB23 has some data in it:
AA | AB | AC | |
01 |
data | ||
02 |
· | square of AB02 | |
03 |
· |
square of AB03 | |
· | · | · | |
· | · | · | |
23 |
· | square of AB23 | |
24 |
mean of X | mean of X^2 | |
25 |
square of AB24 | AC24-AB25 | |
26 |
square root of AC25 | ||
27 |
First find the mean of AB02, AB23 by using = @AVE(AB02,AB23) and enter this in cell AB24. In cell AB25 enter = @SQU(AB24). In column AC02,AC23 enter the formula = @SQU(ABrr) where rr goes from 02 to 23. Or use the move procedure described above. In cell AC24 enter = @AVE(AC02,AC23). In cell AC25 type =AC24 - AB25. Finally in cell AB26 enter = @SQR(AC25). Cell AB26 will contain the standard deviation.
Let's see what that new car will cost when financed at different rates and different principals.
Let r = rate as a decimal, p = principal, t=years of loan and A=cost of loan. The formula for the cost of a loan (principal plus interest) is:
A = (p*r*t* 12)/(1- (1 + r/12) ^ -12*t)
This formula can be entered into one cell; p, r and t can be numbers or cell references. If you would like to calculate a monthly payment just use p*r as the numerator. If cells AA01, AB01, AC01 contained p,r and t respectively, then the above formula would look like this:
= (AA01*AB01*12*AC01)/(1- (1 + AB01/12) ^ -12*AC01)
We tried to put in features that would make it very easy for you to use this spreadsheet. The built-in functions provide you with the building blocks for almost any formula. This program took over five months to develop and test. We hope you will find it useful.
Barry Kolbe and his wife Linda lave in the country with their two children Philip and Audra. Beware, Phil just got his drivers license and Audra can befound at the local shopping mall. The household uses timesharing since the 800 and Nintendo are hooked up to the same TV.
Bryan Schappel discovered computers, bought one, went to college, drank beer, got engaged, left school and is taking a leave of absence from reality.
Note: Listing in red indicates inverse video
LISTING 1: M/L EDITOR DATA
1000 DATA 255,255,64,37,113,54,112,112
,80,66,0,32,144,2,2,2,8400
1010 DATA 2,2,2,2,2,2,2,2,2,2,2,2,2,2,
2,2,1282
1020 DATA 144,66,32,35,2,2,2,65,64,37,
72,138,72,174,122,37,1276
1030 DATA 189,123,37,141,10,212,141,24
208,238,122,37,104,170,104,64,6995
1040 DATA 0,130,0,169,0,141,122,37,162
,4,189,196,2,157,22,208,5783
1050 DATA 202,16,247,76,95,228,32,234,
40,32,210,44,32,255,41,32,4899
1060 DATA 142,40,32,146,42,169,37,141,
49,2,169,64,141,48,2,169,2900
1070 DATA 0,133,128,169,32,133,129,169
,70,162,9,160,0,32,155,40,3291
1080 DATA 32,163,42,169,69,162,224,160
,0,32,155,40,32,104,42,32,1924
1090 DATA 146,42,32,123,47,32,145,46,1
73,31,208,201,5,208,3,76,4523
1100 DATA 176,63,201,3,208,6,32,233,46
,76,201,37,173,252,2,201,8033
1110 DATA 255,240,226,32,172,42,162,16
,133,167,41,127,221,125,70,240,9380
1120 DATA 13,202,16,248,165,167,32,142
,62,176,196,76,34,38,189,142,7231
1130 DATA 70,141,26,38,189,159,70,141,
27,38,169,255,141,252,2,32,6674
1140 DATA 255,255,32,85,48,76,201,37,1
73,192,36,201,155,208,6,32,6554
1150 DATA 231,50,76,207,37,165,193,240
,156,173,187,72,208,123,173,192,3131
1160 DATA 36,201,61,240,7,201,189,240,
3,76,144,38,165,193,133,206,190
1170 DATA 32,156,46,32,231,54,144,4,16
9,130,208,2,169,2,133,194,6756
1180 DATA 165,206,133,193,24,105,192,1
33,252,169,36,105,0,133,253,162,9949
1190 DATA 0,32,171,221,165,193,24,105,
6,133,193,170,169,155,157,192,983
1200 DATA 36,32,9,44,32,145,46,174,65,
36,32,238,60,32,141,221,5279
1210 DATA 32,92,46,76,189,38,201,45,14
4,31,208,15,173,193,36,201,7589
1220 DATA 58,176,22,201,47,240,18,201,
46,144,14,201,47,240,10,201,7666
1230 DATA 58,176,6,32,5,46,76,189,38,1
69,0,133,194,141,187,72,6212
1240 DATA 32,9,44,165,147,133,145,165,
158,32,39,45,32,104,42,165,3803
1250 DATA 194,32,134,48,173,68,71,240,
3,32,46,68,173,179,72,240,7136
1260 DATA 3,32,225,38,76,201,37,201,31
,240,3,76,96,39,164,155,5965
1270 DATA 192,63,176,42,173,188,72,24,
121,203,75,201,41,176,32,72,5958
1280 DATA 173,188,72,133,146,104,141,1
88,72,230,155,165,157,133,145,165,1773
1290 DATA 158,32,39,45,32,104,42,164,1
55,185,10,76,133,144,96,230,7331
1300 DATA 155,169,2,164,155,24,121,202
,75,201,40,176,4,136,76,31,4666
1310 DATA 39,200,132,143,32,255,41,32,
1,45,169,2,164,143,196,155,6846
1320 DATA 240,9,24,121,202,75,200,196,
155,208,247,133,146,24,121,202,1631
1330 DATA 75,141,188,72,165,155,281,63
,208,9,165,146,24,109,9,76,4923
1348 DATA 141,188,72,76,14,39,201,30,2
08,68,165,146,201,2,208,5,6288
1350 DATA 165,143,208,30,96,198,155,16
5,157,133,145,165,158,32,39,45,6743
1360 DATA 165,146,72,56,164,155,249,20
2,75,133,146,104,141,188,72,76,8986
1370 DATA 14,39,198,155,165,155,133,14
3,32,255,41,32,1,45,169,2,3389
1380 DATA 133,146,164,143,24,121,202,7
5,141,188,72,76,14,39,201,28,4773
1390 DATA 208,90,165,157,208,5,165,156
,208,13,96,32,104,42,198,157,7238
1400 DATA 198,147,198,158,76,104,42,32
,104,42,198,156,198,158,169,208,727
1410 DATA 133,134,169,34,133,135,169,2
48,133,128,169,34,133,129,162,16,8061
1420 DATA 32,111,40,56,233,40,133,134,
165,135,233,0,133,135,202,16,7729
1430 DATA 239,162,39,169,0,157,80,32,2
02,16,250,133,145,169,2,133,7277
1440 DATA 192,165,156,32,39,45,32,171,
40,76,104,42,201,29,240,1,4018
1450 DATA 96,165,156,24,101,157,201,63
,144,1,96,165,157,201,17,176,8066
1460 DATA 12,32,184,42,230,157,230,147
,230,158,76,104,42,32,104,42,5854
1470 DATA 230,156,230,158,169,120,133,
134,169,32,133,135,169,80,133,128,9186
1480 DATA 169,32,133,129,162,16,32,111
,40,24,105,40,133,134,165,135,5121
1490 DATA 105,0,133,135,202,16,239,169
,0,162,39,157,248,34,202,16,7584
1500 DATA 250,169,2,133,192,169,17,133
,145,24,101,156,32,39,45,32,2460
1510 DATA 171,40,76,104,42,160,39,177,
134,145,128,136,16,249,165,135,9289
1520 DATA 133,129,165,134,133,128,96,1
34,175,169,12,157,66,3,32,86,4156
1530 DATA 228,166,175,96,32,171,40,76,
151,40,32,255,41,32,210,44,5079
1540 DATA 96,133,133,134,132,177,132,2
01,155,240,5,145,128,200,208,245,4185
1550 DATA 96,160,0,132,145,165,156,133
,190,230,190,165,190,162,0,201,2399
1560 DATA 10,144,6,56,233,10,232,208,2
46,72,138,72,164,145,185,180,1746
1570 DATA 69,133,128,185,198,69,133,12
9,104,9,144,160,0,145,128,104,6540
1580 DATA 200,9,144,145,128,230,190,23
0,145,165,145,201,18,208,204,96,2704
1590 DATA 216,169,80,141,180,69,133,12
8,169,32,141,198,69,133,129,160,9239
1600 DATA 1,165,128,24,105,40,133,128,
153,180,69,165,129,105,0,133,6322
1610 DATA 129,153,198,69,200,192,18,20
8,232,169,108,141,0,2,169,37,6582
1620 DATA 141,1,2,169,2,141,200,2,169,
0,141,198,2,169,10,141,4963
1630 DATA 197,2,169,6,162,37,160,125,3
2,92,228,169,192,141,14,212,9330
1640 DATA 160,63,169,8,153,202,75,169,
32,153,10,76,136,16,243,133,6924
1650 DATA 144,169,0,141,201,75,162,209
,149,0,202,48,251,133,147,141,682
1660 DATA 69,71,141,68,71,169,2,133,14
6,24,109,202,75,141,188,72,7111
1670 DATA 165,121,5,122,240,10,165,121
,141,189,42,165,122,141,190,42,8646
1680 DATA 169,127,168,170,138,153,201,
74,73,128,153,73,75,202,136,48,8001
1690 DATA 16,192,95,208,4,162,63,208,2
35,192,31,208,231,162,95,208,3200
1700 DATA 227,169,202,133,128,169,76,1
33,129,160,0,165,128,153,74,76,7526
1710 DATA 165,129,200,153,74,76,165,12
8,24,105,1,133,128,165,129,105,6812
1720 DATA 0,133,129,200,192,128,208,22
7,160,63,169,255,153,202,76,136,3295
1730 DATA 16,250,169,10,141,189,72,169
,77,141,190,72,169,87,133,128,9003
1740 DATA 141,193,72,169,73,133,129,14
1,251,72,160,1,165,128,24,105,7081
1750 DATA 6,133,128,153,193,72,165,129
,105,0,133,129,153,251,72,200,341
1760 DATA 192,57,208,232,96,169,40,133
,128,169,32,133,129,160,39,169,8452
1770 DATA 128,145,128,136,16,249,169,2
,133,138,165,143,133,139,164,139,356
1780 DATA 192,64,240,22,185,202,75,72,
74,24,101,138,133,141,198,141,8748
1790 DATA 104,24,101,138,133,140,201,4
1,144,1,96,169,33,133,142,165,7488
1800 DATA 139,201,26,144,14,230,142,56
,233,26,201,26,144,5,230,142,8431
1810 DATA 56,233,26,72,164,141,165,142
,73,128,145,128,104,24,105,33,5514
1820 DATA 73,128,200,145,128,230,139,1
65,140,133,138,76,24,42,32,133,6170
1830 DATA 42,172,188,72,136,177,128,73
,128,145,128,136,196,146,16,245,684
1840 DATA 164,155,185,10,76,133,144,32
,7,64,96,164,147,185,180,69,7383
1850 DATA 133,128,185,198,69,133,129,9
6,160,0,152,153,32,35,200,192,8326
1860 DATA 160,208,248,169,128,141,34,3
5,96,32,172,42,162,255,142,252,1278
1870 DATA 2,96,173,252,2,201,255,240,2
49,133,184,168,192,192,144,2,3499
1880 DATA 160,154,185,254,254,133,185,
201,130,208,15,173,190,2,73,64,8998
1890 DATA 141,190,2,169,255,141,252,2,
208,216,201,129,208,11,173,182,3150
1900 DATA 2,73,128,141,182,2,76,205,42
,201,131,240,222,201,132,240,4319
1910 DATA 193,201,133,240,189,165,184,
201,64,176,20,165,185,201,97,144,2209
1920 DATA 14,201,123,176,10,173,190,2,
240,5,5,184,76,181,42,165,7108
1930 DATA 185,162,15,221,176,70,240,6,
202,16,248,77,182,2,96,160,8420
1940 DATA 1,208,6,160,2,208,2,160,3,18
5,216,69,133,128,185,220,464
1950 DATA 69,133,129,160,1,96,160,2,32
,140,52,76,184,46,173,189,6856
1960 DATA 72,141,151,43,24,101,154,141
,154,43,173,190,72,141,152,43,7748
1970 DATA 105,0,141,155,43,197,106,176
,221,173,189,72,56,229,130,133,1339
1980 DATA 152,173,190,72,229,131,133,1
53,173,189,72,24,101,154,141,189,557
1990 DATA 72,173,190,72,105,0,141,190,
72,32,150,43,144,1,96,206,6054
2000 DATA 151,43,173,151,43,201,255,20
8,3,206,152,43,206,154,43,173,752
2010 DATA 154,43,201,255,208,3,206,155
,43,76,115,43,173,255,255,141,2441
2020 DATA 255,255,198,152,165,152,201,
255,208,10,198,153,165,153,201,255,653
9
2030 DATA 208,2,56,96,24,96,165,130,14
1,154,43,24,101,154,141,151,7255
2040 DATA 43,165,131,141,155,43,105,0,
141,152,43,173,189,72,56,237,8573
2050 DATA 151,43,133,152,173,190,72,23
7,152,43,133,153,173,189,72,56,9667
2060 DATA 229,154,141,189,72,173,190,7
2,233,0,141,190,72,32,150,43,7330
2070 DATA 144,1,96,238,151,43,208,3,23
8,152,43,238,154,43,208,3,8712
2080 DATA 238,155,43,76,231,43,134,175
,170,189,201,74,166,175,96,165,2019
2090 DATA 155,133,150,165,156,24,101,1
57,133,151,10,168,185,74,76,133,8050
2100 DATA 130,208,185,74,76,133,131,16
0,0,177,130,16,93,165,193,24,7046
2110 DATA 105,4,133,154,32,56,43,160,0
,165,150,145,130,165,144,160,9075
2120 DATA 1,145,130,200,165,193,145,13
0,200,169,0,5,194,145,130,32,8203
2130 DATA 249,59,160,0,185,192,36,145,
130,200,196,193,208,246,165,193,5819
2140 DATA 24,105,4,133,154,165,151,32,
101,44,96,10,168,200,200,76,7716
2150 DATA 127,44,185,74,76,24,101,154,
153,74,76,200,185,74,76,105,7293
2160 DATA 8,153,74,76,200,192,128,208,
233,96,197,150,208,6,165,151,2407
2170 DATA 32,165,44,56,176,151,160,2,1
77,130,24,101,130,133,130,165,8321
2180 DATA 131,105,0,133,131,32,249,59,
76,33,44,72,160,2,177,130,5320
2190 DATA 24,105,4,133,154,32,176,43,1
04,10,168,200,200,76,205,44,8233
2200 DATA 185,74,76,56,229,154,153,74,
76,200,185,74,76,233,0,153,9022
2210 DATA 74,76,200,192,128,208,233,96
,162,17,32,219,44,282,16,250,339
2220 DATA 96,189,180,69,133,128,189,19
8,69,133,129,169,0,160,2,145,7838
2230 DATA 128,200,192,40,208,249,96,16
4,143,24,121,202,75,201,40,176,499
2240 DATA 3,200,208,245,132,140,96,169
,0,133,145,165,156,133,139,165,1291
2250 DATA 139,32,39,45,230,139,230,145
,165,145,201,18,208,241,96,10,544
2260 DATA 168,185,74,76,133,130,200,18
5,74,76,133,131,96,72,165,143,9129
2270 DATA 133,138,169,2,133,192,32,241
,44,166,145,32,219,44,104,32,6733
2280 DATA 25,45,160,0,177,130,201,255,
240,24,197,138,240,27,144,19,172
2290 DATA 164,138,185,202,75,24,101,19
2,133,192,230,138,165,138,197,140,3430
2300 DATA 144,224,96,32,242,59,76,60,4
5,165,130,24,105,4,133,132,5185
2310 DATA 165,131,105,0,133,133,164,14
5,185,180,69,133,134,185,198,69,1049
2320 DATA 133,135,165,192,133,141,160,
1,177,130,133,144,160,3,177,130,9566
2330 DATA 16,3,76,33,46,41,3,240,23,20
1,1,240,91,160,2,177,6522
2340 DATA 130,56,233,6,24,101,132,170,
165,133,105,0,168,76,246,45,7943
2350 DATA 32,145,46,160,2,177,130,168,
169,155,153,192,36,136,177,132,973
2360 DATA 153,192,36,136,16,248,169,19
2,133,132,169,36,133,133,32,25,7115
2370 DATA 54,164,138,185,202,75,133,14
9,160,0,132,142,164,142,185,128,1028
2380 DATA 5,32,0,44,164,141,145,134,23
0,142,230,141,165,142,197,149,3562
2390 DATA 208,234,32,145,46,76,74,45,1
66,132,164,133,32,137,221,32,7681
2400 DATA 79,46,32,230,216,32,201,52,7
6,203,45,169,1,133,194,32,7216
2410 DATA 66,46,32,68,218,32,0,216,162
,192,160,36,32,167,221,169,289
2420 DATA 6,133,193,32,9,44,96,162,0,1
69,5,133,149,164,138,185,8280
2430 DATA 202,75,201,4,208,2,198,149,1
64,141,189,215,70,145,134,200,2726
2440 DATA 232,228,149,208,245,76,74,45
,169,36,133,244,169,192,133,243,4006
2450 DATA 169,0,133,242,96,169,5,133,2
44,169,128,133,243,169,0,133,1122
2460 DATA 242,96,32,79,46,32,230,216,1
60,0,177,243,48,6,153,192,9444
2470 DATA 36,200,208,246,41,127,153,19
2,36,200,132,193,192,1,240,22,642
2480 DATA 173,192,36,201,48,208,15,160
,0,185,193,36,153,192,36,200,9644
2490 DATA 196,193,208,245,198,193,96,1
62,127,169,32,157,192,36,202,16,147
2500 DATA 250,96,160,0,185,192,36,201,
155,240,18,41,127,281,123,176,970
2510 DATA 6,201,97,144,2,73,32,153,192
,36,200,208,231,96,32,210,652
2520 DATA 44,32,205,46,32,255,41,32,17
1,40,32,1,45,32,85,48,1039
2530 DATA 76,104,42,169,0,133,143,133,
156,133,158,133,155,133,157,133,907
2540 DATA 147,169,2,133,146,164,143,24
,121,202,75,141,188,72,96,32,7500
2550 DATA 146,42,160,26,185,246,70,153
,34,35,136,16,247,160,32,185,8714
2560 DATA 17,71,153,74,35,136,16,247,1
69,0,56,237,189,72,133,212,386
2570 DATA 165,106,237,190,72,133,213,3
2,170,217,32,230,216,160,0,177,2015
2580 DATA 243,72,41,127,32,0,44,153,61
,35,200,104,16,241,160,0,5619
2590 DATA 185,199,70,201,155,240,11,32
,0,44,153,39,35,200,192,16,5717
2600 DATA 208,238,32,129,62,76,146,42,
32,50,50,32,115,50,176,48,3345
2610 DATA 32,54,61,176,43,32,115,50,16
2,0,185,192,35,157,192,35,7139
2620 DATA 201,155,240,4,200,232,200,24
2,162,3,189,192,35,32,0,44,7129
2630 DATA 157,197,74,202,16,244,165,15
0,141,178,72,165,151,141,177,72,1675
2640 DATA 96,32,121,48,162,1,189,199,7
4,157,173,35,189,197,74,157,482
2650 DATA 153,35,202,16,241,165,156,24
,101,157,32,25,45,168,0,177,5810
2660 DATA 130,201,255,240,7,205,178,72
,240,11,144,3,76,242,47,32,7487
2670 DATA 242,59,76,151,47,160,3,177,1
30,41,3,240,31,201,1,208,7547
2680 DATA 235,32,111,48,32,230,216,160
,0,177,243,72,41,127,32,0,5934
2690 DATA 44,153,156,35,104,48,33,200,
192,14,208,237,160,2,177,130,130
2700 DATA 133,176,32,249,59,160,0,177,
130,32,0,44,153,156,35,200,6864
2710 DATA 196,176,240,4,192,14,208,239
,173,177,72,32,25,45,165,155,8819
2720 DATA 133,138,160,0,177,130,201,25
5,240,6,197,138,240,9,144,1,186
2730 DATA 96,32,242,59,76,252,47,160,3
,177,130,41,3,240,31,201,8152
2740 DATA 1,208,237,32,111,48,32,230,2
16,160,0,177,243,72,41,127,9385
2750 DATA 32,0,44,153,176,35,104,48,33
,200,192,14,208,237,160,2,8759
2760 DATA 177,130,133,176,32,249,59,16
0,0,177,130,32,0,44,153,176,6958
2770 DATA 35,200,196,176,240,4,192,14,
208,239,96,166,155,165,158,32,1694
2780 DATA 151,69,144,6,169,3,133,194,2
08,34,160,3,177,130,41,3,5663
2790 DATA 133,194,76,134,48,32,249,59,
166,130,164,131,76,137,221,160,1673
2800 DATA 119,169,0,153,32,35,200,192,
160,208,248,96,165,194,10,18,9746
2810 DATA 10,170,160,31,189,74,71,153,
0,32,232,200,192,39,208,244,2212
2820 DATA 96,32,210,44,169,49,141,193,
70,32,50,50,32,115,50,176,5148
2830 DATA 3,141,193,70,162,32,32,129,4
0,169,1,133,145,169,3,162,6777
2840 DATA 32,157,66,3,169,192,157,68,3
,169,70,157,69,3,169,6,4977
2850 DATA 157,74,3,169,0,157,75,3,32,8
6,228,16,6,32,146,52,2637
2860 DATA 76,196,46,162,32,169,5,157,6
6,3,169,128,157,68,3,169,6340
2870 DATA 5,157,69,3,169,0,157,73,3,16
9,20,157,72,3,32,86,2591
2880 DATA 228,16,11,32,129,62,162,32,3
2,129,40,76,196,46,32,52,3142
2890 DATA 49,162,0,160,11,189,128,5,20
1,155,240,10,32,0,44,145,5543
2900 DATA 128,200,232,76,15,49,230,145
,165,145,201,17,208,181,32,129,699
2910 DATA 62,32,210,44,169,0,133,145,2
40,169,164,145,185,180,69,133,2260
2920 DATA 128,185,198,69,133,129,96,32
,58,50,32,115,50,32,156,50,3575
2930 DATA 32,119,54,144,5,160,165,76,2
15,48,32,160,54,144,3,76,5352
2940 DATA 184,46,169,8,160,11,208,18,3
2,50,50,32,115,50,32,156,3114
2950 DATA 50,32,119,54,176,223,169,4,1
60,7,133,173,132,174,162,32,9213
2960 DATA 32,129,40,162,32,165,173,157
,74,3,169,3,157,66,3,169,5940
2970 DATA 199,157,68,3,169,70,157,69,3
,169,0,157,75,3,32,86,3089
2980 DATA 228,16,3,76,215,48,162,32,16
5,174,168,157,66,3,169,202,9930
2990 DATA 157,68,3,169,75,157,69,3,192
,7,208,10,169,255,157,72,9272
3000 DATA 3,157,73,3,208,17,173,189,72
,56,233,202,157,72,3,173,9470
3010 DATA 190,72,233,75,157,73,3,32,86
,228,16,7,192,136,240,3,7205
3020 DATA 76,215,48,162,32,32,129,40,1
65,173,201,8,240,19,162,32,7743
3030 DATA 169,202,24,125,72,3,141,189,
72,169,75,125,73,3,141,190,7861
3040 DATA 72,76,184,46,32,50,50,32,115
,50,176,43,32,54,61,176,3956
3050 DATA 38,165,151,201,47,176,32,165
,150,201,55,176,26,32,104,42,6605
3060 DATA 32,210,44,165,150,133,143,13
3,155,165,151,133,156,133,158,169,3183
3070 DATA 0,32,215,46,76,190,46,96,160
,114,185,192,36,153,192,35,9542
3080 DATA 136,16,247,96,32,46,68,76,18
4,46,169,1,141,187,72,96,6947
3090 DATA 165,155,170,165,156,24,101,1
57,133,138,32,151,69,144,1,96,6827
3100 DATA 165,138,32,165,44,32,104,42,
169,2,133,192,165,157,133,145,9739
3110 DATA 165,158,32,39,45,32,104,42,9
6,160,0,185,192,35,201,155,8489
3120 DATA 240,9,201,32,240,7,200,192,3
2,208,240,56,96,200,185,192,3862
3130 DATA 35,201,155,240,246,201,32,20
8,7,200,192,32,208,240,240,235,7299
3140 DATA 24,96,162,0,185,192,35,157,1
99,70,201,155,240,4,200,232,3870
3150 DATA 208,242,96,32,50,50,32,115,5
0,176,49,32,54,61,176,44,3985
3160 DATA 230,151,165,151,201,2,144,36
,201,33,176,32,164,150,153,202,1322
3170 DATA 75,32,210,44,32,255,41,32,1,
45,164,143,132,155,169,2,6780
3180 DATA 133,146,24,121,202,75,141,18
8,72,32,104,42,96,166,155,165,9265
3190 DATA 158,32,151,69,144,1,96,160,1
,177,130,133,0,200,177,130,9159
3200 DATA 133,154,200,177,130,41,3,208
,22,32,249,59,164,154,136,177,655
3210 DATA 130,153,192,36,136,16,248,16
9,255,133,148,32,48,62,96,201,15
3220 DATA 2,240,29,32,249,59,166,130,1
64,131,32,137,221,32,230,216,2727
3230 DATA 160,0,177,243,72,41,127,153,
192,36,104,48,218,200,208,242,4046
3240 DATA 165,154,56,233,6,133,154,76,
3,51,169,1,133,191,32,231,8314
3250 DATA 50,32,145,62,8,169,0,133,191
,40,144,1,96,104,104,165,6784
3260 DATA 0,133,144,76,34,38,32,146,42
,164,155,185,10,76,133,144,7488
3270 DATA 162,18,202,48,31,189,64,72,1
57,34,35,224,5,144,243,189,155
3280 DATA 77,72,157,74,35,189,90,72,15
7,114,35,189,103,72,157,154,9155
3290 DATA 35,76,108,51,76,243,51,173,2
52,2,201,255,240,249,162,255,8259
3300 DATA 142,252,2,201,28,208,1,96,16
2,2,221,136,72,240,5,202,63
3310 DATA 16,248,48,14,165,144,41,252,
133,176,138,5,176,133,144,76,75
3320 DATA 243,51,201,58,208,9,165,144,
73,8,133,144,76,243,51,201,200
3330 DATA 32,208,9,165,144,73,4,133,14
4,76,243,51,162,9,221,165,243
3340 DATA 72,240,5,202,16,248,48,175,1
38,72,165,144,41,15,133,144,8566
3350 DATA 104,10,10,10,10,5,144,133,14
4,165,144,41,3,170,189,123,7940
3360 DATA 72,141,51,35,165,144,41,8,74
,74,74,170,189,121,72,141,7794
3370 DATA 91,35,165,144,41,4,74,74,170
,189,121,72,141,131,35,165,8388
3380 DATA 144,41,240,74,74,74,74,170,1
89,126,72,141,171,35,76,145,8932
3390 DATA 51,32,96,51,164,155,165,144,
153,10,76,96,165,158,166,155,846
3400 DATA 32,151,69,144,1,96,32,96,51,
160,1,165,144,145,130,166,8648
3410 DATA 157,134,145,165,158,32,39,45
,164,155,185,10,76,133,144,76,7952
3420 DATA 104,42,173,68,71,73,3,141,68
,71,170,160,0,189,50,71,5985
3430 DATA 153,24,71,232,200,192,3,208,
244,96,173,69,71,73,6,141,8787
3440 DATA 69,71,170,160,0,189,56,71,15
3,44,71,232,200,192,6,208,983
3450 DATA 244,96,132,177,162,32,32,129
,40,164,177,132,212,169,0,133,29
3460 DATA 213,32,170,217,32,230,216,16
0,255,200,177,243,72,41,127,32,2532
3470 DATA 0,44,153,231,70,104,16,241,3
2,121,48,160,20,185,225,70,9246
3480 DATA 153,156,35,136,16,247,169,25
5,141,252,2,32,106,62,96,160,9820
3490 DATA 255,200,177,243,153,0,5,16,2
48,160,127,169,48,153,192,36,55
3500 DATA 136,16,250,169,36,141,192,36
,169,193,133,132,169,36,133,133,1074
3510 DATA 165,144,72,41,240,74,74,74,7
4,141,176,72,104,41,4,208,7287
3520 DATA 12,160,255,200,177,243,145,1
32,16,249,76,99,53,160,255,200,4443
3530 DATA 185,0,5,48,5,201,46,208,246,
136,132,179,162,29,169,2,9392
3540 DATA 141,175,72,185,0,5,41,127,15
7,128,5,202,136,48,13,206,7423
3550 DATA 175,72,16,239,169,44,157,128
,5,202,16,226,232,160,1,189,1353
3560 DATA 128,5,153,192,36,200,232,224
,30,208,244,166,179,189,0,5,1800
3570 DATA 16,11,136,185,192,36,9,128,1
53,192,36,208,12,232,189,0,9447
3580 DATA 5,153,192,36,48,3,200,208,24
4,165,144,41,8,240,8,169,143
3590 DATA 192,133,132,169,36,133,133,1
69,0,141,113,54,160,255,200,185,3292
3600 DATA 192,36,48,46,201,69,208,246,
238,113,54,136,185,192,36,9,310
3610 DATA 128,153,192,36,162,255,232,2
00,185,192,36,72,41,127,157,114,1663
3620 DATA 54,169,48,153,192,36,104,16,
237,232,142,113,54,169,155,157,2076
3630 DATA 114,54,160,255,200,185,192,3
6,16,16,41,127,153,192,36,200,9790
3640 DATA 169,46,153,192,36,132,179,76
,213,53,201,46,208,230,132,179,3939
3650 DATA 200,185,192,36,16,250,41,127
,153,192,36,165,179,24,109,176,610
3660 DATA 72,168,173,176,72,208,1,136,
169,155,153,193,36,173,113,54,513
3670 DATA 240,16,162,0,189,114,54,153,
193,36,201,155,240,4,232,200,3683
3680 DATA 208,242,173,193,36,201,45,20
8,22,173,194,36,201,44,208,15,111
3690 DATA 160,0,185,195,36,153,194,36,
201,155,240,3,200,208,243,160,5681
3700 DATA 255,200,177,132,201,155,208,
249,132,179,162,127,169,32,157,128,412
9
3710 DATA 5,202,16,250,165,144,41,3,17
0,240,36,202,208,14,164,138,1485
3720 DATA 185,202,75,56,229,179,16,22,
162,0,240,21,164,138,185,202,1686
3730 DATA 75,56,229,179,16,7,73,255,74
,168,76,66,54,74,170,160,8815
3740 DATA 255,200,177,132,201,155,240,
6,157,128,5,232,208,243,169,128,5338
3750 DATA 133,132,169,5,133,133,96,0,1
18,54,249,61,155,173,199,70,424
3760 DATA 201,68,208,23,173,200,70,201
,58,240,14,201,56,240,14,201,1978
3770 DATA 49,144,8,201,52,176,4,144,4,
24,96,56,96,173,201,70,7240
3780 DATA 201,58,240,245,208,245,169,0
,141,34,35,162,32,32,129,40,6867
3790 DATA 169,36,157,66,3,169,70,157,6
9,3,169,199,157,68,3,32,5989
3800 DATA 86,228,189,67,3,72,162,32,32
,129,40,104,201,1,240,2,6539
3810 DATA 24,96,169,72,162,139,160,1,3
2,48,69,173,252,2,162,255,1010
3820 DATA 201,43,240,236,201,35,208,24
3,142,252,2,56,96,169,0,133,620
3830 DATA 180,32,68,218,162,0,134,193,
189,192,36,157,192,35,201,155,2824
3840 DATA 240,3,232,208,243,134,193,16
2,1,189,192,35,201,64,240,8,1948
3850 DATA 232,228,193,208,244,76,101,5
8,134,138,169,56,133,131,169,86,1387
3860 DATA 133,130,232,134,139,160,0,17
7,138,240,234,48,18,221,192,35,2044
3870 DATA 208,4,232,200,208,241,169,4,
32,251,59,166,139,208,230,41,3547
3880 DATA 127,221,192,35,208,240,160,3
,177,130,133,176,232,134,139,10,2394
3890 DATA 170,189,127,56,141,246,55,18
9,128,56,141,247,55,169,0,133,557
3900 DATA 178,164,139,185,192,35,201,4
0,240,2,56,96,200,185,192,35,1038
3910 DATA 201,68,176,246,201,65,176,35
,132,242,132,139,32,241,61,32,611
3920 DATA 0,216,176,230,32,254,55,176,
225,164,242,185,192,35,201,41,4481
3930 DATA 208,3,76,206,55,201,44,240,2
11,208,207,132,139,32,54,61,786
3940 DATA 176,200,164,178,165,150,153,
159,0,165,151,153,163,0,165,176,2345
3950 DATA 201,7,240,9,166,150,165,151,
32,22,56,176,227,164,178,169,2871
3960 DATA 128,153,198,0,32,254,55,176,
215,165,139,24,105,4,133,139,9507
3970 DATA 168,76,133,55,200,132,140,16
4,138,166,140,32,206,61,162,0,9781
3980 DATA 189,192,35,201,155,240,3,232
,208,246,134,193,32,221,61,164,4725
3990 DATA 138,169,35,153,192,35,165,19
5,153,193,35,32,255,255,144,1,2205
4000 DATA 96,76,1,55,165,180,164,178,1
53,195,0,230,178,200,192,3,3077
4010 DATA 176,8,170,32,199,61,230,180,
24,96,56,96,134,150,32,25,6917
4820 DATA 45,160,0,177,130,201,255,240
,6,197,150,240,11,144,2,56,293
4030 DATA 96,32,242,59,76,27,56,96,160
,3,177,130,41,3,240,26,6422
4040 DATA 201,1,240,10,160,2,177,139,5
6,233,6,32,251,59,169,4,8066
4050 DATA 32,251,59,166,130,164,131,32
,137,221,24,96,83,81,213,0,8499
4060 DATA 65,66,211,1,83,81,210,2,82,7
8,196,3,69,88,208,4,6304
4070 DATA 76,79,199,5,73,78,212,6,67,7
8,212,7,83,85,205,8,6557
4080 DATA 65,86,197,9,0,245,56,147,56,
207,56,14,57,166,57,175,8060
4090 DATA 57,163,56,45,57,61,57,132,57
,32,248,57,165,212,41,127,8932
4100 DATA 133,212,166,195,32,199,61,24
,96,169,0,141,250,61,32,248,706
4110 DATA 57,32,79,46,32,230,216,32,45
,58,165,212,72,32,0,216,8144
4120 DATA 104,16,15,173,250,61,240,10,
162,179,160,74,32,152,221,32,636
4130 DATA 96,218,76,156,56,32,248,57,1
62,36,160,62,32,167,221,32,9081
4140 DATA 209,222,162,185,160,74,32,15
2,221,32,40,219,144,1,96,32,7918
4150 DATA 204,221,176,6,32,251,61,76,2
04,56,96,32,248,57,32,209,9731
4160 DATA 222,162,185,160,74,32,152,22
1,32,219,218,144,1,96,32,204,1000
4170 DATA 221,144,228,96,32,248,57,162
,191,160,74,32,152,221,32,102,789
4180 DATA 218,144,1,96,32,230,216,32,4
5,58,32,79,46,32,0,216,5168
4190 DATA 76,156,56,32,4,58,32,11,58,3
2,22,58,32,184,57,76,2397
4200 DATA 156,56,96,32,4,58,32,11,58,3
2,22,58,32,79,57,176,2537
4210 DATA 3,76,156,56,96,32,35,58,32,6
8,218,165,167,133,169,32,8864
4220 DATA 182,221,166,169,165,171,32,2
2,56,176,7,240,7,32,102,218,9047
4230 DATA 144,2,56,96,230,169,165,169,
197,168,240,227,144,225,230,171,9626
4240 DATA 165,171,197,172,240,213,144,
211,24,96,32,4,58,32,11,58,5071
4250 DATA 32,22,58,32,184,57,176,19,32
,73,58,32,79,57,176,11,3955
4260 DATA 32,87,58,32,40,219,176,3,76,
156,56,96,32,248,57,32,6805
4270 DATA 204,221,144,244,96,32,248,57
,32,209,222,144,245,96,32,35,1305
4280 DATA 58,169,0,133,173,133,174,165
,167,133,169,166,169,165,171,32,3677
4290 DATA 22,56,176,6,230,173,208,2,23
0,174,230,169,165,169,197,168,7158
4300 DATA 240,233,144,231,230,171,165,
171,197,172,240,219,144,217,32,68,6300
4310 DATA 218,165,173,133,212,165,174,
133,213,32,170,217,24,96,165,178,3931
4320 DATA 240,4,201,1,240,3,104,104,56
,96,165,178,201,2,208,246,3065
4330 DATA 96,160,1,185,198,0,16,238,13
6,16,248,96,165,164,197,163,3763
4340 DATA 144,228,165,160,197,159,144,
222,96,162,7,181,159,149,167,202,5421
4350 DATA 16,249,96,160,0,177,243,48,1
5,201,46,240,3,200,208,245,4349
4360 DATA 141,250,61,169,155,145,243,9
6,41,127,145,243,200,208,244,166,7952
4370 DATA 180,189,251,72,168,189,193,7
2,170,32,167,221,96,166,180,189,5505
4380 DATA 251,72,168,189,193,72,170,32
,152,221,96,160,1,185,192,35,1475
4390 DATA 201,68,176,4,201,65,176,8,20
0,196,193,208,240,76,254,58,5263
4400 DATA 132,138,152,24,105,4,133,140
,32,54,61,176,19,165,151,32,6905
4410 DATA 25,45,160,0,177,130,201,255,
240,6,197,150,240,9,144,1,1726
4420 DATA 96,32,242,59,76,140,58,160,3
,177,130,41,3,240,241,201,2397
4430 DATA 1,240,10,160,2,177,130,56,23
3,6,32,251,59,169,4,32,7237
4440 DATA 251,59,166,130,164,131,32,13
7,221,169,4,133,139,32,207,58,360
4450 DATA 164,138,76,114,58,164,138,16
6,140,32,206,61,165,193,56,229,3071
4460 DATA 139,133,193,32,221,61,164,13
8,169,35,153,192,35,165,180,200,3818
4470 DATA 153,192,35,132,138,170,189,2
51,72,168,189,193,72,170,32,167,3872
4480 DATA 221,230,180,96,160,1,185,192
,35,201,155,240,53,201,40,240,4575
4490 DATA 13,201,41,240,9,201,35,208,9
,200,200,76,60,59,200,76,163
4500 DATA 0,59,132,242,132,138,32,241,
61,32,0,216,176,41,166,242,2307
4510 DATA 138,133,140,56,229,138,133,1
39,32,207,58,164,138,200,196,193,5160
4520 DATA 240,27,185,192,35,201,155,24
0,20,162,4,221,82,73,240,9,851
4530 DATA 202,16,248,201,41,240,230,56
,96,200,76,0,59,160,0,185,9682
4540 DATA 192,35,201,155,240,7,201,40,
240,44,200,208,242,160,0,185,4636
4550 DATA 192,35,201,155,240,9,201,41,
240,42,200,208,242,240,37,162,5953
4560 DATA 0,189,193,35,157,64,36,201,1
55,240,5,232,200,76,123,59,1773
4570 DATA 32,7,60,176,15,96,200,185,19
2,35,201,41,240,8,201,155,2539
4580 DATA 240,2,208,242,56,96,132,208,
136,185,192,35,201,40,208,248,5727
4590 DATA 132,207,162,255,164,207,232,
200,196,208,240,9,185,192,35,157,6650
4600 DATA 64,36,76,176,59,169,155,157,
64,36,32,7,60,176,213,165,9769
4610 DATA 208,56,229,207,201,1,240,204
,166,207,173,64,36,157,192,35,3109
4620 DATA 173,65,36,232,157,192,35,164
,208,232,200,185,192,35,157,192,6478
4630 DATA 35,201,155,208,244,76,87,59,
160,2,177,130,32,251,59,169,1607
4640 DATA 4,24,101,130,133,130,165,131
,105,0,133,131,96,160,0,132,8743
4650 DATA 142,32,164,60,201,155,240,35
,144,1,96,32,221,60,165,183,1345
4660 DATA 201,94,208,14,32,19,61,176,2
41,32,249,60,32,197,61,76,9091
4670 DATA 7,60,165,142,24,105,3,168,76
,9,60,160,0,132,142,32,5819
4680 DATA 164,60,201,155,240,48,144,1,
96,32,221,60,165,183,281,42,1420
4690 DATA 208,7,32,219,218,176,241,144
,9,201,47,208,16,32,40,219,733
4700 DATA 176,230,32,249,60,32,197,61,
164,142,76,55,60,165,142,24,8783
4710 DATA 105,3,168,76,55,60,160,0,132
,142,32,164,60,201,155,240,2071
4720 DATA 39,144,1,96,32,221,60,165,18
3,201,43,208,7,32,102,218,843
4730 DATA 176,241,144,9,201,45,208,235
,32,96,218,176,230,32,249,60,4358
4740 DATA 32,197,61,164,142,76,114,60,
24,96,185,64,36,201,35,240,75
4750 DATA 6,201,155,240,44,56,96,200,1
85,64,36,201,155,240,246,133,5717
4760 DATA 181,200,185,64,36,133,183,20
1,155,240,22,200,185,64,36,201,3513
4770 DATA 155,240,14,201,35,208,222,20
0,185,64,36,201,155,240,214,133,6654
4780 DATA 182,24,96,166,181,32,238,60,
32,141,221,166,182,32,238,60,2670
4790 DATA 32,156,221,96,189,193,72,133
,252,189,251,72,133,253,96,165,6986
4800 DATA 142,24,105,2,168,24,105,3,17
0,189,64,36,153,64,36,201,8253
4810 DATA 155,240,5,200,232,76,3,61,96
,166,181,32,238,60,32,141,9954
4820 DATA 221,32,209,222,144,2,56,96,1
66,182,32,238,60,32,156,221,2138
4830 DATA 32,219,218,176,241,32,204,22
1,176,236,24,96,32,123,61,176,2480
4840 DATA 5,32,79,61,144,1,96,164,205,
200,32,123,61,176,247,32,1247
4850 DATA 148,61,164,205,96,165,203,16
2,2,221,56,73,240,5,202,16,815
4860 DATA 248,48,15,189,59,73,133,141,
165,204,201,91,176,4,201,65,2024
4870 DATA 176,2,56,96,56,233,65,24,101
,141,133,150,201,64,176,242,3530
4880 DATA 96,185,192,35,201,155,240,16
,133,203,200,185,192,35,201,155,5933
4890 DATA 240,6,133,204,132,205,24,96,
56,96,165,203,32,180,61,176,1565
4900 DATA 23,133,151,165,204,32,180,61
,176,14,138,24,101,151,176,202,2001
4910 DATA 224,64,176,4,134,151,24,96,5
6,96,162,9,221,62,73,240,348
4920 DATA 5,202,16,248,56,96,189,72,73
,24,96,166,181,32,238,60,400
4930 DATA 32,171,221,96,189,192,35,153
,192,35,201,155,240,4,200,232,5954
4940 DATA 208,242,96,166,193,189,192,3
5,157,194,35,202,228,138,240,245,8885
4950 DATA 176,243,230,193,230,193,96,1
69,35,133,244,169,192,133,243,96,7302
4960 DATA 251,61,35,62,32,182,221,162,
42,160,62,32,167,221,162,36,1096
4970 DATA 160,62,32,137,221,32,40,219,
162,42,160,62,32,152,221,32,9980
4980 DATA 102,218,162,191,160,74,32,15
2,221,32,219,218,96,48,62,179,2500
4990 DATA 69,169,0,133,139,168,170,134
,140,166,139,189,216,69,24,105,2425
5000 DATA 2,133,128,189,220,69,105,0,1
33,129,166,140,189,192,36,32,847
5010 DATA 0,44,228,148,208,2,73,128,14
5,128,232,200,192,38,208,236,6422
5020 DATA 160,0,230,139,165,139,201,3,
208,205,96,173,31,208,201,6,2996
5030 DATA 208,16,104,104,169,155,141,1
92,36,169,0,133,191,141,201,75,2578
5840 DATA 56,96,173,252,2,201,255,240,
226,32,163,42,166,148,96,32,2569
5850 DATA 145,46,169,0,133,148,32,48,6
2,32,106,62,166,148,164,191,489
5060 DATA 208,30,172,201,75,208,25,160
,4,217,180,72,240,5,136,16,262
5070 DATA 248,48,20,141,179,72,201,155
,208,70,140,179,72,76,255,62,3089
5080 DATA 201,155,208,3,76,255,62,201,
27,208,10,32,106,62,201,155,737
5090 DATA 240,46,76,222,62,160,12,217,
76,70,240,18,136,16,248,157,2092
5100 DATA 192,36,232,134,148,224,114,1
44,173,202,134,148,208,168,185,50,6088
5110 DATA 70,141,250,62,185,63,70,141,
251,62,32,255,255,76,149,62,3278
5120 DATA 160,114,136,185,192,36,201,3
2,240,248,169,155,200,153,192,36,6052
5130 DATA 132,193,169,0,133,191,24,96,
32,145,46,169,0,133,148,96,8792
5140 DATA 166,148,240,8,202,169,32,157
,192,36,134,148,96,166,148,240,4828
5150 DATA 251,202,134,148,96,166,148,2
24,113,176,241,232,134,148,96,166,7225
5160 DATA 148,189,193,36,157,192,36,23
2,224,122,208,245,96,162,122,189,7288
5170 DATA 192,36,157,193,36,202,228,14
8,16,245,232,169,32,157,192,36,4093
5180 DATA 141,50,37,96,165,148,56,233,
38,16,3,24,105,114,133,148,8032
5190 DATA 96,165,148,24,105,38,281,114
,144,244,56,233,114,76,109,63,1565
5200 DATA 162,0,165,148,201,38,144,8,1
62,38,201,76,144,2,162,76,9261
5210 DATA 134,148,96,32,127,63,169,37,
133,141,32,76,63,198,141,16,8381
5220 DATA 249,96,32,127,63,169,37,133,
141,32,62,63,198,141,16,249,716
5230 DATA 96,169,4,141,124,37,169,1,14
1,201,75,32,142,62,176,47,8867
5240 DATA 32,156,46,162,0,169,89,133,1
28,169,70,133,129,160,0,177,1028
5250 DATA 128,240,222,217,192,36,208,3
4,200,192,3,208,242,189,111,70,5122
5260 DATA 141,236,63,189,118,70,141,23
7,63,32,146,42,32,255,255,169,4223
5270 DATA 0,141,124,37,141,201,75,76,2
01,37,232,165,128,24,105,3,9450
5280 DATA 133,128,144,201,230,129,208,
197,165,155,162,0,56,233,26,48,1826
5290 DATA 3,232,208,248,72,138,24,105,
161,141,19,32,104,24,105,187,9276
5300 DATA 141,20,32,166,158,232,138,16
2,0,56,233,10,48,3,232,208,1402
5310 DATA 248,72,138,24,105,144,141,21
,32,104,24,105,154,141,22,32,6426
5320 DATA 96,32,146,42,169,80,141,199,
70,169,58,141,200,70,169,155,3235
5330 DATA 141,201,70,169,72,162,3,160,
0,140,72,71,32,48,69,32,5071
5340 DATA 119,69,32,104,69,32,142,69,3
2,104,69,165,159,133,138,165,898
5350 DATA 160,56,229,159,48,7,165,164,
56,229,163,16,8,160,141,32,9444
5360 DATA 140,52,76,196,46,162,32,32,1
29,40,162,32,169,3,157,66,7675
5370 DATA 3,169,70,157,69,3,169,199,15
7,68,3,169,0,157,75,3,7212
5380 DATA 169,8,157,74,3,32,86,228,48,
213,166,138,189,202,75,133,3547
5390 DATA 149,165,163,32,151,69,176,93
,160,1,177,130,133,144,160,3,781
5400 DATA 177,130,16,3,76,98,65,41,3,2
40,3,76,115,65,160,2,5857
5410 DATA 177,130,168,32,249,59,169,15
5,153,192,36,136,48,8,177,130,1297
5420 DATA 153,192,36,76,218,64,169,192
,133,132,169,36,133,133,32,25,9841
5430 DATA 54,32,49,65,230,138,165,138,
197,160,240,174,144,172,165,159,7592
5440 DATA 133,138,32,26,65,230,163,165
,163,197,164,240,157,144,155,162,7310
5450 DATA 32,32,129,40,96,32,87,65,76,
240,64,169,11,162,32,157,9113
5460 DATA 66,3,169,0,157,72,3,157,73,3
,169,155,32,86,228,48,8747
5470 DATA 34,96,169,11,162,32,157,66,3
,165,149,157,72,3,169,0,7589
5480 DATA 157,73,3,169,5,157,69,3,169,
128,157,68,3,32,86,228,8711
5490 DATA 48,1,96,104,104,76,215,48,16
2,127,169,32,157,128,5,202,1220
5500 DATA 16,250,96,32,87,65,166,4,185
,220,70,153,128,5,136,16,8910
5510 DATA 247,76,240,64,201,1,208,19,3
2,249,59,166,130,164,131,32,1386
5520 DATA 137,221,32,230,216,32,201,52
,76,240,64,160,2,177,130,168,3060
5530 DATA 32,249,59,152,56,233,6,24,10
1,130,170,165,131,105,0,168,677
5540 DATA 76,126,65,32,50,50,32,115,50
,32,156,50,32,119,54,144,6167
5550 DATA 3,76,79,49,32 160,54,144,3,7
6,184,46,32,146,42,169,7945
5560 DATA 72,162,34,76,86,64,32,146,42
,169,71,162,138,160,0,140,9635
5570 DATA 70,71,140,72,71,32,48,69,32,
119,69,32,104,69,32,142,5616
5580 DATA 69,32,104,69,32,137,67,32,10
4,69,165,160,197,159,176,3,844
5590 DATA 76,124,64,165,164,197,163,14
4,247,165,161,197,159,208,6,165,6778
5600 DATA 165,197,163,240,235,165,161,
197,168,208,6,165,165,197,164,240,9245
5610 DATA 223,165,160,56,229,159,133,1
71,133,169,165,164,56,229,163,133,6442
5620 DATA 172,56,165,161,229,159,133,2
02,56 165,165,229,163,133,201,32,5914
5630 DATA 50 67,10,170,189,131,67,141,
215,66,189,132,67,141,216,66,3251
5640 DATA 32,104,42,165,159,133,173,16
5,161,133,174,165,165,32,25,45,1151
5650 DATA 160,0,177,130,201,255,240,19
,197,174,240,8,176,13,32,242,4299
5660 DATA 59,76,79,66,166,174,165,165,
32,165,44,165,130,133,132,165,3295
5670 DATA 131,133,133,165,163,32,25,45
,160,0,177,130,201,255,240,87,4790
5680 DATA 197,173,240,8,176,81,32,242,
59,76,119,66,169,35,133,135,735
5690 DATA 169,192,133,134,160,2,177,13
0,24,105,4,168,136,133,154,132,1647
5700 DATA 149,177,130,145,134,136,192,
255,208,247,165,174,141,192,35,165,797
4
5710 DATA 132,133,130,165,133,133,131,
173,70,71,240,3 32,169,67,164,1349
5720 DATA 149,200,132,154,32,56,43,165
,165,32,101,44,164,149,177,134,1859
5730 DATA 145,132,136,192,255,208,247,
32,255,255,176,3,76,74,66,32,2166
5740 DATA 46,68,32,1,45,32,104,42,24,9
6,230,174,230,173,198,171,4415
5750 DATA 165,171,201,255,208,26,230,1
65,230,163,198,172,165,172,201,255,159
6
5760 DATA 208,2,56,96,165,159,133,173,
165,161,133,174,165,169,133,171,6506
5770 DATA 24,96,230,174,230,173,198,17
1,165,171,201,255,208,242,198,165,2482
5780 DATA 198,163,76,249,66,198,174,19
8,173,198,171,165,171,201,255,208,1436
5790 DATA 223,240,195,165,165,197,163,
208,45,165,161,197,159,208,5,104,5458
5800 DATA 104,76,124,64,144,28,165,160
,56,229,159,24,101,161,133,161,2976
5810 DATA 201,64,176,235,165,160,72,16
5,159,133,160,104,133,159,169,1,3491
5820 DATA 24,96,169,0,24,96,144,250,16
5,164,56,229,163,24,101,165,3346
5830 DATA 133,165,201,64,176,201,165,1
64,72,165,163,133,164,104,133,163,5583
5840 DATA 169,2,24,96,233,66,36,67,17,
67,169,2,133,176,169,71,9388
5850 DATA 162,239,160,3,76,125,69,32,1
46,42,169,1,133,176,141,70,9884
5860 DATA 71,169,71,162,168,160,0,76,2
09,65,160,4,185,192,35,201,2711
5870 DATA 61,240,1,96,200,196,149,176,
250,185,192,35,201,68,176,244,8166
5880 DATA 201,65,144,240,140,73,71,32,
54,61,144,5,172,73,71,208,9885
5890 DATA 227,165,150,24,101,202,133,1
50,201,64,176,215,165,151,24,101,4041
5900 DATA 201,133,151,201,64,176,229,1
72,73,71,162,2,165,150,221,59,3656
5910 DATA 73,176,3,202,16,248,72,189,5
6,73,153,192,35,104,56,253,2756
5920 DATA 59,73,24,105,65,200,153,192,
35,230,151,165,151,162,9,221,4907
5930 DATA 72,73,176,3,202,16,248,72,18
9,62,73,200,153,192,35,104,2496
5940 DATA 56,253,72,73,170,189,62,73,2
00,153,192,35,76,179,67,169,3077
5950 DATA 0,133,151,133,150,173,69,71,
208,29,32,111,68,230,150,165,2880
5960 DATA 150,201,64,144,245,169,0,133
,158,230,151,165,151,201,64,144,5915
5970 DATA 233,32,1,45,76,104,42,32,111
,68,230,151,165,151,201,64,2323
5980 DATA 144,245,169,0,133,151,230,15
0,165,150,201,64,144,233,176,225,8840
5990 DATA 165,151,166 50,133,186,134,
187,32,151,69,144,3,76,203,68,1291
6000 DATA 165,130,133,188,165 31,133,
189,160,3,177,130,48,239,201,2,3624
6010 DATA 208,235,136,177,130,56,233,6
,168,169,155,153,192,36,32,249,4676
6020 DATA 59,136 48,8,177,130,153,192,
36,76,160,68,32,231,54,165,1559
6030 DATA 188,133,130,165,189,133,131,
168,2,177,130,56,233,2,24,101,397
6040 DATA 130,133,252,165,131,105,0,13
3,253,32,171,221,165,186,133,151,6491
6050 DATA 165,187,133,150,96,32,146,42
,169,71,162,106,160,0,140,72,2 5
6060 DATA 71,32,48,69,32,119,64,32,104
,69,32,142,69,32,104,69,5919
6070 DATA 165,160,197,159,144,6,165,16
4,197,163,176,3,76,124,64,165,2704
6080 DATA 159,133,161,166,161,165,163,
32,151,69,176,5,165,163,32,165,2436
6090 DATA 44,230,161,165,161,197,160,2
40,234,144,232,230,163,165,163,197,164
8
6100 DATA 164,240,220,144,218,32,146,4
2,32,210,44,32,1,45,76,104,7323
6110 DATA 42,133,133,134,132,132,177,1
85,216,69,24,105,2,133,128,185,2450
6120 DATA 220,69,105,0,133,129,160,0,1
77,132,201,155,240,5,145,128,3749
6130 DATA 200,208,245,96,32,163,42,201
,155,208,2,24,96,201,27,208,2485
6140 DATA 2,56,96,32,225,38,76,83,69,1
74,72,71,165,155,149,159,2318
6150 DATA 165,158,149,163,238,72,71,96
,169,71,162,198,160,1,132,177,3912
6160 DATA 32,48,69,32,83,69,176,1,96,1
04,104,32,146,42,96,169,8754
6170 DATA 71,162,218,160,2,76,125,69,1
34,150,32,25,45,160,0,177,8767
6180 DATA 130,201,255,240,6,197,150,24
0,10,144,2,56,96,32,242,59,1113
6190 DATA 76,156,69,24,96,216,69,70,71
,32,72,112,152,35,35,35,6346
6200 DATA 35,128,162,141,163,225,236,2
27,128,136,227,137,128,145,153,152,824
8
6210 DATA 151,128,128,128,161,161,144,
145,128,128,128,180,185,176,165,154,72
60
6220 DATA 128,128,128,128,128,128,128,
128,128,155,128,162,141,163,225,236,81
48
6230 DATA 227,128,226,249,128,162,225,
242,242,249,128,171,239,236,226,229,51
03
6240 DATA 128,134,128,162,242,249,225,
238,128,179,227,232,225,240,240,229,56
23
6250 DATA 236,128,155,23,31,62,76,99,1
12,44,52,146,161,43,43,43,6950
6260 DATA 63,63,63,63,63,63,63,63,63,6
3,63,63,63,125,126,254,9697
6270 DATA 255,28,29,30,31,157,156,127,
158,159,68,73,82,71,79,84,9218
6280 DATA 83,65,86,76,79,65,83,69,84,8
7,73,68,76,73,83,0,5473
6290 DATA 155,254,65,98,66,173,162,48,
49,49,49,47,50,65,28,29,4904
6300 DATA 30,31,8,20,11,4,3,13,5,6,7,1
5,18,16,1,172,287
6310 DATA 11,100,232,184,68,74,212,197
,150,68,54,43,92,116,64,62,9709
6320 DATA 39,40,39,38,46,50,50,68,65,6
7,51,52,52,52,52,64,3780
6330 DATA 50,255,254,253,159,158,157,1
56,155,127,126,125,31,30,29,28,11
6340 DATA 27,68,49,58,42,46,42,155,68,
49,58,32,32,32,32,32,2882
6350 DATA 32,32,32,32,32,32,32,155,37,
114,114,111,114,69,114,114,8527
6360 DATA 111,114,37,114,114,111,114,2
6,0,0,0,0,48,114,101,115,5083
6370 DATA 115,0,97,0,107,101,121,38,10
5,108,101,26,0,8,0,0,2516
6380 DATA 0,0,0,0,0,0,0,0,0,0,0,0,0,38
,114,101,238
6390 DATA 101,26,50,101,99,97,108,99,2
6,47,38,38,0,0,0,0,1380
6400 DATA 0,0,0,0,0,0,0,0,0,0,98,121,2
6,50,47,55,1553
6410 DATA 0,0,0,47,38,38,47,46,0,50,47
,55,0,0,0,35,9950
6420 DATA 47,44,53,45,46,0,0,0,74,71,1
84,72,180,229,248,244,4558
6430 DATA 128,128,128,128,174,245,237,
226,229,242,128,128,166,245,238,227,37
32
6440 DATA 244,233,239,238,128,128,128,
128,128,128,128,128,36,37,44,37,9761
6450 DATA 52,37,26,0,48,111,115,105,11
6,105,111,110,0,35,117,114,7909
6460 DATA 115,111,114,12,0,50,37,52,53
,50,46,155,35,47,48,57,4250
6470 DATA 26,0,48,111,115,105,116,105,
111,110,0,35,117,114,115,111,9078
6480 DATA 114,12,0,50,37,52,53,50,46,1
55,45,47,54,37,26,0,2719
6490 DATA 48,111,115,105,116,105,111,1
10,0,35,117,114,115,111,114,12,8348
6500 DATA 0,50,37,52,53,50,46,155,53,1
12,112,101,114,0,108,101,7805
6510 DATA 102,116,0,111,102,0,34,108,1
11,99,107,155,44,111,119,101,9453
6520 DATA 114,0,114,105,103,104,116,0,
111,102,0,34,108,111,99,107,7929
6530 DATA 155,53,112,112,101,114,0,108
,101,102,116,0,111,102,0,36,6280
6540 DATA 101,115,116,14,155,48,50,41,
46,52,26,0,48,111,115,105,5819
6550 DATA 116,105,111,110,0,35,117,114
,115,111,114,12,0,50,37,52,5220
6560 DATA 53,50,46,155,44,41,51,52,26,
0,48,111,115,105,116,105,7189
6570 DATA 111,110,0,35,117,114,115,111
,114,12,0,50,37,52,53,50,4553
6580 DATA 46,155,38,47,50,45,33,52,0,0
,0,42,117,115,116,105,5460
6590 DATA 102,121,0,44,36,111,108,108,
97,114,0,4,8,36,9,0,2380
6600 DATA 46,35,111,109,109,97,115,0,0
,8,12,9,0,46,36,101,2537
6610 DATA 99,14,0,112,108,97,99,101,11
5,0,16,46,57,44,50,35,4238
6620 DATA 16,17,18,19,20,21,22,23,24,2
5,0,40,18,38,105,108,2379
6630 DATA 101,0,101,120,105,115,116,11
5,12,0,50,101,112,108,97,99,8338
6640 DATA 101,31,0,57,15,46,155,50,31,
30,26,24,29,27,51,53,2388
6650 DATA 48,0,0,0,0,0,155,28,29,30,31
,187,72,187,72,0,5787
6660 DATA 53,73,86,73,11,2,20,65,66,67
,0,26,52,48,49,50,2595
6670 DATA 51,52,53,54,55,56,57,0,10,20
,30,40,50,60,70,80,3130
6680 DATA 90,94,42,47,43,45,179,74,200
,74,64,1,0,0,0,0,2858
6690 DATA 64,2,0,0,0,0,63,80,0,0,0,0,3
3,33,16,17,9242
6700 DATA 226,2,227,2,144,37,0,0,0,0,0
,0,0,0,0,0,8561
LISTING 2: ASSEMBLY
0100 ;SAVE#D:BCALC.PT1
0110 .OPT NO LIST
0120 *= 0
0130 PASS .=PASS+1
0140 .IF PASS=1
0150 .INCLUDE YD:BCALC.PT2
0160 .ENDIF
0170 ;close
0180 ;save X & res X in XSAV
0190 .MACRO CLOSE
0200 LDX # <%1*16
0210 JSR CLOSE
0220 .EMDM
0230;
0240 .OPT NO LIST
0250 *= $2000
0260 SCMEM .DS 40*20
0270 TXTWIN .DS 160
0280 BF1 .DS $80
0290 BF2 .DS $80
0300 STRING .DS $80
0310 MDLST .BYTE $70,$70,$50,$42
0320 .WORD SCMEM
0330 .BYTE $90,2,2,2,2,2,2
0340 .BYTE 2,2,2,2,2,2,2,2
0350 .BYTE 2,2,2,2,2,$10,$42
0360 WFLP WORD TXTWIN
0370 .BYTE 2,2,2,$41
0380 .WORD MDLST
0390 ;dli
0400 DLI PHA
0410 TXA
0420 PHA
0430 LDX DLIX
0440 LDA DLIC,X
0450 STA WSYNC.
0460 STA COLPF2
0470 INC DLIX
0480 PLA
0490 TAX
0500 PLA
0510 RTI
0520 ;
0530 DLIX .BYTE 0
0540 DLIC .BYTE $02,$00
0550 ;
0560 ;vblank
0570 VBI LDA #0
0580 STA DLIX
0590 LDX #4
0600 VB1 LDA COLOR0,X
0610 STA COLPF0,X
0620 DEX
0630 BPL VB1
0640 JMP SYSVBV
0650 ;title
0660 BEGIN JSR INIT
0670 JSR CLRSCN
0680 JSR DRAWH
0690 JSR SCRV
0700 JSR CLRTXT
0710 LDA # >MDLST
0720 STA SDLSTL+1
0730 LDA # <MDLST
0740 STA SDLSTL
0750 LDA # <SCMEM
0750 STA L
0770 LDA # >SCMEM
0780 STA L+1
0790 LDA # >CREDTF
0800 LDX # <CREDTF
0810 LDY #0
0820 JSR DPRINT
0830 JSR GNKEY
0840 LDA # >CREDIT
0850 LDX # <CREDIT
0860 LDY #0
0870 JSR DPRINT
0880 JSR IVCRS
0890 BFLP JSR CLRTXT
0900 JSR SHWREF
0910 HIMP JSR CLRSTR
0920 LDA CONSOL
0930 CMP #5 ;sel
0940 BNE TOPT
0950 JMP COMMODE
0960 TOPT CMP #3
0970 BNE TKEY
0980 JSR SHOWST
0990 JMP BFLP
1000 TKEY LDA CH
1010 CMP #$FF
1020 BEQ HINP
1030 JSR GKEY
1040 LDX #16
1050 STA DM0
1060 AND #$7F
1070 TSKY CMP SPCKEY,X
1080 BEQ SPCAL
1090 DEX
1100 BPL TSKY
1110 LDA DM0
1120 JSR INPUT
1130 BCS BFLP
1140 JMP GTIM
1150 SPCAL LDA SPECL,X
1160 STA SPJMP+1
1170 LDA SPECH,X
1180 STA SPJMP+2
1190 LDA #$FF
1200 STA CH
1210 SPJMP JSR $FFFF
1220 JSR SHWT2
1230 JMP BFLP
1240 GTIN LDA STRING
1250 CMP #EOL
1260 BNE GTN1
1270 JSR SHOCEL
1280 JMP HINP
1290 GTN1 LDA STR
1300 BEQ HINP
1319 LDA FRCTXT
1320 BNE TRYTX
1330 LDA STRING
1340 CMP #'=
1350 BEQ AFNN
1360 CMP #'=
1370 BEA AFNN
1380 JMP TRYNU
1390 AFNN LDA STR
1400 STA STR2
1410 JSR LO2UP
1420 JSR TRYFNC
1430 BCC HOOK
1440 LDA #$02 ;error
1450 BNE FHOK
1460 HOOK LDA #2
1470 FHOK STA DTYP
1480 LDA STR2
1490 STA STR
1500 CLC
1510 ADC # <STRING
1520 STA FLPTR
1530 LDA # >STRING
1540 ADC #0
1550 STA FLPTR+1
1560 LDX #0
1570 JSR FST0P
1580 LDA STR
1590 CLC
1600 ABC #6
1610 STA STR
1620 TAX
1630 LDA #EOL
1640 STA STRING,X
1650 JSR INSERT
1660 JSR CLRSTR
1670 LDX BF2+1
1680 JSR STFLPTR
1690 JSR FLD0P
1700 JSR NM2STR
1710 JMP GTR
1720 TRYNU CMP #'- ;-,.,0-9
1730 BCC TRYTX
1740 BME N1
1750 LDA STRING+1 ;nx chr #?
1760 CMP #':
1770 BCS TRYTX
1780 CMP #'/
1790 BEQ TRYTX
1800 CMP #'.
1810 BCC TRYTX
1820 Hl CMP #'/
1830 BEQ TRYTX
1840 CMP #':
1850 BCS TRYTX
1860 JSR SBNUM
1870 JMP GTR
1880 TRVTX LDA #0
1890 STA DTYP
1900 STA FRCTXT
1910 JSR INSERT
1920 GTR LDA CRSY
1930 STA VCNT
1940 LDA SROW
1950 JSR REFROW
1960 JSR IVCRS
1970 LDA DTYP
1980 JSR SHWTYP
1990 LDA ONF
2000 BEQ NORC
2010 JSR RECALC
2920 NORC LDA CDIR
2830 BEQ NOCRS
2040 JSR MVCRS
2950 NOCRS JMP BFLP
2060 ;move crs rout
2070 MVCRS CMP #$1F
2080 BEQ CR
2090 JMP CLA
2100 CR LDY SCOL
2110 CPT #63
2120 BCS NORT
2130 LDA CRSEN
2140 CLC
2150 ADC COLW+1,Y
2160 CMP #41
2170 BCS SCRRT
2180 PHA
2190 LDA CRSEN
2200 STA CRSX
2210 PLA
2220 STA CRSEN
2230 INC SCOL
2240 LDA CURRW
2250 STA VCNT
2260 LDA SROW
2270 JSR REFROW
2280 EXC1 JSR IVCRS
2290 LDY SCOL
2300 LDA FMCOL,Y
2310 STA FORMAT
2320 NORT RTS
2330 SCRRT INC SCOL
2340 LDA #2 ;find 1st col
2350 LDY SCOL
2360 FFLP CLC
2370 ADC COLW,Y
2380 CMP #40
2390 BCS FNF
2400 DEY
2410 JMP FFLP
2420 FNF INY
2430 STY FCOL
2440 JSR DRAWN
2450 JSR REFSCR
2460 ;find st/end of cursor
2470 LDA #2
2480 LDY FCOL
2490 CPY SCOL
2500 BEG FSF
2510 FSE CLC
2520 ADC COLW,Y
2530 INY
2540 CPY SCOL
2550 BNE FSE
2560 FSF STA CRSX
2570 CLC
2580 ADC COLW,Y
2590 STA CRSEN
2600 LDA SCOL
2610 CMP #63
2620 BNE FFJ
2630 LDA CRSX
2640 CLC
2650 ADC COLW+63
2660 STA CRSEN
2670 FFJ JMP EXC1
2680 ;left
2690 CLA CMP #$1E
2700 BNE CUA
2710 CL LDA CRSX
2720 CMP #2
2730 BNE PA
2740 LDA FCOL
2750 BNE SCRLL
2760 RTS
2770 PA DEC SCOL
2780 LDA CURRW
2790 STA VCNT
2800 LDA SROW
2810 JSR REFROW
2820 LDA CRSX
2830 PHA
2840 SEC
2850 LDY SCOL
2860 SBC COLW,Y
2870 STA CRSX
2880 PLA
2890 STA CRSEN
2900 JMP EXC1
2910 SCRLL DEC SCOL
2920 LDA SCOL
2930 STA FCOL
2940 JSR DRAWN
2950 JSR REFSCR
2960 LDA #2
2970 STA CRSX
2980 LDY FCOL
2990 CLC
3000 ADC COLW,Y
3010 STA CRSEN
3020 JMP EXC1
3030 ;up
3040 CUA CMP #$1C
3050 BNE CDJ
3060 CU LDA CURRW
3070 BNE R3
3080 LDA FROM
3090 BNE R4
3100 RTS
3110 R3 JSR IVCRS
3120 DEC CORRW
3130 DEC CRSY
3140 DEC SROW
3150 JMP IVCRS
3160 R4 JSR IVCRS
3170 DEC FROW
3180 DEC SROW
3190 ;
3200 LDA # <[SCMEM+720]
3210 STA JL
3220 LDA # >[SCMEM+720]
3230 STA JL+1
3240 LDA # <[SCMEM+760]
3250 STA L
3260 LDA # >[SCMEM+760]
3270 STA L+l
3280 LDX #16
3210 MUAG JSR MOVSCN
3300 SEC
3310 SBC #40
3320 STA JL
3330 LDA JL+1
3340 SBC #0
3350 STA JL+l
3360 DEX
3370 BPL MUAG
3380 ;
3390 LDX #39
3400 LDA #0
3410 UU STA SCMEM+80,X
3420 DEX
3430 BPL UU
3440 STA VCNT
3450 LDA #2
3460 STA SPX
3470 LDA FROM
3480 JSR REFROW
3490 JSR DRCOL
3500 JMP IVCRS
3510 CDJ CMP #$1D ;down
3520 BEQ CD
3530 RTS
3540 CD LDA FROM
3550 CLC
3560 ADC CURRW
3570 CMP #63
3580 BCC Rl
3590 RTS
3600 R1 LDA CURRW
3610 CMP #17
3620 BCS R2
3630 JSR IVCRS
3640 INC CURRW
3650 INC CRSY
3660 INC SROW
3670 JMP IVCRS
3680 R2 JSR IVCRS
3690 INC FROM
3700 INC SROW
3710 ;
3720 LDA # <[SCMEM+120]
3730 STA JL
3740 LDA # >[SCMEM+120]
3750 STA JL+1
3760 LDA # <[SCNEN+80]
3770 STA L
3780 LDA # >[SCMEM+80]
3790 STA L+1
3800 LDX #16
3810 MDAG JSR MOVSCN
3820 CLC
3830 ADC #40
3840 STA JL
3050 LDA JL+1
3860 ADC #0
3870 STA JL+1
3880 DEX
3890 BPL MDAG
3900 LDA #0
3910 LDX #39
3920 DDZ STA SCNEN+760,X
3930 DEX
3940 BPL DDZ
3950 LDA #2
3960 STA SPX
3970 LDA #17
3980 STA VCNT
3990 CLC
4000 ADC FROM
4010 JSR REFROW
4020 JSR DRCOL
4030 JMP IVCRS
4040 ;mov scrn
4050 MOVSCN LDY #39
4060 MS2 LDA (JL),Y
4070 STA (L),Y
4080 DEY
4090 BPL MS2
4100 LDA JL+1
4110 STA L+1
4120 LDA JL
4130 STA L
4140 RTS
4150 ;close
4160 CLOSE STX XSAV
4170 LDA #12
4180 STA ICCOM,X
4190 JSR CIOV
4200 LDX XSAV
4210 RTS
4220 ;draw screen
4230 SCRV JSR DRCOL
4240 JMP CLEAR
4250 SCRH JSR DRAWN
4260 CLEAR JSR CLRSCN
4270 RTS
4280 ;print a=h,x=1,y=strt
4290 DPRIUT STA IL+1
4300 STX IL
4310 DOP LDA (IL),Y
4320 CMP #EOL
4330 BEQ ENDP
4340 STA (L),Y
4350 INY
4360 BNE DOP
4370 ENDP RTS
4380 ;draw col#
4390 DROL LDY #0
4400 STY VCNT
4410 LDA FROM
4420 STA BCD1
4430 INC BCD1
4440 FG LDA BCD1
4450 LDX #0
4460 FE CMP #10
4470 BCC FF
4480 SEC
4490 sec $10
4500 INX
4510 BNE FE
4520 FF PHA
4530 TXA
4540 PHA
4550 LDY VCNT
4560 LDA Y40L,Y
4570 STA L
4580 LDA Y40H,Y
4590 STA L+1
4600 PLA
4610 ORA #$90
4520 LDY #0
4630 STA (L),Y
4640 PLA
4650 INY
4660 ORA #$90
4670 STA (L),Y
4680 INC BCD1
4690 INC VCNT
4700 LDA VCNT
4710 CMP #18
4720 BNE FG
4730 RTS
4740 ;initial
4750 INIT CLD
4760 LDA # <[SCMEM+80]
4770 STA Y49L
4780 STA L
4790 LDA # >[SCMEN+80]
4800 STA Y40H
4810 STA L+1
4820 LDY #1
4830 I1 LDA L
4840 CLC
4850 ADC #40
4860 STA L
4870 STA Y40L,Y
4880 LDA L+1
4890 ADC #0
4990 STA L+1
4910 STA Y40H,Y
4120 INY
4930 CPY #18
4940 BNE I1
4950 ;
4960 LDA # <DLI
4970 STA VDSLST
4980 LDA # >DLI
4990 STA VDSLST+1
5000 LDA #2
5010 STA COLOR4
5020 LDA #0
$030 STA COLOR2
5040 LDA #10
5050 STA COLOR1
5060 LDA #6
5070 LDX # >VBI
5080 LDY # <VBI
5090 JSR SETVBV
5100 LDA #$C0
5110 STA NMIEN
5120 ;
5130 LDY #63
5140 IJ LDA #8
5150 STA COLW,Y
5160 LDA #$20
5170 STA FMCOL,Y
5180 DEY
5190 BPL IJ
5200 STA FORMAT
5210 LDA #0
5220 STA SPFLG
5230 LDX #$Dl
5240 ZPLP STA $00,X
5250 DEX
5260 BMI ZPLP
5270 STA CRSY
5280 STA RCFLG
5290 STA ONF
5300 LDA #2
5310 STA CRSX
5320 CLC
5330 ADC COLW
5340 STA CRSEN
5350 ;keybd
5360 LDA $79
5370 ORA $7A
5380 BEQ BUZZ
5390 LDA $79
5400 STA GTV+1
5410 LDA $7A
6420 STA GTV+2
5430 ;
5440 BUZZ LDA #$7F
5450 TAY
5460 TAX
5470 KLP TXA
5480 STA AIT,Y
5490 EOR #$80
5500 STA AIT+$80,Y
5510 DEX
5520 DEY
5530 BMI KD
5540 CPY #$5F
5550 BNE KCA
5560 LDX #$$3F
5570 BNE KLP
5580 KCA CPY #$1F
5590 BNE KLP
5600 LDX #$5F
5610 BNE KLP
5620 ;rad tabl
5630 KD LDA # <RO1
5640 STA L
5650 LDA # >RO1
5660 STA L+1
5670 LDY #0
5680 CET LDA L
$690 STA RAD,V
5700 LDA L+1
5710 INY
5720 STA RAD,Y
5730 LDA L
5740 CLC
5750 ADC #1
5760 STA L
5770 LDA L+1
5780 ADC #0
5790 STA L+1
5800 INY
5810 CPY #$80
5820 BNE CET
5830 LDY #63
5840 LDA #$FF
5850 CES STA RO1,Y
5860 DEY
5870 BPL CES
5880 LDA # <ENPROG
5890 STA ENDAT
5900 LDA # >ENPROG
5910 STA ENDAT+1
5920 ;fp table addresses
5930 LDA # <FPSTACK
5940 STA L
5950 STA STLO
5960 LDA # >FPSTACK
5970 STA L+1
5980 STA STHI
5990 LDY #1
6000 FPZ LDA L
6010 CLC
6020 ADC #6
6830 STA L
6840 STA STLO,Y
6950 LDA L+1
6060 ADC #0
6070 STA L+l
6080 STA STHI,Y
6090 INY
6100 CPY #57
6110 BNE FPZ
6120 RTS
6130 ;draw hor
6140 DRAWH LDA #u <[SCMEM+40]
6150 STA L
6160 LDA # >[SCMEM+40]
6170 STA L+l
6180 LDY #39
6190 DN LDA #$80
6200 STA (L),Y
6210 DEY
6220 BPL DH
6230 ;
6240 LDA #2
6250 STA TM
6260 LDA FCOL
6270 STA TM1
6280 COA LDY TMl
6210 CPY #64
6390 BEQ CDO
6300 LDA COLW,Y
6320 PHA
6330 LSR A
6340 CLC
6350 ADC TM
6360 STA TM3
6370 DEC TM3
6380 PLA
6390 CLC
6400 ADC TM
6410 STA TM2
6420 CMP #41
6430 BCC COX
6440 CDO RTS
6450 COK LDA #33
6460 STA TM4
6470 LDA TM1
6480 CMP #26
6490 BCC T2
6500 INC TM4
6510 SEC
6520 SBC #26
6530 CMP #26
6540 BCC T2
6550 INC TM4
6560 SEC
6570 SBC #26
6580 T2 PHA
6590 LDY TM3
6600 LDA TM4
6610 EOR #$80
6620 STA {L},Y
6630 PLA
6640 CLC
6650 ADC #$21
6660 EOR #$80
6670 INY
6660 STA (L),Y
6690 INC TM1
6700 LDA TMZ
6710 STA TM
6720 JMP COA
6730 ;inverse cursor
6740 IVCRS JSR LOCCRS
6750 LDY CRSEN
6760 DEY
6770 IVS LDA {L),Y
6780 EOR #$80
6790 STA (L),Y
6800 DEY
6810 CPY CRSX
6820 BPL IVS
6830 LDY SCOL
6840 LDA FMCOL,Y
6850 STA FORMAT
6860 JSR SHWCRI
6870 RTS
6860 ;find crsor
6890 LOCCRS LDY CRSY
6900 LDA Y40L,Y
6910 STA L
6920 LDA Y40H,Y
6930 STA L+1
6940 RTS
6950 ;clrtxt
6960 CLRTXT LDY #0
6970 TYA
6980 CT STA TXTWIN,Y
6990 INY
7000 CPY #168
7010 BNE CT
7020 LDA #$80
7030 STA TXTWIN+2
7040 RTS
7050 ;get reg. key
7060 GNKEY JSR GKEY
7070 LDX #$FF
7080 STX CH
7090 RTS
7100 ;get a key
7110 GKEY LDA CH
7120 CMP #$FF
7130 BEQ GKEY
7140 STA OLDC
7150 K0 TAY
7160 CPY #$C0
7170 BCC STV
7180 LDY #$9A
7190 STV LDA SFEFE,Y
7200 STA OLDAC
7210 KGB CMP #$82 ;caps
7220 BNE KII
7230 KIM LDA CAPS
7240 EOR #$40
7250 STA CAPS
7260 KIJ LDA #$FF
7270 STA CH
7280 BNE GKEY
7290 KII CMP #$81 ;invrs
7300 BNE K3
7310 LDA INVFLG
7320 EOR #$80
7330 STA INVFLG
7340 JMP KIJ
7350 K3 CMP #$83 ;shift
7360 BEQ KIM
7370 CMP #$84 ;control
7380 BEQ GKEY
7390 CMP #$85
7400 BEQ GKEY
7410 LDA OLDC
7420 CMP #$40
7430 BCS K6
7440 LDA OLDAC
7450 CMP #97
7460 BCC K6
7470 CMP #123
7480 BCS K6
7490 LDA CAPS
7500 BEG K6
7510 ORA OLDC
7520 JMP K0
7530 K6 LDA OLDAC
7540 LDX #15
7550 KCMP CMP SLKEY,X
7560 BEQ KOUT
7570 DEX
7580 BPL KCHP
7590 EOR INVFLG
7600 KOUT RTS
7610 ;twin print
7620 LIN1 LDY U1
7630 BNE TP5
7640 LIN2 LDY #2
7650 BNE TP5
7660 LIN3 LDY #I
7670 TPS LDA TWINL,Y
7680 STA L
7690 LDA TWINH,Y
7700 STA L+1
7710 LDY #1
7720 RTS
7730 ;out of memry
7740 MERR LDY #2
7750 JSR DSKERR
7760 JMP HOME
7770 ;moveup
7780 MOVEUP LDA ENDAT
7790 STA MFR+1
7800 CLC
7810 ADC LENG
7820 STA MTO+1
7830 LDA ENDAT+1
7840 STA MFR+2
7850 ADC #0
7860 STA MTO+2
7870 CMP 106
7880 BCS MERR
7890 LDA ENDAT
7900 SEC
7910 SBC LL
7920 STA NBYT
7930 LDA ENDAT+1
7940 SBC LL+1
7950 STA NBVT+1
7960 LDA ENDAT
7970 CLC
7980 ADC LENG
7990 STA ENDAT
8000 LDA ENDAT+1
8010 ADC #0
8020 STA ENDAT+1
8030 MAG JSR MFR
8040 BCC MM1
8050 RTS
8060 MM1 DEC MFR+1
8070 LDA MFR+1
8080 CMP #$FF
8090 BNE MS
8100 DEC MFR+2
8110 MS DEC MTO+1
8120 LDA MTO+1
8130 CMP #$FF
8140 BNE MT
8150 DEC MTO+2
8160 MT JMP MAG
8170 MFR LDA $FFFF
8180 MTO STA $FFFF
8190 MQ DEC NBYT
8200 LDA NBYT
8210 CMP #$FF
8220 DNE CNR
8230 DEC #BYT+1
8240 LDA NBYT+1
8250 CMP #$FF
8260 BNE CNR
8270 SEC
8280 RTS
8290 CNR CLC
8300 RTS
8310 ;move dn
8320 MOVDN LDA LL
8330 STA MTO+1
8340 CLC
8350 ADC LENG
8360 STA MFR+1
8370 LDA LL+1
8380 STA MTO+2
8390 ADC #0
8400 STA MFR+2
8410 LDA ENDAT
8420 SEC
8430 SBC MFR+1
8440 STA NBYT
8450 LDA ENDAT+1
8460 SBC MFR+2
8470 STA NBYT+1
8480 LDA ENDAT
8490 SEC
8500 SBC LENG
8510 STA ENDAT
8520 LDA ENDAT+1
8530 SBC #0
8540 STA ENDAT+1
8550 DD1 JSR MFR
8560 BCC DD4
8570 RTS
8580 DD4 INC MFR+1
8590 BNE DD2
8600 INC MFR+2
8610 DD2 INC MTO+1
8620 BNE DD3
8630 INC MTO+2
8640 DD3 JMP DD1
8650 ;as2ic
8660 AS2IC STX XSAV
8670 TAX
8680 LDA AIT,X
8690 LDX XSAV
8700 RTS
8710 ;insert
8720 ;b#0 =col # b#1 =format
8730 ;b#2 = length b#3 = type
8740 ;types:0=text 1 = # 2=function
8750 INSERT LDA SCOL
8760 STA COLNU
8770 LDA FROM
8780 CLC
8790 ADC CURRW
8800 STA ROWNU
8810 ASL A
0820 TAY
8830 LDA RAD,Y
8840 STA LL
8850 INY
8860 LDA RAD,Y
8870 STA LL+1
8880 IU LDY #0
8890 LDA (LL),Y
8900 BPL FCEL
8910 IS LDA STR
8920 CLC
8930 ADC #DTLEN
8940 STA LENG
8950 JSR MOVUP
8960 LDY #0
8970 LDA COLNU
8980 STA (LL),Y
8990 LDA FORMAT ;format
9000 LDY #1
9010 STA (LL),Y
9020 INY
9030 LDA STR
9040 STA (LL),Y
9050 INY
9060 LDA #0 ;flag2
9070 ORA DTYP
9080 STA (LL),Y
9090 JSR ADDDT
9100 LDY #0
9110 IT LDA STRING,Y
9120 STA (LL),Y
9130 INY
9140 CPY STR
9150 BNE IT
9160 LDA STR
9170 CLC
9180 ADC #DTLEN
9190 STA LENG
9200 LDA ROWNU
9210 JSR UPRAD
9220 RTS
9230 ;
9240 U51D'RE.A
9250 TAY
9260 INY
9270 INY
9280 JMP IG
9290 IR LDA RAD,Y
9300 CLC
9310 ADC LENG
9320 STA RAD,Y
9330 INY
9340 LDA RAD,Y
9350 ADC #0
9360 STA RAD,Y
9379 INY
9389 IQ CPY #$80
9390 BNE IR
9400 RTS
9410 FCEL CMP COLNU
9420 BNE NOD
9430 LDA ROWNU ;4 del
9440 JSR DELTCL
9450 SEC ;fall thru
9460 NOD BCS IS
9470 LDY #2
9480 LDA (LL),Y
9490 CLC
9500 ADC LL
9510 STA LL
9520 LDA LL+1
9530 ADC #0
9540 STA LL+1
9550 JSR ADDDT
9560 JMP IU
9570 ;delete cell; A=row
9580 DELTCL PHA
9590 LDY #2
9600 LDA (LL),Y
9610 CLC
9620 ADC #DTLEN
9630 STA LENG
9640 JSR MOVDN
9650 PLA
9660 ASL A
9670 TAY
9680 INY
9690 INY
9700 JMP DQ
9710 DR LDA RAD,Y
9720 SEC
9730 SBC LENGS
9740 STA RAD,Y
9750 INY
9760 LDA RAD,Y
9770 SBC #0
9780 STA RAD,Y
9790 INY
9800 DQ CPY #$80
9810 BNE DR
9820 RTS
9830 ;clear screen
9840 CLRSCN LDX #17
9850 CTD JSR CLRLIN
9860 DEX
9870 BPL CTD
9880 RTS
9890 ;enter w/x=row
9900 CLRLIN LDA Y40L,X
9910 STA L
9920 LDA Y40H,X
9930 STA L+1
9940 LDA #0
9950 LDY #2
9960 CSLP STA (L),Y
9970 INY
9980 CPY #40
9990 BNE CSLP
010000 RTS
010010 ;find last col
010020 LSTCOL LDY FCOL
010030 OB CLC
010040 ADC COLW,Y
010050 CMP #40
010060 BCS OA
010070 INY
010080 BNE OB
010090 OA STY TH2 ;1st cot
010100 RTS
010110 ;refresh screen
010120 REFSCR LDA #0 ;vert lines
010130 STA VCNT
010140 LDA FROM
010150 STA TM1 ;rows
010160 ;
010170 OH LDA TM1
010180 JSR REFROM
010190 INC TM1
010200 INC VCNT
010210 LDA VCNT
010220 CMP #18
010230 BNE OH
010240 RTS ;done
010250 ;get RAD
010260 STRAD ASL A
010270 TAY
019280 LDA RAD,Y
010290 STA LL
010300 INY
010310 LDA RAD,Y
010320 STA LL+1
010330 RTS
010340 ;ref a row enter W/A=row
010350 REFROM PHA ;save row
010360 LDA FCOL
010370 STA TM ;col
010380 LDA #2
010390 STA SPX
010400 JSR LSTCOL
010410 LDX VCNT
010420 JSR CLRLIN
010430 PLA
010440 JSR STRAD
010450 VE LDY #0
010460 LDA (LL),Y
010470 CMP #$FF
010480 BEQ VA ;done w/row
010490 CMP TM
010500 BEQ VB ;got col
010510 BCS VC
010520 VD LDY TM ;next coi
010530 LDA COLM,Y ;scrn pos
010540 CLC
010550 ADC SPX
010560 STA SPX
010570 INC TM
010580 LDA TM
010590 CMP TM2 ;last col?
010600 BCC VE
010610 VA RTS
010620 VC JSR UP1COL ;inc 11
010630 JMP VE
010640 VS LDA LL
010650 CLC
010660 ADC #1DTLEN
010670 STA IL
010680 LDA LL+1
010690 ADC #0
010700 STA IL+1 ;keep LL
010710 LOY VCNT
010720 LDA Y40L,Y
010730 STA JL
010740 LDA V40H,Y
010750 STA JL+1
010760 LDA SPX
010770 STA TM3
010780 LDY #1
010790 LDA (LL),Y
010800 STA FORMAT
010810 LDY #3
010820 LDA (LL),Y
0l0830 BPL NNER
010840 JMP NUER
010850 NNER AND #3
010860 BEQ NNM
010870 CMP #1
010880 BEQ ISN ;a #
010890 LDY #2 ;a F
010900 LDA (LL),Y
010910 SEC
010920 SBC #6
010930 CLC
010940 ADC IL
010950 TAX ;low
010960 LDA IL+1
010970 ADC #0
010980 TAY
010990 JHP ISN2
011000 ;put on scrn
011010 NNM JSR CLRSTR
011020 LDY #2
011030 LDA (LL),Y
011040 TAY
011050 LDA #EOL
011060 STA STRING ,Y
011070 DEY
011080 YTA LDA (IL),Y
011090 STA STRING,Y
0ll100 DEY
011110 BPL YTA
011120 LDA # <STRING
011130 STA IL
011140 LDA # >STRING
011150 STA IL+1
011160 JSR FRHTXT ;result in IL
011170 ;put on screen
011180 NNM1 LDY TM
011190 LDA COLW,Y
011200 STA GMX
011210 LDY #09
011220 STY TH4
011230 YLP LDY TM4
011240 LDA LBUF,Y
011250 JSR AS52IC
011260 LDY TM3
011270 STA (JL),Y
011280 INC TM4
011290 INC TM3
011300 LDA TM4
011310 CMP GMX
011320 BNE YLP
011330 JSR CLRSTR
011340 JMP VD
011350 ;refr #s il has #
011360 ISN LDX IL ;strt of #
011370 LDY IL+1
011380 ISN2 JSR FLDOR
011390 JSR SETINB
011400 JSR FASC
011410 JSR FRHNUM
011420 JHP NNM1
011430 ;numbers
011440 SBNUM LDA #1
011450 STA DTYP
011460 JSR SETFP
011470 JSR ZFR0
011480 JSR AFP
011490 LDX # <STRING
011500 LDY # >STRING
011510 JSR FST0R
011520 LDA #6
011530 STA STR
011540 JSR INSERT
011550 RTS
011560 ;error in cell
011570 NUER LDX #0
011580 LDA #5
011590 STA GMX
011600 LDY TM
011610 LDA COLM,Y
011620 CMP #4
011630 BNE ADQ
011640 DEC GMX
011650 ADQ LDY TM3
011660 ADP LDA ERMES,X
011670 STA (JL),Y
011680 INY
011690 INX
011700 CPX GMX
011710 BNE ADP
011720 JHP VD
011730 ;set fp ptrs
011740 SETFP LDA # >STRING
011750 STA INBUF+1
011760 LDA # <STRING
011770 STA INBUF
011780 LDA #0
011790 STA CIX
011800 RTS
011810 ;set inbuf
811820 SETINB LDA # >LBUF
011830 STA INBUF+1
011840 LDA # <LBUF
011850 STA INBUF
011860 LDA #0
011870 STA CIX
011880 RTS
011890 ;# to STRING
011900 NM2STR JSR SETINB
011910 JSR FASC
011920 LDY #0
011930 NLP LDA (INBUF),Y
011940 BMI ML2
0ll950 STA STRING ,Y
011960 INY
011970 BME NLP
011980 NL2 AND #$7F
011990 STA STRING,Y
012000 INY
012010 STY STR
012020 CPY #1
012030 BEQ NRT
012040 LDA STRING
012050 CMP #'0
012060 BNE NRT
012070 LDY #0
012080 NL3 LDA STRING+1,Y
012090 STA STRING,Y
012100 INY
012110 CPY STR
012120 BNE NL3
012130 DEC STR
012140 NRT RTS
012150 ;do spec ctrl cmds
012160 ;clear string for FP
012170 CLRSTR LDX #$7F
812180 LDA #$20
012190 CSTL STA STRING,X
012200 DEX
012210 BPL CSTL
012220 RTS
012230 ;convert low to upp case
012240 L02UP LDY #0
012250 LOLP LDA STRING,Y
012260 CMP #EOL
012270 BEQ LODON
012280 AND #$7F
012290 CMP #'z+1
012300 BCS NLO
012310 CHP #'a
012320 BCC NLO
012330 EOR #$20
012340 NLO STA STRING,Y
012350 INY
012360 BNE LOLP
012370 LODON RTS
012360 .INCLUDE #D:BCALC.PT3
012390 .INCLUDE #D:BCALC.PT4
012400 .INCLUDE #D:BCALC.PT5
012410 .INCLUDE #D:BCALC.PT6
012420 ENPROG = *
012430 *= RUNAD
012440 .WORD BEGIN
012450 .END
LISTING 3: ASSEMBLY
0100 ;SAVE#D:BCEQU
0100 ;
0120 CIOV = $E456
0130 ICCOM = $0342
0140 ICBAL = $0344
0150 ICBAH = $0345
0160 ICBLL = $0348
0170 ICBLH = $0349
0180 AUX1 = $034A
0190 AUX2 = $034B
0200 RUNAD = $02E0
0210 INITAD = $02E2
0220 ;
0230 SDLSTL = $0230
0240 SDMCTL = $022F
0250 VDSLST = $0200
0260 NMIEN = $D40E
0270 WSYNC = $D40A
0280 SETVBV = $E45C
0290 SYSVBV = SE45F
0300 COLOR0 = $02C4
0310 COLOR1 = $02C5
0320 COLOR2 = $02C6
0330 COLOR4 = $02C8
0340 COLPF0 = $D016
0350 COLPF2 = $D018
0360 KEYDEF = $79
0370 INVFLG = $02B6
0380 ;fp equates
0390 CIX = $F2
0400 INDUF = $F3
0410 FR0 = $D4
0420 FR1 = $E0
0430 FLPTR = $FC
0440 LBUF = $0580
0450 AFP = $D800
0460 FASC = $D8E6
0470 IFP = $D9AA
0480 ZFR0 = $DA44
0490 ZF1 = $DA46
0500 FSUB = $DA60
0510 FADD = $DA66
0520 FMUL = $DADB
0530 FDIV = $DB28
0540 FST0R = $DDA7
0550 FST0P = $DDAB
0560 FLD0R = $DD89
0570 FLDIR = $DD98
0580 FLD0P = $DD8D
0590 FLD1P = $DD9C
0600 FMOVE = $DDB6
0610 EXP10 = $DDCC
0620 LOG10 = $DED1
0630 ;
0640 CONSOL = $D01F
0650 CH = $02FC
0660 EOL = $9B
0670 DOSVEC = $0A
0680 RAMTOP = $6A
0690 SEOL = $BB
0700 CAPS = $02BE
0710 DTLEN = 4 ;data length
0720 NUMB = $0500
0730 ;
0740 ;page zero
0750 *= $80
0760 L .DS 2
0770 LL .DS 2
0780 IL .DS 2
0790 JL .DS 2
0800 FPLO .DS 2
0810 TM .DS 1
0820 TM1 .DS 1
0830 TM2 .DS 1
0840 TM3 .DS 1
0850 TM4 .DS 1
0660 FCOL .DS 1
0870 FORMAT .DS 1
0880 VCNT .DS 1
0890 CRSX .DS 1
0900 CRSY .DS 1
0910 XPOS .DS 1
0920 GMX .DS 1
0930 COLNU .DS 1
0940 ROWNU .DS 1
0950 NBYT .DS 2
0960 LENG .DS 1
0970 SCOL .DS 1
0980 FROW .DS 1
0990 CURRW .DS 1
1000 SROW .DS 1
1010 COLF .DS 1
1020 COLS .DS 1
1030 COLT .DS 1
1040 COLZ .DS 1
1050 ROWF .DS 1
1060 ROWS .DS 1
1070 ROWT .DS 1
1080 ROWZ .DS 1
l090 DM0 .DS 1
1100 DM1 .DS 1
1110 DM2 .DS 1
1120 DM3 .DS 1
1130 DM4 .DS 1
1140 DM5 .DS 1
1150 DM6 .DS 1
1160 DM7 .DS 1
1170 XSAV .DS 1
1180 ASAV .DS 1
1190 YSAV .DS 1
1200 NARG .DS 1
1210 SVY .DS 1
1220 FPPTR .DS 1
1230 FTOK .DS 1
1240 STOK .DS 1
1250 OPERAT .DS 1
1260 OLDC .DS 1
1270 OLDAC .DS 1
1280 TA1 .DS 1
1290 TA2 .DS 1
1300 TA3 .DS 1
1310 TA4 .DS 1
1320 BCD1 .DS 1
1330 EDIT .DS 1
1340 SPX .DS 1
1350 STR .DS 1
1360 DTYP .DS 1
1370 FPN1 .DS 3
1380 ARGT .DS 3
1390 ROFST .DS 1
1400 COFST .DS 1
1410 HLDF .DS 1
1420 HLDS .DS 1
1430 HLDY .DS 1
1440 STR2 .DS 1
1450 LEFTP .DS 1
1460 RIGHTP .DS 1
1470 .OPT LIST
1480 ENZ = #
1490 .OPT NO LIST
LISTING 4: ASSEMBLY
0100 ;SAVE#D:BCALC.PT3
0110 ;home pos.
0120 MORE JSR CLRSCN
0130 JSR RSTCRS
0140 HM2 JSR DRAWN
0150 JSR DRCOL
0160 HM3 JSR REFSCR
0170 JSR SHWT2
0180 JMP IVCRS
0190 ;reset cursor
0200 RSTCRS LDA #0
0210 STA FCOL
0220 STA FROW
0230 STA SROW
0240 STA SCOL
0250 CRS2 STA CURRW
0260 STA CRSY
0270 LDA #2
0280 STA CRSK
0290 LDY FCOL
0300 CLC
0310 ADC COLW,Y
0320 STA CRSEN
0330 RTS
0340 ;show stats
0350 SHOWST JSR CLRTXT
0360 LDY #26
0370 SJA LDA STT,Y
0360 STA TXTWIN+2,Y
0390 DEY
0400 BPL SJA
0410 LDY #32
0420 SJN LDA SEG,Y
0430 STA TXTWIN+42,Y
0440 DEY
0450 BPL SJN
0460 ;free mem
0470 LDA #0
0480 SEC
0400 SBC ENDAT
0500 STA FR0
0510 LDA 106
0520 SBC ENDAT+1
0530 STA FR0+1
0540 JSR IFP
0550 JSR FASC
0560 LDY #0
0570 FMLP LDA (INBUF),Y
0580 PHA
0590 AND #$7F
0600 JSR AS2IC
0610 STA TXTWIN+29,Y
0620 INY
0630 PLA
0640 BPL FMLP
0650 ;file name
0660 LDY #0
0670 FSLP LDA FNAME,Y
0680 CMP #EOL
0690 BEQ FSLL
0700 JSR AS2IC
0710 STA TXTWIN+7,Y
0720 INY
0730 CPY #16
0740 BNE FSLP
0750 FSLL JSR GCH
0760 JMP CLRTXT
0770 ;set cross ref
0780 SETREF JSR ST2BF1
0790 JSR FINARG
0800 BCS SO2
0810 JSR GTCLRW
0820 BCS SO2
0830 JSR FINARG
0840 LDX #0
0850 S9LP LDA BF1,Y
0860 STA BF1,X
0870 CMP #EOL
0880 BEQ S8P
0890 INY
0900 INX
0910 BNE S9LP
0920 S8P LDX #3
0930 SFR LDA BF1,X
0940 JSR AS2IC
0950 STA REFTAB,X
0960 DEX
0970 BPL SFR
0980 LDA COLNU
0990 STA SETCOL
1000 LDA ROWNU
1010 STA SETROW
1020 SO2 RTS
1030 ;show refs
1040 SHWREF JSR CLLIN3
1050 LDX #1
1060 SWQ LDA REFTAB+2,X
1070 STA TXTWIN+141,X
1080 LDA REFTAB,X
1090 STA TXTWIN+121,X
l100 DEX
1110 BPL SWQ
1120 LDA FROW
1130 CLC
1140 ADC CURRW
1150 JSR STRAD
1160 XRA LDY #0
1170 LDA (LL),Y
1100 CMP #$FF
1190 BEQ NRF
1200 CMP SETCOL
1210 BEQ GRF
1220 BCC URF
1230 NRF JMP S07 ;try col
1240 URF JSR UP1COL
1250 JMP XRA
1260 GRF LDY #3
1270 LDA (LL),Y
1280 AND #3
1290 BEQ TXT ;text
1300 CMP #1
1310 BNE NRF
1320 JSR LL2FR0
1330 JSR FASC
1340 LDY #0
1350 SO6 LDA (INBUF),Y
1360 PHA
1370 AND #$7F
1380 JSR AS2IC
1390 STA TXTWIN+124,Y
1400 PLA
1410 BMI $07
1420 INY
1430 CPY #14
1440 BNE SO6
1450 TXT LDY #2
1460 LDA (LL),Y
1470 STA ASAV
1480 JSR ADDDT
1490 LDY #0
1500 SO8 LDA (LL),Y
1510 JSR AS2IC
1520 STA TXTWIN+124,Y
1530 INY
1540 CPY ASAV
1550 BED SO7
1560 CPY #14
1570 BNE SO8
1580 ;now show col
1590 SO7 LDA SETROW
1600 JSR STRAD
1610 LDA SCOL
1520 STA TM
1630 XCL LDY #0
1640 LDA (LL),Y
1650 CMP #$FF
1660 BEQ NCOL
1670 CMP TM
1680 BEQ GCOL
1690 BCC UCOL
1700 MCOL RTS
1710 UCOL JSR UP1COL
1720 JMP XCL
1730 GCOL LDY #3
1740 LDA (LL),Y
1750 AND #3
1760 BEQ TTX ;text
1770 CMP #1
1780 BNE NCOL
1790 JSR LL2FR0
1800 JSR FASC
1810 LDY #0
1820 SK2 LDA (INBUF),Y
1830 PHA
1840 AND #$7F
1850 JSR AS2IC
1860 STA TXTWIN+144,Y
1870 PLA
1880 BMI SK3
1890 INY
1900 CPY #14
1910 BNE SK2
1920 TTX LDY #2
1930 LDA (LL),Y
1940 STA ASAV
1950 JSR ADDDT
1960 LDY #0
1970 SK4 LDA (LL),Y
1980 JSR AS2IC
1990 STA TXTWIN+144,Y
2000 INY
2010 CPY ASAV
2020 BEQ SK3
2030 CPY #14
2040 BNE SK4
2050 SK3 RTS
2060 ;show data type
2070 SHWT2 LDX $COL
2080 LDA SROW
2090 JSR LOCCEL
2100 BCC SKB
2110 LDA #3
2120 STA DTYP
2130 BNE SHWTYP
2140 SKB LDY #3
2150 LDA (LL),Y
2160 AND #3
2170 STA DTYP
2180 JMP SHWTYP
2190 ;ll # 2 fro
2200 LL2FR0 JSR ADDDT
2210 LDX LL
2220 LDY LL+1
2230 JMP FLD0R ;auto ret
2240 ;clear line 3
2250 CLLIN3 LDY #119
2260 LDA #0
2270 LP3 STA TXTWIN,Y
2280 INY
2290 CPY #160
2300 BNE LP3
2310 RTS
2320 ;show ent. type
2330 ;0=t,1=#,2=f
2340 SHWTYP LDA DTYP
2350 ASL A
2360 ASL A
2370 ASL A
2380 TAX
2390 LDY #31
2400 STG LDA TEXTYP,X
2410 STA SCMEM,Y
2420 INX
2430 INY
2440 CPY #39
2450 BNE STG
2460 RTS
2470 ;drctry
2480 DIR JSR CLRSCN
2490 LDA #'1
2500 STA DIRTXT+1
2510 JSR ST2BF1
2520 JSR FINARG
2530 BCS NDARG
2540 STA DIRTXT+1
2550 NDARG CLOSE 2
2560 LDA #l
2570 STA VCNT
2580 LDA #3
2590 LDX #$20
2600 STA ICCOM,X
2610 LDA # <DIRTXT
2620 STA ICBAL,X
2630 LDA # >DIRTXT
2640 STA ICBAH,X
2650 LDA #6
2660 STA AUX1,X
2670 LDA #0
2680 STA AUX2,X
2690 JSR CIOV
2700 BPL DIROK
2710 GENER JSR DSKERR ;error
2720 JMP HM3
2730 DIROK LDX #$20
2740 LDA #5
2750 STA ICCOM,X
2760 LDA # <LBUF
2770 STA ICBAL,X
2780 LDA # >LBUF
2790 STA ICBAH,X
2800 LDA #0
2810 STA ICBLH,X
2820 LDA #$14
2830 STA ICBLL,X
2840 JSR CIOV
2850 BPL PRDIR
2860 JSR GCM
2870 CLOSE 2
2880 JMP HM3
2890 PRDIR JSR SCNPOS
2900 LDX #0
2910 LDY #11
2920 DIRLP LDA LBUF,X
2930 CMP #EOL
2940 BEQ XXDR
2950 JSR AS2IC
2960 STA (L),Y
2970 INY
2980 INX
2990 JMP DIRLP
3000 XXDR INC VCNT
3010 LDA VCNT
3020 CMP #17
3030 BNE DIROK
3040 JSR GCH
3050 JSR CLRSCN
3060 LDA #0
3070 STA VCNT
3080 BEQ DIROK
3090 ;get scrn pos
3100 SCNPOS LDY VCNT
3110 LDA Y40L,Y
3120 STA L
3130 LDA Y40H,Y
3140 STA L+1
3150 RTS
3160 ;save
3170 SAVE JSR 5T2BF1
3180 JSR FINARG
3190 JSR GTFILE
3200 JSR CHKDEV
3210 BCC FILE?
3220 DEVERR LDY #165
3230 JMP GENER
3240 FILE? JSR FILEXST
3250 BCC DEVOK
3260 JMP HOME
3270 DEVOK LDA #8 ;write
3280 LDY #11 ;get rec
3290 BNE DOIT
3300 LDAD JSR ST2BFl
3310 JSR FINARG
3320 JSR GTFILE
3330 JSR CHKDEV
3340 BCS DEVERR
3350 LDA #4 ;read
3360 LDY #7 ;input
3370 DOIT STA DM6 ;keep em
3380 STY DM7
3390 close 2
3400 LDX #$20
3410 LDA DM6
3420 STA AUX1,X
3430 LDA #3
3440 STA ICCOM,X
3450 LDA # <FNAME
3460 STA ICBAL,X
3470 LDA # >FNAME
3480 STA ICBAH,X
3490 LDA #0
3500 STA AUX2,X
3510 JSR CIOV
3520 BPL RWOK
3530 JMP GENER ;error
3540 RWOK LDX #$20
3550 LDA DM7
3560 TAY
3570 STA ICCOH,X
3580 LDA # <COLW
3590 STA ICBAL,X
3600 LDA # >COLW
3610 STA ICBAH,X
3620 CPY #7 ;inp?
3630 BNE RITE
3640 LDA #$FF
3650 STA ICBLL,X
3660 STA ICBLH,X
3670 BNE SINP
3680 RITE LDA ENDAT
3690 SEC
3700 SBC #<COLW
3710 STA ICBLL,X
3720 LDA ENDAT+1
3730 SBC # >COLW
3740 STA ICBLH,X
3750 SINP JSR CIOV
3760 BPL IOOK
3770 CPY #136 ;EOF?
3780 BEQ IOOK
3790 JMP GENER ;error
3800 IOOK CLOSE 2
3810 LDA DM6
3820 CMP #8
3830 DEQ WRF
3840 LDX #$20
3850 LDA # <COLW
3860 CLC
3870 ADC ICBLL,X
3880 STA ENDAT
3890 LDA # >COLW
3900 ADC ICBLH,X
3910 STA ENDAT+1
3920 WRF JMP HOME
3930 ;goto
3940 GOTO JSR ST2BF1
3950 JSR FINARG
3960 BCS QAB
3970 JSR GTCLRW
3980 BCS QAB
3990 LDA ROWNU
4000 CMP #47
4010 BCS QAB
4020 LDA COLNU
4030 CMP #55
4040 BCS QAB
4050 JSR IVCRS
4060 JSR CLRSCN
4070 LDA COLNU
4080 STA FCOL
4090 STA SCOL
4100 LDA ROWNU
4110 STA FROW
4120 STA SROW
4130 LDA #0 ;4 crs2
4140 JSR CRS2
4150 JMP HM2
4160 QAB RTS
4170 ;str2bf1
4180 ST2BF1 LDY #114
4190 SO1 LDA STRING,Y
4200 STA BF1,Y
4210 DEY
4220 BPL SO1
4230 RTS
4240 ;recalc now
4250 ARECL JSR RECALC
4260 JMP HOME
4270 ;force text
4280 FORCE LDA #1
4290 STA FRCTXT
4300 RTS
4310 ;kill cell
4320 KILLCL LDA SCOL
4330 TAX
4340 Lea FROM
4350 CLC
4360 ADC CURRW
4370 STA TM
4380 JSR LOCCEL
4390 BCC LCELL
4400 RTS ;none
4410 LCELL LDA TN
4420 JSR DELTCL
4430 JSR IVCRS
4440 LTA #2
4450 STA SPX
4460 LDA CURRW
4470 STA VCNT
4480 LDA SROW
4490 JSR REFROW
4500 JSR IVCRS
4510 RTS
4520 ;find arg
4530 FINARG LDY #0
4540 F8LP LDA BF1,Y
4550 CMP #EOL
4560 BEQ NOARG
4570 CMP #$20
4580 BEQ FSPCE
4590 INY
4600 CPY #$20
4610 BNE F8LP
4620 NOARG SEC
4630 RTS
4640 FSPCE INY
4650 FARG LDA BF1,Y
4660 CMP #EOL
4670 BEQ NOARG
4680 CMP #$20 ;spac
4690 BNE GTARG
4700 INY
4710 CPY #$20
4720 BNE FARG
4730 BEQ NOARG
4740 GTARG CLC
4750 RTS
4760 ;get file name
4770 GTFILE LDX #0
4780 F9LP LDA BF1,Y
4790 STA FNAME,X
4800 CMP #EOL
4810 BEQ FGD
4820 INY
4830 INX
4840 BNE F9LP
4850 FGD RTS
4860 ;chng col width
4870 WIDTH JSR ST2BF1
4880 JSR FINARG
4890 BCS NOW
4900 JSR GTCLRW
4910 BCS NOW
4920 INC ROWNU
4930 LDA ROWNU
4940 CMP #2
4950 BCC NOW
4960 CMP #33
4970 BCS NOW
4980 LDY COLNU
4990 STA COLW,Y
5000 JSR CLRSCN
5010 JSR DRAWH
5020 JSR REFSCR
5030 LDY FCOL
5040 STY SCOL
5050 LDA #2
5060 STA CRSX
5070 CLC
5080 ADSC COLW,Y
5090 STA CRSEIN
5100 JSR IVCRS
5110 NOW RTS
5120 ;show a cell's content
5130 SHOCEL LDX SCOL
5140 LDA SROW
5150 JSR LOCCEL
5160 BCC UAA
5170 RTS ;none
5180 UAA LDY #1 ;format
5190 LDA (LL),Y
5200 STA #00
5210 INY ;length
5220 LDA (LL),Y
5230 STA LENG
5240 INY
5250 LDA (LL),Y
5260 AND #3
5270 BNE UAB
5280 UAG JSR ADDDT
5290 LDY LENG ;text
5300 DEY
5310 UAH LDA (LL),Y
5320 STA STRING,Y
5330 DEY
5340 BPL UAH
5350 UAE LDA #$FF
5360 STA XPOS
5370 JSR DRWIN
5380 RTS ;done
5390 UAB CMP #2
5400 BEQ UAF
5410 JSR ADDDT
5420 LDX LL
5430 LDY LL+1
5440 JSR FLD0R
5450 JSR FASC
5460 LDY #0
5470 UAD LDA (INBUF),Y
5480 PHA
5490 AND #$7F
5500 STA STRING,Y
5510 PLA
5520 BMI UAE
5530 INY
5540 BNE UAD
5550 UAF LDA LENG
5560 SEC
5570 SBC #6
5580 STA LENG
5590 JMP UAG
5600 ;edit mode
5610 EDITM LDA #1
5620 STA EDIT
5630 JSR SHOCEL
5640 JSR INPUT2
5650 PHP
5660 LDA #0
5670 STA EDIT
5680 PLP
5690 BCC EOOK
5700 RTS
5710 EOOK PLA
5720 PLA
5730 LDA $00
5740 STA FORMAT
5750 JMP GTIN
5760 ;format a cell or colm
5770 FORM JSR CLRTXT,
5780 LDY SCOL
5790 LDA FMCOL,Y
5800 STA FORMAT
5810 LDX #18
5820 FPB DEX
5830 BMI FPX
5840 FPA LDA FMES,X
5850 STA TXTWIN+2,X
5860 CPX #5
5870 BCC FPS
5880 LDA FMA-5,X
5890 STA TXTWIN+42,X
5900 LDA FMB-5,X
5910 STA TXTWIN+82,X
5920 LDA FMC-5,X
5930 STA TXTWIN+122,X
5940 JMP FPB
5950 FPX JMP SHOFRM
5960 ;
5970 FPC LDA CH
5980 CMP #$FF
5990 BEQ FPC
6000 LDX #$FF
6010 STX CH
6020 CMP #$1C
6030 BNE FPD
6040 RTS ;done
6050 FPD LDX #2
6060 FPE CMP JSKEY,X
6070 BEQ FPF
6080 DEX
6090 BPL FPE
6100 BMI FPG
6110 FPF LDA FORMAT
6120 AND #252
6130 STA ASAV
6140 TXA
6150 ORA ASAV
6160 STA FORMAT
6170 JMP SHOFRM
6180 FPG CMP #$3A ;D
6190 BNE FPH
6200 LDA FORMAT
6210 EOR #8
6220 STA FORMAT
6230 JMP SHOFRM
6240 FPH CMP #$20
6250 BNE FPJ
6260 LDA FORMAT
6270 EOR #4
6280 STA FORMAT
6290 JMP SHOFRM
6300 FPJ LDX #9
6310 FPK CMP HKEY,X ;dec places
6320 BEQ FQD
6330 DEX
6340 BPL FPK
6350 BMI FPC
6360 FQD TXA
6370 PHA
6380 LDA FORMAT
6390 AND #$0F
6400 STA FORMAT
6410 PLA
6420 ASL A
6430 ASL A
6440 ASL A
6450 ASL A
6460 ORA FORMAT
6470 STA FORMAT
6480 ;
6490 SHOFRM LDA FORMAT
6500 AND #3
6510 TAX
6528 LDA LCR,X
6538 STA TXTWIN+19
6548 LDA FORMAT
6558 AND #8
6568 LSR A
6579 LSR A
6580 LSR A
6590 TAX
6600 LDA YN,X
6610 STA TXTWIN+59
6620 LDA FORMAT
6630 AND #4
6640 LSR A
6650 LSR A
6660 TAX
6670 LDA YN,X
6680 STA TXTWIN+99
6690 LDA FORMAT
6700 AND #$F0
6710 LSR A
6720 LSR A
6730 LSR A
6740 LSR A
6750 TAX
6760 LDA SDEC,X
6770 STA TXTWIN+139
6780 JMP FPC
6790 ;global format
6800 GLOBAL JSR FORM
6810 LDY SCOL
6820 LDA FORMAT
6830 STA FMCOL,Y
6840 RTS
6850 ;format a cell
6860 FORMC LDA SROW
6870 LDX SCOL
6880 JSR LOCCEL
6890 BCC ECL
6900 RTS
6910 ECL JSR FORM
6920 LDY #1
6930 LDA FORMAT
6940 STA (LL),Y
6950 LDX CURRW
6960 STX VCNT
6970 LDA SROW
6980 JSR REFROW
6990 LDY SCOL ;restore
7000 LDA FMCOL,Y ;glob. formt
7010 STA FORMAT
7020 JMP IVCRS
7030 ;recalc flag
7040 RONOF LDA OMF
7050 EOR #3
7060 STA ONF
7070 TAX
7080 LDY #0
7090 RPP LDA ONOFM,X
7100 STA SEG+7,Y
7110 INX
7120 INY
7130 CPY #3
7140 BNE RPP
7150 RTS
7160 ;flip row/col flg
7170 RCFLP LDA RCFLG
7180 EOR #6
7190 STA RCFLG
7200 TAX
7210 LDY #0
7220 RHK LDA RCMES,X
7230 STA SEG+27,Y
7240 INX
7250 INY
7260 CPY #6
7270 BNE RHK
7280 RTS
7290 ;disk error
7300 DSKERR STY YSAV
7310 CLOSE 2
7320 LDY YSAV
7330 STY FR0
7340 LDA #0
7350 STA FR0+1
7360 JSR IFP
7370 JSR FASC
7380 LDY #$FF
7390 ERLPA INY
7400 LDA (INBUF),Y
7410 PHA
7420 AND #$7F
7430 JSR AS2IC
7440 STA DERM+6,Y
7450 PLA
7460 BPL ERLPA
7470 JSR CLLIN3
7480 LDY #20
7490 ERLPA LDA DERM,Y
7500 STA TXTWIN+124,Y
7510 DEY
7520 BPL ERLPB
7530 LDA #$FF
7540 STA CH
7550 JSR GAKEY
7560 RTS
7570 ;Number Format Subroutine
7580 ;for B-CALL
7590 ;FORMAT BYTE 1
7600 ;bit 4-7: Places after Decimal
7610 ;bit 3: dOllar Sign Flag
7620 ;bit 2: COMMA Flag
7630 ;bit 0-1 L/C/R Justify
7640 ;
7650 FRNMUM LDY #$FF
7660 :FM0 INY
7670 LDA (INBUF),Y
7680 STA NUMB,Y
7690 BPL :FM0
7700 LDY #$7F
7710 LDA #'0
7720 FN.1 STA STRING,Y
7730 DEY
7740 BPL FN.1
7750 LDA #'$
7760 STA STRING
7770 LDA # <[STRING+1]
7780 STA IL
7790 LDA # >[STRING+1]
7800 ST: IL+1
7810 ;
7820 LDA FORMAT ;get FM byte
7830 PHA
7840 AND #$F0
7850 LSR A
7860 LSR A
7870 LSR A
7880 LSR A
7890 STA TORITE
7900 PLA
7910
7920 AND #4 ;commas?
7930 BNE FNCOM ;yes
7940 LDY #$FF
7950 :CPL INY
7960 LDA (INBUF),Y
7970 STA (IL),Y
7980 BPL :CPL
7990 :FM1 JMP :DSGN
8000 ;insert ','s
8010 FNCOM LDY #$FF
8020 FM:1 INY
8030 LDA NUMB,Y
8040 BMI FM:D
8050 CMP #'.
8060 BNE FM:1
8070 DEY
8080 FM:D STY SVY
8090 LDX #29
8100 :LP1 LDA #2
8110 STA FCNT
8120 :LP2 LDA NUMB,Y
8130 AND #$7F
8140 STA LBUF,X
8150 DEX
8160 DEY
8170 BMI :LV
8180 DEC FCNT
8190 BPL :LP2
8200 LDA #',
8210 STA LBUF,X
8220 DEX
8230 BPL :LP1
8240 :LV INX
8250 LDY #1
8260 :LP3 LDA LBUF,X
8270 STA STRINF,Y
8280 INY
8290 INX
8300 CPX #30
8310 BNE :LP3
8320 LDX SVY
8330 LDA NUMB,X
8340 BPL :NNV
8350 DEY
8360 LDA STRING,Y
8370 ORA #$80
8380 STA STRING,Y
8390 BNE :DSGN
8400 ;
8410 :NNV INX
8420 LDA NUMB,X
8430 STA STRING,Y
8440 BMI :DSGN
8450 INY
8460 BNE :NNV
8470 ;
8480 :DSGN LDA FORMAT
8490 AND #8
8500 BEQ :AFTER
8610 LDA # <STRING
8520 STA IL
8530 LDA # >STRING
8540 STA IL+1
8550 ;handle places after decimal
8560 ;search for E
8570 :AFTER LDA #0
8580 STA SCI ;flag
8590 LDY #$FF
8600 HXA INY
8610 LDA STRING,Y
8620 BMI :AF2 ;none
8630 CMP #'E
8640 BNE HXA ;kot yet
8650 ;got exp
8660 INC SCI ;set flg
8670 DEY ;invs prev byt
8680 LDA STRING,Y
8690 ORA #$80
8700 STA STRING,Y
8710 LDX #$FF ;bck to E
8720 HXB INX
8730 INY
8740 LDA STRING,Y
8750 PHA
8760 AND #$7F
8770 STA SVEX,X
8780 LDA #'0
8790 STA STRING,Y
8800 PLA
8810 BPL HXB
8820 ;show end
8830 INX
8840 STX SCI
8850 LDA #EOL
8860 STA SVEX,X
8870 :AF2 LDY #$FF
8880 :AF INY
8890 LDA STRING,Y
8900 BPL :TP
8910 AND #$7F
8920 STA STRING,Y
8930 INY
8940 LDA #'.
8950 STA STRING,Y
8960 STY SVY
8970 JMP :JM
8980 :TP CMP #'.
8990 BNE :AF
9000 STY SVY
9010 IA2 INY
9020 LDA STRING,Y
9030 BPL IA2
9040 AND #$7F
9050 STA STRING,Y
9060 :JM LDA SVY
9070 CLC
9080 ADC TORITE
9090 TAY
9100 LDA TORITE
9110 BNE :EL
9120 DEY
9130 :EL LTA #EOL
9140 STA STRING+1,Y
9150 ;chk for E
9160 LDA SCI
9170 BEQ CKMIN
9180 LDX #0
9190 HXC LDA SVEX,X
9200 STA STRING+1,Y
9210 CMP #EOL
9220 BEQ CKMIN
9230 INX
9240 INY
9250 BNE MXC
9260 ;chk for $-,
9270 CKMIN LDA STRING+1
9280 CMP #'-
9290 BNE FRMTXT
9300 LDA STRING+2
9310 CMP #',
9320 BNE FRMTXT
9330 LDY #0
9340 MILP LDA STRING+3,Y
9350 STA STRING+2,Y
9360 CMP #EOL
9370 DEC FRMTXT
9380 INY
9390 BNE MILP
9400 ;get lenth of number
9410 FRMTXT LDY #$FF
9420 :Ll INY
9430 LDA (IL),Y
9440 CMP #EOL
9450 BNE :Ll
9460 STY SVY
9470 ;left/center/right justify
9480 :LCR LDX #$7F
9490 LDA #$20
9500 :L2 STA LBUF,X
9510 DEX
9520 BPL :L2
9530 ;
9540 LDA FORMAT
9550 AND #3
9560 TAX
9570 BEQ :HAV
9580 ;right justify
9590 DEX
9600 BNE :CEN
9610 LDY TM
9620 LDA COLW,Y
9630 SEC
9640 SBC SVY
9650 DPL :HV
9660 YUA LDX #0
9670 BEQ :LC
9680 ;center
9690 :CEN LDY TM
9700 LDA COLW,Y
9710 SEC
9720 SBC SVY
9730 BPL :C1
9740 EOR #$FF
7759 LSR A
9768 TAY
9770 JMP YUA
9789 :C1 LSR A
9799 :HV TAX
9800 ;copy the number
9810 :HAV LDY #$FF
9820 :LC INY
9830 LDA (IL),Y
9840 CMP #EOL
9850 BEQ :LB
9860 STA LBUF,X
9870 INX
9880 BNE :LC
9890 :LB LDA # <LBUF
9900 STA IL
9910 LDA # >LBUF
9920 STA IL+1
9930 RTS
9940 SCI .BYTE 0
9950 SVEX .DS 4
9960 .BYTE EOL
9970 ;check for D:
9980 CHKDEV LDA FNAME
9990 CMP #'D
010000 BNE WRDEV
010010 LDA FNAME+1
010020 DVNUM CMP #':
010030 BEQ AYOK
010040 CMP #'8
010050 BEQ MYOK
010060 CMP #'1
010070 BCC WRDEV
010080 CMP #'4
010090 BCS WRDEV
010100 BCC MYOK
010110 AYOK CLC
010120 RTS
010130 WRDEV SEC
010140 RTS
010150 MYOK LDA FNAME+2
010160 CMP #':
010170 BEQ AYOK
010180 BNE WRDEV
010l90 ;check if file exist
010200 FILEXST LDA #0
010210 STA TKTWIN+2
010220 CLOSE 2
010230 LDA #36 ;Unloc
010240 STA ICCOM,X
010250 LDA # >FNAME
010260 STA ICBAH,X
010270 LDA # <FMAME
010280 STA ICBAL,X
010290 JSR CIOV
010300 LDA ICCOM+1,X ;stat?
010310 PHA
010320 CLOSE 2
010330 PLA
010340 CMP #1
010350 BEQ FYES
010360 OVWR CLC
010370 RTS
010380 FYES LDA # >REPMES
010390 LDX # <REPMES
010400 LDY #1
010410 JSR PRNTTM
010420 YNK LDA CH
010430 LDX #$FF
010440 CMP #$25 ;yes
010450 BEQ OVWR
010460 CMP #$23
010470 BNE YNK
010480 STX CH
010490 SEC ;no
010500 RTS
LISTING 5 ASSEMBLY
0100 ;SAVE#D:bCalC.Pt4
0110 ;
0120 ;start of parsing
0130 TRYFNC LDA #
0140 STA FPPTR
0150 JSR ZFR0
0160 PARS LDX #0
0170 STX STR
0180 PLP LDA STRING,X
0190 STA BF1,X
0200 CMP #EOL
0210 BEQ PDON
0220 INX
0230 BNE PLP
0240 PDON STX STR
0250 ;pass 1 remove @
0260 ;replace with #
0270 ; @ABS(---,---,---)
0280 ; TM ←TM1→ TM2
0290 ;fpn1-3 fp tokens
0300 FNDFUN LDX #1
0310 FFK LDA BF1,X
0320 CMP #'@
0330 BEQ FFN
0340 INX
0350 CPX STR
0360 BNE FFK
0370 FFT JMP PASS2 ;none
0300 FFN STX TM
0390 LDA # >FTAB
0400 STA LL+l
0410 LDA # <FTAB
0420 STA LL
0430 INX
0440 STX TM1
0450 FFS LDY #0
0460 FFR LDA (LL),Y
0470 BEQ FFT ;no mat
0480 BMI FFP ;lst chr
0490 CMP BF1,X
0500 BNE FFQ ;next
0510 INX
0520 INY
0530 BNE FFR
0540 FFQ LDA #4
0550 JSR INCLL
0560 LDX TM1
0570 BNE FFS
0580 FFP AND #$7F
0590 CMP BF1,X
0600 BNE FFQ
0610 LDY #3
0620 LDA (LL),Y ;F#
0630 STA ASAV
0640 INX
0650 STX TM1 ;)?
0660 ASL A
0670 TAX
0680 LDA JTAB,X
0690 STA JPOFF+l
0700 LDA JTAB+1,X
0710 STA JPOFF+2
0720 ;now get arguments
0730 ;if 1 arg. in fr0
0740 LDA #0
0750 STA NARG
0760 LDY TM1
0770 LDA BF1,Y
0780 CMP #'(
0790 BEQ FFD
0800 FFX SEC ;error
0810 RTS
0820 FFD INY
0830 LDA BF1,Y ;ck 4 cell
0840 CMP #'D
0850 BCS FFX ;error
0860 CMP #'A
0870 BCS FFW ;cell
0880 STY CIX ;#
0890 STY TM1
0900 JSR FP2BF1
0910 JSR AFP
0920 BCS FFX
0930 JSR SPFR2ST
0940 BCS FFX
0950 LDY CIX
0960 FFH LDA BF1,Y ; , or )
0970 CMP #')
0980 BNE FFC
0990 JMP FFI
1000 FFC CMP #',
l010 BEQ FFD
1020 BNE FFX
1030 FFW STY TM1
1040 JSR GTCLRW
1050 FFY BCS FFX ;error
1060 LDY NARG
1070 LDA COLNU
l080 STA COLF,Y
1090 LDA ROWNU
1100 STA ROWF,Y
1110 LDA ASAV
1120 CMP #7 ;cnting only
1130 BEQ FVA
1140 LDX COLNU
1150 LDA ROWNU
1160 JSR CL2FR0
1170 BCS FFY
1180 FVA LDY NARG
1190 LDA #$80
1200 STA ARGT,Y
1210 JSR SPFR2ST
1220 BCS FFY
1230 FVB LDA TM1
1240 CLC
1250 ADC #4
1260 STA TM1
1270 TAY
1280 JMP FFX
1290 ;collapse & do fp
1300 FFI INY
1310 STY TM2
1320 LDY TM
1330 LDX TM2
1340 JSR COLAPS
1350 LDX #0
1360 FFO LDA BF1,X
1370 CMP #EOL
1380 BEQ FFL
1390 INX
1400 BNE FFO
1410 FFL STX STR
1420 JSR ADD2SP
1430 LDY TM
1440 LDA #'#
1450 STA BF1,Y
1460 LDA FPN1
1470 STA BF1+1,Y
1480 JPOFF JSR $FFFF
1490 ;back to begin
1500 BCC JJJ
1510 RTS
1520 JJJ JMP FNDFUN
1530 SPFR2ST LDA FPPTR
1540 LDY NARG
1550 STA FPN1,Y
1560 INC NARG
1570 INY
1580 CPY #3
1590 BCS FFG
1600 TAX
1610 JSR FR0X
1620 INC FPPTR
1630 CLC
1640 RTS
1650 FFG SEC
1660 RTS
1670 ;get a cell's #
1680 ;X=col A=row FR0=#
1690 CL2FR0 STX COLNU
1700 JSR STRAD
1710 EE LDY #0
1720 LDA (LL),Y
1730 CMP #$FF
1740 DEC ED
1750 CMP COLNU
1760 BEQ EB
1770 BCC EC
1780 ED SEC ;err
1790 RTS
1800 EC JSR UP1COL
1810 JMP EE
1820 RTS ;c is set
1830 EB LDY #3 ;data typ
1840 LDA (LL),Y
1850 AND #3
1860 BEG EN ;txt!
1870 CMP #1
1880 BEQ EF
1890 LDY #2 ;fn
1900 LDA (LL),Y
1910 SEC
1920 SBC #6
1930 JSR INCLL
1940 EF LDA #4
1950 JSR INCLL
1960 LDX LL
1970 LDY LL+1
1980 JSR FLD0R ;2 fr0
1990 EN CLC
2000 RTS
2010 ;func tabl pad 3spaces! + tok
2020 FTAB .BYTE "SQU",0
2030 .BYTE "ABS",1
2040 .BYTE "SQR",2
2050 .BYTE "RND",3
2060 .BYTE "EXP",4
2070 .BYTE "LOG",5
2080 .BYTE "INT",6
2090 .BYTE "CNT",7
2100 .BYTE "SUM",8
2110 .BYTE "AVE",9
2120 .BYTE 0
2130 ;jmp tabl
2140 JTAB .WORD SQU
2150 .WORD ABS
2160 .WORD SQR
2170 .WORD RND
2180 .WORD EXP
2190 .WORD LOG
2200 .WORD INT
2210 .WORD CNT
2220 .WORD SUM
2230 .WORD AVE
2240 ;absolute val
2250 ABS JSR CHKONE
2260 AXB LDA FR0
2270 AND #$7F
2280 STA FR0
2290 EXX LOU FPN1
2300 JSR FR0X
2310 CLC
2320 RTS
2330 ;int
2340 INT LDA #0 ;default
2350 STA TRCF
2360 JSR CHKONE
2370 MF JSR SETINB
2380 JSR FASC
2390 JSR TRUNC
2400 LDA FR0
2410 PHA
2420 JSR AFP
2430 PLA
2440 BPL EX2
2450 LDA TRCF ;trunc flag
2460 BEQ EX2
2470 LDX # <ONE
2480 LDY # >ONE
2490 JSR FLD1R
2500 JSR FSUB
2510 EX2 JMP EXX
2520 ;sqr
2630 SQR JSR CHKONE
2540 LDX # <SFPN
2550 LDY # >SFPN
2560 JSR FST0R
2570 JSR LOG10
2580 LDX # <TWO
2590 LOD # >TWO
2600 SQI2 JSR FLD1R
2610 JSR FDIV
2620 BCC SQQ ;xit
2630 RTS
2640 SQQ JSR EXP10
2650 EX3 BCS BDEX
2660 JSR RNDSQR
2670 EX8 JMP EX2
2680 BDEX RTS
2690 ;square
2700 SQU JSR CHKONE
2710 JSR LOGIN
2720 LDX # <TWO
2730 LDY # >TWO
2740 JSR FLD1R
2750 JSR FMUL
2760 BCC SQ7
2770 RTS
2780 SQ7 JSR EXP10
2790 BCC EX8
2800 RTS
2810 ;rnd
2820 RND JSR CHKONE
2830 LDX # <HALF
2840 LDY # >HALF
2850 JSR FLD1R
2860 JSR FADD
2870 BCC RP
2880 RTS
2890 RP JSR FASC
2900 JSR TRUNC
2910 JSR SETINB
3740 INC DM7
3750 CNA INC DM2 ;nxt col
3760 LDA DM2
3770 CMP DM1
3780 BEQ CNB
3790 BCC CNB
3800 INC DM4 ;nxt row
3810 LDA DM4
3820 CMP DM5
3830 BEQ CNC
3840 BCC CNC
3850 JSR ZFR0
3860 LDA DM6 ;gt cnt
3870 STA FR0
3880 LDA DM7
3890 STA FR0+1
3900 JSR IFP
3910 CLC
3920 RTS
3930 ;chekc 4 1 arg
3940 CHKONE LDA NARG
3950 BEQ CZ
3760 CMP #l
3970 BEQ CY
3980 CZ PLA ;pull rot
3990 PLA
4000 SEC
4010 CY RTS
4020 ;chk 4 2 arg
4030 CHKTWO LDA NARG
4040 CMP #2
4050 BNE CZ ;err
4060 RTS
4070 ;entries cells?
4080 CHKCEL LDY #1
4090 CWP LDA ARGT,Y
4100 BPL CZ ;err
4110 DEY
4120 BPL CWP
4130 RTS
4140 ;right size?
4150 CHKSIZ LDA ROWS
4160 CMP ROWF
4170 BCC CZ ;err
4180 LDA COLS
4190 CMP COLF
4200 BCC CZ ;err
4210 RTS
4220 ;dup colf-rowz
4230 DUPDAT LDX #7
4240 DDT LDA COLF,X
4250 STA DM0,X
4260 DEX
4270 BPL DDT
4280 RTS
4290 ;truncate
4300 TRUNC LDY #0
4310 TI LDA (INBUF),Y
4320 BMI TEX
4330 CMP #'.
4340 DEC TJAA
4350 INY
4360 BNE TI
4370 TJAA STA TRCF ;flag
4380 TJ LDA #EOL
4390 STA (INBUF),Y
4400 RTS ;NEW
4410 TEX AND #$7F
4420 STA (INBUF),Y
4430 INY
4440 BNE TJ
4450 ;Save fp #
4460 SAVPN LDX FPPTR
4470 LDA STHI,X
4480 TAY
4490 LDA STLO,X
4500 TAX
4510 JSR FST0R
4520 RTS
4530 ;retrv fpn to fr1
4540 RETPN LDX FPPTR
4550 LDA STHI,X
4560 TAY
4570 LDA STLO,X
4580 TAX
4590 JSR FLD1R
4600 RTS
4610 ;pass 2 find cells
4620 ;replace with #
4630 PASS2 LDY #1
4640 LCEL LDA BF1,Y
4550 CMP #'D
4660 BCS NXY
4670 CMP #'A
4680 BCS ANA
4690 NXY INY
4700 CPY STR
4710 BNE LCEL
4720 JMF PASS3 ;do #'s next
4730 ANA STY TM ;for collps
4740 TYA ;strt
4750 CLC
4760 ADC #4
4770 STA TM2 ;end
4780 JSR GTCLRW
4790 BCS ACD
4800 LDA ROWNU
4810 JSR STRAD
4820 ACC LDY #0
4830 LDA (LL),Y
4840 CMP #$FF ;end?
4850 BEQ ACD ;error
4860 CMP COLNU
4870 BEQ ACA ;yup
4800 BCC ACB
4890 ACD RTS
4900 ACB JSR UP1COL
4910 JMP ACC
4920 ACA LDY #3 ;gt cell
4930 LDA (LL),Y
4940 AND #3 ;dt type
4950 BEQ ACD ;text!
4960 CMP #1 ;#?
4970 BEQ ACE
4980 LDY #2
4990 LDA (LL),Y
5000 SEC
5010 SBC #6
5020 JSR INCLL
5030 ;default
5040 ACE LDA #4
5050 JSR INCLL
5060 LDX LL
5070 LDY LL+1
5080 JSR FLD0R
5090 LDA #4
5100 STA TM1
5110 JSR PUTTOK
5120 LDY TM
5130 JMP NXY
5140 ;put tok in2 bf1
5150 PUTTOK LDY TM
5150 LDx TM2
5170 JSR COLAPS
5180 LDA STR
5190 SEC
5200 SEC TM1
5210 STA STR
5220 JSR ADD2SP
5230 LDY TM
5240 LDA #'#
5250 STA BF1,Y
5260 LDA FPPTR
5270 INY
5280 STA BF1,Y
5290 STY TM
5300 ;move fp to stck
5310 TAX
5320 LDA STHI,X
5330 TAY
5340 LDA STLO,X
5350 TAX
5360 JSR FST0R
5370 INC FPPTR
5380 RTS
5390 ;pass 3 find #'s
5400 ;replace with tokens
5410 PASS3 LDY #1 ;find # loop
5420 FMLP LDA BF1,Y
5430 CMP #EOL
5440 BEQ PSS
5450 CMP #'(
5460 BEQ PSM
5470 CMP #')
5480 BEQ PSM
5490 CMP #'#
5500 BNE PSI
5510 INY
5520 INY
5530 JMP PSS
$540 PSM INY
5550 JMP FNLP ;look again
5560 PSI STY CIN ;get #
5570 STY TM ;1st byte #
5580 JSR FP2BF1
5590 JSR AFP ;get fp#
5600 BCS PSL
5610 LDX CIX
5620 TXA
$630 STA TM2
5640 SEC
5650 SBC TM
5660 STA TM1 ;# less
5670 JSR PUTTOK
5680 LDY TM ;get Pos. back
5690 NXEN INY
5700 CPY STR
5710 BEQ PASS4
5720 PSS LDA BF1,Y
5730 CMP #EOL
$740 BEQ PASS4
5750 PSK LDX #4
5760 PSJ CMP OPTAB,X
5770 BEQ NXA
5780 DEX
5790 BPL PSJ
5800 CMP #')
5810 BEQ NXEN
5820 PSL SEC
5830 RTS
5840 NXA INY
5850 JMP PHLP
5860 ;pass 4 find nested ()
5870 ;calculate & quit !
5880 PASS4 LDY #0
5890 P4A LDA BF1,Y
5900 CMP #EOL
5910 BEQ NOLF
5920 CMP #'(
5930 BEQ FLP
5940 INY
5950 BNE P4A
5960 NOLF LDY #0
5970 P4B LDA BF1,Y
5980 CMP #EOL
5990 BEQ NOPRN
6000 CMP #')
6010 BEQ P4ER
6020 INY
6030 BNE P4B
6040 BEQ P4ER ;error
6050 NOPRN LDX #0
6060 PSW LDA BF1+1,X
6070 STA BF2,X
6080 CMP #EOL
6090 BEQ PSV
6100 INX
6110 INY
6120 JMP PSW
6130 PSV JSR CALCIT
6140 BCS P4ER
6150 RTS
6160 FLP INY
6170 LDA BF1,Y
6180 CMP #')
6190 BEQ FRP
6200 CMP #EOL
6210 BEQ P4ER
6220 BNE FLP
6230 P4ER SEC
6240 RTS
6250 FRP STY RIGHTP
6260 P4C DEY
6270 LDA BF1,Y
6280 CMP #'(
6290 BNE P4C
6300 STY LEFTP
6310 LDX #$FF
6320 LDY LEFTP
6330 PSR INX
6340 INY
6350 CPY RIGHTP
6360 BEQ PST
6370 LDA BF1,Y
6380 STA BF2,X
6390 JMP PSR
6400 PST LDA #EOL
6410 STA BF2,X
6420 JSR CALCIT
6430 BCS P4ER
6440 LDA RIGHTP
6450 SEC
6460 SBC LEFTP
6470 CMP #1
6400 BEQ P4ER
6490 LDX LEFTP
6500 LDA BF2
6510 STA BF1,X
6520 LDA BF2+1
6530 INX
6540 STA BF1,X
6550 LDY RIGHTP
6560 PSU INX
6570 INY
6580 LDA BF1,Y
6590 STA BF1,X
6600 CMP #EOL
6610 BNE PSU
6620 JMP PASS4
6630 ;go up 1 col
6640 UP1COL LDY #2
6650 LDA (LL),Y
6660 JSR INCLL
6670 ADDDT LDA #DTLEN
6680 INCLL CLC
6690 ADC LL
6700 STA LL
6710 LDA LL+1
6720 ADC #0
6730 STA LL+1
6740 RTS
6750 ;calculate bf2
6760 ;exponents first
6770 CALCIT
6780 CALCEX LDY #0
6790 CCN STY TM4 ;save for clpse
6800 JSR GT2TOK
6810 CMP #EOL
6820 BEQ CALMD ;try #,/
6830 BCC CCA
6840 CCB RTS ;SEC=error
6850 CCA JSR MV2FPN
6860 LDA OPERAT
6870 CMP #'^
6880 BNE CCE
6890 JSR FIGEXP
6900 BCS CCB ;error
6910 JSR CLPSBF2 ;collpase
6920 JSR FR02ST
6930 JMP CALCEX
6940 CCE LDA TM4
6950 CLC
6960 ADC #3
6970 TAY
6980 JMP CCW ;look 4 more
6990 ;calculate * & /
7000 CALMD LDY #0
7010 CDC STY TM4
7020 JSR GT2TOK
7030 CMP #EOL
7040 BEQ CALAS
7050 BCC CDA
7060 CDB RTS ;error
7070 CDA JSR MV2FPN
7080 LDA OPERAT
7090 CMP #'*
7100 BNE CDD
7110 JSR FMUL
7120 BCS CDB ;error
7130 BCC CDE
7140 CDD CMP #'/
7150 BNE CDF
7160 JSR FDIV
7170 BCS CDB ;error
7180 CDE JSR CLPSBFZ
7190 JSR FR02ST
7200 LDY TM4
7210 JMP CDC
7220 CDF LDA TM4
7230 CLC
7240 ADC #3
7250 TAY
7260 JMP CDC
7270 ;calculate +,
7280 CALAS LDY #0
7290 CEG STY TM4
7300 JSR GT2TOK
7310 CMP #EOL
7320 BEQ CDONE
7330 BCC CEA
7340 CEB RTS ;SEC=error
7350 CEA JSR MV2FPN
7360 LDA OPERAT
7370 CMP #'+
7380 BNE CEC
7390 JSR FADD
7400 BCS CEB
7410 BCC CED
7420 CEC CMP #'-
7430 BNE CEB ;error
7440 JSR FSUB
7450 BCS CEB ;error
7460 CED JSR CLPSBF2
7470 JSR FR02ST
7400 LDY TM4
7490 JMP CEG
7500 CDONE CLC ;ok
7510 RTS
7520 ;get 2 tokens & operation
7530 GT2TOK LDA BF2,Y
7540 CMP #'#
7550 BEQ GBA
7560 CMP #EOL ;done?
7570 BEQ GBB
7580 GBC SEC ;error
7590 RTS
7600 GBA INY
7610 LDA BF2,Y
7620 CMP #EOL
7630 BEQ GBC ;error
7640 STA FTOK
7650 INY
7660 LDA BF2,Y
7670 STA OPERAT
7680 CMP #EOL
7690 BEQ GBB ;done
7700 INY
7710 LDA BF2,Y
7720 CMP #EOL
7730 BEQ CBB ;done
7740 CMP #'#
7750 BNE GBC ;error
7760 INY
7770 LDA BF2,Y
7700 CMP #EOL
7790 BEQ CBG ;error
7800 STA STOK
7810 GBB CLC ;A=eol if done
7820 RTS
7830 ;move tok # to fp re
7840 MV2FPN LDX FTOK
7850 JSR STFLPTR
7860 JSR FLD0P
7870 LDX STOK
7880 JSR STFLPTR
7890 JSR FLD1P
7900 RTS
7910 ;set pointers
7920 STFLPTR LDA STLO,X
7930 STA FLPTR
7940 Loll STHI,X
7950 STA FLPTR+1
7960 RTS
7970 ;colapse bf2
7980 CLPSBF2 LDA TM4
7990 CLC
8000 ADC #2
8010 TAY
8020 CLC
8030 ADC #3
8040 TAX
8050 CF1 LDA BF2,X
8060 STA BF2,Y
8070 CMP #EOL
8080 BEQ CF2
8090 INY
8100 INX
8110 JMP CF1
8120 CF2 RTS
8130 ;figure exp
8140 FIGEXP LDX FTOK
8150 JSR STFLPTR
8160 JSR FLD0P
8170 JSR LOG10
8180 BCC FIA
8190 FIB SEC
8200 RTS
8210 FIA LDX STOK
8220 JSR STFLPTR
8230 JSR FLDIP
8240 JSR FMUL
8250 BCS FIB
8260 JSR EXP10
8270 BCS FIB
8280 CLC
8290 RTS
8300 ;get a cell
8310 ;colnu,rownu have col,row
8320 GTCLRW JSR GET2CH
8330 BCS GRX
8340 JSR FINCNU
8350 BCC GRW
8360 GRX RTS ;error
8370 GRW LDY HLDY
8360 INY
8390 JSR GET2CH
8400 BCS GRX
8410 JSR FINRNU
8420 LDY HLDY
8430 RTS
8440 ;find the column #
8450 FINCNU LDA HLDF
8460 LDX #2
8470 FCA CMP AS26,X
8480 BEQ FCC
8490 DEX
8500 BPL FCA
8510 BMI FCER
8520 FCC LDA N26,X
8530 STA TM3
8540 LDA HLDS
8550 CMP #'[
8560 BCS FCER
8570 CMP #'A
8580 BCS FCB
8590 FCER SEC ;error
8600 RTS
8610 FCB SEC
8620 SBC #'A
8630 CLC
8640 ADC TM3
8650 STA COLNU ;col #
8660 CMP #64 ;0-63
8670 BCS FCER
8680 RTS
8690 ;get 2 chr's from bf1
8700 GET2CH LDA BF1,Y
8710 CMP #EOL
8720 BEQ GERR
8730 STA HLDF
8740 INY
8750 LDA BF1,Y
8760 CMP #EOL
8770 BEQ GERR
8780 STA HLDS
8790 STY HLDY
8800 CLC
8810 RTS
8820 GERR SEC
8830 RTS
8840 ;get the row #
8850 FINRNU LDA HLDF
8860 JSR GETDEC
8870 BCS FRER
8880 STA ROWNU
8890 LDA HLDS
8900 JSR GETDEC
8910 BCS FRER
8920 TXA
8930 CLC
8940 ADC ROWNU
8950 TAX
8960 DEX
8970 CPX #64
8980 BCS FRER
8990 STX ROWNU
9000 CLC
9010 RTS
9020 FRER SEC
9030 RTS
9040 ;get a decimal # (row)
9050 GETDEC LDX #9
9060 DECB CMP DECN,X
9070 BEQ DECA
9080 DEX
9090 BPL DECB
9100 SEC
9110 RTS
9120 DECA LCA DECM,X
9130 CLC
9140 RTS
9150 ;move fr0 to fpstack
9160 FR02ST LDX FTOK
9170 FR0X JSR STFLPTR
9180 JSR FST0P
9l90 RTS
9200 ;colapse ;X=beg y=des
9210 ;USES tm3
9220 COLAPS LDA BF1,X
9230 STA BF1,Y
9240 CMP #EOL
9250 BEQ CPF
9250 INY
9270 INX
9280 BNE COLAPS
9290 CPF RTS
9300 ;room for fp token
9310 ADD2SP LDX STR
9320 ASLP LDA BF1,X
9330 STA BF1+2,X
9340 DEX
9350 CPX TM
9360 BEQ ASLP
9370 BCS ASLP
9380 INC STR
9390 INC STR
9400 RTS
9410 ;point 2 bf1
9420 FP2BF1 LDA # >BF1
9430 STA INBUF+1
9440 LDA # <BF1
9450 STA INBUF
9460 RTS
9470 TRCF .DS 1
9480 ;round off sqrts
9410 RNDSQR JSR FMOVE ;rt to fri
9500 LDX # <SROOT ;save root
9510 LDY # >SROOT
9520 JSR FST0R
9530 LDX # <SFPN
9540 LDY # >SFPN
9550 JSR FLD0R ;N to fr0
9560 JSR FDIV ;N/rt
9570 LDX # <SROOT
9580 LDY # >SROOT
9590 JSR FLDIR ;res. root
9600 JSR FADD ;add rts
9610 LDX # <HALF
9620 LDY # >HALF
9630 JSR FLD1R
9640 JSR FMUL ;x .5
9650 RTS
9660 SFPM .DS 6
9670 SROOT .DS 6
LISTING 6: ASSEMBLY
0100 ;save#D:BCALC.PTE
0110 ;draw text wndw
0120 DRWIN LDA #)
0130 STA TM1
0140 TAY
0150 TAX
0160 DIT STX TM2
0170 LDX TH1
0180 LDA TWINL,x
0190 CLC
0200 ADC #2
0210 STA L
0220 LDA TWINH,X
0230 ADC #0
0240 STA L+1
0250 LDX TM2
0260 DRLP LDA STRING,X
0270 JSR AS2IC
0280 CPX XPOS
0290 BNE DRSC
0300 EOR #$80
0310 DRSC STA (L),Y
0320 INX
0330 INY
0340 CPY #38
0350 BNE DRLP
0360 LDY #0
0370 INC TM1
0380 LDA TM1
0390 CMP #3
0400 BNE DIT
0410 RTS
0420 ;get a key w/OPTION
0430 GAKEY LDA CONSOL
0440 CMP #6
0450 BNE GCH
0460 PLA
0470 PLA
0480 LDA #EOL
0490 STA STRING
0500 LDA #0
0510 STA EDIT
0520 STA SPFLG
0530 SEC
0540 RTS
0550 GCH LDA CH
0560 CMP #$FF
0570 BEQ GAKEY
0580 JSR GNKEY
0590 LDX XPOS
0600 RTS
0610 ;input routine
0620 INPUT JSR CLRSTR
0630 IMPUT2 LDA #0
0340 STA XPOS
0650 INMAIN JSR DRWIN
0660 JSR GAKEY
0670 LDX XPOS
0680 LDY EDIT ;edit mode?
0690 BNE EMT' ;yes
0700 LDY SPFLG ;comd mode?
0710 BNE ENTS ;yes
0720 LDY #4 ;ck 4 eol &
0730 IELP CMP ENKEY,Y ;cursor keys
0740 BEQ INEN
0750 DEY
0760 BPL IELP
0770 BMI SESC
0780 INEN STA CDIR
0790 CMP #EOL
0800 BNE INDDN
0810 STY CDIR
0820 JMP INDON
0830 ENTS CMP #EOL
0840 BNE SESC
0850 JMP INDON
0860 SESC CMP #27 ;ESC?
0870 BNE INEXT
0880 JSR GAKEY
0890 CMP #EOL
0900 BEQ INDON
0910 JMP INOVR
0920 INEXT LDY #12 ;test special
0930 IN1LP CMP INSPC,Y
0940 BEQ INPRC
0950 DEY
0960 BPL IN1LP
0970 INOVR STA STRIMG,X
0980 INX
0990 STX XPOS
1000 CPX #114
1010 BCC INMAIN
1020 DEX
1030 STX XPOS
1040 BNE INMAIN
1050 ;
1060 INPRC LDA INTABL,Y
1070 STA INJSR+1
1080 LDA INTABH,Y
1090 STA INJSR+2
1100 INJSR JSR $FFFF
1ll0 JMP INMAIN
1120 ;
1130 INDON LDY #114
1140 INPUT DEY
1160 LDA STRING,Y
1160 CMP #$20
1170 BEQ INOUT
1180 LDA #EOL
1190 INY
1200 STA STRING,Y
1210 STY STR
1220 LDA #0
1230 STA EDIT
1240 CLC
1250 RTS
1260 ;kill input
1270 ZAPST JSR CLRSTR
1280 LDA #0
1290 STA XPOS
1300 RTS
1310 ;del char
1320 INDEL LDX XPOS
1330 BEQ INDO
1340 DEX
1350 LDA #20
1360 STA STRING,X
1370 STX XPOS
1380 IMDO RTS
1390
1400 INLEFT LDX XPOS
1410 BEQ INDO
1420 DEX
1430 STX XPOS
1440 RTS
1450 ;input rt
1460 INRT LDX XPOS
1470 CPX #113
1400 BCS INDO
1490 INX
1500 STX XPOS
1510 RTS
1520 ;cntrol-del
1530 INCTDL LDX XPOS
1540 INCTD LDA STRING+1,X
1550 STA STRING,X
1560 INX
1570 CPX #$7A
1580 BNE INCTD
1590 RTS
1600 ;cntrol-ins
1610 ININS LDX #$7A
1620 ININD LDA STRING,X
1630 STA STRING+l,X
1640 DEX
1650 CPX XPOS
1660 BPL ININD
1670 INX
1680 LDA #$20
1690 STA STRIMG,X
1700 STA STRING+114
1710 RTS
1720 ;inout up
1730 INUP LDA XPOS
1740 SEC
1750 SBC #38
1760 BPL INST
1770 CLC
1780 ADC #114
1790 INST STA XPOS
1800 RTS
1810 ;inp dwn
1820 INDWN LDA XPOS
1830 CLC
1840 ADC #38
1850 CMP #114
1860 BCC INST
1870 SEC
1880 SBC #114
1890 JHP INST
1900 ;xpos to strt of line
1910 INMOD LDX #0
1920 LDA XPOS
1930 CMP #38
1940 BCC INMD
1950 LDX #38
1960 CMP #76
1970 BCC INMD
1980 LDX #76
1990 INMD STX xpos
2000 RTS
2010 ;insert line
2020 ININLN JSR INMOD
2030 LDA #37
2040 STA TM3
2050 INLNL JSR ININS
2060 DEC TM3
2070 BPL INLNL
2080 RTS
2090 ;del a line
2100 INDLLN JSR INMOD
2110 LDA #37
2120 STA TM3
2130 INLND JSR INCTDL
2140 DEC TM3
2150 BPL INLND
2160 RTS
2170 ;command mode
2180 COMMODE LDA #4
2190 STA DLIC+1
2200 LDA #1
2210 STA SPFLG
2220 JSR INPUT
2230 BCS CMOUT
2240 JSR LO2UP
2250 CMAOK LDX #0 ;command #
2260 LDA # <CMTAB
2270 STA L
2280 LDA # >CMTAB
2290 STA L+l
2300 CMBG LDY #0
2310 CMST LDA (L),Y
2320 BEQ COMMODE
2330 CMP STRING,Y
2340 BNE CU3
2350 INY
2360 CPY #3
2370 BNE CMST
2380 ;
2390 LDA COML,X
2400 STA CMJP+1
2410 LDA COMH,x
2420 STA CMJP+2
2430 JSR CLRTXT
2440 CMJP JSR $FFFF
2450 CMOUT LDA #0
2460 STA DLIC+1
2470 STA SPFLG
2480 JMP BFLP
2490 ;
2500 CU3 INX
2510 LDA L
2520 CLC
2530 ADC #3
2540 STA L
2550 BCC CMBG
2560 INC L+1
2570 BNE CMBG
2580 ;show col/row
2590 SHWCRI LDA SCOL
2600 LDX #0
2610 XGZ SEC
2620 SBC #26
2630 BMI XGY
2640 INX
2650 BNE XGZ
2660 XGY PHA
2670 TXA
2680 CLC
2690 ADC #$A1
2700 STA SCMEM+19
2710 PLA
2720 CLC
2730 ADC #$BB
2740 STA SCMEM+20
2750 LDX SROW
2760 INX
2770 TXA
2780 LDX #0
2790 XGU SEC
2800 SBC #10
2810 BMI XGV
2820 INX
2830 BNE XGU
2840 XGV PHA
2850 TXA
2860 CLC
2870 ADC #$90
2880 STA SCMEM+21
2890 PLA
2900 CLC
2910 ADC #$9A
2920 STA SCMEM+22
2930 RTS
2940 ;print sheet
2950 PRNT JSR CLRTXT
2960 LDA #'P
2970 STA FNAME
2980 LDA #':
2990 STA FNAME+1
3000 LDA #EOL
3010 STA FNAME+2
3020 LDA # >PRITMS
3030 LDX # <PRITMS
3040 PRNTIT LDY #0
3050 STY CPOS ;curs. index
3060 JSR PRNTTW
3070 JSR PRMS1
3080 JSR STCRS
3090 JSR PRMS2
3100 JSR STCRS
3110 LDA COLF
3120 STA TM ;1st col
3130 LDA COLS
3140 SEC ;chk cell range
3150 SBC COLF
3160 BMI PERRR
3170 LDA ROWS
3180 SEC
3190 SBC ROWF
3200 BPL PROK
3210 PERRR LDY #141 ;range err
3220 PERRA JSR DSKERR
3230 JMP HM3
3240 ;open #2 P:
3250 PROK CLOSE 2
3260 LDX #$20
3270 LDA #3
3280 STA ICCOM,X
3290 LDA # >FNAME
3300 STA ICBAH,x
3310 LDA # <FNAME
3320 STA ICBAL,X
3330 LDA #0
3340 STA AUX2,X
3350 LDA #8
3360 STA AUX1,X
3370 JSR CIOV
3380 BMI PERRA
3390 PXD LDX TM ;curr col
3400 LDA COLW,X ;get width
2410 STA GMX
3420 LDA ROWF
3430 JSR LOCCEL
3440 BCS CMTE ;empty
2450 LDY #1
3460 LDA (LL),Y
2470 STA FORMAT
3480 LDY #3
3490 LDA (LL),Y
3500 BPL PXF
3510 JMP ISERR ;error
3520 PXF AND #3
3530 BEQ PXA ;text
3540 JMP ITSAN ;#/F
3550 PXA LDY #2
3560 LDA (LL),Y
3570 TAY
3580 JSR ADDDT ;up 4
3590 LDA #EOL
3600 STA STRING,Y
3610 PXC DEY
3620 BMI PXB
3630 LDA (LL),Y
3640 STA STRING,Y
3650 JMP PXC
3660 PXB LDA # <STRING
3670 STA IL
3680 LDA # >STRING
3690 STA IL+1
3700 JSR FRMTXT
3710 PXE JSR SNDOUT
3720 INC TM ;do nxt col
3730 LDA TM
2740 CMP COLS
3750 BEQ PXD
3760 BCC PXD
3770 LDA COLF
3780 STA TM
3790 JSR SNDEOL ;snd eol
3800 INC ROWF ;next row
3810 LDA ROWF
3820 CMP ROWS
3830 BEQ PXD
3840 BCC PXD
3850 CLOSE 2
3860 RTS ;done
3870 ;send out blanks
3880 CMTE JSR SPLBF
3890 JMP PXE
3900 ;line feed
3910 SNDEOL LDA #11
3920 LDX #$20
3930 STA ICCOM,X
3940 LDA #0
3950 STA ICBLL,X
3960 STA ICBLH,X
3970 LDA #$9B
3980 JSR CIOV
3990 BMI LSERR
4000 RTS
4010 ;send out cell
4020 SNDOUT LDA #11
4030 LDX #$20
4040 STA ICCOM,X
4050 LDA GMX
4060 STA ICBLL,X
4070 LDA #0
4980 STA ICBLH,X
4090 LDA # >LBUF
4100 STA ICBAH,X
4110 LDA # <LBUF
4120 STA ICBAL,X
4130 JSR CIOV
4140 BMI LSERR
4150 RTS
4160 ;list/print err
4170 LSERR PLA
4180 PLA
4190 JMP GENER
4200 ;space out lbuf
4210 SPLBF LDX #$7F
4220 LDA #$20
4230 SL9 STA LBUF,X
4240 DEX
4250 BPL SL9
4260 RTS
4270 ;err in cell
4280 ISERR JSR SPLBF
4290 LDY #4
4300 ISA LDA CERR,Y
4310 STA LBUF,Y
4320 DEY
4330 BPL ISA
4340 JMP PXE
4350 ;its a # or F
4360 ITSAN CMP #1
4370 BNE ITSAF
4380 JSR ADDT
4390 LDX LL
4400 LDY LL+1 ;???
4410 ITSG JSR FLD0R
4420 JSR FASC
4430 JSR FRMNUM
4440 JMP PXE
4450 ;must be a F
4460 ITSAF LDY #2
4470 LDA (LL),Y
4480 TAY
4490 JSR ADDDT
4500 TYA
4510 SEC
4520 SBC #6
4530 CLC
4540 ADC LL
4550 TAX
4560 LDA LL+1
4570 ADC #0
4580 TAY
4590 JMP ITSG
4600 ;list to disk
4610 LIST JSR ST2BF1
4620 JSR FINARG
4630 JSR GTFILE
4640 JSR CHKDEV
4650 BCC LDOK
4660 JMP DEVERR
4670 LDOK JSR FILEXST
4680 BCC FILOK
4690 JMP HOME
4700 FILOK JSR CLRTXT
4710 LDA # >LSMES
4720 LDX # <LSMES
4730 JMP PRNTIT
4740 ;copy & move
4750 ;cmflg 0=cpy 1=mov
4760 ;copy a block verbatim
4770 COPY JSR CLRTXT
4780 LDA # >CPYMES
4790 LDX # <CPYMES
4800 LDY #0
4810 STY CMFLG
4820 JMCPY STY CPOS
4830 JSR PRNTTW
4840 JSR PRMS1
4850 JSR STCRS
4860 JSR PRMS2
4870 JSR STCRS
4880 JSR PRMS3
4890 JSR STCRS
4900 ;chk for block errs
4910 LDA COLS
4920 CMP COLF
4930 BCS CLOK
4940 CSER JMP PERRR
4950 CLOK LDA ROWS
4960 CMP ROWF
4970 BCC CSER
4980 ;chk if dest = corners
4990 LDA COLT
5000 CMP COLF
5010 BNE LOWR
5020 LDA ROWT
5030 CMP ROWF
5040 BEQ CSER
5050 LOWR LDA COLT
5060 CMP COLS
5070 BNE CKOK
5080 LDA ROWT
5090 CMP ROWS
5100 BEQ CSER
5110 ;set cntrs
5120 CKOK LDA COLS
5130 SEC
$140 SBC COLF
5150 STA DM4
5160 STA DM2
5170 LDA ROWS
5180 SEC
5190 SBC ROWF
5200 STA DMS
5210 ;offsets
5220 SEC
5230 LDA COLT
5240 SBC COLF
5250 STA COFST
5260 SEC
5270 LDA ROWT
5280 SBC ROWF
5290 STA ROFST
5300 JSR CHKFSD ;A =typ inc
5310 ASL A
5320 TAX
5330 LDA INCTAB,X
5340 STA INCRES+1
5350 LDA INCTAB+1,X
5360 STA INCRES+2
5370 JSR IVCRS
5380 CPY1 LDA COLF
5390 STA DM6
5400 LDA COLT
5410 STA DM7
5420 CPY5 LDA ROWT ;dest
5430 JSR STRAD ;get add
5440 CPY2 LDY #0 ;see if MT
5450 LDA (LL),Y
5460 CMP #$FF ;MT
5470 BEQ NOEN
5480 CMP DM7 ;col?
5490 BEG FUL
5500 BCS NOEN
5510 JSR UP1COL
5520 JMP CPY2
5530 FUL LDX DM7
5540 LDA ROWT
5550 JSR DELTCL
5560 NOEN LDA LL
5570 STA IL
5580 LDA LL+1
5590 STA IL+1
5600 LDA ROWF
5610 JSR STRAD
5620 CPY3 LDY #0 ;chk source
5630 LDA (LL),Y
5640 CMP #$FF
5650 BEQ INCRES ;no cell
5660 CMP DM6 ;COl?
5670 BEQ GT1
5680 BCS INCRES ;no cell
5690 JSR UP1COL
5700 JMP CPY3
$710 ;move cell to bf1
5720 GT1 LDA # >BF1
5730 STA JL+1
5740 LDA # <BF1
5750 STA JL
5760 LDY #2
5770 LDA (LL),Y
5780 CLC
5790 ADC #DTLEN
5800 TAY
5810 DEY
5820 STA LENG ;4 Move
5830 STY GMX
5840 CPY4 LDA (LL),Y
5850 STA (JL),Y
5860 DEY
5870 CPY #$FF
5880 BNE CPY4
5890 LDA DM7 ;new col #
5900 STA BF1
5910 LDA IL
5920 STA LL
5930 LDA IL+1
5940 STA LL+l
5950 LDA CMFLG
5960 BEQ NOCHG
5970 JSR MVPARS
5980 NOCHG LDY GMX
5990 INY
6000 STY LENG
6010 JSR MOVUP
6020 LDA ROWT
6030 JSR UPRAD
6040 LDY GMX
6050 CPY6 LDA (JL),Y
6060 STA (IL),Y
6070 DEY
6080 CPY #$FF
6090 BNE CPY6
6100 INCRES JSR $FFFF
6110 BCS CFIN
6120 JMP CPY5
8130 CFIN JSR RECALC
6140 JSR REFSCR
6150 JSR IVCRS
6160 CLC
6170 RTS
6180 ;increase ptr routs
6190 RTDN INC DM7
6200 INC DM6 ;next col
6210 DEC DM4
6220 LDA DM4
6230 CMP #$FF
6240 BNE RBX
6250 RBZ INC ROWT ;next row
6260 INC ROWF
6270 RRR DEC DM5
6280 LDA DM5
6290 CMP #$FF
6300 BNE RBY
6310 SEC ;done
6320 RTS
6330 RBY LDA COLF
6340 STA DM6
6350 LDA COLT
6360 STA DM7
6370 LDA DM2
6380 STA DM4
6390 RDX CLC
6400 RTS ;keep going
6410 ;
6420 RTUP INC DM7
6430 INC DM6
6440 DEC DM4
6450 LDA DM4
6460 CMP #$FF
6470 BNE RBX
6480 DEC ROWT
6490 DEC ROWF
6500 JMP RRR
6510 ;
6520 LFDN DEC DM7
6530 DEC DM6
6540 DEC DM4
6550 LDA DM4
6560 CMP #$FF
6570 BNE RBXD
6580 BEQ RBZ
6590 ;check source,end &dest. cell
6600 ;if in sheet
6610 CHKFSD LDA ROWT
6620 CMP ROWF
6630 BNE TBFH
6640 LDA COLT ;A,E
6650 CMP COLF
6660 BNE VAE
6670 VER PLA ;error
6680 PLA
6690 JMP PERRR
6700 VAE BCC VEE ;E
6710 LDA COLS ;A
6720 SEC
6730 SBC COLF
6740 CLC
6750 ADC COLT
6760 STA COLT
6770 CMP #64 ;0-63
6780 BCS VER
6790 LDA COLS ;switch
6800 PHA
6810 LDA COLF
6820 STA COLS
6830 PLA
6640 STA COLF
6850 LDA #1 ;lfdn
6860 CLC
6870 RTS
6880 VEE LDA #0 ;rtdn
6890 CLC
6900 RTS
6910 TBFH BCC VEE
6920 LDA ROWS
6930 SEC
6940 SBC ROWF
6950 CLC
6960 ADC ROWT
6970 STA ROWT
6980 CMP #64
6990 BCS VER
7000 LDA ROWS ;Switch
7010 PHA
7020 LDA ROWF
7030 STA ROWS
7040 PLA
7050 STA ROWF
7060 LDA #2 ;rtup
7070 CLC
7080 RTS
7090 ;
7100 INCTAB .WORD RTDN
7110 .WORD LFDN
7120 .WORD RTUP
7130 ;prn ms3
7140 PRMS3 LDA #2
7150 STA ASAV
7160 LDA # >CMES3
7170 LDX # <CMES3
7180 LDY #3
7190 JMP PRMA
7200 ;move block
7210 MOVEB JSR CLRTXT
7220 LDA #1
7230 STA ASAV
7240 STA CMFLG
7250 LDA # >MOVMES
7260 LDX # <MOVMES
7270 LOY #0
7280 JMP JMCPY ;jmp in2 cpy
7290 ;reassign cell values
7300 ;if error = changed to col
7310 ;dm0,dm1 used
7320 MVPARS LDY #4
7330 LDA BF1,Y
7340 CMP #'=
7350 BEQ JAA
7360 JAB RTS ;quit
7370 JAA INY
7380 CPY GMX ;max len
7390 BCS JAB ;end!
7400 LDA BF1,Y
7410 CMP #'D
7420 BCS JAA ;nxt
7430 CMP #'A
7440 BCC JAA
7450 STY Y9 ;get cell
7460 JSR GTCLRW
7470 BCC JAC
7480 JAD LDY Y9
7490 BNE JAA
7500 JAC LDA COLNU
7510 CLC
7520 ADC COFST ;col offset
7530 STA COLNU
7540 CMP #64
7550 BCS JAB ;err
7560 LDA ROWNU
7570 CLC
7580 ADC ROFST ;row offset
7590 STA ROWNU
7600 CMP #64
7610 BCS JAD ;err
7620 LDY Y9
7630 ;now change'm
7640 LDX #2
7650 LDA COLNU
7660 JAE CMP #26,X
7670 BCS JAF
7680 DEX
7690 BPL JAE
7700 JAF PHA
7710 LDA AS26,X
7720 STA BF1,Y
7730 PLA
7740 SEC
7750 SBC #26,X
7760 CLC
7770 ADC #65
7780 INY
7790 STA BF1,Y
7800 INC ROWNU
7810 LDA ROWNU
7820 LDX #9
7830 JAN CMP DECM,x
7840 BCS JAG
7850 DEX
7860 BPL JAN
7870 JAG PHA
7880 LDA DECN,x
7890 INY
7900 STA BF1,Y
7910 PLA
7920 SEC
7930 SBC DECM,X
7940 TAX
7950 LDA DECN,X
7960 INY
7970 STA BF1,Y
7980 JMP JAA
7990 ;recalc
8000 RECALC LDA #0
8010 STA ROWNU
8020 STA COLNU
8030 LDA RCFLG
8040 BNE BYC
8050 ;by rows
8060 IG JSR RARITH
8070 INC COLNU
8080 LDA COLNU
8090 CMP #64
8100 BCC IG
8110 LDA #0
8120 STA COLNU
8130 INC ROWNU
8140 LDA ROWNU
8150 CMP #64
8160 BCC IG
8170 BYR JSR REFSCR
8180 JMP IVCRS
8190 ;by cols
8200 BYC JSR RARITH
8210 INC ROWNU
8220 LDA ROWNU
8230 CMP #64
8240 BCC BYC
8250 LDA #0
8260 STA ROWNU
8270 INC COLNU
8280 LDA COLNU
8290 CMP #64
8300 BCC BYC
8310 BCS BYR ;done
8320 ;arith done here
8330 RARITH LDA ROWNU
8340 LDX COLNU
8350 STA TA1
8360 STX TA2
8370 JSR LOCCEL
8380 BCC RBD
8390 RBFF JMP RBGH ;none
8400 RBD LDA LL
8410 STA TA3
8420 LDA LL+l
8430 STA TA4
8440 LDY #3
8450 LDA (LL),Y
8460 BMI RBFF ;err
8470 CMP #2 ;func?
8480 BNE RBFF ;no
8490 DEY
8500 LDA (LL),Y
8510 SEC
8520 SBC #6
8530 TAY ;end of F
8540 LDA #EOL
8550 STA STRING,Y
8560 JSR ADDDT ;up 4
8570 RRJ DEY
8580 BMI RRB
8590 LDA (LL),Y
8600 STA STRING,Y
8610 JMP RRJ
8620 RRB JSR TRYFNC
8630 LDA TA3
8640 STA LL
8650 LDA TA4
8660 STA LL+l
8670 LDY #2
8680 LDA (LL),Y
8690 SEC
8700 SBC #2
8710 CLC
8720 ADC LL
8730 STA FLPTR
8740 LDA LL+1
8750 ADC #0
8760 STA FLPTR+1
8770 JSR FST0P
8780 RBGH LDA TA1
8790 STA ROWNU
8800 LDA TA2
8810 STA COLNU
8820 RTS
8830 ;delete block
8840 DELETE JSR CLRTXT
8850 LDA # >DELMS
8860 LDX # <DELMS
8870 LDY #0
8880 STY CPOS
8890 JSR PRNTTW
8900 JSR PRMS1
8910 JSR STCRS
8920 JSR PRMS2
8930 JSR STCRS
8940 LDA COLS
8950 CMP COLF
8960 BCC KER
8970 LDA ROWS
8980 CMP ROWF
8990 BCS DLC
9000 KER JMP PErrr ;ERR 141
9010 ;now delete
9020 DLC LDA COLF
9030 STA COLT
9040 DLB LDX COLT
9050 LDA ROWF
9060 JSR LOCCEL
9070 BCS DLA
9080 LDA ROWF
9090 JSR DELTCL
9100 DLA INC COLT
9110 LDA COLT
9120 CMP COLS
9130 BEQ DLB
9140 BCC DLB
9150 INC ROWF
9160 LDA ROWF
9170 CMP ROWS
9180 BEQ DLC
9190 BCC DLC
9200 JSR CLRTXT
9210 JSR CLRSCN
9220 JSR REFSCR
9230 JMP IVCRS ;done
9240 ;prnt in txtwind
9250 ;asav=hpos A=hi X=lo Y=lin#
9260 PRNTTW STA IL+1,
9270 STX IL
9280 STY YSAV
9290 LDA TWINL,Y
9300 CLC
9310 ADC #2
9320 STA L
9330 LDA TWINH,Y
9340 ADC #0
9350 STA L+1
9360 LDY #0
9370 PR1 LDA (IL),Y
9380 CMP #EOL
9390 BEQ PR2
9400 STA (L),Y
9410 INY
9420 BNE PR1
9430 PR2 RTS
9440 ;get RET/ESC
9450 RETESC JSR GNKEY
9460 CMP #$9B
9470 BNE III
9480 CLC
9490 RTS
9500 III CMP #$1B
9510 BNE IIT
9520 SEC
9530 RTS
9540 IIT JSR MVCRS ;move?
9550 JMP RETESC
9560 ;stor crs pos
9570 STCRS LDX CPOS
9580 LDA SCOL
9590 STA COLF,X
9600 LTA SROW
9610 STA ROWF,X
9620 INC CPOS
9630 RTS
9640 ;print ms1
9650 PRMS1 LDA # >CMES1
9660 LDX # <CMES1
9670 LDY #1
9680 PRMA STY YSAV ;line#
9690 JSR PRNTTW
9700 JSR RETESC
9710 BCS EOUT
9720 RTS
9730 EOUT PLA ;exit
9740 PLA
9760 JSR CLRTXT
9760 RTS
9770 ;prn ms2
9780 PRMS2 LDA # >CMES2
9790 LDX # <CMES2
9800 LDY #2
9810 JMP PRMA ;cheat
9820 ;chk parmeters
9830 ;locat cell
9840 ;x=col A=row ll=loc
9850 LOCCEL STX COLNU
9860 JSR STRAD
9870 FU LDY #0
9880 LDA (LL),Y
9890 CMP #$FF
9900 BEQ FQE
9910 CMP COLNU
9920 BEG FQF
9930 BCC FQG
9940 FQE SEC
9950 RTS
9960 FQG JSR UP1COL
9970 JMP FU
9980 FQF CLC
9990 RTS
LISTING 7: ASSEMBLY
0100 ;SAVE#D:bcalc.pt6
0110 ;
0120 Y40L .DS 18
0130 V40H .DS 18
0140 TWINL .BYTE <TXTWIN
0150 .BYTE <[TXTWIN+$28]
0160 .BYTE <[TXTWIN+$50]
0170 .BYTE <[TXTWIN+$78]
0180 TWINH .BYTE >TXTWIN
0190 .BYTE >[TXTWIN+$28]
0200 .BYTE >[TXTWIN+$50]
0210 .BITE >[TXTWIN+$78]
0220 CREDIT .SBYTE +$80," B-Calc (c)"
0230 .SBYTE +$80," 1987 AA01 "
0240 .SBYTE +$80," TYPE: "
0250 .SBYTE +$80," "
0260 .BYTE EOL
0270 CREDTF .SBYTE +$80," B-Calc by "
0280 .SBYTE +$80,"Barry Kolbe "
0290 .SBYTE +$80,"Bryan Schappel"
0300 .SBYTE +$80," "
0310 .BYTE EOL
0320 ;input tables
0330 INTABL .BYTE <ZAPST
0340 .BYTE <INDEL
0350 .BYTE <INCTDL
0360 .BYTE <ININS
0370 .BYTE <INUP
0380 .BYTE <INDWN
0390 .BYTE <INLEFT
0400 .BYTE <INRT
0410 .BYTE <ININLH
0420 .BYTE <INDLLN
0430 .BYTE <INDO
0440 .BYTE <INDO
0450 .BYTE <INDO
0460.INTABH .BYTE >ZAPST
0470 .BYTE >INDEL
0480 .BYTE >INCTDL
0490 .BYTE >ININS
0500 .BYTE >INUP
0510 .BYTE >INDWN
0520 .BYTE >INLEFT
0530 .BYTE >INRT
0540 .BYTE >ININLN
0550 .BYTE >INDLLN
0560 .BYTE >INDO
0570 .BYTE >INDO
0580 .BYTE >INDO
0590 ;
0600 INSPC .BYTE $7D,$7E,$FE,$FF
0610 .BYTE $1C,$1D,$1E,$1F
0620 .BYTE $9D,$9C,$7F,$9E
0630 .BYTE $9F
0640 ;
0650 ;command mode tables
0660 CMTAB .BYTE "DIR"
0670 .BYTE "GOT" ;GOTO Cell
0680 .BYTE "SAV" ;SAVE Sheet
0690 .BYTE "LOA" ;LOAD Sheet
0700 .BYTE "SET" ;CROSS reference
0710 .BYTE "WID" ;Set Col WIDTH
0720 .BYTE "LIS" ;LIST to disk
0730 .BYTE 0
0740 ;
0750 cOML .BYTE <DIR, <GOTO
0760 .BYTE <SAVE, <LOAD
0770 .BYTE <SETREF, <WIDTH
0780 .BYTE <LIST
0790 ;
0800 COMN .BYTE >DIR, >GOTO
0810 .BYTE >SAVE, >LDAD
0820 .BYTE >SETREF, >WIDTH
0830 .BYTE >LIST
0840 ;
0850 SPCKEY .BYTE $1C,$1D,$1E,$1F
0860 .BYTE $08,$14,$0B
0870 .BYTE $04,$03,$0D
0880 .BYTE $05,$06,$07
0890 .BYTE $0F,$12,$10
0900 .BYTE $01
0910 ;
0920 SPECL .BYTE <CU, <CD, <CL, <CR
0930 .BYTE <HOME, <FORCE
0940 .BYTE <KILLCL, <DELETE
0950 .BYTE <COPY, <MOVEB
0960 .BYTE <EDITM, <FORMC
0970 .BYTE <GLOBAL, <RONOF
0980 .BYTE <RCFLP, <PRNT
0990 .BYTE <ARECL
1000 ;
1010 SPECH .BYTE >CU, >CD, >CL, >CR
1020 .BYTE >NOME, >FORCE
1030 .BYTE >KILLCL, >DELETE
1040 .BYTE >COPY, >MOVEB
1050 .BYTE >EDITM, >FORMC
1060 .BYTE >GLOBAL, >RONOF
1070 .BYTE >RCFLP, >PRNT
1080 .BYTE >ARECL
1090 SLKEY .BYTE $FF,$FE,$FD,$9F
1100 .BYTE $9E,$9D,$9C,$9B
1110 .BYTE $7F,$7E,$7D,$1F
1120 .BYTE $1E,$1D,$1C,$1B
1130 ;
1140 ;Special Text
1150 ;
1160 DIRTUT .BYTE "D1:*.*",EOL
1170 FNAME .BYTE "D1: ",EOL
1180 ERMES .SBYTE "Error"
1190 CERR .BYTE "Error"
1200 DERM .SBYTE "Error: Press a ke
y"
1210 ;
1220 STT .SBYTE "File: "
1230 .SBYTE " Free:"
1240 SEG .SBYTE "Recalc:OFF "
1250 .SBYTE " by: ROW "
1260 ;
1270 ONOFM .SBYTE "OFFON "
1280 RCMES .SBYTE "ROW COLUMN"
1290 ONF .BYTE 0
1300 RCFLG .BYTE 0
1310 CMFLG .BYTE 0
1320 KPY .DS 1 ;y sav
1330 CPOS .DS 1
1340 Y9 .DS 1
1350 ;
1360 TEXTYP .SBYTE "Text "
1370 NUMTYP .SBYTE "Number "
1380 FUNTYP .SBYTE "function"
1390 .SBYTE " "
1400 ;
1410 DELMS .SBYTE "DELETE: Position Cu
rsor, RETURN",SEOL
1420 CPYMES .SBYTE "COPY: Position Cur
sor, RETURN",SEOL
1430 MOVMES .SBYTE "MOVE: Position Cur
sor, RETURN",SEOL
1440 CMES1 .SBYTE "Upper left of Block
", SEOL
1450 CMES2 .SBYTE "Lower right of Bloc
k",SE0L
1460 CMES3 .SBYTE "Upper left of Dest.
",SEOL
1470 PRITMS .SBYTE "PRINT: Position Cu
rsor, RETURN",SEOL
1480 LSMES .SBYTE "LIST: Position Curs
or, RETURN",SEOL
1490 ;
1500 FMES .SBYTE "FORMAT Justify L"
1510 FMA .SBYTE "Dollar $(D) N"
1520 FMB .SBYTE "Commas (,) N"
1530 FMC .SBYTE "Dec. places 0"
1540 YN .SBYTE "NY"
1550 LCR .SBYTE "LRC"
1560 SDEC .SBYTE "0123456789"
1570 ;raw L,C,R
1580 JSKEY .BYTE $00,$28,$12
1590 REPMES .SBYTE "File exists, Repla
ce? Y/N",SEOL
1600 ;raw 0-9
1610 NKEY .BYTE $32,$1F,$1E,$1A
1620 .BYTE $18,$1D,$1B,$33
1630 .BYTE $35,$30
1640 FCNT .BYTE 0
1650 TORITE .BYTE 0
1660 SETROW .BYTE 0
1670 SETCOL .BYTE 0
1680 CDIR .BYTE 0 ;cursor directn
1690 ENKEY .BYTE EOL,$1C,$1D,$1E,$1F
1700 EOM .DS 2 ;end of memry
1710 FRCTXT .BYTE 0
1720 CRSEN .DS 1
1730 ENDAT .DS 2
1740 FXS .DS 1
1750 FXA .DS 1
1760 STLO .DS 58
1770 STHI .DS 58
1780 CTLCMD .BYTE $0B,$02,$14
1790 AS26 .BYTE "ABC"
1800 N26 .BYTE 0,26,52
1810 DECN .BYTE "0123456789"
1820 DECM .BYTE 0,10,20,30,40,50
1830 .BYTE 60,70,80,90
1840 OPTAB .BYTE "^*/+-"
1850 FPSTACK .DS 6*58
1860 ONE .FLOAT 1
1870 TWO .FLOAT 2
1880 HALF .FLDAT .5
1890 REFTAB .SBYTE "AA"
1900 .SBYTE "01"
1910 AIT .DS 256
1920 SPFLG .DS 1
1930 COLW .DS 64
1940 FMCOL .DS 64
1950 RAD .DS $80 ;row add tabl
1960 RO1 .DS $40 ;row data