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
|
* multiply permutations in cycle form (taopc p. 168)
*
MAXWDS EQU 1200
PERM ORIG *+MAXWDS
ANS ORIG *+MAXWDS
OUTBUF ORIG *+24
CARDS EQU 16
PRINTER EQU 18
BEGIN IN PERM(CARDS)
ENT2 0
LDA EQUALS
1H JBUS *(CARDS)
CMPA PERM+15,2
JE *+2
IN PERM+16,2(CARDS)
ENT1 OUTBUF
JBUS *(PRINTER)
MOVE PERM,2(16)
OUT OUTBUF(PRINTER)
JE 1F
INC2 16
CMP2 =MAXWDS-16=,1(1:5)
JLE 1B
HLT 666
1H INC2 15
ST2 SIZE
ENT3 0
2H LDAN PERM,3
CMPA LPREN(1:5)
JNE 1F
STA PERM,3
INC3 1
LDXN PERM,3
JXZ *-2
1H CMPA RPREN(1:5)
JNE *+2
STX PERM,3
INC3 1
CMP3 SIZE
JL 2B
LDA LPREN
ENT1 ANS
OPEN ENT3 0
1H LDXN PERM,3
JXN GO
INC3 1
CMP3 SIZE
JL 1B
*
DONE CMP1 =ANS=
JNE *+2
MOVE LPREN(2)
MOVE =0=
MOVE -1,1(22)
ENT3 0
OUT ANS,3(PRINTER)
INC3 24
LDX ANS,3
JXNZ *-3
HLT
*
LPREN ALF " ("
RPREN ALF ") "
EQUALS ALF " ="
*
GO MOVE LPREN
MOVE PERM,3
STX START
SUCC STX PERM,3
INC3 1
LDXN PERM,3(1:5)
JXN 1F
JMP *-3
5H STX 0,1
INC1 1
ENT3 0
4H CMPX PERM,3(1:5)
JE SUCC
1H INC3 1
CMP3 SIZE
JL 4B
CMPX START(1:5)
JNE 5B
CLOSE MOVE RPREN
CMPA -3,1
JNE OPEN
INC1 -3
JMP OPEN
END BEGIN
|