Voting

Category

assembly language

Bookmarking

Del.icio.us Digg Diigo DZone Earthlink Google Kick.ie
Windows Live LookLater Ma.gnolia Reddit Rojo StumbleUpon Technorati

Language IBM 1620 SPS

Date:10/18/05
Author:Chuck Guzis
URL:n/a
Comments:4
Info:http://www.bitsavers.org/pdf/ibm/1620/
Score: (3.05 in 20 votes)
       BOTTLES OF BEER PROGRAM FOR THE IBM 1620 MODEL I
*
*       HAMMERS THE WHOLE THING OUT ON THE CONSOLE TYPEWRITER.
*
*       A MISERABLE WASTE OF TIME ON 10/2005 BY
*              CHUCK GUZIS   CHUCK @ SYDEX.COM
*
*       THIS CODE IS SHOWN IN ASSEMBLY-LISTING FORMAT WITH SPS MNEMONICS.
*       I HAVE SPREAD THE SPS FIELDS OUT A BIT FOR READABILITY.
*
*       THERE ARE SOME SPECIAL NUMERIC CHARACTERS:
*               ] = FLAGGED 0
*               J-R = FLAGGED 1-9
*               | = RECORD MARK
*               [ = FLAGGED RECORD MARK (NOT USED HERE)
*
*       IF YOU'RE GOING TO RUN THIS ON THE CADET, YOU NEED TO HAVE AT LEAST
*       THE ADDITION TABLES LOADED.  INDIRECT ADDRESSING IS USEFUL, BUT NOT
*       ABSOLUTELY NECESSARY (SEE NOTE BELOW).
*
*       EXECUTION STARTS AT 00402.
*
00402 34 00000 00102    START           RCTY                    ,,, RETURN CARRIAGE
00414 17 00626 ]0426                    BTM     DBEERS,*+12     ,,, SHOW COUNT
00426 39 00783 00100                    WATY    MSG2            ,,, OF BEER ON...
00438 34 00000 00102                    RCTY                    ,,, RETURN CARR.
00450 17 00626 ]0462                    BTM     DBEERS,*+12     ,,, SHOW COUNT
00462 39 00827 00100                    WATY    MSG4            ,,, OF BEER.
00474 34 00000 00102                    RCTY                    ,,, ZZZZIP...
00486 39 00847 00100                    WATY    MSG6            ,,, TAKE ONE DOWN
00498 34 00000 00102                    RCTY                    ,,, ZZZIP...
00510 12 00745 ]0001                    SM      BEERS,1         ,,, A DEAD SOLDIER
00522 46 00578 01200                    BZ      EMPTY           ,,, IF ALL GONE
00534 17 00626 ]0546                    BTM     DBEERS,*+12     ,,, SHOW COUNT
00546 39 00783 00100                    WATY    MSG2            ,,, ON THE WALL
00558 34 00000 00102                    RCTY                    ,,, ZZZZZIP...
00570 49 00402                          B7      START           ,,, DO IT AGAIN
00577 0
00578 39 00911 00100    EMPTY           WATY    MSG8            ,,, NO MORE BEER
00590 34 00000 00102                    RCTY                    ,,, ZZZZIP...
00602 48 00000 00000                    H                       ,,, STOP
00614 49 00578                          B7      EMPTY           ,,, IN CASE RUN PUSHED
*
*       SUBROUTINE TO DISPLAY BOTTLE COUNT AND EITHER *BOTTLE* OR *BOTTLES*
*
*       THIS ASSUMES THAT THE INDIRECT ADDRESSING FEATURE IS PRESENT, BUT
*       IF NOT, SIMPLY USE A "BB"(42) INSTRUCTION IN PLACE OF THE INDIRECT
*       BRANCHES.
*
00621 00000             DBRET           DC      5,0             ,,, RETURN ADD
00626 14 00745 ]0010    DBEERS          CM      BEERS,10        ,,, DISPLAY BOTTLES
00638 46 00710 01300                    BNL     DBEER2          ,,, 10 OR MORE
00650 38 00745 00100                    WNTY    BEERS           ,,, 1 DIGIT
00662 14 00745 ]0001                    CM      BEERS,1         ,,, JUST 1?
00674 47 00722 01200                    BNE     DBEERS4         ,,, NO, *BOTTLES*
00686 39 00767 00100                    WATY    BTL             ,,, SAY *BOTTLE*
00698 49 ]062N                          B7      -DBRET          ,,, EXIT
00710 38 00744 00100    DBEER2          WNTY    BEERS-1         ,,, 2 DIGITS
00722 39 00749 00100    DBEER4          WATY    BTLS            ,,, SAY BOTTLES
00734 49 ]062N                          B7      -DBRET          ,,, EXIT
00741 ]0099             BEERS           DC      5,99            ,,, BOTTLE COUNT
00746 |                                 DC      1,@
00747 0
00748 0042566363534562  BTLS            DAC     8, BOTTLES
00764 0|                                DAC     1,@
00766 004256636353450|  BTL             DAC     8, BOTTLE@
00782 0056460042454559  MSG2            DAC     8, OF BEER
00798 0056550063484500                  DAC     8, ON THE
00814 66415353030|                      DAC     6,WALL.@
00826 0056460042454559  MSG4            DAC     8, OF BEER
00842 030|                              DAC     2,.@
00846 6341524500565545  MSG6            DAC     8,TAKE ONE
00862 00445666552300                    DAC     7, DOWN,
00876 5741626200496300                  DAC     8,PASS IT
00892 4159566455440020                  DAC     8,AROUND -
00908 0|                                DAC     1,@
00910 5556005456594500  MSG8            DAC     8,NO MORE
00926 42454559030|                      DAC     6,BEER.@

