summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Blake Kongslie2021-04-05 13:24:52 -0700
committerJulian Blake Kongslie2021-04-05 13:32:34 -0700
commit6d3551cb8b754897a42ee264135122b80a122be1 (patch)
tree5f4894843fdfa6908f99531a6f7a8a81c40ed348
parentAssembler errors for too-far jumps. (diff)
downloadnoncpu-6d3551cb8b754897a42ee264135122b80a122be1.tar.xz
Use the assembler for allocating static storage in the Fib program.
Diffstat (limited to '')
-rw-r--r--mem/mem.hex102
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
310d // acc= @fib # for the toy indirect jump to fib 3508 // jmp start
4369 // store 0x69 4000 // i: 0 # outer loop index
5000 // ascii0: 0 # ascii digits must be in consecutive incrementing addresses
6000 // ascii1: 0
7000 // ascii2: 0
8000 // ascii3: 0
9000 // fib0: j: 0 # fib[n]; clobbered by ascii printer for inner loop index
10000 // fib1: x: 0 # fib[n+1]; clobbered by ascii printer for digit being printed
11000 // fib2: 0 # fib[n+2]
12116 // start: acc= @fib # for the toy indirect jump to fib
13306 // store @fib0
5170 // acc= 0x70 14170 // acc= 0x70
636a // store 0x6a 15301 // store @i
7001 // loop: cla 16001 // loop: cla
82ea // ladd i 0x6a 17281 // ladd i @i
9400 // ifeq 0 18400 // ifeq 0
105e9 // jmp i 0x69 # toy indirect jump to fib 19586 // jmp i @fib0 # toy indirect jump to fib
11040 // tx 20040 // tx
12003 // cla ++acc 21003 // cla ++acc
1326a // ladd 0x6a 22201 // ladd @i
1436a // store 0x6a 23301 // store @i
15577 // jmp loop 24577 // jmp loop
1636a // fib: store 0x6a # zero, it is known 25301 // fib: store @i # zero, it is known
17370 // store 0x70 # 0x70 is now beginning of Fibonacci sequence (0) 26370 // store 0x70 # 0x70 is now beginning of Fibonacci sequence (0)
18003 // cla ++acc 27003 // cla ++acc
19371 // store 0x71 # 0x71 is 1 28371 // store 0x71 # 0x71 is 1
20170 // fibloop: acc= 0x70 29170 // fibloop: acc= 0x70
2126a // ladd 0x6a 30201 // ladd @i
22369 // store 0x69 31306 // store @fib0
23001 // cla 32001 // cla
242e9 // ladd i 0x69 # next fib number to print 33286 // ladd i @fib0 # next fib number to print
2566b // ascii 0x6b # LSB of ASCII rep 34602 // ascii @ascii0 # LSB of ASCII rep
2666c // ascii 0x6c 35603 // ascii @ascii1
2766d // ascii 0x6d 36604 // ascii @ascii2
2866e // ascii 0x6e # MSB of ASCII rep 37605 // ascii @ascii3 # MSB of ASCII rep
29104 // acc= 4 38104 // acc= 4
30369 // store 0x69 39306 // store @j
31005 // scan: cla --acc 40005 // scan: cla --acc
32269 // ladd 0x69 41206 // ladd @j
334ff // ifeq -1 424ff // ifeq -1
34508 // jmp print 43508 // jmp print
35369 // store 0x69 44306 // store @j
3616b // acc= 0x6b 45102 // acc= @ascii0
37269 // ladd 0x69 46206 // ladd @j
38368 // store 0x68 47307 // store @x
39001 // cla 48001 // cla
402e8 // ladd i 0x68 49287 // ladd i @x
41430 // ifeq 0x30 50430 // ifeq 0x30
42574 // jmp scan 51574 // jmp scan
4316b // print: acc= 0x6b 52102 // print: acc= @ascii0
44269 // ladd 0x69 53206 // ladd @j
45368 // store 0x68 54307 // store @x
46001 // cla 55001 // cla
472e8 // ladd i 0x68 56287 // ladd i @x
48040 // tx 57040 // tx
49005 // cla --acc 58005 // cla --acc
50269 // ladd 0x69 59206 // ladd @j
514ff // ifeq -1 604ff // ifeq -1
52502 // jmp space 61502 // jmp space
53369 // store 0x69 62306 // store @j
54574 // jmp print 63574 // jmp print
55120 // space: acc= 0x20 64120 // space: acc= 0x20
56040 // tx 65040 // tx
57170 // acc= 0x70 66170 // acc= 0x70
5826a // ladd 0x6a 67201 // ladd @i
59369 // store 0x69 68306 // store @fib0
60003 // cla ++acc 69003 // cla ++acc
61269 // ladd 0x69 # compute &fib[i+1] 70206 // ladd @fib0 # compute &fib[i+1]
62368 // store 0x68 71307 // store @fib1
63003 // cla ++acc 72003 // cla ++acc
64268 // ladd 0x68 # compute &fib[i+2] 73207 // ladd @fib1 # compute &fib[i+2]
65367 // store 0x67 74308 // store @fib2
66001 // cla 75001 // cla
672e9 // ladd i 0x69 76286 // ladd i @fib0
682e8 // ladd i 0x68 # compute fib[i+2] 77287 // ladd i @fib1 # compute fib[i+2]
693e7 // store i 0x67 # store it 78388 // store i @fib2 # store it
70003 // cla ++acc 79003 // cla ++acc
7126a // ladd 0x6a 80201 // ladd @i
72432 // ifeq 50 81432 // ifeq 50
73502 // jmp fullydone 82502 // jmp fullydone
7436a // store 0x6a 83301 // store @i
75548 // jmp fibloop 84548 // jmp fibloop
76121 // fullydone: acc= 0x21 85121 // fullydone: acc= 0x21
77040 // tx 86040 // tx
78080 // halt 87080 // 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
91048 // H # later: start of in-memory Fib sequence 91048 // H # later: start of in-memory Fib sequence
92065 // e 92065 // e
9306c // l 9306c // l
9406c // l 9406c // l