1 / 8

ZAP Zero and Add Packed

The ZAP instruction in SS2 explicitly codes and adds packed fields. It can handle fields of different sizes and does not require the first field to contain packed data. ZAP is preferred over MVC for packed decimal fields. This instruction zeros the target field and then adds the source field.

kolivia
Download Presentation

ZAP Zero and Add Packed

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. ZAPZero and Add Packed

  2. ZAP • Instruction type: SS2 • Explicit Coding: D1(L1,B1),D2(L2,B2) • Example ZAP 3(4,5),8(9,7) • Example ZAP X(3),Y(4) • Example ZAP X,Y • Zeroes the target field and then adds the source field. Fields can have different sizes. • Use ZAP not MVC on packed decimal fields. • First field doesn’t have to contain packed data

  3. What does it do? ZAP X,Y 00 12 3C Y X 00 00 00 12 3C CC = 2 =Positive PADDING 0’s

  4. What does it do? ZAP X,Y 00 00 12 34 45 6C Y 45 6C CC = 3 = Overflow X Truncation

  5. ZAP Assume: Y DC PL3’-123.45’ X DS PL5’-1’ You execute: ZAP X,Y X Before: Y Before: 000000001D 12345D X After:Y After: 000012345D 12345D

  6. ZAP Assume: X DC PL3’40’ You execute: ZAP X,X BP THERE … THERE EQU * X Before: 00040C X After: 00040C

  7. Programming Tips • Never use MVC to transfer packed data • The largest field that can be copied is 16 bytes • ZAP generates a data exception (SOC7) if the second operand isn’t packed. The first operand can contain anything – it get’s zeroed out

  8. Try it in VisibleZ • Try the following programs: • zap.obj • zap1.obj • zap2.obj • zap3.obj • zap4.obj

More Related