RWIN Disk Controller

starting with (1.0.15) RAW images can be used in both HDs and FDs , however HD images MUST be homogenous 256 byte sectors, zero based, and Magic should be for a HD. Magic for FDs can be T0 is single density or T0 is like rest of tracks, one based. Put floppy images in FDs and Hard images in HD.

The read track returns a formated track with the sector data, address marks, data marks, and ECC, but both Address ECC and Data ECC is 0.

Format Track and Format Disk simply return success, even though nothing is done...

Read ECC returns 260 bytes, Data and ECC, but ECC is 0
(if someone can teach me how to calculate the ECC, i will fix it)

Write ECC accepts 260 bytes, writes the data and tosses the ECC..

SCAN is the same as READ, but does not fill the FIFO.

READ and WRITE support FM and MFM 128, 256, 512, and 1024 byte sectors for Floppies; and MFM 256 byte sectors for HD. Note, that the real RWIN does not support 128 byte MFM, sincer it uses the 765 FDC.

The FIFO is increased in size from 4K to 256K. This allows operations to occur, non-piece-mill, up to 256 1024 byte sectors.. Versados never does more than 255 LSNs (and both floppies and HDs are 256 bytes per sector), and the max count is usually 255, due to the value 0 being for 256 and 0 as a return error status can not be determined correctly (can be either 0 or 256). 

The FIFO has been increased to 256k, so that any size sector (128, 256,512 or 1024) can be read 256 at a time.

CPM always does track sized transfers, 2K (for 128x16 - TK0 of floppy) or 4k (for 512x8 - TKnot0 of floppy;  and, 256x16 - for HD), so should work.

All actual disk transfers are done at beginning of READs; and, at the end of the fill of N * Sector-Size bytes to the FIFO for WRITEs.

For reads, the RWIN fills the FIFO with N sectors of data read.

For Writes, the FIFO must be filled first, by the driver, with N * Sector-Size bytes, before the write takes place. 

Writes mess up if not enough bytes are transfered, but fixes itself when the FIFO is reset at the beginning of each operation, by discarding the transaction that had too few bytes. Should work with existing drivers, but new drivers must account for the right number of transfer bytes. Too few, locks up (need a timeout). Too many is OK. You MUST send at least the number of bytes required for a write of N blocks. The actual write does not take place until the FIFO has N * sector-size bytes. If not enough bytes are sent, then BUSY and DRQ remain true. When enough bytes are recieved(sent), BUSY is made false, after the write takes place. 

To prevent a tight interrupt situation, the rwin does not actually complete its commands. It only sets a flag and enables the emualtor to complete the command at a later time (measured in instructions). 

The RWIN slider can be used to make the delay 1 to 32k instructions. 

I have tried to make the emulator capable of accessing more types of floppy disks than a real vme10 is capable of accessing. This allows a user to transfer files between various disk types. 

the real RWIN has a single jumper for all floppies to select either 8 inch or 5 inch. this sets the clock (500 or 250) and SPT for 8 or 5 inch disks.  

The emulator's RWIN can be told to set the type of drive and TPI for each floppy drive separately: and can set the sector size defaults for 5 different specs...for each floppy disk drive. this sets the number of sectors per track, such that the RWIN emulation can calculate LSNs for disks other than 8 and 5. Normally, the RWIN only knows of 8 inch and 5 inch DD SPTs.

Setting the RWIN jumpers is needed only for the device drivers. The settings (5/8,48/96TPI) are returned in a sense block. The default SPT are set by the option buttons, then if AUTO is checked, the actual SPT are set when a configure command occurs, by scanning the first 6 tracks). 

The emulator's RWIN can also Auto Scan and set the SPT according to the disk image.

NOTE - when creating IMD files the emulator defaults the CLOCK to 300 (not 250) for 5 inch disks. This is due to the fact that most people do not have 5 inch DD drives, which spin at 300 RPM. The HD drive uses 360 RPM instead of 300 RPM. If you do have 300 RPM drives then you can use IMDU to fix. (most 300 RPM 5 inch drives are 320K not 640K)

the rwin emulation supports the following specs for floppies...(May NOT be correct for all types)

		128		256		512		1024
	     FM	    MFM      FM     MFM      FM     MFM       FM    MFM          

8 inch       26      52      13      26     (7)      15        4     8    () means not correct

5 inch DD    16      32       8      16      4        8        2     4

5 inch HD    32      64      16      32      8       16        4     8 
             18      36       9      18     (4)       9       (2)   (4)   these are alternates

3 inch DD    16      32       8      16      4        8        2     4
             18      36       9      18     (4)       9       (2)   (4)   these are alternates

