blob: 4d5700fcb2c7303741cfabd4b91c5f58abf4d359 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
@0
10d // acc= @fib # for the toy indirect jump to fib
369 // store 0x69
170 // acc= 0x70
36a // store 0x6a
001 // loop: cla
2ea // ladd i 0x6a
400 // ifeq 0
5e9 // jmp i 0x69 # toy indirect jump to fib
040 // tx
003 // cla ++acc
26a // ladd 0x6a
36a // store 0x6a
577 // jmp loop
36a // fib: store 0x6a # zero, it is known
370 // store 0x70 # 0x70 is now beginning of Fibonacci sequence (0)
003 // cla ++acc
371 // store 0x71 # 0x71 is 1
170 // fibloop: acc= 0x70
26a // ladd 0x6a
369 // store 0x69
001 // cla
2e9 // ladd i 0x69 # next fib number to print
66b // ascii 0x6b # LSB of ASCII rep
66c // ascii 0x6c
66d // ascii 0x6d
66e // ascii 0x6e # MSB of ASCII rep
104 // acc= 4
369 // store 0x69
005 // scan: cla --acc
269 // ladd 0x69
4ff // ifeq -1
508 // jmp print
369 // store 0x69
16b // acc= 0x6b
269 // ladd 0x69
368 // store 0x68
001 // cla
2e8 // ladd i 0x68
430 // ifeq 0x30
574 // jmp scan
16b // print: acc= 0x6b
269 // ladd 0x69
368 // store 0x68
001 // cla
2e8 // ladd i 0x68
040 // tx
005 // cla --acc
269 // ladd 0x69
4ff // ifeq -1
502 // jmp space
369 // store 0x69
574 // jmp print
120 // space: acc= 0x20
040 // tx
170 // acc= 0x70
26a // ladd 0x6a
369 // store 0x69
003 // cla ++acc
269 // ladd 0x69 # compute &fib[i+1]
368 // store 0x68
003 // cla ++acc
268 // ladd 0x68 # compute &fib[i+2]
367 // store 0x67
001 // cla
2e9 // ladd i 0x69
2e8 // ladd i 0x68 # compute fib[i+2]
3e7 // store i 0x67 # store it
003 // cla ++acc
26a // ladd 0x6a
432 // ifeq 50
502 // jmp fullydone
36a // store 0x6a
548 // jmp fibloop
121 // fullydone: acc= 0x21
040 // tx
080 // halt
// 67: scratch (pointer to fib[i+2])
// 68: scratch (pointer to fib[i+1])
// 69: scratch (pointer to fib[i]) (j)
// 6a: i
// 6b: LSB of ASCII rep
// 6c: USB of ASCII rep
// 6d: USB of ASCII rep
// 6e: MSB of ASCII rep
@70
048 // H # later: start of in-memory Fib sequence
065 // e
06c // l
06c // l
06f // o
02c // ,
020 // ' '
077 // w
06f // o
072 // r
06c // l
064 // d
021 // !
00a // \n
000
|