# Tool Tips

### Instruction Information:

• Each line is independent and self-contained, and may be blank, an instruction, or a storage directive
• All delimiters are the space character
• Instructions are for an accumulator machine
(left argument and result are in an implicit accumulator ACC register, except for COPY),
with the following format XXX arguments XXX is the reserved instruction name, required,
in upper case arguments as needed separated by spaces additional optional label can start
any instruction (label:), just one label per line at most instructions (# arguments, meaning)

ADD, DIV, MULT, WRITE, LOAD, SUB can take either variable or immediate value as the arg: immediate value is positive integer or negative integer

PUSH/POP are only means to reserve/delete automatic storage. STACKW/STACKR n - these are stack write/read instructions. n must be a non-negative number, and the access is to nth element down from TOS, top of stack NOTE: tos points to the topmost element on the stack Storage directives XXX val XXX is a name val is the initial value all storage and ACC size are signed 2 bytes Storage name and label are all names starting with latter and following with letters and digits up to eight total

### Instuctions:

    • ADD (1, ACC = ACC +arg)

     • BR (1, jump to arg)

     • BRNEG (1, jump to arg if ACC < 0)

     • BRZNEG (1, jump to arg if ACC <= 0)

     • BRPOS (1, jump to arg if ACC > 0)

     • BRZPOS (1, jump to arg if ACC >= 0)

     • BRZERO (1, jump to arg if ACC == 0)

     • COPY (2, arg1 = arg2)

     • DIV (1, ACC = ACC / arg)

     • MULT (1, ACC = ACC * arg)

###

     • READ (1, arg=input integer)

     • WRITE (1, put arg to output as integer)

     • STOP (0, stop program)

     • STORE (1, arg = ACC)

     • SUB (1, ACC = ACC - arg)

     • NOOP (0, nothing)

     • LOAD (1, ACC=arg)

     • PUSH (0, tos++)

     • POP (0, tos–)

     • STACKW (1,stack[tos-arg]=ACC)

     • STACKR (1,ACC=stack[tos-arg])