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