home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / msr313src.zip / mssdef.h < prev    next >
Text File  |  1993-07-12  |  15KB  |  442 lines

  1. ; File MSSDEF.H
  2. ;; MASM v6, use MASM 5.1 constructions (/Zm)    OPTION    M510
  3.     .xlist            ; suppress listing in program
  4.     .sall            ; don't list macro expansions
  5. version equ    313        ; master version number
  6. verdef    macro
  7.     db    ' MS-DOS Kermit: 3.13 8 July 1993'
  8.     endm
  9.  
  10. BELL    EQU    07H
  11. TAB     EQU    09H
  12. LF      EQU    0AH
  13. FF      EQU    0CH
  14. CR      EQU    0DH
  15. XON     EQU    11H
  16. XOFF    EQU    13H
  17. ESCAPE     EQU    1BH
  18. DEL     EQU    7FH
  19. BS      EQU    08H
  20. CTLZ    EQU    1AH
  21. SOH     EQU    01H     ; Start of header char
  22. SPC     EQU    20H
  23. SS2    equ    8eh
  24. SS3    equ    8fh
  25. DCS    equ    90h
  26. CSI    equ    9bh
  27. STCHR    equ    9ch
  28.  
  29. DOS     EQU    21H
  30.  
  31. CONIN    EQU    01H
  32. CONOUT    EQU    02H
  33. LSTOUT    EQU    05H
  34. DCONIO    EQU    06H
  35. CONINQ    EQU    07H    ; quiet console input
  36. PRSTR    EQU    09H
  37. CONSTAT    EQU    0BH
  38. SELDSK    EQU    0EH    ; Select disk
  39. GCURDSK    EQU    19H    ; Current disk
  40. SETDMA    EQU    1AH
  41. SETINTV    EQU    25H    ; Set interrupt vector from ds:dx
  42. GETDATE EQU    2AH    ; Get date
  43. GETTIM    EQU    2CH    ; Get the time of day 
  44. DOSVER    EQU    30H    ; dos version #
  45. GETINTV    EQU    35H    ; get interrupt vector to es:bx
  46. GSWITCH    EQU    37H    ; undocumented get/set switch character
  47. CHDIR    EQU    3BH    ; change directory
  48. CREAT2    EQU    3CH    ; create
  49. OPEN2    EQU    3DH    ; open
  50. CLOSE2    EQU    3EH    ; close
  51. READF2    EQU    3FH    ; read
  52. WRITE2    EQU    40H    ; write
  53. DEL2    EQU    41H    ; delete
  54. LSEEK    EQU    42H    ; lseek
  55. IOCTL    EQU    44H    ; i/o control
  56. GCD    EQU    47H    ; get current directory
  57. ALLOC    EQU    48H    ; allocate memory
  58. FREEMEM    EQU    49H    ; free memory
  59. SETBLK    EQU    4AH    ; modify allocated memory map
  60. EXEC    EQU    4BH    ; execute task
  61. FIRST2    EQU    4EH    ; search for first
  62. NEXT2    EQU    4FH    ; search for next
  63.  
  64. PAREVN    EQU    00    ; Even parity
  65. PARMRK    EQU    01    ; Mark parity
  66. PARNON    EQU    02    ; No parity.    
  67. PARODD    EQU    03    ; Odd parity
  68. PARSPC    EQU    04    ; Space parity
  69.  
  70. FLOXON    EQU    1113H    ; Use XON/XOFF for flow control
  71. FLONON    EQU    0    ; Don't do flow control
  72. DEFHAND    EQU    XON    ; Use XON as default handshake
  73.  
  74. MODCD    EQU    80H    ; MODEM CD handshake line status responses
  75. MODCTS    EQU    10H    ; MODEM CTS
  76. MODDSR    EQU    20H    ; MODEM DSR
  77. MODRI    EQU    40H    ; MODEM RI
  78.  
  79.             ; flags.remflg byte definitions
  80. DQUIET    EQU    1    ; Display mode, suppress file xfer statistics
  81. DREGULAR EQU    2    ; Regular formatted screen display of statistics
  82. DSERIAL    EQU    4    ; Serial mode (non-formatted screen)
  83. D8BIT    EQU    8    ; Display chars as 8-bit vs 7-bit quantities
  84. DSERVER    EQU    10H    ; Server mode active, if this bit is set
  85.  
  86. MAXTAK    EQU    25    ; Max number of TAKE's allowed
  87. DEFMXTRY EQU    5    ; default number of retries on a data packet (63 max)
  88.             ; Init packet gets three times this number of tries
  89.  
  90. DEFESC    EQU    1DH    ; The default escape character (Control rt sq bracket)
  91. DRPSIZ    EQU    94    ; Default receive packet size, regular pkts
  92. DSPSIZ    EQU    94    ; Default send packet size, regular pkts
  93. DSTIME    EQU    8    ; Default send time out interval
  94. DSQUOT    EQU    23H    ; Default send (and receive) quote char
  95. DQBIN    EQU    26H    ; Default 8-bit prefix
  96. DCHKLEN    EQU    1    ; Default checksum length
  97. DEFPAR    EQU    PARNON    ; Default parity (none) 
  98.  
  99. bufsiz    equ    512    ; size of serial port input buffer
  100. buffsz    equ    512    ; size of disk file i/o buffer (buff)
  101. cmdblen    equ    1000    ; length of command lines (sharing buffers)
  102. cptsiz    equ    256    ; size of session capture buffer
  103. tbufsiz    equ    128    ; size of Take buffers
  104. maxwind equ    31    ; max number of window slots
  105. macmax    equ    100    ; max number of macros
  106.  
  107.             ; bit defs for flags.capflg (LOG command)
  108. logoff    equ    0    ; Off = no or suspended logging
  109. logdeb    equ    1    ; log debugging (not yet imp)
  110. logpkt    equ    2    ; log packets sent/received
  111. logses    equ    4    ; log connect mode session
  112. logtrn    equ    8    ; log (file) transaction
  113.  
  114.             ; Attributes-allowed bits in flags.attflg 
  115. attchr    equ    1    ; File Character-set
  116. attdate    equ    2    ; File Date/Time
  117. attlen    equ    4    ; File Length
  118. atttype    equ    8    ; File Type
  119.  
  120. xfr_xparent    equ    0    ; transfer character set indices
  121. xfr_latin1    equ    1    ;  ref table charids in mssfil.asm
  122. xfr_latin2    equ    2
  123. xfr_hebiso    equ    3
  124. xfr_cyrillic    equ    4
  125. xfr_japanese    equ    5
  126.  
  127. lock_disable    equ    0    ; transfer locking shift capability
  128. lock_enable    equ    1
  129. lock_force    equ    2
  130.  
  131. ; Terminal emulator section
  132.  
  133. ; Kinds of terminals available
  134. ttgenrc equ    0            ; no emulation done by Kermit
  135. ttheath equ    1            ; Heath-19
  136. ttvt52    equ    2            ; VT52
  137. ttvt100    equ    4            ; VT100
  138. ttvt102    equ    8            ; VT102
  139. ttvt220    equ    10h            ; VT220
  140. ttvt320    equ    20h            ; VT320
  141. tttek    equ    40h            ; Tektronix 4010
  142. tthoney    equ    80h            ; Honeywell VIP7809
  143. ttpt200    equ    100h            ; Prime PT200
  144. ttd463    equ    200h            ; Data General D463
  145. ttd470    equ    400h            ; Data General D470
  146. TTTYPES equ    12            ; Number of terminal types defined
  147. ; tekflg bits in byte
  148. tek_active equ    1            ; actively in graphics mode
  149. tek_tek    equ    2            ; Tek terminal
  150. tek_dec    equ    4            ; Tek submode of DEC terminals
  151. tek_sg    equ    8            ; special graphics mode
  152.  
  153. ; DEC emulator status flags (bits in words vtemu.vtflgst and vtemu.vtflgop)
  154. anslnm  equ    1H            ; ANSI line feed/new line mode
  155. decawm  equ    2H            ; DEC autowrap mode
  156. decscnm equ    80H            ; DEC screen mode
  157. decckm  equ    200H            ; DEC cursor keys mode
  158. deckpam equ    400H            ; DEC keypad application mode
  159. decom   equ    800H            ; DEC origin mode
  160. deccol    equ    1000H            ; DEC column mode (0=80 col)
  161. decanm  equ    2000H            ; ANSI mode
  162. ;dececho equ    4000H            ; ANSI local echo on (1 = on)
  163.      
  164. ; Terminal SETUP mode flags (joint with bits above, some name dups)
  165. vsnewline    equ    1H        ; ANSI new line (0 = off)
  166. vswrap        equ    2H        ; Line wrap around (0 = no wrap)
  167. vsnrcm        equ    4H        ; National Rep Char set (0=none)
  168. vswdir        equ    8H        ; Writing direction (0=left, 1 right)
  169. vskeyclick    equ    10H        ; Keyclick (0 = off)
  170. vsmarginbell    equ    20H        ; Margin bell (0 = off)
  171. vscursor    equ    40H        ; Cursor (0 = block, 1 = underline)
  172. vsscreen    equ    80H        ; Screen (0 = normal, 1 = rev. video)
  173. vscntl        equ    100h        ; 8 or 7 bit controls (1 = 8-bit)
  174. vshscroll    equ    4000h        ; horiz scroll (0=auto, 1=manual)
  175. vscompress    equ    8000h        ; compressed text(0=graphics,1=132col)
  176.  
  177. ; VTxxx defaults for SETUP
  178. ; Note: Tab stops default to columns 9, 17, 25, 33, etc
  179. ;
  180. ; VSDEFAULTS holds Kermit startup time settings for the VT100 emulator
  181. ; Configure it by adding together names from the setup mode flags above
  182. ; to turn on features (they default to being off if not mentioned).
  183. ; Set the kind of terminal by placing a ttxxxx name in VTFLGS in the
  184. ; FLGINFO structure well below.
  185.  
  186. vsdefaults    equ    0+vscursor+vshscroll+vscompress    ; default conditions
  187.  
  188. emulst    struc            ; structure for terminal emulator global data
  189. vtflgst    dw    0        ; VTxxx setup flags
  190. vtflgop    dw    0        ; VTxxx runtime flags, like setup flags
  191. vttbs    dw    0        ; pointer to default tab stops 
  192. vttbst    dw    0        ; pointer to tab stops (both in mszibm)
  193. vtchset    db    16        ; value of default character set (15=Latin-1)
  194. vtchop    db    16        ; value of operational char set
  195. att_ptr    dw    0        ; pointer to video attributes: norm, rev
  196. vttable db    4 dup (0ffh)    ; char set number for G0..G3 overrides
  197. emulst    ends
  198. ; end of terminal emulator section
  199.  
  200. ; Structure definitions
  201.  
  202. ifdef save_mem2            ; define only for Xenix builds
  203. save_mem equ    1        ; for Xenix
  204. endif
  205.  
  206. ifndef save_mem2        ; for regular DOS builds
  207. ; Command parser information
  208. cmdinfo    struc
  209. cmrprs    dd 0        ; offset,segment of where to jmp on reparsing
  210. cmostp  dw 0
  211. cmprmp    dw 0        ; Address of prompt
  212. cmwhite    db 0        ; non-zero to permit leading whitespace
  213. cmcr    db 0        ; Say whether bare CR is allowed
  214. cmper    db 0        ; Allow literal backslash-percent in command
  215. cmquiet    db 0        ; non-zero for no echoing
  216. cmkeep    db 0        ; non-zero to keep Take/Macro open after EOF
  217. cmblen    dw 0        ; length of caller's cmtxt receiving buffer
  218. impdo    db 0        ; non-zero for keyword search failure to use DO cmd
  219. cmdinfo    ends
  220.  
  221. ; Command parser equates
  222. cmkey    equ    1    ; parse a keyword
  223. cmeol    equ    4    ; parse a CR end of line character
  224. cmline    equ    5    ; parse line of text up to CR
  225. cmword    equ    6    ; parse an arbitrary word
  226.  
  227. endif
  228.  
  229. ; Flags information
  230. flginfo    struc
  231. belflg    db 1        ; Use bell
  232. comflg    db 1        ; Use COM1 by default
  233. abfflg    db 1        ; Discard incoming file if abort
  234. debug    db 0        ; Debugging mode (default off)
  235. flwflg    db 0        ; File warning (collision) flag (default rename)
  236. extflg    db 0        ; Exit flag (default off)
  237. vtflg    dw ttvt320    ; term emulation type, default
  238. cxzflg    db 0        ; ^X/^Z to interrupt file x-fer
  239. xflg    db 0        ; Seen "X" packet
  240. eoflag    db 0        ; EOF flag; non-zero on EOF
  241. capflg    db 0        ; On if capturing data
  242. takflg    db 0        ; On if echoing commands of TAKE file
  243. timflg    db 1        ; Say if are timing out or not
  244. destflg    db 1        ; Incoming files destination: disk or printer
  245. eofcz    db 0        ; ^Z signals eof if non-zero
  246. remflg    db DREGULAR    ; server (remote) mode plus display flag bits
  247. modflg    db 1        ; non-zero if mode line on
  248. attflg    db 0ffh        ; non-zero if file attributes packets are enabled
  249. chrset    dw 0        ; ident of file character set (437=hardware, CP437)
  250. unkchs    db 0        ; files w/unknown-character-set (0=keep, 1=cancel)
  251. xltkbd    db 1        ; keyboard character-set translation (1=on, 0=off)
  252. oshift    db 0        ; output-shift (1 = auto, 0 = none, default none)
  253. flginfo    ends
  254.  
  255. ifndef save_mem2
  256. ; Transmission parameters
  257. trinfo    struc
  258. maxdat    dw 0        ; Max packet size for send, word for long packets
  259. chklen    db 1        ; Number of characters in checksum
  260. seol      db cr        ; Send EOL char
  261. reol      db cr        ; Receive EOL char
  262. ssoh      db soh        ; Send start-of-packet character
  263. rsoh      db soh        ; Receive start-of-packet character
  264. squote    db dsquot    ; Send quote character
  265. rquote    db dsquot    ; Receive quote character
  266. rptq    db 7eh        ; Repeat quote character (tilde)
  267. spsiz     db dspsiz    ; Send (regular) packet size
  268. rpsiz     db drpsiz    ; Receive (regular) packet size
  269. stime     db dstime    ; Send timeout. (Don't timeout)
  270. rtime     db 5        ; Receive timeout
  271. sdelay    db 0        ; Send delay time (sec) for just SEND command
  272. spad      db 0        ; Send number of padding char
  273. rpad      db 0        ; Receive number of padding char
  274. spadch    db 0        ; Send padding char
  275. rpadch    db 0        ; Receive padding char
  276. ebquot    db 'Y'        ; Send 8-bit quote character
  277. escchr    db defesc    ; Escape character
  278. capas    db 2,0        ; Capas bytes (just two for now)
  279. windo    db 1        ; number of window slots
  280. rlong    dw drpsiz    ; long pkt size we want to receive
  281. slong    dw 9024        ; long pkt size we could send (negotiated with host)
  282. xchset    db 0        ; transfer char set (0=hardware) on comms wire
  283. xchri    db 0        ; transfer char set readable (0) or invertible (1)
  284. xtype    db 0        ; file type for xfer (0=text,1=binary,etc)
  285. sdbl    db 0        ; char to be doubled when sending (if non-null)
  286. rign    db 0        ; char to be ignored when received (if non-null)
  287. lshift    db lock_enable    ; locking shift (0=disable, 1=enable, 2=force on)
  288. trinfo    ends
  289. endif
  290.  
  291. ifndef save_mem
  292. pktinfo    struc
  293. datadr    dd 0        ; data field address (segment:offset)
  294. datlen    dw 0        ; length of data field in a packet
  295. datsize    dw 0        ; length of data field buffer
  296. pktype    db 0        ; packet type, a letter
  297. seqnum    db 0        ; packet SEQ number
  298. ackdone    db 0        ; zero if pkt not ack'ed yet
  299. numtry    db 0        ; number of tries on this packet
  300. pktinfo    ends
  301. endif
  302.  
  303. filest    struc
  304. dta    db 26 dup(0)    ; DOS, 21 resev'd bytes, file attr, 2 each date & time
  305. sizelo    dw 0        ; DOS, file size double word
  306. sizehi    dw 0
  307. fname    db 13 dup(0)    ; DOS, filename, asciiz, with dot. End of DOS section
  308. handle    dw -1        ; Kermit, file handle
  309. string    db 64 dup(0)    ; Kermit, filename string, including drive and path
  310. fstat    db 0        ; Kermit, status of Find First DOS call
  311. filest    ends
  312.  
  313. takinfo    struc        ; Take file structure
  314. taktyp    db 0        ; type: 0FEh = valid file handle, 0FFh = a macro
  315. takhnd    dw 0        ; file handle
  316. takbuf    dw 0        ; offset of Take buffer
  317. takptr    dw 0        ; pointer in buffer to next char to read
  318. takcnt    dw 0        ; number of unread bytes in buffer
  319. takctr    dw 0        ; COUNT variable for script program control
  320. takargc    dw 0        ; argument quantity count
  321. takinfo ends
  322.  
  323. ; Port Information
  324. prtinfo    struc
  325. baud    dw 0        ; Default baud rate
  326. ecoflg    db 0        ; Local echo flag (default off)
  327. parflg    db 0        ; Parity flag (default none)
  328. floflg    db 0        ; If need flow control
  329. hndflg    db 0        ; If need handshake during file transfer
  330. hands    db 0        ; Default handshake
  331. flowc    dw 0        ; Do flow control with XON/XOFF
  332. duplex    db 0        ; Do full (0) or half (1) duplex comms
  333. portrdy db 0        ; Non-zero if comms port is still active
  334. sndproc dw 0        ; byte sending procedure
  335. rcvproc dw 0        ; byte receiving procedure
  336. cloproc dw 0        ; session close procedure
  337. prtinfo    ends
  338.                 ; ENABLE/DISABLE bits for denyflg
  339. cwdflg    equ    1        ; deny remote cwd
  340. delflg    equ    2        ; deny remote del
  341. dirflg    equ    4        ; deny remote dir
  342. hostflg    equ    8        ; deny remote host
  343. spcflg    equ    10H        ; deny remote space
  344. finflg    equ    20H        ; deny fin, bye, logo to server
  345. getsflg    equ    40H        ; deny paths in get cmds to server
  346. sndflg    equ    80H        ; deny paths in send cmds to server
  347. typflg    equ    100H        ; deny paths in type
  348. pasflg    equ    200h        ; username/password required
  349. kerflg    equ    400h        ; deny remote kermit
  350. prtflg    equ    800h        ; deny remote print
  351. tekxflg    equ    8000h        ; deny automatic Tektronix invokation
  352.  
  353. ifndef save_mem
  354. statinfo struc            ; statistics, basic information layout
  355. prbyte    dw    2 dup (0)    ; number of bytes received by port
  356. psbyte    dw    2 dup (0)    ; number of bytes sent to port
  357. frbyte    dw    2 dup (0)    ; bytes received
  358. fsbyte    dw    2 dup (0)    ; bytes sent
  359. prpkt    dw    2 dup (0)    ; number of packets received
  360. pspkt    dw    2 dup (0)    ; number of packets sent
  361. nakrcnt    dw    0        ; count of naks received
  362. nakscnt    dw    0        ; count of naks sent
  363. btime    dw    2 dup (0)    ; start time (seconds) of transfer
  364. etime    dw    2 dup (0)    ; elapsed time (seconds) of transfer
  365. pretry    dw    0        ; packet retries
  366. xstatus    db    0        ; transfer status
  367. xname    db    64 dup (0)    ; alias (send/receive as) filename
  368. statinfo ends
  369.  
  370. endif
  371.  
  372. scptinfo struc            ; scripts
  373. inactv    db    0        ; input action value (default proceed)
  374. incasv    db    0dfh        ; input case  (default ignore)
  375. indfto    dw    1        ; input and pause timeout (def 1 sec)
  376. inecho    db    1        ; echo Input cmd text (0 = no)
  377. xmitfill db    0        ; non-zero to TRANSMIT filler for blank line
  378. xmitlf    db    0        ; non-zero to TRANSMIT LF's
  379. xmitpmt    db    lf        ; default prompt for line acknowledgments
  380. xmitpause dw    0        ; millisec pause between lines
  381. scptinfo ends
  382.  
  383. ; definitions for terminal handler:
  384. termarg    struc
  385. flgs    db 0        ; flags
  386. prt    db 0        ; port to use (0,1,etc)
  387. captr    dw 0        ; routine to call with captured data
  388. baudb    db 0        ; baud rate bits
  389. parity    db 0        ; parity
  390. termarg    ends
  391.  
  392. ; bits for flag byte
  393. capt    equ 40h        ; capture output
  394. emheath    equ 20h        ; emulate heath
  395. trnctl    equ 08h        ; translate controls (debug)
  396. modoff    equ 04h        ; mode line off
  397. lclecho    equ 01h        ; local echo
  398.  
  399. ; bits for kstatus general Kermit status word
  400. kssuc    equ    0000h    ; success condition
  401. kssend    equ    0001h    ; send file failed
  402. ksrecv    equ    0002h    ; get/receive file failed
  403. ksrem    equ    0004h    ; Remote command failed
  404. kstake    equ    0008h    ; Take file failure
  405. ksgen    equ    0010h    ; general command failure
  406. ksuser    equ    0080h    ; user intervention (aka Control-C)
  407.  
  408. mkeyw    macro    key,value    ; widely used data structure
  409.     local    keylen,start
  410. start    equ    $        ; remember start address of structure
  411.     dw    keylen        ; length of "key"
  412.     db    key        ; "key" itself
  413. keylen    equ    $-(start+2)    ; number of bytes in "key"
  414.     dw    value        ; action value
  415.     endm
  416. ;
  417. ; Note well. The following segment references are in THIS file to provide
  418. ; the desired ordering of them in memory. To wit: lowest addresses for
  419. ; 'code', followed by 'data', and only then by 'stack'.
  420. code    segment public 'kcode'
  421. code    ends
  422. code1    segment public 'kcode'
  423. code1    ends
  424. code2    segment public 'kcode'
  425. code2    ends
  426. data    segment public 'kdata'
  427. data    ends
  428. data1    segment public 'kdata'
  429. data1    ends
  430. _TEXT    SEGMENT  WORD PUBLIC 'CODE'
  431. _TEXT    ENDS
  432. _DATA    SEGMENT  WORD PUBLIC 'DATA'
  433. _DATA    ENDS
  434. CONST    SEGMENT  WORD PUBLIC 'CONST'
  435. CONST    ENDS
  436. _BSS    SEGMENT  WORD PUBLIC 'BSS'
  437. _BSS    ENDS
  438. _STACK    SEGMENT    WORD STACK 'STACK'
  439. _STACK    ENDS
  440. DGROUP    GROUP    CONST, _BSS, _DATA, _STACK
  441.     .list
  442.