sample.ums (1611B)
1 ; sample file - comments are prepended with a semicolon 2 ; bsd licence, you know the drill 3 4 ;cmov 1 2 3 5 ;arri 1 8 15 6 ;orth 5 493028 7 8 ;orth 1 'b' 9 ;orth 2 's' 10 ;orth 3 'a' 11 ;orth 4 'n' 12 ;orth 5 10 ; LF 13 14 orth 0 64 ; register #0 is 64 15 allo 1 0 ; allocate 64 bytes, write allocated array id to #1 16 orth 0 0 ; register #0 is 0 17 orth 3 1 ; register #3 is 1 18 orth 2 'b' ; register #2 is symbol 'b' 19 arra 1 0 2 ; array of id from #1 at offset from #0 is set to value from #2 ('s') 20 add 0 0 3 ; register #0 is incremented by #3 (that is 1) 21 orth 2 's' ; 22 arra 1 0 2 ; array second element is set to 's' 23 add 0 0 3 ; register #0 += 1 24 orth 2 'a' ; 25 arra 1 0 2 ; 26 add 0 0 3 ; 27 orth 2 'n' ; 28 arra 1 0 2 ; 29 add 0 0 3 ; 30 orth 2 'd' ; 31 arra 1 0 2 ; 32 add 0 0 3 ; 33 orth 2 'r' ; 34 arra 1 0 2 ; 35 add 0 0 3 ; 36 orth 2 'o' ; 37 arra 1 0 2 ; 38 add 0 0 3 ; 39 orth 2 10 ; \n symbol 40 arra 1 0 2 ; by now the array from #1 is set to string "bsandro" 41 add 0 0 3 ; and register #0 is set to that string length with \n included 42 43 ; now to actually print this 44 orth 4 0 ; register #4 is set to 0 45 arri 2 1 4 ; read into #2 from array in #1 with offset of #4 46 outp 2 ; print value from #2 ('b') 47 add 4 4 3 ; array #4 value is incremented by value from #3 (that is 1) 48 arri 2 1 4 ; 49 outp 2 ; print 's' 50 51 add 4 4 3 52 arri 2 1 4 53 outp 2 ; 'a' 54 add 4 4 3 55 arri 2 1 4 56 outp 2 ; 'n' 57 add 4 4 3 58 arri 2 1 4 59 outp 2 ; 'd' 60 add 4 4 3 61 arri 2 1 4 62 outp 2 ; 'r' 63 add 4 4 3 64 arri 2 1 4 65 outp 2 ; 'o' 66 add 4 4 3 67 arri 2 1 4 68 outp 2 ; '\n' 69 70 aban 1 ; free array from #1 71 inp 2 ; read symbol from standard input 72 outp 2 ; mirror whatever was read 73 74 halt