Reading a disk using DSKCON

Hardware Hacking, Programming and Game Solutions/Cheats
Post Reply
pser1
Posts: 1205
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Reading a disk using DSKCON

Post by pser1 » Tue Jan 08, 2019 6:17 pm

Hello,
I have two programs, one made using the Basic SREAD to get the sector data and another POKEing the DSKCON variables from $ea to $ef
Well, the one using SREAD works flawlessly, but the other reads the sectors from track zero, but when sector is changed to any ther value
it reads again sectors from track 0.
These are the listings.

Code: Select all

100 REM DISC READER
110 PCLEAR1:CLEAR800,32767
120 FORT=0TO39:FORS=1TO18
130 IFT=20THENT=21
140 SREAD 1,T,S,A$,B$
150 PRINT:PRINT"*** ";T" - ";S;"***"
160 PRINTA$;B$
170 IFINKEY$=""THEN170
180 NEXT:NEXT:CLOSE

Code: Select all

100 REM DISC READER
110 PCLEAR1:CLEAR200,32767
120 POKE&HEB,1:'DRIVE 1
130 FORT=0TO39:FORS=1TO18
135 IFT=20THENT=21:'SKIP DIRECTORY
140 POKE&HEC,T
150 POKE&HED,S
160 POKE&HEE,&H08:POKE&HEF,0
170 POKE&HEA,2:'READ SECTOR
180 EXEC(PEEK(&HC004)*256+PEEK(&HC005))
185 PRINT:PRINT"*** ";T" - ";S;"***"
190 FORI=0TO255:PRINTCHR$(PEEK(&H800+I));:NEXT
210 NEXT:NEXT:CLOSE
There must be something wrong in the second program, but I am unable to see it.
Any advice will be very welcome
thanks
pere

sixxie
Posts: 1061
Joined: Fri Jul 18, 2008 8:36 am
Location: Hertfordshire
Contact:

Re: Reading a disk using DSKCON

Post by sixxie » Tue Jan 08, 2019 9:07 pm

I think DSKCOM (CON?) is a fairly light abstraction of the actual FDC operations, so you'll have to SEEK ([$ea] = 1) first.

pser1
Posts: 1205
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Re: Reading a disk using DSKCON

Post by pser1 » Tue Jan 08, 2019 11:32 pm

sixxie wrote:I think DSKCOM (CON?) is a fairly light abstraction of the actual FDC operations, so you'll have to SEEK ([$ea] = 1) first.
right, it is DSKCON in the CoCo documentation, but is named DSKCOM in the DP5.0 comments
Using this DP5.0 I have solved the problem calling $C167 every time the track gets changed. In fact, I assume it is a kind of seek to move
the read header to the beginning of the new track.
Thanks a lot
pere

pser1
Posts: 1205
Joined: Sun Mar 25, 2012 7:32 pm
Location: Barcelona (SPAIN)

Re: Reading a disk using DSKCON

Post by pser1 » Tue Jan 08, 2019 11:46 pm

Hi Ciaran,
I have tried your idea ... calling the same [$c004] but with command 1 (seek) when track changes
and then the normal command 2 to read the sector.
It works flawlessly, so now it is usable with any DOS, great!
Thanks a bunch
pere

Post Reply