Solved

z390 Assembly

Posted on 2011-09-28
5
519 Views
Last Modified: 2012-06-21
Yes; this is relevant to school.

I'm working in z/390 assembly code, with a program named z390 V1.5.05.

I'm trying to perform arithmetic operations and then annotate the answers to:

A + B
A – B
A * B
B / A

But I need to make sure I've successfully produced and then I need to locate my values.

Can you help me?
pgm3.mlc

        TITLE 'CS 4321 Program #3 by J. Colt Wright' 
        PRINT NOGEN            
PGM3	SUBENTRY

	ZAP	ADD,A
	AP	ADD,B

	ZAP	SUB,A
	SP	SUB,B

	ZAP	MUL,A
	MP	MUL,B

	ZAP	DIV,B
	DP	DIV,A

	SNAPSHOT PGM3,ENDPGM
	SUBEXIT
	PRINT DATA
A DC P'3509'
B DC P'2450940'
ADD DS PL8
SUB DS PL8
MUL DS PL8
DIV DS PL8

ENDPGM  DS D
	SNAPDATA
	END PGM3

Open in new window

SNAPDATA.MAC.txt
SNAPSHOT.MAC.txt
Basic-Assembler-Training-Session.pdf
0
Comment
Question by:JCW2
5 Comments
 
LVL 31

Expert Comment

by:farzanj
ID: 36821258
Never seen any flavor of assembly written like this.  If you are sure that it is working the way you have written it, please disregard my comment.  And be more specific what errors you get.

The first column should be operators and then operands.

So it should be
ADD  ZAP,A

Instead of
ZAP      ADD,A

I am not yet talking about the modes of addressing.
0
 
LVL 40
ID: 36845326
I unfortunately cannot help you on that one, my last assembler code was somewhere in the middle of the 80's, for a Motorola 6809 on a CoCo, if you can still find a CoCo and the Motorola specs somewhere else than in Wikipedia.

I just want to encourage you even if at this point, assembly (sorry, assembler, my .NET is too present now) might seem like a painful useless thing. It is out of most curriculum nowadays, and it is a mistake. It's like a chemist who knows what will happen when any 2 chemicals are mixed together, but think that electron is a drug sold in dark streets.

You might, and probably never will have to use assembler in your life as a programmer. But you will understand a lot of things that other programmers won't, and that will give you an automatic edge when learning even the most modern of technologies. And you will have acquired a sense of logic that seems unnecessary now that we have frameworks that do all the job for us (thanks for them, how I love them), but that enables you nonetheless to be a far better programmer than the average.

I often have problems, in my .NET training sessions, explaining my students why they should most often use a 32-bits integer instead of a 16-bits integer, even if the 16-bits takes less memory. They can't understand the advantage. They have to take my words as a religion. Jacques told us so, so it is True. That is because they did not learn how microprocessors work, they do not even know what a register is, and they do not see the impact of storing two 16-bits values in the same register on 32-bits computers.

Death to assembler.
but
Kudos to your school that has the courage of leaving assembler on the curriculum.
Kudos to you who have the courage of going through that stuff (unless you dream of working for Intel or AMD).

You might be having a hard time now. You might be thinking that you would be better off learning Java for Android than assembler for mainframe. But when Java and Android will have died (they all do eventually), unless silicon will have been replaced by neurons or PsychedelicLinksToTheSpheres, you will be a better programmer because you had that stupid assembler course when you were younger.

Good luck with your problem. I hope that you have solved it or that somebody will come to the rescue.
0
 
LVL 34

Accepted Solution

by:
Gary Patterson earned 500 total points
ID: 36893643
I'm not an OS/390 expert, but perhaps I can help a little.  I took S/360 assembler ages ago, and this is kind of familiar.

Looks like your code -is- in the proper order, and should not be changed.

ZAP, AP, SP, MP, and DP are the opcodes:  Zero and add packed (basically just a MOVE), Add Packed, Subtract Packed, and Divide Packed.

ADD, SUB, MUL, and DIV are variables.  I think farzanj may have thought these were the opcodes.

When you execute the SNAPSHOT macro, you should get a snap dump printout of the current state of all of the storage in your program.  I'm not sure, but it should appear with the rest of your spooled files.

Remember that the result of your DP operation contains both quotient and remainder.  Result will be :

DIV = x'...698C...1658C', which means quotient = 698, remainder = 1685

Hope this helps.

- Gary Patterson
0
 

Author Closing Comment

by:JCW2
ID: 36895349
Thank you for your help.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
changePi Challenge 15 76
mapAB Challlenge 35 88
create an incrementing variable name AutoHotKey 5 57
WPF issue with Trigger 2 68
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now