diff options
Diffstat (limited to '')
| -rw-r--r-- | mem/mem.hex | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/mem/mem.hex b/mem/mem.hex index 4d5700f..a0c98e5 100644 --- a/mem/mem.hex +++ b/mem/mem.hex | |||
| @@ -1,94 +1,94 @@ | |||
| 1 | @0 | 1 | @0 |
| 2 | 2 | ||
| 3 | 10d // acc= @fib # for the toy indirect jump to fib | 3 | 508 // jmp start |
| 4 | 369 // store 0x69 | 4 | 000 // i: 0 # outer loop index |
| 5 | 000 // ascii0: 0 # ascii digits must be in consecutive incrementing addresses | ||
| 6 | 000 // ascii1: 0 | ||
| 7 | 000 // ascii2: 0 | ||
| 8 | 000 // ascii3: 0 | ||
| 9 | 000 // fib0: j: 0 # fib[n]; clobbered by ascii printer for inner loop index | ||
| 10 | 000 // fib1: x: 0 # fib[n+1]; clobbered by ascii printer for digit being printed | ||
| 11 | 000 // fib2: 0 # fib[n+2] | ||
| 12 | 116 // start: acc= @fib # for the toy indirect jump to fib | ||
| 13 | 306 // store @fib0 | ||
| 5 | 170 // acc= 0x70 | 14 | 170 // acc= 0x70 |
| 6 | 36a // store 0x6a | 15 | 301 // store @i |
| 7 | 001 // loop: cla | 16 | 001 // loop: cla |
| 8 | 2ea // ladd i 0x6a | 17 | 281 // ladd i @i |
| 9 | 400 // ifeq 0 | 18 | 400 // ifeq 0 |
| 10 | 5e9 // jmp i 0x69 # toy indirect jump to fib | 19 | 586 // jmp i @fib0 # toy indirect jump to fib |
| 11 | 040 // tx | 20 | 040 // tx |
| 12 | 003 // cla ++acc | 21 | 003 // cla ++acc |
| 13 | 26a // ladd 0x6a | 22 | 201 // ladd @i |
| 14 | 36a // store 0x6a | 23 | 301 // store @i |
| 15 | 577 // jmp loop | 24 | 577 // jmp loop |
| 16 | 36a // fib: store 0x6a # zero, it is known | 25 | 301 // fib: store @i # zero, it is known |
| 17 | 370 // store 0x70 # 0x70 is now beginning of Fibonacci sequence (0) | 26 | 370 // store 0x70 # 0x70 is now beginning of Fibonacci sequence (0) |
| 18 | 003 // cla ++acc | 27 | 003 // cla ++acc |
| 19 | 371 // store 0x71 # 0x71 is 1 | 28 | 371 // store 0x71 # 0x71 is 1 |
| 20 | 170 // fibloop: acc= 0x70 | 29 | 170 // fibloop: acc= 0x70 |
| 21 | 26a // ladd 0x6a | 30 | 201 // ladd @i |
| 22 | 369 // store 0x69 | 31 | 306 // store @fib0 |
| 23 | 001 // cla | 32 | 001 // cla |
| 24 | 2e9 // ladd i 0x69 # next fib number to print | 33 | 286 // ladd i @fib0 # next fib number to print |
| 25 | 66b // ascii 0x6b # LSB of ASCII rep | 34 | 602 // ascii @ascii0 # LSB of ASCII rep |
| 26 | 66c // ascii 0x6c | 35 | 603 // ascii @ascii1 |
| 27 | 66d // ascii 0x6d | 36 | 604 // ascii @ascii2 |
| 28 | 66e // ascii 0x6e # MSB of ASCII rep | 37 | 605 // ascii @ascii3 # MSB of ASCII rep |
| 29 | 104 // acc= 4 | 38 | 104 // acc= 4 |
| 30 | 369 // store 0x69 | 39 | 306 // store @j |
| 31 | 005 // scan: cla --acc | 40 | 005 // scan: cla --acc |
| 32 | 269 // ladd 0x69 | 41 | 206 // ladd @j |
| 33 | 4ff // ifeq -1 | 42 | 4ff // ifeq -1 |
| 34 | 508 // jmp print | 43 | 508 // jmp print |
| 35 | 369 // store 0x69 | 44 | 306 // store @j |
| 36 | 16b // acc= 0x6b | 45 | 102 // acc= @ascii0 |
| 37 | 269 // ladd 0x69 | 46 | 206 // ladd @j |
| 38 | 368 // store 0x68 | 47 | 307 // store @x |
| 39 | 001 // cla | 48 | 001 // cla |
| 40 | 2e8 // ladd i 0x68 | 49 | 287 // ladd i @x |
| 41 | 430 // ifeq 0x30 | 50 | 430 // ifeq 0x30 |
| 42 | 574 // jmp scan | 51 | 574 // jmp scan |
| 43 | 16b // print: acc= 0x6b | 52 | 102 // print: acc= @ascii0 |
| 44 | 269 // ladd 0x69 | 53 | 206 // ladd @j |
| 45 | 368 // store 0x68 | 54 | 307 // store @x |
| 46 | 001 // cla | 55 | 001 // cla |
| 47 | 2e8 // ladd i 0x68 | 56 | 287 // ladd i @x |
| 48 | 040 // tx | 57 | 040 // tx |
| 49 | 005 // cla --acc | 58 | 005 // cla --acc |
| 50 | 269 // ladd 0x69 | 59 | 206 // ladd @j |
| 51 | 4ff // ifeq -1 | 60 | 4ff // ifeq -1 |
| 52 | 502 // jmp space | 61 | 502 // jmp space |
| 53 | 369 // store 0x69 | 62 | 306 // store @j |
| 54 | 574 // jmp print | 63 | 574 // jmp print |
| 55 | 120 // space: acc= 0x20 | 64 | 120 // space: acc= 0x20 |
| 56 | 040 // tx | 65 | 040 // tx |
| 57 | 170 // acc= 0x70 | 66 | 170 // acc= 0x70 |
| 58 | 26a // ladd 0x6a | 67 | 201 // ladd @i |
| 59 | 369 // store 0x69 | 68 | 306 // store @fib0 |
| 60 | 003 // cla ++acc | 69 | 003 // cla ++acc |
| 61 | 269 // ladd 0x69 # compute &fib[i+1] | 70 | 206 // ladd @fib0 # compute &fib[i+1] |
| 62 | 368 // store 0x68 | 71 | 307 // store @fib1 |
| 63 | 003 // cla ++acc | 72 | 003 // cla ++acc |
| 64 | 268 // ladd 0x68 # compute &fib[i+2] | 73 | 207 // ladd @fib1 # compute &fib[i+2] |
| 65 | 367 // store 0x67 | 74 | 308 // store @fib2 |
| 66 | 001 // cla | 75 | 001 // cla |
| 67 | 2e9 // ladd i 0x69 | 76 | 286 // ladd i @fib0 |
| 68 | 2e8 // ladd i 0x68 # compute fib[i+2] | 77 | 287 // ladd i @fib1 # compute fib[i+2] |
| 69 | 3e7 // store i 0x67 # store it | 78 | 388 // store i @fib2 # store it |
| 70 | 003 // cla ++acc | 79 | 003 // cla ++acc |
| 71 | 26a // ladd 0x6a | 80 | 201 // ladd @i |
| 72 | 432 // ifeq 50 | 81 | 432 // ifeq 50 |
| 73 | 502 // jmp fullydone | 82 | 502 // jmp fullydone |
| 74 | 36a // store 0x6a | 83 | 301 // store @i |
| 75 | 548 // jmp fibloop | 84 | 548 // jmp fibloop |
| 76 | 121 // fullydone: acc= 0x21 | 85 | 121 // fullydone: acc= 0x21 |
| 77 | 040 // tx | 86 | 040 // tx |
| 78 | 080 // halt | 87 | 080 // halt |
| 79 | 88 | ||
| 80 | // 67: scratch (pointer to fib[i+2]) | ||
| 81 | // 68: scratch (pointer to fib[i+1]) | ||
| 82 | // 69: scratch (pointer to fib[i]) (j) | ||
| 83 | // 6a: i | ||
| 84 | // 6b: LSB of ASCII rep | ||
| 85 | // 6c: USB of ASCII rep | ||
| 86 | // 6d: USB of ASCII rep | ||
| 87 | // 6e: MSB of ASCII rep | ||
| 88 | |||
| 89 | @70 | 89 | @70 |
| 90 | 90 | ||
| 91 | 048 // H # later: start of in-memory Fib sequence | 91 | 048 // H # later: start of in-memory Fib sequence |
| 92 | 065 // e | 92 | 065 // e |
| 93 | 06c // l | 93 | 06c // l |
| 94 | 06c // l | 94 | 06c // l |
