
Behavior Research Methods& Instrumentation 1978, VoL 10 (4),527-530 Hardware and Software A floppy disk operating system for the 8080 and Z80 KARL W. SCHOLZ AdvancedInteractive Systems, 8216 Pickering Street, Philadelphia, Pennsylvania 19150 Techniques for the design and implementation of a floppy disk operating system for the 8080A or ZSO microprocessors are described. Implementation details are illustrated through reference to 80S, a prototype Small Operating System which runs with a single IBM·format floppy drive on an 8080. Techniques for floppy disk communication, disk directory design, and system resource management are described and illustrated. For years, journals such as Behavior Research haps compiler(s) for higher level languages such as Methods & Instrumentation have presented count­ BASIC,PASCAL, or FORTRAN. less descriptions of the successes achieved by com­ The list of desirable features can be greatly extended, puterized research laboratories using equipment resulting in the specification of a complex but compre­ costing tens or hundreds of thousands of dollars. hensive system. However, for a small research laboratory However, as both federal and institutional funds such a system can well represent an unnecessary extrav­ become increasingly difficult to obtain, a growing agance. The following discussion will be restricted number of laboratories are forced to consider economic to the features listed above. alternatives to total computerization, such as pur­ The development of the floppy disk is the single chasing used equipment or microprocessor-based technological achievement which makes possible the systems. Those who choose the microprocessor route creation of a functional but truly inexpensive laboratory quickly learn that, although inexpensive hardware computer system. In view of this, the following dis­ is readily available, appropriate software is scarce and cussion centers primarily around techniques for orga­ difficult to obtain. In a sense, the microprocessor nizing and communicating with a floppy disk. user of today is in a position similar to that of the minicomputer user of a decade ago, in that both find rns FLOPPY DISK AS A SECONDARY the only practical source of appropriate software is STORAGE MEDIUM internal. The present paper summarizes techniques central to the design of disk-based system software A floppy disk is a disk of flexible Mylar 5~ or 8 in. in and illustrates these techniques using SOS, a Small I diameter which is coated with a magnetic emulsion sim­ Operating System, for the 8080 or Z80 micropro­ ilar to that on conventional recording tape. Disk drives cessor with at least 8K of memory and one floppy are available for both sizes which provide either a single disk. read-write head or multiple heads for double-sided re­ cording; data can be written using either a single- or SYSTEM REQUIREMENTS double-density format. Although double-density and double-sided formats are growing rapidly in popularity, A disk-based operating system should include as the most widely used is the 8-in. disk, single-density a minimum the following features. (1) A bootstrap and single-sided. This type disk will be used in the loader, often ROM resident, to permit fast loading following illustrations. of the system when the machine is powered up. (2) Disk The disk's surface is formatted into a number of I/O primitives (e.g., subroutines) that permit reading concentric "tracks," and each track is divided into a from and writing to the disk. (3) A disk directory number of "sectors." In order to permit disk transport­ ("table of contents") through which any information ability from system to system, many manufacturers stored on the disk can be located. (4) Utility functions conform to a standard commonly referred to as the for system and data file maintenance such as DIREC- "IBM 3740" format, which provides 26 sectors of 128 TORY (display the "table of contents"), DELETE bytes for each of 77 tracks. Disks formatted in this way (to remove an unwanted data file), COPY (to copy provide 2,002 sectors, or 256,256 bytes of usable an existing data file), RENAME (to alter the name storage. of an existing data file), GET (to load a data file to Disk drives are interfaced to the computer via a memory), and SAVE (to create or update information "controller" which attends to all the details of for­ on the disk from information in memory). (5) Utility matting, error detection, and parallel-serial conversion. programs such as a text editor, an assembler, and per- Programming, therefore, requires positioning the disk 527 528 SCHOLZ head to the desired track, locating the desired sector, sector and contains the correct track and sector address. and transferring one or more sectors of information On each transfer, the controller attempts to verify to or from the disk. head position by inspecting this header, and sets an error status bit if the attempt fails. THEDISKDRNER Figure 1 illustrates the code in 8080 assembly lan­ guage for a typical disk driver that includes error The read and write routines (frequently referred to recovery procedures. It can be entered at either the as the disk "driver") are central to the operation of READ or WRITE entry points, and expects to find any disk-based operating system. Since all disk I/O the desired sector address (between 1 and 2,002) in operations are mediated by the driver, it should be the BC register, the desired number of sectors to be coded to maximize ease of use and should include transferred in the DE register, and the memory facilities for error detection and recovery. Although address in the HL register. Although additional error the disk is accessed by both track number and sector processing can be included, this driver is entirely ade­ number, the sector/track distinction should be of quate for all but the most critical applications. concern only to the driver, not to the user. A user need only specify a sector relative to the start of the DISK ORGANIZATION disk or the start of a desired data file. The driver should calculate the correct track and sector within In the simplest case, disks serviced by a simple that track. operating system need to be divided into three distinct Dispite the extreme reliability of the floppy disk, sections: the system loader, the directory, and the user errors occasionally occur. The IBM format includes storage area. The term "system loader" refers to a several cyclic redundancy checks (CRCs, similar to simple routine stored in a known location on a disk a check sum) for each sector transfer. The controller (usually Track 0, Sector 1) which on execution loads generates a CRC when a sector is written and checks the monitor (the nucleus of the operating system). it when that sector is read. If the CRC check reveals If the disk contains only the three sections mentioned, an error, a status bit is set by the controller which the system loader is required to search the directory is accessible to the software. Furthermore, the IBM for the name of the me containing the system monitor format includes a sector header that precedes each and then load it. For SOS, the system loader is con- SIIIPLB DIlII: IIrUT/OUTPUT Diua 8PLIT - coa, Set ADDI TO SIC , Til ~LIT: D ;S"I DB (BU: CIIT) DC1 8 ;UloS 0 - 2001 . 1IllU1T&S: LII D.080Dll ;SIT 0.8 , E.13 UGO IQU 0'88 ; COIlIWID REG DIYLP: - 1.8 ;IS E .0T. 81 Ill' RIG2 IIllU OPlB ;SECTOI REG !D8 S ;SU8TRleT E 'ROIl 8 REG3 IQU 0'811 ;D1TA REG JC ROSU8 ;JUMP. C SIT. If IIOT REG_ IQU OPCS ; COITROL RIG Ill' 8,1 ;SU8T DYSR PROM D'ND AD BQU 0888 ; IIAD CCHUID IIOSUB: QIC ;COMPL Ie' (QUOTIEIIT) IR IQU OlBH ; IIITE COIlIWID Ill' I,C ; 'ITCH QUOTIEIIT 1II IQU 016H ;SIIl ClHWID IlL jSHIFT 111 'e' BIT ; lilY C,l ;lID RISTORE. RIllD 18THt POlIT lilY 1.8 ;'ITCH DIVISOR RIllD: CALL SPLIT ;SIT SEC. , TRI. UL ;SHIn II RElT 8IT C1LL SEll ; POSITIOR BIllD Ill' 8,1 ;lID RESTORE. BLUP1: SIU.J) USTH ;SlYE MEIl ADDR DCI 0 ; DEC l.OOP COUNT lilY 1.8 ;SEC. TO ICC JIZ DIYLP ;LOOP '01 cn 0' 8. OUT REG2 ;IMIT TO CnRLLEI III 8 ;SIT SICT RlIOE 1-26 HYI I.RD ;UAD COIIWID POP D ; RESTORE 8U: CNT OUT REGO ;START 1lEAD. RET ;lID RETURI BLUP2: 11 REG_ ;IUT FOR 8ITE RDt , SCIRC - IRC SEC CIT , TIST OONE ORI I ;Sir ,UOS SCllC: 11 RlGO ; RIllD STATUS RIG JP IlDOIIE ;JUMP If OORE. III OFDB ;1llS1 ERROR BITS II RIG3 ; ELSE Gil 8ITE JZ aOERR ; JUMP IF ALL 01. Ill' H.l ;STORE II BlK IJILI) USTB ;ELSE 81Cl UP tiL III B ; IICR MEIl lDDR RET ; liD RITRt RD/WR. JMP BLUP2 ; LOOP TIL SIC. DOli HOERI: DC1 D ; DIC SEC COURT RDOIIE: CALL SCIIC ; lIC SIC , DIC CIT Ill' I,D ; TIST\ FOR ZIRO JMP BLUPI ;l.OOP TIL CIIT • O. ou I ;8OTH 8ITIS JRZ HORI ; JUMP URLESS OOU , WRITE BIITRI POINT POP D ;DISClRD 1 RITURI WIITE: CALL SPLIT ;SIT SIC •• TRI. RET ; RETURI TO CALLER. CALL SEll ;POSITION BElD IIllRE: IRR 8 ; ON TO lilT SIC ILUP1: SHLD Ll5TB ;snl MEIl lDDR HOY 1.8 ;OET SIC lillY 1,8 ;SIC. TO ICC CPI 27 ;TUCI 00111 OUT RlG2 ;IMIT TO CRTBLLIR RC ;RITURR If lOT HVI A,WI ; WIITI COIII1ND MYI 8,1 ; ELSI IISIT TO 1 OUT RlGO ; START WRITI lIR C; liD lICR TUCI WLUP2: IR RIG_ ; WlIT 'OR 8ITE RDI , Sill - POSITIOR DISK BllD OU I ;SIT FL1GS SEll: HOY I,C ;OIT DlSlllED TRI JP IIDONE ;JUMP IF OOIE. CPI 78 ;resr OYIIlFLOW HO' I,H ; ELSE Gil 8ITI JNC ERROR ;IRROI I' SO OUT RIG3 ; WRITE IT TO DIlII OUT RlG3 ;IMIT TO CRTBLLER 181 B ; I1CR HEll lDDR MYI I,SE ;SBEI COIIWID JMP BLUP2 ;l.OOP TI~ SEC.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages4 Page
-
File Size-