: 2swap pushsp 10 - ! pushsp 10 - ! pushsp 10 - ! pushsp 10 - ! pushsp 16 - @ pushsp 16 - @ pushsp 8 - @ pushsp 8 - @ ;

[izaya@nagato Documents]$ lua tsm2.lua $(echo : 2swap pushdsp 10 - ! pushdsp 10 - ! pushdsp 10 - ! pushdsp 10 - ! pushdsp 16 - @ pushdsp 16 - @ pushdsp 8 - @ pushdsp 8 - @ \; 1 noop 2 noop 3 noop 4 noop 2swap . . . . halt | lua tasm.lua) count pc ins opcode tos 0 1 129 im 1 0 1 2 1 noop 1 2 3 130 im 2 1 3 4 1 noop 2 4 5 131 im 3 2 5 6 1 noop 3 6 7 132 im 4 3 7 8 1 noop 4 8 9 149 im 21 4 9 10 1 noop 21 10 11 24 pushpc 21 11 12 133 im 5 11 12 13 4 add 5 13 14 22 pushr 16 14 15 20 jmp 21 15 21 25 pushdsp 4 16 22 138 im 10 16120 17 23 5 sub 10 18 24 19 storei 16110 19 25 25 pushdsp 3 20 26 138 im 10 16122 21 27 5 sub 10 22 28 19 storei 16112 23 29 25 pushdsp 2 24 30 138 im 10 16124 25 31 5 sub 10 26 32 19 storei 16114 27 33 25 pushdsp 1 28 34 138 im 10 16126 29 35 5 sub 10 30 36 19 storei 16116 31 37 25 pushdsp 0 32 38 144 im 16 16128 33 39 5 sub 16 34 40 18 loadi 16112 35 41 25 pushdsp 3 36 42 144 im 16 16126 37 43 5 sub 16 38 44 18 loadi 16110 39 45 25 pushdsp 4 40 46 136 im 8 16124 41 47 5 sub 8 42 48 18 loadi 16116 43 49 25 pushdsp 1 44 50 136 im 8 16122 45 51 5 sub 8 46 52 18 loadi 16114 47 53 23 popr 2 48 54 20 jmp 16 49 16 31 print 2 2.0 50 17 31 print 1 1.0 51 18 31 print 4 4.0 52 19 31 print 3 3.0 53 20 0 halt 0 breakpoint at 20.0 ret 0

imagine having dedicated call/jsr instructions
: jsr pushpc 5 + pushr jmp ;
: ret popr jmp ;
okay so my assembler now skips including unused words

time to write a standard library
Follow

@izaya what's the goal with this? Just wanted to write a stack machine?

Sign in to participate in the conversation
CleverLibre Social

CleverLibre Social is an inclusive social instance for open discussion, learning, and community.
All cultures welcome.
Hate speech and harassment strictly forbidden.