The ZAP utility allows you to directly examine and modify files on a Files-11 volume. Using ZAP, you can patch task images and data files in an interactive environment without reassembling the files. ZAP's command syntax is generally similar to that of ODT, except that commands must be terminated with a carriage return (). There are three ways of invoking ZAP. Unlike most other utilities, when using ZAP, you cannot specify the file name on the command line. Invoke ZAP as follows: >ZAP >RUN $ZAP >ZAP @indirectfile ZAP>filespec[/sw] ZAP>filespec[/sw] _zapcommand _zapcommand Further help is available for: /AB /LI /RO COMMANDS INDIRECT OPERATORS REGISTERS SEPARATORS 2 /AB ZAP>filespec/AB The /AB switch tells ZAP to process addresses as absolute byte address within the file. You should specify /AB for files that are not in task image format (tasks and resident commons). You can also specify /AB on task image files, which is the only way you can reference the task header. If /AB is not specified, addresses in ZAP command lines refer to addresses in the task image file as shown in the Task Builder task image map for the file. 2 /LI ZAP>filespec/LI The /LI switch causes ZAP to display the starting disk block and address boundaries for each overlay segment in the file. The format of the display is: bbbb: llllll-uuuuuu [type] where bbbb is the starting disk block number llllll is the lower address limit uuuuuu is the upper address limit [type] appears only for RSX-11M-PLUS-specific tasks to distinguish the pure section of a multiuser task and the data space section of an I- and D-space task. For a multiuser task, a "P" will mark the pure segment. For an I- and D-space task, a "D" will mark the data segment. For a multiuser I- and D-space task, the pure segments will be marked as "PI" and "PD". 2 /RO ZAP>filespec/RO The /RO switch opens the file in read-only mode. When /RO is specified, you can execute ZAP functions that change the contents of locations, but the changes are not written back to the file. 2 COMMANDS ZAP commands take one of the following formats: block#:address op relocreg,address op If op, the operation, opens a location, the present value of that location may be changed by typing just the new value (in octal) and pressing the RETURN key. Help is available for the following commands (HELP ZAP COMMAND command or HELP ZAP COMMAND /. for the "/" command): / (open octal word) " (open ASCII word) % (open Radix-50 word) \ (open octal byte) ' (open ASCII byte) ^ (open preceding location) _ (open offset word) @ (open indirect word) > (open relative branch) < (open last location before _, @, >) X (exit from ZAP) K (compute offset) O (jump and branch displacements) = (compute value) V (verify contents) R (set reloc register) 3 . _b:a/ _r,a/ The "/" command opens a word location, displays its contents in octal, and stores the contents of the location in the Q(uantity) register. If the address of the location is odd, the location is opened as a byte. To change the contents of the location, a new value should be typed, in octal, at the next prompt (_). For example: _0,100/ 002:0,000100/ 000000 3 " _b:a" _r,a" The '"' command opens a word location, displays its contents as two ASCII characters, and saves the contents of the location in the Q(uantity) register. If the address of the location is odd, the location is opened as a byte. To change the contents of the location, a new value should be typed, in octal, at the next prompt (_). For example: _0,100" 002:000100" AG 3 % _b:a% _r,a% The "%" command opens a word location, displays its contents as 3 Radix-50 characters, and saves the contents of the location in the Q(uantity) register. If the address of the location is odd, the location is opened as a byte. To change the contents of the location, a new value should be typed, in octal, at the next prompt (_). For example: _0,100% 002:000100% UGH 3 \ _b:a\ _r,a\ The "\" command opens a byte location, displays its contents in octal, and stores the contents of the location in the Q(uantity) register. To change the contents of the location, a new value should be typed, in octal, at the next prompt (_). For example: _0,101\ 002:0,000101\ 000 3 ' _b:a' _r,a' The "'" command opens a byte location, displays its contents as an ASCII character, and stores the contents of the location in the Q(uantity) register. To change the contents of the location, a new value should be typed, in octal, at the next prompt (_). For example: _0,101' 002:000101' A 3 ^ _^ The "^" command opens the previous location, displays its contents in the current format, and stores the contents of the location in the Q(uantity) register. If ZAP is displaying words, the previous word location is opened. If ZAP is displaying bytes, the previous byte location is opened. To change the contents of the location, a new value should be typed, in octal, at the next prompt (_). For example: _0,100/ 002:000100/ 000000 _^ 002:000076/ 000123 3 _ __ The "_" command uses the contents of the current location as an offest from the current location, opens that location, displays its contents in the current format, and stores the contents of the location in the Q(uantity) register. To change the contents of the location, a new value should be typed, in octal, at the next prompt (_). For example: _0,0/ 002:000100/ 100 __ 002:000202/ 123456 3 @ _@ The "@" command uses the contents of the current location as an absolute address, opens that location, displays its contents in the current format, and stores the contents of the location in the Q(uantity) register. To change the contents of the location, a new value should be typed, in octal, at the next prompt (_). For example: _0,0/ 002:000000/ 000100 _@ 002:000100/ 123456 3 > _> The ">" command uses the low order byte of contents of the current location as a relative branch offset, opens that location, displays its contents in the current format, and stores the contents of the location in the Q(uantity) register. To change the contents of the location, a new value should be typed, in octal, at the next prompt (_). For example: _0,0/ 002:0,000000/ 000100 _> 002:0,000202/ 123211 3 < _< The "<" command causes ZAP to return to the location where the current series of _, @, and/or > commands began, display the contents of that location in the current format, and to store the contents of that location in the Q(uantity) register. To change the contents of the location, a new value should be typed, in octal, at the next prompt (_). For example: _0,10/ 002:0,000010/ 005212 __ 002:0,005224/ 001020 _> 002:0,005266/ 000000 _@ 002:0,000000/ 000000 _< 002:0,000012/ 000430 3 X _X The "X" command write the current block back to disk (except if /RO was specified) and then exits from ZAP. 3 K _K _nK _a;nK The "K" command computes the offset between the value of the nearest relocation register and the currently open location, displays the offset value in octal, and stores it in the Q(uantity) register. The "nK" command computes the displacement in bytes between the last open location and relocation register "n", displays the offset value in octal, and stores it in the Q register. The "a;nK" command computes the displacement in bytes between address "a" and relocation register "n", displays the offset value in octal, and stores it in the Q register. For example: _2:1202/ 002:0,000010/ 000111 _K =0,000010 _0,100;1K =1,000040 3 O _aO _a;bO The "aO" command computes and displays the jump and branch displacements from the current location to the target of the branch "a". The "a;bO" command computes and displays the jump and branch displacements from location "a" to target location "b". The first number displayed is the jump displacement and the second number is the branch displacement. For example: _0,4534/ 0,004534/ 000123 _4566O 000030> 000014 _4534;4566O 000030> 000014 3 = _exp= The "=" command evalutes an expression, displays its value in octal, and stores it in the Q(uantity) register. For example: _1+2= 000003 3 V nV The "V" command verifies that the contents of the just opened location are equal to "n". The command is used only in ZAP indirect command files. 3 R _b:o;nR The "R" command sets the value of a relocation register. "b" is the number of the starting block, "o" is the virtual address offset, and "n" is the number of the relocation register (0-7). For example: _2:121200;0R 2 @ #INDIRECT 2 INDIRECT >ZAP @cmdfile Along with being used interactively, ZAP may be executed by means of an indirect command file. The command file should include all input typed to ZAP. The first line should be the file specification of the file to be modified. The last line should be "X". The following is an example of a ZAP command file: TISK.TSK 2:120004/ 30V 70 X 2 REGISTERS ZAP maintains the following registers: 0R - 7R Relocation Registers 0 through 7. C Constant Register. F Format Register. Q Quantity Register. To access the contents of a register, specify a dollar sign ($) preceding the register. For example: $C/ To modify the contents of the register, type in the new value and press the RETURN key. Further help is available for R C F Q 3 R Relocation registers 0R - 7R are used to hold addresses inside the task image. You load them with the base addresses of modules relocated by the Task Builder. By using relocation registers, you can reference locations in a module using the addresses in an assembly listing. The relocation registers are loaded differently than other registers. To load a relocation register, you enter a command line consisting of the block number and address (in normal ZAP format), a semicolon (;), and the register you want to load. From then on you can use that relocation register as part of an address. For example, assume that your task has a segment that starts in block 13 and whose low virtual address is 1572. You would then load a relocation register with that address and reference locations in the segment using the addresses in the assmebly listing (which starts from 0). _13:1572;2R _2,100/ 3 C The constant register is a register that contains a 16-bit value you specify. The value "C" can then be used in an expression. For example: _$C/ $C/ 000000 _3 _C + 2 = 000005 3 F The format register controls the format of the displayed address. If its value is 0, ZAP displays addresses relative to the closest relocation register. If the value is non-zero, ZAP displays addresses in absolute format. Zero is the initial value of the format register. 3 Q The quantity register is set by ZAP to contain the last value displayed at your terminal. "Q" can be used in expressions. 2 SEPARATORS There are three separator characters used by ZAP: "," separates a relocation register from another command line element ";" separates an address from an internal register specification; it is used in expressions that set values for relocation registers ":" separates a block number base value from an offset into the block 2 OPERATORS ZAP accepts three operators that may be used in all expressions: "+" adds one value to another value "-" subtracts one value from another value "*" multiplies one value and adds it to another; this is used in forming Radix-50 strings