home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_disks
/
300-399
/
ff312.lzh
/
TrackSalve
/
Source
/
ts.i
< prev
next >
Wrap
Text File
|
1990-02-12
|
9KB
|
152 lines
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 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
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)
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 ,READONLY,0
BITDEF ,NOCLICK,1
BITDEF ,SALVE,2
BITDEF ,VERIFY,3
BITDEF ,RAM,6
BITDEF ,TERM,7
FUNCTIONS EQU F_RAM+F_VERIFY+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
WaitRtnPC equ -20 Offset of a task's PC to TC_SPUPPER during a Wait() in version 33 and 34
;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
*-- 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
STRUCTURE TSBN,bn_SIZEOF Extended blit node, data area available during blitter fuctions
APTR TSBN_SceB Source B
APTR TSBN_Dest Destination
APTR TSBN_Unit Td's unit pointer
WORD TSBN_C1 Control 1
LABEL TSBN_SIZE