?
Solved

z390 Assembly

Posted on 2011-09-28
5
Medium Priority
?
533 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 35

Accepted Solution

by:
Gary Patterson earned 2000 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
This is about my first experience with programming Arduino.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Suggested Courses

770 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