-
Notifications
You must be signed in to change notification settings - Fork 0
03. Writing a program
Davide Della Giustina edited this page Aug 17, 2020
·
1 revision
There are few, strict rules:
- There are two sections, the
.data
and.prgm
ones. Data section must come before the program section. - Labels are formatted as
&label
and followed by a=
sign if the data is on the same line (this can be done only in.data
section!). - Every instruction is formatted as follows:
instr: arg1, arg2, arg3
. Every instruction is made of 3 letters, followed by ans
if you want to update the flags (allowed only in operations that involve the ALU, ignored otherwise), followed by an optional conditional (two letters). There must be only one instruction per row. - You can recall a certain label (for using it in a
put
,set
,jmp
orcal
command) using the syntax$label
. - Comments can be written with a trailing
#
, but they cannot be placed at the end of a line (i.e. a line containing a comment must not contain also an instruction before the comment). - BE CAREFUL! When using the
put
command, the loaded address MUST be declared inside the.data
section.
For further details check the example programs in the programs
folder.