Home

CPM 68K System Guide

image

Contents

1. fee ee ee hhh o ee a a k 2h 2 fe 2 ae fe 2 ak ae if LOADER define NUMTB3 Number of track buffers must be at least 3 for the algorithms in this BIOS to work properly Define the track buffer structure 78 Apendix D EXORmacs BIOS struct tbstr struct 5 struct tbstr firstbuf struct tbstr tbuf NUMTBIJ array of track buffers Helse tbstr nextbuf BYTE buf 32 128 WORD dsk WORD trk BYTE valid BYTE dirty form linked list for LRU big enough for 1 4 hd trk disk for this buffer track for this buffer buffer valid flag true if a BIOS write has put data in this buffer but the buffer hasn t been flushed yet head of linked list of track buffers struct tbstr lastbuf tail of ditto the loader bios uses only 1 track buffer BYTE bufltrk 32 128 BYTE bufvalid WORD buftrk endif big enough for 1 4 hd trk CP M 68K System Guide fee eee ee ae ee pe Disk I O Packets for the UDC and other Disk I O Variables fee eee spese opo epo o eot tepore 28 fe Home disk packet struct hmpkst 1 BYTE BYTE BYTE BYTE BYTE BYTE BYTE BYTE T al a2 a3 dskno coml com2 ao a7 hmpack 2 0 7 0 0 0 3 0 sw Init by bytes now hmpack 512 1792 0 768 kludge init by words Read write disk packet struct rwpkst 1
2. return 1 else return 0 T T setimask imsave return 0 T fee ee ee eee eee ee k k pe Do a Disk Read or Write fee ee ee eee eee ee k k dskxfer dsk trk bufp cmd REG WORD dsk trk cmd REG BYTE bufp H 86 Apendix D EXORmacs BIOS CP M 68K System Guide build packet REG WORD sectent REG WORD result fif CTLTYPE LONG bytecnt only needed for FDC WORD cheksum endif rwpack dskno cnvdsk dsk rwpack iobf bufp sectcnt dphtab dsk dpbp gt spt rwpack Isect trk sectent gt gt 1 rwpack chcmd cmd rwpack numblks sectent gt gt 1 if CTLTYPE cheksum 0 FDC needs checksum bytecnt LONG sectent lt lt 7 while bytecnt cheksum bufp amp Oxff rwpack cksum cheksum endif actvdsk dsk dskstate dsk change 0 sendpkt amp rwpack 21 result dskwait dsk 0x70 0x0 sendack dskstate dsk state IDLE ipcstate IDLE return result if LOADER fee ee ee eee eee ae a fe e hK k pe Write one disk buffer fee ee ee eee eee ee k k flush1 tbp struct tbstr tbp H REG WORD ok if tbp gt valid amp amp tbp gt dirty ok dskxfer tbp gt dsk tbp gt trk tbp gt buf DSK WRITE else ok 1 tbp gt dirty 0 even if error mark not dirty tbp gt valid amp ok otherwise system has trouble continuing return ok 87 Apendix D EXORmacs BIOS CP M 68K
3. 60 00000078 6E000152 bgt erxit 61 0000007C 1010 move b a0 d0 62 0000007E 4880 extw dO put disk letter into range O 15 63 00000080 907C0041 sub w 41 d0 64 00000084 33C00000408A move w d0 dsk 65 66 open file to copy 67 68 0000008A 303C000F move w open d0 69 0000008E 223900004080 move l fcb dl 70 00000094 4E42 trap 2 71 00000096 0C4000FF cmpi w 00ff d0 72 0000009A 660C bne openok 73 0000009C 223C00000034 move 1 opnfl d1 74 000000A2 4EF9000001D2 jmp erx 75 000000A8 207900004080 openok move 1 fcb a0 76 000000AE 42280020 clrb 32 a0 77 78 read 79 80 000000B2 243C00000000 move l buf d2 81 000000B8 42790000408E clr w count 82 000000BE 303C001A rloop move w dsetdma d0 83 000000C2 2202 move d2 d1 84 000000C4 4E42 trap 2 85 000000C6 303C0014 move w readseq d0 86 000000CA 223900004080 move 1 fcb d1 87 000000D0 4E42 trap 72 88 000000D2 4A40 tstw dO 89 000000D4 661A bne wrtout 90 000000D6 D4BC00000080 add 2128 02 91 000000DC 52790000408E add w l count 92 000000E2 0C7900800000408E cmpi w bufcnt count 93 000000EA 6E0000FE bet bufoflx 94 000000EE 60CE bra rloop 95 96 write 97 98 000000F0 303C0009 wrtout move w Zseldsk dO select the disk 99 000000F4 32390000408A move w dsk dl 100 000000FA 4202 clrb d2 101 000000FC 4E43 trap 3 104 Appendix E PUTBOOT Utility 102 000000FE 4A80 103 00000100 670000D8 104 00000104 2040 105 00000106 2068000E 106 0
4. Entry Parameters Register DO W 03H Returned Value Register DO W Character This function reads the next console character into register DO W If no console character is ready it waits until a character is typed before returning 18 Function 4 Write Console Character CP M 68K System Guide FUNCTION 4 WRITE CONSOLE CHARACTER Entry Parameters Register DO W 04H Register DI W Character Returned Value None This function sends the character from register Dl to the console output device The character is in ASCII You might want to include a delay or filler characters for a line feed or carriage return if your console device requires some time interval at the end of the line such as a TI Silent 700 Terminal You can also filter out control characters which have undesirable effects on the console device 19 Function 5 List Character Output CP M 68K System Guide FUNCTION 5 LIST CHARACTER OUTPUT Entry Parameters Register DO W 05H Register DI W Character Returned Value None This function sends an ASCII character from register Dl to the currently assigned listing device If your list device requires some communication protocol it must be handled here 20 Function 6 Auxiliary Output CP M 68K System Guide FUNCTION 6 AUXILIARY OUTPUT Entry Parameters Register DO W 06H Register DIW Character Returned Value Register DO W Character This function sends an ASCII character from register Dl to the
5. REG BYTE g REG WORD i REG struct tbstr tbp locate track buffer containing sector to be written Tif MEMDSK if setdsk MEMDSK i 90 Apendix D EXORmacs BIOS CP M 68K System Guide endif top gettrk if tbp return 1 failure locate desired sector and do copy the data from the user area p tbp gt buf setsec lt lt 7 multiply by shifting Hif MEMDSK else i p memdsk LONG settrk lt lt 12L LONG setsec lt lt 7L q setdma i 128 do pt q i 1 3 while 1 this generates good code return 0 endif q setdma i 128 do pt q i 1 3 while 1 this generates good code tbp gt dirty 1 the buffer is now dirty The track must be written if this is a directory write if mode 1 if flush1 tbp return 0 else return 1 else return 0 Helse fee eee ee ae ee ee eek Read and Write functions for the Loader BIOS fee eee ee ae ee read t REG BYTE p REG BYTE q REG WORD i if bufvalid buftrk settrk amp amp I dskxfer setdsk settrk bufltrk DSKREAD return 1 bufvalid 1 buftrk settrk p bufltrk setsec lt lt 7 q setdma i 128 do qt p i 1 while i return 0 T endif 91 Apendix D EXORmacs BIOS CP M 68K System Guide fee eee ee ae ee pe BIOS Sector Translate Function fee eee ee ae ee
6. WORD sectran s xp REG WORD s REG BYTE xp if xp return WORD xp s else return s 1 fee eee spese opo epo o eot tepore 28 fe BIOS Set Exception Vector Function fee eee ee ae ee LONG setxvect vnum vval WORD vnum LONG vval H REG LONG oldval REG BYTE vloc CP M 68K System Guide D EXORmacs BIOS Listing D 1 continued vloc long vnum lt lt 2 oldval vloc gt lword vloc gt lword wval return oldval fee eee spese opo epo o eot tepore 28 fe pe BIOS Select Disk Function fee eee ee ae ee LONG slctdsk dsk logged REG BYTE dsk BYTE logged i REG struct dph dphp REG BYTE stl st2 BYTE stpkt STPKTSZ setdsk dsk Record the selected disk number if LOADER 92 Apendix D EXORmacs BIOS endif if endif Special Code to disable drive C On the EXORmacs drive C is the non removable hard disk Including this code lets you save your non removable disk for non CP M use if dsk gt MAXDSK dsk 2 i printstr n rBIOS ERROR DISK portout PORT 1 A dsk printstr NOT SUPPORTED nir return OL dphp amp dphtab dsk MEMDSK if setdsk MEMDSK return dphp if logged amp 0x1 i hmpack dskno cnvdsk setdsk hmpack coml 0x30 hmpack com2 0x02 actvdsk dsk dskstate dsk change 0 sendpkt amp hmpack 7 if dskwait dsk 0x72 0x0 H sendack ipc
7. 21 BIOS function 7 Auxiliary Input 22 BIOS function 8 Home 23 BIOS function 9 Select Disk Drive 24 BIOS function 10 Set Track Number 25 BIOS function 11 get Sector Number 26 BIOS function 12 Set OMA Address 27 BIOS function 13 Read Sector 28 BIOS function 14 Write Sector 29 BIOS function 15 Return List Status 30 BIOS function 16 Sector Translate 31 BIOS function 18 Jet Address of MRT 32 BIOS function 19 Get I O Byte 33 BIOS function 20 Set I O Byte 36 BIOS function 21 Flush Buffers 37 BIOS function 22 Set Exception Handler Address 38 BIOS function I Warm Boot 16 BIOS function called by BDOS 13 Home 8 25 BIOS interface 39 BIOS internal variables 15 BIOS register usage 14 BIOS write operation 47 BLM 43 Block Mask 43 block number largest allowed 44 Block Shift Factor 42 block storage 2 BLS 44 BLS bytes 48 boot disk 11 49 boot tracks 43 boot warm 47 121 bootstrap loader 6 machine dependent 43 bootstrap procedure 9 bootstrapping loading 9 BSH 42 bss 2 buffer writing to disk 47 built in user commands 4 byte 1 byte 3 bit value 42 C C language 39 carriage return 19 CBASE feature 51 CCP 3 4 6 7 50 CCP entry point 16 character devices 5 checksum vector 41 CKS 43 Cold Boot Automatic Command Execution 51 Cold Boot Loader 7 Cold Boot Loader creating 10 cold start 6 communication protocol 20 configuration r
8. 346 347 000000A0 alv0 dc b 20 26 6 12 dc b 18 24 4 10 dc b 16 22 bss ds b 128 ds b 16 ds b 16 ds b 32 Listing B 1 65 CP M 68K System Guide dummy ptr to directory buffer ptr to disk parameter block ptr to check vector ptr to allocation vector dummy ptr to directory buffer ptr to disk parameter block ptr to check vector ptr to allocation vector sectors per track block shift block mask extent mask dummy fill disk size 64 directory entries directory mask directory check size track offset directory buffer check vector allocation vector continued Appendix B Sample Assembly Language BIOS CP M 68K System Guide 348 000000C0 alvl ds b 32 349 350 000000E0 end Symbol Table cop eeepeces EXT init 00000000 TEXT alv0 00000040 BSS alvl 000000C0 BSS biosbase 0000001E TEXT chkdone 00000264 TEXT chksl 0000022A TEXT chks2 00000254 TEXT chkseek 00000208 TEXT ckv0 00000080 BSS ckvl 00000090 BSS conin 00000094 TEXT conout 000000A8 TEXT constat 00000080 TEXT curdrv 00000001 DATA dcmd OOFFFFF8 ABS dentr OOFFFFFC ABS ddata OOFFFFFB ABS dirbuf 00000000 BSS dma 00000006 DATA dpb 0000004A DATA dphO 00000016 DATA dphl 00000030 DATA dphlen 0000001A ABS dsect OOFFFFFA ABS dstat OOFFFFF8 ABS dtrk OOFFFFF9 ABS dwait OOFFFFFC ABS errchk 00000200 TEXT errent 0000000B DATA flush 00000298 TEXT getiob 000002A4 TEXT getseg 0000029C TEXT home 00
9. and of course the details of the hardware environment where CP M 68K is to be implemented How This Book is Organized Section 1 presents an overview of CP M 68K and describes its major components Section 2 discusses the adaptation of CP M 68K for your specific hardware system Section 3 discusses bootstrap procedures and related information Section 4 describes each BIOS function including entry parameters and return values Section 5 describes the process of creating a BIOS for a custom hardware interface Section 6 discusses how to get CP M working for the first time on a new hardware environment Section 7 describes a procedure for causing a command to be automatically executed on cold boot Section 8 describes the PUTBOOT utility which is useful in generating a bootable disk Appendix A describes the contents of the CP M 68K distribution disks Appendixes B C and D are listings of various BIOSes Appendix E contains a listing of the PUTBOOT utility program Appendix F describes the Motorola S record representation for programs Table of Contents 1 System Overview 1 1 Introduction 1 2 CP M 68K Organization 1 3 Memory Layout 1 4 Console Command Processor 1 5 Basic Disk Operating System BDOS 1 6 Basic I O System BIOS 1 7 VO Devices 1 7 1 Character Devices 1 7 2 Character Devices 1 8 System Generation and Cold Start Operation 2 System Generation 2 1 Overview 2 2 Creating CPM SYS 2 3 Relocating Utilities 3 Bootstrap Proce
10. relocated to the top of the TPA each time it is used Relocatable version of the DUMP utility Relocatable version of the ED utility Assembly language source for the ERG sample loader BIOS Assembly language source for the ERG sample BIOS Same as above Relocatable disk formatter for the Motorola EXORmacs 56 Appendix A Contents of Distribution Disks File FORMAT S INIT REL INIT S LCPM SUB LDBIOS 0 LDBIOSA 0 LDBIOSA S LDRLIB L068 REL LOADBIOS H LOADBIOS SUB MAKELDR SUB NORMBIOS H NORMBIOS SUB NM68 REL PIP REL PORTAB H PUTBOOT REL CP M 68K System Guide Table A 1 continued Contents Assembly language source for the FORMAT utility Relocatable version of the INIT utility Assembly language source for the INIT utility Submit file to create CPM REL for EXORmacs Object file of loader BIOS for EXORmacs Object file for assembly portion of EXORmacs loader BIOS Source for the assembly language portion of the EXORmacs loader BIOS as distributed with CP M 68K Library of object files for creating a Bootstrap Loader See Section 3 Relocatable version of the linker Include file for use with BIOS C to make it into a loader BIOS Submit file to create loader BIOS for EXORmacs Submit file to create CPMLDR SYS on EXORmacs Include file for use with BIOS C to make it into a normal BIOS Submit file to create normal BIOS for EXORmacs Relocatable version of the symbol
11. you can continue transferring the file After the file is transferred review the file and add the data that was not transferred due to the bad sector CP M Disk write error on drive x Do you want to Abort A Retry R or Continue with bad data C BDOS This message indicates a hardware error Specify one of the options enclosed in parentheses Each option is described below Option Action A or CTRL C Terminates the operation and CP M 68K returns the system prompt R Retries operation If the retry fails the system reprompts with the option message Meaning continued on next page 114 Appendix G CP M 68K Error Messages CP M 68K System Guide Table G 1 continued Message Meaning CP M Disk write error on drive x continued Option Action C Ignores error and continues program execution Be careful if you use this option Program execution should not be continued for some types of programs For example if you are updating a data base and receive this error but continue program execution you can corrupt the index fields and the entire data base For other programs continuing program execution is recommended For example when you transfer a long text file and receive an error because one sector is bad you can continue transferring the file After the file is transferred review the file and add the data that was not transferred due to the bad sector CP M Disk select error on drive x Do you want to Abort
12. 0 if no error Register DO W I if physical error After the drive has been selected the track has been set the sector has been set and the DMA address has been specified the read function uses these parameters to read one sector and returns the error code in register DO Currently CP M 68K responds only to a zero or nonzero return code value Thus if the value in register DO 15 zero CP M 68K assumes that the disk operation completed properly Ifan error occurs however the BIOS should attempt at least ten retries to see if the error is recoverable 28 Function 14 Write Sector CP M 68K System Guide FUNCTION 14 WRITE SECTOR Entry Parameters Register DO W OEH Register DI W 0 normal write 1 write to a directory sector 2 write to first sector of new block Returned Value Register DO W 0 no error 1 physical error This function is used to write 128 bytes of data from the currently selected DMA buffer to the currently selected sector track and disk The value in register DI W indicates whether the write is an ordinary write operation or whether the there are special considerations If register D1 W 0 this is an ordinary write operation if D1 W 1 this is a write to a directory sector and the write should be physically completed immediately If DI W 2 this is a write to the first sector of a newly allocated block of the disk The significance of this value is discussed in Section 5 under Disk Buffering 29 Function 1
13. 97 Apendix D EXORmacs BIOS CP M 68K System Guide Listing D 2 EXORmacs BIOSTYPS H File Q biostyps h 1 1 fee ee ee pe Portable type definitions for use with the C BIOS according to CP M 68K tm standard usage pe fee ee ee define LONG long define ULONG unsigned long define WORD short int define UWORD unsigned short define BYTE char define UBYTE unsigned char define VOID define REG register define LOCAL auto define MLOCAL static define GLOBAL extern define EXTERN extern SO Listing D 3 EXORmacs NORMBIOS H File define LOADER 0 define CTLTYPE 0 define MEMDSK 4 Listing D 4 EXORmacs LOADBIOS H File define LOADER 1 define CTLTYPE 0 define MEMDSK 0 Listing D 5 EXORmacs BIOSA S File text x N Global Code addresses x globl _init globl _biosinit 98 Apendix D EXORmacs BIOS dskint trap3 buserr x _ init loop quit globl flush globl wboot globl cbios globl deska globl dskic globl setimask globl _ccp globl cpm globl end Global data addresses globl memtab globl dpb3 globl _memdsk Vector Addresses equ 3fc equ 8c equ 8 lea entry a0 move l a0 trap3 lea _dskia a0 move a0 dskint Auto Size TPA lea _memtab a0 move w 1 a0 move l 400 a0 move cpm 408 a0 Auto Size RAM disk move l buserr sp lea _end a0 add 1 cpm a0 move l a0 memd
14. A Retry R BDOS There is no disk in the drive or the disk is not inserted correctly Ensure that the disk is securely inserted in the drive If you enter the R option the system retries the operation If you enter the option or CTRL C the program terminates and CPM 68K returns the system prompt CP M Disk select error on drive x BDOS The disk selected in the command line is outside the range A through P CP M 68K can support up to 16 drives lettered through P Check the documentation provided by the manufacturer to find out which drives your particular system configuration supports Specify the correct drive code and reenter the command line 115 Appendix G CP M 68K Error Messages CP M 68K System Guide Table G 1 continued Message Meaning File already exists CCP This error occurs during a REN command The name specified in the command line as the new filename already exists Use the ERA command to delete the existing file if you wish to replace it with the new file If not select another filename and reenter the REN command line insufficient memory or bad file header CCP This error could result from one of three causes 1 The file is not a valid executable command file Ensure that you are requesting the correct file This error can occur when you enter the filename before you enter the command for a utility Check the appropriate section of the CP M 68K Operating System Programmer s Guide or the CP M 68K Oper
15. System Guide fee eee ee ae ee Write all disk buffers fee eee ee ae ee flush REG struct tbstr tbp REG WORD ok ok 1 tbp firstbuf while tbp if flush1 tbp ok 0 tbp tbp gt nextbuf return ok fee eee ee ae ee pe Fill the indicated disk buffer with the current track and sector fee eee ee ae ee fill tbp REG struct tbstr tbp H REG WORD ok if tbp gt valid amp amp tbp gt dirty ok flush1 tbp else ok 1 if ok ok dskxfer setdsk settrk tbp gt buf DSKREAD tbp gt valid ok tbp gt dirty 0 tbp gt trk settrk tbp gt dsk setdsk return ok fee eee ee ae ee ee eek Return the address of a track buffer structure containing the currently set track of the currently set disk fee eee ee ae ee struct tbstr gettrk H REG struct tbstr tbp 88 Apendix D EXORmacs BIOS CP M 68K System Guide REG struct tbstr Itbp REG struct tbstr mtbp REG WORD imsave Check for disk on line if not return error imsave setimask 7 if dskstate setdsk ready H setimask imsave tbp OL return tbp T Search through buffers to see if the required stuff is already in a buffer tbp firstbuf Itbp 0 mtbp 0 while tbp if tbp gt valid amp amp tbp gt dsk setdsk amp amp tbp gt trk settrk if Itbp found it rearrange LRU links i Itbp g
16. been corrupted reassemble or recompile the source file and relink 1t before you reenter the command line BIOS ERROR DISK X NOT SUPPORTED BIOS The disk drive indicated by the variable X is not supported by the BIOS The BDOS supports a maximum of 16 drives lettered A through P Check the documentation provided by the manufacturer for your particular system configuration to find out which of the BDOS drives your BIOS implements Specify the correct drive code and reenter the command line 111 Appendix G CP M 68K Error Messages CP M 68K System Guide Table G 1 continued Message Meaning BIOS ERROR Invalid Disk Status BDOS The disk controller returned unexpected or incomprehensible information to the BIOS Retry the operation If the error persists check the hardware If the error does not come from the hardware it is caused by an error in the internal logic of the BIOS Contact the place you purchased your system for assistance You should provide the information below 1 Indicate which version of the operating system you are using 2 Describe your system s hardware configuration 3 Provide sufficient information to reproduce the error Indicate which program was running at the time the error occurred if possible you should also provide a disk with a copy of the program Buffer Overflow PUTBOOT The bootstrap file will not fit in the PUTBOOT bootstrap buffer PUTBOOT contains an internal buffer of approximat
17. currently assigned auxiliary output device 21 Function 7 Auxiliary Input CP M 68K System Guide FUNCTION 7 AUXILIARY INPUT Entry Parameters Register DO W 07H Returned Value Register DO W Character This function reads the next character from the currently assigned auxiliary input device into register DO It reports an end of file condition by returning an ASCII CTRL Z IAH 22 Function 8 Home CP M 68K System Guide FUNCTION 8 HOME Entry Parameters Register DO W 08H Returned Value None This function returns the disk head of the currently selected disk to the track 00 position If your controller does not have a special feature for finding track 00 you can translate the call to a SETTRK function with a parameter of 0 23 Function 9 Select Disk Drive CP M 68K System Guide FUNCTION 9 SELECT DISK DRIVE Entry Parameters Register DO W 09H Register DI B Disk Drive Register D2 B Logged in Flag Returned Value Register DO L Address of Selected Drivels DPH This function selects the disk drive specified in register D1 for further operations Register D1 contains 0 for drive A 1 for drive B up to 15 for drive P On each disk select this function returns the address of the selected drive s Disk Parameter Header in register DO L See Section 5 for a discussion of the Disk Parameter Header If there is an attempt to select a nonexistent drive this function returns 00000000H in register DO L as
18. organized in CP M 68K A CP M 68K disk has two major areas the boot or system tracks and the file system tracks The boot tracks are usually used to hold a machine dependent bootstrap loader for the operating system They consist of tracks 0 to OFF 1 Zero is a legal value for OFF and in that case there are no boot tracks The usual value of OFF for 8 inch floppy disks is two The tracks after the boot tracks beginning with track number OFF are used for the disk directory and disk files Disk space in this area is grouped into units called allocation units or blocks The block size for a particular disk is a constant called BLS BLS may take on any one of these values 1024 2048 4096 8192 or 16384 bytes No other values for BLS are allowed Note that BLS does not appear explicitly in any BIOS table However it determines the values of a number of other parameters The DSM field in the Disk Parameter Block is one less than the number of 43 5 2 Disk Definition Tables CP M 68K System Guide blocks on the disk Space 15 allocated to a file or to the directory in whole blocks No fraction of a block can be allocated block size The choice of BLS is very important because it effects the efficiency of disk space utilization and because for any disk size there 15 a minimum value of BLS that allows the entire disk to be used Each block on the disk has a block number ranging from 0 to DSM The largest block number allowed is 32767 Theref
19. page 1 1 Introduction CP M 68K System Guide USER A V User Interface CCP V Programming Interface BDOS V Hardware Interface BIOS V HARDWARE ENVIRONMENT Figure 1 1 CP M 68K Interfaces 1 2 CP M 68K Organization CP M 68K comprises three system modules the Console Command Processor CCP the Basic Disk Operating System BDOS and the Basic Input Output System BIOS These modules are linked together to form the operating system They are discussed individually in this section 1 3 Memory Layout The CP M 68K operating system can reside anywhere in memory except in the interrupt vector area 0H to 3FFH The location of CP M 68K is defined during system generation Usually the CP M 68K operating system is placed at the top end high address of available memory and the TPA runs from 400H to the base of the operating system It is possible however to have other organizations for memory For example CP M 68K could go in the low part of memory with the TPA above it CP M 68K could even be placed in the middle of available memory 1 3 Memory Layout CP M 68K System Guide However because the TPA must be one contiguous piece part of memory would be unavailable for transient programs in this case Usually this is wasteful but such an organization might be useful if an area of memory is to be used for a bit mapped graphics device for example or if there are ROM resident routines The
20. sets the exception vector indicated in register DI W to the value specified in register D2 L The previous vector value is returned in register DO L Unlike the BDOS Set Exception Vector Function 61 this BIOS function sets any exception vector Note that register DI W contains the exception vector number Thus to set exception 2 bus error this register contains a 2 and the vector value goes to memory locations 08H to OBH End of Section 4 38 Section 5 Creating a BIOS 5 1 Overview The BIOS provides a standard interface to the physical input output devices in your system The BIOS interface is defined by the functions described in Section 4 Those functions taken together constitute a model of the hardware environment Each BIOS is responsible for mapping that model onto the real hardware In addition the BIOS contains disk definition tables which define the characteristics of the disk devices which are present and provides some storage for use by the BOOS in maintaining disk directory information Section 4 describes the functions which must be performed by the BIOS and the external interface to those functions This Section contains additional information describing the structure and significance of the disk definition tables and information about sector blocking and deblocking Careful choices of disk parameters and disk buffering methods are necessary 1f you are to achieve the best possible performance from CP M 68K Therefo
21. system is either trivial or involved depending on your hardware environment Digital Research supplies CP M 68K in a form suitable for booting on a Motorola EXORmacs development system If you have an EXORmacs you can read Section 6 1 which tells how to load the distributed system Similarly you can buy or lease some other machine which already runs CP M 68K If you do not have an EXORmacs you can use the S record files supplied with your distribution disks to bring up your first CP M 68K system This process is discussed in Section 6 2 6 2 Booting on an EXORmacs The CP M 68K disk set distributed by Digital Research includes disks boot and run CP M 68K on the Motorola EXORmacs You can use the distribution system boot disk without modification if you have a Motorola EXORmacs system and the following configuration 1 128K memory minimum 2 a Universal Disk Controller UDC or Floppy Disk Controller FDC 3 a single density IBM 3740 compatible floppy disk drive 4 an EXORter Hi To load CP M 68K do the following 1 Place the disk in the first floppy drive FD04 with the UDC or FDOO with the FDC 2 Press SYSTEM RESET front panel and RETURN this brings in MACSbugT M 3 Type BO 4 if you are using the UDC BO 0 if you are using the FDC and RETURN CP M 68K boots and begins running 49 6 3 CP M 68K with S record Files CP M 68K System Guide 6 3 Bringing Up CP M 68K Using the S record Files The CP M 68K distribut
22. table dump utility Relocatable version of the PIP utility Same as above Relocatable version of the PUTBOOT utility 57 Appendix A Contents of Distribution Disks File PUTBOOT S README TXT RELCPM SUB RELOC REL RELOCX SUB b S 0 SENDC68 REL SETJMP H SIGNAL H SIZE68 REL SRI28K SYS SR400 SYS STAT REL STDIO H CP M 68K System Guide Table A 1 continued Contents Assembly language source for the PUTBOOT utility ASCII file containing information relevant to this shipment of CP M 68K This file might not be present Submit file to relocate CPM REL into CPM SYS Relocatable version of the command file relocation utility This file is included on each disk that contains REL command files x is the number of the distribution disk containing the files It is a submit file which will relocate the REL files for the target system Startup routine for use with C programs must be first object file linked Relocatable version of the S record creation utility Same as above Same as above Relocatable version of the SIZE68 utility S record version of CP M 68K This version has no BIOS and is provided for use in porting CP M 68K to new hardware S record version of CP M 68K This version has no BIOS and is provided for use in porting CP M 68K to new hardware Relocatable version of the STAT utility Include file with standard I O definitions for use with C programs See the C P
23. tracks typically the first two are reserved for the operating system and bootstrap routines while the remainder of the disk contains the file structure consisting of a directory and disk files The topic of disk organization and parameters is discussed in Section 5 In our model the CP M 68K operating system resides in a disk file named CPM SYS described in Section 2 and the system tracks contain a bootstrap loader program CPMLDR SYS which knows how to read CPM SYS into memory and transfer control to it Most systems have a boot procedure similar to the following 1 When you press reset or execute a boot command from a monitor ROM the hardware loads one or more sectors beginning at track 0 sector 1 into memory at a predetermined address and then jumps to that address 2 The code that came from track 0 sector 1 and is now executing 15 typically a small bootstrap routine that loads the rest of the sectors on the system tracks containing CPMLDR into another predetermined address in memory and then jumps to that address Note that if your hardware is smart enough steps I and 2 can be combined into one step 3 The code loaded in step 2 which is now executing is the CP M Cold Boot Loader CPMLDR which is an abbreviated version of CP M 68K itself CPMLDR now finds the file CPM SYS loads it and jumps to it A copy of CPM SYS is now in memory executing This completes the bootstrapping process In order to create a CP M 68
24. user number The high order bytes should be zero The entry point to this function must be named init and must be declared global This function is called only once from the system at system initialization Following is an example of skeletal code globl _ init sbios init entry point init do any initialization here move 1 traphndl 8c set trap 3 handler clr 1 do login drive A user 0 rts 15 Function 1 Warm Boot CP M 68K System Guide FUNCTION 1 WARM BOOT Entry Parameters Register DO W 01H Returned Value None This function is called whenever a program terminates Some reinitialization of the hardware or software might occur When this function completes it jumps directly to the entry point of the CCP named ccp Note that ccp must be declared as a global Following is an example of skeletal code for this BIOS function globl ccp wboot do any reinitialization here if necessary jmp ccp 16 Function 2 Console Status CP M 68K System Guide FUNCTION 2 CONSOLE STATUS Entry Parameters Register DO W 02H Returned Value Register DO W OOFFH if ready Register DO W 0000H if not ready This function returns the status of the currently assigned console device It returns OOFFH in register DO when a character is ready to be read or 0000H in register DO when no console characters are ready 17 Function 3 Read Console Character CP M 68K System Guide FUNCTION 3 READ CONSOLE CHARACTER
25. whichever is more convenient 2 Your BIOS needs the address of the cop entry point in the S record system This can be obtained from the release notes and or the README file 3 Down load the S record system into the memory of your target computer 4 Down load your BIOS into the memory of your target computer 5 Begin executing instructions at the first location of the down loaded S record system Now that you have a working version of CP M 68K you can use the tools provided with the distribution system for further development End of Section 6 50 Section 7 Cold Boot Automatic Command Execution 7 1 Overview The Cold Boot Automatic Command Execution feature of CP M 68K allows you to configure CP M 68K so that the CCP will automatically execute a predetermined command line on cold boot This feature can be used to start up turn key systems or to perform other desired operations 7 2 Setting up Cold Boot Automatic Command Execution The CBACE feature uses two global symbols autost and usercmd These are both defined in the CCP which uses them on cold boot to determine whether this feature is enabled If you want to have a CCP command automatically executed on cold boot you should include code in your BIOS s _init routine which is called at cold boot to do the following 1 The byte at autost must be set to the value 01H 2 The command line to be executed must be placed in memory at usercmd and subsequent locations
26. 0 line feed 19 list device 20 LIST device 33 Loader BIOS writing 10 loader system library 10 logical sector numbering 41 longword 32 bit value 40 longword value 1 15 LRU buffers 48 M MACSbug 49 mapping logical to physical 41 maximum track number 65535 25 memory location absolute 7 Memory Region Table 32 mopping logical to physical 6 Motorola MC68000 1 N nibble I O OFF parameter 43 53 offset I output device auxiliary 21 P parsing command lines 4 physical sector 46 PIP 35 PUTBOOT utility 10 il 53 R Read 11 read write head 45 README file 50 register contents destroyed by BIOS 13 RELOC utility 7 relocatable 2 reserved tracks number of 43 return code value 28 rotational latency 41 45 47 RTE 10 rts instruction 15 S S record files 49 S record systems 50 S records bringing up CP M 68K 50 longword location 50 scratchpad area 40 scratchpad words 40 sector 5 sector numbers unskewed 26 sector skewing 53 sector translate table 41 sectors 128 byte 5 45 Sectran 11 Seldsk 10 Set exception 11 Setdma 11 123 Setsec 11 Settrk 11 SETTRK function 23 SIZE68 command 7 8 SPT 42 SPT parameter 53 STAT 35 system disk 6 system generation 6 T text segment 2 TPA I track 6 track 00 position 23 transient program 2 translate table 31 Trap 3 handler 10 TRAP 3 instruction 13 Trap 3 vector 15 trap initializa
27. 0 3 defining the assigned source or destination of each logical device The values which can be assigned to each field are given in Table 4 4 Table 4 4 I O Byte Field Definitions CONSOLE field bits 1 0 Bit Definition console is assigned to the console printer TTY console is assigned to the CRT device CRT batch mode use the AUXILIARY INPUT as the CONSOLE input and the LIST device as the CONSOLE output BAT 3 user defined console device UC1 NRF AUXILIARY INPUT field bits 3 2 Bit Definition AUXILIARY INPUT is the Teletype device TTY AUXILIARY INPUT is the high speed reader device PTR user defined reader 1 URI user defined reader 2 UR2 WN 34 Function 19 Get I O Byte CP M 68K System Guide Table 4 4 continued AUXILIARY OUTPUT field bits 5 4 Bit Definition AUXILIARY OUTPUT is the Teletype device TTY AUXILIARY OUTPUT is the high speed punch device PTP user defined punch 1 UP1 user defined punch 2 UP2 UD O LIST field bits 7 6 Bit Definition LIST is the Teletype device TTY LIST is the CRT device CRT LIST is the line printer device LPT user defined list device UL1 Ww Ne Note that the implementation of the I O byte is optional and affects only the organization of your BIOS No CP M 68K utilities use the I O byte except for PIP which allows access to the physical devices and STAT which allows logical physical assignments to be made and d
28. 0 ABS count 0000408E BSS dseldsk 0000000E ABS dsetdma 0000001A ABS dsk 0000408A BSS erstr 00000000 DATA erx 000001D2 TEXT erxit 000001CC TEXT exit 000001C2 TEXT fcb 00004080 BSS flush 00000015 ABS hflag 00004094 BSS isetdma 0000000C ABS nohyph 00000056 TEXT off 0000408C BSS oflex 000001F2 TEXT open 0000000F ABS openok 000000A8 TEXT opnfl 00000034 DATA prntstr 00000009 ABS readseq 00000014 ABS rloop 000000BE TEXT scan 0000001C TEXT scanl 00000024 TEXT scan2 0000005C TEXT sect 00004086 BSS sectran 00000010 ABS seldsk 00000009 ABS selerx 000001DA TEXT selstr 00000017 DATA setsec 0000000B ABS settrk 0000000A ABS sok 0000017A TEXT spt 00004084 BSS start 00000000 TEXT trk 00004088 BSS trkofl 00000060 DATA upper 0000006C TEXT wloop 00000146 TEXT write 0000000E ABS wrtl 00000140 TEXT wrterx 000001E2 TEXT wrtout 000000FO TEXT wrtstr 00000026 DATA End of Appendix E 107 Appendix F Motorola S Records F 1 S record Format The Motorola S record format is a method of representing binary memory images in an ASCII form The primary use of S records 15 to provide a convenient form for transporting programs between computers Since most computers have means of reading and writing ASCII information the format is widely applicable The SENDC68 utility provided with CP M 68K may be used to convert programs into S record form An S record file consists of a sequence of S records of various types The entire content of an S record is ASCII When a hexa
29. 000000B0 423900000000 clrb seldrv Listing C 1 continued 68 select drive Appendix C Sample Loader BIOS 95 000000B6 423900000004 96 000000BC 203C0000000C CP M 68K System Guide clr b selcode select code is 00 for drv 0 10 for drv 1 move l dph0 d0 rts rts 97 000000C2 4E75 selrtn 98 99 000000C4 13C100000002 settrk move b d1 track 100 000000CA 4E75 101 102 000000CC 13C100000004 setsec move b dl sector 103 000000D2 4E75 104 105 sectran 106 N 107 N 108 000000D4 2042 109 000000D6 48C1 110 000000D8 10301000 111 000000DC 48C0 112 000000DE 4E75 113 114 setdma 115 000000E0 23C100000006 116 000000E6 4E75 117 118 119 120 read 122 123 000000FO 6134 124 000000F2 00430088 125 000000F6 13C300FFFFF8 rretry 126 000000FC 0839000700FFFFFC rloop btst 127 00000104 6708 128 00000106 10F900FFFFFB 129 0000010C 60EE 130 131 0000010E 61000106 132 00000112 6604 133 00000114 4280 134 00000116 4E75 135 00000118 6170 rerror 136 0000011A 53390000000B 137 00000120 66CE 138 00000122 70FF 139 00000124 4E75 140 141 142 143 144 rdone setup 146 0000012E 163900000001 Listing C 1 continued rts translate sector in d1 with translate table pointed to by d2 result in dO movea 1 d2 a0 ext l dl move b 0 a0 d1 d0 extl dO rts move l dl dma rts Read one sector from requested disk track sector to dma address Retry if necessary return in dO 00 if
30. 00000A8 32 00000034 000000B0 33 00000038 000000C4 34 0000003C 000000CC 35 00000040 000000E0 36 00000044 000000E8 37 00000048 0000000E 38 0000004C 0000000E 39 00000050 000000D4 40 00000054 000000E0 41 00000058 0000000E 42 0000005C 0000000E Appendix C Revision 02 01 Page 1 LLELLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLDLLLDLLLLLILLI k k k a rol CP M 68K Loader BIOS Basic Input Output Subsystem XX X X X For ERG 68000 with Tarbell floppy disk controller XX X X X LLELLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLDLLLDLLLLLILLI ELE ILE rol globl _ bios declare external entry point _bios cmpi nfuncs dO bge nogood ls 2 d0 multiply bios function by 4 get handler address jsr a0 call handler movea 1 6 pc d0 a0 nogood rts biosbase dc 1 nogood dc 1 nogood dc 1 constat dc 1 conin dc 1 conout dc 1 nogood dc 1 nogood dc 1 nogood dc 1 home dc 1 seldsk dc 1 settrk dc 1 setsec dc 1 setdma dc 1 read dc 1 nogood dc 1 nogood dc 1 sectran dc 1 setdma dc 1 nogood dc 1 nogood Listing C 1 Sample BIOS Loader 67 Appendix C Sample Loader BIOS 43 00000060 0000000E dc 1 nogood 44 00000064 0000000E dc 1 nogood 45 00000068 00000222 de l setexc 46 47 nfuncs biosbase 4 48 49 50 0000006C 103900FFFFO1 constat move b ffff01 d0 51 00000072 02400002 andi w 2 d0 52 00000076 6704 beq noton 53 00000078 7001 moveq 1 1 d0 54 0000007A 4E75 rts 55 56 0000
31. 000010A 33D000004084 tstl dO beq selerx move l d0 a0 move 1 14 a0 a0 move w a0 spt 107 00000110 33E8000E0000408C move w 14 20 off 108 00000118 427900004088 clr w trk 109 000001 1E 33FC000100004086 move w 1 sect 110 00000126 41F900000000 111 0000012C 4A3900004094 112 00000132 660C 113 00000134 0C50601A 114 00000138 6606 115 0000013A D1FC0000001C 116 00000140 23C800004090 117 118 00000146 4A790000408E 119 0000014C 6774 120 0000014E 323900004086 121 00000154 B27900004084 122 0000015A 6F1E lea bufa0 tstb hflag bne wrtl cmpi w 601a a0 bne wrtl add 1 28 a0 wrtl move l a0 bufp wloop tst w count beq exit move w sect dl cmp w spt dl ble sok 123 0000015C 33FC000100004086 move w 1 sect 124 00000164 303900004088 125 0000016A 5240 126 0000016C 33C000004088 127 00000172 B0790000408C 128 00000178 6C78 129 0000017A 303C000A sok 130 0000017E 323900004088 131 00000184 4E43 132 00000186 323900004086 133 0000018C 303C000B 134 00000190 4E43 135 00000192 303C000C 136 00000196 223900004090 137 0000019C 4E43 138 0000019E 303C000E 139 000001A2 4241 140 000001A4 4E43 141 000001A6 4440 142 000001A8 6638 143 000001 AA 527900004086 144 000001B0 53790000408E move w trk dO add w 1 d0 move w dO trk cmp w off d0 bge oflex move w settrk dO move w trk dl trap 3 move w sect dl move w setsec d0 trap 3 move w fisetdma dO move 1 bufp dl trap 3 move w fwrite dO clr w d
32. 0000C8 TEXT iobase OOFFFFF8 ABS listst 000000C2 TEXT Istout O00000BC TEXT maxdsk 00000002 ABS memrgn 0000000C DATA newdrive 000001CC TEXT newtrk 000001E0 TEXT nfuncs 00000017 ABS noset 000002B6 TEXT noton 00000090 TEXT oldtrk 00000003 DATA pun 000000BE TEXT rdone 00000144 TEXT rdr 000000C0 TEXT read 0000011C TEXT readid 00000266 TEXT rerror 0000014E TEXT restore 0000020C TEXT rid2 0000027A TEXT rloop 00000132 TEXT rretry 00000124 TEXT rstatus 0000028C TEXT rstwait 00000214 TEXT sector 00000004 DATA sectran 00000108 TEXT selcode 0000000A DATA seldry 00000000 DATA seldsk O00000D0 TEXT selrtn 000000F6 TEXT setdma 00000114 TEXT setexc 000002A8 TEXT setiob 000002A6 TEXT setsec 00000100 TEXT settrk 000000F8 TEXT setup 0000019C TEXT sexit O00001E4 TEXT track 00000002 DATA traphndl 0000000E TEXT trapng 0000001C TEXT wboot 0000007A TEXT wdone 00000184 TEXT werror 0000018E TEXT wloop 00000172 TEXT wretry 00000166 TEXT write 0000015E TEXT xlt 0000005A DATA Listing B 1 continued End of Appendix B 66 Sample Loader BIOS Written in Assembly Language CP M 68000 Assembler Source File eldbios s AUD tn LA LA O 10 11 12 13 14 00000000 0C400017 15 00000004 6C08 16 00000006 E548 17 00000008 207B0006 18 0000000C 4E90 19 20 0000000E 4E75 21 22 23 00000010 0000000E 24 00000014 0000000E 25 00000018 0000006C 26 0000001C 00000080 27 00000020 00000094 28 00000024 0000000E 29 00000028 0000000E 30 0000002C 0000000E 31 00000030 0
33. 007C 4280 noton clr dO 57 0000007E 4E75 rts 58 59 00000080 61EA conin bsr constat 60 00000082 4A40 tst do 61 00000084 67FA beq conin 62 00000086 103900FFFF00 move b ffff00 d0 63 0000008C COBC0000007F and 7 d0 64 00000092 4E75 rts 65 66 00000094 103900FFFF01conout move b ffff01 d0 CP M 68K System Guide get status byte data available bit on branch if not set result to true set result to false see if key pressed wait until key pressed get key clear all but low 7 bits get status 67 0000009A C03C0001 and b 1 d0 check for transmitter buffer empty 68 0000009E 67F4 beq conout wait until our port has aged 69 000000A0 13C100FFFFO0 move b dl ffff00 and output it 70 000000A6 4E75 rts and exit 71 72 73 74 Disk Handlers for Tarbell 1793 floppy disk controller 75 76 maxdsk 2 this BIOS supports 2 floppy drives 77 dphlen 26 length of disk parameter header 78 79 iobase OOfffffs Tarbell floppy disk port base address 80 demd iobase output port for command 81 dstat iobase input status port 82 dtrk iobase 1 disk track port 83 dsect 10base 2 disk sector port 84 ddata iobase 3 disk data port 85 dwait iobase 4 input port to wait for op finished 86 dcntrl iobase 4 output control port for drive selection 87 88 89 000000A8 423900000002 home clr b track 90 000000AE 4E75 rts 91 92 seldsk 93 select disk A 94
34. 1 8796a5b4 dc 1 c3d2e1f0 dc 1 0fle2d3c dc 1 4b5a6978 dc 1 8796a5b4 dc 1 c3d2e1f0 dc 1 4f8f0f07 dc 1 0b0d0e06 dc 1 0a0c0408 dc 1 04020100 dc 1 00 00 00 00 dc 1 0 dc 1 0 dew 0 dc 1 0 dew 0 del 0 0 0 0 0 0 0 de 0 0 0 0 0 0 de 0 0 0 0 0 0 0 de 0 0 0 0 0 0 dcb EXORMACS end of volume id begin boot info proper dsb 300 even move 2700 sr move l 8 a0 253 d0 move l expdef a0 dbf d0 exlp jmp grunt rte move 2000 sr end 102 CP M 68K System Guide diagnostic test pattern diagnostic test pattern diagnostic test pattern diagnostic test area directory start of dump area length of dump area start of sector lockout table length of sector lockout table unused reserved let s hear it for Motorola skip over exception vectors Appendix E Putboot Utilility Assembly Language Source LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLDLLLLLLLLLLILLILI 2 x x 3 Program to Write Boot Tracks for CP M 68K tm 4 5 Copyright Digital Research 1982 6 x 7 Ace fe sk oie ole ole ale le oe c oe ole ole ole ale ae oe cie ole ole ole ole ale oe oe oe ole ole ole oe ale oe c oe ole ole ole oe oe fe ce ole k k k ale ae k k k k k k 8 x 9 x 10 11 prntstr 9 BDOS Functions 12 dseldsk 14 13 open 15 14 readseq 20 15 dsetdma 26 16 17 seldsk 9 BIOS Functions 18 settrk 10 19 setsec 11 20 isetdma 12 21 wr
35. 270 0000004A 1218040A dc b 18 24 4 10 271 0000004E 1016 dc b 16 22 272 273 274 00000000 bss 275 276 00000000 dirbuf dsb 128 directory buffer 277 278 279 00000080 end Symbol Table bios 00000000 TEXT biosbase 00000010 TEXT chkdone 000001EE TEXT chksl 000001B4 TEXT chks2 000001DE TEXT chkseek 00000192 TEXT conin 00000080 TEXT conout 00000094 TEXT constat 0000006C TEXT curdrv 00000001 DATA demd OOFFFFF8 ABS dcntrl OOFFFFFC ABS ddata OOFFFFFB ABS dirbuf 00000000 BSS dma 00000006 DATA dpb 00000026 DATA dpho 0000000C DATA dphlen 0000001A ABS dsect OOFFFFFA ABS dstat OOFFFFF8 ABS dtrk OOFFFFF9 ABS dwait OOFFFFFC ABS errchk 0000018A TEXT errent 0000000B DATA home 000000A8 TEXT iobase OOFFFFF8 ABS maxdsk 00000002 ABS newdrive 00000156 TEXT newtrk 0000016A TEXT nfuncs 00000017 ABS nogood 0000000E TEXT noton 0000007C TEXT oldtrk 00000003 DATA rdone 0000010E TEXT read 000000E8 TEXT readid 000001F0 TEXT rerror 00000118 TEXT restore 00000196 TEXT rid2 00000204 TEXT rloop 000000FC TEXT rretry 000000FO TEXT rstatus 00000216 TEXT rstwait 0000019E TEXT sector 00000004 DATA sectran 000000D4 TEXT selcode 00000004 DATA seldrv 00000000 DATA seldsk 000000BO TEXT selrtn 000000C2 TEXT setdma 000000E0 TEXT setexc 00000222 TEXT setsec 000000CC TEXT settrk 000000C4 TEXT setup 00000126 TEXT sexit 0000016E TEXT track 00000002 DATA xlt 00000036 DATA Listing C 1 continued End of Appendix C 72 Appendix D EXORmacs BIOS Written in C T
36. 39000700FFFFFC chks2 btst 7 dwait 193 00000 1E6 66F6 bne chks2 loop until seek complete 194 000001E8 163900FFFFF8 move b dstat d3 read status to clear FDC 195 chkdone 196 000001EE 4E75 rts 197 198 readid Listing C 1 continued 70 Appendix C Sample Loader BIOS CP M 68K System Guide 199 N read track id return track number in d3 200 000001FO 13FCOOC400FFFFF8 move b c4 dcmd issue read id command 201 000001F8 1E3900FFFFFC 202 00000 1FE 163900FFFFFB 203 rid2 move b dwait d7 move b ddata d3 204 00000204 0839000700FFFFFC btst 7 dwait 205 0000020C 6708 206 0000020E 1E3900FFFFFB beq rstatus move b ddata d7 wait for intrq track byte to d3 wait for intrq read another byte 207 00000214 60EE bra rid2 and loop 208 rstatus 209 00000216 1E3900FFFFF8 move b dstat d7 210 000002 1C 0207009D andi b 9d d7 set condition codes 211 00000220 4E75 rts 212 213 214 setexc 215 00000222 0281000000FF andil ff d1 do only for exceptions 0 255 216 00000228 E549 ls 2 d1 multiply exception number by 4 217 0000022A 2041 movea l d1 a0 218 0000022C 2010 move 1 a0 d0 return old vector value 219 0000022E 2082 move 1 d2 a0 insert new vector 220 00000230 4E75 rts 221 222 223 00000000 data 224 225 00000000 FF seldrv dc b ff drive requested by seldsk 226 00000001 FF curdrv dc b ff currently selected drive 227 228 00000002 00 track dcb 0 track requested by se
37. 3F90000000400FFFFFA move b sector dsect set up sector number 163 00000178 13F90000000200FFFFF9 move b track dtrk set up track number 164 00000182 207900000006 move 1 dma a0 dma address to a0 165 00000188 4E75 rts 166 167 errchk 168 0000018A 08070004 btstb 4 d7 169 0000018E 6602 bne chkseek if record not found error reseek 170 00000190 4E75 rts 171 172 chkseek 173 check for correct track seek if necessary 174 00000192 615C bsr readid find out what track we re on 175 00000194 671E beq chksl if read id ok skip restore code 176 restore 177 home the drive and reseek to correct track 178 00000196 13FCOOOBOOFFFFF8 move b 0B dcmd restore command to command port 179 rstwait 180 0000019E 0839000700FFFFFC btst 7 dwait 181 000001A6 66F6 bne rstwait loop until restore completed 182 000001A8 0839000200FFFFF8 btst 2 dstat 183 000001B0 67E4 beq restore 1f not at track 0 try again 184 000001B2 4283 clr1 d3 track number returned in d3 from readid 185 chks1 186 000001B4 13C300FFFFF9 move b d3 dtrk update track register in FDC 187 000001BA 13F90000000200000003 move b track oldtrk update oldtrk 188 000001C4 B63900000002 emp b track d3 are we at right track 189 000001CA 6722 beq chkdone if yes exit 190 000001CC 13F90000000200FFFFFB move b track ddata else put desired track in data reg of FDC 191 000001D6 13FCOO1800FFFFF8 move b 4 18 dcmd and issue a seek command 192 000001DE 08
38. 5 Return List Status CP M 68K System Guide FUNCTION 15 RETURN LIST STATUS Entry Parameters Register DO W OFH Returned Value Register DO 00FFH device ready Register DO 0000H device not ready This function returns the status of the list device Register DO contains either 0000H when the list device is not ready to accept a character or OOFFH when a character can be sent to the list device 30 Function 16 Sector Translate FUNCTION 16 Entry Parameters Register DO W Register D1 W Register D2 L Returned Value Register DO W CP M 68K System Guide SECTOR TRANSLATE 10H Logical Sector Number Address of Translate Table Physical Sector Number This function performs logical to physical sector translation as discussed in Section 5 2 2 The Sector Translate function receives a logical sector number from register DI W The logical sector number can range from 0 to the number of sectors per track 1 Sector Translate also receives the address of the translate table in register D2 L The logical sector number is used as an index into the translate table The resulting physical sector number is returned in DO W If register D2 L 00000000H implying that there is no translate table register D1 is copied to register DO before returning Note that other algorithms are possible in particular is is common to increment the logical sector number in order to convert the logical range of 0 to n 1 into the physical r
39. 68K System Guide When you perform the relocation verify that the resulting system does not overlap the TPA as defined in the BIOS The boundaries of the system are determined by taking the relocation address of CPM SYS as the base and adding the size of the system use SIZE68 on CPM SYS to get the upper bound This address range must not overlap the TPA that the BIOS defines in the Memory Region Table 2 3 Relocating Utilities Once you have built CPM SYS it is advisable to relocate the operating system utilities for your TPA using the RELOC utility RELOC is described in the CP M 68K Operating System Programmer s Guide This results in the utilities being absolute rather than relocatable but they will occupy half the disk space and load into memory twice as fast in their new form You should also keep the relocatable versions backed up in case you ever need to use them in a different TPA End of Section 2 Section 3 Bootstrap Procedures 3 1 Bootstrapping Overview Bootstrap loading is the process of bringing the CP M 68K operating system into memory and passing control to it Bootstrap loading is necessarily hardware dependent and it is not possible to discuss all possible variations in this manual However the manual presents a model of bootstrapping that 15 applicable to most systems The model of bootstrapping which we present assumes that the CP M 68K operating system is to be loaded into memory from a disk in which the first few
40. 7 return portin PORT2 READER break case 8 settrk 0 HOME break case 9 return slctdsk char d1 char d2 SELDSK break case 10 settrk int dl SETTRK break case 11 setsec int d1 1 SETSEC break case 12 setdma dl SETDMA break 96 Apendix D EXORmacs BIOS CP M 68K System Guide if LOADER endif if LOADER endif if LOADER endif case 13 return read READ break case 14 return write char d1 WRITE break case 15 if BYTE PORT2 PORTSTAT amp PORTTDRE return OxOff else return 0x000 break case 16 return sectran int d1 d2 SECTRAN break case 18 return amp memtab GMRTA break case 19 return iobyte GETIOB break case 20 iobyte int d1 SETIOB break case 21 if flush return OL FLUSH else return OxffffL break case 22 return setxvect int d1 d2 SETXVECT break J eee ee ee This function is not part of a standard BIOS It is included only for convenience and will not be supported in any way nor will it necessarily be included in future versions of f CP M 68K J eee ee ee case 63 return format int d1 Disk Formatter break default return OL break 3 end switch y END OF BIOS End of C Bios
41. BIOS and specialized application programs might know this memory exists but it is not part of the TPA Top of Memory CCP amp BDOS BIOS CP M 68K User Stack Free Memory bss TPA J Data user pgm Text 00500H Base Page 00400H Interrupt Vectors 00000H Figure 1 2 Typical CP M 68K Memory Layout 1 4 Console Command Processor CCP The Console Command Processor CCP provides the user interface to CP M 68K It uses the BDOS to read user commands and load programs and provides several built in user commands It also provides parsing of command lines entered at the console 1 5 Basic Disk Operating System CP M 68K System Guide 1 5 Basic Disk Operating System BDOS The Basic Disk Operating System BDOS provides operating system services to applications programs and to the CCP These include character I O disk file I O the BDOS disk T O operations comprise the CP M 68K file system program loading and others 1 6 Basic I O System BIOS The Basic Input Output System BIOS is the interface between CP M 68K and its hardware environment All physical input and output is done by the BIOS It includes all physical device drivers tables defining disk characteristics and other hardware specific functions and tables The CCP and BOOS do not change for different hardware environments because all hardware dependencies have been concentrated in the BIO
42. BYTE BYTE BYTE stxchr pktid pktsize 79 Apendix D EXORmacs BIOS CP M 68K System Guide BYTE dskno BYTE chcmd BYTE devcmd WORD numblks WORD blksize LONG iobf WORD cksum LONG sect BYTE etxchr BYTE rwpad 5 struct rwpkst rwpack 1 2 0 21 0 16 1 13 256 OL 0 0L 3 0 struct rwpkst rwpack 512 5376 4097 13 256 0 0 0 0 0 768 Y if LOADER format disk packet struct fmtpkst 1 BYTE fmtstx BYTE fmtid BYTE fmtsize BYTE fmtdskno BYTE fmtchcmd BYTE fmtdvcmd BYTE fmtetx BYTE fmtpad 5 struct fmtpkst fmtpack 1 512 1792 0x4002 0x0300 struct fmtpkst fmtpack 2 0 7 0 64 2 3 0 X Zendif fee ee ee ee ae Define the number of disks supported and other disk stuff fee ee ee ee ae if I CTLTYPE define NUMDSKS 4 number of disks defined else define NUMDSKS 2 endif if MEMDSK define NUMDSKS 5 endif define MAXDSK NUMDSKS 1 maximum disk number if CTLTYPE BYTE cnvdsk NUMDSKS 4 5 0 1 3 convert CP M dsk to EXORmacs BYTE renvdsk 6 2 3 0 0 0 1 and vice versa Helse BYTE cnvdsk NUMDSKS 0 1 80 Apendix D EXORmacs BIOS CP M 68K System Guide BYTE renvdsk 2 0 1 endif defines for IPC and disk states define IDLE 0 define ACTIVE 1 WORD ipcstate current IPC state WORD actvdsk disk number of currently active disk if any L
43. CP M 68K TM Operating System System Guide Copyright C 1983 Digital Research P O Box 579 167 Central Avenue Pacific Grove CA 93950 408 649 3896 TWX 910 360 5001 All Rights Reserved COPYRIGHT Copyright D 1983 by Digital Research All rights reserved No part of this publication may be reproduced transmitted transcribed stored in a retrieval system or translated into any language or computer language in any form or by any means electronic mechanical magnetic optical chemical manual or otherwise without the prior written permission of Digital Research Post Office Box 579 Pacific Grove California 93950 DISCLAIMER Digital Research makes no representations or warranties with respect to the contents hereof and specifically disclaims any implied warranties of merchantability or fitness for any particular purpose Further Digital Research reserves the right to revise this publication and to make changes from time to time in the content hereof without obligation of Digital Research to notify any person of such revision or changes TRADEMARKS CP M and CP M 86 are registered trademarks of Digital Research CP M 80 CP M 68K DDT and MP M are trademarks of Digital Research Motorola MC68000 is a registered trademark of Motorola Incorporated EXORmacs EXORterm and MACSbug are trademarks of Motorola Inc VAX VMS is a trademark of Digital Equipment Corporation UNIX is a trademark of Bell Laboratories TI Silent 700 T
44. DRM should be chosen large enough so that you do not run out of directory entries before running out of disk space It is not possible to give an exact rule for determining DRM since the number of directory entries needed will depend on the number and sizes of the files present on the disk The CKS entry in the DPB is the number of bytes in the CSV checksum vector which was pointed to by the DPH If the disk is not removable a checksum vector is not needed and this value may be zero 5 3 Disk Blocking When the BDOS does a disk read or write operation using the BIOS the unit of information read or written is a 128 byte sector This may or may not correspond to the actual physical sector size of the disk If not the BIOS must implement a method of representing the 128 byte sectors used by CP M 68K on the actual device Usually if the physical sectors are not 128 bytes long they will be some multiple of 128 bytes Thus one physical sector can hold some integer number of 128 byte CP M sectors In this case any disk I O will actually consist of transferring several CP M sectors at once It might also be desirable to do disk I O in units of several 128 byte sectors in order to increase disk throughput by decreasing rotational latency Rotational latency is the average time it takes for the desired position on a disk to rotate around to the read write head Generally this averages 1 2 disk revolution per transfer Since a great deal of disk I O
45. EXORmacs BIOS CP M 68K System Guide for i STPKTSZ 1 1 1 p q p T 1 q gt fee ee ee eee eee ae a fe e hK k pe Handle Unsolicited Status from IPC fee ee ee eee eee ee k k unsolst stpktp REG BYTE stpktp i REG WORD dev REG WORD ready REG struct dskst dsp dev renvdsk stpktp PKTDEV gt byte ready stpktp PKTSTPRM gt byte amp 0x80 0x0 dsp amp dskstate dev if ready amp amp dsp gt ready Iready amp amp dsp gt ready dsp gt change 1 dsp gt ready ready if LOADER if ready setinvld dev Disk is not ready mark buffers endif if LOADER fee ee ee eee 7 pe Mark all buffers for a disk as not valid fee ee ee eee eee ee k k setinvld dsk REG WORD dsk H REG struct tbstr tbp tbp firstbuf while tbp if tbp gt dsk dsk tbp gt valid 0 tbp tbp gt nextbuf Zendif 84 Apendix D EXORmacs BIOS CP M 68K System Guide fee eee ee ae ee pe Wait for an ACK from the IPC fee eee ee ae ee waitack H REG WORD imsave REG BYTE work while 1 while intcount wait imsave setimask 7 intcount 1 work DSKIPC ACKFMIPC gt byte if work ACK work NAK H DSKIPC ACKFMIPC gt byte 0 setimask imsave return work ACK T setimask imsave T T fee eee ee ae ee ee Acknowledge a message from the IPC fee eee ee ae ee
46. Fields Field Definition SPT Number of 128 byte logical sectors per track BSH The block shift factor determined by the data block allocation size as shown in Table 5 3 42 5 2 Disk Definition Tables CP M 68K System Guide Field BLM EXM DSM DRM CKS OFF Table 5 2 continued Definition The block mask which is determined by the data block allocation size as shown in Table 5 3 The extent mask determined by the data block allocation size and the number of disk blocks as shown in Table 5 4 Reserved byte Determines the total storage capacity of the disk drive and is the number of the last block counting from 0 That is the disk contains DSM 1 blocks Determines the total number of directory entries which can be stored on this drive DRM is the number of the last directory entry counting from 0 That is the disk contains DRM L directory entries Each directory entry requires 32 bytes and for maximum efficiency the value of DRM should be chosen so that the directory entries exactly fill an integral number of allocation units The size of the directory check vector which is zero if the disk is permanently mounted or length CSV DRM 4 I for removable media The number of reserved tracks at the beginning of a logical disk This is the number of the track on which the directory begins To choose appropriate values for the Disk Parameter Block elements you must understand how disk space is
47. IRBUF DPB Table 5 1 Disk Parameter Header Elements Description Address of the logical to physical sector translation table if used for this particular drive or the value 0 if there is no translation table for this drive 1 e the physical and logical sector numbers are the same Disk drives with identical sector translation may share the same translate table The sector translation table is described in Section 5 2 2 Three scratchpad words for use within the BDOS Address of a 128 byte scratchpad area for directory operations within BDOS All DPHs address the same scratchpad area Address of a disk parameter block for this drive Drives with identical disk characteristics may address the same disk parameter block 40 5 2 Disk Definition Tables CP M 68K System Guide Table 5 1 continued Element Description CSV Address of a checksum vector The BDOS uses this area to maintain a vector of directory checksums for the disk These checksums are used in detecting when the disk in a drive has been changed If the disk is not removable then it is not necessary to have a checksum vector Each DPH must point to a unique checksum vector The checksum vector should contain 1 byte for every four directory entries or 128 bytes of directory In other words length CSV DRM 4 DRM is discussed in Section 5 2 3 ALV Address of a scratchpad area used by the BDOS to keep disk storage allocation information The area must be diff
48. It is possible to use the same source code for both your normal BIOS and your loader BIOS if you use conditional compilation or assembly to distinguish the two We have done this in our example BIOS for the EXORmacs 3 2 2 Building CPMLDR SYS Once you have written and compiled or assembled a loader BIOS you can build CPMLDR SYS in a manner very similar to building CPM SYS There is one additional complication here the result of this step is placed on the system tracks So if you need a small prebooter to bring in the bulk of CPMLDR the prebooter must also be included in the link you are about to do The details of what must be done are hardware dependent but the following example should help to clarify the concepts involved Suppose that your hardware reads track 0 sector 1 into memory at location 400H when reset is pressed then jump to 400H Then your boot disk must have a small program in that sector that can load the rest of the system tracks into memory and execute the code that they contain Suppose that you have written such a program assembled it and the assembler output is in BOOT O Also assume that your loader BIOS object code is in the file LDRBIOS O Then the following command links together the code that must go on the system tracks A gt 1068 s T400 uldr o cpmldr sys boot o Idrlib Idrbios o Once you have created CPMLDR SYS in this way you can use the PUTBOOT utility to place it on the system tracks PUTBOOT is describe
49. K diskette that can be booted you need to know how to create CPM SYS see Section 2 2 how to create the Cold Boot Loader CPMLDR and how to put CPMLDR onto your system tracks You must also understand your hardware enough to be able to design a method for bringing CPMLDR into memory and executing it 3 2 Creating the Cold Boot Loader CP M 68K System Guide 3 2 Creating the Cold Boot Loader CPMLDR is a miniature version of CP M 68K It contains stripped versions of the BOOS and BIOS with only those functions which are needed to open the CPM SYS file and read it into memory CPMLDR will exist in at least two forms one form is the information in the system tracks the other is a file named CPMLDR SYS which is created by the linker The term CPMLDR is used to refer to either of these forms but CPMLDR SYS only refers to the file CPMLDR SYS is generated using a procedure similar to that used in generating CPM SYS That is a loader BIOS is linked with a loader system library named LDRLIB to produce CPMLDR SYS Additional modules may be linked in as required by your hardware The resulting file is then loaded onto the system tracks using a utility program named PUTBOOT 3 2 1 Writing a Loader BIOS The loader BIOS is very similar to your ordinary BIOS it just has fewer functions and the entry convention is slightly different The differences are itemized below 1 Only one disk needs to be supported The loader system selects only drive A I
50. ONG intcount count of interrupts needing to be processed struct dskst WORD state from defines above BYTE ready 0 gt not ready BYTE change 0 gt no change T dskstate NUMDSKS fee ee ee ee ae ee ae fe a a a ekk pe Generic Serial Port I O Procedures fee ee ee ee ae ee hhh 2 a ae fe 2 ak ae fee ee ee ee ae ee ae fe a a a ekk Port initialization fee ee ee ee ae ee hhh 2 a ae fe 2 ak ae portinit port REG BYTE port i port PORTCTRL PORTRSET reset the port port PORTCTRL PORTINIT rk soe sk seo ee ee ee ae ee hhh 2 a ae fe 2 ak ae Generic serial port status input status fee ee ee ee ae ee hhh 2 a ae fe 2 ak ae portstat port REG BYTE port i if port PORTSTAT amp PORTRDRF return Oxff input ready else return 0x00 not ready rk soe sk seo ee ee ee ae ee hhh 2 a ae fe 2 ak ae Generic serial port input fee ee ee ee ae ee hhh 2 a ae fe 2 ak ae 81 Apendix D EXORmacs BIOS CP M 68K System Guide BYTE portin port REG BYTE port while portstat port wait for input return port PORTRDR got some return it fee eee ee ae ee Generic serial port output fee eee ee ae ee portout port ch REG BYTE port REG BYTE ch while port PORTSTAT amp PORTTDRE wait for ok to send port PORTTDR ch then send character fee eee ee a
51. S Each hardware configuration needs its own BIOS Section 4 describes the BIOS functions in detail Section 5 discusses how to write a custom BIOS Sample BIOSes are presented in the appendixes 1 7 VO Devices CP M 68K recognizes two basic types of 1 O devices character devices and disk drives Character devices are serial devices that handle one character at a time Disk devices handle data in units of 128 bytes called sectors and provide a large number of sectors which can be accessed in random nonsequential order In fact real systems might have devices with characteristics different from these It is the BIOS s responsibility to resolve differences between the logical device models and the actual physical devices 1 7 1 Character Devices Character devices are input output devices which accept or supply streams of ASCII characters to the computer Typical character devices are consoles printers and modems In CP M 68K operations on character devices are done one character at a time A character input device sends ASCII CTRL Z IAH to indicate end of file 1 7 2 Character Devices Disk devices are used for file storage They are organized into sectors and tracks Each sector contains 128 bytes of data If sector sizes other than 128 bytes are used on the actual disk then the BIOS must do a logical to physical mapping to simulate 128 byte sectors to the rest of the system All disk I O in CP M 68K is done in one sector units A tr
52. The command must be terminated with a NULL OOH byte and may not exceed 128 bytes in length All alphabetic characters in the command line should be upper case Once you write a BIOS that performs these two functions you can build it into a CPM SYS file as described in Section 2 This system when booted will execute the command you have built into it End of Section 7 51 52 Section 8 The PUTBOOT Utility 8 1 PUTBOOT Operation The PUTBOOT utility is used to copy information usually a bootstrap loader system onto the system tracks of a disk Although PUTBOOT can copy any file to the system tracks usually the file being written is a program the bootstrap system 8 2 Invoking PUTBOOT Invoke PUTBOOT with a command of the form PUTBOOT H lt filename gt lt drive gt where o H is an optional flag discussed below o lt filename gt is the name of the tile to be written to the system tracks o drive is the drive specifier for the drive to which filename is to be written letter in the range A P PUTBOOT writes the specified file to the system tracks of the specified drive Sector skewing is not used the file is written to the system tracks in physical sector number order Because the file that is written is normally in command file format PUTBOOT contains special logic to strip off the first 28 bytes of the file whenever the file begins with the number 601 AH the magic number used in command files If by c
53. ack is a group of sectors The number of sectors on a track is a constant depending on the particular device The characteristics of a disk device are specified in the Disk Parameter Block for that device See Section 5 To locate a particular sector the disk track number and sector number must all be specified 1 8 System Generation CP M 68K System Guide 1 8 System Generation and Cold Start Operation Generating a CP M 68K system 15 done by linking together the CCP BDOS and BIOS to create a file called CPM SYS which is the operating system Section 2 discusses how to create CPM SYS CPM SYS is brought into memory by a bootstrap loader which will typically reside on the first two tracks of a system disk The term system disk as used here simply means a disk with the file CPM SYS and a bootstrap loader Creation of a bootstrap loader is discussed in Section 3 End of Section 1 Section 2 System Generation 2 1 Overview This section describes how to build a custom version of CP M 68K by combining your BIOS with the CCP and BDOS supplied by Digital Research to obtain a CP M 68K operating system suitable for your specific hardware system Section 5 describes how to create a BIOS In this section we assume that you have access to an already configured and executable CP M 68K system If you do not you should first read Section 6 which discusses how you can make your first CP M 68K system work A CP M 68K operating system is gener
54. acters and may be used to contain an address to which to pass control The data field 1s empty 8 This is similar to type 7 except that it ends a block of type 2 S records and its address field is 3 bytes 6 characters long 9 This is similar to type 7 except that it ends a block of type I S records and its address field is 2 bytes 4 characters long S records are produced by the SENDC68 utility program described in the CP M 68K Operating System Programmer s Guide End of Appendix F 110 Appendix G CP M 68K Error Messages This appendix lists the error messages returned by the internal components of CP M 68K BDOS BIOS and CCP and by the CP M 68K system utility PUTBOOT The BIOS error messages listed here are specific to the EXORmacs BIOS distributed by Digital Research BIOSes for other hardware might have different error messages which should be documented by the hardware vendor The error messages are listed in Table G 1 in alphabetic order with explanations and suggested user responses Table G 1 CP M 68K Error Messages Message Meaning bad relocation information bits CCP This message is a result of a BDOS Program Load Function 59 error It indicates that the file specified in the command line is not a valid executable command file or that the file has been corrupted Ensure that the file is a command file The CP M 68K Operating System Programmer s Guide describes the format of a command file If the file has
55. al devices within the BDOS Device characteristics are defined in Table 4 3 below Table 4 3 CP M 68K Logical Device Characteristics Device Name Characteristics CONSOLE The interactive console that you use to communicate with the system is accessed through functions 2 3 and 4 Typically the console is a CRT or other terminal device LIST The listing device is a hard copy device usually a printer AUXILIARY OUTPUT An optional serial output device AUXILIARY INPUT An optional serial input device Note that a single peripheral can be assigned as the LIST AUXILIARY INPUT and AUXILIARY OUTPUT device simultaneously if no peripheral device is assigned as the LIST AUXILIARY INPUT or AUXILIARY OUTPUT device your BIOS should give an appropriate error message so that the system does not hang if the device is accessed by PIP or some other transient program Alternatively the AUXILIARY OUTPUT and LIST functions can simply do nothing except return to the caller and the AUXILIARY INPUT function can return with a 1AH CTRL Z in register DO W to indicate immediate end of file 33 Function 19 Get I O Byte CP M 68K System Guide The I O byte is split into four 2 bit fields called CONSOLE AUXILIARY INPUT AUXILIARY OUTPUT and LIST as shown in Figure 4 2 most significant least significant AUXILIARY AUXILIARY T O Byte LIST OUTPUT INPUT CONSOLE bits 7 6 5 4 3 2 1 0 Figure 4 3 I O Byte The value in each field can be in the range
56. ample Assembly Language BIOS 246 00000284 1E3900FFFFFB move b ddata d7 247 0000028A 60EE bra rid2 248 rstatus 249 0000028C 1E3900FFFFF8 move b dstat d7 250 00000292 0207009D andi b 9d d7 251 00000296 4E75 rts 252 253 254 flush 255 00000298 4280 clr 1 dO 256 0000029A 4E75 rts 257 258 getseg 259 0000029C 203C0000000C move l Zmemrgn dO 260 000002A2 4E75 rts 261 262 getiob 263 000002A4 4E75 rts 264 265 setiob 266 000002A6 4E75 rts 267 268 setexc 269 000002A8 0281000000FF andil ff d1 270 000002AE E549 Isl 2 d1 271 000002B0 2041 movea 1 d1 a0 272 000002B2 2010 move 1 a0 d0 273 000002B4 2082 move 1 d2 a0 274 000002B6 4E75 noset rts 275 276 277 00000000 data 278 279 00000000 FF seldrv dc b ff 280 00000001 FF curdrv dc b ff 281 282 00000002 00 track dcb 0 283 00000003 00 oldtrk dcb 0 284 285 00000004 0000 sector dc w 0 286 00000006 00000000 dma dc 1 0 287 0000000A 00 selcode dc b 0 288 289 0000000B 0A errent dcb 10 290 291 0000000C 0001 memrgn dc w 1 292 0000000E 00000800 dc 1 800 293 00000012 00017800 dc 1 17800 294 295 296 disk parameter headers Listing B 1 64 CP M 68K System Guide read another byte and loop set condition codes return successful return address of mem region table do only for exceptions O 255 multiply exception nmbr by 4 return old vector value insert new vector drive reques
57. an error indicator Although the function must return the header address on each call it may be advisable to postpone the actual physical disk select operation until an 1 0 function seek read or write is performed Disk select operations can occur without a subsequent disk operation Thus doing a physical select each time this function is called may be wasteful of time On entry to the Select Disk Drive function if the least significant bit in register D2 is zero the disk is not currently logged in Ifthe disk drive is capable of handling varying media such as single and double sided disks single and double density and so on the BIOS should check the type of media currently installed and set up the Disk Parameter Block accordingly at this time 24 Function 10 Set Track Number CP M 68K System Guide FUNCTION 10 SET TRACK NUMBER Entry Parameters Register DO W OAH Register DI W Disk track number Returned Value None This function specifies in register DO W the disk track number for use in subsequent disk accesses The track number remains valid until either another Function 10 or a Function 8 Home is performed You can choose to physically seek to the selected track at this time or delay the physical seek until the next read or write actually occurs The track number can range from 0 to the maximum track number supported by the physical drive However the maximum track number is limited to 65535 by the fact that it i
58. ange of 1 to n Sector Translate is always called by the BIOS whether the translate table address in the Disk Parameter Header is zero or nonzero 31 Function 18 Get Address of MRT CP M 68K System Guide FUNCTION 18 GET ADDRESS OF MEMORY REGION TABLE Entry Parameters Register DO W 12H Returned Value Register DO L Memory Region Table Address This function returns the address of the Memory Region Table MRT in register DO For compatibility with other CP M systems CP M 68K maintains a Memory Region Table However it contains only one region the Transient Program Area TPA The f or mat of the MRT is shown below Count 16 bits Base address of first region 32 bits Length of first region 32 bits Figure 4 1 Memory Region Table Format The memory region table must begin on an even address and must be implemented 32 Function 19 Get I O Byte CP M 68K System Guide FUNCTION 19 GET I O BYTE Entry Parameters Register DO W 13H Returned Value Register DO W VO Byte Current Value This function returns the current value of the Logical to physical input output device byte I O byte in register DO W This 8 bit value associates physical devices with CP M 68K s four logical devices as noted below Note that even though this is a byte value we are using word references The upper byte should be zero Peripheral devices other than disks are seen by CP M 68K as logical devices and are assigned to physic
59. ated by using the linker L068 to link together the system modules CCP BDOS and BIOS Then the RELOC utility is used to bind the system to an absolute memory location The resulting file is the configured operating system Itis named CPM SYS 2 2 Creating CPM SYS The CCP and BDOS for CP M 68K are distributed in a library file named CPMLIB You must link your BIOS with CPMLIB using the following command A gt LO68 R UCPM 0 CPM REL CPMLIB BIOS 0 where BIOS 0 is the compiled or assembled BIOS This creates CPM REL which is a relocatable version of your system The cold boot loader however can load only an absolute version of the system so you must now create CPM SYS an absolute version of your system If you want your system to reside at the top of memory first find the size of the system with the following command A gt SIZE68 CPM REL This gives you the total size of the system in both decimal and hex byte counts Subtract this number from the highest memory address in your system and add one to get the highest possible address at which CPM REL can be relocated Assuming that the result is aaaaaa type this command A gt RELOC Baaaaaa CPH REL CPK SY N The result is the CPM SYS file relocated to load at memory address aaaaaa If you want CPM SYS to reside at some other memory address such as immediately above the exception vector area you can use RELOC to place the system at that address 7 2 2Creating CPM SYS CP M
60. ating System User s Guide for the correct command syntax before you reenter the command line If you are trying to run a program when this error occurs the program fi le may have been corrupted Reassemble or recompile the source file and relink it before you reenter the command line 2 The program is too large for the available memory Add more memory boards to the system configuration or rewrite the program to use less memory 3 The program is linked to an absolute location in memory that cannot be used The program must be made relocatable or linked to a usable memory location The BDOS Get Set TPA Limits Function 63 returns the high and low boundaries of the memory space that is available for loading programs 116 Appendix G CP M 68K Error Messages CP M 68K System Guide Message Table G 1 continued Meaning Invalid Command Line No file PUTBOOT Either the command line syntax is incorrect or you have selected a disk drive code outside the range A through P Refer to the section in this manual on the PUTBOOT utility for a full description of the command line syntax The CP M 68K BDOS supports 16 drives lettered A through P The BIOS may or may not support all 16 drives Check the documentation provided by the manufacturer for your particular system configuration to find out which drives your BIOS supports Specify a valid drive code before reentering the PUTBOOT command line CCP The filename specified in the co
61. atus byte data available bit on branch if not set result to true set result to false see if key pressed wait until key pressed get key clear all but low 7 bits get status check for transmitter buffer empty wait until our port has aged and output it and exit Disk Handlers for Tarbell 1793 floppy disk controller maxdsk 2 dphlen 26 iobase OOfffff8 demd iobase Listing B 1 60 this BIOS supports 2 floppy drives length of disk parameter header Tarbell floppy disk port base address output port for command continued Appendix B Sample Assembly Language BIOS CP M 68K System Guide 93 dstat iobase input status port 94 dtrk iobase 1 disk track port 95 dsect 10base 2 disk sector port 96 ddata iobase 3 disk data port 97 dwait iobase 4 input port to wait for op finished 98 dcntrl iobase 4 output control port for drive selection 99 100 101 000000C8 423900000002 home clr b track 102 000000CE 4E75 rts 103 104 seldsk 105 select disk given by register d1 b 106 000000D0 7000 moveq 0 d0 107 000000D2 B23C0002 cmp b maxdsk d1 valid drive number 108 000000D6 6A1E bpl selrtn if no return 0 in dO 109 000000D8 13C100000000 move b dl seldrv else save drive number 110 000000DE E909 Isl b 4 d1 111 000000E0 13C10000000A move b dl selcode select code is 00 for drv 0 10 for drv 1 112 000000E6 103900000000 move b
62. bios _biosinit _cbios _dskia _dskic _setimask a6 0 d2 a7 100 CP M 68K System Guide Apendix D EXORmacs BIOS CP M 68K System Guide move d1 a7 move w d0 a7 move 2000 sr lea _dskia a0 move l a0 3fc jst _cbios unik a6 rts x _dskia link a6 0 movem 1d0 d7 a0 a5 a7 jsr _dskic movem 1 a7 d0 d7 a0 a5 unik a6 rte Setimask move sr d0 Isr and l move ror w and w add w ror w move rts end 8 d0 7 d0 sr dl 8 d1 118 d1 4 a7 d1 8 d1 dl sr Listing D 7 EXORmacs BOOTER S File LLLELLLLLLLLLLLLLLLLLLLLLLLLLLLLILLILELI nformation to go on the 256 byte boot sector of an ExorMacs joke 2k 2fe sk oce oe oo oe o oe ole ole oe oce oe oe oe oe oce oe oe oe oe oce oe oe oe oe oce oe oce oe ok 2k ake text dc 1 dc 1 dc w dc w dc 1 dc 1 dc 1 dc w dc 1 dc 1 dc b dc b dc b dc w dc 1 4000 starting stack pointer start starting program counter 1 garbage 1 length of SAT 2 secondary directory start 0 primary directory PSN list start 0 start of boot loader 26 length of boot loader 0 boot execution address 0 boot load address 9 30 generation date CP M 68K of 9 30 82 volume descriptor 0020 version revision 0a484 checksum god help us 0fle2d3c diagnostic test pattern 101 Apendix D EXORmacs BIOS XX X X X start move w exlp expdef grunt dc 1 4b5a6978 dc
63. bly Language BIOS 59 bios initialization entry point multiply bios function by 4 get handler address jsr a0 call handler trapng Appendix B Sample Assembly Language BIOS 42 0000005E 00000108 43 00000062 00000114 44 00000066 0000029C 45 0000006A 000002 A4 46 0000006E 000002 A6 47 00000072 00000298 48 00000076 000002A8 49 50 51 dc 1 sectran dc 1 setdma dc l getseg dc l getiob dc l setiob dc 1 flush dc l setexc nfuncs biosbase 4 52 0000007A 4EF900000000 53 54 00000080 103900FFFF01 55 00000086 02400002 56 0000008A 6704 57 0000008C 7001 58 0000008E 4E75 59 60 00000090 4280 61 00000092 4E75 62 63 00000094 61EA 64 00000096 4A40 65 00000098 67FA noton conin 66 0000009A 103900FFFF00 67 00000040 COBC0000007F 68 000000A6 4E75 69 wboot jmp _ccp constat move b ffff01 d0 andi w 2 d0 beq noton moveq 1 1 d0 rts clr 1 dO rts bsr constat tst do beq conin move b ffff00 d0 and 7f d0 rts 70 000000A8 103900FFFFO1conout move b ffff01 d0 71 000000AE C03C0001 72 000000B2 67F4 73 000000B4 13C100FFFF00 74 000000BA 4E75 75 76 000000BC 4E75 TI 78 000000BE 4E75 79 80 000000C0 4E75 81 82 000000C2 103C00FF 83 000000C6 4E75 84 85 86 87 88 89 90 9 92 Istout pun rdr listst and b 1 d0 beq conout move b d1 ffff00 rts rts rts rts move b ff d0 rts CP M 68K System Guide get st
64. bly language portion of the EXORmacs BIOS as distributed with CP M 68K Include file for use with BIOS C object for EXORmacs bootstrap Assembly boot code for the EXORmacs Submit file to do a C compilation Invokes all three passes of the C compiler as well as the assembler You can compile a C program with the line A gt C filename Relocatable version of the C parser Relocatable version of the C code generator 55 Appendix A Contents of Distribution Disks File CLIB CLINK SUB CP68 REL CPM H CPM REL CPM SYS CPMLIB CPMLDR SYS CTYPE H DDT REL DDT1 68K DUMP REL ED REL ELDBIOS S ERGBIOS S ERRNO H FORMAT REL CP M 68K System Guide Table A 1 continued Contents The C run time library Submit file for linking C object programs with the C run time library Relocatable version of the C preprocessor Include file with C definitions for CP M 68K See the C Programminq Guide for CP M 68K for details Relocatable version of CPM SYS CP M 68K operating system file for the EXORmacs Library of object files for CP M 68K See Section 2 The bootstrap loader for the EXORmacs A copy of this was written to the system tracks using PUTBOOT Same as above Relocatable version of the preloader for DDT Loads DDT 1 into the high end of the TPA This is the real DDT that gets loaded into the top of the TPA It is relocatable even though the file type is 68K because it must be
65. d in Section 8 The command to place CPMLDR on the system tracks of drive A is A gt putboot cpmldr sys a 11 3 2 Creating the Cold Boot Loader CP M 68K System Guide PUTBOOT leads the file CPMLDR SYS strips off the 28 byte command file header and puts the result on the specified drive You can now boot from this disk assuming that CPM SYS is on the disk End of Section 3 12 Section 4 BIOS Functions 4 1 Introduction All CP M 68K hardware dependencies are concentrated in subroutines that are collectively referred to as the Basic I O System BIOS A CP M 68K system implementor can tailor CP M 68K to fit nearly any 68000 operating environment This section describes each BIOS function its calling conventions parameters and the actions 1t must perform The discussion of Disk Definition Tables is treated separately in Section 5 When the BDOS calls a BIOS function it places the function number in register DO W and function parameters in registers Dl and D2 It then executes a TRAP 3 instruction DO W is always needed to specify the function but each function has its own requirements for other parameters which are described in the section describing the particular function The BIOS returns results if any in register DO The size of the result depends on the particular function Note the BIOS does not need to preserve the contents of registers That is any register contents which were valid on entry to the BIOS may be des
66. decimal number needs to be represented in an S record it is represented by the ASCII characters for the hexadecimal digits comprising the number Each S record contains five fields as follows Field S type length address data checksum Characters 1 1 2 2 40r6 variable 2 Figure F 1 S record Fields The field contents are as follows Table F 1 S record Field Contents Field Contents S The ASCII Character IS This signals the beginning of the S record type A digit between 0 and 9 represented in ASCII with the exceptions that 4 and 6 are not allowed Type is explained in detail below 108 Appendix F 1 S record Format CP M 68K System Guide Table F 1 continued Field Contents length The number of character pairs in the record excluding the first three fields That is one half the number of characters total in the address data and checksum fields This field has two hexadecimal digits representing a one byte quantity address The address at which the data portion of the record is to reside in memory The data goes at this address and successively higher numbered addresses The length of this field is determined by the record type data The actual data to be loaded into memory with each byte of data represented as a pair of hexadecimal digits in ASCII checksum A checksum computed over the length address and data fields The checksum is computed by adding the values of all the character pairs each character
67. dures 3 1 Bootstrapping overview 3 2 Creating the Cold Boot Loader 3 2 1 Writing a Loader BIOS 3 2 2 Building CPMLDR SYS 4 BIOS Functions 4 1 Introduction Nanna an BB UU a o 10 10 11 13 Table of Contents continued 5 Creating a BIOS 5 1 Overview 5 2 Disk Definition Tables 5 2 1 Disk Parameter Header 5 2 2 Sector Translate Table 5 2 3 Disk Parameter Block 5 3 Disk Blocking Guide 5 3 1 A Simple Approach 5 3 2 Some Refinements 5 3 3 Track Buffering 5 3 4 LRU Replacement 5 3 5 The New Block Flag 6 Installing and Adapting the Distributed BIOS and CP M 68K 6 1 Overview 6 2 Booting on an EXORmacs 6 3 Bringing up CP M 68K Using S record Files 7 Cold Boot Automatic Command Execution 7 1 Overview 7 2 Setting up Cold Boot Automatic Command Execution 8 The PUTBOOT Utility 8 1 PUTBOOT Operation 8 2 Invoking PUTBOOT 39 39 40 41 42 45 46 46 47 47 48 49 49 50 51 51 53 53 Appendixes A Contents of Distribution Disks B Sample BIOS Written in Assembly Language C Sample Loader BIOS Written in Assembly Language D EXORmacs BIOS Written in C B PUTBOOT Utility Assembly Language Source F The Motorola S record Format F 1 S record Format F 2 S record Types G CP M 68K Error Messages 55 59 67 73 101 107 107 108 109 Tables 1 1 4 1 4 2 4 3 5 1 5 2 5 3 5 4 F 1 F 2 G 1 Figures Tables and Figures CP M 68K Terms BIOS Register Usage BIOS F
68. e drive specified in the command line is either not supported by the BIOS or is not physically accessible Check the documentation provided by the manufacturer to find out which drives your BIOS supports This error is also returned if a BIOS supported drive is not supported by your system configuration Specify a valid drive and reenter the PUTBOOT command line SUB file not found CCP The file requested either does not exist or does not have a filetype of SUB Ensure that you are requesting the correct file Refer to the section on SUBMIT in the CP M 68K Operating System User s Guide for information on creating and using submit files Syntax REN newfile oldfile CCP The syntax of the REN command line is incorrect The correct syntax is given in the error message Enter the REN command followed by a space then the new filename followed immediately by an equals sign and the name of the file you want to rename 118 Appendix G CP M 68K Error Messages CP M 68K System Guide Table G 1 continued Message Meaning Too many arguments argument CCP The command line contains too many arguments The extraneous arguments are indicated by the variable argument Refer to the CP M 68K Operating System User s Guide for the correct syntax for the command Specify only as many arguments as the command syntax allows and reenter the command line Use a second command line for the remaining arguments if appropriate Too Much Data for Sys
69. e ee ee eek Error procedure for BIOS fee eee ee ae ee if LOADER bioserr errmsg REG BYTE errmsg i printstr n rBIOS ERROR printstr errmsg printstr An T printstr s used by bioserr REG BYTE s while s portout PORT1 s s 1 X T Helse bioserr minimal error procedure for loader BIOS i 1 goto 1 Zendif fee eee ee ae ee Disk I O Procedures fee eee ee ae ee 82 Apendix D EXORmacs BIOS EXTERN dskia external interrupt handler calls dskic EXTERN setimask use to set interrupt mask returns old mask dskicQ t Disk Interrupt Handler C Language Portion REG BYTE workbyte BYTE stpkt STPKTSZ workbyte DSKIPC ACKFMIPC gt byte if workbyte ACK workbyte NAK i if ipcstate ACTIVE intcount 1 else DSKIPC ACKFMIPC gt byte 20 workbyte DSKIPC MSGFMIPC gt byte if workbyte amp 0x80 i getstpkt stpkt if stpkt PK TID OxFF i unsolicited unsolst stpkt sendack T else t solicited if ipcstate ACTIVE intcount 1 else sendack T 3 end of dskic CP M 68K System Guide fee eee ee ae ee Read status packet from IPC fee eee ee ae ee getstpkt stpktp REG BYTE stpktp i REG BYTE p q REG WORD i p stpktp q DSKIPC PKTFMIPC 83 Apendix D
70. ead the physical sector into the BIOS s buffer copy the 128 bytes of output data into the proper 128 byte piece of the physical sector in the buffer and finally write the entire physical sector back to disk Note this operation involves two rotational latency delays in addition to the time needed to copy the 128 bytes of data In fact the second rotational wait 1s probably nearly a full disk revolution since the copying is usually much faster than a disk revolution 5 3 2 Some Refinements There are some easy things that can be done to the algorithm of Section 5 2 1 to improve its performance The first is based on the fact that disk accesses are usually done sequentially Thus if data from a certain physical sector is needed 1t is likely that another piece of that sector will be needed on the next disk operation To take advantage of this fact the BIOS can keep information with its physical sector buffer as to which disk track and physical sector if any is represented in the buffer Then when reading the BIOS need only do physical disk reads when the information needed is not in the buffer On writes the BIOS still needs to preread the physical sector for the same reasons discussed in Section 5 2 1 but once the physical sector is in the buffer subsequent writes into that physical sector do not require additional prereads An additional saving of disk accesses can be gained by not writing the sector to the disk until absolutely necessa
71. eee ee ae ee 1 0 Device Definitions fee eee ee ae ee 73 Apendix D EXORmacs BIOS CP M 68K System Guide fee eee ee ae ee Define the two serial ports on the DEBUG board fee eee ee ae ee Port Addresses define PORT1 OxFFEEO11 console port define PORT2 OxFFEE015 debug port Port Offsets define PORTCTRLO Control Register define PORTSTATO X Status Register define PORTRDR 2 Read Data Register define PORTTDR 2 Write Data Register Port Control Functions define PORTRSET 3 Port Reset define PORTINIT 0x11 Port Initialize Port Status Values define PORTRDRF I Read Data Register Full define PORTTDRE2 Write Data Register Empty fee eee ee ae ee Define Disk I O Addresses and Related Constants fee eee ee ae ee define DSKIPC OxFF0000 PC Base Address define DSKINTV Ox3FC Address of Disk Interrupt Vector define INTTOIPC OxD offsets in mem mapped io area define RSTTOIPC OxF define MSGTOIPC 0x101 define ACKTOIPC 0x103 define PKTTOIPC 0x105 define MSGFMIPC 0x181 define ACKFMIPC 0x183 define PKTFMIPC 0x185 define DSKREAD 0x10 disk commands define DSK WRITE 0x20 Some characters used in disk controller packets define STX 0x02 define ETX 0x03 define ACK 0x06 define NAK 0x15 74 Apendix D EXORmacs BIOS CP M 68K System Guide define PKTSTX 0x0 off
72. ely 16K bytes into which it reads the bootstrap file Either make the bootstrap file smaller so that it will fit into the buffer or change the size of the PUTBOOT buffer The PUTBOOT source code is supplied with the system distributed by DRI Equate bufsize located near the front of the PUTBOOT source code to the required dimension in Hexidecimals Reassemble and relink the source code before you reenter the PUTBOOT command line Cannot Open Source File PUTBOOT PUTBOOT cannot locate the source file Ensure that you specify the correct drive code and filename before you reenter the PUTBOOT command line 112 Appendix G CP M 68K Error Messages CP M 68K System Guide Table G 1 continued Message Meaning CP M Disk change error on drive x BDOS The disk in the drive indicated by the variable x is not the same disk the system logged in previously When the disk was replaced you did not enter a CTRL C to log in the current disk Therefore when you attempted to write to erase or rename a file on the current disk the BDOS set the drive status to read only and warm booted the system The current disk in the drive was not overwritten The drive status was returned to read write when the system was warm booted Each time a disk is changed you must type a CTRL C to log in the new disk CP M Disk file error filename is read only Do you want to Change it to read write C or Abort A BDOS You attempted to write to erase or rena
73. equirements 49 Conout 10 CONSOLE device 33 CP M 68K customizing 7 generating 7 installing 49 loading 49 logical device characteristics 33 system modules 3 CP M 68K configuration 39 CP M 68K file structure 1 CP M 68K programming model 2 CPM REL 7 CPM SYS creating 7 CPM SYS 6 9 CPM SYS file 51 CPMLDR 9 CPMLDR SYS 10 building 11 CPMLIB 7 CSV 41 CTRL Z IAH 5 D data segment 2 device models logical 5 DIRBUF 40 directory buffer 11 directory check vector 43 disk 6 disk access sequential 46 disk buffers writing 37 disk definition tables 39 disk devices 6 disk drive total storage capacity 43 disk head 23 Disk Parameter Block DPB 11 13 24 42 43 Disk Parameter Block fields 42 Disk Parameter Header DPH 11 13 24 31 40 Disk Parameter Header elements 40 41 disk select operation 24 disk throughput 46 disk writes 37 DMA address 27 DMA buffer 29 DPB 40 DRM 43 DSM 43 44 E end of file 5 end of file condition 22 error indicator 24 ESM 44 exception vector area 1 38 EXORmacs 49 Extent Mask 43 F FDC 49 file storage 6 file system tracks 43 Function 0 10 122 G Get MRT 11 graphics device bit mapped 4 I O byte 34 I O byte field definitions 34 I 0 character 5 I O devices character 5 disk drives 5 disk file 5 init 10 interface hardware 5 interrupt vector area 3 J jsr init 15 L L068 command 7 LDRLIB 1
74. erent for each DPH There must be 1 bit for each allocation block on the drive requiring the following length ALV DSM 8 1 DSM is discussed below 5 2 2 Sector Translate Table Sector translation in CP M 68K is a method of logically renumbering the sectors on each disk track to improve disk I O performance A frequent situation is that a program needs to access disk sectors sequentially However in reading sectors sequentially most programs lose full disk revolution between sectors because there is not enough time between adjacent sectors to begin a new disk operation To alleviate this problem the traditional CP M solution is to create a logical sector numbering scheme in which logically sequential sectors are physically separated Thus between two logically contiguous sectors there is a several sector rotational delay The sector translate table defines the logical to physical mapping in use for a particular drive if a mapping is used Sector translate tables are used only within the BIOS Thus the table may have any convenient format Although the BDOS is aware of the sector translate table its only interaction with the table is to get the address of the sector translate table from the DPH and to pass that address to the Sector Translate Function of the BIOS The most common form for a sector translate table is an n byte or n word array of physical sector numbers where n is the number of sectors per disk track Indexing in
75. erminal is a registered trademark of Texas Instruments Incorporated The CP M 68K Operating System System Guide was prepared using the Digital Research TEX Text Formatter and printed in the United States of America First Edition January 1983 Foreword CP M 68K is a single user general purpose operating system it is designed for use with any disk based computer using a Motorola MC68000 or compatible processor CP M 68K is modular in design and can be modified to suit the needs of a particular installation The hardware interface for a particular hardware environment is supported by the OEM or CP M 68K distributor Digital Research supports the user interface to CP M 68K as documented in the CP M 68K Operating System User s Guide Digital Research does not support any additions or modifications made to CP M 68K by the OEM or distributor Purpose and Audience This manual is intended to provide the information needed by a systems programmer in adapting CP M 68K to a particular hardware environment A substantial degree of programming expertise is assumed on the part of the reader and it is not expected that typical users of CP M 68K will need or want to read this manual Prerequisites and Related Publications In addition to this manual the reader should be familiar with the architecture of the Motorola MC68000 as described in the Motorola 16 Bit Microprocessor User s Manual third edition the CP M 68K User s and Programmer s Guides
76. f you want to boot from a drive other than A your loader BIOS should be written to select that other drive when it receives a request to select drive A 2 The loader BIOS is not called through a trap the loader BDOS calls an entry point named bios instead The parameters are still passed in registers just as in the normal BIOS Thus your Function 0 does not need to initialize a trap the code that in a normal BIOS would be the Trap 3 handler should have the label bios and you exit from your loader BIOS with an RTS instruction instead of an RTE 3 Only the following BIOS functions need to be implemented 0 Init Called just once should initialize hardware as necessary no return value necessary Note that Function 0 is called via bios with the function number equal to 0 You do not need a separate init entry point 4 Conout Used to print error messages during boot If you do not want error messages this function should just be an rts 9 Seldsk Called just once to select drive A 10 Settrk 10 3 2 Creating the Cold Boot Loader CP M 68K System Guide 11 Setsec 12 Setdma 13 Read 16 Sectran 18 Get MRT Not used now but may be used in future releases 22 Set exception 4 You do not need to include an allocation vector or a check vector and the Disk Parameter Header values that point to these can be anything However you still need a Disk Parameter Header Disk Parameter Block and directory buffer
77. ff ds w 180 0000408E count ds w 181 00004090 bufp ds l 182 00004094 hflag dsb 183 184 00004096 data 184 00000000 185 186 00000000 496E76616C696420 186 00000008 436F6D6D616E6420 186 00000010 4C696E650D0A24 187 00000017 53656C6563742045 187 0000001F 72726F720D0A24 188 00000026 5772697465204572 188 0000002E 726F720D0A24 189 00000034 43616E6E6F74204F 189 0000003C 70656E20536F7572 189 00000044 63652046696C650D 189 0000004C 0A24 190 0000004E 427566666572204F 190 00000036 766572666C6F770D 190 0000005E 0424 191 00000060 546F6F204D756368 191 00000068 204461746120666F 191 00000070 722053797374656D 191 00000078 20547261636B730D 191 00000080 0424 192 193 194 00000082 end exit CIX CIX CIX CIX bufsize 128 1 Ra e ke ke erstr dc b selstr dc b wrtstr dc b opnfl dc b bufofl dc b trkofl dc b CP M 68K System Guide disk select error disk write error buffer overflow fcb address sectors per track current sector current track selected disk 1st track of non boot area Invalid Command Line 13 10 Select Error 13 10 Write Error 13 10 Cannot Open Source File 13 10 Buffer Overflow 13 10 Too Much Data for System Tracks 13 10 106 Appendix E PUTBOOT Utility CP M 68K System Guide Symbol Table buf 00000000 BSS bufent 00000080 ABS bufofl 0000004E DATA bufoflx 000001EA TEXT bufp 00004090 BSS bufsize 0000400
78. hance the file to be written begins with 601AH but should not have its first 28 bytes discarded the H flag should be specified in the PUTBOOT command line This flag tells PUTBOOT to write the file verbatim to the system tracks PUTBOOT uses BDOS calls to read lt filename gt and used BIOS calls to write lt filename gt to the system tracks It refers to the OFF and SPT parameters in the Disk Parameter Block to determine how large the system track space is The source and command files for PUTBOOT are supplied on the distribution disks for CP M 68K End of Section 8 53 54 Appendix A Contents of Distribution Disks This appendix briefly describes the contents of the disks that contain CP M 68K as distributed by Digital Research File AR68 REL AS68INIT AS68 REL ASM SUB BIOS 0 BIOS C BIOSA 0 BIOSA S BIOSTYPS H BOOTER 0 BOOTER S C SUB C068 REL C168 REL Table A 1 Distribution Disk Contents Contents Relocatable version of the archiver librarian Initialization file for assembler see AS68 documentation in the CP M 68K Operating System Programer s Guide Relocatable version of the assembler Submit file to assemble an assembly program with file type S put the object code in filename 0 and a listing file in filename PRN Object file of BIOS for EXORmacs C language source for the EXORmacs BIOS as distributed with CP M 68K Object file for assembly portion of EXORmacs BIOS Source for the assem
79. his Appendix contains several files in addition to the C BIOSproper First the C BIOS includes conditional compilation to make it into either a loader BIOS or a normal BIOS and there is an include file for each possibility One of these include files should be renamed BIOSTYPE H before compiling the BIOS The choice of which file is used as BIOSTYPE H determines whether a normal or loader BIOS is compiled Both the normal and the loader BIOSes need assembly language interfaces and they are not the same Both assembly interface modules are given Finally there is an include file that defines some standard variable types Listing D 1 EXORmacs BIOS C File pe hn pe pe CP M 68K tm BIOS for the EXORMACS Copyright 1983 Digital Research pe Modified 9 7 82 wbt pe 10 5 82 wbt pe 12 15 82 wbt pe 12 22 82 wbt pe 1 28 83 wbt pe 2 05 84 sw v1 2 pe PON o nnn nnn nnn nn pe include biostype h defines LOADER 0 gt normal bios 1 gt loader bios also defines CTLTYPE 0 gt Universal Disk Cntrlr 1 gt Floppy Disk Controller MEMDSK 0 gt no memory disk 4 gt 384K memory disk include biostyps h defines portable variable types char copyright Copyright 1983 Digital Research struct memb BYTE byte 3 use for peeking and poking memory struct memw WORD word struct meml LONG lword y fee
80. ion disks contain two copies of the CP M 68K operating system in Motorola S record form for use in getting your first CP M 68K system running S records described in detail in Appendix F are a simple ASCII representation for absolute programs The two S record systems contain the CCP and BDOS but no BIOS One of the S record systems resides at locations 400H and up the other 15 configured to occupy the top ofa 128K memory space The exact bounds of the S record systems may vary from release to release There will be release notes and or a file named README describing the exact characteristics of the S record systems distributed on your disks To bring up CP M 68K using the S record files you need 1 some method of down loading absolute data into your target system 2 a computer capable of reading the distribution disks a CP M based computer that supports standard CP M 8 inch diskettes 3 a BIOS for your target computer Given the above items you an use the following procedure to bring a working version of CP M 68K into your target system 1 You must patch one location in the S record system to link 1t to your BIOS s init entry point This location will be specified in release notes and or in a README file on your distribution disks The patch simply consists of inserting the address ofthe init entry in your BIOS at one long word location in the record system This patching can be done either before or after down loading the system
81. is sequential rotational latency can be greatly reduced by reading several sectors at a time and saving them for future use In both the cases above the point of interest is that physical I O occurs in units larger than the expected sector size of 128 bytes Some of the problems in doing disk I O in this manner are discussed below 45 5 3 Disk Blocking CP M 68K System Guide 5 3 1 A Simple Approach This section presents a simple approach to handling a physical sector size larger than the logical sector size The method discussed in this section is not recommended for use in a real BIOS Rather it is given as a starting point for refinements discussed in the following sections Its simplicity also makes it a logical choice for a first BIOS on new hardware However the disk throughput that you can achieve with this method is poor and the refinements discussed later give dramatic improvements Probably the easiest method for handling a physical sector size which is a multiple of 128 bytes is to have a single buffer the size of the physical sector internal to the BIOS Then when a disk read is to be done the physical sector containing the desired 128 byte logical sector is read into the buffer and the appropriate 128 bytes are copied to the DMA address Writing is a little more complicated You only want to put data into a 128 byte portion of the physical sector but you can only write a whole physical sector Therefore you must first r
82. isk sector that is not presently in memory The second issue when to write a buffer back to disk is more complicated Generally it is desirable to defer writing a buffer until it becomes necessary Thus several transfers can be done to a buffer for the cost of only one disk access two accesses if the buffer had to be preread However there are several reasons why buffers must be written The following list describes the reasons 1 A BIOS Write operation with mode l write to directory sector To maintain the integrity of CP M 68K s file system it is very important that directory information on the disk is kept up to date Therefore all directory writes should be performed immediately 2 A BIOS Flush Buffers operation This BIOS function is explicitly intended to force all disk buffers to be written After performing a Flush Buffers it is safe to remove a disk from its drive 3 A disk buffer is needed but all buffers are full Therefore some buffer must be emptied to make it available for reuse 4 A Warm Boot occurs This is similar to number 2 above 47 5 3 Disk Blocking CP M 68K System Guide Case three above is the only one in which the BIOS writer has any discretion as to which buffer should be written Probably the best strategy is to write out the buffer which has been least recently used The fact that an area of disk has not been accessed for some time is a fairly good indication that it will not be needed again soo
83. isplayed It is a good idea to first implement and test your BIOS without the IOBYTE functions then add the I O byte function 35 Function 20 Set I O Byte CP M 68K System Guide FUNCTION 20 SET VO BYTE Entry Parameters Register DO W 14H Register D1 W Desired Returned Value None This function uses the value in register D1 to set the value of the I O byte that is stored in the BIOS See Table 4 4 for the I O byte field definitions Note that even though this is a byte value we are using word references The upper byte should be zero 36 Function 2 1 Flush Buffers CP M 68K System Guide FUNCTION 21 FLUSH BUFFERS Entry Parameters Register DO W 15H Returned Value Register DO W 0000H successful write Register DO W FFFFH unsuccessful write This function forces the contents of any disk buffers that have been modified to be written That is after this function has been performed all disk writes have been physically completed After the buffers are written this function returns a zero in register DO W However if the buffers cannot be written or an error occurs the function returns a value of FFFFH in register DO W 37 Function 22 Set Exception Address CP M 68K System Guide FUNCTION 22 SET EXCEPTION HANDLE ADDRESS Entry Parameters Register DO W 16H Register DI W Exception Vector Number Register D2 L Exception Vector Address Returned Value Register DO L Previous Vector Contents This function
84. ite 14 22 sectran 16 23 flush 21 24 25 bufcnt 80 26 bufsize 80 bufcnt 27 28 00000000 text 29 30 00000000 4E560000 start link a6 40 31 00000004 206E0008 move 1 8 a6 a0 base page address 32 00000008 43E8005C lea 5c a0 al 33 0000000C 23C900004080 move 1 al fcb 34 00000012 423900004094 clrb hflag 35 00000018 DOFC0081 add 81 a0 first character of command tail 36 0000001C 0C180020 scan cmpi b 20 a0 skip over blanks 37 00000020 67FA beq scan 38 00000022 5388 sub 71 30 39 00000024 4A10 scanl tstb a0 40 00000026 670001A4 beq erxit 41 0000002A 0C18002D cmpi b 2d a0 check for H flag 42 0000002E 6626 bne nohyph 43 00000030 0C180048 cmpi b 48 a0 44 00000034 66000196 bne erxit 45 00000038 4A3900004094 tstb hflag 46 0000003E 6600018C bne erxit 47 00000042 13FCOOFF00004094 move b ff hflag 103 Appendix E PUTBOOT Utility CP M 68K System Guide 48 0000004A 04B90000002400004080 sub 24 fcb change to 2nd default fcb 49 00000054 60C6 bra scan 50 00000056 0C100020 nohyph cmpi b 20 a0 5 0000005A 66C8 bne scanl 52 0000005C 0C180020 scan2 cmpi b 20 a0 53 00000060 67FA beq scan2 54 00000062 0C200061 cmpi b 61 a0 get disk letter 55 00000066 6D04 bit upper upshift 56 00000068 04500020 sub 20 a0 57 0000006C 0C100041 upper cmpi b 41 a0 compare with range A P 58 00000070 6D00015A blt erxit 59 00000074 0C100050 cmpi b 50 a0
85. l trap 3 tst w dO bne wrterx add 1 sect sub 1 count 145 000001B6 06B90000008000004090 add I 128 bufp 146 000001C0 6084 147 148 000001C2 303C0015 exit 149 000001C6 4E43 150 000001C8 4E5E 151 000001CA 4E75 152 bra wloop move w flush dO trap 3 unik a6 rts 153 000001CC 223C00000000 erxit move l erstr d1 154 000001D2 303C0009 erx 155 000001D6 4E42 move w prntstr d0 trap 2 105 CP M 68K System Guide check for select error get DPB address get sectors per track get offset start at trk 0 start at sector 1 check for end of track advance to new track set the track set sector set up dma address for write and write check for write error increment sector number exit location flush bios buffers and exit to CCP miscellaneous errors print error message and exit Appendix E PUTBOOT Utility 156 000001D8 60E8 157 158 000001DA 223C00000017 selerx move 1 selstr d1 159 00000 1E0 60FO 160 000001E2 223C00000026 wrterx move l wrtstr d1 161 00000 1E8 60E8 162 000001EA 223C0000004E bufoflx move l bufofl d1 163 00000 1F0 60E0 164 000001F2 223C00000060 oflex move l trkofl d1 bra bra bra bra 165 000001F8 60D8 bra 166 167 168 00000000 bss 169 170 even 171 172 00000000 buf ds b 173 174 00004080 fcb ds 1 175 00004084 spt ds w 176 00004086 sect ds w 177 00004088 trk ds w 178 0000408A dsk ds w 179 0000408C o
86. me a file whose status is read only Specify one of the options enclosed in parentheses If you specify the C option the BDOS changes the status of the file to read write and continues the operation The read only protection previously assigned to the file is lost If you specify the A option or a CTRL C the program terminates and CP M 68K returns the system prompt CP M Disk read error on drive x Do you want to Abort A Retry R or Continue with bad data C BDOS This message indicates a hardware error Specify one of the options enclosed in parentheses Each option is described below Option Action A or CTRL C Terminates the operation and CP M 68K returns the system prompt Meaning continued on next page 113 Appendix G CP M 68K Error Messages CP M 68K System Guide Table G 1 continued Message Meaning CP M Disk read error on drive x continued Option Action R Retries operation If the retry fails the system reprompts with the option message C Ignores error and continues program execution Be careful if you use this option Program execution should not be continued for some types of programs For example if you are updating a data base and receive this error but continue program execution you can corrupt the index fields and the entire data base For other programs continuing program execution is recommended For example when you transfer a long text file and receive an error because one sector is bad
87. mmand line does not exist Ensure that you use the correct filename and reenter the command line No wildcard filenames CCP The command specified in the command line does not accept wildcards in file specifications Retype the command line using a specific filename Program Load Error CCP This message indicates an undefined failure of the BDOS Program Load Function 59 Reboot the system and try again If the error persists then it is caused by an error in the internal logic of the BDOS Contact the place you purchased your system for assistance You should provide the information below 1 Indicate which version of the operating system you are using 2 Describe your system s hardware configuration Meaning continued on next page 117 Appendix G CP M 68K Error Messages CP M 68K System Guide Table G 1 continued Message Meaning 3 Provide sufficient information to reproduce the error Indicate which program was running at the time the error occurred If possible you should also provide a disk with a copy of the program read error on program load CCP This message indicates a premature end of file The file is smaller than the header information indicates Either the file header has been corrupted or the file was only partially written Reassemble or recompile the source file and relink it before you reenter the command line Select Error PUTBOOT This error is returned from the BIOS select disk function Th
88. n 5 3 5 The New Block Flag As explained in Section 5 2 2 the BDOS allocates disk space to files in blocks of BLS bytes When such a block is first allocated to a file the information previously in that block need not be preserved To enable the BIOS to take advantage of this fact the BDOS uses a special parameter in calling the BIOS Write Function If register DI W contains the value 2 on a BIOS Write call then the write being done is to the first sector of a newly allocated disk block Therefore the BIOS need not preread any sector of that block If the BIOS does disk buffering in units of BLS bytes it can simply mark any free buffer as corresponding to the disk address specified in this write because the contents of the newly allocated block are not important If the BIOS uses a buffer size other than BLS then the algorithm for taking full advantage of this information is more complicated This information is extremely valuable in reducing disk delays Consider the case where one file is read sequentially and copied to a newly created file Without the information about newly allocated disk blocks every physical write would require a preread With the information no physical write requires a preread Thus the number of physical disk operations is reduced by one third 0 End of Section 5 48 Section 6 Installing and Adapting the Distributed BIOS and CP M 68K 6 1 Overview The process of bringing up your first running CP M 68K
89. ok else non zero 121 000000E8 13FC000A0000000B move b f10 errent set up retry counter bsr setup on 88 d3 move b d3 dcmd 7 dwait OR read command with head load bit output it to FDC if end of read exit else move next byte of data beq rdone move b ddata a0 bra rloop bsr rstatus get FDC status bne rerror clr 1 dO rts bsr errchk subq b 1 errent bne rretry move l ffffffff dO rts go to error handler common read and write setup code select disk set track set sector were all deferred until now 145 00000126 13FCOODOOOFFFFF8 move b H d0 dcmd clear controller get status move b curdrv d3 69 Appendix C Sample Loader BIOS CP M 68K System Guide 147 00000134 B63900000000 cmp b seldrv d3 148 0000013A 661A bne newdrive if drive not selected do it 149 0000013C 163900000002 move b track d3 150 00000142 B63900000003 cmp b oldtrk d3 151 00000148 6620 bne newtrk 1f not on right track do it 152 0000014A 4283 clr1 d3 1f head already loaded no head load delay 153 0000014C 0839000500FFFFFS btst 5 dstat if head unloaded treat as new disk 154 00000154 6618 bne sexit 155 newdrive 156 00000156 13F90000000A00FFFFFC move b selcode dcntrl select the drive 157 00000160 13F90000000000000001 move b seldrv curdrv 158 newtrk 159 0000016A 6126 bsr chkseek seek to correct track if required 160 0000016C 7604 moveq 4 d3 force head load delay 161 sexit 162 0000016E 1
90. ore the largest number of bytes that can be addressed in the file system space is 32768 BLS Because the largest allowable value for BLS is 16384 the biggest disk that can be accessed by CP M 68K is 16384 32768 512 Mbytes Each directory entry may contain either 8 block numbers if DSM gt 256 or 16 block numbers if DSM lt 256 Each file needs enough directory entries to hold the block numbers of all blocks allocated to the fi le Thus a large value for BLS implies that fewer directory entries are needed Since fewer directory entries are used the directory search time is decreased The disadvantage of a large value for BLS is that since files are allocated BLS bytes at a time there is potentially a large unused portion of a block at the end of the file If there are many small files on a disk the waste can be very significant The BSH and BLM parameters in the DPB are functions of BLS Once you have chosen BLS you should use Table 5 3 to determine BSH and BIM The EXM parameter of the DPB is a function of BLS and DSM You should use Table 5 4 to find the value of EXM for your disk Table 5 3 BSH and BLM Values BLS BSH BLM 1024 3 7 2048 4 15 4096 5 31 8192 6 63 16384 7 127 44 5 2 Disk Definition Tables CP M 68K System Guide Table 5 4 EXM Values BLS DSM lt 255 DSM gt 255 1024 0 N A 2048 1 0 4096 3 1 8192 7 3 16384 15 7 The DRM entry in the DPB is one less than the total number of directory entries
91. pair represents a one byte quantity in these fields taking the one s complement of the result and finally taking the least significant byte This byte is then represented as two ASCII hexadecimal digits F 2 S record Types There are eight types of S records They can be divided into two categories records containing actual data and records used to define and delimit groups of data containing records Types 1 2 and 3 are in the first category and the rest of the types are in the second category Each of the S record types is described individually below 109 Appendix F 2 S record Types CP M 68K System Guide Table F 2 S record Types Type Meaning 0 This type is a header record used at the beginning of a group of S records The data field may contain any desired identifying information The address field is two bytes four S record characters long and is normally Zero 1 This type of record contains normal data The address field is two bytes long four S record characters 2 Similar to Type 1 but with a 3 byte six S record characters address field 3 Similar to Type 1 but with a 4 byte eight S record characters address field 5 This record type indicates the number of Type 1 2 and 3 records in a group of S records The count is placed in the address field The data field is empty no characters 7 This record signals the end of a block of type 3 S records If desired the address field is 4 bytes long 8 char
92. pendix D EXORmacs BIOS CP M 68K System Guide fee eee ee ae ee Bios initialization Must be done before any regular BIOS calls are performed fee eee ee ae ee biosinit i initprts initdsksQ initprts i portinit PORT1 portinit PORT2 initdsks i REG WORD i REG WORD imsave if LOADER for i 0 i lt NUMTB i i tbuf i valid 0 tbuf i dirty 0 if 1 1 lt NUMTB tbuf i nextbuf amp tbuf i 1 else tbuf i nextbuf 0 T firstbuf amp tbuf 0 lastbuf amp tbuf NUMTB 1 Helse bufvalid 0 endif for i 0 i lt MAXDSK i 1 t dskstate i state IDLE dskstate i ready 1 dskstate i change 0 T imsave setimask 7 turn off interrupts intcount 0 ipcstate IDLE setimask imsave turn on interrupts T 95 Apendix D EXORmacs BIOS CP M 68K System Guide fee eee ee ae ee f BIOS MAIN ENTRY Branch out to the various functions f fee eee ee ae ee LONG cbios d0 d1 d2 REG WORD do REG LONG dl d2 t switch d0 t case 0 biosinit INIT break if LOADER case 1 flushQ WBOOT initdsksQ wboot break endif case 2 return portstat PORT1 CONST break case 3 return portin PORTI CONIN break case 4 portout PORTI char d1 CONOUT break case 5 LIST case 6 portout PORT char d1 PUNCH break case
93. re this section should be read thoroughly before writing a custom BIOS CP M 68K as distributed by Digital Research is configured to run on the Motorola EXORmacs development system with Universal Disk The sample BIOS in Appendix D is the BIOS used in the distributed system and is written in C language A sample BIOS for an Empirical Research Group ERG 68000 based microcomputer with Tarbell floppy disk controller is also included in Appendix B and is written in assembly language These examples should assist the reader in understanding how to construct his own BIOS 5 2 Disk Definition Tables As in other CP M systems CP M 68K uses a set of tables to define disk device characteristics This section describes each of these tables and discusses choices of certain parameters 39 5 2 Disk Definition Tables CP M 68K System Guide 5 2 1 Disk Parameter Header Each disk drive has an associated 26 byte Disk Parameter Header DPH which both contains information about the disk drive and provides a scratchpad area for certain BDOS operations Each drive must have its own unique DPH The format of a Disk Parameter Header is shown in Figure 5 1 XLT 0000 0000 0000 DIRBUF DPB CSV ALV 32b 16b 16b 16b 32b 32b 32b 32b Figure 5 1 Disk Parameter Header Each element of the DPH is either a word 16 bit or longword 32 bit value The meanings of the Disk Parameter Header DPH elements are given in Table 5 1 Element XLT 0000 D
94. rogramming Guide for CP M 68K for details End of Appendix A 58 Sample BIOS Written in Assembly Language AUD tn LA LA O 10 11 12 00000000 23FC0000000E0000008C init move l traphndl 8c set up trap 3 handler clr 1 dO log on disk A user 0 13 0000000A 4280 14 0000000C 4E75 15 16 17 0000000E 0C400017 18 00000012 6408 19 00000014 E548 20 00000016 207B0006 2 0000001A 4E90 22 23 0000001C 4E73 24 25 26 0000001E 00000000 27 00000022 0000007A 28 00000026 00000080 29 0000002A 00000094 30 0000002E 000000A8 31 00000032 000000BC 32 00000036 000000BE 33 0000003A 000000C0 34 0000003E 000000C8 35 00000042 000000D0 36 00000046 000000F8 37 0000004A 00000100 38 0000004E 00000114 39 00000052 0000011C 40 00000056 0000015E 41 0000005A 000000C2 Appendix B LLELLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLDLLLDLLLLLILLI k k k a rol XX X X X CP M 68K BIOS Basic Input Output Subsystem For ERG 68000 with Tarbell floppy disk controller XX X X X LLELLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLDLLLDLLLLLILLI ELE ILE rol globl _ init globl _ccp ccp entry point rts traphndl cmpi nfuncs dO bcc trapng Is 22 00 movea 1 6 pc d0 a0 rte biosbase dc l init dc 1 wboot dc 1 constat dc 1 conin dc 1 conout dc 1 1stout dc 1 pun dc 1 rdr dc 1 home dc 1 seldsk dc 1 settrk dc 1 setsec dc 1 setdma dc 1 read dc l write dc 1 listst Listing B 1 Sample Assem
95. ror 151 0000014A 4280 clr 1 dO 152 0000014C 4E75 rts 153 0000014E 610000B0 rerror bsr errchk go to error handler 154 00000152 53390000000B subq b 1l errcnt 155 00000158 66CA bne rretry 156 0000015A 70FF move 1 ffffffff do 157 0000015C 4E75 rts 158 159 write 160 Write one sector to requested disk track sector from dma address 161 Retry if necessary return in dO 00 if ok else non zero 162 0000015E 13FC000A0000000B move b 10 errent set up retry counter 163 wretry 164 00000166 6134 bsr setup 165 00000168 004300A8 ori a8 d3 OR write command with head load bit 166 0000016C 13C300FFFFF8 move b d3 dcmd output it to FDC 167 00000172 0839000700FFFFFC wloop btst 7 dwait 168 0000017A 6708 beq wdone if end of read exit 169 0000017C 13D800FFFFFB move b a0 ddata else move next byte of data 170 00000182 60EE bra wloop 171 wdone 172 00000184 61000106 bsr rstatus get FDC status 173 00000188 6604 bne werror 174 0000018A 4280 clr 1 dO 175 0000018C 4E75 rts 176 0000018E 6170 werror bsr errchk go to error handler 177 00000190 53390000000B subq b 1l errcnt 178 00000196 66CE bne wretry 179 00000198 70FF move 1 ffffffff do 180 0000019A 4E75 rts 181 182 setup 183 common read and write setup code 184 select disk set track set sector were all deferred until now 185 0000019C 13FCOODOOOFFFFF8 move b d0 dcmd clear controller get status 186 000001A4 163900000001 move b curd
96. rrect track 218 0000020C 13FCOOOBOOFFFFF8 move b 0B dcmd restore command to command port 219 rstwait 220 00000214 0839000700FFFFFC btst 7 dwait 221 0000021C 66F6 bne rstwait loop until restore completed 222 0000021E 0839000200FFFFF8 btst 2 dstat 223 00000226 67E4 beq restore 1f not at track 0 try again 224 00000228 4283 clr1 d3 track number returned in d3 from readid 225 chks1 226 0000022A 13C300FFFFF9 move b d3 dtrk update track register in FDC 227 00000230 13F90000000200000003 move b track oldtrk update oldtrk 228 0000023A B63900000002 emp b track d3 are we at right track 229 00000240 6722 beq chkdone if yes exit 230 00000242 13F90000000200FFFFFB move b track ddata else put desired track in data reg of FDC 231 0000024C 13FC001800FFFFF8 move b 4 18 dcmd and issue a seek command 232 00000254 0839000700FFFFFC chks2 btst 7 dwait 233 0000025C 66F6 bne chks2 loop until seek complete 234 0000025E 163900FFFFF8 move b dstat d3 read status to clear FDC 235 chkdone 236 00000264 4E75 rts 237 238 readid 239 read track id return track number in d3 240 00000266 13FCOOC400FFFFF8 move b c4 dcmd issue read id command 241 0000026E 1E3900FFFFFC move b dwait d7 wait for intrq 242 00000274 163900 FFFFFB move b ddata d3 track byte to d3 243 rid2 244 0000027A 0839000700FFFFFC btst 7 dwait 245 00000282 6708 beq rstatus wait for intrq Listing B 1 continued 63 Appendix B S
97. rv d3 187 000001AA B63900000000 cmp b seldrv d3 188 000001B0 661A bne newdrive if drive not selected do it 189 000001B2 163900000002 move b track d3 190 000001B8 B63900000003 cmp b oldtrk d3 191 000001BE 6620 bne newtrk 1f not on right track do it 192 000001C0 4283 clr1 d3 1f head already loaded no head load delay 193 000001C2 0839000500FFFFF8 btst 5 dstat if head unloaded treat as new disk 194 000001CA 6618 bne sexit Listing B 1 continued 62 Appendix B Sample Assembly Language BIOS CP M 68K System Guide 195 newdrive 196 000001CC 13F90000000A00FFFFFC move b selcode dcntrl select the drive 197 000001D6 13F90000000000000001 move b seldrv curdrv 198 newtrk 199 000001E0 6126 bsr chkseek seek to correct track if required 200 000001E2 7604 moveq 4 d3 force head load delay 201 sexit 202 000001E4 13F90000000400FFFFFA move b sector dsect set up sector number 203 000001EE 13F90000000200FFFFF9 move b track dtrk set up track number 204 000001F8 207900000006 move l dma a0 dma address to a0 205 000001FE 4E75 rts 206 207 errchk 208 00000200 08070004 btst b 4 d7 209 00000204 6602 bne chkseek if record not found error reseek 210 00000206 4E75 rts 211 212 chkseek 213 check for correct track seek if necessary 214 00000208 615C bsr readid find out what track we re on 215 0000020A 671E beq chksl if read id ok skip restore code 216 restore 217 home the drive and reseek to co
98. ry The conditions under which the physical sector must be written are discussed in Section 5 3 4 46 5 3 Disk Blocking CP M 68K System Guide 5 3 3 Track Buffering Track buffering is a special case of disk buffering where the I O is done a full track at a time When sufficient memory for several full track buffers is available this method is quite good The method is essentially the same as discussed in Section 5 3 2 but there are some interesting features First transferring an entire track is much more efficient than transferring a single sector The rotational latency is incurred only once for the entire track whereas if the track is transferred one sector at a time the rotational latency occurs once per sector On a typical diskette with 26 sectors per track rotating at 6 revolutions per second the difference in rotational latency per track is about 2 seconds versus a twelfth of a second Of course in applications where the disk is accessed purely randomly there is no advantage because there is a low probability that more than one sector will be used from a given track However such applications are extremely rare 5 3 4 LRU Replacement With any method of disk buffering using more than one buffer it is necessary to have some algorithm for managing the buffers That is when should buffers be filled and when should they be written back to disk The first question is simple a buffer should be filled when there is a request for a d
99. s being passed as a 16 bit quantity Standard floppy disks have tracks numbered from 0 to 76 25 Function 11 Set Sector Number CP M 68K System Guide FUNCTION 11 SET SECTOR NUMBER Entry Parameters Register DO W OBH Register DI W S sector Number Returned Value None This function specifies in register Dl W the sector number for subsequent disk accesses This number remains in effect until either another Function 11 is performed The function selects actual unskewed sector numbers if skewing is appropriate it will have previously been done by a call to Function 16 You can send this information to the controller at this point or delay sector selection until a read or write operation occurs 26 Function 12 Set DMA Address CP M 68K System Guide FUNCTION 12 SET DMA ADDRESS Entry Parameters Register DO W OCH Register DLL DMA Address Returned Value None This function contains the DMA disk memory access address in register DI for subsequent read or write operations Note that the controller need not actually support DMA direct memory access The BIOS will use the 128 byte area starting at the selected DMA address for the memory buffer during the following read or write operations This function can be called with either an even or an odd address for a DMA buffer 27 Function 1 3 Read Sector CP M 68K System Guide FUNCTION 13 READ SECTOR Entry Parameters Register DO W ODH Returned Value Register DO W
100. sages CP M 68K System Guide Message Table G 1 continued Meaning User range is 0 15 Write Error CCP The user number specified in the command line is not supported by the BIOS The valid range is enclosed in the square brackets in the error message Specify a user number between 0 and 15 decimal when you reenter the command line PUTBOOT Either the disk to which PUTBOOT is writing is damaged or there is a hardware error Insert a new disk and reenter the PUTBOOT command line If the error persists check for a hardware error End of Appendix G 120 H flag 53 0000 40 _autost 51 __ccp 16 _ccp entry point 50 init 15 init entry point 50 init routine 51 usercmd 51 A absolute 2 absolute data down loading 50 address 1 address space 1 algorithms 31 allocation vector 11 ALV 41 applications programs 5 ASCII character 5 20 ASCII CTRL Z IAH 22 AUXILIARY INPUT device 33 AUXILIARY OUTPUT device 33 B base page 2 BDOS 3 5 6 7 50 BDOS Direct BIOS Function Call 50 13 BDOS function 61 Set Exception Vector 38 BIOS 3 5 6 10 13 BIOS compiled 7 creating 39 BIOS flush buffers operation 47 BIOS function 0 15 BIOS function 0 Initialization 15 BIOS function 2 Console Status 17 BIOS function 3 Read Console Character 18 BIOS function 4 Write Console Character 19 BIOS function 5 List Character Output 20 Index BIOS function 6 Auxiliary Output
101. seldrv dO 113 000000EC COFC001A mulu dphlen dO 114 000000F0 DOBC00000016 add 1 dph0 d0 point dO at correct dph 115 000000F6 4E75 selrtn rts 116 117 000000F8 13C100000002 settrk move b dl track 118 000000FE 4E75 rts 119 120 00000100 13C10000000 setsec move b dl sector 121 00000106 4E75 rts 122 123 sectran 124 translate sector in d1 with translate table pointed to by d2 125 result in dO 126 00000108 2042 movea l d2 a0 127 0000010A 48C1 ext l dl 128 0000010C 10301000 move b 0 a0 d1 d0 129 00000110 48C0 extl do 130 00000112 4E75 rts 131 132 setdma 133 00000114 23C100000006 move l d1 dma 134 0000011A 4E75 rts 135 136 read 137 Read one sector from requested disk track sector to dma address 138 Retry if necessary return in dO 00 if ok else non zero 139 0000011C 13FC000A0000000B move b 10 errcnt set up retry counter 140 rretry 141 00000124 61000076 bsr setup 142 00000128 00430088 or 88 d3 OR read command with head load bit 143 0000012C 13C300FFFFF8 move b d3 dcmd output it to FDC Listing B 1 continued 61 Appendix B Sample Assembly Language BIOS CP M 68K System Guide 144 00000132 0839000700FFFFFC rloop btst 7 dwait 145 0000013A 6708 beq rdone if end of read exit 146 0000013C 10F900FFFFFB move b ddata a0 else move next byte of data 147 00000142 60EE bra rloop 148 rdone 149 00000144 61000146 bsr rstatus get FDC status 150 00000148 6604 bne rer
102. sendack i DSKIPC MSGFMIPC gt byte 0 clear message flag DSKIPC ACKTOIPC gt byte ACK send ACK DSKIPC INTTOIPC gt byte 0 interrupt IPC fee eee spese opo epo o eot tepore 28 fe Send a packet to the IPC fee eee ee ae ee sendpkt pktadr pktsize REG BYTE pktadr REG WORD pktsize i REG BYTE iopackp REG WORD imsave while DSKIPC MSGTOIPC gt byte wait til ready DSKIPC ACKFMIPC gt byte 0 DSKIPC MSGFMIPC gt byte 0 85 Apendix D EXORmacs BIOS CP M 68K System Guide iopackp DSKIPC PKTTOIPC do iopackp pktadr iopackp 2 pktsize 1 while pktsize DSKIPC MSGTOIPC gt byte 0x80 imsave setimask 7 dskstate actvdsk state ACTIVE ipcstate ACTIVE intcount OL DSKIPC INTTOIPC gt byte 0 setimask imsave waitack T fee ee ee eee eee ee k k Wait for a Disk Operation to Finish fee ee ee eee eee ee k k WORD dskwait dsk stcom stval REG WORD dsk BYTE stcom WORD sSstval t REG WORD imsave BYTE stpkt STPKTSZ imsave setimask 7 while I intcount amp amp dskstate dsk ready amp amp dskstate dsk change t setimask imsave imsave setimask 7 T if intcount t intcount 1 if DSKIPC MSGFMIPC gt byte amp 0x80 0x80 t getstpkt stpkt setimask imsave if stpkt PKTSTCOM stcom amp amp stpkt PKTSTVAL gt word stval
103. sets within a disk packet define PKTID 0x1 define PKTSZ 0x2 define PRTDEV 0x3 define PKTCHCOM 0x4 define PKTSTCOM 0x5 define PKTSTVAL 0x6 define PKTSTPRM 0x8 define STPKTSZ Oxf fee eee ee ae ee BIOS Table Definitions fee eee ee ae ee Disk Parameter Block Structure struct dpb t WORD spt BYTE bsh BYTE blm BYTE exm BYTE dpbjunk WORD dsm WORD drm BYTE alo BYTE all WORD cks WORD off 5 Disk Parameter Header Structure struct dph i BYTE xltp WORD dphscr 3 BYTE dirbufp struct dpb dpbp BYTE csvp BYTE alvp fee eee ee ae ee Directory Buffer for use by the BDOS fee eee ee ae ee BYTE dirbuf 128 if LOADER 75 Apendix D EXORmacs BIOS CP M 68K System Guide fee eee ee ae ee f CSV s fee eee ee ae ee BYTE csv0 16 BYTE csvl 16 Hif I CTLTYPE BYTE csv2 256 BYTE csv3 256 endif if MEMDSK BYTE csv4 16 endif fee eee spese opo epo o eot tepore 28 fe pe ALV s fee eee ee ae ee BYTE alv0 32 dsm0 8 1 BYTE alv1 32 dsml 8 1 if CTLTYPE BYTE alv2 412 dsm2 8 1 BYTE alv3 412 dsm2 8 1 endif Taf MEMDSK BYTE alv4 48 dsm4 8 1 endif endif fee eee spese opo epo o eot tepore 28 fe pe Disk Parameter Blocks fee eee ee ae ee The following dpb definitions express the intent of the writer unfor
104. sk move l quit buserr tstw a0 bra loop add 1 14 a7 move a7 buserr subl 7 end a0 subl X cpm a0 move l a0 d0 movel 11 d1 Isr 1 d1 d0 move w d0 dpb3 6 99 XX X X XX X X X CP M 68K System Guide Lowest addr of CP M Highest addr of CP M memory region table RAM disk dpb address gt First memory disk location UDC Interrupt vector Trap 3 vector Bus error vector a0 gt Memory region table 1 region TPA starts at 400 Ends where CP M begins Push bus err vector a0 gt Last location in CP M Linker doesn t reloc this gt first location in RAM disk set up vector gt ourselves Find End of memory Clear buserr gorp Pop buserr vector a0 bytes in RAM disk Relocation bug Into D reg for shift Load shift count Divide by 2048 Load DRM field of dpb Apendix D EXORmacs BIOS move 2000 sr jst biosinit clr 1 do rts x _wboot clr 1 dU jmp _ccp x entry move l d2 a7 move l dl a7 move w d0 a7 jst _cbios add 10 a7 rte x _dskia link a6 0 movem 1d0 d7 a0 a5 a7 jsr _dskic movem 1 a7 d0 d7 a0 a5 unik a6 rte Setimask move sr d0 Isr and l move ror w and w add w ror w move rts data globl BIOSDATA de 1 end 8 d0 7 d0 sr dl 8 d1 118 d1 4 a7 d1 8 d1 dl sr BIOSDATA 0 0 Listing D 6 EXORmacs LDBIOS S File text globl globl globl globl globl globl XX X link move 1 bios
105. state IDLE return OL getstpkt stpkt determine disk type and size sendack ipcstate IDLE stl stpkt PKTSTPRM st2 stpkt PKTSTPRM 1 if stl amp 0x80 not ready ready t dskstate dsk ready 0 return OL T else dskstate dsk ready 1 switch stl amp 7 i case I floppy disk dphp gt dpbp amp dpb0 93 CP M 68K System Guide Apendix D EXORmacs BIOS break if CTLTYPE case 2 hard disk dphp gt dpbp amp dpb2 break endif default bioserr Invalid Disk Status dphp OL break return dphp if LOADER f ee ee ee ea ee ae eek This function is included as an undocumented unsupported method for EXORmacs users to format disks Itis not a part of CP M 68K proper and is only included here for convenience since the Motorola disk controller is somewhat complex to program and the BIOS contains supporting routines f ee ee ee ea ee ae eek format dsk REG WORD dsk i REG WORD retval if endif Zendif if I slctdsk BYTE dsk BYTE I return MEMDSK if setdsk MEMDSK return fmtpack dskno cnvdsk setdsk actvdsk setdsk dskstate setdsk change 0 sendpkt amp fmtpack 7 if I dskwait setdsk 0x70 0x0 retval 0 else retval 1 sendack ipcstate IDLE return retval 94 CP M 68K System Guide A
106. sv2 amp alv2 dsk c OL 0 0 0 amp dirbuf amp dpb2 amp csv3 amp alv3 dsk d Zendif Zif MEMDSK OL 0 0 0 amp dirbuf amp dpb3 amp csv4 amp alv4 dsk e endif else if CTLTYPE struct dph dphtab 4 Helse struct dph dphtab 2 endif amp xlt 0 0 0 amp dirbuf amp dpbO OL OL dsk a amp xlt 0 0 0 amp dirbuf amp dpbO OL OL dsk b if CTLTYPE OL 0 0 0 amp dirbuf amp dpb2 OL OL dsk c OL 0 0 0 amp dirbuf amp dpb2 OL OL dsk d 77 Apendix D EXORmacs BIOS CP M 68K System Guide endif endif fee eee spese opo epo o eot tepore 28 fe Memory Region Table fee eee ee ae ee CP M 68K System Guide D EXORmacs BIOS Listing D 1 continued struct mrt WORD count LONG tpalow LONG tpalen T memtab Initialized in BIOSA S if MEMDSK BYTE memdsk Initialized in BIOSA S endif if LOADER rk soe sk seo ee ee ee ae ee hhh 2 a ae fe 2 ak ae IOBYTE fee ee ee hhh o ee a a k 2h 2 fe 2 ae fe 2 ak ae WORD iobyte The I O Byte is defined but not used endif fee ee ee ee ae ee ae fe a a a ekk Currently Selected Disk Stuff fee ee ee ee ae ee hhh 2 a ae fe 2 ak ae WORD settrk setsec setdsk Currently set track sector disk BYTE setdma Currently set dma address fee ee ee ee ae ee ae fe a a a ekk Track Buffering Definitions and Variables
107. t nextbuf tbp gt nextbuf tbp gt nextbuf firstbuf firstbuf tbp setimask imsave return tbp else i mtbp ltbp move along to next buffer Itbp tbp top tbp gt nextbuf The stuff we need is not in a buffer we must make a buffer available and fill it with the desired track if mtbp mtbp gt nextbuf 0 detach Iru buffer Itbp gt nextbuf firstbuf firstbuf Itbp setimask imsave if flush1 Itbp amp amp filldtbp mtbp Itbp success else mtbp OL failure return mtbp 89 Apendix D EXORmacs BIOS CP M 68K System Guide fee eee ee ae ee pe Bios READ Function read one sector fee eee ee ae ee readQ i REG BYTE p REG BYTE g REG WORD i REG struct tbstr tbp Tif MEMDSK if setdsk MEMDSK H endif tbp gettrk locate track buffer with sector if tbp return 1 failure CP M 68K System Guide D EXORmacs BIOS Listing D 1 continued locate sector in buffer and copy contents to user area p tbp gt buf setsec lt lt 7 multiply by shifting Hif MEMDSK else p memdsk LONG settrk lt lt 12L LONG setsec lt lt 7L endif q setdma i 128 do qt p i 1 while 1 this generates good code return 0 fee eee ee ae ee pe BIOS WRITE Function write one sector fee eee ee ae ee write mode BYTE mode i REG BYTE p
108. ted by seldsk currently selected drive track requested by settrk track we were on drive select code retry counter 1 memory region starts at 800 hex goes until 18000 hex continued Appendix B Sample Assembly Language BIOS 297 298 00000016 0000005A dph0 dc l xlt 299 0000001A 0000 dc w 0 300 0000001C 0000 dc w 0 301 0000001E 0000 dc w 0 302 00000020 00000000 dc l dirbuf 303 00000024 0000004A dc l dpb 304 00000028 00000080 dc l ckv0 305 0000002C 000000A0 dc l alvO 306 307 00000030 0000005A dphl dcl xlt 308 00000034 0000 dc w 0 309 00000036 0000 dc w 0 310 00000038 0000 dc w 0 311 0000003A 00000000 dc l dirbuf 312 0000003E 0000004A dc l dpb 313 00000042 00000090 dc 1 ckvl 314 00000046 000000CO dc 1 alvl 315 316 disk parameter block 317 318 0000004A 001A dpb dc w 26 319 0000004C 03 dcb 3 320 0000004D 07 dc b 7 321 0000004E 00 deb 0 322 0000004F 00 deb 0 323 00000050 00F2 dc w 242 324 00000052 003F dc w 63 325 00000054 C000 dc w c000 326 00000056 0010 dc w 16 327 00000058 0002 dc w 2 328 329 sector translate table 330 331 0000005A 01070D13 xlt dcb 1 7 13 19 332 0000005E 19050B11 dc b 25 5 11 17 333 00000062 1703090F dc b 23 3 9 15 334 00000066 1502080E dc b 21 2 8 14 335 0000006A 141A060C 336 0000006E 1218040A 337 00000072 1016 338 339 340 00000000 341 342 00000000 dirbuf 343 344 00000080 ckv0 345 00000090 ckv1
109. tem Tracks PUTBOOT The bootstrap file is too large for the space reserved for it on the disk Either make the bootstrap file smaller or redefine the number of tracks reserved on the disk for the file The number of tracks reserved for the bootstrap file is controlled by the OFF parameter in the disk parameter block in the BIOS This error can also be caused by a bootstrap file that contains a symbol table and relocation bits To find out if the bootstrap program will fit on the system tracks without the symbol table and relocation bits use the SIZE68 Utility to display the amount of space the bootstrap program occupies The first and second items returned by the SIZE68 Utility are the amount of space occupied by the text and data respectively The third item returned is the amount of space occupied by the BSS The sum of the first two items or the total minus the third item will give you the amount of space required for the bootstrap program on the system tracks Compare the amount of space your bootstrap program requires to the amount of space allocated by the OFF parameter Because the symbol table and relocation bits are at the end of the file the bootstrap program may have been entirely written to the system tracks and you can ignore this message Or you can run RELOC on the bootstrap file to remove the symbol table and relocation bits from the bootstrap file and reenter the PUTBOOT command line 119 Appendix G CP M 68K Error Mes
110. ter out Auxiliary Output write character to auxiliary output device Auxiliary Input read from auxiliary input Home move to track 00 Select Disk Drive Set Track Number Set Sector Number Set DMA Address Read Selected Sector Write Selected Sector Return List Status Sector Translate Get Memory Region Table Address Get I O Mapping Byte Set VO Mapping Byte Flush Buffers Set Exception Handler Address 14 Function 0 Initialization CP M 68K System Guide FUNCTION 0 INITIALIZATION Entry Parameters Register DO W 00H Returned Value Register DO W User Disk Numbers This routine is entered on cold boot and must initialize the BIOS Function 0 is unique in that it is not entered with a TRAP 3 instruction Instead the BIOS has a global label init which is the entry to this routine On cold boot Function 0 is called by a jsr init When initialization is done exit is through an rts instruction Function 0 is responsible for initializing hardware if necessary initializing BIOS internal variables such as IOBYTE as needed setting up register DO as described below setting the Trap 3 vector to point to the main BIOS entry point and then exiting with an rts Function 0 returns a longword value The CCP uses this value to set the initial user number and the initial default disk drive The least significant byte of DO is the disk number 0 for drive A 1 for drive B and so on The next most significant byte is the
111. tion 10 turn key systems 51 U UDC 49 user interface 4 W warm boot 47 word 1 word 16 bit value 40 42 word references 36 X XLT 40 124
112. tion of memory above the 68000 exception vector area OH to 3FFH The remainder of the address space is available for applications programs and is called the transient program area TPA Several terms used throughout this manual are defined in Table 1 1 Table 1 1 CP M 68K Terms Term Meaning nibble 4 bit half byte byte 8 bit value word 16 bit value longword 32 bit value address 32 bit identifier of a storage location offset a value defining an address in storage a fixed displacement from some other address 1 1 Introduction Term text segment data segment block storage segment bss absolute relocatable CP M 68K System Guide Table 1 1 continued Meaning program section containing machine instructions program section containing initialized data program section containing uninitialized data describes a program which must reside at a fixed memory address describes a program which includes relocation information so it can be loaded into memory at any address The CP M 68K programming model is described in detail in the CP M 68K Operating System Programmer s Guide To summarize that model briefly CP M 68K supports four segments within a program text data block storage segment bss and stack When a program is loaded CP M 68K allocates space for all four segments in the TPA and loads the text and data segments transient program may manage free memory using values stored by CP M 68K in its base
113. to the table with the logical sector number yields the corresponding physical sector number 41 5 2 Disk Definition Tables CP M 68K System Guide Although you may choose any convenient logical to physical mapping there is a nearly universal mapping used in the CP M community for single sided single density 8 inch diskettes That mapping is shown in Figure 5 2 Because your choice of mapping affects diskette compatibility between different systems the mapping of Figure 5 2 is strongly recommended Logical Sector 0 1 2 456 7 89101112 Physical Sector 3 5 1 3 7 1319 25 5 1117 233 9 1521 Logical Sector 13 14 15 16 17 18 19 20 2122 23 24 25 Physical Sector 2 8 14 20 26 6 12 18 24 4 10 16 22 Figure 5 2 Sample Sector Translate Table 5 2 3 Disk Parameter Block A Disk Parameter Block DPB defines several characteristics associated with a particular disk drive Among them are the size of the drive the number of sectors per track the amount of directory space and others A Disk Parameter Block can be used in one or more DPH s if the disks are identical in definition A discussion of the fields of the DPB follows the format description The format of the DPB is shown in Figure 5 3 SPT BSH BLM EXM 0 DSM DRM Reserved CKS OFF 16b 8b 8b 8b 8b 16b 16b 16b 16b 6b Figure 5 3 Disk Parameter Block Each field is a word 16 bit or a byte 8 bit value The description of each field is given in Table 5 2 Table 5 2 Disk Parameter Block
114. troyed by the BIOS on exit The BDOS does not depend on the BIOS to preserve the contents of data or address registers Of course if the BIOS uses interrupts to service 1 O the interrupt handlers will need to preserve registers Usually user applications do not need to make direct use of BIOS functions However when access to the BIOS is required by user software 1t should use the BDOS Direct BIOS Function Call 50 instead of calling the BIOS with a TRAP 3 instruction This rule ensures that applications remain compatible with future systems The Disk Parameter Header DPH and Disk Parameter Block DPB formats have changed slightly from previous CP M versions to accommodate the 68000 s 32 bit addresses The formats are described in Section 5 13 4 1 Introduction CP M 68K System Guide Table 4 1 BIOS Register Usage Entry Parameters DO W function code D1 x first parameter D2 x second parameter Return Values DO B byte values 8 bits DO W word values 16 bits DO L longword values 32 bits The decimal BIOS function numbers and the functions they correspond to are listed in Table 4 2 Number OIA NWN HK NO NN BB BB e a a eK D LA a DOA DUN E LA LA Oo Table 4 2 BIOS Functions Function Initialization called for cold boot Warm Boot called for warm start Console Status check for console character ready Read Console Character In Write Console Character Out List write listing charac
115. ttrk 229 00000003 00 oldtrk dc b 0 track we were on 230 231 00000004 0000 sector dc w 0 232 00000006 00000000 dma dcl 0 233 0000000A 00 selcode dc b 0 drive select code 234 235 0000000B OA errcnt dc b 10 retry counter 236 237 238 disk parameter headers 239 240 0000000C 00000036 dph0 del xlt 241 00000010 0000 dc w 0 dummy 242 00000012 0000 de w 0 243 00000014 0000 de w 0 244 00000016 00000000 dc 1 dirbuf ptr to directory buffer 245 000000 1A 00000026 dc l dpb ptr to disk parameter block 246 0000001E 00000000 dcl 0 ptr to check vector 247 00000022 00000000 dcl 0 ptr to allocation vector 248 249 250 disk parameter block Listing C 1 continued Appendix C Sample Loader BIOS CP M 68K System Guide 251 252 00000026 001A dpb dcw 26 sectors per track 253 00000028 03 dc b 3 block shift 254 00000029 07 deb 7 block mask 255 0000002A 00 dcb 0 extent mask 256 0000002B 00 dc b 0 dummy fill 257 0000002C 00F2 dc w 242 disk size 258 0000002E 003F dc w 63 64 directory entries 259 00000030 C000 dc w c000 directory mask 260 00000032 0010 dc w 16 directory check size 261 00000034 0002 dew 2 track offset 262 263 sector translate table 264 265 00000036 01070D13 xlt dc b 1 7 13 19 266 0000003A 19050B11 dc b 25 5 11 17 267 0000003E 1703090F dc b 23 3 9 15 268 00000042 1502080E dc b 21 2 8 14 269 00000046 141A060C dc b 20 26 6 12
116. tunately due to a compiler bug these lines cannot be used Therefore the obscure code following them has been inserted sw With release 1 2 the structure init bug disappeared so Pete spt bsh blm exm jnk dsm drm al0 all cks off struct dpb dpb0 26 3 7 0 0 242 63 0 0 16 2 if I CTLTYPE struct dpb dpb2 32 5 31 1 0 3288 1023 0 0 256 43 endif 76 Apendix D EXORmacs BIOS CP M 68K System Guide iif MEMDSK struct dpb dpb3 32 4 15 0 0 191 63 0 0 0 0 Zendif fee eee ee ae ee Sector Translate Table for Floppy Disks fee eee ee ae ee BYTE xit 26 1 7 13 19 25 5 11 17 23 3 9 15 21 2 8 14 20 26 6 12 18 24 4 10 16 22 Y fee eee ee ae ee ee eek Disk Parameter Headers f Four disks are defined dsk a diskno 0 Motorola s fd04 if CTLTYPE 0 dsk b diskno 1 Motorola s fd05 dsk c diskno 2 Motorola s hd00 dsk d diskno 3 Motorola s hd01 f Two disks are defined dsk a diskno 0 Motorola s fd00 if CTLTYPE 1 dsk b diskno 1 Motorola s fd01 f fee eee ee ae ee if LOADER Disk Parameter Headers struct dph dphtab f amp xlt 0 0 0 amp dirbuf amp dpbO amp csv0 amp alv0 dsk a amp xlt 0 0 0 amp dirbuf amp dpbO amp csvl amp alv13 dsk b Zif CTLTYPE OL 0 0 0 amp dirbuf amp dpb2 amp c
117. unctions CP M 68K Logical Device Characteristics I O Byte Field Definitions Disk Parameter Header Elements Disk Parameter Block Fields BSH and BLM Values EXM Values Distribution Disk Contents S Record Field Contents S Record Types CP M 68K Error Messages CP M 68K Interfaces Typical CP M 68K Memory Layout Memory Region Table Format T O Byte Fields Disk Parameter Header Sample Sector Translate Table Disk Parameter Block S Reference Fields 14 14 33 34 40 42 44 45 55 107 109 109 32 34 40 42 42 107 Section 1 System Overview 1 1 Introduction CP M 68K is a single user general purpose operating system for microcomputers based on the Motorola MC68000 or equivalent microprocessor chip It is designed to be adaptable to almost any hardware environment and can be readily customized for particular hardware systems CP M 68K is equivalent to other CP M systems with changes dictated by the 68000 architecture In particular CP M 68K supports the very large address space of the 68000 family The CP M 68K file system is upwardly compatible with CP M 80 version 2 2 and CP M 86 Version 1 1 The CP M 68K file structure allows files of up to 32 megabytes per file CP M 68K supports from one to sixteen disk drives with as many as 512 megabytes per drive The entire CP M 68K operating system resides in memory at all times and is not reloaded at a warm start CP M 68K can be configured to reside in any por

Download Pdf Manuals

image

Related Search

Related Contents

ViaLite Alarm Concentrator User Manual (LAC-HB-5)  お客様各位 高所作業車のバスケット荷重検出装置の不具合について  Manual del Usuario (ESTUDIANTE)  SucheBiete Kleinanzeigenzeitung Castrop Rauxel  Dotworkz BR-ACC1  93.21 Manual  Ficha del Servicio - Wiki-SIC - Junta de Comunidades de Castilla  Philips FWD831 User's Manual  vivicam tdc35 - Copyright © michel  Vélos de cycling CycleOps Pro Series  

Copyright © All rights reserved.
Failed to retrieve file