home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_disks
/
300-399
/
ff355.lzh
/
TrackSalve
/
Source
/
ts.i
< prev
next >
Wrap
Text File
|
1990-06-12
|
6KB
|
169 lines
*
* ts.i - Copyright 1990 D.W.Reisig
*
* # date by Comment
* -- --------- ----- ---------------------
* 0 29-Oct-89 DWR Created for Tracksalve
* 1 10-Apr-90 DWR TrackSalve 1.3, more switches
*
INCLUDE "exec/types.i"
INCLUDE "exec/memory.i"
INCLUDE "exec/semaphores.i"
INCLUDE "devices/trackdisk.i"
INCLUDE "hardware/cia.i"
INCLUDE "hardware/blit.i"
TD_VERSION1_2 equ 33
TD_VERSION1_3 equ 34
PUBCLR equ (MEMF_PUBLIC+MEMF_CLEAR)
*-- Secondary result codes
E_CMDLINE equ -41 Some syntax error in the commandline is met
E_ALLOCMEM equ -42 No success with AllocMem()
E_INTUITION equ -43 No success with OpenLibrary
E_RTAG equ -44 No success with FindResident()
E_TD_VERSION equ -45 Not supported version of Trackdisk
E_CATCHTD equ -46 TD's pc is not at the expected position
*-- The findable TSHook structure. We put it in the semaphore list. Donot change!
STRUCTURE TSH,SS_SIZE Struct SignalSemaphore
APTR TSH_TSControl Pointer to data and patch
ULONG TSH_Version Value to check own compatibility
LABEL TSH_SIZE
*-- The UnitData structure contains data of interest for a particular Trackdisk unit task.
STRUCTURE TSBN,bn_SIZEOF Extended blit node, data area available for blitter fuctions
WORD TSBN_Pad Long alignment
APTR TSBN_P0 Some pointers
APTR TSBN_P1
APTR TSBN_P2
APTR TSBN_P3
APTR TSBN_Unit Td's unit pointer
UWORD TSBN_C0 Control 0
UWORD TSBN_C1 Control 1
LABEL TSBN_SIZE
STRUCTURE UD,0
STRUCT UD_TDReq,IOTD_SIZE Used for OpenDevice() of all units
APTR UD_TSControl Pointer to shared data area
APTR UD_ReturnTD Value of PC when caught in ROM
APTR UD_Userdata Original value of tc_UserData
APTR UD_CopySect Copy routine if IO buffers non chip
UBYTE UD_Cmd0 Field used for preparation of commands
UBYTE UD_Cmd1 Command pattern to the trackdisk task
UWORD UD_SavedL Bitflags of saved sector labels (good are cleared)
UWORD UD_SavedD Bitflags of saved data blocks (good are cleared)
UWORD UD_Update Counter to determine when to update and auto motor off
STRUCT UD_BlitNode,TSBN_SIZE We use a static blitnode, saves us repeated inits.
LABEL UD_SIZE
*-- The global control structure. It contains data concerning shared items between all TD-tasks.
STRUCTURE TSC,0
APTR TSC_TSHook Semaphore to set for drastic TSC accesses
STRUCT TSC_UnitData,NUMUNITS*4 Pointers to UnitData structures
STRUCT TSC_UDAlloc,NUMUNITS*UD_SIZE The UnitData structures itself
APTR TSC_TDTag Pointer to Trackdisk romtag in ROM
ULONG TSC_TDCodeSize Size of Trackdisk code
APTR TSC_TSTag Pointer to Trackdisk romtag in RAM
APTR TSC_TSCode Pointer to extension code
ULONG TSC_TSCodeSize Size of extension code
APTR TSC_Buffer Pointer to shared buffer
UBYTE TSC_InUse Bit pattern of units which use the control structure
UBYTE TSC_Salve Bit pattern of units which use the buffer for salvage
UBYTE TSC_Verify Bit pattern of units which use the buffer for verify
UBYTE TSC_AvailUnits Bit pattern of existing Trackdisk units
STRUCT TSC_OwnBuffer,SS_SIZE Semaphore for usage of the buffer
APTR TSC_IntuBase IntuitionBase for building requesters
ULONG TSC_Size Size of control structure + extension code + TD code, one allocation
LABEL TSC_SIZE
*-- Bits of the UD_Cmd1, UD_Cmd0 and TDU_pad
BITDEF ,VERIFY0,0
BITDEF ,VERIFY1,1
BITDEF ,READONLY,2
BITDEF ,NOCLICK,3
BITDEF ,SALVE,4
BITDEF ,UPDATE,5
BITDEF ,RAM,6
BITDEF ,TERM,7
FUNCTIONS EQU F_RAM+F_VERIFY1+F_VERIFY0+F_SALVE+F_NOCLICK+F_READONLY
*-- Some NON-Public members of the Trackdisk unit and device structure
TDU_Flags equ $40 Byte. Some statistics about the inserted disk
TDU_CiabPb equ $41 Byte. Memory to prepare commands to hardware
TDU_Retries equ $42 Byte. Number of performed retries
TDU_UnitNr equ $43 Byte. Identification number
TDU_IOReq equ $44 Long. IORequest currently processed
TDU_IOSector equ $49 Byte. Sector currently I/O'ed
TDU_XTrack equ $4a Word. Desired track
TDU_PTrack equ $4c Word. Present track
TDU_DiskBuf equ $4e Long. Buffer used for disk i/o
TDU_UnitBuf equ $52 Long. Pointer to buffer allocated by the TD unit
TDU_TCB equ $12e Begin of task control block
TDD_SysBase equ $34 Long. Pointer to ExecBase
TDD_GfxBase equ $38 Long. Pointer to GfxBase
*--
_ciaa equ $BFE001
_ciab equ $BFD000
;09876543210
BADTRACKBITS equ %11111111111 One bit for every sector/label
DISKFORMAT equ -1 First field in the sector address
SYNC equ $4489 Uniq pattern to recognise the beginning of data
SYNCSYNC equ $44894489 idem
GAPSIZE equ 1660 Size of first written non-data part of a track
SPT equ 11 Sectors per track
UPDATECOUNT equ 10 Ten times .5 seconds before auto update
*-- Structures used by Trackdisk or its patch
STRUCTURE HE,0 Sector Header structure
BYTE HE_Format Contens: DISKFORMAT
BYTE HE_TrkNo Tracknumber the formatter thought the head was on during format
BYTE HE_SecNo Sectornumber from 0 to 10
BYTE HE_ToGap Number of sectors until gap
LABEL HE_SIZE Warning: Maybe subtracted from the stackpointer
STRUCTURE SE,0 MFM encoded sector
ULONG SE_Start Contens: $AAAAAAAA
ULONG SE_Sync Contens: SYNCSYNC
STRUCT SE_Header,HE_SIZE*2 HE_ structure
STRUCT SE_Label,TD_LABELSIZE*2
STRUCT SE_SumL,4*2 Checksum over SE_Header and SE_Label
STRUCT SE_SumD,4*2 Checksum over SE_Data
STRUCT SE_Data,TD_SECTOR*2
LABEL SE_SIZE
SSIZE equ SE_SIZE-SE_Label
LSIZE equ SE_SumL-SE_Label
DSIZE equ SE_SIZE-SE_SumD
STRUCTURE TB,0 Picture of trackbuffer as TD uses
WORD TB_TrkNo Tracknumber of track in buffer, -1 if none or bad
BYTE TB_ChgFlag Bit 0. 1 means that the buffer must be written to disk before...
BYTE TB_FirstSec First sector present at position TB_Data
STRUCT TB_Gap,GAPSIZE MFM-zeros. Written first to clear the area behind the last write.
STRUCT TB_Data,SPT*SE_SIZE SPT SE_ structures
LABEL TB_SIZE
STRUCTURE SB,0 Salvebuffer
STRUCT SB_Header,HE_SIZE Just some storage to ease access to the bytes of the header structure
APTR SB_Begin Begin of data (EA of SB_Data)
APTR SB_End End of sync search area
WORD SB_CorrectTrk Number of matching tracknumbers during buffer scan
WORD SB_WrongTrk Number of non-matching tracknumbers during buffer scan
STRUCT SB_Data,2*SPT*SE_SIZE+GAPSIZE Buffer in which data is read from disk
LABEL SB_SIZE