Inside - DEVICES

From NitrOS-9
Jump to: navigation, search

Devices Section 1

OS9 Is O OS9 IAO RBFMAN FILE
PD. - path des criptor vars VS-- device table V. -- device static storage QŞ -- IRQ poll table DD. - drive tables (LSN 0) PŞ-- process descript or
Opening a disk (RBF) file takes the following steps:
VAR MOD ACTION
1. PD . PD IOMAN Allocates a 64-byte block path descriptor.
PD) . MOD Sets access mode desired. PD . CNT Sets user cnt=1 for this path desc.
2 PD . DEV IOMAN Attaches the device (drive) used.
VSSTAT Allocates memory for device driver (CCDisk).
W. PORT Sets device address in driver static memory.
3 V. NDRV CCDISK The driver's in it subroutine is called to
V. TRAK initialize the device, and static memory
DD . TOT (drive tables) to default values.
4 OSPOLL OS 9 Sets up IRQ polling table entry .
o ( address, flip & mask bytes, service add, OSPRTY static storage, priority of IRQ )
5 V ŞDIRIV IOMAN Sets up rest of device table.
VŞ DESC ( module addresses of des c, driver, mgr) VSFMGIR VS U SRS Sets user count of device=1
6 PD . OPT IOMAN Copies device desc info to path des c.
( drive st, step rate, den sity, tracks, PD , SAS sides, interleave, seg alloc size )
.PD . BUF° RBFMN Allocates buffer for file use ך
PD . DVT Copies device table entry for user. PD . DTB Calc's drive table add for quick refrince.
DD I TOT CCDISK Copies LSN 0 in it info to drive table.
- ( diskette" s format, root dir, ID, attros, DD. RES number of tracks, sectors, bitmap size )
PD » D SK RBFMN Gets disk ID and finds the file:
PD , DFD LSN of directory fille des c
PD . DCP Entry # of pathname in directory file PD . FD LSN of path name's file desc
PD . CP Current file pos
PD , SIZE File size
PD . SBL Offset from beginning of file segment PD , SBP LSN of file segment
PD . SSZ, Segment size in sectors
PD . ATT File attributes (DS EWR)
8 PSPATH IOMAN Puts path desc # in proc desc I/O table.
Returns table pointer to user as path number.
S Sq SqqqSqL S SqSqqSqqq qSqSqq SqqSq SqSqqSS S qSS S S Sq SqqqSqS qSqqS SqqSqSqS Sqqqq SqS S SqqS SqTSq qSqqS SqS qqqqqqS qqq qSqqS S q S SS SS SqqqS qSq qqqS qSq qSqq qqqS SqqS qqSq SS qSqSqSq qqSq qSq qSqq Sqqqqq SqqqqSq qqS S qSS LLLLLSL eeeee LSq L qqqqqqS qSqSqSq
3-1-1
________________
INSIDE OS9 LEVEL II
Devices Section 1
DEVICE DRIVER ENTRIES RBFMAN
INIT U =device static memory CC, B <error code
Y = device descriptor
. Set W. NDRV to number drives controller handles
Set DD. TOT to non-zero value so RBF man can read LSN O Set V. TRAK to high number i f driver controls seek op code * Use FSIro to place driver IRO service routine in poll table
Init controller * Copy V. BUSY to V. WAKE, FSSleep 0, check V. WAKE=0
READ U is device static memory CCB Cerror code
Y = path descriptor B, X = ILSN
. Get PD. BUF buffer address from path descriptor Get PD. DRV drive number from path descriptor Send LSN converted to track and sector to controller
* Copy V. BUSY to V. WAKE, FSSleep O, check V. WAKE=0
Read the data into the buffer if not a DMA controller
... If LSN O, copy DD. SIZ bytes into drive table
WRITE U =device static memory CC, B Cerror code
Y =path des criptor B. X = LSN
Get PD. BUF buffer address from path descriptor
Get PD. DRV drive number from path descriptor
Send LSN converted to track and sector to controller ... Write the data into the buffer if not a DMA controller * Copy V. BUSY to V. WAKE, FSSleep O, check V. WAKE=0
GETSTT U = device static memory CC, B Cerror code PUTSTT Y = path descriptor
A = status call
* Wait for any I/O to complete * Disable any device IRQ " s * Remove device from IRQ polling table
k IRO Service Routine
Kill IRQ request i f necessary Send wake up signal to V. Wake Clear V. Wake
Clear Carry bit
RTS
3-1-2
 
________________
NSIDE OS9 LEVEL II
Devices Section 1
DEVICE WARIABLES Static Memory RBFMAN
Name Offset Description
V . PAGE OO POrt eXtended address V. PORT O 1 - O2 Device address W. LPRC O3 Last active process ID ( not used V. BUSY O4 Active process ID (dev busy flag) O= not busy W. WAKE O5 Process ID to awake after command completed V . USER o Beginning of file mgr / driver var " s
V. NDRV O 6 Number drives Controller Can handle
Ol-OE Reser Ved
DRV BEG Beginning of drive tables
(One table for each drive, up to V. NDRV)
This section of each table copied from LSN 0 of disk. Dr. O
D D . TOT OO-O2 Number of sectors OF-1 DD) . TKS O3 Number of tracks 12 DD. MAP O 4-05 Number bytes in allocation map 13-14 DD. BIT O 6-O 7 Sectors/bit in map (sectors/cluster) 15ー16 DD . D IR O8-OA LSN of root directory 17-19 DD . OW N Ο Β-OO Owner " s u ser number 1A-1B DDATT OD Disk attr (D S PE PW PR E W R) 1C D D . D SK OE — OF Disk ID 1D-1E DD. FMT 1 O Disk format 1F DD . SPT 11-12 Sectors/track 20-21 DD. RES 13-4 Reser ved 22ー23 DD ... S IZ Size of bytes to copy from LSN O
V. TRAK 15-16 Current track 24-25 V . BMB 17 Bit map in use flag 26 V. File Hd 18-19 Open file list 27ー28 V . Disk TD 1A-1B Disk TD 29-2A V. ВMap s z 1. С Bitmap size in sectors 2B V. MapSct 1D Lowest reas on able bitmap sect or 2C W. Res Bit 1E Res er ved boit map sector 2D
1 Ε-25 Reserved 2E-34
DRWMEM Drive table size
(other drive tables follow)
Drive tabole address = DRVBEG + ( PD . DRV * DRVME M ) Also found in PD. DVTB
3-1-3
________________
NSIDE OS9 LEVE I
Devices Section 1
Module DEVICE DESCRIPTOR RBFMAN
Name Offset Description
MŞID OO-Ol Sync bytes ($87CD} MSSize 02-03 Module size MSName 04-05 Offset from start to module name string MSType O6 Type/lang (SF1) M$Revs O7 Attr Arevision MSParity 08 Header parity
MŚFMgr 09 -- OA File manager name offset MSPDev OB-OC Driver name offset MSMode OD Device capabilities MSPort 0E一10 Device extended address MSopt 11 Number of options in initialization table
IT. DTP 12 Device type (sRBF) TDRV 13 Drive number (O. . . n.) ITT STP 4 Step rate : 0- 30 ms 1- 20 ms 2 - 12 ms 3- 6 ms
IT TYP 15 Device type: bit 0- O=5 l/4 =8 inch
bit 5- 0 as noncoco l =coco bit 6- Osos9std 1 snonstc. bit 7- 0-floppy l-hard
TDNS 6 Density: bit 0- 0=single l=double bit1 - 0-48 tpi 1596 tpi
IT - CYL 17 148 سه Cylinders (tracks) Iʻr SD 19 Sides
T - VFY A Os verify disk writes IT SCT B-1C Sectors/track IT TOS Das E Sectors/track (track O)
T - LV F Sector inter leave T. SAS 2O Minimum sectors/segment alloc
End of option table. 2- Name strings here.
3-1-4
________________
INSIDE OS9 LEVEL
Devices Section 1
PATH DESCRIPTOR PD. Variables REBETMAN
Name Offset Descriptionh
PD . PD OO Path number PD , MOD O1 Acces s mode 1=read 2=write 3= update PD - CNT O2 Number of paths using this path desc PD . DEV 03ー04 Device table entry address PD, CPR O5 Current Proc ID using this path for I/O PD , RGS 06ー07 Address of user's register stack PD. BUF 08-09 Data buffer (256 bytes) address for RBF/drvir PD . SMF OA Buffer state: see below PD . CP OB-OE Current file position PD. SIZ, OF-12 File size PD . SBL 13-15 File beginning segment number (FSN) PD . SBP 16-18 Actual segment beginning LSN PD , SSZ, 19-1B Segment size in sectors PD - DSK C-D Disk ID PD - D T B 1E-1F Drive table address for this drive sh
PD .. ΟΡΤ 20 Device class 0 = SCF 1 =RBEF 2 = PIPE
PD . DRV 21 Drive number 0-n
PD . STP 22 Step rate
PD . TYP 23 Device type 5, 8, hard
PD » DNS 24 Disk den sity
PD - CYL 25-26 Number of tracks ( cylinders)
PD . SID 27 Number of sides
PD - VFY 28 Verify flag 0=do verify on write
PD - SCT 29-2A Sectors/track
PD . TOS 2B-2C Sectors/track (track O)
PD » LV 2D Sector inter leave
PD . SAS 2E Segment allocation size in sectors h
PD . TFM 2F DMA transfer mode
PD . Exit en 30-31 Path extension (not used)
PD » ST off 32 Sector/track offset
PD - ATT 33 File attributes (D S PE PW PR E W R) PD . F’D 34-36 File descriptor LSN (list of segments) PD . DFD 37-39 Dir file desc LSN (of dir holding file) PD , DCP 3A-3D File dir ptr (filename entry in dir file) PD . DVT 3E-3F Device table entry address for user sh
Buffer state flag bits:
$ 0 1 - bou ffer modified SO2 - current sector SO 4 – fille de sc in buffer SO8 - end of file sector S10 - end of file S2 O - in disk driver S4 O - buffer busy rh
________________
INSIDE OS9 LEVEL
Devices Section 1
Template DEVICE DESCRIPTOR RBFMAN
IFP1
USE DEFSAOS9 defs USE DEFS/RBF defs ENDC
type SET Devic--Objct
revs SET Re Erit + 1
MOD rend, devnam, type, revs, finnam, drvnam
FCB SFF all access modes to FCB SFF, SFF, S40 device address to FCB optil option length b
optns EQU *
FCB DT. RBF type = 1 for RBFman devices rb
FCB Ş 0 3 drive number (0. . . n.) b
FCB S02 step rate b
FCB S40 device type : bitO - O=5 1/4 l=8 inch 欢 bit5- 0=non coco l=coco 该 bit 6- O=Fos9.st di 1 = non std.
bit 7- 0 = floppy l=hard
FCB S01 den sity : bit 0- 0 =single l =double 索 bit1- 0=48 tpi 1=96 tpi
FCB Ş00, Ş23 cylinders (tracks)
FCB S01 sides
FCB S01 O= verify disk writes
FCB S00, S12 sectors/track
FCB S00, S12 sectors/track (track O)
FCB S01 sector inter leave
FCB S01 minimum sectors/segment alloc
optil EQU *-optims
devnam FCS AD3/
fnnam FCS / RBFs
drvnan FCS /CCD is k/
EMOD
rend EQU *
This is a typical RBF device descriptor. You may modify the constants and names (dev nam drvnam) to suit your de vice name, driver, and characteristics.


Ron - ok ok Kheh-heh). remember now, One of these
Have you tried formatting the disk anyway? I can't but I don't think the desc extensions are used there. Anyway try
DIWA OA or O9
ΟIVY 01.00 O080 DV O3O2 OO
OVA
is the of bits used for the cylinder number. DIVY is the of heads * sectors/trk * shift value. DIVU mask ( ; of bits set ) is (DIVA-8) biti s . The DIVU shift is DIVA-8 . If you've disassembled the driver, you'll see that you end up with the sectors remaining in D (shifted to the left), with the cyl hi in the last one or two bits of B. They mask off those bits, and put them as the cyl hi value. Then D must be shifted right to get back in the correct position. Thus the shift value is dependent upon how many cylinders you have.

