Thanks to all!  Especially pointing out different ways to do it, like this.

The first assembler language I learned to any proficiency was for a PIC 
microcontroller. (RISC and Harvard) It had I believe only 33 instructions which 
were easy to learn.  On the other hand, you really had to think to make those 
few do all the things you wanted to do.  That I liked.

This on the other hand makes me go Doh!  (-:  I learned a shift left 
instruction without thinking there was an equivalent to shift to the right as 
well.  I totally LOL'd at myself on this one.  On the other hand the amount of 
and complexity of (some of) the zArch instructions can be overwhelming to a new 
learner.  I couldn't do it without you guys. (-; Thanks.

(ps. I accidentally posted my original to IBM-MAIN while thinking I was posting 
to the Assembler list.)


-----Original Message-----
From: IBM Mainframe Discussion List on behalf of Bill Wilkie
Sent: Fri 12/28/2007 4:00 PM
To: IBM-MAIN@BAMA.UA.EDU
Subject: Re: Shifting nibbles to the end of a register
 
Lindy:
 
You mention moving a nibble but your INTENDED code doesn't do that. You are 
just moving the 9A from the LO byte to the HO byte. A nibble as I recall is 4 
bits of a byte, either the LO or HO 4. To move out a nibble:
 
LA     R4,X'9A'
SRDL  R4,4
SRL    R5,28
 
That will yield:
 
R4= 00000009
R5= 0000000A
 
Alternatively, to move it to the HO byte of R5 instead of to the LO byte, SRL 
R5,4. You could then do a STCM R5 of either the HO byte or the LO byte.  
 
Using the algebraic Shift involves a sign so use the logical. 
 
Bill 

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to