ECHO START 0
    LDA #3643
    STA number
    JSUB char
    JSUB nl
    JSUB char 
    JSUB nl    
    +LDA #test_niz
    JSUB string
    JSUB nl
    LDA number
    JSUB num
    JSUB nl
    LDA #23
    JSUB num
    JSUB nl
HALT J HALT
    END ECHO

.izpis znaka
char WD #1
     RSUB

.izpis newline
nl  +STA old_A
    CLEAR A

    LDCH newline
    WD #1
    
    +LDA old_A
    RSUB

.izpis niza
string   +STA strptr
loop_niz CLEAR A
         LDCH @strptr
         WD #1
         COMP #0
         JEQ out
         +LDA strptr
         ADD #1
         +STA strptr 
         J loop_niz 
out  RSUB
    
.desetiski izpis stevila v A iz HEX
.stevke pridobimo z mod 10, shranimo v tabelo, nato tabelo izpisemo v obratnem vrstnem redu
num     LDX digits_ix
        STA number
        DIV #10
        STA quot
        MUL #10
        STA subtrahend
        LDA number
        SUB subtrahend
        STCH digits, X
        LDA digits_ix
        ADD #1
        STA digits_ix
        LDA number
        DIV #10
        COMP #0
        JGT num
        .shrani stevec za X register in pa mejo len za naslednjo zanko loop_num        
        LDA digits_ix
        STA len
        SUB #1
        STA digits_ix
        .izpis tabele v obratnem vrstnem redu
loop_num  LDX digits_ix
          LDCH digits, X
          ADD #48 .stevke v ascii se zacnejo pri 48
          WD #1
          LDA digits_ix
          SUB #1
          STA digits_ix
          LDA i
          ADD #1
          STA i
          COMP len
          JLT loop_num
          
          LDX #0
          LDA #0
          STA digits_ix
          STA i
          STA len
          LDA number
          RSUB 

old_A WORD 0 
newline BYTE 10
test_niz BYTE C'hello world'
         BYTE 0
strptr WORD 0
quot WORD 0
subtrahend WORD 0
number WORD 0 
digits RESB 100
digits_ix WORD 0 
i WORD 0
len WORD 0 
