The NURSE software has been release for free distribution by the author, Dave Datta. If you have questions, contact datta@cs.uwp.edu (Internet) N.U.R.S.E. A Disk Utility Kit for the Commodore 64, Commodore 128 and any Commodore Floppy Disk Drive from Datta Production & Development Software and Documentation By David Datta Copyright (C) 1986,1987,1988 Datta Production & Development Table of Contents Introduction Getting started EDIT Mode Cursor Keys Move to end of window Tab Get new position Input new ,position Quit Help mode SINGLE BYTE changes Enter decimal Enter Hex Insert chr$(0) Insert chr$(13) Increment Byte Decrement Byte Enter Text Reverse Text Edit HEX Bytes RANGE options Setting the Range EXCLUSIVE OR (XOR) ADD SUBTRACT FILL AND OR TRACK and SECTOR changes Rewrite sector to disk Rewrite without confirm Increment sector Decrement sector Increment track Decrement track Change track and sector number Link to next block in file Jump to link under cursor New block Re-read Block AUTOMATIC commands Automatic link through file Sequential trace of disk Search and Replace Replace Search Sequential search Get search string Search and Replace Editor Edit replace string Edit search string Move to Position Zero Edit search Edit Replace Move to Position Zero Clear string. Copy search to replace Other Editor Commands. Set string Lengths Quit string editor Wildcards Turn on Wildcard character. Turn off wild card. Memory Buffer Memory Buffer Up Memory Buffer Down DEVICE options Change printer device Change disk Change device Change drive Change head Swaps current viewing screen Setting Colors Window Color Highlight Color Background Color Restore Default colors Disassembly Jump to the next opcode Branching Macro Commands Enter macro Execute macro Record mode on Record mode off Playback mode on Edit Record Sequence Setting Defaults Sample file edit example Printer Default Device Printer Secondary Address Borders (Window outlines) Windows (Window text color) Background Color Memory Buffer Address Other commands Rotate left Rotate right Print sector Read Disk Memory Re-initialize Burst Mode Read/Write Errors How Information is stored on the disk Directory entry format A 1541 disk directory sector So What can I do now? Undeleting files Changing the Disk Name and ID Appendix A drive is not supported Bootsector utility 128 Source code files Extramon 128 Up and Down scrolling Disk commands Interrogate command Change current print device Compute Checksum Format 1571 Back Side 128 BASIC Print Routines for the C128 and C64 Error Checker for the 1571 Source Code Formatter Input file name output files Comment column Output device Tabs or Spaces Screen Dump 128 Super Search And Recover 1 block files creating files analyze the first sector file has been overwritten Restarting SSAR/128 Limited Warranty Acknowledgments Credits Introduction N.U.R.S.E. is a comprehensive diskette sector editor written for the Commodore 64* and the Commodore 128* computers. Designed for ease of use N.U.R.S.E. includes many commands you only dreamed of having in other sector editors for Commodore computers. * Supports the Commodore 2031 lp, 2040, 4040, 8050, 8250, SFD 1001, 1541, 1571 and the new 1581 disk drives. * Supports both drives 0 and 1 on dual drives. * Supports all disk devices from 8 - 11. * Prints a sector to any printer. (Printer devices 4 & 5 and the plotter device 6.) * Supports 80 column and FAST mode on the C128*. * Easy to use -- Most commands are just 1 keypress. * Includes a help mode that will identify all commands associated with any key. * Searches the disk or file for a string up to 30 characters long. * Make changes in HEX, DECIMAL, or TEXT. * Recovers damaged data -- reads through errors when possible. * Do operations on segments of the sector -- FILL, AND, OR, ADD, SUBTRACT, & EXCLUSIVE-OR with any value. * Not copy-protected. Copy N.U.R.S.E. to your favorite format. * Scan a disk or file to find errors, includes a pause so you can find other interesting stuff. * Dis-assembles the current byte. * Will not allow illegal track and sectors on supported disk drives. * 256 character macro -- have N.U.R.S.E. type the repetitious commands for you. * Lets you copy a sector to another sector or even another disk. Getting started To load N.U.R.S.E.: on the C-128* : DLOAD"NURSE128" RUN on the C-64* : LOAD "NURSE64" , 8 RUN From here on all instructions are the same for both versions except where noted. After you run N.U.R.S.E. a title screen will appear. At this point take the N.U.R.S.E. system disk out and put the disk you wish to edit into the drive. (For dual drive owners, this must be drive 0.) The startup device can be 8,9,10, or 11, N.U.R.S.E. will use the first available drive. When you have your disk in the drive, press any key and the main N.U.R.S.E. screen will appear. After a short time, N.U.R.S.E. will identify the disk drive that you are using in the upper right side of the screen. If you get "???? ??" as the drive type, please read Appendix A. When using the 1571, N.U.R.S.E. will identify it as a 1541* if you have a single sided disk in the drive. Some 1571s* may take a while to identify "flippy" disks- those formatted by flipping the disk over on a 1541- this is normal and due to early 1571 ROMS. Next, N.U.R.S.E. will prompt you for the track and sector you wish to edit. The default track will be the catalogue track for your disk drive and the starting sector will be 1 (the first sector of the catalogue.) After the track and sector you wish to edit have been entered, the block is read and you are in the edit mode. EDIT Mode The following is a list and brief description of each command of N.U.R.S.E. while in edit mode. Cursor Keys: Left,right,up,down, and the HOME key. These commands work as they do with the Commodore BASIC editor in normal mode but they are limited to the boundaries of the editing window. Additional movement keys: English Pound- Move to end of window. Moves the cursor to the end of the editing window (position 255). I - Tab. Moves the cursor to the right 8 spaces. (also TAB key in the 128 mode.) G - Get new position. Gets new value for the cursor position from the byte currently under the cursor. Example: if the current byte is CHR$(100) the new position will be 100. SHIFT G - Input new ,position. Moves the cursor to a position you input. Q - Quit. Quit N.U.R.S.E.. H - Help mode. Press any key that you wish to have information on. N.U.R.S.E. will tell you what the current definitions for all modes of the key (Shifted, Control. . . etc.). Keys pressed with Control , Commodore, or Shift will be ignored. Pressing the space bar will exit this mode. SINGLE BYTE changes These commands will allow you to change the ascii value of the byte under the cursor (referred to as the "cursor byte" from here on.) @ - Enter decimal. This command will move the cursor to the window containing the decimal value of the cursor byte. Enter a new number and press RETURN to exit. The new number will be entered and the byte will change. * - Enter Hex. This command will move the cursor to the window with the hex value of the cursor byte. Enter a new number in hex and press RETURN. Do not type "$" to notate hex. 0 - Insert chr$(0). Changes the cursor byte to CHR$(0) and moves the cursor right one. COMMODORE M - Insert chr$(13). Changes the cursor byte to CHR$(13) and moves the cursor right one. F1 - Increment Byte. This key will increment the cursor byte by 1 and wrap around to 0 after 255. F3 - Decrement Byte. This key will decrement the cursor byte by 1. Decrementing zero will wrap around to 255. T - Enter Text. Enters TEXT mode. Type a string from the keyboard and terminate with RETURN. Please note, you can enter control characters from the keyboard. Control M will execute a RETURN and exit text mode. When typing SHIFTed letters will appear as inverse, unshifted letters will be in plain upper case letters, and some control characters appear as lower case letters. Some characters do not appear on the screen properly. The @ sign will appear as a horizontal line. Other keys may also generate strange screen characters. This is because the screen codes are not the same as the ASCII codes. You can get a list of the screen codes in many reference guides so they are not included in this manual. SHIFT T - Reverse Text. Enters REVERSE TEXT mode. Same as above but the cursor moves right to left. M - Edit HEX Bytes Allows the user to edit the cursor byte and seven following bytes in hex. The cursor is moved to the lower editing window where eight byte values in hex can be typed separated by a space. Do not use the "$" to denote hex. Press return to exit. If you enter a value that is not valid, N.U.R.S.E. will replace it with zero. RANGE options The following list of commands have one thing in common. They all allow the user to change a RANGE of values. Setting the Range. When using these commands you must follow the following procedure: 1. Move the cursor to the start of the range to be affected and press a command that uses RANGE. 2. Enter a value. Value entry: N.U.R.S.E. will wait for you to press a key. The base/method of entry depends on the first character you press. To enter in: 1) Decimal - press a digit 0-9. 2) Hex - press the dollar sign ($). 3) ASCII - press any other key the ASCII code of that key will be used. (Eg. press an 'A' and the value used is 65 press 32 and the value used is 32, press $20 and the value used is 32.) 3. Move the cursor to the end of the area you wish to use as the range. The color of the selected area will be the same as the window border color. 4. Press RETURN to set the range and execute the command. If you make a mistake when entering the value or if you decide to cancel the command press the back arrow key (ESC key will also abort in 128 mode). The commands that allow the RANGE are as follows: X EXCLUSIVE OR (XOR) range with value. F2 ADD value to range. F4 SUBTRACT value from range. F FILL range with value. A AND range with value. O OR range with value. TRACK and SECTOR changes With the exception of the Block command none of the following commands will allow the user to use an illegal track or sector for the disk being edited. If N.U.R.S.E. identifies the disk drive as "???? ??" then it may be possible to get illegal tracks and sectors. If this occurs, please read Appendix A. R - Rewrite sector to disk. This will ask you for confirmation and act accordingly. SHIFT R - Rewrite without confirm. Rewrite sector to disk. This will not ask you for confirmation. + Increment sector. This will read the next sector on the disk. If you are on the last sector of a track then N.U.R.S.E. will wrap around to the first sector on the next track. - Decrement sector. Reads the previous sector on the same track. If the user invokes '-' on sector zero of a track the last sector for the previous track will be read. SHIFT + Increment track. Reads the same sector on the next track. If the new sector would be illegal this command is ignored. SHIFT - Decrement track. Reads same sector on the previous track. If the new sector would be illegal this command is ignored. # - Change track and sector number. This allows you to change where the sector will be written to with the Rewrite command. The cursor will be moved to the two windows at the top right corner of the screen. Enter the new track number and press return. Then enter the new sector number and press return. The cursor will stay in the windows until a valid track and sector combination is input. This allows you to make a copy of the sector to a different place on the disk. L - Follow Link to next block in file. This allows you to follow a file one sector at a time. The link to the next file block is stored in the first and second bytes in the sector (positions 0 and 1). N.U.R.S.E. will take the first byte for the new track and the second byte for the new sector number. If the new track and sector combination is invalid this command is ignored. J - Jump to link under cursor. N.U.R.S.E. will take the cursor byte for the new track and the next byte for the new sector and read it in. This can be useful in jumping to the start of a file from the directory. As in the above commands this is ignored if an illegal track and sector combination results. B - New block. Prompts the user for a new track and sector combination to read, and then reads that sector. This will allow an invalid combination for track and sector. The user can read and write from a disk not supported by N.U.R.S.E. (the disk is not supported if the drive type is '???? ??'. If this is the case please read Appendix A). SHIFT B - Re-read Block. Reads the current block from disk. Does not prompt for a new track and sector combination. AUTOMATIC commands The following list of commands will automatically change sectors. They can all be stopped with any keypress or disk error. CONTROL L - Automatic link through file. This will follow the track and sector link for a file until an end of file marker (track 0 as link), disk error, or keypress. A pause is included to allow time to react and stop on a sector if you see something interesting. COMMODORE + Sequential trace of disk. This will scan a disk starting on the current track and sector. The scan is executed as follows: Starting on track 18 sector 0. Moves to [18,1], [18,2], [18,3] ... [18,18] ,[19,0] ,[19,1]...[highest allowable track,highest allowable sector]. A pause is used so you can stop the scan if you see something interesting. This command can be used to find bad sector on a disk as it also stops on disk errors. Search and Replace ^ - Replace. Copy from replace buffer to current cursor position. Places the cursor at the end of copied string. The replace string will be copied until the end of the string. S - Search. The search string stored on the bottom of the screen is searched for starting at the current cursor position, track, and sector (see rules for search string in the next section). If the string is not found search will follow the file links (as in the auto link function above). If a string is split between two sectors it will not be found. This feature does not pause, but it can be stopped with a keypress. SHIFT S - Sequential search. Searches for the string in the search buffer starting at the current cursor position, track, and sector (see rules for search string in the next section). This command automatically increments sector as in the COMMODORE + command above. Can be stopped with a keypress. = - Get search string. Copy from cursor position to cursor position + 29 to search buffer Search and Replace Editor The search and replace strings are entered by editing the buffers on the bottom of the string. Each string can be up to 30 characters long. The end of string is entered with the 'S' command. The commands for the string editor are as follows: SHIFT E - Edit replace string. Enter edit buffer for replace string. E - Edit search string. Enter edit buffer for search string. When in the search/replace edit mode you have the following commands: HOME - Move to Position Zero. Move to position Zero in string editor. UP - Edit search. Change to edit search mode when in edit replace mode. DOWN - Edit Replace Change to edit replace mode, (only active when in edit search mode). RETURN - Move to Position Zero. Same as HOME. SHIFT HOME (CLR) - Clear string. Fill from current cursor position to end of string with CHR$(0). Also clears all wildcard characters by turning them back on for the search. = - Copy search to replace. Copy one byte from the search buffer to the same position in the replace buffer and move the cursor right one. F1,F3,T,#,*,@,0,left,right - Other Editor Commands. Same functions as in the normal editor, described elsewhere. S/R - Set string Lengths. Set search/replace string length. Move the cursor to the last character you wish to include in the search string and press S/R. The color of the search/replace string will change to the color of the editing window. Q - Quit string editor Quit string editor and return to normal edit mode. Wildcards (placeholders that will match any character.) The use is a follows: - - Turn on Wildcard character. + - Turn off wild card. Move to the position you wish to place a wild card character, press the minus key (-). The plus key (+) will turn a wild card off. The first character of the search string can be turned on & off but it will not function as a wildcard. The Clear to end of string command in the string edit mode will clear all of the wildcards. The color of the wild card character when it is on will be the same as the color of a non-functional string character (the line-border color.) The Memory Buffer The memory buffer will enable the user to load a block from the disk into a specific memory location. The address the buffer is located is printed in the upper left side of the main screen. The following commands allow the user to change where the buffer is located. In the C-64* the buffer can be located from the top of memory used by N.U.R.S.E. to $9f00. In the C-128* the buffer is in bank 1 from $0400 to $fd00. Due to the location in bank 1, N.U.R.S.E. is not compatible with the TSDS* Assembler by NoSync Corp. ] - Memory Buffer Up. Move the memory buffer up 256 bytes. [ - Memory Buffer Down Move the memory buffer down 256 bytes. DEVICE options N.U.R.S.E. is implemented to take advantage of whatever equipment you are using. The following commands allow you to copy sectors from disk to disk and print on any valid devices you may have available. F8 - Change printer device. Changes the current printer to the next allowable printer device. Will allow the use of printers with device numbers 4,5, or 6. The secondary address is changed with the printer as follows: with 4 and 5 the secondary address is 7 for upper/lower case. For device 6 the secondary address is 0 for data output to the plotter. C - Change disk. Allows the replacement of the disk in the drive with another. It will reset values for the new disk (for example if you have a 1571* disk in and you change it to a 1541/4040 compatible disk, the track and sector checks will still work. If the current sector is not valid you can still try to write it and you WILL get an illegal track or sector. F7 - Change device. This will look for the next available disk drive and use it for reading and writing. When no other device is present has the same effect as the Change disk command. F5 - Change drive. Changes from drive 0 to drive 1 (or 1 to 0) on dual drives. If executed on a single drive (0) it has the same effect as the Change disk option. F6 - Change head. Changes from head 0 to head 1 (or 1 to 0) on the 1571 drive when the disk is identified as 1541. If executed on a 1541 drive (head 1 does not exist) it has the same effect as the Change disk option. V (C-128* only) - Swaps current viewing screen. If 80 column screen is activated then the clock speed is changed to 2MHZ. If 40 Column screen is activated then the 80 column screen is no-longer updated. Setting Colors 1 - Window Color. Change the color of the window borders. 2 - Highlight Color. Change the color of the highlighted text. 3 - Background Color. Change the background colors. 5 - Restore Default colors. Change the colors back to the defaults. Disassembly D - Jump to the next opcode. This will move the cursor right the number of bytes to skip over the current opcode. If it is not a valid opcode then the cursor moves one right. Branching When branch commands are computed they return a decimal value that is the offset from the CURRENT cursor position. This allows you to count where the branch will go. Please remember when counting not to count track and sector links. Macro Commands CONTROL 1 - Enter macro. This defines the macro key. It will allow you to enter up to 10 characters to be used when the shift 1 is pressed. To enter a macro less than 10 characters press the back arrow key when done. After you press the tenth character you will return to edit mode. When you press RETURN it will appear as the back arrow character. Recursive macros can be created by putting "!" at the end. (Recursive <==> Self Calling). SHIFT 1 - Execute macro. This key will execute up to 10 N.U.R.S.E. commands for you. The keys are defined with the Control 1 command. When a macro is executing you can stop by pressing and holding the commodore key. You cannot resume a macro once it is stopped. CONTROL 8 (RVS on) - Record mode on. This will turn the record mode on. The next 256 keystrokes will be 'remembered' in a buffer. Record will be turned off if an error occurs. Invalid keystrokes can be entered. If a playback command is typed it is recorded but not executed. CONTROL 9 (RVS off) - Record mode off. This will end record mode. It is inactive when record is not on. CONTROL P - Playback mode on. This will cause the keystrokes that were 'remembered' from the record mode to be re-typed. If a playback command is encountered then the playback will re-start. Playback can be stopped by pressing the back arrow key. This command will not activate while record is on. CONTROL = - Edit Record Sequence. Swaps the current edit window with the record buffer. Allows you to edit a recorded sequence or save it to a sector. This does not destroy the old edit buffer, pressing the command again will swap the buffers back. The playback will stop at the first occurrence of a zero Byte - CHR$(0). Any data after the first zero byte is garbage and can be over-written. Setting Defaults Sample file edit example. By using editing N.U.R.S.E. you can customize the startup colors, printer device, and memory buffer address. Always customize a backup copy of N.U.R.S.E. If you make any mistakes you can damage the program. To begin, you must first find where the defaults are stored on the disk. Start N.U.R.S.E. with a backup in your drive. It will automatically choose the start of the directory. Read the first sector by pressing RETURN twice. Press "e" to edit the search string. Press "t" to enter text in the search string. Type "nurse128" and RETURN (or "nurse64" for c64 version.) Move the cursor to the "8" (or "4") in the string editor and press "s" to set the search string length. Press "q" to quit the string editor. Press "s" to start searching the directory for the file. When the sectors stop changing the cursor will be at the first character of the word "nurse". Move the cursor two characters left. This is the link for the first track and sector of the file. Press "j" to jump to the first block of the file. Press "e" to edit the search string again. Press "t" to enter text. Type "defaults" RETURN Move to the end of the "s" in defaults and press "s" to set the length. Press "q" to quit the editor, then "s" to search for the defaults. When found, the cursor will be at the beginning of the string "defaults follow-". The default value will be directly after the colon (:) after then default name. The defaults are as follows: Printer Default Device - the word "printer:" followed by a byte defining the printer device, originally chr$(4) for device 4. Printer Secondary Address - the word "pr sec:" followed by a byte defining the default printer secondary address, originally chr$(7) for secondary address 7. Borders (Window outlines) - the word "borders(lines):" followed by a byte defining the default window outline color, originally chr$(6) for Dark Blue outlines. Windows (Window text color) - the word "windows(text):" followed by a byte defining the default window text color, originally 3 for Light blue text. Background Color - the word "backgnd:" followed by a byte defining the default background colors, originally 0 for Black background. Memory Buffer Address - the word "memory buffer(low/high):" followed by two bytes that define where the memory buffer is when you run the program, originally chr$(0) chr$(4) on the C128 for a default buffer of $0400 (on the C128 the buffer is always in bank 1) and the first available memory range for the C64 Version (different depending on the version.) The last thing for defaults will be the string "end defaults". Changing anything after this string could be hazardous to the copy of N.U.R.S.E., so BE CAREFUL! Other commands < - Rotate left. Rotate all bytes from the cursor position to end of sector 1 place left. Any bytes that would be moved beyond position 255 are wrapped around to the cursor position. > - Rotate right. Rotate all bytes from the cursor position to end of sector 1 place right. Any bytes that would be moved beyond the cursor position are wrapped around to the end of the sector. P - Print sector. This dumps the current sector to the printer in the following format: The track and sector numbers 256 bytes of ASCII 256 bytes in the following format: position:8 bytes hex 8 bytes ASCII See example disk directory sector in the section directory entry format at a glance. SHIFT I - Read Disk Memory. Reads a block of disk memory into the buffer so you can save it as a sector. Input the high byte of the block to be read. I.E. enter 01 will read disk memory from $0100 to $01ff. CONTROL B - Re-initialize Burst Mode. (C128 Mode only.) Tries to re-initialize Burst mode on the 1571. On any other disk drive it acts like Change disk. Due to a bug in the 1581 Burst sector read is incompatible with N.U.R.S.E. (Certain Burst commands will close open direct buffers.) At this time there are no plans for CBM to upgrade the ROM, Should they do so then Burst will work. Read/Write Errors When a read or write error occurs, N.U.R.S.E. will ask you to retry with the following options: Y Retrys read/write. N Cancels read/write, returns to edit. P Restore to previous sector (keeps new track and sector numbers). Q Quit N.U.R.S.E.. R Read anyway. This will allow you to recover from disk errors by bringing in whatever DOS was able to read. Please note reading the sector will have unknown results and the data read may not be complete. When re-writing the data it is best to change the track and sector with the '#' command or use the change disk option to transfer the data to another disk. C Change the disk in the drive. How Information is stored on the disk Commodore stores information on the disk in 256 byte sectors (logically if not physically.) They have set up special reserved sectors on the disk for the directory. At the beginning of the directory the name of the disk (header) that is defined when you format (New a disk). Following the header you will find the BAM (Block Availability Map) of the disk. A breakdown of the BAM can be found in the Commodore Computer Disk System Reference Guide (Part Number 320972- 01) and in the users guide for the particular disk drive. The BAM can take up more than one sector. You can find the first sector containing file names on sector 1 of the directory track (except for the 1581 which is sector 3). The directory is stored like a sequential file. The first two bytes in the sector contain the link to the next track and sector of the file. The last block of the file will have a track of zero and the sector will be the distance into the sector that is actually data. In the directory, the last sector will have a link of 0,255. The directory entries are stored 8 per sector and contain 30 bytes each. Directory entry format at a glance. The byte breakdown of the directory entry is as follows: byte definition 0 File type OR'ed with $80 for closed, $c0 for locked, types are 0:DELeted, 1:SEQuential, 2:PRoGram, 3:USeR, 4:RELative. 1 Start track of file. 2 Start sector of file. 3-18 File name padded with shifted spaces ($a0). 19,20 Track and sector of relative file side sector block. 21 Length of relative file record. 22-25 Unused by CBM DOS, Some programs such as GEOS use these bytes. 26,27 Track and sector of replacement file during an open or save with replace. 28,29 File Size stored in Low Byte High Byte order (in blocks). Example: A 1541 disk directory sector. track: 18 sector: 1 rdbq@NURSE128 @@@@@@@@@;@@@bs@NUR SE64 @@@@@@@@@5@@@boaFORMAT128 @@@@@@@@@l@@@buhFORMAT64 @@@ @@@@@@k@@@bnbEXTRAMON BOOT @@@@@@@@@b@ @@bncEXTRA $0B00 @@@@@@@@@e@@@bnfEXT RA $1300 @@@@@@@@@e@@@bnrSCRNDUMP.BI N @@@@@@@@@a@ $00: 12 04 82 11 00 4e 55 52 rdbq@NUR Next Sector of dir 18,4 $08: 53 45 31 32 38 a0 a0 a0 SE128 $10: a0 a0 a0 a0 a0 00 00 00 @@@ $18: 00 00 00 00 00 00 3b 00 @@@@@@;@ $20: 00 00 82 13 00 4e 55 52 @@bs@NUR Type = PRG = $82 $28: 53 45 36 34 a0 a0 a0 a0 SE64 $30: a0 a0 a0 a0 a0 00 00 00 @@@ $38: 00 00 00 00 00 00 35 00 @@@@@@5@ $40: 00 00 82 0f 01 46 4f 52 @@boaFOR File Start = 15,1 $48: 4d 41 54 31 32 38 a0 a0 MAT128 $50: a0 a0 a0 a0 a0 00 00 00 @@@ $58: 00 00 00 00 00 00 0c 00 @@@@@@l@ $60: 00 00 82 15 08 46 4f 52 @@buhFOR File name $68: 4d 41 54 36 34 a0 a0 a0 MAT64 $70: a0 a0 a0 a0 a0 00 00 00 @@@ $78: 00 00 00 00 00 00 0b 00 @@@@@@k@ $80: 00 00 82 0e 02 45 58 54 @@bnbEXT $88: 52 41 4d 4f 4e 20 42 4f RAMON BO $90: 4f 54 a0 a0 a0 00 00 00 OT @@@ Pad character $a0 $98: 00 00 00 00 00 00 02 00 @@@@@@b@ $a0: 00 00 82 0e 03 45 58 54 @@bncEXT $a8: 52 41 20 24 30 42 30 30 RA $0B00 $b0: a0 a0 a0 a0 a0 00 00 00 @@@ $b8: 00 00 00 00 00 00 05 00 @@@@@@e@ File Size = 5 blocks $c0: 00 00 82 0e 06 45 58 54 @@bnfEXT $c8: 52 41 20 24 31 33 30 30 RA $1300 $d0: a0 a0 a0 a0 a0 00 00 00 @@@ $d8: 00 00 00 00 00 00 05 00 @@@@@@e@ $e0: 00 00 82 0e 12 53 43 52 @@bnrSCR $e8: 4e 44 55 4d 50 2e 42 49 NDUMP.BI $f0: 4e a0 a0 a0 a0 00 00 00 N @@@ $f8: 00 00 00 00 00 00 01 00 @@@@@@a@ So What can I do now? Now that you have a sector editor there are many things to do with it, here are a few suggestions: Investigate programs on the disk, start with a backup copy of N.U.R.S.E.. There are messages in many commercial programs, you just need to know where to find them. Most 1987 Electronic Arts Programs have a message somewhere on the disk, if I tell where it won't be any fun. Instead of loading and running programs that change the disk name, undelete files, or create dummy file names you can do it yourself. Undeleting files You cannot undelete a file if it has been partially overwritten. The only way to tell is to find the filename in the directory, jump to the first sector then link through the file. It takes practice to identify the file as it would be stored. If nothing has been written on the disk since the file was deleted then your recovery should be successful. If the file is complete then return to the directory sector that has the filename you want to restore. The first byte in the directory will be $00 change it to $80 + . (File types are found in Directory Format at a glance.) Changing the Disk Name and ID The disk name is usually stored in the first sector of the directory track. On the 1541/1571 the disk name is on track 18 sector 0 beginning at position 144 and continuing to 159. This is followed by a shifted space ($a0) and the disk ID in text. The disk ID stored in the beginning of the directory is just text. The only way you will be able to change the actual ID stored on the disk is to reformat it. N.U.R.S.E. will always identify the real ID. You can change the text copy for directory logging programs. Appendix A If N.U.R.S.E. identifies your disk drive as "????" then your drive is not supported by this version. If this is the case sorry, the program will not be updated. Boot Sector Routines and Bootsector utility 128 The file "boot utility/128" is a program to allow you to manipulate the 128 boot sector. The options are: 1. Copy a boot sector to a file. This will copy a bootsector from a disk into a 2 block file that can be transferred over the modem. You will give the name of the file the bootsector will be saved in. 2. Copy a file into a boot sector. This will reverse the above action. It will not overwrite a current boot sector. 3. Validate protect the boot sector. This will create a usr file in the directory that will validate protect the boot sector. You will need to input the name of the protect file name. The method of operation of this option was originally written by "DBEST". 4. Remove boot sector. This will change the CBM at the start of the bootsector to zeros. It does not destroy the sector but the disk will no longer boot. You can restore a removed boot sector (if it has not been overwritten by another program) by changing the first three bytes to "CBM" using N.U.R.S.E. The Source code files Sample boot sector routines The Files: "boot.go64bank1", "boot.menu", "boot.load64ml", "boot.runbasic", and "boot.loadml" are source code files that can be directly assembled with most CBM compatible assemblers. These routines are all released for your use with no conditions attached. They are internally commented for your convenience. A short description follows: boot.go64bank1 : Places you in C64 mode on the C128 and uses bank 1 memory for 64 mode. If you reset from the c64 you have access to all of the previously C64 memory in bank 1 all untouched ($0400 to $ffff). You can access from $0000 to $03ff by turning off the RAM Share routines for Zero Page, Copying the data to another location and then turning normal Zero Page back on. boot.load64ml: This is code that will load a C64 program (in 64 mode) and start it. It operates by copying a load routine into an open area in memory (you supply) then setting up a fake cartridge at $8000, and resetting the machine into 64 mode. The 64 sees the fake cartridge and executes the loader. boot.loadml: This will load a c128 Machine Language program and run it. boot.menu: A sample boot sector that offers you a small menu program that will 1. c64 bank 0, 2. c64 bank 1, 3. c128 basic, 4. c128 monitor. boot.runbasic: A sample boot sector to run a c128 BASIC program. Extramon 128 v1.0 Extramon is an enhancement to the Commodore 128 ROM Monitor (Built in). Two versions are provided, 1 at $0b00 and 1 at $1300. This will allow you to use Extramon to work on most any program you have. Enhancements on normal monitor are as follows: Up and Down scrolling for Dis-assembly, Memory dump, and Interrogate commands. For each of the above listed commands if the command has been executed previously in the current window. Attempting to scroll the window from the bottom will cause the command to continue to execute. For example if you have dis-assembled from $0b00 to $0c00 and you move to the bottom of the window and press cursor down then the disassembly will continue from the last line disassembled on the screen. Similarly if you go to the top of the window and press cursor up it will scroll the window down and disassemble (as best possible) the memory backwards from the first disassembled line on the screen. If you are using windows other than the normal screen size then interrogate and memory will overflow the lines. If you are in 40 col mode then a window smaller than 40 will overflow and if you are 80 col mode then a window smaller than 80 will overflow. Disk commands The command "@" has been modified so if there is no device number the command can start in the second character. Example: old command new command ----------- ----------- @8 $ @$ @8 v @v etc... (the old methods also still work) All addresses in the following commands are of the form BHHLL Where B = bank, HH = High Byte, LL = Low byte. If B is omitted then default is bank 0, if B and LL are omitted then the default is bank 0, zero page. Interrogate command Syntax: I Start and end addresses are optional Example: I fb000 fb100 Result: Interrogate memory from bank 15, $b000 to $b100. Displays address and line of ASCII for the memory range given. The memory in the addresses listed will be translated to ascii and displayed in reverse on the screen. If the character is unprintable then a reverse period is displayed. You cannot edit the ascii. If you wish to edit use the M command and change it with hex. Change current print device Syntax: P Device can be 0 to 255, using special conventions below: 0,3 restore to screen 8..11 disk devices, must have a file name in quotes Example: P4 P8 "dump" Result: The first line will send all output to a printer device 4. The second line will send all output to a file on device 8 named "dump". Changes output to another device. The current output is changed to print to a device. If devices 0 or 3 are used it restores output to the screen and closes any open files. If devices 8 to 11 are used then a file name is required. This can be used to get output of your programs on paper and to disk. Pressing the RUN/STOP key to abort a command will restore the output to the screen but it will not close the file. A P0 or P3 must be used to prevent a "splat" file on a disk. Compute Checksum Syntax: (English Pound) Both addresses are required Example: (English pound) 1000 2000 Will return the checksum of all bytes between start and end addresses. The checksum is the sum of all bytes between the addresses. The checksum will be a 5 byte number where the last four letters/numbers are the same as the checksum in Micromon 64. Format 1571 Back Side 128 Formats the back side of a 1541 formatted disk on the 1571. If the disk is a "flippy" (formatted on both sides by flipping the disk over and cutting a second notch) then DO NOT USE THIS PROGRAM ON THE DISK. If the disk is already formatted then the program will not run. This program will allow the 1571 to use the second side of the disk. Do not stop it or you may end up with a partially usable disk. Saves time of copying the files to an already formatted 1571 disk. The program builds a new BAM for the second side of the disk, you do not have to validate it but you might want to for peace of mind. BASIC Print Routines for the C128 and C64 The files: 1 "print.banner" prg 2 "print.leftright" prg 1 "print.center" prg 2 "print.rising" prg 1 "print.climbing" prg 1 "print.spring" prg 1 "print.falling" prg 2 "print.meshing" prg 1 "print.conleft" prg 2 "print.falling ii" prg 1 "print.flashing" prg 2 "print.shoveright" prg 2 "print.hypererase" prg 1 "print.shove left" prg are all print routines in BASIC for the inclusion in your own programs. Most will require the variable A$ to be set to the string you wish to print in the cute manner. All of the routines will are currently separate programs that demonstrate themselves but they can be easily converted into subroutines. Full permission is given to use these routines in your own code as long as credit is given either in listable form or with the statement "Portions of this code are copyright (C) by DPD" somewhere in the documentation or title screens. Error Checker for the 1571 Error check is a program that will test the sectors of a disk for errors and prints a graphical interpretation to the screen. It only runs on the 80 column screen as the 1571 double sided disk is too large to represent in 40 columns. This program uses the "scrndump.bin" file to print the screen at the end so it must be on the disk when you first run the error check program. Source Code Formatter The Source Code formatter is a utility that acts as a "pretty printer" for CBM compatible source code files (Sequential File text only). Input file name: Enter the name of the file you wish to format. Wildcards are supported, when entering the file name you can enter a "*" and the positions following and including the "*" will be treated as wildcard characters, a "?" can be used for a single character wildcard. When formatting files to disk the formatted file will have a "f/" preceding the old name. For Example: With a disk directory with the files: tables.src seq prog.src seq prog1.src seq prog2.src seq external.src seq program.bin prg output.txt seq the following will be formatted: input filename: p* output files: f/prog.src seq f/prog1.src seq f/prog2.src seq input filename:prog?.src output files: f/prog1.src seq f/prog2.src seq input filename: * output files: f/tables.src seq f/prog.src seq f/prog1.src seq f/prog2.src seq f/external.src seq f/program.bin prg f/output.txt seq input filename: tables.src output files: f/tables.src seq Opcode column: This is the column that opcodes are aligned to. If a label goes past this column then the line is reformatted so that the label is followed by 1 space then the opcode. For clarity this should be at least 1 character longer than your largest label. In order to preserve space it is also better to make this an even multiple of a tab. Comment column: If a comment is the first character on the line (leading spaces are removed) then the formatted code will leave it there. If it is after an opcode then this is the column that it will be aligned to. If the source code is already formatted then it will be re-formatted to the new column even if it used to start after the comment column. When a line is read all multiple occurrences of spaces and tab combinations not inside either a single or double quote are converted to 1 space. Output device: This is the device that the formatted source code will be printed. Regardless of the device the output will always be echoed to the screen. If the output device is a disk device between 8 and 11 then the output will be to the input filename with the prefix of "f/". Use Tabs or Spaces: This will define how the column that you wish to align to will be reached. Some editors do not allow the use of tabs in the input line and expect spaces. (If using the c-64 then the screen output will NOT align with tabs as the c64 does not use chr$(9) for a tab in standard output.) When moving to the correct column tabs will be used until the cursor is as close to the correct place as possible then spaces are used to fill the gap. Screen Dump 128 The Screendump is a program you can add to your own Basic and Machine Language programs that will print the current window (including custom windows). To use it all you need to do is BLOAD"scrndump.bin" in the start of your program. The default printer is device 4 with a secondary address of 7. To change the printer poke 2833,printer device and poke 2831,secondary address ($0b11 = printer, $0b0f = secondary address). When you want to get a screen dump sys 2816 (jsr $0b00). Super Search And Recover SSAR will analyze a 1541 disk, find all tracks and sectors that are the start in a series of links and creates filename entries in the directory for them. This allows you to recover from a soft format (a format that does not physically format, the "N0:NAME,ID" command without the ID) or recover a file that has been scratched and the directory entry over-written. When the disk is being checked, the markers on the screen are: "*" is the current sector that is being analyzed. "+" is a sector that has a valid track and sector link in it. "." is a sector that does not have a valid track and sector link. " " (Space) is a sector that is being pointed to by another sector. "x" This sector has an error in it, could not read the sector link. You have the option to try and identify all sectors that are an end of file (try to identify 1 block files). This can cause disks that are formatted with some fast formatters to have files found on every sector. An end of file sector is a sector that the track link is zero and sector link is not zero. Some fast formatters format with default links of 0,255. If you choose not to use this option it will not have any effect on files that are larger than 1 block long. If you choose to identify 1 block files and whole tracks come up as start of programs then re-run SSAR and do not use this option. When creating files SSAR will use the track and sector in the name, the name will be "trAA seBB" where AA is the track and BB is the sector. You have the option to automatically analyze the first sector of the file to try and identify if the file is text or a program. The first sector will be read and then a count of all letters (a-z and A-Z) and spaces will be made. As BASIC programs use a lot of numbers and punctuation, these are not considered text characters. You can set the percentage of characters that will make the file a text file. Machine language program are generally about 10% to 50% text characters as some opcodes are also letters, BASIC programs tend to be about 65% and most text files are 70% or above. When this option is used, the file name will have additional information added, text files will be SEQuential and have the word "text" appended to the files. Program files will be type PRoGram and the load address of the program in hex will be appended to the name. If you do not choose auto identification all files are created with a type PRG. All files recovered will have a file size of 0. Some file copiers that use the directory file size to copy files will not be able to copy these files. SSAR will not check track 18 (the directory) for files. When SSAR creates filenames they are put on the directory track, this tends to destroy programs that are stored on the directory track. If a sector has two other sectors that point to it then there will be two files created that will include that sector and all sectors that are in the links. This will occur if a file has been overwritten. Do not run SSAR on a disk that you wish to use for a data disk, always use it only to recover a bad disk. The entries in the directory are not allocated and will be overwritten. To save time SSAR will not create a file if there is an existing directory entry for that sector. Restarting SSAR/128. Once you RUN SSAR/128 you cannot just type "RUN" to re-start it. The 128 version of SSAR is compiled with BASIC 128 from Abacus Software, the actual program is moved and can only be re-started with the command "BANK0:SYS56139". The program "SSAR RESTART" can be used to do this for you. SSAR64 is compiled with BASIC 64 and does not need special re-start instructions. Limited Warranty Datta Production and Development. makes no warranties, either expressed or implied, with respect to the software programs recorded on the diskette or the supporting documentation, their quality, performance, merchantability, or fitness for any particular purpose. The programs and supporting documentation are sold "as is." The entire risk as to their quality and performance is with the buyer. In no event will Datta Production and Development. be liable for direct, indirect, incidental or consequential damages resulting from any defects in the programs or supporting documentation even if Datta Production and Development. has been advised of the possibility of such damages. The enclosed software programs and supporting documentation are copyrighted. All rights reserved. Acknowledgments I wish to thank Fred Bowen, Ken Flader, Jim Halsey, Joe Hubbard, Tim Moczulewski, Steve McCrystal, Jim Morton, Butch Thompson, and members of the CUSSH Users Group in Racine WI for their suggestions during the development of N.U.R.S.E.. Additional thanks to Ken Flader, Tim Fossum, Nathan Ivanov, and Jim Morton for their help with the documentation. Credits N.U.R.S.E. was written and assembled on the C64 and C128 Microcomputers and assembled with the Total Software Development System (TSDS), and the Commodore 128 Development Package (DevPac). Supporting documentation was written on Superscript 128 and Wordperfect for the IBM PC. Commodore 64, Commodore 128, 2031lp, 2040, 4040, 8050, 8250, SFD 1001, 1541, 1571, 1581 and the 128 Development Package are all manufactured by Commodore Business Machines. TSDS is manufactured by NoSync Corp. BASIC64 and BASIC128 are Commodore 64/128 BASIC compilers from Abacus Software. Superscript 128 is manufactured by Precision Software. Wordperfect for the IBM PC is manufactured by Wordperfect Corporation. This program would never have been written without the music of Mike Oldfield, Tangerine Dream, Mannheim Steamroller, Jean Michel Jarre, and Vangelis and many other musicians who write music that is made to program to. N.U.R.S.E. and the DPD logo are trademarks of Datta Production & Development. Datta Production & Development 905-97th Street Kenosha WI 53143