[comp.sys.cbm] Correction to Fast Hack'em patch

prindle@NADC.ARPA (10/03/87)

From: prindle@nadc.arpa (Frank Prindle)


Welcome to the "CAPUTE!" department!  Many thanks to Fred Bowen of Commodore
who spotted a typo in the patches to Fast Hack'em "S NIB" module (to make it
work with the new -05 ROM for the 1571):

Incorrect patch:	1499: $AA

Correct patch:		1494: $AA

Fred verified all the other patches for this module and the others were
correct as posted.  In any case, just to prevent any possibility of confusion,
here is a re-post of the complete set of patches with the correction noted
with an asterisk(*) in column 1.  Hope nobody patched his/her original disk!

----------------------------Corrected 2 Oct 1987--------------------------------

    Patches to "FAST HACK'EM" to work with 1571 ROM upgrade -05


The following files from versions 3.0A through 4.1 need to be patched:

	"64"
	"FASTBOOT V2"
	"SINGLE"
	"V2 NIB" (3.0A only)
	"S NIB"
	"128 SINGLE"

The patches are necessitated by three changes in the 1571 ROM:

	1. ROM location $c000 contains a new value.  The 'fastboot' processing
	   checks this value to determine if it is appropriate to install and
	   utilize the fast booting code.  Finding the new value there, which
	   does not match any known drive type, it bypasses the fast booting
	   capability.  This may be restored by making the processing check
	   default to 1541/1571 mode if $c000 is unknown.

	2. RAM location $01b4 is now used by the DOS as a flag.  When code is
	   uploaded from the C64 into drive RAM $0174-$01b9, the last one or two
	   instructions is overwritten by the DOS in this location (a $01 is
	   overwritten); thus the uploaded program executes incorrectly.
	   This may be corrected by installing a harmless instruction with
	   it's operand at this address: ORA ($00,X).  The remaining code is
	   moved down or prior code is moved up, as necessary to fit under
	   $01ba.

	3. The -05 ROM clears bit 1 ($02) of the disk controller's Peripheral
	   Control Register (PCR) at $1C0C in the drive whenever it is not
	   reading or writing the disk.  Apparently, this bit, when cleared,
	   disables the generation of "byte ready" signal (as bytes are
	   read and assembled by the disk controller) which appears as bit
	   7 of port $180F.  This only seems to occur when the drive is in
	   "fast-serial" (i.e. 128) mode.  The "128 single" module assumed that
	   this bit would be set and did not set it.  Additional code must
	   be added to ensure that this bit of the PCR is set during both read
	   and write portions of the copy operation.

(Note: notice that the "2-Drive" modules are not afflicted by these problems,
and do not require modification).

--------------------------------------------------------------------------------
                                    SPECIFICS
--------------------------------------------------------------------------------

Module: "64":

	Symptom: Main menu boots up slowly on a C64.

	Cause: Signature change in ROM causes drive not to be recognized as
	       a 1541 or a 1571.  Defaults to no fast boot.

	Fix: Alter code so that unrecognized signature defaults to 1571.

	Module Loads At: $102 to ? (i.e. in the stack)

	Patch:
			0135: BNE +9	;Default unknown $c000 to 1541/1571
			;i.e. the second byte of the BNE instruction is 9

			Hint: Use "DISK DOCTOR" or any other sector editor to
			      change first sector of file, position 55=208,
			      position 56=9 (these numbers are decimal).


Module: "FASTBOOT V2"

	Symptom: Even when FASTBOOT is enabled, modules don't load fast

	Cause: Signature change in ROM causes drive not to be recognized as
	       a 1541 or a 1571.  Defaults to no fast load.

	Fix: Alter code so that unrecognized signature defaults to 1571.

	Module Loads At: $C800 to $CFA6-1

	Patch:
			C878: NOP	;Default unknown $c000 to 1541/1571
			C879: NOP
			C87A: NOP
			C87B: NOP
			C87C: NOP

			Hint: Must use "DISK DOCTOR" or other sector editor
			      to change first sector of file, positions 124
			      thru 128 to 234; This file is not loaded by name,
			      but by position on disk, so it must be modified
			      in place!  If you move it, it won't be found.


