27 ;assuming that no more than 42 instr are used
32 .fill 1, 0xE701FFFC;ldw r0, 0-4(r3)
33 .fill 1, 0xEB00000A;ret+
36 .fill 1, 0xE1998020;subi r3, r3, 4
37 .fill 1, 0xe7318000;ldw r6, 0(r3)
38 .fill 1, 0xe739fffc;ldw r7, 0-4(r3)
39 .fill 1, 0xed400004;ldis r8, 0
40 .fill 1, 0xe1038000;mov r0, r7
41 .fill 1, 0xe2800008;andx r0, 1
42 .fill 1, 0x00443001;adddnz r8, r8, r6
43 .fill 1, 0x01bb8008;subinz r7, r7, 1
44 .fill 1, 0x113b8000;addizs r7, r7, 0
46 .fill 1, 0x00443001;adddnz r8, r8, r6
47 .fill 1, 0x00443001;adddnz r8, r8, r6
48 .fill 1, 0xe1bb8010;subi r7, r7, 2
49 .fill 1, 0x0b7ffe83;brnz+ loop
50 .fill 1, 0xe7c1fffc;stw r8, 0-4(r3)
53 .fill 1, 0xed400004;ldis r6, CONST
54 .fill 1, 0xe7b18000;stw r6, 0(r3)
55 .fill 1, 0xe1198020;addi r3, r3, 4
58 .fill 1, 0xe1998020;subi r3, r3, 4
59 .fill 1, 0xe7318000;ldw r6, 0(r3)
60 .fill 1, 0xe739fffc;ldw r7, 0-4(r3)
61 .fill 1, 0xe03bb000;add r7, r7, r6
62 .fill 1, 0xe7b9fffc;stw r7, 0-4(r3)
65 .fill 1, 0xe1998020;subi r3, r3, 4
66 .fill 1, 0xe7318000;ldw r6, 0(r3)
67 .fill 1, 0xe739fffc;ldw r7, 0-4(r3)
68 .fill 1, 0xe0bbb000;sub r7, r7, r6
69 .fill 1, 0xe7b9fffc;stw r7, 0-4(r3)
72 .fill 1, 0xe1998020;subi r3, r3, 4
73 .fill 1, 0xe7318000;ldw r6, 0(r3)
74 .fill 1, 0xe739fffc;ldw r7, 0-4(r3)
75 .fill 1, 0xed400004;ldis r8, 0
76 .fill 1, 0xec3b0000;cmp r7, r6
77 .fill 1, 0xbd4007fc;ldislt r8, 0xFF
78 .fill 1, 0xe7c1fffc;stw r8, 0-4(r3)
81 .fill 1, 0xe731fffc;ldw r6, 0-4(r3)
82 .fill 1, 0xe7b18000;stw r6, 0(r3)
83 .fill 1, 0xe1198020;addi r3, r3, 4
86 .fill 1, 0xe1998020;subi r3, r3, 4
87 .fill 1, 0xe7318000;ldw r6, 0(r3)
88 .fill 1, 0xecb00000;cmpi r6,0
90 .fill 1, 0xbb000103;breq- vm_next
91 .fill 1, 0xeb000003;br+ #CONST
94 .fill 1, 0xed400000;ldil r6, CONST
95 .fill 1, 0xed400002;ldih r6, CONST
96 .fill 1, 0xe7b18000;stw r6, 0(r3)
97 .fill 1, 0xe1198020;addi r3, r3, 4
100 .fill 1, 0xe1998020;subi r3, r3, 4
103 .fill 1, 0xe731fffc;ldw r6, 0-4(r3)
104 .fill 1, 0xe739fff8;ldw r7, 0-8(r3)
105 .fill 1, 0xe7b1fff8;stw r6, 0-8(r3)
106 .fill 1, 0xe7b9fffc;stw r7, 0-4(r3)
109 .fill 1, 0xe731fffc;ldw r6, 0-4(r3)
110 .fill 1, 0xe4b7fffa;not r6
111 .fill 1, 0xe7b1fffc;stw r6, 0-4(r3)
115 ;set address of input
116 ldil r1, inputdata@lo
117 ldih r1, inputdata@hi
119 ;set address of program start
120 ldil r2, prog_start@lo
121 ldih r2, prog_start@hi
123 ;set address to instruction table
124 ldil r3, instrtable@lo
125 ldih r3, instrtable@hi
127 ;set address to defer table
128 ldil r9, instrtable@lo
129 ldih r9, instrtable@hi
135 ;set address to stack
144 ;first version only supports backward jumps
146 ;r1 ... address to input, every byte is a new input
147 ; includes pc implicitly
148 ;r2 ... address to program start
149 ;r3 ... address of instruction table
150 ;r4 ... gets loaded with instr. prog. addr.
152 ;r9 ... address to actual entry in defer table
153 ;r10... address to defer table
155 ;backup defer table address
157 ;decrement address to input by 1
162 ;increment input address
165 ;store address of next instruction in table
167 ;increment instr. table
172 ;we need to multiply input by 4 to get correct address offset
174 ;calc position in jumptable
175 ldw r0, jumptable(r0)
180 ;load address of program
183 ;program instruction (2)
190 ;now it is time to clear up the defer table
194 ;load branch template
197 ;if actual and base are equal, no entry
203 ;load pointer to where to jump to
205 ;load where to jump to
207 ;load where to save from defer table
212 ;set the upper 16 bit 0
214 ;shift to the position of imm in br
227 ;load address of program
231 ;program instruction (14)
269 ;load address of program
273 ;program instruction (5)
293 ;load address of program
297 ;program instruction (5)
314 ;case 0 1 2 3 4 5 6 7 8 9
317 ;load address of program
318 ldil r4, prog_consts@lo
319 ldih r4, prog_consts@hi
321 ;program instruction (3)
323 ;the first instr. loads r6 with the number
324 ;thus we shall emulate this
328 ;shift 3 bits left, as the immediate in ldi has
331 ;now 'add' this to the ldi
334 ;store this 'dynamic' instruction
349 ;load address of program
350 ldil r4, prog_lessthan@lo
351 ldih r4, prog_lessthan@hi
353 ;program instruction (7)
377 ;load address of program
381 ;program instruction (3)
397 ;the following instructions calculate the immediate
419 ;now we will generate ldih/l which will store this
420 ;immediate into a register
422 ;load address of program
443 ;now we program the instructions that will save the
444 ;immediate onto the stack and increment the later
462 ;gespeicherte instrs sollten input indepentent sein
464 ;fuer forward jumps muss deferrer table gemacht werden *puke*
466 ;load address of program
470 ;program instruction (3)
489 ;r8 has now the current base
491 ;we add the offset to this instruction
495 ;we know calculate the jump destination
496 ;set r6 to 0 (to clear upper bytes)
500 ;compare input with neg. max of 8 bit
506 ;generate negativ offset
509 ;r0 now has the target address
513 ;set the upper 16 bit 0
515 ;shift to the position of imm in br
529 ;we know save the address in the instrtable where the addr to jump to stands
530 ;the value doesn't exists at the moment, but it will at evaluation
532 ;save position to save the instr into defer table
535 ;todo: check if -1 is needed
537 ;multiply with 2 to get offset right
541 ;save the address to defer table
543 ;increment defer table address
552 ;load address of program
556 ;program instruction (1)
568 ;load address of program
572 ;program instruction (4)
590 ;load address of program
594 ;program instruction (3)
653 .fill 129, vm_default
655 ;we assume not more than 3 entries