I THINK either of the two sets of values above will work. Also I think your drive is 15 meg, not 20.

Devices Section 2

Disk Format LSN FORMATS RBFMAN LSN 0 (TD sector) DD. War S FLE DESC Sector : DD. TOT O0 Number disk sectors FD . ATT 0 0 DSPEPNEWR DD, TKS O3. Number tracks FD. OWN O1. Owner ID DD., MAP O4 Bytes in allo c map FDDAT 03 Last YMD: HM DD . BIT O6 Sector s / Cluster FD. INK O8 Link count DD . D IR O 8 Root dir LSN FD . SIZ 09 File #bytes DD OWN OB O Winer " S u Ser Inurr F.D.. DCR OD Date create DD. ATT 0D Disk attributes FD. SEG 10 Segment list LLLLSLLLL S S S L S LLLLLJLLL LLLL S SLLLLL S S LLLS SS S SAAS S SMS S S AAAA SSS S SSAAA AAAA AiS iSSS SSASS AAi iiSS SS DD FMT 1 O Format dens sides Seg ) ist : DD. SPT 11 Sectors / track Up to 48 5-byte DRES 13 Reserved entries : 3LSN, 2 size DD. BT 15 Bootstrap LSN strt — — — — — — — — — — - — — — — — — — — — — DD. BSZ 18 Boot si ze in bytes Dir file: D D - DAT 1 A Creat e time YMD : HIM 29 bytes-name DD. NAM 1F Disk name ( 32 bytes) 3 bytes-LSN des C LSN 1 ( Bit map) Each bit = 1 cluster of the number of sectors from DD. BIT.

