Voting

Category

real language

Bookmarking

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

Language IBM/3x0 Assembler

Date:04/20/05
Author:Anonymous
URL:n/a
Comments:2
Info:n/a
Score: (2.50 in 26 votes)
This one is in IBM 360/370/390 assembler, and is known 
to assemble under HLASM/390. Identifiers start in 
column 1, opcodes/instructions in column 10, and 
operands in column 16, with continuation characters in column 72 
when needed. Isn't emulating punched cards fun?

BEER     CSECT
* Standard entry linkage.
          STM   14,12,12(13)
          LR    12,15
          USING BEER,12
          LA    14,BEERSV
          ST    13,4(,14)
          ST    14,8(,13)
          LR    13,14
* The meat of the thing.
          OPEN  (BEERDCB,(OUTPUT))
MOREBEER CP    BOTTLES,=P'0'
          BE    NOBEER
          MVC   LINE1(4),=X'40202120'
          MVC   LINE2(4),=X'40202120'
          MVC   LINE5(4),=X'40202120'
          ED    LINE1(4),BOTTLES
          ED    LINE2(4),BOTTLES
          MVI   LINE1,C'0'
          PUT   BEERDCB,LINE1
          PUT   BEERDCB,LINE2
          PUT   BEERDCB,LINE3
          PUT   BEERDCB,LINE4
          SP    BOTTLES,=P'1'
          ED    LINE5(4),BOTTLES
          PUT   BEERDCB,LINE5
          B     MOREBEER
NOBEER   DS    0H
          CLOSE (BEERDCB)
* Standard exit linkage.
          L     13,4(,13)
          LM    14,12,12(13)
          XR    15,15
          BR    14
          LTORG
BEERSV   DC    18F'0'
BOTTLES  DC    PL2'99'
LINE1    DC    CL132'     bottles of beer on the wall,'
LINE2    DC    CL132'     bottles of beer!'
LINE3    DC    CL132'  Take one down,'
LINE4    DC    CL132'  Pass it around,'
LINE5    DC    CL132'     bottles of beer on the wall!'
BEERDCB  DCB   DDNAME=BEEROUT,                                         X
                DSORG=PS,                                               X
                RECFM=FA,                                               X
                MACRF=PM,                                               X
                LRECL=132
          END   BEER

Download Source | Write Comment

Alternative Versions

Comments

>>  Terry Kinnard said on 07/31/09 14:04:28

Terry Kinnard Such a long time since I've seen any IBM 3x0 Assembler. I haven't written any for about 15 years. I've lost track of mainframe computer progress or otherwise over that time.

Brings back memories...

But yet again you haven't handled the special case for 1 bottle rather than 1 bottles...

>>  JHT said on 04/02/10 18:28:19

JHT No annotation, no dealing with the singular case BOTTLES=1 ... never mind not bothering to TM BEERDCB+48,X'40' after OPEN to check that it worked

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: