Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 544
  • Last Modified:

z390 Assembly

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
JCW2
Asked:
JCW2
1 Solution
 
farzanjCommented:
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
 
Jacques Bourgeois (James Burger)PresidentCommented:
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
 
Gary PattersonVP Technology / Senior Consultant Commented:
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
 
JCW2Author Commented:
Thank you for your help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now