Each disk file has at least one sector: the File Desc. This sector (see format above) contains the segment list, which is a list of the sectors used by that file. Each 5 byte entry (in order) points to the next block of sectors: the beginning LSN of the block, and the number of contiguous LSN's from and including the beginning block LSN.

Thus, if your disk files got so fragmented that the file could not be held in 48 blocks of any number of neighboring sectors, the File Desc couldn't handle it. This is extremely unlikely, of course.

The sectors pointed to in the segment list contain the file itself, which might be a m/l program, an ASCII file, or a list of other files.

A file that consists of a list of other files is assigned (by the Attr or Makdir commands) the Directory attribute. The list of files, and THEIR File Desc sector, is kept in a special order (see Dirfile above right).

The directory file can have an essentially unlimited number of 32-byte entries consisting of the file name (up to 29 char) and the 3-byte LSN of the filename's File Desc sector. Note that the first two filenames are automatically inserted by RBFman and they are "." and '...', whichpoint respectively to the dir file's own File Desc, and the File Desc of the dir file just above it in heirarchy.

DD.DIR points to the LSN of the first File Desc which has the Directory attribute, and is a list of all the files and directory files that you see when you do a "Dir' of the device holding the disk.

CREATE File Mgr Entry RBFMAN Drop bit 7 of attir parm Find file LSN (file exits?) y------------- > "File Exists' ln (dir found? ) I1ܚܙܘ - ܗ- -- -- -- -- - ܚ -ܝ -- -ܗ - > o Path nOt. FOUnd ly Get segment PSN of dir file Get size of dir file Allocate >=one sector (segment) Save number of Sectors all OC * d Save new segment PSN Seek start of dir file lくーーーーーーーーーーーーーーーー Get 32 byte entry l * Make new dir entry * . K--y (empty spot?) l ln l Point to next 32 l (error ? ) n - - - - - - - - - - >l ly (eof ?) I[ -ܚܘ ܘܗ -- -- -- -- -- - ܚ ܚ - -- -- -- -- > Err, Or End ly Extend file by 32 Update file size Read new sector nons -- . > l Clear 32 bytes Move C=29 name chars to buffer Move alloc "d de SC LSN to buffer Write out updated dir file LSN l Clear bou ffer * Make des c Sector * State= fille des c Insert file attir, user ID, time, date Set link count=1 l Check number se ct or s a lloc " d l ... <--y (any sectors left?) ln Set first seg LSN= des c LSN + 1 Set first seg size = sect or s - 1 S SS SS S SS SS SS SS > Write out file desc LSN Put file desc LSN in path desc Zero file size, pos in path des C Seek O in new file END l l

