Hey guys... this is my first time working with assembler, so please be patient with me! I am currently taking a course in assembler and have had a couple of basic assignments so far (mainly number systems, adding subtracting, two's complements etc etc). This is my first major (you may think so!) programming assignment.
I have to read in from a file that has the following:
a car number -
the price of the car (in whole dollars) -
the tax on the car (in whole dollars) -
cost of the new car (in whole dollars)
In four colums, like this:
1 25250 1250 24908
2 #### ### ####
and so on.
I have to read from this file, computer some information, and print the result, all in assembler.
Below is my attempt at doing this - could i get some input - i have it working i think as when i read through my assist dump of the program i find the hex code for the value 25250 - so i am reading in correctly.
I just wanted to make sure the basics look good before i start trying to figure out the way i can do addition/subtraction/multiplication etc of different variables in different registers!
So thanks for any input - i would love to know if there would be a way i can read in from the file multiple times, using a loop (sory of like you can do with a while (eof) in c++).
Is this possible with assembler? Cant you use labels? Like DO1 ENDD01 etc.?
Any ideas?
Here the code so far:
***********************************************************************
*
* 1 2 3 4 5 6 7
*2345678901234567890123456789012345678901234567890123456789012345678901
*
ASSIGN2 CSECT
USING ASSIGN2,1 Establish addressability
* XPRNT PGHDR,72
* XPRNT COLS,72
XREAD BUFFER,80 Reads in first line of input
XDECI 2,BUFFER stores car number in R2
XDECI 3,0(,1) stores price of car in R3
XDECI 4,0(,1) stores tax on car in R4
XDECI 5,0(,1) stores cost of new car in R5
SR 6,6
XDECO 2,CARNUM STORES IN R2 IN CARNUM
XDECO 3,PRICE price of car
XDECO 4,TAX stores tax on car in TAX
XDECO 5,NEWCOST stores R5 in newcost
A 6,PRICE adds price to cost (r6)
A 6,PREP adds prep to cost (r6)
A 6,TAX adds tax to cost (r6)
S 6,DISCNT subtracts discount from cost
***********************STORAGE SPACE*******************************
COST DS CL12 TOTAL PRICE FOR CUSTOMER
PREP DC F'375' PREP COST OF CAR
DISCNT DC F'350' DISCOUNT OFF TOTAL COST
PCOST DC F'125' PRESENT COST
DEALCST DS CL12 DEAL COST OF CAR
PROFIT DS CL12 PROFIT ON SALE OF CAR
*PGHDR DC C'1'
* DC CL55' '
* DC C'CAR SALES REPORT'
*COLS DC C'0'
* DC CL1' '
* DC C'CAR NUM'
* DC CL11' '
* DC C'CUSOMTER COST'
* DC CL30' '
* DC C'DEALER COST'
* DC CL47' '
* DC C'PROFIT'
*
CARNUM DS CL12 NUBER OF CAR
PRICE DS CL12 INITIAL PRICE OF CAR
TAX DS CL12 TAX ON SALE OF CAR
NEWCOST DS CL12 NEW COST OF CAR
*
BUFFER DS CL80 ALLOCATED MEMORY TO HOLD INPUT
END ASSIGN2
NOTE*** I have commented out the lines i have tried to get printing colum headers etc. But i keep getting a AS000 error on some of the lines - so once again, i would like basic info on if the code looks good, and if and how i could set up a loop to read to EOF ... if possible
Thanks folks.