Chapter 2

THE SYSTEM INTERFACE

The operating system of the PX-8 is an expanded version of the CP/M operat-ing system, version 2.2. This chapter deals with the more advanced aspects of using the PX-8 and will be of more use to programmers than any other users. It contains information on subroutines which can handle peripheral devices and files. Familiarity with assembler programming is a prerequisite for using these subroutines and functions. You must purchase an assembler such as MACRO-80 and other program development tools from your dealer for using these BDOS and BIOS subroutines.

Users who are not interested in assembler programming may skip this chapter.

Further information on the operating system will be published as a separate manual. 5.1 The CP/M Configuration

CP/M Configuration Block diagram

page 5-1


5.2 The IOBYTE

The PX-8 operating system supports 4 logical I/0 devices, CON:, RDR:, PUN: and LST: as described in Chapter 3. In order to make it easy for the user, the CP/M Utilities STAT enable devices to be assigned using these names.

In software terms the logical and physical devices are assigned using the ad-dress 0003H in the main memory bank which contains a byte whose contents decide the logical to physical device assignments. This byte is known as the IO-BYTE. The contents of the IOBYTE assigns the logical to physical devices as shown in the following table. Table 5.1 Logical device LST: PUN: RDR: CON: Bit position 7 or 6 5 or 4 3or2 1 or 0 Direction Hit pair Output Output Input Output Input value (Binary) 00 (printer) Keyboard RS-232C Keyboard 01 LCD LCD ’LCD ”Keyboard 10 *RS-232C *RS-232C “RS-232C LCD RS-232C 11 RS-232C RS-232C

The default setting of the IOBYTE is 10101001. (Hexadecimal A9) This gives the default assignments as shown by the asterisks in the table. Further information on the assignments can be found in Chapter 3, sections 3.6 and 3.8.

page 5-2


5.3 The File Control Block (FCB)

r During file operations, the operating system obtains file information from a table called the file control block (FCB). The information included in the FCB is as shown below. DrF1F2 // FST1T2T3Ex S1S2RcDO // D1 Cr RORl R2 000102 ... 08 09 10 1112 13 14 15 16 ... 31 323334 35 Dr: Decimal Drive code 0: use logged-in drive 1: use Drive A: 2: use Drive B: 3: use Drive C: 4: use Drive D: 5: use Drive E: 6: use Drive F: 7: use Drive G: 8: use Drive H: the microcassette drive F1 – F8: contain the file name in upper case ASCII T1 – T3: contain the file type in upper case ASCII Ex: Current extent number S1: Reserved for system S2: Reserved for system Rc: Record count DO – D15: Assigned by operating system. Cr: Record counter RO – R2: Random access record counter Fig. 5.2

The CCP provides a FCB in the system work area which is called a TFCB (tem-porary FCB); this is used as the default FCB.

page 5-3


5-3 5.4 BDOS Function Calls

BDOS includes many utility subroutines which input or output data to and from peripherals and handle files. These subroutines are referred to as BDOS func-tions, and can easily be used in your own programs as shown below. There are 39 BDOS functions which can be utilised; any of these can be used by calling address 0005H with a function number in register C and a parameter in register pair DE. Single byte values will be returned in register A while double byte values are returned in register pair HL.

The BDOS functions are listed below. In this list, the ent.ry parameters are those which are passed to BDOS from the user program which calls the function, and the return parameters are those which are passed to the user program from the function called. 5-4

page 5-4


iaoie v.Ώ Function No. Explanation Entry Parameter Returned value 0 This function returns control to C: OOH the CP/M command level. 1 This function reads a character C: 01K A: Read character from CON: 2 This function outputs a charac- C: 02H ter to CON: E: Character to be output 3 This function reads a character C: 03H A: Read character from RDR: 4 This function outputs a charac- C: 04H ter to PUN: E: Character to be output 5 This function outputs a charac- C: 05H ter to LST: E: Character to be output 6 This function provides direct C: 06H console input and output opera- E: For input, A: For input, the character tion. It bypasses all CP/M nor- OFFH read OOH is returned when mal control character functions For output, the CON: is not ready. such as "CTRL" + "P.". character to be output. 7 This function returns the current C; 07H A: Contents of IOBYTE canter,ts of IOBYTE. 8 This function sets a new value in C: 08H IOBYTE. E: Value to be set in IOBYTE 9 This function outputs the C: 09H character string starting at the DE; Starting ad- specified address and ending dress of the with "$" to CON: memory area in which the cha-racter string is stored 10 This function reads a character C: OAH Buffer: Character string read string from CON: into the buf- DE: Starting ad- from CON: fer area starting at the specified dress sf the buf- address. fer area 11 This function reads the status of C: OBH A: CON: status FFH – CON: CON: ready OOH – CON: not ready 12 This function returns the version C: OCH H: CP/M or MP/M number of the CP/M system L: Version number currently in use. 13 This function sets all disks to C: ODH read/write, selects drive A and sets the default DMA address to 0080H. 14 This function selects the C: OEH specified disk drive. E: Name of drive to be selected (Continued)