OPEN File Mgr Entry RBFMAN Find cir LSN l . K- -y (file desc PSN?) l lin ( ( - open whole device) l l l (modes dir?) y------------ > 1 SD 6 error " l lin l Zero seg begin PSN, FSN l Get sectors from drv table l Store as pd. segment Size l Store * 25. 6 as pd. file size l l l END l > ܚ- ܒܗ ܗ-܀ -- -- - ܚܘ 1 Check file attr er r ------ > "No Permission" l PD. pos, FSN, msb seg si ze=0 Move file attr fim buffer to pd. attr Move first LSN & segment size to path desc Move file si ze to pd. file size l END Path desc var ‘S : PD » CP OB PD . SIZ OF PD » SIBIL 13 Segment beginning fi le sector (FSN) PD . SBP 16 Segment beginning disk sector (LSN) 4 Current file position 4. 3 3 PD . SSZ 1 9 3 Segment size in sectors 1. 3 3 4. File size PD - ATT 33 File attr (D S P E PW PR E W. R) PD) - FD 34 File desc PSN (the list of sectors for file) PD - DFD 37 Dir file desc PSN (one level up from 34) PD) . DCP 3A Dir file entry pointer to this filename The FSN, as I call it, is the offset in sectors from the beginning of the actual file position. The LSN is the actual disk sector that the FSN is equal to. The PSN is also the actual disk LSN . 3-2-3 ________________ INSIDE OS9 LEVEL Devices Section 2 CLOSE File Mgr Entry RBFMAN SD3EB (images=0?) n--------- >END ly (modes write?) n - - - - - - - - - - - - - - - - - - - - - - - .م حج ly l (fille des c ?) n–---------------------- >l ly l Insect date in de sc buff Return buffer Move file si ze to des c buff l Check disk ID & write buff END Check EOF statu s l END CHGDIR File Mgr Entry REBFMAN ŞD 4 3A Open path name l

l data SXSEC l Put dr# & fille des c LSN in Proc Des c Return buffer END ... <- -n (sector in buffer?) l ly l Get pos of buff start lik-i-y (seek within buff?) l ln l Get buff within seek ]> ــ ميس ـ ـ ـ ـ سم. 1 Set new pd. pos l END 3-2-4

________________ INSIDE OS9 LEVEL Devices Section 2 Find File Subroutine RBFMAN States altered Request buffer, set PD. BUF PD. file desc PSN=0 PD. disk ID=0 l (1st char= | W 2) n------ > . ly l Get device name l )? " ( "y (1st chars ܚ- -- -- -- - ܘ- ܗ- -ܢܗ ܚܣ ܣܒܐ 1 l ln PD. file desc PSN= Proc Desc default l data/exec dir desc PSN l - ܚܒ -- -- -- -- -- -- -ܚ - ܗ- ܗ - -- -- - ܚܝܐ 1 PD - DVT=PD - DEV PD... DTB=static mem+drvbgn + ( dr# * drvmem) l (Was 1st char ln Read LSN O PD - disk ID=disk ID l (PD. file desc PSN=0?) ln PD - file des c PSN l SLSS LS SSSLSS SLSS SLSS S S > Save ptr to pathname l> ܝ ܲ- ܚܣ ܘܘܗ ܒܗ ܗ- ܗ ܗ . Read file desc LSN l (next char ly Check file attir Read 32 bytes - - - - - - - - - - - - - - - > ・<一ーy ?) <--y root dir PSN l / ? . > -------------------- س- سس -- س- س-- -- ----- -------د-- س----س- سد. --س-r l l l (end of name?) y -->. FSParsenam . l س۔ جعبه په ست به -ی ---سه حسست س->ه 1 Save otr to name l END ) er I---> NO PernSn . > ܚ- =ܗ ܗ =ܗ ܗ= ܢ Pt to next file name l 1 >-ܗ - -- -- -- -- - ܚ- ܒܘ ܚ ܚܝ -- -ܝܗ ܗ ܗ l{-y (unused entry?) l. ln lig-n (same names?) ly Set PD. dir file PSN & entry ptr PD . file des C PSN=this LSN l (at end of file?) ln ܚ- ܚܘ ܫܒܚܘ ܚܘ ܚ- -- ܡܗ ܐ l l l l FOUND NAME k y------- > EOF error Returns last dir file PSN & entry found. File des c PSN the LSN at that dir file Position. IF ' ' , PSN = 0, size= entire disk 3-2-5 ________________ INSIDE OS9 LEVEL Devices Section 3 OS9 is O OS9 IAO SCFMAN FTLE PD. – path descriptor var s VS-- device table V. -- device static storage QŞ — — IRQ poll table PS-- process descriptor Opening a serial (SCF) file takes the following steps: VAR MOD ACTION PD - PD IOMAN Allocates a 64-byte block path descriptor. PD I MOD Sets access mode desired. PD - CNT Sets user cnt=1 for this path des c. 2 PD - DEV IOMAN Attaches the device (driver) used: VŞSTAT Allocates memory for device driver (RS232). WPORT Sets device address in driver static memory. 3 RS232 The driver 's init subroutine is called to initialize the device. 4 QSPOLI, OS9 Set s upo IRQ polling table entry. - - ( address, flip & mask bytes, service add, QSPRTY static stor age, priority of IRQ ) 5 VSDRTV IOMAN Sets up rest of device table. VSDESC ( module addresses of des c, driver, mgr) VŞFMGR VSUSRS Sets user count of device=1 6 PD . OPT IOMAN Copies device des c info to path des c. s & ( upper/lower case, lif, lines/page, PD » XOFF file chars, baud rate, echo device ) .PD. BUF SCFMN Allo cates 1 byte buffer ך W NIE Copies desc line s/page to lines left var . PDDV2 ISAttach echo device, set dev table ptr. 8 PSPATH IOMAN Puts path desc in proc desc I/O table. Returns table pointer to user as path number. 2, 3, 4, 5 only if first time for that device, else VSUSRS i VSUSRS + 1 PD. DEV = device table entry . 4 only if device uses IRQ's. INIT U =device static memory CC, B Cerror code Y =device descriptor Tnitialize any static var s, constant s Use FSIrg to place driver IRQ service routine in poll table In it controller 3-3-1


________________ INSIDE OS9 LEVEL Devices Section 3 READ U =device static memory A Kchar Y = path descriptor CC, B Cerror code . Get next char from input buffer in static memory ... If none: copy V. BUSY to V. WAKE, FSSleep 0, check W. WAKE=0 WRITE U = device static memory A Kchar Y spath descriptor CC, B Kerror code ... Put char into static memory output buffer ... Enable ready-to-transmit interrupt ... If full: copy V. BUSY to V. WAKE, FSSleep O. check V. WAKE=0 GETSTT U = device static memory CC, B Kerror code PUT SITT Y =path descriptor A =status call ... Do wildcard driver call if not handled by IOMAN/RBF man TERM U =device static memory CC, B Kerror code ... Wait for output buffer to empty . Disable any device IRQ " s . Remove device from IRQ polling table eLLLLL LLLL L LLSS LqqL LLLLzSe seee LLLSLL LLSqL HqqeqSLLSSL LSSLAeeL qSqLASLL SuqL LSLSLS LA SAAJAAALLLLLL YLLTDL BDqeeqL LS LAL LAqASAJAASLSLLLLSLLLeee LLSLSL LAL LSALSSAHJSSLL 0SSSL LSL LALJSS0ASSJL YLSL LMASSL SACLLSq LSSSSSJSL YqeqL SSLLLSSALLLSAAAAASSAAASSSSLLSJJSSSeeeLLL LLLSLLLLL LSqSL LSLeqeS LMqL LqMAAS IRO Service Routine Read data if necessary into input buffer. If pause char read, set V. PAUS of memory area W. DEW2 K>0. ... If quit or keybd interrupt is read, send appropriate signal to the last user (W. LPRC) and error codes char. ... Write the output buffer to device until it is empty, disable ready-to-transmit interrupt. . Send wake up signal to V. WAKE Clear W. WAKE 3-3-2 ________________ NSIDE OS9 LEVEL I Devices Section 3 DEVICE WARIABLES Static Memory SCFFMAN Name Offset Description WPAGE OO Port extended address WPORT O1-02 Device address W. LPRC O3 Last active process ID W. BUSY O4 Active process ID ( dev bussy flag) O=not busy WWAKE O5 Process ID to awake after command completed V. USER Beginning of file mgr / driver var " s W. TYPE O6 Device parity type WLINE O7 Lines til end of Page V. PAUS 08 Pause request 0 = none V. DEV2 09 - OA Ech o device memory are a V . INTR OB Interrupt char V. QUIT OC Quit char V., PCHR OD Pause Char W , ERR OE Error collect or V. XON OF X-ON char V - XOFF O X-OFF char 1-15 used by Japanese computers W. PDHD 1 6-7 Path desc's head link for device users 18-1C res er ved V - SCF End Of SCFman Var S 1D- Free for de vice driver var s V. LPRC is used by the IRQ routine. If a quit or interrupt char is received, the routine should signal the last process to use the device with the signal associated with that char. This is why the Shell usually catches your <sh ft-brk > or <brk > multi-task / abort keystrokes, and takes the appropriate action. Note that if your program uses the device itself, you get the strange alternating set of Shell / program messages. 3-3-3 ________________ INSIDE OS9 LEVEL DeViCes Section 3 Module DEVICE DESCRIPTOR SCE"MAN Name Offset Description MSID OO - 0 1 Sync bytes ( $87 CD) MSSize O2-03 Module si ze MSName 04-05 Offset from start to module name string MŞType O6 Type/lang (SF1) MS Revs Ol Attr Wrevision MSParity 08 Header parity MşFMgr O 9 - OA File manager name offset MSPDevr OB- OC Driver name offset MSMode OD Device capabilities MŞ Port 0瓦一10 Device extended address MŞOpt 11 Number of options in initialization table: IT. DTP 2 Device type { 0=SCF) IT UPC 13 Case : 0 = U/l 1=Upper only ITBSO 14 Back space : 0=bsp pnly 1=bsp, space, bsp. IT » DLO 15 Delete: 0=bsp over line 1=<cr> T. EKO 16 Echo : O=no echo III. ALF Aut o li ne feed : 0 = n o aut o line feed IT. NUL 18 Null: number of delay nulls sent after Kcr> IT » PAU 19 Pause: 0=no pause at end of page IT. PAG 1A Lines per page IT - BSP B Back space code char from device T, DEL 1C Delete-line code from device IT. EOR 1D End of record code from device IT . EOF 1E End of file code fim dev (EOF " is e choed) IT . RPR 1F Reprint line code from device (buffer echoed) IT . DUP 2O Duplicate line code (all buffer echoed) IT, PSC 21 Pause code from device TT - INT 22 Interrupt code from device IT. QUT 23 Quit code from device IT » BSE 24 Back space code echoed to echo device IT. OVE 25 Li ne too long code to echo ( bell) B.T.PAR 26 Parity: init byte for ACIA control register IT » BAU 2. Baud rate ITD2P 28ー29 Echo device name offset IT, XON 2A X- on char IT, XOFF 2C X-off char IT COL 2C Number of columns IT, ROW 2D Number of rows End of option table. 2E- Name strings here. 3-3-4 ________________ NSIDE OS9 LEVE Devices Section 3 PATH DESCRIPTOR PD. Variables SCFMAN Name Offset Description PD . PD OO Path number PD , MOD O Acces s mOde l=read 2=write 3=update PD » CNT O2 Number of paths using this path desc PD DEW 03-04 Device table entry address PD CPR O5 Current Proc ID using this path for I/O PD) . RGS O6r-OT Address of user's register stack PD BUF 08ー09 Data buffer (256 bytes) if used PD . FST Beginning of SCF man var s PD) . DV2 OAー0B Echo device table ptr (output) PD » RAW OC Edit flag 0=read/write 1=readlin/writlin PD) , MAX OD -- OE Readiline max char cnt PD » IMIN OF Device use flag O=my devices PD · STS 10ー11 Status routine module address PD . STM 12-13 Reserved for status routine 14-1F Reserved PD) . OPT 20 Device class 0=SCF 1 =RBF 2=PIPE PD I. UPC 2 Case O=upper and lower l=upper only PD » BSC 22 Back space O=bsp 1=bsP, space, bsD PD) . DILO 23 Delete 0=bsp over line 1 = cr/lf PD ... EKO 24 Echo Ocno echo PD . ALF 25 Auto lif 0=no auto line feed after cr PD NUL 26 Null cht nulls sent after cr slf for delay PD PAU 27 Pause lines left before pause; 0 = no pause PD .. PAG 28 Lines / page PD - BSP 29 Back space char PD . DEL 2A Delete-line char PD) . EOR 2B End of line char (normally SOD, 0 still EOF) PD . EOF 2C End of file char (read only) PD) - RPR 2D Reprint li ne char PD . DUP 2E Duplicate last line char PD - PSC 2F Pause char PD) . INT 3O Keyboard inter rupt char (ctrl-C) PD . QUT 31 Keyboard abort char (ctrl-O / Break) PD » BSE 32 Back space echo char PD . COVE” 33 Line overflow char (Bell code) PD), PAR 34 Device in it byte (parity) PD . BAU 35 Baud rate code PD » D2P 36ー37 Offset to DEV2 name string PD) . XON 38 X-ON chair for ACIA PD I. XOFF 39 X-OFF char PD - ERR 3A Most recent. I / O error status PD. TBL 3B-3C Device table entry copy for user Input of a keyboard INT/QUT character returns that char as the I/O error code, and sends an interrupt/abort Signal to the last active user process of this path. 3-3-5 ________________ INSIDE OS9 LEVE II Devices Section 3 Template DEVICE DESCRIPTOR SCFMAN ifpl use /dd/defs/defs file en dic type SET DEVIC+OBJCT rews SET REENT+ 1 MOD len nam, type, revs, mgr, drvir FCB READ +WRITE. mode FCB SFF ext 'c acci FDB SFFOO device address FCB opt-* -1 option byte cnt FCB DT.SCF SCF device FCB O cas e = UPPER and lower FCB 1. backspace=bs sp. bs FCB O delet e=bs over line FCB 1. aut o echo FCB 1. aut o line feed FCB O no nulls on CR FCB O no page pause FCB 24 lines per page FCB O8 back space char FCB S18 delete line char FCB SOD end of record char FCB O no end of file char FCB O4 reprint line char FCB O1 duip last line char FCB S17 pau se char FCB 3 abort chair FCB 5 interrupt char FCB S08 backspace e cho char FCB Ol line overflow (bell) FCB O printer type FCB 4 baud rate=24 OO FDB e Cho echo device opt EQU 女 än FCS "Remote" FCS patch space mgr FCS I "SCF file mgr name drv FCS ICCIO driver name e Cho FCS T1 . echo device EMOD llen EQU ★ END Using "Shell K/remote >/t1 >>/t1' allows you to use the CoCo keyboard while visual output is redirected (and input echoed) to a terminal display connected to the RS-232 port. LSLLBBSBL eeLLeLeeS SeeSSSL LSeLeLLLLL LLSL LSL DeLe SSLeqLLLL Lqqq qqqq SqqSq qqqqSLLSLLSqS SqqqqS SSS S eqeSSSL LSLSeee eeeLLqL LL SL LLLLL LeeL LqeL LLSLSSLSSSL qSSSL qSq LSLLSqSSeqLSLeq qqSSqLqqL SSqe qSqqSL LSqS SLLLLLLLeeLSL LSLSqSqL LLLLL qqqL LS SL SYLASS 3-3-6 ________________ INSIDE OS9 LEVE I Devices Section 4 OS9 IAO OS9 IAO IP IPEMIAN FILE PD. - path descriptor vars WS-- device table V. -- device static storage QŞ-- IRQ poll table PŞ-- process descriptor Opening a pipe (PIPEMAN) file takes the following steps: VAR MOD ACTION 1. PD PD IOMAN Allocates a 64-byte block path descriptor. PD MOD Sets access mode desired. PD - CNT Sets user cntal for this path desc. 2 PD - DEV IOMAN Attaches the device used: VSSTAT Allocates memory for device driver (none). W. PORT Sets device address in driver static memory. ( address = 00 0000 ) 3 PIPER. The driver's init subroutine is called to initialize the device (does nothing) . 4. No interrupts used by PIPER. 5 VŞDRTV IOMAN Sets up rest of device table. VŞDESC ( module addresses of des c, driver, mgr) VŞFMGR VŞUSERS Sets user count of this pipemansl 6 PD - OPT IOMAN Copies device desc info to path desc. ( just type= Pipe ) 7 PD. BUE' PIPMN Allocates 256-byte buffer. Sets begin end, next char pitrs in PD. 8 PSPATH IOMAN Puts path desc in proc desc I/O table. Returns table pointer to user as path number. 23, 5 only the very first time a pipe is used else VSUSRS = VSUSRS + 1. PD. DEV = device table entry 4. not used at all Note that both the driver and descriptor (Piper, Pipe) are only dummy modules, there just to make IOMAN happy. 3-4-1 ________________ INSIDE OS9 LEVEL I Devices Section 4 PATH DESCRIPTOR PD. Variables PIPEMAN Name Offset Description PD - PD 00 Path number PD MOD O1 Access mode 1=read 2=write 3=update PD - CNT O2 Number of paths using this path desc PD - DEV 03-04 Device table entry address 12-13 14-15 16-17 18 Current Proc ID using this path for I/O Address of user's register stack Data buffer (256 bytes) address each Create Beginning of Pipeman vars Read user Number read users Read signal End of line char Write user Number write users Write signal Not used End of buffer Pointer to next address to store char Pointer to next address to read char Data flag 0=no data in circular buffer

