<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Mon, 05 Sep 2011 00:29:17 GMT
From   : jgh@... (J.G.Harston)
Subject: Sometimes they come back... OSWORD &7F question

Carlo wrote:
> One thing that I've never ever been able to do is reading and writing raw
> floppy disc tracks.
> BeebWiki says that OSWORD &7F should be able to do just that with commands
> &E0 and &F0, provided a 1770 DFS is used:

No, the BeebWiki says that OSWORD &7F can read and write entire tracks with
commands &E0 and &F0. The normal read/write commands are &53 and &4B.
&E0/&F0 tend to be used for the *FORMAT and *VERIFY lowlevels.
 
>     10?&3000=&38
>     20!&3001=&4000
>     30?&3005=1
>     40?&3006=&E0
>     50?&3007 
>     55!&3008=0
>     56!&300C=0

The &E0/&F0 commands are specifically there to enable *FORMAT and *VERIFY to
perform their functions, and as such I would be unsurprised if they cannot
do double-density.

Also, did you read the notes on the Wiki page that warns that, although the
API and the low-level code allows double-density access, on the Master
series computers the code actually access the wrong bit of hardware, so
double-density access does not work. See http://mdfs.net/ROMs/Filing/Disk
(as referenced on the Wiki page) for patched versions that actually work.

>     80LDA #&7F
>     90LDX #&0
>    100LDY #&30
>    110JSR&FFF1
>    120RTS
>    130]
>    140CALL&3010

Errr.... What's wrong with X%=&00:Y%=&30:A%=&7F:CALL &FFF1 ???

> Or any other solution for raw disc track I/O?

How about actually using the code on the Wiki page?

When initialising your program:
    DIM ctrl% 31:X%=ctrl%:Y%=X%DIV256

Function to access FM disks:
    DEFFNdisk(addr%,cmd%,drv%,trk%,sec%,num%,den%):LOCAL fs%
    fs%=FNfs:IF fs%<>4:*FX143,18,4
    REPEAT
      X%?0=drv%+den%*24+32:X%!1=addr%:X%?5=3
      X%?6=cmd%:X%?7=trk%:X%?8=sec%:X%?9=num%OR&20
      A%=127:CALL&FFF1:A%=X%?10
    UNTIL A%<>&10:IF fs%<>4:OSCLI"FX143,18,"+STR$ fs%
    =A%
    DEFFNfs:LOCAL A%,E%,Y%:=(USR&FFDA)AND&FF

Parameters are:
    addr% => address to transfer data
    cmd%  =  8271 FDC command
    drv%  =  logical drive number
    trk%  =  track
    sec%  =  sector
    num%  =  number of sector to transfer
    den%  =  1=single density, 2=double density if supported

Example call:
    result%=FNdisk(buffer%,&53,0,0,0,2,1)

    will read (cmd=&53) two single density sectors from track 0, sector zero
    on drive 0, ie reads the DFS catalogue from the first two sectors on the
    disk.

-- 
J.G.Harston - jgh@...      - mdfs.net/jgh
If you wish the light to be seen you have to take it into dark places.
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>