home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
robot-pd
/
12400.ZIP
/
12400B.DSK
/
manual09.txt
< prev
next >
Wrap
Text File
|
1998-04-30
|
6KB
|
190 lines
═
╩C H A P T E R E I G H TΩ
╩8.1 ASSEMΩ
╩SyntaxΩ:╔ASSEM <source file path> <dest file path>Θ
Scans through the source file and generates an HAL machine
code program from the contents. The resulting code will
then be written into the destination file.
╩8.1.2 The HAL MicroprocessorΩ
This is a software implemented tutorial microprocessor. It
has the following features:-
1.Four internal registers:A(accumulator),IX(index), SP(st-
ack pointer) and PC(program counter).
2.It is a 10 bit microprocessor. That is to say, it can
handle data in the range 0-1023.
3.All arithmetic results are placed in the accumulator.
4.Address range is the same as data range ie; 10 bits.
5.Port address range is 0-255.
╩8.1.3 The HAL Assembler LanguageΩ
In the following list, the following terms apply:-
<source> : Can be one of:-
<number> - A numeric value in the range 0..1023
@<number>- The contents of memory location whose address
is the same as the given number
^<number>- The contents of the given I/O port.
A - Contents of accumulator
SP - Contents of stack pointer
IX - Contents of index register
IX <num> - Contents of memory location, whose address is
the same as (IX + <num>)
<dest> : Can be:-
@<number>- Put result in given memory address.
^<number<- Put result in given port.
A - Put result in accumulator
SP - Put result in stack pointer
etc.
<cond.> : Can be one of:-
Z - Return true if the last arithmetic operation resulted
in a zero value.
C - Return true if the last arithmetic operation generated
a carry.
M - True if the last arithmetic operation produced a
negative result.
The possible commands are then:-
LD <dest>,<source> - Move data from one location to
another.
PUSH <source> - Place data onto machine stack. The stack
pointer will move down once after this operation.
POP <dest> - Retrieve data from stack, SP moves up before
the data is retrieved.
{SP can be thought of as pointing to the next "free" entry
on the stack. It starts at an initial value of 1023.}
ADD <source>,<source> - Add the two items and put the
result into the accumulator.
SUB <source>,<source> - As above but subtract.
CP <source>,<source> - Perform a subtraction but discard
the result. This instructions allows comparisons to be
made between numbers.
JP <source> - Jump to a different memory location
JPC <cond.>,<source> - If the given condition is TRUE,
jump to the given location.
CALL <source> - Call a subroutine at location given.
CALLC <cond.>,<source>
RET - Return from subroutine.
RETC <cond.>
Later versions may also support the following:-
ROTR <source> - Rotate source right, placing result in
accumulator.
ROTL <source> - Rotate left.
AND <source>,<source> - Place result of logical operation
in accumulator.
XOR and OR are also supported.
╩8.1.4 Port I/O SignalsΩ
Port 0 is the control register. The value sent to this
port will determine the function to be carried out:-
001-Output character whose ASCII code has previously been
sent to port 1. The code sent to port 1 will be forced to
ASCII range by ADDing it with 255.
002-Read keyboard and place code of character pressed at
port 1. A value of zero at port 1 indicates that no key
was pressed.
003-Change screen mode. The value at port 2 is modified to
suit the range 0..2 by taking it MOD 3.
004-Move cursor to given column. The column number is sent
to port 1 as normal, but is not forced into range by the
port controller.
005-As above, but move cursor to given column.
╩8.1.5 Numbers In Source CodeΩ
A <number> may be given in the following forms:-
[╤#±]<decimal digits> - Decimal form of number.
{&}<Hexadecimal digits> - Hexadecimal form of number.
%<binary digits> - Binary form of number.
'<character>' - ASCII code of character. Any character may
appear between the single quotes.
<label name> - The value of the given label.
╩8.1.6 Assembler CommandsΩ
EQU <number> - Set the last label to hold the given number
DEFB ++<number> - Enter a list of bytes into the source
code at the current position.
DEFM '<string>' - Store the given string in the code.
╩8.2 Monitor CommandsΩ
╩Format:Ω MONITOR <file path>
The given <file path> points to the object code produced
by the assembler program.
╩8.2.1 Control KeysΩ
`P' - Change address stored in the program counter (PC).
This is the address of the next instruction to be executed
by the CPU.
`M' - Modify memory. Values can be placed into memory
using this option. To finish the operation, press [RETURN]
on a blank line.
`R' - Run object code from next instruction. In this
execution mode, MONITOR will display the contents of the
CPU registers, and the memory that they point to. This is
the slowest method of running code-it also affects screen
displays.
`G' - Execute object code from next instruction. In this
execution mode, the CPU is being emulated at it's highest
possible speed. On average the CPU can execute three
instructions each second.
` ' - Execute the next instruction only, in ╔RΘUN mode.
`D' - Disassemble memory.
In several of the above cases, you will be asked for a
memory address. Hexadecimal numbers have to be prefixed by
`&' or `&H'. Binary numbers have to be prefixed by `&X'.
The `R' and `G' options can be terminated by holding down
[CONTROL + [SPACE]]╒
M <source file path> <dest file path>Θ
Sca