Pipeman uses no static memory. Instead, it allocates a 256 byte buffer each time a 'file' is created. This buffer is returned when the last user has closed a path to it, or there are no more readers.

Note: these are for Level One. I haven't had a chance to check on L-II vars, but the concept will be the same, with the exception that Pipeman will do an FSMove of the data between process maps.

Devices Section 5

GENERAL DRIVER NOTES

LEVEL TWO DEVICE ADDRESSES

(Message from me to CompuServe OS9 Forum 24Mar87.)

Finally went looking for the reason why I've been telling everyone that their extended device addresses had to be $07FXXX instead of the old L-ISFFXXXX. Here's the dope:

L-II IOMan (just like a GIMIX) takes the address ($07FF) top bytes, and converts it to an I/O block number... on the CoCo, it translates to block $3F. Well, this makes sense as far as it goes, as extended address $07FXXX is indeed the top of mem; that is, the last block or $3F block.

It then looks to see if that block is already mapped into the system 64K map...if it's block $3F, it already is, cuz that's the kernal and I/O area from SE000-FFFF.

BUT If the extended address does NOT translate out to $3F (SFFFF = block number SFF), then it maps that block into the system map. And ignores it as RAM cuz it's obviously I/O, right? So you just lost 8K in your System 64K map.

8K is a lot to take away from the system map, and that's when those of you using Rogue got the dreaded 207 error for no seeming reason.

