RE: Question about writing to 1541

From: Baltissen, GJPAA (Ruud) (
Date: 2005-04-22 09:43:01

Hallo Spiro,

> Now, the format routine handles the same (writing a block to disk) a
> little bit differently:
> .8:fd1e   50 FE      BVC $FD1E    ; make sure the last byte is written
> .8:fd20   B8         CLV
> .8:fd21   50 FE      BVC $FD21    ; write another (!) byte to disk
> .8:fd23   B8         CLV
> .8:fd24   20 00 FE   JSR $FE00    ; set read mode and data 
> port as input

The actual formating of the track starts at $FCAE with writing 10240 times
$55. This is more then enough to write the complete track. Then a loop
starts at $FCB1. This loop handles writing a sector including its header.
The loop itself goes as far as $FD1C. The last part of the loop is writing a
number of $55's to the disk. This number depends on the number of tracks and
is calculated at $FC17. 
Only after ALL sectors have been written, your part shows up by writing two
extra $55's after the last $55's written by the loop. This bit of code isn't
used anywhere else, certainly it is not used for writing a block to disk as
you say. 

The only reason these $55 bytes are there is to give the drive time to
switch from read- to write-mode (or vica versa) if needed, nothing else. So
why these extra two bytes are written, I don't know; I don't see any
advantage in doing so. 

I hope this helped :)

    / __|__
   / /  |_/     Groetjes, Ruud
   \ \__|_\
    \___|       URL:


De informatie in dit e-mailbericht is vertrouwelijk en uitsluitend bestemd voor de geadresseerde. Wanneer u dit bericht per abuis ontvangt, verzoeken wij u contact op te nemen met de afzender per kerende e-mail. Verder verzoeken wij u in dat geval dit e-mailbericht te vernietigen en de inhoud ervan aan niemand openbaar te maken. Wij aanvaarden geen aansprakelijkheid voor onjuiste, onvolledige dan wel ontijdige overbrenging van de inhoud van een verzonden e-mailbericht, noch voor daarbij overgebrachte virussen.

The information contained in this e-mail is confidential and may be privileged. It may be read, copied and used only by the intended recipient. If you have received it in error, please contact the sender immediately by return e-mail; please delete in this case the e-mail and do not disclose its contents to any person. We don't accept liability for any errors, omissions, delays of receipt or viruses in the contents of this message which arise as a result of e-mail transmission.

       Message was sent through the cbm-hackers mailing list

Archive generated by hypermail pre-2.1.8.