Re: Question about writing to 1541

From: Patrycjusz R. Łogiewa (silverdr_at_inet.com.pl)
Date: 2005-04-26 18:16:15

[...]

> BTW: The cbm4win/cbm4linux formatter cbmformat does this job wrong, as
>      well as the 9-seconds-formatter. Anyway, I *never* saw any code
>      execute TWO "bvc *" before going into read mode (other then the 
> ROM
>      format routine), thus, this error seems to be very wide spread.

I know It's quite old now but I once dug up the sources of the quite 
reliable fast copy program I reversed some ages ago because Ruud was 
asking if I could find them - now I checked them and they contain the 
following routine... I include it because you once asked and maybe you 
can see something interesting there ;-) It has the same double BVCs in 
question but of course I can't really explain why is this needed. Since 
I am now also up to similar matters (I am trying to adapt some software 
to work with DD3), I can only add my voice to the chorus "can someone 
explain that?"


Formatting routine follows:

format_track_703:
	LDA #$00
	STA $C1		; current sector
	STA $1800
	LDA $43		; number of sectors per track
	STA $C3		; sectors left
	LDA #$CE
	STA $1C0C
	LDA #$FF
	STA $1C03
	LDA #$55
	STA $1C01
	LDX #$01
	JSR $FE24	; Write $55 10240 times - clearout the track


L722:
	LDA #$FF	; SYNC mark
	STA $1C01
	LDX #$05	; number of SYNC-bytes
L729:
	BVC L729	; wait for BYTE-READY
	CLV
	DEX
	BNE L729	; all SYNC-bytes on disk?

	LDX #$08	; number of bytes from buffer
	LDY $C1	; pointer to buffer position
L733:
	BVC L733	; write circuit ready?
	CLV		; yes, restore the flag
	LDA $0200,Y
	STA $1C01
	INY
	DEX
	BNE L733	; all (header?) bytes written?

	STY $C1		; buffer position merken
	LDX #$0B
L744:
	BVC L744
	CLV
	LDA #$55	; $0b fill-bytes ($55)
	STA $1C01	; write
	DEX
	BNE L744


	LDA #$FF	; SYNC mark?
	LDX #$05	; five times?
L753:
	BVC L753
	CLV
	STA $1C01
	DEX
	BNE L753	; all sync marks?

	TXA		; LDA #$00
	LDY #$A2	; 162 times?
L75F:
	BVC L75F
	CLV
	EOR $1801	; get the byte from parallel port
	STA $1C01	; write to disk

	DEC $1800	; acknowledge (DATA HI?)?
	LDA $1801
L76E:
	BVC L76E
	CLV
	EOR $1801	; zero out??
	STA $1C01

	INC $1800	; acknowledge (DATA LO?)?
	LDA $1801
	DEY
	BNE L75F


	LDA #$55
	LDX $45
L784:
	BVC L784
	CLV
	STA $1C01
	DEX
	BNE L784

	LDA $1C00	;
	EOR #$08	; LED bit toggle
	STA $1C00	; and set

	DEC $C3
	BEQ L79C	; all sectors?
	JMP L722	; no, write next

L79C:
	DEC $1800
L79F:
	BVC L79F
	CLV
L7A2:
	BVC L7A2
	CLV
	JSR $FE00	; Switch to reading
	JMP main_loop_319




-- 
Marriage is the sole cause of divorce.


       Message was sent through the cbm-hackers mailing list

Archive generated by hypermail pre-2.1.8.