PK.DOC ------ Documentation for PK.COM Version 1.2 (c) 07/84 E.Meyer PK.COM is a handy PeeK and PoKe utility for CP/M. Written in 8080 assembler, it takes only 1K of disk space. It allows you to examine or change the contents of any location in RAM. You can also read or send a byte to a hardware port. Here is a brief summary of PK syntax ("[]" = optional): A>pk [b:]aaaa[+nn][=vv] or A>pk [b:]aaaa=vvvv.... or A>pk #pp[=vv] Be careful to use only valid hex digits 0-f, and specify ALL digits, even leading 0's, to avoid unpredictable results. The "b:" parameter in the above examples is used only on systems with banked memory; see NOTE below. I. PEEK: Examine memory locations You can examine anything from a single byte to a full page (256 bytes) of memory. There are two different formats: (1) To examine a single byte: A>pk aaaa (2) To examine many bytes: A>pk aaaa+nn Examples: PK 003B shows the value at address 003B. PK 0600+4F shows all bytes from 0600 to 064F. PK always displays the requested location(s) in hex and ASCII: A>pk 005d+07 PK 1.2 - 07/84 - E.Meyer 005D: 30 30 35 >005< 0060: 44 2B 30 37 20 >D+07 < Of course 005C is the address of CP/M's first FCB, so its contents were simply the argument we gave on the command line with PK. II. POKE: Change memory locations PK also allows you to poke desired values into memory. There are three different formats for doing this. (1) To poke a single byte: A>pk aaaa=vv (2) To poke the same value into many bytes: A>pk aaaa+nn=vv (3) To poke a series of up to 16 different values: A>pk aaaa=vvvv.... Examples: PK 309D=E5 pokes value E5 into address 309D. PK 4000+07=00 pokes value 00 into addresses 4000-4007. PK 0006=43FB pokes 43 into 0006 and FB into 0007. The values that display on screen are the values just poked. III. IN/OUT: Communicate with hardware port PK also allows you to talk to hardware ports using the IN and OUT assembler commands. To do this, the argument should begin with a number sign "#" and the port number, "pp". (1) To read a hardware port: A>pk #pp (2) To send a value to it: A>pk #pp=vv Examples: PK #0D reads the byte from port 0D. PK #0C=E8 sends byte E8 to port 0C. The port number and the value read or sent will be displayed. -------- NOTE ON BANKED MEMORY (CP/M PLUS ONLY) -------- If you do not have banked memory (found in most implementations of CP/M 3.0), do not use the "b:" parameter. If you intend to use it, be sure to install your machine's bank control port number with SID at location 0103 in PK.COM. The default is 00, for an Osborne Executive. The "b:" parameter may not work on your machine if its bank selection protocols are different. When PK sees a "7:" before the address "aaaa" on the command line, for example, it sends the byte 01000000 to the control port, enabling bank 7 (as well as 0 of course) before operating on memory. The original bank configuration is restored on exit. The default bank is "1:", the TPA. Accessing other banks can be hazardous. Often they are "reserved" for system use. Sometimes the same addresses can refer to different entities on reading and writing. If you use an address that doesn't exist in the specified bank, you will be operating on bank 0. Review your machine's manual carefully. PK has to use an odd trick to switch banks, in order to avoid losing itself, since switching banks disables bank 1, which is where PK itself resides. The BDOS, though, is usually visible under any bank selection, as is a small amount of RAM just below it. PK.COM puts a little piece of itself (about 20 bytes) up in high memory, just under the BDOS, on the assumption that it won't get wiped out by the bank switch. This should work, unless so many RSXs are present that PK can't get itself high enough. For example, it will work on my Executive unless there are more than two pages of RSXs in memory. If you find that PK crashes when you try to access another bank, and you don't have RSXs that you could remove, it's a sign that this trick isn't working on your machine, and you just won't be able to reach that bank.