* Kermit68K: source file K68DEF * * Author: Roberto Bagnara (Bagnara@Iboinfn.Bitnet), * Bologna University, Physics Department, July 1987. * * All rights reserved to Bologna University, Italy. * * Permission is granted to any individual or institution * to use, copy, or redistribute this software so long as * it is not sold for profit, provided this copyright * notice is retained. * * Modification History: * * Version Date Who Comments * * 1.0.00 870701 Roberto Bagnara First official release * ?????? ?????? Steve Williams Modified for OS9 (see below) * This file is adapted in a very straightforward manner from the original * k68def.src file. * * Since the OS-9 assembler will not allow the declaration of labels inside * a macro definition (ala the'\3 equ VarIndex' used previously) the do.b, * do.w, and do.l pseudo instructions are used instead. These perform a * very similiar offset definition function. * * This file has been converted to its own psect for the following reasons: * * 1. It makes defining the dependencies in the make utility makefile much * easier, since each object file depends on only one source file. * * 2. It greatly decreases the development cycle time by reducing the disk * accesses needed during reassembly. * * 3. The OS-9 symobolic debugger needs global symbols in order to provide * meaningful interpretation of programs being debugged. Edition set 1 psect K68Definitions,0,0,Edition,0,0 * Truth values True: EQU -1 True value, in the sense of Scc opcode False: EQU 0 False value, in the sense of Scc opcode * ASCII control characters Asc_Nul: EQU 0 Nul or tape feed Asc_SOH: EQU 1 Start of heading Asc_STx: EQU 2 Start of text Asc_ETx: EQU 3 End of text Asc_EOT: EQU 4 End of transmission Asc_Enq: EQU 5 Enquire Asc_Ack: EQU 6 Acknowledge Asc_Bel: EQU 7 Bell Asc_BS: EQU 8 Backspace Asc_HT: EQU 9 Horizontal tab Asc_LF: EQU 10 Line feed Asc_VT: EQU 11 Vertical tab Asc_FF: EQU 12 Form feed Asc_CR: EQU 13 Carriage return Asc_SO: EQU 14 Shift out Asc_SI: EQU 15 Shift in Asc_DLE: EQU 16 Data link escape Asc_DC1: EQU 17 Device control 1 Asc_DC2: EQU 18 Device control 2 Asc_DC3: EQU 19 Device control 3 Asc_DC4: EQU 20 Device control 4 Asc_NAk: EQU 21 Negative acknowledge Asc_Syn: EQU 22 Synchronous idle Asc_ETB: EQU 23 End of transmission block Asc_Can: EQU 24 Cancel Asc_EM: EQU 25 End of medium Asc_Sub: EQU 26 Substitute Asc_Esc: EQU 27 Escape, prefix Asc_FS: EQU 28 File separator Asc_GS: EQU 29 Group separator Asc_RS: EQU 30 Record separator Asc_US: EQU 31 Unit separator Asc_Del: EQU 127 Delete * Buffers and strings sizes StkMDpth: EQU 512 Max stack depth (long words) McrTblLn: equ 2000 Mcaro table length RBufLen: EQU 200 Receive buffer length CmdBufLn: EQU 200 Command buffer length PromptML: EQU 32 Prompt string max length LinNamML: EQU 32 Line name string max length FilNamML: EQU 28 File names max length (for OS9--was 40) MxPckSiz: EQU 94 Maximum packet size MaxTakeF: EQU 20 Maximum number of nested take files * Kermit protocol automaton states SndInitS: EQU 0 Send-Init OpnFileS: EQU 1 Open-File SndFileS: EQU 2 Send-File SndDataS: EQU 3 Send-Data SendEOFS: EQU 4 Send-End-Of-File SendEOTS: EQU 5 Send-Break RecInitS: EQU 6 Receive-Init RecFileS: EQU 7 Receive-File RecDataS: EQU 8 Receive-Data SndSrvIS: EQU 9 Send-Server-Init SndGCmdS: EQU 10 Send-Generic-Command CompletS: EQU 11 Complete AbortS: EQU 12 Abort * Logical channels Null: EQU 0 Null logical channel number Terminal: EQU 1 Terminal line logical channel number HostLine: EQU 2 Host line logical channel number IOFile: EQU 3 I/O file logical channel number TakeFil0: EQU 4 Outer level take file ... TakeFil1: EQU 5 ... and so on * System I/O routines InpChar, OutChar and ChanCtrl completion codes AllOk: EQU 0 No errors BadChan: EQU 1 Inexistent channel ResChan: EQU 2 Access reserved, permission denied DevNotRd: EQU 3 Device not ready (e.g. unmounted) NotInpCh: EQU 4 Input impossible on this channel NotOutCh: EQU 5 Output impossible on this channel NotOpRd: EQU 6 File not open for read NotOpWr: EQU 7 File not open for write UnrInpF: EQU 8 Unrecoverable failure during input UnrOutF: EQU 9 Unrecoverable failure during output InChLost: EQU 10 Input character lost InpBreak: EQU 11 Break received on input BufEmpty: EQU 12 Input buffer empty BufOvflw: EQU 13 Input buffer overflow EndOfFil: EQU 14 End of file reached on input DevFull: EQU 15 Device full, not enough space BadCtReq: EQU 16 I/O control request code invalid * FilOpen function request codes RdWrOp: EQU 0 Open for read/write ReadOp: EQU 1 Open for read WriteOp: EQU 2 Open for write AppendOp: EQU 3 Open for append * I/O channel control requests SetBaud: EQU 0 Set baud rate on port RawMode: EQU 1 Enable raw mode TextMode: EQU 2 Enable text mode DoXCntrl: EQU 3 Enable XON/XOFF protocol NoXCntrl: EQU 4 Disable XON/XOFF protocol SndBreak: EQU 5 Send a break over RS 232 C line ClrInpBf: EQU 6 Clear input buffer ClrOutBf: EQU 7 Clear output buffer * System function request codes SysCommd: equ 0 Forward a command to system Directry: EQU 1 Display a directory listing SpacInfo: EQU 2 Display informations about disk usage DeletFil: EQU 3 Delete file(s) CopyFile: EQU 4 Copy file(s) ChangDir: EQU 5 Change the default directory PrntFile: EQU 6 Print file(s) RenamFil: EQU 7 Rename file(s) TypeFile: EQU 8 Type file(s) * Screen request codes SFilName: EQU 0 Outgoing file name RFilName: EQU 1 Inbound file name FlAsName: EQU 2 File as-name XPckData: EQU 3 X packet data FlTranOk: EQU 4 File transfer ok FlDiscrd: EQU 5 File discarded FlIntrrp: EQU 6 File interrupted FlSkippd: EQU 7 File skipped PackType: EQU 8 Packet type TranCmpl: EQU 9 Transaction complete ErrMessg: EQU 10 Error message WarnMess: EQU 11 Warning message UndelTxt: EQU 12 Undelimited text TxtDlBeg: EQU 13 Text delimited at the beginning TxtDlEnd: EQU 14 Text delimited at the end ScrnMxRq: EQU 14 Screen function max request code * Program variables defaults DefDuplx: equ False Default duplex DefPrity: EQU 0 Default parity DefEscap: EQU 5 Default escape character for connect DefFlow: EQU 1 Default line flow control DefLocal: EQU True Default mode, local or remote DefSpeed: EQU 9600 Default line speed DefDelay: EQU 5 Default initial delay before sending DefRetIn: EQU 16 Defaulut retry limit initial connection DefRetPk: EQU 10 Defaulut retry limit normal packets * Send Init parameters MyMxPSiz: EQU 90 Biggest packet I want receive MyTimOut: EQU 10 When I want to be timed out MyPad: EQU 0 How much padding I need MyPadChr: EQU Asc_Nul Padding character I want MyEOL: EQU Asc_CR End-Of-Line character I want MyCtlQot: EQU '#' Control-Quote character I send MyRptQot: EQU $7E Repeat-Quote character I send My8BQuot: EQU '&' 8th-Bit prefix char I will use * Receive Init default parameters DefMxPSz: EQU 80 Default biggest packet you can receive DefTmOut: EQU 10 Default when you want to be timed out DefPadNm: EQU 0 Default how much padding you need DefPadCr: EQU Asc_Nul Default padding character you want DefEOL: EQU Asc_CR Default End-Of-Line character you want DefCtlQt: EQU '#' Default Control-Quote character you send * System variables * OS-9 will not accept a macro argument as a label, so the variable * declarations have been done in another way. The do.s directive keeps * a running offset location counter (separate from the code counter) that * can be reset at any time using the org directive. org 0 * Packet related variables PackNum: do.b 1 Packet number PrevPckN: do.b 1 Previous packet number NextPckN: do.b 1 Next packet number SendType: do.b 1 Packet type just sent IStPckCh: do.b 1 Incoming packet start character OStPckCh: do.b 1 Outbound packet start character Size: do.b 1 Current output data packet size OldSize: do.b 1 Previous output data packet size First: do.b 1 Flag for first character from input Current: do.b 1 Current character from input Next: do.b 1 Next character from input * Communication line variables Speed: do.l 1 Line speed, -1 if unknown Parity: do.b 1 Parity specified, 0, 'E', 'O', 'M', 'S' Flow: do.b 1 Flow control, 1 for xon/xoff TurnFlag: do.b 1 Line turnaround handshake flag TurnChar: do.b 1 Line turnaround character Delay: do.b 1 Initial delay before sending Duplex: do.b 1 Duplex, full by default Escape: do.b 1 Escape character for connect * Program variables CmdBfPnt: do.b 1 Relative pointer to command buffer ServrCmd: do.b 1 Server command to send Retry: do.b 1 Retry limit currently in use RtryInit: do.b 1 Retry limit initial connection packets RtryPack: do.b 1 Retry limit for normal packets TakLevel: do.b 1 Take file level LFSave: do.b 1 This is for newline processing * If the system uses a single character for text file line delimitation, * assign to NewLinCh the ASCII value of that character. For text files, * that character will be converted to CRLF upon output, and CRLF will be * converted to that character on input. NewLinCh: EQU Asc_CR Line delimiter for text files * Variables for Send-Init parameters ICtlQuot: do.b 1 Control prefix in incoming data OCtlQuot: do.b 1 Control prefix in outgoing data IEOL: do.b 1 End-Of-Line character to look for OEOL: do.b 1 End-Of-Line character to send IPadNumb: do.b 1 How much padding to ask for OPadNumb: do.b 1 How much padding to send IPadChar: do.b 1 Padding character to ask for OPadChar: do.b 1 Padding character to send ITimInt: do.b 1 Timeout interval I use OTimInt: do.b 1 Timeout interval I want you to use IMPckSiz: do.b 1 Biggest packet size I want to receive OMPckSiz: do.b 1 Biggest packet size I can send BlChkUs: do.b 1 Block check type used BlChkRq: do.b 1 Block check type requested ReptCnt: do.b 1 Repeat count ReptQuot: do.b 1 Repeat prefix ReptFlag: do.b 1 Repeat processing flag Bit8Quot: do.b 1 8th bit prefix Bit8Flag: do.b 1 8th bit quoting flag TimInFlg: do.b 1 Flag to override the timeout requested SndPSFlg: do.b 1 Flag to override the size requested * Flags MStrFlag: do.b 1 Flag for input from memory string TermOut: do.b 1 Flag for output to the terminal channel CtlXSeen: do.b 1 Flag for cancelling a file CtlZSeen: do.b 1 Flag for cancelling a file group Binary: do.b 1 Flag for binary file FNameCnv: do.b 1 Flag for converting file names Keep: do.b 1 Flag for incomplete file disposition Warning: do.b 1 Flag for file warning Display: do.b 1 Flag for file transfer display Quiet: do.b 1 Be quiet during file transfer Local: do.b 1 Flag for running in local mode IntMacro: do.b 1 Flag for interpreting macros Done: do.b 1 Flag for exiting the command parser * String and buffer variables LeftOver: do.b 6 Small buffer for optimal packet filling Prompt: do.b PromptML Prompt string LineName: do.b LinNamML Communication line name FilName: do.b FilNamML Current file name Argumnt1: do.b CmdBufLn First command argument Argumnt2: do.b CmdBufLn Second command argument DataBuf: do.b MxPckSiz+4 Packet data buffer SendBuf: do.b MxPckSiz+4 Send packet buffer RecBuf: do.b RBufLen Receive packet buffer CmdBuf: do.b CmdBufLn Buffer for command interpretation MacroTbl: do.b McrTblLn Macro definitions table * Statistic variables ChrsSent: do.l 1 Chars sent last transaction TChsSent: do.l 1 Total characters sent ChrsRecd: do.l 1 Chars received last transaction TChsRecd: do.l 1 Total characters received DChsSent: do.l 1 Data chars sent last transaction TDChSent: do.l 1 Total data characters sent DChsRecd: do.l 1 Data chars received last transaction TDChRecd: do.l 1 Total data characters received PcksSent: do.l 1 Packets sent last transaction TPckSent: do.l 1 Total packet sent PcksRecd: do.l 1 Packets received last transaction TPckRecd: do.l 1 Total packet received NAKsSent: do.l 1 NAKs sent last transaction TNAKSent: do.l 1 Total NAKs sent NAKsRecd: do.l 1 NAKs received last transaction TNAKRecd: do.l 1 Total NAKs received * Pointers MStrgPnt: do.l 1 Pointer for input from memory string MacroPnt: do.l 1 Pointer for macro interpretation MTNxtChF: do.l 1 Pointer to the end of the macro table * System dependent routines variables LinLngth: do.b 1 For the dumb terminal Screen routine MyFNBuff: do.b FilNamML This is for tests on my system * OS-9/68000 specific variables CR_Last: do.b 1 Flag for CR/LF stripping on terminal TermFlag: do.b 1 Flag used in OutChar for terminal. Pathnums: do.w 20 OS-9 path numbers for logical channels NumFiles: do.l 1 Number of files left to process NextFile: do.l 1 Pointer to next file name CmdLinPt: do.l 1 Pointer to the OS-9 command arguments FNBuffer: do.b 50*FilNamML File names buffer for ExpandFN ShellCmd: do.b 128 Buffer for constructing shell commands OptBuff: do.b 128 Save area for terminal input PD options * Must set the VarIndex variable to the current offset location counter * so that the variable section can be set up properly VarIndex: do.w 1 Seems reasonable to be word aligned vsect VarArea: ds.b VarIndex Storage definition for the variables area ends ends end