diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2004-06-09 13:13:08 +0000 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2004-06-09 13:13:08 +0000 |
commit | 6609d3d0d93c7f5fee96dbe8cd9a19acee3bf9d3 (patch) | |
tree | 59393ae717462450edd82a856e942bcb3d4ee627 /samples/permutations.mixal | |
parent | 0e9f85afc65fbe21a43bf5e78a23ae3277c4f627 (diff) | |
download | mdk-6609d3d0d93c7f5fee96dbe8cd9a19acee3bf9d3.tar.gz mdk-6609d3d0d93c7f5fee96dbe8cd9a19acee3bf9d3.tar.bz2 |
initial revision
Diffstat (limited to 'samples/permutations.mixal')
-rw-r--r-- | samples/permutations.mixal | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/samples/permutations.mixal b/samples/permutations.mixal new file mode 100644 index 0000000..24cc682 --- /dev/null +++ b/samples/permutations.mixal @@ -0,0 +1,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 |