HP Dev Assmebly Syntax

Standard syntax

SASM syntax

Standard syntax

This assembly syntax is used while compiling a Assembly function.

Main points

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)

?B=A.f
?C=B.f
?A=C.f
?C=D.f
?B#A.f
?C#B.f
?A#C.f
?C#D.f
?A=0.f
?B=0.f
?C=0.f
?D=0.f
?A#0.f
?B#0.f
?C#0.f
?D#0.f
?A>B.f
?B>C.f
?C>A.f
?D>C.f
?A<B.f
?B<C.f
?C<A.f
?D<C.f
?A>=B.f
?B>=C.f
?C>=A.f
?D>=C.f
?A<=B.f
?B<=C.f
?C<=A.f
?D<=C.f
?A=B.f
?B=C.f
?C=A.f
?D=C.f
?A#B.f
?B#C.f
?C#A.f
?D#C.f
?B>A.f
?C>B.f
?A>C.f
?C>D.f
?B<A.f
?C<B.f
?A<C.f
?C<D.f
?B>=A.f
?C>=B.f
?A>=C.f
?C>=D.f
?B<=A.f
?C<=B.f
?A<=C.f
?C<=D.f
GOTOL Label
GOLONG Label
GOVLNG Label
GOSUBL Label
GOSBVL Label
A+B.f
B+C.f
C+A.f
D+C.f
A+A.f
B+B.f
C+C.f
D+D.f
B+A.f
C+B.f
A+C.f
C+D.f
A=0.f
B=0.f
C=0.f
D=0.f
A=B.f
B=C.f
C=A.f
D=C.f
B=A.f
C=B.f
A=C.f
C=D.f
ABEX.f
BCEX.f
ACEX.f
CDEX.f
A-B.f
B-C.f
C-A.f
D-C.f
B-A.f
C-B.f
A-C.f
C-D.f
A=B-A.f
B=C-B.f
C=A-C.f
D=C-D.f
ASL.f
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HEX
SETDEC
RSTK=C
C=RSTK
CLRST
C=ST
ST=C
CSTEX
P+1
P-1
A&B.f
B&C.f
C&A.f
D&C.f
B&A.f
C&B.f
A&C.f
C&D.f
A!B.f
B!C.f
C!A.f
D!C.f
B!A.f
C!B.f
A!C.f
C!D.f
RTI
A+Expression.f
B+Expression.f
C+Expression.f
D+Expression.f
A-Expression.f
B-Expression.f
C-Expression.f
D-Expression.f
GOINC label
COINA label
G5 label
G4 label
G3 label
G2 label
GOIN5 label
GOIN4 label
GOIN3 label
GOIN2 label
D1+Expression
D0+Expression

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.

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.

Skips

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.

But let's show an example.

The Followin text is compile as..
This
SKIP
{ instruction
}
GOTO l1
instructions
*l1
SKIPC { ... }
GOC l1 ... *l1
SKIPNC { .. }
GONC l1 ... *l1
{ ... }
...

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.

The Followin text is compile as..
This
{
    UP
    EXIT
}
*Begining
GOTO Begining
GOTO End
*End

Normaly, you might be able now to understand the whole SKIP concept.

Let's introduce then all the diferents posibilities to do a SKIP.

and for UPs and EXITs.

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.

Others instructions

Compilation Directives

SASM like syntax

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.