You also got the error if it couldn't map the block in. This error number has been changed to 237 (no ram), in the latest versions, btw.

Since the converted logical address would also be wrong, some things died. Devices with hard coded addresses had fewer problems.

That's the scoop, guys... so make sure to use the $07FXXX if writing up new device descriptors. That is, offset $OE in your device descriptor must be = $07 and the next =SFX.

On the other hand, $000XXX should be okay also, as block 00 is also always in the system map.

SCF SPECIAL CHARS

As you know, SCF drivers are responsible for sending either an SSAbort (for character matching V.QUIT) or SSIntrpt (char = V.INTR) signal to the last process (V.LPRC) that used the device.

A note about the above... character matching is done against the V.xxx static memory variables, NOT against the path descriptor PDyyy equivalents. This is even though the V.xxx were set by SCF to the PDyyy characters when the process gained the use of the device.

Why not just use the PD stuff? Because most devices are IRQ-driven, and there's no easy way for OS9 to get the path descriptor pointer to the asynchronous IRQ code that is servicing that driver. Hence they are copied to the V.xxx driver memory which IS known, as IOMan has it in it's interrupt polling table.

RBF THINGS

The Device Descriptor describes the maximum capabilities of the device; the Path Descriptor is used for variables pertaining to the file itself (pos, length, 1sn's, dirs, etc); and the Drive Tables are for info about THAT one diskette currently in the drive (format, tracks, sectors, bitmap size, root dir, id, which track the head is pointing to, whether a process is changing the bit map, etc).

Those of you who write RAMdisk drivers usually follow the lead of the floppy drivers. Okay, but some parts are different. For example in your Init, you should probably set the DDTOT to the actual sector size of the "drive". And unless you wish to use it as some kind of flag, there is NO need to do anything to DDTRAK. That's done there only so floppy drives can restore to track zero the first time they're called. If your driver doesn't need it, don't mess with it.

IRO's On LEVEL TWO

Let's take a quick look at how ACIAPAK sets up for interrupts, to give other driver writers some help. ACIAPAK Init Routine: Does an FSIRO call Stops all interrupts Resets the CART PIA line for no Multi-Pak FIRQ's Gets Direct Page 0092 (GIME IRQ register shadow) OR's it with 01 to enable CART-->IRQ conversions Stores that value back at 0092 and FF92 Restores the CC register Sets the MPI slot for CART from slot 0 What CLOCK Does on Interrupt : On an IRQ, Clock read GIME FF92 IRQ register OR"d that value into Direct Page 00AF JSR'd the Interrupt Polling Routine. . . ACIAPAK Interrupt Routine: Get Direct Page 00AF (contains FF92 IRQ read by Clock) NOT with 01 to indicate that CART IRO was read Store that value back at 00AF Do the interrupt routine Go back and check for another IRQ before RTS

OTHER L2 DRIVER CHANGES

Because the system map is so much like under L-I, only a few changes must be made. The most obvious is the interrupt handling, as discussed above. Timing loops have to compensate for the 2Mhz speed, also. For RBF devices that must change slots, the main (and sometimes almost only) change is that D.DMAReq has moved from 006A to 008A.

The file managers take care of moving data between system maps, so many old drivers will work fine (once the descriptor address is changed as pointed out). For example, once the address has been changed the Disto Parallel Printerport driver works.

One last note: CC3DISK no longer turns on precompensation on the inner tracks. Supposedly most drives never needed it.