Search the web
Sign In
New User? Sign Up
z390-assembler-contest · z390 Mainframe Assembler Coding Contest
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Messages 12 - 41 of 70   Newest  |  < Newer  |  Older >  |  Oldest
Messages: Show Message Summaries   (Group by Topic) Sort by Date v  
#41 From: "Don Higgins" <don@...>
Date: Tue Jan 15, 2008 2:26 am
Subject: z390 Mainframe Assembler Coding Contest Update - 01/14/08
dsh33782
Offline Offline
Send Email Send Email
 

All

 

Two new solutions have been posted

 

1.      P10MB1.MLC/LOG by Mats Broberg at SEB using fewer instr. and single ED (Note execution of this solution on z390 requires latest z390 v1.3.08h PTF to fix overflow bug)

2.      P12DSH1.MLC/LOG by Don Higgins -using BFP  to calc standard. deviation for (1, 2, 3, 6) = 1,87

 

There is still no solution posted yet for the hash table problem #12.  I will post a solution soon if none is forthcoming.  How about a new problem that can best be solved using the new decimal floating point?  After spending a good deal of time on DFP recently, one quiz problem that comes to mind is how many different ways can you represent the exact value of 1 using DFP short, double, or extended formats?  The answer may surprise you/   

 

Don Higgins

mailto:don@...

http://don.higgins.net

 


#40 From: "Don Higgins" <don@...>
Date: Sun Jan 6, 2008 1:38 pm
Subject: z390 Mainframe Assembler Coding Contest Update 01/06/08
dsh33782
Offline Offline
Send Email Send Email
 

All

 

1.      A new problem #12 submitted by Tony Matharu has been posted regarding standard deviation.

2.      A new solution to #4 submitted by Alfred Nykolya uses 854 instructions to complete sort which moves this solution to 2nd place. 

3.      An improved solution to #10 has been submitted with I’m working with author to resolve why it fails some tests and not others on z390.

4.      No solutions have been submitted yet for problems #11 and #12.  I was looking for some new approaches to #11 which I think can be done in as little as 5 instructions for random fetch for fixed tables. 

 

Tomorrow everyone will be back at work and I need to get back to work on z390 updates to get ready for SHARE presentation on February 25, 2008 in Orlando so contest support may be more limited until then.

 

Don Higgins

mailto:don@...

http://don.higgins.net

 


#39 From: "Don Higgins" <don@...>
Date: Tue Jan 1, 2008 2:33 pm
Subject: z390 Mainframe Assembler Coding Contest - Update 01/01/08
dsh33782
Offline Offline
Send Email Send Email
 

All

 

1.      I’ve posted my solution for problem 10 which uses about 27 instructions and no loops to convert any 128 bit unsigned integer.  The technique is basically to divide the 128 bit number by 10E19 resulting in a 64 bit remainder and 64 bit quotient each of which can be converted to decimal and concatenated to produce the result.  However, in order to use the DLG instruction, the high order bit had to be removed in order to avoid overflow, and then the result had to be adjusted accordingly.  Also in order to use the CVDG instruction to convert the two 64 bit numbers to packed decimal for editing, the high order bit had to be removed to avoid sign processing and then the result had to be adjusted accordingly.

 

2.      Here is the first problem for 2008, #11:

 

Code two routines: one to add 8 byte opcode mnemonic to a hash table and another routine to retrieve the address of opcode table entry given the 8 byte mnemonic as key.  To test the efficiency of the two routines a table of the z390 mnemonic machine instructions and their hex opcodes is provided in a copybook file, and a model program using the ZMFACC macro to build the table and then fetch all the opcodes 100 times is provided:

 

All you need to do is code the two routines, test the program in your environment, and submit the program.  This type of routine is used heavily in assemblers, compilers, and debuggers and directly affects the speed of these type programs which may perform the routines millions of times during an execution.

 

Visit the z390 mainframe assembler coding contest site for details and download links:

 

http://z390.sourceforge.net/z390_Mainframe_Assemble_Coding_Contest.htm

 

Don Higgins

mailto:don@...

http://don.higgins.net

 


#38 From: "Don Higgins" <don@...>
Date: Sun Dec 30, 2007 9:53 pm
Subject: z390 Mainframe Assembler Coding Contest - Update 12/30/07
dsh33782
Offline Offline
Send Email Send Email
 

All

 

Since the last update on 12/27/07 we have 2 new solutions posted:

 

1.       Congratulations to Mats Broberg, Roland Johansson, and Seb Sweden for the new #1 solution to problem 4 using an improved version of Quicksort using 685 instructions.  Several of the winners work for http://www.seb.se/pow/wcp/sebgroup.asp?website=&lang=en.

2.      Congratulations to Lindy Mayfield for solution #2 to problem #3 using a different approach to convert 4 bytes at a time.  Lindy works for SAS Institute, Helsinki, Finland: http://www.sas.com/

 

I’m still waiting for the first solution to problem #10.  I completed my first version yesterday which executes about 27 instructions and no loops to convert any 128 bit unsigned integer to display decimal character format with leading zero suppression and comma insertion.  I’ll post it along with new hash table problem on Tuesday if there are no other solutions by then.

 

Don Higgins

mailto:don@...

http://don.higgins.net

 


#37 From: "Don Higgins" <don@...>
Date: Thu Dec 27, 2007 2:55 pm
Subject: z390 Mainframe Assembler Coding Contest - new problem #10 and another solution for problem #8
dsh33782
Offline Offline
Send Email Send Email
 

All

 

A new problem #10 and another solution for problem #9 have been posted on the contest web site here:

 

http://z390.sourceforge.net/z390_Mainframe_Assemble_Coding_Contest.htm

 

This new problem should not be too hard (no floating point required) so you can work on it while watching bowl games etc.  First solution submitted gets first place unless it gets bumped by a significantly faster simpler solution.  Next week’s problem involving hash tables will be more challenging, but also more useful.

 

Congratulations to Lindy Mayfield for the second solution to problem #8.  This solution uses a series from a Rexx program that has all positive terms and only requires 3 floating point (multiply, divide, and add) instructions per iteration.  However, it requires 39 iterations to reach 33 significant digits of precision compared to 7 for Melvyn’s first place entry.  Lindy and I jointly worked on debugging the assembler version of the Rexx program.  I also added z390 CTD services to display value of Pi and the difference from known value of Pi on each iteration.  This solution also uses inline version of LX and STX macros to simplify loading and storing of extended floating point values in storage.

 

Any  and all feedback, comments, suggestions, new problems, and solutions welcome.  And Happy New Year!

 

Don Higgins

mailto:don@...

http://don.higgins.net

 


#36 From: "Don Higgins" <don@...>
Date: Sun Dec 23, 2007 12:42 pm
Subject: z390 Mainframe Assembler Coding Contest Update 12/23/07
dsh33782
Offline Offline
Send Email Send Email
 

