1 / 13

Character Manipulation

2. MVI

koen
Download Presentation

Character Manipulation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


    1. 1 Character Manipulation

    2. 2 MVI & CLI Instructions SI instructions: area in storage and a single byte (the immediate byte) generated by the instruction itself. Two commands: MVI (Move Immediate) and CLI (Compare Immediate). Format: opcode address,byte MVI 41(R15),C'$' Move immediate. CLI MYBYTE,C' ' Compare immediate.

    3. 3 MVI & CLI Instructions Three ways to specify the immediate byte MVI MYBYTE,C'$' Easiest, most common. CLI MYBYTE,X'5B' In hex. CLI MYBYTE,B'01011011' In binary. Address doesn't need to be on a boundary, because this is character data. Don't use the "=" sign.

    4. 4 CLI Instruction CLI does a logical compare – unsigned, hex/binary. 00 is lowest, FF is highest. Condition code settings: CC = 0 means operands are equal. CC = 1 means first operand is low. CC = 2 means first operand is high.

    5. CLI & MVI Example Replace all blanks with $... LA R4,INPUT Get @ of input. LOOP CLI 0(R4),C'*' End of input? BE ENDLP If yes, get out. CLI 0(R4),C' ' If a blank, BNE SKIP MVI 0(R4),C'$' replace with $. SKIP LA R4,1(R4) Get next char. B LOOP ENDLP … … INPUT DS CL80 DC C'*'

    6. 6 SI Encoding hohoh1h1 hBhDhDhD hoho op code h1h1 immediate byte in hex hB base register hDhDhD displacement Note no index register.

    7. 7 MVC & CLC Instructions MVC (Move Character) is counterpart of MVI, but moves up to 256 characters instead of just one. CLC (Compare Logical Character) is counterpart of CLI, but can compare up to 256 characters.

    8. 8 MVC & CLC Instructions SS instructions: two fields that are both in storage. Two formats (only first one right now): a) both operands are the same length. b) the operands are of different lengths. First format: label opcode D1(L,B1),D2(B2)

    9. 9 MVC & CLC Instructions Note no index register; length instead. L (real length) applies to both operands, up to 256. If no length is specified, the implied length of first operand is used. Careful: this will use only the length of the named operand, so best to actually specify... PLINE DC C’0’ PLNAME DS CL15

    10. 10 MVC Instruction Examples: Move name to a print line: MVC 4(20,R8),0(R5) MVC PLNAME(20),NAMEIN Blank out a print line: MVC PLINE(133),=CL133' ' Unfortunately, this reserves an additional 133 characters of blanks, where the CL133' ' is stored by the LTORG. A better way, that uses no additional storage...

    11. 11 MVC Instruction MVI PLINE,C' ' MVC PLINE+1(132),PLINE (Starts at left, altering one byte at a time.) PLINE

    12. 12 CLC Instruction CC set same as for CLI. Compares as characters, even if numeric data. I.e., FFFFFFF1 (a negative number) will be larger than 00000001 (a positive number). CLC example: CLC 4(16, R5),8(R6) CLC INNAME(15),SRCHNAME

    13. 13 Encoding SS Instructions hohohLhL hB1hD1 hD1 hD1 hB2hD2hD2hD2 hoho op code hLhL length code (length - 1). (Applies to both operands, up to 255/256. If 0 or 1 in instruction, code = 0. ) hB1hD1hD1hD1 base/displacement for first operand. hB2hD2hD2hD2 base/displacement for second operand. Again, no index register.

More Related