-------------------------------ADVANCED DEMUFFIN------------------------------- version 1.5 2014-08-08 ------------------------------------------------------------------------------- ~ INTRODUCTION Advanced Demuffin allows you to convert a disk that is in non-standard format to DOS 3.3 format. If you supply an RWTS that can read the original disk, it's likely that Advanced Demuffin can convert it. To use Advanced Demuffin, you should be familiar with "THE BASIC OF KRAKING BY KRAKOWICZ". Also helpful (but not required): a sector editor like The Inspector, Disk Fixer, Nibbles Away, Copy ][+, or Disk Driver; a copy of "Beneath Apple DOS"; some knowledge of assembly language. Advanced Demuffin is only an automation tool. You must capture the RWTS of the original disk; Advanced Demuffin will not help you do that. If the disk's RWTS is too different from a normal RWTS, you may also need to write some assembly language code (an IOB module, described below). And even if Advanced Demuffin is successful in converting a disk to a standard format, any secondary protection (checksums, nibble counts &c.) that were on the original disk will still be there on the converted disk. To complete the deprotection process, you may need to sector edit the copy to take out these "checks". Advanced Demuffin will not help you with that either. (Occasionally you will find a disk that will not require any further changes after conversion, but this is not common.) The name "Advanced Demuffin" is an homage to a historical tool, "Demuffin," which had severe limitations (for example, it could only copy a disk if it has a directory). Advanced Demuffin works completely differently from the original Demuffin, so it does not share these limitations. ~ BASIC OPERATION Advanced Demuffin starts at the main menu. Here are the options: 1) CONVERT DISK: Does the actual copying of the disk. Allows you to change different parameters, like start track, start sector, etc. 2) LOAD NEW RWTS MODULE: Will load an RWTS for the source disk (the disk you are converting to DOS 3.3) from a DOS 3.3 disk. 3) LOAD NEW IOB MODULE: Will load a new interface for the source disk's RWTS from a DOS 3.3 disk. Described in greater detail below. 4) FORMAT TARGET DISK: Initializing a disk in either drive, in DOS 3.3 format. 5) EXIT TO MONITOR: Just what it says on the tin. To use the options, move the "light bar" with the arrow keys. The left arrow moves the bar up and the right arrow moves the bar down. To execute an option, just move the bar to it and press RETURN. The CONVERT DISK option will do the actual converting of the disk. To use the convert option move the light bar to "CONVERT DISK" and press RETURN. When you access the convert option, make sure that you already have the source RWTS in memory and have the IOB module pointing to it. (The IOB module normally points to $BD00.) Advanced Demuffin will then ask you: "CHANGE DEFAULT VALUES?" If you want to copy from track $00, sector $00 to Track $22, sector $0F, by whole tracks, with 1 retry on bad sectors, and the destination (blank) disk in drive 2 then answer "N" to this question. If you answer "Y", Advanced Demuffin will ask you a series of questions to customize the conversion process. "SECTORS PER TRACK? (13/16)" The first digit is always a 1. You should then enter a "3" for a thirteen sector disk (DOS 3.2) or a "6" for a sixteen sector disk (DOS 3.3). (If you don't know if the disk has 13 or 16 sectors, try to convert it with 16 sectors. If you get errors on all sectors past $0C on each track, it is most likely a 13 sector disk. All the "SECTORS PER TRACK" option does is tell Advanced Demuffin at what sector to change to a new track.) "START TRACK:" Enter the start track in hex (normally $00). You may enter half tracks; just type a "." after you enter the track and Advanced Demuffin will automatically tack a ".5" on the end of the track. "START SECTOR:" Enter the start sector number in hex (normally $00). "END TRACK:" Enter the end track in hex (normally $22). "END SECTOR:" Enter the end sector in hex (normally $0F). The start track and sector must come before the end track and sector. This is fine --+ +--- but this is illegal | | v v Start track: $00 Start track: $22 Start sector: $00 Start sector: $0F End track: $22 End track: $00 End sector: $0F End sector: $00 If you enter it this way Advanced Demuffin will give you the message "BACKWARDS COPYING NOT SUPPORTED!" "INCREMENT:" Enter the increment between tracks (usually 1). "MAX # OF RETRIES?" Enter the number of times you want Advanced Demuffin to retry reading or writing a sector (usually 1). "COPY FROM DRIVE 1 TO DRIVE:" Enter the drive for the target disk (1 or 2). The original disk is always in drive 1. If you specified 2 drives, Advanced Demuffin will prompt you "INSERT DISKS AND PRESS RETURN" Insert the original disk in drive 1 and the target disk in drive 2, then press RETURN. If you specified 1 drive, Advanced Demuffin will prompt you "INSERT SOURCE DISK AND PRESS RETURN" Insert the source disk and press RETURN. Advanced Demuffin will then read as many tracks as it can from the original disk (usually 7), then prompt you "INSERT TARGET DISK AND PRESS RETURN" Then it will write those tracks to the target disk in standard DOS 3.3 format. With the default options, it takes 5 passes to copy an entire disk. After the disk is converted, Advanced Demuffin will display the message "PRESS ANY KEY TO CONTINUE" If you press 1-7 now (or at any time during the conversion process), Advanced Demuffin will dump the screen to the printer in the specified slot. Any other key will return you to the main menu. ~ THE STATUS DISPLAY At the beginning of the conversion process, the screen looks like this: ADVANCED DEMUFFIN 1.5 (C) 1983, 2014 ORIGINAL BY THE STACK UPDATES BY 4AM ======================================== TRK: +.5: 0123456789ABCDEF0123456789ABCDEF0123 SC0: SC1: SC2: SC3: SC4: SC5: SC6: SC7: SC8: SC9: SCA: SCB: SCC: SCD: SCE: SCF: ======================================== 16SC $00,$00-$22,$0F BY 1.0 S6,D1->S6,D2 The top 2 lines are just the title lines. Then comes the disk map. The first two lines contain the track list. Each track number is displayed here, from $00 to $23. Most disks only use tracks $00-$22, but occasionally some software uses track $23. (Note that all the values are displayed in hex format, not decimal.) The first line of the disk map (marked with "TRK" on the left side of the screen) is for normal tracks. The next line is for half tracks (marked with a "+.5"). The next line is the actual track numbers. After this is the sector map, which will show the status code of each sector as the conversion progresses. At the bottom of the screen is the options line. It shows what format the disk is in (13 or 16 sector), then the start track and sector, then the end track and sector. The next thing on the options line is the track increment. The last thing is the slot and drive of the source and target disks. If you opted to change default values, the options line will reflect the choices you made. There are a number of status codes that appear in these displays. An inverse "R" on the disk map shows a sector being read in. An inverse "W" in the disk map shows a sector being written out to disk. An inverse "R" or "W" on track list shows which track is being read or written. A "." on either the disk map or the track display shows the sector or track copied correctly. Error codes and messages: "R" on the track list - Some sectors on the track could not be read. "W" on the track list - Advanced Demuffin could not write out some sectors on that track. "R" on the disk map --- That sector could not be read. "W" on the disk map --- That sector could not be written. When Advanced Demuffin detects that the target disk is "write protected", it will replace the title lines with this message: DISK WRITE-PROTECTED! PRESS "S" TO START OVER, "C" TO CONTINUE You should then remove the write protect tab or insert another disk. If you want Advanced Demuffin to start copying from the start sector and track, press "S". If you want it to continue copying from where it is, press "C". At any point in the conversion process, you can press "ESC" to cancel the conversion and return to the main menu. ~ LOADING RWTS MODULES A RWTS module is the RWTS will be used to copy the source disk. When you access the "LOAD NEW RWTS MODULE" Advanced Demuffin will prompt you to "PAGE TO LOAD AT (MUST BE A 2 DIGIT HEX NUMBER):" You must then enter the page number of the address that you want to load RWTS at. For example, "B8" would load it at $B800. (Most RWTS's start at $B800.) Advanced Demuffin will only allow you to load the RWTS between $20 and $BF. It will then ask you to "PLEASE TYPE THE NAME OF THE FILE TO LOAD". You should then enter the file name. When you press RETURN, Advanced Demuffin will ask you what drive to load it from. You should then enter a 1 or a 2. Possible errors: 1) NO SUCH BINARY FILE EXISTS! This is the same as a "FILE NOT FOUND" error. 2) PLEASE INSERT THE CORRECT DISK CORRECTLY IN CORRECT THE DRIVE AND PRESS This means that Advanced Demuffin had problems reading your RWTS. ~ CREATING IOB MODULES An IOB module is an interface for the source RWTS. Advanced Demuffin uses the IOB module to set up the RWTS parameter table and jump to the RWTS entry point. The IOB module is stored from $1400-$14FB. When Advanced Demuffin loads in an IOB module, it reads the first sector of the file off the track-sector list and stores it at $13FC-$14FB. When Advanced Demuffin wants to read a sector it JSRs to the IOB module with the phase number, sector number, and the page number stored in the A, Y and X registers respectively. Since the source drive always has to be drive 1, Advanced Demuffin can make the IOB module very compact. After it gets the page, track, and sector, Advanced Demuffin sets up the RWTS parameter table and JMPs to the RWTS entry point. Here is a disassembly of the IOB module that is built in to Advanced Demuffin: *1400L 1400- 4A LSR ; Convert phase # to track # 1401- 8D 22 0F STA $0F22 ; Store track number 1404- 8C 23 0F STY $0F23 ; Store sector number 1407- 8E 27 0F STX $0F27 ; Store page number 140A- A9 01 LDA #$01 140C- 8D 20 0F STA $0F20 ; Store the drive number 140F- 8D 2A 0F STA $0F2A ; Store the read code 1412- A9 0F LDA #$0F ; With high byte of IOB 1414- A0 1E LDY #$1E ; With low byte of IOB 1416- 4C 00 BD JMP $BD00 ; Goto RWTS Here are some reasons why you might need to write a custom IOB module: 1) The source RWTS uses some of the same zero page locations as Advanced Demuffin. The IOB module would have to swap those out before the read, and swap them back in after the read. 2) The source RWTS resides within the text window, or over part of Advanced Demuffin. The IOB module would have to save those memory ranges before the read and swap them back in after the read. 3) The source RWTS starts at a non-standard location (for example, at $3800 instead of $B800). Your IOB might need to change the memory ranges that Advanced Demuffin uses to store sector data during a copy, so that the data does not overwrite the RWTS. 4) The source RWTS uses a different entry point for reading a sector (for example, at $BA00 instead of $BD00). 5) The source RWTS requires initialization (for example, it relies on values stored in zero page locations during early boot). 6) The source disk stores data on half or quarter tracks. If you need to read half tracks, modify the LSR at $1400 that normally converts the phase number to a track number. If you need to change memory locations that Advanced Demuffin relies on, you should make sure that you JSR to the RWTS instead of JMPing to it, so that you can move the things back to their right place after the RWTS returns. A complete list of reserved memory locations is included in this documentation. ~ A STEP-BY-STEP EXAMPLE ACTUALLY DEMUFFINING A DISK: Using Castle Wolfenstein as an example. (I used this because it is the only thing that I that have that wasn't cracked!) 1) Boot up Castle Wolfenstein. Before the cursor appears press CTRL-C. The one character buffer in the keyboard will remember it and when DOS asks for a character it will give the CTRL-C. The CTRL-C will cause Castle Wolfenstein's hello program to break into BASIC after it is loaded. 2) Enter the monitor with "CALL-151". Enter "4000S6,D2" $09BB - change "06" to "05" (position of start track) $09D7 - change "0C" to "0B" (position of start sector) $09F0 - change "11" to "0D" (position of end track) $0A0A - change "17" to "13" (position of end sector) $0A5E - change "1C" to "18" (position of increment) 1.4 was released in 1989 by The Brain Trust - main program was unchanged, but it was bundled with a boot tracing program to extract the RWTS from a disk automatically 1.1 was released in 1983 by The Stack / Corrupt Computing, with documentation by The Inspector - All options work, including LOAD RWTS MODULE & LOAD IOB MODULE. - Does not require a DOS or an RWTS to function properly. However, if you don't have an RWTS in memory, you either need to load one with "LOAD NEW RWTS MODULE" or change the JMP in the built-in IOB module to point to $1A00. - Default is to read in $7000 bytes per pass, meaning that the entire disk can be converted in 5 passes (especially useful with only one disk drive). - The buffer start and end can easily be changed by changing locations $1CF0 and $1CF1. The defaults for these locations are $20 and $90, respectively. - After "EXIT TO MONITOR", CTRL-Y and & will get you back into the program. - Can do a screen dump to the printer after the conversion is done. Typing a number from 1-7 at any time during the conversion will do a screen dump to the specified slot once the conversion is complete. (Any other key besides 1-7 will clear the pending screen dump.) Before printing, the program will send "CTRL-I80n" so that the output will not go to the screen during print. - The left-arrow key <- works as a backspace-delete in inputs when entering multi-character values such as track number or filenames. - You can now specify the maximum number of retries per sector. This can be anything from 0 (only one try, no retries) to $0F (15 retries). The default value is 1. - If backwards copying is attempted, you will be given an error message instead of it incorrectly copying only the first sector. - You don't have to do the $1318 modification. The IOB module (which is now at $1400 instead of $1300) now points to $BD00 instead of $1900 or whatever. - The "change default values" screen asks for the "INCREMENT" instead of "BY", because this was confusing. - It does not print through DOS. 1.0 was released in 1983 by The Stack / Corrupt Computing - Initial release --------------------------------------EOF--------------------------------------