Skip to content

Instantly share code, notes, and snippets.

@monsonite
Created August 6, 2017 17:59
Show Gist options
  • Save monsonite/e1cd36fdd8f2d71d743aea143fc6d463 to your computer and use it in GitHub Desktop.
Save monsonite/e1cd36fdd8f2d71d743aea143fc6d463 to your computer and use it in GitHub Desktop.
An integer print routine for an EDSAC work-alike
0 0A
1 49E Jump to 49
2 0A
3 0A
4 1A Used to ADD 1
5 48A Code for ascii zero
6 0A
7 0A
8 0A
9 0A
10 0A
11 0A
12 0A
13 0A
14 0A
15 0A
16 0A
17 0A
18 0A
19 0A
20 0A
21 0A
22 0A
23 0A
24 0A
25 0A
26 0A
27 0A
28 0A
29 0A
30 0A
31 0A
32 0A
33 48A Code for ascii zero
34 0A This stores the current power of 10
35 1808E 100000
36 1000A 1000
37 100A 100
38 10A 10
39 1A 1
40 1A 1
41 0A
42 40A Used to compare which power of 10 to use
43 0A
44 10A Line Feed
45 12A Carriage return
46 43O Output a space
47 33O Output a zero
48 123A Number to be printed
49 46A Add in Instruction "43 O" output a space
50 65K Transfer to m[65] and clear Acc
51 79K Transfer to m[79] and clear ( m[79]is trash )
52 35A Add in 10000
53 34K Transfer to m[32] and clear
54 61E JGE m[61]
55 48K Transfer to m[48] and clear
56 47A Add in m[47] "33 O" output a zero
57 65K Transfer to m[65] and clear
58 33A Add in code for ascii zero
59 40A Add in 1
60 33K Transfer to m[33] and clear
61 48A Add in m[48] - the current number
62 34B Subtract current power of 10
63 55E If >=0 goto 55
64 34A Add current power of 10
65 0A Add Zero (no op)
66 48K Transfer to m[48] and clear
67 5A Add in m[5] = 48 An ascii zero
68 33K Transfer to m[33] and clear
69 52A Add in m[52] the loop count
70 4A Add m[4] which is 1
71 52D Deposit into m[52]
72 42B Subtract m[42] which is 40
73 51G JLT m[51]
74 80A Add 80
75 52K Transfer to m[52] and clear
76 49E Jump to m[49]
// Below is just the code - can be cut and pasted into Teraterm
0A
49E
0A
0A
1A
48A
0A
0A
0A
0A
0A
0A
0A
0A
0A
0A
0A
0A
0A
0A
0A
0A
0A
0A
0A
0A
0A
0A
0A
0A
0A
0A
0A
48A
0A
1808E
1000A
100A
10A
1A
1A
0A
40A
0A
10A
12A
43O
33O
32766A
46A
65K
79K
35A
34K
61E
48K
47A
65K
33A
40A
33K
48A
34B
55E
34A
0A
48K
5A
33K
52A
4A
52D
42B
51G
80A
52K
49E
0A
0A
0A
0A
35A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment