464 lines
12 KiB
Plaintext
464 lines
12 KiB
Plaintext
|
|
2. Moving Text
|
|
|
|
There are also methods of moving the text itself, when in the cursor
|
|
mode. The direction, in which the text moves, is set by pressing the '+'
|
|
key (a forward direction) or the '-' key (a backward direction) prior to
|
|
pressing the L, P, or A keys.
|
|
|
|
A) The L key will move the text up or down one line.
|
|
|
|
B) The P key will move the text up or down one full page.
|
|
|
|
C) The A key will set the text in continuous scrolling motion.
|
|
|
|
You can move to the beginning or end of the text by pressing the Esc key
|
|
first and then the '-' key or the '+' key respectively.
|
|
|
|
3. Deleting Text
|
|
|
|
This function deletes text from the screen and the memory if the Apple,
|
|
but not from the disk. There are three methods of deleting text:
|
|
|
|
A) Ctrl-D Any character may be deleted by positioning the cursor over
|
|
the character and pressing Ctrl-D.
|
|
|
|
B) Ctrl-G Any line, or portion of a line, may be deleted by positioning
|
|
the cursor over a character and pressing Ctrl-G. This will delete the
|
|
character and the rest of the line that follows it.
|
|
|
|
C) Esc Ctrl-Z All of the text, presently in the text-editor may be
|
|
deleted by pressing Esc and then Ctrl-Z. You will have to confirm the
|
|
command by pressing the # key. This protects against accidental
|
|
erasures.
|
|
|
|
4. Block Operations
|
|
|
|
This function allows you to mark a portion of the current source code,
|
|
and then manipulate that block to another place in the file. You must
|
|
designate the beginning and the end of a block by placing block markers
|
|
at those two points. To insert a block marker immediately after the
|
|
cursor, press Ctrl-V to mark the beginning and end of th block, and it
|
|
will be represented on the screen by a flashing ')' sign. Only one block
|
|
can exist in a file at any one time and any attempt to insert a block
|
|
mark when a block has already been defined will result in the error
|
|
message "BLOCK ALREADY MARKED".
|
|
|
|
When a block is marked, press Esc V and the block options will be
|
|
displayed on the bottom of the screen. They are Copy, Delete, and
|
|
Unmark.
|
|
|
|
To copy a block, move the cursor to the location in the file where you
|
|
want to insert the copy of the block and press C. This is a
|
|
non-destructive copy.
|
|
|
|
To delete a block. Pressing D will remove the block and the block
|
|
markers from memory.
|
|
|
|
To unmark the block press U. You may also remove markers with normal
|
|
delete commands. Remember, these changes only exits in the memory and
|
|
not on the disk.
|
|
|
|
5. Find Operations
|
|
|
|
Fo find all occurrences of a word or phrase in a file, use the find
|
|
command. Press Ctrl-F and you will be prompted wit the "FIND:>" message.
|
|
At this point, type in the word or phrase you wish to locate and press
|
|
return.
|
|
|
|
The first occurrence of the word or phrase will be displayed in the
|
|
center of the screen. To find all subsequent occurrences press Ctrl-F
|
|
and Return.
|
|
|
|
You need not enter the word each time, the search will always begin at
|
|
the current cursor location and search in the direction that the
|
|
indicator in the lower left corner of the screen shows.
|
|
|
|
6. Printing Source Code Files
|
|
|
|
To print the source code on a printer, press Ctrl-P. The screen will
|
|
prompt you to type in the printer slot number. Once this has been done,
|
|
and the RETURN key has been pressed, the text will print out.
|
|
|
|
7. Adding Text
|
|
|
|
Position the cursor to where you want to begin adding text and enter the
|
|
add mode by pressing Ctrl-A. To return from add mode to cursor mode,
|
|
press Esc twice.
|
|
|
|
8. Loading files
|
|
|
|
To load a file into memory which was previously saved on disk press
|
|
Ctrl-L. The loading operation works similar to loading any other file.
|
|
|
|
9. Saving Files
|
|
|
|
To save a file on disk, press Ctrl-S. Use the space bar to select the
|
|
file name from disk, or type one in. Press RETURN when done.
|
|
|
|
10. Entering the Assembler
|
|
|
|
To save the current robot program and enter the assembler, press Ctrl-R.
|
|
This will save the text as it appears in the memory on the disk, and
|
|
then exit the text-editor to the assembler. Before a robot can be
|
|
assembled, it must have been given a name by being saved to disk.
|
|
|
|
The Assembler
|
|
|
|
The Assembler translates source code programs into robot-understandable
|
|
object code. It also checks for errors in the source code and displays a
|
|
message if one is found.
|
|
|
|
The assembler can be entered from the Main Menu by selecting option 2,
|
|
or from the editor by pressing Ctrl-R. If the assembler is entered from
|
|
the editor, a robot source program is loaded and ready to assemble.
|
|
|
|
It is possible to assemble a robot from source code on the disk, or load
|
|
an assembled robot from disk to test. There is also an option to print
|
|
the assembled robot on the printer.
|
|
|
|
Assembly Errors
|
|
|
|
There are eight errors that the RobotWar assembler can detect. When the
|
|
assembler detects an error it will display a message such as:
|
|
|
|
NO DATA FIELD IN LINE 27
|
|
|
|
10 + TO C
|
|
|
|
^
|
|
|
|
|
|
The error message indicates the type of error, the program line number
|
|
and the position in the line (^) where it occurred. Following are the
|
|
possible error messages:
|
|
|
|
1. NO DATA FIELD - There is no register or number after a command.
|
|
|
|
2. UNKNOWN ITEM - You have tried to use a register or a label that is
|
|
not defined.
|
|
|
|
3. LARGE NUMBER - You have tried to store a number greater than 1,024,
|
|
or less than -1,024 into a register.
|
|
|
|
4. PROGRAM TOO LONG - Program is too big for the allotted program
|
|
storage area. Programs have a maximum length of 256 object code
|
|
instructions.
|
|
|
|
5. FATAL JUNK - You have included something that the computer cannot
|
|
understand, like an illegal statement.
|
|
|
|
6. STORE IN NUMBER - You have tried to store a value in a number instead
|
|
of a register.
|
|
|
|
7. RESERVED LABEL - You have tried to use a register name as a label.
|
|
|
|
8. NO PROGRAM CODE - There are no instructions in the program. Object
|
|
Code Exercise
|
|
|
|
The following pages list the object code's commands and registers and
|
|
the translation of the sample robot's source code. Using the list and
|
|
the two codes for the sample robot, compare and identify the source code
|
|
and it's object code translation. It will be very useful to understand
|
|
the object code when learning to use the test bench in the next
|
|
chapter.
|
|
|
|
List of Object Code Instructions
|
|
|
|
Instruction Action
|
|
|
|
, Load accumulator with next data item
|
|
|
|
IF Load accumulator with next data item
|
|
|
|
+ Add next data item to accumulator
|
|
|
|
- Subtract next data item from accumulator
|
|
|
|
* Multiply accumulator by next data item
|
|
|
|
/ divide accumulator by next data item
|
|
|
|
= Skips the next command unless the accumulator is equal to next
|
|
data item
|
|
|
|
> Skips the next command unless the accumulator is greater than the
|
|
next data item
|
|
|
|
< Skips the next command unless the accumulator is less than next
|
|
data item
|
|
|
|
# Skips the next command if the accumulator is equal to next data
|
|
item
|
|
|
|
TO Store accumulator in next dat item
|
|
GOTO Branch to the address given
|
|
GOSUB GOSUB to the address give
|
|
ENDSUB REturn from a subroutine
|
|
|
|
Assembly of Robot Sample
|
|
|
|
Code Building
|
|
==== ========
|
|
SCAN
|
|
0 , AIM
|
|
1 + 5
|
|
2 TO AIM
|
|
3 , AIM
|
|
4 TO RADAR
|
|
LOOP
|
|
5 IF RADAR
|
|
6 < 0
|
|
7 GOSUB FIRE
|
|
8 GOTO SCAN
|
|
FIRE
|
|
9 , 0
|
|
10 - RADAR
|
|
11 TO SHOT
|
|
12 ENDSUB
|
|
|
|
Code Statistics
|
|
=== ==========
|
|
140 Letters
|
|
13 Instructions
|
|
3 Labels
|
|
2 References
|
|
|
|
|
|
The Test Bench
|
|
|
|
The test bench is a micro-computer simulator of a robot. With the test
|
|
bench, you can monitor a robot's performance without actually putting it
|
|
on the battlefield. This simulator will prove an important device, as
|
|
you learn to debug robots, because it allows you to monitor the object
|
|
code and the contents of the registers.
|
|
|
|
Load a robot into the test bench by selecting option 2 from the
|
|
assembler menu or from the main menu.
|
|
|
|
Operating the Test Bench
|
|
|
|
As the test bench runs the program, each instruction (in object code)
|
|
will appear on the left side of the screen as it is executed. On the
|
|
right side of the screen are displayed the robot's position and register
|
|
contents. Also shown are the instruction number being executed (program
|
|
counter) and the accumulator.
|
|
|
|
Controlling the Test Bench
|
|
|
|
The test bench can be interrupted by pressing the space bar. Press the
|
|
space bar again to execute one more instruction. This can be useful when
|
|
analyzing a program to see if it is acting as you had planned. Pressing
|
|
RETURN will start the test bench running again. To change the speed of
|
|
the test bench, press a number from 0 to 9.
|
|
|
|
Simulating Radar
|
|
|
|
Pressing the R key will cause the radar display to light up and the
|
|
RADAR register will display a negative number to simulate an enemy robot
|
|
in view. This will allow your program to go into it's "enemy spotted"
|
|
routine.
|
|
|
|
Simulating Damage
|
|
|
|
Each time the G key is pressed, a random amount, up to 10% will be
|
|
subtracted from the DAMAGE register. This allows th program the
|
|
opportunity to use it's damage detection routine. The DAMAGE register
|
|
will also indicate damage if the simulated robot crashes into a wall.
|
|
The test bench will automatically stop when the DAMAGE register reaches
|
|
0.
|
|
|
|
Tracing Registers
|
|
|
|
The trace is used to check the contents of registers not normally
|
|
displayed on the test bench. Press the T key to access the tracer. The
|
|
test bench will stop, and the following question will be displayed:
|
|
"NAME REGISTER TO TRACE?" Enter the name of the register you want to
|
|
trace and press RETURN. The test bench will continue, with the contents
|
|
of the traced register displayed on the line above "X POSITION".
|
|
|
|
The Esc key will exit from the test bench.
|
|
|
|
Storing Robots
|
|
|
|
There is a limited amount of space on the RobotWar disk to store robot
|
|
files. However, robot files can be transferred to and from auxiliary
|
|
storage disks.
|
|
|
|
Auxiliary storage disks are used only to store robot files. Robot files
|
|
on auxiliary disks must be transferred back to the RobotWar program disk
|
|
before they can be tested, assembled, edited, or battled.
|
|
|
|
There is a utility in the menu to initialize a data disk. Only disks
|
|
initialized by RobotWar can be used as data disks.
|
|
|
|
To save or load a robot to or from a data disk simply remove the
|
|
RobotWar disk after entering the robot name and before pressing return.
|
|
After the file is loaded, swap the disks back again before continuing
|
|
with the program.
|
|
|
|
To delete a robot from a disk, exit to basic, and delete the file with
|
|
the DOS 3.3 command DELETE filename and press RETURN. When done, enter
|
|
PR#6 to re-start RobotWar.
|
|
|
|
Summary of Editor Keys Cursor Mode:
|
|
|
|
Moving keys
|
|
|
|
+ Set forward direction
|
|
|
|
- Set backward direction
|
|
|
|
Esc + Move to end of text
|
|
|
|
Esc - Move to beginning of text
|
|
|
|
A Sets text in continuous scrolling motion
|
|
|
|
RETURN Move cursor up one line
|
|
Esc RETURN Move cursor to top of page
|
|
|
|
/ Move cursor one line down
|
|
|
|
Esc / Move cursor to bottom of page
|
|
|
|
<- Move one space left
|
|
|
|
-> Move one space right
|
|
|
|
Esc -> Move cursor to right end of line
|
|
|
|
Esc <- Move cursor to left margin
|
|
|
|
P Move up or down one full page
|
|
|
|
L Move text up or down one line
|
|
|
|
Text deleting keys
|
|
|
|
|
|
Ctrl-D Delete the character at the cursor
|
|
|
|
Ctrl-G Delete the line at the cursor
|
|
|
|
Esc Ctrl-Z Delete the whole file
|
|
|
|
File handling keys
|
|
|
|
|
|
Ctrl-L Clear memory and load a source file
|
|
|
|
Ctrl-S Save text as a source file
|
|
|
|
Ctrl-R Save current file and enters assembler
|
|
|
|
Control keys
|
|
|
|
Esc Ctrl-Q Exits to main menu
|
|
|
|
Ctrl-F Executes FIND operation
|
|
|
|
Ctrl-P Prints file in memory
|
|
|
|
Ctrl-V Places block marker at cursor
|
|
|
|
Esc-V Displays block options
|
|
|
|
C-Copy block
|
|
|
|
D-Delete block
|
|
|
|
U-Remove block markers
|
|
|
|
Add Mode
|
|
|
|
Text adding keys
|
|
|
|
|
|
Ctrl-A Start adding text
|
|
Esc Esc Stop adding text
|
|
|
|
<- Backspace, erases as it goes
|
|
|
|
-> Moves text to the right
|
|
|
|
RETURN Acts as a carriage return
|
|
|
|
|
|
From the Assembler
|
|
|
|
Space Bar Stop the assembler or move it one step
|
|
RETURN Start the assembler operating again
|
|
|
|
0-9 Adjust the speed at which the assembler is
|
|
scrolling
|
|
|
|
From the Test Bench
|
|
|
|
RETURN Start the assembler operating again
|
|
|
|
0-9 Adjust the speed at which the assembler is
|
|
scrolling
|
|
|
|
R Simulate Radar
|
|
|
|
G Simulate a shell hit
|
|
|
|
T Trace a Register
|
|
|
|
Esc Exit the test bench
|
|
|
|
the DOS 3.3 command DELETE filename and press RETURN. When
|
|
done, enter PR#6 to re-start RobotWar.
|
|
|
|
Summary of Editor Keys
|
|
Cursor Mode:
|
|
|
|
Moving keys
|
|
|
|
+ Set forward direction
|
|
|
|
- Set backward direct
|
|
|
|
-END-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|