mirror of
https://github.com/kenrector/sds-kit.git
synced 2026-01-11 23:43:17 +00:00
add algol.ini, prime.si and prime examples
This commit is contained in:
parent
ee92640053
commit
15ee8f6ece
38
850816/algol.ini
Normal file
38
850816/algol.ini
Normal file
@ -0,0 +1,38 @@
|
||||
# algol.ini - use the algol compiler
|
||||
|
||||
|
||||
# load algol.bo from card reader using the sds universal loader
|
||||
dep bpt4 1
|
||||
|
||||
|
||||
att cp card-punch
|
||||
att ptp zzz
|
||||
att lpt xxx
|
||||
|
||||
#! /users/admin/sds/sds-kit/tools/mkdeck -a /users/admin/sds/sieve.si >source
|
||||
|
||||
|
||||
att cr /users/admin/sds/sds-kit/850645/pre.bo,/users/admin/sds/sds-kit/850648/850648-84,/users/admin/sds/sds-kit/850645/ldr.bo,/users/admin/sds/sds-kit/850816/algol.bo
|
||||
|
||||
boot cr
|
||||
|
||||
# Simulation stopped, P: 22713 (BRU 22712)
|
||||
|
||||
# Compiler options
|
||||
# dep bpt1 1 down, use card reader
|
||||
# dep bpt2 1 down, use card punch
|
||||
# dep bpt3 1 down, type source
|
||||
# dep bpt4 0 down, call objty before codout
|
||||
|
||||
# dep p 7347 no transfer address on algol.bo, start at 7347
|
||||
|
||||
# c
|
||||
|
||||
#^E
|
||||
|
||||
# Simulation stopped, P: 04534 (SKS 12006) waiting for CR
|
||||
# attach source code
|
||||
#att cr source
|
||||
|
||||
#c
|
||||
|
||||
1
850816/prime
Normal file
1
850816/prime
Normal file
File diff suppressed because one or more lines are too long
37
850816/prime.si
Normal file
37
850816/prime.si
Normal file
@ -0,0 +1,37 @@
|
||||
'COMMENT' PRIME FACTORIZATION.
|
||||
INPUT = 7DIGITS,OUTPUT = FACTORS (ASCENDING ORDER);
|
||||
'BOOLEAN' 'PROCEDURE' PRIME (N);
|
||||
'VALUE' N;'INTEGER' N;
|
||||
'BEGIN'
|
||||
'EXTERNAL' NEXT;
|
||||
'INTEGER' Q;
|
||||
Q:= 2;
|
||||
PRIME1:'IF' Q*Q>N 'THEN' PRIME:='TRUE'
|
||||
'ELSE' 'IF' N\Q*Q = N
|
||||
'THEN' PRIME := 'FALSE'
|
||||
'ELSE 'BEGIN' NEXT (Q); 'GO TO' I PRIME 1 'END'
|
||||
'END' PRIME;
|
||||
|
||||
'PROCEDURE' NEXT (X);
|
||||
'BEGIN'
|
||||
'BOOLEAN' 'EXTERNAL' PRIME;
|
||||
A:X := X + 1;
|
||||
'IF' 'NOT' PRIME (X) 'THEN' 'GO TO' A
|
||||
'END' NEXT;
|
||||
|
||||
BEGIN:='BEGIN'
|
||||
'INTEGER' M, P, TYPEWRITER;
|
||||
'PROCEDURE' OUT (X);
|
||||
'BEGIN' OUTPUT (TYPEWRITER, 17); 10 (X); ENDIO 'END';
|
||||
'EXTERNAL' NEXT;
|
||||
TYPEWRITER := 1;
|
||||
17:'FORMAT' "17";
|
||||
INPUT (TYPEWRITER, 17); IO (M); ENDIO;
|
||||
P:= 2;
|
||||
PRIME3: 'IF' P*P>M
|
||||
'THEN' 'BEGIN' OUT (M); 'GO TO' BEGIN 'END'
|
||||
'ELSE' 'IF' M\P*P=M
|
||||
'THEN' 'BEGIN' OUT (P); M := M/P 'END'
|
||||
'ELSE' NEXT (P);
|
||||
'GO TO' PRIME3;
|
||||
'END' FACTORIZATION
|
||||
Loading…
x
Reference in New Issue
Block a user