CSCI 360 | Spring 2014 |
For this assignment, take a pre-written assembly language program and modify it to:
The original program with internal subroutines:
http://faculty.cs.niu.edu/~byrnes/csci360/assigns/pgm8.txt
The file should be uploaded to your Marist account without the file extension. Make sure to put your KC-id number and name on the first line.
This program processes information on domestic and imported beer that is carried by a liquor store. The information is stored in a table, sorted, and then displayed.
The input file contains the domestic and imported beer inventory for the liquor store. There are at most 40 records in the file, each of which represents a single beer that the store carries. Each record has the following format:
columns description 1 - 5 beer ID number (EBCDIC integer) 6 blank 7 - 38 beer name (character) 39 - 58 location of brewery (character) 59 - 61 number of cases of beer in stock (EBCDIC integer) 62 blank 63 - 67 price per case in cents (EBCDIC integer) 68 - 80 blank
The table has been defined in the storage area for the MAIN routine. It holds a maximum of 40 entries. Each entry is 64 bytes and has the following format:
Field Size Field Data Type Field Contents Fullword Binary ID Number Fullword Binary Number of cases in stock Fullword Binary Price per case 20 bytes Character Brewery Location 32 bytes Character Beer name -------------- 64 bytes total
The program should have at least 2 Dummy SECTions:
The first DSECT (the table entry) will be used in both the BUILD and PRINT routines. The second DSECT (the input record) will only be used in the BUILD routine.
This routine controls the flow of the program by:
The storage area for this routine is where the table, the fullword that holds the address of the logical end of table, the input buffer, and the parameter list(s) have been created.
There are no changes to make to this routine.
This routine puts information into the table and sets the address of the logical end of the table.
Input Parameters for the BUILD routine
There are two changes to make to this routine: eliminate the use of the XDECI instruction that is used to convert the beer ID number, number of cases in stock, and price per case to binary (if needed, extra storage areas may be added to BUILD's storage area) and modify the code so that is uses the DSECTs for the input buffer and table wherever possible.
This routine prints the contents of the table and one line of summary information (the total number of cases in stock).
Input Parameters for the PRINT routine
All of the XDECO instructions should be eliminated from the code and replaced by ED or EDMK instructions.
Formatting Requirements for the PRINT routine
Since the original program used XDECO, all of the storage areas that hold data on the print line have been defined as CL12 fields. Those fields can either remain as 12-byte fields or be made smaller/larger depending upon the editing that is done. If the field sizes are changed, make sure that the data still lines up nicely and is under the column headings.
If needed, extra storage areas may be added to the PRINT routines original storage area.
As with the BUILD routine, make sure to include the use of the DSECT for the table wherever possible.
This routine sorts the contents of the table using a selection sort algorithm. The table is sorted in ASCENDING order by the Beer Name.
Input Parameters for the SORT routine
There are no changes that need to be made to this routine.
The output from this program will be the one report that is produced by the PRINT subroutine.
The report is a listing of the sorted beer information in the table.
Domestic and Imported Beer Information ID # Beer Name Brewery Location Cases Price per Case ---------------------------------------------------------------------------------------------------------- 12-345 Anchor Steam California 25 $15.99 67-861 Ayinger Altbairisch Dunkel Germany 36 $28.68 69-871 Bass Pale Ale England 14 $24.85 23-654 Black & Tan United Kingdom 8 $19.99 45-693 Boulder Pass Time Pale Ale Colorado 17 $17.94 19-763 Boulder Planet Porter Colorado 1 $22.20 67-890 Bud Light Missouri 50 $17.99 65-445 Budweiser Missouri 48 $17.99 54-875 Celebrator Doppelbock Germany 10 $31.68 45-454 Coors Light Colorado 29 $17.99 32-145 Coors Original Colorado 32 $17.99 78-451 Dos Equis Amber Lager Mexico 20 $12.99 84-613 Foster's Lager Australia 17 $12.99 21-459 Grolsch Lager The Netherlands 29 $13.99 12-546 Harp Lager Ireland 17 $12.99 48-729 Hazed and Infused Dry Hopped Ale Colorado 21 $21.80 84-583 J.W. Dundee Honey Brown Lager New York 13 $19.03 45-782 Killian's Irish Red Lager Colorado 31 $24.59 78-197 Kirin Lager Japan 16 $14.99 45-888 Labatt Blue Lager Canada 2 $9.99 13-456 Leinenkugel Red Lager Wisconsin 8 $13.99 12-849 Lindeman's Kreik Lambic Belgium 31 $88.68 99-546 McEwan's Scottish Ale Scotland 35 $35.96 12-867 Michelob Light Missouri 51 $10.99 78-543 Miller Genuine Draft Wisconsin 26 $12.99 21-544 Miller Lite Wisconsin 10 $17.99 15-789 New Belgium Fat Tire Amber Ale Colorado 12 $23.64 67-852 Paulaner Hefe-Weizen Germany 24 $14.99 48-633 Peroni Lager Italy 12 $34.36 36-999 Pete's Wicked Ale California 24 $21.41 79-536 Pilsner Urquell Czech Republic 23 $14.99 78-562 Red Stripe Lager Jamaica 12 $30.76 78-458 Redhook E.S.B Washington 24 $26.99 12-354 Rolling Rock Pennsylvania 5 $20.95 87-158 Samuel Adams Boston Lager Massachusetts 33 $21.41 53-547 Samuel Smith's Oatmeal Stout England 6 $53.94 54-698 Sierra Nevada Pale Ale California 18 $26.99 12-999 Steinlager New Zealand 30 $11.99 58-712 Stella Artois Pilsner Belgium 17 $38.94 24-948 TsingTao Lager China 1 $13.58 Total Stock: 838 cases
For any code that is added/changed, use line documentation, documentation
boxes, EJECT
, and SPACE
as before. Any new routines
should have their own documentation box that starts on a new page. Document
everything that you do, and use lots of white space. Segregate groups of related
information with white space. Segregate loops with white space. White space
makes listings (in any language, including written languages) much easier to read.
The XDECI
and XDECO
instructions can no longer
be used to convert numbers. All formatting MUST be done using the ED
or EDMK
instructions.
Any subroutine that is added should be external. They should have standard entry and exit linkage. Failure to follow this requirement will result in significant point reduction.
Any and all information to be shared between routines must be passed by parameter list. This means that no routine may refer to a label outside that routine (i.e. all labels are "local" to the routine they are created in). Failure to follow this requirement will result in significant point reduction.
The only items that may be "passed" to a subroutine are those listed above. You may NOT pass any extra fields!
When you are debugging logic errors, don't be reluctant to use
XDUMP
instructions to display registers and/or memory. Once you
get the program running, remove the XDUMP
s from the run that is
turned in for grading.
Use the following JCL statement to access the input file:
//FT05F001 DD DSN=KC02330.CSCI360.FILES(DATA8),DISP=SHR
Feel free to test the program with your own data. Simply leave out the statement above and place your data after the assembly END statement. It is important that the data you enter follows the same format as the grade run input file. For example:
END MAIN 12345 Anchor Steam California 025 01599 12354 Rolling Rock Pennsylvania 005 02095 12867 Michelob Light Missouri 051 01099 13456 Leinenkugel Red Lager Wisconsin 008 01399 /* //
Make sure that the run you hand in for grading uses the file specified above and contains nothing after the END statment.