The table below describes the machine instruction set available with TINY.  Several symbols are used in the descriptions: ACC = contents of the accumulator, c(x) = contents of memory at address x, PC = value of Program Counter, SP = value of Stack Pointer, c(SP) = contents of memory at the address indicated by the SP register.

 

        Op Code         Mnemonic             Description

              00              STOP                      STOP execution of TINY program.

                                                                (Return control to the Operating System.)

 

              01              LD x                        LoaD accumulator with contents at the address

                                                                specified by operand 'x'.

                                                                ACC = c(x)

 

              02              LDI x                       LoaD (Indirect) accumulator with contents at the

                                                                address found in the memory location specified by 'x'.

                                                                ACC = c(c(x))

 

              03              LDA x                     LoaD Address specified by 'x' into accumulator.

                                                                ACC = x

 

              04              ST x                        STore contents of accumulator at address 'x'.

                                                                c(x) = ACC

 

              05              STI x                       STore (Indirect) contents of accumulator at the

                                                                address found in the memory location specified by 'x'.

                                                                c(c(x)) = ACC

 

              06              ADD x                    ADD contents at address 'x' to the accumulator.

                                                                ACC = ACC + c(x)

 

              07              SUB x                     SUBtract contents at address 'x' from the accumulator.

                                                                ACC = ACC - c(x)

 

              08              MUL x                    MULtiply contents at address 'x' to the accumulator.

                                                                ACC = ACC * c(x)

 

              09              DIV x                      DIVide contents of accumulator by the contents at 'x'.

                                                                ACC = ACC / c(x)

 

              10              IN                            INput a Character from the keyboard and place the

                                                                character's ASCII code into the accumulator.

                                                                ACC = ASCII of input character

 

              11              OUT                       OUTput the Character associated with the ASCII code

                                                                found in the accumulator.

 

              12              B x                           Branch (unconditionally) to address 'x'.

                                                                PC = x

 

              13              BP x                        Branch on Positive accumulator to address 'x'.

                                                                PC = x   if ACC > 0

 

              14              BN x                        Branch on Negative accumulator to address 'x'.

                                                                PC = x   if ACC < 0

 

              15              BZ x                        Branch on Zero accumulator to address 'x'.

                                                                PC = x   if ACC = 0

 

 

        Op Code         Mnemonic             Description

              16              JSB x                       Jump to SuBroutine whose address is specified by 'x'.

                                                                SP    = SP - 1

                                                                c(SP) = PC

                                                                PC    = x

 

              17              RSB                        Return from SuBroutine.

                                                                PC    = c(SP)

                                                                SP    = SP + 1

 

              18              PUSH                     PUSH contents of ACCUM onto stack.

                                                                SP    = SP - 1

                                                                c(SP) = ACC

 

              19              POP                        POP value off of stack and place in ACCUM.

                                                                ACCUM = c(SP)

                                                                SP    = SP + 1

 

Pseudo Operations:

 

                                DC ‘string’            Define Character string.  ASCII codes for characters within single quotation marks

                                                                are stored in consecutive addresses.

 

                                DB  n                      Define byte.  Places value of N in byte at current address.  (n must be numeric.)

 

                                DS  n                      Define Storage.  Reserves next N addresses for future use.  (n must be numeric.)

 

 

 

 

 

 

ROM routines:

 

        Address         Mnemonic             Description

            900              PRINTN                 Converts current integer value in ACC to ASCII characters and outputs the result.

 

            925              PRINTC                 Outputs ASCII characters contained in memory at the location specified by ACC.

                                                                Output continues until a ‘zero-byte’ is detected!

 

            950              INPUTN                 Execution pauses to accept a numeric value from the user.  The input is converted to

                                                                decimal format and stored in ACC.

 

            975              INPUTC                 Execution pauses to accept ASCII text from the user.  The input is stored in memory

                                                                beginning with the address specified by ACC.  A trailing ‘zero-byte’ will be

                                                                appended to the end of the ASCII string.