[comp.sys.cbm] autobooting kermit from a 1581

dave@zehntel (Dave Funk) (03/25/89)

After looking through both the C128 Programmers Reference Guide and
the 1581 manual, I came to the following conclusion.

Track 1, sector 0 is the 'autoboot' area (for a C128) on any disk - 1541,
1571, or 1581.  Therefore, I reasoned, I should be able to write
a little basic program that reads track 1, sector 0 on the 1541 Kermit
distribution disk and then writes this data to track 1, sector 0 on the
1581.  That track and sector should then be allocated.

Well, I did that, and it works!  The only thing I haven't quite figured
out is how to also overwrite the first byte in the sector (seems this is
reserved for the sector length).  It is a simple matter to use a disk 
editor to do this, but I would prefer my program to handle it.  I know
it can be done - disk editors do it and Fred Bowen's 'autoboot 128' program
must do it.

It seems to me that one could convert any C128 5.25" autoboot disk to a
1581 autoboot disk this way (as long as nothing is copied protected).
You would just have to make sure to do *this* copy and allocation first,
followed by a copy of all the files on the disk.

Does this seem reasonable or did I just luck out in this particular case?

Dave Funk			 ....!ucbvax!zehntel!dave
Zehntel, Inc.			 ....!decvax!sytek!zehntel!dave
2625 Shadelands Drive		 ...."zehntel!dave"@BERKELEY
Walnut Creek, CA  94598		 (415) 932-6900 x309

izot@f171.n221.z1.FIDONET.ORG (Geoffrey Welsh) (03/26/89)

 > From: dave@zehntel (Dave Funk)
 > Message-ID: <802@zehntel.UUCP>
 
 > Well, I did that, and it works!  The only thing I haven't quite figured
 > out is how to also overwrite the first byte in the sector (seems this is
 > reserved for the sector length).  It is a simple matter to use a disk
 > editor to do this, but I would prefer my program to handle it.  I know
 > it can be done - disk editors do it and Fred Bowen's 'autoboot 128' program
 > must do it.
 
   The first TWO bytes (bytes 0 & 1) are used to link to the next track & 
sector (or, if the sector is the last in the file, the track link contains 
zero and the sector link points to the last used byte). CBM drive manuals 
state that, when the exact contents of a buffer are to be copied to disk (i.e. 
the first two bytes are not to be set to anything but the first two bytes of 
the buffer), use the "U2:" command in stead of the "B-W:" (block-write) 
command. Here's how it might go:
 
10 OPEN 1,8,15 : REM command channel - necessary for any major work
20 OPEN 2,8,14,"#" : REM allocate a buffer & a data channel
30 FOR I = 0 TO 255
40 PRINT#2, CHR$( DATA( I ) ); : REM send data to buffer - rewrite as needed
50 NEXT I
60 PRINT#1,"U2:14 0 1 0" : REM write buffer accessed via channel 14 to 1,0
70 CLOSE 2 : CLOSE 1 : REM let's not leave open files for BASIC to close!
 
 > It seems to me that one could convert any C128 5.25" autoboot disk to a
 > 1581 autoboot disk this way (as long as nothing is copied protected).
 > You would just have to make sure to do *this* copy and allocation first,
 > followed by a copy of all the files on the disk.
 >
 > Does this seem reasonable or did I just luck out in this particular case?
 
   Basically, as long as track 1 sector 0 is free, any disk on any drive can 
be made to autoboot. There is no reason why most copy-protected disks could 
not be made to autoboot on their original format drive; the common techniques 
of wiping sectors or tracks or half-tracking should not be affected by 1,0 
unless that sector is affected by the copy-protect scheme (very unlikely).
 
============================================================================
Usenet:    watmath!isishq!izot                       | 66 Mooregate Crescent
Internet:  Geoffrey.Welsh@f171.n221.z1.fidonet.org   | Suite 602
FidoNet:   Geoffrey Welsh on 1:221/171               | Kitchener, Ontario
PunterNet: 7/GEOFFREY WELSH                          | N2M 5E6 CANADA
BBS:       (519) 742-8939 24h/7d 9600 USRobotics HST | (519) 741-9553
============================================================================
|  "I don't need a disclaimer. No one pays any attention to what I say."   |
============================================================================
 


--  
 Geoffrey Welsh - via FidoNet node 1:221/162
     UUCP: ...!watmath!isishq!171!izot
 Internet: izot@f171.n221.z1.FIDONET.ORG

) (03/27/89)

In article <802@zehntel.UUCP> dave@zehntel (Dave Funk) writes:

>                             ... The only thing I haven't quite figured
>out is how to also overwrite the first byte in the sector (seems this is
>reserved for the sector length). ...

The problem might be...

The are several ways of writing a sectory on a disc. One way is (in Basic):

   PRINT#15,"B-W";channel#;drive#;track#;sector#

There is the bug, because the "B-W" Command uses the first byte as a buffer-
pointer, so what is written on the disc are bytes 1 to 255 (byte 0 is left out)!

So what can we do? Hm...
Just use the 'User-Command' instead of the 'B-W'-Command! The syntax is almost
the same:

               PRINT#15,"U2",channel#;drive#,track#;sector#

("U2" instead of "B-W") Everything else stays the same!

							      This should do it!


BTW: The same thing is also true for the "B-R" command. So it's much better
     to use "U1" instead of "B-R" !

I hope this helped. :-)

					Greetings Kianusch