3 inch HD    32      64      16      32      8       16        4     8
             36      72      18      36      9       18       (4)    9    these are alternates

to use alternates or fix these if in error, you MUST edit the registry.

while these specs allow the RWIN to access various size disks, the drivers for CPM, VersaDOS and Unix do not support most specs. 

Since i have NO sample images, and do not have specifications, these are probably wrong in several places. The Auto function will scan the disk and set all the SPTs that it finds as-is on the disk

The Versados RWIN driver only supports 8 inch FM 26/128 and MFM 26/256; and , 5 inch FM 16/128 and MFM 16/256. It appears that Vdos uses the 8 inch format for 5 HD and 3 HD. To make the RWIN emulation set correct for 3 HD and 5HD you might need to use AUTO (or edit the registry).

The CPM driver only supports 5 inch DD FM 16/128 and MFM 8/512

To access 5 inch HD or 3 inch disks will require modification to the device drivers (unless they are formatted exactly as are 8 inch disks). Since i have NO examples of disks, other than 5 inch DD, i can not make the modifications. 

the alternates are shown, because i have no idea what's right. 

if 5 inch HD's and 3 inch HD's use track0 "same as other tracks" (FM vs MFM) (attribute bit 13) then that bit must be implemented in the driver. Currently, it is not. Also (if not formatted as 8's) the driver's SPT tables must be modified. Perhaps, make selection of 8's either be 8's or 3's. this way, only changes with no additions, if T0 is FM, else, if MFM, bit 13 must be added.

if you select Auto (RWIN jumpers), then...after the defaults specs are applied, the disk will be scanned and the specs set to what is found on the disk ( only the first 6 tracks are scanned ). note, that if the disk only contains 256 MFM and 128 FM byte sectors, then only those specs are set, leaving all the other default settings unchanged. This automatically makes the RWIN properly access whatever type disk is inserted, BUT (WARNING) the OS's driver MUST understand the format, too; AND the Configuration area must be correct for that disk.... else bad things will happen.

if you only use supported, correctly formatted disks with the Configuration Area correct, then setting Auto will work fine. IF, HOWEVER, you attempt to use a disk with the wrong info in the Configuration Area, or non-supported then horrific problems may ruin your day.

IF you use non- standard VME10 floppy disks, the the OS driver MUST be modified to understand them, else your disk dies a painful and humiliating death.

you might think ... why have defaults... why not just use AUTO... well... sometimes an improperly formated disk got used. IE. a 3 inch disk with 32 SPT might be used, with the RWIN and versados believing that it has only 26 SPT. this will work... the RWIN will calculate correct CHS from an LSN only if the RWIN uses the 26 SPT spec. the AUTO would force 32 SPT, which would cause the CHS to be incorrectly calculated from the LSN..

here is the source for setting up the sector specification table... if something is wrong you must edit the registry to correct... note that NONE of these registry entrys are created by the emulator, but if they exist then they are used..(the apostrophe is comment delimiter)


    ' 8 inch
    TrackSectorSpecs(0).FM128 = GetSetting(App.Title & Qualifier, "RWIN", "SPT0FM128", 26)
    TrackSectorSpecs(0).MFM128 = GetSetting(App.Title & Qualifier, "RWIN", "SPT0MFM128", 52)
    TrackSectorSpecs(0).FM256 = GetSetting(App.Title & Qualifier, "RWIN", "SPT0FM256", 13)
    TrackSectorSpecs(0).MFM256 = GetSetting(App.Title & Qualifier, "RWIN", "SPT0MFM256", 26)
    TrackSectorSpecs(0).FM512 = GetSetting(App.Title & Qualifier, "RWIN", "SPT0FM512", 7) '(not right)
    TrackSectorSpecs(0).MFM512 = GetSetting(App.Title & Qualifier, "RWIN", "SPT0MFM512", 15)
    TrackSectorSpecs(0).FM1024 = GetSetting(App.Title & Qualifier, "RWIN", "SPT0FM1024", 4)
    TrackSectorSpecs(0).MFM1024 = GetSetting(App.Title & Qualifier, "RWIN", "SPT0MFM1024", 8)
    ' 5 1/4 inch DD
    TrackSectorSpecs(1).FM128 = GetSetting(App.Title & Qualifier, "RWIN", "SPT1FM128", 16)
    TrackSectorSpecs(1).MFM128 = GetSetting(App.Title & Qualifier, "RWIN", "SPT1MFM128", 32)
    TrackSectorSpecs(1).FM256 = GetSetting(App.Title & Qualifier, "RWIN", "SPT1FM256", 8)
    TrackSectorSpecs(1).MFM256 = GetSetting(App.Title & Qualifier, "RWIN", "SPT1MFM256", 16)
    TrackSectorSpecs(1).FM512 = GetSetting(App.Title & Qualifier, "RWIN", "SPT1FM512", 4)
    TrackSectorSpecs(1).MFM512 = GetSetting(App.Title & Qualifier, "RWIN", "SPT1MFM512", 8)
    TrackSectorSpecs(1).FM1024 = GetSetting(App.Title & Qualifier, "RWIN", "SPT1FM1024", 2)
    TrackSectorSpecs(1).MFM1024 = GetSetting(App.Title & Qualifier, "RWIN", "SPT1MFM1024", 4)
    ' 5 1/4 inch HD
    TrackSectorSpecs(2).FM128 = GetSetting(App.Title & Qualifier, "RWIN", "SPT2FM128", 32) '36
    TrackSectorSpecs(2).MFM128 = GetSetting(App.Title & Qualifier, "RWIN", "SPT2MFM128", 64) '72
    TrackSectorSpecs(2).FM256 = GetSetting(App.Title & Qualifier, "RWIN", "SPT2FM256", 16) '18
    TrackSectorSpecs(2).MFM256 = GetSetting(App.Title & Qualifier, "RWIN", "SPT2MFM256", 32) '36
    TrackSectorSpecs(2).FM512 = GetSetting(App.Title & Qualifier, "RWIN", "SPT2FM512", 8) '9
    TrackSectorSpecs(2).MFM512 = GetSetting(App.Title & Qualifier, "RWIN", "SPT2MFM512", 16) '18
    TrackSectorSpecs(2).FM1024 = GetSetting(App.Title & Qualifier, "RWIN", "SPT2FM1024", 4) '4 (not right)
    TrackSectorSpecs(2).MFM1024 = GetSetting(App.Title & Qualifier, "RWIN", "SPT2MFM1024", 8) '9
    ' 3.5 inch DD
    TrackSectorSpecs(3).FM128 = GetSetting(App.Title & Qualifier, "RWIN", "SPT3FM128", 16) '18
    TrackSectorSpecs(3).MFM128 = GetSetting(App.Title & Qualifier, "RWIN", "SPT3MFM128", 32) '36
    TrackSectorSpecs(3).FM256 = GetSetting(App.Title & Qualifier, "RWIN", "SPT3FM256", 8) '9
    TrackSectorSpecs(3).MFM256 = GetSetting(App.Title & Qualifier, "RWIN", "SPT3MFM256", 16) '18
    TrackSectorSpecs(3).FM512 = GetSetting(App.Title & Qualifier, "RWIN", "SPT3FM512", 4) '4 (not right)
    TrackSectorSpecs(3).MFM512 = GetSetting(App.Title & Qualifier, "RWIN", "SPT3MFM512", 8) '9
    TrackSectorSpecs(3).FM1024 = GetSetting(App.Title & Qualifier, "RWIN", "SPT3FM1024", 2) '2 (not right)
    TrackSectorSpecs(3).MFM1024 = GetSetting(App.Title & Qualifier, "RWIN", "SPT3MFM1024", 4) '4 (not right)
    ' 3.5 inch HD
    TrackSectorSpecs(4).FM128 = GetSetting(App.Title & Qualifier, "RWIN", "SPT4FM128", 32) '36
    TrackSectorSpecs(4).MFM128 = GetSetting(App.Title & Qualifier, "RWIN", "SPT4MFM128", 64) '72
    TrackSectorSpecs(4).FM256 = GetSetting(App.Title & Qualifier, "RWIN", "SPT4FM256", 16) '18
    TrackSectorSpecs(4).MFM256 = GetSetting(App.Title & Qualifier, "RWIN", "SPT4MFM256", 32) '36
    TrackSectorSpecs(4).FM512 = GetSetting(App.Title & Qualifier, "RWIN", "SPT4FM512", 8) '9
    TrackSectorSpecs(4).MFM512 = GetSetting(App.Title & Qualifier, "RWIN", "SPT4MFM512", 16) '18
    TrackSectorSpecs(4).FM1024 = GetSetting(App.Title & Qualifier, "RWIN", "SPT4FM1024", 4) '4 (not right)
    TrackSectorSpecs(4).MFM1024 = GetSetting(App.Title & Qualifier, "RWIN", "SPT4MFM1024", 8) '9
    
-----

added support so that the RWIN can access hard disks with sector sizes of 128, 512 and 1024...already supported 256

no need to specify size . RWIN automatically uses it if the CNFG area of a raw image specifies sector size