Input functions
Output functions
Floppy disk functions
Conversion functions
Buffer control functions
Inserting additional functions
Transfer control to TUTOR
To execute a trap function: set up appropriate registers move.b #,d7 trap #14 For example: move.b #'*',d0 move.b #OUTCH,d7 trap #14 Input functions --------------- PORTIN1 Action: Input string from Port 1. String must be terminated by CR. Pre: A5 points to start of buffer. A6 points to next free location in buffer. Post: A6 points to buffer location following last character of string. Other: Buffer size <= 127 characters. All characters have high bit cleared. NULL is ignored. Terminating CR is not stored. Echoes CR as CR + LF. PORTIN1N Action: Input string from Port 1. String must be terminated by CR. Pre: A5 points to start of buffer. A6 points to next free location in buffer. Post: A6 points to buffer location following last character of string. Other: Buffer size <= 127 characters. All characters have high bit cleared. NULL is ignored. Terminating CR is not stored. Echoes CR as CR. PORTIN20 Action: Input string from Port 2. String must be terminated by CR. Pre: A5 points to start of buffer. A6 points to next free location in buffer. Post: A6 points to last character of string. Other: Buffer size <= 127 characters. All characters have high bit cleared. Control characters (ASCII value < 20) are ignored. Terminating CR is not stored. Echoes CR as CR. INCHE Action: Input single character from Port 1. Pre: none. Post: D0 contains input character. A0 contains serial channel base address D1 is destroyed. Other: All characters have high bit cleared. Does not echo input character. Output functions ---------------- OUTPUT Action: Output string to port 1. Pre: A5 points to start of string. A6 points to location following last byte of string. Post: A5 points to location following last byte of string. Other: If Port 3 is attached, characters are echoed to Port 3 but control characters are replaced by a period. OUT1CR Action: Output string plus 'CR', 'LF' to Port 1. Pre: A5 points to start of string. A6 points to location following last byte of string. Post: A5 points to location following last byte of string. D0 is destroyed. D1 is destroyed. A0 contains serial channel base address Other: If Port 3 is attached, characters are echoed to Port 3 but control characters (except CR or LF) are replaced by a period. OUTPUT21 Action: Output String to Port 2. Pre: A5 points to start of string. A6 points to location following last byte of string. Post: A5 points to location following last byte of string. Other: If Port 3 is attached, characters are echoed to Port 3 but control characters (except CR or LF) are replaced by a period. PRCRLF Action: Output string to Port 3. Pre: A5 points to start of string. A6 points to location following last byte of string. Post: A5 points to start of string. D0 is destroyed. Other: Control characters (except CR or LF) are replaced by a period. OUTCH Action: Output single character to Port 1. Pre: D0 contains character. Post: D0 is destroyed. D1 is destroyed. A0 contains serial channel base address Other: If Port 3 is attached, characters are echoed to Port 3 but control characters (except CR or LF) are replaced by a period. CHRPRINT Action: Output single character to Port 3. Pre: D0 contains character. Post: D0 is unchanged. Other: Control characters (except CR or LF) are replaced by a period. Floppy disk functions --------------------- DSELECT Action: Select (activate) one of the drives. Pre: D0 bit 0 is 0 for drive 0, 1 for drive 1. D0 bit 7 is 0 for double density, 1 for single density. Post: D0 contains disk status. D1 is destroyed A0 contains disk address. Other: Diskette need not be formatted. DRESTORE Action: Restore the head to track zero on selected drive. Pre: none. Post: D1 contains disk status Z bit in SR is 1 if restore was successful. Other: Diskette need not be formatted. DREADS Action: Read one sector off the selected drive. Pre: D0 bits 0-6 is sector number. D0 bit 7 is 0 for side 0, 1 for side 1. D0 bits 8-14 is track number. D0 bit 15 is ignored. D0 bits 16-31 is number of bytes in a sector. A5 points to buffer. Post: D0 contains disk status. Z bit in SR is 1 if read was successful. A5 points to last byte used in buffer plus 1. D1 is destroyed. Other: Diskette must be formatted. DREADT Action: Read one track off the selected drive. Pre: D0 bit 7 is 0 for side 0, 1 for side 1. D0 bits 8-14 is track number. A5 points to buffer. Post: D0 contains disk status. A5 points to last byte used in buffer plus 1. D1 is destroyed. Other: Diskette must be formatted. DSEEK Action: Move head to desired track on selected drive. Pre: D0 bits 8-14 is track number. Post: D1 contains disk status. Z bit in SR is 1 if read was successful. D0 is destroyed. A0 is destroyed. Other: Diskette must be formatted. DWRITS Action: Write one sector on the selected drive. Pre: D0 bits 0-6 is sector number. D0 bit 7 is 0 for side 0, 1 for side 1. D0 bits 8-14 is track number. D0 bit 15 is 0 to enable precompensation, 1 to disable it. D0 bits 16-31 is number of bytes in a sector. A5 points to buffer. Post: D0 contains disk status. Z bit in SR is 1 if read was successful. A5 points to last byte used in buffer plus 1. D1 is destroyed. Other: Diskette must be formatted. DSTEPIN Action: Move head one track inward on selected drive. Pre: none. Post: D1 contains disk status. Other: Diskette need not be formatted. DWRITT Action: Write the entire track on the selected drive. Pre: D0 bit 7 is 0 for side 0, 1 for side 1. D0 bit 15 is 0 to enable precompensation, 1 to disable it. A5 points to buffer. Post: D0 contains disk status. Z bit in SR is 1 if write was successful. A5 points to last byte used in buffer plus 1. D1 is destroyed. D2 is destroyed. Other: Diskette need not be formatted. UNSELECT Action: Deselect the drives. Pre: none. Post: none. Other: Diskette need not be formatted. Conversion functions -------------------- HEX2DEC Action: Convert hex value to ASCII encoded decimal. Pre: D0 contains hex digits. A6 points to buffer. Post: A6 points to last used byte in buffer plus 1. D0 is destroyed. D1 is destroyed. D2 is destroyed. Other: Leading zeroes are suppressed. PUTHEX Action: Convert 1 hex digit to ASCII. Pre: D0 contains hex digits. A6 points to buffer. Post: A6 points to last used byte in buffer plus 1. D0 is destroyed. Other: Leading zeroes are suppressed. PNT2HX Action: Convert 2 hex digits to ASCII. Pre: D0 contains hex digits. A6 points to buffer. Post: A6 points to last used byte in buffer plus 1. D0 is destroyed. D2 is destroyed. Other: Leading zeroes are suppressed. PNT4HX Action: Convert 4 hex digits to ASCII. Pre: D0 contains hex digits. A6 points to buffer. Post: A6 points to last used byte in buffer plus 1. D0 is destroyed. D1 is destroyed. D2 is destroyed. Other: Leading zeroes are suppressed. PNT6HX Action: Convert 6 hex digits to ASCII. Pre: D0 contains hex digits. A6 points to buffer. Post: A6 points to last used byte in buffer plus 1. D0 is destroyed. D1 is destroyed. D2 is destroyed. Other: Leading zeroes are suppressed. PNT8HX Action: Convert 8 hex digits to ASCII. Pre: D0 contains hex digits. A6 points to buffer. Post: A6 points to last used byte in buffer plus 1. D0 is destroyed. D1 is destroyed. D2 is destroyed. Other: Leading zeroes are suppressed. GETNUMA Action: Convert ASCII encoded hex to hex number. Pre: A5 points to ASCII string. A6 points to end of string plus 1 Post: D0 contains number. A5 points to end of string plus 1 Other: In case of error (invalid digit, number too large) error printed on Port 1. GETNUMD Action: Convert ASCII encoded decimal to hex number. Pre: A5 points to ASCII string. A6 points to end of string plus 1 Post: D0 contains number. A5 points to end of string plus 1 Other: In case of error (invalid digit, number too large) error printed on Port 1. GETHEX Action: Convvert ASCII character to hex. Pre: D0 contains ASCII hex digit. Post: D0 contains number. Other: In case of error (invalid digit, number too large) error printed on Port 1. Buffer control functions ------------------------ FIXBUF Action: Initialize A5 and A6 to 'BUFFER'. Pre: none. Post: A5 points to 'BUFFER'. A6 points to 'BUFFER'. Other: 'BUFFER' is located in TUTOR system RAM. FIXDADD Action: Append string to buffer. Pre: A5 points to string. A6 points to buffer. Post: A5 points to buffer. A6 points to last used byte in buffer plus 1. Other: String must be terminated by ASCII $04, which is not transferred to buffer. FIXDATA Action: Initialize A6 to 'BUFFER' and append string to buffer. Pre: A5 points to string. Post: A5 points to 'BUFFER'. A6 points to last used byte in 'BUFFER' plus 1. Other: String must be terminated by ASCII $04, which is not transferred to buffer. 'BUFFER' is located in TUTOR system RAM. FIXDCRLF Action: Move 'CR', 'LF', initialize A6 to 'BUFFER' and append string to buffer. Pre: A5 points to string. Post: A5 points to 'BUFFER'. A6 points to last used byte in 'BUFFER' plus 1. Other: String must be terminated by ASCII $04, which is not transferred to buffer. 'BUFFER' is located in TUTOR system RAM. Inserting additional functions ------------------------------ LINKIT Action: Append user table to TRAP 14 table. Pre: A0 points to user table. Post: A0 contains address of old table to be inserted as last entry of new table. D0 is destroyed. Other: Table entry is 1 byte function number + 3 byte address. Transfer control to TUTOR ------------------------- START Action: Restart TUTOR, perform initialization. Pre: None. Post: SR = $2700. A7 = 'SYSTACK'. PC = 0. Other: None. TUTOR Action: Go to TUTOR, print prompt. Pre: None. Post: SR = $2700. A7 = 'SYSTACK'. Other: None.
[SSU Home Page] [SSU CS Department] [ CS Dept webmaster ] 12/22/97.