All

 

This is fun!  Floating point is catching on after all.  Here are two new solutions plus update to the ZMFACC macro to include all 16 floating point registers available on z:

 

1.       Congratulations to Melvyn Maltz for the first solution to calculating Pi using extended precision floating point.  Melvyn used the arctan series developed in the 17th century.  This impressive solution calculates Pi to 33 decimal places using 1640 instructions. 

2.      Congratulations to Rafa Pereira for moving to first place with an improved version of quicksort which sorts the 20 elements using  1380 instructions.

 

Check it out here:

 

http://z390.sourceforge.net/z390_Mainframe_Assemble_Coding_Contest.htm

 

Don Higgins

mailto:don@...

http://don.higgins.net

 


#35 From: "Lindy Mayfield" <lindy.mayfield@...>
Date: Fri Dec 21, 2007 2:17 pm
Subject: z390 Mainframe Assembler Coding Contest - Problem 8, Calculate PI
jussipupu
Offline Offline
Send Email Send Email
 
I've been trying to do number 8, but I'm beginning to think the learning curve
for working with floating point is too much. (I'm also learning assembler at the
same time.)

I thought I'd post what I've done so far.  If it has any worth, perhaps someone
else can assist me with the hard parts.  If not, the cat > /dev/null, anyway it
was fun getting this far.

By the way, I'm fairly confident the algorithm works, but I've no idea how it
works or why, or if it is even a good way to go.  I did it in Rexx first (which
I mangled from something a colleague did).

Here is the Rexx I used as a model:

/* Rexx */
size = 1165  /*    1165 gives 1000 digits    */
numeric digits size
n = 0
asubn = 3
sum = 3
last = no
do size
   n = n + 1
   n1 = n * 2
   n1 = n1 * 2
   n2 = n * n
   n2 = n2 * 4
   d1 = n2 - n1 + 1
   d2 = (n2 * 2) + n1
   d2 = d2 * 2
   asubn = asubn * d1 / d2
   sum = sum + asubn
end
   say n 'iterations'
   say 'pi =' sum * 1
   say
exit 0

Note, that to get the correct value of PI you have to (I think) count the number
of leading zeros in ASUBN, and so PI is precise up to there.

And here is my so far lame attempt at translating that to assembler:

MAIN     LA    R2,10              Number of iterations
          XR    R3,R3              N
          XR    R4,R4              N1
          XR    R6,R6              N2 high (not used)
          XR    R7,R7              N2 low
          XR    R8,R8              D1
          XR    R9,R9              D2
          LD    FR0,=D'3'          ASUBN initalized to 3
          LD    FR4,=D'3'          Result initalized to 3
          LD    FR8,=D'0'          Work
LOOP     DS    0H
          LA    R3,1(,R3)          n = n + 1
          LR    R4,R3              n1 = n * 2
          SLA   R4,1(R0)
          SLA   R4,1(R0)           n1 = n1 * 2
          LR    R7,R3              n2 = n * n
          MR    R6,R3
          SLA   R7,2(R0)           n2 = n2 * 4
          LR    R8,R7              d1 = n2 - n1 + 1
          SR    R8,R4
          LA    R8,1(,R8)
          LR    R9,R7              d2 = (n2 * 2) + n1
          SLA   R9,1(R0)
          AR    R9,R4
          SLA   R9,1(R0)           d2 = d2 * 2
          LDGR  FR8,R8             asubn = asubn * d1 / d2
          CEFR  FR8,FR8            convert to float
          MXDR  FR0,FR8            multiply
          LDGR  FR8,R9             asubn = asubn * d1 / d2
          CEFR  FR8,FR8            convert to float
          DXR   FR0,FR8            divide
          AXR   FR4,FR0            sum = sum + asubn
          LTR   R2,R2              Is it zero?
          BZ    CONVERT            Yes, done, convert to decimal
          BCTR  R2,R0              Decrement counter
          B     LOOP               Loop
*
CONVERT  DS    0H                 Convert to decimal
*      Don't know what to do now....  Even IF the above is correct.


Any help or suggestions welcome!

Regards,
Lindy

#34 From: "rptv2003" <rptv2003@...>
Date: Sat Dec 22, 2007 5:24 pm
Subject: Re: z390 Mainframe Assembler Coding Contest - Update 12/21/07
rptv2003
Offline Offline
Send Email Send Email
 
Hi all,

--- In z390-assembler-contest@yahoogroups.com, "Don Higgins" <don@...>
wrote:
>
> Congratulations to John Erhman for the first solution to problem 7 -
> calculate the repeating fraction 311/99 = 3.14141414... using single
> precision floating point without using any library functions to do the
> conversion from binary to decimal display format:
>

> Additional solutions to problem 7 may also be forthcoming.  I'll be
> interested to hear how these floating point solutions work on
Hercules as
> I've not done any testing in that environment yet.
>

I have tested P7EH1 successfully on HERCULES. I have done three tests,
all of them successful:

1. On MVS 3.8 running on HERCULES.
2. As a stand-alone program on HERCULES emulating a S/370 machine.
3. As a stand-alone program on HERCULES emulating a ESA/390 machine.

For all the tests I have assembled the code using IFOX00, the nice
ancient assembler in MVS 3.8.

The only changes I have had to do for IFOX00 to assemble the code with
no complains are:

1. Change all the labels to upper case ones.
2. Replace the 'LHI R1,1' instruction with 'LA R1,1', as IFOX00 has no
notice of the LOAD HALFWORD IMMEDIATE instruction.

I have upload the output of the assembly-and-execution job to file
#7/P7EH1-exec.txt in the Files area.

Regards,

Rafa.

#33 From: "Don Higgins" <don@...>
Date: Fri Dec 21, 2007 1:49 pm
Subject: z390 Mainframe Assembler Coding Contest - Update 12/21/07
dsh33782
Offline Offline
Send Email Send Email
 

All

 

Congratulations to John Erhman for the first solution to problem 7 – calculate the repeating fraction 311/99 = 3.14141414….. using single precision floating point without using any library functions to do the conversion from binary to decimal display format:

 

http://z390.sourceforge.net/z390_Mainframe_Assemble_Coding_Contest.htm

 

As expected I learned a lot from this solution and have initiated some changes as a result of it.  First I discovered a bug in z390 execution for the HFP AW add normalized double instruction.  Z390 maintains all floating point values in a cache using normalized single, double, or BigDecimal Java native format for performance and only converts to/from HFP, BFP, or DFP when initially fetching or storing register.  This caching causes the AW result to be normalized which defeats John’s usage to automatically shift bits for double integer alignment.  As a result I’ve done 3 things:  I’ve opened z390 RPI 767 to disable all the un-normalized floating point instructions rather than returning normalized results.  I’ve added alternate code path to John’s solution when running in z390 operating environment to do the required bit shifting without using AW.  And I’ve updated the ZMFACC macro to display the RUNSYS=??? value after programmer name to show which environment solution is running in (z390, MVS, ZOS, CMS, or VSE).

 

