CHAP04.TXT Version 1.01 12/27/84 Robert Flagg 72466,2332 Chapter 4 - Patching Even where a program cannot be easily overlaid, it is often possible to configure it for a particular computer or function by changing the object code byte-by-byte. Overlaying is a fast way of making many such changes, but it is cumbersome and unnecessary where only a few changes need to be made. Making changes in this manner is called "patching". DDT may be used for examining and changing the values at each address in the program, with its "s" (Set) command. For example, a common patch is changing the cursor delays in WordStar 3.3 (WS.COM): A>DDT WS.COM DDT VERS 2.2 <---returned by the command NEXT PC <---returned by the command 4800 0100 <---returned by the command -s02AF <---the command and starting address (HEX) -02AF 03 ** <---returned by command - option to change ** <---the ** does not appear on your screen <---Changing the delays: (note that the delays are DECIMAL!) Hex Old New Add. -02AF 03 01 <---(cr) makes the change and -02B0 09 03 <---moves to next address (HEX) -02B1 19 09 <---change next delay -02B2 40 19 <--- -02B3 09 03 <---last delay -02B4 00 <---(cr) keeps data unaltered -02B5 00 <---(.) exits "s" mode -g0 <---exit from DDT WARM BOOT <---system response A>SAVE 72 WSNEW.COM DDT was created in 1976 by Digital Research. Much easier screen-oriented patching tools have been developed since then. Notable examples in the public domain are EDFILE and its very recent offspring, PATCH. The following is an example of invoking EDFILE for the purpose of examining the file PATNEW.COM. PATCH is similar, except that it is much more screen oriented, making use of hilighting and also using the standard WordStar cursor movement control keys (^X, ^S, ^D, etc.). PATCH also allows you to edit memory (and in versions 1.5 and above -track-by-track on any disk drive!) .PO 5 A>edfile c:patnew.com Vers: 01-10-84; by: J.C.Kaltwasser & M.J.Mosko, K3RL File: C:PATNEW.COM Record: 00001 (0001H) LOF: 00171 (00ABH) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 0123456789ABCDEF -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ---------------- 0180- 65 74 69 74 00 00 00 00 00 00 00 04 1B 3D 00 00 >etit.........=..< 0190- 64 00 1B 6C 2F 63 00 1B 2F 6C 63 01 20 20 04 03 >d..l/c../lc. ..< 01A0- 0A 00 01 1A 2A 40 23 00 00 11 00 00 00 00 02 1B >....*@@#.........< 01B0- 45 00 00 00 02 1B 52 08 00 00 0A 00 02 1B 54 00 >E.....R.......T.< 01C0- 00 00 02 1B 29 34 00 00 02 1B 28 30 00 00 0A 00 >....)4....(0....< 01D0- 7E B7 37 C8 23 F5 E5 7E CD 00 02 E1 F1 3D C8 18 >~77H#ue~M..aq=H.< 01E0- F3 CD 25 02 0D 0A 00 C9 C5 D5 E5 DD E5 FD E5 F5 >sM%....IEUe]e}eu< 01F0- 6F 26 00 E5 CD A6 00 F1 FD E1 DD E1 E1 D1 C1 C9 >o&.eM&.q}a]aaQAI< ? File: C:PATNEW.COM Record: 00002 (0002H) LOF: 00171 (00ABH) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 0123456789ABCDEF -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ---------------- 0200- 6F E5 CD A6 00 C9 FE 80 DC 90 02 D4 A9 02 E6 7F >oeM&.I~.\..T).f< 0210- 18 EE C5 D5 E5 DD E5 FD E5 CD A3 00 7D 18 D9 E5 >.nEUe]e}eM#.}.Ye< 0220- 21 06 02 18 04 E5 21 00 02 22 38 02 E1 E3 F5 C5 >!....e!.."8.acuE< 0230- D5 7E 23 B7 28 07 E5 CD 00 02 E1 18 F4 D1 C1 F1 >U~#7(.eM..a.tQAq< 0240- E3 C9 7D B4 C8 3A 24 01 87 87 87 E3 E3 E3 E3 C5 >cI}4H:$....ccccE< 0250- 01 D2 04 C1 3D 20 F4 2B 18 E8 CD D0 01 D8 2A CE >.R.A= t+.hMP.X*N< 0260- 01 18 DF F5 C5 D5 E5 21 A8 01 CD 5A 02 21 A2 01 >.._uEUe!(.MZ.!".< 0270- CD D0 01 2A BA 01 D4 42 02 E1 D1 C1 F1 C9 F5 C5 >MP.*:.TB.aQAqIuE< ?Q .PO 8 As you can see, a takes you through the file one page at a time. Both HEX and ASCII are dumped to the screen, and finding an address is simply a matter of reading across and down. Both EDFILE and PATCH allow you to edit either the HEX or the ASCII columns and both allow writing of the edited file back to the disk by a simple write command, thus eliminating those pesky "SAVE" sizes! A very useful feature of these programs is the ability to search through a file for HEX and/or ASCII strings. PATCH version 1.5 is available on the KayPro SIG in DL1. There are several files: PAT15.BIN(COM), the object code file, PAT15.DOC, the documentation and three files used for installing the program on your system: PATINS.BIN(COM), the installer, PAT15.INS, the installation message file and PAT15.DTA, a binary data file containing data on about 30 common terminals, including KayPro with and without hilighting!