-
Notifications
You must be signed in to change notification settings - Fork 6
/
primes.mmix
43 lines (43 loc) · 1.63 KB
/
primes.mmix
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
000000001000: Hand-assembled primes program
85f5f900e3f80003 1000: Main LDWI jj,p500,0; SETL n,3
a4f8f9f5e7f50002 1008: 2H STW n,p500,jj; INCL jj,2
42f5000be7f80002 1010: 3H BZ jj,2F;4H INCL n,2
21f4fa028500f400 1018: 5H ADDI pk,p0,2;6H LDWI $0,pk,0
1cf7f800fef60006 1020: DIV q,n,$0; GET r,rR
43f6fffb300100f7 1028: BZB r,4B;7H CMP $1,$0,q
e7f400025b11fffa 1030: 8H INCL pk,2; PBNB $1,6B
f1fffff400000000 1038: JMPB 2B;2H TRAP
100000000000: must preload this address into g250 (fa)
0002000000000000 PRIME: WYDE 2
1000000003e8: must preload this address into g249 (f9)
fc1a000000000000 JCON: WYDE (1-500)*2
200000000000: bottom of stack
0000000000000000 20...000: rL
0000000000001000 20...008: f4
0000000000000000 20...010: f5
0000000000000000 20...018: f6
0000000000000000 20...020: f7
0000000000000000 20...028: f8
00001000000003e8 20...030: f9
0000100000000000 20...038: fa
0000000000000000 20...040: fb
0000000000000000 20...048: fc
0000000000000000 20...050: fd
0000000000000000 20...058: fe
0000000000000000 20...060: ff
0000000000000000 20...068: rB
0000000000000000 20...070: rD
0000000000000000 20...078: rE
0000000000000000 20...080: rH
0000000000000000 20...088: rJ
0000000000000000 20...090: rM
0000000000000000 20...098: rR
0000000000000000 20...0a0: rP
0000000000000000 20...0a8: rW
0000000000000000 20...0b0: rX
0000000000000000 20...0b8: rY
0000000000000000 20...0c0: rZ
f400000000000000 20...0c8: rG and rA
000000000100: bootstrapping (start with mmmix> d, then b0, then @100)
e1002000e70000c8 00000100: SETMH $0,#2000; INCL $0,#c8
fb000000f00003bd 00000108: UNSAVE 0,$0; JMP Main