Problem 8 remains unsolved, but it appears that some folks are working on it so I’ll wait until next week to post new problem about hash tables.  Additional solutions to problem 7 may also be forthcoming.  I’ll be interested to hear how these floating point solutions work on Hercules as I’ve not done any testing in that environment yet.

 

All feedback, suggestions, new problems, and solutions welcome!

 

Don Higgins

mailto:don@...

http://don.higgins.net

 


#32 From: "Don Higgins" <don@...>
Date: Tue Dec 18, 2007 11:16 pm
Subject: z390 Mainframe Assembler Coding Contest Update 12/18/07
dsh33782
Offline Offline
Send Email Send Email
 

All

 

There is a new version of the ZMFACC macro available for download now that can be used to assemble and execute all the contest solutions in the following operating system environments:

1.      RUNSYS=390 – J2SE on Windows or Linux using WTO and SNAP for output to ASCII LOG file

2.      RUNSYS=MVS – Hercules MVS 3.8 on Windows or Linux using WTO and SNAP output to SYSPRINT

3.      RUNSYS=ZOS – z/OS on System z using WTO and SNAP output to SYSPRINT

4.      RUNSYS=CMS – CMS under VM using WRTERM and LINEDIT output

5.      RUNSYS=VSE – VSE using WTO and PDUMP output to SYSLST

 

The keyword RUNSYS=??? Can be added to first call to ZMFACC to override the default z390 target operating system environment.  You can also override the RUNSYS default using SYSPARM override.  Many thanks to Rafa Pereira, Chris Langford, Wolfgang Deschner, and Ray Mulllins for working on this today.  I’m sure there will be further refinements but it’s getting closer now:

 

http://z390.sourceforge.net/z390_Mainframe_Assemble_Coding_Contest.htm#Download_ZMFACC_macro

 

Don Higgins

mailto:don@...

http://don.higgins.net

 


#31 From: "Don Higgins" <don@...>
Date: Sun Dec 16, 2007 1:55 pm
Subject: z390 Mainframe Assembler Coding Contest Update #6
dsh33782
Offline Offline
Send Email Send Email
 

All

 

z390 Mainframe Assembler Coding Contest Update #6:

 

There is now a What’s New section where you can find the most recent updates:

 

http://z390.sourceforge.net/z390_Mainframe_Assemble_Coding_Contest.htm#What_is_New

 

Check out the latest solution to problem #1 swapping 2 fields with 2 MVC’s by Rafa Pereira:

 

http://z390.sourceforge.net/contest/p1/P1RAFA1.TXT

 

Check out the latest solution to problem #4 using shell sort submitted by Alfred Nykolyn:

 

http://z390.sourceforge.net/contest/p4/P4AN1.TXT

 

And you can now download an updated version of the ZMFACC macro which should work in the z390, Hercules MVS 3.8, and z/OS environments:

 

http://z390.sourceforge.net/z390_Mainframe_Assemble_Coding_Contest.htm#Download_ZMFACC_macro

 

Additional mods for support of VM/CMS and VSE wanted.

 

Don Higgins

mailto:don@...

http://don.higgins.net

 


#30 From: "Don Higgins" <don@...>
Date: Sun Dec 16, 2007 2:13 am
Subject: FW: ZMFACC Solution for z390 Mainframe Assembler Coding Contest problem
dsh33782
Offline Offline
Send Email Send Email
 
From: Binyamin Dissen [mailto:bdissen@...]
Sent: Saturday, December 15, 2007 2:31 PM
To: don@...
Cc: mdixon@...
Subject: ZMFACC Solution for z390 Mainframe Assembler Coding Contest problem

Solution #9 can be improved.

1. EDMK sets a condition code. No need to check for negative.
2. ')' can be placed at the end of the pattern. If the number is positive,
it
is replaced with the fill character. If the number is negative, it is left
unchanged.

          LA    R1,OUT1+5          PRESET CURRENCY SYMBOL IF ZERO
          MVC   OUT1(10),MASK      SET EDIT MASK
          EDMK  OUT1(10),TEST1     EDIT
          BCTR  R1,0               BACK OFF 1 FOR CURRENCY SYMBOL
          MVI   0(R1),C'$'         SET CURRENCY SYMBOL
          BNM   NEXT1              EXIT IF positive number
          BCTR  R1,0               BACK OFF FROM CURRENCY SYMBOL
          MVI   0(R1),C'('         SET BEG PAREN

MASK     DC    X'4020206B2021204B20205D'

OUT1     DC    CL12' '

--
Binyamin Dissen <bdissen@...>
http://www.dissensoftware.com

Director, Dissen Software, Bar & Grill - Israel


Should you use the mailblocks package and expect a response from me,
you should preauthorize the dissensoftware.com domain.

I very rarely bother responding to challenge/response systems,
especially those from irresponsible companies.

#29 From: "rptv2003" <rptv2003@...>
Date: Sat Dec 15, 2007 7:21 pm
Subject: Problem #1
rptv2003
Offline Offline
Send Email Send Email
 
A minor variation on a previous solution to problem #1.

Instead of three 20-byte MVCs, I use two, one 20-byte and one 40-byte.
It requires A,B and TEMP to occupy contiguous storage locations.

The code:

* Problem - Swap two 20 byte fields optimized for speed
* Date    - 12/15/07
* Author  - Rafa Pereira
* Ref.    - z390 Mainframe Assembler Coding Contest on www.z390.org
*
* Using just two MVC instructions. A,B and TEMP must be consecutive.
P1MVC2   ZMFACC  CODE,START,NAME='RAFA'
*
          OPEN    (SNAPDCB,(OUTPUT))
*
          MVC     TEMP,A
          MVC     A(L'A+L'B),B
          ZMFACC  CODE,END
          ZMFACC  INPUT,START
          ZMFACC  OUTPUT,START
A        DC      CL20'FIELD A'
B        DC      CL20'FIELD B'
          ZMFACC  INPUT,END
          ZMFACC  OUTPUT,END
TEMP     DS      CL20
*
SNAPDCB  DCB   DSORG=PS,MACRF=W,RECFM=VBA,BLKSIZE=1632,LRECL=125,      X
                DDNAME=SNAPDUMP
*
          END


Cheers,

Rafa.

#28 From: "Don Higgins" <don@...>
Date: Sat Dec 15, 2007 3:21 pm
Subject: Wanted - a universal self aware version of ZMFACC macro that runs in all current mainframe assembler environments
dsh33782
Offline Offline
Send Email Send Email
 

All

 

You heard it here first.  I am challenging those of you who like to write conditional macro mainframe assembler to develop a universal self aware version of ZMFACC macro that runs in all current mainframe assembler environments including z390, Hercules, z/OS/TSO , z/VM/CMS, and VSE. 

 

