Solved

z390 Assembly

Posted on 2011-09-28
5
527 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 35

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 Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

Question has a verified solution.

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

This is about my first experience with programming Arduino.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

839 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