page 5-5


Function No. Explanation Entry Parameter Returned value 15 This function opens a file. C: OFH A: Directory code DE: FCB address OFFH when the file cannot be Positions 1 found. through14must This function fills the FCB in contain the the main memory with the name of the file contents of the corresponding to be opened. FCB in the directory stored on the disk. 16 This function closes a file. C: 10H A: Directory code DE: FCB address OFFH when the file cannot be found. This function writes the con-tents of the FCB in the main memory to the directory on the disk. 17 This function searches for a file. C: 11H A: Directory code DE: FCB ad- OFFH when the file cannot be dress found. 18 This function is used following C: 12H A: Directory code function 17 to find the file OFFH when the file cannot be whose name matches that found. specified. 19 This function deletes the C: 13H A: Directory code specified file. DE: FCB address OFFH when the file cannot be found. 20 This function reads the next C: 14H A: OOH when the read opera- record from the file into memory DE: FCB address tion is completed. at the current DMA address. Other than OOH when the next record contains no data. 21 This function writes 128 bytes C: 15H A: OOH when the write opera- of data at the current DMA ad- DE: FCB address tion is completed. dress to a record of the file Other than OOH when the disk specified by the FCB. is full. 22 This function generates a new C: 16H A: Directory code file and catalogs it in the direc- DE: FCB address OFFH when the directory is tory. full. 23 This function changes the file C: 17H A: Directory code name. DE: FCB OFFH when the file cannot be found 24 This function returns the log-in C: 18H HL: Log-in vector vector which indicates drives The least significant bit of L which are currently on line. corresponds to drive A and the most significant bit.of H cor-responds to drive P. A "1" bi indicates that the correspon-ding drive is on line. A: Contains the same value as register L. 25 This function returns the cur- C: 19H A: Currently logged-in drive rently logged-in drive. 01H – Drive A 02H – Drive B 05H – Drive E 06H – Drive F (Continued)

page 5-6