Module: "SINGLE"

	Symptom:  1541 Single Drive Fast Copy hangs up

	Cause: Fast uploader code uploaded to $1b4 in the drive is overwritten
	       by the new DOS, which has allocated $1b4 for it's own use.

	Fix: Alter uploaded code so that it doesn't matter what is in $1b4.

	Module Loads At: $07F8 to $13F0-1

	Patch:
			13ED: ORA ($00,X)	;skip over drive $1b4
			13EF: NOP
			13F0: JMP ($01A9)

			0FAD: $B6		;change refs to $1b3 -> $1b6
			1008: $B6
			106C: $B6
			10A9: $B6
			10EB: $B6
			10FE: $B6

			Hint: File must be loaded, altered, and re-saved with
			      a ML monitor.  When re-saving file, save
			      $07F8-$13F3 (i.e. 3 more bytes than loaded, to
			      compensate for added code).


Module: "V2 NIB" (Version 3.0A only)

	Symptom: 1541 Single Drive Auto Nibbler hangs up.

	Cause: Same as for "SINGLE"

	Fix: Same as for "SINGLE"

	Module Loads At: $07F8 to $17A9-1

	Patch:
			First, transfer $15A2-$15D3 to $15A0 (i.e. move that
			block of code backward two bytes).  Then:

			159B: LDA #$04		;correct for move-back
			15C8: BNE $159B		;correct for move-back
			15CF: ORA ($00,X)	;skip over drive $1b4
			15D1: JMP ($01A9)

			119D: $AA		;change refs to $1ac -> $1aa
			1266: $AA
			12B7: $AA
			12C2: $AA
			12CA: $AA
			131A: $AA
			131E: $AA

			Hint: Easiest to do this with a ML monitor; Because code
			      is moved back instead of ahead, just save same
			      area as loaded: $07F8-$17A9.

Module "S NIB":

	Symptom: 1541 Single Drive Nibbler hangs up.

	Cause: Same as for "SINGLE"

	Fix: Same as for "SINGLE"

	Module Loads At: $07F8 to $179B-1

	Patch:
			First, transfer $1769-$179A to $1767 (i.e. move that
			block of code backward 2 bytes).  Then:

			1762: LDA #$04		;correct for move-back
			178F: BNE $1762		;correct for move-back
			1796: ORA ($00,X)	;skip over drive $1b4
			1798: JMP ($01A9)

			136F: $AA		;change refs to $1ac -> $1aa
			1438: $AA
			1489: $AA
*(corrected 2 Oct 87)	1494: $AA
			149C: $AA
			14EC: $AA
			14F0: $AA

			Hint: Easiest to do this with a ML monitor; Because code
			      is moved back instead of ahead, just save same
			      same area as loaded: $07F8-$179B.

Module: "128 SINGLE"

	Symptom: 1571 (128 mode) Single Drive Fast Copy hangs up.

	Cause: New ROM -05 clears bit 1 of PCR when not reading from disk.  This
	       inhibits ability to detect "byte ready" by testing the sign bit
	       of $180F.  128 SINGLE assumes that this bit is set when it gets
	       control from the DOS and hangs forever waiting for "byte ready".

	Fix: Modify the current subroutine which delays while waiting for drive
	     motor to come up to speed so that it achieves a similar delay, but
	     also ensures that bit 1 of the PCR ($1C0C) is set.  This may seem
	     like a silly place for a patch, but there is no other available
	     patch area.

	Module Loads At: $1C00 to $2E24-1 (in 128 mode)

	Patch:
			2D0B: LDA #$00		; modified drive motor delay
			2D0D: TAX
			2D0E: TAY
			2D0F: LDA $1C0C		; loop begins
			2D12: ORA #$02		; set bit 1 of PCR
			2D14: STA $1C0C		; inside loop for more delay
			2D17: NOP		; still more delay
			2D18: DEX
			2D19: BNE $2D0F		; end of inner loop
			2D1B: DEY
			2D1C: BNE $2D0F		; end of outer loop
			2D1E: RTS

			Hint: Easiest to do this with a ML monitor; Because code
			      is not moved and no new code is added, save
			      same area as loaded: $1C00-$2E24.


My experience is that the SINGLE 1541 FILE COPIER and all of the DUAL 1541 and
DUAL 1571 modules still work (unmodified) with the -05 ROM upgrade, though I
suspect this is purely coincidental.  If anyone has information to the contrary,
please let me know.

Sincerely,
Frank Prindle
Prindle@NADC.arpa