One of my first recollections of such assembler code occurred when I was a summer student at Florida Power while attending engineering college at the University of South Florida.  I was watching a consultant who came in at night to buy time on their IBM 1401 system.  He IPL’s  the system from a tape he mounted and then proceeded to mount other input tapes and wait for sort to complete before removing sorted output tape and mounting another input tape. I was asking him about the program, and he said it was an assembler (Autocoder) program that was self aware and determined how much memory it could use and how many tape drives it could use.

 

This ZMFACC problem reduces basically to converting WTO and SNAP macros into whatever form is required to write the same information from memory to a log file which can be converted to ASCII for posting on the contest website along with problem solution programs which call the ZMFACC macro at the start end of the executable code, input data, and output data areas.  The snap memory dump of the input and output areas are taken when the end of executable code section is reached so that any generated input data can be displayed.  Note the z/OS macro reference manual requires open DCB file for the SNAP to write to.  This may be the way to go using dynamic allocation or requiring user DDNAME input etc.  However, there may be a simpler interface that is more standard across OS’s such as WTO, WTP, TPUT, etc. that could be used.  The actual snap dump could be recoded in the macro using Melvyn’s TROT type code etc.

 

The macro can test what version of assembler it is being assembled with using the &SYS type global variables that the different versions of mainframe assembler use and/or it can generate executable code at execution time to test what OS is running and branch to appropriate code.  My preference would be to try and minimize the amount of code generated by the macro and the amount of code required to code the macro.

 

This may turn out to be a collaborative effort as not too many folks have access to test all the environments.  The fall back position is to just post different versions for different environments as they become available.

 

All feedback and suggestions welcome.

 

Don Higgins

mailto:don@...

http://don.higgins.net

 


#27 From: "Don Higgins" <don@...>
Date: Sat Dec 15, 2007 2:17 pm
Subject: FW: ZMFACC Solution for z390 Mainframe Assembler Coding Contest problem
dsh33782
Offline Offline
Send Email Send Email
 
From: Mark Dixon [mailto:MarkDixon@...]
Sent: Friday, December 14, 2007 7:31 PM
To: Don Higgins
Subject: ZMFACC Solution for z390 Mainframe Assembler Coding Contest problem


Hi Don,

Here is a proposed solution to problem 6, Print a binary byte.

Cheers, Mark Dixon
(University of Western Australia)
* z390  Mainframe Assembler Coding Contest
* Problem 6: Convert a byte of binary to printable zeros and ones
* Solution submitted by Mark Dixon (recently of University of Western Australia)
BinPrt ZMFACC  START

	 LA R7,8 	 Loop Counter
	 LA R4,OutByte  End of output area
	 ICM R3,B'1000',InByte R3 gets the input in top byte
Loop XR R2,R2 	 Clear R2
	 SLDL R2,1 	 Shift top bit of R3 into R2
	 STC R2,0(R4)  Store that bit in a byte
	 LA R4,1(R4)  Increment output address counter
	 BCT R7,Loop 	 Loop till done.
	 TR OutByte,ZeroOne  Translate b'0', b'1' -> c'0', c'1'

	 ZMFACC END

ZeroOne DC C'01'  Translate table for binary to character
IN_START DS 0D  Align for ease of dump interpretation
OUT_START EQU *
InByte DC B'01010011' Sample input
OutByte DS CL8  Output space
IN_END EQU *
OUT_END EQU *

	 END ,

#26 From: "Don Higgins" <don@...>
Date: Fri Dec 14, 2007 2:38 pm
Subject: Update #5 - All solutions reformatted using new ZMFACC macro for portability across multiple OS
dsh33782
Offline Offline
Send Email Send Email
 

All

Update #5 - All z390 mainframe assembler coding contest solutions have been reformatted using new ZMFACC macro for portability across multiple OS and new problem and solution submission email methods.  The source and generated log files for each of the ranked solutions are now directly accessible from the contest web page here:

 

http://z390.sourceforge.net/z390_Mainframe_Assemble_Coding_Contest.htm

 

These changes are intended to make the contest more accessible to all mainframe assembler programmers regardless of the particular mainframe platform and operating system they are using.   Also the use of the contest email discussion group is now optional.  Once all the customized versions of the ZMFACC macro are available for download, then everyone should be able to assemble, link, and execute solutions in their own environment and test any new solutions they would like to submit.  To get the contest going I’ve been taking solutions in all forms and have tested and posted what I consider the best solutions in the new standard form.  For example, I think the best solution to John Erhman’s problem #6 is the one submitted by Raymond Wong using exactly 5 instructions to covert from 1 to 32 bytes into the corresponding 8 to 256 zero and one bytes for display.  The contest web page now has direct links to display both the source and the generated z390 execution log for each ranked solution. The links for Raymond Wong’s solution is here:

 

http://z390.sourceforge.net/contest/p6/P6RW1.TXT

 

http://z390.sourceforge.net/contest/p6/P6RW1.LOG  

 

I think second place goes to Bob Rutledge for his solution with single byte fetch, 6 instruction register only loop, plus single 8 byte store from 64 bit register and no tables required.  It’s neat but I don’t think it will beat the 5 instruction solution to convert up to 32 bytes:

 

http://z390.sourceforge.net/contest/p6/P6BR1.TXT

 

http://z390.sourceforge.net/contest/p6/P6BR1.LOG

 

The contest staff (me) is still looking for a few good programmers to volunteer to be moderators and judges.  If you would like to volunteer, let me know.  I’m also looking for customized versions of the ZMFACC macro along with sample JCL, CLIST, REXX, Perl, or other control scripts used to run the solutions in different mainframe operating system environments which can be posted on the contest website for new participants to download.

 

All feedback and suggestions welcome.

 

mailto:don@...

http://don.higgins.net

 


#25 From: "MELVYN MALTZ" <zarf77777@...>
Date: Thu Dec 13, 2007 7:34 pm
Subject: Re: Decimal Exercise
the_hursley_...
Offline Offline
Send Email Send Email
 
Hi Mark,
 
It's easy.
 
Use EDMK and TP, the parentheses have to be inserted manually, sorry don't have the time to give you sample code.
 
Mel (developer of Z390/CICS)
 
----- Original Message -----
From: Mark Dixon
Sent: Thursday, December 13, 2007 2:02 AM
Subject: [z390-assembler-contest] Decimal Exercise

Does z390 support the decimal data types P and Z and the decimal
instructions such as CVD? If so, an old chestnut of a coding problem
is the representation of a packed decimal number in printable format
with the floating currency sign (eg. $) the decimal place, commas to
separate thousands, millions, etc. and parenthesis to indicate a
negative value.

eg. convert DC PL8'-1234567.90" to DC C" ($1,234,567.90)'


#24 From: <abe@...>
Date: Thu Dec 13, 2007 7:52 pm
Subject: Re: Decimal Exercise
abekornelis
Offline Offline
Send Email Send Email
 
