textfiles/apple/DOCUMENTATION/d.code

613 lines
22 KiB
Plaintext
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

COMPACT
DECODE's COMPACT program allows you to reduce the amount of memory occupied by
an Applesoft program, by optionally removing Rem statements, packing as many
statements as possible into single lines, and shortening variable names.
How to Use Compact:
1. Lock the program you want compacted on disk so you don't accidentally loose
it.
2. LOAD the program you want to compact.
3. BRUN COMPACT. If this has recently been done you probably can just type "&".
D.BUG Note: If you want D.BUG and both in memory, you must BRUN D.BUG first.
Otherwise COMPACT will disappear.
Now you will see COMPACT's menu:
(1) REMOVE REMS ............... YES
(2) CONCATENATE LINES ......... YES
(3) SHORTEN VARIABLE NAMES .... YES
(4) RENAME VARIABLES .......... YES
(5) COMPACT PART OF PROGRAM .... NO
(6) VARIABLE TABLE TO PRINTER .. NO
(C) COMPACT
(Q) QUIT
COMPACT Menu Options
1. REMOVE REMS
YES means when you compact your program, every Remark statement will be deleted.
If you use a lot of Rems, thiill save more program space than any other, because
every character and space in a Remark takes up an entire byte of memory.
2. CONCATENATE LINES
YES means that when you compact your program, as many statements as possible
will be packed into single program lines, thus eliminating old line numbers.
ULTRA-LONG-LINE PROBLEMS
With option 2 set at YES, COMPACT will often create a program line that works
perfectly, but is too long to edit. Applesoft allows program lines of about 250
bytesd like "PRINT" takes up one byte). Editing, however, has to consider each
character in the listing (now "PRINT" takes up five characters, plus two more
for spaces on each end). Even GPLE's "Pack" feature won't always let you edit an
ultra-long line.
WATCH OUT that you don't inadvertently chop off a program line when you attempt
to edit it. If you are cursor-tracing a line and you hear beeping (or you try to
edit with GPLE and code is missing), type CONTROL-X immediately, and BRUN
LINE.SPLITTER.
3. SH# When this option is set to YES, all variable names longer than two
characters will be shortened to two characters.
In Applesoft, it doesn't matter how long your variable names are, only the first
two characters count (COMPACT leaves only those two characters if you select YES
for this option). The variables APPLE, APPALOOSA and AP are the same. So are
MOUSE$, MOUNTEVEREST$ and MO$. The advantage to long variable names is that they
are more descriptiave. The disadvantage is that they take up a lot of room - one
byte perNote: OPTION 3 simply chops off the end of long variable names.
OPTION 4 actually renames variables without regard to their former name
4. RENAME VARIBLES
When this option is selected, COMPACT will change as many two-or-more character
variable names into one-letter names as possible. The multiple characater
variables that are used most often will be converted to single letter names
until all 26 letters have been used (for each variable type. Remember, A$, A%
and A may all be in the same proe: A (4) YES sets (3) to YES and (5) to NO. A
(4) NO sets (6) to NO.
5. COMPACT PART OF PROGRAM
Use this option if you only want a portion of a program compacted. After typing
"C" to start compacting, you will be asked for the start and end line numbers
for compacting. You may default to the beginning or the end of the program by
simply hitting RETURN as an answer to either question.
Note: A (5) YES sets (4) to NO.
6. VARIABLE TABLE TO PRINTER
When set to YES, this option wil variables on your slot 1
printer (if option 4 set to YES).
"&" TO RE-RUN COMPACT
After COMPACT has been used and exited, you will usually be able to bring it up
again by typing "&" (return). If this doesn't work, just type "BRUN COMPACT"
again.
COMPACT assumes that any extra bytes that it finds imbedded beyond the end of a
program is relocatable code that the program uses. If extra bytes are found, you
will be asked if you wish to keep them. Answering "Y" will move the code to the
new program e the extra bytes.
If you don't think you have anything beyond the end of the program, and COMPACT
asks you about it anyway, just answer "N" and that will be the end of that.
UNUSED STATEMENTS
When programs have undergone heavy revision, statements often remain that can't
possibly be executed - your program just won't encounter them. COMPACT will
report the line numbers that contain these potentially useless statements. It's
up to you to delete them after COMPACT is finished.
THE VARIABLE CONVERENAME VARIABLES (option 4) is set to YES, a variable
conversion table will be displayed on the screen during compaction. This chart
lists the name of every variable in the program, it's new name (if it was
changed), and the number of times it appears in the program. (Note: Only the
first two characters of the variable will appear under the OLD column heading,
even though that variable may have had a longer name.).
One-character variables are listed first, unchanged, in the order of their
appearance in tt come the multiple-character variables. COMPACT will shorten as
many of those as possible to one character, with the ones that appear most often
in the program changed first.
If no name appears in the NEW column, it's because there are no more single
characters left for that particular variable type. This will only occur in very
large and/or complex programs. Usually real of string variables will be the
first to run out of the 26 available single-character names.
LOOK FOR "LONE" VARIABLES
Watch theart for variables that appear only once or twice in a program. This
could indicate that the variable name was misspelled or was once part of a
program segment that was removed. You might be able to save additional space (or
uncover a potential bug) if you look at the lone variable.
OLD NEW OCCURRENCES
--- --- -----------
D 2 SAMPLE VARIABLE CONVERSION TABLE
L$ 6 This table prints on the screen when COMPACT
B 5 option 4 (Re) is set to YES.
B$ 8
A%( 2
L 14
H 21
C 4
K 1 <-- Note: Only 1 occurance may indicate an
Z 8 unnecessary (or misspelled) variable name.
J 9
N$ 15 <-- Single-chartacter variables are listed first,
D$ 7 and will remain unchanged.
A$ 72
S$ 52
A 95
X 20
S 12 Variables A, B,C, & D are already used, so the
T 9 first multi-character variable is converted to E
P( 16
I 94 <-- End of old single-character variable names.
BU => E 39 <-- The most-often used multi-character variable name
FI => F 19 is converted first
EC => G 17
LV => M 16
SM => N 14
YE => O 14
BE => P 14
CO #BP => R 12
DF$( => A$( 11 <-- First string array is named A$().
CD => U 11
PN => V 10
FD => W 10
FI$( => B$( 9
PN$( => C$( 8
BL => Y 8
IP 8
ID 8
PR 8
PR% => A% 8 <-- First integer variable is named A%.
IO 8
CF 8
ME$ => A$ 7 <-- First string is name A$.
WD 6
COMPACT ERROR MESSAGES
NOT IN MEMORY
This means what it says. Load your program first, then BRUN COMPACT (or type "&"
if COMPACT is already loaded).
MEMORY OVERFLOW. PROGRAM TOO LARGE
This sometimes happens when you have other machine language program(s) in memory
in addition to COMPACT. You may need to re-boot or take other measures to clear
memory.
RELOAD YOUR BASIC PROGRAM
This message will occasionally come up when you're going to compact a very long
Applesoft program. Just re-load the program as instructed, and typn COMPACT.
In case you care: When you first BRUN COMPACT, it's code Bloads at $4000 (16384
decimal), and then relocates itself just under HIMEM. If your loaded program
extends above $4000, it will be partially wiped out by COMPACT and you'll be
told to re-load.
-----------------------------------------------------------
LINE.SPLITTER
LINE.SPLITTER simply chops a program line into two parts,in case it is too long
to edit. With your program loaded simply type "BRUN LI when asked, type the
number of the line you want to split. LINE.SPLITTER will split the line as near
the middle as possible, taking into consideration any IF statements.
The second section of the split line will be numbered one line number higher
than the first section.
LINE.SPLITTER ERROR MESSAGES
LINE DOES NOT EXIST
Oops, try again.
RENUMBER FOLLOWING LINE
If the higher number is already taken, the split will be cancelled and you will
have to renumber that part of your program to make rN'T BE SPLIT
The line has only one statement, or its first statement contains an IF.
-----------------------------------------------------------
COMPARE
D CODE's COMPARE program will take two Applesoft programs and tell you exactly
what lines are unique, different, or the same. You can also use COMPARE to check
binary and text files to see if they are identical.
JUST BRUN COMPARE AND TYPE TWO FILE NAMES
Select COMPARE from the D CODE startup menu, or simply type:BRUN COMPnatly,
COMPACT and COMPARE cannot live in the same Apple at the same time -
irreconcilable differences. COMPARE and D.BUG get along quite well, however. So
do COMPACT and D.BUG.
When the COMPARE screen appears, enter the names of the two files you want to
COMPARE. RETURN (with no name) signifies the Applesoft program currently in
memory. Under DOS 3.3, type the file name and any DOS parameters that go with
it (for example - MYPROGRAM,S6,D2). Under ProDOS, COMPARE will assume the
current prefix, unless ame is specified (for example
/MYDISK/MY.SUBDIR/MYPROGRAM).
COMPARING APPLESOFT FILES
When you're comparing two Applesoft programs, COMPARE will ask you if you want
occurences of identical lines printed. You will usually want to answer
"N", since "Y" will often print a ton of meaningless line numbers.
During comparison, a 1, 2, D or S will appear next to the line numbers as they
are shown on the screen:
1 means that this line is unique to Program #1 (the first one you selected) and
doesn't exis#2 means the line exists in Program #2 and not in #1.
D means both programs have duplicate line numbers, but the contents of the
lines are different.
S means the lines are the same (This will appear only if you answered "Y" to
the DISPLAY SAME LINES? option.)
COMPARING BINARY AND TEXT FILES
Since there are no line numbers in binary and text files, COMPARE will just tell
you if the files are identical or not.
Binary file note: If you're using DOS 3.3, COMPARE will also display the
starting addboth files (If you're in ProDOS, just type "CATALOG" and take a look
there.)
"&" TO RE-COMPARE
Once it's loaded, you may usually re-enter COMPARE and use it again by typing
"&" (return).
-----------------------------------------------------------
D.BUG
LOADING D.BUG
To load and activate D.BUG's commands, just type:BRUN D.BUG. Or select D.BUG
from the STARTUP program's menu.
If you want D.BUG to co-exist in memory with either COMPACT or COMPARE, D.BUG
must be loaded first like GPLE, Double-Take, ProntoDOS, and so on, should be
loaded before D.BUG.
D.BUG may be loaded from a program in the usual way:
10 PRINT: PRINT CHR$(4);"BRUN D.BUG"
REMOVING D.BUG
To disable D.BUG and free up approximatly 5.5K of memory it occupies, type
"FP" (DOS 3.3) or "-FP" (ProDOS - FP is a memory clearing file in the ProDOS
D.CODE catalog.).
SINGLE CHARACTER ABBREVIATIONS
Each D.BUG command may be abbreviated by typing only its first character (or
characters). For example, thed can be abbreviated as C, CH, CHE, or CHEC. To
function properly, some of the new commands may or must be followed by other
characters or words.
D.BUG FUNCTIONS AND COMMANDS
Fast Finder
New command: FIND (F)
Function: Quickly searches through an Applesoft program for occurrences of a
specified character or word.
Program Checker
New command: CHECK (C)
Function: Quickly proofreads Applesoft programs for syntax errors and undefined
statement errors. In addition, everything you type from troofread automatically
(no command required)
Easy Lister
New command: L
Function: Saves you three keystrokes every time you list a program, by letting
you type "L" instead of "LIST".
Window Tracer
New commands: TRACE (T), NOTRACE (N), VARIABLES (V), and WINDOW (W)
Function: Lets you watch Applesoft program line numbers and statements "live" as
they are executed (and optionally watch variable and expression values) in an
adjustable text window at the bottom of the screen.
Dump Tracer
DUMP (D), SIZE (S), and ZAP (Z)
Function: After a program stops for any reason, you can see the line numbers and
statements that were most-recently executed.
Breakpoints
New command: BREAK (B)
Function: Lets you set up breakpoints so your program will automaticly stop when
a variable becomes a certain value, or when other specified conditions are true.
Note: All D.BUG commands may be used within a program.
FAST FINDER
New command: FIND (F)
With any Applesoft program (and D.BUG) "F" (return). You will be asked what you
want to "SEARCH FOR:". After you respond, all line numbers containing your
character or word will be reported. If your word appears in line, say three
times, that line number will appear three times. The total number of occurrences
will be reported after the search ends.
FIND scans your entire program twice, first looking for your string in PRINT,
REM, and DATA statements, and then in the form of Applesoft words, or tokens.
When you tell FIND to search for "READ"it reports one set of line numbers for
ocurrences like PRINT "READ YOUR MAIL." and then another set of numbers for
occurrences line READ A$.
WILDCARD CHARACTERS
Using "@" in a search word will match a single character in a string.
Using "#" in a search will match any number of characters.
FIND AND LIST (FIND L OR FL)
Typing "FINDL" of "FL" works like "F" (above), but each occurrence will be
Listed, and the search word will be highlighted in inverse.
PROGRAM CHECKER
New command: CHECK (Applesoft program (and D.BUG) in memory, type "C" (return),
and your program will quickly be proofread for two specific things:
?SYNTAX ERRORS: This includes misspelled commands (like "PTINT"), improperly
punctuated Applesoft statements (like "INPUT A/B") and type-mismatch errors
(like A="CAT" and a$=CAT).
?UNDEFINED STATEMENT ERRORS: For example, a "GOTO 100" statement when there is
no line 100 in your program.
Sorry: misspelled words inside quote marks (including DOS commands) and in REM
and DATAll be ignored. CHECK will also not find ?Illegal Quantity errors and the
like. The COMPACT program will find program statements or lines that can't
possibly be executed (not really an error)
D.BUG does not cancel improper statements, it just tells you about them. May be
your "error" was intentional - like a GOTO 100 when you hadn't typed in line 100
yet. After entering a program line that is improper, you should immediatly edit,
re-enter or delete the line. And speaking of editing, D.BUG is totally compa If
you want to type a statement that contains an error, and you don't want to see
and hear D.BUG's warning, precede the statement (and line number, if any) with a
slash ("/"). The slash turns off D.BUG's proofread function for that line only.
ERROR MESSAGES
No Errors: This means that the program in memory when you typed "C" is free of
syntax and undefined statement errors.
<?> An inverse "?" in a listed program line or statement means a syntax error
exists nearby.
<#> An inverse "#" in a listed pratement means an undefined statement error
exists nearby.
"LIVE" SYNTAX CHECKING
With D.BUG loaded, every time you type anything, it will automaticly be checked
for syntax and undefined statement errors. Improper statements will be listed
and flagged with an inverse "?" or "#".
EASY LISTER
New command: L
With D.BUG loaded you may simply type "L" (return) to LIST a program in memory.
All Applesoft syntax is in effect; therefore you can use commands like L10-100,
L-100, and L100-.
WINDOWnds: TRACE (T), NOTRACE (N), VARIABLES (V), WINDOW (W)
Typing "T" before you run a program activates an adjustable-size "trace window"
at the bottom of the screen. that displays the current line numbers and
statements currently being executed. You can slow down the program execution or
even execute one program line at a time.
Note: Most 80-col!cards for the ][+ do not scroll properly because they don't
support the required windows for "Window Tracer"
NOTRACE (N)
Typing "N" disables TRACE and rels
VARIABLES (V:)
With TRACE active you can specify particular variables to display in the trace
window. (Only the first 12 characters of strings will appear) All variable
expressions are also displayed. Type "V:" to cancel variable tracing.
Errors: When an expression which are impossible to interpret, like CHR$(-65) or
123/0, will produce an error message during a trace.
WINDOW (W)
This command changes the size of the trace window. The controls are: (Up arrow
or Ctrl-K): Moves the top of the trwn arrow or Ctrl-J): Moves the top of the
trace window down. (the trace window can occupy all but the top 3 lines on the
screen (> or .): Moves the division between the variable area and the statement
area 20 spaces right. (< or ,): Moves the division between the variable area and
the statement area 20 spaces left. (the "*" shows the division between the two
areas in the trace window)
While the program is running you can use these keys:
Space bar: Will execute one statement. If the trace windostatement will appear
in the window BEFORE it is executed so you can press Ctrl-C before it goes.
Return: Will restore normal execution after using the above function.
Left arrow: Will slow down execution to one lower of eight speeds.
Right arrow: Will speed up execution to the next higher of the eight speeds.
Button 1: Will turn off the TRACE function making your program run faster.
Button 0: Will restore the TRACE function.
Ctrl-C: Does it's normal thing.
DUMP TRACER
New comma SIZE (S)
ZAP (Z)
DUMP (D)
After a program stops for any reason "D" will list, in order used, the last line
numbers and statements that were executed. If D is followed by a number only
that many lines will be displayed. (You can only dump up to the amount of space
set aside by the "S" option) PR#1 will work normally with DUMP.
If you change your program in any way the dump buffer will be cleared, thus if
you are going to DUMP then you should do it immediatly after exdon't want the
buffer cleared when you run a program type "RUN 10" (or whatever the first line
in the program is)
While you are DUMPing you may use the following:
Left & Right arrows: Will control the direction of the dump, however it is
pretty hard to understand while going backwards.
Ctrl-S: Does the same thing it has always done.
Space bar: Will single step through a DUMP.
Ctrl-C: Halts a DUMP.
SIZE (S)
Type "S" followed by a number to specify how many lines you want to be stored.
Each line in the buffer eats 2 bytes of memory. You cannot specify a SIZE
smaller than 5. If you want only 5 lines in the buffer you need only type "S".
Anytime you use SIZE all of your variables are cleared, and you will also need
to run your program again before DUMP will work.
Note: The buffer is above HIMEM, when you use SIZE, HIMEM is changed.
ZAP (Z)
This will clear the dump buffer. If you do not ZAP before typing "RUN FILENAME",
you will get meaningless garbage next time you DUMP.
commands: BREAK IF...
BREAK ON...
BREAK AT...
BREAK LIST
BREAK +
BREAK -
Typing "BREAK:" or "B:" followed by a number 1-8 will set up a breakpoint.
Sample program:
5 TEXT:HOME
10 X=INT(RND(1)*20)
20 PRINT X
30 IF X+2 THEN PRINT CHR$(7): GOTO 10
40 IF NOT INT(RND(1)*200) THEN 10
50 PRINT "END":END
Sample breakpoints:
B1: IF X=10
B2: ON GOTO
B8: AT 20,10
BREAK IF...
The first breakpoiogram to stop anytime X=10. When X does equal ten then the
following will appear:
BREAKPOINT 1: IF X=10
BREAK IN 20
The first line tells you what made the program stop, the second is the next
statement executed after the break occured.
BREAK ON...
The second breakpoint will stop the program the first time a statement beginning
with GOTO. This breakpoint will stop the program at line 30
BREAK AT...
The third breakpoint will halt the program the 10th time a statement in line e
were two statements, seperated by a colon, in line 20, then the 5th time the
program reached line 20 the program would stop. If the breakpoint was set up as
"B8: AT 20" then the first time line 20 was encountered the program would break.
BREAK LIST (BLIST)
This will list all breakpoints that are currently in memory. A "+" will indicate
an active breakpoint, and a "-" will denote an inactive one. To list one
breakpoint, 2 for example, type "B2LIST".
BREAK- (B-)
To deactivate all breakpoi"B-" to deactivate only one, say 4, type "B4-".
BREAK+ (B+)
"B+" will activate all breakpoints. You can use the same method to activate only
one as you do deactivate one breakpoint.
After a breakpoint does it's job you can continue the program with "CONT". If
the program stopped with a BREAK IF... or BREAK ON... then you will need to
deactivate that breakpoint or change the condition, or the program will stop
immediatly after you restart it. Do not, however, change the program.
Breakpoints slow the program down considerably. However, BREAK ON and BREAK AT
won't slow down a program much at all.
that breakpoint or change the condition, or the program will stop immediatly
after you restart it. Do not, however, change the program.
-END- MISSING TEXT AT END