home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / HEATH / HMSRC20.LBR / HMODEM80.HZ / HMODEM80.H
Text File  |  2000-06-30  |  12KB  |  430 lines

  1. /*************************** hmodem80.h *************************************/
  2.  
  3. #ifdef   C80
  4. #include "e:printf.h"
  5. #endif
  6.  
  7. #ifndef        MAIN
  8. #define        EXTERN   extern
  9. #else
  10. #define        EXTERN
  11. #endif
  12.                                     
  13. #define        PBUFSIZ         2048    /*2k printer buffer*/
  14. #define        DFLTPORT        0330    /*default modem port*/
  15. #define        DFLTINDEX       7       /* pointer to default baud */
  16. #define        BUFSTART        16384 /*16k text buffer starting size*/
  17. #define        DIRCTIO         6       /*cpm bdos direct-console io command*/
  18. #define        INPUT           0xff    /*direct-console io input*/
  19. #define        FALSE           0
  20. #define        TRUE            1
  21. #define        OK              0
  22. #define        NERROR         (-1)
  23. #define        NULL            0
  24. #define        ERROR           0
  25. #define        GETCUR          25      /* bdos get current disk command */
  26. #define        KEYHIT          0
  27. #define        MAXFILES        255    /* max number of expanded files */
  28. #define        FNSIZE          15   /* filename: 2(A:)+8+1+3+null */
  29.  
  30. /**************************************************************************/
  31. /*                                                                        */
  32. /*      Miscellaneous ASCII characters.                                   */
  33. /*                                                                        */
  34. /**************************************************************************/
  35.  
  36. #define        LF              10
  37. #define        CR              13
  38. #define        CTRLZ           26      /*end of text-file character*/
  39.  
  40. /*************************************************************************/
  41. /*                                                                       */
  42. /*      These #defines determine which keys will be interpreted as       */
  43. /*  command characters.                                                  */
  44. /*                                                                       */
  45. /*************************************************************************/
  46.  
  47. #define        VT52            '/'     /*code to indicate VT52 seq*/
  48. #define        F1              'S'
  49. #define        F2              'T'
  50. #define        F3              'U'
  51. #define        F4              'V'
  52. #define        F5              'W'
  53. #define        ERASE           'J'
  54. #define        BLUE            'P'
  55. #define        RED             'Q'
  56. #define        WHITE           'R'
  57. #define        LEVELFLAG       0xff00
  58. #define        RECEIVE         F1      /*receive file*/
  59. #define        CAPTURE         F2      /*toggle capture mode*/
  60. #define        DIR             F3      /*get disk directory*/
  61. #define        PRTSCRN         F4      /*print screen*/
  62. #define        SEND            F5      /*send file*/
  63. #define        HANGUP          ERASE   /*erase key to hangup*/
  64. #define        COMMAND         BLUE    /*change command mode*/
  65. #define        HELP            RED     /*get instructions*/
  66. #define        QUIT            WHITE   /*quit*/
  67. #define        DIAL            (F1 | LEVELFLAG) /*make phone call*/
  68. #define        HOST            (F2 | LEVELFLAG) /* host mode */
  69. #define        CONFIG          (F3 | LEVELFLAG) /*configure system*/
  70. #define        TOGPRT          (F4 | LEVELFLAG) /*toggle printer*/
  71. #define        DISK            (F5 | LEVELFLAG)  /*reset disk, erase file*/
  72. #define        CHELP           (RED | LEVELFLAG)
  73. #define        CCOMMAND        (BLUE | LEVELFLAG)
  74. #define        CHANGUP         (ERASE | LEVELFLAG)
  75. #define        CQUIT           (WHITE | LEVELFLAG)
  76.  
  77. /******************* constants used in file transfer **********************/
  78.  
  79. /* Ward Christensen / CP/M parameters - Don't change these! */
  80.  
  81. #define        SOH            1
  82. #define        ENQ            5
  83. #define        CAN            ('X'&037)
  84. #define        XOFF           ('s'&037)
  85. #define        XON            ('q'&037)
  86. #define        STX            2
  87. #define        CPMEOF         26
  88. #define        EOF            (-1)
  89. #define        TIMEOUT        (-2)
  90. #define        RCDO           (-3)
  91. #define        ERRORMAX       5
  92. #define        RETRYMAX       10
  93. #define        WCEOT          (-10)
  94. #define        SECSIZ         128    /* cp/m's Magic Number record size */
  95. #define        PATHLEN        257    /* ready for 4.2 bsd ? */
  96. #define        KSIZE          1024    /* record size with k option */
  97. #define        EOT             4
  98. #define        ACK             6
  99. #define        NAK             21
  100. #define        WANTCRC         'C'
  101.  
  102. #define        TICCNT          0x0b    /*address of H8/H89 timer*/
  103. #define        ORIGIN          0x0100  /*starting point for cp/m programs*/
  104. #define        COMPSIZ         35      /*cpm bdos compute file size command*/
  105. #define        CTRLX           24
  106. #define        ESC             27
  107. #define        COLUMNS         4       /*number of dir columns displayed*/
  108. #define        CPMBUF          0x80    /*address of cpm file buffer*/
  109. #define        SELDSK          14      /*bdos select disk command*/
  110. #define        SFF             17      /*bdos search for first command*/
  111. #define        SFN             18      /*bdos search for next command*/
  112. #define        SETDMA          26      /*bdos set dma address */
  113. #define        RESET           13      /*bdos reset disk command*/
  114. #define        GETDPB          31      /*get disk paramenter block addr*/
  115. #define        GETALL          27      /*get allocation vector*/
  116. #define        GCS             11      /*get console status*/
  117. #define        DONE            0xff    /*flag for no more entries*/
  118. #define        BS              8
  119. #define        DEL             127
  120. #define        CTRLE           5
  121. #define        RET             '!'     /*symbol for CR string terminator */
  122. #define        WAITASEC        '~'     /* one second delay */
  123. #define        BIOSADDR        1       /*ptr to base of bios + 3*/
  124. #define        LISTST          42      /*index to list status routine*/
  125. #define        MBUFSIZ         1024    /*size of modem input buffer*/
  126. #define        ENABLE          0xfb    /*code for EI*/
  127. #define        RTN             0xc9    /*code for RET*/
  128. #define        JUMP            0xc3    /*code for JMP*/
  129. #define        CONIN           1       /*bdos call for console input*/
  130. #define        OUTSTAT         040         /*ready-for-output status*/
  131. #define        INSTAT          001         /*ready-for-input status*/
  132. #define        CONNECTSTAT     0x80        /* carrier detect */
  133. #define        NOPARITY        0x00        /* line settings */
  134. #define        EVENPARITY      0x18
  135. #define        ODDPARITY       0x08
  136. #define        SEVENBITS       0x02
  137. #define        EIGHTBITS       0x03
  138. #define        ONEBIT          0x00
  139. #define        TWOBITS         0x40
  140. #define        CTRLS           19          /* xoff */
  141. #define        CTRLQ           17          /* xon */
  142.  
  143. /************************ configuration variables **********************************/
  144.  
  145. EXTERN int BFlag
  146. #ifdef   MAIN
  147. = FALSE
  148. #endif
  149. ;
  150. EXTERN int PFlag
  151. #ifdef   MAIN
  152. = FALSE
  153. #endif
  154. ;
  155. EXTERN int FDx
  156. #ifdef   MAIN
  157. = TRUE
  158. #endif
  159. ;
  160. EXTERN int Crcflag
  161. #ifdef   MAIN
  162. = TRUE
  163. #endif
  164. ;
  165. EXTERN int XonXoff
  166. #ifdef   MAIN
  167. = FALSE
  168. #endif
  169. ;
  170. EXTERN char Msgfile[20]
  171. #ifdef   MAIN
  172. = "HMODEM.MSG"
  173. #endif
  174. ;
  175. EXTERN char Phonefile[20]
  176. #ifdef   MAIN
  177. = "HMODEM.FON"
  178. #endif
  179. ;
  180. EXTERN char Logfile[20]
  181. #ifdef   MAIN
  182. = "HMODEM.LOG"
  183. #endif
  184. ;
  185. EXTERN char Cfgfile[20]
  186. #ifdef   MAIN
  187. = "HMODEM.CFG"
  188. #endif
  189. ;
  190. EXTERN char KbMacro[12][22]
  191. #ifdef   MAIN
  192.  = { "Macro Key 0!",
  193.      "Macro Key 1!",
  194.      "Macro Key 2!",
  195.      "Macro Key 3!",
  196.      "Macro Key 4!",
  197.      "Macro Key 5!",
  198.      "Macro Key 6!",
  199.      "Macro Key 7!",
  200.      "Macro Key 8!",
  201.      "Macro Key 9!",
  202.      "Macro Key .!",
  203.      "Macro Key ENTER!" }
  204. #endif
  205. ;
  206.  
  207. EXTERN struct modemparms {
  208.    char init[20];
  209.    char dialcmd[8];
  210.    char dialsuffix[8];
  211.    char connect[20];
  212.    char busy1[20];
  213.    char busy2[20];
  214.    char busy3[20];
  215.    char busy4[20];
  216.    char hangup[20];
  217.    int timeout;
  218.    int pause;
  219. } Modem
  220. #ifdef   MAIN
  221.    = {
  222.    "ATE0V1X4S0=0!",
  223.    "ATDT",
  224.    "!",
  225.    "CONNECT",
  226.    "BUSY",
  227.    "NO CARRIER",
  228.    "NO RESPONSE TO DIAL",
  229.    "ERROR",
  230.    "~+++~ATH0!",
  231.    40,8
  232.    }
  233. #endif
  234. ;
  235.  
  236. EXTERN struct hostparms {
  237.    char welcome[40];
  238.    char autoanswer[20];
  239.    char password[20];
  240.    char user[20];
  241.    int modemconnection;
  242. } Host
  243. #ifdef MAIN
  244. = {
  245.    "Welcome to HModem Host!",
  246.    "ATS0=2!",
  247.    "PASSWORD",
  248.    "null",
  249.    TRUE }
  250. #endif
  251. ;
  252.  
  253. EXTERN struct settings {
  254.    int cbaudindex;
  255.    char cparity;
  256.    int cdatabits;
  257.    int cstopbits;
  258. } Current;
  259.          
  260. EXTERN struct lineparms {
  261.    int baudindex;
  262.    char parity;
  263.    int databits;
  264.    int stopbits;
  265.    int port;
  266.    int lstatus;
  267.    int mstatus;
  268. } Line
  269. #ifdef MAIN
  270. = { DFLTINDEX,'N', 8, 1, DFLTPORT, DFLTPORT+5, DFLTPORT+6 }
  271. #endif
  272. ;
  273. EXTERN char Mci[20];
  274. EXTERN char Sprint[20];
  275. EXTERN int Zmodem
  276. #ifdef MAIN
  277.  = FALSE
  278. #endif
  279. ;
  280. EXTERN int Nozmodem
  281. #ifdef MAIN
  282.  = FALSE
  283. #endif
  284. ;
  285. EXTERN int Blklen
  286. #ifdef MAIN
  287.  = SECSIZ
  288. #endif
  289. ;
  290. EXTERN int Xmodem
  291. #ifdef MAIN
  292.  = FALSE
  293. #endif
  294. ;
  295. EXTERN int Zrwindow          /* RX window size (controls garbage count) */
  296. #ifdef MAIN
  297.  = 1400
  298. #endif
  299. ;
  300. EXTERN unsigned Bufsize
  301. #ifdef   MAIN
  302. = BUFSTART
  303. #endif
  304. ;
  305. EXTERN unsigned Pbufsiz
  306. #ifdef   MAIN
  307. = PBUFSIZ
  308. #endif
  309. ;
  310. EXTERN unsigned *Ticptr
  311. #ifdef   MAIN
  312. = TICCNT
  313. #endif
  314. ;
  315. EXTERN int Intlevel
  316. #ifdef   MAIN
  317. = 5
  318. #endif
  319. ;
  320. EXTERN int Datadrive
  321. #ifdef   MAIN
  322. = 'A'
  323. #endif
  324. ;
  325. EXTERN char Waste[128];     /* pad to allow config to be multiple of 128 */
  326.  
  327. /************************ global variables **********************************/
  328.  
  329. EXTERN struct phonebook {
  330.    char name[18];
  331.    char number[18];
  332.    int pbaudindex;        
  333.    char pparity;
  334.    int pdatabits;
  335.    int pstopbits;
  336.    int echo;
  337. } *Book;
  338.  
  339. EXTERN unsigned Baudtable[11]
  340. #ifdef MAIN
  341.  = { 50,75,110,300,450,600,1200,2400,4800,9600,19200 }
  342. #endif
  343. ;
  344. EXTERN unsigned Divtable[11]
  345. #ifdef MAIN
  346.  = { 2304,1536,1047,384,256,192,96,48,24,12,6 }
  347. #endif
  348. ;
  349. EXTERN int QuitFlag
  350. #ifdef   MAIN
  351. = FALSE
  352. #endif
  353. ;
  354. EXTERN char Pathname[128];
  355. EXTERN char Buf[128];                /* general purpose buffer */
  356. EXTERN char *MainBuffer;
  357. EXTERN char *Prtbuf;
  358. EXTERN unsigned Buftop;
  359. EXTERN unsigned TxtPtr
  360. #ifdef   MAIN
  361. = 0
  362. #endif
  363. ;
  364. EXTERN char Stline[]
  365. #ifdef   MAIN
  366. = "\033x5\033j\033x1\033Y8 "
  367. #endif
  368. ;
  369. EXTERN char Endline[]
  370. #ifdef   MAIN
  371. = "\033k\033y5"
  372. #endif
  373. ;
  374. EXTERN char Vl[]          /* graphics vertical line */
  375. #ifdef   MAIN
  376.  = "\033F`\033G"
  377. #endif
  378. ;
  379. EXTERN char *Mdmhead;
  380. EXTERN char *Mdmtail;
  381. EXTERN char *Mdmtop;
  382. EXTERN char *Mdmbottom;
  383. EXTERN char *Prthead;
  384. EXTERN char *Prttail;
  385. EXTERN char *Prttop;
  386. EXTERN char *Prtbottom;
  387. EXTERN int Stopped
  388. #ifdef MAIN
  389.  = FALSE
  390. #endif
  391. ;
  392. EXTERN int Inhost
  393. #ifdef MAIN
  394.  = FALSE
  395. #endif
  396. ;
  397. EXTERN char *MdmInBuffer;
  398. EXTERN char Version[]
  399. #ifdef MAIN
  400. =  "Version 2.06.00 (CP/M 2.2) 12 May 1988"
  401. #endif
  402. ;
  403. EXTERN char Lastlog[20];
  404. extern char Cmode;
  405. struct stat {
  406.    char fname[9];
  407.    char fext[4];
  408.    int dcode;
  409.    int records;
  410. };
  411. EXTERN char **Pathlist;
  412. EXTERN int Hlap
  413. #ifdef MAIN
  414.  = 0
  415. #endif
  416. ;
  417. EXTERN int Tlap
  418. #ifdef MAIN
  419.  = 0
  420. #endif
  421. ;
  422. EXTERN int Mdmport;
  423. EXTERN int Mdmstat;
  424. EXTERN int Linestat;
  425. EXTERN int Dialing;
  426. EXTERN int Lastkey;
  427. EXTERN int Invokdrive, Currdrive;
  428.  
  429. /**************************** end of hmodem80.h ****************************/
  430.