Here we go again - we're having
endless discussion on the topic
with one of our software vendors...
 
Please make the currency symbol a
multi-byte variable and the decimal
separator could be either a period
or a comma...
 
Cheers,
Abe Kornelis.
============
 
 
----- Original Message -----
From: Mark Dixon
Sent: Thursday, December 13, 2007 3:02 AM
Subject: [z390-assembler-contest] Decimal Exercise

Does z390 support the decimal data types P and Z and the decimal
instructions such as CVD? If so, an old chestnut of a coding problem
is the representation of a packed decimal number in printable format
with the floating currency sign (eg. $) the decimal place, commas to
separate thousands, millions, etc. and parenthesis to indicate a
negative value.

eg. convert DC PL8'-1234567.90" to DC C" ($1,234,567.90)'


#23 From: "Robert A. Rosenberg" <rarpsl@...>
Date: Thu Dec 13, 2007 8:14 pm
Subject: Problem #6
rarpsl
Offline Offline
Send Email Send Email
 
Here is my attempt (just the code without all the other stuff). It
shifts the bits from one register to another, positions them
correctly, saves it, and then converts to Printable.


LA R5,8 COUNT
ICM R3,8,BYTE INSERT BYTE AT BITS 32-39 of 64 bit register
XR R2,R2 (Clear R2)
BITLOOP EQU *
SLL R2,3  (Moves bits 3 positions left - does nothing useful on 1st Pass)
SLDL R2,1 (Moves bit to position 63 of R2 and shifts contents of R2
one bit left)
BCT R5,BITLOOP LOOP
* R2 is now 000x000x000x000x000x000x000x000x
ST R2,FW (Store the bits)
UNPK QW(9),FW(5) (Unpack inserts the needed Fx for each bit)
*
FW  DS F
BYTE DS X (Padding for UNPK from - Also Source of BYTE to be Displayed)
QW  DS XL9 (8 bytes for number + 1 byte padding for UNPK)
--


Robert A. Rosenberg
RAR Programming Systems Ltd.
(646)-349-4025 - Fax
(646)-479-1984 - Cell Phone

#22 From: "Peter J Farley III" <pjfarley3@...>
Date: Wed Dec 12, 2007 11:38 pm
Subject: Re: Solution to #6 - DispBit2, faster than DispBits
pjfarley3
Offline Offline
Send Email Send Email
 
--- In z390-assembler-contest@yahoogroups.com, "Peter J Farley III"
<pjfarley3@...> wrote:
>
> Could not resist, the DispBits solition was quite nice, but the TR
> at the end is unnecessarily slow -- a simple NC with 8X'F0' is
> sufficient to make the stored bits displayable.  And faster, unless
> I am sorely mistaken.

And of course, Don's correction of my NC to OC shows once again that
you cannot program without TESTING FIRST (Doh!).  I knew that, I
really did, I swear I did...

Thank you Don for correcting my error.

Peter

#21 From: "John P. Baker" <jbaker314@...>
Date: Wed Dec 12, 2007 11:55 pm
Subject: Problem #6
jbaker314ca
Offline Offline
Send Email Send Email
 

