Re: Making Encoded Bits Human Readable

2022-02-07 Thread Bob Raicer

Just for fun, here is yet one more variation on Peter's scheme, using
only S/360 instructions.  In the comments, YY and ZZ represent the two
bit pairs of interest, lower case x represents bits or bytes of unknown
value.  Bit strings are enclosed in square brackets.  Bytes are separated
by underscore characters.


 XR    R14,R14  R14 = 00_00_00_00
 IC    R14,BYTE R14 = 00_00_00_[YYZZ]
 SRDL  R14,6(0) R14 = 00_00_00_[00YY]
*   R15 = [ZZxx]_xx_xx_xx
 SRL   R15,30(0)    R15 = 00_00_00_[00ZZ]
 LA    R14,X'F1'(,R14)  * Scale x'00' through x'03'
 LA    R15,X'F1'(,R15)  * to x'F1' through x'F4'


Re: Making Encoded Bits Human Readable

2022-02-07 Thread Bob Raicer

Making Peter's approach even more old school, use R14 and R15
instead of R0 and R1, and do the character conversion stuff
with Load Address instead of Add Halfword Immediate.

 ICM   R14,B'1000',BYTE   Put the byte into bits 0-7
 SRDL  R14,30 Move BYTE.0-1 to reg 14.30-31,
* zeroing reg 14.0-29
* BYTE.2-3 to reg 15.0-1
 SRL   R15,30 Move BYTE.2-3 to reg 15.30-31,
* zeroing reg 15.0-29
 LA    R14,X'F1'(,R14)    0-3 => C'1'-C'4'
 LA    R15,X'F1'(,R15)

 STC   R14,TARGET0
 STC   R15,TARGET1
BYTE DS    X