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 ldil r15, prog_consts@lo
160 ldih r15, prog_consts@hi
162 ;backup defer table address
164 ;decrement address to input by 1
169 ;increment input address
172 ;store address of next instruction in table
174 ;increment instr. table
179 ;we need to multiply input by 4 to get correct address offset
181 ;calc position in jumptable
182 ldw r0, jumptable(r0)
187 ;load address of program
190 ;program instruction (2)
197 ;now it is time to clear up the defer table
201 ;load branch template
204 ;if actual and base are equal, no entry
210 ;load pointer to where to jump to
212 ;load where to jump to
214 ;load where to save from defer table
220 ;set the upper 16 bit 0
222 ;shift to the position of imm in br
235 ;load address of program
239 ;program instruction (14)
277 ;load address of program
281 ;program instruction (5)
301 ;load address of program
305 ;program instruction (5)
322 ;case 0 1 2 3 4 5 6 7 8 9
325 ;program instruction (3)
327 ;the first instr. loads r6 with the number
328 ;thus we shall emulate this
332 ;shift 3 bits left, as the immediate in ldi has
335 ;now 'add' this to the ldi
338 ;store this 'dynamic' instruction
353 ;load address of program
354 ldil r4, prog_lessthan@lo
355 ldih r4, prog_lessthan@hi
357 ;program instruction (6)
379 ;load address of program
383 ;program instruction (3)
399 ;the following instructions calculate the immediate
421 ;now we will generate ldih/l which will store this
422 ;immediate into a register
424 ;load address of program
445 ;now we program the instructions that will save the
446 ;immediate onto the stack and increment the later
464 ;gespeicherte instrs sollten input indepentent sein
466 ;fuer forward jumps muss deferrer table gemacht werden *puke*
468 ;load address of program
472 ;program instruction (3)
491 ;r8 has now the current base
493 ;we add the offset to this instruction
497 ;we know calculate the jump destination
498 ;set r6 to 0 (to clear upper bytes)
502 ;compare input with neg. max of 8 bit
508 ;generate negativ offset
510 ;r6 is now the 'real' negativ number
512 ;todo: testing showed (at least once) we are off by 2 instr.
514 ;multiply by to get the offset
516 ;generate address in table
518 ;r0 now has the target address
523 ;we shift 2 bits out, because rel. br takes instr.
524 ;count and not address amount ...
526 ;set the upper 16 bit 0
528 ;shift to the position of imm in br
542 ;we know save the address in the instrtable where the addr to jump to stands
543 ;the value doesn't exists at the moment, but it will at evaluation
545 ;save position to save the instr into defer table
548 ;todo: check if -1 is needed
550 ;multiply with 2 to get offset right
554 ;save the address to defer table
556 ;increment defer table address
565 ;load address of program
569 ;program instruction (1)
581 ;load address of program
585 ;program instruction (4)
603 ;load address of program
607 ;program instruction (3)
666 .fill 129, vm_default
668 ;we assume not more than 3 entries