return to main page
Return to 1401 Software Development
Return to Geek-fun,-Software
82 Factorial, Exactly ;-))
by Ed Thelen, April 10, 2010
the language is Autocoder
A bit of background -
a) Stan Paddock (ever practical) figured we could do "The Hollywood Thing"
- "Love Interest", punched cards flying about, and forget SPS - fake what ever is needed - (That PDP-11 assembler paper tape did look way too short!! ;-) He did mention printing Factorials (less paper) instead of - "HELLO WORLD" - (not very exciting to the casual observer) - Powers of 2 (too much printing time and paper) b) Ed Thelen (ever in love with the 1403 132 column printer)
coded up the following 1401 program which uses most columns ;-)) 82! or 82 Factorial using Ron Mak's "ROPE" of course, on a modern PC - no more switch toggling for me! ;-) but forgot the "Love Interest" (what a nerd!!)
job compute and print 82 Factorial
ctl 6611
*
* Product formed in the print area
*
* label | op | OPERATION |xxxxxxx
ORG 87
X1 DSA 0 index register 1
ORG 92
X2 DSA 0 index register 2
ORG 97
X3 DSA 0 index register 3
*
*
ORG 201
PTAREA DA 1X1 PRINT AREA, PRODUCT AND MULTIPLIER
ORG 328 END OF PRODUCT FIELD
PRODCT DC 0
ORG 331
MULIER dcw 00 MULTIPLIER, TWO DECIMAL DIGITS OUGHT TO DO IT
*
org 400
ONE2 DCW 01 ONE
SAVE1 DCW 0 SAVE TO STRIP SIGN ZONE BITS
ZERO1 DCW 0 USED TO STRIP SIGN ZONE BITS
ZERO3 DCW 000
ORG 450
START MCW ZERO3,X1 * SET INDEX REGISTER
* PRINT BLANK LINE
LOOP4 MCW @ @,PTAREA&X1 * SET BLANK
SBR X1,1&X1 INCREMENT INDEX REGISTER
C @132@,X1 DONE ?
BL LOOP4
W
MCW @82 FACTORIAL, EXACTLY !@,PTAREA&50
W
ZA @1@,PRODCT INITIALIZE PRODUCT FIELD
MCW ONE2,MULIER INITIALIZE MULTIPLIER FIELD
LOOP1 MCW ZERO3,X1 * SET INDEX REGISTERS
LOOP2 MLNS PTAREA&3&X1,PTAREA&X1 ALIGN OPERANDS
SBR X1,1&X1 INCREMENT INDEX REGISTER
C @128@,X1
BL LOOP2
M MULIER,PRODCT MULTIPLY, LOW CHAR HAS SIGN ZONE BIT
MLNS PRODCT,SAVE1
MCW SAVE1,PRODCT REMOVE SIGN BIT
* START ZERO SUPPRESSION
MCW ZERO3,X1 * SET INDEX REGISTERS
LOOP3 MCW @ @,PTAREA&X1 * SET PRESUMED BLANK
SBR X1,1&X1 INCREMENT INDEX REGISTER
BCE LOOP3,PTAREA&X1,0 TEST NEXT CHARACTER
* END MANUAL ZERO SUPPRESSION
W PRINT THE LINE
A ONE2,MULIER ADD ONE TO MULTIPLIER
C @83@,MULIER LOOK FOR END
BL LOOP1
* done with 82 factorial
H HALT,
B START GO DO IT AGAIN
END START