The attached code should be the most compact form of generating a binary character string from a byte value (Problem #6):

 

         MVC   OBUFF,IBYTE    Copy the byte to be converted    @xxnnnnn

         MVC   OBUFF+1(7),OBUFF                                @xxnnnnn

*                             Propagate the byte to all eight  @xxnnnnn

*                               (8) positions                  @xxnnnnn

         NC    OBUFF,=X'8040201008040201'                      @xxnnnnn

*                             Mask the appropriate bit in      @xxnnnnn

*                               each byte                      @xxnnnnn

         MVO   WORK5,OBUFF(4) Shift the high-order nibbles     @xxnnnnn

*                               associated with the high-order @xxnnnnn

*                               bits to the corresponding      @xxnnnnn

*                               low-order-nibbles in the work  @xxnnnnn

*                               buffer                         @xxnnnnn

         MVC   OBUFF(4),WORK5 Return the low-order nibbles to  @xxnnnnn

*                               the output buffer              @xxnnnnn

         TR    OBUFF,=C'011111111'                             @xxnnnnn

*                             Convert the bits masks contained @xxnnnnn

*                               in the output buffer to EBCDIC @xxnnnnn

*                               binary digits (0,1)            @xxnnnnn

 

IBYTE    DC    B'01110101'    Sample input value               @xxnnnnn

 

WORK5    DC    X'0000000000'                                   @xxnnnnn

OBUFF    DS    CL8            Output value                     @xxnnnnn

 

         LTORG ,              Literal Pool                     @xxnnnnn

 

Summary of storage requirements:

 

  36  Instructions

  17  Literals

   1  Input Buffer

   5  Work Area

   8  Output Area

 

  67  Total Bytes

   6  Total Instructions

 

John P. Baker

Software Engineer

HFD Technologies


#20 From: "Mark Dixon" <mdixon@...>
Date: Thu Dec 13, 2007 2:02 am
Subject: Decimal Exercise
mdofperth
Offline Offline
Send Email Send Email
 
Does z390 support the decimal data types P and Z and the decimal
instructions such as CVD?  If so, an old chestnut of a coding problem
is the representation of a packed decimal number in printable format
with the floating currency sign (eg. $) the decimal place, commas to
separate thousands, millions, etc. and parenthesis to indicate a
negative value.

eg. convert DC PL8'-1234567.90" to DC C"  ($1,234,567.90)'

#19 From: "Don Higgins" <don@...>
Date: Wed Dec 12, 2007 9:25 pm
Subject: Update #4 - A new solution to problem #6 using 5 instructions for the complete conversion by Ray Wong
dsh33782
Offline Offline
Send Email Send Email
 

All

 

Update #4 - A new solution to problem #6 using 5 instructions for the complete conversion by Raymond Wong:

 

* PROBLEM 6 SOUTION SUBMITTED BY RAYMOND WONG

* MODIFIED FOR Z390 BY CHANGING LOC=(BELOW,ANY) TO LOC=ANY BY DSH

* TO ASSEMBLE,LINK, AND EXECUTE USE ASMLG BYTTBIN3 GUAM

* THE GUAM OPTION IS REQUIRED FOR TGET/TPUT MCS SUPPORT

LCDSECT  DSECT

INBUF    DS    CL32

OUTBUF   DS    CL32

OSTRING  DS    CL32

LCSIZE   EQU   256

         YREGS

***********************************************************************

**       EZSAMPLE start;                                             **

***********************************************************************

EZSAMPLE AMODE 31

EZSAMPLE RMODE ANY

EZSAMPLE CSECT

         USING EZSAMPLE,R12

         BAKR  R14,0

         LR    R12,R15

*

*        **************************************************************

*        *   Allocate terminal I/O Amode 24 buffers;                  *

*        **************************************************************

*DSH1    STORAGE OBTAIN,LENGTH=LCSIZE,LOC=(BELOW,ANY),COND=NO

         STORAGE OBTAIN,LENGTH=LCSIZE,LOC=ANY,COND=NO

*

         USING LCDSECT,R10

         LR    R10,R1

         XC    0(LCSIZE,R10),0(R10)

*

CTOBIN20 EQU   *

         MVC   OSTRING(32),=CL32'Enter char or "?" to end'

         TPUT  OSTRING,32

*

         TGET  INBUF,1                Get a byte via TGET

*

         CLI   INBUF,C'?'             Want to end session?

         JE    CTOBINX                Then end

*

         MVC   OUTBUF(8),TABTR1T8

         TR    OUTBUF(8),INBUF

         NC    OUTBUF(8),TABNC1T8

         TR    OUTBUF(8),TABXTBIN

*

         TPUT  OUTBUF,8               Display the result

*

         J     CTOBIN20               Try next I/char

*

CTOBINX  EQU   *

         SR    R15,R15

         PR

*

***********************************************************************

**       Tranlation tables;                                          **

***********************************************************************

TABTR1T8 DC    256AL1((*-TABTR1T8)/8)

*

TABNC1T8 DC    32X'8040201008040201'

*

TABXTBIN DC    C'0',255C'1'

*

*        **************************************************************

*        *   EZSAMPLE end;                                            *

*        **************************************************************

         LTORG

         END   EZSAMPLE

 

Very tricky and very impressive.  It runs interactively using z390 with GUAM option to support TGET/TPUT IO.

 

mailto:don@...

http://don.higgins.net

 


#18 From: "the_hursley_horror" <zarf77777@...>
Date: Wed Dec 12, 2007 9:03 pm
Subject: Four solutions to #6
the_hursley_...
Offline Offline
Send Email Send Email
 
Anyone got it lower than 2mS ?

The last one added for interest, 30 years since I did that.

Sorry Don, I broke your 100 line rule, take the comments out !!

SAMPLE   SUBENTRY
*
* METHOD 1    57.2 mS
* USES SLDL
*
          SR    R2,R2              CLEAR R2
          SR    R3,R3              CLEAR R3
          LA    R4,BITS1           OUTPUT AREA
          LA    R5,8               COUNT
          ICM   R3,8,BYTE          INSERT BYTE AT TOP
BITLOOP1 EQU   *
          SLDL  R2,1               SHIFT NEXT BIT INTO R2
          LTR   R2,R2              IS IT 1 ?
          BZ    INCR               EXIT IF NOT
          MVI   0(R4),C'1'         MARK IT
          SR    R2,R2              CLEAR R2
INCR     EQU   *
          AHI   R4,1               BUMP OUTPUT POINTER
          BCT   R5,BITLOOP1        LOOP
*
* METHOD 2   2.4mS
* USES 2K TABLE
          SR    R2,R2              CLEAR R2
          IC    R2,BYTE            INSERT BYTE TO CONVERT
          SLL   R2,3               * 8
          LA    R3,BITABLE1(R2)    INDEX
          MVC   BITS2(8),0(R3)     MOVE TO OUTPUT
*
* METHOD 3   5mS
* USES 64-BYTE TABLE
          SR    R2,R2              CLEAR R2
          SR    R3,R3              CLEAR R3
          ICM   R3,8,BYTE          INSERT BYTE AT TOP
          SLDL  R2,4               SHIFT 1ST NIBBLE
          SLL   R2,2               * 4
          LA    R2,BITABLE2(R2)    INDEX
          MVC   BITS3(4),0(R2)     MOVE TO OUTPUT
          SR    R2,R2              CLEAR R2
          SLDL  R2,4               SHIFT 2ND NIBBLE
          SLL   R2,2               * 4
          LA    R2,BITABLE2(R2)    INDEX
          MVC   BITS3+4(4),0(R2)   MOVE TO OUTPUT
*
* METHOD 4  49mS  WITHOUT FLAG CONVERSION...44.3mS
* USES ROTATE, WITH ADDED FLAG CONVERSION
          SR    R2,R2              CLEAR R2
          SR    R3,R3              CLEAR R3
          LA    R4,WORK            OUTPUT AREA
          LA    R5,8               COUNT
          ICM   R3,8,BYTE          INSERT BYTE AT TOP
          LR    R2,R3              COPY TO R2
BITLOOP4 EQU   *
          LTR   R2,R2              TEST IT
          BNM   INCR4              EXIT IF -VE
          MVI   0(R4),X'FF'        MARK IT
INCR4    EQU   *
          AHI   R4,1               BUMP OUTPUT POINTER
          RLL   R2,R3,1            ROTATE LEFT INTO R2
          LR    R3,R2              COPY BACK
          BCT   R5,BITLOOP4        LOOP
* CONVERT TO INDICATOR FLAGS
          XC    BITS4(8),WORK      INVERT IT
          OC    WORK,ZEROS         MARK THE ZEROS
          OC    BITS4(8),ONES      MARK THE ONES
          NC    BITS4(8),WORK      COMBINE
          SNAP  STORAGE=(BYTE,BITS4+8),ID=0
*
          SUBEXIT
*
BYTE     DC    X'AB'              A NICE BYTE
*
BITS1    DC    8C'0'
BITS2    DC    8C'0'
BITS3    DC    8C'0'
BITS4    DC    8X'FF'
*
BITABLE1 EQU   *                  2K TABLE
          DC    C'00000000'
          DC    (X'AB'-X'01')CL8' ' I'M NOT DOING IT
          DC    C'10101011'
          DC    (X'FF'-X'AC')CL8' ' I'M NOT DOING IT
          DC    C'11111111'
*
BITABLE2 EQU   *                  64-BYTE TABLE
          DC    C'0000'
          DC    C'0001'
          DC    C'0010'
          DC    C'0011'
          DC    C'0100'
          DC    C'0101'
          DC    C'0110'
          DC    C'0111'
          DC    C'1000'
          DC    C'1001'
          DC    C'1010'
          DC    C'1011'
          DC    C'1100'
          DC    C'1101'
          DC    C'1110'
          DC    C'1111'
*
ZEROS    DC    8C'.'
ONES     DC    C'12345678'
WORK     DS    XL8
*
          LTORG
*
          EQUREGS REGS=GPR
          END

#17 From: "the_hursley_horror" <zarf77777@...>
Date: Wed Dec 12, 2007 8:01 pm
Subject: Re: Translate hex to display hex using TROT
the_hursley_...
Offline Offline
Send Email Send Email
 
--- In z390-assembler-contest@yahoogroups.com, "mickpoil"
<mickpoil@...> wrote:
>
> --- In z390-assembler-contest@yahoogroups.com, "the_hursley_horror"
> <zarf77777@> wrote:
> >
> > --- In z390-assembler-contest@yahoogroups.com, "Mark Dixon"
> > <mdixon@> wrote:
> > >
> > > MELVYN MALTZ provided sample code to translate hexadecimal to
> > > printable hex.  The code included the comment: "THE REVERSE
OPERATION
> > > IS ALSO POSSIBLE USING TRTO, BUT THIS REQUIRES A 14K TABLE AND
NOT
> > > CONSIDERED WORTHWHILE"
> > >
> > > Perhaps this is the next problem.  I'm pretty sure that
converting
> > > printable-hex to hexadecimal can be done with much less effort
than a
> > > 14K table and might be worthwhile for programs that need to
receive
> > > user input in typed hexadecimal that needs to be stored in
hexadecimal
> > > for processing.
> > >
> >
> > Mark is exactly right.
> > The new instructions TROT and TRTO provide the facility to do
this
> > translation either way in one go, rather than a loop. Up to 2GB
streams
> > may be done, which saves a lot of CPU time.
> >
> > Below you will find both way conversions using what I've
> > termed 'archaic' methods.
> > I have coded examples of looped conversions for long strings, but
> > haven't time to re-invent them now, hope the stuff below will
suffice.
> >
> > When Z390/CICS V4 is published look at Z390CEBR which has many
> > conversions, including typed hex streams.
> >
> > SAMPLE   SUBENTRY
> > *
> > * SAMPLE CODE TO TRANSLATE TRUE HEX TO PRINTABLE HEX
> > * AND BACK TO HEX USING ARCHAIC METHODS
> > *
> > * IT IS COMPLEX TO DO LONG STREAMS WITH THIS METHOD
> > *
> >          UNPK  MYCHAR,MYHEX(7)    UNPACK HEX STREAM
> >          TR    MYCHAR,TABLE-240   TRANSLATE TO CHAR FORM
> > *
> >          MVC   WORK,MYCHAR        SAVE FOR RECONVERT
> >          TR    WORK(12),TRANHXCH-X'C1' TRANSLATE TO UNPACKED HEX
> >          PACK  MYHEX2,WORK        PACK BACK TO HEX
> >          SNAP  ID=0
> > *
> >          SUBEXIT
> > *
> > MYHEX    DC    X'FFA193BC120A'    HEX DATA
> >          DC    X'00'              DUMMY BYTE
> > MYCHAR   DS    XL13               CHAR DATA
> > WORK     DS    XL13               CHAR DATA
> > MYHEX2   DS    XL7                BACK TO HEX
> > *
> > *                  C1C2C3C4C5C6
> > TRANHXCH DC      X'0A0B0C0D0E0F000000000000000000'  C1-CF
> >          DC    32X'00'                              D0-EF
> > *                F0F1F2F3F4F5F6F7F8F9
> >          DC    X'00010203040506070809000000000000'  F0-FF
> > *
> > TABLE    DC    C'0123456789ABCDEF'
> > *
> >          LTORG
> > *
> >          EQUREGS REGS=GPR
> >          END
> >
> I am not sure that Melvyn's TROT example is 100% correct.
>
> From my understanding, TROT is one of the new breed of instructions
> that need to be re-driven when CC=3 is encountered (CPU has
> interrupted it before completion), therefore I think the code should
> look like this to work in all circumstances:
>
> TROT   TROT R6,R8,1
>        BC   1,TROT
>

Thankyou for your contribution.

You are academically correct. All interruptible instructions must
allow for re-drive when executed on a mainframe.

I have been in prior discussion with Don on this subject and I am
assured that Z390 on a PC does not interrupt those instructions.

#16 From: dailomond@...
Date: Wed Dec 12, 2007 6:31 pm
Subject: Possible solution for #6
dailomond
Offline Offline
Send Email Send Email
 
Hi Don,
 
I am submitting a possible solution for #6.  I don't have a Email server setup here so I am using AOL to send this and I'm not sure it is the correct way.  If not please let me know how and I'll do it again.


Regards, 
Raymond Wong
Boston, MA

More new features than ever. Check out the new AOL Mail!
LCDSECT  DSECT
INBUF    DS    CL32
OUTBUF   DS    CL32
OSTRING  DS    CL32
LCSIZE   EQU   256
          YREGS
***********************************************************************
**       EZSAMPLE start;                                             **
***********************************************************************
EZSAMPLE AMODE 31
EZSAMPLE RMODE ANY
EZSAMPLE CSECT
          USING EZSAMPLE,R12
          BAKR  R14,0
          LR    R12,R15
*
*        **************************************************************
*        *   Allocate terminal I/O Amode 24 buffers;                  *
*        **************************************************************
          STORAGE OBTAIN,LENGTH=LCSIZE,LOC=(BELOW,ANY),COND=NO
*
          USING LCDSECT,R10
          LR    R10,R1
          XC    0(LCSIZE,R10),0(R10)
*
CTOBIN20 EQU   *
          MVC   OSTRING(32),=CL32'Enter char or "?" to end'
          TPUT  OSTRING,32
*
          TGET  INBUF,1                Get a byte via TGET
*
          CLI   INBUF,C'?'             Want to end session?
          JE    CTOBINX                Then end
*
          MVC   OUTBUF(8),TABTR1T8
          TR    OUTBUF(8),INBUF
          NC    OUTBUF(8),TABNC1T8
          TR    OUTBUF(8),TABXTBIN
*
          TPUT  OUTBUF,8               Display the result
*
          J     CTOBIN20               Try next I/char
*
CTOBINX  EQU   *
          SR    R15,R15
          PR
*
***********************************************************************
**       Tranlation tables;                                          **
***********************************************************************
TABTR1T8 DC    256AL1((*-TABTR1T8)/8)
*
TABNC1T8 DC    32X'8040201008040201'
*
TABXTBIN DC    C'0',255C'1'
*
*        **************************************************************
*        *   EZSAMPLE end;                                            *
*        **************************************************************
          LTORG
          END   EZSAMPLE

#15 From: "Peter J Farley III" <pjfarley3@...>
Date: Wed Dec 12, 2007 7:23 pm
Subject: Solution to #6 - DispBit2, faster than DispBits
pjfarley3
Offline Offline
Send Email Send Email
 
Could not resist, the DispBits solition was quite nice, but the TR at
the end is unnecessarily slow -- a simple NC with 8X'F0' is sufficient
to make the stored bits displayable.  And faster, unless I am sorely
mistaken.

What fun this is!

Regards,

Peter

#14 From: dailomond@...
Date: Wed Dec 12, 2007 6:47 pm
Subject: Fwd: Possible solution for #6
dailomond
Offline Offline
Send Email Send Email
 
Hi Don,

I've just uploaded possible solution for #6 (EZSAMPLE). It had nothing to do with my email server.

Regards,
Raymond Wong


-----Original Message-----
From: dailomond@...
To: z390-assembler-contest@yahoogroups.com
Sent: Wed, 12 Dec 2007 12:31 pm
Subject: Possible solution for #6

Hi Don,
 
I am submitting a possible solution for #6.  I don't have a Email server setup here so I am using AOL to send this and I'm not sure it is the correct way.  If not please let me know how and I'll do it again.


Regards, 
Raymond Wong
Boston, MA

More new features than ever. Check out the new AOL Mail!
LCDSECT  DSECT
INBUF    DS    CL32
OUTBUF   DS    CL32
OSTRING  DS    CL32
LCSIZE   EQU   256
          YREGS
***********************************************************************
**       EZSAMPLE start;                                             **
***********************************************************************
EZSAMPLE AMODE 31
EZSAMPLE RMODE ANY
EZSAMPLE CSECT
          USING EZSAMPLE,R12
          BAKR  R14,0
          LR    R12,R15
*
*        **************************************************************
*        *   Allocate terminal I/O Amode 24 buffers;                  *
*        **************************************************************
          STORAGE OBTAIN,LENGTH=LCSIZE,LOC=(BELOW,ANY),COND=NO
*
          USING LCDSECT,R10
          LR    R10,R1
          XC    0(LCSIZE,R10),0(R10)
*
CTOBIN20 EQU   *
          MVC   OSTRING(32),=CL32'Enter char or "?" to end'
          TPUT  OSTRING,32
*
          TGET  INBUF,1                Get a byte via TGET
*
          CLI   INBUF,C'?'             Want to end session?
          JE    CTOBINX                Then end
*
          MVC   OUTBUF(8),TABTR1T8
          TR    OUTBUF(8),INBUF
          NC    OUTBUF(8),TABNC1T8
          TR    OUTBUF(8),TABXTBIN
*
          TPUT  OUTBUF,8               Display the result
*
          J     CTOBIN20               Try next I/char
*
CTOBINX  EQU   *
          SR    R15,R15
          PR
*
***********************************************************************
**       Tranlation tables;                                          **
***********************************************************************
TABTR1T8 DC    256AL1((*-TABTR1T8)/8)
*
TABNC1T8 DC    32X'8040201008040201'
*
TABXTBIN DC    C'0',255C'1'
*
*        **************************************************************
*        *   EZSAMPLE end;                                            *
*        **************************************************************
          LTORG
          END   EZSAMPLE

#13 From: "Philippe Leite" <philippe.leite@...>
Date: Wed Dec 12, 2007 5:40 pm
Subject: Re: BYT2BCD
philippe_leite
Offline Offline
Send Email Send Email
 
Hi Mr. Higgins,

I don't have z390 installed...I'm using a real T-Rex machine.
Anyway I want to thank you for all your great work with z390.

PS.: By the way...my name is wrong in the Contest Web site. :-)

