Test10   START   1000
. Print number 3
FIRST    LDA     K3
         STA     N1
         JSUB    PNUM
. Print a star (*)
         LDA     STAR
         STA     C1
         JSUB    PCH
. Print number 7
         LDA     K7
         STA     N1
         JSUB    PNUM
. Print an equal sign (=)
         LDA     EQUAL
         STA     C1
         JSUB    PCH
. Print the result of multiplication
         LDA     K3
         MUL     K7
         STA     N1
         JSUB    PNUM
. New line
         LDA     NEWLINE
         STA     C1
         JSUB    PCH
. This is the end of the main program
K3       WORD    3
K7       WORD    7
STAR     BYTE    c'*'
EQUAL    BYTE    c'='
.
. Subroutine for printing a byte
. Input: N1
. Current limitation: the number must be smaller than 100.
PNUM     STL     RETADR
         LDA     N1
         DIV     K10
         ADD     K48
         STCH    C1
         JSUB    PCH
. Now print the second digit
         LDA     N1
LOOP     COMP    K10
         JLT     DIGIT2
         SUB     K10
         J       LOOP
DIGIT2   ADD     K48
         STCH    C1
         JSUB    PCH
         LDL     RETADR
         RSUB
N1       RESW    1
K10      WORD    10
K48      WORD    48
RETADR   RESW    1
.
. Subroutine for printing a character
. Input: C1
PCH      TD      OUTDEV
         JEQ     PCH
         LDCH    C1
         WD      OUTDEV
         RSUB
. 
. Constants
.
OUTDEV   BYTE    x'06'
C1       RESW    1
NEWLINE  BYTE    x'00'
         END     FIRST
