27 ;assuming that no more than 42 instr are used
32 .ifill ldw r0, 0-4(r3);0xE701FFFC
36 .ifill subi r3, r3, 4;0xE1998020
37 .ifill ldw r6, 0(r3);0xe7318000
38 .ifill ldw r7, 0-4(r3);0xe739fffc
39 .ifill ldis r8, 0;0xed400004
40 .ifill mov r0, r7;0xe1038000
41 .ifill andx r0, 1;0xe2800008
42 .ifill adddnz r8, r8, r6;0x00443001
43 .ifill subinz r7, r7, 1;0x01bb8008
44 .ifill addizs r7, r7, 0;0x113b8000
46 .ifill adddnz r8, r8, r6;0x00443001
47 .ifill adddnz r8, r8, r6;0x00443001
48 .ifill subi r7, r7, 2;0xe1bb8010
49 .fill 0x0b7ffe83;brnz+ loop
50 .ifill stw r8, 0-4(r3);0xe7c1fffc
53 .fill 0xed300004;ldis r6, CONST
54 .ifill stw r6, 0(r3);0xe7b18000
55 .ifill addi r3, r3, 4;0xe1198020
58 .ifill subi r3, r3, 4;0xe1998020
59 .ifill ldw r6, 0(r3);0xe7318000
60 .ifill ldw r7, 0-4(r3);0xe739fffc
61 .ifill add r7, r7, r6;0xe03bb000
62 .ifill stw r7, 0-4(r3);0xe7b9fffc
65 .ifill subi r3, r3, 4;0xe1998020
66 .ifill ldw r6, 0(r3);0xe7318000
67 .ifill ldw r7, 0-4(r3);0xe739fffc
68 .ifill sub r7, r7, r6;0xe0bbb000
69 .ifill stw r7, 0-4(r3);0xe7b9fffc
72 .ifill subi r3, r3, 4;0xe1998020
73 .ifill ldw r6, 0(r3);0xe7318000
74 .ifill ldw r7, 0-4(r3);0xe739fffc
75 .ifill cmp r7, r6;0xec3b0000
76 .ifill stwlt r14, 0-4(r3);
77 .ifill stwge r15, 0-4(r3);
80 .ifill ldw r6, 0-4(r3);0xe731fffc
81 .ifill stw r6, 0(r3);0xe7b18000
82 .ifill addi r3, r3, 4;0xe1198020
85 .ifill subi r3, r3, 4;0xe1998020
86 .ifill ldw r6, 0(r3);0xe7318000
87 .ifill cmpi r6,0;0xecb00000
89 .fill 1, 0x1b000103;breq- vm_next
90 .fill 1, 0xeb000003;br+ CONST
93 .fill 1, 0xed400000;ldil r6, CONST
94 .fill 1, 0xed400002;ldih r6, CONST
95 .ifill stw r6, 0(r3);0xe7b18000
96 .ifill addi r3, r3, 4;0xe1198020
99 .ifill subi r3, r3, 4;0xe1998020
102 .ifill ldw r6, 0-4(r3);0xe731fffc
103 .ifill ldw r7, 0-8(r3);0xe739fff8
104 .ifill stw r6, 0-8(r3);0xe7b1fff8
105 .ifill stw r7, 0-4(r3);0xe7b9fffc
108 .ifill ldw r6, 0-4(r3);0xe731fffc
109 .ifill not r6;0xe4b7fffa
110 .ifill stw r6, 0-4(r3);0xe7b1fffc
114 ;set address of input
115 ldil r1, inputdata@lo
116 ldih r1, inputdata@hi
118 ;set address of program start
119 ldil r2, prog_start@lo
120 ldih r2, prog_start@hi
122 ;set address to instruction table
123 ldil r3, instrtable@lo
124 ldih r3, instrtable@hi
126 ;set address to defer table
127 ldil r9, defertable@lo
128 ldih r9, defertable@hi
134 ;set address to stack
138 ;make r15 a 0-register
140 ;make r14 a 8-bit -1-register
148 ;first version only supports backward jumps
150 ;r1 ... address to input, every byte is a new input
151 ; includes pc implicitly
152 ;r2 ... address to program start
153 ;r3 ... address of instruction table
154 ;r4 ... gets loaded with instr. prog. addr.
156 ;r9 ... address to actual entry in defer table
157 ;r10... address to defer table
159 ;load address of program
160 ldil r13, prog_dup@lo
161 ldih r13, prog_dup@hi
163 ;load address of program
164 ldil r14, prog_mul@lo
165 ldih r14, prog_mul@hi
167 ldil r15, prog_consts@lo
168 ldih r15, prog_consts@hi
170 ;backup defer table address
172 ;decrement address to input by 1
177 ;increment input address
180 ;store address of next instruction in table
182 ;increment instr. table
187 ;we need to multiply input by 4 to get correct address offset
189 ;calc position in jumptable
190 ldw r0, jumptable(r0)
195 ;load address of program
198 ;program instruction (2)
205 ;now it is time to clear up the defer table
209 ;load branch template
212 ;if actual and base are equal, no entry
218 ;load pointer to where to jump to
220 ;load where to jump to
222 ;load where to save from defer table
228 ;set the upper 16 bit 0
230 ;shift to the position of imm in br
243 ;program instruction (14)
281 ;load address of program
285 ;program instruction (5)
305 ;load address of program
309 ;program instruction (5)
326 ;case 0 1 2 3 4 5 6 7 8 9
329 ;program instruction (3)
331 ;the first instr. loads r6 with the number
332 ;thus we shall emulate this
336 ;shift 3 bits left, as the immediate in ldi has
339 ;now 'add' this to the ldi
342 ;store this 'dynamic' instruction
357 ;load address of program
358 ldil r4, prog_lessthan@lo
359 ldih r4, prog_lessthan@hi
361 ;program instruction (6)
384 ;program instruction (3)
400 ;the following instructions calculate the immediate
422 ;now we will generate ldih/l which will store this
423 ;immediate into a register
425 ;load address of program
446 ;now we program the instructions that will save the
447 ;immediate onto the stack and increment the later
465 ;gespeicherte instrs sollten input indepentent sein
467 ;fuer forward jumps muss deferrer table gemacht werden *puke*
469 ;load address of program
473 ;program instruction (3)
492 ;r8 has now the current base
494 ;we add the offset to this instruction
498 ;we know calculate the jump destination
499 ;set r6 to 0 (to clear upper bytes)
503 ;compare input with neg. max of 8 bit
509 ;generate negativ offset
511 ;r6 is now the 'real' negativ number
513 ;todo: testing showed (at least once) we are off by 2 instr.
515 ;multiply by to get the offset
517 ;generate address in table
519 ;r0 now has the target address
524 ;we shift 2 bits out, because rel. br takes instr.
525 ;count and not address amount ...
527 ;set the upper 16 bit 0
529 ;shift to the position of imm in br
543 ;we know save the address in the instrtable where the addr to jump to stands
544 ;the value doesn't exists at the moment, but it will at evaluation
546 ;save position to save the instr into defer table
549 ;todo: check if -1 is needed
551 ;multiply with 2 to get offset right
555 ;save the address to defer table
557 ;increment defer table address
566 ;load address of program
570 ;program instruction (1)
582 ;load address of program
586 ;program instruction (4)
604 ;load address of program
608 ;program instruction (3)
667 .fill 129, vm_default
669 ;we assume not more than 3 entries