Best regards,

Philippe Leite
z/OS System Programmer
Portugal






--- In z390-assembler-contest@yahoogroups.com, "Don Higgins"
<don@...> wrote:
>
> Philippe
>
>
>
> Thanks for contributing solution all the way from Portugal.  I've
added your
> contribution to the contest web site.  Would you like to add alma
mater
> link?
>

#12 From: "Don Higgins" <don@...>
Date: Wed Dec 12, 2007 5:16 pm
Subject: RE: BYT2BCD
dsh33782
Offline Offline
Send Email Send Email
 

Philippe

 

Thanks for contributing solution all the way from Portugal.  I’ve added your contribution to the contest web site.  Would you like to add alma mater link?

 

To get your solution to run on z390 on my Windows Vista system, I had to change the WTO to use execute form WTO MF=(E,MSG) and change message to define 4 byte prefix with total 2 byte total length and 2 bytes of MCS flags.  There is a pending z390 RPI 282 to add TEXT= support to the z390 WTO macro but I just haven’t gotten to it yet.  Here is the modified version of your program that I ran on z390:

 

* PROBLME 6 - BYTTBCD SUBMITTED BY PHILIPPE LIETE

* WTO CHANGED TO ELIMINATE TEXT= FOR Z390 COMPATIBLITY BY DSH

