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


CODE
PRINTOUT


A bit of background -

well - maybe just a long winded story ;-))

a) Someone posted to the list cctech@classiccmp.org

"Programming the PPD-11", linking to
http://fs6.depauw.edu:50080/~dharms/pdp11/
the "Low Resolution (31 MB)" version is plenty good -
http://www.csc.depauw.edu/~dharms/PDP11Video/Video/PDP11-320x240.mov

b) Robert Garner saw the cute "time travel" debugging session

involving the paper tape reader and assembler (no fancy disk drives)
and thought it would be nice to do something similar
for the 1401
(using cards of course) ;-))

c) Ed Thelen thought about trying to get Van Snyder to get the SPS (card only) assembler going

(no fancy disk drives)

d) 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)

e) 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




                            82 FACTORIAL, EXACTLY !
                                                                                                                          1  01
                                                                                                                          2  02
                                                                                                                          6  03
                                                                                                                         24  04
                                                                                                                        120  05
                                                                                                                        720  06
                                                                                                                       5040  07
                                                                                                                      40320  08
                                                                                                                     362880  09
                                                                                                                    3628800  10
                                                                                                                   39916800  11
                                                                                                                  479001600  12
                                                                                                                 6227020800  13
                                                                                                                87178291200  14
                                                                                                              1307674368000  15
                                                                                                             20922789888000  16
                                                                                                            355687428096000  17
                                                                                                           6402373705728000  18
                                                                                                         121645100408832000  19
                                                                                                        2432902008176640000  20
                                                                                                       51090942171709440000  21
                                                                                                     1124000727777607680000  22
                                                                                                    25852016738884976640000  23
                                                                                                   620448401733239439360000  24
                                                                                                 15511210043330985984000000  25
                                                                                                403291461126605635584000000  26
                                                                                              10888869450418352160768000000  27
                                                                                             304888344611713860501504000000  28
                                                                                            8841761993739701954543616000000  29
                                                                                          265252859812191058636308480000000  30
                                                                                         8222838654177922817725562880000000  31
                                                                                       263130836933693530167218012160000000  32
                                                                                      8683317618811886495518194401280000000  33
                                                                                    295232799039604140847618609643520000000  34
                                                                                  10333147966386144929666651337523200000000  35
                                                                                 371993326789901217467999448150835200000000  36
                                                                               13763753091226345046315979581580902400000000  37
                                                                              523022617466601111760007224100074291200000000  38
                                                                            20397882081197443358640281739902897356800000000  39
                                                                           815915283247897734345611269596115894272000000000  40
                                                                         33452526613163807108170062053440751665152000000000  41
                                                                       1405006117752879898543142606244511569936384000000000  42
                                                                      60415263063373835637355132068513997507264512000000000  43
                                                                    2658271574788448768043625811014615890319638528000000000  44
                                                                  119622220865480194561963161495657715064383733760000000000  45
                                                                 5502622159812088949850305428800254892961651752960000000000  46
                                                               258623241511168180642964355153611979969197632389120000000000  47
                                                             12413915592536072670862289047373375038521486354677760000000000  48
                                                            608281864034267560872252163321295376887552831379210240000000000  49
                                                          30414093201713378043612608166064768844377641568960512000000000000  50
                                                        1551118753287382280224243016469303211063259720016986112000000000000  51
                                                       80658175170943878571660636856403766975289505440883277824000000000000  52
                                                     4274883284060025564298013753389399649690343788366813724672000000000000  53
                                                   230843697339241380472092742683027581083278564571807941132288000000000000  54
                                                 12696403353658275925965100847566516959580321051449436762275840000000000000  55
                                                710998587804863451854045647463724949736497978881168458687447040000000000000  56
                                              40526919504877216755680601905432322134980384796226602145184481280000000000000  57
                                            2350561331282878571829474910515074683828862318181142924420699914240000000000000  58
                                          138683118545689835737939019720389406345902876772687432540821294940160000000000000  59
                                         8320987112741390144276341183223364380754172606361245952449277696409600000000000000  60
                                       507580213877224798800856812176625227226004528988036003099405939480985600000000000000  61
                                     31469973260387937525653122354950764088012280797258232192163168247821107200000000000000  62
                                   1982608315404440064116146708361898137544773690227268628106279599612729753600000000000000  63
                                 126886932185884164103433389335161480802865516174545192198801894375214704230400000000000000  64
                                8247650592082470666723170306785496252186258551345437492922123134388955774976000000000000000  65
                              544344939077443064003729240247842752644293064388798874532860126869671081148416000000000000000  66
                            36471110918188685288249859096605464427167635314049524593701628500267962436943872000000000000000  67
                          2480035542436830599600990418569171581047399201355367672371710738018221445712183296000000000000000  68
                        171122452428141311372468338881272839092270544893520369393648040923257279754140647424000000000000000  69
                      11978571669969891796072783721689098736458938142546425857555362864628009582789845319680000000000000000  70
                     850478588567862317521167644239926010288584608120796235886430763388588680378079017697280000000000000000  71
                   61234458376886086861524070385274672740778091784697328983823014963978384987221689274204160000000000000000  72
                 4470115461512684340891257138125051110076800700282905015819080092370422104067183317016903680000000000000000  73
               330788544151938641225953028221253782145683251820934971170611926835411235700971565459250872320000000000000000  74
             24809140811395398091946477116594033660926243886570122837795894512655842677572867409443815424000000000000000000  75
           1885494701666050254987932260861146558230394535379329335672487982961844043495537923117729972224000000000000000000  76
         145183092028285869634070784086308284983740379224208358846781574688061991349156420080065207861248000000000000000000  77
       11324281178206297831457521158732046228731749579488251990048962825668835325234200766245086213177344000000000000000000  78
      894618213078297528685144171539831652069808216779571907213868063227837990693501860533361810841010176000000000000000000  79
    71569457046263802294811533723186532165584657342365752577109445058227039255480148842668944867280814080000000000000000000  80
  5797126020747367985879734231578109105412357244731625958745865049716390179693892056256184534249745940480000000000000000000  81
475364333701284174842138206989404946643813294067993328617160934076743994734899148613007131808479167119360000000000000000000  82