Function No. Explanation Entry Parameter Return Parameter 26 This function changes the DMA C: IAH address. DE: DMA ad- dress 27 This function returns the base C: IBH HL: ALLOC address address of the allocation vector. 28 This function sets the read only C: 1CH attribute for the currently logged-in drive. 29 This function returns the R/0 C: 1DH HL: R/0 vector vector which indicates drives which are set to read only. 30 This function sets the file at- C: IEH A: Directory code tributes. The R/O and system at- DE: FCB address A: FFH (no filets tributes can be set or reset with this function. 31 This function returns the BIOS C: 1FH HL: DPB address resident disk parameter block (DPBl. 32 This function sets or gets the C: 20H A: User number (GETS user number. E: OFFH for get E: User code for set 33 This function is similar to func- C: 21H A: Return code tion 20; however, a particular DE: FCB address OOH – Normal completion record is read according to the Non-zero – Abnormal comple- contents of positions RO tion through R2 in the FCB. 34 This function is initiated similarly C: 22H A: Return code to function 33. However, the DE: FCB address OOH – Normal completion data at the DMA address is writ- Non-zero – Abnormal comple- ten to the disk. tion 35 This function returns the virtual C: 23H file size to the random record DE: FCB address bytes IRO to R2l of the FCB. 36 This function returns the ran- C: 24H dam record position to the ran- DE: FCB address dom record bytes of the FCB after a series of sequential reads or writes. 37 This function resets the C: 25H A; OOH specified drives according to the DE: Drive vector 16-bit drive vector indicating drives to be reset; the least significant bit of the vector cor- responds to drive A, and so forth. 40 This function is similar to func- C: 28H A: Return code tion 34. However, the data writ- DE: FCB address OOH – Normal completion ten is all OOH.

page 5-7


5.5 Zero Page Locations

CP/M holds a number of parameters in page zero of the main memory bank. The IOBYTE (section 5.2) is held in location 3H. The following are important locations in page zero. Further information is included in the books referred to in Chapter 3, and other such books. Location in hex Contents from to 0000 0002 A jump instruction followed by the warm start entry address. Thus locations 0001 and 0002 contain WBOOT. 0003 The IOBYTE. See section 5.2 for further details. 0004 The current default drive number (0=A:, 1 = B: etc.) 0005 0007 A jump instruction followed by the loca- tion of BDOS. Thus locations 006 and 007 contain the lowest address used by CP/M.

page 5-8


,Ώ 5.6 The BIOS Interface

The Basic Input/Output System (the BIOS) of the operating system for the PX-8 includes many useful subroutines which can be used by calling their entry ad-dresses from user programs after setting parameters (if required) in applicable registers. Care must be taken to ensure that the entry addresses are correctly specified when calling these subroutines.

page 5-9


5.7 The Entry Address of the BIOS Subroutines

Table 5.3 lists the entry addresses of BIOS subroutines.

Since the BIOS routines are relocatable, the entry addresses of BIOS suhrou-tines are indicated relative to the warm boot routine (WBOOT) address. The WBOOT address can be found from locations 0001 and 0002 in page zero. Table 5.3 ADDRESS ENTRY NAME ADDRESS ENTRY NAME WBOOT – 03H BOOT + 45H RSIN WBOOT WBOOT + 48H RSOUT WROOT +03H CONST + 4BH TIMDAT + 06H CONIN + 4EH MEMORY + 51H RSIOX + 09H CONOUT + OCH LIST + 54H LIGHTPEN + OFH PUNCH + 57H MASKI + 12H READER + 5AH LOADX +5DH STORX + 15H HOME + 18H SELDSK + 60H LDIRX + 1BH SETTRK + 63H JUMPX + 1EH SETSEC + 66H CALLX + 69H GETPFK + 21H SETDMA + 24H READ + 6CH PUTPFK + 27H WRITE + 6FH ADCVRT + 2AH LISTST + 72H SLAVE + 75H RDVRAM + 2DH SECTRAN + 78H MCMTX + 30H PSET + 33H SCRNDUMP + 7HH POWEROFF +36H BEEP + 7EH USERBIOS e 39H RSOPEN + 3CH RSCLOSE + 3FH RSINST + 42H RSOUTST 5.7.1 Functions of BIOS subroutines

In the following explanations, entry parameters are those which must be as-signed by user programs calling the BIOS routines. The contents of registers other than those to which the system returns parameters may be changed un-less otherwise specified.

page 5-10


5.7.2 Subroutines concerned with power-up and initialization Entry Point: WBOOT – 03H

BOOT is the entry point for the cold start loader, which runs only when system initialization is made or the 7508 sub-CPU is reset or SHIFT + Ώggppp keys are pressed together with RESET switch. This routine is not used by the user. Entry Point: See locations 0001H and 0002H in page zero.

The WBOOT location is used as the point from which all other BIOS routines are given in the following sections. WBOOT can alter if the configuration of the system changes, e.g. the RAM Disk size alters or the USER BIOS size changes.

WBOOT is the entry point for the warm start bootstrap; this routine loads CCP and BDOS into memory. The MENU or CCP module is activated after a warm start. Return Parameters: The currently selected drive is returned in register C. Entry Point: WBOOT + 7BH POWEROFF is the entry point for the subroutine which turns off the main system power supply, after saving the current status. Entry parameters Register C = 00H Sets continue mode when switching on. Register C = 01H Sets restart mode upon power-up. 5.7.3 BIOS subroutines for use with the console Entry Point: WBOOT + 03H

page 5-1


CONST is the entry point for the subroutine which reads the console status and sets it in register A. Return Parameter Register A = 00H Indicates that the console input buffer is empty. Register A = FFH Indicates that the console input buffer contains characters. Entry Point: WBOOT + 06H CONIN is the entry point for the subroutine which enables a character to be input from the keyboard. It loops indefinitely until a character is entered when the buffer is empty. Because it is also possible to press the Programmable Func-tion keys, special provision is made for them as follows. Return Parameters Register A contains the ASCII code of the input character if a key other than a PF. key is pressed. Th'e FUNKFLG (address F108H) setting determines the contents of register A when a PF key is pressed. If FUNKFLG is set to FFH, registers A and C contain the following data: Register C Register A Code returned by the PF keys Code as in table PF key pressed FFH f Ώ g f PF1 EOH PF6 ESH PF2 E1H PF7 E6H PF3 E2H PFS E7H pressed 00H ASCII code PF4 E3H PF9 ESH PF5 E4H PF10 E9H If FUNCFLG is not set to FFH (normally it will be 0), then register A will con-tain the ASCII code of the key pressed if a key other than a PF key is pressed, and will contain the first character of the PF key string if a PF key is pressed. Continuous polling of the keyboard will cause the other characters to be en-tered from the PF key string as if they were typed from the keyboard. · e Entry Point." WBOOT + 09H

page 5-12


CONOUT is the entry point for the subroutine which outputs a character to the console from register C. Note that a number of functions can be obtained by using the control codes in Appendix E and also the ESC control sequences in Appendix A. Entry parameter Register C = ASCII code of character to be output to the console 5.7.4 BIOS subroutines for use with devices 0' Entry point: WBOOT + OCH LIST is the entry point for the subroutine which outputs a character to the log-ical device LST:. It will be output if both DSR and TxRDY are “1”, otherwise will wait until these condiiions are satisfied. Entry parameter Register C = ASCII code of character to be output to LST: gggg Entry Point: WBOOT + OFH PUNCH is the entry point for the subroutine which outputs a character to the logical device PUN:. Entry parameter Register C = ASCII code of character to be output · · · -g Entry Point: WBOOT + 12H READER is the entry point for the subroutine which reads a character from the logical device RDR:. This subroutine loops until a character is input. Return Parameter Register A = ASCII code of character input from RDR:

page 5-13


Entry Point: WBOOT + 2AH LISTST is the entry point for the subroutine which reads the status of the logi-cal device LST:. Return Parameter Register A = 00H Indicates that LST: is busy. Register A = FFH Indicates that LST: is ready. This subroutine returns FFH when DSR = 1; otherwise, it returns 00H. GETPFK is the entry point for the subroutine which accesses the character strings assigned to the PF keys. Entry Point: WBOOT + 69H Entry parameters Register C = PF key number -1 (i.e. 0 to 9 for keys 1 to 10) Register HL = Starting address of the character string buffer Result The format of the character string buffer is as follows. No. of characters Character 1 Character 2 Character 15 (HL) Whether or not any of the PF keys has been pressed can be determined using the CONST and CONIN routines. The maximum capacity of the character string buffer is 15 characters. The contents of r.egister pair HL are not affected by execution of this routine. a- PUTPFK is the entry point for the subroutine which assigns a character string to the PF keys.

page 5-14


Entry Point: WBOOT + 6CH Entry parameters Register C = PF key number – 1 (i.e. 0 to 9 for keys 1 to 10) Register HL = Starting address of the character string buffer The format of the character string buffer is as follows. No. of characters Character 1 Character 2 Character 15 (HL) A maximum of 15 characters can be assigned to one PF key. The contents of register pair HL are not affected by execution of this routine. IZEi Entry Point: WBOOT + 30H PSET is the entry point for the subroutine which replaces graphic screen data at a specified address in accordance with a specified logical operation. The graph-ics screen is sequential in memory, with each dot corresponding to one bit. The graphic screen memory starts at 8380H and has a length of FOOH bytes. Each byte thus corresponds to eight dots across the screen. Since there are 480 dots, the second row of the screen starts at byte 83BC. Logical operation is required if individual bytes need to be set. Entry parameters Register B = Data Register C = 1 (AND) C = 2 (OR) C = 3 (XOR) C = Others (NOP) Register HL = graphic screen address Return Parameters Register A = 00H – Normal completion Register A = FFH – Character screen mode

page 5-15


Register A = other than 00H and FFH – Indicates that the address in HL is not within the VRAM area. The contents of register B and register pair HL are not changed. Entry Point: WBOOT + 33H SCRNDUMP is the entry point for the subroutine which prints a hard copy of the LCD screen image on the printer. It is terminated by pressing the CTRL-STOP key. Return Parameters F67EH (LSTERR) = 00H – normal operation F67EH (LSTERR) = FFH – Terminated by CTRL-STOP 5.7.5 BIOS subroutines related to the disk operation Entry Point: WBOOT + 15H HOME is the entry point for the subroutine which sets the track to zero. Entry Point: %BOOT + 18H SELDSK is the entry point for the subroutine which specifies a disk drive. Entry parameter Register C = 00H Drive A: Register C = 01H Drive B: Register C = 02H Drive C: Register C = 03H Drive D: Register C = 04H Drive E: Register C = 05H Drive F: Register C = 06H Drive G: Register C = 07H Drive H: HL register includes the disk parameter header address.

page 5-16


Return Parameters Register HL = 00H Indicates that a parameter error has occurred. Register HL is not 00H Normal operation f · Entry Point: WBOOT + 1BH SETTRK is the entry point for the subroutine which selects the track to be read from or written to. Entry parameter Register BC = Track number The track number varies according to the drive as shown below. It can be any number from zero to that shown in the following table: Drive Default Track number Default Device A: 0 to 1 (Max. 2) Internal RAM disk 0to6 60K RAM Disk Unit to 13 120K RAM Disk Unit B: 0to3 ROM 1 (32K ROM) C: ROM 2 (32K ROM) D: FDD 1 E: FDD 2 F: 0 to 39 FDD 2 6: FDD 4 H: 0 to 4 Microcassette drive If a value which is not within the above range is specified, an error occurs when a read or write is performed. These values assume that the default settings for the drive assignments hold. See section 3.8.6 for further details of drive as-signments. NOTE: Maximum track number changes in accordance with the sign of RAM disk set by CONFIG. U%RRQ Entry Point: WBOOT + 1EH

page 5-17


SETSEC is the entry point for the subroutine which sets the sector number to be read from or written to. Entry parameter Register BC = Sector number to be accessed (00H – 3FH) If a value other than 00H to 3FH is specified, an error will occur when a read or write is performed. Entry Point: WBOOT + 21H SETDMA is the entry point for the subroutine which sets the starting address of the 128 byte DMA buffer area used for disk access. Entry parameter Register BC = DMA address UZI Entry Point: WBOOT + 24H READ is the entry point for the subroutine which reads data from a disk drive into the DMA buffer according to parameters set by the SELDSK, SETTRK, SETSEC and SETDMA subroutines. Return Parameter Register A = 0 Normal completion Register A = Other than 0 Abnormal completion EKER Entry Point: WBOOT + 27H WRITE is the entry point for the subroutine which writes data to a disk drive according to parameters set by the SELDSK, SETTRK, SETSEC and SETD-MA subroutines. Entry parameter Register C = 00H Write standard format data. Register C = 01H Write unblocked data. Register C = 02H Write sequential file.

page 5-18


Return Parameter Register A = 00H Normal completion Register A = Other than 00H Abnormal completion egg Entry Point: WBOOT + 2DH SECTRAN is the entry point for the subroutine which converts a logical sector number into the corresponding physical sector number. Entry parameters Register BC = Logical sector number Register HL = Physical sector number DISKTBL AND DISKROV – CHANGING DRIVES The CONFIG program enables the logical and physical drives to be assigned in three ways. It is not possible to have the Microcassette Drive assigned to any drive other than drive H:. The logical and physical drives are assigned in a ta-ble of 7 bytes in length beginning at address F1D2H (DISKTBL). The table at default contains the following data: Address Logical Drive Code Physical Drive F1D2H A: 00 RAM Disk F1D3H B: 01 ROM Capsule 1 F1D4H C: 02 ROM Capsule 2 F1D5H D: 03 Floppy Disk Drive 1 F1D6H E: 04 Floppy Disk Drive 2 F1D7H F: 05 Floppy Disk Drive 3 F1D8H 6: 06 Floppy Disk Drive 4 If the code 07H to FFH is contained in this table, the drive cannot be selected. If the table is changed, the two bytes at address F1DAH (DISKROV) must also be changed. This is the vector table which sets the READ/WRITE status of the drives. If the corresponding bit is “1” the drive is set to R/0, and if to R/W it is set to “0”. F1DAH (DISKROV) includes the drive in the following order. bit 7 6 5 4 3 2 1 0 H: G: F: E: D: C: B: A:

page 5-19


NOTE: Please not that device assignments changed by this address may not be reflected in CONFIG main menu 5. Do not set the same value as the code. 5.7.6 BIOS subroutine for the speaker gg Entry Point: WBOOT + 36H BEEP is the entry point for the subroutine which sounds the speaker. Entry parameters Register C = 0 turns the speaker off. C = 1 to FF The speaker sounds for an interval of [C] x 0.1 secs Register DE sets the frequency of the sound according to the expression: (DE) – 3.2 x Frequency (Hz) 5.7.7 BIOS subroutines for the RS232 port The following routines can be used to operate the RS-232C interface. Details of the RS-232C interface are given in Chapter 4. The interface supports all commonly used transmission rates, up to 19,200 bps. In general it is not possible to transmit and receive at different rates. Since some databases (e.g. the European Videotext databases) use 75 bps transmit and 1200 bps receive this option is available together with the reverse 1200 bps trans-mit/75 bps receive. The interface is initialized using the RSIOX routine, but can also be initialized by BASIC and partially by the CONFIG program. The operating system uses a 261 byte buffer. Characters overflowing this buffer are lost. The size of the buffer can be increased by the RSIOX routine. The interface should be opened before attempting to send data. The interface also supports XON/XOFF and SI/SO in communication. These are described in Chapter 4.

page 5-20


The SI/SO function only applies in 7 bit transmission. When SI/SO = 1, no action is taken. When SI/SO = 0, if a SI character (OFH) is received, subsequent characters will have a “0” added as the MSB to complete the byte. When SI/SO = 0, if a SO character (OEH) is received, subsequent characters in the range 20H to 7EH will have a “1” added as the MSB to complete the byte. Characters 00H to 1FH and character 7FH will remain unchanged. The XON/XOFF protocol allows the receiving device to tell the sender to wait while it catches up on processing. When XON/XOFF = 1 no action is taken. When XON/XOFF = 0 a transmission off character CTRL-S (13H) is sent when the buffer becomes more than three-quarters full, so that processing can catch up. A transmission on character CTRL-Q (011H) is sent when the buffer be-comes less than one-quarter full, so that transmission can begin again. This makes it possible to prevent the buffer overflowing and the loss of characters. Entry Point: WBOOT + 39H RSOPEN is the entry point for the subroutine which initializes the RS232C in-terface for communication according to the conditions set with the CONFIG program. This subroutine turns on the power supply to the RS-232C interface (and the serial interface) and performs processing to prevent noise from being output over the line. When this routine is called, the former RS-232C condi-tions are reset; therefore, any data remaining in the receive buffer at the time of the call is lost. Entry Point: WBOOT + 3CH RSCLOSE is the entry point for the subroutine which disables communication through the RS232C interface. IZRi Entry Point: WBOOT + 3FH

page 5-21


RSINST is the entry point for the subroutine which checks whether any charac-ters have been received. Return Parameters Register A = 00H No data received Register A = FFH Data received Entry Point: WBOOT + 42H RSOUTST is the entry point for the subroutine which checks whether trans-mission is enabled. Return Parameters Register A = 00H Transmission disabled Register A = FFH Transmission enabled EKI Entry Point: WBOOT + 45H RSIN is the entry point for the subroutine which receives one character. When the receive buffer is empty, it waits until data is received. Return Parameter Register A = Character received Z Flag = 01H Normal completion Z Flag = 00H CTRL-STOP was used to terminate transmission. Entry Point: WBOOT + 48H RSOUT is the entry point for the subroutine which outputs a character via the RS232C interface. Entry parameter Register C = ASCII code of character to be sent. Z Flag = 01H Normal completion Z Flag = 00H OCTAL - Ώsrov was used to terminate transmission. Buffer address and size are as specified by the user with the RSOPEN routine.

page 5-23


,' NOTE: l RSOPEN must be called to open the RS232C port before RSIN or RSOUT is called. · e Entry Point: WBOOT + 51H RSIOX is the entry point for the subroutine which determines the I/0 configu-ration via the RS-232C interface and opens or closes the interface. The func-tions of this subroutine are explained below. RSIOX (OPEN) Function: Opens the RS232C interface Entry parameters Register B = 10H Register HL= Parameter block address The contents of the parameter block are shown below. (HL) Ώ Buffer Address (2B) Receive Buffer Buffer Size l2Bl Bit Rate (0 - 0FH, 1B) 0FH = 19200 0EH = 9600 Bit/CHAR (1B) 0DH = 4800 0CH = 2400 Parity (1Bl BAH = 1200 STOP Bit I1B) 8 = 800 Special Para. (1B) 4 = 150 2 = 110 = 2 7 Bit/Chara. = 3 8 Bit/Chara. 81H = 75/1200 (Tx/Rxl 80H = 1200/75 (Tx/Rxl = 0 No Parity Normally set tv 0FFH. 1 Odd Parity 6 5 4 3 2 0 = 3 Even Parity ΏDTR ON RTS ON S I/SO =3 2bit XON/XOFF

page 5-23


Return parameters Register A = 00H Normal open Zflag = 1 A = 02H Busy (i.e., used by another program) Z flag = 0 A = 04H Parameter error Zflag = 0 Register HL contents are not changed Ώ7 6 5 4 3 2 1 0 (HL) Ώ Flag (1B) ΏOpen GET Pointer (2B) Get data Receive buffer full PUT Pointer (2B) Buffer Addr. (2B)” DCD Parity error Buffer Size (2B)" Receive over run Framing error DSR RSIOX (CLOSE) Function: Closes the RS232C interface. Entry parameter Register B = 20H RSIOX (INSTS) Function: Checks whether there is any data in the receive buffer. Entry parameters Register B = 30H Register HL= 9 byte block address which is used to store return information. Return parameters Z flag = 01H Normal completion Register A = 00H No data in the receive buffer A = FFH Data has been received Register BC = LOC – Number of bytes of received data Register HL = Return information (See Open) NOTE: The meaning of LOC relates to the value of PUT(Pointer) and GET(Pointer) (see diagram under RSIOX' (OPEN)).

page 5-24


If PUTP Ώ GETP then LOC = PUTP – GETP If PUTP < GETP then LOC = PUTP – GETP + Buffer size Z flag = 0 Abnormal end Register A = 03H – Interface not open Register BC Unknown Register HL Unknown RSIOX (OUTST) Function: Checks whether output is enabled. Entry parameters Register B = 40H Register HL = Address of the block which is used to store reurn information Return parameters Z flag = 1 Normal completion Register A = 00H Output disabled Register A = FFH Output enabled Z flag = 0 Abnormal end Register A = 03H Interface not open Register HL = Not changed (For the HL contents, refer to the OPEN function.) RSIOX (GET) Function: Reads in one byte of data from the receive buffer. Entry parameters Register B = 50H Register HL= Starting address of the block which is used to store return in-formation Return parameters Z flag = 1 Normal completion Register A = Receive data Register HL= Refer to the OPEN function. Z flag = 0 Abnormal end Register A = 03H Interface not open A = 00H CTRL-STOP was pressed Register H L= not changed

page 5-25


RSIOX pUT) Function: Sends one byte of data. Entry parameters Register B = 60H Register C = Send data Register HL= Address of the block which is used to store return information Return parameters Z flag = 1 Normal completion Register HL= Refer to the OPEN function. Z flag = 0 Abnormal end Register A = 03H Interface not open A = 00H CTRL-STOP was pressed The contents of register HL is not changed. RSIOX (CTLIN) Function: Reads the status of the control line. Entry parameter Register B = 70H Return parameters Z flag = 1 Normal completion Register A shows the conditions of the control line flags as follows: 7 6 5 4 3 2 1 0 DCD status DRS status Z flag = 00H Abnormal end Register A = 03H Interface not open

page 5-26


RSIOX (SETCTL) Function: Sets the control lines. Entry parameters Register B = 80H Register C = Data to be set BIT 0 = DTR (H for “1” and L for “0”) BIT 1 = RTS (H for “1” and L for “0”) Return parameters Z flag = 1 Normal completion Z flag = 0 Abnormal end Register A = 3 Interface not open RSIOX (ERSTS) Function: Checks the error status and clears the error flags. Entry parameter Register B = 90H Return parameters Z flag = 1 Normal completion Register A contains the conditions of the control line flags 7 6 5 4 3 2 1 0 Receive buffer overflow DCD status Parity error Receive overrun Framing error DSR status Z flag = 00H Abnorinal end Register A = 03H Interface not open RSIOX (SENS) Function: Checks the status of the RS232C interface.

page 5-27


Entry parameter Register B = FOH Return parameters Z flag = 1 The RS232C interface can be opened. Z flag = 0 Busy (i.e., the port is being used by another program.) Register A = 02H 5.7.8 BIOS subroutines related to the clock Entry Point: WBOOT + 4BH TIMDAT is the entry point for the subroutine which has 6 functions relating to the clock (time and date), according to the contents of the C register. The TIMDAT routine also uses a series of bytes called the Time Descriptor to read or write the description of the time. There are a total of 11 bytes in the Time Descriptor, although not always all of them may be used by or for each func-tion. The date and time are coded in BCD. The order of the bytes are as follows. Year – 1 byte, 2 BCD digits Month – 1 byte, 2 BCD digits Day – 1 byte, 2 BCD digits Hour – 1 byte, 2 BCD digits Minute – 1 byte, 2 BCD digits Second – 1 byte, 2 BCD digits Day of week – 1 byte (0= Sunday, 6= Saturday) Type – 1 byte (0 = none, 1 = alarm, 2 = wake, 3 = wake subroutine). Address – 2 bytes (message address for alarm if type= 1, wake string address if type=2 or subroutine address if type = 3). Alarm – 1 byte (0 = alarm not sounded, 1 = alarm sounded). It is important to make sure that the number of bytes of the Time Descriptor required by the function are in fact present. It is also important that the order described above is adhered to. TIMDAT (READ TIME) Function: Reads the time and sets data in time descriptor address.

page 5-28


Entry parameters Register C = 00H – Time read function Register DE = Starting address for 7 bytes of Time Descriptor information Return Parameters The contents of register pair DE are not changed. The Year Month Day Weekday and time are placed in memory starting at the address placed in the DE register. TIMDAT (SET TIME) Function: Allows the date, weekday and time to be set. If any bytes of the Time Descriptor are set to FFH they will not be updated. It is also up to the programmer to check the contents of the Time Descriptor before calling this routine as no checks are made. Entry Parameters Register C = FFH – set time Register DE = starting address of the 7 bytes of the Time Descriptor TIMDAT (ALARM ENABI.E) Function: Enables the alarm/wake function. Entry parameter Register C = 80H – Alarm enable TIMDAT (ALARM DISABLE) Function: Disables the alarm/wake function. Entry parameter Register C = 81H – Alarm disable TIMDAT (SET ALARM) Function: Sets the alarm/wake time, whether it is an alarm or a wake function and the address of the location of the message/wake string. The time can be set in increments of 10 seconds. If the byte OFH is specified, applicable digits will be regarded as wild-card positions. For example, setting FH for the year, month, and day will cause the alarm/wake function to operate at the specified hour, minute, and second every day.

page 5-29


Entry parameters Register C = 82H – Alarm set Register DE = Time descriptor address 10 bytes including message string address. Return Parameters The contents of register pair DE are not changed. TIMDAT (READ ALARM) Function: Reads the Time Descriptor into the address required. Note that the year byte (byte 1) will contain FFH and the seconds byte (byte 6) contains FH in the lowest nibble (lowest 4 bits). This is because neither the year nor the 1s place of the seconds (i.e. it can only be set in 10 second intervals) is relevant for alarm setting. Entry parameters Register C = 84H Register DE = Starting address to load the 11 bytes of the Time Descriptor 5.7.9 BIOS subroutines related to the serial port The Serial Port is not supported by the BIOS. 5.7.10 BIOS subroutines related to memory The memory of the PX-8 consists of 64K bytes of RAM and 32K of ROM. By means of bank switching it is possible to read addresses 0000H to 7FFFH from either RAM or ROM. In the following routines when references are made to system bank and user bank they correspond to addresses as follows: System bank: 0000H to 7FFF (ROM) 8000H to FFFF (RAM) User bank: 0000H to FFFF (RAM)

page 5-30


LOADX is the entry point for the subroutine which reads 1 byte of data from the specified memory bank. Entry address: WBOOT + 5AH Entry parameters Register C = – 1 – System bank C = 0 – User bank Register HL= Data address Return Parameter Register A = Data read This routine does not change the contents of the other registers. OlZ< (Ordinarily, this entry is not used by the user.) STORX is the entry point for the subroutine which writes 1 byte of data into the user bank. Entry Point: WBOOT + 5DH Entry parameters Register C = 0 – User bank Register A = Data Register HL= Data address into which data is to be written. Return Parameters This routine will not change the contents of the other registers. · (Ordinarily, this entry is not used by the user.) LDIRX is the entry point for the subroutine which transfers data from the speci-fied memory bank to the uses bank. Entry Point: WBOOT + 60H Entry parameters Register HL= Starting address of the memory area from which data is transferred

page 5-31


Register DE = Starting address of the memory area to which data is trans- ferred Register BC = Number of bytes of data to be transferred Register A = 0 – Data is transferred to the user bank. The operating system ROM cannot be changed or modified using this routine. JUMPX is the entry point for the subroutine which jumps to the specified ad-dress in the specified memory bank. Entry Point: WBOOT + 63H Entry parameters Register IX = Jump address If Address F539H (DISBNK) = – 1 System bank If Address F539H (DISBNK) = 0 User bank NOTE: When a stack is to be used at the destination address, a new stack must be estab-lished. CALLX is the entry point for the subroutine which calls the specified address in the specified bank. Entry Point: WBOOT + 66H Entry parameters Register IX = Call address If Address F539H (DISBNK) = – 1 – System bank If Address F539H (DISBNK) = 0 – User bank NOTE: CALLA uses one level in the user stack. Therefore, the stack pointer must be used in the common area in RAM (8000H to OFFFFH), and there must be at least one free level of stack space.

page 5-32


SLAVE is the entry point for the subroutine which sends commands and data to the 6301 slave CPU and returns results and data from the slave. The use of this command is beyond the scope of this manual. Full details are shown in the OS Reference Manual and Technical Reference Manual. HEKI RDVRAM is the entry point for the subroutine which reads the contents of the virtual character screen. Entry Point: WBOOT + 75H Entry parameters Register B = Column at which the read is to start (1 to 80) Register C = Line at which the read is to start (1 to virtual screen line size) Register DE = Number of characters to be read Register HL = Starting address of the area in which data read is to be stored. Return Parameters Register A = 00H – Normal completion A = 01H – Read error A = FFH – Parameter error or graphic screen read attempted If the end of the screen is encountered before the specified number of charac-ters has been read, remaining addresses in the storage area are padded with spaces and 1 is returned in register A. 5.7.11 Miscellaneous subroutines Entry Point: WBOOT + 4EH This is not supported. It will simply RETURN.

page 5-33


IKCERR Entry Point: WBOOT + S4H This is not supported. It will simply RETURN. MASKI is the entry point for the subroutine which sets and resets interrupt masks. Entry Point". WBOOT + 57H Entry parameters Register B = 00H Interrupt disable B = 01H Interrupt enable B Ώ2 Interrupt enable register (IER) read Register C Bit 0 – 7508 C Bit 1 – 8251 C Bit 2 – DCD (RS-232C carrier detect) C Bit 3 – ICF (Input capture flag) C Bit 4 – OVF (Timer overflow) C Bit 5 – EXT (Interrupt from system bus) Return Parameters Register A = Contents of IER register (I/0 port 4) ADCVRT is the entry point for the subroutine which reads the A/D converter input, Bar Code reader, DIP switch settings, battery voltage, or power switch status. Entry Point: WBOOT + 6F Entry parameters RegisterC = 00H – A/D channel 1 (input from the analog jack) RegisterC = 01H – A/D channel 2 (input from the bar code reader con- nector) RegisterC = 02H – DIP SW1 RegisterC = 03H – Battery voltage RegisterC = 04H – Power switch status (TRIG status of the analog con- nector)

page 5-34


When any other value is set in register C, the routine returns without doing anything. Return Parameters When Register C contains 00H or 01H on calling ADCVRT Register A contains A/D converter data in the 6 MSB as follows: Bit 7 6 5 4 3 2 1 0 Data MSB LSB Bits 2 to 7 will all be 1 if the input voltage is greater than 2.0 V. If the input voltage is negative, bits 2 to 7 will all be 0. When Register C contains 2 on calling ADCVRT Register A contains contains the Switch information as follows. Bit 7 6 5 4 3 2 1 0 SW 8 7 6 5 4 3 2 1 When Register C contains 3 on calling ADCVRT Register A contains data from the A/D converter Full scale = 5.7 V When register C contains 4 on calling ADCVRT Register A, bit 0=1 – Power switch ON Register A, bit 0= 0 – Power switch OFF Register A, bit 1 = 1 – TRIG ON Register A, bit 1 = 0 – TRIG OFF

page 5-35


5.7.12 Subroutines for using the Microeassette Drive MCMTX is the entry point for the subroutine which calls the MTOS functions. Entry point: WBOOT + 78H The use of this routine is similar to using a BDOS function call. Full details are given in the OS reference manual. 5.7.13 Subroutines for the USER BIOS The BIOS can be extended to include routines which are not supported by CP/M. 0 Entry Point: WBOOT + 7EH USERBIOS is the routine which allows USER BIOS entry points to be changed. The table of entry points is reinitialized if a reset is carried out or the system is initialized. Thus it is necessary to reload the USER BIOS entry points if any type of reset is carried out. The use of the USER BIOS is explained in the OS Reference Manual.

page 5-36