BYT2BCD  START                                          

         USING *,R12                                   

         BAKR  R14,0                                   

         LR    R12,R15                                 

         LA    R2,8               LOOP COUNTER         

         LA    R3,128             LOAD FLOATING BIT    

         XR    R4,R4              CLEAR R4             

         IC    R4,BYTE            INSERT SOURCE BYTE   

         LA    R6,BCD             LOAD TARGET ADDRESS  

LOOP     LR    R5,R4              TEMP COPY             

         NR    R5,R3              TURN OFF OTHER BITS  

         XR    R5,R3              TEST BIT             

         BZ    SETF1                                   

         MVI   0(R6),X'F0'                             

         B     CONT                                     

SETF1    MVI   0(R6),X'F1'                             

CONT     SRL   R3,1               SHIFT RIGHT 1 POSITION

         LA    R6,1(R6)           NEXT TARGET BYTE     

         BCT   R2,LOOP            BACK TO LOOP         

*        LA    R9,MSG                                  

*        WTO   TEXT=((R9)),ROUTCDE=11 DISPLAY RESULT   

         WTO   MF=(E,MSG)                                    DSH1

         PR                                             

BYTE     DC    B'00001111'                             

* MSG      DC    Y(L'BCD)                                

MSG      DC    AL2(L'BCD+4,0) TOTAL LENGTH + FLAGS FOR MCS   DSH1

BCD      DS    CL8                                      

         LTORG                                         

         YREGS                                         

         END   BYT2BCD

 

And here is the log file with WTO output:

 

EZ390I V1.3.09 Current Date 12/12/07 Time 12:01:14

EZ390I Copyright 2006 Automated Software Tools Corporation

EZ390I z390 is licensed under GNU General Public License

EZ390I program = BYTTBCD2

EZ390I options =

00001111

EZ390I Stats total instructions    = 79

EZ390I stats TCPIO operations      = 0

EZ390I stats DCB operations        = 0

EZ390I stats VSAM operations       = 0

EZ390I Stats current date 12/12/07 time 12:01:14

EZ390I Stats total seconds         = 0

EZ390I Stats instructions/sec      = 2323

EZ390I total errors         = 0

EZ390I return code(BYTTBCD2)= 0

 

Don Higgins

mailto:don@...

http://don.higgins.net

 

From: z390-assembler-contest@yahoogroups.com [mailto:z390-assembler-contest@yahoogroups.com] On Behalf Of Philippe Leite
Sent: Wednesday, December 12, 2007 10:07 AM
To: z390-assembler-contest@yahoogroups.com
Subject: [z390-assembler-contest] BYT2BCD

 

Hi guys,

I've just upload my little solution to problem #6.
I hope you like it ! :-)

Best regards,

Philippe Leite
z/OS System Programmer
Portugal


Messages 12 - 41 of 70   Newest  |  < Newer  |  Older >  |  Oldest
Advanced
Add to My Yahoo!      XML What's This?

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help