This assembly syntax is used while compiling a Assembly function.
You can put as many instruction as you want per lines.
You can put instruction whereever you want in each line.
Comments begin with a '%' character and edn at the end of the line.
Labels are declared by a '*' character.
When using a Saturn instruction of the folowing format: Register=Register... (where Register can be either A, B, C, D, P, D1 or D0). you can omit the Register=. Example: A=A+5 is equivalent to A+5.
To increase redability, you can separate the field of the instruction from the instruction by a '.' char. Example A+5.A
Instruction list.
f is a field (A, B, M, P, S, W, X, XS, WP)
x is an expression between 0 and 15 or 1 and 16 (depending of the instruction and the !0-15 flag)
|
|
|
|
|
Notes:
GOINC and GOINA are compiled as LC(5) Label-& and LA(5) Label-&
GOINx and Gx are compiled as $(5) label-&
For, Rx register access and RSRB instructions, if you use the W field, the dedicated instructinon is used.
For Reg=Reg+Expression instructions, Reg must be within the -256 +256 range.
If Expression is greater than 16 or -16, multiple instructions are generated.
If Expression is < 0, the sign of the instruction is inverted. For example, A+0-5.a will generate a A-5.a instruction.
HPDev will always generate the best instruction. For example, A+17.A will generate a A+16.A instruction (6 nibbles) and a A+1.A instruction (2 nibbles).
After a Jump, you must put a jump instruction. Normaly, it's a GOYES or a RTNYES instruction. with HP Dev syntax, you have others possibilities.
GOYES label
-> label (Idem GOYES)
RTNYES
RTY (Idem RTNYES)
GOTO label, GOTOL label, GOSUB lane, GOSUBL label, GOSBVL label, GOVLNG label.
In this cases, HP dev invert the jump and place the Jump. Example ?A=C.A GOTO foo will be compiled in ?A#C.A GOYES l1 GOTO lable *l1
Some Tests can not be inverted (test on HST). then, an error message will be generated.
The skips are a great thing first introduce in HP assembly by Cyrille de Brebisson in HP Masd.
The aim of the skip concept is to allow block programming (Link in Pascal oc C) in assembly. Then, your programs will be more easy to read, understand and debug.
There is two sort of skips.
The first type is well nomed, because it's really a something that will skip an other thing.
The second one allows to jump out of a skip block.
But let's show an example.
|
|
|
|
|
|
|
|
|
|
In the three first example, the aim of the skip is obvious, But what about the last one?
To understant the utility of the last type of skip, let's explain the second type of skips called UPs and EXITs.
|
|
|
|
Normaly, you might be able now to understand the whole SKIP concept.
Let's introduce then all the diferents posibilities to do a SKIP.
SKIP -> GOTO
SKUB -> GOSUB
SKUBL -> GOSUBL
SKC -> GOC
SKNC -> GONC
{ -> Nothing
{ After a test (?A=C.A { ... }) replace a GOYES.
-> { After a test (?A=C.A { ... }) invert the test and replace a GOYES (the example on the right will be compile as ?A#C.A GOYES l1 ... *l1).
CODE { ... } -> $(5) DoCode $(5) End-& ... *End (Usefull when including an object in an Assembly code)
STRING { ... } -> Idem but with a DoString.
and for UPs and EXITs.
UP -> GOTO Begining of the block
UPC -> GOC Begining of the block
UPNC -> GONC Begining of the block
EXIT -> GOTO end of the block
EXITC -> GOC end of the block
EXITNC -> GONC end of the block
EXIT after a test -> GOYES begining of the block
UP after a test -> GOYES endof the block
Then, let's add some new features for UPs and EXITs. UPn and EXITn.
This can be usefull if you include a block in an other block. The aim ot this thing is to be able from an internal block to jump to the begining or the end of an upper block. To Use this, you just need to put after the Up or Exit the number of block you want to jump out. UP2 will jump to the begining of the block including the current block (UP1 is equivalent to UP).
Example:
SKC
{ A=DAT1.A D1+5 ?A#0.A { C=DAT0.A D0+5 ?C=0.A UP2 C-1.A UPNC C=DAT0.A ?A=C.A EXIT2 } UP } |
GONC End1
*Beg1 A=DAT1.A D1+5 ?A#0.A GOYES End2 *Beg2 C=DAT0.A D0+5 ?C=0.A GOYES Beg1 C-1.A GONC Beg2 C=DAT0.A ?A=C.A GOYES End1 *End2 GOTO Beg1 *End1 |
Let's finish with the SKIPs. Now introducing the SKIPELSE feature!
After the closing barcklet of a SKIP, you can put a SKIPELSE instruction and then a new block opening.
?A=C.B { ... } SKIPELSE {...} -> ?A=C.B GOYES l1 ... GOYES l2 *L1 ... *L2
That's a ELSE (or something like that!)
Note: the EXITs you will put in the first block will jump to the end of the second block.
You can use SKEC and SKENC SKLSE to compile GOC and CONC or nothing instead of the GOTO.
$(x) Expression -> put the result of the expression on x nibble in the output file.
$Hexa -> Put directly the Hexa datas in the output file.
$/Hexa -> Put directly the Hexa datas in the output file but in inverted mode (the last nible first).
/FileName -> Include the datas in the file directly in the output file.
óASCIIó (Alt 162 character) put the ascii in the output file.
!0-15 Pass to the 0-15 mode. Then, numbers between 0 and 15 are expected for P=, ST= and ABIT= like instructions.
!1-16 Pass to the 1-16 mode. Then, numbers between10 and 16 are expected for P=, ST= and ABIT= like instructions.
!SASM pass in SASM syntax
!RPL pass in RPL mode
On the SASM syntax, every tocken begining at the begining of the line is a label.
The instruction start anywhere after the first character.
Comments are placed after instructions or after a ';' character.
Instructions folows the same rules that HP dev syntax.