BLOCK WORK - v4.0 by Mark Harris Copyright (C) 1987 Status: Freeware I - Introduction Block Work is a sophisticated PRODOS and GS/OS compatible block editor. Also known as a ZAP program. Although it is specifically designed to work with PRODOS and GS/OS, with certain considerations, Block Work can be used with DOS 3.3 and Pascal formatted disks as well. Block Work is also a flexible copy program. This is again designed around PRODOS and GS/OS, but can copy DOS 3.3 and Pascal formatted disks. The main strength and advantage of Block Work is it's flexability. For example; Ever need to block edit a 3 1/2 inch disk, and you pulled out Copy II+ to do the job, and found that it couldn't handle the job? Well I did, and that's why Block Work was written. Or maybe you'd like to copy a 5 1/4 inch disk to a 3 1/2 inch disk, or to your RAM disk, again Copy II+ won't allow this. But Block Work has no problem with it. There are many other features that will be explained later in this text. A word of caution: With flexibility, comes the possibilities of problems. So practice using a expendable disk until you get the feel of this program. But once you take a few moments you'll become quite adept in manipulating your disks. With Block Work, the possibilities are endless. Thank you. Mark Harris Associate Team Member - 1WSW 9034 W. Williams Rd. Peoria, AZ (602) - 566-8488 II - Command Summary All commands should be accompanied by the Open-Apple key. (OA). OA-A = Ascii Display Mode OA-B = Set Current Block # OA-C = Copy Blocks between devices OA-E = Edit byte OA-F = Find Byte Sequence OA-H = Hex Display Mode OA-L = List disassembly of Buffer OA-P = Print Screen to Slot #1 OA-R = Read Block to Buffer OA-S = Set Current Slot # OA-T = Toggle Tone On/Off OA-V = View Directory of device OA-> = Increment Block & Read OA-< = Decrement Block & Read OA-Ctrl-W = Write Buffer To Device OA-? = Help Screen III - Command Explanation All inputs must be in Hexidecimal, unless otherwise noted. See Appendix A for more information on the Hexidecimal numbering system. OA-A = Ascii display This puts Block Work into the Ascii display mode. Everything that is done from then on will use Ascii information. For example, when you search for a byte sequence you'll be prompted for Ascii information instead of Hex. This command also resets the default search string to null, no default search string. OA-B = Set Current block # Pressing this key will allow the user to change the current block # being work with. For example, if you would like to read block #$3A, make a change and write it back to block #$110. You would follow this sequence of keystrokes; - OA-B enter 003A, or just 3A and . - OA-R Read block into buffer - OA-E Edit what you need. - OA-B enter 0110, or just 110 and . - OA-Ctrl-W Write buffer to disk at block #$110 OA-C = Copy Blocks between devices Pressing this key puts you into the copy mode of this program. With this command you can do any of the following, plus other things not listed or thought of yet. - Copy 5 1/4 to 5 1/4 inch disks. One or two drives. - Copy 3 1/2 to 3 1/2 inch disks. One or two drives. - Copy Ram disks to any of the above or visa versa. - Copy Hard disks to any of the above or visa versa. - Or any combination of the above. - Copy ranges of blocks between any of the above. - Search and replace byte sequences between any of the above - Search and replace within ranges of blocks. - Backup hard drives, or ram drives onto 5 1/4 or 3 1/2. - And other things that I haven't run across yet. See Appendix B on the copy program for more information. OA-E = Edit Byte Pressing this key will allow you to edit the buffer. This can be done either in Hexidecimal or Ascii. If your in the Hexidecimal mode, by pressing OA-E you'll be asked for which byte you would like to edit. Enter in the byte # you want to work on. At this time the byte in the buffer will be highlighted, the byte number, the current value and a prompt will be presented to you. If you press Escape, you'll back out of this operation. If you press Return, no change will be made to the byte, and the next byte will be presented to you for the same evaluation. Pressing the arrow keys will allow you to quickly and easily move around in the buffer. You'll always be presented with the current byte value for the same evaluation as before. You may also use any of the OA-keys to go to any other operation without hitting the Escape key. If you choose to enter a new hex byte the buffer will be updated, and the next byte will be displayed. This will continue on until you press Escape. If you're in Ascii mode, the same order of events will happen with one notable difference. Before being asked which byte number you want to edit, you'll be asked to specify if you want the High bit set, or reset. The difference being in the Hexidecimal value of the byte. For example the letter "A" has a hexidecimal value of $C1, (High bit set). This letter on the screen is displayed normally. The letter "A" can also be represented on the screen as a flashing character (40 columns), or Inverse (80 columns). The hexidecimal value for this letter "A" is $41. It is important to edit a letter in the correct mode, otherwise problems can arise later while using the edited data. An example of this problem can happen if you want to change the volume name of a PRODOS-GS/OS disk. PRODOS looks for the volume name in block #$02, and it must be in high bit reset mode, (Flashing). If you edit it with the high bit set, PRODOS won't recognize it as a valid volume name. So to prevent problems, mark down which type of letter is being used. *** Note- Editing a byte does not alter the disk in any way. To save the edited information to a disk you must use the OA-Ctrl-W, Write command. OA-F = Find Byte Sequence Pressing this key will allow you to search the disk for a specific byte sequence. You may enter up to a 20 byte sequence to be searched for. The "=" sign (or BD in hex mode), is the Wildcard, and can be inserted anytime you need to find a range of bytes. For example, if you want to find out anytime softswitches are being accessed you could search for this sequence; A9 BD C0 (LDA $C0XX); Remember BD="=" This will show you the places on the disk that this instruction is being executed. Or if you want to find the occurrences of a word that might be spelled incorrectly, but you're not sure how it's spelled, you might search for this sequence; MISP====== (MISPELLED) This will show you all the places on the disk that mispxxxxx occurs. If you want to search for a Hex sequence, you must be in the HEX display mode, (OA-H). And if you want to search for an Ascii sequence you must be in the ASCII mode, (OA-A). You'll find that while searching for Ascii bytes, you may enter the characters in lowercase, but the program turns them into uppercase. This happens because the Ascii search looks for the entered sequence in uppercase, lowercase, high bit set, high bit reset or a mixture of any. Once you hit OA-F, assuming your in hex mode, you'll be presented with a prompt that ask's you to enter your search sequence in hex. If you have already entered a sequence it will be displayed as the default. Pressing Return here will accept the default and start it's search. Pressing Escape here will back out of this operation. You may also use any of the OA-keys to jump to another operation. Any other hex bytes can then be entered. After the proper sequence is entered, press Return to accept, and the search will begin. Pressing Escape while searching the disk will stop the search and end the operation. If your in Ascii mode, the sequence of events is the same, only you'll have to enter Ascii Information. Remember, when you hit OA-A or OA-H you'll set the default search string to null, no default string will be displayed. OA-H = Hex display Mode Pressing this key will set the program in the Hex display mode. All work on the buffer data will be done in Hex. OA-L = List disassembly of buffer Pressing this key lists a disassembly of the code read to the buffer. This command also shows the Ascii equivalent along side of the disassembled code. You may disassemble a page at a time by pressing the Return key. Or you may disassemble one instruction at a time by pressing the space-bar. Holding down the space-bar will give you a slow non stop scroll of the code. Holding down the Return key will give you a quick non stop scroll of the code. Pressing Escape at anytime will back out of the operation. OA-P = Print screen to Slot #1 Pressing this key will print the contents of the screen to your printer connected at slot #1. This command can be invoked at anytime the program is waiting for keypress. The intialization string is set up for the Imagewriter printers. Other printers may not work as cleanly. Eventually the user will be able to designate his own initialization string. Sorry for now though. If you really need to change the intialization string, then follow these steps; - Scan the disk that the Block Work program is on. - Look for this sequence - 89 90 8E 00 EA EA EA EA EA - This equals "Ctrl-I 90 N". For the Imagewriter... - Replace this with your init string. - You only have 8 bytes to work with and an ending 00. - You must append the 00 to the end of your string. - Write it back to the same block number and try it. OA-R = Read Block to Buffer Pressing this key will read a block of information to the buffer, and display the information on the screen. This command uses the information on the top of the screen to find the correct block. You will need to set the correct Slot #, Drive #, and Block # to read first. (See Appendix C for what device is located in which slot and drive #). OA-S = Set current Slot # After pressing this key, you'll be prompted for the slot number of the device you're working with. Pressing Escape will restore the old slot number and end this operation. Enter a number between 1 and 7. When the program first starts up, it uses the slot it started up from as the current slot #. Also, when ending the program, set the Slot and Drive that you want your selector quit code to access first. This will greatly speed up your selection of the next system program. OA-T = Toggle tone ON/OFF Pressing this key will toggle the tone on or off. So if you like it silent, press this key once. If you decide you want it back, press it again. The program starts up with the tone enabled. OA-Ctrl-W = Write buffer to Block # Pressing these keys will write the contents of the buffer to the block number designated on the top information line. The control key was added for safety. OA-> = Increment Block # and Read Pressing this key will allow you to increment the block number and read it's contents to the buffer and display it on the screen. This is particularly useful to scan the disk for text while in the Ascii mode. OA-< = Decrement Block # and Read Pressing this key will do the same as the above only decrementing the block #. OA-? = Help Screen Pressing this key will give you an online summary of all the commands available to the user. Pressing any key will return you back to the main screen. ESC = Escape key Pressing the Escape key will always allow you to back out of a particular operation. If no operation is underway, pressing the Escape key will end the program. I hope that this program is of value to you in your library. I intend to update this program periodically and release it. You are welcome to pick-up updates and keep them without charge if you have sent in the initial purchase price. They will be available on BBS's or Public Domain libraries. Thank-you for your interest. Mark Harris Appendix A - The Hexidecimal numbering system The hexidecimal numbering system is a convenient system for programmers to use. An example of a hexidecimal number would be $10. (The dollar sign "$" is the standard representation of a hexidecimal number.) The number $10 does not equal the number 10. The former equals 16 in our normal decimal numbering system. While the latter does equal 10 in the decimal numbering system. The Hex numbering system utilizes 16 unique digits, they are 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F. While the decimal numbering system just uses 0-9. There are a couple of reasons why hexidecimal is so important to the computer programmer but unfortunatly I don't have the space to thorougly discuss it. But I would like to give you a couple of sources to look at. - Assembly Lines, Softalk Publishing, Roger Wagner. $3.00 from Polarware software company. - ProDOS inside and out, Appendix B, Tab Books inc. Dennis Doms and Tom Weishaar. $16.95 Walden books etc - And any other good Apple publication on Assembly. Appendix B - Copying Blocks between devices The Copy option of this program is one of the nicest features of this program. It's extremely flexible, and has features not found on any other program that I've seen. These features are; - Normal Disk copy - Copy a range of blocks from one device to another. - Copy disk while searching and replacing a string. You are not limited to device types. For example I can copy a 5 1/4 disk to a RAM disk. Or Back-up a Hard Disk. (There are other programs that will do this job more efficiently.) Or any other combination of devices. Now this could cause problems, but if your careful you'll have no problem. When copying disk to disk, you must have a formatted disk for your target disk, Otherwise a write error will occur. The upper information line will display the Slot, Drive, Block and operation that is being worked on at any given time. The normal disk copy option will keep reading from one disk and write to another disk until either the source disk runs out of blocks, or the target disk runs out of blocks. This allows you to use any combination of devices while copying. The Copy range of blocks option allows a much more controlled copying process. If you want to copy the first 80 blocks of a 5 1/4 disk to you Ram disk, you could specify this. You can even set the starting block of the target disk to a different starting block. The Search for byte sequence option allows you to specify either a hex string, or an Ascii string to search for. If the string is found it is replaced with another string that you specify. The number of times a replacement is made is displayed down at the bottom of the screen. You can use this option on the whole disk or use the Range option to be more controlled in your search. All these options allow for alot of combinations, so try them out and see what works the best. Appendix C - Device mapping in PRODOS PRODOS upon booting checks to see what machine is it's running on, and what devices are connected to it. It now stores all the information about these devices in a special location inside PRODOS. Storage devices such as Disk II's, Duo Drives, Ram disks, Hard disks, etc, are mapped to go into a specific slot and drive number. The problem is, depending on your configuation, the slot and drive number given to a device may not be the exact slot and drive that it is setting in. So, for those of you who need it heres a list of where PRODOS will map the following devices. (Assuming that these devices are connected at once.) Slot # Drive # - Device 7 1 - Hard Drive #1 (ProDOS-GS/OS) 7 2 - Hard Drive #2 ( ProDOS-GS/OS ) 6 1 - 5 1/4 Floppy drive #1 6 2 - 5 1/4 Floppy drive #2 5 1 - 3 1/2 Floppy drive #1 5 2 - 3 1/2 Floppy drive #2 or IIgs RAM5, if setup 3 2 - RAM disk 64K 2 2 - 3 1/2 Floppy drive #2 if RAM5 is installed on IIgs. -END OF FILE-