Skip to content
rust11 edited this page Mar 15, 2021 · 1 revision

PATCH file

PATCH.SAV examines and modifies binary files.

File The specification of the file to be patched.

  DCL             CSI     PATCH   Operation
  ---             ---     -----   ---------
  /ASCII          /A      ^A      Display ascii data
  /BYTES          /B      ^B      Display bytes
  /DECIMAL        /D      ^D      Display decimal values
  /IMMEDIATELY    /F              Update file immediately
  /HEXADECIMAL    /H      ^H      Display hexadecimal
  /MEMORY         /M              Patch memory
  /INSPECT        /N              Do not alter file
  /INSTRUCTION    /I      ^I      Display PDP-11 instructions
  /OCTAL          /O      ^O      Display octal (default)
                  /R      ^R      Display rad50
  /RAD50          /X              Display rad50
  /WORDS          /W      ^W      Display words (default)
  • Patches files of up to a megabyte.
  • Modifications are usually not applied to the file until you exit.
  • The /IMMEDIATELY option modifies this behaviour.
  • You can patch process memory and system memory with PATCH.
  • Replaces the (retired) RT-11 PATCH utility.
  • For more information see Patch_Command.

Single-Line Commands

The single-line command below:

  .patch sy:myprog 400?355=1777.e

Expands to the following sequence:

  .patch sy:mprog
  000000  000000  | 400           ! open location 400
  000400  000355  | ?355          ! make sure it's 355
  000400  000355  | =1777         ! change it
  000402  000456  | .e            ! exit and make change permanent

Interactive Session

PATCH commands have the syntax below. Commands are terminated with [return] or [linefeed]:

  address content | command       
  1000    104035  | 
  • You abort a PATCH session with CTRL-C.
  • PATCH asks for confirmation if modifications have been made.

Control Commands

  .a      Advance by words in instruction mode
  .c      Combine instruction & numeric mode
  .e      Exit, update file with changes
  .i      Advance by instructions
  .j      Jump to instruction destination
  .n      Enable/disable EMT display
  .o      Use with ^I to alternately change display format
  .p      Use with .j, returns to the pre-branch location
  .q      Quit, do not write changes out
  .sv,s,e Search for Value, between Start & End
  .s      Search for next occurence
  .u      Update changes, continue patching

Navigation Commands

  [enter] Display next location
  nnn     Display location N
  /       Reopen current location
  +       Display next location
  +nnn    Add N to address
  -       Display previous location
  -nnn    Subtract N from address
  =v      Deposit value V
  @       Display indirect location
  _       Display relative location
  %       Display branch destination
  ?       Verify contents of location
  $a=nnn  Sets variable value

Radix Commands

  ^A      Display ascii
  ^B      Display bytes
  ^H      Display hexadecimal
  ^I      Display MACRO instructions 
  ^O      Display octal - default
  ^R      Display rad50
  ^W      Display words - default

Variables

PATCH makes 26 variables A..Z available.

  000000  040000  | a=54000      ! store value 54000 in A
  000000  040000  | a             ! open location in A
  054000  120333  |
Clone this wiki locally