Download Source | Write Comment

Alternative Versions

Comments

>>  Tom Watson said on 07/25/06 23:51:20

Tom Watson One should note that if you are using an assemmber (SPS) that has the 'B7' op code, you are running under a monitor program (either monitor 1, or monitor 2). Given this, one should know two things: 1) Indirect addressing is required for the monitor to run. 2) Under the monitor (either one), programs must start at location '02402', not '00402'. In addition, if you are using an assembler (an IBM supplied one, or a contributed one), it produces an object deck that includes the add tables (if required). If desired some efficiencies could be added to the program. The console typewriter did a "really big" stall when starting a new string to output. It probably would have been better to have the whole line edited beforehand and printed out in a single instruction (it would have made the program more complex, but I digress). Another "optimization" would have been to use a two digit field for the number of bottles of beer (faster add). As noted in the program, the return brances from the subroutine can be replaced with 'BB' (or with the monitor 'BB2's) instruction. Done that way, and transmitting only a two digit field in the 'BTM' instruction would also made the program run "quicker". Most of the optimiations wouldn't amount to much since the typing time (at 10 characters per second on the Model 1, 15 characters per second on the Model 2) is the bigger consumer of time. If I do find the Model 1 that I sent to Napa county, I'll run the program. Don't hold out hope.

>>  Richard said on 07/17/09 09:40:10

Richard Wow - you even remember the code. Its 43 years for me, and nothing looks familiar.
And Tom - "Monitor" ??? All our programs were SPS or Fortran PDQ and we certainly did not have any monitor programs in 1966.

I am impressed with your knowledge.
Oh, and Tom there may be an emulator out there somewhere??? assigning the typewriter may be a problem though. LOL

Fond memories, just sitting there, watching it divide ....

>>  Chuck said on 09/24/09 19:04:34

Chuck Yes, you're right that "B7" is a SPS-IID mnemonic, but it's just a shorthand way of getting rid of a "DORG *-4" after a normal 12-digit 49 branch. In any case, Monitor would allow you to punch an object deck--you could always prepend it with the usual short bootstrap that loaded the addition tables and run the program as standalone. I did note in the listing that since there's only one level of nesting, a BB instruction could have been used, or the return address simply plugged into a 49 branch as part of the exit code, if one wanted a more "conventional" 1620 calling sequence.

As far as the typewriter workings go, the vast amount of lag is going to be taken up by the return of the typewriter carriage, not the delay in the startup of the I/O instructions, so I didn't think that it was worth the extra effort to prepare the entire message, though it certainly could have been done that way.

>>  Ed said on 02/13/10 14:12:10

Ed HELP! Last time I saw 1620 SPS, it was 1975. Funny thing, I looked at this code and I started reading it like it still was 1975. All I need to find is some emulator / simulator and some 1620 software (monitor i) to assemble....

Download Source | Write Comment

Add Comment

Please provide a value for the fields Name, Comment and Security Code.
This is a gravatar-friendly website.
E-mail addresses will never be shown.
Enter your e-mail address to use your gravatar.

Please don't post large portions of code here! Use the form to submit new examples or updates instead!

Name:

eMail:

URL:

Security Code:
  
Comment: