Skip to content

Commit

Permalink
[#201] Updated some SSEM programs
Browse files Browse the repository at this point in the history
  • Loading branch information
vbmacher committed May 29, 2021
1 parent 440c55e commit 6483c69
Show file tree
Hide file tree
Showing 6 changed files with 181 additions and 63 deletions.
44 changes: 44 additions & 0 deletions plugins/compiler/as-ssem/src/main/examples/bcs-division.ssem
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
; The UK schools winner of the 1998 SSEM Programming Competition.
;
; An implementation of "division by repeated subtraction".
;
; Written by: Brendan Campbell
; Obtained from: The 1998 SSEM Programming Competition.
; Description: Integer division, giving quotient and remainder.
; Parameter Lines: 28: Dividend
; 29: Divisor
; Result Lines: 30: Quotient
; 31: Remainder

00 BNUM 00000000000000000000011110000000
01 BINS 10111000000000100000010001000000
02 BINS 11011000000001100000011110000000
03 BINS 00111000000000100000010001000000
04 BINS 01011000000001100000011110000000
05 BINS 01011000000000100000000000000000
06 BINS 10111000000000010000011111000000
07 BINS 00111000000001100000000010000000
08 BINS 00000000000000110000000010000000
09 BINS 10011000000000000000010010000000
10 BINS 11011000000000010000001100000000
11 BINS 11111000000001100000000000000000
12 BINS 00000000000001110000010000000000
13 BINS 01111000000000100000010000000000
14 BINS 00011000000000010000010000000000
15 BINS 01111000000001100000010000000000
16 BINS 01111000000000100000011111000000
17 BINS 01111000000001100000000000000000
18 BINS 11101000000000000000001111000000
19 BNUM 00000000000000000000010000000000
20 BNUM 00000000000000000000010000000000
21 BNUM 00000000000000000000010000000000
22 BNUM 00000000000000000000001111000000
23 BNUM 01000000000000000000000000000000
24 BNUM 10000000000000000000000000000000
25 BNUM 00110000000000000000000000000000
26 BNUM 00000000000000000000000000000000
27 BNUM 00000000000000000000000000000000
28 BNUM 01011001010000000000000000000000
29 BNUM 01010100000000000000000000000000
30 BNUM 00000000000000000000000000000000
31 BNUM 00000000000000000000000000000000
74 changes: 43 additions & 31 deletions plugins/compiler/as-ssem/src/main/examples/medclock.ssem
Original file line number Diff line number Diff line change
@@ -1,31 +1,43 @@
0001 BINS 11011000000000100000000010000000
0002 BINS 00111000000000010000000101000000
0003 BINS 00000000000000110000001000100000
0004 BINS 00111000000000000000010010010000
0005 BINS 11111000000000100010100000001010
0006 BINS 00000000000001100101000010000101
0007 BINS 00000000000000100111001010100111
0008 BINS 00000000000000010101001010100101
0009 BINS 11111000000001100101001010100101
0010 BINS 00000000000000110101001010100101
0011 BINS 00111000000001000111111111111111
0012 BINS 10111000000000000100000000000001
0013 BINS 00111000000000100100000111000001
0014 BINS 11111000000001100100001000100001
0015 BINS 01111000000000100100010000010001
0016 BINS 00000000000001100100100000001001
0017 BINS 00000000000000100111100000001111
0018 BINS 00000000000000010000000000000000
0019 BINS 01111000000001100110001111000111
0020 BINS 01011000000000010010001010101010
0021 BINS 00000000000000110010001010010010
0022 BINS 10111000000000000010001010010010
0023 BINS 00111000000000100001110011000111
0024 BINS 01111000000001100000000000000000
0025 BINS 10111000000000000000000000000000
0026 BINS 00000000000111111111111111111111
0027 BINS 01101110100110011111111111111111
0028 BINS 10000000000000000000000000000000
0029 BINS 00000000000000000000000000000000
0030 BINS 11111111111111111111111111111111
0031 BINS 11111111111111111111111111111111
; (The "dog kennel" on the right hand side of the code is the University of Manchester logo.)
;
; Written by: John Deane of Australia.
; Obtained from: The 1998 SSEM Programming Competition.
; Description: "Mediaeval analog clock which displays the hour as the number of zeroes counted from the left in location 30.
; The fraction of the hour is displayed in location 31 where each 0 from the left indicates 1/32 hour (about 2 minutes)."
; Parameter Lines: 27: initial value for the timing interval counter. See code below.
; Result Lines: 30: hours display
; 31: 1/32 hour display
; (run time display)

01 BINS 11011000000000100000000010000000
02 BINS 00111000000000010000000101000000
03 BINS 00000000000000110000001000100000
04 BINS 00111000000000000000010010010000
05 BINS 11111000000000100010100000001010
06 BINS 00000000000001100101000010000101
07 BINS 00000000000000100111001010100111
08 BINS 00000000000000010101001010100101
09 BINS 11111000000001100101001010100101
10 BINS 00000000000000110101001010100101
11 BINS 00111000000001000111111111111111
12 BINS 10111000000000000100000000000001
13 BINS 00111000000000100100000111000001
14 BINS 11111000000001100100001000100001
15 BINS 01111000000000100100010000010001
16 BINS 00000000000001100100100000001001
17 BINS 00000000000000100111100000001111
18 BINS 00000000000000010000000000000000
19 BINS 01111000000001100110001111000111
20 BINS 01011000000000010010001010101010
21 BINS 00000000000000110010001010010010
22 BINS 10111000000000000010001010010010
23 BINS 00111000000000100001110011000111
24 BINS 01111000000001100000000000000000
25 BINS 10111000000000000000000000000000
26 BNUM 00000000000111111111111111111111
27 BNUM 01101110100110011111111111111111 -- timing counter for original machine
27 BNUM 10111111111111111111111111111111 -- timing counter to speed up simulation
28 BNUM 10000000000000000000000000000000
29 BNUM 00000000000000000000000000000000
30 BNUM 11111111111111111111111111111111
31 BNUM 11111111111111111111111111111111
72 changes: 40 additions & 32 deletions plugins/compiler/as-ssem/src/main/examples/nightmare.ssem
Original file line number Diff line number Diff line change
@@ -1,32 +1,40 @@
0000 BINS 00000110101001000100000100000100
0001 BINS 10011011111100100010000010001000
0002 BINS 10000010000101101000100001010000
0003 BINS 00000010000100110100001001100000
0004 BINS 11101011111100011010101010010100
0005 BINS 10000000110000010001000010101001
0006 BINS 10000001111000010000100100001100
0007 BINS 10000001111000010000011000000010
0008 BINS 10011000000001101000011001000001
0009 BINS 10101001111000100100100100000010
0010 BINS 00000001111000110011010010000100
0011 BINS 01101001111000010011000001001000
0012 BINS 11101001111000010100100000110000
0013 BINS 10101000110001101000010000110000
0014 BINS 10100001111000010000001001001000
0015 BINS 00010011111101100000000110000100
0016 BINS 00000111111110010000000010000010
0017 BINS 10000011111101101111111111111111
0018 BINS 10101001111000100110011001100110
0019 BINS 10101000110001101111111111111111
0020 BINS 00011000110000001111111111111111
0021 BINS 01100000000000000000000000000000
0022 BINS 11100000000000000000000000000000
0023 BINS 11111111111111111111111111111111
0024 BINS 00000000000000000000000000000000
0025 BINS 00000000000000011111000000100000
0026 BINS 00000000000000100000100001010000
0027 BINS 00000000000000100010100000100000
0028 BINS 00000001111110100000100000111000
0029 BINS 00000010000000011111000000100000
0030 BINS 00011110011110001000000000100000
0031 BINS 00111111111111111110000001010000
; Written by: Frank Hurley.
; Obtained from: The 1998 SSEM Programming Competition.
; Description: "The program is an animation of a giant baby and Tom chasing after each other for eternity underneath
; a jumble of bulbs, switches, cables, smoke and iron. Viewable on store tube. The program does not
; terminate and the animation cycles every 8 seconds @ 700 ips. Blurred vision helps."
; Parameter Lines: -
; Result Lines: (run-time display)

00 BNUM 00000110101001000100000100000100
01 BINS 10011011111100100010000010001000
02 BINS 10000010000101101000100001010000
03 BINS 00000010000100110100001001100000
04 BINS 11101011111100011010101010010100
05 BINS 10000000110000010001000010101001
06 BINS 10000001111000010000100100001100
07 BINS 10000001111000010000011000000010
08 BINS 10011000000001101000011001000001
09 BINS 10101001111000100100100100000010
10 BINS 00000001111000110011010010000100
11 BINS 01101001111000010011000001001000
12 BINS 11101001111000010100100000110000
13 BINS 10101000110001101000010000110000
14 BINS 10100001111000010000001001001000
15 BINS 00010011111101100000000110000100
16 BINS 00000111111110010000000010000010
17 BINS 10000011111101101111111111111111
18 BINS 10101001111000100110011001100110
19 BINS 10101000110001101111111111111111
20 BINS 00011000110000001111111111111111
21 BNUM 01100000000000000000000000000000
22 BNUM 11100000000000000000000000000000
23 BNUM 11111111111111111111111111111111
24 BNUM 00000000000000000000000000000000
25 BNUM 00000000000000011111000000100000
26 BNUM 00000000000000100000100001010000
27 BNUM 00000000000000100010100000100000
28 BNUM 00000001111110100000100000111000
29 BNUM 00000010000000011111000000100000
30 BNUM 00011110011110001000000000100000
31 BNUM 00111111111111111110000001010000
10 changes: 10 additions & 0 deletions plugins/compiler/as-ssem/src/main/examples/noodle-timer.ssem
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
; The Winner of the 1998 SSEM Programming Competition!
;
; Written by: Yasuaki Watanabe of Japan.
; Obtained from: The 1998 SSEM Programming Competition.
; Description: "This is a three minutes timer program. If you want to eat instant noodles, use this program. Start
; the program after pour hot water into the cup. Open the cover and start to eat if the "Stop" indicator
; is illuminated. I promise you that the noodles taste good."
; Parameter Lines: 31: initial value for the timing interval counter. See values in code below.
; Result Lines: (run-time display)

00 BNUM 00000000000000000000000000000000
01 BINS 10011011111000101111110000111111
02 BINS 00111000100001100000000000000000
Expand Down
38 changes: 38 additions & 0 deletions plugins/compiler/as-ssem/src/main/examples/parabola.ssem
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
; Written by: Magnus Olsson of Sweden.
; Obtained from: The 1998 SSEM Programming Competition.
; Description: "uses the CRT as an X-Y display to plot a parabola by setting bits in the unused upper half of lines 1-22.
; The parabola is computed as the solution of a difference equation."
; Parameter Lines: -
; Result Lines: (see description)

01 LDN 29
02 SUB 29
03 STO 29
04 CMP
05 STP
06 LDN 29
07 STO 29
08 LDN 22
09 SUB 29
10 STO 30
11 LDN 30
12 STO 22
13 LDN 8
14 SUB 28
15 STO 30
16 LDN 30
17 STO 8
18 SUB 27
19 STO 12
20 LDN 28
21 SUB 26
22 STO 28
23 LDN 28
24 STO 28
25 JMP 31
26 NUM 1
27 NUM -8192
28 NUM -6
29 NUM 131072
30 NUM 0
31 NUM 0
6 changes: 6 additions & 0 deletions plugins/compiler/as-ssem/src/main/examples/primegen.ssem
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
; Written by: Bas Wijnen of Holland.
; Obtained from: The 1998 SSEM Programming Competition.
; Description: Each time the program is run (pressing the EXEC button) the next prime number in the sequence is generated.
; Parameter Lines: -
; Result Lines: 21: generated primes

0000 JMP 24
0001 LDN 21
0002 STO 21
Expand Down

0 comments on commit 6483c69

Please sign in to comment.