home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / c / m4kerm.jar < prev    next >
Text File  |  2020-01-01  |  481KB  |  15,205 lines

  1. This file is a text archive of the files for Tandy Model 4 Kermit.
  2. Each file begins with a line <<< name >>>, where "name" is the name of
  3. the file.  The files begin on the next line.
  4. <<< m4boo.bas >>>
  5. 10 INPUT "Input filename";INFILE$
  6. 20 INPUT "Output filename (/CMD file)";OUTFILE$
  7. 30 OPEN "I",1,INFILE$:OPEN "O",2,OUTFILE$
  8. 40 WHILE (EOF(1)=0)
  9. 50    INPUT #1,A$:IF INSTR(A$,"*****")<>0 THEN 150
  10. 60    FOR T=1 TO LEN(A$) STEP 2: B=VAL("&h"+MID$(A$,T,2))
  11. 70       SUM=(SUM+B) AND -4097
  12. 80       PRINT #2,CHR$(B);
  13. 90    NEXT T
  14. 100 WEND
  15. 110 PRINT "Error: Early End-Of-File Encountered!"
  16. 120 PRINT "Last record read:"
  17. 130 PRINT A$
  18. 140 CLOSE: END
  19. 150 I=INSTR(A$," ")+1:J=INSTR(I,A$," ")-I:NEWSUM=VAL(MID$(A$,I,J))
  20. 160 IF NEWSUM=SUM THEN PRINT "Checksum OK:";NEWSUM;"=";SUM: GOTO 180
  21. 170 PRINT "Bad checksum:";NEWSUM;"<>";SUM
  22. 180 CLOSE: END
  23. <<< m4h19.equ >>>
  24. *LIST OFF
  25. ;*********
  26. ; TRSDOS/LDOS 6.x  Supervisor Call Equate File
  27. ; (c) 1983 Mark Vasoll - All rights reserved
  28. ; Licensed to Softronics Computer Systems
  29. ;*********
  30. @ABORT    EQU    015H
  31. @ADTSK    EQU    01DH
  32. @BANK    EQU    066H
  33. @BKSP    EQU    03DH
  34. @BREAK    EQU    067H
  35. @CHNIO    EQU    014H
  36. @CKDRV    EQU    021H
  37. @CKEOF    EQU    03EH
  38. @CKTSK    EQU    01CH
  39. @CLOSE    EQU    03CH
  40. @CMNDI    EQU    018H
  41. @CMNDR    EQU    019H
  42. @CTL    EQU    005H
  43. @DATE    EQU    012H
  44. @DCINIT    EQU    02AH
  45. @DCRES    EQU    02BH
  46. @DCSTAT    EQU    028H
  47. @DEBUG    EQU    01BH
  48. @DECHEX    EQU    060H
  49. @DIRRD    EQU    057H
  50. @DIRWR    EQU    058H
  51. @DIV8    EQU    05DH
  52. @DIV16    EQU    05EH
  53. @DODIR    EQU    022H
  54. @DSP    EQU    002H
  55. @DSPLY    EQU    00AH
  56. @ERROR    EQU    01AH
  57. @EXIT    EQU    016H
  58. @FEXT    EQU    04FH
  59. @FLAGS    EQU    065H
  60. @FNAME    EQU    050H
  61. @FSPEC    EQU    04EH
  62. @GET    EQU    003H
  63. @GTDCB    EQU    052H
  64. @GTDCT    EQU    051H
  65. @GTMOD    EQU    053H
  66. @HDFMT    EQU    034H
  67. @HEXDEC    EQU    061H
  68. @HEX8    EQU    062H
  69. @HEX16    EQU    063H
  70. @HIGH$    EQU    064H
  71. @INIT    EQU    03AH
  72. @IPL    EQU    000H
  73. @KBD    EQU    008H
  74. @KEY    EQU    001H
  75. @KEYIN    EQU    009H
  76. @KLTSK    EQU    020H
  77. @LOAD    EQU    04CH
  78. @LOC    EQU    03FH
  79. @LOF    EQU    040H
  80. @LOGER    EQU    00BH
  81. @LOGOT    EQU    00CH
  82. @MSG    EQU    00DH
  83. @MUL8    EQU    05AH
  84. @MUL16    EQU    05BH
  85. @OPEN    EQU    03BH
  86. @PARAM    EQU    011H
  87. @PAUSE    EQU    010H
  88. @PEOF    EQU    041H
  89. @POSN    EQU    042H
  90. @PRINT    EQU    00EH
  91. @PRT    EQU    006H
  92. @PUT    EQU    004H
  93. @RAMDIR    EQU    023H
  94. @RDHDR    EQU    030H
  95. @RDSEC    EQU    031H
  96. @RDSSC    EQU    055H
  97. @RDTRK    EQU    033H
  98. @READ    EQU    043H
  99. @REMOV    EQU    039H
  100. @RENAM    EQU    038H
  101. @REW    EQU    044H
  102. @RMTSK    EQU    01EH
  103. @RPTSK    EQU    01FH
  104. @RREAD    EQU    045H
  105. @RSLCT    EQU    02FH
  106. @RSTOR    EQU    02CH
  107. @RUN    EQU    04DH
  108. @RWRIT    EQU    046H
  109. @SEEK    EQU    02EH
  110. @SEEKSC    EQU    047H
  111. @SKIP    EQU    048H
  112. @SLCT    EQU    029H
  113. @SOUND    EQU    068H
  114. @STEPI    EQU    02DH
  115. @TIME    EQU    013H
  116. @VDCTL    EQU    00FH
  117. @VER    EQU    049H
  118. @VRSEC    EQU    032H
  119. @WEOF    EQU    04AH
  120. @WHERE    EQU    007H
  121. @WRITE    EQU    04BH
  122. @WRSEC    EQU    035H
  123. @WRSSC    EQU    036H
  124. @WRTRK    EQU    037H
  125. AFLAG$    EQU    0
  126. CFLAG$    EQU    2
  127. DFLAG$    EQU    3
  128. EFLAG$    EQU    4
  129. FEMSK$    EQU    5
  130. IFLAG$    EQU    8
  131. KFLAG$    EQU    10
  132. MODOUT    EQU    12
  133. NFLAG$    EQU    13
  134. OPREG$    EQU    14
  135. RFLAG$    EQU    17
  136. SFLAG$    EQU    18
  137. TFLAG$    EQU    19
  138. UFLAG$    EQU    20
  139. VFLAG$    EQU    21
  140. WRINTMASK$    EQU    22
  141. SVCTABPTR    EQU    26
  142. VERSIONBYTE    EQU    27
  143. ICNFGVECTOR    EQU    28
  144. KITSKVECTOR    EQU    31
  145. ;*********
  146. ; End of Equate File
  147. ;*********
  148. *LIST ON
  149. <<< m4h19.hex >>>
  150. 050648313920202001020030181D000006244845415448000000005F5F14007D00000000000000
  151. 000029002803C336363E65EF79E67F4F3264372A07377CB52808E5210000220737C979FE1BCA50
  152. 31FE20DA4E30CD5936C341363A6437874F0600216630095E2356EB7CB53A6437CA4136E9000000
  153. 0000000000000000000000A630D030D5300631000018313E310000000000000000000000000000
  154. 000000000000000000000000000000000000000000003A1230B7CA47323A11306FED5B13303E01
  155. D390424B0B78B120FBAFD390424B0B78B120FB2D20E8C341363E18C3D831C50604F53E0FEFF1C1
  156. 3E4F95FE08D2F0303E1DCD31363E1AC331367DC608E6F86FC5D5E50603F53E0FEFF101020031E1
  157. D1C1C341363E1ACDD8313A1C30E6023E1DC4D831C34136210000C5D5E50603F53E0FEFF1E1D1C1
  158. C3AE33210000C5D5E50603F53E0FEFF1E1D1C1C341363E1DCDD8313A1C30E6013E1AC4D831C341
  159. 36217431220737C341364142434445464748494A4B4C4D4E4F594066717078796A6B626F6C3A64
  160. 37215931061B11A0314EB9280E23131310F7210000220737C34136EB5E2356210000220737EB3A
  161. 6437E9D6310631DE31D0301831E331E6312B31E931AE33223483357F353D3482349B3489344732
  162. 913496349B349B349132B33205335733D8323E1B326437C32E363E19C3D831C34136C34136C506
  163. 04F53E0FEFF1C17CB7C2D6313E0FCD31363E17212F01020032FF117FFF015000F5F5F3FD7E0EE6
  164. FED384F1EDB8F5FD7E0EF601D384FBF1F13D20E2111337D5D5E1133620014F00EDB02600D1C5E5
  165. D506090E00F53E0FEFF1D1E1C13E0EC331363E10CD31360E00C52600111337C5E5D506090E01F5
  166. 3E0FEFF1D1E1C1E5626B06507EEE80772310F9E1C5E5D506090E00F53E0FEFF1D1E1C1247CFE18
  167. 20CCFBC1790CB728C23E11C3D831ED5BF136C50604F53E0FEFF1C1EBE5010737B7ED42E1280773
  168. 23722322F136C341362AF13601F336B7E5ED42E128152B562B5E22F136EBC5D5E50603F53E0FEF
  169. F1E1D1C1C34136C50604F53E0FEFF1C1E52E00C5D5E50603F53E0FEFF1E1D1C1CD2234E1C5D5E5
  170. 0603F53E0FEFF1E101020033D1C1C34136C50604F53E0FEFF1C1CDBB361100F8B7ED52444D78B1
  171. 28372100F81101F8F5F3FD7E0EE6FED384F13620F5FD7E0EF601D384FBF10B78B12816F5F3FD7E
  172. 0EE6FED384F1EDB0F5FD7E0EF601D384FBF1C34136C50604F53E0FEFF1C1E5CDBB36EBE12E00CD
  173. BB36EBB7D5ED52444D78B12835E1545D13F5F3FD7E0EE6FED384F13620F5FD7E0EF601D384FBF1
  174. 0B78B12816F5F3FD7E0EE6FED384F1EDB0F5FD7E0EF601D384FBF1C34136C50604F53E0FEFF1C1
  175. CDBB36E5E5C1217FFFB7ED42E5C1E12857E5D113C5D5E53E0FCD3136E1D1C1F5F3FD7E0EE6FED3
  176. 84F13620F5FD7E0EF601D384FBF13E1EF5F3FD7E0EE6FED384F1F578B12812F1EDA0010200343D
  177. 20F5F5FD7E0EF601D384FBF118DDF1F5FD7E0EF601D384FBF13E0EC33136C34136C50604F53E0F
  178. EFF1C1E5CDBB36E32E4FCDBB36C1C579BD28E41883111337D5C50604F53E0FEFF1C1E5C5E5D506
  179. 090E01F53E0FEFF1D1E1C13E4F95260019E5D1B728064F060023EDB03E2012E1D1C5E5D506090E
  180. 00F53E0FEFF1D1E1C1C34136AF320937C341363E01320937C341363E11C3D8313E10C3D83121CE
  181. 342207373A6437320B37C34136FD34FD34FD3428353F35FD34FD3400350A35FD34FD34FD343A35
  182. 3535FD34FD3414351E353A0B37FE782808FE79206B0E1218020E003A6437D631FE09D24136FE00
  183. DA4136CB27814F060021AA34095E2356D5C9C34136010200353A1C30F601321C3018F33A1C30F6
  184. 02321C3018E93A1C30E6FE321C3018DF3A1C30E6FD321C3018D52A0C377CB5CA4136114136D5E9
  185. 3E0FC3D8312A0E3718EC3E0EC3D8313A6437D620DA4136FE18D24136321237215D35220737C341
  186. 363A6437D620DA4136FE50D241366F3A123767C5D5E50603F53E0FEFF1E1D1C1C341363E011801
  187. AF320A37C50604F53E0FEFF1C13E1794286BFDE5E5C5D5F53E0FCD3136F1D1C1E1FDE13A0A37B7
  188. 282DE52E00CDBB36F1E5D101500009F5F3FD7E0EE6FED384F1C5EDB0C1F5FD7E0EF601D384FBF1
  189. 3CFE1720E36718303E1794212FFF117FFF015000F5F3FD7E0EE6FED384F1C5EDB8C1F5FD7E0EF6
  190. 01D384FBF13D20E501F50036C50604F53E0FEFF1C1E5111337D5D5E113014F003620EDB0D1E1C5
  191. E5D506090E00F53E0FEFF1D1E1C13E0EC331363A64374F0602B7BFDDE5DD2A0B303E14EFDDE13A
  192. 6437BFC9210000C5D5E50603F53E0FEFF1E1D1C1C3AE33F5C50604F53E0FEFF1C1E53A0937B728
  193. 38111337C5E5D506090E01F53E0FEFF1D1E1C13E4F954F0600B7281D2E4F260019D55D542BEDB8
  194. D1E1C5E5D506090E00F53E0FEFF1D1E1C1E5E1F1C32E3606083A0F304F3E0FEFC906083A10304F
  195. 3E0FEFC9C5F5D5E5D12100F801500015FACD360918F9160019D1F1C1C9C5F5D50100F8B7ED4216
  196. 00015000B7ED42DAEB361418F70962D1F1C1C9F336010E07370000000000A736B136000000016D
  197. 64370048313920456D756C61746F722D66696C74657220666F7220545253444F5320362E322E20
  198. 5772697474656E2062793A2020477265676720576F6E6465726C791D1A4C6F6164206164647265
  199. 73733A2003202020202020202020456E64696E6720616464726573733A200301021F380000ED53
  200. 0B303E65EFFD2210372165373E0AEF21000006003E64EF221530220230E521FEF3C1B7E5ED42E1
  201. 3802C5E123016507B7ED42E52B22173006003E64EFD1ED531F3821CF37E53E63EF3603E13E0AEF
  202. 2A1F38010030B7E5ED42221A30E101650709E521B5373E0AEFD121CF37E53E63EF360DE13E0AEF
  203. DD21EB38ED4B1A30DD6E00DD23DD6600DD23DDE5E5DDE1DD6E00DD660109DD7500DD7401C1C5DD
  204. E121693AB7ED4220D4016507ED5B1F38210030EDB0DD2A0B30ED5B1F38DD360047DD7301DD7202
  205. 210000BFC9CC3122302C302F303A304130463049304C304F305630603063307430763078307A30
  206. 7E308030A730AB30AE30B330CE30D330E43001021F39CE31E930EE300431093129313C31413151
  207. 3154315731753178317D318C318F3199319D31A031A231A431A631A831AA31AC31AE31B031B231
  208. B431B631B831BA31BC31BE31C031C231C431C631C831CA31D931DC31E131E431E731F531233245
  209. 3252328F32B8331D343E348034843487348C348F34943499349C349F34A234A534A834CF342935
  210. 2E3531353B3545354A354F355235553558355B355E35633568356C357D358535A735B0350B362C
  211. 362F363A3665366B36A536AA36B436C836E6360C370E3742365736FA314A329E35E0340C319332
  212. A132AE32B132B432B732C532D632F136D031D231D431F23203330F33553362336933AC33383542
  213. 35AA34AC34014C1F3AAE34B034B234B434B634B834BA34BC34BE34C034C234C434C634C834CA34
  214. CC34EC34F534FE3444314B314E3113311631013506350B35103515351A351F352435E7342D3433
  215. 34D13320340202213800000000000000000000000000000000
  216. ***** 768 *****
  217. <<< m4h19.mac >>>
  218. ;        m4h19/mac
  219. *LIST OFF
  220. SWAP_IN        MACRO
  221.         PUSH    AF
  222.         DI
  223.         LD    A,(IY+SCR_MASK)
  224.         AND    S_IN
  225.         OUT    (132),A
  226.         POP    AF
  227.         ENDM
  228. ;
  229. SWAP_OUT    MACRO
  230.         PUSH    AF
  231.         LD    A,(IY+SCR_MASK)
  232.         OR    S_OUT
  233.         OUT    (132),A
  234.         EI
  235.         POP    AF
  236.         ENDM
  237. ;
  238. SVC        MACRO    #P1
  239.         PUSH    AF
  240.         LD    A,#P1
  241.         RST    28H
  242.         POP    AF
  243.         ENDM
  244. ;
  245. SSVC        MACRO    #P1
  246.         LD    A,#P1
  247.         RST    28H
  248.         ENDM
  249. ;
  250. GET_CURSOR    MACRO
  251.         PUSH    BC
  252.         LD    B,4
  253.         SVC    @VDCTL
  254.         POP    BC
  255.         ENDM
  256. ;
  257. PUT_CURSOR    MACRO
  258.         PUSH    BC
  259.         PUSH    DE
  260.         PUSH    HL
  261.         LD    B,3
  262.         SVC    @VDCTL
  263.         POP    HL
  264.         POP    DE
  265.         POP    BC
  266.         ENDM
  267. ;
  268. GET_LINE    MACRO
  269.         PUSH    BC
  270.         PUSH    HL
  271.         PUSH    DE
  272.         LD    B,9
  273.         LD    C,1
  274.         SVC    @VDCTL
  275.         POP    DE
  276.         POP    HL
  277.         POP    BC
  278.         ENDM
  279. ;
  280. PUT_LINE    MACRO
  281.         PUSH    BC
  282.         PUSH    HL
  283.         PUSH    DE
  284.         LD    B,9
  285.         LD    C,0
  286.         SVC    @VDCTL
  287.         POP    DE
  288.         POP    HL
  289.         POP    BC
  290.         ENDM
  291. ;
  292. *LIST ON
  293. <<< m4h19s.hex >>>
  294. 05065345544831390102002511B32901FF00ED53AF29EDB01100273E53EFC2E726E5DDE111C92A
  295. 2AAF297EFE0DCA3B26FE2828032318F32B3E11EFC23B263AD02AB72811E660C2D5262A58297CB7
  296. C2CD267DDD770F3ADA2AB72811E660C2D5262A56297CB7C2CD267DDD77103AE42AB72849E6A0C2
  297. D52606002100003E64EFC2DF26DD7E174FDD7E1847B7ED42C2C426DD7E156FDD7E166706003E64
  298. EFC2DF262168293E19EF2172293E19EF217C293E19EF2187293E19EFC337263AF12AB7280EE660
  299. C2D5262A5E29DD7513DD74143AFD2AB72811E660C2D5262A5C297CB7C2CD267DDD77113A052BB7
  300. CAEC25E6A0C2D5263A6029DD77123A1F2BB7CA0D26E6A0C2D526DD4E1DDD461EDDE501020026E1
  301. 090EFF3A6629B728020E7F713A0D2BB7280CE6A0C2D5263A6229B7C43B263A152BB72812E6A0C2
  302. D5263A6429B7CA372621C2273E0AEF210000C92178273E0AEFDD6E102600CDAD262188273E0AEF
  303. DD6E0F2600CDAD260E0D3E02EF21B4273E0AEF21BB27DD7E12B7200321BE273E0AEF2199273E0A
  304. EFDD6E112600CDAD2621A6273E0AEFDD6E13DD6614CDAD262124273E0AEFDD4E1DDD461EDDE5E1
  305. 097E213527FEFF20032139273E0AEFC911B52AD53E61EFEB3603E13E20BE20032318FA3E0AEFC9
  306. 2107273E0AEFC39425216827DD213C27DD2154273E0AEF21FFFFC9F6C04F3E1AEF18F43AB129B7
  307. 20E43C32B1292195293E19EF21A1293E19EFC30C25010200272448454154480043616E206E6F74
  308. 207265636C61696D2075736564206D656D6F7279210D0A537472697020387468206269743A2003
  309. 5945530D4E4F0D43616E206E6F742066696E64204831392066696C7465720D4261642070617261
  310. 6D657465722076616C75650D56616C756520746F6F206C617267650D4E6F726D616C2063757273
  311. 6F723A20032C20426C6F636B20637572736F723A20032C204475726174696F6E3A20032C204672
  312. 657175656E63793A200342656C6C3A20034F4E034F4646035265636F676E697A65642070617261
  313. 6D65746572733A0A435552534F522020202020202D2020204E6F726D616C20637572736F722063
  314. 6861726163746572010200280A424C4F434B202020202020202D202020426C6F636B2063757273
  315. 6F72206368617261637465720A42454C4C20202020202020202D2020205475726E2062656C6C20
  316. 4F4E206F72204F46460A4652455155454E43592020202D2020204672657175656E6379206F6620
  317. 62656C6C2028696E7665727365206F66207265616C2066726571290A4455524154494F4E202020
  318. 202D2020204C656E677468206F6620746F6E652028323535204D4158290A535452495038202020
  319. 2020202D20202052656D6F766520387468206269742066726F6D20636861726163746572732028
  320. 64656661756C743D4F4E290A52454D4F56452020202020202D20202052656D6F766501B8002920
  321. 7468652066696C7465722066726F6D206D656D6F72790A53484F5720202020202020202D202020
  322. 53686F7720616C6C2076616C7565730A48454C5020202020202020202D20202054686973206D65
  323. 73736167650A0D0000000000000000000000000000000000007265736574202A736F0D72657365
  324. 74202A68700D72656D6F7665202A68700D726F757465202A736F202A646F0D736574202A687020
  325. 6831390D66696C746572202A736F202A687000000020202020015CC92A8085424C4F434B005829
  326. 86435552534F520056294652454D4F5645005A29994652455155454E4359005E29984455524154
  327. 494F4E005C294442454C4C0060294453484F570062294448454C50006429465354524950380066
  328. 290002020025000000000000000000000000000000000000000000000000000000000000000000
  329. 000000000000000000000000000000000000000000000000000000000000000000000000000000
  330. 000000000000000000000000000000000000000000000000000000000000000000000000000000
  331. 000000000000000000000000000000000000000000000000000000000000000000000000000000
  332. 000000000000000000000000000000000000000000000000000000000000000000000000000000
  333. 000000000000000000000000000000
  334. ***** 3468 *****
  335. <<< m4ker.src >>>
  336. <<< m4add.asm >>>
  337. ;    m4add/asm
  338. ;
  339. ;    Input a line from a take file
  340. ;
  341. DOTAKE    EQU    $
  342.     LD    HL,CMDBUF    ;WHERE TO PUT THE TEXT
  343.     LD    B,0        ;CHARACTER COUNTER
  344.     CALL    CONIN
  345.     IFA    128,TAKERR    ;Jump if break was pressed
  346. TAKLOP    LD    DE,TFCB        ;FCB FOR TAKE FILE
  347.     CALL    XGET        ;Call @GET svc
  348.     JR    NZ,TAKERR    ;QUIT ON AN ERROR
  349.     LD    (HL),A        ;SAVE THE CHARACTER
  350.     INC    HL        ;POINT TO THE NEXT
  351.     INC    B        ;ADD TO CHARACTER COUNT
  352.     IFA    CR,TAK020    ;Go if at the end of string
  353.     LD    C,A
  354.     LD    A,(TAKLOG)    ;IS DISPLAY OF TAKE FILES ON?
  355.     OR    A
  356.     LD    A,C
  357.     CALL    NZ,CONOUT
  358.     JR    TAKLOP
  359. TAK020    RET            ;RETURN WITH THE STRING
  360. TAKERR    LD    DE,TFCB        ;GET READY TO CLOSE THE FILE
  361.     CALL    XCLOSE        ;Close the file
  362.     XOR    A        ;TURN THE TAKE FLAG OFF
  363.     LD    (TAKFLG),A    ;RESET IT
  364.     LD    A,29
  365.     CALL    CONOUT
  366.     SCF            ;SET CARRY FOR A PARSE ERROR
  367.     RET
  368. ;
  369. ;    This routine is used by the command parser routines to input a
  370. ;    string from the keyboard.  It recognizes the TAKFLG which tells
  371. ;    it to input a string from the active take file.
  372. ;    Input to the routine is HL which points to the string buffer,
  373. ;    and B which has an initial count of the number of characters
  374. ;    already in the buffer.
  375. ;
  376. GETSTR    LD    A,(TAKFLG)    ;Is there a TAKE file active
  377.     OR    A
  378.     JP    NZ,DOTAKE    ;If so than go fill buffer from file.
  379.     LD    IY,(FLAGS)    ;Get the flags address.
  380.     BIT    5,(IY+18)    ;Check if JCL active.
  381.     JR    Z,SKIP_JCL    ;Jump if JCL not active.
  382.     LD    HL,CMDBUF    ;Get the input buffer.
  383.     LD    BC,5000H    ;Set B to max count, and C to zero.
  384.     JP    XKEYIN        ;Get a line from JCL and return.
  385. ;
  386. SKIP_JCL    PUSH    HL    ;Save the registers
  387.     PUSH    DE    
  388.     LD    A,B        ;Save the number of character already in
  389.     LD    (TEMP4),A    ;the buffer for later
  390. GET010    CALL    XKEY        ;Get a character from the keyboard
  391.     JP    NZ,GETEXT    ;Humm, what do we do on an error
  392.     IFANOT    8,GET030    ;Go if not backspace
  393.     LD    E,A        ;Save the KEY we got
  394.     LD    A,B        ;Get the number of characters 
  395.     IFZ    GET010        ;Go if no place to backspace over
  396.     DEC    B        ;At least one space left
  397.     DEC    HL        ;Back up the buffer pointer
  398.     LD    A,E        ;Get the character 
  399.     CALL    CONOUT        ;Display it
  400.     JR    GET010        ;Go get a new key
  401. GET030    IFA    CR,GET040    ;Go if enter pressed
  402.     IFANOT    24,GET036    ;Jump if not SHIFT <-
  403. GET035    LD    A,B        ;NUMBER LEFT
  404.     IFZ    GET010        ;Go if all were erased
  405.     LD    A,8        ;BACKSPACE
  406.     CALL    CONOUT        ;PRINT IT
  407.     DEC    B        ;ONE MORE LEFT
  408.     DEC    HL        ;BACKUP IN THE BUFFER
  409.     JR    GET035        ;KEEP LOOPING
  410. GET036    IFA    ESC,GET040    ;Go if it was escape
  411.     IFANOT    129,GET038    ;Go if not F1 (Also escape)
  412.     LD    A,ESC        ;GET AN ESCAPE
  413.     JR    GET040        ;JOIN THE CODE FOR EXIT
  414. GET038    IFA    128,GET040    ;Go it it was a break
  415.     IFALT    20H,GET010    ;Ignore other control keys
  416. GET040    INC    B        ;ONE LESS CHARACTER LEFT
  417.     LD    (HL),A        ;PUT THE CHARACTER IN THE BUFFER
  418.     JR    NZ,GET050    ;WHEN nZ IS SET, NO MORE CHARS LEFT
  419.     DEC    B        ;SAY WE STILL HAVE ONE
  420.     JR    GET060        ;MIGHT BE '?' WHICH IS IGNORED AS LAST
  421. GET050    IFA    CR,GETEXT    ;Finish up if CR pressed
  422.     IFA    ESC,GETEXT    ;Same for escape
  423.     IFA    128,GETEXT    ;Same for break
  424.     INC    HL        ;ONE MORE IN THE BUFFER
  425.     CALL    CONOUT        ;PRINT WHAT WAS TYPED
  426. GET060    CP    '?'        ;WAS IT A '?' ?
  427.     JP    NZ,GET010    ;GET A NEW KEY IF NOT
  428.     LD    A,8        ;GET A BACKSPACE
  429.     CALL    CONOUT        ;PRINT IT TO REMOVE THE '?'
  430.     DEC    HL        ;POINT AT THE '?'
  431.     PUSH    HL        ;HL -> IY
  432.     POP    IY
  433.     LD    A,' '        ;LOOK FOR A PREVIOUS SPACE
  434.     IFA    (IY-1),GETEXT    ;Look for a previous space
  435.     LD    A,B        ;ARE WE AT THE START OF THE LINE
  436.     DEC    A
  437. ;IF Z IS SET THAN THE CURSOR IS AT HOME ON THE LINE.    NO SPACE WILL
  438. ;BE ADDED IN THIS CASE.
  439.     LD    A,' '        ;PUT A SPACE ON THE DISPLAY
  440.     CALL    NZ,CONOUT    ;PRINT IT
  441. GETEXT    LD    A,B        ;GET NUMBER ON THE LINE
  442.     DEC    A
  443.     JR    NZ,GET110    ;AT LEAST ONE CHAR ON THE LINE
  444.     PUSH    AF        ;PUT AF INTO BC
  445.     POP    BC
  446.     LD    A,(HL)        ;WAS '?' THE TERMINATOR?
  447.     CP    '?'
  448.     LD    A,B        ;GET THE LENGTH IN A
  449.     JR    NZ,GET120
  450. GET110    INC    A        ;COUNT THE TERMINATOR IF IT IS '?'
  451. GET120    LD    B,A        ;SAVE THE LENGTH
  452.     LD    A,(HL)        ;GET THE TERMINATOR
  453.     IFA    ESC,GET130    ;Skip normal return if escape
  454.     SLA    A        ;CHECK FOR BREAK (128 IS NEGATIVE)
  455.     JR    C,GET130    ;ALSO GIVES C STATUS LIKE @KEYIN
  456.     SRL    A        ;FIX IT BACK
  457.     OR    10H        ;MAKE CR, CHR$(29), '?' IS UNDISTURBED
  458.     CALL    CONOUT        ;PRINT THE CHARACTER
  459. GET130    POP    DE        ;RESTORE THE REGS
  460.     POP    HL
  461.     RET            ;RETURN TO THE CALLER
  462. ;
  463. STDOUT    LD    A,16        ;REVERSE VIDEO ON
  464.     JP    CONOUT        ;USE THE RETURN ON THE STACK
  465. STDEND    LD    A,17        ;REVERSE VIDEO OFF
  466.     JP    CONOUT        ;USE THE RETURN ON THE STACK
  467. ;
  468. ;ENTRY POINT FOR INTERUPT DRIVEN RECEIVE CHARACTER ROUTINE.
  469. ;
  470. GETINT    JR    NZ,GTIN10    ;NO CHARACTER AVAILABLE
  471.     LD    HL,(CURCHR)    ;CURRENT POS IN BUFFER
  472.     LD    (HL),C        ;CHARACTER IS IN C, STORE IT
  473.     INC    L        ;POINT TO NEXT WRITE POSITION
  474.     LD    A,(NXTCHR)    ;CHECK FOR OVERFLOW
  475.     IFA    L,GTIN10
  476.     LD    (CURCHR),HL    ;SAVE ADDRESS OF NEXT STORE
  477.     LD    A,(MAXCNT)
  478.     LD    E,A
  479.     LD    HL,INCNT    ;Get the address of the count
  480.     INC    (HL)        ;Add one to the count
  481.     LD    A,(HL)        ;Get the count
  482.     IFALT    E,GTIN10    ;Jump if below count
  483.     LD    A,(FLOFLG)    ;ARE WE DOING FLOW CONTROL?
  484.     IFZ    GTIN10        ;Go if not doing flow control
  485.     LD    A,C        ;GET THE CHARACTER JUST RECEIVED
  486.     IFA    XOFF,GTIN06    ;Jump if XOFF received
  487.     IFANOT    XON,GTIN07    ;Jump if not time for XON
  488.     XOR    A
  489. GTIN06    LD    (XOFREC),A    ;Store the new flag value
  490. GTIN07    LD    A,(XFFLG)    ;SEE IF WE ALREADY SENT IT
  491.     IFNZ    GTIN10        ;Go if XOFF already sent
  492.     INC    A        ;MAKE IT NON-ZERO
  493.     LD    (XFFLG),A    ;SET IT
  494.     LD    E,XOFF        ;Get an XOFF character
  495.     CALL    OUTCHR        ;SENT IT OUT
  496. GTIN10    RET
  497. ;
  498. ;LOG THE CHARACTER IN THE LOG FILE
  499. ;
  500. LOGIT    PUSH    AF        ;Save the character to log
  501.     LD    A,(LOGFLG)    ;Check if logging active
  502.     IFANOT    2,LOGITO    ;Go if logging not on, or file not open
  503.     POP    AF        ;Get the character back
  504.     PUSH    AF        ;Put the character back
  505.     IFANOT    LF,LOGT0    ;Is it LINE FEED? Jump if not
  506.     LD    A,(PREVLCHR)    ;Check if previous character was <CR>
  507.     IFA    CR,LOGITO    ;Throw out <LF> if previous was <CR>
  508.     LD    A,LF        ;Get a line feed character back
  509. LOGT0    PUSH    DE        ;Save the registers
  510.     LD    (PREVLCHR),A    ;Save the previous character
  511.     LD    DE,LFCB        ;Get the FCB address
  512. LOGT1    CALL    XPUT        ;@PUT the character to the file
  513.     JR    Z,LOGEXT    ;Exit if no errors on output
  514. LOGT2    CALL    XERROR0        ;Print the system message given in A
  515.     LD    DE,LFCB        ;Get the FCB back
  516.     CALL    XCLOSE        ;Make sure that the file is closed
  517.     STROUT    ERMS20        ;Say that the file was closed
  518.     XOR    A        ;Reset the logging flag
  519.     LD    (LOGFLG),A    ;Store the new value
  520. LOGEXT    POP    DE        ;Restore DE
  521. LOGITO    POP    AF        ;Restore the character 
  522.     RET            ;Back to caller
  523. ;
  524. ;    These are the TRSDOS 6.x SVC definitions
  525. ;
  526. XPARAM    DOSVC    17        ;@PARAM SVC (Parse ()'d argument list).
  527. XFSPEC    DOSVC    78        ;@FSPEC SVC (Convert filename to TRSDOS)
  528. XINIT    DOSVC    58        ;@INIT SVC (Create a file on disk device)
  529. XOPEN    DOSVC    59        ;@OPEN SVC (Open a file)
  530. XREAD    DOSVC    67        ;@READ SVC (Read a record)
  531. XSKIP    DOSVC    72        ;@SKIP SVC (Skip a logical record)
  532. XCLOSE    DOSVC    60        ;@CLOSE SVC (Close a file)
  533. XVER    DOSVC    73        ;@VER SVC (Write with verification)
  534. XCTL    DOSVC    5        ;@CTL SVC, perform control operation
  535. XPRT    PUSH    BC        ;Send character to printer
  536.     PUSH    AF
  537.     LD    C,A
  538.     LD    A,6
  539.     JR    SVCSAV
  540. XVDCTL    DOSVC    15        ;@VDCTL SVC (Perform video operations)
  541. XGET    DOSVC    3        ;@GET SVC (Get a character from a file)
  542. ;
  543. ;    SVC'S that require the character passed in A to be in C should
  544. ;    look like this.
  545. ;
  546. XPUT    PUSH    BC        ;SAVE BC
  547.     PUSH    AF        ;SAVE AF
  548.     LD    C,A
  549.     LD    A,4        ;@PUT SVC
  550. SVCSAV    RST    28H        ;CALL AN SVC
  551.     POP    BC        ;POPPING BC DOES NOT AFFECT THE FLAGS
  552.     LD    (XERRNO),A    ;Store last error number
  553.     LD    A,B        ;B HAS OLD A SO RESTORE
  554.     POP    BC        ;GET OLD BC
  555.     RET            ;RETURN TO THE CALLER
  556. XKEYIN    DOSVC    9        ;Get a string from *DO (@KEYIN SVC)
  557. XHIGH    DOSVC    100        ;@HIGH$ SVC
  558. XLOAD    DOSVC    76        ;@LOAD SVC (Load an executable)
  559. XCHKDRV    DOSVC    33        ;@CHKDRV SVC (Check if drive is ready)
  560. XTIME    DOSVC    19        ;@TIME SVC (Get current system time)
  561. XADTSK    DOSVC    29        ;@ADTSK SVC (Add a task to the table)
  562. XCKTSK    DOSVC    28        ;@CKTSK SVC (Check if task slot available)
  563. XRMTSK    DOSVC    30        ;@RMTSK SVC (Remove task from table)
  564. XKLTSK    DOSVC    32        ;@KLTSK SVC (Kill current exec task)
  565. XPAUSE    DOSVC    16        ;@PAUSE SVC (Delay for count in BC)
  566. XFLAGS    DOSVC    101        ;@FLAGS SVC (Get system flags address)
  567. XREMOVE    DOSVC    57        ;@REMOV SVC (Remove opened file)
  568. XKILL    EQU    XREMOVE
  569. XDECHEX    DOSVC    96        ;@DECHEX SVC (Convert ASCII to binary)
  570. XHEXDEC    DOSVC    97        ;@HEXDEC SVC (Convert binary to ASCII)
  571. XKBD    DOSVC    8        ;@KBD SVC (Get a keyboard char, no wait)
  572. XKEY    DOSVC    1        ;@KEY SVC (Get a keyboard char, wait)
  573. XCMNDR    DOSVC    25        ;@CMNDR SVC (Execute system command)
  574. XMUL16    DOSVC    91        ;@MUL16 SVC (Multiply 8 bit by 16 bi&t)
  575. XDSP    PUSH    BC        ;SAVE BC
  576.     PUSH    AF        ;SAVE AF
  577.     LD    C,A
  578.     LD    A,2        ;@DSP SVC
  579.     JP    SVCSAV
  580. XGTDCB    DOSVC    82        ;@GTDCB SVC (Get the DCB for given device)
  581. XEXIT    LD    L,A        ;A HAS OUR RETURN CODE
  582.     LD    H,0        ;MAKE HL THE RETURN CODE
  583.     DOSVC    22        ;Do @EXIT SVC
  584. XERROR0    LD    A,0        ;Get the last error number
  585. XERRNO    EQU    $-1
  586. XERROR    PUSH    BC        ;SAVE BC AND AF
  587.     PUSH    AF
  588.     LD    IY,(FLAGS)    ;GET @FLAGS ADDRESS
  589.     RES    6,(IY+2)    ;RESET ALL SPECIAL BITS
  590.     RES    7,(IY+2)
  591.     RES    6,(IY+18)
  592.     OR    0C0H        ;MAKE SIMPLE MESSAGES
  593.     LD    C,A        ;C NEEDS THE ERROR NUMBER
  594.     CALL    NEWLIN        ;Get a new line for the messages
  595.     LD    A,26        ;@ERROR SVC    (ISSUE A SYSTEM MESSAGE)
  596.     JP    SVCSAV        ;GO CALL IT
  597. ;
  598. ;    Set up interrupt and device information
  599. ;
  600. SETINT    EQU    $
  601. ;
  602. ;    This code sets up the interrupt driven receiver.  It calls @CTL
  603. ;    to pass the address of the "GETINT" routine, which is called
  604. ;    each time a character is received by the UART
  605. ;
  606.     LD    IY,GETINT        ;Where to transfer control to
  607.     LD    DE,(CLDCB)        ;Which device to get
  608.     LD    C,4            ;Ctl function 4
  609.     CALL    XCTL            ;Do @CTL
  610. ;
  611. ;    Install *FO and *FI devices
  612. ;
  613.     LD    DE,0        ;Find a new DCB for this device
  614.     CALL    XGTDCB
  615.     JR    NZ,NODCB    ;Abort if an error occured
  616.     LD    (FOTDCB),HL    ;Save the pointer to the DCB
  617.     PUSH    HL        ;Move it to IX to do indexing
  618.     POP    IX
  619.     LD    (IX+6),'F'    ;Store the name in the DCB
  620.     LD    (IX+7),'O'
  621.     LD    A,2        ;Select @PUT capabilities only
  622.     LD    (IX),A
  623.     LD    HL,FILOUT    ;Get the entry point
  624.     LD    (IX+1),L    ;Store it
  625.     LD    (IX+2),H
  626.     LD    DE,0        ;Get a new DCB for the input device
  627.     CALL    XGTDCB
  628.     JR    NZ,NODCB    ;Abort if an error occurs
  629.     LD    (FINDCB),HL    ;Save the address of the DCB
  630.     PUSH    HL        ;Put the address in IX for indexing
  631.     POP    IX
  632.     LD    (IX+6),'F'    ;Store the device name in the DCB
  633.     LD    (IX+7),'I'
  634.     LD    A,1        ;Select @GET capabilites only
  635.     LD    (IX),A
  636.     LD    HL,FILIN    ;Get the entry point
  637.     LD    (IX+1),L    ;Store the address
  638.     LD    (IX+2),H
  639.     RET            ;Done!
  640. ;
  641. ;    Print no DCB's available message
  642. ;
  643. NODCB    STROUT    NONDCB        ;Print NO NEW DCB's message
  644.     JP    EXIT1        ;Exit from KERMIT
  645. ;
  646. ;    Get a new line to print on
  647. ;
  648. NEWLIN    PUSH    AF        ;Save the acumulator
  649.     LD    A,CR        ;Get a <CR><LF> equivilent
  650.     CALL    CONOUT        ;Output it to the screen
  651.     POP    AF        ;Restore A
  652.     RET            ;Return to caller
  653. ;
  654. ;    Set the default disk drive command
  655. ;
  656. SETDSK    EQU    $
  657.     LD    A,CMNUM        ;PARSE A NUMBER
  658.     CALL    COMND
  659.     JP    KERMT3
  660.     OR    A        ;If no number than say bad command
  661.     JP    Z,KERMT2
  662.     LD    A,D        ;Check for number above 255
  663.     IFNZ    SETDRV_2    ;Jump if number bigger than 255
  664.     LD    C,E        ;Get the lower order byte
  665.     CALL    XCHKDRV        ;Check the disk drive
  666.     JR    NZ,SETDRV_2    ;Jump if TRSDOS doesn't like it
  667.     PUSH    BC        ;Save the binary number
  668.     JR    NC,SETDRV_1    ;If carry set the drive is write protected
  669.     STROUT    WRTPROT        ;Say drive is write protected
  670. SETDRV_1    STROUT    DSKOK    ;Say default drive changed
  671.     POP    BC        ;Get the drive number back
  672.     LD    A,C        ;Get the binary value into a
  673.     ADD    A,48        ;Make it and ASCII digit
  674.     LD    (DEFDSK),A    ;Save it as the new default
  675.     JP    KERMIT        ;Get a new command
  676. ;
  677. ;    Print bad drive message
  678. ;
  679. SETDRV_2    LD    A,32    ;Get the illegal drive message number
  680.     CALL    XERROR        ;Have TRSDOS print the message
  681.     JP    KERMIT        ;Go get a new command
  682. ;
  683. ;    Clear any buffered characters from input buffer
  684. ;
  685. CLRPRT    PUSH    AF
  686.     LD    A,(NXTCHR)    ;Set the next, and current positions
  687.     LD    (CURCHR),A    ;within the buffer to be the same
  688.     XOR    A        ;Set buffered character count to zero
  689.     LD    (INCNT),A
  690.     LD    (XOFREC),A    ;Reset XOFF'd state
  691.     LD    (XFFLG),A    ;Haven't sent XOFF either
  692.     POP    AF
  693.     RET
  694. ;
  695. ;    Display the directory
  696. ;
  697. ;This code makes an educated guess as to whether it is running on a
  698. ;6.1 or a 6.2 TRSDOS machine.    This is to determine if we should
  699. ;issue the DIR command for 6.1 or the CAT command for 6.2
  700. ;
  701. DIR    EQU    $
  702.     LD    A,CMTXT        ;Get text for DIR/CAT command
  703.     LD    DE,DIRBUF
  704.     CALL    COMND
  705.     JP    KERMT3
  706.     IFNZ    DIR1C        ;Jump if some text given
  707. DIR1B    LD    A,(DEFDSK)    ;Otherwise, use default drive
  708.     LD    (DIRBUF),A    ;Put in the text
  709.     LD    A,CR        ;Put in the terminator
  710.     LD    (DIRBUF+1),A
  711. DIR1C    CALL    NEWLIN        ;Get new lines
  712.     CALL    NEWLIN
  713.     LD    IY,(FLAGS)    ;Check if using 6.1, or 6.2 TRSDOS
  714.     LD    A,(IY+27)    ;Get the version number
  715.     AND    0FH        ;KEEP JUST THE X OF 6.X
  716.     LD    HL,DO62DR    ;Get 6.2 command (CAT)
  717.     IFA    2,DIR1E        ;Jump if 6.2
  718.     LD    HL,DO61DR    ;Get 6.1 command (DIR)
  719. DIR1E    LD    DE,DIRCMD    ;Where to put the text
  720.     LD    BC,4        ;How much to move
  721.     PUSH    DE        ;Save the start
  722.     LDIR            ;Move the command
  723.     POP    HL        ;Restore the start
  724.     CALL    XCMNDR        ;Let TRSDOS do it for us
  725. DIR1D    JP    KERMIT        ;Get a new command
  726. ;
  727. ;    Erase a file from the system
  728. ;
  729. ERA    EQU    $
  730.     LD    A,CMTXT        ;Get some text
  731.     LD    DE,MFNBUF
  732.     PUSH    DE        ;Save the buffer address
  733.     CALL    COMND
  734.     JP    KERMT3
  735.     IFZ    ERA3        ;Jump if no text given
  736.     CALL    NEWLIN        ;Get a newline
  737.     POP    HL        ;Get the address back
  738.     LD    (MFNPTR),HL
  739.     XOR    A
  740.     LD    (LOGNAMES),A    ;Reset the log names flag
  741.     CALL    BUILDF        ;Do wild carding
  742.     LD    A,(FILECNT)    ;Check if anything found
  743.     IFZ    ERA3
  744.     LD    (MFNPTR),HL    ;Save the start of the list
  745. ERA2    CALL    MFNAME        ;Get one filename from the buffer
  746.     JR    C,ERA3        ;Jump if no more
  747.     LD    DE,MFREQ    ;Get the name
  748.     LD    B,0        ;Select 256 LRL
  749.     LD    HL,DATA        ;Get the address of a temp buffer
  750.     CALL    XOPEN        ;Try to open it
  751.     JR    Z,ERA1        ;Jump if opened
  752.     CP    42        ;Was it an LRL error message?
  753.     JR    Z,ERA1        ;Jump if it was
  754. ERA0    CALL    XERROR0        ;Issue the message indicated in A
  755.     JR    ERA3        ;Get a new command
  756. ;
  757. ;    Print the removing message, then remove it
  758. ;
  759. ERA1    LD    HL,FCB        ;Convert ETX to EOS in FCB
  760.     LD    BC,32        ;Max distance
  761.     LD    A,3        ;What to find
  762.     CPIR            ;Look
  763.     DEC    HL        ;Ignore errors
  764.     LD    (HL),EOS    ;Change it
  765.     STROUT    REMOVSTR    ;Output 'Removing: ' message
  766.     STROUT    FCB        ;Output the filename
  767.     CALL    NEWLIN        ;Get a newline
  768.     LD    DE,MFREQ    ;Get the FCB
  769.     CALL    XKILL        ;Remove the file
  770.     JR    Z,ERA2        ;Abort if error occurs
  771.     JR    ERA0        ;Get the next one
  772. ;
  773. ERA3    JP    KERMIT        ;Get a new command
  774. ;
  775. ;    This routine sets up KERMIT/INI as initialization.  The trick
  776. ;    is to just make it look like the user typed 'TAKE KERMIT/INI'.
  777. ;
  778. CHKTAK    CALL    XFLAGS        ;Get the flags area into IY
  779.     LD    A,(IY+10)    ;Get the KFLAG$
  780.     AND    0F8H        ;Reset the <ENTER>, <BREAK> and
  781.     LD    (IY+10),A    ;the <PAUSE> bits, and store it
  782.     LD    B,46        ;Pause for a good deal of time 
  783.     CALL    XPAUSE
  784.     LD    A,(IY+10)    ;Get the KFLAG$ mask back
  785.     AND    7        ;Any of the keys pressed?
  786.     RET    NZ        ;Stop if BREAK, ENTER, or PAUSE
  787.     LD    DE,TFCB        ;LOAD THE FCB ADDRESS
  788.     LD    HL,TKNAME    ;NAME OF THE FILE
  789.     LD    BC,TKLEN    ;LENGTH OF THE STRING
  790.     LDIR
  791.     LD    DE,TFCB        ;GET IT AGAIN
  792.     LD    HL,TBUF        ;GET THE INPUT BUFFER
  793.     LD    B,0        ;256 BYTE LRL
  794.     CALL    XOPEN        ;OPEN THE FILE
  795.     JR    Z,CHKT_1    ;Jump if everything OK
  796.     CP    42
  797.     RET    NZ        ;Return if NOT LRL error
  798. CHKT_1    LD    A,1        ;SET THE TAKE COMMAND ACTIVE FLAG
  799.     LD    (TAKFLG),A
  800.     RET            ;GO DO IT.
  801. ;
  802. ;    Print ESCAPE character sequence as CONTROL-?
  803. ;
  804. ESCPR    LD    A,(ESCCHR)    ;GET THE ESCAPE CHAR.
  805. ESCPR1    IFAGE    ' ',ESCPR2    ;IS IT A CONTROL CHAR?
  806.     PUSH    AF
  807.     STROUT    INMS10        ;Output CONTROL-
  808.     POP    AF        ;GET THE CHAR BACK
  809.     OR    100O        ;DE-CONTROLIFY.
  810. ESCPR2    CALL    CONOUT
  811.     RET    
  812. ;
  813. ;    Swap screens between connect mode, and KERMIT command modes
  814. ;
  815. SWAPIN    LD    A,15        ;cursor off
  816.     CALL    CONOUT        ;Tell *DO to turn it off
  817.     LD    HL,2600H    ;Get the destination
  818.     LD    B,6
  819.     CALL    XVDCTL        ;Move screen image to temp space
  820.     LD    HL,SWTBUF    ;Move the buffer to the screen
  821.     LD    B,5
  822.     CALL    XVDCTL        ;Move it
  823.     LD    HL,2600H    ;Now move temp buffer to swap buffer
  824.     LD    DE,SWTBUF
  825.     LD    BC,1920
  826.     LDIR            ;Move it
  827.     LD    A,14        ;cursor back on
  828.     CALL    CONOUT
  829.     RET            ;Return to the caller
  830. ;
  831. ;    Put connect command screen in view
  832. ;
  833. SCRCON    EQU    $
  834.     CALL    SWAPIN        ;Swap screens
  835.     LD    B,4        ;Select get cursor position option
  836.     CALL    XVDCTL        ;SVC @VDCTL to get position
  837.     LD    (CMDCRS),HL    ;Save the cursor
  838.     LD    HL,(CONCRS)    ;Get the connect cursor postion
  839.     LD    B,3        ;Select SET cursor position
  840.     CALL    XVDCTL        ;SVC @VDCTL to set it
  841.     LD    A,14        ;Make sure that the cursor is ON
  842.     CALL    CONOUT
  843.     RET            ;Return to caller
  844. ;
  845. ;    Swap in Kermit command screen
  846. ;
  847. SCRCMD    EQU    $
  848.     CALL    SWAPIN        ;Swap screens
  849.     LD    B,4        ;Get the current cursor position
  850.     CALL    XVDCTL        ;SVC @VDCTL to get it
  851.     LD    (CONCRS),HL    ;Save it
  852.     LD    HL,(CMDCRS)    ;Get the Kermit command cursor position
  853.     LD    B,3        ;Set the current cursor position
  854.     CALL    XVDCTL        ;SVC @VDCTL to set it
  855.     LD    A,14        ;Make sure the cursor is on
  856.     CALL    CONOUT
  857.     RET            ;Return
  858. ;
  859. ;    *FI Device driver is here
  860. ;
  861. ;    Valid memory module headers are used here, but are not necessary
  862. ;    since the drivers are not in the High or Low memory chain of
  863. ;    modules.
  864. ;
  865. FILIN    JR    INPFIL        ;Jump to code
  866.     DW    ENDIN        ;End of module
  867.     DB    4        ;Module name length
  868.     DB    'INP$'
  869. FINDCB    DW    0        ;Pointer to our DCB
  870.     DW    0
  871. PRECHR    DB    0        ;Previous character received
  872. INPFIL    CALL    INPORT        ;Get an input character
  873.     JR    Z,INP04        ;Jump if successful
  874.     CALL    CONIN        ;Failed, read the keyboard
  875.     IFZ    INPFIL        ;Jump if no key pressed
  876.     IFANOT    128,INP03    ;Jump if not break
  877.     LD    A,28        ;Return at EOF indicator
  878.     OR    A        ;Set NZ status
  879.     RET            ;return to caller
  880. INP03    LD    E,A        ;Get the keyboard character
  881.     CALL    OUTCHR        ;Output it to the port
  882.     JR    INPFIL        ;Read the port again
  883. INP04    LD    C,A        ;Get the input character
  884.     LD    A,(FLOFLG)    ;Are we doing flow control?
  885.     IFNZ    INP05        ;Jump if not doing flow control
  886.     LD    A,C        ;Get the character back
  887.     IFA    XON,INPFIL    ;Ignore XON if sent
  888.     IFA    XOFF,INPFIL    ;Ignore that also
  889. INP05    LD    A,(PRECHR)    ;Get the previous character
  890.     CP    CR        ;Was it CR?
  891.     LD    A,C        ;Get the current character
  892.     JR    NZ,INP09    ;Jump if not CR
  893.     LD    A,(FILTYPE)    ;Check if should convert
  894.     OR    A        ;Is it binary mode?
  895.     LD    A,C
  896.     JR    NZ,INP09    ;It is, so do not translate
  897.     CP    LF        ;Is the current character LF?
  898.     LD    (PRECHR),A    ;Store new previous
  899.     JR    Z,INPFIL    ;Ignore LF after CR
  900. INP09    CP    A        ;Set Z status
  901.     RET            ;Return byte to caller in A
  902. ENDIN    EQU    $
  903. ;
  904. ;    *FO Device driver is here
  905. ;
  906. FILOUT    JR    FIOUT        ;Jump to code
  907.     DW    OUTEND-1    ;Normal header
  908.     DB    4
  909.     DB    'OUT$'
  910. FOTDCB    DW    0
  911.     DW    0
  912. FIOUT    LD    E,C        ;Get the character to send
  913. FIOUT1    CALL    OUTCHR        ;Output it.  We will hang till output
  914.     LD    A,C        ;Get the character sent
  915.     CP    A        ;Set the Z flag
  916.     RET            ;Return the byte sent out, and Z status
  917. OUTEND    EQU    $
  918. ; end of file
  919. <<< m4chgs.asm >>>
  920. ;        m4chgs/asm
  921.  
  922. Version 5.2
  923. 9/21/86        Change <ESC-CHAR> ? to not destroy the screen while in connect
  924.         mode.  Save screen, and then restore it after the user presses
  925.         a key.
  926.  
  927. 9/20/86        Fix bug in SET KEY that caused garbage to be returned
  928.         when a new key was defined after ANY key definition
  929.         was used.
  930.  
  931. 7/20/86        Moved SET FILE-WARNING to SET FILE WARNING.
  932.  
  933. 7/1/86        Add wild carding to KILL command.
  934.  
  935. 6/15/86        Add transaction and DEBUG logging.
  936.  
  937. 6/14/86        Fixed dumb terminal emulation, and moved DUMB terminal
  938.         translations to TRMOUT() so that LOCAL ECHO would also
  939.         work correctly.
  940.  
  941. 6/6/86        Changed FILE-TYPE, and FILE-DISPOSITION to be options
  942.         under a new SET value called FILE.  Now the corresponding
  943.         commands are SET FILE TYPE, and SET FILE DISPOSITION.
  944.  
  945. 6/6/86        SHOW was changed also to reflect the changes in SET.
  946.  
  947. 6/3/86        Add (SYSTEM,INVIS) parameters to send command to allow
  948.         these types of files to be ignored.  Neither type is
  949.         allowed by default.  The first letter is enough to
  950.         qualify the full name.
  951.  
  952. 5/30/86        Fixed problem with ^C and ^E exits from the protocol.
  953.         Changed CALL XKLTSK to JP XKLTSK.  TRSDOS evidently
  954.         did not like the extra word on the stack.
  955.  
  956. 5/30/86        Fix error is LOGOUT, BYE, and FINISH retry handling
  957.         that caused weird behavior when MAXTRY retries were
  958.         reached.
  959.  
  960. 5/29/86        Logging now translates CR/LF pairs to just CR
  961.  
  962. 5/28/86        Added wild carding to SEND command
  963.  
  964. Version 5.1    (Never released)
  965.  
  966. 5/24/86        Restructure output of SHOW ALL to include everything
  967.  
  968. 5/2/86        Make it possible to use break to abort a PAUSE
  969.  
  970. 5/2/86        Fixed problem with PAUSE, backwards test changed.
  971.         This error made PAUSE work for one second, no matter
  972.         what the parameter was.
  973.  
  974. Version 5.0
  975.         A large number of changes were made between version
  976.         5 and version 4.  Added REMOTE commands, restructured
  977.         the code quite a bit to clean up some things.  There
  978.         were too many changes to document all of them here.
  979. ; end of file
  980. 
  981. <<< m4cmd.asm >>>
  982. ;    M4CMD/ASM
  983. ;
  984. ;    Jumping to this location will cause the return address on the
  985. ;    stack to be incremented by 3, and then jumped to.  This is used
  986. ;    in several places to make error handling easier.  Code using
  987. ;    this mechanism might look like.
  988. ;
  989. ;    ROUTINE:    EQU    $
  990. ;            ...
  991. ;            CALL    SPACK
  992. ;            JP    ABORT    ;Die on an error
  993. ;            ...        ;Continue normally
  994. ;
  995. ;            RET
  996. ;    SPACK:        EQU    $
  997. ;            ...
  998. ;            LD    A,B    ;Check result
  999. ;            CP    C    ;Must be equal
  1000. ;            RET    NZ    ;Error if not equal
  1001. ;            LD    A,(LEN)    ;Get the length for return
  1002. ;            JP    RSKP    ;Normal return
  1003. ;
  1004. RSKP    POP    HL        ;GET THE RETURN ADDRESS.
  1005.     INC    HL        ;INCREMENT BY THREE.
  1006.     INC    HL
  1007.     INC    HL
  1008.     JP    (HL)        ;Return to return+3 bytes
  1009. ;
  1010. ;    Output the value in HL as an ASCII decimal string
  1011. ;
  1012. NOUT    EQU    $
  1013.     PUSH    HL        ;Save the registers
  1014.     PUSH    BC
  1015.     PUSH    DE
  1016.     LD    DE,NBUFF    ;Get the string buffer
  1017.     PUSH    DE        ;Save the address
  1018.     CALL    XHEXDEC        ;Convert from binary to ASCII
  1019.     EX    DE,HL        ;HL = end of buffer + 1
  1020.     LD    (HL),EOS    ;Add EOS for printing
  1021.     POP    HL        ;Restore the starting address
  1022.     LD    A,' '        ;Remove leading spaces
  1023. NOUT1    IFANOT    (HL),NOUT2    ;Go if not blank
  1024.     INC    HL        ;Point to next character
  1025.     JR    NOUT1        ;Back to top of loop
  1026. NOUT2    EX    DE,HL        ;DE is now start of string to print
  1027.     CALL    PRTSTR        ;Print the number
  1028.     POP    DE        ;Restore the registers
  1029.     POP    BC
  1030.     POP    HL
  1031.     RET
  1032. ;
  1033. ;
  1034. ;    Command parsing routines
  1035. ;
  1036. ;    This routine prints the prompt pointed to by DE, and then
  1037. ;    sets up the appropriate values to allow a reparse at any point
  1038. ;
  1039. PROMPT    POP    HL        ;Get the return address
  1040.     PUSH    HL        ;Put it back
  1041.     LD    (CMRPRS),HL    ;Save it as the reparse address
  1042.     LD    (CMOSTP),SP    ;Save the stack pointer as well
  1043.     LD    (CMPRMP),DE    ;Save the prompt to print
  1044.     LD    HL,CMDBUF    ;Get the start of the command buffer
  1045.     LD    (CMCPTR),HL    ;Initialize the pointer into it
  1046.     LD    (CMDPTR),HL    ;Save 2 copies
  1047.     XOR    A
  1048.     LD    (CMAFLG),A    ;Zero the flags
  1049.     LD    (CMCCNT),A    ;No characters
  1050.     CPL            ;Make it non zero
  1051.     LD    (CMSFLG),A    ;Set these flags
  1052.     LD    A,(TAKFLG)    ;Check if take is active
  1053.     IFZ    PRMT10        ;Jump if not
  1054.     LD    A,(TAKLOG)    ;Is the take-file display flag set?
  1055.     IFZ    PRMT20        ;Jump if not
  1056. PRMT10    CALL    NEWLIN        ;Get a newline
  1057.     LD    DE,(CMPRMP)    ;Print the prompt
  1058.     CALL    PRTSTR
  1059. PRMT20    RET            ;Return to the caller
  1060. ;
  1061. ;    Come to here to initiate a reparse
  1062. ;
  1063. REPARS    LD    SP,(CMOSTP)    ;GET THE OLD STACK POINTER.
  1064.     LD    HL,CMDBUF
  1065.     LD    (CMDPTR),HL
  1066.     LD    A,0FFH        ;TRY IT THIS WAY (DAPHNE.)
  1067.     LD    (CMSFLG),A
  1068.     LD    HL,(CMRPRS)    ;GET THE REPARSE ADDRESS.
  1069.     JP    (HL)        ;GO THERE.
  1070. ;
  1071. ;THIS ADDRESS CAN BE JUMPED TO ON A PARSING ERROR.
  1072. ;
  1073. PRSERR    LD    SP,(CMOSTP)    ;GET THE OLD STACK POINTER.
  1074.     LD    HL,CMDBUF
  1075.     LD    (CMCPTR),HL    ;INITIALIZE THE COMMAND POINTER.
  1076.     LD    (CMDPTR),HL
  1077.     CALL    NEWLIN
  1078.     XOR    A
  1079.     LD    (CMAFLG),A    ;ZERO THE FLAGS.
  1080.     LD    (CMCCNT),A
  1081.     LD    A,0FFH        ;TRY IT THIS WAY (DAPHNE.)
  1082.     LD    (CMSFLG),A
  1083.     LD    DE,(CMPRMP)    ;GET THE PROMPT.
  1084.     CALL    PRTSTR
  1085.     LD    HL,(CMRPRS)
  1086.     JP    (HL)  
  1087. ;
  1088. ;This routine parses the specified function in A.  Any additional
  1089. ;information is in DE and HL.
  1090. ;    Returns to RETURN+3 on success
  1091. ;    Returns to RETURN on failure.  (Assumes that a JP follows CALL)
  1092. ;
  1093. COMND    LD    (CMSTAT),A    ;Save what we are presently parsing.
  1094.     CALL    CMINBF        ;Get chars until action or erase char.
  1095.     CP    CMNUM        ;Is the function "PARSE a number"?
  1096.     JP    Z,CMDNUM    ;Jump if so
  1097.     CP    CMCFM        ;Parse a confirm?
  1098.     JP    Z,CMCFRM    ;Jump if so
  1099.     CP    CMKEY        ;Parse a keyword from a table?
  1100.     JP    Z,CMKEYW    ;Jump if so
  1101.     CP    CMIFI        ;Parse a file spec?
  1102.     JP    Z,CMIFIL    ;If so jump
  1103.     CP    CMIFIN        ;Other file type?
  1104.     JP    Z,CMIFIL    ;If so use same routine
  1105.     CP    CMOFI        ;ditto
  1106.     JP    Z,CMIFIL
  1107.     CP    CMTXT        ;Parse a text string?
  1108.     JP    Z,CMTEXT    ;If so jump
  1109.     LD    DE,CMER00    ;Otherwise parser calling error
  1110.     CALL    PRTSTR        ;So print a message
  1111.     RET            ;And return error
  1112. ;
  1113. ;This routine parses arbitrary text up to a <ENTER>
  1114. ;
  1115. ;    DE=address of text buffer
  1116. ;
  1117. ;    A=number of characters typed (zero or more) on return
  1118. ;
  1119. CMTEXT    EX    DE,HL          ;Put the pointer to the buffer in HL
  1120.     LD    (CMPTAB),HL    ;Save the pointer
  1121.     LD    B,0        ;Initialize the count to zero
  1122. CMTXT1    CALL    CMGTCH        ;Get a character 
  1123.     OR    A        ;Test the high bit for some terminator
  1124.     JP    P,CMTXT5    ;If not then jump
  1125.     AND    7FH        ;Turn off the high bit
  1126.     CP    ESC        ;Is it escape
  1127.     RET    Z        ;Return failure if so
  1128. CMTXT2    IFA    '?',CMTXT7    ;Jump if the user needs help
  1129.     IFA    ' ',CMTXT5    ;If blank, add it to text
  1130.     LD    A,B        ;Get the counter
  1131.     LD    HL,(CMPTAB)    ;Get the updated pointer
  1132.     LD    (HL),CR        ;Put the terminator in
  1133.     EX    DE,HL        ;Move ending pointer to DE
  1134.     JP    RSKP        ;Return success
  1135. ;
  1136. CMTXT3    LD    HL,CMAFLG    ;Point to the action flag
  1137.     LD    (HL),0        ;Reset it
  1138. CMTXT5    INC    B        ;Add one to the count of characters
  1139. CMTXT6    LD    HL,(CMPTAB)    ;Get the pointer
  1140.     PUTHL    A        ;Add the character and increment
  1141.     LD    (CMPTAB),HL    ;Save the update pointer
  1142.     JR    CMTXT1        ;Go get another character
  1143. ;
  1144. CMTXT7    LD    DE,TXTHLP    ;Get the help message
  1145.     CALL    REPRNT        ;Print the message
  1146.     JP    REPARS        ;Jump to the reparse
  1147. ;
  1148. ;This routine parses an input number in ASCII decimal
  1149. ;
  1150. CMDNUM    LD    B,0        ;Reset the character count
  1151.     LD    HL,0        ;Initialize the value to zero
  1152.     LD    (THEVAL),HL
  1153. CMNM10    CALL    CMGTCH        ;Get a character
  1154.     OR    A        ;Check for high bit set terminator
  1155.     JP    P,CMNM50    ;Jump if not
  1156.     AND    7FH        ;Trim the high bit
  1157.     CP    ESC        ;Is it ESCAPE (abort)
  1158.     RET    Z        ;Return error if so
  1159. CMNM20    IFA    '?',CMNM70    ;Go if the user needs help
  1160.     LD    A,B        ;Get the count
  1161.     LD    DE,(THEVAL)    ;Get the number found
  1162.     JP    RSKP        ;Return success
  1163. ;
  1164. CMNM50    INC    B        ;Add one to count of characters
  1165.     PUSH    HL        ;Save the values
  1166.     PUSH    DE
  1167.     PUSH    BC
  1168.     LD    HL,(THEVAL)    ;Get the current number
  1169.     LD    C,10        ;Multiply by 10
  1170.     PUSH    AF        ;Save AF too
  1171.     CALL    XMUL16        ;Multiply 8 bit by 16 bit
  1172.     LD    H,L        ;Move the 24 bit result into HL as 16
  1173.     LD    L,A
  1174.     POP    AF        ;Get the character to add
  1175.     SUB    48        ;Convert to a binary number
  1176.     JP    P,CMNM60    ;Jump if no underflow
  1177. CMNM55    POP    BC        ;Restore the regs
  1178.     POP    DE
  1179.     POP    HL
  1180.     LD    DE,ERMES2    ;Print error message
  1181.     CALL    PRTSTR
  1182.     JP    KERMIT        ;GET A NEW COMMAND
  1183. ;
  1184. CMNM60    IFAGE    10,CMNM55    ;Jump if too big
  1185.     LD    C,A        ;Get it into BC for 16 bit MATH
  1186.     LD    B,0        ;Zero the MSB
  1187.     ADD    HL,BC        ;Compute the new number
  1188.     LD    (THEVAL),HL    ;Save the result
  1189.     POP    BC        ;Restore the registers
  1190.     POP    DE
  1191.     POP    HL
  1192.     JR    CMNM10        ;Loop on
  1193. ;
  1194. CMNM70    LD    DE,NUMHLP    ;Get the HELP message
  1195.     CALL    REPRNT        ;Print the message, and reprint prompt
  1196.     JP    REPARS        ;Plus the rest of the text, and restart
  1197. ;
  1198. ;    Get a confirmation of the command by accepting only <ENTER>
  1199. ;
  1200. CMCFRM    CALL    CMGTCH        ;GET A CHARACTER FROM THE BUFFER
  1201.     OR    A        ;WHAT WAS IT, CONTROL?
  1202.     RET    P        ;NOPE, SO EXIT VIA ERROR RETURN
  1203.     AND    7FH        ;STRIP THE SIGN BIT FLAG
  1204.     IFANOT    '?',CMCFR3    ;Go if not help request
  1205.     LD    DE,CMIN00    ;TELL THEM NO MORE HELP
  1206.     CALL    REPRNT        ;PRINT THE MESSAGE
  1207.     JP    REPARS        ;PRINT THE MESSAGE AND THE PROMPT AGAIN
  1208. CMCFR3    CP    ESC        ;IS IT ABORT?
  1209.     RET    Z        ;TAKE ERROR EXIT IF SO
  1210.     JP    RSKP        ;TAKE NORMAL RETURN
  1211. ;THIS ROUTINE PRINTS THE MESSAGE IN DE AND SETS UP FOR A REPARSE
  1212. REPRNT    CALL    PRTSTR
  1213.     XOR    A
  1214.     LD    (CMAFLG),A
  1215.     CALL    NEWLIN
  1216.     LD    DE,(CMPRMP)
  1217.     CALL    PRTSTR
  1218.     LD    HL,(CMCPTR)
  1219.     DEC    HL
  1220.     LD    (HL),EOS
  1221.     LD    (CMCPTR),HL
  1222.     LD    DE,CMDBUF
  1223.     CALL    PRTSTR
  1224.     RET
  1225. ;THIS ROUTINE PARSES A KEYWORD FROM THE TABLE POINTED
  1226. ;TO IN DE.  THE FORMAT OF THE TABLE IS AS FOLLOWS
  1227. ;
  1228. ;ADDR    DB    N    Where N is the number of entries in the table
  1229. ;    DB    K    Where K is 2+length of longest keyword.
  1230. ;    Repeated for each entry in the table...
  1231. ;    DB    M        Where M is the length of the keyword
  1232. ;    DB    'STRING',EOS    Where string is the KEYWORD.
  1233. ;    DB    A,B           Where A & B are pieces of DATA
  1234. ;                to be returned, (Must be two bytes worth)
  1235. ;
  1236. ;THE KEYWORDS MUST BE IN ALPHABETICAL ORDER.
  1237. ;**** NOTE  THE DATA VALUE A IS RETURNED IN REGISTERS A AND E.  THE
  1238. ;****    DATA VALUE B IS RETURNED IN REGISTER D.  THIS ALLOWS THE TWO DATA
  1239. ;BYTES TO BE STORED AS
  1240. ;DW    XXX
  1241. ;AND RESULT IN A CORRECTLY FORMATTED 16-BIT VALUE IN REGISTER PAIR
  1242. ;DE.
  1243. CMKEYW    LD    (CMPTAB),DE    ;SAVE THE BEGINNING OF KEYWORD for ?
  1244.     LD    A,(DE)        ;GET THE NUMBER OF ENTRIES IN THE TABLE.
  1245.     LD    B,A        ;SAVE IN B
  1246.     INC    DE        ;Point past the keyword count
  1247.     INC    DE        ;POINT PAST THE MAX LENGTH NUMBER
  1248.     LD    (CMKPTR),DE    ;Save it for later
  1249.     LD    HL,(CMDPTR)    ;Save the command buffer pointer
  1250.     LD    (CMSPTR),HL
  1251. CMKEY2    LD    A,B        ;Get the keyword counter
  1252.     OR    A        ;ANY LEFT?
  1253.     RET    Z        ;IF NOT WE FAILED.
  1254.     LD    HL,(CMKPTR)    ;Get the current keyword pointer
  1255.     INC    HL        ;Skip the visibility
  1256.     LD    E,(HL)        ;Get the length of the keyword
  1257.     INC    HL        ;Skip the length
  1258. CMKEY3    DEC    E        ;DECREMENT THE NUMBER OF CHARS LEFT.
  1259.     LD    A,E
  1260.     CP    -1
  1261.     JP    M,CMKEY5    ;IF SO GO TO THE NEXT.
  1262.     CALL    CMGTCH        ;GET A CHAR.
  1263.     OR    A        ;IS IT A TERMINATER?
  1264.     JP    P,CMKEY4    ;IF POSITIVE, IT IS NOT.
  1265.     AND    7FH        ;TURN OFF THE MINUS BIT.
  1266.     CP    '?'        ;Is this help?
  1267.     JP    NZ,CMKY35
  1268.     PUSH    HL        ;SAVE HL FOR A SEC
  1269.     PUSH    DE
  1270.     XOR    A
  1271.     LD    (CMAFLG),A    ;TURN OFF THE ACTION FLAG.
  1272.     LD    DE,HLPMES    ;PRINT ONE OF THE FOLLOWING...
  1273.     CALL    PRTSTR
  1274.     LD    HL,CMCCNT    ;DECREMENT THE CHAR COUNT.
  1275.     DEC    (HL)
  1276.     POP    DE
  1277.     POP    HL
  1278.     LD    HL,(CMPTAB)    ;GET THE START OF THE KEYWORD TABLE
  1279.     LD    B,(HL)        ;B IS HOW MANY IN THE TABLE
  1280.     INC    HL        ;Point at the column spacing value
  1281.     LD    A,(HL)        ;Get the length
  1282.     LD    (MAXLEN),A    ;Save it for later
  1283.     XOR    A
  1284.     LD    (CURCOL),A    ;Set column to starting column
  1285.     INC    HL        ;Point at the visible attribute
  1286. CM1010    LD    A,(HL)        ;Get the visibility
  1287.     LD    (VISIBLE),A
  1288.     INC    HL        ;POINT AT THE FIRST ENTRY
  1289.     LD    C,(HL)        ;C IS HOW MANY CHARACTERS IN NAME
  1290.     LD    A,C        ;SAVE THE LENGTH FOR LATER
  1291.     LD    (CURLEN),A
  1292.     INC    HL        ;POINT AT THE TEXT FOLLOWING
  1293.     LD    (CMKPTR),HL    ;SAVE THE ADDRESS TO PRINT FROM ON MATCH
  1294.     LD    DE,(CMSPTR)    ;GET THE ADDRESS OF THE TYPED KEYWORD
  1295. CM1020    LD    A,(DE)        ;GET A CHARACTER
  1296.     IFA    '?',CM1040    ;Go if request for help
  1297.     CALL    CAPTAL        ;MAKE SURE LETTERS ARE UPPER CASE
  1298.     INC    DE        ;POINT TO THE NEXT.
  1299.     CP    (HL)        ;SAME AS IN KEYWORD TABLE?
  1300.     INC    HL        ;POINT TO THE NEXT
  1301.     JR    NZ,CM1050    ;JUMP IF NO MATCH
  1302.     DEC    C        ;ONE LESS CHARACTER IN THE KEYWORD
  1303.     JP    P,CM1020
  1304.     LD    A,(DE)
  1305.     IFA    '?',CM1040    ;Jump if help request
  1306.     CP    0        ;Set flags to P,NZ
  1307.     JP    CM1050        ;Join other code
  1308. CM1040    EQU    $
  1309.     LD    A,(VISIBLE)    ;Is this a visible command?
  1310.     IFZ    CM1045        ;Jump if it is not
  1311.     PUSH    DE        ;SAVE THE REGS
  1312.     PUSH    HL
  1313.     PUSH    BC
  1314.     LD    DE,(CMKPTR)    ;Get the string
  1315.     CALL    STRLEN        ;Get length into BC
  1316.     LD    A,(MAXLEN)    ;Get the padded length
  1317.     LD    B,A        ;Save it for now
  1318.     LD    A,(CURCOL)    ;Get current screen column
  1319.     ADD    A,B        ;Compute new column
  1320.     LD    B,A        ;Save it
  1321.     LD    A,(MAXCOL)    ;Get right margin
  1322.     IFALT    B,CM1042    ;Are we passed the edge? Jump if so
  1323.     LD    A,B        ;Get new column
  1324.     LD    (CURCOL),A    ;Save it
  1325.     LD    A,(MAXLEN)
  1326.     JR    CM1043        ;Join code
  1327. CM1042    CALL    NEWLIN        ;Print a newline
  1328.     LD    A,(MAXLEN)    ;Get the padded length
  1329.     LD    (CURCOL),A    ;Set new position
  1330. CM1043    SUB    C        ;Compute blanks to print
  1331.     LD    C,A        ;Put it into C
  1332.     PUSH    BC        ;Save count for now
  1333.     LD    DE,(CMKPTR)    ;Get the string to print
  1334.     CALL    PRTSTR        ;Print the keyword
  1335.     POP    BC        ;Restore count
  1336. CM1044    LD    A,' '        ;Get a blank
  1337.     CALL    CONOUT        ;Display it
  1338.     DEC    C        ;Decrement counter
  1339.     JR    NZ,CM1044    ;Jump if not there
  1340.     POP    BC        ;RESTORE THE REGS
  1341.     POP    HL
  1342.     POP    DE
  1343. CM1045    LD    A,3        ;SKIP OVER THE EOS AND THE DISCRIPTOR
  1344.     ADD    A,C        ;PLUS THE CHARACTERS LEFT IN THE STRING
  1345.     LD    E,A        ;PUT IT IN DE TO ADD
  1346.     LD    D,0        ;MAKE IT A BYTE VALUE IN 16 BITS
  1347.     ADD    HL,DE        ;GOT THE NEW ADDRESS
  1348.     DJNZ    CM1010        ;GET THE NEXT
  1349.     JR    CM1190        ;END OF THE TABLE
  1350. CM1050    DEC    HL        ;CORRECT HL FROM LAST INCREMENT
  1351.     JP    P,CM1045    ;IF (TABLE) > (COMMAND) KEEP LOOKING
  1352.     JR    Z,CM1045
  1353.     XOR    A        ;RESET THE ACTION FLAG
  1354.     LD    (CMAFLG),A
  1355. CM1190    CALL    NEWLIN        ;PRINT A NEW LINE
  1356. CM1200    CALL    NEWLIN        ;PRINT A NEW LINE
  1357.     LD    DE,(CMPRMP)    ;GET THE PROMPT TO REPRINT
  1358.     CALL    PRTSTR        ;PRINT IT
  1359.     LD    HL,(CMDPTR)    ;GET THE END OF THE COMMAND LINE
  1360.     LD    (HL),EOS    ;TERMINATOR FOR PRINTING
  1361.     LD    HL,(CMCPTR)    ;GET THE LAST CHARACTER
  1362.     DEC    HL
  1363.     LD    (CMCPTR),HL    ;IGNORE THE '?' AT THE END
  1364.     LD    DE,CMDBUF    ;GET THE START OF THE BUFFER
  1365.     CALL    PRTSTR        ;PRINT THE COMMAND LINE
  1366.     JP    REPARS        ;REPARSE THE ENTIRE LINE
  1367. CMKY35    CP    ESC
  1368.     RET    Z
  1369.     PUSH    HL
  1370.     PUSH    DE
  1371.     CALL    CMAMBG
  1372.     JP    CMKY36
  1373.     LD    HL,(CMCPTR)    ;GET THE END OF THE COMMAND
  1374.     LD    BC,CMDBUF    ;GET THE START OF THE BUFFER
  1375.     OR    A        ;RESET THE CARRY
  1376.     SBC    HL,BC        ;COMPUTE THE OFFSET
  1377.     LD    DE,CMER01
  1378.     CALL    PRTSTR        ;SAY ITS AMBIGUOUS.
  1379.     JP    PRSERR        ;GIVE UP.
  1380. CMKY36    POP    DE
  1381.     POP    HL
  1382. CMKY37    INC    E        ;ADD ONE IN CASE IT IS NEGATIVE.
  1383.     LD    D,0
  1384.     ADD    HL,DE        ;INCREMENT PAST THE KEYWORD.
  1385.     INC    HL        ;PAST THE EOS.
  1386.     LD    E,(HL)        ;GET THE DATA.
  1387.     INC    HL
  1388.     LD    D,(HL)
  1389.     LD    A,E
  1390.     JP    RSKP
  1391. CMKEY4    CALL    CAPTAL        ;MAKE IT UPPER CASE IF LOWER    
  1392. CMKY41    CP    (HL)        ;Check the next character
  1393.     JR    NZ,CMKEY5
  1394.     INC    HL
  1395.     JP    CMKEY3
  1396. CMKEY5    LD    D,0
  1397.     LD    A,E        ;GET THE NUMBER OF CHARS LEFT.
  1398.     OR    A        ;IS IT NEGATIVE?
  1399.     JP    P,CMKY51
  1400.     LD    D,0FFH
  1401. CMKY51    EQU    $
  1402.     ADD    HL,DE        ;INCREMENT PAST THE KEYWORD.
  1403.     INC    HL        ;PLUS 4
  1404.     INC    HL
  1405.     INC    HL
  1406.     INC    HL
  1407.     LD    (CMKPTR),HL
  1408.     DEC    B        ;DECREMENT THE NUMBER OF ENTRIES LEFT.
  1409.     LD    HL,(CMSPTR)    ;GET THE OLD CMDPTR.
  1410.     LD    (CMDPTR),HL    ;RESTORE IT.
  1411.     JP    CMKEY2        ;GO CHECK THE NEXT KEYWORD.
  1412. ;CONVERT CONTENTS OF A TO UPPER CASE IF IT IS LOWER
  1413. CAPTAL    IFALT    'a',CAPS10
  1414.     IFAGE    'z'+1,CAPS10
  1415.     AND    137O        ;MAKE IT UPPER CASE
  1416. CAPS10    RET            ;RETURN TO THE CALLER
  1417. ;CHECK AMBIGUITY OF A COMMAND
  1418. CMAMBG    DEC    B        ;DECREMENT THE NUMBER OF ENTRIES LEFT.
  1419.     RET    M        ;IF NONE LEFT THEN IT IS NOT AMBIGUOUS.
  1420.     INC    E        ;THIS IS OFF BY ONE;ADJUST.
  1421.     LD    C,E        ;SAVE THE CHAR COUNT.
  1422.     LD    A,E
  1423.     OR    A        ;ANY CHARS LEFT?
  1424.     RET    Z        ;NO, IT CAN'T BE AMBIGUOUS.
  1425.     LD    D,0
  1426.     ADD    HL,DE        ;INCREMENT PAST THE KEYWORD.
  1427.     LD    E,4        ;PLUS THE EOS AND DATA.
  1428.     ADD    HL,DE
  1429.     LD    B,(HL)        ;GET THE LENGTH OF THE KEYWORD.
  1430.     INC    HL
  1431.     EX    DE,HL    
  1432.     LD    HL,(CMKPTR)    ;GET POINTER TO KEYWORD ENTRY.
  1433.     INC    HL
  1434.     LD    A,(HL)        ;GET THE LENGTH OF THE KEYWORD.
  1435.     SUB    C        ;SUBTRACT HOW MANY LEFT.
  1436.     LD    C,A        ;SAVE THE COUNT.
  1437.     IFA    B,CMAMB0
  1438.     RET    P        ;IF LARGER THAN THE NEW WORD THEN NOT AMB
  1439. CMAMB0    LD    HL,(CMSPTR)    ;GET THE POINTER TO WHAT PARSED.
  1440. CMAMB1    DEC    C        ;DECREMENT THE COUNT.
  1441.     JP    M,RSKP        ;IF WE ARE DONE THEN IT IS AMBIGUOUS.
  1442.     EX    DE,HL        ;EXCHANGE THE POINTERS.
  1443.     LD    B,(HL)        ;GET THE NEXT CHAR OF THE KEYWORD
  1444.     INC    HL
  1445.     EX    DE,HL        ;EXCHANGE THE POINTERS.
  1446.     LD    A,(HL)        ;GET THE NEXT PARSED CHAR.
  1447.     INC    HL
  1448.     CALL    CAPTAL        ;MAKE IT UPPER IF LOWER
  1449. CMAMB2    CP    B        ;ARE THEY EQUAL?
  1450.     RET    NZ        ;IF NOT THEN ITS NOT AMBIGUOUS.
  1451.     JP    CMAMB1        ;CHECK THE NEXT CHAR.
  1452. ;
  1453. ;    Parse a file specification.  This includes a call to @FSPEC to
  1454. ;    do case conversion, and any other necessary stuff to make a
  1455. ;    legal file spec.  On normal return, A has the count of characters
  1456. ;    that are in the passed buffer
  1457. ;
  1458. CMIFIL    LD    (CMFCB),DE    ;SAVE WHERE TO PUT THE CHARACTERS
  1459.     LD    DE,CLBUF
  1460.     LD    B,0        ;Set the count to zero
  1461. CMIFI1    CALL    CMGTCH        ;GET A CHARACTER
  1462.     OR    A        ;CHECK FOR A CONTROL CHARACTER ?,CR,ESC
  1463.     JP    P,CMIFI3    ;GO IF NOT CONTROL
  1464.     AND    7FH        ;STRIP THE HIGH BIT
  1465.     CP    ESC        ;WAS IT ABORT?    
  1466.     RET    Z        ;TAKE THE ERROR EXIT
  1467.     IFANOT    '?',CMIFI4    ;Go if not help request
  1468.     LD    DE,FILHLP    ;PRINT A MESSAGE
  1469.     CALL    REPRNT        ;SET UP FOR REPARSE
  1470.     JP    REPARS        ;GET A NEW CHARACTER
  1471. CMIFI3    LD    (DE),A        ;STORE THE CHARACTER
  1472.     INC    DE        ;POINT TO NEXT POS
  1473.     INC    B        ;INCREMENT CHARACTER COUNT
  1474.     JR    CMIFI1        ;GET ANOTHER ONE
  1475. CMIFI4    LD    A,CR        ;Get the end of name marker
  1476.     LD    (DE),A        ;Put in a terminator
  1477.     LD    A,B        ;Get the count
  1478.     IFZ    CMIFI5        ;Skip fspec if no characters given
  1479.     PUSH    HL        ;Save the pointer
  1480.     LD    HL,CLBUF    ;GET THE TEXT TO FSPEC
  1481.     LD    DE,(CMFCB)    ;WHERE TO PUT THE RESULT
  1482.     CALL    XFSPEC        ;MAKE IT A FILE SPEC
  1483.     JP    NZ,CMIFI6    ;Oops, bad fspec
  1484.     EX    DE,HL        ;Move start to HL
  1485.     LD    A,3        ;Get the character to find
  1486.     LD    BC,40        ;Get the maximum distance to look
  1487.     CPIR            ;Find it
  1488.     LD    HL,39        ;Find out how far we looked
  1489.     OR    A        ;Reset the carry
  1490.     SBC    HL,BC        ;Compute the distance
  1491.     LD    B,L        ;Get the length
  1492.     POP    HL        ;Restore pointer which is...
  1493. CMIFI5    LD    (CMDPTR),HL    ;Next place to put characters at
  1494.     LD    A,B        ;Copy the length to A
  1495.     JP    RSKP        ;Return normal
  1496. ;
  1497. CMIFI6    POP    HL        ;Restore the stack
  1498.     JP    XERROR0        ;Print a system message and return
  1499. ;
  1500. ;    Get input characters from the keyboard, up to an action character
  1501. ;    The actual character input is retrieved via GETSTR().
  1502. ;
  1503. CMINBF    PUSH    AF
  1504.     PUSH    DE
  1505.     PUSH    HL
  1506.     LD    A,(CMAFLG)    ;IS THE ACTION CHAR FLAG SET?
  1507.     IFNZ    CMINB9        ;Go if it is
  1508.     LD    HL,(CMCPTR)    ;Get the position
  1509.     PUSH    HL        ;Save it for later
  1510.     LD    DE,CMDBUF    ;Get EOB
  1511.     OR    A        ;Reset carry
  1512.     SBC    HL,DE        ;Compute number of characters typed in
  1513.     LD    B,L        ;Get number of characters
  1514.     POP    HL        ;Get the value back
  1515.     CALL    GETSTR        ;Input up to an action character
  1516.     JP    C,PRSERR    ;Jump if user pressed break
  1517.     LD    A,B        ;SAVE THE COUNT
  1518.     LD    (CMCCNT),A
  1519.     LD    C,B        ;GET THE NUMBER OF CHARACTERS IN BUFFER
  1520.     LD    B,0
  1521.     LD    HL,CMDBUF    ;Get the start
  1522.     PUSH    HL        ;Save it
  1523.     ADD    HL,BC        ;Add the count
  1524.     LD    (CMCPTR),HL    ;Save next input position
  1525.     POP    BC        ;Get the start
  1526.     OR    A        ;Reset the carry
  1527.     SBC    HL,BC        ;Are there any characters in the buffer?
  1528.     JP    Z,PRSERR    ;IF NO CHARACTERS START OVER
  1529. CMINB6    LD    A,0FFH        ;SET THE ACTION FLAG.
  1530.     LD    (CMAFLG),A
  1531. CMINB9    POP    HL        ;Restore the registers
  1532.     POP    DE
  1533.     POP    AF
  1534.     RET            ;Return
  1535. ;
  1536. ;    Get a character from the command input buffer.  If an action
  1537. ;    character is found, then the MSB of the character will be set
  1538. ;
  1539. CMGTCH    PUSH    HL
  1540.     PUSH    BC
  1541. CMGTC1    LD    A,(CMAFLG)
  1542.     OR    A        ;IS IT SET.
  1543.     CALL    Z,CMINBF    ;IS THE ACTION CHAR FLAG SET?
  1544.     LD    HL,(CMDPTR)    ;GET A POINTER INTO THE BUFFER.
  1545.     LD    A,(HL)        ;GET THE NEXT CHAR.
  1546.     INC    HL
  1547.     LD    (CMDPTR),HL
  1548.     IFA    ' ',CMGTC2
  1549.     IFANOT    TAB,CMGTC3
  1550. CMGTC2    LD    A,(CMSFLG)    ;GET THE SPACE FLAG.
  1551.     IFNZ    CMGTC1        ;Was last char a space?
  1552.     LD    A,0FFH        ;SET THE SPACE FLAG.
  1553.     LD    (CMSFLG),A
  1554.     LD    A,' '
  1555.     POP    BC
  1556.     POP    HL
  1557.     JR    CMGTC5
  1558. CMGTC3    PUSH    AF
  1559.     XOR    A
  1560.     LD    (CMSFLG),A        ;ZERO THE SPACE FLAG.
  1561.     POP    AF
  1562.     POP    BC
  1563.     POP    HL
  1564.     IFA    ESC,CMGTC5    ;Go if escape abort
  1565.     IFA    '?',CMGTC4    ;Go answer a help request
  1566.     IFA    CR,CMGTC4
  1567.     CP    LF
  1568.     RET    NZ        ;NOT AN ACTION CHAR, JUST RETURN.
  1569. CMGTC4    PUSH    HL
  1570.     LD    HL,(CMDPTR)
  1571.     DEC    HL
  1572.     LD    (CMDPTR),HL
  1573.     POP    HL
  1574. CMGTC5    OR    80H        ;MAKE THE CHAR NEGATIVE TO INDICATE IT IS
  1575.     RET                ;A TERMINATOR.
  1576. STRLEN    EQU    $
  1577.     PUSH    AF
  1578.     PUSH    DE
  1579.     LD    BC,0
  1580. STRLEN_1    EQU    $
  1581.     LD    A,(DE)
  1582.     IFA    EOS,STRLEN_2
  1583.     INC    DE
  1584.     INC    BC
  1585.     JR    STRLEN_1
  1586. STRLEN_2    EQU    $
  1587.     POP    DE
  1588.     POP    AF
  1589.     RET
  1590. ;end of file
  1591. <<< m4equ.asm >>>
  1592. ;
  1593. ;    Symbolic defintions for some ASCII characters
  1594. ;
  1595. EOS    EQU    0    ;Printed string terminator
  1596. BELL    EQU    07O    ;ASCII BEL (CONTROL-G)
  1597. CTRLC    EQU    03O    ;ASCII ETX (CONTROL-C)
  1598. TAB    EQU    11O    ;ASCII TAB (CONTROL-I)
  1599. LF    EQU    12O    ;ASCII LINE FEED (CTRL-J)
  1600. FF    EQU    14O    ;ASCII FORM FEED (CTRL-L)
  1601. CR    EQU    15O    ;ASCII CARRIAGE RETURN (CTRL-M)
  1602. XON    EQU    21O    ;THE THE ASCII CHARACTER USED FOR XON
  1603. XOFF    EQU    23O    ;THE THE ASCII CHARACTER USED FOR XOFF
  1604. ESC    EQU    33O    ;ASCII ESCAPE
  1605. SUBT    EQU    32O    ;ASCII SUB (CTRL-Z)
  1606. DEL    EQU    177O    ;ASCII DELETE (RUBOUT)
  1607. DEFESC    EQU    31    ;<CLEAR> KEY ON KEY BOARD
  1608. MAXPKT    EQU    '~'-' '+2O    ;MAXIMUM SIZE OF A PACKET.
  1609. DRPSIZ    EQU    5EH    ;DEFAULT RECEIVE PACKET SIZE.
  1610. DSPSIZ    EQU    20H    ;DEFAULT SEND PACKET SIZE.
  1611. DSTIME    EQU    15    ;DEFAULT SEND TIME OUT INTERVAL.
  1612. DRTIME    EQU    10    ;DEFAULT RECEIVE TIME OUT INTERVAL.
  1613. DSPAD    EQU    00H    ;DEFAULT SEND PADDING.
  1614. DRPAD    EQU    00H    ;DEFAULT RECEIVE PADDING.
  1615. DSPADC    EQU    00H    ;DEFAULT SEND PADDING CHAR.
  1616. DRPADC    EQU    00H    ;DEFAULT RECEIVE PADDING CHAR.
  1617. DSEOL    EQU    CR    ;DEFAULT SEND EOL CHAR.
  1618. DREOL    EQU    CR    ;DEFAULT RECEIVE EOL CHAR.
  1619. DSQUOT    EQU    '#'    ;DEFAULT SEND QUOTE CHAR.
  1620. DRQUOT    EQU    '#'    ;DEFAULT RECEIVE QUOTE CHAR.
  1621. DSCHKT    EQU    '1'    ;DEFAULT CHECKSUM TYPE
  1622. SOH    EQU    01H    ;START OF HEADER CHAR.
  1623. CMKEY    EQU    01H    ;PARSE A KEYWORD.
  1624. CMIFI    EQU    02H    ;PARSE AN INPUT FILE SPEC.
  1625. CMOFI    EQU    03H    ;PARSE AN OUTPUT FILE SPEC.
  1626. CMCFM    EQU    04H    ;PARSE A CONFIRM.
  1627. CMTXT    EQU    05H    ;PARSE TEXT.
  1628. CMNUM    EQU    06H    ;PARSE ASCII DECIMAL STRING
  1629. CMIFIN    EQU    10H    ;PARSE AN INPUT FILE SPEC
  1630. <<< m4file.asm >>>
  1631. ;        m4file/asm
  1632. ;
  1633. ;    The close command.  At present, only SESSION is valid
  1634. ;
  1635. CLSFLS    CALL    GETLOGF        ;Get the logfile descriptor
  1636.     IFNZ    CLSF10        ;Skip if not SESSION LOG FILE
  1637.     LD    A,(LOGFLG)    ;Check to see if session log open
  1638.     IFZ    CLSF07        ;If already closed, then jump to message
  1639.     XOR    A        ;Reset the FILE OPEN flag
  1640.     LD    (LOGFLG),A
  1641.     LD    DE,LFCB        ;Get the FCB for the CLOSE
  1642.     CALL    XCLOSE        ;Close the file if possible
  1643.     CALL    NZ,XERROR0    ;Print a message if file not closed right
  1644.     JR    CLSF08        ;Back for another command
  1645. CLSF07    STROUT    NOLOGF        ;Print LOG FILE NOT OPEN message
  1646. CLSF08    JP    KERMIT        ;Back for another command
  1647. ;
  1648. ;    Check the debug logfile
  1649. ;
  1650. CLSF10    IFANOT    1,CLSF30    ;If not debug then try transaction
  1651.     LD    A,(DEBLOG)    ;Check if logging in effect
  1652.     IFZ    CLSF07
  1653.     XOR    A        ;Zap the open flag
  1654.     LD    (DEBLOG),A
  1655.     LD    DE,DFCB        ;Get the FCB
  1656.     CALL    XCLOSE
  1657.     CALL    NZ,XERROR0
  1658.     JR    CLSF08
  1659. ;
  1660. ;    Check the transaction logfile
  1661. ;
  1662. CLSF30    LD    A,(TRANLOG)    ;Check if it is open
  1663.     IFZ    CLSF07
  1664.     XOR    A        ;Zap the open flag
  1665.     LD    (TRANLOG),A    ;Reset it
  1666.     LD    DE,TRFCB        ;Get the transaction FCB
  1667.     CALL    XCLOSE        ;Close the file
  1668.     CALL    NZ,XERROR0    ;Print system message if error
  1669.     JR    CLSF08        ;Back for another command
  1670. ;
  1671. ;    THIS IS THE LOG COMMAND.
  1672. ;
  1673. LOG    EQU    $
  1674.     CALL    GETLOGF        ;Get the logfile descriptor
  1675.     OR    A
  1676.     JP    Z,LOGSES    ;If zero then session logging
  1677.     CP    2
  1678.     JP    Z,LOGTRAN    ;Go do transaction logging
  1679. ;
  1680. ;    Debug logging
  1681. ;
  1682.     LD    A,(DEBLOG)    ;See if logging already in effect
  1683.     IFZ    LOG_3
  1684. LOG_1    STROUT    LOGOPN        ;Print LOG OPEN message
  1685.     JP    KERMIT        ;RETURN TO COMMAND PARSER
  1686. LOG_3    LD    DE,DFCB
  1687.     PUSH    DE        ;Save it for later
  1688.     LD    A,CMIFI        ;Get a file spec
  1689.     CALL    COMND        ;Parse it
  1690.     JP    KERMT3        ;Exit if not confirmed
  1691.     IFNZ    LOG_3A
  1692.     LD    HL,DEFDEBLOG    ;Get the default name
  1693.     LD    DE,DFCB
  1694.     LD    BC,32
  1695.     LDIR            ;Move it into place
  1696. LOG_3A    POP    DE        ;Get the FCB back
  1697.     LD    HL,DBUFF    ;Get the buffer
  1698.     LD    B,0        ;Use 256 LRL
  1699.     CALL    XINIT        ;Create the output file
  1700.     JR    Z,LOG_5
  1701.     IFA    42,LOG_5    ;Ignore a LRL error
  1702. LOG_4    CALL    XERROR0
  1703.     JP    KERMIT
  1704. LOG_5    LD    A,1
  1705.     LD    (DEBLOG),A    ;Set the log file open flag
  1706.     JP    KERMIT
  1707. ;
  1708. ;    Session logging
  1709. ;
  1710. LOGSES    LD    A,(LOGFLG)    ;Check if session log open
  1711.     IFZ    LOG_6
  1712.     JP    LOG_1        ;Oops, log already open
  1713. LOG_6    LD    A,CMIFI        ;PARSE AN INPUT FILE SPEC.
  1714.     LD    DE,LFCB        ;Get the session log FCB
  1715.     PUSH    DE        ;Save it for later
  1716.     CALL    COMND        ;Parse it
  1717.     JP    KERMT3
  1718.     IFNZ    LOG_6A        ;Jump if text was given
  1719.     LD    HL,DEFSESLOG    ;Get the default name
  1720.     LD    DE,LFCB        ;Get the FCB
  1721.     LD    BC,32        ;Get the count
  1722.     LDIR            ;Move the block
  1723. LOG_6A    LD    HL,LBUFF    ;Get the buffer
  1724.     POP    DE        ;Get the session log FCB
  1725.     LD    B,0        ;Select 256 byte records
  1726.     CALL    XINIT        ;Create a new file
  1727.     JR    Z,LOG_8        ;Continue on a no error return
  1728.     IFANOT    42,LOG_4    ;If not LRL error, then abort
  1729. LOG_8    XOR    A
  1730.     LD    (PREVLCHR),A    ;Reset the previous character
  1731.     LD    A,2
  1732.     LD    (LOGFLG),A    ;Turn logging on
  1733.     JP    KERMIT        ;Jump to get a new command
  1734. ;
  1735. ;    Transaction logging
  1736. ;
  1737. LOGTRAN    LD    A,(TRANLOG)    ;Get the flag
  1738.     IFZ    LOG_9
  1739.     JP    LOG_1        ;Oops log already open
  1740. LOG_9    LD    A,CMIFI        ;Get a file spec
  1741.     LD    DE,TRFCB
  1742.     PUSH    DE        ;Save it for later
  1743.     CALL    COMND        ;Parse a file name
  1744.     JP    KERMT3        ;Abort if no confirm
  1745.     IFNZ    LOG_9A        ;Jump if text given
  1746.     LD    HL,DEFTRLOG    ;Get the default
  1747.     LD    DE,TRFCB
  1748.     LD    BC,32
  1749.     LDIR            ;Move it
  1750. LOG_9A    POP    DE
  1751.     LD    HL,TBUFF    ;Get the buffer
  1752.     LD    B,0        ;Select 256 LRL
  1753.     CALL    XINIT        ;Create the output file
  1754.     JR    Z,LOG_10
  1755.     IFANOT    42,LOG_4
  1756. LOG_10    LD    A,1        ;Set the flag to ON
  1757.     LD    (TRANLOG),A
  1758.     JP    KERMIT        ;Back for another command
  1759. ;
  1760. ;    Get a logfile identifier
  1761. ;
  1762. GETLOGF    LD    A,CMKEY        ;PARSE A KEYWORD
  1763.     LD    DE,CLSTAB    ;GET THE PARSE TABLE
  1764.     CALL    COMND        ;GET A KEYWORD
  1765.     JP    KERMT2        ;ABORT ON AN ERROR
  1766.     RET            ;Return to caller
  1767. ;
  1768. ;    Output a normal string terminated by EOS.
  1769. ;
  1770. OUTLOG    LD    A,EOS
  1771.     JP    OUTLOGCH
  1772. ;
  1773. ;    Output a message to a log file
  1774. ;    HL=message, DE=FCB, A=terminator character
  1775. ;
  1776. OUTLOGCH    EQU    $
  1777.     PUSH    HL        ;Save the registers
  1778.     PUSH    DE
  1779.     LD    (ENDCH),A    ;Store the terminator
  1780. OUTL_1    LD    A,(HL)        ;Get a character
  1781.     CP    EOS
  1782. ENDCH    EQU    $-1        ;Address of terminator character
  1783.     JR    Z,OUTL_2
  1784.     PUSH    HL        ;Save the string address, and the FCB
  1785.     PUSH    DE
  1786.     CALL    XPUT        ;@PUT the character
  1787.     POP    DE        ;Restore the addresses
  1788.     POP    HL
  1789.     JR    NZ,OUTL_3    ;On error, abort
  1790.     INC    HL        ;Point to next character
  1791.     JR    OUTL_1        ;Loop on
  1792. OUTL_2    POP    DE        ;Restore stack
  1793.     POP    HL
  1794.     JP    RSKP        ;Return normal
  1795. ;
  1796. ;    Log file error
  1797. ;
  1798. OUTL_3    CALL    XERROR0        ;Print system message
  1799.     STROUT    LOGERROR    ;Print a message on the console
  1800.     POP    DE        ;Restore the stack
  1801.     POP    HL
  1802.     RET            ;Return error
  1803. ;end of file
  1804. <<< m4get.asm >>>
  1805. ;    M4GET/ASM
  1806. ;    RECEIVE    COMMAND
  1807. READ    EQU    $
  1808.     CALL    NEWLIN
  1809.     NSTATE    'R'        ;Set initial protocol state
  1810.     LD    DE,DATA        ;WHERE TO PUT THE TEXT (IF ANY.)
  1811.     LD    A,CMTXT
  1812.     CALL    COMND        ;GET EITHER SOME TEXT OR A CONFIRM.
  1813.     JP    KERMT3        ;DIDN'T GET ANYTHING.
  1814.     OR    A        ;GET ANY CHARS?
  1815.     JR    Z,READ1        ;NOPE, JUST A REGULAR SEND.
  1816.     LD    (ARGBLK+1),A    ;STORE THE NUMBER OF CHARS.
  1817.     LD    (TEMP4),A    ;Save the length
  1818.     EX    DE,HL       ;GET POINTER INTO HL.
  1819.     LD    (HL),EOS    ;Put in the print terminator
  1820.     NSTATE    'r'        ;Set state to receive init with file
  1821. READ1    CALL    INIT        ;Clear input line and init buffers
  1822.     LD    HL,0        ;Reset all the flags
  1823.     LD    (NUMPKT),HL    ;SET THE NUMBER OF PACKETS TO ZERO.
  1824.     LD    (NUMRTR),HL    ;SET THE NUMBER OF RETRIES TO ZERO.
  1825.     LD    (KTRANS),HL
  1826.     XOR    A
  1827.     LD    (PKTNUM),A    ;SET THE PACKET NUMBER TO ZERO.
  1828.     LD    (NUMTRY),A    ;SET THE NUMBER OF TRIES TO ZERO.
  1829.     LD    (CZSEEN),A    ;Reset the control-Z seen flag
  1830.     LD    A,'R'        ;Get the state character
  1831.     LD    (DISFLG),A    ;Set the display flag
  1832.     CALL    CONDCHR        ;Display it as well
  1833.     CALL    CLRPRT        ;CLEAR OUT THE COMMUNICATIONS PORT
  1834.     STROUT    HELPMSG
  1835.     CALL    PROTO
  1836.     JP    KERMIT
  1837. ;
  1838. ;    This is the complete state
  1839. ;
  1840. COMP    EQU    $
  1841.     LD    DE,INFMS3    ;PUT IN "COMPLETE" MESSAGE.
  1842.     LD    A,(CZSEEN)
  1843.     OR    A        ;...
  1844.     JR    Z,COMP1
  1845.     XOR    A        ;YES, CLEAR FLAG.
  1846.     LD    (CZSEEN),A
  1847.     LD    DE,INMS13    ;ISSUE "INTERRUPTED" MESSAGE.
  1848. COMP1    LD    A,(DISFLG)    ;But only if we are supposed to
  1849.     OR    A
  1850.     CALL    NZ,FINMES    ;PRINT COMPLETION MESSAGE
  1851.     JP    KERMIT
  1852. ;
  1853. ;    This is the abort state
  1854. ;
  1855. SABORT    EQU    $
  1856.     LD    DE,INFMS4    ;Message to print
  1857.     JR    COMP1        ;Go print it conditionally
  1858. ;
  1859. ;    Initialize the buffers, and clear the line
  1860. ;
  1861. INIT    XOR    A        ;BUFFER SIZE.
  1862.     LD    (CHRCNT),A    ;NUMBER OF CHARS LEFT.
  1863.     LD    HL,BUFF        ;ADDR FOR BEGINNING.
  1864.     LD    (BUFPNT),HL    ;STORE ADDR FOR BEGINNING.
  1865.     CALL    CLRPRT
  1866.     RET    
  1867. ;
  1868. ;    RECEIVE    ROUTINES
  1869. ;
  1870. ;    RECEIVE    INIT with no previous file header
  1871. ;
  1872. RINIT    CALL    CHKTRYS        ;Check retry threshold
  1873.     LD    A,'1'        ;RESET BLOCK CHECK TYPE TO SINGLE CHAR
  1874.     LD    (CURCHK),A    ;STORE AS CURRENT TYPE FOR INITIALIZATION
  1875.     CALL    RPACK        ;GET A PACKET.
  1876.     JP    NAK        ;TRASHED PACKET NAK, RETRY.
  1877.     JR    RINIT_1
  1878. ;
  1879. ;    This entry point is for GET's.  The file name is in DATA, and
  1880. ;    and 'R' packet will be sent out to ask for the file.
  1881. ;
  1882. RINITF    CALL    CHKTRYS        ;Check retry threshold
  1883.     LD    A,'1'        ;START WITH SINGLE CHARACTER CHECKSUM
  1884.     LD    (CURCHK),A    ;SAVE THE TYPE
  1885.     LD    A,(TEMP4)    ;Get the length
  1886.     LD    (ARGBLK+1),A    ;Put it in the packet
  1887.     XOR    A        ;Start at packet zero
  1888.     LD    (ARGBLK),A
  1889.     LD    A,'R'        ;Send RECV INIT
  1890.     CALL    SPACK
  1891.     JP    RECABORT    ;Die if SEND fails
  1892.     LD    A,'1'        ;Reset the blk check type to 1
  1893.     LD    (CURCHK),A    ;Store it
  1894.     CALL    RPACK        ;Get a packet
  1895.     JP    QUIT        ;Trashed, return to protocol
  1896.     JR    RINIT_1        ;Join other code
  1897. ;
  1898. ;    Common receive init code
  1899. ;
  1900. RINIT_1    EQU    $
  1901.     IFANOT    'S',RINIT3    ;Send initiate packet?
  1902.     LD    A,(NUMTRY)    ;GET THE NUMBER OF TRIES.
  1903.     LD    (OLDTRY),A    ;SAVE IT.
  1904.     XOR    A
  1905.     LD    (NUMTRY),A    ;RESET THE NUMBER OF TRIES.
  1906.     LD    A,(ARGBLK)    ;RETURNED PACKET NUMBER.  (SYNC THEM.)
  1907.     CALL    INCPKT        ;Increment the packet number
  1908.     CALL    INCDISPKT
  1909.     LD    A,(ARGBLK+1)    ;GET THE NUMBER OF ARGUMENTS RECEIVED.
  1910.     LD    HL,DATA        ;GET A POINTER TO THE DATA.
  1911.     CALL    SPAR        ;GET THE DATA INTO THE PROPER VARIABLES.
  1912.     LD    HL,DATA        ;GET A POINTER TO OUR DATA BLOCK.
  1913.     CALL    RPAR        ;SET UP THE RECEIVE PARAMETERS.
  1914.     LD    (ARGBLK+1),A    ;STORE THE RETURNED NUMBER OF ARGUMENTS.
  1915.     LD    A,'Y'        ;ACKNOWLEDGE PACKET.
  1916.     CALL    SPACK        ;SEND THE PACKET.
  1917.     JP    RECABORT        ;FAILED, ABORT.
  1918.     LD    A,(INICHK)
  1919.     LD    (CURCHK),A    ;FOR ALL FUTURE PACKETS
  1920.     NSTATE    'f'
  1921.     LD    A,'F'
  1922.     CALL    CONDCHR        ;Display which packet
  1923.     RET    
  1924. RINIT3    IFANOT    'E',NAK_0    ;Is it a NAK ?
  1925.     CALL    ERROR
  1926.     JP    RECABORT
  1927. ;
  1928. ;    THESE ARE SOME UTILITY ROUTINES.
  1929. ;
  1930. ;    RECABORT
  1931. ;
  1932. RECABORT    EQU    $
  1933.     LD    IX,RTRANS    ;Get the receive data area
  1934.     CALL    UPDTRANS    ;Update the transfer statics
  1935. ABORT    NSTATE    'A'        ;Set state to abort
  1936. ABORT_1    LD    A,(LOGTRAN)    ;Check if logging active
  1937.     CP    1        ;Is it on?
  1938.     RET    NZ        ;Return if not
  1939.     LD    DE,TRFCB    ;Get the FCB
  1940.     TRLOG    TRANABRT,ABORT_2;Log the aborted message
  1941.     RET            ;Return
  1942. ;
  1943. ;    Close up after a tranaction log error
  1944. ;
  1945. ABORT_2    XOR    A        ;Reset the logging active flag
  1946.     LD    (LOGTRAN),A
  1947.     LD    DE,TRFCB    ;Close the log file
  1948.     CALL    XCLOSE
  1949.     RET
  1950. ;
  1951. ;    SNDABORT
  1952. ;
  1953. SNDABORT    NSTATE    'A'
  1954.     LD    IX,STRANS
  1955.     CALL    UPDTRANS
  1956.     JP    ABORT_1
  1957. ;
  1958. ;    Nack a packet.
  1959. ;
  1960. NAK_0    XOR    A        ;Reset to first packet
  1961.     LD    (PKTNUM),A    ;Set the packet number
  1962.     JR    NAK        ;Join NAK code
  1963. ;
  1964. NAK_RTR    CALL    UPDRTR        ;Update retries
  1965. ;
  1966. NAK    LD    A,(PKTNUM)    ;GET THE PACKET NUMBER WE'RE WAITING FOR.
  1967.     LD    (ARGBLK),A
  1968.     XOR    A        ;NO DATA.
  1969.     LD    (ARGBLK+1),A
  1970.     LD    A,'N'        ;NAK THAT PACKET.
  1971.     CALL    SPACK
  1972.     JP    RECABORT        ;GIVE UP.
  1973.     LD    A,'N'        ;Display NAKed character
  1974.     CALL    CONDCHR
  1975.     RET            ;GO AROUND AGAIN.
  1976. ;
  1977. ;    Update the retry count
  1978. ;
  1979. UPDRTR    EQU    $
  1980.     LD    HL,(NUMRTR)
  1981.     INC    HL        ;INCREMENT THE NUMBER OF RETRIES
  1982.     LD    (NUMRTR),HL
  1983.     RET    
  1984. ;
  1985. ;    THIS ROUTINE SETS UP THE DATA FOR INIT PACKET (EITHER THE
  1986. ;    SEND_INIT OR ACK PACKET).
  1987. ;
  1988. RPAR    ADDPUT    RPSIZ        ;GET THE RECEIVE PACKET SIZE.
  1989.     ADDPUT    STIME        ;Add send timeout
  1990.     ADDPUT    RPAD        ;Add padding amount
  1991.     LD    A,(RPADCH)    ;Get the pad character
  1992.     ADD    A,100O        ;UNCONTROL IT.
  1993.     PUTHL    A        ;Put the pad character in
  1994.     ADDPUT    REOL        ;Put the end of line character
  1995.     LD    A,(RQUOTE)    ;GET THE QUOTE CHAR.
  1996.     PUTHL    A
  1997.     LD    A,(EBQFLG)    ;Is eighth bit quoting on?
  1998.     IFZ    RPAR1        ;If not, then say no
  1999.     PUTHL    'Y'        ;Say yes to anything
  2000.     JR    RPAR2
  2001. RPAR1    PUTHL    'N'        ;Say no eighth bit quoting
  2002. RPAR2    LD    A,(INICHK)    ;Check type
  2003.     PUTHL    A
  2004.     LD    A,(RPTQ)    ;Get the repeat quote
  2005.     PUTHL    A
  2006.     LD    A,9        ;Nine pieces of data
  2007.     RET    
  2008. ;
  2009. ;    Tochar() A, and store indirect HL, then increment HL
  2010. ;
  2011. TCHPUT    ADD    A,' '        ;Tochar(A)
  2012.     PUTHL    A        ;Store it, and increment
  2013.     RET            ;Return
  2014. ;
  2015. ;    THIS ROUTINE READS IN ALL THE SEND_INIT PACKET INFORMATION.
  2016. ;
  2017. SPAR    LD    (TEMP4),A    ;Save the number of arguments
  2018.     PUSH    BC
  2019.     XOR    A
  2020.     LD    B,A
  2021.     LD    (RPTFLG),A    ;Set everything to default
  2022.     CALL    CHKSPAR        ;Check number of characters in packet
  2023.     LD    A,(HL)        ;Get THEIR Max packet size
  2024.     SUB    20H        ;Make it real
  2025.     LD    (SPSIZ),A    ;Save the value
  2026.     CALL    CHKSPAR        ;Check the count
  2027.     GETHL    A
  2028.     SUB    20H        ;Make it real
  2029.     LD    (RTIME),A    ;Send packet timeout value
  2030.     CALL    CHKSPAR        ;Check the count
  2031.     GETHL    A
  2032.     SUB    20H        ;Make it real
  2033.     LD    (SPAD),A    ;Save the padding character
  2034.     CALL    CHKSPAR        ;Check the count of characters
  2035.     GETHL    A
  2036.     ADD    A,100O        ;RE-CONTROLIFY IT.
  2037.     AND    7FH        ;Keep us honest
  2038.     LD    (SPADCH),A    ;Save the padding character
  2039.     CALL    CHKSPAR        ;Check the count
  2040.     GETHL    A
  2041.     SUB    20H        ;Make it the real value
  2042.     LD    (SEOL),A    ;Save the value
  2043.     CALL    CHKSPAR        ;Check the count
  2044.     GETHL    A
  2045.     LD    (SQUOTE),A    ;Save it
  2046.     CALL    CHKSPAR        ;Check the count
  2047.     INC    HL
  2048.     LD    A,(EBQFLG)
  2049.     IFZ    SPAR7
  2050.     LD    A,(HL)
  2051.     IFA    'Y',SPAR4
  2052.     IFANOT    'N',SPAR5
  2053.     XOR    A
  2054.     JR    SPAR6
  2055. SPAR4    LD    A,'&'
  2056. SPAR5    LD    (EBQ),A
  2057. SPAR6    LD    (EBQFLG),A
  2058. SPAR7    CALL    CHKSPAR        ;Check the count
  2059.     GETHL    A
  2060.     LD    C,A        ;COPY VALUE
  2061.     LD    A,(CHKTYP)    ;GET OUR TYPE
  2062.     IFA    C,SPAR8
  2063.     LD    A,'1'        ;NO, USE SINGLE CHARACTER
  2064. SPAR8    LD    (INICHK),A
  2065.     CALL    CHKSPAR        ;Check the count
  2066.     GETHL    A
  2067.     IFA    ' ',SPAR10
  2068.     LD    C,A
  2069.     LD    (RPTQ),A    ;Save it
  2070.     LD    (RPTFLG),A
  2071. SPAR10    EQU    $
  2072.     POP    BC
  2073.     RET            ;AND RETURN
  2074. ;
  2075. ;    Check the count of characters left in the packet.
  2076. ;
  2077. CHKSPAR    EQU    $
  2078.     LD    A,(TEMP4)
  2079.     INC    B
  2080.     CP    B
  2081.     RET    P
  2082.     POP    HL        ;Remove return address
  2083.     POP    BC        ;Restore original BC
  2084.     RET            ;Return to caller
  2085. ;
  2086. ;    RECEIVE    FILE
  2087. ;
  2088. RFILE    CALL    CHKTRYS        ;Check retry threshold
  2089.     CALL    RPACK        ;GET A PACKET.
  2090.     JP    NAK        ;TRASHED PACKET NAK, RETRY.
  2091.     IFANOT    'S',RFILE2    ;If not send init, then jump
  2092.     CALL    CHKOLD        ;Make sure we have not surpassed retries
  2093.     CALL    CHKBLKDEC    ;Check if previous packet number
  2094.     JP    NZ,NAK_RTR    ;No, NAK it, and try again
  2095.     CALL    UPDRTR        ;Update the retry count.
  2096.     LD    HL,DATA        ;Get the data address
  2097.     CALL    RPAR        ;Set up the parameter information
  2098.     LD    (ARGBLK+1),A    ;Save the number of bytes in the packet
  2099.     LD    A,'Y'        ;Acknowledge with parameters
  2100.     CALL    SPACK        ;Send the packet
  2101.     JP    RECABORT    ;Send failed, abort
  2102.     LD    A,'S'        ;Show the state as still send init
  2103.     CALL    CONDCHR
  2104.     RET    
  2105. ;
  2106. RFILE2    IFANOT    'Z',RFILE3    ;EOF packet?  Jump if not
  2107.     CALL    CHKOLD        ;Check retry treshold
  2108.     CALL    CHKBLKDEC    ;Was it previous packet in sequence?
  2109.     JP    NZ,NAK_RTR    ;No, NAK it and try again
  2110.     CALL    UPDRTR        ;Update the number of retries
  2111.     XOR    A        ;Set length to zero
  2112.     LD    (ARGBLK+1),A    ;No data
  2113.     LD    A,'Y'        ;Send an ACK
  2114.     CALL    SPACK        ;Send the packet
  2115.     JP    RECABORT    ;Send failed, abort
  2116.     LD    A,'Z'        ;Show state as EOF
  2117.     CALL    CONDCHR
  2118.     RET    
  2119. RFILE3    IFANOT    'F',RFILE4    ;Jump if not FILE header packet
  2120.     CALL    CHKBLK        ;Check packet number against current
  2121.     JP    NZ,NAK_RTR    ;If not the same, then NAK and try again
  2122.     CALL    INCPKT        ;Increment the packet number
  2123.     CALL    INCDISPKT    ;Increment the real packet count
  2124.     LD    A,'F'
  2125.     LD    (DISFLG),A    ;Set the non-generic mode flag
  2126.     CALL    CONDCHR        ;Print the state character
  2127.     CALL    GOFIL        ;Get the file
  2128.     JP    RECABORT    ;Abort on an error
  2129.     CALL    INIT        ;Initialize everything else
  2130.     CALL    NUM2OLD        ;Reset the retry number
  2131.     LD    (ARGBLK+1),A    ;On return, A is zero, so NO DATA
  2132.     LD    A,'Y'        ;Send an ACK
  2133.     CALL    SPACK        ;Send the packet
  2134.     JP    RECABORT    ;Send failed, abort
  2135.     NSTATE    't'        ;Set the state to receive transition
  2136.     LD    A,(CZSEEN)    ;Check if user requested EOF or EOT
  2137.     CP    'Z'        ;Was it EOF?
  2138.     RET    Z        ;If it was EOF, then not yet
  2139.     XOR    A        ;Otherwise, must be EOT, so reset
  2140.     LD    (CZSEEN),A    ;Reset the flag
  2141.     RET            ;And return, ignoring other states
  2142. RFILE4    IFANOT    'B',RFILE5    ;Jump if not EOT
  2143.     CALL    CONDCHR        ;Display the state
  2144.     CALL    CHKBLK        ;Check packet number against current
  2145.     JP    NZ,NAK_RTR    ;If not right, then NAK and try again
  2146.     XOR    A        ;Set data length to zero
  2147.     LD    (ARGBLK+1),A    ;Store it for later
  2148.     LD    A,'Y'        ;Send an ACK
  2149.     CALL    SPACK        ;Send the packet
  2150.     JP    RECABORT    ;Send failed, abort
  2151.     NSTATE    'C'        ;Set state to complete
  2152.     RET            ;Return to caller
  2153. RFILE5    CP    'X'        ;Type on tty packet?
  2154.     JP    NZ,BADERROR    ;Bad packet if not
  2155.     CALL    CHKBLK        ;Make sure the packet number is right
  2156.     RET    NZ        ;Return if not
  2157.     CALL    SETUPDIS    ;Set up to type on terminal
  2158.     CALL    PRTPKTOUT    ;Print the packet contents
  2159.     CALL    NEWLIN        ;Get a newline
  2160.     CALL    NUM2OLD        ;Get new retry count
  2161.     LD    (ARGBLK+1),A    ;Zero length (A is zero on return)
  2162.     LD    A,'Y'        ;Send an ACK
  2163.     CALL    SPACK        ;Send the packet
  2164.     JP    RECABORT    ;Quit if send fails
  2165.     LD    A,(PKTNUM)    ;Get the packet number
  2166.     CALL    INCPKT        ;Add one
  2167.     CALL    INCDISPKT    ;Increment count for display
  2168.     NSTATE    'd'        ;Set the state to receive data
  2169.     RET            ;Return to protocol switch
  2170. ;
  2171. ;    Transition between receive file, and receive data
  2172. ;
  2173. RECTRAN    EQU    $
  2174.     STROUT    KERREC        ;Print the receiving message
  2175.     STROUT    TFILNAM        ;Print the name of the file
  2176.     LD    A,(TRANLOG)    ;Get the flag
  2177.     IFZ    RTRAN_1        ;Test the flag and jump if not set
  2178.     LD    DE,TRFCB    ;Get the FCB
  2179.     TRLOG    KERREC,RTRAN_3    ;Log the string
  2180.     TRLOG    TFILNAM,RTRAN_3    ;Log the file name
  2181.     TRLOG    TIMEMES,RTRAN_3    ;Log the time message
  2182.     CALL    PRTTIME        ;Print the current time
  2183. RTRAN_1    EQU    $
  2184.     LD    DE,FCB        ;Get the file FCB address
  2185.     LD    (RFIDCB),DE    ;Save it as the output FCB
  2186.     CALL    RSETPKT        ;Reset the packet coding routines
  2187.     NSTATE    'd'        ;Set the state to receive data
  2188.     RET
  2189. ;
  2190. ;    Clean up on log file failure
  2191. ;
  2192. RTRAN_3    XOR    A        ;Clear A
  2193.     LD    (TRANLOG),A    ;Reset the logging flag
  2194.     LD    DE,TRFCB    ;Get the FCB
  2195.     CALL    XCLOSE
  2196.     JR    RTRAN_1        ;Ignore rest of logging code
  2197. ;
  2198. ;    RECEIVE    DATA
  2199. ;
  2200. RDATA    CALL    CHKTRYS        ;Check the retry threshold
  2201.     CALL    RPACK        ;Get a packet
  2202.     JP    NAK        ;NAK it if bad packet
  2203.     IFANOT    'D',RDATA2    ;If not data check others
  2204. RDAT11    CALL    CHKBLK        ;Check packet number against current
  2205.     JR    Z,RDAT14    ;Jump if current packet
  2206.     CALL    CHKOLD        ;Check tries
  2207.     CALL    CHKBLKDEC    ;Check packet number against previous
  2208.     JP    NZ,NAK_RTR    ;Was not previous, so NAK it and retry
  2209.     CALL    UPDRTR        ;Update the number of retries
  2210.     XOR    A        ;Clear A
  2211.     LD    (NUMTRY),A    ;Reset the number of tries
  2212.     LD    (ARGBLK+1),A    ;Set the data length to zero
  2213.     LD    A,'Y'        ;Send ACK packet
  2214.     CALL    SPACK        ;Send the packet
  2215.     JP    RECABORT    ;Send failed, abort
  2216.     LD    A,'%'        ;Say we already saw this packet
  2217.     CALL    CONDCHR        ;and just stay in the same state
  2218.     RET            ;Next packet
  2219. RDAT14    CALL    INCPKT        ;Increment the packet number
  2220.     CALL    INCDISPKT    ;Increment the real packet count
  2221.     LD    A,(NUMTRY)    ;Get the number of retries
  2222.     LD    (OLDTRY),A    ;Save it
  2223.     LD    A,(ARGBLK+1)    ;Get the length of the data
  2224.     CALL    PTCHR        ;Decode the data packet and write it out
  2225.     JP    RECABORT    ;Can't write to output, abort
  2226.     XOR    A        ;Clear A
  2227.     LD    (NUMTRY),A    ;Reset the number of tries
  2228.     LD    (ARGBLK+1),A    ;Set data length to zero
  2229.     LD    C,A        ;Make C zero
  2230.     LD    A,(CZSEEN)    ;Check the flag
  2231.     IFZ    RDAT15        ;If nothing, then skip
  2232.     LD    C,A        ;Get the character typed
  2233.     LD    A,1        ;One data character
  2234.     LD    (ARGBLK+1),A    ;Set the length
  2235.     LD    A,C        ;Get the data character
  2236.     LD    (DATA),A    ;Store the character
  2237. RDAT15    LD    A,'Y'        ;Send an ACK (Possibly with data)
  2238.     CALL    SPACK        ;Send the packet
  2239.     JP    RECABORT    ;Send failed, abort
  2240.     LD    A,(NUMPKT)    ;Time to log the progress?
  2241.     AND    3        ;Only every 4 packets
  2242.     RET    NZ        ;Return if not time
  2243.     LD    A,'.'        ;Get the character
  2244.     CALL    CONDCHR        ;Log it if not doing 'X' packet
  2245.     RET    
  2246. RDATA2    IFANOT    'F',RDATA3    ;File header?  Jump if not
  2247.     CALL    CHKOLD        ;Check against previous retries
  2248.     CALL    CHKBLKDEC    ;Check packet number against previous
  2249.     JP    NZ,NAK_RTR    ;If not previous, then NAK and try again
  2250.     CALL    UPDRTR        ;Update the number of retries
  2251.     XOR    A        ;Clear A
  2252.     LD    (NUMTRY),A    ;Reset the number of retries
  2253.     LD    (ARGBLK+1),A    ;Set the length to zero
  2254.     LD    A,'Y'        ;Send an ACK
  2255.     CALL    SPACK        ;Send the packet
  2256.     JP    RECABORT    ;Send failed, abort
  2257.     LD    A,'%'        ;Already saw this one.
  2258.     CALL    CONDCHR        ;Tell the user
  2259.     RET    
  2260. RDATA3    CP    'Z'        ;If not EOF then jump
  2261.     JP    NZ,RDATA4
  2262.     CALL    CONDCHR        ;Display the new state
  2263.     CALL    CHKBLK        ;Check packet number against current
  2264.     JP    NZ,NAK_RTR    ;If not, then NAK and try again
  2265.     CALL    INCPKT        ;Increment the packet number
  2266.     CALL    INCDISPKT    ;Increment the real packet count
  2267.     LD    A,(ARGBLK+1)    ;Get the length of the data
  2268.     IFANOT    1,RDAT35    ;Jump if packet length not 1
  2269.     LD    A,(DATA)    ;Just one, get the data
  2270.     IFANOT    'D',RDAT36    ;Is it discard?  Jump if not
  2271.     LD    A,(TRANLOG)    ;Check if loggin active
  2272.     IFZ    RDAT31
  2273.     LD    DE,TRFCB    ;Get the log file FCB
  2274.     TRLOG    TRANCANC,RDAT39    ;Print canceled message
  2275. RDAT31    LD    A,(DISCARD)    ;Check users preference for incompletes
  2276.     IFZ    RDAT35        ;Jump if no discard
  2277.     CALL    CHKFCB        ;Is this FCB or *SO?
  2278.     JR    NZ,RDAT36    ;Jump if no remove, and don't close either
  2279.     CALL    XREMOVE        ;Remove it
  2280.     JR    Z,RDAT32    ;Jump if remove succeeded
  2281.     CALL    XERROR0        ;Print system error message
  2282.     JR    RDAT36        ;Join other code
  2283. RDAT32    STROUT    RMMES        ;Print the message
  2284.     LD    A,(TRANLOG)    ;Check if loggin active
  2285.     IFZ    RDAT36
  2286.     LD    DE,TRFCB
  2287.     TRLOG    RMMES,RDAT39
  2288.     JR    RDAT36        ;Join the other code
  2289. RDAT35    CALL    CHKFCB        ;Check for file FCB, don't close *SO
  2290.     CALL    Z,XCLOSE    ;Conditionally close the FILE
  2291. RDAT36    XOR    A        ;Reset the EOF seen flag
  2292.     LD    (CZSEEN),A
  2293.     CALL    NUM2OLD        ;Reset the number of retries
  2294.     LD    (ARGBLK+1),A    ;Set the length to zero
  2295.     LD    A,'Y'        ;Send an ACK
  2296.     CALL    SPACK        ;Send the packet
  2297.     JP    RECABORT    ;Send failed, abort
  2298.     NSTATE    'f'        ;Set state to receive file
  2299.     LD    IX,RTRANS    ;Get the receive statistics address
  2300.     CALL    UPDTRANS    ;Update the transfer statistics
  2301.     RET    
  2302. ;
  2303. ;    Close up on a transaction log error
  2304. ;
  2305. RDAT39    XOR    A        ;Reset the logging flag
  2306.     LD    (TRANLOG),A
  2307.     LD    DE,TRFCB    ;Close the file
  2308.     CALL    XCLOSE
  2309.     JR    RDAT36        ;Rejoin code
  2310. ;
  2311. RDATA4    CP    'X'        ;Is it End Of Transmission?
  2312.     JP    NZ,BADERROR    ;If not, then bad packet
  2313.     CALL    CHKBLKDEC    ;Check if previous sequence number
  2314.     RET    NZ        ;Return if not
  2315.     XOR    A        ;Clear A
  2316.     LD    (ARGBLK+1),A    ;Set the length to zero
  2317.     LD    A,'Y'        ;Send an ACK
  2318.     CALL    SPACK        ;Send the packet
  2319.     JP    RECABORT    ;Send failed, abort
  2320.     RET            ;Return to protocol
  2321. ;
  2322. ;    Check received packet number against previous
  2323. ;
  2324. CHKBLKDEC    EQU    $
  2325.     LD    A,(PKTNUM)    ;Get the current packet number
  2326.     DEC    A        ;Minus one for previous
  2327.     JR    CHKBLK_1    ;Join other code
  2328. ;
  2329. ;    Check the current packet number against that received
  2330. ;
  2331. CHKBLK    EQU    $
  2332.     LD    A,(PKTNUM)    ;Get the current number
  2333. CHKBLK_1    LD    B,A    ;Copy it to B
  2334.     LD    A,(ARGBLK)    ;Get the received packet number
  2335.     CP    B        ;Are they the same
  2336.     RET            ;Return the condition codes
  2337. ;
  2338. ;    Check for too many retries based on previous knowledge
  2339. ;
  2340. CHKOLD    EQU    $
  2341.     LD    A,(MAXTRY)    ;Get the max number of tries
  2342.     LD    B,A        ;Save it
  2343.     LD    A,(OLDTRY)    ;Check against old max
  2344.     CP    B        ;Set the condition bits
  2345.     JR    C,CHKOLD1    ;Jump if less than
  2346.     POP    DE        ;Remove the return address
  2347.     LD    DE,ERMS10    ;Get the message
  2348.     CALL    ERROR3        ;Display the error message
  2349.     JP    RECABORT    ;Change the state to abort
  2350. CHKOLD1    INC    A        ;Increment the number of tries
  2351.     LD    (OLDTRY),A    ;Save the updated number of tries.
  2352.     RET            ;Return normally
  2353. ;
  2354. ;    Set up for a REMOTE command.  The RFILE FCB is pointed at
  2355. ;    the *SO device, so that data received goes to the screen,
  2356. ;    rather than to a file.
  2357. ;
  2358. SETUPDIS    EQU    $
  2359.     LD    DE,(TMODCB)    ;Get the current output DCB address
  2360.     LD    (RFIDCB),DE    ;Make it the current received file output
  2361.     XOR    A        ;Reset the 'display' flag
  2362.     LD    (DISFLG),A
  2363.     CALL    NEWLIN        ;Get a fresh line
  2364.     RET            ;Return to caller
  2365. ;
  2366. ;    Conditionally display the string pointed to by DE based on the
  2367. ;    DISFLG which is active only during non REMOTE transactions.  This
  2368. ;    makes REMOTE command pleasingly silent so that only the output
  2369. ;    of the requested operation is seen.
  2370. ;
  2371. CONDIS    EQU    $
  2372.     PUSH    AF        ;Save A and the flags
  2373.     LD    A,(DISFLG)    ;Get the 'display' flag
  2374.     OR    A        ;Is it set?
  2375.     CALL    NZ,PRTSTR    ;If so, then print the string
  2376.     POP    AF        ;Restore the flags and A
  2377.     RET            ;Return to caller
  2378. ;
  2379. ;    Print the contents of the PACKET data area to the
  2380. ;    screen.
  2381. ;
  2382. PRTPKTOUT    EQU    $
  2383.     LD    HL,DATA        ;Get the start of the string
  2384.     LD    A,(ARGBLK+1)    ;Get the length
  2385.     OR    A
  2386.     RET    Z        ;Return if no data
  2387.     LD    C,A        ;Get the LSB into C
  2388.     LD    B,0        ;Make BC a 16 bit offset
  2389.     ADD    HL,BC        ;HL is now the address past the end
  2390.     LD    (HL),EOS    ;Terminator for printing
  2391.     STROUT    DATA
  2392.     JP    NEWLIN        ;Print a new line and return
  2393. ;
  2394. ;    Update byte counters, IX MUST point to send or receive
  2395. ;    counter.  We mod HL with 1K to get the remainder, and use
  2396. ;    the rest to sum into the current total.  The remainder of
  2397. ;    HL mod 1024 is tucked away, but not forgotten.
  2398. ;
  2399. UPDTRANS    EQU    $
  2400.     LD    HL,(KTRANS)    ;Calculate new total transfered
  2401.     LD    C,(IX+2)    ;Get the overflow counter
  2402.     LD    B,(IX+3)
  2403.     ADD    HL,BC        ;Compute the total
  2404.     XOR    A        ;Reset the falg
  2405.     CALL    C,ADD64K    ;Add 64k if addition overflows
  2406.     LD    A,H        ;Get the high byte
  2407.     AND    3        ;Save the 2 lower order bits for mod 1024
  2408.     LD    B,A        ;Put them in B
  2409.     LD    C,L        ;Put the other 8 bits into C
  2410.     LD    (IX+2),C    ;Store the new overflow (HL mod 1024)
  2411.     LD    (IX+3),B
  2412.     LD    A,H        ;Trim to 1K multiple
  2413.     AND    0FCH        ;A is now 4 times the number of Kbytes
  2414.     LD    L,A        ;Put it into L
  2415.     LD    H,0        ;Make H zero
  2416.     SRL    L        ;Divide by 4 to align
  2417.     SRL    L
  2418.     LD    C,(IX)        ;Get the total so far
  2419.     LD    B,(IX+1)
  2420.     ADD    HL,BC        ;Compute the new total Kbyte
  2421.     LD    (IX),L        ;Put it back
  2422.     LD    (IX+1),H    ;ignoring any overflow
  2423.     CALL    TRANSCNT    ;Log the transaction size if logging
  2424.     LD    HL,0        ;Set the counter to zero
  2425.     LD    (KTRANS),HL
  2426.     LD    (CURTRANS),HL    ;Reset current counters
  2427.     LD    (CURTRANS+2),HL
  2428.     RET            ;Return to the caller
  2429. ;
  2430. ;    Log the size of the last transaction to the logfile
  2431. ;
  2432. TRANSCNT    EQU    $
  2433.     PUSH    AF        ;Save A and the FLAGS
  2434.     LD    A,(TRANLOG)    ;Is tranaction logging in progress?
  2435.     IFZ    TRANSC_10    ;Jump if not active
  2436.     PUSH    HL
  2437.     PUSH    DE
  2438.     PUSH    BC
  2439.     LD    HL,(CURTRANS+2)    ;Get the number of K transfered
  2440.     LD    A,H
  2441.     OR    L        ;Is it zero?
  2442.     JR    Z,TRANSC_3    ;Jump if it is
  2443.     CALL    NUM2BUFF    ;Put the number in the buffer
  2444.     LD    DE,TRFCB    ;Get the FCB address
  2445.     CALL    OUTLOG        ;Log the number of K transfered
  2446.     JP    TRANSC_20    ;Close up on an error
  2447.     TRLOG    KPLUS,TRANSC_20    ;Log the 'K + ' string
  2448. TRANSC_3    EQU    $
  2449.     LD    HL,(CURTRANS)    ;Get the value
  2450.     CALL    NUM2BUFF    ;Make it printable
  2451.     LD    DE,TRFCB    ;Get the output FCB
  2452.     CALL    OUTLOG        ;Log the number of left over bytes
  2453.     JP    TRANSC_20    ;Close up on an error
  2454.     TRLOG    BYTESMES,TRANSC_20;Log the 'bytes transferred' message
  2455.     TRLOG    TIMEMES,TRANSC_20; Log the time message
  2456.     CALL    PRTTIME        ;Print the current time
  2457. TRANSC_9    EQU    $
  2458.     POP    BC        ;Restore the registers
  2459.     POP    DE
  2460.     POP    HL
  2461. TRANSC_10    EQU    $
  2462.     POP    AF    ;Restore A and flags
  2463.     RET            ;Return to caller
  2464. TRANSC_20    EQU    $
  2465.     LD    DE,TRFCB
  2466.     CALL    XCLOSE
  2467.     XOR    A
  2468.     LD    (TRANLOG),A
  2469.     JP    TRANSC_9
  2470. ;
  2471. ;    Convert binary to ascii, NO leading spaces
  2472. ;
  2473. NUM2BUFF    EQU    $
  2474.     PUSH    DE        ;Save DE
  2475.     PUSH    BC        ;and BC
  2476.     LD    DE,NBUFF    ;Get the data buffer
  2477.     PUSH    DE        ;Save it for later
  2478.     CALL    XHEXDEC
  2479.     EX    DE,HL
  2480.     LD    (HL),EOS    ;Terminate the buffer
  2481.     POP    HL        ;Get the start back
  2482.     LD    A,' '        ;Character to skip over
  2483. N2B_1    EQU    $
  2484.     IFANOT    (HL),N2B_2    ;Jump if passed last
  2485.     INC    HL        ;Point to next
  2486.     JR    N2B_1        ;Back to test
  2487. N2B_2    EQU    $
  2488.     POP    BC        ;Restore the registers
  2489.     POP    DE
  2490.     RET            ;Return to caller
  2491. ;end of file
  2492. <<< m4h191.asm >>>
  2493. ;        M4H191/ASM
  2494. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2495. ;
  2496. ;        Heath 19 terminal emulation filter
  2497. ;
  2498. ;            Written By:  Gregg Wonderly
  2499. ;
  2500. ;    This program functions as a TRSDOS 6.2 device filter to emulate
  2501. ;    the h19 terminal.  It recognizes most of the features of the
  2502. ;    H19 that are reasonable to implement on the Model 4.  The items
  2503. ;    missing are ALT character set, and some of the <ESC>[xy]n
  2504. ;    sequences.
  2505. ;
  2506. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2507. ;
  2508. ;    This filter relocates itself to HIGH memory.
  2509. ;
  2510. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2511. ;
  2512.         ORG    3000H
  2513. TAB        EQU    9        ;Tab character code
  2514. ESC        EQU    27        ;Tab character code
  2515. S_OUT        EQU    1        ;Screen on mask
  2516. S_IN        EQU    0FEH        ;Screen off mask
  2517. R_ON        EQU    8        ;Reverse video on mask
  2518. R_OFF        EQU    0F7H        ;Reverse video off mask
  2519. FLAGVAL        EQU    17        ;Flags offset from MODDCB
  2520. SCR_MASK    EQU    14        ;Offset of screen mask in flags
  2521. WRINTMASK    EQU    22        ;Interrupts mask in FLAGS
  2522. BITOFFSET    EQU    29
  2523. ;
  2524. *GET        M4H19/EQU        ;Get the SVC equates
  2525. *GET        M4H19/MAC        ;Get the macros
  2526. ;
  2527. ;        The system enters the driver here with each character
  2528. ;
  2529. FILTER        JR    H19EMULATOR    ;Go to the start of the driver
  2530.         DW     0        ;End of module address goes here
  2531.         DB    6        ;Length of the module name
  2532.         DB    '$HEATH'    ;The name
  2533. MODDCB        DW    0        ;To be filled in later
  2534.         DW    0        ;Filler
  2535. VSCUR        DB    95        ;Block cursor character
  2536. VECUR        DB    95        ;Underscore cursor character
  2537. DEF_LEN        DB    20        ;Default duration for the bell
  2538. BELLFLAG    DB    0        ;Visual or audible bell
  2539. DEF_FREQ    DW    125        ;Default frequency for bell tone
  2540. OLDLOW        DW    0        ;The address to restore if we
  2541. ;                        remove ourselves
  2542. OLDHIGH        DW    0        ;This is where we are loaded at
  2543. WHERE_AT    DB    0        ;Flag for high or low mem load
  2544. OFFSET        DW    0        ;Offset from load to destination
  2545. FVAL        DB    0        ;No flags to start with
  2546. BITVAL        DW    BITMASK        ;Offset to 7-bit mask
  2547. ;
  2548. ;    Start of actual Filter
  2549. ;
  2550. H19EMULATOR    JR    Z,ISPUT        ;Go to process @PUT requests
  2551.         JP    CHAIN_2        ;Ignore other options
  2552. R002        EQU    $-2
  2553. ;
  2554. ;    Do only @PUT requests
  2555. ;
  2556. ISPUT        EQU    $
  2557.         LD    A,@FLAGS    ;Get the flags address into IY
  2558.         RST    28H
  2559.         LD    A,C        ;Character is in A and C now
  2560.         AND    07FH        ;Strip any 8th bit if STRIP8 set
  2561. BITMASK        EQU    $-FILTER-1
  2562.         LD    C,A
  2563.         LD    (NEWCHAR),A    ;Save the character to display
  2564. R003        EQU    $-2
  2565.         LD    HL,(OLDSTATE)    ;Get any preexisting state
  2566. R004        EQU    $-2
  2567.         LD    A,H        ;Check for on, NZ means yes
  2568.         OR    L
  2569.         JR    Z,NOSTATE    ;Go if no state
  2570.         PUSH    HL        ;Put the address on the stack
  2571.         LD    HL,0        ;Wipe out the state value
  2572.         LD    (OLDSTATE),HL    ;by storing zero in it
  2573. R005        EQU    $-2
  2574.         RET            ;Go to the address on the stack
  2575. ;
  2576. ;    Look for what we should do with the character...
  2577. ;
  2578. NOSTATE        LD    A,C        ;Get the character
  2579.         CP    ESC        ;Is it the escape character?
  2580.         JP    Z,DOESCAPE    ;Go do it if so
  2581. R006        EQU    $-2
  2582.         CP    ' '        ;Check for a Control Character
  2583.         JP    C,DOCONTROL    ;Go do it if so
  2584. R007        EQU    $-2
  2585.         CALL    INSERT_A    ;Put the character on the screen
  2586. R008        EQU    $-2
  2587.         JP    RETOUT        ;Return to caller
  2588. R009        EQU    $-2
  2589. ;
  2590. ;    Process all of the control characters between 0-31 inclusive
  2591. ;
  2592. DOCONTROL    EQU    $
  2593.         LD    A,(NEWCHAR)    ;Get the character
  2594. R010        EQU    $-2
  2595.         ADD    A,A        ;Times 2 for word offset
  2596.         LD    C,A        ;Get a copy of A for the offset
  2597.         LD    B,0        ;Make BC a 16 bit offset
  2598.         LD    HL,CTL_JMP_TBL    ;Get the jump table
  2599. R011        EQU    $-2
  2600.         ADD    HL,BC        ;Get the address in the table
  2601.         LD    E,(HL)        ;Get LSB of the address
  2602.         INC    HL        ;Point at next byte of address
  2603.         LD    D,(HL)        ;Get the MSB
  2604.         EX    DE,HL        ;Swap the jump address into HL
  2605.         LD    A,H        ;Is there a special routine?
  2606.         OR    L        ;Set the flags
  2607.         LD    A,(NEWCHAR)    ;Get the character back
  2608. R012        EQU    $-2
  2609.         JP    Z,RETOUT    ;If not recognized, throw it out.
  2610. R013        EQU    $-2
  2611.         JP    (HL)        ;Go to the special routine
  2612. ;
  2613. ;    Control character jump table.  Each word is the address of a
  2614. ;    routine that processes the specfic character.
  2615. ;
  2616. CTL_JMP_TBL    DW    0,0,0,0,0,0,0    ;Throw these out.
  2617.         DW    SET_BELL    ;Start the buzzer.
  2618. R014        EQU    $-2
  2619.         DW    BACK_SPACE    ;Backup a character NON-destruct.
  2620. R015        EQU    $-2
  2621.         DW    SHOW_TAB    ;Skip a physical tab.
  2622. R016        EQU    $-2
  2623.         DW    LINE_FEED    ;Down one line.
  2624. R017        EQU    $-2
  2625.         DW    0        ;Throw this one out.
  2626.         DW    FORM_FEED    ;Clear the screen on FF.
  2627. R018        EQU    $-2
  2628.         DW    CARRIAGE    ;Carriage return.
  2629. R019        EQU    $-2
  2630.         DW    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0    ;Not used.
  2631. ;
  2632. SET_BELL    LD    A,(BELLFLAG)    ;Is the bell function valid?
  2633. R020        EQU    $-2
  2634.         OR    A
  2635.         JP    Z,FLASH_SCREEN    ;Flash if signaled
  2636. R021        EQU    $-2
  2637.         LD    A,(DEF_LEN)    ;This is the timer value.
  2638. R022        EQU    $-2
  2639.         LD    L,A
  2640.         LD    DE,(DEF_FREQ)
  2641. R023        EQU    $-2
  2642. BELL01        EQU    $
  2643.         LD    A,1
  2644.         OUT    (90H),A
  2645.         LD    B,D
  2646.         LD    C,E
  2647. BELL02        EQU    $
  2648.         DEC    BC
  2649.         LD    A,B
  2650.         OR    C
  2651.         JR    NZ,BELL02
  2652.         XOR    A
  2653.         OUT    (90H),A
  2654.         LD    B,D
  2655.         LD    C,E
  2656. BELL03        EQU    $
  2657.         DEC    BC
  2658.         LD    A,B
  2659.         OR    C
  2660.         JR    NZ,BELL03
  2661.         DEC    L
  2662.         JR    NZ,BELL01
  2663.         JP    RETOUT        ;Exit without chaining
  2664. R024        EQU    $-2
  2665. ;
  2666. BACK_SPACE    EQU    $
  2667.         LD    A,24        ;Non-destructive backspace
  2668.         JP    STORE_CHAIN    ;Chain into any filters
  2669. R025        EQU    $-2
  2670. ;
  2671. SHOW_TAB    EQU    $
  2672.         GET_CURSOR        ;Get the cursor position
  2673.         LD    A,79        ;Last column to display in
  2674.         SUB    L        ;Compute the difference
  2675.         CP    8        ;Do we have enough?
  2676.         JP    NC,TABOK    ;If at least 8 then go do it
  2677. R026        EQU    $-2
  2678.         LD    A,29        ;Send simulated <CR><LF> to *DO
  2679.         CALL    CHAIN_IN
  2680. R028        EQU    $-2
  2681.         LD    A,26
  2682.         JP    CHAIN_IN    ;No return
  2683. R029        EQU    $-2
  2684. TABOK        EQU    $
  2685.         LD    A,L        ;Must truncate to even 8 chars
  2686.         ADD    A,8
  2687.         AND    0F8H
  2688.         LD    L,A        ;Get the column back into L
  2689. NOSCROLL    EQU    $
  2690.         PUT_CURSOR        ;Set the cursor to what is in HL
  2691.         JP    RETOUT        ;Return
  2692. R030        EQU    $-2
  2693. ;
  2694. LINE_FEED    EQU    $
  2695.         LD    A,26        ;Non-destructive LF
  2696.         CALL    STORE_CHAIN    ;Chain into any filters
  2697. R031        EQU    $-2
  2698.         LD    A,(FVAL)
  2699. R131        EQU    $-2
  2700.         AND    2        ;Check for auto CR
  2701.         LD    A,29        ;Get a CR
  2702.         CALL    NZ,STORE_CHAIN
  2703. R177        EQU    $-2
  2704.         JP    RETOUT        ;Return
  2705. R178        EQU    $-2
  2706. ;
  2707. FORM_FEED    EQU    $
  2708.         LD    HL,0        ;Set the cursor to 0,0
  2709.         PUT_CURSOR
  2710.         JP    CLEAR_TO_EOS    ;Do a clear to end of screen
  2711. R032        EQU    $-2
  2712. ;
  2713. MOVE_HOME    EQU    $
  2714.         LD    HL,0        ;Get Row=0, Column=0
  2715. STORE_ROW_COL    EQU    $
  2716.         PUT_CURSOR        ;Move the cursor to the pos in HL
  2717.         JP    RETOUT        ;Return
  2718. R033        EQU    $-2
  2719. ;
  2720. CARRIAGE    EQU    $
  2721.         LD    A,29        ;True carriage return
  2722.         CALL    STORE_CHAIN
  2723. R034        EQU    $-2
  2724.         LD    A,(FVAL)
  2725. R174        EQU    $-2
  2726.         AND    1
  2727.         LD    A,26        ;Get a line_feed
  2728.         CALL    NZ,STORE_CHAIN    ;Display it conditionally
  2729. R175        EQU    $-2
  2730.         JP    RETOUT
  2731. R176        EQU    $-2
  2732. ;
  2733. ;    Process the ESCAPE character sequences
  2734. ;
  2735. DOESCAPE    EQU    $
  2736.         LD    HL,ESCAPE_1    ;Set the next state to go to
  2737. R035        EQU    $-2
  2738.         LD    (OLDSTATE),HL
  2739. R036        EQU    $-2
  2740.         JP    RETOUT        ;Leave with no chain
  2741. R037        EQU    $-2
  2742. ;
  2743. ;    Escape has been seen, now check for a special character
  2744. ;
  2745. ESCAPE_CHARS    DB    'ABCDEFGHIJKLMNOY@fqpxyjkbol'
  2746. ESC_LEN        EQU    $-ESCAPE_CHARS
  2747. ;
  2748. ESCAPE_1    EQU    $
  2749.         LD    A,(NEWCHAR)    ;Get the character sent
  2750. R038        EQU    $-2
  2751.         LD    HL,ESCAPE_CHARS    ;Get the list of valid ones
  2752. R039        EQU    $-2
  2753.         LD    B,ESC_LEN    ;Get how many
  2754.         LD    DE,ESC_1_JMPS    ;Get the vector table
  2755. R040        EQU    $-2
  2756. ESC_1_LOOP    LD    C,(HL)        ;Get a character
  2757.         CP    C        ;Is it a match?
  2758.         JR    Z,ESC_1_FND    ;Found it, so go
  2759.         INC    HL        ;Next character
  2760.         INC    DE        ;next jump table entry
  2761.         INC    DE
  2762.         DJNZ    ESC_1_LOOP    ;Loop while still more
  2763.         LD    HL,0
  2764.         LD    (OLDSTATE),HL
  2765. R041        EQU    $-2
  2766.         JP    RETOUT        ;Ignore unimplemented or invalid codes
  2767. R042        EQU    $-2
  2768. ;
  2769. ESC_1_FND    EQU    $
  2770.         EX    DE,HL        ;Get the vector's address
  2771.         LD    E,(HL)        ;Get the table value
  2772.         INC    HL
  2773.         LD    D,(HL)
  2774.         LD    HL,0        ;Reset the state
  2775.         LD    (OLDSTATE),HL
  2776. R043        EQU    $-2
  2777.         EX    DE,HL        ;Get the vector in HL
  2778.         LD    A,(NEWCHAR)
  2779. R044        EQU    $-2
  2780.         JP    (HL)        ;Go do the right thing.
  2781. ;
  2782. ;    Level 1 escape vector table
  2783. ;
  2784. ESC_1_JMPS    DW    CURSOR_UP
  2785. R045        EQU    $-2
  2786.         DW    LINE_FEED
  2787. R046        EQU    $-2
  2788.         DW    CURSOR_RIGHT
  2789. R047        EQU    $-2
  2790.         DW    BACK_SPACE
  2791. R048        EQU    $-2
  2792.         DW    FORM_FEED
  2793. R049        EQU    $-2
  2794.         DW    START_ALT_SET
  2795. R050        EQU    $-2
  2796.         DW    END_ALT_SET
  2797. R051        EQU    $-2
  2798.         DW    MOVE_HOME
  2799. R052        EQU    $-2
  2800.         DW    REV_INDEX
  2801. R053        EQU    $-2
  2802.         DW    CLEAR_TO_EOS
  2803. R054        EQU    $-2
  2804.         DW    CLEAR_TO_EOL
  2805. R055        EQU    $-2
  2806.         DW    ADD_LINE
  2807. R056        EQU    $-2
  2808.         DW    DEL_LINE
  2809. R057        EQU    $-2
  2810.         DW    DEL_CHAR
  2811. R058        EQU    $-2
  2812.         DW    END_INSERT
  2813. R059        EQU    $-2
  2814.         DW    SET_ESC_2
  2815. R060        EQU    $-2
  2816.         DW    BEGIN_INSERT
  2817. R061        EQU    $-2
  2818.         DW    FLASH_SCREEN
  2819. R062        EQU    $-2
  2820.         DW    STAND_END
  2821. R063        EQU    $-2
  2822.         DW    STAND_OUT
  2823. R064        EQU    $-2
  2824.         DW    SET_ESC_2
  2825. R065        EQU    $-2
  2826.         DW    SET_ESC_2
  2827. R066        EQU    $-2
  2828.         DW    SAVE_CURSOR
  2829. R001        EQU    $-2
  2830.         DW    RESTORE_CURSOR
  2831. R027        EQU    $-2
  2832.         DW    ERA_BEG_SCR
  2833. R141        EQU    $-2
  2834.         DW    ERA_BEG_LIN
  2835. R142        EQU    $-2
  2836.         DW    ERASE_LINE
  2837. R143        EQU    $-2
  2838. ;
  2839. ;    Move the cursor up one line if possible, stopping at the top
  2840. ;    of the screen.
  2841. ;
  2842. CURSOR_UP    EQU    $
  2843.         LD    A,27        ;Non-destructive cursor up
  2844. STORE_CHAIN    EQU    $
  2845.         LD    (NEWCHAR),A    ;Store it
  2846. R067        EQU    $-2
  2847.         JP    CHAIN        ;Let *DO do the dirty work
  2848. R068        EQU    $-2
  2849. ;
  2850. CURSOR_RIGHT    EQU    $
  2851.         LD    A,25        ;Non-destructive cursor right
  2852.         JP    STORE_CHAIN    ;Let *DO do it for us
  2853. R069        EQU    $-2
  2854. ;
  2855. START_ALT_SET    JP    RETOUT        ;No defined action
  2856. R070        EQU    $-2
  2857. ;
  2858. END_ALT_SET    JP    RETOUT        ;No defined action
  2859. R071        EQU    $-2
  2860. ;
  2861. ;    This is the reverse scroll.  We use direct screen access to
  2862. ;    move one line.  Interrupts are off during the move, but are
  2863. ;    restored between each line.  There seems to be quite reasonable
  2864. ;    behavior at 9600 baud with this strategy.
  2865. ;
  2866. REV_INDEX    EQU    $
  2867.         GET_CURSOR        ;Make sure we are at the top
  2868.         LD    A,H        ;Get the cursor row
  2869.         OR    A        ;Is it row zero?
  2870.         JP    NZ,CURSOR_UP    ;Go if not, to Cursor up routine
  2871. R072        EQU    $-2
  2872.         LD    A,15        ;Remove the cursor
  2873.         CALL    CHAIN_IN
  2874. R127        EQU    $-2
  2875.         LD    A,23        ;Move 23 lines down
  2876.         LD    HL,23*80+0F7FFH    ;Get the next to last line, last byte
  2877.         LD    DE,24*80+0F7FFH    ;Get the last byte on the screen
  2878. REV_LOOP    LD    BC,80        ;Get the byte count
  2879.         PUSH    AF        ;Save the line count
  2880.         SWAP_IN            ;Screen in, interrupts off
  2881.         LDDR            ;Move a line
  2882.         SWAP_OUT        ;Screen out, interrupts on
  2883.         POP    AF        ;Get line count
  2884.         DEC    A        ;One less to move
  2885.         JR    NZ,REV_LOOP    ;Loop if not done
  2886. REV_DONE    EQU    $
  2887.         LD    DE,SCR_BUFF    ;Get the buffer address
  2888. R073        EQU    $-2
  2889.         PUSH    DE        ;Save it
  2890.         PUSH    DE        ;Copy it into HL
  2891.         POP    HL
  2892.         INC    DE        ;Point one ahead for the copy
  2893.         LD    (HL),' '    ;Store one blank
  2894.         LD    BC,79        ;Copy it into the remaining 79
  2895.         LDIR            ;Do the copy
  2896.         LD    H,0        ;Get the top row
  2897.         POP    DE        ;Get the buffer address back
  2898.         PUT_LINE        ;Put a blank line there
  2899.         LD    A,14        ;Turn the cursor back on
  2900.         JP    CHAIN_IN
  2901. R074        EQU    $-2
  2902. ;
  2903. ;    Flash the screen, by inverting all of the msb's of the characters
  2904. ;    twice.  The result is a fair approximation to a flash.
  2905. ;
  2906. FLASH_SCREEN    EQU    $
  2907.         LD    A,16        ;Turn reverse video on
  2908.         CALL    CHAIN_IN
  2909. R128        EQU    $-2
  2910.         LD    C,0        ;Get the loop counter
  2911. FLASH_LOOP_1    EQU    $
  2912.         PUSH    BC        ;Save it
  2913.         LD    H,0        ;Get the first line
  2914. FLASH_LOOP_2    EQU    $
  2915.         LD    DE,SCR_BUFF    ;Get the buffer to put it in
  2916. R075        EQU    $-2
  2917.         GET_LINE        ;Get the line from @VDCTL
  2918.         PUSH    HL        ;Save the line number for PUT_LINE
  2919.         LD    H,D        ;Copy DE into HL
  2920.         LD    L,E
  2921.         LD    B,80        ;Get the BYTE count
  2922. FLASH_LOOP_3    EQU    $
  2923.         LD    A,(HL)        ;Get a BYTE
  2924.         XOR    080H        ;Invert the HIGH BIT
  2925.         LD    (HL),A        ;Put it back
  2926.         INC    HL        ;Point to the next
  2927.         DJNZ    FLASH_LOOP_3    ;Loop until line is done
  2928.         POP    HL        ;Restore the Line number
  2929.         PUT_LINE        ;Put the line back
  2930.         INC    H        ;Point to next line
  2931.         LD    A,H        ;Test for last
  2932.         CP    24        ;END?
  2933.         JR    NZ,FLASH_LOOP_2    ;Loop if not done
  2934.         EI            ;Make sure interrupts are back on
  2935.         POP    BC        ;Restore the FLASH counter
  2936.         LD    A,C        ;Get the original value
  2937.         INC    C        ;Increment the counter
  2938.         OR    A        ;Test OLD value
  2939.         JR    Z,FLASH_LOOP_1    ;Loop if just finished first time
  2940.         LD    A,17        ;Set reverse video OFF
  2941.         JP    STORE_CHAIN    ;Chain to *DO
  2942. R076        EQU    $-2
  2943. ;
  2944. ;    Save the current cursor position
  2945. ;
  2946. SAVE_CURSOR    EQU    $
  2947.         LD    DE,(LASTPUSH)    ;Get the nextplace available
  2948. R132        EQU    $-2
  2949.         GET_CURSOR        ;Get the cursor
  2950.         EX    DE,HL        ;Swap push address for screen pos
  2951.         PUSH    HL        ;Save push address
  2952.         LD    BC,ENDPUSH    ;Get the first illeagal address
  2953. R133        EQU    $-2
  2954.         OR    A        ;Reset the carry
  2955.         SBC    HL,BC        ;Compute difference
  2956.         POP    HL        ;Restore real address
  2957.         JR    Z,NO_SAVE    ;Jump if can't save
  2958.         LD    (HL),E        ;Put in column
  2959.         INC    HL        ;Point to next pos
  2960.         LD    (HL),D        ;Put in the row
  2961.         INC    HL        ;Point past it to next position
  2962.         LD    (LASTPUSH),HL    ;Save the new address
  2963. R134        EQU    $-2
  2964. NO_SAVE        EQU    $
  2965.         JP    RETOUT
  2966. R135        EQU    $-2
  2967. ;
  2968. ;    Restore the previously pushed cursor position.
  2969. ;
  2970. RESTORE_CURSOR    EQU    $
  2971.         LD    HL,(LASTPUSH)    ;Get the next store position
  2972. R136        EQU    $-2
  2973.         LD    BC,PUSHAREA    ;Get the start of the area
  2974. R137        EQU    $-2
  2975.         OR    A        ;Reset carry
  2976.         PUSH    HL        ;Save the address
  2977.         SBC    HL,BC        ;See if anything to pop
  2978.         POP    HL
  2979.         JR    Z,NO_RESTORE    ;Jump if not
  2980.         DEC    HL        ;Point back to row
  2981.         LD    D,(HL)        ;Get it
  2982.         DEC    HL        ;Point back to column
  2983.         LD    E,(HL)        ;Get it
  2984.         LD    (LASTPUSH),HL    ;Save the next position
  2985. R138        EQU    $-2
  2986.         EX    DE,HL        ;Put the Row/Column into HL
  2987.         PUT_CURSOR        ;Set the cursor position
  2988. NO_RESTORE    EQU    $
  2989.         JP    RETOUT        ;Return without calling *DO
  2990. R139        EQU    $-2
  2991. ;
  2992. ;    Erase the current line
  2993. ;
  2994. ERASE_LINE    EQU    $
  2995.         GET_CURSOR        ;Get the current position
  2996.         PUSH    HL        ;Save it
  2997.         LD    L,0        ;Move to beginning of line
  2998.         PUT_CURSOR        ;Store the new cursor position
  2999.         CALL    CLEAR_TO_EOL
  3000. R144        EQU    $-2
  3001.         POP    HL
  3002.         PUT_CURSOR
  3003.         JP    RETOUT
  3004. R145        EQU    $-2
  3005. ;
  3006. ;    Erase to beginning of screen
  3007. ;
  3008. ERA_BEG_SCR    EQU    $
  3009.         GET_CURSOR        ;Get the current screen position
  3010.         CALL    GET_RC_ADDR    ;Convert it to a memory address
  3011. R146        EQU    $-2
  3012.         LD    DE,0F800H    ;Get the start of the screen
  3013.         OR    A        ;Reset the carry
  3014.         SBC    HL,DE        ;Compute number to blank
  3015.         LD    B,H        ;Put the count into BC
  3016.         LD    C,L
  3017.         LD    A,B        ;See if at start of screen
  3018.         OR    C
  3019.         JR    Z,NO_ERA_SCR    ;Jump if so, nothing to erase
  3020.         LD    HL,0F800H    ;Get the start
  3021.         LD    DE,0F801H    ;Get the start + 1
  3022.         SWAP_IN            ;Make the screen visible
  3023.         LD    (HL),20H    ;Blank one position
  3024.         SWAP_OUT        ;Swap the screen back out
  3025.         DEC    BC        ;Decrement remaining places
  3026.         LD    A,B        ;See if only one needed blanking
  3027.         OR    C
  3028.         JR    Z,NO_ERA_SCR    ;Jump it that was all
  3029.         SWAP_IN            ;Swap the screen back in
  3030.         LDIR            ;Blank the characters
  3031.         SWAP_OUT        ;Swap the screen back out
  3032. NO_ERA_SCR    EQU    $
  3033.         JP    RETOUT        ;Return without chaining
  3034. R147        EQU    $-2
  3035. ;
  3036. ;    Clear to the beginning of the line
  3037. ;
  3038. ERA_BEG_LIN    EQU    $
  3039.         GET_CURSOR        ;Get current position
  3040.         PUSH    HL        ;Save it
  3041.         CALL    GET_RC_ADDR    ;Convert to memory address
  3042. R148        EQU    $-2
  3043.         EX    DE,HL        ;Swap current to DE
  3044.         POP    HL        ;Get the row/column back
  3045.         LD    L,0        ;Set row to start of screen
  3046.         CALL    GET_RC_ADDR    ;Get the address there
  3047. R149        EQU    $-2
  3048.         EX    DE,HL        ;Swap it back
  3049.         OR    A        ;Reset the carry
  3050.         PUSH    DE        ;Save starting address
  3051.         SBC    HL,DE        ;Compute length
  3052.         LD    B,H        ;Put it into BC
  3053.         LD    C,L
  3054.         LD    A,B        ;Check if no characters
  3055.         OR    C
  3056.         JR    Z,NO_ERA_LIN    ;Jump if at start of line
  3057.         POP    HL        ;Get start of line address back
  3058.         LD    D,H        ;Make DE=HL+1
  3059.         LD    E,L
  3060.         INC    DE
  3061.         SWAP_IN            ;Swap the screen in
  3062.         LD    (HL),20H    ;Store a space
  3063.         SWAP_OUT        ;Swap the screen out
  3064.         DEC    BC        ;Decrement the count for prev inst
  3065.         LD    A,B        ;Check for zero
  3066.         OR    C        ;Set the flags
  3067.         JR    Z,NO_ERA_LIN
  3068.         SWAP_IN            ;Fold the screen into memory
  3069.         LDIR            ;Blank the screen
  3070.         SWAP_OUT        ;Swap the screen back out
  3071. NO_ERA_LIN    EQU    $
  3072.         JP    RETOUT        ;Return to caller
  3073. R150        EQU    $-2
  3074. *GET        M4H192/ASM
  3075.         END    LOAD
  3076. <<< m4h192.asm >>>
  3077. ;        M4H192/ASM
  3078. CLEAR_TO_EOS    EQU    $
  3079.         GET_CURSOR        ;Get the cursor position
  3080.         CALL    GET_RC_ADDR    ;Get the real address
  3081. R077        EQU    $-2
  3082.         PUSH    HL        ;Save the start for LDIR
  3083.         PUSH    HL        ;Copy it to BC
  3084.         POP    BC
  3085.         LD    HL,24*80+0F7FFH    ;Get the last place to blank
  3086. CLEAR_SPACE    EQU    $
  3087.         OR    A        ;Reset the carry
  3088.         SBC    HL,BC        ;HL is now length of area
  3089.         PUSH    HL        ;Put it into BC and clear stack
  3090.         POP    BC
  3091.         POP    HL        ;Get the starting address
  3092.         JR    Z,NO_CLEAR    ;Jump if no count
  3093.         PUSH    HL        ;Copy to DE
  3094.         POP    DE
  3095.         INC    DE        ;Point DE one ahead
  3096.         PUSH    BC        ;Hide the cursor before
  3097.         PUSH    DE
  3098.         PUSH    HL
  3099.         LD    A,15        ;Use *DO for this
  3100.         CALL    CHAIN_IN
  3101. R190        EQU    $-2
  3102.         POP    HL        ;Restore the stack
  3103.         POP    DE
  3104.         POP    BC
  3105.         SWAP_IN            ;Swap screen into RAM
  3106.         LD    (HL),' '    ;Store one blank
  3107.         SWAP_OUT
  3108. CLR_LOOP    LD    A,30        ;One line max
  3109.         SWAP_IN            ;Screen in
  3110. LINE_LOOP    PUSH    AF        ;Save the max counter
  3111.         LD    A,B        ;Check if done with all bytes
  3112.         OR    C
  3113.         JR    Z,END_CLEAR    ;If done, exit
  3114.         POP    AF        ;Get the max count back
  3115.         LDI            ;Blank one byte
  3116.         DEC    A        ;Decrement the max count
  3117.         JR    NZ,LINE_LOOP    ;If not done, do it again
  3118.         SWAP_OUT        ;Swap the video out, and enable
  3119.         JR    CLR_LOOP    ;interrupts again, and loop.
  3120. ;
  3121. END_CLEAR    POP    AF        ;Fix the stack
  3122.         SWAP_OUT        ;Swap the video back out
  3123.         LD    A,14        ;Turn the cursor back on
  3124.         JP    CHAIN_IN
  3125. R078        EQU    $-2
  3126. NO_CLEAR    EQU    $
  3127.         JP    RETOUT
  3128. R191        EQU    $-2
  3129. ;
  3130. CLEAR_TO_EOL    EQU    $
  3131.         GET_CURSOR        ;Get the cursor ROW/COL
  3132.         PUSH    HL        ;Save it
  3133.         CALL    GET_RC_ADDR    ;Get the ADDRESS equivilent
  3134. R188        EQU    $-2
  3135.         EX    (SP),HL        ;Exchange for ROW/COL
  3136.         LD    L,79        ;Point to end of this line
  3137.         CALL    GET_RC_ADDR    ;Get the RAM address
  3138. R189        EQU    $-2
  3139.         POP    BC        ;Restore the beginning
  3140.         PUSH    BC        ;Save it
  3141.         LD    A,C        ;If C = L then at EOL
  3142.         CP    L
  3143.         JR    Z,NO_CLEAR    ;So skip rest of operations
  3144.         JR    CLEAR_SPACE
  3145. ;
  3146. DEL_CHAR    EQU    $
  3147.         LD    DE,SCR_BUFF    ;Get the buffer address
  3148. R079        EQU    $-2
  3149.         PUSH    DE        ;Save it for the store
  3150.         GET_CURSOR        ;Get the row to retrieve
  3151.         PUSH    HL        ;Save the column for later store
  3152.         GET_LINE        ;Get the line into the buffer
  3153.         LD    A,79        ;Maximum characters to move
  3154.         SUB    L        ;Subtract the current position
  3155.         LD    H,0        ;Set the column to zero
  3156.         ADD    HL,DE        ;HL is now the place to start at
  3157.         PUSH    HL        ;Get a copy in de
  3158.         POP    DE
  3159.         OR    A
  3160.         JR    Z,NO_D_CHAR
  3161.         LD    C,A        ;Get the count in BC as 16 bits
  3162.         LD    B,0
  3163.         INC    HL        ;Move the source one forward
  3164.         LDIR            ;Skoot it all backwards
  3165. NO_D_CHAR    EQU    $
  3166.         LD    A,' '        ;Get a space character
  3167.         LD    (DE),A        ;Blank the last space on the line
  3168.         POP    HL        ;Get the row to store at
  3169.         POP    DE        ;Get the buffer address back
  3170.         PUT_LINE        ;Put the line back on the screen
  3171.         JP    RETOUT
  3172. R080        EQU    $-2
  3173. ;
  3174. END_INSERT    EQU    $
  3175.         XOR    A
  3176.         LD    (INSERT_FLAG),A    ;End insert mode
  3177. R081        EQU    $-2
  3178.         JP    RETOUT
  3179. R082        EQU    $-2
  3180. ;
  3181. BEGIN_INSERT    LD    A,1
  3182.         LD    (INSERT_FLAG),A    ;Begin insert mode
  3183. R083        EQU    $-2
  3184.         JP    RETOUT
  3185. R084        EQU    $-2
  3186. ;
  3187. STAND_END    EQU    $
  3188.         LD    A,17        ;End standout mode
  3189.         JP    STORE_CHAIN
  3190. R085        EQU    $-2
  3191. ;
  3192. STAND_OUT    EQU    $
  3193.         LD    A,16
  3194.         JP    STORE_CHAIN    ;Begin standout mode
  3195. R086        EQU    $-2
  3196. ;
  3197. ;    At this point, there are still more characters to distinguish
  3198. ;    between sequences.  So we set the next state to go to
  3199. ;
  3200. SET_ESC_2    EQU    $
  3201.         LD    HL,ESCAPE_2    ;Get address of the next state
  3202. R087        EQU    $-2
  3203.         LD    (OLDSTATE),HL    ;Save it
  3204. R088        EQU    $-2
  3205.         LD    A,(NEWCHAR)    ;Get the character sent this time
  3206. R089        EQU    $-2
  3207.         LD    (CHAR_2),A    ;Save the character
  3208. R090        EQU    $-2
  3209.         JP    RETOUT        ;Skip the *do device and return
  3210. R091        EQU    $-2
  3211. ;
  3212. ;    Jump table for processing ESC-y-[123456789] and ESC-x-[123456789]
  3213. ;    sequences
  3214. ;
  3215. MODE_TABLE    EQU    $
  3216.         DW    ENABLE_25TH
  3217. R153        EQU    $-2
  3218.         DW    NO_KEY_CLICK
  3219. R154        EQU    $-2
  3220.         DW    HOLD_SCREEN
  3221. R155        EQU    $-2
  3222.         DW    BLOCK_CURSOR
  3223. R156        EQU    $-2
  3224.         DW    CURSOR_OFF
  3225. R157        EQU    $-2
  3226.         DW    KEYPAD_SHIFTED
  3227. R158        EQU    $-2
  3228.         DW    ALT_KEY_MODE
  3229. R159        EQU    $-2
  3230.         DW    AUTO_LF
  3231. R160        EQU    $-2
  3232.         DW    AUTO_CR
  3233. R161        EQU    $-2
  3234.         DW    DISABLE_25TH
  3235. R162        EQU    $-2
  3236.         DW    KEY_CLICK
  3237. R163        EQU    $-2
  3238.         DW    NO_HOLD_SCREEN
  3239. R164        EQU    $-2
  3240.         DW    LINE_CURSOR
  3241. R165        EQU    $-2
  3242.         DW    CURSOR_ON
  3243. R166        EQU    $-2
  3244.         DW    KEY_UNSHIFT
  3245. R167        EQU    $-2
  3246.         DW    EXIT_ALT_KEY
  3247. R168        EQU    $-2
  3248.         DW    NO_AUTO_LF
  3249. R169        EQU    $-2
  3250.         DW    NO_AUTO_CR
  3251. R170        EQU    $-2
  3252. ;
  3253. ;    Process third character in 3 character or more sequence
  3254. ;
  3255. ESCAPE_2    EQU    $
  3256.         LD    A,(CHAR_2)    ;Get the previous character
  3257. R092        EQU    $-2
  3258.         CP    'x'        ;Was it options on
  3259.         JR    Z,OPTION_X    ;Yep, go do it
  3260.         CP    'y'        ;Was it options off?
  3261.         JR    NZ,MOVE_CURSOR    ;Jump if not
  3262.         LD    C,18        ;Get the offset
  3263.         JR    OPTIONS        ;Join other code
  3264. OPTION_X    EQU    $
  3265.         LD    C,0        ;Get offset at zero
  3266. OPTIONS        EQU    $
  3267.         LD    A,(NEWCHAR)    ;Get the character
  3268. R130        EQU    $-2
  3269.         SUB    '1'        ;Zero base it
  3270.         CP    9        ;Check for too big
  3271.         JP    NC,RETOUT    ;Can't do this one
  3272. R187        EQU    $-2
  3273.         CP    0
  3274.         JP    C,RETOUT
  3275. R171        EQU    $-2
  3276.         SLA    A        ;Multiply by 2
  3277.         ADD    A,C        ;Tack on offset
  3278.         LD    C,A        ;Make BC a 16 bit offset
  3279.         LD    B,0
  3280.         LD    HL,MODE_TABLE    ;Get the table
  3281. R172        EQU    $-2
  3282.         ADD    HL,BC
  3283.         LD    E,(HL)        ;Get the low order byte
  3284.         INC    HL        ;Point to MSB
  3285.         LD    D,(HL)        ;Get the MSB
  3286.         PUSH    DE        ;Put it on the stack
  3287.         RET            ;Jump to it
  3288. ;
  3289. ;    All of the following options are not implemented, so they are
  3290. ;    ignored
  3291. ;
  3292. ENABLE_25TH:
  3293. NO_KEY_CLICK:
  3294. HOLD_SCREEN:
  3295. KEYPAD_SHIFTED:
  3296. ALT_KEY_MODE:
  3297. DISABLE_25TH:
  3298. KEY_CLICK:
  3299. NO_HOLD_SCREEN:
  3300. EXIT_ALT_KEY:
  3301. KEY_UNSHIFT:
  3302. GOOUT        EQU    $
  3303.         JP    RETOUT
  3304. R173        EQU    $-2
  3305. ;
  3306. AUTO_LF        EQU    $
  3307.         LD    A,(FVAL)
  3308. R179        EQU    $-2
  3309.         OR    1
  3310.         LD    (FVAL),A
  3311. R180        EQU    $-2
  3312.         JR    GOOUT
  3313. ;
  3314. AUTO_CR        EQU    $
  3315.         LD    A,(FVAL)
  3316. R181        EQU    $-2
  3317.         OR    2
  3318.         LD    (FVAL),A
  3319. R182        EQU    $-2
  3320.         JR    GOOUT
  3321. ;
  3322. NO_AUTO_LF    EQU    $
  3323.         LD    A,(FVAL)
  3324. R183        EQU    $-2
  3325.         AND    0FEH
  3326.         LD    (FVAL),A
  3327. R184        EQU    $-2
  3328.         JR    GOOUT
  3329. ;
  3330. NO_AUTO_CR    EQU    $
  3331.         LD    A,(FVAL)
  3332. R185        EQU    $-2
  3333.         AND    0FDH
  3334.         LD    (FVAL),A
  3335. R186        EQU    $-2
  3336.         JR    GOOUT
  3337. ;
  3338. BLOCK_CURSOR    EQU    $
  3339.         LD    HL,(VIDEO_START);Get the call out vector
  3340. R093        EQU    $-2
  3341. CHECK_JUMP    LD    A,H        ;Check for valid
  3342.         OR    L
  3343.         JP    Z,RETOUT    ;Jump if no address specified
  3344. R094        EQU    $-2
  3345.         LD    DE,RETOUT    ;Push the return address
  3346. R095        EQU    $-2
  3347.         PUSH    DE
  3348.         JP    (HL)        ;Call the users routine
  3349. CURSOR_ON    EQU    $
  3350.         LD    A,15        ;Cursor on to *DO
  3351.         JP    STORE_CHAIN
  3352. R151        EQU    $-2
  3353. ;
  3354. LINE_CURSOR    EQU    $
  3355.         LD    HL,(VIDEO_END)    ;Get the vector
  3356. R096        EQU    $-2
  3357.         JR    CHECK_JUMP
  3358. ;
  3359. CURSOR_OFF    EQU    $
  3360.         LD    A,14
  3361.         JP    STORE_CHAIN
  3362. R152        EQU    $-2
  3363. ;
  3364. MOVE_CURSOR    EQU    $
  3365.         LD    A,(NEWCHAR)
  3366. R097        EQU    $-2
  3367.         SUB    ' '        ;This should be the row
  3368.         JP    C,RETOUT    ;Abort if bad row
  3369. R098        EQU    $-2
  3370.         CP    24        ;check for too big    
  3371.         JP    NC,RETOUT    ;Abort on bad here too
  3372. R099        EQU    $-2
  3373.         LD    (GOTO_ROW),A    ;Save the row
  3374. R100        EQU    $-2
  3375. ;
  3376. ;    Now we must wait for the column to get here, so set the state,
  3377. ;
  3378.         LD    HL,ESCAPE_3    ;Set the state for column
  3379. R101        EQU    $-2
  3380.         LD    (OLDSTATE),HL    ;Store it
  3381. R102        EQU    $-2
  3382. CONTINUE    EQU    $
  3383.         JP    RETOUT        ;Chain into any filters
  3384. R103        EQU    $-2
  3385. ;
  3386. ;    At this point, we are looking for the column of a cursor
  3387. ;    motion sequence.  This is the longest sequence
  3388. ;
  3389. ESCAPE_3    LD    A,(NEWCHAR)    ;Get the character
  3390. R104        EQU    $-2
  3391.         SUB    ' '        ;Get rid of the bias
  3392.         JP    C,RETOUT    ;Abort if bad column
  3393. R105        EQU    $-2
  3394.         CP    80        ;Check for too high
  3395.         JP    NC,RETOUT    ;Exit if over
  3396. R106        EQU    $-2
  3397.         LD    L,A        ;Get the column in L
  3398.         LD    A,(GOTO_ROW)    ;Get the ROW from the save area
  3399. R107        EQU    $-2
  3400.         LD    H,A        ;Put it in HL for PUT_CURSOR
  3401.         PUT_CURSOR        ;Set the new cursor position
  3402.         JP    RETOUT        ;Return
  3403. R108        EQU    $-2
  3404. ;
  3405. DEL_LINE    LD    A,1        ;Set the delete line flag
  3406.         JR    LINE_OPS
  3407. ;
  3408. ADD_LINE    XOR    A        ;Clear the flag
  3409. ;
  3410. ;    The following code is somewhat shared by the INSERT and DELETE
  3411. ;    line code.  This code accesses the video memory directly to get
  3412. ;    the fastest possible movement.  Interrupts must be off while
  3413. ;    the screen is swapped in, so a compromise was made so that the
  3414. ;    interrupts were not off for too long.  The movement of the
  3415. ;    screen is done one line at a time.  Interrupts are turned back
  3416. ;    on in between lines, so that the UART can generate RECEIVED
  3417. ;    CHARACTER AVAILABLE interrupts.  I have had reasonable behavior
  3418. ;    at 9600 BAUD with this idea...
  3419. ;
  3420. LINE_OPS    LD    (DEL_FLAG),A    ;Store the flag value
  3421. R109        EQU    $-2
  3422.         GET_CURSOR        ;Get the current row and column
  3423.         LD    A,23        ;Get the maximum possible
  3424.         SUB    H        ;Get the difference in rows
  3425.         JR    Z,CLEAR_LINE    ;Go clear the line if on the last
  3426.         PUSH    IY
  3427.         PUSH    HL        ;Save HL from the call to *DO
  3428.         PUSH    BC
  3429.         PUSH    DE
  3430.         PUSH    AF
  3431.         LD    A,15        ;Turn the cursor off
  3432.         CALL    CHAIN_IN    ;Call *DO to do the work
  3433. R129        EQU    $-2
  3434.         POP    AF
  3435.         POP    DE
  3436.         POP    BC
  3437.         POP    HL        ;Restore the ROW/COL
  3438.         POP    IY
  3439.         LD    A,(DEL_FLAG)    ;Get the flag
  3440. R110        EQU    $-2
  3441.         OR    A
  3442.         JR    Z,INS_MODE
  3443. ;
  3444. ;    Delete the line that the cursor is on
  3445. ;
  3446.         PUSH    HL        ;Save the row and column
  3447.         LD    L,0        ;Go to the first col of the line
  3448.         CALL    GET_RC_ADDR    ;Get the effective address in mem
  3449. R111        EQU    $-2
  3450.         POP    AF        ;Get the row in A, ignoring F
  3451.         PUSH    HL        ;Move the address to DE
  3452.         POP    DE
  3453.         LD    BC,80        ;One row is this many characters
  3454.         ADD    HL,BC        ;Add one row to HL for the source
  3455. DEL_LOOP    EQU    $
  3456.         SWAP_IN            ;Swap the screen into view
  3457.         PUSH    BC
  3458.         LDIR            ;Move one rows worth
  3459.         POP    BC
  3460.         SWAP_OUT        ;Swap the screen back out
  3461.         INC    A        ;Add one to the row
  3462.         CP    23        ;Are we at the end?
  3463.         JR    NZ,DEL_LOOP    ;Loop if not
  3464.         LD    H,A        ;Load H with the last row
  3465.         JR    LINE_OPS_1    ;Join the other code
  3466. ;
  3467. INS_MODE    EQU    $
  3468.         LD    A,23        ;Max lines on a screen
  3469.         SUB    H        ;Minus current line = remaining
  3470.         LD    HL,23*80+0F7FFH    ;Source address for LDDR
  3471.         LD    DE,24*80+0F7FFH    ;Destination address for LDDR
  3472.         LD    BC,80        ;Number of bytes to move
  3473. INS_LOOP    EQU    $
  3474.         SWAP_IN            ;Swap the screen in
  3475.         PUSH    BC
  3476.         LDDR            ;Move one line
  3477.         POP    BC
  3478.         SWAP_OUT        ;Swap the screen out
  3479.         DEC    A        ;Decrement the line count
  3480.         JR    NZ,INS_LOOP    ;Loop until done
  3481. CLEAR_LINE    EQU    $
  3482.         GET_CURSOR        ;Get the current row
  3483. LINE_OPS_1    EQU    $
  3484.         PUSH    HL        ;Save the row
  3485.         LD    DE,SCR_BUFF    ;Get the buffer address
  3486. R112        EQU    $-2
  3487.         PUSH    DE        ;Save the buffer address
  3488.         PUSH    DE        ;Copy the address into hl
  3489.         POP    HL
  3490.         INC    DE        ;Plus one for the copy
  3491.         LD    BC,79        ;Copy 79 times
  3492.         LD    (HL),' '    ;Store one blank
  3493.         LDIR            ;Copy in the rest
  3494.         POP    DE        ;Restore the buffer address
  3495.         POP    HL        ;Restore the row
  3496.         PUT_LINE        ;Put the line back
  3497.         LD    A,14        ;Turn the cursor back on
  3498.         JP    CHAIN_IN
  3499. R113        EQU    $-2
  3500. ;
  3501. ;    Chain into any filters
  3502. ;
  3503. CHAIN        EQU    $
  3504.         LD    A,(NEWCHAR)    ;Get the character sent to us
  3505. R114        EQU    $-2
  3506. CHAIN_IN    EQU    $
  3507.         LD    C,A        ;Move the character to C for @PUT
  3508.         LD    B,2        ;Signal @PUT for others in chain
  3509.         OR    A        ;Reset the carry
  3510.         CP    A        ;Set Z flag
  3511. CHAIN_2        EQU    $
  3512.         PUSH    IX        ;Save the old DCB address
  3513.         LD    IX,(MODDCB)    ;Get the next in chain
  3514. R115        EQU    $-2
  3515.         LD    A,@CHNIO
  3516.         RST    28H
  3517.         POP    IX        ;Restore the old
  3518. ;
  3519. ;    Return without knowldege of the call to *DO
  3520. ;
  3521. RETOUT        EQU    $
  3522.         LD    A,(NEWCHAR)    ;Get the character sent
  3523. R125        EQU    $-2
  3524.         CP    A        ;Set the Z flag
  3525.         RET
  3526. ;
  3527. ;    Clear the screen
  3528. ;
  3529. CLEAR_SCREEN    EQU    $
  3530.         LD    HL,0        ;Put the cursor at the top
  3531.         PUT_CURSOR
  3532.         JP    CLEAR_TO_EOS
  3533. R126        EQU    $-2
  3534. ;
  3535. ;    Put the character in A on the screen at the current screen
  3536. ;    position.  If insert mode is active, then perform the shift
  3537. ;    of the line before chaining to *DO which will do the actual
  3538. ;    displaying for us.
  3539. ;
  3540. INSERT_A    EQU    $
  3541.         PUSH    AF        ;Save the character
  3542.         GET_CURSOR        ;Get the cursor position
  3543.         PUSH    HL        ;Save the cursor position
  3544.         LD    A,(INSERT_FLAG)    ;Get the insert mode flag
  3545. R116        EQU    $-2
  3546.         OR    A        ;Is insert character mode on?
  3547.         JR    Z,NO_MOVE    ;Jump if no insert character mode
  3548.         LD    DE,SCR_BUFF    ;Get the buffer's address
  3549. R117        EQU    $-2
  3550.         GET_LINE        ;Get the line from the screen
  3551.         LD    A,79        ;Get the maximum to move
  3552.         SUB    L        ;Compute the number to move
  3553.         LD    C,A        ;Make the byte, 16 bits in BC
  3554.         LD    B,0        ;Zero the high byte for 16 bits
  3555.         OR    A        ;Check if count is already zero
  3556.         JR    Z,NO_MOVE    ;Skip if it is
  3557.         LD    L,79        ;Get the end of the buffer
  3558.         LD    H,0        ;    by adding 79 to the address
  3559.         ADD    HL,DE        ;HL is now the end of the buffer
  3560.         PUSH    DE        ;Save the buffer address
  3561.         LD    E,L        ;Copy HL to DE
  3562.         LD    D,H
  3563.         DEC    HL        ;Decrement the source address
  3564.         LDDR            ;Skoot the line over
  3565.         POP    DE        ;Restore the buffer address
  3566.         POP    HL        ;Restore the row to restore 
  3567.         PUT_LINE        ;Put it on the screen
  3568.         PUSH    HL        ;Push something for the POP
  3569. NO_MOVE        EQU    $
  3570.         POP    HL        ;Restore the current row/col
  3571.         POP    AF        ;Restore the character to insert
  3572.         JP    CHAIN        ;Use *DO to display it
  3573. R118        EQU    $-2
  3574. ;
  3575. ;        The default visual begin command is to change the cursor
  3576. ;        to a block character
  3577. ;
  3578. VSTART        EQU    $
  3579.         LD    B,8        ;Change cursor character
  3580.         LD    A,(VSCUR)    ;Get the video start cursor
  3581. R119        EQU    $-2
  3582.         LD    C,A        ;Special graphics block
  3583.         LD    A,@VDCTL
  3584.         RST    28H
  3585.         RET
  3586. ;
  3587. ;    This is the default call out for visual end.
  3588. ;
  3589. VEND        EQU    $
  3590.         LD    B,8        ;Set the normal cursor character
  3591.         LD    A,(VECUR)    ;Get the video end cursor
  3592. R120        EQU    $-2
  3593.         LD    C,A
  3594.         LD    A,@VDCTL
  3595.         RST    28H
  3596.         RET            ;Return
  3597. ;
  3598. ;
  3599. ;    Calculate address of Row and Column in HL
  3600. ;
  3601. GET_RC_ADDR    PUSH    BC
  3602.         PUSH    AF
  3603.         PUSH    DE
  3604.         PUSH    HL        ;Copy the Row and Column to DE
  3605.         POP    DE
  3606.         LD    HL,0F800H    ;Get the start of the screen
  3607.         LD    BC,80        ;One row is this long
  3608. ADD_LOOP    DEC    D        ;Decrement the row count
  3609.         JP    M,NO_MORE    ;If less than zero, no more rows
  3610. R121        EQU    $-2
  3611.         ADD    HL,BC        ;Add one more Row's worth
  3612.         JR    ADD_LOOP    ;Go to the top of the loop
  3613. NO_MORE        LD    D,0        ;Make it a 16 bit value
  3614.         ADD    HL,DE        ;Add it into the total
  3615.         POP    DE
  3616.         POP    AF
  3617.         POP    BC
  3618.         RET            ;Return to caller
  3619. ;
  3620. ;    Calculate Row and Column based on address in HL
  3621. ;
  3622. GET_ADDR_RC    PUSH    BC        ;Save the registers
  3623.         PUSH    AF
  3624.         PUSH    DE
  3625.         LD    BC,0F800H    ;Get the start of the screen
  3626.         OR    A        ;Reset the carry flag
  3627.         SBC    HL,BC        ;HL now is the offset into screen
  3628.         LD    D,0        ;This is the counter
  3629.         LD    BC,80        ;Get one rows worth
  3630. SUB_LOOP    OR    A        ;Reset the carry
  3631.         SBC    HL,BC        ;Subtract one rows worth
  3632.         JP    C,NO_MORE_2    ;There are no more so leave
  3633. R122        EQU    $-2
  3634.         INC    D        ;Add one to the row count
  3635.         JR    SUB_LOOP    ;Go to the top of the loop
  3636. NO_MORE_2    ADD    HL,BC        ;Correct for the subtract
  3637.         LD    H,D        ;Get the row count, L has the
  3638.                     ;Column already in it
  3639.         POP    DE        ;Restore the registers
  3640.         POP    AF
  3641.         POP    BC
  3642.         RET            ;Return to the caller
  3643. ;
  3644. ;    Data storage area
  3645. ;
  3646. LASTPUSH    DW    PUSHAREA    ;Next place to push pos into
  3647. R140        EQU    $-2
  3648. PUSHAREA    DS    20        ;Storage area
  3649. ENDPUSH        EQU    $        ;End of storage
  3650. OLDSTATE    DW    0        ;Any preexisting state for
  3651.                     ;special character sequences,
  3652.                     ;actually, the address of the
  3653.                     ;routine to execute the next time
  3654.                     ;that a @PUT request is made.
  3655. INSERT_FLAG    DB    0        ;Insert character mode flag
  3656. DEL_FLAG    DB    0        ;Delete or Insert line direction
  3657. CHAR_2        DB    0        ;Second character in a multiple
  3658. ;                    ;character sequence.
  3659. VIDEO_START    DW    VSTART        ;Call out address for visual begin
  3660. R123        EQU    $-2
  3661. VIDEO_END    DW    VEND        ;Call out address for visual end
  3662. R124        EQU    $-2
  3663. FLAG_ADDR    DW    0        ;Address of flags area
  3664. GOTO_ROW    DB    0        ;Saved row for cursor motion
  3665. SCR_BUFF    DS    81        ;Space for put_line and get_line
  3666. NEWCHAR        DB    0        ;Character sent to @PUT request
  3667. MODEND        EQU    $        ;End of the routine
  3668. FLTR_LEN    EQU    MODEND-FILTER    ;This is the length
  3669. INTRO        EQU    $
  3670.         DB    'H19 Emulator-filter for TRSDOS 6.2. '
  3671.         DB    'Written by:  Gregg Wonderly',29,26
  3672.         DB    'Load address: ',3
  3673. INTRO2        DB    '         Ending address: ',3
  3674. STRING        DS    80
  3675. FIRST        DW    0
  3676. ;
  3677. ;    Entry point of load routine.
  3678. ;
  3679. LOAD        EQU    $
  3680.         LD    (MODDCB),DE    ;Save the DCB address
  3681.         LD    A,@FLAGS    ;Get the Flags area address
  3682.         RST    28H
  3683.         LD    (FLAG_ADDR),IY    ;Save it away
  3684.         LD    HL,INTRO    ;Print the intro message
  3685.         LD    A,@DSPLY
  3686.         RST    28H
  3687.         LD    HL,0        ;Get HIGH MEMORY pointer from DOS
  3688.         LD    B,0        ;B=0 selects HIGH$
  3689.         LD    A,@HIGH$
  3690.         RST    28H
  3691.         LD    (OLDLOW),HL    ;Save it for later restoral
  3692.         LD    (FILTER+2),HL
  3693.         PUSH    HL
  3694. ;
  3695. ;    Since this filter accesses the video directly, we can not reside
  3696. ;    up where it does.  Here we determine if there is suffient space
  3697. ;    used to put us below the screen, or that we must waist memory,
  3698. ;    and relocate to just below 0F400H.
  3699. ;
  3700.         LD    HL,0F3FEH    ;Get the highest usable address
  3701.         POP    BC        ;Get the old HIGH memory
  3702.         OR    A        ;Reset the carry bit
  3703.         PUSH    HL        ;Save HL
  3704.         SBC    HL,BC        ;See if hl is less than bc
  3705.         POP    HL        ;Get HL back
  3706.         JR    C,USE_HL    ;If C, then use HL's address
  3707.         PUSH    BC        ;Move BC into HL
  3708.         POP    HL
  3709. USE_HL        EQU    $
  3710.         INC    HL        ;Must increment for true value
  3711.         LD    BC,FLTR_LEN    ;Get the length of the filter
  3712.         OR    A        ;Reset the carry
  3713.         SBC    HL,BC        ;Compute the new high
  3714.         PUSH    HL        ;Save where to load at
  3715.         DEC    HL        ;One below that is new high
  3716.         LD    (OLDHIGH),HL    ;Save it for restore when removed
  3717.         LD    B,0        ;Select HIGH$
  3718.         LD    A,@HIGH$
  3719.         RST    28H
  3720. RELOCATE    EQU    $
  3721. ;
  3722. ;    THIS ROUTINE WILL MOVE THE FILTER, UP INTO HIGH MEMORY AND
  3723. ;    RESET THE POINTER TO HIGH$
  3724. ;
  3725.         POP    DE        ;Get the load address
  3726.         LD    (FIRST),DE    ;Save it for later
  3727.         LD    HL,STRING    ;Get the scratch area
  3728.         PUSH    HL        ;Save the address for @DSPLY
  3729.         LD    A,@HEX16    ;Convert DE to 4 HEX digits (HL)
  3730.         RST    28H
  3731.         LD    (HL),3        ;Terminate with ETX
  3732.         POP    HL        ;Get the start
  3733.         LD    A,@DSPLY    ;Display it
  3734.         RST    28H
  3735.         LD    HL,(FIRST)    ;Get the starting reloc address
  3736.         LD    BC,FILTER    ;Calculate offset from source
  3737.         OR    A        ;Reset the carry
  3738.         PUSH    HL        ;Save it
  3739.         SBC    HL,BC        ;Offset now in HL
  3740.         LD    (OFFSET),HL    ;Save it for later reference
  3741.         POP    HL        ;Get the load address into hl
  3742.         LD    BC,FLTR_LEN    ;Calculate the end
  3743.         ADD    HL,BC        ;HL now has the ending address
  3744.         PUSH    HL        ;Save it for transfer to DE
  3745.         LD    HL,INTRO2    ;Get the message string
  3746.         LD    A,@DSPLY    ;Display it
  3747.         RST    28H
  3748.         POP    DE        ;Get the ending address
  3749.         LD    HL,STRING    ;Get the string buffer
  3750.         PUSH    HL        ;Save the address for later
  3751.         LD    A,@HEX16    ;Convert DE to 4 HEX digits (HL)
  3752.         RST    28H
  3753.         LD    (HL),13        ;Put a carriage return on the end
  3754.         POP    HL        ;Get the starting address back
  3755.         LD    A,@DSPLY    ;Display the VALUE
  3756.         RST    28H
  3757.         LD    IX,OFFTBL    ;Get start of offset table
  3758. ;
  3759. ;    LOOP TO ADD OFFSET TO ALL ADDRESSES NECESSARY
  3760. ;
  3761. MOVNXT        EQU    $
  3762.         LD    BC,(OFFSET)    ;Put the offset into BC
  3763.         LD    L,(IX)        ;Get LSB of address to change
  3764.         INC    IX        ;POINT TO MSB
  3765.         LD    H,(IX)        ;GET IT
  3766.         INC    IX        ;POINT TO LSB OF NEXT, OR END
  3767.         PUSH    IX        ;Save pointer to table
  3768.         PUSH    HL        ;Put the address into IX
  3769.         POP    IX
  3770.         LD    L,(IX)        ;Get the LSB for relocation
  3771.         LD    H,(IX+1)    ;Get the MSB
  3772.         ADD    HL,BC        ;Relocate it
  3773.         LD    (IX),L        ;Put it back
  3774.         LD    (IX+1),H
  3775.         POP    BC        ;Get the table address in BC
  3776.         PUSH    BC        ;Copy it back into IX
  3777.         POP    IX        ;Restore the table address
  3778.         LD    HL,OFFEND    ;Get the end of the offset table
  3779.         OR    A        ;Reset the carry
  3780.         SBC    HL,BC        ;Compute the difference
  3781.         JR    NZ,MOVNXT    ;Loop, if not done
  3782. ;
  3783.         LD    BC,FLTR_LEN    ;MOVE MODULE INTO HIGH MEMORY.
  3784.         LD    DE,(FIRST)
  3785.         LD    HL,FILTER    ;Get the load address
  3786.         LDIR            ;Move it into place
  3787.         LD    IX,(MODDCB)    ;Get the dcb address back
  3788.         LD    DE,(FIRST)
  3789.         LD    (IX),47H    ;Say we are a filter
  3790.         LD    (IX+1),E    ;Tell where the filter starts
  3791.         LD    (IX+2),D
  3792.         LD    HL,0
  3793.         CP    A
  3794.         RET
  3795. ;
  3796. OFFTBL        EQU    $
  3797.         DW    R001
  3798.         DW    R002
  3799.         DW    R003
  3800.         DW    R004
  3801.         DW    R005
  3802.         DW    R006
  3803.         DW    R007
  3804.         DW    R008
  3805.         DW    R009
  3806.         DW    R010
  3807.         DW    R011
  3808.         DW    R012
  3809.         DW    R013
  3810.         DW    R014
  3811.         DW    R015
  3812.         DW    R016
  3813.         DW    R017
  3814.         DW    R018
  3815.         DW    R019
  3816.         DW    R020
  3817.         DW    R021
  3818.         DW    R022
  3819.         DW    R023
  3820.         DW    R024
  3821.         DW    R025
  3822.         DW    R026
  3823.         DW    R027
  3824.         DW    R028
  3825.         DW    R029
  3826.         DW    R030
  3827.         DW    R031
  3828.         DW    R032
  3829.         DW    R033
  3830.         DW    R034
  3831.         DW    R035
  3832.         DW    R036
  3833.         DW    R037
  3834.         DW    R038
  3835.         DW    R039
  3836.         DW    R040
  3837.         DW    R041
  3838.         DW    R042
  3839.         DW    R043
  3840.         DW    R044
  3841.         DW    R045
  3842.         DW    R046
  3843.         DW    R047
  3844.         DW    R048
  3845.         DW    R049
  3846.         DW    R050
  3847.         DW    R051
  3848.         DW    R052
  3849.         DW    R053
  3850.         DW    R054
  3851.         DW    R055
  3852.         DW    R056
  3853.         DW    R057
  3854.         DW    R058
  3855.         DW    R059
  3856.         DW    R060
  3857.         DW    R061
  3858.         DW    R062
  3859.         DW    R063
  3860.         DW    R064
  3861.         DW    R065
  3862.         DW    R066
  3863.         DW    R067
  3864.         DW    R068
  3865.         DW    R069
  3866.         DW    R070
  3867.         DW    R071
  3868.         DW    R072
  3869.         DW    R073
  3870.         DW    R074
  3871.         DW    R075
  3872.         DW    R076
  3873.         DW    R077
  3874.         DW    R078
  3875.         DW    R079
  3876.         DW    R080
  3877.         DW    R081
  3878.         DW    R082
  3879.         DW    R083
  3880.         DW    R084
  3881.         DW    R085
  3882.         DW    R086
  3883.         DW    R087
  3884.         DW    R088
  3885.         DW    R089
  3886.         DW    R090
  3887.         DW    R091
  3888.         DW    R092
  3889.         DW    R093
  3890.         DW    R094
  3891.         DW    R095
  3892.         DW    R096
  3893.         DW    R097
  3894.         DW    R098
  3895.         DW    R099
  3896.         DW    R100
  3897.         DW    R101
  3898.         DW    R102
  3899.         DW    R103
  3900.         DW    R104
  3901.         DW    R105
  3902.         DW    R106
  3903.         DW    R107
  3904.         DW    R108
  3905.         DW    R109
  3906.         DW    R110
  3907.         DW    R111
  3908.         DW    R112
  3909.         DW    R113
  3910.         DW    R114
  3911.         DW    R115
  3912.         DW    R116
  3913.         DW    R117
  3914.         DW    R118
  3915.         DW    R119
  3916.         DW    R120
  3917.         DW    R121
  3918.         DW    R122
  3919.         DW    R123
  3920.         DW    R124
  3921.         DW    R125
  3922.         DW    R126
  3923.         DW    R127
  3924.         DW    R128
  3925.         DW    R129
  3926.         DW    R130
  3927.         DW    R131
  3928.         DW    R132
  3929.         DW    R133
  3930.         DW    R134
  3931.         DW    R135
  3932.         DW    R136
  3933.         DW    R137
  3934.         DW    R138
  3935.         DW    R139
  3936.         DW    R140
  3937.         DW    R141
  3938.         DW    R142
  3939.         DW    R143
  3940.         DW    R144
  3941.         DW    R145
  3942.         DW    R146
  3943.         DW    R147
  3944.         DW    R148
  3945.         DW    R149
  3946.         DW    R150
  3947.         DW    R151
  3948.         DW    R152
  3949.         DW    R153
  3950.         DW    R154
  3951.         DW    R155
  3952.         DW    R156
  3953.         DW    R157
  3954.         DW    R158
  3955.         DW    R159
  3956.         DW    R160
  3957.         DW    R161
  3958.         DW    R162
  3959.         DW    R163
  3960.         DW    R164
  3961.         DW    R165
  3962.         DW    R166
  3963.         DW    R167
  3964.         DW    R168
  3965.         DW    R169
  3966.         DW    R170
  3967.         DW    R171
  3968.         DW    R172
  3969.         DW    R173
  3970.         DW    R174
  3971.         DW    R175
  3972.         DW    R176
  3973.         DW    R177
  3974.         DW    R178
  3975.         DW    R179
  3976.         DW    R180
  3977.         DW    R181
  3978.         DW    R182
  3979.         DW    R183
  3980.         DW    R184
  3981.         DW    R185
  3982.         DW    R186
  3983.         DW    R187
  3984.         DW    R188
  3985.         DW    R189
  3986.         DW    R190
  3987.         DW    R191
  3988. OFFEND        EQU    $
  3989. <<< m4h19s.asm >>>
  3990. ;        M4H19S/ASM
  3991. *GET        M4H19/EQU
  3992. *GET        M4H19/MAC
  3993. VS        EQU    15    ;Offset in header for visual cursor
  3994. VE        EQU    16    ;Offset in header for line mode cursor
  3995. DEF_LEN        EQU    17    ;Default length of audible bell
  3996. BELLFLAG    EQU    18    ;Audible or visual bell flag
  3997. DEF_FREQ    EQU    19    ;Frequency value for bell tone
  3998. OLDLOW        EQU    21    ;Set up address used for removing *HP
  3999. OLDHIGH        EQU    23    ;Ditto
  4000. BIT_MASK    EQU    29    ;Offset to bit mask
  4001. ;
  4002. ;    Load in low memory to avoid user programs, and KERMIT in
  4003. ;    particular
  4004. ;
  4005.         ORG    2500H
  4006. START:
  4007.         LD    DE,ARGBUFF+1    ;Copy the arguments
  4008.         LD    BC,255        ;Pick a number suffiently large
  4009.         LD    (PARMS),DE    ;Save the dest for later use
  4010.         LDIR            ;Move the command line
  4011. GETH19:
  4012.         LD    DE,H19_NAME    ;Check to see if $HEATH is there
  4013.         SSVC    @GTMOD        ;Try to find it
  4014.         JP    NZ,NOH19    ;Not there, so go put it in
  4015.         PUSH    HL        ;Put the header address into IX
  4016.         POP    IX
  4017.         LD    DE,PARAM_TABLE    ;Get the parameter table
  4018.         LD    HL,(PARMS)    ;Get the command line
  4019. ;
  4020. ;    We look for a '(' to know whether or not to display the usage
  4021. ;    message.  If we do not find one, then we give the user help.
  4022. ;
  4023. LOOP1:
  4024.         LD    A,(HL)        ;See if there is anything there
  4025.         CP    13        ;End of command line
  4026.         JP    Z,SHOW_VALS    ;If so, then give help
  4027.         CP    '('        ;Start of argument list?
  4028.         JR    Z,LOOP2        ;Jump if it is
  4029.         INC    HL        ;Point to next
  4030.         JR    LOOP1        ;Loop on
  4031. LOOP2:
  4032.         DEC    HL        ;Back up before the '('
  4033.         SSVC    @PARAM        ;Parse the parameter list
  4034.         JP    NZ,SHOW_VALS    ;On failure, give help
  4035.         LD    A,(RESP_VS)    ;Was a BLOCK cursor value given?
  4036.         OR    A
  4037.         JR    Z,CHK_VE    ;Jump if not
  4038.         AND    60H        ;Verify only numeric.
  4039.         JP    NZ,BAD_PARAM    ;Jump if not
  4040.         LD    HL,(VS_VAL)    ;Get the value given
  4041.         LD    A,H        ;Make sure it is only a byte
  4042.         OR    A
  4043.         JP    NZ,TOO_BIG    ;Print a message if too big
  4044.         LD    A,L        ;Get the byte value from L
  4045.         LD    (IX+VS),A    ;Save it into the $HEATH header
  4046. CHK_VE:
  4047.         LD    A,(RESP_VE)    ;Was there a line mode cursor
  4048.         OR    A        ;Jump if not
  4049.         JR    Z,CHK_REM
  4050.         AND    60H        ;Verify it is only numeric
  4051.         JP    NZ,BAD_PARAM    ;Jump if bad
  4052.         LD    HL,(VE_VAL)    ;Get the value
  4053.         LD    A,H        ;Make sure it is a byte value
  4054.         OR    A
  4055.         JP    NZ,TOO_BIG    ;Jump if too big.
  4056.         LD    A,L        ;Get the byte value from L
  4057.         LD    (IX+VE),A    ;Store it
  4058. CHK_REM:
  4059.         LD    A,(RESP_REMOVE)    ;Is this a remove request?
  4060.         OR    A
  4061.         JR    Z,CHK_FREQ    ;If not go check bell frequency
  4062.         AND    0A0H        ;Must be boolean
  4063.         JP    NZ,BAD_PARAM
  4064.         LD    B,0        ;Get the current HIGH$ value
  4065.         LD    HL,0
  4066.         SSVC    @HIGH$
  4067.         JP    NZ,ERROR
  4068.         LD    A,(IX+OLDHIGH)    ;Get the OLD HIGH$ from header
  4069.         LD    C,A
  4070.         LD    A,(IX+OLDHIGH+1)
  4071.         LD    B,A        ;See if they are still the same
  4072.         OR    A        ;Reset the carry
  4073.         SBC    HL,BC        ;Compute the difference
  4074.         JP    NZ,CANT_REMOVE    ;If not equal, then can't remove
  4075.         LD    A,(IX+OLDLOW)    ;Get the previous HIGH$ that was
  4076.         LD    L,A        ;in effect before $HEATH was
  4077.         LD    A,(IX+OLDLOW+1)    ;installed
  4078.         LD    H,A
  4079.         LD    B,0        ;removing the module
  4080.         SSVC    @HIGH$
  4081.         JP    NZ,ERROR
  4082. ;
  4083. ;    The code here make several RASH assumptions about what devices
  4084. ;    $HEATH is mated to.  It assumes that the following commands were
  4085. ;    used to install the $HEATH module:
  4086. ;
  4087. ;    set *hp h19
  4088. ;    filter *so *hp
  4089. ;
  4090. ;    With these in mind, it does the following commands
  4091. ;
  4092. ;    reset *so
  4093. ;    reset *hp
  4094. ;    remove *hp
  4095. ;    route *so *do
  4096. ;
  4097. ;    This should restore the system to a reasonable state, given the
  4098. ;    fact that the filter should be in by itself anyway.
  4099. ;
  4100. REMOVE_FILTER:
  4101.         LD    HL,CMD1        ;Do "reset *so" command
  4102.         SSVC    @CMNDR
  4103.         LD    HL,CMD2        ;Do "reset *hp" command
  4104.         SSVC    @CMNDR
  4105.         LD    HL,CMD3        ;Do "remove *hp" command
  4106.         SSVC    @CMNDR
  4107.         LD    HL,CMD4        ;Do "route *so *do" command
  4108.         SSVC    @CMNDR
  4109.         JP    SET_EXIT    ;Nothing else is reasonable, quit
  4110. CHK_FREQ:
  4111.         LD    A,(RESP_FREQ)    ;Check for a frequency given
  4112.         OR    A
  4113.         JR    Z,CHK_DUR    ;Jump if none there
  4114.         AND    60H        ;Verify that it is numeric
  4115.         JP    NZ,BAD_PARAM    ;Jump if not just numeric
  4116.         LD    HL,(FREQ_VAL)    ;Get the value
  4117.         LD    (IX+DEF_FREQ),L    ;Use all 16 bits worth
  4118.         LD    (IX+DEF_FREQ+1),H
  4119. CHK_DUR:
  4120.         LD    A,(RESP_DURA)    ;Is there a duration given?
  4121.         OR    A
  4122.         JR    Z,CHK_BELL    ;Jump if there is isn't
  4123.         AND    60H        ;Verify that it is numeric
  4124.         JP    NZ,BAD_PARAM    ;Jump if it is not
  4125.         LD    HL,(DUR_VAL)    ;Get the value
  4126.         LD    A,H        ;Make sure there is only a byte
  4127.         OR    A
  4128.         JP    NZ,TOO_BIG    ;Jump if MSB not zero
  4129.         LD    A,L        ;Get the byte value from L
  4130.         LD    (IX+DEF_LEN),A    ;Save the tone length
  4131. CHK_BELL:
  4132.         LD    A,(RESP_BELL)    ;Are they setting bell flag?
  4133.         OR    A
  4134.         JP    Z,CHK_STRIP8    ;Check if strip8 parameter given
  4135.         AND    0A0H        ;Is it boolean?
  4136.         JP    NZ,BAD_PARAM    ;Jump if not
  4137.         LD    A,(BELL_VAL)    ;Get the value
  4138.         LD    (IX+BELLFLAG),A    ;Save it
  4139. CHK_STRIP8:
  4140.         LD    A,(RESP_STRIP8)    ;Get the parameter present flag
  4141.         OR    A
  4142.         JP    Z,CHK_SHOW    ;Go check show parameter
  4143.         AND    0A0H        ;Check if boolean
  4144.         JP    NZ,BAD_PARAM
  4145.         LD    C,(IX+BIT_MASK)
  4146.         LD    B,(IX+BIT_MASK+1)
  4147.         PUSH    IX
  4148.         POP    HL
  4149.         ADD    HL,BC        ;Compute the offset
  4150.         LD    C,0FFH        ;Get the off mask
  4151.         LD    A,(STRIP8_VAL)
  4152.         OR    A
  4153.         JR    Z,STRIP8_OFF    ;Option is off so jump
  4154.         LD    C,07FH        ;Load on mask
  4155. STRIP8_OFF:
  4156.         LD    (HL),C        ;Patch AND instruction
  4157. CHK_SHOW:
  4158.         LD    A,(RESP_SHOW)    ;Check if show given
  4159.         OR    A
  4160.         JR    Z,CHK_HELP    ;Check for help
  4161.         AND    0A0H        ;Is it boolean
  4162.         JP    NZ,BAD_PARAM    ;Error if not
  4163.         LD    A,(SHOW_VAL)    ;Get the value
  4164.         OR    A        ;Make sure not (SHOW=NO)
  4165.         CALL    NZ,SHOW_VALS
  4166. CHK_HELP:
  4167.         LD    A,(RESP_HELP)    ;Check if HELP given
  4168.         OR    A
  4169.         JR    Z,SET_EXIT
  4170.         AND    0A0H        ;Is it boolean?
  4171.         JP    NZ,BAD_PARAM
  4172.         LD    A,(HELP_VAL)    ;Get the value
  4173.         OR    A        ;Make sure not (HELP=NO)
  4174.         JP    Z,SET_EXIT
  4175.         LD    HL,HELP_STR
  4176.         SSVC    @DSPLY
  4177. SET_EXIT:
  4178.         LD    HL,0        ;Set normal exit code
  4179.         RET            ;Return, DON'T @EXIT HERE
  4180. ;
  4181. ;    Show the values of the currently set options
  4182. ;
  4183. SHOW_VALS:
  4184.         LD    HL,LINE_STR    ;Get the line mode cursor descr
  4185.         SSVC    @DSPLY        ;Display it
  4186.         LD    L,(IX+VE)    ;Get the value
  4187.         LD    H,0        ;Make it only a byte
  4188.         CALL    NUMOUT        ;Print it on the screen
  4189.         LD    HL,BLK_STR    ;Print the block mode descr
  4190.         SSVC    @DSPLY
  4191.         LD    L,(IX+VS)    ;Get the value
  4192.         LD    H,0        ;Make it a byte
  4193.         CALL    NUMOUT        ;Print the number on the display
  4194.         LD    C,13        ;Get a new line
  4195.         SSVC    @DSP
  4196.         LD    HL,BELL_STR    ;Print the BELL descr
  4197.         SSVC    @DSPLY
  4198.         LD    HL,ON_STR    ;Get the ON string
  4199.         LD    A,(IX+BELLFLAG)    ;Get the value
  4200.         OR    A        ;Check if it is on
  4201.         JR    NZ,SHOW_1    ;Jump if it is
  4202.         LD    HL,OFF_STR    ;Get the off string
  4203. SHOW_1        SSVC    @DSPLY        ;Display ON or OFF
  4204.         LD    HL,DURA_STR    ;Get the duration descr
  4205.         SSVC    @DSPLY
  4206.         LD    L,(IX+DEF_LEN)    ;Get the duration
  4207.         LD    H,0        ;Make it a byte in HL
  4208.         CALL    NUMOUT        ;Print the number on the screen
  4209.         LD    HL,FREQ_STR    ;Print the frequency descr
  4210.         SSVC    @DSPLY
  4211.         LD    L,(IX+DEF_FREQ)    ;Get the LSB of FREQ
  4212.         LD    H,(IX+DEF_FREQ+1);Get the MSB
  4213.         CALL    NUMOUT        ;Print the number out
  4214.         LD    HL,STRIP_STR    ;Get the STRIP8 message
  4215.         SSVC    @DSPLY
  4216.         LD    C,(IX+BIT_MASK)
  4217.         LD    B,(IX+BIT_MASK+1)
  4218.         PUSH    IX
  4219.         POP    HL
  4220.         ADD    HL,BC        ;Compute the offset
  4221.         LD    A,(HL)
  4222.         LD    HL,ONSTR
  4223.         CP    0FFH        ;Check for off
  4224.         JR    NZ,ISON
  4225.         LD    HL,OFFSTR
  4226. ISON:
  4227.         SSVC    @DSPLY
  4228.         RET            ;Return to caller
  4229. ;
  4230. NUMOUT        LD    DE,STRBUF
  4231.         PUSH    DE
  4232.         SSVC    @HEXDEC
  4233.         EX    DE,HL
  4234.         LD    (HL),3
  4235.         POP    HL
  4236.         LD    A,' '
  4237. NUM_1        CP    (HL)
  4238.         JR    NZ,NUM_2
  4239.         INC    HL
  4240.         JR    NUM_1
  4241. NUM_2        SSVC    @DSPLY
  4242.         RET
  4243. ;
  4244. CANT_REMOVE:
  4245.         LD    HL,NO_REMOVE    ;Print the Can't remove message
  4246.         SSVC    @DSPLY
  4247.         JP    REMOVE_FILTER    ;Finish unlinking the devices
  4248. ;
  4249. TOO_BIG:
  4250.         LD    HL,TOO_BIG_STR    ;Get the TOO BIG message
  4251.         DB    0DDH        ;Hide LD HL instruction
  4252. ;
  4253. NOH19MESS:
  4254.         LD    HL,NOFLT_STR    ;Print error message, No H19/FLT
  4255.         DB    0DDH        ;Hide LD HL
  4256. ;
  4257. BAD_PARAM    LD    HL,BAD_PARAM_STR;Print Bad paramter message
  4258. ;
  4259. PRINT_EXIT:
  4260.         SSVC    @DSPLY        ;Print it
  4261. EXIT:
  4262.         LD    HL,-1        ;Get error exit code
  4263.         RET            ;Return from caller
  4264. ;
  4265. ERROR:
  4266.         OR    0C0H
  4267.         LD    C,A
  4268.         SSVC    @ERROR
  4269.         JR    EXIT
  4270. ;
  4271. NOH19:
  4272.         LD    A,(ONCE)    ;Check if we have been here once
  4273.         OR    A
  4274.         JR    NZ,NOH19MESS    ;If so, then issue a message
  4275.         INC    A        ;Set the flag
  4276.         LD    (ONCE),A
  4277.         LD    HL,SETH19    ;Do the "set *hp h19" command
  4278.         SSVC    @CMNDR
  4279.         LD    HL,FILTER    ;Do the "filter *so *hp" command
  4280.         SSVC    @CMNDR
  4281.         JP    GETH19        ;Try to load it again
  4282. ;
  4283. H19_NAME    DB    '$HEATH',0
  4284. NO_REMOVE    DB    'Can not reclaim used memory!',13
  4285. STRIP_STR    DB    10,'Strip 8th bit: ',3
  4286. ONSTR        DB    'YES',13
  4287. OFFSTR        DB    'NO',13
  4288. NOFLT_STR    DB    'Can not find H19 filter',13
  4289. BAD_PARAM_STR    DB    'Bad parameter value',13
  4290. TOO_BIG_STR    DB    'Value too large',13
  4291. LINE_STR    DB    'Normal cursor: ',3
  4292. BLK_STR        DB    ', Block cursor: ',3
  4293. DURA_STR    DB    ', Duration: ',3
  4294. FREQ_STR    DB    ', Frequency: ',3
  4295. BELL_STR    DB    'Bell: ',3
  4296. ON_STR        DB    'ON',3
  4297. OFF_STR        DB    'OFF',3
  4298. ;
  4299. HELP_STR    DB    'Recognized parameters:',10
  4300.         DB    'CURSOR      -   Normal cursor character',10
  4301.         DB    'BLOCK       -   Block cursor character',10
  4302.         DB    'BELL        -   Turn bell ON or OFF',10
  4303.         DB    'FREQUENCY   -   Frequency of bell (inverse of '
  4304.         DB    'real freq)',10
  4305.         DB    'DURATION    -   Length of tone (255 MAX)',10
  4306.         DB    'STRIP8      -   Remove 8th bit from characters '
  4307.         DB    '(default=ON)',10
  4308.         DB    'REMOVE      -   Remove the filter from memory'
  4309.         DB    10,'SHOW        -   Show all values',10
  4310.         DB    'HELP        -   This message',10,13
  4311. ;
  4312. VE_VAL        DW    0
  4313. VS_VAL        DW    0
  4314. RM_FLAG        DW    0
  4315. DUR_VAL        DW    0
  4316. FREQ_VAL    DW    0
  4317. BELL_VAL    DW    0
  4318. SHOW_VAL    DW    0
  4319. HELP_VAL    DW    0
  4320. STRIP8_VAL    DW    0
  4321. ;
  4322. CMD1        DB    'reset *so',13
  4323. CMD2        DB    'reset *hp',13
  4324. CMD3        DB    'remove *hp',13
  4325. CMD4        DB    'route *so *do',13
  4326. SETH19        DB    'set *hp h19',13
  4327. FILTER        DB    'filter *so *hp'
  4328. PARMS        DW    0
  4329. ONCE        DB    0
  4330. ARGBUFF        DB    '    '
  4331.         DS    255
  4332. STRBUF        DS    20
  4333. ;
  4334. PARAM_TABLE:
  4335.         DB    80H
  4336. ;
  4337.         DB    80H+5
  4338.         DB    'BLOCK'
  4339. RESP_VS        DB    0
  4340.         DW    VS_VAL
  4341. ;
  4342.         DB    80H+6
  4343.         DB    'CURSOR'
  4344. RESP_VE        DB    0
  4345.         DW    VE_VAL
  4346. ;
  4347.         DB    40H+6
  4348.         DB    'REMOVE'
  4349. RESP_REMOVE    DB    0
  4350.         DW    RM_FLAG
  4351. ;
  4352.         DB    90H+9
  4353.         DB    'FREQUENCY'
  4354. RESP_FREQ    DB    0
  4355.         DW    FREQ_VAL
  4356. ;
  4357.         DB    90H+8
  4358.         DB    'DURATION'
  4359. RESP_DURA    DB    0
  4360.         DW    DUR_VAL
  4361. ;
  4362.         DB    40H+4
  4363.         DB    'BELL'
  4364. RESP_BELL    DB    0
  4365.         DW    BELL_VAL
  4366. ;
  4367.         DB    40H+4
  4368.         DB    'SHOW'
  4369. RESP_SHOW    DB    0
  4370.         DW    SHOW_VAL
  4371. ;
  4372.         DB    40H+4
  4373.         DB    'HELP'
  4374. RESP_HELP    DB    0
  4375.         DW    HELP_VAL
  4376. ;
  4377.         DB    46H
  4378.         DB    'STRIP8'
  4379. RESP_STRIP8    DB    0
  4380.         DW    STRIP8_VAL
  4381. ;
  4382. TABLE_END    DB    0
  4383.         END    START
  4384. <<< m4key.asm >>>
  4385. ;        m4key/asm
  4386. ;
  4387. GETKEY        EQU    $
  4388.         LD    HL,(KEYPOS)    ;Get the buffered keys address
  4389. GETKEY_0    EQU    $
  4390.         LD    A,(HL)        ;Get the key there
  4391.         IFZ    GETKEY_1    ;Jump if no key available
  4392.         INC    HL        ;Point to next
  4393.         LD    (KEYPOS),HL    ;Save the new pointer
  4394.         CP    A        ;Set Z status
  4395.         RET            ;Return the key
  4396. ;
  4397. ;    Here, we must change the current string pointer back to a KNOWN
  4398. ;    zero byte.  Otherwise the next defintion may move non-zero data
  4399. ;    underneath the pointer and result in garbage being retrieved on
  4400. ;    the next call to GETKEY.
  4401. ;
  4402. GETKEY_1    EQU    $
  4403.         LD    HL,ATNULL    ;Replace current string pointer
  4404.         LD    (KEYPOS),HL
  4405.         CALL    TRMIN        ;Get a key from *SI
  4406.         RET    NZ        ;Return if nothing there
  4407.         LD    (SAVEDKEY),A    ;Save it for later use
  4408.         CALL    KEYTRANS    ;Get the address from the table
  4409.         OR    H        ;A holds L, OR in H to check
  4410.         JR    NZ,GETKEY_0    ;Jump if string is present
  4411.         LD    A,(SAVEDKEY)    ;Get the real key back
  4412.         CP    A        ;Set Z status
  4413.         RET            ;Return the key
  4414. ;
  4415. ;    Store a key definition into the table
  4416. ;
  4417. DEFKEY        EQU    $
  4418.         LD    (KEYSTRING),HL    ;Save the pointer to the data
  4419.         LD    (KEYNUMBER),A    ;Save the key to be replaced
  4420.         PUSH    AF
  4421.         LD    A,B        ;Get the number of bytes in (HL)
  4422.         LD    (STRINGLEN),A    ;Store it
  4423.         POP    AF
  4424.         CALL    KEYTRANS    ;Get the address of the current
  4425.         OR    H        ;definition and see if one exists
  4426.         CALL    NZ,DELETEKEY    ;If so, then remove it
  4427.         LD    A,(STRINGLEN)    ;Get the length
  4428.         OR    A        ;Is there a string there?
  4429.         RET    Z        ;Return if none.  Old was deleted
  4430.         LD    HL,DEFTABLE+DEFTLEN-1;Get the top of the table
  4431.         LD    DE,(TOPADDR)    ;Get the start of available
  4432.         OR    A        ;Reset carry
  4433.         SBC    HL,DE        ;Compute available number bytes
  4434.         LD    C,A        ;Get the request size as 16 bits
  4435.         LD    B,0
  4436.         OR    A        ;Reset the carry
  4437.         SBC    HL,BC        ;Compute the remaining after use
  4438.         JR    NC,DEFKEY_1    ;Jump if there is room for it
  4439.         LD    DE,NOSPACE    ;Print the error message
  4440.         CALL    PRTSTR
  4441.         RET            ;Return without defining it
  4442. DEFKEY_1    EQU    $
  4443.         LD    HL,(KEYSTRING)    ;Get the new definition
  4444.         PUSH    DE        ;Save the address to store at
  4445.         LDIR            ;Move the string
  4446.         EX    DE,HL        ;Get the ending address
  4447.         LD    (HL),0        ;Put a NULL in
  4448.         INC    HL        ;Point to next available
  4449.         LD    (TOPADDR),HL    ;Save the new available address
  4450.         POP    DE        ;Restore the definition address
  4451.         LD    HL,(TABLEADDR)    ;Get the address in the table
  4452.         LD    (HL),E        ;Store the LSB
  4453.         INC    HL        ;Point to the MSB
  4454.         LD    (HL),D        ;Save the MSB
  4455.         RET            ;Return to the caller
  4456. ;
  4457. ;    Get the address of the string corresponding to the key number
  4458. ;    in A.  A holds the value of H on return.  HL is zero if no
  4459. ;    definition exists.  HL is the address of the string that is
  4460. ;    defined for the key if it is non-zero.  The last byte in the
  4461. ;    string is followed by a zero byte.
  4462. ;
  4463. KEYTRANS    EQU    $
  4464.         LD    HL,KEYTABLE    ;Get the pointer table
  4465.         LD    C,A        ;Put it into C
  4466.         LD    B,0        ;Set B to zero initially
  4467.         RLC    C        ;C = C * 2
  4468.         JR    NC,KEYTRANS_1    ;If carry on shift then c > 127,
  4469.         INC    B        ;so increment B to recover bit 7
  4470. KEYTRANS_1    EQU    $
  4471.         RES    0,C        ;Reset the LSB of C.
  4472.         ADD    HL,BC        ;Compute the table address
  4473.         LD    (TABLEADDR),HL    ;Save the address of the key def
  4474.         LD    A,(HL)        ;Get the LSB
  4475.         INC    HL        ;Point to the MSB
  4476.         LD    H,(HL)        ;Get it
  4477.         LD    L,A        ;Get the LSB
  4478.         RET            ;Return to caller
  4479. ;
  4480. ;    Delete a key definition from the table.  No parameters are
  4481. ;    needed.  The key to undefine is pointed to by (TABLEADDR).
  4482. ;    Thus, you must call KEYTRANS with the key number in A and then
  4483. ;    call DELETEKEY to delete the key.
  4484. ;
  4485. DELETEKEY    EQU    $
  4486.         LD    HL,(TABLEADDR)    ;Get the addr of the definition
  4487.         LD    E,(HL)        ;Get the LSB of the string
  4488.         XOR    A        ;Clear A
  4489.         LD    (HL),A        ;Zap the LSB
  4490.         INC    HL        ;Point to the MSB
  4491.         LD    D,(HL)        ;Get the MSB
  4492.         LD    (HL),A        ;Zap the MSB
  4493.         LD    (CMPADDR),DE    ;Save the address for compares
  4494.         LD    H,D        ;Copy DE to HL
  4495.         LD    L,E
  4496. ;        XOR    A        ;A is already zero (what we seek)
  4497.         CPIR            ;Look for it
  4498.         PUSH    HL        ;Save the ending address
  4499.         OR    A        ;Reset the carry
  4500.         SBC    HL,DE        ;Compute the difference
  4501.         LD    (MOVEDIFF),HL    ;Save the difference
  4502.         LD    HL,(TOPADDR)    ;Get the end of the table
  4503.         POP    BC        ;Get the end of string to delete
  4504.         OR    A        ;reset the carry
  4505.         SBC    HL,BC        ;Calculate number bytes to move
  4506.         PUSH    BC        ;Exchange HL and BC
  4507.         PUSH    HL
  4508.         POP    BC
  4509.         POP    HL
  4510.         LD    A,B        ;Check for zero length
  4511.         OR    C
  4512.         JR    Z,DELETEKEY_1    ;Don't move 65536 bytes
  4513.         LDIR            ;Adjust the strings down
  4514. DELETEKEY_1    EQU    $
  4515.         LD    (TOPADDR),DE    ;Set the new top address
  4516.         LD    HL,KEYTABLE    ;Get start of table
  4517.         LD    B,0        ;Check 256 entrys
  4518. DELETEKEY_2    EQU    $
  4519.         PUSH    BC        ;Save the counter
  4520.         LD    C,(HL)        ;Get the table value LSB
  4521.         INC    HL        ;Point to MSB
  4522.         LD    B,(HL)        ;Get the MSB
  4523.         DEC    HL        ;Back to original address
  4524.         LD    A,B        ;Check for any definition
  4525.         OR    C        ;Set the flags
  4526.         JR    Z,DELETEKEY_4    ;Skip this entry
  4527.         PUSH    HL        ;Save the table address
  4528.         LD    HL,(CMPADDR)    ;Get the address to check against
  4529.         OR    A        ;Reset the carry
  4530.         SBC    HL,BC        ;Compute the difference
  4531.         JP    P,DELETEKEY_3    ;Jump if no adjust needed
  4532.         LD    H,B        ;Copy BC to HL
  4533.         LD    L,C
  4534.         LD    BC,(MOVEDIFF)    ;Get the difference
  4535.         OR    A        ;Reset the carry
  4536.         SBC    HL,BC        ;Adjust the pointer
  4537.         LD    C,L        ;Copy HL to BC
  4538.         LD    B,H        ;Get the MSB
  4539.         POP    HL        ;Get the destination address
  4540.         LD    (HL),C        ;Store the LSB back
  4541.         INC    HL        ;Point to MSB
  4542.         LD    (HL),B        ;Store the MSB
  4543.         JR    DELETEKEY_5    ;Join other code
  4544. DELETEKEY_3    EQU    $
  4545.         POP    HL        ;Get the table address back
  4546. DELETEKEY_4    EQU    $
  4547.         INC    HL        ;Point to next table pos
  4548. DELETEKEY_5    EQU    $
  4549.         INC    HL        ;One more increment
  4550.         POP    BC        ;Get the counter back
  4551.         DJNZ    DELETEKEY_2    ;Loop until done
  4552.         RET
  4553. ;end of file
  4554. <<< m4log.asm >>>
  4555. ;    M4LOG/ASM
  4556. ;    LOGON SCRIPT INTERPRETER
  4557. ;
  4558. ;    OUTPUT STRING TO PORT
  4559. ;
  4560. ;    This code performs the OUTPUT function.  Control characters
  4561. ;    are ignored in the output string as far as matching is concerned,
  4562. ;    and they are also ignored in the input port.  This allows more
  4563. ;    flexability as far as text recognition is concerned.
  4564. ;
  4565. ;    e.g.  The string XYZPDQ<CR><ESC><CR> will be output exactly as
  4566. ;    specified, but only the characters "XYZPDQ" will be matched if
  4567. ;    SET OUTPUT HOST-ECHO is ON.  Any control characters will be
  4568. ;    ignored.
  4569. ;
  4570. OUTPUT    EQU    $
  4571.     LD    A,CMTXT        ;GET SOME TEXT TO SEND
  4572.     LD    DE,DATA        ;WHERE TO PUT THE STRING
  4573.     LD    (SOUPTR),DE    ;SET THE ORIGINAL DATA ADDRESS
  4574.     CALL    COMND        ;GET IT
  4575.     JP    KERMT3        ;SAY NOT CONFIRMED ON ERROR
  4576.     LD    A,1
  4577.     LD    (SNDFLG),A
  4578. OUTPUT1    CALL    GETFCH        ;GET A CHARACTER
  4579.     JR    NZ,OUTPUT5
  4580.     CALL    GTREAL        ;GET THE ACTUAL IF IT IS SPECIAL
  4581.     JP    NZ,SOU400    ;QUIT ON AN ERROR
  4582.     LD    E,A        ;PUT IT IN E FOR OUTCHR
  4583.     LD    A,(DLYFLG)    ;WAS IT A DELAY
  4584.     IFZ    OUTPUT2        ;Jump is no delay
  4585.     XOR    A
  4586.     LD    (DLYFLG),A    ;RESET THE FLAG
  4587.     JR    OUTPUT1        ;GET A NEW CHARACTER
  4588. OUTPUT2    CALL    OUTCHR        ;OUT THE PORT WITH IT
  4589.     LD    A,(LOGFLG)    ;DO WE NEED TO LOGIT TO THE FILE
  4590.     OR    A
  4591.     LD    A,E        ;RESTORE THE CHARACTER IN A
  4592.     CALL    NZ,LOGIT    ;LOG IT IF LOGFLG IS SET
  4593.     IFALT    32,OUTPUT1
  4594.     LD    A,(ECHFLG)    ;IS ECHO ON?
  4595.     IFZ    OUTPUT1        ;If not than get the next to send
  4596.     LD    A,E        ;GET THE CHARACTER BACK IN A
  4597.     PUSH    AF        ;SAVE IT FOR A SEC
  4598. OUTPUT3    CALL    INPORT        ;GET ONE CHARACTER FROM THE PORT
  4599.     JR    Z,OUTPUT4    ;Got a character so check it
  4600.     CALL    CONIN        ;IS THERE A KEY PRESSED?
  4601.     IFZ    OUTPUT3        ;Go if there isn't
  4602.     CP    128        ;IS IT BREAK
  4603.     JP    Z,SBORT        ;QUIT IF IT IS
  4604.     CP    27        ;IS IT ESCAPE
  4605.     JP    Z,QUTOUT    ;Skip this command
  4606.     CP    129        ;CHECK FOR F1 PRESSED
  4607.     JP    Z,QUTOUT    ;Skip this command
  4608.     JR    OUTPUT3        ;TRY AGAIN TO GET THE ECHO
  4609. OUTPUT4    LD    E,A
  4610.     LD    A,(OTDSP)    ;LOCAL ECHO ON?
  4611.     OR    A
  4612.     LD    A,E        ;RESTORE A FOR THE CALL TO TRMOUT
  4613.     CALL    NZ,TRMOUT    ;DISPLAY THE CHARACTER
  4614.     LD    A,(LOGFLG)    ;IS LOGGING SET?
  4615.     OR    A
  4616.     LD    A,E
  4617.     CALL    NZ,LOGIT    ;LOG WHAT WE RECEIVED
  4618.     CALL    SETCSE        ;SET THE CASE
  4619.     LD    E,A        ;PUT IT IN E
  4620.     POP    AF        ;GET THE CHARACTER WE SENT
  4621.     CALL    SETCSE        ;SET THE CASE
  4622.     IFA    E,OUTPUT1
  4623.     LD    A,E
  4624.     IFALT    32,OUTPUT1    ;Ignore CNTL that doesn't match
  4625.     LD    DE,NOECHO    ;LOAD NO REMOTE-HOST ECHO ERROR
  4626.     JP    SBORT2        ;QUIT, NO MATCH
  4627. OUTPUT5    XOR    A        ;RESET STATE FLAG
  4628.     LD    (SNDFLG),A
  4629.     JP    KERMIT        ;GET A NEW COMMAND
  4630. ;
  4631. ;    Do receive character matching.
  4632. ;
  4633. ;    The KMP pattern matching algorithm is used here for the fun of
  4634. ;    it.  In reality, we probably don't need this much power, but
  4635. ;    it is rather elegant!!!
  4636. ;
  4637. INPUT    EQU    $
  4638.     LD    A,CMTXT        ;GET SOMETHING TO SEND
  4639.     LD    DE,DATA        ;WHERE TO PUT THE TEXT
  4640.     LD    (SOUPTR),DE    ;SAVE THE ADDRESS FOR GETFCH
  4641.     CALL    COMND        ;GET SOME TEXT, OR FAIL
  4642.     JP    KERMT3        ;SAY NOT CONFIRMED ON FAILURE
  4643.     LD    A,1
  4644.     LD    (RECFLG),A
  4645.     LD    HL,STRING    ;GET ADDRESS OF THE BUFFER
  4646.     LD    B,0        ;B IS THE LENGTH COUNTER
  4647. ;
  4648. ;    Gather the string to receive
  4649. ;
  4650. INPUT1    CALL    GETFCH        ;GET A CHARACTER
  4651.     JP    NZ,INPUT3    ;QUIT ON AN ERROR
  4652.     CALL    GTREAL        ;CONVERT ESCAPES, ETC...
  4653.     JP    NZ,SOU400    ;QUIT ON AN ERROR
  4654.     LD    E,A        ;SAVE THE CHARACTER FOR A SEC
  4655.     LD    A,(DLYFLG)    ;WAS IT A DELAY?
  4656.     IFZ    INPUT2        ;Jump if not
  4657.     XOR    A        ;CLEAR A
  4658.     LD    (DLYFLG),A    ;RESET THE FLAG
  4659.     JR    INPUT1
  4660. INPUT2    LD    (HL),E        ;STORE WHAT WE GOT
  4661.     INC    HL        ;POINT TO THE NEXT
  4662.     INC    B        ;ONE MORE TO LENGTH
  4663.     JR    NZ,INPUT1    ;JUMP IF NOT BUFFER OVERFLOW
  4664.     LD    DE,STOBIG    ;LOAD error MESSAGE STRING
  4665.     CALL    PRTSTR        ;PRINT IT ON THE SCREEN.
  4666.     JP    SOU540        ;Jump to end
  4667. INPUT3    LD    (HL),0        ;END IT WITH A NULL
  4668. ;
  4669. ;    KMP really begins here.  The basic C code is in the comments!
  4670. ;    Build the failure link table...
  4671. ;        
  4672.     LD    A,B        ;B IS THE LENGTH
  4673.     LD    (LENGTH),A    ;SAVE THE LENGTH M=STRLEN(STR)
  4674.     XOR    A        ;ZERO a FOR FLINK[1]=0
  4675.     LD    C,1        ;SUBSCRIPT 1
  4676.     CALL    SETLNK        ;FLINK[1]=0;
  4677.     LD    D,2        ;I=2;
  4678. INPUT4    LD    C,D        ;GET I
  4679.     LD    A,(LENGTH)    ;GET THE LENGTH OF THE STRING
  4680.     CP    C        ;IF (I <= M) {
  4681.     JP    M,INPUT7    ;Jump if I > M
  4682.     LD    C,D        ;c = I
  4683.     DEC    C        ;c = I-1
  4684.     CALL    GETLNK        ;a = FLINK[c]
  4685.     LD    E,A        ;J = FLINK[I-1]
  4686. INPUT5    INC    E        ;IF (I != 0
  4687.     DEC    E
  4688.     JR    Z,INPUT6    ;JUMP IF I = 0
  4689.     LD    C,E        ;c = J
  4690.     CALL    GETSTG        ;a = STRING[J]
  4691.     LD    B,A        ;b = a
  4692.     LD    C,D        ;c = I
  4693.     DEC    C        ;c = I - 1
  4694.     CALL    GETSTG        ;a = STRING[I-1]
  4695.     IFA    B,INPUT6
  4696.     LD    C,E        ;c = J
  4697.     CALL    GETLNK        ;a = FLINK[J]
  4698.     LD    E,A        ;J = FLINK[J]
  4699.     JR    INPUT5
  4700. INPUT6    LD    A,E        ;A = J
  4701.     INC    A        ;A = J+1
  4702.     LD    C,D        ;C = I
  4703.     CALL    SETLNK        ;FLINK[I] = J+1
  4704.     INC    D        ;I++
  4705.     JR    INPUT4
  4706. INPUT7    LD    E,0        ;J = 0
  4707.     LD    A,(HSTCHR)    ;GET ANY LEFT OVER CHARACTERS
  4708.     IFZ    INPUT12
  4709.     LD    C,A        ;SAVE A FOR A SEC
  4710.     XOR    A        ;CLEAR IT OUT
  4711.     LD    (HSTCHR),A    ;SAY NO REMAINING HOST CHARACTER
  4712.     LD    A,C        ;RESTORE A
  4713. INPUT8    LD    (CHRGOT),A
  4714.     LD    C,A        ;SAVE THE CHARACTER
  4715.     LD    A,(INDSP)    ;CHECK IF WE SHOULD DISPLAY
  4716.     IFZ    INPUT9
  4717.     LD    A,C        ;GET THE CHARACTER BACK
  4718.     CALL    TRMOUT        ;PRINT IT
  4719. INPUT9    LD    A,(LOGFLG)    ;IS LOGGING ON
  4720.     OR    A        ;SET THE FLAGS
  4721.     LD    A,C        ;RESTORE THE CHARACTER INTO A
  4722.     CALL    NZ,LOGIT    ;LOG THE CHARACTER TO THE FILE
  4723.     INC    E        ;++J
  4724. INPUT10    INC    E        ;IS E == 0
  4725.     DEC    E
  4726.     JR    Z,INPUT11
  4727.     LD    C,E        ;C = J
  4728.     DEC    C        ;C = J-1
  4729.     CALL    GETSTG        ;A = STRING[J-1]
  4730.     CALL    SETCSE        ;ADJUST THE CASE
  4731.     LD    C,A        ;C = A
  4732.     LD    A,(CHRGOT)
  4733.     CALL    SETCSE        ;ADJUST THE CASE
  4734.     IFA    C,INPUT11
  4735.     LD    C,E        ;C = J
  4736.     CALL    GETLNK        ;A = FLINK[J]
  4737.     LD    E,A        ;J = FLINK[J]
  4738.     JR    INPUT10
  4739. INPUT11    LD    A,(LENGTH)    ;ARE WE AT THE END
  4740.     IFA    E,INPUT13
  4741. INPUT12    CALL    INPORT        ;GET A CHARACTER IF THERE
  4742.     JR    Z,INPUT8    ;GO IF WE GOT ONE
  4743.     CALL    CONIN        ;IS THERE A KEY PRESSED
  4744.     IFZ    INPUT12
  4745.     CP    128        ;IS BREAK PRESSED
  4746.     JP    Z,SBORT        ;SBORT IF IT IS
  4747.     CP    ESC        ;IS IT ESCAPE
  4748.     JP    Z,QUTOUT    ;Skip this command
  4749.     CP    129        ;CHECK IF F1 IS PRESSED AS ESCAPE
  4750.     JP    Z,QUTOUT    ;Skip this command
  4751.     PUSH    DE        ;SAVE E
  4752.     LD    E,A        ;OUTCHR NEEDS CHAR IN E
  4753.     CALL    OUTCHR        ;SEND IT OUT THE PORT
  4754.     POP    DE        ;RESTORE E
  4755.     JR    INPUT12        ;CHECK AGAIN
  4756. INPUT13    XOR    A        ;RESET RECEIVE STATE FLAG
  4757.     LD    (RECFLG),A
  4758.     JP    KERMIT        ;GET A NEW COMMAND
  4759. ;
  4760. ;    DO MULTIPLE/REPEATING TRANSMITTION UNTIL A CHARACTER IS RECEIVED
  4761. ;
  4762. PULSE    EQU    $
  4763.     LD    A,CMTXT        ;GET SOME TEXT
  4764.     LD    DE,DATA        ;WHERE TO PUT IT
  4765.     LD    (SOUPTR),DE    ;SAVE THE ADDRESS OF THE BUFFER
  4766.     CALL    COMND        ;GET SOME TEXT
  4767.     JP    KERMT3        ;SAY NOT CONFIRMED ON FAILURE
  4768.     LD    A,1
  4769.     LD    (MULFLG),A
  4770.     LD    HL,MULBUF    ;GET THE BUFFER
  4771.     LD    (BUFPTR),HL    ;SAVE THE START
  4772. PULSE1    CALL    GETFCH        ;GET A CHARACTER
  4773.     JP    NZ,PULSE3    ;QUIT ON AN ERROR
  4774.     CALL    GTREAL        ;GET THE ACTUAL CHARACTER
  4775.     JP    NZ,SOU400
  4776.     LD    E,A
  4777.     LD    A,(DLYFLG)    ;WAS IT A DELAY?
  4778.     IFZ    PULSE2
  4779.     XOR    A        ;CLEAR A
  4780.     LD    (DLYFLG),A    ;RESET THE FLAG
  4781.     JR    PULSE1        ;GET A NEW CHARACTER
  4782. PULSE2    LD    (HL),E        ;SAVE THE CHARACTER
  4783.     INC    HL        ;POINT TO THE NEXT
  4784.     JR    PULSE1        ;DO IT AGAIN
  4785. PULSE3    PUTHL    A        ;Save the CR just found
  4786.     LD    (HL),0        ;Terminate with a NULL
  4787. PULSE4    LD    BC,3000        ;DELAY COUNTER, MAGICAL NUMBER?!?
  4788. PULSE5    CALL    INPORT        ;CHECK FOR A CHARACTER FIRST.
  4789.     JR    Z,PULSE9    ;GO IF WE GOT ONE
  4790.     PUSH    BC        ;SAVE BC
  4791.     CALL    CONIN        ;CHECK THE KEYBOARD
  4792.     IFZ    PULSE6
  4793.     CP    128        ;IS IT BREAK?
  4794.     POP    BC
  4795.     JP    Z,SBORT        ;SBORT IF IT IS
  4796.     CP    ESC        ;IS IT ESCAPE?
  4797.     JP    Z,QUTOUT    ;Skip this command
  4798.     CP    129        ;IS F1 PRESSED FOR ESCAPE?
  4799.     JP    Z,QUTOUT    ;Skip this command
  4800.     PUSH    BC
  4801.     LD    E,A        ;PUT CHAR IN E FOR OUTCHR
  4802.     CALL    OUTCHR        ;OUTPUT THE SUCKER!
  4803.     LD    A,(LOGFLG)    ;CHECK FOR LOGGING TO FILE
  4804.     OR    A
  4805.     LD    A,E        ;GET THE CHARACTER BACK
  4806.     CALL    NZ,LOGIT    ;GO LOG IT TO THE FILE IF FLAG
  4807. PULSE6    POP    BC
  4808.     DEC    BC        ;DECREMENT OUR COUNTER
  4809.     LD    A,B        ;CHECK IT FOR ZERO
  4810.     OR    C
  4811.     JR    NZ,PULSE5    ;LOOP UNTIL IT IS
  4812.     LD    HL,MULBUF    ;GET THE STRING ADDRESS
  4813. PULSE7    LD    A,(HL)        ;GET A CHARACTER TO SEND
  4814.     CP    CR        ;IS IT THE END OF THE STRING?
  4815.     JR    NZ,PULSE8    ;If not CR than jump
  4816.     INC    HL        ;CHECK FOR NULL TERMINATOR
  4817.     LD    A,(HL)        ;GET THE CHARACTER AFTER CR
  4818.     DEC    HL        ;POINT BACK ONE FOR FAIL
  4819.     IFZ    PULSE4
  4820. PULSE8    INC    HL        ;POINT TO NEXT CHAR
  4821.     PUSH    HL        ;SAVE THE ADDRESS
  4822.     LD    E,A        ;SEND IT TO THE PORT
  4823.     CALL    OUTCHR
  4824.     LD    A,(LOGFLG)    ;CHECK FOR LOGGING
  4825.     OR    A
  4826.     LD    A,E        ;GET THE CHARACTER BACK
  4827.     CALL    NZ,LOGIT    ;GO LOG IT TO THE FILE
  4828.     POP    HL        ;GET THE ADDRESS BACK
  4829.     JR    PULSE7        ;TO OF THE LOOP
  4830. PULSE9    LD    (HSTCHR),A    ;SAVE THE SENT CHARACTER
  4831.     XOR    A        ;RESET THE STATE FLAG
  4832.     LD    (MULFLG),A
  4833.     JP    KERMIT        ;GET A NEW COMMAND
  4834. ;
  4835. ;    PAUSE FOR A CERTAIN NUMBER OF SECONDS
  4836. ;
  4837. PAUSE    EQU    $
  4838.     LD    A,CMNUM        ;GET A WHILE TO PAUSE
  4839.     CALL    COMND        ;GET A NUMBER
  4840.     JP    KERMT3        ;SAY NOT CONFIRMED ON AN ERROR
  4841.     IFNZ    PAUSE1        ;Jump if at least one digit given
  4842.     LD    DE,1        ;Use one second for the default
  4843. PAUSE1    LD    L,E        ;SAVE IT
  4844.     LD    H,D        ;HL IN THE COUNT
  4845.     LD    C,30        ;Count * 30 * HL = seconds delay
  4846.     CALL    XMUL16        ;Multiply 16 bit HL by 8 bit C
  4847.     LD    H,L        ;Put the lower 16 bit of the 24
  4848.     LD    L,A        ;bit result into HL
  4849.     LD    (TIMER),HL    ;STORE THE NUMBER
  4850.     LD    C,8        ;TASK SLOT # 8
  4851. PAUSE2    CALL    XCKTSK        ;Is the task available?
  4852.     JR    NZ,PAUSE3
  4853.     LD    IY,(FLAGS)    ;Reset the special key bits in kflag$
  4854.     LD    A,(IY+10)    ;Get it
  4855.     AND    0F8H        ;Throw out <ENTER>, <BREAK>, and <PAUSE>
  4856.     LD    (IY+10),A    ;Put it back
  4857.     LD    DE,ALRMAD    ;ADDRESS OF THE ALARM
  4858.     CALL    XADTSK        ;Add the task
  4859.     JR    PAUSE5        ;Go wait for completion
  4860. PAUSE3    INC    C        ;Get the next slot
  4861.     CP    11
  4862.     JR    NZ,PAUSE2
  4863.     STROUT    NODELAY        ;Issue errormessage
  4864.     LD    BC,0FFFFH    ;Get a big value
  4865.     CALL    XPAUSE        ;Use @PAUSE to sleep for awhile
  4866.     JP    KERMIT
  4867. PAUSE5    LD    HL,(TIMER)    ;CHECK FOR ZERO YET
  4868.     LD    A,H
  4869.     OR    L
  4870.     JR    NZ,PAUSE5    ;LOOP UNTIL EXPIRES
  4871.     JP    KERMIT        ;QUIT WHEN FLAG IS ZERO
  4872. ;
  4873. ;    Set or ignore case based on "CSEFLG"
  4874. ;
  4875. SETCSE    PUSH    AF        ;SAVE THE CHARACTER
  4876.     LD    A,(CSEFLG)    ;IS THE OPTION ON?
  4877.     IFZ    CPS10
  4878.     POP    AF        ;GET THE CHARACTER BACK
  4879. CPTAL    CP    'a'        ;CHECK FOR LOWER CASE
  4880.     RET    M
  4881.     CP    'z'+1
  4882.     RET    P
  4883.     AND    5FH        ;MAKE IT UPPER IF IT IS LOWER
  4884.     JR    CAPS20
  4885. CPS10    POP    AF        ;RESTORE AF
  4886. CAPS20    RET            ;RETURN TO THE CALLER
  4887. ;
  4888. ;    INDEX STRING BY "C" ELEMENTS, AND PUT THE VALUE THERE IN A
  4889. ;
  4890. GETSTG    LD    HL,STRING    ;GET STRING AS THE BASE
  4891.     JR    GET100        ;JOIN THE CODE
  4892. GETLNK    LD    HL,FLINK    ;GET FLINK AS THE BASE
  4893. GET100    PUSH    BC        ;SAVE BC FOR THE ADD
  4894.     LD    B,0        ;MAKE BC A BYTE COUNT
  4895.     ADD    HL,BC        ;HL NOW POINTS TO IT
  4896.     LD    A,(HL)        ;A = HL[c]
  4897.     POP    BC        ;RESTORE BC
  4898.     RET
  4899. ;
  4900. ;    ASSIGN THE C'th ELEMENT OF A STRING THE VALUE IN A
  4901. ;
  4902. SETSTG    LD    HL,STRING    ;GET STRING AS THE BASE
  4903.     JR    SET100        ;JOIN THE CODE
  4904. SETLNK    LD    HL,FLINK    ;GET FLINK AS THE BASE
  4905. SET100    PUSH    BC        ;SAVE BC FOR THE ADD
  4906.     LD    B,0        ;MAKE BC A BYTE OFFSET
  4907.     ADD    HL,BC        ;HL POINT TO IT NOW
  4908.     LD    (HL),A        ;HL[c] = A
  4909.     POP    BC        ;RESTORE BC
  4910.     RET
  4911. ;
  4912. ;    PRINT THE MESSAGE IN DE AND QUIT WITH AN ERROR
  4913. ;
  4914. SBORT2    CALL    PRTSTR        ;DISPLAY THE MESSAGE
  4915.     JR    SBORT        ;CLOSE THE FILE AND EXIT
  4916. ;
  4917. ;    ISSUE A SYSTEM ERROR MESSAGE FIRST AND SBORT
  4918. ;
  4919. SBORT1    CALL    XERROR0        ;PRINT A SYSTEM MESSAGE
  4920. SBORT    STROUT    LGFAIL        ;Operation aborted message
  4921.     JP    SOU540
  4922. ;
  4923. ;    SURRENDER THE TERMINAL TO THE USER
  4924. ;
  4925. QUTOUT    STROUT    QUTMES        ;TELL THEM WHAT WE ARE DOING
  4926.     LD    HL,(CMCPTR)
  4927.     LD    (HL),EOS
  4928.     STROUT    CMDBUF
  4929.     JP    KERMIT        ;GET A NEW COMMAND
  4930. ;
  4931. ;    CONTROL COMES HERE AT EOF
  4932. ;
  4933. SOU400    LD    A,(ESFLG)    ;DID WE DIE IN AN ESC SEQ
  4934.     IFZ    SOU420
  4935.     STROUT    PREESC        ;Print the message
  4936.     JR    SOU540        ;CHECK STATE FLAGS
  4937. SOU420    LD    A,(CTLFLG)    ;DID WE DIE IN A CTL SEQ
  4938.     IFZ    SOU430
  4939.     STROUT    PRECTL        ;Print the message
  4940.     JR    SOU540        ;CHECK STATE FLAGS
  4941. SOU430    LD    A,(OPTFLG)    ;CHECK FOR <CR> TYPE EOF
  4942.     OR    A
  4943.     JP    Z,KERMIT    ;ON THIS ONE, GOTO KERMIT
  4944.     STROUT    PREOPT        ;Print the message
  4945.     JR    SOU540
  4946. SOU540    LD    A,(EXTFLG)    ;CHECK FOR EXIT AT EOF
  4947.     OR    A        ;IS IT SET
  4948.     JP    Z,KERMIT    ;GOTO GET MORE COMMANDS IF NOT
  4949.     LD    A,(TAKFLG)    ;CHECK IF TAKE ACTIVE
  4950.     OR    A
  4951.     JP    Z,KERMIT    ;GOTO KERMIT IF NOT
  4952.     LD    DE,TFCB
  4953.     CALL    XCLOSE        ;CLOSE THE TAKE FILE
  4954.     XOR    A        ;TURN TAKE OFF
  4955.     LD    (TAKFLG),A
  4956.     JP    KERMIT        ;GET A NEW COMMAND
  4957. ;
  4958. ;    GET \ ESCAPED OR CONTROL'D CHARACTER IF CONTENTS OF "A" SAY SO.
  4959. ;    ALSO <CR>, <LF>, <FF>, ARE RECOGNIZED HERE FOR SEND AND RECEIVE.
  4960. ;    HL MUST CONTAIN ADDRESS OF ROUTINE TO CALL FOR NEXT CHARACTER.
  4961. ;    RETURNS NZ STATUS IF SECOND GET FAILED, OTHERWIZE RETURNS Z.
  4962. ;
  4963. GTREAL    PUSH    HL        ;SAVE THE REGS!
  4964.     PUSH    BC
  4965.     PUSH    DE
  4966.     IFANOT    '\',GT010
  4967.     XOR    A
  4968.     LD    B,A
  4969.     INC    A
  4970.     LD    (ESFLG),A
  4971.     CALL    GETFCH        ;CALL THE SPECIAL ROUTINE
  4972.     JP    NZ,GT060    ;QUIT IF END IS FOUND
  4973.     CP    '0'
  4974.     JP    M,GT005
  4975.     CP    '9'+1
  4976.     JP    P,GT005
  4977. GT002    CP    '0'
  4978.     JP    M,GT003
  4979.     CP    '9'+1
  4980.     JP    P,GT003
  4981.     SUB    '0'
  4982.     SLA    B
  4983.     SLA    B
  4984.     SLA    B
  4985.     ADD    A,B
  4986.     LD    B,A
  4987.     CALL    GETFCH        ;CALL THE SPECIAL ROUTINE
  4988.     JR    Z,GT002        ;Go on success
  4989. GT003    LD    HL,(SOUPTR)    ;Unput the character
  4990.     DEC    HL
  4991.     LD    (SOUPTR),HL
  4992.     LD    (HL),A
  4993. GT004    LD    A,B
  4994. GT005    PUSH    AF
  4995.     XOR    A
  4996.     LD    (ESFLG),A
  4997.     POP    AF
  4998.     JP    GT050
  4999. GT010    IFANOT    '^',GT020    ;Jump if not a control sequence
  5000.     LD    A,1        ;SET THE FLAG FOR A GET ERROR
  5001.     LD    (CTLFLG),A
  5002.     CALL    GETFCH        ;CALL THE SPECIAL ROUTINE
  5003.     JP    NZ,GT060
  5004.     SUB    40H        ;CONTROLIFY IT BY SUBTRACTING "@"
  5005.     PUSH    AF
  5006.     XOR    A
  5007.     LD    (CTLFLG),A
  5008.     POP    AF
  5009.     JP    GT050
  5010. GT020    CP    '<'        ;Is it an ANSI sequence
  5011.     JP    NZ,GT050    ;RETURN Z STATUS IF NOT
  5012.     LD    A,1        ;SET THE STATE FLAG
  5013.     LD    (OPTFLG),A
  5014.     LD    HL,GTSTRG    ;WHERE TO STORE THE STRING
  5015. GT023    CALL    GETFCH        ;GET A CHARACTER
  5016.     JP    NZ,GT060    ;QUIT ON AN ERROR
  5017.     IFA    '>',GT026
  5018.     CALL    CPTAL        ;MAKE IT A CAPITAL
  5019.     PUTHL    A        ;Save the character
  5020.     JR    GT023        ;GET SOME MORE
  5021. GT026    LD    (HL),0FFH    ;IMPOSSIBLE CHARACTER AS EOL
  5022.     LD    HL,CTLTBL    ;TOP OF THE TABLE
  5023.     LD    B,(HL)        ;GET THE NUMBER OF ENTRIES
  5024.     INC    HL        ;POINT AT THE FIRST CHAR
  5025. GT028    LD    DE,GTSTRG    ;Get the buffer we stored into
  5026. GT030    LD    A,(DE)        ;Get a character
  5027.     IFANOT    (HL),GT040    ;Does it match
  5028. GT035    GETHL    A        ;Get the next character
  5029.     INC    DE        ;Point to next
  5030.     IFALT    '0',GT037    ;Check valid range of characters
  5031.     IFAGE    'Z'+1,GT037    ;Jump if we are at the end marker
  5032.     JR    GT030        ;Go get the rest of the string
  5033. GT037    LD    C,A        ;Save the character
  5034.     LD    A,(DE)        ;Get the next
  5035.     IFANOT    0FFH,GT040    ;Error if not terminator
  5036.     LD    A,C        ;RESTORE THE CHARACTER
  5037.     CP    DLY        ;Is it a delay string?
  5038.     JP    Z,DELAY        ;Go do it if it is
  5039.     PUSH    AF
  5040.     XOR    A        ;Reset the state flag for EOF
  5041.     LD    (OPTFLG),A
  5042.     POP    AF
  5043.     JP    GT050        ;RETURN Z STATUS
  5044. GT040    LD    C,A        ;SAVE THE CHARACTER
  5045.     LD    A,(HL)        ;WILD CARD?
  5046.     IFANOT    '*',GT042    ;Jump if not wild
  5047.     LD    A,C        ;Get the delay character
  5048.     LD    (WLDBUF),A    ;SAVE IT IN THE BUFFER
  5049.     JR    GT035        ;Join the code for end check
  5050. GT042    LD    A,0FEH        ;WHAT TO LOOK FOR
  5051.     PUSH    BC        ;DON'T KILL B
  5052.     LD    BC,0        ;Set max count
  5053.     CPIR            ;LOOK AHEAD FOR THE NEXT
  5054.     POP    BC        ;RESTORE B
  5055.     DJNZ    GT028        ;GO LOOK SOMEMORE
  5056.     JP    NOCODE        ;PRINT A MESSAGE
  5057. DELAY    LD    A,(WLDBUF)    ;GET THE CHARACTER
  5058.     SUB    48        ;MAKE IT BINARY
  5059.     LD    L,A        ;SAVE IT
  5060.     LD    H,0        ;HL IN THE COUNT
  5061.     LD    C,30        ;33.33 MILLISECS * 30 * HL = SECS
  5062.     CALL    XMUL16
  5063.     LD    H,L        ;SHIFT IT ALL INTO HL
  5064.     LD    L,A        ;HL = HL * 120
  5065.     LD    (TIMER),HL
  5066.     LD    IY,(FLAGS)    ;Reset the special key bits in kflag$
  5067.     LD    A,(IY+10)
  5068.     AND    0F8H
  5069.     LD    (IY+10),A
  5070.     LD    C,8        ;TASK SLOT # 8
  5071.     LD    DE,ALRMAD    ;ADDRESS OF THE ALARM
  5072.     CALL    XADTSK
  5073. GT034    LD    HL,(TIMER)    ;CHECK FOR ZERO YET
  5074.     LD    A,H
  5075.     OR    L
  5076.     JR    NZ,GT034    ;LOOP UNTIL EXPIRES
  5077.     LD    A,1
  5078.     LD    (DLYFLG),A    ;SET THE DELAY FLAG
  5079. GT050    CP    A        ;SET Z STATUS
  5080. GT060    POP    DE        ;RESTORE REGS
  5081.     POP    BC
  5082.     POP    HL
  5083.     RET            ;RETURN TO THE CALLER
  5084. ;
  5085. ;    Print an error message about a bad string inside <...>'s
  5086. ;
  5087. NOCODE    STROUT    BADCD        ;PRINT A MESSAGE
  5088.     XOR    A
  5089.     INC    A        ;SET NZ STATUS
  5090.     JR    GT060
  5091. ;
  5092. ;    ALARM COUNTER
  5093. ;
  5094. ALARM    PUSH    HL        ;Save the registers
  5095.     PUSH    AF
  5096.     PUSH    IY
  5097.     LD    IY,(FLAGS)    ;Get the system flags
  5098.     LD    HL,(TIMER)    ;PREVIOUS TIMER VALUE
  5099.     DEC    HL        ;DECREMENT IT
  5100.     LD    (TIMER),HL    ;SAVE THE NEW VALUE
  5101.     LD    A,H        ;IS IT ZERO YET
  5102.     OR    L
  5103.     JR    NZ,ALARM2
  5104. ALARM1    EQU    $
  5105.     RES    0,(IY+10)    ;Reset the break bit
  5106.     POP    IY
  5107.     POP    AF
  5108.     POP    HL
  5109.     CALL    XKLTSK        ;Remove the alarm task, doesn't return
  5110.     RET            ;Just in case
  5111. ALARM2    EQU    $
  5112.     BIT    0,(IY+10)    ;Check the break bit
  5113.     JR    Z,ALARM5
  5114.     LD    HL,0
  5115.     LD    (TIMER),HL
  5116.     LD    H,50
  5117. ALARM3    DEC    HL
  5118.     LD    A,H
  5119.     OR    L
  5120.     JR    NZ,ALARM3
  5121.     JR    ALARM1
  5122. ALARM5    EQU    $
  5123.     POP    IY
  5124.     POP    AF
  5125.     POP    HL
  5126.     RET
  5127. ;
  5128. ;    GET THE NEXT CHARACTER FROM THE BUFFER
  5129. ;
  5130. GETFCH    PUSH    HL
  5131.     LD    HL,(SOUPTR)
  5132.     LD    A,(HL)
  5133.     INC    HL
  5134.     LD    (SOUPTR),HL
  5135.     IFA    CR,GTF010
  5136.     CP    A
  5137.     POP    HL
  5138.     RET
  5139. GTF010    CP    CR+1        ;Force NZ to be set
  5140.     POP    HL
  5141.     RET
  5142.     END
  5143. ;end of file
  5144. <<< m4mac.asm >>>
  5145. ;    m4mac/asm
  5146. *LIST    OFF
  5147. PUTHL    MACRO    #P1
  5148.     LD    (HL),#P1
  5149.     INC    HL
  5150.     ENDM
  5151. ;
  5152. ;    Protocol switch macro
  5153. ;
  5154. ;    Expansion is something like:
  5155. ;
  5156. ;    CP    'D'
  5157. ;    JR    NZ,SWAA
  5158. ;    CALL    SDATA
  5159. ;    JP    PROTO
  5160. ;SWAA
  5161. ;
  5162. SWITCH    MACRO    #P1,#P2
  5163.     CP    #P1
  5164.     JR    NZ,SW?
  5165.     CALL    #P2
  5166.     JP    PROTO
  5167. SW?
  5168.     ENDM
  5169. ;
  5170. TOCHAR    MACRO
  5171.     ADD    A,32
  5172.     ENDM
  5173. ;
  5174. STROUT    MACRO    #P1
  5175.     LD    DE,#P1
  5176.     CALL    PRTSTR
  5177.     ENDM
  5178. ;
  5179. SPACKET    MACRO    #P1
  5180.     LD    A,#P1
  5181.     CALL    SPACK
  5182.     JP    ABORT
  5183.     ENDM
  5184. ;
  5185. RPACKET    MACRO
  5186.     CALL    RPACK
  5187.     JP    QUIT
  5188.     ENDM
  5189. ;
  5190. NSTATE    MACRO    #P1
  5191.     LD    A,#P1
  5192.     LD    (STATE),A
  5193.     ENDM
  5194. ;
  5195. IFANOT    MACRO    #P1,#P2
  5196.     CP    #P1
  5197.     JR    NZ,#P2
  5198.     ENDM
  5199. ;
  5200. IFALT    MACRO    #P1,#P2
  5201.     CP    #P1
  5202.     JR    C,#P2
  5203.     ENDM
  5204. ;
  5205. IFAGE    MACRO    #P1,#P2
  5206.     CP    #P1
  5207.     JR    NC,#P2
  5208.     ENDM
  5209. ;
  5210. IFA    MACRO    #P1,#P2
  5211.     CP    #P1
  5212.     JR    Z,#P2
  5213.     ENDM
  5214. ;
  5215. IFZ    MACRO    #P1
  5216.     OR    A
  5217.     JR    Z,#P1
  5218.     ENDM
  5219. ;
  5220. GENCASE    MACRO    #P1,#P2
  5221.     LD    A,#P2
  5222.     LD    (FLDLEN),A
  5223.     LD    A,#P1
  5224.     JP    GENCMD
  5225.     ENDM
  5226. ;
  5227. GETHL    MACRO    #P1
  5228.     INC    HL
  5229.     LD    #P1,(HL)
  5230.     ENDM
  5231. ;
  5232. ADDPUT    MACRO    #P1
  5233.     LD    A,(#P1)
  5234.     CALL    TCHPUT
  5235.     ENDM
  5236. ;
  5237. SRPACK    MACRO    #P1
  5238.     LD    A,#P1
  5239.     CALL    SPACK
  5240.     JP    ABORT
  5241.     RPACKET
  5242.     ENDM
  5243. ;
  5244. GETCRCTAB    MACRO
  5245.     LD    C,A
  5246.     LD    HL,CRCTAB
  5247.     ADD    HL,BC
  5248.     ADD    HL,BC
  5249.     ENDM
  5250. ;
  5251. XORATHL    MACRO    #P1
  5252.     LD    A,#P1
  5253.     XOR    (HL)
  5254.     LD    #P1,A
  5255.     ENDM
  5256. ;
  5257. CHKWKEY    MACRO    #P1
  5258.     IFA    #P1,INCHR5
  5259.     ENDM
  5260. ;
  5261. IFNZ    MACRO    #P1
  5262.     OR    A
  5263.     JR    NZ,#P1
  5264.     ENDM
  5265. ;
  5266. SETFLG    MACRO    #P1
  5267.     CALL    ONOFF
  5268.     LD    (#P1),A
  5269.     JP    KERMIT
  5270.     ENDM
  5271. ;
  5272. SHOFFON    MACRO    #P1
  5273.     LD    A,(#P1)
  5274.     CALL    COFFON
  5275.     JP    NEWLIN
  5276.     ENDM
  5277. ;
  5278. FOFFON    MACRO    #P1
  5279.     LD    A,(#P1)
  5280.     CALL    COFFON
  5281.     CALL    NEWLIN
  5282.     ENDM
  5283. ;
  5284. SHRSTAT    MACRO    #P1,#P2
  5285.     FORMAT    #P1,SRSTRLEN
  5286.     LD    A,(#P2)
  5287.     CALL    ANOUT
  5288.     CALL    NEWLIN
  5289.     ENDM
  5290. ;
  5291. SHSSTAT    MACRO    #P1,#P2
  5292.     FORMAT    #P1,SRSTRLEN
  5293.     LD    A,(#P2)
  5294.     CALL    ANOUT
  5295.     CALL    NEWLIN
  5296.     ENDM
  5297. ;
  5298. DOSVC    MACRO    #P1
  5299.     LD    A,#P1
  5300.     RST    28H
  5301.     LD    (XERRNO),A
  5302.     RET
  5303.     ENDM
  5304. ;
  5305. FORMAT    MACRO    #P1,#P2
  5306.     LD    HL,#P2
  5307.     LD    DE,#P1
  5308.     CALL    LEFTPAD
  5309.     ENDM
  5310. ;
  5311. TRLOG    MACRO    #P1,#P2
  5312.     LD    HL,#P1
  5313.     CALL    OUTLOG
  5314.     JP    #P2
  5315.     ENDM
  5316. *LIST    ON
  5317. <<< m4mit.asm >>>
  5318. ;    M4MIT/ASM
  5319. ;
  5320.     ORG    6000H
  5321. ;
  5322. ;    Model 4(p) KERMIT by Gregg Wonderly
  5323. ;
  5324. ;    Version 5.2
  5325. ;
  5326. ;    Version 5.2 adds wild card send capabilities as well as fixes
  5327. ;    to bugs.  M4CHGS/ASM contains a list of the changes made between
  5328. ;    version 5.0, and 5.2.
  5329. ;
  5330. ;    This version is a radically modified and rewritten version
  5331. ;    of the original TRS-80 KERMIT done by Stan Barber.  It has
  5332. ;    numerous features and capabilities beyond that version due
  5333. ;    to differences between the Model 3 and 4.
  5334. ;
  5335. ;    Get the macro definitions first
  5336. ;
  5337. *GET        M4EQU
  5338. *GET        M4MAC
  5339. ;
  5340. ;    Entry point for execution
  5341. ;
  5342. START    LD    (OLDSP),SP    ;Save the current stack pointer for later
  5343.     LD    SP,STACK    ;Set up the stack to our area
  5344.     CALL    XFLAGS        ;Get the flags address in IY
  5345.     LD    (FLAGS),IY    ;Save the flags for later
  5346.     LD    HL,SWTBUF    ;Clear initial connect screen buffer
  5347.     LD    DE,SWTBUF+1
  5348.     LD    BC,1920        ;Byte counter
  5349.     LD    (HL),' '    ;Clear the first character
  5350.     LDIR            ;Copy it to the next
  5351.     LD    B,1        ;Move low memory up above our code.
  5352.     LD    HL,0        ;Select GET option of @HIGH$
  5353.     CALL    XHIGH        ;Get the current LOW$
  5354.     JP    NZ,BADMEM    ;Quit on an error
  5355.     LD    (OLDLOW),HL    ;Save for restore on exit
  5356.     LD    HL,TOPMEM    ;Get the last address used
  5357.     CALL    XHIGH        ;Store it as the new LOW$
  5358.     JP    NZ,BADMEM    ;Quit on an error
  5359.     LD    E,'C'        ;Look for the *CL DCB
  5360.     LD    D,'L'
  5361.     CALL    XGTDCB        ;The address comes back in HL
  5362.     LD    (CLDCB),HL    ;Save the address (May be wrong)
  5363.     JR    NZ,NOCL        ;Now check for error...
  5364.     LD    E,'S'        ;Look for the *SI DCB
  5365.     LD    D,'I'
  5366.     CALL    XGTDCB        ;The address comes back in HL
  5367.     LD    (TMIDCB),HL    ;Store the result
  5368.     JR    NZ,NOSI        ;Skip if NOT found or other error
  5369.     LD    E,'S'        ;Look for the *SO DCB
  5370.     LD    D,'O'
  5371.     CALL    XGTDCB        ;The address comes back in HL
  5372.     LD    (TMODCB),HL    ;Save the address
  5373.     JR    NZ,NOSO        ;Jump if NOT found or other error
  5374.     CALL    SETINT        ;Set up interupt receiver etc
  5375.     XOR    A        ;ZERO A
  5376.     LD    (FCB),A        ;SET FILE CLOSED FLAG
  5377.     CALL    CMBLNK        ;CLEAR THE SCREEN
  5378.     STROUT    INTRO        ;Print the intro message
  5379.     CALL    CHKTAK        ;Check if there is a KERMIT/INI file
  5380.     CALL    KERMIT        ;Start accepting commands.
  5381.     JP    EXIT1        ;If control returns, then exit
  5382. ;
  5383. ;    Error messages printed when devices can not be found or allocated
  5384. ;
  5385. NOCL    LD    DE,CFCL        ;Error message (Can't find *CL DCB)
  5386. PRTOOPS    CALL    PRTSTR        ;Print an OOPS message, and quit
  5387.     JP    EXIT2        ;Finish cleaning up
  5388. ;
  5389. ;    No DCB for the SI device was found
  5390. ;
  5391. NOSI    LD    DE,CFSI        ;Get the message
  5392.     JR    PRTOOPS        ;Go print it
  5393. ;
  5394. ;    No DCB for the SO device was found
  5395. ;
  5396. NOSO    LD    DE,CFSO        ;Get the message
  5397.     JR    PRTOOPS        ;Go print it
  5398. ;
  5399. ;    Bad return code from @HIGH$ call
  5400. ;
  5401. BADMEM    CALL    XERROR0        ;Print a system error message
  5402.     STROUT    NOMEM        ;Print the message
  5403.     JP    XEXIT        ;Exit to TRSDOS
  5404. ;
  5405. ;    CLEAR THE SCREEN, SAVING DE
  5406. ;
  5407. CMBLNK    PUSH    DE        ;Save DE
  5408.     STROUT    CLRTOP        ;Clear the screen
  5409.     POP    DE        ;Restore DE
  5410. QUIT    RET            ;Just a simple return for QUIT
  5411. ;
  5412. ;    KERMIT command processor
  5413. ;    This is where each command originates.
  5414. ;
  5415. KERMIT    LD    SP,STACK    ;Set the stack back
  5416.     LD    DE,FCB        ;Always close an open file
  5417.     LD    A,(DE)        ;Get the flags byte
  5418.     BIT    7,A        ;Is the file still open?
  5419.     CALL    NZ,XCLOSE    ;Close it if it is
  5420.     LD    DE,KERM        ;Get the prompt
  5421.     CALL    PROMPT        ;Display it, and set up the parser
  5422.     LD    DE,COMTAB    ;Get the primary command table
  5423.     LD    A,CMKEY        ;Parse a keyword
  5424.     CALL    COMND        ;Get a command or ERROR
  5425.     JP    KERMT2        ;Abort on ERROR
  5426.     LD    HL,KERMIT    ;Put on a return address for the
  5427.     PUSH    HL        ;FINISH, LOGOUT, and BYE commands.
  5428.     PUSH    HL
  5429.     LD    HL,KERMTB    ;Get the JUMP table for these commands
  5430.     LD    C,A        ;Make BC = A extended to 16 bits
  5431.     LD    B,0        ;high byte is zero, (unsigned)
  5432.     ADD    HL,BC        ;Calculate the effective address
  5433.     JP    (HL)        ;Jump into the jump table
  5434. ;
  5435. ;    Jump table for primary commands
  5436. ;
  5437. KERMTB    JP    REMOTE        ;REMOTE
  5438.     JP    EXIT        ;EXIT
  5439.     JP    CONNECT        ;CONNECT
  5440.     JP    LOG        ;LOG
  5441.     JP    READ        ;RECEIVE
  5442.     JP    SEND        ;SEND
  5443.     JP    SETCOM        ;SET
  5444.     JP    SHOW        ;SHOW
  5445.     JP    STATUS        ;STATUS
  5446.     JP    FINISH        ;FINISH
  5447.     JP    LOGOUT        ;LOGOUT
  5448.     JP    BYE        ;BYE
  5449.     JP    DIR        ;DIRECTORY
  5450.     JP    ERA        ;KILL
  5451.     JP    LOCCOM        ;LOCAL
  5452.     JP    SETCL        ;SETCOM
  5453.     JP    TAKE        ;TAKE
  5454.     JP    INPUT        ;INPUT
  5455.     JP    OUTPUT        ;OUTPUT
  5456.     JP    PAUSE        ;PAUSE
  5457.     JP    PULSE        ;PULSE
  5458.     JP    CLEARC        ;CLEAR
  5459.     JP    CLSFLS        ;CLOSE
  5460.     JP    ECHO        ;Type text to screen
  5461. ;
  5462. ;    Echo text to screen
  5463. ;
  5464. ECHO    EQU    $
  5465.     LD    A,CMTXT        ;Get some text
  5466.     LD    DE,DATA        ;Where to put it
  5467.     PUSH    DE        ;Save for printing
  5468.     CALL    COMND        ;Parse it
  5469.     JP    KERMT3        ;Jump on error
  5470.     POP    HL        ;Get the start
  5471.     LD    C,A        ;Make BC the length that is in A
  5472.     LD    B,0
  5473.     ADD    HL,BC        ;Move to EOS position
  5474.     LD    (HL),EOS    ;Put it in place
  5475.     CALL    NEWLIN        ;Get a new line
  5476.     STROUT    DATA        ;Print the string
  5477.     JP    KERMIT        ;Get a new command
  5478. ;
  5479. ;    CLEAR command.  Services CLEAR INPUT-PORT, and CLEAR SCREEN
  5480. ;
  5481. CLEARC    LD    A,CMKEY        ;GET A KEYWORD
  5482.     LD    DE,CLRTAB    ;FROM THIS TABLE
  5483.     CALL    COMND
  5484.     JP    KERMT2        ;SAY UNRECOGNIZED COMMAND ON AN ERROR
  5485.     LD    (TEMP1),A    ;SAVE THE RETURNED VALUE
  5486.     LD    A,CMCFM
  5487.     CALL    COMND
  5488.     JP    KERMT3
  5489.     LD    A,(TEMP1)
  5490.     LD    C,A
  5491.     IFNZ    CLR010
  5492.     CALL    CLRPRT        ;DO "CLEAR INPUT-PORT"
  5493.     JP    KERMIT        ;GET A NEW COMMAND
  5494. CLR010    CP    3        ;IS IT CLEAR SCREEN?
  5495.     JP    NZ,KERMT2    ;SAY UNRECOGNIZED COMMAND IT NOT
  5496.     CALL    CMBLNK        ;CLEAR THE SCREEN
  5497.     JP    KERMIT        ;GET A NEW COMMAND
  5498. ;
  5499. ;    TAKE commands from a file.  This is basically a HACK that
  5500. ;    initializes some values so that GETSTR reads from the file,
  5501. ;    instead of the keyboard, until EOF is found.
  5502. ;
  5503. TAKE    LD    DE,TFCB        ;WHERE TO PUT THE FILENAME
  5504.     LD    A,CMIFI        ;GET A FILE NAME
  5505.     CALL    COMND        ;GET USER INPUT
  5506.     JP    KERMT3        ;ABORT ON AN ERROR
  5507.     OR    A
  5508.     JP    Z,KERMT3    ;Abort if no name given
  5509.     LD    IY,(FLAGS)    ;GET THE SYSTEM FLAGS
  5510.     SET    0,(IY+18)    ;SET UP FOR NO FILE OPEN BIT
  5511.     LD    HL,TBUF        ;THIS IS THE DATA BUFFER
  5512.     LD    DE,TFCB        ;GET THE FILE FCB
  5513.     LD    B,0        ;256 BYTE LRL
  5514.     CALL    XOPEN        ;TRY TO OPEN THE FILE
  5515.     JR    NZ,TERROR    ;GO REPORT AN ERROR
  5516.     LD    A,1
  5517.     LD    (TAKFLG),A    ;SET THE FLAG
  5518.     JP    KERMIT
  5519. TERROR    CALL    XERROR0        ;PRINT THE MESSAGE
  5520.     XOR    A        ;RESET THE TAKE FLAG
  5521.     LD    (TAKFLG),A
  5522.     JP    KERMIT        ;GET A NEW COMMAND
  5523. ;
  5524. ;    SETCOM command.  We use the TRSDOS SETCOM command here, as it
  5525. ;    saves lots of time and trouble.
  5526. ;
  5527. SETCL    LD    A,CMTXT        ;GET ARBITRARY TEXT
  5528.     LD    DE,CLBUF    ;BUFFER TO PUT DATA INTO
  5529.     CALL    COMND        ;GET THE INPUT
  5530.     JP    KERMT3        ;ABORT ON ERROR
  5531.     CALL    NEWLIN        ;NEED A NEW LINE TO PRINT ON
  5532.     LD    A,CR        ;Get the EOL character
  5533.     LD    (DE),A        ;Put in the terminator
  5534.     LD    HL,CLBUF-7    ;Get the 'SETCOM ' prefix
  5535.     CALL    XCMNDR        ;Let TRSDOS do it for us
  5536.     JP    KERMIT        ;Get a new command, ignoring any errors
  5537. ;
  5538. ;    LOCAL command.  Use @CMNDR to execute a TRSDOS command
  5539. ;
  5540. LOCCOM    LD    HL,(CMDPTR)    ;GET THE ADDRESS OF THE START
  5541. SYST1    LD    A,(HL)        ;GET A CHARACTER
  5542.     INC    HL        ;POINT TO THE NEXT
  5543.     IFA    ' ',SYST1    ;Loop if just a blank
  5544.     IFA    CR,SYST2    ;Do a LIB command if no text given
  5545.     IFANOT    '?',SYST4    ;Go if user not asking for HELP
  5546. SYST2    PUSH    HL        ;SAVE THE ADDRESS TO PASS
  5547.     POP    IY        ;GET A THE ADDRESS IN AN INDEX
  5548.     LD    (IY-1),'L'    ;HL GO INCREMENTED UP THERE
  5549.     LD    (IY),'I'    ;SPELLING OUT LIB
  5550.     LD    (IY+1),'B'
  5551.     LD    (IY+2),CR    ;ADD THE TERMINATOR
  5552. SYST4    DEC    HL        ;POINT TO THE ACTUAL ADDRESS
  5553.     CALL    NEWLIN    ;NEED A NEW LINE
  5554. ;
  5555. ;    Remove the comments below to force LOCAL to process only library
  5556. ;    commands
  5557. ;
  5558. ;    LD    IY,(FLAGS)    ;Get the Flags pointer
  5559. ;    SET    4,(IY+2)    ;Only library commands are allowed
  5560.     CALL    XCMNDR        ;Do a system command
  5561. SYST5    JP    KERMIT        ;IGNORE ANY ERRORS
  5562. ;
  5563. ;    Print UNRECOGNIZED COMMAND message
  5564. ;
  5565. KERMT2    STROUT    ERMES1        ;Issue the message
  5566.     JP    KERMIT
  5567. ;
  5568. ;    Print NOT CONFIRMED message
  5569. ;
  5570. KERMT3    STROUT    ERMES3        ;Issue the message
  5571.     JP    KERMIT
  5572. ;
  5573. ;    Exit to TRSDOS
  5574. ;
  5575. EXIT    LD    A,CMCFM        ;Get a confirmation of the EXIT
  5576.     CALL    COMND
  5577.     JP    KERMT3
  5578. EXIT1    LD    DE,FCB        ;Check the file FCB, and close if needed
  5579.     LD    A,(DE)        ;Get the info byte
  5580.     BIT    7,A        ;Check the file open BIT
  5581.     CALL    NZ,XCLOSE    ;Close it if needed
  5582. ;
  5583. ;    Check the log files to make sure they are closed
  5584. ;
  5585.     LD    DE,LFCB        ;Get the file FCB
  5586.     LD    A,(LOGFLG)    ;Check if logging active
  5587.     OR    A        ;Check the flags
  5588.     CALL    NZ,XCLOSE    ;Close the file if open
  5589.     LD    DE,DFCB        ;Check debugging
  5590.     LD    A,(DEBLOG)    ;Get the flag
  5591.     OR    A
  5592.     CALL    NZ,XCLOSE    ;Close it if open
  5593.     LD    DE,TFCB        ;Get the FCB
  5594.     LD    A,(TRANLOG)    ;Get the flag
  5595.     OR    A
  5596.     CALL    NZ,XCLOSE    ;Close it if open
  5597. ;
  5598. ;    Now reset the interrupt vector for *CL.
  5599. ;
  5600.     LD    C,4        ;Interrupts option of the @CTL SVC
  5601.     LD    IY,0        ;Reset the INTERRUPT vector of *CL
  5602.     LD    DE,(CLDCB)    ;Get the *CL DCB address
  5603.     CALL    XCTL        ;Use @CTL to do it
  5604.     CALL    CMBLNK        ;Clear the screen
  5605. EXIT2    LD    HL,(OLDLOW)    ;Get the old low memory pointer
  5606.     LD    B,1        ;Set B to indicate LOW$
  5607.     CALL    XHIGH        ;Move the value back
  5608. ;
  5609. ;    Now fill the *FO, and *FI devices DCB's with zeros.  This
  5610. ;    will make the devices no longer available.
  5611. ;
  5612.     LD    HL,(FINDCB)    ;Get the *FI DCB address
  5613.     CALL    ZERO8        ;Fill it with zeroes
  5614.     LD    HL,(FOTDCB)    ;Do the same for *FO
  5615.     CALL    ZERO8        ;Fill DCB with zeroes
  5616.     CALL    STOPTIMER    ;Stop the timer if still running
  5617.     LD    SP,(OLDSP)    ;Restore the old STACK pointer
  5618.     LD    HL,0        ;Set OK exit
  5619.     LD    IY,(FLAGS)    ;If JCL active, then just return
  5620.     BIT    5,(IY+18)    ;Check the BIT
  5621.     RET    NZ        ;Return if BIT is set
  5622.     JP    XEXIT        ;Exit via @EXIT
  5623. ;
  5624. ;    Zero 8 bytes pointed to by HL
  5625. ;
  5626. ZERO8    LD    B,8        ;Get the byte count
  5627. ZERO8_1    LD    (HL),0        ;Zap one byte
  5628.     INC    HL        ;Point to next
  5629.     DJNZ    ZERO8_1        ;Loop until done
  5630.     RET
  5631. ;
  5632. ;    CALL ERROR    Prints the DATA area on a new line, and sets
  5633. ;            the state to ABORT.
  5634. ;    CALL ERROR1    Prints the DATA area on a new line.
  5635. ;    CALL ERROR2    Prints the DATA area on the same line
  5636. ;    CALL ERROR3    Prints the string pointed to by DE on a new line
  5637. ;    CALL ERRORD    Prints a system error message corresponding to
  5638. ;            A, providing A is none zero.
  5639. ;
  5640. ERROR    NSTATE    'A'        ;Set the state to abort
  5641. ;
  5642. ERROR1    CALL    NEWLIN        ;Get a new line
  5643. ;
  5644. ERROR2    LD    A,(ARGBLK+1)    ;Get the length of the data
  5645.     LD    C,A        ;Put the length into BC
  5646.     LD    B,0
  5647.     LD    HL,DATA        ;Get the start of the DATA area
  5648.     PUSH    HL        ;Save it
  5649.     LD    A,EOS        ;Add EOS for printing
  5650.     CALL    PUTTRN
  5651.     POP    DE        ;Get start back
  5652.     JP    PRTSTR        ;Print the string, and return
  5653. ;
  5654. ERROR3    PUSH    DE        ;Save the message
  5655.     CALL    NEWLIN        ;Get a new line
  5656.     POP    DE        ;Restore the message
  5657.     JP    PRTSTR        ;Print error message
  5658. ;
  5659. ERRORD    OR    A        ;Display system error message
  5660.     RET    Z        ;IFF an error has occured
  5661.     JP    XERROR0        ;Do system error
  5662. ;
  5663. ;    Print the string in DE, followed by a new line
  5664. ;
  5665. FINMES    CALL    PRTSTR        ;Print the message
  5666.     JP    NEWLIN        ;Get a newline and return
  5667. ;
  5668. ;    The FINISH, BYE, and LOGOUT commands all need a return address
  5669. ;    on the stack.  This is because the CHKTRYS routine will use it
  5670. ;    to abort the packet operations when MAXTRY retries are reached.
  5671. ;
  5672. ;    This is the FINISH command.
  5673. ;
  5674. FINISH    LD    A,CMCFM
  5675.     CALL    COMND        ;GET A CONFIRM.
  5676.     JP    KERMT3
  5677.     CALL    NEWLIN
  5678.     CALL    CLRPRT        ;CLEAR ANY STACKED NAKS
  5679.     XOR    A        ;DIDN'T GET A CONFIRM.
  5680.     LD    (NUMTRY),A    ;INITITIALIZE COUNT.
  5681.     LD    A,'1'        ;Set block check to single char
  5682.     LD    (CURCHK),A    ;. . .
  5683. FINSH1    CALL    CHKTRYS        ;Check the retry threshold
  5684.     XOR    A
  5685.     LD    (ARGBLK),A    ;MAKE IT PACKET NUMBER ZERO.
  5686.     LD    A,1
  5687.     LD    (ARGBLK+1),A    ;ONE PIECE OF DATA.
  5688.     LD    HL,DATA
  5689.     LD    (HL),'F'    ;FINISH RUNNING KERMIT.
  5690.     LD    A,'G'        ;GENERIC COMMAND PACKET.
  5691.     CALL    SPACK        ;Send the packet
  5692.     JP    FINSH1        ;On fail, try again
  5693.     CALL    RPACK         ;GET AN ACKNOWLEDGEMENT.
  5694.     JP    FINSH1        ;On fail, try again
  5695.     CP    'Y'        ;ACK?
  5696.     JP    Z,KERMIT    ;YES, WE ARE DONE.
  5697.     IFANOT    'E',FINSH2    ;Jump if not error packet
  5698.     CALL    ERROR1        ;PRINT THE ERROR MESSAGE.
  5699.     JP    KERMIT
  5700. FINSH2    CP    'N'        ;Is this a NAK?
  5701.     CALL    NZ,CONOUT    ;Output the packet type to term
  5702.     JR    FINSH1        ;Resend the packet
  5703. ;
  5704. ;    This is the LOGOUT command.
  5705. ;
  5706. LOGOUT    LD    A,CMCFM
  5707.     CALL    COMND        ;GET A CONFIRM.
  5708.     JP    KERMT3
  5709.     CALL    NEWLIN
  5710.     CALL    LOGO        ;SEND THE LOGOUT PACKET.
  5711.     JP    LOG111        ;GO GET ANOTHER COMMAND
  5712.     JP    KERMIT        ;WHETHER WE SUCCEED OR NOT.
  5713. LOGO    XOR    A
  5714.     LD    (NUMTRY),A    ;INITITIALIZE COUNT.
  5715.     CALL    CLRPRT        ;CLEAR ANY STACKED NAKS
  5716.     LD    A,'1'        ;Block check type to single
  5717.     LD    (CURCHK),A    ;. . .
  5718. LOGO1    CALL    CHKTRYS        ;Check retry threshold
  5719.     XOR    A
  5720.     LD    (ARGBLK),A    ;MAKE IT PACKET NUMBER ZERO.
  5721.     LD    A,1
  5722.     LD    (ARGBLK+1),A    ;ONE PIECE OF DATA.
  5723.     LD    HL,DATA
  5724.     LD    (HL),'L'    ;LOGOUT THE REMOTE HOST.
  5725.     LD    A,'G'        ;GENERIC COMMAND PACKET.
  5726.     CALL    SPACK
  5727.     JP    LOGO3
  5728.     CALL    RPACK        ;GET AN ACKNOWLEDGEMENT
  5729.     JP    LOGO1
  5730.     CP    'Y'        ;ACK?
  5731.     JP    Z,RSKP        ;YES, WE ARE DONE.
  5732.     CP    'E'        ;IS IT AN ERROR PACKET?
  5733.     JP    Z,ERROR1    ;Print the error message
  5734. LOGO2    CP    'N'
  5735.     CALL    NZ,CONOUT
  5736.     JR    LOGO1
  5737. ;
  5738. LOGO3    LD    DE,ERMS19    ;Get the message
  5739.     JP    PRTSTR        ;Print it
  5740. ;
  5741. ;    This is the BYE command
  5742. ;
  5743. BYE    EQU    $
  5744.     LD    A,CMCFM
  5745.     CALL    COMND        ;GET A CONFIRM.
  5746.     JP    KERMT3
  5747.     CALL    NEWLIN
  5748.     CALL    LOGO        ;TELL THE MAIN FRAME TO LOGOUT.
  5749.     JP    LOG111        ;IF IT FAILS, DON'T EXIT.
  5750.     JP    EXIT1        ;EXIT KERMIT.
  5751. LOG111    CALL    NEWLIN        ;GET A NEW LINE
  5752.     JP    KERMIT
  5753. ;
  5754. ;    Get the rest of the modules
  5755. ;
  5756. *GET    M4FILE/ASM    ;Log file code
  5757. *GET     M4CMD/ASM    ;Command parser
  5758. *GET    M4SET/ASM    ;Set command processing
  5759. *GET    M4TERM/ASM    ;Terminal emulation
  5760. *GET    M4SHOW/ASM    ;Show command processing
  5761. *GET    M4PKT/ASM    ;Additional packet stuff
  5762. *GET    M4GET/ASM    ;Receive protocol
  5763. *GET    M4SEND/ASM    ;Send protocol
  5764. *GET    M4XFER/ASM    ;Protocol common code
  5765. *GET    M4ADD/ASM    ;TRSDOS SVC's and other system dependent stuff
  5766. *GET    M4RMT/ASM    ;Remote commands
  5767. *GET    M4KEY/ASM    ;Set key code
  5768. *GET    M4LOG/ASM    ;Input, Output, Pause, Pulse commands
  5769. *GET    M4WILD/ASM    ;Wild carding
  5770. *GET     M4STR/ASM    ;Strings and storage
  5771. TOPMEM    EQU    $+10    ;A little padding
  5772.     END    START
  5773. ;end of file
  5774. <<< m4pkt.asm >>>
  5775. ;    m4pkt/asm
  5776. ;
  5777. ;    Most of the code in this file was derived directly from
  5778. ;    the C-KERMIT program.  The code here represents a line by
  5779. ;    line translation of the C-KERMIT code.
  5780. ;
  5781. MEMSTR    DW    0
  5782. MAXSIZE    DB    0
  5783. ;
  5784. ;    Encode a packet from memory contents instead of from a file
  5785. ;
  5786. ENCSTR    EQU    $
  5787.     PUSH    HL        ;Save the registers
  5788.     PUSH    BC
  5789.     PUSH    DE
  5790.     LD    (MEMSTR),HL    ;Store the passed pointer
  5791.     CALL    RSETPKT        ;Reinitiaize GETPKT() parameters
  5792.     CALL    GETPKT        ;Get a packet
  5793.     LD    HL,0        ;Reset the memory pointer
  5794.     LD    (MEMSTR),HL
  5795.     POP    DE        ;Restore the registers
  5796.     POP    BC
  5797.     POP    HL
  5798.     RET            ;Return to the caller
  5799. ;
  5800. ;    Get a packet worth of data from the FILE indicated by the global
  5801. ;    FCB.  Eighth bit quoting, and Repeat count prefixing are done
  5802. ;    as indicated by the status of EBQFLAG, and RPTFLG respectively.
  5803. ;
  5804. GETPKT    EQU    $
  5805.     PUSH    BC        ;Save the registers
  5806.     PUSH    DE
  5807.     PUSH    HL
  5808.     LD    A,(CURCHK)    ;Calculate the size of a packet
  5809.     SUB    '1'
  5810.     LD    B,A
  5811.     LD    A,(SPSIZ)    ;Get the user specified size
  5812.     SUB    5        ;Minus the overhead
  5813.     SUB    B
  5814.     LD    (MAXSIZE),A    ;Save it for later use
  5815.     LD    HL,(NEXT)    ;Get the next character, 16 bits
  5816.     LD    BC,0        ;Subtract zero to set flags
  5817.     OR    A        ;Reset the carry flag
  5818.     SBC    HL,BC        ;Set the flags
  5819.     JP    P,GETPKT1
  5820.     CALL    GETCH        ;Get a character if no previous exists
  5821.     LD    (CH),HL        ;Save it
  5822. GETPKT1    EQU    $
  5823.     LD    BC,0        ;Copy leftovers from previous call
  5824. GETPKT2    EQU    $
  5825.     LD    HL,LEFTOVER    ;Get the start
  5826.     ADD    HL,BC        ;Index by BC
  5827.     LD    A,(HL)        ;Get a byte
  5828.     LD    HL,FILBUF    ;Get the destination
  5829.     ADD    HL,BC        ;Index by BC
  5830.     LD    (HL),A        ;Put a byte
  5831.     IFZ    GETPKT3        ;Exit loop if zero byte found
  5832.     INC    C        ;Point to next
  5833.     JR    GETPKT2        ;Loop on
  5834. GETPKT3    EQU    $
  5835.     LD    A,C        ;Save the initial size of leftovers
  5836.     LD    (SIZE),A
  5837.     XOR    A        ;Nullify the string for next time
  5838.     LD    (LEFTOVER),A
  5839. GETPKT4    EQU    $
  5840.     LD    HL,(CH)        ;Get the character
  5841.     LD    BC,0        ;Subtract zero to set the flags
  5842.     OR    A
  5843.     SBC    HL,BC
  5844.     JP    M,GETPKT20    ;Jump at end of file
  5845.     CALL    GETCH        ;Get the next character
  5846.     LD    (NEXT),HL    ;Save it
  5847.     LD    A,(SIZE)    ;Get the current size
  5848.     LD    (OSIZE),A    ;Save it in case we overflow the packet
  5849.     LD    C,A        ;Make BC a 16 bit value of C
  5850.     LD    B,0
  5851.     LD    HL,FILBUF    ;Get the desination buffer
  5852.     ADD    HL,BC        ;Index by BC
  5853.     LD    (CBFPTR),HL    ;Save the buffer pointer
  5854.     LD    HL,(CH)        ;Get the character
  5855.     LD    A,L        ;Keep only 8 bits
  5856.     CALL    ENCODE        ;Encode it and store the result
  5857.     LD    HL,(CBFPTR)    ;Compute the new size
  5858.     LD    BC,FILBUF    ;Get the start
  5859.     OR    A        ;Reset carry
  5860.     SBC    HL,BC        ;Compute lenght
  5861.     LD    A,L        ;Keep only 8 bits
  5862.     LD    (SIZE),A    ;Store the result
  5863.     LD    HL,(NEXT)    ;Get the next character
  5864.     LD    (CH),HL        ;Store it as the current character
  5865.     LD    A,(SIZE)    ;Get the size and check the size
  5866.     LD    C,A
  5867.     LD    A,(MAXSIZE)    ;Get the maximum length
  5868.     CP    C        ;Are they equal?
  5869.     JP    Z,GETPKT20    ;Go return SIZE if equal
  5870.     JP    P,GETPKT13    ;Jump if maxsize still bigger
  5871.     LD    BC,0        ;Start from the beginning
  5872. GETPKT11    EQU    $
  5873.     LD    A,(OSIZE)    ;Get the oldsize index
  5874.     PUSH    BC        ;Save the value of i
  5875.     ADD    A,C        ;Compute osize+i
  5876.     LD    C,A        ;Save the result
  5877.     LD    HL,FILBUF    ;Get the start of the buffer
  5878.     ADD    HL,BC        ;Compute &filbuf[osize+i]
  5879.     LD    A,(HL)        ;Get the character stored there
  5880.     POP    BC        ;Restore i
  5881.     LD    HL,LEFTOVER    ;Get the address of the leftover buffer
  5882.     ADD    HL,BC        ;Compute the absolute address
  5883.     LD    (HL),A        ;Store the byte
  5884.     OR    A        ;Check the value for zero
  5885.     JR    Z,GETPKT12    ;Jump if end of string
  5886.     INC    C        ;Compute i++
  5887.     JR    GETPKT11    ;Go to the top of the loop
  5888. GETPKT12    EQU    $
  5889.     LD    A,(OSIZE)    ;Store the new pointer
  5890.     LD    (SIZE),A
  5891.     LD    C,A        ;Terminate the string with a NULL
  5892.     LD    B,0        ;Get a 16 bit offset
  5893.     LD    HL,FILBUF    ;Get the starting address
  5894.     ADD    HL,BC        ;Compute the address
  5895.     LD    (HL),0        ;Put in the NULL
  5896.     JP    GETPKT20    ;Go to the return code
  5897. GETPKT13    EQU    $
  5898.     JP    GETPKT4
  5899. GETPKT20    EQU    $
  5900.     LD    A,(SIZE)    ;Get the size to return
  5901.     POP    HL        ;Restore the registers
  5902.     POP    DE
  5903.     POP    BC
  5904.     RET
  5905. ;
  5906. ;    Encode the character in the Accumlator and put it into
  5907. ;    the packet buffer at CBFPTR.
  5908. ;
  5909. ENCODE    EQU    $
  5910.     PUSH    BC        ;Save the regs
  5911.     PUSH    DE
  5912.     PUSH    HL
  5913.     LD    C,A        ;Save the character to encode
  5914.     LD    A,(RPTFLG)    ;Is repeat quoting in effect?
  5915.     OR    A
  5916.     JP    Z,ENCODE30
  5917.     LD    HL,(NEXT)    ;Get the last character
  5918.     LD    A,L
  5919.     IFANOT    C,ENCODE3
  5920.     LD    A,(RPTCNT)    ;Get the current repeat count
  5921.     INC    A        ;Add one to it
  5922.     LD    (RPTCNT),A    ;Store it back
  5923.     CP    94        ;Too many characters?
  5924.     JP    M,ENCODE50
  5925.     LD    A,(RPTQ)
  5926.     CALL    PUTCBF
  5927.     LD    A,(RPTCNT)
  5928.     TOCHAR
  5929.     CALL    PUTCBF
  5930.     XOR    A
  5931.     LD    (RPTCNT),A
  5932.     JP    ENCODE30
  5933. ENCODE3    EQU    $
  5934.     LD    A,(RPTCNT)
  5935.     IFANOT    1,ENCODE7
  5936.     XOR    A
  5937.     LD    (RPTCNT),A
  5938.     LD    A,C        ;Get the character back
  5939.     CALL    ENCODE        ;Encode it again
  5940.     LD    HL,(CBFPTR)    ;Get the buffer pointer
  5941.     LD    DE,FILBUF    ;Get the start of the buffer
  5942.     OR    A        ;Reset the carry
  5943.     SBC    HL,DE        ;Compute the difference    in L
  5944.     LD    A,(MAXSIZE)    ;Get MAXSIZE
  5945.     CP    L        ;Is L <= A?
  5946.     JP    M,ENCODE6
  5947.     LD    A,L        ;Get SIZE
  5948.     LD    (OSIZE),A    ;Store it in the old size
  5949. ENCODE6    EQU    $
  5950.     XOR    A
  5951.     LD    (RPTCNT),A
  5952.     LD    A,C        ;Get the character back
  5953.     CALL    ENCODE        ;Encode it
  5954.     JP    ENCODE50
  5955. ENCODE7    EQU    $
  5956.     LD    A,(RPTCNT)
  5957.     CP    2
  5958.     JP    M,ENCODE10
  5959.     LD    A,(RPTQ)
  5960.     CALL    PUTCBF
  5961.     LD    A,(RPTCNT)    ;Get the count
  5962.     ADD    A,' '+1        ;Uncontrolify it
  5963.     CALL    PUTCBF
  5964.     XOR    A
  5965.     LD    (RPTCNT),A
  5966. ENCODE10    EQU    $
  5967. ENCODE30    EQU    $
  5968.     LD    A,C        ;Get the character
  5969.     AND    127        ;Turn off high bit
  5970.     LD    B,A        ;Save it
  5971.     LD    A,C        ;Get the character
  5972.     AND    128        ;Leave only high bit
  5973.     LD    D,A        ;Save it
  5974.     IFZ    ENCODE32
  5975.     LD    A,(EBQFLG)
  5976.     IFZ    ENCODE32
  5977.     LD    A,(EBQ)
  5978.     CALL    PUTCBF
  5979.     LD    C,B        ;Save only 7 bit version
  5980. ENCODE32    EQU    $
  5981.     LD    A,C        ;Get all bits for check
  5982.     IFA    127,ENCODE33
  5983.     IFAGE    ' ',ENCODE34
  5984. ENCODE33    EQU    $
  5985.     LD    A,(MYCTLQ)
  5986.     CALL    PUTCBF
  5987.     LD    A,C        ;Get the character
  5988.     ADD    A,64        ;Uncontrolify it
  5989.     AND    127        ;Keep only 7 bits
  5990.     LD    C,A        ;Save the new value
  5991. ENCODE34    EQU    $
  5992.     LD    HL,(CBFPTR)    ;Do this ahead to save overhead
  5993.     LD    A,(MYCTLQ)
  5994.     IFANOT    B,ENCODE35
  5995.     PUTHL    A        ;Store the byte
  5996. ENCODE35    EQU    $
  5997.     LD    A,(RPTFLG)
  5998.     IFZ    ENCODE36
  5999.     LD    A,(RPTQ)
  6000.     IFANOT    B,ENCODE36
  6001.     LD    A,(MYCTLQ)
  6002.     PUTHL    A
  6003. ENCODE36    EQU    $
  6004.     LD    A,(EBQFLG)
  6005.     IFZ    ENCODE37
  6006.     LD    A,(EBQ)
  6007.     IFANOT    B,ENCODE37
  6008.     LD    A,(MYCTLQ)
  6009.     PUTHL    A
  6010. ENCODE37    EQU    $
  6011.     PUTHL    C
  6012.     LD    (CBFPTR),HL
  6013.     LD    (HL),0
  6014. ENCODE50    EQU    $
  6015.     POP    HL        ;Restore the stack
  6016.     POP    DE
  6017.     POP    BC
  6018.     RET
  6019. ;
  6020. ;    Decode the contents of the packet, and output them using
  6021. ;    the function whose address is passed in HL
  6022. ;
  6023. DECODE    LD    (OUTADDR),HL    ;Save the output function
  6024.     PUSH    BC        ;Save the registers that we use
  6025.     PUSH    DE
  6026.     PUSH    HL
  6027.     LD    HL,DATA        ;Get the buffer address
  6028.     LD    (DATPTR),HL    ;Set the address
  6029.     LD    C,A        ;Get the length
  6030.     LD    B,0        ;Make it 16 bits
  6031.     PUSH    HL        ;Save DATPTR
  6032.     ADD    HL,BC        ;Compute the end of the packet
  6033.     LD    (HL),0        ;Put in the NULL byte
  6034.     POP    HL        ;Get DATPTR back
  6035. DECODE0    LD    A,1        ;Set the repeat count
  6036.     LD    (RPTCNT),A
  6037.     LD    A,(HL)        ;Get a character
  6038.     INC    HL        ;Point to the next
  6039.     LD    C,A        ;Store the value
  6040.     OR    A        ;Is it NULL?
  6041.     JP    Z,DECODE40    ;Quit the loop if it is
  6042.     LD    A,(RPTFLG)    ;Is repeat prefixing on?
  6043.     IFZ    DECODE1
  6044.     LD    A,(RPTQ)    ;Get the quote character
  6045.     IFANOT    C,DECODE1
  6046.     LD    A,(HL)        ;Get the count + 32
  6047.     SUB    ' '        ;Make it the real count
  6048.     INC    HL        ;Point to next character
  6049.     LD    (RPTCNT),A    ;Save the repeat count
  6050.     LD    A,(HL)        ;Get a character
  6051.     INC    HL        ;Point to the next
  6052.     LD    C,A        ;Save the character
  6053. DECODE1    XOR    A        ;Set the initial eighth bit as ZERO
  6054.     LD    D,A
  6055.     LD    A,(EBQFLG)    ;Is eighth bit quoting on?
  6056.     IFZ    DECODE2
  6057.     LD    A,(EBQ)        ;Get the eighth bit quote character
  6058.     IFANOT    C,DECODE2
  6059.     LD    D,128        ;Get an eighth bit
  6060.     LD    A,(HL)        ;Get a character
  6061.     INC    HL        ;Point to the next
  6062.     LD    C,A        ;Save the character
  6063. DECODE2    LD    A,(MYCTLQ)    ;Get the control character quote
  6064.     IFANOT    C,DECODE5
  6065.     LD    A,(HL)        ;Get a character
  6066.     INC    HL        ;Point to the next
  6067.     LD    C,A        ;Save the character
  6068.     AND    127        ;Keep 7 bits
  6069.     LD    E,A        ;Save only 7 bits worth
  6070.     LD    A,E        ;Check lower bound of controls
  6071.     CP    '@'
  6072.     JP    M,DECODE3    ;Jump if less than
  6073.     CP    96        ;Check upper bound of controls
  6074.     JP    M,DECODE4
  6075. DECODE3    IFANOT    '?',DECODE5
  6076. DECODE4    LD    A,C        ;Get the character
  6077.     SUB    64        ;Subtract 64 to uncontrolify it
  6078.     AND    127
  6079.     LD    C,A        ;Save the new value
  6080. DECODE5    LD    A,D        ;Get the eighth bit
  6081.     OR    C        ;Or in the character
  6082.     LD    C,A        ;Save the new value
  6083.     LD    A,(RPTCNT)    ;Get the repeat count
  6084.     LD    B,A        ;Get it into the counter
  6085. DECODE8    LD    IX,RTRANS    ;Get the pointer
  6086.     CALL    INCKTRANS    ;Increment character counts
  6087.     LD    A,C        ;Get the character
  6088.     CALL    PUTCH
  6089.     JR    NZ,DECODE50
  6090.     DJNZ    DECODE8        ;Loop until done
  6091.     JP    DECODE0
  6092. DECODE40    EQU    $
  6093.     POP    HL        ;Restore the stack
  6094.     POP    DE
  6095.     POP    BC
  6096.     RET
  6097. DECODE50    EQU    $
  6098.     CALL    XERROR0        ;Print a system error message
  6099.     LD    A,1        ;Set NZ status for return
  6100.     OR    A
  6101.     JR    DECODE40    ;Join the exit code
  6102. ;
  6103. ;    Get the next character from the input file.  We translate CR to
  6104. ;    CRLF, for ASCII files.  Returns with (EOFLAG) set to 0FFH at end
  6105. ;    of file.  The character retrieved is in HL.  HL will be 16bits
  6106. ;    of -1 and EOF, but will otherwise only be 8bits wide.  H in this
  6107. ;    case will always be 0, and L will hold the character.
  6108. ;
  6109. GETCH    LD    A,(FILTYPE)    ;Check for binary mode
  6110.     OR    A        ;Set the flags
  6111.     JR    NZ,GETCH1    ;Jump if it is binary
  6112.     LD    A,(PREVCH)    ;Get the previous character
  6113.     IFANOT    CR,GETCH1
  6114.     LD    A,10        ;Get a LF character
  6115.     LD    (PREVCH),A    ;Reset the previous character
  6116.     LD    L,A        ;Put it into HL
  6117.     LD    H,0
  6118.     RET            ;Return to the caller
  6119. GETCH1    EQU    $
  6120.     LD    HL,(MEMSTR)
  6121.     LD    A,H
  6122.     OR    L
  6123.     JR    Z,GETCH2
  6124.     LD    A,(HL)
  6125.     INC    HL
  6126.     LD    (MEMSTR),HL
  6127.     IFZ    GETCH4
  6128.     JR    GETCH3
  6129. GETCH2    EQU    $
  6130.     LD    DE,FCB        ;Get the File Control Block
  6131.     CALL    XGET        ;Get a character into A
  6132.     JR    NZ,GETCH4    ;Jump to EOF on error
  6133.     LD    IX,STRANS    ;Get the pointer
  6134.     CALL    INCKTRANS    ;Increment the character count
  6135. GETCH3    EQU    $
  6136.     LD    (PREVCH),A    ;Set the previous character
  6137.     LD    L,A        ;Put it into HL
  6138.     LD    H,0
  6139.     RET            ;Return
  6140. GETCH4    EQU    $
  6141.     LD    A,0FFH        ;Set the EOF flag
  6142.     LD    (EOFLAG),A
  6143.     LD    (PREVCH),A    ;Reset the previous character flag
  6144.     LD    L,A        ;Make HL 16bits wide -1
  6145.     LD    H,A
  6146.     RET            ;Return to caller
  6147. ;
  6148. ;    Put the next character to the output file.  We convert CRLF to CR
  6149. ;    IFF X packets are not active, and binary mode is not active
  6150. ;
  6151. PUTCH    PUSH    HL
  6152.     PUSH    BC        ;Save the register
  6153.     LD    C,A        ;Save the character to output
  6154.     LD    A,(PREVCH)    ;Get the previous character
  6155.     IFANOT    CR,PUTCH1
  6156.     LD    A,(DISFLG)    ;Check if we are doing X packets
  6157.     IFZ    PUTCH1
  6158.     LD    A,(FILTYPE)    ;Doing D packets, so check file mode
  6159.     OR    A
  6160.     JR    NZ,PUTCH1
  6161.     LD    A,C
  6162.     IFA    10,PUTCH2
  6163. PUTCH1    LD    A,C        ;Get the character to output
  6164.     LD    (PREVCH),A    ;Make it the new previous
  6165.     LD    HL,(OUTADDR)    ;Get the output routines address
  6166.     CALL    CALLHL        ;Call the output routine
  6167. PUTCH2    POP    BC        ;Restore the stack
  6168.     POP    HL
  6169.     RET            ;Return to caller
  6170. ;
  6171. ;    Put A into the location pointed to by CBFPTR, and increment the
  6172. ;    pointer to point to the next location
  6173. ;
  6174. PUTCBF    LD    HL,(CBFPTR)    ;Get the pointer
  6175.     PUTHL    A
  6176.     LD    (CBFPTR),HL    ;Store the new pointer value
  6177.     RET            ;Return
  6178. ;end of file
  6179. <<< m4rmt.asm >>>
  6180. ;    M4RMT/ASM
  6181. ;    REMOTE KERMIT COMMAND
  6182. REMOTE    LD    A,CMKEY
  6183.     LD    DE,RMTTAB
  6184.     CALL    COMND
  6185.     JP    KERMT2
  6186.     LD    C,A        ;SAVE THE TYPE
  6187.     CALL    NEWLIN
  6188.     LD    B,0
  6189.     LD    HL,RMTJTB    ;GET THE JUMP TABLE
  6190.     ADD    HL,BC        ;COMPUTE THE ADDRESS
  6191.     LD    A,'G'
  6192.     LD    (PKTTYPE),A    ;Set to generic packet
  6193.     JP    (HL)
  6194. ;    REMOTE COMMAND JUMP TABLE
  6195. RMTJTB    JP    RMTCWD        ;CHANGE WORKING DIRECTORIES
  6196.     JP    RMTDEL        ;DELETE A FILE
  6197.     JP    RMTDIR        ;DISPLAY A DIRECTORY
  6198.     JP    RMTDSK        ;DO A REMOTE DISK ALLOCATION
  6199.     JP    RMTHLP        ;GET REMOTE HELP
  6200.     JP    RMTHST        ;DO REMOTE HOST COMMAND
  6201.     JP    RMTKER        ;DO REMOTE KERMIT COMMAND
  6202.     JP    RMTWHO        ;RUN A REMOTE PROGRAM
  6203.     JP    RMTREN        ;SEND DATA TO A REMOTE PROGRAM
  6204.     JP    RMTTYPE        ;DISPLAY A REMOTE FILE
  6205.     JP    RMTCOPY        ;Copy a file
  6206.     JP    RMTMSG        ;Send a message
  6207.     JP    RMTSET        ;Set a variable
  6208.     JP    RMTQUERY    ;Query a variable
  6209.     JP    RMTCLOSE    ;Close the log
  6210.     JP    RMTSEND        ;Send the log
  6211.     JP    RMTSTART    ;Start logging
  6212.     JP    RMTSTOP        ;Stop logging
  6213.     JP    RMTLOGIN    ;Login to dedicated server
  6214.     JP    RMTPRG        ;Remote program manipulation
  6215.     JP    RMTSRV        ;Remote server status query
  6216. ;
  6217. ;    DO A GENERIC REMOTE COMMAND
  6218. ;
  6219. GENCMD    LD    DE,RMTDATA    ;Set the initial destination
  6220.     LD    B,0        ;Set the initial counters
  6221.     LD    (GENTYPE),A    ;Save the type
  6222.     IFA    'J',GENCMD1    ;Jump if journaling
  6223.     IFANOT    'V',GENCMD2    ;Jump if not variable
  6224. GENCMD1    LD    A,C        ;Get the second attribute
  6225.     LD    (DE),A        ;Store it
  6226.     INC    DE        ;Point ahead
  6227.     INC    B        ;Plus one for the extra attribute
  6228. GENCMD2    LD    C,0        ;Reset the beginning field length
  6229. GENCMD3    LD    (INITRMT),DE    ;Save the values
  6230.     LD    (INITCNT),BC
  6231.     CALL    ENCFLDS        ;Get the input fields
  6232. GENCMD5    LD    A,'1'        ;SET CURRENT CHECK SUM
  6233.     LD    (CURCHK),A
  6234.     XOR    A        ;Set the packet number to zero
  6235.     LD    (ARGBLK),A
  6236.     NSTATE    'I'        ;Set the state to I-initiate
  6237.     CALL    INIT        ;Initialize buffers
  6238.     LD    HL,0        ;Set packet count to zero
  6239.     LD    (NUMPKT),HL
  6240.     LD    (NUMRTR),HL    ;Reset number of retries
  6241.     XOR    A        ;Set mode to display on screen
  6242.     LD    (DISFLG),A
  6243.     LD    (PKTNUM),A    ;Zero current packet number
  6244.     LD    (NUMTRY),A    ;Zero retries for current packet
  6245.     LD    (CZSEEN),A
  6246.     CALL    CLRPRT
  6247.     CALL    PROTO
  6248.     JP    KERMIT
  6249. ;
  6250. ;    State G of the protocol.   Build a G or C packet, and send it
  6251. ;
  6252. DOGEN    EQU    $
  6253.     CALL    CHKTRYS        ;Check the retry count
  6254.     LD    A,(PKTNUM)    ;Set the packet number to current
  6255.     LD    (ARGBLK),A
  6256.     LD    HL,FILBUF    ;Transfer data to the buffer
  6257.     LD    DE,DATA        ;Get the DATA area
  6258.     LD    A,(PKTTYPE)    ;Get the requested type, 'G' or 'C'
  6259.     IFA    'C',DOGEN6    ;If COMMAND then jump
  6260.     INC    DE        ;Point to data+1 if not remote host
  6261. DOGEN6    LD    A,(GENLEN)    ;Get the length
  6262.     IFZ    DOGEN1        ;Jump if no length
  6263.     LD    C,A        ;Make BC the count
  6264.     LD    B,0
  6265.     LDIR            ;Move the bytes
  6266. DOGEN1    LD    C,A        ;Store the length
  6267.     LD    A,(PKTTYPE)    ;Check the type again
  6268.     IFA    'C',DOGEN7    ;If COMMAND then jump
  6269.     LD    A,(GENTYPE)    ;Get the GENERIC type
  6270.     LD    (DATA),A    ;Store it
  6271.     INC    C        ;Add one to DATA length
  6272.     LD    A,'G'        ;Send a generic packet
  6273. DOGEN7    PUSH    AF        ;Save the packet type
  6274.     LD    A,C        ;Get the length of DATA
  6275.     LD    (ARGBLK+1),A    ;Store it
  6276.     LD    A,'1'        ;Always 1 character checksum
  6277.     LD    (CURCHK),A
  6278.     LD    A,(CHKTYP)    ;Get the desired checksum type
  6279.     LD    (INICHK),A    ;Save it for later
  6280.     POP    AF        ;Get the packet type back
  6281.     CALL    SPACK        ;Send the packet
  6282.     JP    ABORT        ;Abort on an error
  6283.     RPACKET            ;Receive a packet
  6284.     IFANOT    'S',DOGEN2    ;Skip if not send_init
  6285.     LD    A,(ARGBLK+1)    ;Get the length
  6286.     LD    HL,DATA        ;Get the DATA area
  6287.     CALL    SPAR        ;Get parameters from packet
  6288.     LD    HL,DATA        ;Get the DATA area
  6289.     CALL    RPAR        ;Put our capabilities in
  6290.     LD    (ARGBLK+1),A    ;Store the length that is returned
  6291.     SPACKET    'Y'        ;Send ACK with parameters
  6292.     LD    A,(INICHK)    ;Get the requested checksum type
  6293.     LD    (CURCHK),A    ;Store it as current
  6294.     NSTATE    'f'        ;Set state to file receive
  6295.     RET            ;Return to protocol switch
  6296. DOGEN2    IFANOT    'X',DOGEN3    ;X packet?  Jump if not
  6297.     CALL    SETUPDIS    ;Set up for terminal display
  6298.     CALL    PRTPKTOUT    ;Print the packet contents
  6299.     CALL    DOINC        ;Increment everything
  6300.     LD    (ARGBLK+1),A    ;A is zero, so use for zero length
  6301.     SPACKET    'Y'        ;Send ACK
  6302.     NSTATE    'd'        ;Set state to receive DATA
  6303.     RET
  6304. ;
  6305. DOGEN3    IFANOT    'Y',DOGEN4    ;Jump if not ACK
  6306.     CALL    NEWLIN        ;Get a new line for data
  6307.     CALL    PRTPKTOUT    ;Print the packets contents on screen
  6308.     NSTATE    'C'        ;Set state to complete
  6309.     RET            ;Return to proto switch
  6310. ;
  6311. DOGEN4    CP    'N'        ;Was it NAK?
  6312.     RET    Z        ;If so, stay in this state
  6313.     IFANOT    'E',DOGEN5    ;If not Error packet, then go
  6314.     CALL    ERROR        ;Print error message
  6315.     CALL    NEWLIN        ;Get a new line
  6316.     JP    KERMIT        ;Get a new command
  6317. ;
  6318. DOGEN5    STROUT    UNKNOWN        ;Print unknown packet type message
  6319.     XOR    A
  6320.     LD    (ARGBLK+1),A    ;Set DATA length to zero
  6321.     SPACKET    'E'        ;Send an error packet
  6322.     JP    KERMIT        ;Get a new command
  6323. ;
  6324. ;    Do remote directory
  6325. ;
  6326. RMTDIR    EQU    $
  6327.     GENCASE    'D',1
  6328. ;
  6329. ;    Remote delete file
  6330. ;
  6331. RMTDEL    EQU    $
  6332.     GENCASE    'E',1
  6333. ;
  6334. ;    Remote disk utilization
  6335. ;
  6336. RMTDSK    EQU    $
  6337.     GENCASE    'U',1
  6338. ;
  6339. ;    Remote Help
  6340. ;
  6341. RMTHLP    EQU    $
  6342.     GENCASE    'H',1
  6343. ;
  6344. ;    Remote Program control
  6345. ;
  6346. RMTPRG    EQU    $
  6347.     GENCASE    'P',2
  6348. ;
  6349. ;    Remote Kermit Command
  6350. ;
  6351. RMTKER    EQU    $
  6352.     GENCASE    'P',1
  6353. ;
  6354. ;    Remote type command
  6355. ;
  6356. RMTTYPE    EQU    $
  6357.     GENCASE    'T',1
  6358. ;
  6359. ;    Remote who command
  6360. ;
  6361. RMTWHO    EQU    $
  6362.     GENCASE    'W',2
  6363. ;
  6364. ;    Remote change directory
  6365. ;
  6366. RMTCWD    EQU    $
  6367.     GENCASE    'C',2
  6368. ;
  6369. ;    Remote rename a file
  6370. ;
  6371. RMTREN    EQU    $
  6372.     GENCASE    'R',2
  6373. ;
  6374. ;    Remote copy a file
  6375. ;
  6376. RMTCOPY    EQU    $
  6377.     GENCASE    'K',2
  6378. ;
  6379. ;    Remote send a message
  6380. ;
  6381. RMTMSG    EQU    $
  6382.     GENCASE    'M',2
  6383. ;
  6384. ;    Remote set a variable
  6385. ;
  6386. RMTSET    EQU    $
  6387.     LD    C,'S'
  6388.     GENCASE    'V',2
  6389. ;
  6390. ;    Remote query a variable
  6391. ;
  6392. RMTQUERY    EQU    $
  6393.     LD    C,'Q'
  6394.     GENCASE    'V',2
  6395. ;
  6396. ;    Remote close the log file
  6397. ;
  6398. RMTCLOSE    EQU    $
  6399.     LD    C,'c'
  6400.     GENCASE    'J',1
  6401. ;
  6402. ;    Remote send log file
  6403. ;
  6404. RMTSEND    EQU    $
  6405.     LD    C,'s'
  6406.     GENCASE    'J',1
  6407. ;
  6408. ;    Remote start logging
  6409. ;
  6410. RMTSTART    EQU    $
  6411.     LD    C,'+'
  6412.     GENCASE    'J',1
  6413. ;
  6414. ;    Remote stop logging
  6415. ;
  6416. RMTSTOP    EQU    $
  6417.     LD    C,'-'
  6418.     GENCASE    'J',1
  6419. ;
  6420. ;    Remote login
  6421. ;
  6422. RMTLOGIN    EQU    $
  6423.     GENCASE    'l',3
  6424. ;
  6425. ;    Remote server status query
  6426. ;
  6427. RMTSRV    EQU    $
  6428.     GENCASE    'Q',1
  6429. ;
  6430. ;    Remote host command
  6431. ;
  6432. RMTHST    EQU    $
  6433.     LD    DE,FILBUF
  6434.     LD    A,CMTXT
  6435.     CALL    COMND
  6436.     JP    KERMT2
  6437.     LD    (TEMP4),A
  6438.     LD    A,CMCFM
  6439.     CALL    COMND
  6440.     JP    KERMT3
  6441.     LD    A,(TEMP4)
  6442.     LD    (GENLEN),A
  6443.     LD    C,A
  6444.     LD    B,0
  6445.     LD    HL,FILBUF
  6446.     ADD    HL,BC
  6447.     LD    (HL),0
  6448.     LD    A,1
  6449.     LD    (FLDLEN),A
  6450.     LD    A,'C'
  6451.     LD    (PKTTYPE),A
  6452.     JP    GENCMD5
  6453. ;
  6454. ;    Get users response, and put it into the buffer
  6455. ;
  6456. ENCFLDS    LD    A,CMTXT
  6457.     LD    DE,DATA        ;Get the text
  6458.     CALL    COMND
  6459.     JP    KERMT2
  6460.     CALL    ENCOLEN        ;Length encode each argument
  6461.     JP    GETFIELD1    ;On error jump
  6462.     LD    HL,RMTDATA    ;Get the input buffer
  6463.     CALL    ENCSTR        ;Encode the contents
  6464.     LD    A,(SIZE)    ;Get the length
  6465.     LD    (GENLEN),A    ;Save it for later
  6466.     RET            ;Return
  6467. ;
  6468. GETFIELD1    EQU    $    ;Bad string found in encodelen
  6469.     STROUT    TOOLONG        ;Print string too long message
  6470.     JP    KERMIT        ;Abort completely
  6471. ;
  6472. ;    Protocol switch code
  6473. ;
  6474. PROTO    EQU    $
  6475.     LD    A,(STATE)
  6476.     SWITCH    'D',SDATA    ;Send data
  6477.     SWITCH    'F',SFILE    ;Send file
  6478.     SWITCH    'T',SNDTRAN    ;Transition from 'F' to 'D'
  6479.     SWITCH    'Z',SEOF    ;Send EOF
  6480.     SWITCH    'S',SINIT    ;Send init
  6481.     SWITCH    'B',SEOT    ;End of transmittion
  6482.     SWITCH    'C',COMP    ;Completed
  6483.     SWITCH    'A',SABORT    ;Abort
  6484.     SWITCH    'd',RDATA    ;Receive data
  6485.     SWITCH    'f',RFILE    ;Receive file
  6486.     SWITCH    't',RECTRAN    ;Transition from 'f' to 'd'
  6487.     SWITCH    'R',RINIT    ;Receive init
  6488.     SWITCH    'r',RINITF    ;Receive init with filename (GET command)
  6489.     SWITCH    'G',DOGEN    ;Generic server command
  6490.     SWITCH    'I',IINIT    ;Generic init packet
  6491.     CALL    SABORT        ;Bad protocol state
  6492.     JP    KERMIT        ;Abort
  6493. ;
  6494. ;    SEND    I-INITIATE
  6495. ;
  6496. IINIT    CALL    CHKTRYS        ;Check retry threshold
  6497.     LD    A,'1'        ;RESET TO USE SINGLE CHARACTER CHECKSUM
  6498.     LD    (CURCHK),A    ;FOR STARTUP
  6499.     LD    A,(CHKTYP)    ;GET OUR DESIRED BLOCK CHECK TYPE
  6500.     LD    (INICHK),A    ;Store it as the initial value
  6501.     LD    HL,DATA        ;GET A POINTER TO OUR DATA BLOCK.
  6502.     CALL    RPAR        ;SET UP THE PARAMETER INFORMATION.
  6503.     LD    (ARGBLK+1),A    ;SAVE THE NUMBER OF ARGUMENTS.
  6504.     LD    A,(PKTNUM)    ;GET THE PACKET NUMBER.
  6505.     LD    (ARGBLK),A
  6506.     SPACKET    'I'        ;Send the I packet
  6507.     RPACKET            ;Get the answer packet
  6508.     CP    'Y'        ;Is it an ACK?
  6509.     JP    NZ,IINIT3    ;IF NOT TRY NEXT.
  6510.     CALL    CHKBLK
  6511.     RET    NZ         ;IF NOT TRY AGAIN.
  6512.     CALL    DOINC
  6513.     LD    A,(ARGBLK+1)    ;GET THE NUMBER OF PIECES OF DATA.
  6514.     LD    HL,DATA        ;POINTER TO THE DATA.
  6515.     CALL    SPAR        ;READ IN THE DATA.
  6516.     LD    A,(INICHK)    ;GET THE AGREED UPON BLOCK-CHECK-TYPE
  6517.     LD    (CURCHK),A    ;STORE AS TYPE TO USE FOR PACKETS NOW
  6518.     NSTATE    'G'
  6519.     RET    
  6520. IINIT3    IFANOT    'N',IINIT4    ;NAK?
  6521.     CALL    UPDRTR        ;UPDATE THE NUMBER OF RETRIES.
  6522.     RET
  6523. IINIT4    CP    'E'        ;IS IT AN ERROR PACKET.
  6524.     JP    NZ,ABORT    ;JUMP IF NOT
  6525.     LD    A,80        ;SET UP ALL DEFAULT PARAMETERS
  6526.     LD    (SPSIZ),A
  6527.     XOR    A
  6528.     LD    (SPAD),A
  6529.     LD    (SPADCH),A
  6530.     LD    A,13
  6531.     LD    (SEOL),A
  6532.     LD    A,'1'
  6533.     LD    (CURCHK),A
  6534.     LD    A,'#'
  6535.     LD    (SQUOTE),A
  6536.     NSTATE    'G'
  6537.     RET
  6538. ;
  6539. ;    This routine encodes the length of the blank separated fields
  6540. ;    into a packet for the generic routines.  If there are more
  6541. ;    blank separated fields than FLDLEN says there should be, the
  6542. ;    remaining fields are added to the end of the last field,
  6543. ;    separated by blanks.
  6544. ;
  6545. ENCOLEN    LD    HL,DATA        ;Get the source
  6546.     LD    DE,(INITRMT)    ;Get the initial location
  6547.     LD    BC,(INITCNT)    ;Get the initial counters
  6548.     PUSH    DE        ;Save the store address for length
  6549.     PUSH    BC
  6550.     INC    DE        ;Point to where the data goes
  6551.     LD    A,(FLDLEN)    ;Get the number of fields
  6552.     LD    B,A        ;Put it into the counter
  6553.     POP    AF        ;Get the initial length
  6554.     LD    (FLDLEN),A    ;Set the length to zero initially
  6555. ENCLEN1    LD    A,(HL)        ;Get a character
  6556.     IFANOT    20H,ENCLEN4    ;Jump if not space
  6557. ENCLEN2    INC    HL        ;Point to next character
  6558.     IFA    (HL),ENCLEN2    ;Loop while we are looking at a space
  6559.     DJNZ    ENCLEN3        ;See if we have done all fields
  6560.     INC    B        ;Reset the counter back to one if so
  6561.     LD    (DE),A        ;Store a space
  6562.     INC    DE        ;Point to next place to store at
  6563.     INC    C        ;Increment the field length
  6564.     JR    ENCLEN1        ;Process next character
  6565. ENCLEN3    LD    A,C        ;Get the field length
  6566.     TOCHAR            ;Make it printable
  6567.     EX    (SP),HL        ;Get the store address for the length
  6568.     LD    (HL),A        ;Store the length byte
  6569.     POP    HL        ;Restore the old HL
  6570.     PUSH    DE        ;Save the new length byte address
  6571.     INC    DE        ;Point to the data store address
  6572.     LD    C,0        ;Reset the count of characters
  6573.     LD    A,(FLDLEN)    ;Get the total length
  6574.     INC    A        ;Add one to the length
  6575.     LD    (FLDLEN),A    ;Store the new length
  6576.     JR    NZ,ENCLEN1    ;Continue if OK
  6577.     POP    DE        ;Restore the stack
  6578.     RET            ;Return error
  6579. ENCLEN4    JR    C,ENCLEN5    ;If this is a control character then stop
  6580.     INC    C        ;Correct for the comming decrement
  6581.     LDI            ;Move one char, and increment counter
  6582.     INC    C        ;Plus one more for the length
  6583.     LD    A,(FLDLEN)    ;Get the length
  6584.     INC    A        ;Add one for current character
  6585.     LD    (FLDLEN),A    ;Store the new length
  6586.     JR    NZ,ENCLEN1    ;Top of the loop if no overflow
  6587.     POP    DE        ;Restore the stack
  6588.     RET            ;Return error
  6589. ENCLEN5    POP    HL        ;Get the length address
  6590.     LD    A,C        ;Get the length
  6591.     TOCHAR            ;Make it printable
  6592.     LD    (HL),A        ;Store this fields length
  6593.     XOR    A        ;Terminate the packet
  6594.     LD    (DE),A
  6595.     LD    A,(FLDLEN)    ;Get the overall length
  6596.     LD    (GENLEN),A    ;Save it for later
  6597.     OR    A        ;Is it a null length string?
  6598.     JP    Z,RSKP        ;Return if it is
  6599.     INC    A        ;Add one to length for field length byte
  6600.     CP    MAXPKT-4    ;Too big for packet?
  6601.     RET    P        ;Return error if string too long
  6602.     LD    (GENLEN),A    ;Save it
  6603.     JP    RSKP        ;Return to the caller
  6604. ;end of file
  6605. <<< m4send.asm >>>
  6606. ;    M4SEND/ASM
  6607. ;
  6608. ;    SEND    COMMAND
  6609. ;
  6610. SEND    EQU    $
  6611.     CALL    NEWLIN
  6612.     LD    A,CMTXT        ;PARSE A TEXT STRING
  6613.     LD    DE,MFNBUF    ;GIVE THE ADDRESS FOR THE STRING
  6614.     PUSH    DE        ;Save it
  6615.     CALL    COMND        ;GET THE INPUT
  6616.     JP    KERMT2        ;GIVE UP ON BAD PARSE.
  6617.     POP    HL        ;Get the pointer
  6618.     LD    (MFNPTR),HL    ;Save it as the start
  6619.     LD    A,1        ;Set the log names flag
  6620.     LD    (LOGNAMES),A
  6621.     CALL    BUILDF        ;Build a list doing wildcarding
  6622.     LD    A,(FILECNT)    ;Get the number of files
  6623.     IFNZ    SEND11        ;Jump if some files were found
  6624.     STROUT    NOFILES        ;Print the message
  6625.     JP    KERMIT
  6626. SEND11    LD    (MFNPTR),HL    ;Save the start of the found list
  6627.     CALL    MFNAME        ;Get the next from the list
  6628.     JR    NC,SEND14    ;Jump if got a name
  6629.     CALL    NEWLIN
  6630.     LD    A,19        ;Issue system error, Illeagal filename
  6631.     CALL    XERROR
  6632.     JP    KERMIT        ;GET A NEW COMMAND
  6633. SEND14    CALL    INIT        ;Clear the line and initialize buffers
  6634.     XOR    A
  6635.     LD    (PKTNUM),A
  6636.     LD    (NUMTRY),A    ;SET THE NUMBER OF TRIES TO ZERO.
  6637.     LD    HL,0
  6638.     LD    (NUMPKT),HL    ;SET THE NUMBER OF PACKETS TO ZERO.
  6639.     LD    (NUMRTR),HL    ;SET THE NUMBER OF RETRIES TO ZERO.
  6640.     LD    (KTRANS),HL
  6641.     LD    A,'1'        ;RESET TO USE SINGLE CHARACTER CHECKSUM
  6642.     LD    (CURCHK),A    ;FOR STARTUP
  6643.     NSTATE    'S'
  6644.     LD    (DISFLG),A    ;Put in something non zero
  6645.     CALL    CONDCHR        ;Display starting sendinit character 'S'
  6646.     CALL    CLRPRT        ;CLEAR OUT ANY STACKED NAKS
  6647.     STROUT    HELPMSG
  6648.     CALL    PROTO        ;Do protocol states
  6649.     JP    KERMIT        ;Return to Kermit
  6650. ;
  6651. ;    SEND ROUTINES
  6652. ;    SEND INITIATE
  6653. ;
  6654. SINIT    CALL    CHKTRYS        ;Check retry threshold
  6655.     LD    A,'1'        ;RESET TO USE SINGLE CHARACTER CHECKSUM
  6656.     LD    (CURCHK),A    ;FOR STARTUP
  6657.     LD    A,(CHKTYP)    ;GET OUR DESIRED BLOCK CHECK TYPE
  6658.     LD    (INICHK),A
  6659.     LD    HL,DATA        ;GET A POINTER TO OUR DATA BLOCK.
  6660.     CALL    RPAR        ;SET UP THE PARAMETER INFORMATION.
  6661.     LD    (ARGBLK+1),A    ;SAVE THE NUMBER OF ARGUMENTS.
  6662.     LD    A,(NUMPKT)    ;GET THE PACKET NUMBER.
  6663.     LD    (ARGBLK),A
  6664.     SRPACK    'S'        ;Do send init, and get response
  6665.     IFANOT    'Y',SINIT3    ;Was it an ACK? Jump if not
  6666.     CALL    CHKBLK
  6667.     RET    NZ         ;IF NOT TRY AGAIN.
  6668.     CALL    DOINC        ;Increment and reset
  6669.     LD    A,(ARGBLK+1)    ;GET THE NUMBER OF PIECES OF DATA.
  6670.     LD    HL,DATA        ;POINTER TO THE DATA.
  6671.     CALL    SPAR        ;READ IN THE DATA.
  6672.     LD    A,(INICHK)    ;GET THE AGREED UPON BLOCK-CHECK-TYPE
  6673.     LD    (CURCHK),A    ;STORE AS TYPE TO USE FOR PACKETS NOW
  6674.     NSTATE    'F'        ;Set the state
  6675.     CALL    CONDCHR
  6676.     CALL    GETFIL        ;Open the file name given in FCB
  6677.     JP    SNDABORT    ;Something is wrong if come to here
  6678.     RET            ;Next state in protocol
  6679. ;
  6680. ;    Come here on bad answer to S packet
  6681. ;
  6682. SINIT3    CP    'N'        ;NAK?
  6683.     JP    NZ,BADERROR    ;If not, then it is a fatal error
  6684.     CALL    CONDCHR        ;Output N character
  6685.     RET            ;Back to protocol
  6686. ;
  6687. ;    Terminate a transaction log because of an error
  6688. ;
  6689. ;
  6690. ;    SEND FILE HEADER
  6691. ;
  6692. SFILE    CALL    CHKTRYS        ;Check retry threshold
  6693.     XOR    A        ;CLEAR A
  6694.     LD    (CZSEEN),A
  6695.     LD    DE,DATA        ;GET A POINTER TO OUR DATA BLOCK.
  6696.     LD    HL,MFREQ    ;Get filename
  6697.     LD    BC,255        ;B must be zero, C must be big for LDI
  6698. SF1    LD    A,(HL)
  6699.     IFA    '/',SF2
  6700.     IFA    ':',SF4
  6701.     IFALT    ' ',SF4
  6702.     LDI
  6703.     INC    B
  6704.     JR    SF1
  6705. SF2    LD    (HL),'.'
  6706.     LDI
  6707.     INC    B
  6708. SF3    LD    A,(HL)
  6709.     IFALT    ' ',SF4
  6710.     IFA    ':',SF4
  6711.     LDI
  6712.     INC    B
  6713.     JR    SF3
  6714. SF4    EQU    $
  6715.     LD    (DATPTR),DE
  6716.     LD    (FCBPTR),HL
  6717.     LD    A,B        ;NUMBER OF CHAR IN FILE NAME.
  6718.     LD    (ARGBLK+1),A
  6719.     EX    DE,HL
  6720.     LD    (HL),EOS    ;Put in the print terminator
  6721.     LD    A,(PKTNUM)    ;GET THE PACKET NUMBER.
  6722.     LD    (ARGBLK),A
  6723.     SRPACK    'F'        ;Send file header and get response
  6724.     IFANOT    'Y',SFILE2    ;Jump if not an ACK
  6725.     CALL    CHKBLK        ;Check packet number
  6726.     RET    NZ         ;Return if not the right one
  6727. SFIL14    CALL    DOINC        ;Increment packet count
  6728. SFIL15    CALL    RSETPKT        ;Reinitialize GETPKT()
  6729.     CALL    GTCHR
  6730.     JP    SFIL16        ;ERROR GO SEE IF ITS EOF.
  6731.     JR    SFIL17        ;GOT THE CHARS, PROCEED.
  6732. SFIL16    CP    0FFH        ;IS IT EOF?
  6733.     JP    NZ,SNDABORT    ;IF NOT GIVE UP.
  6734.     NSTATE    'Z'        ;Set EOF state
  6735.     CALL    CONDCHR
  6736.     RET    
  6737. SFIL17    EQU    $
  6738.     NSTATE    'T'        ;Set state to data send
  6739.     LD    (DISFLG),A    ;Make sure display is on
  6740.     RET    
  6741. SFILE2    CP    'N'        ;NAK?
  6742.     JP    NZ,BADERROR    ;TRY IF ERROR PACKET.
  6743.     CALL    CONDCHR        ;Display the packet character
  6744.     CALL    CHKBLKINC    ;Check NAK for packet N+1
  6745.     RET    NZ         ;If not, then try to resend
  6746.     JR    SFIL14        ;As good as an ACK, join the ack code
  6747. ;
  6748. ;    Send transition state from Send file to Send data
  6749. ;
  6750. SNDTRAN    EQU    $
  6751.     STROUT    KERSND        ;Print SENDING message
  6752.     STROUT    TFILNAM        ;Print the file name
  6753.     LD    A,(TRANLOG)    ;Check if logging active
  6754.     IFZ    SNDTRAN2    ;If not, then jump
  6755.     LD    DE,TRFCB    ;Get the log file FCB
  6756.     TRLOG    KERSND,SNDTRAN1    ;Log the SENDING=> message
  6757.     TRLOG    TFILNAM,SNDTRAN1    ;Log the file name
  6758.     TRLOG    TIMEMES,SNDTRAN1;Log the time: message
  6759.     CALL    PRTTIME        ;Print the time
  6760.     JR    SNDTRAN2    ;Join other code
  6761. ;
  6762. ;    Close up on a logging error
  6763. ;
  6764. SNDTRAN1    EQU    $
  6765.     XOR    A        ;Reset the log open flag
  6766.     LD    (TRANLOG),A
  6767.     LD    DE,TRFCB    ;Close the log file
  6768.     CALL    XCLOSE
  6769. SNDTRAN2    EQU    $
  6770.     NSTATE    'D'        ;Set the state to SEND DATA
  6771.     RET
  6772. ;
  6773. ;    SEND DATA
  6774. ;
  6775. SDATA    CALL    CHKTRYS        ;Check the retry threshold
  6776.     LD    DE,DATA        ;Get the data area
  6777.     LD    HL,FILBUF    ;Get the file buffer
  6778.     LD    A,(SIZE)    ;Get the number of bytes encoded
  6779.     IFZ    SDAT11        ;Jump if there are none
  6780.     LD    C,A        ;Put LSB into C
  6781.     LD    B,0        ;Zero B
  6782.     LDIR            ;Move the bytes
  6783. SDAT11    LD    A,(SIZE)    ;Get the number of bytes back
  6784.     LD    (ARGBLK+1),A    ;Store it as the length
  6785.     LD    A,(PKTNUM)    ;Get the current packet number
  6786.     LD    (ARGBLK),A    ;Put it in the packet
  6787.     LD    A,'D'        ;Get the packet type
  6788.     CALL    SPACK        ;Send a data packet
  6789.     JP    SNDABORT    ;Abort if send fails
  6790.     LD    A,(NUMPKT)    ;See if time to log progress
  6791.     AND    3        ;Every 4 packets
  6792.     LD    A,'.'        ;Get the character
  6793.     CALL    Z,CONDCHR    ;Output if it is time
  6794.     RPACKET            ;Get a packet
  6795.     IFANOT    'Y',SDATA2    ;Jump if not an ACK
  6796.     CALL    CHKBLK        ;See if proper packet number
  6797.     RET    NZ         ;Wait for more if not right number
  6798.     CALL    DOINC        ;Increment and reset
  6799.     LD    A,(ARGBLK+1)    ;Get the length of packet
  6800.     IFANOT    1,SDAT15    ;Jump if not 1 character
  6801.     LD    A,(DATA)    ;Get the character sent in ACK
  6802.     IFANOT    'Z',SDAT14    ;Is it end of file?  Jump if not
  6803.     LD    (CZSEEN),A    ;Save it
  6804.     JR    SDAT15        ;Continue
  6805. SDAT14    IFANOT    'X',SDAT15    ;Was it EOT?  Jump if not
  6806.     LD    (CZSEEN),A    ;Save it 
  6807. SDAT15    LD    A,(CZSEEN)    ;Get the character
  6808.     IFZ    SDAT12        ;Jump if nothing there
  6809.     CALL    CONDCHR        ;Display the character
  6810.     NSTATE    'Z'        ;Set the state to EOF
  6811.     RET            ;Return to protocol
  6812. ;
  6813. SDAT12    CALL    GTCHR        ;Get more data from input file
  6814.     JP    SDAT13        ;Jump if error occurs (might be EOF)
  6815.     RET            ;Continue sending
  6816. ;
  6817. SDAT13    CP    0FFH        ;Was the file error EOF?
  6818.     JP    NZ,SNDABORT    ;If not, then file error, so abort
  6819.     NSTATE    'Z'        ;Set state to EOF
  6820.     CALL    CONDCHR        ;Output the state
  6821.     RET            ;Return to protocol
  6822. ;
  6823. SDATA2    CP    'N'        ;Is it a NAK?
  6824.     JP    NZ,BADERROR    ;Nope, check next type
  6825.     CALL    CONDCHR        ;Display packet type
  6826.     CALL    CHKBLKINC    ;NAK this packet plus one?
  6827.     JR    Z,SDAT12    ;Just as good as an ACK, Join ACK code.
  6828.     CALL    UPDRTR
  6829.     RET
  6830. ;
  6831. ;    Send the EOF packet
  6832. ;
  6833. SEOF    CALL    CHKTRYS        ;Check the retry threshold
  6834.     CALL    INITBLK        ;Initialize ARGBLK
  6835.     LD    A,(CZSEEN)    ;Check for ABORT
  6836.     IFZ    SEOF14        ;If not aborted, then keep going
  6837.     LD    A,(TRANLOG)    ;Check if logging active
  6838.     IFZ    SEOF10        ;Jump if no logging
  6839.     LD    DE,TRFCB    ;Get the log file FCB
  6840.     TRLOG    TRANCANC,SEOF19    ;Log the canceled message
  6841. SEOF10    LD    A,(DISCARD)    ;Should the file be deleted?
  6842.     IFZ    SEOF11        ;Skip delete if user want to keep it
  6843.     LD    A,'D'        ;Tell other end to discard packet
  6844.     LD    (DATA),A    ;Store the delete character
  6845.     LD    A,1        ;Length is one character
  6846. SEOF11    LD    (ARGBLK+1),A    ;Store the length
  6847. SEOF14    SRPACK    'Z'        ;Send EOF, and get a response
  6848.     IFANOT    'Y',SEOF2    ;Jump if not an ACK
  6849.     CALL    CHKBLK        ;Check the packet number
  6850.     RET    NZ         ;Return if not correct one
  6851. SEOF12    CALL    DOINC        ;Increment and reset
  6852.     CALL    CHKFCB        ;Check for file, don't close *SO
  6853.     CALL    Z,XCLOSE    ;Conditionally close it
  6854.     LD    A,(CZSEEN)    ;Did the user force us to stop?
  6855.     IFA    'Z',SEOF13    ;Jump if EOF was signaled by user
  6856.     CALL    MFNAME        ;Get a new file name
  6857.     JR    C,SEOF13    ;Jump if no more
  6858.     CALL    GETFIL        ;AND OPEN IT
  6859.     JP    SNDABORT    ;SOMETHING IS WRONG, DIE.
  6860.     XOR    A        ;CLEAR A
  6861.     LD    (CZSEEN),A
  6862.     NSTATE    'F'        ;Set state to file send
  6863.     CALL    CONDCHR
  6864.     LD    IX,STRANS    ;Update transmission information
  6865.     CALL    UPDTRANS
  6866.     RET            ;Continue protocol
  6867. ;
  6868. SEOF13    NSTATE    'B'        ;Set state to EOT
  6869.     CALL    CONDCHR
  6870.     LD    IX,STRANS    ;Update the transmission info
  6871.     CALL    UPDTRANS
  6872.     RET    
  6873. ;
  6874. SEOF2    CP    'N'        ;NAK?
  6875.     JP    NZ,BADERROR    ;TRY AND SEE IF ITS AN ERROR PACKET.
  6876.     CALL    CONDCHR
  6877.     CALL    UPDRTR        ;UPDATE THE NUMBER OF RETRIES.
  6878.     CALL    CHKBLKINC
  6879.     RET    NZ        ;IF NOT GO TRY AGAIN.
  6880.     JR    SEOF12        ;Just as good as an ACK
  6881. ;
  6882. SEOF19    XOR    A        ;Reset the log open flag
  6883.     LD    (TRANLOG),A
  6884.     LD    DE,TRFCB    ;Close the file
  6885.     CALL    XCLOSE
  6886.     JP    SEOF10        ;Join other code
  6887. ;
  6888. ;    Send EOT packet
  6889. ;
  6890. SEOT    CALL    CHKTRYS        ;Check the retry threshold
  6891.     CALL    INITBLK        ;Initialize ARGBLK
  6892.     SRPACK    'B'        ;Send END of BATCH and get response
  6893.     IFANOT    'Y',SEOT2    ;Jump if not ACK
  6894.     CALL    CHKBLK        ;Check the packet number
  6895.     RET    NZ         ;Return if not correct
  6896. SEOT12    CALL    DOINC        ;Increment and reset
  6897.     NSTATE    'C'        ;Set state to complete
  6898.     RET    
  6899. SEOT2    CP    'N'        ;NAK?
  6900.     JP    NZ,BADERROR    ;IS IT ERROR.
  6901.     CALL    CONDCHR
  6902.     CALL    UPDRTR        ;UPDATE THE NUMBER OF RETRIES.
  6903.     CALL    CHKBLKINC
  6904.     JP    Z,SEOT12    ;Good as an ACK, so continue
  6905.     OR    A        ;Is the other end starting over?
  6906.     JR    Z,SEOT12
  6907.     RET
  6908. ;
  6909. ;    Check the retry threshold
  6910. ;
  6911. CHKTRYS    EQU    $        ;Check retry threshold
  6912.     LD    A,(MAXTRY)    ;Get the maximum
  6913.     LD    B,A        ;Save
  6914.     LD    A,(NUMTRY)
  6915.     IFALT    B,CHKTRYS1    ;Jump if not at limit
  6916.     POP    DE        ;Remove the callers return addr
  6917.     LD    DE,ERMS14    ;Print the error message
  6918.     CALL    ERROR3
  6919.     JP    SNDABORT    ;CHANGE THE STATE TO ABORT.
  6920. CHKTRYS1    EQU    $
  6921.     IFZ    CHKTRYS2    ;Jump if first try
  6922.     PUSH    AF        ;Save the count
  6923.     LD    A,'%'        ;Print retrying message
  6924.     CALL    CONDCHR
  6925.     POP    AF        ;Get the count back
  6926. CHKTRYS2    EQU    $
  6927.     INC    A        ;Increment it
  6928.     LD    (NUMTRY),A    ;Save the new count
  6929.     RET
  6930. ;
  6931. ;    Increment the packet count modulo 64, A already has the old one.
  6932. ;
  6933. INCPKT    INC    A
  6934.     AND    3FH
  6935.     LD    (PKTNUM),A
  6936.     RET
  6937. ;
  6938. ;    Move numtry to oldtry and zero numtry
  6939. ;
  6940. NUM2OLD    EQU    $
  6941.     LD    A,(NUMTRY)    ;GET THE NUMBER OF TRIES.
  6942.     LD    (OLDTRY),A    ;SAVE IT.
  6943.     XOR    A
  6944.     LD    (NUMTRY),A    ;RESET THE NUMBER OF TRIES.
  6945.     RET
  6946. ;
  6947. ;    Increment display packet count
  6948. ;
  6949. INCDISPKT    EQU    $
  6950.     LD    HL,(NUMPKT)
  6951.     INC    HL
  6952.     LD    (NUMPKT),HL
  6953.     RET
  6954. ;
  6955. ;    Do several things
  6956. ;
  6957. DOINC    CALL    INCPKT
  6958.     CALL    INCDISPKT
  6959.     JP    NUM2OLD
  6960. ;
  6961. ;    Check the packet number 'received plus 1' verses that sent
  6962. ;    return their relation, eg <, >, =, <>.  This is used as a
  6963. ;    method to determine that a NAK for packet N+1 is equivelent
  6964. ;    to an ACK for packet N.
  6965. ;
  6966. CHKBLKINC    EQU    $
  6967.     LD    A,(PKTNUM)    ;Get the current packet number
  6968.     INC    A        ;Plus one
  6969.     LD    B,A        ;Save it
  6970.     LD    A,(ARGBLK)    ;Get the packet number returned
  6971.     CP    B        ;Are they equal?
  6972.     RET            ;Return the flags setting
  6973. ;
  6974. ;    Conditionally display the character in A based on the value
  6975. ;    of DISFLG.  This is used to print the characters during transfers
  6976. ;    that show the status of the transfer.  eg '.', 'Q', 'S', 'Z', etc
  6977. ;
  6978. CONDCHR    EQU    $
  6979.     LD    C,A        ;Save the character
  6980.     LD    A,(DISFLG)    ;Check if should display the character
  6981.     OR    A        ;Set the flags
  6982.     RET    Z        ;Return if flag not set
  6983.     LD    A,C        ;Get the character back
  6984.     JP    CONOUT        ;Print the terminal on the console
  6985. ;
  6986. RSETPKT    EQU    $
  6987.     XOR    A        ;GET A ZERO.
  6988.     LD    (EOFLAG),A    ;INDICATE NOT EOF.
  6989.     LD    (SIZE),A    ;Nothing in packet buffer
  6990.     LD    (OSIZE),A    ;No old length
  6991.     LD    (LEFTOVER),A    ;No leftovers from previous packet
  6992.     LD    (RPTCNT),A    ;No repeated characters yet
  6993.     LD    (PREVCH),A    ;Reset any previous character knowledge
  6994.     LD    HL,-1        ;Set NO next character
  6995.     LD    (NEXT),HL
  6996.     LD    (CH),HL
  6997.     RET
  6998. ;
  6999. BADERROR    EQU    $
  7000.     CP    'E'        ;IS IT AN ERROR PACKET.
  7001.     JP    NZ,SNDABORT
  7002.     CALL    ERROR
  7003.     JP    SNDABORT
  7004. ;
  7005. INITBLK    EQU    $
  7006.     LD    A,(PKTNUM)    ;GET THE PACKET NUMBER.
  7007.     LD    (ARGBLK),A
  7008.     XOR    A
  7009.     LD    (ARGBLK+1),A    ;NO DATA.
  7010.     RET
  7011. PRTTIME    EQU    $
  7012.     PUSH    AF        ;Save the regs
  7013.     PUSH    BC
  7014.     PUSH    HL
  7015.     PUSH    DE        ;Save the FILE FCB
  7016.     LD    HL,CLBUF    ;Get the character buffer
  7017.     PUSH    HL        ;Save the address
  7018.     CALL    XTIME        ;Get the time
  7019.     LD    (HL),CR        ;Get a new line
  7020.     INC    HL        ;Point to next pos
  7021.     LD    (HL),EOS    ;Terminate the string
  7022.     POP    HL        ;Get the string to print back
  7023.     POP    DE        ;Get the log file FCB
  7024.     CALL    OUTLOG
  7025.     CALL    TIMCLOSE    ;Close up if error occurs
  7026.     POP    HL        ;Restore the regs
  7027.     POP    BC
  7028.     POP    AF
  7029.     RET
  7030. ;
  7031. TIMCLOSE    EQU    $
  7032.     XOR    A        ;Reset the file open flag
  7033.     LD    (LOGTRAN),A
  7034.     LD    DE,TRFCB    ;Get the FCB
  7035.     JP    XCLOSE        ;Close the file and return.
  7036. ; end of file
  7037. <<< m4set.asm >>>
  7038. ;    m4set/asm
  7039. ;
  7040. ;THIS IS THE SET COMMAND.
  7041. ;
  7042. SETCOM    LD    DE,SETTAB    ;Parse a keyword for set table
  7043.     LD    A,SHLEN/3    ;Patch the number in the table
  7044.     LD    (SETTAB),A    ;Store the value
  7045.     LD    A,MXSLEN    ;Patch the other value
  7046.     LD    (SETTAB+1),A
  7047.     LD    A,CMKEY        ;Select keyword parse
  7048.     CALL    COMND        ;Parse it
  7049.     JP    KERMT2        ;Quit on an error
  7050.     LD    HL,SETJTB    ;Get the jump table address.
  7051.     LD    C,A
  7052.     LD    B,0
  7053.     ADD    HL,BC
  7054.     JP    (HL) 
  7055. ;SET COMMAND JUMP TABLE
  7056. SETJTB    JP    ESCAPE        ;SET ESC
  7057.     JP    LOCAL        ;SET LOCAL
  7058.     JP    SETEIGHT    ;SET EIGHT-BIT-QUOTING
  7059.     JP    SETFILE        ;SET FILE
  7060.     JP    SETBLK        ;SET BLOCK-CHECK-TYPE
  7061.     JP    SETEMUL        ;SET emulation
  7062.     JP    PRINTR        ;set printer
  7063.     JP    SETBUG        ;SET DEBUG
  7064.     JP    SETDSK        ;SET DEFAULT DISK
  7065.     JP    SETBEL        ;SET BELL ON OR OFF
  7066.     JP    SETSND        ;SET SEND PARAMETERS
  7067.     JP    SETREC        ;SET RECEIVE PARAMTERS
  7068.     JP    SETKEY        ;SET A KEY FOR TRANSLATION
  7069.     JP    SETFLO        ;SET FLOW CONTROL
  7070.     JP    SETINP        ;SET INPUT PARAMETERS
  7071.     JP    SETOTP        ;SET OUTPUT PARAMETERS
  7072.     JP    SETTAK        ;Set take display
  7073. SHLEN    EQU    $-SETJTB    ;OFFSET FOR SHOW ALL
  7074. ;
  7075. ;    Set file dispostion
  7076. ;
  7077. SETDISP    LD    DE,DISPTAB    ;Get the parse table
  7078.     LD    A,CMKEY
  7079.     CALL    COMND        ;Parse a keyword
  7080.     JP    KERMT2
  7081.     LD    (TEMP1),A    ;Save it
  7082.     LD    A,CMCFM        ;Get a confirm
  7083.     CALL    COMND
  7084.     JP    KERMT3
  7085.     LD    A,(TEMP1)
  7086.     LD    (DISCARD),A    ;Set the value
  7087.     JP    KERMIT
  7088. ;
  7089. ;    Set take file display
  7090. ;
  7091. SETTAK    SETFLG    TAKLOG
  7092. ;
  7093. ;    Set input options
  7094. ;
  7095. SETINP    LD    A,CMKEY        ;GET A KEYWORD
  7096.     LD    DE,INPTAB    ;WHERE ARE THE KEYWORDS AT?
  7097.     CALL    COMND
  7098.     JP    KERMT2        ;QUIT ON AN ERROR
  7099.     LD    C,A
  7100.     IFANOT    0,STINP1    ;Check for first time
  7101.     SETFLG    CSEFLG
  7102. STINP1    CP    3
  7103.     JP    NZ,KERMT3
  7104.     SETFLG    INDSP
  7105. ;
  7106. ;    Set output option
  7107. ;
  7108. SETOTP    LD    A,CMKEY
  7109.     LD    DE,OUTTAB
  7110.     CALL    COMND
  7111.     JP    KERMT2
  7112.     LD    C,A
  7113.     IFANOT    0,STOTP1
  7114.     SETFLG    ECHFLG
  7115. STOTP1    CP    3
  7116.     JP    NZ,KERMT3
  7117.     SETFLG    OTDSP
  7118. ;
  7119. ;    Set flow control option
  7120. ;
  7121. SETFLO    LD    DE,FLOTAB
  7122.     LD    A,CMKEY
  7123.     CALL    COMND
  7124.     JP    KERMT2
  7125.     LD    (TEMP1),A
  7126.     LD    A,CMCFM
  7127.     CALL    COMND
  7128.     JP    KERMT3
  7129.     LD    A,(TEMP1)
  7130.     LD    (FLOFLG),A    ;STORE THE NEW STATUS
  7131.     JP    KERMIT
  7132. ;
  7133. ;    Set bell on/off
  7134. ;
  7135. SETBEL    SETFLG    BELFLG        ;Set the bell ON or OFF
  7136. ;
  7137. ;    Set block check type
  7138. ;
  7139. SETBLK    LD    DE,BLKTAB    ;GET THE BLOCK-CHECK TABLE
  7140.     LD    A,CMKEY        ;PARSE A KEYWORD
  7141.     CALL    COMND        ;GO GET IT
  7142.     JP    KERMT2        ;COULDN'T, COMPLAIN
  7143.     LD    (TEMP1),A    ;SAVE THE PARSED ITEM
  7144.     LD    C,A
  7145.     LD    A,CMCFM        ;WANT TO END THE COMMAND
  7146.     CALL    COMND        ;GO DO IT
  7147.     JP    KERMT3        ;GIVE UP
  7148.     LD    A,(TEMP1)    ;GET THE VALUE BACK
  7149.     LD    (CHKTYP),A    ;SAVE DESIRED CHECKSUM TYPE
  7150.     JP    KERMIT        ;GO GET ANOTHER COMMAND
  7151. ;
  7152. ;    Set send options
  7153. ;
  7154. SETSND    XOR    A        ;SET SEND/RECEIVE TO SEND
  7155.     JR    SETSOR
  7156. ;
  7157. ;    Set receive options
  7158. ;
  7159. SETREC    LD    A,1        ;SET SEND/RECEIVE TO RECEIVE
  7160. ;
  7161. ;    Common code that uses the contents of A at this point to
  7162. ;    control where the set value is stored.  All of the SEND/RECV
  7163. ;    options are set up in memory together, so that to give a
  7164. ;    particular send option a value, it is stored directly.  The
  7165. ;    corresponding recv option is one byte in memory beyond the
  7166. ;    send option, so the flag (What is in A) is checked, and the
  7167. ;    destination address is incremented if A is non zero
  7168. ;
  7169. ;    Memory looks like this
  7170. ;
  7171. ;    SEOL    DB    13
  7172. ;    REOL    DB    13
  7173. ;    SSOH    DB    1
  7174. ;    RSOH    DB    1
  7175. ;
  7176. SETSOR    LD    (SORFLG),A    ;STORE THE FLAG
  7177.     LD    DE,STSNTB    ;GET THE PARSE TABLE
  7178.     LD    A,CMKEY
  7179.     CALL    COMND        ;PARSE SOMETHING
  7180.     JP    KERMT2        ;ABORT
  7181.     LD    HL,STSJTB    ;GET THE JUMP TABLE
  7182.     LD    C,A
  7183.     LD    B,0
  7184.     ADD    HL,BC
  7185.     JP    (HL)
  7186. STSJTB    JP    STPDCH        ;SET PAD CHARACTER
  7187.     JP    STPAD        ;SET PADDING ON/OFF
  7188.     JP    SSOFP        ;SET START OF PACKET
  7189.     JP    STIMEO        ;SET TIME OUT
  7190.     JP    SSEOL        ;SET END OF LINE
  7191.     JP    SSQUOT        ;SET QUOTE CHARACTER
  7192.     JP    SSTURN
  7193. ;
  7194. ;    Set the padding.  Note that it is only done on output, so
  7195. ;    SET RECEIVE PADDING doesn't make sense.
  7196. ;
  7197. STPAD    LD    A,CMNUM        ;GET A LENGTH COUNT
  7198.     CALL    COMND        ;PARSE A VALUE
  7199.     JP    KERMT3        ;NOT CONFIRMED ON AN ERROR
  7200.     OR    A        ;CHECK FOR NO NUMBER
  7201.     JP    Z,KERMT2    ;SAY AMBIGUOUS
  7202.     LD    A,D        ;CHECK FOR OVERFLOW
  7203.     IFZ    STPD10        ;Go if none
  7204.     LD    DE,OUTRNG
  7205.     CALL    PRTSTR
  7206.     JP    KERMIT
  7207. STPD10    LD    A,E
  7208.     LD    (SPAD),A    ;SET THE STATUS
  7209.     JP    KERMIT        ;GET A NEW COMMAND
  7210. ;
  7211. ;    Set the padding character.  Also applys to SEND only!
  7212. ;
  7213. STPDCH    LD    HL,SPADCH    ;GET THE ADDRESS TO STORE AT
  7214. SOR010    LD    (SORLOC),HL    ;SAVE IT FOR LATER
  7215.     LD    A,CMNUM        ;GET A DECIMAL NUMBER
  7216.     CALL    COMND
  7217.     JP    KERMT3
  7218.     OR    A        ;CHECK FOR NO NUMBER
  7219.     JP    Z,KERMT2    ;SAY AMBIGUOUS
  7220.     LD    A,D        ;CHECK FOR TOO BIG
  7221.     IFZ    PDCH2        ;Go if ok
  7222.     LD    DE,OUTRNG    ;VALUE OUT OF RANGE ERROR
  7223.     CALL    PRTSTR        ;PRINT IT
  7224.     JP    KERMIT
  7225. PDCH2    LD    HL,(SORLOC)    ;GET WHERE TO PUT IT
  7226.     LD    A,(SORFLG)    ;GET THE MODE, SEND/RECEIVE
  7227.     OR    A        ;CHECK FOR SET OR RESET FLAG
  7228.     CALL    Z,SSVAL        ;IF ZERO THEN SET RECEIVE VALUE
  7229.     CALL    NZ,SRVAL    ;ELSE SET THE SEND VALUE
  7230.     JP    KERMIT        ;GET A NEW COMMAND
  7231. ;
  7232. ;    Set START-OF-PACKET (Start Of Header, SOH)
  7233. ;
  7234. SSOFP    LD    HL,SSOHCH
  7235.     JP    SOR010
  7236. ;
  7237. ;    Set turn around character
  7238. ;
  7239. SSTURN    LD    HL,STURN
  7240.     JP    SOR010
  7241. ;
  7242. ;    Set time-out value
  7243. ;
  7244. STIMEO    LD    HL,STIME
  7245.     JP    SOR010
  7246. ;
  7247. ;    Set End Of Line (or End Of Packet) character
  7248. ;
  7249. SSEOL    LD    HL,SEOL
  7250.     JP    SOR010
  7251. ;
  7252. ;    Set eighth bit quote character
  7253. ;
  7254. SSQUOT    LD    HL,SQUOTE
  7255.     JP    SOR010
  7256. ;
  7257. ;    Convert ASCII Decimal string to binary in BC, HL is the
  7258. ;    source buffer.
  7259. ;
  7260. DECHEX    JP    XDECHEX
  7261. ;
  7262. ;    Store E at HL+1
  7263. ;
  7264. SSVAL    INC    HL
  7265. ;
  7266. ;    Store E at HL
  7267. ;
  7268. SRVAL    LD    (HL),E
  7269.     RET
  7270. ;
  7271. ;    Convert contents of A to ASCII string, and display
  7272. ;
  7273. ANOUT    PUSH    HL
  7274.     LD    L,A
  7275.     LD    H,0
  7276.     CALL    NOUT
  7277.     POP    HL
  7278.     RET
  7279. ;
  7280. ;    Set the escape character
  7281. ;
  7282. ESCAPE    LD    A,CMCFM
  7283.     CALL    COMND        ;GET A CONFIRM.
  7284.     JP    KERMT3        ;DIDN'T GET A CONFIRM.
  7285.     LD    DE,ESCMES    ;GET THE ADDRESS OF THE ESCAPE MESSAGE.
  7286.     CALL    PRTSTR
  7287.     CALL    XKEY
  7288.     LD    (ESCCHR),A    ;STORE THE NEW ESCAPE CHARACTER.
  7289.     CALL    ESCPR        ;Print the Verbpse description of it
  7290.     JP    KERMIT
  7291. ;
  7292. ;    Set local echo status
  7293. ;
  7294. LOCAL    SETFLG    ECOFLG
  7295. ;
  7296. ;    Set the emulation type
  7297. ;
  7298. SETEMUL    LD    DE,EMLTAB
  7299.     LD    A,CMKEY
  7300.     CALL    COMND
  7301.     JP    KERMT2
  7302.     LD    (TEMP1),A
  7303.     LD    A,CMCFM
  7304.     CALL    COMND
  7305.     JP    KERMT3
  7306.     LD    A,(TEMP1)
  7307.     LD    (EMULFLAG),A
  7308.     JP    KERMIT
  7309. ;
  7310. ;    Set file-warning status
  7311. ;
  7312. SETWARN    SETFLG    FLWFLG        ;Set the file-warning flag
  7313. ;
  7314. ;    SET FILE parse and jump
  7315. ;
  7316. SETFILE    LD    DE,FILETAB    ;Get the table of choices
  7317.     LD    A,CMKEY        ;Select keyword parse
  7318.     CALL    COMND        ;Parse the input
  7319.     JP    KERMT2        ;Abort on an error
  7320.     LD    C,A
  7321.     LD    B,0
  7322.     LD    HL,FILJTAB    ;Get the jump table
  7323.     ADD    HL,BC
  7324.     JP    (HL)        ;Go to the routine
  7325. ;
  7326. ;    SET FILE jump table
  7327. ;
  7328. FILJTAB    JP    SETDISP        ;SET FILE DISPOSITION
  7329.     JP    SETTYPE        ;SET FILE TYPE
  7330.     JP    SETWARN        ;SET FILE WARNING
  7331. ;
  7332. ;    SET FILE TYPE
  7333. ;
  7334. SETTYPE    LD    DE,TYPETAB    ;Get the table
  7335.     LD    A,CMKEY
  7336.     CALL    COMND
  7337.     JP    KERMT2        ;Abort on an error
  7338.     LD    (TEMP1),A    ;Save the value
  7339.     LD    A,CMCFM        ;Get a confirm
  7340.     CALL    COMND
  7341.     JP    KERMT3        ;Say not confirmed
  7342.     LD    A,(TEMP1)    ;Get the value back
  7343.     LD    (FILTYPE),A    ;Set the type chosen
  7344.     JP    KERMIT        ;Get another command
  7345. ;
  7346. ;    Set Printer command
  7347. ;
  7348. PRINTR    SETFLG    PRTFLG
  7349. ;
  7350. ;    Set status of DEBUG
  7351. ;
  7352. SETBUG    SETFLG    DBFLG
  7353. ;
  7354. ;    SET EIGHTH-BIT quoting status
  7355. ;
  7356. SETEIGHT    CALL    ONOFF
  7357.     LD    (EBQFLG),A
  7358.     JP    KERMIT
  7359. ;
  7360. ;    Get an ON/OFF value in A, with a confirm
  7361. ;
  7362. ONOFF    LD    DE,ONTAB
  7363. ONOFFA    LD    A,CMKEY
  7364.     CALL    COMND
  7365.     JP    KERMT2
  7366.     LD    (TEMP1),A
  7367.     LD    A,CMCFM
  7368.     CALL    COMND
  7369.     JP    KERMT3
  7370.     LD    A,(TEMP1)
  7371.     RET
  7372. ;
  7373. ;    Set a KEY mapping
  7374. ;
  7375. SETKEY    LD    A,CMNUM        ;Get the key number
  7376.     CALL    COMND
  7377.     JP    KERMT2        ;Abort on error
  7378.     IFZ    SETKEY_5    ;Abort if no number
  7379.     LD    A,D        ;Get the MSB must be zero
  7380.     IFNZ    SETKEY_4
  7381.     LD    A,E        ;Get the LSB
  7382.     LD    (KEYNUM),A    ;This is the key number
  7383.     LD    A,CMTXT        ;Get the text definition
  7384.     LD    DE,RMTDATA    ;Where to put it
  7385.     LD    (SOUPTR),DE    ;Set the starting address
  7386.     CALL    COMND        ;Call the parser
  7387.     JP    KERMT3        ;Say not confirmed
  7388.     LD    HL,DATA
  7389.     LD    (KEYPTR),HL
  7390.     PUSH    AF
  7391.     XOR    A
  7392.     LD    (KEYLEN),A
  7393.     POP    AF
  7394.     IFZ    SETKEY_3
  7395. SETKEY_1    CALL    GETFCH    ;GET A CHARACTER
  7396.     JR    NZ,SETKEY_3
  7397.     CALL    GTREAL        ;GET THE ACTUAL IF IT IS SPECIAL
  7398.     JP    NZ,KERMIT    ;Abort on bad string
  7399.     LD    E,A        ;PUT IT IN E FOR OUTCHR
  7400.     LD    A,(DLYFLG)    ;WAS IT A DELAY
  7401.     IFZ    SETKEY_2
  7402.     XOR    A
  7403.     LD    (DLYFLG),A    ;RESET THE FLAG
  7404.     JR    SETKEY_1    ;GET A NEW CHARACTER
  7405. SETKEY_2    LD    A,E    ;Get the character
  7406.     CALL    PUTDKEY        ;Put it into the buffer
  7407.     JR    SETKEY_1
  7408. SETKEY_3    LD    HL,DATA
  7409.     LD    A,(KEYLEN)
  7410.     LD    B,A
  7411.     LD    A,(KEYNUM)
  7412.     CALL    DEFKEY
  7413.     JP    KERMIT
  7414. SETKEY_4    LD    DE,OUTRNG
  7415.     CALL    PRTSTR
  7416.     JP    KERMIT
  7417. SETKEY_5    LD    DE,KEYHELP
  7418.     CALL    PRTSTR
  7419. SETKEY_6    CALL    CONIN
  7420.     IFZ    SETKEY_6
  7421.     LD    (KEYNUM),A
  7422.     CALL    VERPRT
  7423.     LD    DE,STRHELP
  7424.     CALL    PRTSTR
  7425.     LD    HL,DATA
  7426.     LD    B,0
  7427. SETKEY_7    CALL    CONIN
  7428.     IFZ    SETKEY_7
  7429.     IFA    128,SETKEY_10
  7430.     LD    (HL),A
  7431.     CALL    VERPRT
  7432.     INC    B
  7433.     LD    A,255
  7434.     IFA    B,SETKEY_10
  7435.     INC    HL
  7436.     JR    SETKEY_7
  7437. SETKEY_10    LD    A,B
  7438.     LD    (KEYLEN),A
  7439.     JR    SETKEY_3
  7440. ;
  7441. ;    Put the decoded value into the buffer pointer to by KEYPTR
  7442. ;
  7443. PUTDKEY    PUSH    HL
  7444.     LD    HL,(KEYPTR)
  7445.     LD    (HL),A
  7446.     INC    HL
  7447.     LD    (KEYPTR),HL
  7448.     LD    HL,KEYLEN
  7449.     INC    (HL)
  7450.     POP    HL
  7451.     RET
  7452. ;end of file
  7453. <<< m4show.asm >>>
  7454. ;    m4show/asm
  7455. ;
  7456. ;THIS IS THE SHOW COMMAND.
  7457. ;
  7458. SHOW    LD    A,SHLEN        ;GET THE OFFSET TO OVERWRITE WITH
  7459.     LD    (SETTAB),A    ;FIX SET TABLE FOR SHOW
  7460.     LD    (SETTAB+1),A
  7461.     LD    A,CMKEY        ;Parse a keyword
  7462.     LD    DE,SHOTAB    ;From this table
  7463.     CALL    COMND        ;Go do it
  7464.     JP    KERMT2        ;Say ambiguous if nothing matches
  7465.     IFA    KYLEN,NOCFM    ;If keyword is KEY, then special case
  7466.     IFA    FILLEN,NOCFM    ;If keyword is FILE, then special case
  7467.     LD    (TEMP1),A    ;SAVE THE JUMP OFFSET
  7468.     LD    A,CMCFM        ;Get a confirm
  7469.     CALL    COMND
  7470.     JP    KERMT3        ;SAY NOT CONFIRMED ON AN ERROR
  7471.     CALL    NEWLIN        ;Get a new line to print on
  7472.     LD    A,(TEMP1)    ;Get the keyword value
  7473. NOCFM    LD    HL,SHOJTB    ;Get the start of the jump table
  7474.     LD    C,A        ;Make BC a 16-bit copy of A
  7475.     LD    B,0
  7476.     ADD    HL,BC        ;HL IS WHERE WE GO
  7477.     LD    BC,KERMIT    ;Put a return address on the
  7478.     PUSH    BC        ;stack to simulate a call
  7479.     JP    (HL)        ;GO DO THE ROUTINE
  7480. ;
  7481. ;    Show command jump table.  The 2 equates embedded in this table
  7482. ;    indicate functions which need furthur parsing.  These are checked
  7483. ;    above, and then handled special.
  7484. ;
  7485. SHOJTB    JP    ESCSTAT        ;SHOW ESCAPE
  7486.     JP    ECHSTAT        ;SHOW LOCAL ECHO
  7487.     JP    EIGSTAT        ;Eight bit quoting status
  7488. FILLEN    EQU    $-SHOJTB
  7489.     JP    FILESTAT    ;Show the file parameters
  7490.     JP    CHKSTAT        ;SHOW BLOCK-CHECK-TYPE
  7491.     JP    EMULSTAT    ;SHOW emulation status
  7492.     JP    PRTSTAT        ;SHOW PRINTER
  7493.     JP    DEBSTAT        ;SHOW DEBUGGING
  7494.     JP    DSKSTAT        ;SHOW DEFAULT DISK
  7495.     JP    BELLSTAT    ;BELL STATUS
  7496.     JP    RCVSTAT        ;SHOW RECEIVE
  7497.     JP    SENDSTAT    ;SHOW SEND
  7498. KYLEN    EQU    $-SHOJTB    ;THESE 2 LINES MUST BE TOGETHER
  7499.     JP    KYSTAT        ;SHOW A KEY TRANSLATION
  7500.     JP    FLOWSTAT    ;SHOW FLOW CONTROL
  7501.     JP    SHOINP        ;SHOW INPUT PARAMETERS
  7502.     JP    SHOOUT        ;SHOW OUTPUT PARAMETERS
  7503.     JP    TAKESTAT    ;SHOW STATUS OF TAKE DISPLAY
  7504.     JP    SHOALL        ;SHOW ALL
  7505. ;
  7506. ;    Show the status of several values.  This is the STATUS command
  7507. ;
  7508. STATUS    LD    A,CMCFM        ;GET A CONFIRM
  7509.     CALL    COMND
  7510.     JP    KERMT3        ;QUIT ON AN ERROR
  7511.     STROUT    SPACSTR
  7512.     LD    HL,DEFTABLE+DEFTLEN-1    ;Get the end of table
  7513.     LD    BC,(TOPADDR)        ;Get the current top
  7514.     OR    A            ;Reset carry
  7515.     SBC    HL,BC            ;Compute difference
  7516.     CALL    NOUT            ;Print the number
  7517.     CALL    NEWLIN
  7518.     CALL    SHOTRANS
  7519.     JP    KERMIT
  7520. ;
  7521. ;    Show the values of all setable values other than keystrokes.
  7522. ;    There is a lot of code here to perform the 2 column output.
  7523. ;
  7524. SHOALL    EQU    $
  7525.     STROUT    SENDRECV    ;Send  Receive   header
  7526.     FORMAT    BELSTR,SHSTRLEN    ;Print setting of BELL
  7527.     FOFFON    BELFLG
  7528.     FORMAT    EOLST,SRSTRLEN    ;Print send/recv EOL values
  7529.     LD    HL,SEOL
  7530.     CALL    SRSTATS
  7531.     FORMAT    PNTSTR,SHSTRLEN    ;Print status of printer
  7532.     FOFFON    PRTFLG
  7533.     FORMAT    RETST,SRSTRLEN    ;Print send/recv turn around values
  7534.     LD    HL,STURN
  7535.     CALL    SRSTATS
  7536.     FORMAT    BUGST,SHSTRLEN    ;Print setting of debug flag
  7537.     FOFFON    DBFLG
  7538.     FORMAT    PCHST,SRSTRLEN    ;Print send/recv padding characters
  7539.     LD    HL,SPADCH
  7540.     CALL    SRSTATS
  7541.     FORMAT    TYPEST,SHSTRLEN    ;Print file-type (ASCII or BINARY)
  7542.     LD    A,(FILTYPE)
  7543.     LD    DE,ASCIIST
  7544.     IFZ    SHOA_1
  7545.     LD    DE,BINST
  7546. SHOA_1    CALL    PRTSTR
  7547.     CALL    NEWLIN
  7548.     FORMAT    QTEST,SRSTRLEN    ;Print send/recv eighth bit quotes
  7549.     LD    HL,SQUOTE
  7550.     CALL    SRSTATS
  7551.     FORMAT    LOCST,SHSTRLEN    ;Print local echo setting
  7552.     FOFFON    ECOFLG
  7553.     FORMAT    TOST,SRSTRLEN    ;Print send/recv time out values
  7554.     LD    HL,STIME
  7555.     CALL    SRSTATS
  7556.     FORMAT    ESCST,SHSTRLEN    ;Print escape character
  7557.     CALL    STDOUT
  7558.     CALL    ESCPR
  7559.     CALL    STDEND
  7560.     CALL    NEWLIN
  7561.     FORMAT    PADST,SRSTRLEN    ;Print send/recv padding amounts
  7562.     LD    HL,SPAD
  7563.     CALL    SRSTATS
  7564.     FORMAT    FILST,SHSTRLEN    ;Print file warning setting
  7565.     FOFFON    FLWFLG
  7566.     FORMAT    SOPST,SRSTRLEN    ;Print send/recv SOP characters
  7567.     LD    HL,SSOHCH
  7568.     CALL    SRSTATS
  7569.     FORMAT    FLOWST,SHSTRLEN    ;Print flow control setting
  7570.     LD    A,(FLOFLG)
  7571.     LD    DE,XONSTR
  7572.     IFNZ    SHOA_2
  7573.     LD    DE,NONSTR
  7574. SHOA_2    CALL    PRTSTR
  7575.     CALL    NEWLIN
  7576.     STROUT    INPUTSTR    ;Print Input settings message
  7577.     FORMAT    DSKDEF,SHSTRLEN    ;Print the default disk drive
  7578.     CALL    STDOUT
  7579.     LD    A,(DEFDSK)
  7580.     CALL    CONOUT
  7581.     CALL    STDEND
  7582.     CALL    NEWLIN
  7583.     FORMAT    IDSPST,SRSTRLEN    ;Print INPUT DISPLAY setting
  7584.     LD    A,(INDSP)
  7585.     CALL    JUSONOFF
  7586.     LD    BC,0620H    ;Display 6 spaces (B is count, C is char)
  7587.     CALL    MULDIS
  7588.     CALL    DISSEP
  7589.     FORMAT    EMSTR,SHSTRLEN    ;Print setting for emulation
  7590.     LD    A,(EMULFLAG)
  7591.     LD    DE,NOESTR
  7592.     IFZ    SHOA_3
  7593.     LD    DE,DMESTR
  7594. SHOA_3    CALL    PRTSTR
  7595.     CALL    NEWLIN
  7596.     FORMAT    CSEST,SRSTRLEN    ;Print INPUT CASE-IGNORE setting
  7597.     LD    A,(CSEFLG)
  7598.     CALL    JUSONOFF
  7599.     LD    BC,0620H
  7600.     CALL    MULDIS
  7601.     CALL    DISSEP
  7602.     FORMAT    DISPST,SHSTRLEN    ;Print file dispostion
  7603.     CALL    STDOUT
  7604.     LD    A,(DISCARD)
  7605.     LD    DE,DSCRDST
  7606.     IFNZ    SHOA_4
  7607.     LD    DE,KEEPST
  7608. SHOA_4    CALL    PRTSTR
  7609.     CALL    STDEND
  7610.     CALL    NEWLIN
  7611.     STROUT    OUTPUTSTR    ;Print Output settings message
  7612.     FORMAT    BCKST,SHSTRLEN    ;Print block check type
  7613.     CALL    STDOUT
  7614.     LD    A,(CHKTYP)
  7615.     CALL    CONOUT
  7616.     STROUT    BCKST1
  7617.     CALL    STDEND
  7618.     CALL    NEWLIN
  7619.     FORMAT    ODSPST,SRSTRLEN    ;Print OUTPUT DISPLAY setting
  7620.     LD    A,(OTDSP)
  7621.     CALL    JUSONOFF
  7622.     LD    BC,0620H
  7623.     CALL    MULDIS
  7624.     CALL    DISSEP
  7625.     FORMAT    TAKST,SHSTRLEN    ;Print take file display setting
  7626.     FOFFON    TAKLOG
  7627.     FORMAT    HSTEST,SRSTRLEN    ;Print OUTPUT HOST-ECHO setting
  7628.     LD    A,(ECHFLG)
  7629.     CALL    JUSONOFF
  7630.     LD    BC,0620H
  7631.     CALL    MULDIS
  7632.     CALL    DISSEP
  7633.     FORMAT    EIGHTSTR,SHSTRLEN ;Print eight bit quoting status
  7634.     FOFFON    EBQFLG
  7635.     CALL    NEWLIN
  7636.     JP    KERMIT        ;Get a new command
  7637. ;
  7638. ;    Print status of take file display
  7639. ;
  7640. TAKESTAT    STROUT    TAKST
  7641.     SHOFFON    TAKLOG
  7642. ;
  7643. ;    Print status of eighth bit quoting
  7644. ;
  7645. EIGSTAT    STROUT    EIGHTSTR
  7646.     SHOFFON    EBQFLG
  7647. ;
  7648. ;    Print file disposition
  7649. ;
  7650. DISPSTAT    STROUT    DISPST
  7651.     CALL    STDOUT
  7652.     LD    A,(DISCARD)
  7653.     LD    DE,DSCRDST
  7654.     IFNZ    DISP_4
  7655.     LD    DE,KEEPST
  7656. DISP_4    CALL    PRTSTR
  7657.     CALL    STDEND
  7658.     JP    NEWLIN
  7659. ;
  7660. ;    Show the SET INPUT parameters
  7661. ;
  7662. SHOINP    CALL    NEWLIN        ;GET A NEW LINE
  7663.     STROUT    CSEST
  7664.     LD    A,(CSEFLG)
  7665.     CALL    COFFON
  7666.     CALL    NEWLIN
  7667.     STROUT    IDSPST
  7668.     SHOFFON    INDSP
  7669. ;
  7670. ;    Print the SET OUTPUT parameters
  7671. ;
  7672. SHOOUT    CALL    NEWLIN
  7673.     STROUT    HSTEST
  7674.     LD    A,(ECHFLG)
  7675.     CALL    COFFON
  7676.     CALL    NEWLIN
  7677.     STROUT    ODSPST
  7678.     LD    A,(OTDSP)
  7679.     CALL    COFFON
  7680.     JP    NEWLIN
  7681. ;
  7682. ;    Flow control setting
  7683. ;
  7684. FLOWSTAT    STROUT    FLOWST
  7685.     LD    DE,XONSTR
  7686.     LD    A,(FLOFLG)
  7687.     OR    A
  7688.     JP    NZ,PRTSTR
  7689.     LD    DE,NONSTR
  7690.     JP    PRTSTR
  7691. ;
  7692. ;    Show status of all send parameters
  7693. ;
  7694. SENDSTAT    LD    A,CMCFM
  7695.     CALL    COMND
  7696.     JP    KERMT3
  7697.     CALL    NEWLIN
  7698.     SHSSTAT    EOLST,SEOL
  7699.     SHSSTAT    RETST,STURN
  7700.     SHSSTAT    PCHST,SPADCH
  7701.     SHSSTAT    QTEST,SQUOTE
  7702.     SHSSTAT    TOST,STIME
  7703.     SHSSTAT    PADST,SPAD
  7704.     SHSSTAT    SOPST,SSOHCH
  7705.     RET
  7706. ;
  7707. ;    Show status of all receive parameters
  7708. ;
  7709. RCVSTAT    LD    A,CMCFM
  7710.     CALL    COMND
  7711.     JP    KERMT3
  7712.     CALL    NEWLIN
  7713.     SHRSTAT    EOLST,REOL
  7714.     SHRSTAT    RETST,RTURN
  7715.     SHRSTAT    PCHST,RPADCH
  7716.     SHRSTAT    QTEST,RQUOTE
  7717.     SHRSTAT    TOST,RTIME
  7718.     SHRSTAT    PADST,RPAD
  7719.     SHRSTAT    SOPST,RSOHCH
  7720.     RET
  7721. ;
  7722. ;    Show status of bell for KERMIT messages
  7723. ;
  7724. BELLSTAT    STROUT    BELSTR
  7725.     SHOFFON    BELFLG        ;Print the bell status
  7726. ;
  7727. ;    Show status of local echo
  7728. ;
  7729. ECHSTAT    STROUT    LOCST        ;Local echo is ...
  7730.     SHOFFON    ECOFLG        ;Print local echo status
  7731. ;
  7732. ;    Show the type of emulation
  7733. ;
  7734. EMULSTAT    STROUT    EMSTR    ;Emulation is ...
  7735.     LD    A,(EMULFLAG)
  7736.     OR    A
  7737.     LD    DE,NOESTR
  7738.     JP    Z,PRTSTR
  7739.     LD    DE,DMESTR
  7740.     JP    PRTSTR
  7741. ;
  7742. ;    Show file parameters
  7743. ;
  7744. FILESTAT    LD    DE,FILETAB    ;Get the options
  7745.     LD    A,CMKEY        ;Get a keyword
  7746.     CALL    COMND        ;Parse it
  7747.     JP    KERMT2        ;Say ambiguous if error
  7748.     CALL    NEWLIN
  7749.     LD    (TEMP1),A    ;Save the value
  7750.     LD    A,CMCFM        ;Get a confirm
  7751.     CALL    COMND
  7752.     JP    KERMT3        ;Say not confirmed if it is not
  7753.     LD    A,(TEMP1)    ;Get the value back
  7754.     LD    C,A        ;Put it into BC as 16 bits
  7755.     LD    B,0
  7756.     LD    HL,SHFLJTAB    ;Get the jump table
  7757.     ADD    HL,BC        ;Get the destination
  7758.     JP    (HL)        ;Jump into the table
  7759. ;
  7760. SHFLJTAB    EQU    $
  7761.     JP    DISPSTAT    ;SHOW FILE DISPOSITION
  7762.     JP    TYPESTAT    ;SHOW FILE TYPE
  7763.     JP    WARNSTAT    ;SHOW FILE WARNING
  7764. ;
  7765. ;    Show file-type, ASCII or BINARY
  7766. ;
  7767. TYPESTAT    STROUT    TYPEST    ;File type is ...
  7768.     LD    DE,ASCIIST    ;Get ASCII type
  7769.     LD    A,(FILTYPE)    ;Check the type
  7770.     OR    A        ;Set the flags
  7771.     JP    Z,PRTSTR    ;Jump if ASCII
  7772.     LD    DE,BINST    ;Get binary type
  7773.     JP    PRTSTR        ;Print the string in rev video
  7774. ;
  7775. ;    Show the default disk-drive
  7776. ;
  7777. DSKSTAT    STROUT    DSKDEF        ;Default disk is ...
  7778.     CALL    STDOUT        ;REVERSE VIDEO ON
  7779.     LD    A,(DEFDSK)    ;GET THE CHARACTER 0-9
  7780.     CALL    CONOUT
  7781.     JP    STDEND        ;REVERSE VIDEO OFF
  7782. ;
  7783. ;    Show status of file warning
  7784. ;
  7785. WARNSTAT    STROUT    FILST    ;File warning is ...
  7786.     SHOFFON    FLWFLG        ;Show the file warning status
  7787. ;
  7788. ;    Show status of debug setting
  7789. ;
  7790. DEBSTAT    STROUT BUGST        ;Debugging is ...
  7791.     SHOFFON    DBFLG        ;Show the debugging
  7792. ;
  7793. ;    Show status of logging to the printer.
  7794. ;
  7795. PRTSTAT    STROUT    PNTSTR        ;Printer is ...
  7796.     SHOFFON    PRTFLG        ;Show printer status
  7797. ;
  7798. ;    Show block check type
  7799. ;
  7800. CHKSTAT    STROUT    BCKST        ;Block check type is ...
  7801.     CALL    STDOUT        ;REVERSE VIDEO ON
  7802.     LD    A,(CHKTYP)    ;GET THE TYPE (CHARACTER 1, 2, OR 3)
  7803.     CALL    CONOUT
  7804.     CALL    STDEND        ;REVERSE VIDEO OFF
  7805.     LD    DE,BCKST1    ;GET REST OF TEXT ("-CHARACTER")
  7806.     JP    PRTSTR        ;. . .
  7807. ;
  7808. ;    Show the escape character
  7809. ;
  7810. ESCSTAT    STROUT    ESCST        ;Escape character is ...
  7811.     CALL    STDOUT        ;REVERSE VIDEO ON
  7812.     CALL    ESCPR        ;PRINT THE ESCAPE CHAR.
  7813.     JP    STDEND        ;REVERSE VIDEO OFF
  7814. ;
  7815. ;    Pick a character up from (HL+BC)
  7816. ;
  7817. GETTRN    EQU    $
  7818.     LD    C,A
  7819.     ADD    HL,BC
  7820.     LD    A,(HL)
  7821.     RET
  7822. ;
  7823. ;    Put a characcter at (HL+BC)
  7824. ;
  7825. PUTTRN    EQU    $
  7826.     ADD    HL,BC
  7827.     LD    (HL),A
  7828.     RET
  7829. ;
  7830. ;    Show the mapping of a keystroke
  7831. ;
  7832. KYSTAT    LD    A,CMNUM        ;GET WHICH KEY
  7833.     CALL    COMND        ;GET IT
  7834.     JP    KERMT3        ;SAY NOT CONFIRMED
  7835.     IFZ    KYST_4        ;Say ambiguous if no number given
  7836.     LD    A,D        ;CHECK FOR OVERFLOW
  7837.     IFNZ    KYST_3        ;Jump if > 255
  7838.     CALL    NEWLIN
  7839.     LD    A,E        ;Get the key number
  7840. KYST_0    EQU    $
  7841.     CALL    KEYTRANS    ;Do the translation
  7842.     OR    H        ;Check if there is one
  7843.     JR    Z,KYST_2    ;Jump if not
  7844.     CALL    NEWLIN        ;Print a new line
  7845. KYST_1    EQU    $
  7846.     LD    A,(HL)        ;Get a character
  7847.     OR    A        ;Is it a null
  7848.     RET    Z        ;Return if end of string
  7849.     CALL    VERPRT        ;Print verbose description
  7850.     INC    HL        ;Point to next
  7851.     JR    KYST_1        ;Loop until done
  7852. KYST_2    EQU    $
  7853.     LD    DE,NODEF    ;Print undefined message
  7854.     JP    PRTSTR
  7855. KYST_3    STROUT    OUTRNG        ;Print bad value message
  7856.     JP    KERMIT
  7857. KYST_4    STROUT    KEYHELP        ;Ask them to press a key
  7858. KYST_5    CALL    CONIN        ;Get the keystroke
  7859.     IFZ    KYST_5        ;If none pressed, then loop
  7860.     PUSH    AF        ;Save the key
  7861.     CALL    VERPRT        ;Print it out
  7862.     POP    AF        ;Restore key
  7863.     JR    KYST_0        ;Go process the key
  7864. ;
  7865. ;    Print verbose string of A.  Control characters appear as
  7866. ;    ^M for <CR>, etc...
  7867. ;
  7868. VERPRT    IFAGE    ' ',VER_2    ;Jump if character not a control char
  7869. VER_1    PUSH    AF        ;Save the character
  7870.     LD    A,'^'        ;Print a carrat first
  7871.     CALL    CONOUT        ;Output it
  7872.     POP    AF        ;Get the character back
  7873.     ADD    A,64        ;Uncontrolify it
  7874.     AND    127        ;Remove eighth bit for <DEL>
  7875.     JP    CONOUT        ;Output and return
  7876. VER_2    IFA    127,VER_1    ;If <DEL> then process as control char
  7877.     JP    C,CONOUT    ;If less that 127 then print it
  7878. ;
  7879. ;    Characters greater than 127 are printed as \nnn, where
  7880. ;    nnn is the 3 digit octal number representing the value
  7881. ;    of the character
  7882. ;
  7883.     LD    C,A        ;Save the character
  7884.     LD    A,'\'        ;Get a leading \
  7885.     CALL    CONOUT        ;Output it
  7886.     LD    A,C        ;Get a copy of the character
  7887.     AND    0C0H        ;Save only 2 higher order bits
  7888.     RLC    A        ;Move the 2 bits into the lower
  7889.     RLC    A        ;order bits of A
  7890.     AND    3        ;Make sure nothing else is there
  7891.     ADD    A,'0'        ;Make it a printable value
  7892.     CALL    CONOUT        ;Output it
  7893.     LD    A,C        ;Get another copy
  7894.     AND    38H        ;Save bits 5-3
  7895.     SRL    A        ;Align in lower order bits of
  7896.     SRL    A        ;the accumulator
  7897.     SRL    A
  7898.     AND    07H        ;Truncate to 3 bits only
  7899.     ADD    A,'0'        ;Make it printable
  7900.     CALL    CONOUT        ;Output it
  7901.     LD    A,C        ;Get the character again
  7902.     AND    07H        ;Save lower 3 bits, 2-0
  7903.     ADD    A,'0'        ;Make it printable
  7904.     JP    CONOUT        ;Output it, and return
  7905. ;
  7906. ;    Right justify the string in DE, within a field as wide as
  7907. ;    HL specifies.
  7908. ;
  7909. LEFTPAD    PUSH    DE        ;Save the strings address for printing
  7910.     CALL    STRLEN        ;Get the length in BC
  7911.     OR    A        ;Reset the carry
  7912.     SBC    HL,BC        ;Compute the difference to pad
  7913.     LD    B,L        ;Make B the count
  7914.     LD    A,L        ;Check for no padding
  7915.     IFZ    LEFTP_2        ;Jump if none needed
  7916. LEFTP_1    LD    A,' '        ;Get the pad character
  7917.     CALL    CONOUT        ;output one
  7918.     DJNZ    LEFTP_1        ;Loop until done
  7919. LEFTP_2    POP    DE        ;Restore the strings address
  7920.     JP    PRTSTR        ;Print it, and return
  7921. ;
  7922. ;
  7923. DISSEP    LD    DE,SEPAR
  7924.     JP    PRTSTR
  7925. ;
  7926. ;    Display SEND and RECEIVE status as indicated by values at
  7927. ;    the address pointed to be HL, and HL+1.
  7928. ;
  7929. SRSTATS    EQU    $
  7930.     LD    A,(HL)        ;Get the value
  7931.     PUSH    HL        ;Save the address
  7932.     CALL    DISNUM        ;Display the value
  7933.     LD    A,' '        ;Put in an extra blank
  7934.     CALL    CONOUT
  7935.     POP    HL        ;Get the address back
  7936.     INC    HL        ;Point to receive value
  7937.     LD    A,(HL)        ;Get the value
  7938.     CALL    DISNUM        ;Display the value
  7939.     CALL    DISSEP        ;Put in the separator
  7940.     RET
  7941. ;
  7942. ;    Display value in A, in a 5 character field
  7943. ;
  7944. DISNUM    EQU    $
  7945.     LD    DE,DECBUF    ;Get the buffer
  7946.     LD    L,A        ;Put the value into HL
  7947.     LD    H,0
  7948.     CALL    XHEXDEC        ;Convert to printable
  7949.     EX    DE,HL        ;Put ending address into HL
  7950.     LD    (HL),EOS    ;Put in a terminator
  7951.     STROUT    DECBUF        ;Output the string
  7952.     RET
  7953. ;
  7954. ;    Display the character in C, B times on the screen
  7955. ;
  7956. MULDIS    PUSH    AF        ;Save AF, don't destroy it
  7957. MULDIS1    LD    A,C        ;Get the character to print
  7958.     CALL    CONOUT        ;Output one
  7959.     DJNZ    MULDIS1        ;Loop until all done
  7960.     POP    AF        ;Restore AF
  7961.     RET            ;Return
  7962. ;
  7963. ;    Print the ON string, or the OFF string, based on the value in
  7964. ;    A.
  7965. ;
  7966. JUSONOFF    EQU    $
  7967.     LD    DE,OFFSTR    ;Get the default before test
  7968.     IFZ    JUSON_1        ;Jump if OFF is right
  7969.     LD    DE,ONSTR    ;Get ON, since A is non-zero
  7970. JUSON_1    LD    HL,7        ;Make the field 7 characters wide
  7971.     JP    LEFTPAD        ;Go pad it, and return from there
  7972. ;
  7973. ;    Print ON or OFF based on the status of A.  This is different
  7974. ;    from JUSONOFF because here, we do not right justify in a
  7975. ;    fixed length field.
  7976. ;
  7977. COFFON    LD    DE,OFFSTR    ;START WITH OFF AS DEFAULT
  7978.     OR    A        ;SET THE FLAGS
  7979.     JP    Z,PRTSTR    ;GO PRINT OFF IF A ZERO
  7980.     LD    DE,ONSTR
  7981.     JP    PRTSTR
  7982. ; end of file
  7983. <<< m4str.asm >>>
  7984. ;    M4STR/ASM 
  7985. ;Pure storage.
  7986. FLINK    DS    256        ;FAILURE LINK STORAGE
  7987. STRING    DS    256        ;STORAGE FOR THE STRING TO MATCH
  7988. LENGTH    DB    0        ;LENGTH OF STRING
  7989. BUFPTR    DW    0        ;POINTER INTO THE BUFFER
  7990. MULBUF    DS    256        ;THE BUFFER
  7991. CTLTBL    DB    35
  7992.     DB    'ACK',6,254,'BEL',7,254,'BS',8,254
  7993.     DB    'CAN',24,254,'CR',13,254,'DC1',17,254
  7994.     DB    'DC2',18,254,'DC3',19,254,'DC4',20,254
  7995. DLY    EQU    250
  7996.     DB    'DEL',127,254,'DLE',16,254,'DLY*',DLY,254
  7997.     DB    'EM',25,254,'ENQ',5,254,'EOT',4,254
  7998.     DB    'ESC',27,254,'ETB',23,254,'ESC',27,254
  7999.     DB    'FF',12,254,'FS',28,254,'GS',29,254
  8000.     DB    'HT',9,254,'LF',10,254,'NAK',21,254
  8001.     DB    'NUL',0,254,'RS',30,254,'SI',15,254
  8002.     DB    'SO',14,254,'SOH',1,254,'SPA',32,254
  8003.     DB    'STX',2,254,'SUB',26,254,'SYN',22,254
  8004.     DB    'VS',31,254,'VT',31,254
  8005.     DB    0
  8006. GTSTRG    DS    6        ;String space for storing above ANSI strs
  8007. WLDBUF    DS    6        ;Save wildcards here
  8008. ALRMAD    DW    ALARM        ;Delay TCB
  8009. TIMER    DW    0        ;Counter
  8010. RECTIME    DW    RECTIMOUT    ;Receive timeout TCB
  8011. SVTIMER    DW    0
  8012. TKNAME    DB    'KERMIT/INI',13    ;Name of the initialization file
  8013. TKLEN    EQU    $-TKNAME    ;Length of the name
  8014. ;    THE FOLLOWING FLAGS ARE STATE FLAGS FOR WHEN EOF OCCURS.
  8015. ;    IF ANY ARE SET WHEN EOF OCCURS THAN AN ERROR HAS OCCURED.
  8016. INBUF    DS    102H        ;FILE INPUT BUFFER
  8017. HSTCHR    DB    0        ;TERMINATOR FROM THE HOST IN '*'
  8018. DLYFLG    DB    0        ;WAS A DELAY INVOKED
  8019. CHRGOT    DB    0        ;ACTUAL CHARACTER FROM THE FILE
  8020. ;    PARSING OPTION FLAGS
  8021. CSEFLG    DB    0        ;IGNORE CASE FLAG
  8022. SPTFLG    DB    0        ;ECHOING OF SET OPTIONS IS ON
  8023. ECHFLG    DB    0        ;IS ECHO OF SENT STRINGS ON
  8024. EXTFLG    DB    1        ;EXIT AT EOF FLAG
  8025. ;    EARLY EOF STATE FLAGS
  8026. ESFLG    DB    0        ;ESCAPE CHARACTER SEQUENCE
  8027. CTLFLG    DB    0        ;CONTROL CHARACTER SEQUENCE
  8028. SNDFLG    DB    0        ;SEND STATE FLAG
  8029. RECFLG    DB    0        ;RECEIVE SATE FLAG
  8030. MULFLG    DB    0        ;MULTI-SEND STATE FLAG
  8031. OPTFLG    DB    0        ;SET OPTIONS STATE FLAG
  8032. BUFFSIZE    EQU    2048        ;Size of buffer
  8033. SRCPTR        DW    0        ;Source string pointer
  8034. HASWILD        DB    0        ;Wild cards present flag
  8035. SPAT        DW    0        ;Pattern pointer
  8036. SSTR        DW    0        ;String pointer
  8037. PSAVE        DW    0        ;Saved pattern pointer
  8038. SSAVE        DW    0        ;Saved string pointer
  8039. SDIRDRV        DB    '0'        ;Saved current drive
  8040. DIRBUFF        DS    256        ;Buffer for DIR/SYS record
  8041. COMPNAME    DS    32        ;Complete file name
  8042. FNLEN        DB    0        ;Length of pattern
  8043. MOREDRV        DB    0        ;More drives to check flag
  8044. DIRFCB        DB    'DIR/SYS:'    ;Directory file control block
  8045. DIRDRV        DB    '0',CR        ;Where to put the drive number
  8046.         DC    23,0        ;Remaining, for 33 bytes total
  8047. TFBUF        DS    256        ;Current pattern storage
  8048. FILEBUFF    DS    BUFFSIZE    ;Place for file name list
  8049. FBPTR        DW    FILEBUFF    ;Pointer to next available space
  8050. FILECNT        DB    0        ;Number of file names in FILEBUFF
  8051. DIRSPEC        DB    'DIR/SYS:'    ;DIR/SYS pattern 
  8052. DLEN        EQU    $-DIRSPEC    ;Length of text to move
  8053. PARMS        DB    80H        ;@PARAM parse table
  8054.         DB    56H
  8055.         DB    'SYSTEM'
  8056. SYSRESP        DB    0
  8057.         DW    SYSFLAG
  8058.         DB    55H
  8059.         DB    'INVIS'
  8060. INVRESP        DB    0
  8061.         DW    INVFLAG
  8062.         DB    0
  8063. SYSFLAG        DW    0
  8064. INVFLAG        DW    0
  8065. BADCD    DB    13,'Bad code inside of <...>',39,'s',EOS
  8066. NOECHO    DB    13,'Host did not echo last character sent',13,EOS
  8067. QUTMES    DB    13,'Ignoring => ',EOS
  8068. STOBIG    DB    13,'String too big for buffer!',13,EOS
  8069. LGFAIL    DB    13,'Operation aborted!',13,EOS
  8070. PREESC    DB    13,'Missing character following \',13,EOS
  8071. PRECTL    DB    13,'Missing character following ^',13,EOS
  8072. PREOPT    DB    13,'Missing > in <...> sequence',13,EOS
  8073. TXTHLP    DB    CR,16,'Enter a text string',17,CR,EOS
  8074. FILHLP    DB    CR,16,'Enter a file specification!',17,CR,EOS
  8075. NUMHLP    DB    CR,16,'Enter a Decimal number!',17,CR,EOS
  8076. FILESFND    DB    'Sending files:',CR,EOS
  8077. NOFILES    DB    16,'No files found',17,CR,EOS
  8078. OUTOFSTR    DB    16,'Too many files, out of space',17,CR,EOS
  8079. NOTIMER    DB    CR,16,'No task slots available for timeout',17,CR,EOS
  8080. NODELAY    DB    CR,16,'No task slots available for delay, using 1 second'
  8081.     DB    17,CR,EOS
  8082. NOMEM    DB    CR,16,'Can',39,'t move LOW$ to new value',17,CR,EOS
  8083. BADPARM    DB    CR,'Bad parameter list',CR,EOS
  8084. TRANABRT    DB    'Transaction aborted',CR,EOS
  8085. TRANCANC    DB    'Transaction canceled',CR,EOS
  8086. WRTPROT    DB    CR,'Drive is write protected',EOS
  8087. DSKOK    DB    CR,'Default drive changed',CR,EOS
  8088. REMOVSTR    DB    'Removing: ',EOS
  8089. TIMEMES    DB    '   Time: ',EOS
  8090. LOGERROR    DB    'Log file I/O error.  '
  8091. ERMS20    DB    'Log file CLOSED!',CR,EOS
  8092. BLANKS    DB    '    ',EOS
  8093. INTRO    DB    CR,'TRS-80 Model 4(p) TRSDOS 6.2 - KERMIT - Version'
  8094.     DB    ' 5.2',CR,'By Gregg Wonderly',CR,CR
  8095.     DB    'Type a ? for help at any time....',CR,EOS
  8096. CFCL    DB    CR,'No *CL DCB!',CR,EOS
  8097. CFSO    DB    CR,'No *SO DCB!',CR,EOS
  8098. CFSI    DB    CR,'No *SI DCB!',CR,EOS
  8099. NONDCB    DB    CR,'Can not find a DCB for the *FI or *FO devices!'
  8100.     DB    CR,EOS
  8101. NOSPACE    DB    CR,'Not enough space left for definition',CR,EOS
  8102. KPLUS    DB    'K + ',EOS
  8103. BYTESMES    DB    ' bytes transfered.',EOS
  8104. KEYHELP    DB    CR,'Press keystroke you desire: ',EOS
  8105. STRHELP    DB    CR,'Enter definition string, end with <BREAK> '
  8106.     DB    '(255 characters MAX)',CR,EOS
  8107. SPACSTR    DB    CR,'Remaining key definition space: ',EOS
  8108. TOOLONG    DB    CR,'String too long for one packet!',CR,EOS
  8109. NPKTSTR    DB    CR,'Number of packets  => ',EOS
  8110. NRTRSTR    DB    CR,'Number of retries  => ',EOS
  8111. NCHRSTR    DB    CR,'Bytes transfered   => ',EOS
  8112. NRECCH    DB    CR,'Kbytes received    => ',EOS
  8113. NSNDCH    DB    CR,'Kbytes transmitted => ',EOS
  8114. CBATCH    DB    32,16,'[Cancelling batch]',17,32,EOS
  8115. CFILE    DB    32,16,'[Cancelling file]',17,32,EOS
  8116. UNKNOWN    DB    CR,'Unknown packet type',CR,EOS
  8117. HELPMSG    DB    CR,'     CTRL-F => Cancel file            '
  8118.     DB    'CTRL-B => Cancel Batch'
  8119.     DB    CR,'     CTRL-C => Quit protocol          '
  8120.     DB    'CTRL-A => Transfer status'
  8121.     DB    CR,'     CTRL-D => Toggle debugging       '
  8122.     DB    'CTRL-H => This message'
  8123.     DB    CR,'     CTRL-E => Send error, quit       '
  8124.     DB    'ENTER  => Resend last packet',CR,EOS
  8125. RMMES    DB    BELL,32,16,'[Discarded]',17,32,EOS
  8126. DO62DR    DB    'CAT '
  8127. DO61DR    DB    'DIR '
  8128. DIRCMD    DS    4
  8129. DIRBUF    DS    256
  8130. DEFTRLOG    DB    'TRANS/LOG',CR
  8131. DEFSESLOG    DB    'SESSION/LOG',CR
  8132. DEFDEBLOG    DB    'DEBUG/LOG',CR
  8133. DECBUF    EQU    $
  8134. NBUFF    DS    6
  8135. VISIBLE    DB    0
  8136. THEVAL    DW    0
  8137. RMTPTR    DW    0
  8138. OUTADDR    DW    0
  8139. PREVCH    DB    0
  8140. CURLEN    DB    0
  8141. MAXLEN    DB    0
  8142. CURCOL    DB    0
  8143. MAXCOL    DB    78
  8144. RPTFLG    DB    0
  8145. NEXT    DW    0
  8146. RPTCNT    DB    0
  8147. RPTQ    DB    '~'
  8148. EBQFLG    DB    1
  8149. EBQ    DB    '&'
  8150. MYCTLQ    DB    '#'
  8151. LEFTOVER    DS    7
  8152. CH    DW    0
  8153. DISCARD    DB    0
  8154. LOGNAMES    DB    1
  8155. INITRMT    DW    0
  8156. INITCNT    DW    0
  8157. PKTTYPE    DB    0
  8158. FLDLEN    DW    0
  8159. KTRANS    DW    0
  8160. RTRANS    DW    0,0
  8161. STRANS    DW    0,0
  8162. CURTRANS    DW    0,0
  8163. SOUPTR    DW    0
  8164. XOFREC    DB    0
  8165. TAKLOG    DB    0
  8166. RECTYP    DB    0
  8167. SNDTYP    DB    0
  8168. INDSP    DB    0
  8169. OTDSP    DB    0
  8170. PREVLCHR    DB    0    ;Previous character logged to session log
  8171. TRTAB    DB    0,1,2,3,4,5,6,7,24,9,26,11,12,29,0,0,16,17,18,19,20
  8172.     DB    21,22,23,24,25,26,27,28,29,30,31,32,33
  8173. KEYTABLE    DC    512,0    ;Must be 256 words of zeroes
  8174.     DW    0        ;A little padding for off by one errors
  8175. TOPADDR    DW    DEFTABLE
  8176. DEFTABLE    DS    2048    ;Key definition space
  8177. DEFTLEN        EQU    $-DEFTABLE
  8178. KEYPOS    DW    ATNULL        ;Initial buffered string pointer
  8179. ATNULL    DB    0        ;A null byte to signal no characters
  8180. DIFFADDR    DW    0
  8181. STRINGLEN    DB    0
  8182. SAVEDKEY    DB    0
  8183. KEYSTRING    DW    0
  8184. KEYNUMBER    DB    0
  8185. TABLEADDR    DW    0
  8186. CMPADDR    DW    0
  8187. MOVEDIFF    DW    0
  8188. KEYNUM    DB    0
  8189. KEYPTR    DW    0
  8190. KEYLEN    DB    0
  8191. OUTRNG    DB    CR,'Value out of range!!',CR,EOS
  8192. NODEF    DB    CR,'No definition exists',EOS
  8193. SOUFCB    DS    40
  8194. TAKFLG    DB    0
  8195. INCNT    DB    0
  8196. XFFLG    DB    0
  8197. FLOFLG    DB    1
  8198. TFCB    DS    32
  8199. OLDLOW    DW    0
  8200. FLAGS    DW    0
  8201. BEPLEN    DB    0
  8202. BELFLG    DB    1
  8203. CLDCB    DW    0
  8204. TMIDCB    DW    0
  8205. TMODCB    DW    0
  8206. RFIDCB    DW    0
  8207. MAXCNT    DB    180
  8208. SVMAX    DB    80
  8209. DISFLG    DB    1
  8210. HLPMES    DB    8,' One of the following...',CR,EOS
  8211. SORFLG    DB    0
  8212. MAXTRY    DB    7
  8213. GENTYPE    DB    0
  8214. GENLEN    DB    0
  8215. SORLOC    DW    0
  8216. LOGOPN    DB    CR,16,'Logfile is already OPEN!',17,CR,EOS
  8217. NOLOGF    DB    CR,16,'Logfile is not OPEN!',17,CR,EOS
  8218. SNDREC    DB    EOS
  8219. KERREC    DB    13,'Receiving => ',EOS
  8220. KERSND    DB    13,'Sending => ',EOS
  8221. DSSOP    EQU    1
  8222. DRSOP    EQU    1
  8223. SWTBUF    DS    2048
  8224. CONCRS    DW    0
  8225. CMDCRS    DW    0
  8226. FTIME    DB    0
  8227. SNDST    DB    0
  8228. TIME    DB    30H
  8229. TBUF    DS    256    ;TAKE COMMAND INPUT BUFFER.
  8230. ;
  8231. ;    The next 512 bytes produce a 256 byte circular buffer for
  8232. ;    the communications input routine.
  8233. ;
  8234.     DS    256
  8235. CHRBUF    DS    256
  8236. CURCHR    DW    CHRBUF        ;Buffer is initially empty
  8237. NXTCHR    DW    CHRBUF
  8238.     DB    'SETCOM '
  8239. CLBUF    DS    256
  8240. KERM    DB    14,16,17,'KERMIT 4(p)>',EOS    ;cursor on at prompt
  8241. CRLF    DB    CR,EOS
  8242. ERMES1    DB    CR,16,'Unrecognized command',17,CR,EOS
  8243. ERMES2    DB    CR,16,'Illegal character',17,CR,EOS
  8244. ERMES3    DB    CR,16,'Not confirmed',17,CR,EOS
  8245. ERMES4    DB    'Unable to receive initiate',CR,EOS
  8246. ERMES5    DB    'Unable to receive file name',CR,EOS
  8247. ERMES6    DB    'Unable to receive end of file',CR,EOS
  8248. ERMS10    DB    'Unable to receive data',CR,EOS
  8249. ERMS17    DB    CR
  8250. ERMS11    DB    'System DOS error',CR,EOS
  8251. ERMS14    DB    'No acknowledgement from the host',CR,EOS
  8252. ERMS15    DB    CR,'Unable to find file',CR,EOS
  8253. ERMS16    DB    'Unable to rename file',EOS
  8254. ERMS18    DB    CR,'Unable to tell host that the session is finished',EOS
  8255. ERMS19    DB    CR,'Unable to tell host to logout',EOS
  8256. INFMS3    DB    BELL,CR,'Completed',EOS
  8257. INFMS4    DB    BELL,'Failed',EOS
  8258. INFMS5    DB    'Renaming file => ',EOS
  8259. INFMS6    DB    CR,'<Closing the log file>',EOS
  8260. INFMS7    DB    CR,'<Connected to remote host, type ',EOS
  8261. INFMS8    DB    'C to return>',CR
  8262.     DB    '<CLEAR> is Control-',95,CR,EOS
  8263. INFMS9    DB    CR,'<Connection closed, back at micro>',EOS
  8264. INMS10    DB    'Control-',EOS
  8265. INMS13    DB    BELL,CR,'Interrupted',EOS
  8266. INMS18    DB    CR,'File KILLED',EOS
  8267. CFRMES    DB    CR,16,'Confirm with <ENTER>, cancel with <BREAK>',17,CR
  8268.     DB    EOS
  8269. CMIN00    EQU    CFRMES
  8270. ABRTMSG    DB    'Transfer aborted...'
  8271. ABRTMSGLEN    EQU    $-ABRTMSG
  8272. ESCMES    DB    CR,'Type the new escape character: ',EOS
  8273. INTHLP    DB    16,CR,17,CR,CR
  8274.     DB    '    ? =  This message',CR
  8275.     DB    '    0 =  (zero) Transmit a NULL',CR
  8276.     DB    '    B =  Send modem break',CR
  8277.     DB    '    C =  Close the connection',CR
  8278.     DB    '    Q =  Quit logging session',CR
  8279.     DB    '    R =  Resume logging session',CR,CR
  8280.     DB    'Type the escape character again to send it to the host.'
  8281.     DB    16,CR,17,EOS
  8282. ;
  8283. SENDRECV    DB    '                       ',16,'Send',17,'  ',16
  8284.         DB    'Receive',17,'  |  ',EOS
  8285. INPUTSTR    DB    16,'Input settings',17,'                        '
  8286.         DB    '|  ',EOS
  8287. OUTPUTSTR    DB    16,'Output settings',17,'                       '
  8288.         DB    '|  ',EOS
  8289. SEPAR    DB    '      |  ',EOS
  8290. ONSTR    DB    16,'ON',17,EOS
  8291. OFFSTR    DB    16,'OFF',17,EOS
  8292. XONSTR    DB    16,'XON-XOFF',17,EOS
  8293. NONSTR    DB    16,'NONE',17,EOS
  8294. NOESTR    EQU    NONSTR
  8295. ASCIIST    DB    16,'ASCII',17,EOS
  8296. BINST    DB    16,'BINARY',17,EOS
  8297. DMESTR    DB    16,'DUMB',17,EOS
  8298. DSCRDST    DB    16,'DISCARD',17,EOS
  8299. KEEPST    DB    16,'KEEP',17,EOS
  8300. ;
  8301. ;
  8302. ;    Miscellaneous SET strings
  8303. ;
  8304. BELSTR        DB    'Bell: ',EOS
  8305. PNTSTR        DB    'Printer: ',EOS
  8306. BUGST        DB    'Debugging: ',EOS
  8307. TYPEST        DB    'File type: ',EOS
  8308. LOCST        DB    'Local echo: ',EOS
  8309. ESCST        DB    'Escape char: ',EOS
  8310. FILST        DB    'File warning: ',EOS
  8311. FLOWST        DB    'Flow control: ',EOS
  8312. DSKDEF        DB    'Default drive: ',EOS
  8313. EMSTR        DB    'Emulation type: ',EOS
  8314. DISPST        DB    'File disposition: ',EOS
  8315. BCKST        DB    'Block check type: ',EOS
  8316. TAKST        DB    'Display TAKE file: ',EOS
  8317. EIGHTSTR    DB    'Eight bit quoting: ',EOS
  8318. ;
  8319. ;    This value must be the length of the longest of the
  8320. ;    above strings (except the ending EOS).
  8321. ;
  8322. SHSTRLEN    EQU    $-EIGHTSTR-1
  8323. ;
  8324. ;    Send/Recv strings
  8325. ;
  8326. EOLST        DB    'End-of-line:  ',EOS
  8327. RETST        DB    'Turn around:  ',EOS
  8328. PCHST        DB    'Pad character:  ',EOS
  8329. QTEST        DB    'Control quote:  ',EOS
  8330. TOST        DB    'Time out value:  ',EOS
  8331. PADST        DB    'Padding Length:  ',EOS
  8332. SOPST        DB    'Start-of-packet:  ',EOS
  8333. SRSTRLEN    EQU    $-SOPST+2
  8334. ;
  8335. ;    Input strings (Length must fit within SRSTRLEN)
  8336. ;
  8337. IDSPST        DB    'Display input:  ',EOS
  8338. CSEST        DB    'Ignore case:  ',EOS
  8339. ;
  8340. ;    Output strings (Length must fit within SRSTRLEN)
  8341. ;
  8342. ODSPST        DB    'Display output:  ',EOS
  8343. HSTEST        DB    'Match echo:  ',EOS
  8344. ;
  8345. BCKST1    DB    '-character',EOS
  8346. RPPOS    DB    'RPack=>',EOS
  8347. SPPOS    DB    'SPack=>',EOS
  8348. CLRTOP    DB    1CH,1FH,EOS    ;clear screen
  8349. ;
  8350. ;    COMND tables
  8351. ;
  8352. ;    Structure of command table
  8353. ;
  8354. ;    1) Number of entries.
  8355. ;    2) Length of longest keyword + 2
  8356. ;    3) Each entry is arranged as follows
  8357. ;        a) visibility byte, 1-command is visible, 2-invisible
  8358. ;        b) length of command in bytes.
  8359. ;        c) 'name of command and eos'
  8360. ;        d) offset into command table at KERMTB
  8361. ;        e) offset into command table at KERMTB
  8362. ;
  8363. ;    ---> Note this command table is in alphabetic order.
  8364. ;
  8365. COMTAB    DB    30    ;Number of keywords in table
  8366.     DB    9    ;LONGEST KEYWORD + 2
  8367.     DB    1,3,'BYE',EOS,33,33
  8368.     DB    0,1,'C',EOS,6,6
  8369.     DB    1,5,'CLEAR',EOS,63,63
  8370.     DB    1,5,'CLOSE',EOS,66,66
  8371.     DB    1,7,'CONNECT',EOS,6,6
  8372.     DB    1,3,'DIR',EOS,36,36
  8373.     DB    0,1,'E',EOS,3,3
  8374.     DB    1,4,'ECHO',EOS,69,69
  8375.     DB    1,4,'EXIT',EOS,3,3
  8376.     DB    1,6,'FINISH',EOS,27,27
  8377.     DB    1,3,'GET',EOS,12,12
  8378.     DB    1,5,'INPUT',EOS,51,51
  8379.     DB    1,4,'KILL',EOS,39,39
  8380.     DB    0,1,'L',EOS,42,42
  8381.     DB    1,5,'LOCAL',EOS,42,42
  8382.     DB    1,3,'LOG',EOS,9,9
  8383.     DB    1,6,'LOGOUT',EOS,30,30
  8384.     DB    1,6,'OUTPUT',EOS,54,54
  8385.     DB    1,5,'PAUSE',EOS,57,57
  8386.     DB    1,5,'PULSE',EOS,60,60
  8387.     DB    0,1,'R',EOS,12,12
  8388.     DB    1,7,'RECEIVE',EOS,12,12
  8389.     DB    1,6,'REMOTE',EOS,0,0
  8390.     DB    0,1,'S',EOS,15,15
  8391.     DB    1,4,'SEND',EOS,15,15
  8392.     DB    1,3,'SET',EOS,18,18
  8393.     DB    1,6,'SETCOM',EOS,45,45
  8394.     DB    1,4,'SHOW',EOS,21,21
  8395.     DB    1,6,'STATUS',EOS,24,24
  8396.     DB    1,4,'TAKE',EOS,48,48
  8397. MXSLEN    EQU    19
  8398. SHOTAB    DB    SHLEN/3+1
  8399.     DB    MXSLEN        ;LONGEST KEYWORD + 2
  8400.     DB    1,3,'ALL',EOS    ;THE OTHER TWO BYTES WILL BE SUBSTITUTED
  8401. SETTAB    DB    SHLEN/3        ;Number of entries in the jump table
  8402.     DB    MXSLEN        ;LONGEST KEYWORD + 1
  8403.     DB    1,4,'BELL',EOS,27,27
  8404.     DB    1,16,'BLOCK-CHECK-TYPE',EOS,12,12
  8405.     DB    1,9,'DEBUGGING',EOS,21,21
  8406.     DB    1,12,'DEFAULT-DISK',EOS,24,24
  8407.     DB    1,17,'EIGHT-BIT-QUOTING',EOS,6,6
  8408.     DB    1,9,'EMULATION',EOS,15,15
  8409.     DB    1,6,'ESCAPE',EOS,0,0
  8410.     DB    1,4,'FILE',EOS,9,9
  8411.     DB    1,12,'FLOW-CONTROL',EOS,39,39
  8412.     DB    1,5,'INPUT',EOS,41,41
  8413.     DB    1,3,'KEY',EOS,36,36
  8414.     DB    1,10,'LOCAL-ECHO',EOS,3,3
  8415.     DB    1,6,'OUTPUT',EOS,45,45
  8416.     DB    1,7,'PRINTER',EOS,18,18
  8417.     DB    1,7,'RECEIVE',EOS,30,30
  8418.     DB    1,4,'SEND',EOS,33,33
  8419.     DB    1,12,'TAKE-DISPLAY',EOS,48,48
  8420. ;
  8421. ;    File options
  8422. ;
  8423. FILETAB    DB    3
  8424.     DB    13
  8425.     DB    1,11,'DISPOSITION',EOS,0,0
  8426.     DB    1,4,'TYPE',EOS,3,3
  8427.     DB    1,7,'WARNING',EOS,6,6
  8428. ;
  8429. ;    File disposition options
  8430. ;
  8431. DISPTAB    DB    2
  8432.     DB    9
  8433.     DB    1,7,'DISCARD',EOS,1,1
  8434.     DB    1,4,'KEEP',EOS,0,0
  8435. ;
  8436. ;    Remote commands parse table
  8437. ;
  8438. RMTTAB    DB    21
  8439.     DB    16
  8440.     DB    1,9,'CLOSE-LOG',EOS,42,42
  8441.     DB    1,4,'COPY',EOS,30,30
  8442.     DB    1,3,'CWD',EOS,0,0
  8443.     DB    1,6,'DELETE',EOS,3,3
  8444.     DB    1,3,'DIR',EOS,6,6
  8445.     DB    1,4,'DISK',EOS,9,9
  8446.     DB    1,4,'HELP',EOS,12,12
  8447.     DB    1,4,'HOST',EOS,15,15
  8448.     DB    1,6,'KERMIT',EOS,18,18
  8449.     DB    1,5,'LOGIN',EOS,54,54
  8450.     DB    1,7,'MESSAGE',EOS,33,33
  8451.     DB    1,7,'PROGRAM',EOS,57,57
  8452.     DB    1,14,'QUERY-VARIABLE',EOS,39,39
  8453.     DB    1,6,'RENAME',EOS,24,24
  8454.     DB    1,8,'SEND-LOG',EOS,45,45
  8455.     DB    1,13,'SERVER-STATUS',EOS,60,60
  8456.     DB    1,12,'SET-VARIABLE',EOS,36,36
  8457.     DB    1,9,'START-LOG',EOS,48,48
  8458.     DB    1,8,'STOP-LOG',EOS,51,51
  8459.     DB    1,4,'TYPE',EOS,27,27
  8460.     DB    1,3,'WHO',EOS,21,21
  8461. ;
  8462. ;    Emulation type parse table
  8463. ;
  8464. EMLTAB    DB    2
  8465.     DB    6
  8466.     DB    1,4,'DUMB',EOS,3,3
  8467.     DB    1,4,'NONE',EOS,0,0
  8468. ;
  8469. ;    Close options parse table
  8470. ;
  8471. CLSTAB    DB    3
  8472.     DB    13
  8473.     DB    1,5,'DEBUG',EOS,1,1
  8474.     DB    1,7,'SESSION',EOS,0,0
  8475.     DB    1,11,'TRANSACTION',EOS,2,2
  8476. ;
  8477. ;    Clear command options parse table
  8478. ;
  8479. CLRTAB    DB    2
  8480.     DB    12
  8481.     DB    1,10,'INPUT-PORT',EOS,0,0
  8482.     DB    1,6,'SCREEN',EOS,3,3
  8483. ;
  8484. ;    Flow control options parse table
  8485. ;
  8486. FLOTAB    DB    2
  8487.     DB    10
  8488.     DB    1,4,'NONE',EOS,0,0
  8489.     DB    1,8,'XON-XOFF',EOS,1,1
  8490. ;
  8491. ;    SET SEND/RECEIVE options parse table
  8492. ;
  8493. STSNTB    DB    7
  8494.     DB    17
  8495.     DB    1,11,'END-OF-LINE',EOS,12,12
  8496.     DB    1,8,'PAD-CHAR',EOS,0,0
  8497.     DB    1,7,'PADDING',EOS,3,3
  8498.     DB    1,15,'QUOTE-CHARACTER',EOS,15,15
  8499.     DB    1,15,'START-OF-PACKET',EOS,6,6
  8500.     DB    1,8,'TIME-OUT',EOS,9,9
  8501.     DB    1,9,'TURN-CHAR',EOS,18,18
  8502. ;
  8503. ;    SET OUTPUT options parse table
  8504. ;
  8505. OUTTAB    DB    2
  8506.     DB    11
  8507.     DB    1,9,'HOST-ECHO',EOS,0,0
  8508.     DB    1,7,'DISPLAY',EOS,3,3
  8509. ;
  8510. ;    SET INPUT options parse table
  8511. ;
  8512. INPTAB    DB    2
  8513.     DB    13
  8514.     DB    1,11,'CASE-IGNORE',EOS,0,0
  8515.     DB    1,7,'DISPLAY',EOS,3,3
  8516. ;
  8517. ;    SET FILE TYPE options parse table
  8518. ;
  8519. TYPETAB    DB    2
  8520.     DB    8
  8521.     DB    1,6,'BINARY',EOS,1,1
  8522.     DB    1,5,'ASCII',EOS,0,0
  8523. ;
  8524. ;    SET BLOCK-CHECK-TYPE options parse table
  8525. ;
  8526. BLKTAB    DB    3
  8527.     DB    8
  8528.     DB    1,1,'1',EOS,'11'
  8529.     DB    1,1,'2',EOS,'22'
  8530.     DB    1,1,'3',EOS,'33'
  8531. ;
  8532. ;    OFF/ON parse table
  8533. ;
  8534. ONTAB    DB    4    ;Number of entries
  8535.     DB    5    ;Max length + 2
  8536.     DB    0,2,'NO',EOS,0,0    ;YES and NO are invisible
  8537.     DB    1,2,'ON',EOS,1,1
  8538.     DB    1,3,'OFF',EOS,0,0
  8539.     DB    0,3,'YES',EOS,1,1
  8540. ;
  8541. ;    Assorted error/informational messages
  8542. ;
  8543. CMER00    DB    CR,'Program error, Invalid COMND call',EOS
  8544. CMER01    DB    CR,'Ambiguous',EOS
  8545. CMER02    DB    CR,'Illegal input filespec',EOS
  8546. CMCRLF    DB    CR,EOS
  8547. ;
  8548. ;    Storage for the parser, etc.
  8549. ;
  8550. CMSTAT    DB    0    ;What is presently being parsed.
  8551. CMAFLG    DB    0    ;Non-zero when an action char has been found.
  8552. CMCCNT    DB    0    ;Non-zero if a significant char is found.
  8553. CMSFLG    DB    0    ;Non-zero when the last char was a space.
  8554. CMOSTP    DW    0    ;Old stack pointer for reparse.
  8555. CMRPRS    DW    0    ;Address to go to on reparse.
  8556. CMPRMP    DW    0    ;Address of prompt.
  8557. CMPTAB    DW    0    ;Address of present keyword table.
  8558. CMDBUF    DS    100H    ;Buffer for command parsing.
  8559. CMFCB    DW    0    ;Pointer to FCB.
  8560. CMCPTR    DW    0    ;Pointer for next char input.
  8561. CMDPTR    DW    0    ;Pointer into the command buffer.
  8562. CMKPTR    DW    0    ;Pointer to keyword.
  8563. CMSPTR    DW    0    ;Place to save a pointer.
  8564. OLDSP    DW    0    ;Room for old system stack.
  8565.     DS    200H    ;Room for lots of calls
  8566. STACK    DW    0
  8567. EOFLAG    DB    0    ;EOF flag; non-zero on EOF.
  8568. FILFLG    DB    0    ;NON-ZERO WHEN FILE NOT OPEN
  8569. LSTCHR    DB    0    ;Last character in disk i/o
  8570. DEFDSK    DB    '0'    ;Default disk drive number
  8571. LOGFLG    DB    0    ;Flag for session logging
  8572. DEBLOG    DB    0    ;Flag for debug logging
  8573. TRANLOG    DB    0    ;Flag for transaction logging
  8574. ECOFLG    DB    0    ;Local echo flag (default off).
  8575. ESCFLG    DB    0    ;Escape flag (start off).
  8576. EMULFLAG    DB    0    ;Emulation flag, NONE is default
  8577. FLWFLG    DB    0    ;file warning flag (default on)
  8578. FILTYPE    DB    0    ;File type, default is ASCII
  8579. DBFLG    DB    0    ;debugging flag (default off)
  8580. PRTFLG    DB    0    ;printer flag (default off)
  8581. ESCCHR    DB    DEFESC    ;Storage for the escape character.
  8582. CHRCNT    DB    0    ;Number of chars in the file buffer.
  8583. FILCNT    DB    0    ;Number of chars left to fill.
  8584. OUTPNT    DW    0    ;Position in packet.
  8585. BUFPNT    DW    0    ;Position in file buffer.
  8586. FCBPTR    DW    0    ;Position in FCB.
  8587. FCBEXT    DW    0
  8588. DATPTR    DW    0    ;Position in packet data buffer.
  8589. LOGPTR    DW    LBUFF    ;pointer into log file buffer
  8590. CBFPTR    DW    0    ;Position in character buffer.
  8591. PKTPTR    DW    0    ;Poistion in receive packet.
  8592. OSIZE    DB    0    ;Old size of packet before overflow
  8593. SIZE    DB    0    ;Size of data from gtchr.
  8594. SPSIZ    DB    DSPSIZ    ;Send packet size.
  8595. RPSIZ    DB    DRPSIZ    ;Receive packet size.
  8596. STIME    DB    DSTIME    ;Send time out.
  8597. RTIME    DB    DRTIME    ;Receive time out.
  8598. SPAD    DB    DSPAD    ;Send padding.
  8599. RPAD    DB    DRPAD    ;Receive padding.
  8600. SPADCH    DB    DSPADC    ;Send padding char.
  8601. RPADCH    DB    DRPADC    ;Receive padding char.
  8602. SEOL    DB    DSEOL    ;Send EOL char.
  8603. REOL    DB    DREOL    ;Receive EOL char.
  8604. SSOHCH    DB    DSSOP    ;SEND START OF PACKET
  8605. RSOHCH    DB    DRSOP    ;RECEIVE START OF PACKET
  8606. SQUOTE    DB    DSQUOT    ;Send quote char.
  8607. RQUOTE    DB    DRQUOT    ;Receive quote char.
  8608. STURN    DB    0    ;Send turn around character
  8609. RTURN    DB    0    ;Receive turn around character
  8610. CHKTYP    DB    DSCHKT    ;Checksum type desired
  8611. CURCHK    DB    DSCHKT    ;Current checksum type
  8612. INICHK    DB    DSCHKT    ;Agreed upon checksum type
  8613. CZSEEN    DB    0    ;Flag that control-Z was typed
  8614. MFNPTR    DW    MFNBUF    ;multiple file processing buffer
  8615. PKTNUM    DB    0    ;Packet number.
  8616. NUMPKT    DW    0    ;Total number of packets sent.
  8617. NUMRTR    DW    0    ;Total number of retries.
  8618. NUMTRY    DB    0    ;Number of tries on this packet.
  8619. OLDTRY    DB    0    ;Number of tries on previous packet.
  8620. TFILNAM    DS    33    ;Space for saved file name printed during GETs
  8621. RMTDATA    DS    101H    ;Data for remote commands
  8622. STATE    DB    0    ;Present state of the automaton.
  8623. PACKET    DS    4    ;Packet (data is part of it).
  8624. DATA    DS    101H    ;Data and checksum field of packet.
  8625. RECPKT    DS    70H    ;Receive packet storage (use the following).
  8626. FILBUF    DS    70H    ;Character buffer.
  8627. ;
  8628. ;** Temp 1 & 2 must be in order
  8629. ;
  8630. TEMP1    DB    0    ;Temporary storage.
  8631. TEMP2    DB    0
  8632. TEMP3    DB    0
  8633. TEMP4    DB    0
  8634. ;
  8635. ;    Data storage for MFNAME (multi-file access)
  8636. ;
  8637. MFREQ    DS    40    ;Requested name
  8638. MFNBUF    DS    100H    ;filename buffer
  8639. ;
  8640. FCB    DS    40    ;file control block
  8641. LFCB    DS    40    ;log file fcb
  8642. TRFCB    DS    40    ;Transaction file fcb
  8643. DFCB    DS    40    ;Debug fcb
  8644. KFCB    DS    40    ;kill file fcb
  8645. BUFF    DS    256    ;file buffer
  8646. LBUFF    DS    256    ;log file buffer
  8647. TBUFF    DS    256    ;Transaction log buffer
  8648. DBUFF    DS    256    ;Debug log buffer
  8649. ARGBLK    DS    20H    ;Used
  8650. ; end of file
  8651. <<< m4term.asm >>>
  8652. ;    m4term/asm
  8653. ;
  8654. ;    This is the connect command
  8655. ;
  8656. CONNECT    EQU    $
  8657.     LD    A,CMCFM        ;Get a confirmation
  8658.     CALL    COMND
  8659.     JP    KERMT3        ;Abort if no <ENTER> pressed
  8660.     CALL    SCRCON        ;Swap in the proper screen
  8661.     LD    A,(MAXCNT)    ;Select the proper buffer size
  8662.     LD    (SVMAX),A
  8663.     LD    A,80        ;80 characters max are buffered
  8664.     LD    (MAXCNT),A
  8665.     LD    A,(FTIME)    ;Is this the VERY FIRST connect?
  8666.     IFNZ    CON_2
  8667.     STROUT    CLRTOP        ;Clear the screen
  8668. CON_1    STROUT    INFMS7        ;Display the message
  8669.     CALL    ESCPR
  8670.     STROUT    INFMS8
  8671.     LD    A,1        ;Set the first time done flag
  8672.     LD    (FTIME),A
  8673. CON_2    LD    A,14
  8674.     CALL    CONOUT
  8675. ;
  8676. ;    While in connect mode, at most, 30 characters may be processed
  8677. ;    from the input port, before the keyboard is scaned. We try not
  8678. ;    to scan the keyboard too much, as that will kill screen I/O. This
  8679. ;    is especially true at higher baud rates, where the user might
  8680. ;    not get to type a key because the flow of characters into the
  8681. ;    port is continuous.
  8682. ;
  8683. CHRLUP    LD    A,30        ;Set the maximum character count
  8684.     LD    (CHCNT),A    ;Save it
  8685.     CALL    PRTCHR        ;Do input characters
  8686.     CALL    CONCHR        ;Get a keyboard character
  8687.     JP    KERMIT        ;IF we return here, then abort
  8688.     JR    CHRLUP        ;Loop on
  8689. ;
  8690. ;    Look at the input buffer for a character, and return it, or
  8691. ;    return no input.
  8692. ;
  8693. INPORT    PUSH    HL        ;SAVE HL
  8694.     LD    HL,(NXTCHR)    ;Get address of next input char
  8695.     LD    A,(CURCHR)    ;Get the LSB of the queue start
  8696.     IFA    L,INOUT        ;If A=L, then there is no input.
  8697.     DI            ;Interrupts off, CRITICAL section
  8698.     LD    A,(HL)        ;Get the character back
  8699.     LD    (SVCHAR),A    ;Save the input character
  8700.     INC    L        ;Delete the character
  8701.     LD    (NXTCHR),HL    ;Set the new pointer
  8702.     LD    HL,INCNT    ;Decrement the count
  8703.     DEC    (HL)
  8704.     EI            ;Interrupts back on
  8705.     LD    A,(FLOFLG)    ;Is XON/XOFF in effect?
  8706.     IFZ    INP11        ;Go if not doing flow control
  8707.     PUSH    BC        ;Save BC
  8708.     LD    C,(HL)        ;Get a copy of the count
  8709.     LD    A,(XFFLG)    ;Check if XOFF sent out
  8710.     IFZ    INP10        ;Jump if not
  8711.     LD    A,(MAXCNT)    ;It was, so check if time for XON
  8712.     SRL    A        ;Use 1/2 of the max as the restart count
  8713.     IFALT    C,INP10        ;If A >= count it is not time yet
  8714.     PUSH    DE        ;Save DE
  8715.     LD    E,XON        ;Get an XON character
  8716.     CALL    OUTCHR        ;Out the port it goes
  8717.     XOR    A        ;Reset the XOFF sent flag
  8718.     LD    (XFFLG),A
  8719.     POP    DE        ;Restore E
  8720. INP10    POP    BC        ;Restore C
  8721. INP11    LD    A,0        ;Get the next character
  8722. SVCHAR    EQU    $-1
  8723.     CP    A        ;Set Z status for normal return
  8724. INOUT1    POP    HL        ;Restore HL
  8725.     RET            ;Back to caller
  8726. ;
  8727. ;    No input exit from INPORT
  8728. ;
  8729. INOUT    EQU    $
  8730.     XOR    A        ;Reset the count
  8731.     LD    (INCNT),A    ;Zeroed
  8732.     INC    A        ;Set NZ (We know A was zero, now it is 1)
  8733.     POP    HL        ;Restore HL
  8734.     RET            ;Back to the caller
  8735. ;
  8736. ;    Input a character, and display it based on the current value
  8737. ;    of EMULATION.
  8738. ;
  8739. PRTCHR    CALL    INPORT        ;Try to get an input character.
  8740.     RET    NZ        ;Return if none there
  8741.     LD    E,A        ;Get the input character
  8742.     CALL    LOGONE        ;Maybe do logging
  8743.     LD    A,(PRTFLG)    ;CHECK FOR PRINTER OUTPUT
  8744.     OR    A        ;SET THE FLAGS
  8745.     CALL    NZ,PRTIT    ;GO PRINT IT
  8746.     LD    A,E        ;GET THE CHARACTER AND DISPLAY
  8747.     CALL    TRMOUT        ;Send it to the *SO device
  8748.     LD    B,0        ;Get the current count
  8749. CHCNT    EQU    $-1
  8750.     DJNZ    PRTCHR5        ;SKIP RETURN IF NOT LIMIT
  8751.     RET            ;RETURN AFTER LIMIT IS UP
  8752. PRTCHR5    LD    A,B        ;GET THE NEW COUNT
  8753.     LD    (CHCNT),A    ;SAVE IT
  8754.     JP    PRTCHR        ;LOOP ON
  8755. ;
  8756. ; Input a character from the keyboard.
  8757. ;
  8758. CONCHR    CALL    GETKEY        ;Get a keyboard character without
  8759.     JP    NZ,RSKP        ;Return if not one
  8760.     LD    E,A        ;Is it CONNECT escape character?
  8761.     LD    A,(ESCCHR)
  8762.     CP    E
  8763.     JP    Z,INTCHR    ;Go process the next key pressed
  8764. CONCHR2    IFANOT    128,CONCHR3    ;BREAK?
  8765.     CALL    DOBRK        ;Generate real BREAK
  8766.     JP    RSKP
  8767. CONCHR3    LD    A,E
  8768. CONCHR4    PUSH    DE        ;SAVE DE
  8769.     CALL    PRTOUT        ;SEND IT TO THE PORT
  8770.     POP    DE
  8771.     LD    A,(ECOFLG)    ;CHECK FOR LOCAL ECHO
  8772.     OR    A
  8773.     LD    A,E
  8774.     CALL    NZ,TRMOUT    ;Echo out terminal device
  8775.     JP    RSKP        ;RETURN TO THE CALLER SAY OK
  8776. ;
  8777. ;    This is the code to process the escape sequences during the
  8778. ;    CONNECT command that do things like return to the KERMIT
  8779. ;    prompt, send a break, turn logging on and off, etc...
  8780. ;
  8781. INTCHR    EQU    $
  8782.     CALL    GETKEY        ;Get a character from translator
  8783.     JR    NZ,INTCHR    ;Loop until we get one
  8784. INCH00    EQU    $
  8785.     LD    B,A        ;Put the real character into B
  8786.     AND    137O        ;Convert A to upper case
  8787.     IFANOT    'C',INCH01    ;Is it connect, if not try other
  8788.     CALL    SCRCMD        ;Swap KERMIT screen in
  8789.     LD    A,(SVMAX)    ;Restore the old max
  8790.     LD    (MAXCNT),A
  8791.     RET            ;Return to KERMIT
  8792. INCH01    LD    A,B        ;Get the real value
  8793.     IFANOT    '?',INTCH1    ;Is it help, if not try next
  8794.     LD    A,15        ;Turn the cursor off
  8795.     CALL    CONOUT
  8796.     LD    B,4        ;Get the cursor position
  8797.     CALL    XVDCTL
  8798.     PUSH    HL        ;Save it
  8799.     LD    HL,2600H    ;Save the screen
  8800.     LD    B,6        ;Get screen function
  8801.     CALL    XVDCTL        ;Do the move
  8802.     LD    HL,0C00H    ;Move to middle
  8803.     CALL    TOSCRPOS    ;Move to possition on screen
  8804.     LD    A,31        ;Clear to eos
  8805.     CALL    CONOUT
  8806.     LD    DE,INTHLP    ;Get Help message
  8807.     CALL    PRTSTR        ;Print message
  8808. INCH11    CALL    GETKEY        ;Get a character
  8809.     JR    NZ,INCH11    ;Jump if no key pressed
  8810.     POP    HL        ;Reorder the stack
  8811.     PUSH    AF
  8812.     PUSH    HL
  8813.     LD    HL,2600H    ;Get the old screen
  8814.     LD    B,5        ;Put it back into view
  8815.     CALL    XVDCTL
  8816.     POP    HL        ;Restore old cursor position
  8817.     CALL    TOSCRPOS    ;Position the cursor
  8818.     LD    A,14        ;Turn the cursor back on
  8819.     CALL    CONOUT
  8820.     POP    AF        ;Get the character typed back
  8821.     JR    INCH00        ;Loop back to process character
  8822. ;
  8823. INTCH1    AND    137O        ;Convert back to uppercase
  8824.     IFANOT    'B',INTCH2    ;Is it BREAK, if not try next
  8825.     CALL    DOBRK        ;Send BREAK out port
  8826.     JP    RSKP        ;Return NO error
  8827. INTCH2    LD    A,B        ;Get the real character
  8828.     IFANOT    '0',INTCH3    ;Is it NULL, if not try next
  8829.     LD    E,0        ;Get a NULL
  8830.     CALL    OUTCHR        ;Out the port with it
  8831.     JP    RSKP        ;Return no error
  8832. INTCH3    LD    E,B        ;Get the real character
  8833.     LD    A,(ESCCHR)    ;Get the escape character
  8834.     IFA    E,INTCHZ    ;Is it the escape character ?
  8835.     LD    A,B        ;Get the real character
  8836.     AND    137O        ;Upper case again
  8837.     IFANOT    'Q',INTCH4    ;Is it QUIT, if not try next
  8838.     LD    A,(LOGFLG)    ;Get the logging flag
  8839.     IFANOT    2,INTC3A    ;Is logging active, jump if not
  8840.     DEC    A        ;Turn logging off
  8841.     LD    (LOGFLG),A    ;Set the value
  8842.     JP    RSKP        ;Return no error
  8843. INTC3A    LD    A,BELL        ;Get An error sound
  8844.     CALL    CONOUT        ;BEEP AT THEM
  8845.     JP    RSKP        ;Return no error
  8846. INTCH4    IFANOT    'R',INTCH5    ;Resume logging?  Jump if not
  8847.     LD    A,(LOGFLG)    ;Check logging status
  8848.     IFANOT    1,INTC3A    ;If not 1, can't resume
  8849.     INC    A        ;Turn logging on
  8850.     LD    (LOGFLG),A    ;Set the value
  8851.     JP    RSKP        ;Return no error
  8852. INTCH5    LD    A,E        ;Get the character typed
  8853.     CALL    PRTOUT        ;Send it out the port
  8854.     JP    RSKP        ;Return no error
  8855. INTCHZ    CALL    OUTCHR        ;Send it out the port
  8856.     LD    A,BELL        ;Get a bell
  8857.     CALL    CONOUT        ;Send bell to terminal
  8858.     JP    RSKP        ;Return no error
  8859. ;
  8860. ;    Send character to printer
  8861. ;
  8862. PRTIT    EQU    $
  8863.     LD    A,E        ;Get the character
  8864.     PUSH    DE        ;Save E for return
  8865.     CALL    XPRT        ;Dos printer routine
  8866.     POP    DE        ;Restore E
  8867.     RET            ;Return
  8868. ;
  8869. ;    Generate a real modem break
  8870. ;
  8871. DOBRK    LD    C,1        ;OPTION 1 OF @CTL
  8872.     LD    DE,(CLDCB)    ;Get the *CL DCB
  8873.     CALL    XCTL        ;Do @CTL to start Modem break
  8874.     DI            ;Make the pause be exact
  8875.     LD    BC,39000    ;Pause for 200ms
  8876. BRKLOOP    DEC    BC        ;Decrement the count
  8877.     LD    A,B
  8878.     OR    C
  8879.     JR    NZ,BRKLOOP    ;Loop until done
  8880.     EI
  8881.     LD    E,0        ;Stop break with any character
  8882.     JP    OUTCHR        ;Null is good
  8883. ;
  8884. ;    Output any none null character to the RS232 port
  8885. ;
  8886. PRTOUT    OR    A        ;Don't send NULLS
  8887.     RET    Z
  8888.     LD    E,A        ;Get the character
  8889.     JP    OUTCHR        ;Output it
  8890. ;
  8891. ;    Log a character to the log file
  8892. ;
  8893. LOGONE    PUSH    AF
  8894.     PUSH    DE
  8895.     LD    E,A
  8896.     LD    A,(LOGFLG)
  8897.     OR    A
  8898.     LD    A,E
  8899.     CALL    NZ,LOGIT
  8900.     POP    DE
  8901.     POP    AF
  8902.     RET
  8903. ;
  8904. ;    Output a character to *DO
  8905. ;
  8906. CONOUT    PUSH    DE        ;SAVE THE REGS
  8907.     PUSH    BC
  8908.     PUSH    AF
  8909.     IFA    BELL,BEEPON    ;Go if bell 
  8910.     CALL    XDSP        ;Use the @DSP SVC to display it
  8911. CON010    POP    BC        ;Use BC to get A, and not destroy flags
  8912.     LD    A,B        ;Get the old A
  8913.     POP    BC
  8914.     POP    DE
  8915.     RET            ;RETURN TO THE CALLER
  8916. ;
  8917. ;    Output a character to *SO
  8918. ;
  8919. TRMOUT    PUSH    DE        ;Save the regs
  8920.     PUSH    BC
  8921.     PUSH    AF
  8922.     LD    E,A        ;Make a copy of the character
  8923.     LD    A,(EMULFLAG)    ;Get the emulation flag
  8924.     IFZ    TRMOUT3        ;Jump if EMULATION set to NONE
  8925. ;
  8926. ;    Certain control characters are translated on input. In
  8927. ;    particular, the following mappings are in effect.
  8928. ;
  8929. ;    8  -> 24    non destructive backspace
  8930. ;    10 -> 26    non destructive linefeed
  8931. ;    13 -> 29    True carriage return
  8932. ;
  8933.     LD    A,E        ;Is this a control character?
  8934.     IFAGE    32,TRMOUT3    ;Jump if not a control character
  8935.     LD    HL,TRTAB    ;Get the translation table
  8936.     LD    B,0        ;Make BC an offset into TRTAB
  8937. ;
  8938. ;    If the character in the translation table is 0, then it is
  8939. ;    ignored. This is handy for blocking out things like cursor
  8940. ;    on/off, and inverse video on/off
  8941. ;
  8942.     LD    C,A        ;Get the character to use as index
  8943.     ADD    HL,BC        ;Index to the table
  8944.     LD    A,(HL)        ;Get the translated character
  8945.     IFZ    TRMOUT5        ;Return if character is to be ignored
  8946.     LD    E,A        ;Make a copy for later
  8947.     IFANOT    12,TRMOUT1    ;Jump if not a formfeed
  8948.     CALL    CMBLNK        ;Clear the screen
  8949.     JR    TRMOUT5
  8950. TRMOUT1    IFANOT    7,TRMOUT3    ;Jump if not bell
  8951.     CALL    CONOUT        ;DUMB uses BUILTIN Bell
  8952.     JR    TRMOUT5
  8953. TRMOUT3    EQU    $
  8954.     LD    A,E        ;Get the character
  8955.     LD    DE,(TMODCB)    ;Get the Device DCB for terminal out
  8956.     CALL    XPUT        ;@PUT the character to the device
  8957. TRMOUT5    POP    BC        ;Use BC to get A, and leave Flags alone
  8958.     LD    A,B        ;Get A
  8959.     POP    BC        ;Restore BC
  8960.     POP    DE        ;And the rest
  8961.     RET
  8962. ;
  8963. ;    Input a character from *SI
  8964. ;
  8965. TRMIN    PUSH    DE
  8966.     PUSH    BC
  8967.     LD    DE,(TMIDCB)    ;Get the terminal input DCB
  8968.     CALL    XGET        ;@GET a character
  8969.     POP    BC        ;Restore the regs
  8970.     POP    DE
  8971.     RET
  8972. ;
  8973. ;    Sound a bell
  8974. ;
  8975. BEEPON    LD    A,(BELFLG)    ;IS THAT OPTION ON?
  8976.     IFZ    CON010        ;Jump if bell option off
  8977.     PUSH    BC        ;Save counter
  8978.     LD    C,50        ;Get the duration
  8979. BEEP1    LD    A,1        ;Get the value to send out port
  8980.     OUT    (90H),A        ;Toggle port high
  8981.     LD    B,130        ;Delay
  8982.     DJNZ    $
  8983.     DEC    A        ;Set A to zero
  8984.     OUT    (90H),A        ;Toggle port low
  8985.     LD    B,130        ;Delay
  8986.     DJNZ    $
  8987.     DEC    C        ;Decrement duration
  8988.     JR    NZ,BEEP1    ;Loop if not done
  8989.     POP    BC        ;Restore counter
  8990.     JR    CON010        ;Join return code
  8991. ;
  8992. ;    Print string pointed to by DE to *DO, EOS is end of string
  8993. ;    NUL characters are thrown out.
  8994. ;
  8995. PRTSTR    LD    A,(DE)        ;GET A CHARACTER
  8996.     CP    EOS        ;IS IT THE END?
  8997.     RET    Z        ;RETURN TO CALLER IF SO
  8998.     OR    A        ;THROW AWAY THE NULL CHARACTER
  8999.     CALL    NZ,CONOUT    ;DISPLAY ANYTHING NON-NULL
  9000.     INC    DE        ;POINT TO THE NEXT ONE
  9001.     JR    PRTSTR        ;LOOP ON
  9002. ;
  9003. ;    Get a character from *KI
  9004. ;
  9005. CONIN    PUSH    DE        ;SAVE DE
  9006.     CALL    XKBD        ;LOOK AT THE KEYBOARD WITHOUT WAITING
  9007.     POP    DE        ;RESTORE DE
  9008.     RET            ;RETURN TO THE CALLER
  9009. ;
  9010. ;    Output a character to *CL.  The character is in E.
  9011. ;
  9012. OUTCHR    PUSH    DE        ;SAVE CURRENT DE AND BC
  9013.     PUSH    BC
  9014.     LD    C,E        ;Put the character where it should be
  9015. OUTCH0    LD    A,(XOFREC)    ;CHECK TO SEE IF WE CAN TRANSMIT YET!
  9016.     IFZ    OUTCH2
  9017. ;
  9018. ;    We allow break to force the transmittion of the character that
  9019. ;    is being sent.  There are ways that the XON from the host can
  9020. ;    be lost.  This allows control to be regained, without rebooting
  9021. ;    which would be the only other choice.
  9022. ;
  9023. OUTCH1    CALL    CONIN        ;Check the break key
  9024.     IFANOT    128,OUTCH0    ;Jump if not
  9025.     XOR    A        ;Reset the XOF'd flag
  9026.     LD    (XOFREC),A
  9027. OUTCH2    LD    A,C        ;Get the character to send
  9028. OUTCH3    LD    DE,(CLDCB)    ;GET THE DCB OF THE DEVICE TO PUT TO
  9029.     CALL    XPUT        ;SEND THE CHARACTER
  9030.     JR    NZ,OUTCH3    ;Transmitter may not be ready, loop if
  9031. ;                needed until character is transmitted
  9032. OUTCH4    POP    BC        ;Restore the regs
  9033.     POP    DE
  9034.     RET
  9035. ;
  9036. ;    Character input routine for INPKT.  We can timeout on the
  9037. ;    receive by allowing the timer to place a return in the code
  9038. ;    below, at the address RECALRM.  Since TRSDOS doesn't allow
  9039. ;    us (neatly, without a hack) to transfer control in a task,
  9040. ;    to some other code, we use the self modifying code.  This
  9041. ;    may be considered dirty, but it does work.  The RET causes
  9042. ;    the code to behave as though the user had pressed <ENTER> to
  9043. ;    resend the latest packet.
  9044. ;
  9045. INCHR    XOR    A        ;Get a NOP instruction
  9046.     LD    (RECALRM),A    ;Remove any stored RET instruction
  9047. INCHR1    CALL    CONIN        ;Check keyboard first to make sure
  9048.     IFNZ    INCHR3
  9049.     CALL    INPORT        ;Get a character from the buffer
  9050.     JP    Z,RSKP        ;Return if we got one
  9051. RECALRM    NOP            ;Modified by timeout code to be a RET
  9052.     JR    INCHR
  9053. INCHR3    IFANOT    CR,INCHR4    ;Check which key was pressed
  9054.     LD    A,(TASKSLOT)    ;Get the active task
  9055.     OR    A        ;See if task aqctive
  9056.     RET    Z        ;Return if not
  9057.     LD    C,A        ;Get the task slot into c
  9058.     CALL    XRMTSK        ;Stop the task
  9059.     RET            ;Return resend status
  9060. INCHR4    CHKWKEY    'B'-64        ;Control-B for batch
  9061.     CHKWKEY    'F'-64        ;Control-F for file
  9062.     CHKWKEY    'A'-64        ;Control-A for status
  9063.     CHKWKEY    'E'-64        ;Control-E for send error
  9064.     CHKWKEY    'D'-64        ;Debug?
  9065.     CHKWKEY    'H'-64        ;Help?
  9066.     IFANOT    'C'-64,INCHR1    ;Control-C for abort completely
  9067. INCHR5    ADD    A,40H        ;MAKE IT PRINTABLE
  9068.     LD    (CZSEEN),A
  9069.     RET
  9070. ;
  9071. ;    Timer task for receiving a packet.  Called every 33.333333333
  9072. ;    milliseconds.  We decrement the TIMER counter, and when it
  9073. ;    goes to zero, we write a RET into the above code, and kill
  9074. ;    the task so that is does not return.
  9075. ;
  9076. ;    Note that we must NOT leave anything on the stack when @KLTSK
  9077. ;    is called or else it will puke.
  9078. ;
  9079. RECTIMOUT    EQU    $
  9080.     PUSH    HL        ;Save the registers used
  9081.     PUSH    AF
  9082.     LD    HL,(TIMER)    ;Get the counter
  9083.     DEC    HL        ;Decrement it
  9084.     LD    (TIMER),HL    ;Store the new value
  9085.     LD    A,H        ;Check it for zero
  9086.     OR    L
  9087.     JR    NZ,RECT1
  9088.     LD    A,0C9H        ;Get a RET instruction opcode
  9089.     LD    (RECALRM),A    ;Write it in
  9090.     POP    AF        ;Restore the register
  9091.     POP    HL
  9092.     JP    XKLTSK        ;Remove this task, NO RETURN.
  9093. ;
  9094. RECT1    POP    AF        ;Restore the registers
  9095.     POP    HL
  9096.     RET            ;Return
  9097. ;
  9098. ;    Move cursor to position on screen
  9099. ;
  9100. TOSCRPOS    EQU    $
  9101.     LD    B,3
  9102.     JP    XVDCTL
  9103. ;end of file
  9104. <<< m4wild.asm >>>
  9105. ;        m4wild/asm
  9106. ;
  9107. ;    Build a list of filenames given a list of arbitrary names
  9108. ;    pointed to by HL.  Wild card processing is done here.
  9109. ;
  9110. ;    The resulting blank separated list is returned in HL.  The
  9111. ;    number of names put into the buffer is indicated by the
  9112. ;    count in FILECNT.  This is a byte valued count, so 255 is
  9113. ;    the maximum number possible.
  9114. ;
  9115. BUILDF        EQU    $
  9116.         LD    (SRCPTR),HL    ;Save the source input pointer
  9117.         LD    HL,FILEBUFF    ;Set the pointer to the matches
  9118.         LD    (FBPTR),HL    ;buffer where all matches go
  9119.         XOR    A        ;Set number of files found to 0
  9120.         LD    (FILECNT),A
  9121. BF_0        EQU    $
  9122.         LD    HL,(SRCPTR)    ;Get the input string
  9123.         LD    BC,0        ;Get zero
  9124.         LD    (SYSFLAG),BC    ;No system files
  9125.         LD    (INVFLAG),BC    ;No invisible files
  9126.         XOR    A        ;Reset response values
  9127.         LD    (INVRESP),A
  9128.         LD    (SYSRESP),A
  9129.         LD    A,' '
  9130. BF_A        IFANOT    (HL),BF_B
  9131.         INC    HL
  9132.         JR    BF_A
  9133. ;
  9134. BF_B        LD    DE,PARMS    ;Get the parse table
  9135.         CALL    XPARAM        ;Do @PARAM SVC
  9136.         JR    Z,BF_D        ;Jump if parse ok
  9137. BF_C        STROUT    BADPARM        ;Print error message
  9138.         JP    KERMIT        ;Abort!
  9139. ;
  9140. BF_D        LD    A,(SYSRESP)    ;Get the system response
  9141.         AND    0A0H        ;Valid?
  9142.         JR    NZ,BF_C        ;Jump if not
  9143.         LD    A,(INVRESP)    ;Check invisble flag
  9144.         AND    0A0H        ;Valid?
  9145.         JR    NZ,BF_C        ;Jump if not
  9146.         LD    A,' '        ;Get a space to compare with
  9147. BF_E        IFANOT    (HL),BF_F    ;Jump if not space
  9148.         INC    HL
  9149.         JR    BF_E
  9150. ;
  9151. BF_F        LD    B,32        ;Move 32 characters, MAX
  9152.         LD    DE,TFBUF    ;Get the temporary buffer
  9153. BF_1        LD    A,(HL)        ;Get a character
  9154.         IFALT    ' '+1,BF_2    ;Jump if at end of this filename
  9155.         CALL    CPTAL        ;Capitalize it
  9156.         LD    (DE),A        ;Save the new character
  9157.         INC    DE        ;Increment the pointers
  9158.         INC    HL
  9159.         DJNZ    BF_1        ;Loop until done
  9160. BF_2        XOR    A        ;Terminate the string with a zero
  9161.         LD    (DE),A        ;Put in a terminator
  9162. BF_3        LD    A,(HL)        ;Get the next character
  9163.         IFAGE    ' '+1,BF_4    ;Jump if not separator
  9164.         IFA    CR,BF_4        ;Jump if end of string
  9165.         INC    HL        ;Skip the separator
  9166.         JR    BF_3        ;Loop on
  9167. ;
  9168. BF_4        LD    (SRCPTR),HL    ;Save the next string pointer
  9169.         LD    A,32        ;Get the max length
  9170.         SUB    B        ;Compute length
  9171.         LD    (FNLEN),A    ;Save it
  9172.         JP    Z,BF_18        ;Exit if no more names
  9173.         LD    A,1        ;Initially check all drives
  9174.         LD    (MOREDRV),A    ;Set the flag
  9175.         DEC    DE        ;Check if '/' last character
  9176.         EX    DE,HL        ;Put it in HL
  9177.         LD    A,(HL)        ;Get the character
  9178.         IFANOT    '/',BF_5    ;Is it a '/'
  9179.         LD    (HL),0        ;Remove the trailing slash
  9180. BF_5        LD    HL,TFBUF    ;Look for a drive specification
  9181.         LD    A,(FNLEN)    ;Get the length
  9182.         LD    C,A        ;Make BC a 16 bit copy of A
  9183.         LD    B,0
  9184.         ADD    HL,BC        ;Compute end of name plus one
  9185.         DEC    HL        ;Backup to possible drive number
  9186.         DEC    C        ;Decrement the counter
  9187.         JR    Z,BF_7        ;Jump if no characters left
  9188.         DEC    HL        ;Backup to possible ':' separator
  9189.         DEC    C        ;Decrement counter
  9190.         JR    Z,BF_7        ;Jump no characters left
  9191.         LD    A,(HL)        ;Get a possible ':'
  9192.         IFANOT    ':',BF_7    ;Jump if not drive spec
  9193.         LD    (HL),0        ;Terminate with no drive number
  9194.         INC    HL        ;Point back at drive number
  9195.         LD    A,(HL)        ;Get the drive number
  9196.         LD    HL,FNLEN    ;Change the length
  9197.         DEC    (HL)
  9198.         DEC    (HL)
  9199.         SUB    '0'        ;Make the drive number binary
  9200.         LD    C,A        ;Save the drive to check
  9201.         XOR    A
  9202.         LD    (MOREDRV),A    ;No more drives to check
  9203.         JR    BF_8
  9204. ;
  9205. BF_7        EQU    $
  9206.         XOR    A        ;Zero A
  9207.         LD    C,A        ;Set drive number to zero
  9208. BF_8        EQU    $
  9209.         PUSH    BC        ;Save the current drive number
  9210.         CALL    XCHKDRV        ;Check this drive
  9211.         JP    NZ,BF_17    ;Jump if drive not ready
  9212.         LD    HL,DIRSPEC    ;Get the source of 'DIR/SYS'
  9213.         LD    DE,DIRFCB    ;Put it here
  9214.         LD    BC,DLEN        ;Move this many characters
  9215.         LDIR            ;Copy the name
  9216.         POP    BC        ;Get the drive number
  9217.         PUSH    BC        ;Put it back
  9218.         LD    A,C        ;Put it into A
  9219.         ADD    A,'0'        ;Make it printable
  9220.         LD    (DIRDRV),A    ;Set the drive number
  9221.         LD    (SDIRDRV),A    ;Save the current drive
  9222.         LD    A,CR        ;Get a EOL marker
  9223.         LD    (DIRDRV+1),A    ;Put in a terminator
  9224.         LD    HL,DIRBUFF    ;Get the buffer
  9225.         LD    B,0        ;LRECL = 256
  9226.         LD    DE,DIRFCB    ;Get the FCB
  9227.         CALL    XOPEN        ;Try to open the directory
  9228.         JP    NZ,BF_19    ;Jump on open error
  9229.         LD    DE,DIRFCB    ;Get the FCB
  9230.         CALL    XSKIP        ;Skip HIT and GAT
  9231.         CALL    XSKIP
  9232. BF_9        EQU    $
  9233.         LD    HL,DIRBUFF    ;Get the data buffer
  9234.         LD    DE,DIRFCB    ;Get the FCB
  9235.         CALL    XREAD        ;Read a record
  9236.         JP    NZ,BF_15    ;Jump if can't read anymore
  9237.         LD    B,8        ;Number of dir entries
  9238.         LD    HL,DIRBUFF    ;Get the starting data
  9239. BF_10        PUSH    BC        ;Save the counter
  9240.         BIT    4,(HL)        ;Check for used directory record
  9241.         JR    Z,BF_12        ;Jump entry not in use
  9242.         BIT    7,(HL)        ;Check if FPDE
  9243.         JR    NZ,BF_12    ;Jump if extent or other
  9244.         LD    A,(SYSFLAG)    ;Check is system file valid
  9245.         IFNZ    BF_10A        ;Jump if system OK
  9246.         BIT    6,(HL)        ;Is it a system file
  9247.         JR    NZ,BF_12    ;Skip it if it is
  9248. BF_10A        LD    A,(INVFLAG)    ;Is invisible file valid?
  9249.         IFNZ    BF_10B        ;Jump if invisble ok (no check)
  9250.         BIT    3,(HL)        ;Is the file invisible?
  9251.         JR    NZ,BF_12    ;Skip it if it is
  9252. BF_10B        LD    DE,TFBUF    ;Get the pattern to match
  9253.         LD    A,1
  9254.         LD    (HASWILD),A    ;Set wild cards present flag
  9255.         CALL    ISWILD        ;Check if it really is
  9256.         JR    Z,BF_11        ;Jump if there are wild cards
  9257.         XOR    A
  9258.         LD    (HASWILD),A    ;Reset has wild cards flag
  9259. BF_11        EQU    $
  9260.         CALL    MATCH        ;See if it matches
  9261.         JR    NZ,BF_12
  9262.         CALL    COPYFILE    ;Copy it if it matches
  9263.         LD    A,(HASWILD)    ;Check if should check others
  9264.         IFNZ    BF_12        ;Jump if wild, might be more
  9265.         POP    BC        ;Otherwise, no wild, so keep only
  9266.         POP    BC        ;the first match as in TRSDOS's
  9267.         JP    BF_0        ;normal drive search algorithm
  9268. ;
  9269. BF_12        LD    BC,32        ;Get the length of a DIR record
  9270.         ADD    HL,BC        ;Point to next
  9271.         POP    BC        ;Restore the number of entries
  9272.         DJNZ    BF_10        ;Decrement and loop if not end
  9273.         JR    BF_9        ;Try next drive
  9274. ;
  9275. ;    Control comes to here on an error in the call to @READ.  Check
  9276. ;    to make sure it is EOF, and print an error message if not.
  9277. ;
  9278. BF_15        EQU    $
  9279.         CP    28        ;Check for end of file
  9280.         JR    Z,BF_16        ;Jump if end of file
  9281.         CALL    XERROR0        ;Print the error message
  9282.         LD    DE,DIRFCB    ;Close the open file
  9283.         CALL    XCLOSE
  9284.         JP    KERMIT        ;Abort completely
  9285. ;
  9286. BF_16        EQU    $
  9287.         LD    DE,DIRFCB    ;Close the directory
  9288.         CALL    XCLOSE        ;Closed
  9289.         JP    NZ,BFCLSERR    ;Jump if close error
  9290. BF_17        EQU    $
  9291.         POP    BC        ;Restore drive number
  9292.         INC    C        ;Next drive
  9293.         LD    A,8        ;Get max drive number (plus 1)
  9294.         CP    C        ;Get next name if no more drvs
  9295.         JP    Z,BF_0        ;Go get next name if end
  9296.         LD    A,(MOREDRV)    ;See if should check other drvs
  9297.         OR    A        ;Check for zero
  9298.         JP    NZ,BF_8        ;If set, then no drive spec so go
  9299.         JP    BF_0        ;Get the next filename in list
  9300. ;
  9301. ;    At the end of processing, we update the end of the list of names,
  9302. ;    and return the pointer to the start of the list in HL.
  9303. ;
  9304. BF_18        EQU    $
  9305.         LD    HL,(FBPTR)    ;Get the pointer
  9306.         LD    (HL),CR        ;Terminate the string
  9307.         LD    HL,FILEBUFF    ;Return the start of the list
  9308.         RET
  9309. ;
  9310. ;    Control comes to here on a directory open error.  Print the error
  9311. ;    message, and then go check next drive.
  9312. ;
  9313. BF_19        EQU    $
  9314.         CALL    XERROR0
  9315.         JR    BF_17
  9316. ;
  9317. ;    Control comes to here if CLOSE on DIR/SYS fails.
  9318. ;
  9319. BFCLSERR    EQU    $
  9320.         CALL    XERROR0        ;Print the error message
  9321.         JP    KERMIT        ;Return to command level
  9322. ;
  9323. ;    Do a wild card match on the 2 strings pointed to by
  9324. ;    HL, and DE.  DE points at the pattern containing possible
  9325. ;    wild card characters.  HL points at the start of a TRSDOS
  9326. ;    complete directory record.  HL must be moved to the start
  9327. ;    of the filename.  The filename HL points to has up to 11
  9328. ;    characters in it.  The first 8 are the filename, the last
  9329. ;    3 are the extension.  Both are left justified within their
  9330. ;    respective fields, with blanks as fill.
  9331. ;
  9332. MATCH        EQU    $
  9333.         PUSH    BC        ;Save BC
  9334.         PUSH    HL        ;Save HL
  9335.         PUSH    DE        ;Save DE
  9336.         LD    BC,5        ;Move HL to filename field
  9337.         ADD    HL,BC        ;Move the pointer
  9338. ;
  9339. ;    We must now convert the filename in the directory record
  9340. ;    to have the '/' in it.  I.E. the entry may look like:
  9341. ;
  9342. ;        DIR+5                     DIR+15
  9343. ;        +-+-+-+-+-+-+-+-+-+-+-+
  9344. ;        |F|I|L|E| | | | |C| | |
  9345. ;        +-+-+-+-+-+-+-+-+-+-+-+
  9346. ;
  9347. ;    So we must make the name be FILE/C
  9348. ;
  9349.         LD    DE,COMPNAME    ;Get the destination
  9350.         LD    BC,0B30H    ;Number of characters to move
  9351. ;
  9352. ;    Note that C has a big enough value in it to keep the LDI
  9353. ;    below from changing B which is the loop counter.
  9354. ;
  9355. MATCH_1        LD    A,(HL)        ;See if at the end of name
  9356.         INC    HL        ;Point a head in case ' ' is next
  9357.         IFA    ' ',MATCH_3    ;Skip spaces if at one
  9358.         DEC    HL        ;Move back, valid character
  9359.         LD    A,B        ;Check if time for '/'
  9360.         IFANOT    3,MATCH_2    ;If B is 3, then put in a '/'
  9361.         LD    A,'/'        ;Get the '/'
  9362.         LD    (DE),A        ;Put it in the destination
  9363.         INC    DE        ;Point to next position
  9364. MATCH_2        LDI            ;Move the current character
  9365. MATCH_3        DJNZ    MATCH_1        ;Loop until all moved
  9366.         XOR    A        ;Put in a terminating NULL
  9367.         LD    (DE),A
  9368.         POP    DE        ;Get the wild card pattern back
  9369.         PUSH    DE        ;Save it again
  9370.         LD    HL,COMPNAME    ;Get the name to compare against
  9371. ;
  9372. ;    Now the matching process starts
  9373. ;
  9374. ;    From C-Kermit's wild carding, this is the function match()
  9375. ;    HL is string, DE is pattern.  There are some things different
  9376. ;    here, but this is mostly a line by line translation.
  9377. ;
  9378. ;
  9379.         LD    A,(HL)        ;Check for null strings
  9380.         IFZ    NOMATCH        ;Return if no match
  9381.         LD    A,(DE)        ;Check for null pattern
  9382.         IFZ    NOMATCH        ;Return if no match
  9383. ;
  9384.         LD    (SPAT),DE    ;Save current pattern spot
  9385.         LD    (SSTR),HL    ;Save current string spot
  9386.         LD    HL,0        ;Reset the 2 pointers
  9387.         LD    (PSAVE),HL
  9388.         LD    (SSAVE),HL
  9389. ;
  9390. MATCH_6        EQU    $
  9391.         LD    HL,(SSTR)    ;Get the pointer
  9392.         LD    A,(HL)        ;Check for end of str
  9393.         IFZ    MATCH_9        ;Jump if at the end
  9394. ;
  9395.         LD    DE,(SPAT)    ;Ge&t the pattern pointer
  9396.         LD    A,(DE)        ;Get the character
  9397.         CP    (HL)        ;Do the characters match
  9398.         JR    NZ,MATCH_9
  9399.         INC    HL        ;Increment the pointers
  9400.         INC    DE
  9401.         LD    (SPAT),DE    ;Save the new values
  9402.         LD    (SSTR),HL
  9403.         JR    MATCH_6        ;Loop until done
  9404. ;
  9405. MATCH_9        EQU    $
  9406.         LD    A,(HL)        ;Check if a match was found
  9407.         IFNZ    MATCH_10    ;Jump if not at end
  9408.         LD    DE,(SPAT)    ;Get the pattern pointer
  9409.         LD    A,(DE)        ;Check if at end of pattern
  9410.         IFNZ    MATCH_10    ;Jump if not at end
  9411. MATCHED        CP    A        ;Set Z status
  9412.         POP    DE        ;Restore the saved registers
  9413.         POP    HL
  9414.         POP    BC
  9415.         RET            ;Return the matched status
  9416. ;
  9417. MATCH_10    EQU    $
  9418.         LD    DE,(SPAT)    ;Get the pattern pointer
  9419.         LD    A,(DE)        ;Get the pattern character
  9420.         IFANOT    '$',MATCH_12    ;Jump if not '$'
  9421.         INC    HL        ;++sstr
  9422.         INC    DE        ;++spat
  9423.         LD    (SSTR),HL
  9424.         LD    (SPAT),DE
  9425.         JR    MATCH_20    ;Skip else case
  9426. ;
  9427. MATCH_12    EQU    $
  9428.         IFANOT    '*',MATCH_15    ;Jump if not '*'
  9429.         INC    DE        ;Move pattern forward
  9430.         LD    (SPAT),DE    ;Save the new value
  9431.         LD    (PSAVE),DE
  9432.         LD    (SSAVE),HL    ;Match Zero characters
  9433.         JR    MATCH_20
  9434. ;
  9435. MATCH_15    EQU    $
  9436.         LD    HL,(SSAVE)    ;Get the saved position
  9437.         LD    A,H        ;Check if null pointer
  9438.         OR    L
  9439.         JR    Z,MATCH_17    ;Jump if pointer NULL
  9440.         LD    A,(HL)        ;Check if end of string
  9441.         IFZ    MATCH_17    ;Jump if at the end
  9442.         INC    HL
  9443.         LD    (SSTR),HL    ;sstr = ++ssave;
  9444.         LD    (SSAVE),HL    ;Save new value
  9445.         LD    HL,(PSAVE)
  9446.         LD    (SPAT),HL    ;spat = psave;
  9447.         JR    MATCH_20
  9448. ;
  9449. MATCH_17    EQU    $
  9450. NOMATCH        LD    A,1        ;Set NZ status
  9451.         CP    0
  9452.         POP    DE        ;Restore the saved registers
  9453.         POP    HL
  9454.         POP    BC
  9455.         RET            ;Return to caller
  9456. ;
  9457. MATCH_20    EQU    $
  9458.         JP    MATCH_6        ;Loop
  9459. ;
  9460. ;    This function takes the string in the COMPNAME data area, and
  9461. ;    appends it to the list of filenames already collected.
  9462. ;
  9463. COPYFILE    EQU    $
  9464.         PUSH    DE        ;Save the regs
  9465.         PUSH    HL
  9466.         PUSH    BC
  9467.         LD    HL,COMPNAME    ;Get name matched
  9468.         LD    DE,(FBPTR)    ;Get the current position
  9469.         PUSH    DE        ;Save address to print from
  9470. COPYF_1        EQU    $
  9471.         LD    A,(HL)        ;Check for end of string
  9472.         IFZ    COPYF_3        ;Jump if at the end
  9473.         LDI            ;Move a character
  9474.         PUSH    HL        ;Save HL
  9475.         PUSH    DE        ;Copy DE to HL
  9476.         POP    HL
  9477.         LD    BC,FILEBUFF+BUFFSIZE    ;Get the end of buffer
  9478.         OR    A        ;Reset the carry
  9479.         SBC    HL,BC        ;Check for too far
  9480.         POP    HL        ;Restore HL back
  9481.         JR    NZ,COPYF_1    ;Loop if not too far
  9482.         STROUT    OUTOFSTR    ;Print a message
  9483.         JP    KERMIT
  9484. ;
  9485. COPYF_3        EQU    $
  9486.         PUSH    DE
  9487.         POP    HL        ;Copy DE to HL
  9488.         LD    BC,FILEBUFF+BUFFSIZE-4    ;Get max for following
  9489.         OR    A
  9490.         SBC    HL,BC        ;Compute remaining
  9491.         JR    NZ,COPYF_5
  9492. COPYF_4        STROUT    OUTOFSTR    ;Print message
  9493.         JP    KERMIT        ;Abort
  9494. ;
  9495. COPYF_5        LD    A,':'        ;Put in the drive delimiter
  9496.         LD    (DE),A        ;Store it
  9497.         INC    DE        ;Point ahead one
  9498.         LD    A,(SDIRDRV)    ;Get the drive number
  9499.         LD    (DE),A        ;Store it
  9500.         INC    DE        ;Point ahead one more
  9501.         LD    A,' '        ;Add a space at the end
  9502.         LD    (DE),A        ;Store it
  9503.         INC    DE        ;Point ahead
  9504.         LD    A,EOS        ;Get the end of string character
  9505.         LD    (DE),A        ;Put in a terminator
  9506.         LD    (FBPTR),DE    ;Save the new pointer
  9507.         LD    HL,FILECNT    ;Increment the number of files
  9508.         LD    A,(HL)        ;Get the current count
  9509.         PUSH    AF        ;Save the count
  9510.         INC    (HL)        ;Add one to counter
  9511.         IFNZ    COPYF_6        ;Jump if not first
  9512.         LD    A,(LOGNAMES)    ;Check if should print anything
  9513.         IFZ    COPYF_6        ;Jump if not
  9514.         STROUT    FILESFND    ;Print the message only once
  9515. COPYF_6        EQU    $
  9516.         POP    AF
  9517.         IFA    255,COPYF_4    ;Jump if not too many names
  9518.         POP    DE        ;Get the string
  9519.         LD    A,(LOGNAMES)    ;Check if should print anything
  9520.         IFZ    COPYF_7        ;Jump if not
  9521.         CALL    PRTSTR        ;Print the string
  9522.         CALL    NEWLIN        ;Get a new line
  9523. COPYF_7        EQU    $
  9524.         POP    BC        ;Restore the registers
  9525.         POP    HL
  9526.         POP    DE
  9527.         RET            ;Return to caller
  9528. ;
  9529. ;    Check if any wild card characters are in the string pointed
  9530. ;    to by HL.  Return Z status if there are, NZ if there are not
  9531. ;
  9532. ISWILD        EQU    $
  9533.         PUSH    HL        ;Save the strings address
  9534.         PUSH    DE
  9535.         EX    DE,HL
  9536. ISWILD_1    LD    A,(HL)        ;Get a character
  9537.         IFZ    ISWILD_2    ;End of string?  Jump if so
  9538.         IFA    '$',ISWILD_4    ;Jump if it is a wild card
  9539.         IFA    '*',ISWILD_4    ;Jump if it is a wild card
  9540.         INC    HL        ;Point to next character
  9541.         JR    ISWILD_1    ;Loop until there
  9542. ;
  9543. ISWILD_2    EQU    $
  9544.         INC    A        ;Set NZ
  9545. ISWILD_3    POP    DE        ;Restore the registers
  9546.         POP    HL
  9547.         RET            ;Return to caller
  9548. ;
  9549. ISWILD_4    EQU    $
  9550.         CP    A        ;Set Z status
  9551.         JR    ISWILD_3    ;Return
  9552. ; end of file
  9553. <<< m4xfer.asm >>>
  9554. ;    M4XFER/ASM
  9555. ;
  9556. ;    FILE ROUTINES
  9557. ;
  9558. ;    Output the characters in a packet
  9559. ;
  9560. PTCHR    LD    HL,PUTFILE
  9561.     CALL    DECODE
  9562.     JP    Z,RSKP
  9563.     RET
  9564. ;
  9565. ;    Get a packets worth of data
  9566. ;
  9567. GTCHR    LD    A,(EOFLAG)    ;Check for EOF
  9568.     OR    A        ;Set or reset Z
  9569.     RET    NZ        ;Return if EOF occured
  9570.     CALL    GETPKT        ;Get a packets worth
  9571.     JP    RSKP        ;Return saying that something is there
  9572. ;
  9573. ;    Put a character to a file
  9574. ;
  9575. PUTFILE    LD    DE,(RFIDCB)    ;Get the DCB address
  9576.     CALL    XPUT        ;Output the character
  9577.     RET    Z        ;Return if no error
  9578.     CALL    XERROR0        ;Print an error message
  9579.     LD    A,'X'        ;Set EOT flag
  9580.     LD    (CZSEEN),A
  9581.     RET            ;Return to caller
  9582. ;
  9583. ;    Put a character to the buffer
  9584. ;
  9585. PUTDATA    PUSH    HL        ;Save the pointer
  9586.     LD    HL,(RMTPTR)    ;Get the pointer to the start
  9587.     LD    (HL),A        ;Store the character
  9588.     INC    HL        ;Point to next
  9589.     LD    (HL),0        ;Terminate the string
  9590.     LD    (RMTPTR),HL    ;Save the new pointer
  9591.     POP    HL        ;Restore the pointer
  9592.     CP    A        ;Set Z status
  9593.     RET            ;Return
  9594. ;
  9595. ;    Get a character from the packet, doing all necessary decoding
  9596. ;
  9597. GETDATA    PUSH    HL        ;Save HL
  9598.     LD    (RMTPTR),HL    ;Store as the place to but the data
  9599.     LD    HL,PUTDATA    ;Get the address of the routine
  9600.     CALL    DECODE        ;Decode it
  9601.     POP    HL        ;Restore HL
  9602.     RET            ;Return to caller
  9603. ;
  9604. ;    Call this address to call the address in HL
  9605. ;
  9606. CALLHL    JP    (HL)
  9607.     RET
  9608. ;
  9609. ;    Get the next file name pointed to by MFNPTR and put it in FCB.
  9610. ;    If no more names are available, then the Carry Flag will be
  9611. ;    set apon return.  Otherwise, NC will exist, and FCB will
  9612. ;    contain a valid TRSDOS filename.
  9613. ;
  9614. MFNAME    PUSH    BC        ;Save the registers
  9615.     PUSH    DE
  9616.     PUSH    HL
  9617.     LD    B,32        ;Blank the FCB
  9618.     LD    HL,MFREQ
  9619.     PUSH    HL
  9620.     LD    A,32
  9621. MFN0A    LD    (HL),A
  9622.     INC    HL
  9623.     DJNZ    MFN0A
  9624.     LD    HL,(MFNPTR)    ;Get the start of the next name
  9625.     POP    DE        ;Get the destination
  9626.     CALL    XFSPEC        ;Move and convert
  9627.     LD    (MFNPTR),HL    ;Save start of next name
  9628.     PUSH    AF        ;Save the returned flags
  9629.     LD    HL,MFREQ    ;Get the source
  9630.     PUSH    HL        ;Make a copy
  9631.     LD    DE,TFILNAM    ;Get the destination
  9632.     LD    BC,32        ;Get the byte count
  9633.     LDIR            ;Move them
  9634.     LD    HL,TFILNAM    ;Terminate the string with EOS
  9635.     LD    A,3        ;Find the ETX
  9636.     LD    BC,32        ;Only look this far
  9637.     CPIR            ;Find it
  9638.     DEC    HL        ;Back up to the ETX
  9639.     LD    (HL),EOS    ;Put in an ETX
  9640.     POP    HL        ;Restore the source address
  9641.     LD    DE,FCB        ;Get the FCB destination
  9642.     CALL    XFSPEC        ;Move a copy into FCB
  9643.     POP    AF        ;Restore the return flags
  9644.     SCF            ;Set initial return flag
  9645.     JR    NZ,MFFIX1    ;Abort on error
  9646.     CCF            ;Reset Carry to return valid name
  9647. MFFIX1    POP    HL        ;Restore the registers
  9648.     POP    DE
  9649.     POP    BC
  9650.     RET            ;Return to the caller
  9651. ;
  9652. ;    Open the filename in FCB for output
  9653. ;
  9654. GETFIL    LD    A,0FFH
  9655.     LD    (FILFLG),A    ;No file open
  9656.     XOR    A        ;Get zero
  9657.     LD    (EOFLAG),A    ;Not the end of file
  9658.     LD    (LSTCHR),A    ;No previous character
  9659.     PUSH    HL
  9660.     LD    DE,FCB        ;Get the FCB
  9661.     LD    HL,BUFF        ;Get the data buffer
  9662.     LD    B,0        ;Select LRL=256
  9663.     CALL    XOPEN        ;Open the file (at least try)
  9664.     POP    HL        ;Restore old HL
  9665.     JR    Z,GETFIL1    ;Return if normal open
  9666. ;
  9667. ;    The following code handles files with LRL's different then
  9668. ;    256.  The LRL open fault can be ignored in this case.
  9669. ;
  9670.     CP    42        ;Check for different LRL ERROR
  9671.     JP    NZ,ERRORD    ;If not, then error
  9672. GETFIL1    JP    RSKP        ;Ignore LRL open fault
  9673. ;
  9674. ;    PACKET ROUTINES
  9675. ;
  9676. ;    Send a packet out the comm port
  9677. ;
  9678. ;    This routine assembles a packet from the arguments given and
  9679. ;    sends it out the communications port
  9680. ;
  9681. ;    Arguments:
  9682. ;
  9683. ;    A     - TYPE OF PACKET (D,Y,N,S,R,E,F,Z,T)
  9684. ;    ARGBLK     - PACKET SEQUENCE NUMBER
  9685. ;    ARGBLK+1 - NUMBER OF DATA CHARACTERS
  9686. ;
  9687. SPACK    LD    (ARGBLK+2),A    ;Save data for resend to use
  9688.     LD    HL,PACKET    ;GET ADDRESS OF THE SEND PACKET.
  9689.     LD    A,(SSOHCH)    ;GET THE START OF HEADER CHAR.
  9690.     PUTHL    A        ;PUT IN THE PACKET.
  9691.     LD    A,(CURCHK)    ;GET CURRENT CHECKSUM TYPE
  9692.     SUB    '1'        ;DETERMINE EXTRA LENGTH OF CHECKSUM
  9693.     LD    B,A        ;COPY LENGTH
  9694.     LD    A,(ARGBLK+1)    ;GET THE NUMBER OF DATA CHARS.
  9695.     ADD    A,' '+3        ;Real packet length made printable
  9696.     ADD    A,B        ;DETERMINE OVERALL LENGTH
  9697.     PUTHL    A        ;Put in the packet
  9698.     LD    B,0        ;ZERO THE CHECKSUM AC.
  9699.     LD    C,A        ;START THE CHECKSUM.
  9700.     LD    A,(ARGBLK)    ;GET THE PACKET NUMBER.
  9701.     TOCHAR            ;ADD A SPACE SO THE NUMBER IS PRINTABLE.
  9702.     PUTHL    A        ;Put in the packet
  9703.     CALL    NXTSUM        ;Get next checksum value
  9704.     LD    A,(ARGBLK+2)    ;GET THE PACKET TYPE.
  9705.     PUTHL    A        ;Put in the packet
  9706.     CALL    NXTSUM
  9707. SPACK2    LD    A,(ARGBLK+1)    ;GET THE PACKET SIZE.
  9708.     IFZ    SPACK3
  9709.     DEC    A        ;DECREMENT THE CHAR COUNT.
  9710.     LD    (ARGBLK+1),A    ;PUT IT BACK.
  9711.     LD    A,(HL)        ;GET THE NEXT CHAR.
  9712.     INC    HL        ;POINT TO NEXT CHAR.
  9713.     CALL    NXTSUM        ;Compute next checksum
  9714.     JR    SPACK2        ;GO TRY AGAIN.
  9715. SPACK3    LD    A,(CURCHK)    ;GET THE CURRENT CHECKSUM TYPE
  9716.     IFA    '2',SPACK4
  9717.     JR    NC,SPACK5    ;Go do CRC if '3'
  9718.     LD    A,C        ;GET THE CHARACTER TOTAL.
  9719.     AND    0C0H        ;TURN OFF ALL BUT THE TWO HIGH ORDER BITS
  9720.     RLCA            ;TWO LEFT ROTATES SAME AS 6 RIGHTS
  9721.     RLCA            ;.  .    .
  9722.     ADD    A,C        ;ADD IT TO THE OLD BITS.
  9723.     AND    3FH        ;TURN OFF THE TWO HIGH ORDER BITS.
  9724.     TOCHAR            ;ADD A SPACE SO THE NUMBER IS PRINTABLE.
  9725.     PUTHL    A        ;Put in the packet
  9726.     JP    SPACK7        ;GO STORE EOL CHARACTER
  9727. ;
  9728. ;HERE FOR 3 CHARACTER CRC-CCITT
  9729. ;
  9730. SPACK5    LD    (HL),0        ;STORE A NULL FOR CURRENT END
  9731.     PUSH    HL        ;SAVE H
  9732.     LD    HL,PACKET+1    ;POINT TO FIRST CHECKSUMED CHARACTER
  9733.     CALL    CRCCLC        ;CALCULATE THE CRC
  9734.     POP    HL        ;RESTORE THE POINTER
  9735.     LD    C,E        ;GET LOW ORDER HALF FOR LATER
  9736.     LD    B,D        ;COPY THE HIGH ORDER
  9737.     LD    A,D        ;GET THE HIGH ORDER PORTION
  9738.     RLCA            ;SHIFT OFF LOW 4 BITS
  9739.     RLCA            ;.  .    .
  9740.     RLCA            ;.  .    .
  9741.     RLCA            ;.  .    .
  9742.     AND    0FH        ;KEEP ONLY LOW 4 BITS
  9743.     TOCHAR            ;PUT INTO PRINTING RANGE
  9744.     LD    (HL),A        ;STORE THE CHARACTER
  9745.     INC    HL        ;POINT TO NEXT POSITION
  9746. ;
  9747. ;HERE FOR TWO CHARACTER CHECKSUM
  9748. ;
  9749. SPACK4    LD    A,B        ;GET HIGH ORDER PORTION
  9750.     AND    0FH        ;ONLY KEEP LAST FOUR BITS
  9751.     RLCA            ;SHIFT UP TWO BITS
  9752.     RLCA            ;. .  .
  9753.     LD    B,A        ;COPY BACK INTO SAFE PLACE
  9754.     LD    A,C        ;GET LOW ORDER HALF
  9755.     RLCA            ;SHIFT HIGH TWO BITS
  9756.     RLCA            ;TO LOW TWO BITS
  9757.     AND    03H        ;KEEP ONLY TWO LOW BITS
  9758.     OR    B        ;GET HIGH ORDER PORTION IN
  9759.     TOCHAR            ;CONVERT TO PRINTING CHARACTER RANGE
  9760.     PUTHL    A        ;Store the character
  9761.     LD    A,C        ;GET LOW ORDER PORTION
  9762.     AND    3FH        ;KEEP ONLY SIX BITS
  9763.     TOCHAR            ;CONVERT TO PRINTING RANGE
  9764.     PUTHL    A        ;Store the character
  9765. SPACK7    LD    A,(SEOL)    ;GET THE EOL THE OTHER HOST WANTS.
  9766.     PUTHL    A        ;Store the character
  9767.     PUTHL    0        ;End with a NULL
  9768.     LD    A,(DBFLG)
  9769.     OR    A
  9770.     JR    Z,SPACK8    ;debug is off
  9771.     PUTHL    EOS        ;Add terminator
  9772. SPACK8    CALL    OUTPKT        ;CALL THE SYSTEM DEPENDENT ROUTINE.
  9773.     JP    QUIT
  9774.     JP    RSKP
  9775. ;
  9776. ;    WRITE OUT A PACKET.
  9777. ;
  9778. OUTPKT    LD    A,(SPAD)    ;GET THE NUMBER OF PADDING CHARS.
  9779.     LD    B,A
  9780. OUTPK2    DEC    B
  9781.     JP    M,OUTPK4
  9782.     LD    A,(SPADCH)    ;GET THE PADDING CHAR.
  9783.     LD    E,A        ;PUT THE CHAR IN RIGHT AC.
  9784.     CALL    OUTCHR        ;OUTPUT IT.
  9785.     JR    OUTPK2
  9786. OUTPK4    LD    A,(DBFLG)
  9787.     IFZ    OUTPK5        ;If not on, then check for logfile
  9788.     STROUT    SPPOS        ;Print the SPACK=> message
  9789.     STROUT    PACKET+1    ;Print the data
  9790. OUTPK5    LD    A,(DEBLOG)    ;See if logging in effect
  9791.     IFZ    OUTPK7        ;If not, then finish up
  9792.     LD    DE,DFCB        ;Get the debug FCB
  9793.     TRLOG    SPPOS,OUTPK6    ;Log the SPACK=> message
  9794.     TRLOG    PACKET,OUTPK6    ;Log the packet data
  9795.     JR    OUTPK7
  9796. OUTPK6    XOR    A
  9797.     LD    (DEBLOG),A
  9798.     LD    DE,DFCB
  9799.     CALL    XCLOSE
  9800. OUTPK7    LD    HL,PACKET    ;POINT TO THE PACKET.
  9801. OUTPK10    LD    A,(HL)        ;GET THE NEXT CHARACTER.
  9802.     IFZ    OUTPK11        ;Return success if EOS found
  9803.     LD    E,A        ;PUT THE CHAR IN RIGHT AC.
  9804.     CALL    OUTCHR        ;OUTPUT THE CHARACTER.
  9805.     INC    HL        ;INCREMENT THE CHAR POINTER.
  9806.     JR    OUTPK10
  9807. OUTPK11    LD    A,(STURN)    ;Is turn around needed?
  9808.     IFZ    OUTPK12        JUMP IF NOT NEEDED
  9809.     LD    E,A        ;Get the character
  9810.     CALL    OUTCHR        ;Output it
  9811. OUTPK12    JP    RSKP        ;Return no error
  9812. ;
  9813. ;    Compute next checksum
  9814. ;
  9815. NXTSUM    ADD    A,C
  9816.     LD    C,A
  9817.     LD    A,0        ;Must use load to preserve Carry flag
  9818.     ADC    A,B
  9819.     LD    B,A
  9820.     RET
  9821. ;
  9822. ;THIS ROUTINE WAITS FOR A PACKET TO ARRIVE FROM THE HOST. IT READS
  9823. ;CHARACTERS UNTIL IT FINDS THE SOH. IT THEN READS THE PACKET INTO PACKET.
  9824. ;
  9825. ;RETURNS +1 FAILURE (IF THE CHECKSUM IS WRONG OR THE PACKET TRASHED)
  9826. ;    +3 SUCCESS WITH A        - MESSAGE TYPE
  9827. ;            ARGBLK - MESSAGE NUMBER
  9828. ;            ARGBLK+1 - LENGTH OF DATA
  9829. ;
  9830. RPACK    LD    A,(RTIME)    ;Get the timeout value
  9831.     LD    HL,0
  9832.     IFZ    RPACK1        ;If zero, then no timeout
  9833.     LD    L,A        ;Get the value as 16 bits
  9834.     LD    C,30        ;Get the factor to extend it by
  9835.     CALL    XMUL16        ;Do the multiplication
  9836.     LD    H,L        ;Slide the 24 bit result down
  9837.     LD    L,A
  9838. RPACK1    LD    (SVTIMER),HL    ;Save it as the timer value
  9839. RPACK2    CALL    STARTTIMER    ;Start the timer for receive timeout
  9840.     CALL    INPKT        ;READ UP TO A CARRIAGE RETURN.
  9841.     JP    QUIT        ;RETURN BAD.
  9842.     CALL    STOPTIMER    ;Stop the timeout countdown
  9843. RPACK3    CALL    GETCHR        ;GET A CHARACTER.
  9844.     JP    RPACK2        ;HIT A CR;NULL LINE; JUST START OVER.
  9845.     CALL    CPRSOH        ;IS THE CHAR THE START OF HEADER CHAR?
  9846.     JR    NZ,RPACK3    ;NO, GO UNTIL IT IS.
  9847. RPACK4    CALL    GETCHR        ;GET A CHARACTER.
  9848.     JP    QUIT        ;HIT THE CARRIAGE RETURN, RETURN BAD.
  9849.     CALL    CPRSOH        ;IS THE CHAR THE START OF HEADER CHAR?
  9850.     JR    Z,RPACK4    ;YES, THEN GO START OVER.
  9851.     LD    (PACKET+1),A    ;STORE IN PACKET ALSO
  9852.     LD    C,A        ;START THE CHECKSUM.
  9853.     LD    A,(CURCHK)    ;GET BLOCK CHECK TYPE
  9854.     SUB    '1'        ;DETERMINE EXTRA LENGTH OF BLOCK CHECK
  9855.     LD    B,A        ;GET A COPY
  9856.     LD    A,C        ;GET BACK LENGTH CHARACTER
  9857.     SUB    ' '+3        ;GET THE REAL DATA COUNT.
  9858.     SUB    B        ;GET TOTAL LENGTH
  9859.     LD    (ARGBLK+1),A
  9860.     LD    B,0        ;CLEAR HIGH ORDER HALF OF CHECKSUM
  9861.     CALL    GETCHR        ;GET A CHARACTER.
  9862.     JP    QUIT        ;HIT THE CARRIAGE RETURN, RETURN BAD.
  9863.     CALL    CPRSOH        ;IS THE CHAR THE START OF HEADER CHAR?
  9864.     JR    Z,RPACK4    ;YES, THEN GO START OVER.
  9865.     LD    (ARGBLK),A
  9866.     LD    (PACKET+2),A    ;SAVE ALSO IN PACKET
  9867.     CALL    NXTSUM        ;ADD THE CHARACTER TO THE CHECKSUM
  9868.     LD    A,(ARGBLK)
  9869.     SUB    ' '        ;GET THE REAL PACKET NUMBER.
  9870.     LD    (ARGBLK),A
  9871.     CALL    GETCHR        ;GET A CHARACTER.
  9872.     JP    QUIT        ;HIT THE CARRIAGE RETURN, RETURN BAD.
  9873.     CALL    CPRSOH        ;IS THE CHAR THE START OF HEADER CHAR?
  9874.     JR    Z,RPACK4    ;YES, THEN GO START OVER.
  9875.     LD    (TEMP1),A    ;SAVE THE MESSAGE TYPE.
  9876.     LD    (PACKET+3),A    ;SAVE IN PACKET
  9877.     LD    (RECTYP),A
  9878.     CALL    NXTSUM        ;ADD THE CHARACTER TO THE CHECKSUM.
  9879.     LD    A,(ARGBLK+1)    ;GET THE NUMBER OF DATA CHARACTERS.
  9880.     LD    (TEMP2),A
  9881.     LD    HL,DATA        ;POINT TO THE DATA BUFFER.
  9882.     LD    (DATPTR),HL
  9883. RPACK5    LD    A,(TEMP2)
  9884.     DEC    A        ;ANY DATA CHARACTERS?
  9885.     JP    M,RPACK6    ;IF NOT GO GET THE CHECKSUM.
  9886.     LD    (TEMP2),A
  9887.     CALL    GETCHR        ;GET A CHARACTER.
  9888.     JP    QUIT        ;HIT THE END-OF-LINE, RETURN BAD.
  9889.     CALL    CPRSOH        ;IS THE CHAR THE START OF HEADER CHAR?
  9890.     JR    Z,RPACK4    ;YES, THEN GO START OVER.
  9891.     LD    HL,(DATPTR)
  9892.     PUTHL    A        ;Store the character
  9893.     LD    (DATPTR),HL
  9894.     CALL    NXTSUM        ;ADD THE CHARACTER TO THE CHECKSUM.
  9895.     JR    RPACK5        ;GO GET ANOTHER.
  9896. RPACK6    CALL    CHKECHO        ;See if only echo of previous
  9897.     JP    RPACK3        ;Yes, restart
  9898.     CALL    GETCHR        ;Get a character
  9899.     JP    QUIT        ;HIT THE CARRIAGE RETURN, RETURN BAD.
  9900.     CALL    CPRSOH        ;IS THE CHAR THE START OF HEADER CHAR?
  9901.     JP    Z,RPACK4    ;YES, THEN GO START OVER.
  9902.     SUB    ' '        ;TURN THE CHAR BACK INTO A NUMBER.
  9903.     LD    (TEMP3),A
  9904. ;DETERMINE TYPE OF CHECKSUM
  9905.     LD    A,(CURCHK)    ;GET THE CURRENT CHECKSUM TYPE
  9906.     IFA    '2',RPACK9    ;Jump if 2 character
  9907.     JR    NC,RPACK8    ;Jump if 3 character
  9908. ;
  9909. ;    1 character checksum
  9910. ;
  9911.     LD    A,C        ;Get the character count
  9912.     AND    0C0H        ;Keep 2 MSB's
  9913.     RLCA            ;Move them to 2 LSB's
  9914.     RLCA
  9915.     ADD    A,C        ;Add the 2 low bits to bottom
  9916.     AND    3FH        ;Remove 2 high bits after add
  9917.     LD    B,A
  9918.     LD    A,(TEMP3)    ;GET THE REAL RECEIVED CHECKSUM.
  9919.     IFA    B,RPACK10    ;Jump checksum OK
  9920. RPACK7    CALL    UPDRTR        ;If checksum bad, update retries
  9921.     RET            ;Return error
  9922. ;
  9923. ;    Here for three character CRC-CCITT
  9924. ;
  9925. RPACK8    LD    HL,(DATPTR)    ;GET THE ADDRESS OF THE DATA
  9926.     LD    (HL),0        ;Store a zero in the buffer as terminator
  9927.     LD    HL,PACKET+1    ;POINT AT START OF CHECKSUMMED REGION
  9928.     CALL    CRCCLC        ;CALCULATE THE CRC
  9929.     LD    C,E        ;SAVE LOW ORDER HALF FOR LATER
  9930.     LD    B,D        ;ALSO COPY HIGH ORDER
  9931.     LD    A,D        ;GET HIGH BYTE
  9932.     RLCA            ;WANT HIGH FOUR BITS
  9933.     RLCA            ;.  .    .
  9934.     RLCA            ;AND SHIFT TWO MORE
  9935.     RLCA            ;.  .    .
  9936.     AND    0FH        ;KEEP ONLY 4 BITS
  9937.     LD    D,A        ;BACK INTO D
  9938.     LD    A,(TEMP3)    ;GET FIRST VALUE BACK
  9939.     IFANOT    D,RPACK7    ;Jump if not correct
  9940.     CALL    GETCHR        ;GET A CHARACTER.
  9941.     JP    QUIT        ;HIT THE CARRIAGE RETURN, RETURN BAD.
  9942.     CALL    CPRSOH        ;IS THE CHAR THE START OF HEADER CHAR?
  9943.     JP    Z,RPACK4    ;YES, THEN GO START OVER.
  9944.     SUB    ' '        ;REMOVE SPACE OFFSET
  9945.     LD    (TEMP3),A    ;STORE FOR LATER CHECK
  9946. ;
  9947. ;    Here for a two character checksum and last two characters of CRC
  9948. ;
  9949. RPACK9    LD    A,B        ;GET HIGH ORDER PORTION
  9950.     AND    0FH        ;ONLY FOUR BITS
  9951.     RLCA            ;Shift up 2 bits
  9952.     RLCA
  9953.     LD    B,A        ;Save back into B
  9954.     LD    A,C        ;Get low order byte
  9955.     RLCA            ;Move the 2 MSB's to 2 LSB's
  9956.     RLCA
  9957.     AND    03H        ;Save only low 2 bits
  9958.     OR    B        ;Get other 4 bits
  9959.     LD    B,A        ;Save back into B
  9960.     LD    A,(TEMP3)    ;Get this portion of the checksum
  9961.     IFANOT    B,RPACK7    ;If wrong, then give up
  9962.     CALL    GETCHR        ;GET A CHARACTER.
  9963.     JP    QUIT        ;HIT THE CARRIAGE RETURN, RETURN BAD.
  9964.     CALL    CPRSOH        ;IS THE CHAR THE START OF HEADER CHAR?
  9965.     JP    Z,RPACK4    ;YES, THEN GO START OVER.
  9966.     SUB    ' '        ;REMOVE SPACE OFFSET
  9967.     LD    B,A        ;SAVE IN SAFE PLACE
  9968.     LD    A,C        ;GET LOW 8 BITS OF CHECKSUM
  9969.     AND    3FH        ;KEEP ONLY 6 BITS
  9970.     IFANOT    B,RPACK7    ;Jump if bad value
  9971. RPACK10    LD    HL,(DATPTR)
  9972.     PUTHL    0        ;End with a NULL
  9973.     LD    A,(TEMP1)    ;GET THE TYPE.
  9974.     JP    RSKP
  9975. ;
  9976. ;    Input a packet
  9977. ;
  9978. INPKT    LD    HL,RECPKT    ;POINT TO THE BEGINNING OF THE PACKET.
  9979.     LD    (PKTPTR),HL
  9980. INPKT2    CALL    INCHR        ;GET A CHARACTER.
  9981.     JP    INPKT7        ;Skip out if key typed that is valid
  9982.     LD    HL,(PKTPTR)    ;Get the packet position
  9983.     PUTHL    A        ;Store the character
  9984.     LD    (PKTPTR),HL    ;Save the pointer
  9985.     CALL    CPREOL        ;IS IT THE EOL CHARACTER?
  9986.     JR    NZ,INPKT2
  9987.     PUTHL    EOS        ;Put in the terminator
  9988.     LD    A,(DBFLG)
  9989.     IFZ    INPKT3        ;Jump if debug off
  9990.     STROUT    RPPOS        ;Output RPACK=> message
  9991.     STROUT    RECPKT+1    ;Print the received packet
  9992. INPKT3    LD    A,(DEBLOG)    ;See if debug log in on
  9993.     IFZ    INPKT6        ;Jump if not enabled
  9994.     LD    DE,DFCB        ;Get the FCB
  9995.     TRLOG    RPPOS,OUTPK6    ;Log the RPACK=> message
  9996.     TRLOG    RECPKT+1,OUTPK6    ;Log the packet
  9997. INPKT6    LD    HL,RECPKT
  9998.     LD    (PKTPTR),HL    ;SAVE THE PACKET POINTER.
  9999.     LD    A,(RTURN)    ;Get the turn around character
  10000.     CALL    WAITT        ;Go wait for it.
  10001.     JP    RSKP        ;Return no error
  10002. ;
  10003. ;    Error return processing.  This code deals with the keystrokes
  10004. ;    that are recognized in INCHR().
  10005. ;
  10006. INPKT7    LD    A,(CZSEEN)
  10007.     IFANOT    'A',INPKT8    ;Status
  10008.     CALL    SHOTRANS    ;Show the transfer status
  10009.     JR    INPKT16
  10010. INPKT8    IFANOT    'B',INPKT9    ;Cancel Batch?
  10011.     LD    A,'Z'        ;Get the packet type
  10012.     LD    (CZSEEN),A
  10013.     LD    DE,CBATCH    ;Get the cancel message
  10014.     CALL    CONDIS        ;Print it if not doing REMOTE commands
  10015.     JP    INPKT2
  10016. INPKT9    IFANOT    'F',INPKT10    ;Cancel FILE?
  10017.     LD    A,'X'        ;Get the PACKET type
  10018.     LD    (CZSEEN),A
  10019.     LD    DE,CFILE    ;Get the cancel message
  10020.     CALL    CONDIS        ;Print it if not doing REMOTE commands
  10021.     JP    INPKT2
  10022. INPKT10    IFANOT    'E',INPKT12    ;Send error, and ABORT?
  10023.     XOR    A
  10024.     LD    (CZSEEN),A    ;Reset the key pressed flag
  10025.     CALL    STOPTIMER    ;Stop the timer
  10026.     LD    A,ABRTMSGLEN    ;Get length of message
  10027.     LD    (ARGBLK+1),A    ;Save the length
  10028.     LD    HL,ABRTMSG    ;Get the message
  10029.     LD    DE,DATA        ;Where to put it
  10030.     LD    C,A        ;Get the length in BC
  10031.     LD    B,0
  10032.     LDIR            ;Move the message
  10033.     LD    A,'E'        ;Get the packet type
  10034.     CALL    SPACK        ;Send the error packet
  10035.     JP    ABORT        ;Give up on an error
  10036.     JP    KERMIT        ;Give up completely
  10037. INPKT12    IFANOT    'C',INPKT14    ;Cancel transfer, immediately
  10038.     XOR    A
  10039.     LD    (CZSEEN),A    ;Zap the old key pressed
  10040.     CALL    STOPTIMER    ;Stop the timer
  10041.     JP    KERMIT        ;Jump to restart
  10042. INPKT14    IFANOT    'D',INPKT18    ;Toggle debug mode?
  10043.     LD    A,(DBFLG)    ;Get the debug flag
  10044.     XOR    1        ;Toggle value
  10045.     LD    (DBFLG),A    ;Store it back
  10046. INPKT16    XOR    A        ;Finish up handling, reset key pressed
  10047.     LD    (CZSEEN),A    ;Reset the flag
  10048.     JP    INPKT2        ;Get the next character
  10049. INPKT18    IFANOT    'H',INPKT20    ;Help?
  10050.     STROUT    HELPMSG        ;Print the message
  10051.     JR    INPKT16        ;Finish up
  10052. INPKT20    XOR    A        ;Otherwise, return no input to force
  10053.     LD    (CZSEEN),A    ;resend to occur...
  10054.     RET            ;Return no input packet
  10055. ;
  10056. GETCHR    LD    HL,(PKTPTR)    ;GET THE PACKET POINTER.
  10057.     LD    A,(HL)        ;GET THE CHAR.
  10058.     INC    HL
  10059.     LD    (PKTPTR),HL
  10060.     CALL    CPREOL        ;IS IT THE END OF LINE
  10061.     JP    NZ,RSKP        ;IF NOT RETURN RETSKP.
  10062.     RET            ;IF SO RETURN FAILURE.
  10063. ;
  10064. ;    Assorted comparison routines
  10065. ;
  10066. CPSSOH    PUSH    HL
  10067.     LD    HL,SSOHCH
  10068. CPSH10    CP    (HL)
  10069.     POP    HL
  10070.     RET
  10071. CPRSOH    PUSH    HL
  10072.     LD    HL,RSOHCH
  10073.     JR    CPSH10
  10074. CPSEOL    PUSH    HL
  10075.     LD    HL,SEOL
  10076.     JR    CPSH10
  10077. CPREOL    PUSH    HL
  10078.     LD    HL,REOL
  10079.     JR    CPSH10
  10080. CPSPAD    PUSH    HL
  10081.     LD    HL,SPADCH
  10082.     JR    CPSH10
  10083. CPRPAD    PUSH    HL
  10084.     LD    HL,RPADCH
  10085.     JR    CPSH10
  10086. CPSTME    PUSH    HL
  10087.     LD    HL,STIME
  10088.     JR    CPSH10
  10089. CPRTME    PUSH    HL
  10090.     LD    HL,RTIME
  10091.     JR    CPSH10
  10092. CPSQTE    PUSH    HL
  10093.     LD    HL,SQUOTE
  10094.     JR    CPSH10
  10095. CPRQTE    PUSH    HL
  10096.     LD    HL,RQUOTE
  10097.     JR    CPSH10
  10098. ;
  10099. ;THIS ROUTINE WILL CALCULATE A CRC USING THE CCITT POLYNOMIAL FOR
  10100. ;A STRING.
  10101. ;
  10102. ;USAGE
  10103. ;    HL/ ADDRESS OF STRING
  10104. ;    A/ LENGTH OF STRING
  10105. ;    CALL    CRCCLC
  10106. ;
  10107. ;16-BIT CRC VALUE IS RETURNED IN DE.
  10108. ;
  10109. ;REGISTERS BC AND HL ARE PRESERVED.
  10110. ;
  10111. CRCCLC    PUSH    HL        ;SAVE HL
  10112.     PUSH    BC        ;AND BC
  10113.     LD    DE,0        ;INITIAL CRC VALUE IS 0
  10114. CRCCL0    LD    A,(HL)        ;GET A CHARACTER
  10115.     OR    A        ;CHECK IF ZERO
  10116.     JP    Z,CRCCL1    ;IF SO, ALL DONE
  10117.     PUSH    HL        ;SAVE THE POINTER
  10118.     XOR    E        ;ADD IN WITH PREVIOUS VALUE
  10119.     AND    0FH        ;Keep only 4 bits
  10120.     LD    B,0
  10121.     GETCRCTAB
  10122.     CALL    SRLDE4        ;Shift CRC right by 4
  10123.     XORATHL    E
  10124.     INC    HL
  10125.     XORATHL    D
  10126.     POP    HL
  10127.     PUSH    HL
  10128.     LD    A,(HL)
  10129.     SRL    A
  10130.     SRL    A
  10131.     SRL    A
  10132.     SRL    A
  10133.     XOR    E
  10134.     AND    0FH
  10135.     GETCRCTAB
  10136.     CALL    SRLDE4
  10137.     XORATHL    E
  10138.     INC    HL
  10139.     XORATHL    D
  10140.     POP    HL        ;AND H
  10141.     INC    HL        ;POINT TO NEXT CHARACTER
  10142.     JP    CRCCL0        ;GO GET NEXT CHARACTER
  10143. CRCCL1    POP    BC        ;RESTORE B
  10144.     POP    HL        ;AND HL
  10145.     RET            ;AND RETURN, DE=CRC-CCITT
  10146. ;
  10147. ;    Shift DE right by 4 bits
  10148. ;
  10149. SRLDE4    SRL    D
  10150.     RR    E
  10151.     SRL    D
  10152.     RR    E
  10153.     SRL    D
  10154.     RR    E
  10155.     SRL    D
  10156.     RR    E
  10157.     RET
  10158. ;
  10159. CRCTAB    DW    00000H
  10160.     DW    01081H
  10161.     DW    02102H
  10162.     DW    03183H
  10163.     DW    04204H
  10164.     DW    05285H
  10165.     DW    06306H
  10166.     DW    07387H
  10167.     DW    08408H
  10168.     DW    09489H
  10169.     DW    0A50AH
  10170.     DW    0B58BH
  10171.     DW    0C60CH
  10172.     DW    0D68DH
  10173.     DW    0E70EH
  10174.     DW    0F78FH
  10175. ;
  10176. GETNPNT    LD    A,(HL)
  10177.     INC    HL
  10178.     LD    (OUTPNT),HL
  10179.     RET
  10180. ;
  10181. ;    Check if RFIDCB points at FCB.
  10182. ;
  10183. CHKFCB    LD    DE,(RFIDCB)    ;Get the current FCB/DCB pointer
  10184.     LD    HL,FCB        ;Get the Address of FCB
  10185.     OR    A        ;Reset the carry
  10186.     SBC    HL,DE        ;Compute the difference
  10187.     RET            ;Return the flags
  10188. ;
  10189. INCKTRANS    PUSH    HL    ;Save the regs
  10190.     PUSH    AF
  10191.     LD    HL,(KTRANS)    ;Get the current count
  10192.     INC    HL        ;Add one to it
  10193.     LD    A,H        ;Check for overflow
  10194.     OR    L        ;Set the flags
  10195.     LD    A,1        ;Set the ok to change curtrans flag
  10196.     CALL    Z,ADD64K    ;Add 64K if overflow
  10197.     LD    (KTRANS),HL    ;Save the new counter
  10198.     LD    (CURTRANS),HL    ;Store as current count too
  10199.     POP    AF        ;Restore the regs
  10200.     POP    HL
  10201.     RET            ;Return to caller
  10202. ;
  10203. ;    Add 64k to the current counter (RTRANS, or STRANS, as well as
  10204. ;    CURTRANS which is used for TRANSACTION logs).
  10205. ;
  10206. ADD64K    EQU    $
  10207.     PUSH    HL        ;Save the regs
  10208.     LD    L,(IX)        ;Get the current Kbyte counter
  10209.     LD    H,(IX+1)
  10210.     LD    BC,64        ;Add 64 to it
  10211.     ADD    HL,BC
  10212.     LD    (IX),L        ;Store it back
  10213.     LD    (IX+1),H
  10214.     IFZ    ADD64K_1
  10215.     LD    HL,(CURTRANS+2)    ;Get the current value
  10216.     ADD    HL,BC        ;Add 64
  10217.     LD    (CURTRANS+2),HL    ;Store new value
  10218. ADD64K_1    POP    HL        ;Restore HL
  10219.     RET            ;Return
  10220. ;
  10221. ;    Wait for the turn around character in A
  10222. ;
  10223. TTURN    DB    0
  10224. ;
  10225. WAITT    OR    A        ;Check for no turn around
  10226.     RET    Z        ;return on ZERO
  10227.     LD    (TTURN),A    ;Save the character
  10228. WAITT1    CALL    INCHR        ;Get a character
  10229.     JP    INPKT7        ;Process keyboard character
  10230.     LD    C,A        ;Save the character
  10231.     LD    A,(TTURN)    ;Check for turn around
  10232.     CP    C        ;Is the character received it?
  10233.     JR    NZ,WAITT1    ;No, get another
  10234.     RET
  10235. ;
  10236. SHOTRANS    EQU    $
  10237.     STROUT    NPKTSTR        ;Print number of packets
  10238.     LD    HL,(NUMPKT)
  10239.     CALL    NOUT
  10240.     STROUT    NRTRSTR        ;Print retries
  10241.     LD    HL,(NUMRTR)
  10242.     CALL    NOUT
  10243.     STROUT    NCHRSTR        ;Print number of characters
  10244.     LD    HL,(KTRANS)
  10245.     CALL    NOUT
  10246.     STROUT    NRECCH        ;Number K of characters recvd
  10247.     LD    HL,(RTRANS)
  10248.     CALL    NOUT
  10249.     LD    A,'K'
  10250.     CALL    CONOUT
  10251.     STROUT    NSNDCH        ;Print number of characters sent
  10252.     LD    HL,(STRANS)
  10253.     CALL    NOUT
  10254.     LD    A,'K'
  10255.     CALL    CONOUT
  10256.     JP    NEWLIN
  10257. ;
  10258. CHKECHO    PUSH    BC
  10259.     LD    A,(SNDTYP)
  10260.     LD    C,A
  10261.     LD    A,(RECTYP)
  10262.     CP    C
  10263.     POP    BC
  10264.     RET    Z
  10265.     JP    RSKP
  10266. ;
  10267. ;    Convert KERMIT filename to TRSDOS filename
  10268. ;
  10269. GOFIL    LD    HL,RMTDATA    ;Where to put the name
  10270.     LD    A,(ARGBLK+1)    ;Number of characters
  10271.     CALL    GETDATA        ;Get the name in RMTDATA (HL saved)
  10272.     LD    DE,MFREQ    ;Destination
  10273.     LD    BC,8        ;Max characters for first field
  10274. GOFIL1    EQU    $
  10275.     LD    A,(HL)        ;At end of field?
  10276.     IFA    '.',GOFIL8    ;Jump if at separator
  10277.     IFALT    ' ',GOFIL15    ;Stop if at end of string
  10278.     LD    A,C        ;Check range
  10279.     IFANOT    8,GOFIL2    ;If not first character, then skip
  10280.     LD    A,(HL)        ;Get the character
  10281.     CALL    ISALPHA        ;Is it alphabetic?
  10282.     JR    Z,GOFIL5    ;Jump if it is
  10283.     LD    (HL),'Z'    ;Change name
  10284.     JR    GOFIL5        ;Join code
  10285. GOFIL2    EQU    $        ;Second or later character...
  10286.     LD    A,(HL)
  10287.     CALL    ISALNUM        ;Is it alphanumeric?
  10288.     JR    Z,GOFIL5    ;Jump if so
  10289.     INC    HL        ;Skip this one
  10290.     JR    GOFIL1        ;Go to the next character
  10291. GOFIL5    EQU    $
  10292.     LDI            ;Move the character
  10293.     LD    A,B        ;Check the remaining count
  10294.     OR    C
  10295.     JR    NZ,GOFIL1    ;Jump if still OK
  10296. GOFIL7    EQU    $
  10297.     LD    A,(HL)        ;Are we at the end yet
  10298.     IFA    '.',GOFIL8    ;Jump if at the separator
  10299.     IFALT    ' ',GOFIL15    ;Stop it at the end
  10300.     INC    HL        ;Point to next source character
  10301.     JR    GOFIL7        ;Loop
  10302. GOFIL8    EQU    $
  10303.     LD    A,C        ;Check the count of characters moved
  10304.     IFANOT    8,GOFIL9    ;Jump if at least one moved
  10305.     LD    A,'X'        ;Use this as the first character
  10306.     LD    (DE),A        ;Put it in
  10307.     INC    DE        ;Point to next slot
  10308. GOFIL9    LD    (HL),'/'    ;Put in separator
  10309.     LDI            ;Move it too
  10310.     LD    BC,3        ;Length of next field
  10311. GOFIL10    EQU    $
  10312.     LD    A,(HL)        ;Get the character
  10313.     IFALT    ' ',GOFIL15    ;Jump if at the end
  10314.     LD    A,C        ;Check ranges
  10315.     IFANOT    3,GOFIL12    ;Jump if not first character
  10316.     LD    A,(HL)        ;Get the character (Must be alphabetic)
  10317.     CALL    ISALPHA        ;Is it alphbetic?
  10318.     JR    Z,GOFIL13    ;Jump if it is
  10319.     LD    (HL),'Z'    ;Make it alphabetic
  10320.     JR    GOFIL13        ;Join other code
  10321. GOFIL12    EQU    $        ;Second or third character in extension
  10322.     LD    A,(HL)        ;Get the character back
  10323.     CALL    ISALNUM        ;Is it alphanumeric?
  10324.     JR    Z,GOFIL13    ;Jump if so
  10325.     INC    HL        ;Skip it
  10326.     JR    GOFIL10        ;Check the next one
  10327. GOFIL13    EQU    $
  10328.     LDI            ;Move a char
  10329.     LD    A,B        ;Check the count
  10330.     OR    C
  10331.     JR    NZ,GOFIL10    ;Loop if OK
  10332. GOFIL15    EQU    $
  10333.     PUSH    DE        ;Put dest into HL
  10334.     POP    HL
  10335.     PUTHL    ':'        ;Add the default drive
  10336.     LD    A,(DEFDSK)
  10337.     PUTHL    A        ;Add the drive number
  10338.     LD    (HL),EOS    ;Add the end of string byte
  10339.     PUSH    HL        ;Save that address
  10340.     LD    HL,MFREQ    ;Move the string to the save area
  10341.     LD    DE,TFILNAM    ;Get the destination
  10342.     LD    BC,32
  10343.     LDIR            ;Move the bytes
  10344.     POP    HL
  10345.     LD    (HL),3        ;Put in FSPEC terminator
  10346.     LD    (FCBPTR),HL    ;Save the end
  10347.     LD    HL,MFREQ    ;Validate the filespec
  10348.     LD    DE,FCB
  10349.     CALL    XFSPEC        ;Call TRSDOS
  10350.     JR    Z,GOFIL18    ;Jump if OK
  10351.     LD    HL,(FCBPTR)    ;Get end of string
  10352.     LD    (HL),EOS    ;Put in print terminator
  10353.     STROUT    FCB        ;Print the name
  10354.     JP    XERROR0        ;Print system error message and return
  10355. GOFIL18    LD    HL,FCB        ;Get start
  10356.     LD    BC,40        ;Maximum to look
  10357.     LD    A,':'        ;Find drive spec to index off of
  10358.     CPIR            ;Look for it.  MUST be there
  10359.     INC    HL        ;Point after for terminator
  10360.     LD    (FCBPTR),HL    ;Save it
  10361.     DEC    HL        ;Back up to just after extension
  10362.     DEC    HL
  10363.     LD    (DATPTR),HL    ;Save it for renaming
  10364.     LD    A,(FLWFLG)    ;Is file warning on?
  10365.     IFZ    GOFIL30        ;Jump if not
  10366.     LD    DE,FCB        ;Get the file name
  10367.     LD    HL,BUFF        ;Buffer address
  10368.     LD    B,0        ;LRL=256
  10369.     CALL    XOPEN        ;Is it there?
  10370.     JR    NZ,GOFIL30    ;Jump if not
  10371.     LD    DE,INFMS5    ;Print renaming message
  10372.     CALL    ERROR3
  10373.     LD    DE,FCB        ;Close the file
  10374.     CALL    XCLOSE        ;Close restores the filename with @FNAME
  10375. GOFIL20    LD    HL,(DATPTR)    ;Get the pointer to extension
  10376.     LD    DE,FCB        ;Get the start
  10377.     OR    A        ;Reset the carry
  10378.     PUSH    HL        ;Save it
  10379.     SBC    HL,DE        ;At the beginning yet
  10380.     POP    HL        ;Restore it
  10381.     JR    NZ,GOFIL21    ;Jump if not
  10382.     LD    DE,ERMS16    ;Oops, Can't rename it, stop
  10383.     JP    PRTSTR        ;Print, and return
  10384. ;
  10385. GOFIL21    DEC    HL        ;Point to previous character
  10386.     LD    (DATPTR),HL    ;Save the new pointer
  10387. GOFIL24    LD    HL,(DATPTR)    ;Get the pointer
  10388.     LD    A,(HL)        ;Get the character
  10389.     IFALT    'B',GOFIL20    ;Jump if we can't change it
  10390.     DEC    (HL)        ;Change the file name
  10391.     LD    HL,FCB        ;Get the source address
  10392.     PUSH    HL        ;Save it for later
  10393.     LD    DE,TFILNAM    ;Get the destination
  10394.     LD    BC,32        ;Number to move
  10395.     LDIR            ;Move them
  10396.     POP    DE        ;Restore stack and get FCB address
  10397.     LD    HL,BUFF
  10398.     LD    B,0
  10399.     CALL    XOPEN        ;Is it there?
  10400.     JR    NZ,GOFIL27    ;Jump if not
  10401.     LD    DE,FCB        ;Close it up
  10402.     CALL    XCLOSE
  10403.     JR    GOFIL24        ;Try another name
  10404. ;
  10405. GOFIL27    LD    HL,(FCBPTR)    ;Get the end of the file name
  10406.     LD    (HL),EOS    ;Add the print terminator
  10407.     STROUT    FCB        ;Print the new name
  10408.     LD    (HL),3        ;Put the @OPEN terminator back
  10409. GOFIL30    LD    DE,FCB        ;Get the FCB
  10410.     LD    HL,BUFF        ;Get the buffer
  10411.     LD    B,0        ;LRL=256
  10412.     CALL    XINIT        ;Create it or zap old file
  10413.     JP    Z,RSKP        ;Return on success +4
  10414.     PUSH    AF        ;Save error code
  10415.     LD    DE,ERMS11    ;Print the error message
  10416.     CALL    ERROR3
  10417.     POP    AF        ;Get the error code back
  10418.     JP    ERRORD        ;Print a system error
  10419. ;
  10420. ;    Restart timer for receive packet timeout
  10421. ;
  10422. STARTTIMER    PUSH    HL    ;Save the clobbered regs
  10423.     PUSH    DE
  10424.     PUSH    BC
  10425.     LD    C,0        ;Get no timer flag for next test
  10426.     LD    HL,(SVTIMER)    ;Get the timer value
  10427.     LD    A,H        ;Check if not timeout wanted
  10428.     OR    L
  10429.     JR    Z,STARTT3    ;Don't start timer if none needed
  10430.     LD    (TIMER),HL    ;Set the real counter
  10431.     LD    C,8        ;Get the task slot number
  10432. STARTT1    CALL    XCKTSK        ;Check is slot in use
  10433.     JR    NZ,STARTT2
  10434.     LD    DE,RECTIME    ;Get the TCB
  10435.     PUSH    BC
  10436.     CALL    XADTSK        ;Try to add the task
  10437.     POP    BC        ;Restore the task slot
  10438.     JR    STARTT3        ;Go save slot used
  10439. STARTT2    INC    C        ;Get next possible slot
  10440.     IFANOT    11,STARTT1    ;Loop if not at max task slot
  10441.     STROUT    NOTIMER        ;Print error message
  10442.     LD    HL,1
  10443.     LD    (SVTIMER),HL    ;Zap timer
  10444.     LD    C,0        ;Make sure no timer flag is on
  10445. STARTT3    LD    A,C        ;Save task to stop
  10446.     LD    (TASKSLOT),A
  10447.     POP    BC        ;Restore registers
  10448.     POP    DE
  10449.     POP    HL
  10450.     RET
  10451. ;
  10452. ;    Stop the timeout task
  10453. ;
  10454. STOPTIMER    PUSH    HL    ;Save the registers
  10455.     PUSH    DE
  10456.     PUSH    BC
  10457.     LD    C,8        ;Get the task slot number
  10458. TASKSLOT    EQU    $-1
  10459.     CALL    XRMTSK
  10460.     LD    HL,0        ;Zero out the timer
  10461.     LD    (TIMER),HL
  10462.     POP    BC        ;Restore the registers
  10463.     POP    DE
  10464.     POP    HL
  10465.     RET
  10466. ;
  10467. ;    Check if character in A is alphabetic.  Z status means YES,
  10468. ;    NZ status means NO
  10469. ;
  10470. ISALPHA    CP    'A'        ;Check upper case
  10471.     RET    C        ;Return if less than
  10472.     CP    'Z'+1        ;If less than or equal to Z, then A-Z
  10473.     JR    C,ISAL_1    ;Jump to TRUE return
  10474.     CP    'a'        ;Check lower case
  10475.     RET    C        ;Return less than
  10476.     CP    'z'+1        ;Check for a-z
  10477.     RET    NC        ;NC means greater than 'z'
  10478. ISAL_1    CP    A        ;Set Z status
  10479.     RET            ;Return
  10480. ;
  10481. ;    Check if character in A is alphanumeric
  10482. ;
  10483. ISALNUM    CP    '0'        ;Check digits
  10484.     RET    C        ;Return too small
  10485.     CP    '9'+1        ;Check max+1
  10486.     JR    NC,ISALPHA    ;If too big, go try alphabetic
  10487.     CP    A        ;Set Z status
  10488.     RET            ;return it
  10489. ; end of file
  10490. <<< m4mit.doc >>>
  10491.  
  10492.  
  10493.  
  10494.  
  10495.  
  10496.  
  10497.                        _T_R_S_-_8_0 _M_o_d_e_l _4_(_p_) _K_E_R_M_I_T_:   _V_e_r_s_i_o_n _5_._2
  10498.  
  10499.                           _F_o_r _U_s_e _U_n_d_e_r _T_R_S_D_O_S _6_._1 _o_r _L_a_t_e_r
  10500.  
  10501.  
  10502.  
  10503.              _P_r_o_g_r_a_m _b_y:        Gregg Wonderly Oklahoma State University,
  10504.                                 (gregg@okstate) rewritten from the origi-
  10505.                                 nal Model-4 KERMIT which was derived from
  10506.                                 the TRS-80 KERMIT done by Stan Barber,
  10507.                                 Rice University who modified the CP/M-80
  10508.                                 version by Bill Catchings and others.
  10509.  
  10510.              _L_a_n_g_u_a_g_e:          Z80 Assembler, compatible with M80 and
  10511.                                 EDAS from Misosys
  10512.  
  10513.              _V_e_r_s_i_o_n:           5.2
  10514.  
  10515.              _D_a_t_e:              Wed Oct 22 10:17:07 CDT 1986
  10516.  
  10517.              _D_o_c_u_m_e_n_t_a_t_i_o_n _b_y:  Gregg Wonderly
  10518.  
  10519.  
  10520.  
  10521.              _1.  _S_u_m_m_a_r_y _o_f _T_R_S_D_O_S _6._1
  10522.  
  10523.  
  10524.                   _T_R_S_D_O_S (The Radio Shack Disk Operating System) has a
  10525.              large library of built in commands dealing with files,
  10526.              directory maintenance, device I/O, etc.  Programs are also
  10527.              used for some functions on some _T_R_S_D_O_S-based DOS's.  Model
  10528.              4(p) KERMIT gives you access to all of the library commands
  10529.              of _T_R_S_D_O_S versions 6.x via the LOCAL command.  Issue the
  10530.              _L_I_B_R_A_R_Y command at _T_R_S_D_O_S _R_e_a_d_y to obtain a list.
  10531.  
  10532.                   _T_R_S_D_O_S file specifications can be represented as a
  10533.              sequence of characters of the form
  10534.  
  10535.                   FILESPEC/EXT.PASSWORD:D
  10536.  
  10537.  
  10538.              _F_I_L_E_S_P_E_C   is the filename up to eight characters.
  10539.  
  10540.              _E_X_T        is the file type, up to three characters.
  10541.  
  10542.              _P_A_S_S_W_O_R_D   is the password for that file, up to eight char-
  10543.                         acters.
  10544.  
  10545.              _D          is a numerical drive specification (0-7).
  10546.  
  10547.                   File names, file types and passwords may contain
  10548.              letters and numbers, but the first character in each must be
  10549.              a letter.  No special characters or spaces are allowed.  All
  10550.              fields are optional except the filespec.  Any field added
  10551.  
  10552.  
  10553.  
  10554.  
  10555.  
  10556.  
  10557.  
  10558.  
  10559.  
  10560.                                         - 2 -
  10561.  
  10562.  
  10563.              must be preceded by its special delimiter '/' for file type,
  10564.              '.' for passwords and ':' for drive specifications.  Upper
  10565.              and lower case characters are equivalent.
  10566.  
  10567.              _2.  _T_R_S_D_O_S _C_o_m_m_a_n_d_s _o_f _I_n_t_e_r_e_s_t
  10568.  
  10569.  
  10570.              _2._1.  _C_A_T _P_A_R_T_S_P_E_C:_D (_O_T_H_E_R _O_P_T_I_O_N_S)
  10571.  
  10572.                   This command is specific to _T_R_S_D_O_S version 6.2 and
  10573.                   later.  It displays only the names of visible files on
  10574.                   the drive specified, or all drives if no _p_a_r_t_s_p_e_c is
  10575.                   given.  (_o_t_h_e_r _o_p_t_i_o_n_s) allows different formats and
  10576.                   invisible as well as system files to be selected.  See
  10577.                   the _T_R_S_D_O_S manual for specifics
  10578.  
  10579.              _2._2.  _D_I_R _P_A_R_T_S_P_E_C:_D (_O_T_H_E_R _O_P_T_I_O_N_S)
  10580.  
  10581.                   DIR is common to all version of TRSDOS.  Versions after
  10582.                   6.1 replaced the DIR command with CAT, and changed the
  10583.                   DIR command so that always produces a long listing.
  10584.  
  10585.              _2._3.  _F_R_E_E :_D
  10586.  
  10587.                   Gives statistics on disk usage.  If D is present, it
  10588.                   indicates a drive number, and only the statistics for
  10589.                   the specified disk will be shown.
  10590.  
  10591.              _2._4.  _R_E_M_O_V_E/_P_U_R_G_E _F_I_L_E_S_P_E_C (_P_A_R_A_M_E_T_E_R_S)
  10592.  
  10593.                   Remove the file(s) given by FILESPEC from the directory
  10594.                   and frees the space allocated to the file for reassign-
  10595.                   ment.  Purge allows PARTSPECs that specify groups of
  10596.                   files.  With no PARAMETERS, PURGE prompts before delet-
  10597.                   ing any file.  REMOVE requires a full filespec as the
  10598.                   name of the file to remove.  REMOVE allows more than
  10599.                   one filespec to be given on the command line.
  10600.  
  10601.              _2._5.  _L_I_S_T _F_I_L_E_S_P_E_C (_P_A_R_A_M_E_T_E_R_S)
  10602.  
  10603.                   Lists the file on the display.  Parameters are
  10604.                   described in the _T_R_S_D_O_S manual in detail.  (_H_E_X) is
  10605.                   sometimes useful to display the hexidecimal values of
  10606.                   the characters in a file.
  10607.  
  10608.              _2._6.  _R_E_N_A_M_E _o_l_d_f_i_l_e _n_e_w_f_i_l_e
  10609.  
  10610.                   Changes the name of oldfile to newfile, provided that
  10611.                   newfile is a unique file name on that disk.
  10612.  
  10613.              _3.  _C_o_p_y_i_n_g _D_i_s_k_s _a_n_d _F_i_l_e_s:
  10614.  
  10615.  
  10616.  
  10617.  
  10618.  
  10619.  
  10620.  
  10621.  
  10622.  
  10623.  
  10624.  
  10625.  
  10626.                                         - 3 -
  10627.  
  10628.  
  10629.                   _3._1.  _C_O_P_Y _f_i_l_e_1 _f_i_l_e_2
  10630.  
  10631.                        Copies file1 and name the copy file2. If file2
  10632.                        exists, it will be replaced.
  10633.  
  10634.                   _3._2.  _B_A_C_K_U_P :_D :_E
  10635.  
  10636.                        Makes a copy of the disk in drive D on the the
  10637.                        disk in drive E.
  10638.  
  10639.                   _3._3.  _F_O_R_M_A_T :_D
  10640.  
  10641.                        Formats the disk in drive D.  The disk will be
  10642.                        ready for any normal read or write operation fol-
  10643.                        lowing successful completion of this operation.
  10644.                        This operation must be performed before use of a
  10645.                        blank disk. Reformatting a previously formatted
  10646.                        disk will cause all previously stored information
  10647.                        to be lost.
  10648.  
  10649.              _4.  _T_r_a_n_s_f_e_r_s _w_i_t_h_o_u_t _t_h_e _K_E_R_M_I_T _P_r_o_t_o_c_o_l
  10650.  
  10651.                   Model 4(p) KERMIT adds 2 logical devices to the already
  10652.              resident devices.  These devices are used to access the com-
  10653.              munications port.  These devices, *FI (File Input) and *FO
  10654.              (File Output), can be used as the source, and destination of
  10655.              a copy command, respectively.  They make use of the status
  10656.              of the SET FLOW-CONTROL parameter, to send and receive data
  10657.              using the communications port.  For instance, say you are
  10658.              communicating with a computer that does not have KERMIT.
  10659.              Say you also wish to transfer a file to this computer to do
  10660.              some further processing.  The normal method involves start-
  10661.              ing a program on the remote computer to collect the data
  10662.              into a file on that system.  On a VAX/VMS system, you might
  10663.              use the CREATE command to capture the file.  The following
  10664.              _K_E_R_M_I_T commands will accomplish the transmition of a file in
  10665.              this case.
  10666.  
  10667.                   OUTPUT CREATE MYPROG.DAT<CR>
  10668.                   LOCAL COPY PROG/DAT *FO
  10669.  
  10670.              The KERMIT command, OUTPUT, will send the string "CREATE
  10671.              MYPROG.DAT<CR>" to the host.  Let's say for now that this is
  10672.              sufficient to cause all future characters sent to the host
  10673.              to be placed into the file MYPROG.DAT on that system.  The
  10674.              KERMIT command LOCAL is then used to invoke the _T_R_S_D_O_S
  10675.              library command COPY.  COPY will copy the contents of the
  10676.              file "PROG/DAT" to the *FO device.  The driver for this dev-
  10677.              ice is part of the KERMIT program, and will take care of
  10678.              transmitting the data out of the communications port to the
  10679.              HOST.  If the HOST sends XOFF because DATA is arriving TOO
  10680.              fast, then the XON/XOFF option to the _K_E_R_M_I_T command, SET
  10681.              FLOW-CONTROL, will allow the transfer to pause while the
  10682.              HOST catches up.  You may wish to collect the contents of a
  10683.  
  10684.  
  10685.  
  10686.  
  10687.  
  10688.  
  10689.  
  10690.  
  10691.  
  10692.                                         - 4 -
  10693.  
  10694.  
  10695.              file that is on another computer.  If particular computer
  10696.              does not have _K_E_R_M_I_T, you can use a series of commands simi-
  10697.              lar to those listed below to retrieve the file.  It should
  10698.              be noted that the _S_E_S_S_I_O_N-_L_O_G can also be used to trap the
  10699.              contents of a file.  For that very reason, this is only one
  10700.              of several possible ways to get a file from another computer
  10701.              that does not have _K_E_R_M_I_T.
  10702.  
  10703.                   OUTPUT TYPE MYPROG.DAT<CR>
  10704.                   INPUT TYPE MYPROG.DAT<CR><LF>
  10705.                   LOCAL COPY *FI MYPROG/DAT:1
  10706.  
  10707.                   It may help to clarify the use of the _O_U_T_P_U_T command,
  10708.              and the corresponding _I_N_P_U_T command.  If you use the _K_E_R_M_I_T
  10709.              command _C_O_N_N_E_C_T to enter terminal mode, and then proceed to
  10710.              tell the host to type out a file, it may start sending data
  10711.              before you can escape back, and type the _C_O_P_Y command.  This
  10712.              means that some of the data would be lost.  With _F_L_O_W-
  10713.              _C_O_N_T_R_O_L set to _X_O_N/_X_O_F_F, and the remote host recognizing
  10714.              this fact, the previous commands would not allow any data to
  10715.              be lost.  The use of _I_N_P_U_T is only to remove the characters
  10716.              ECHOed by the host from the input buffer (The TEXT of the
  10717.              command "TYPE MYPROG.DAT").  If you are communicating with a
  10718.              half-duplex system in which _M_o_d_e_l (_4)_p _K_E_R_M_I_T is echoing the
  10719.              characters typed on the keyboard, then the _I_N_P_U_T command
  10720.              need not be used.
  10721.  
  10722.  
  10723.  
  10724.  
  10725.              _5.  _C_o_n_t_r_o_l _o_f _F_i_l_e _T_r_a_n_s_f_e_r_s _U_s_i_n_g _t_h_e _K_E_R_M_I_T _P_r_o_t_o_c_o_l
  10726.  
  10727.  
  10728.                   During the transfer of a file using either _S_E_N_D, or _G_E_T
  10729.              and possibly during the use of the _R_E_M_O_T_E command, protocol
  10730.              operations may need to be aborted, or altered.  Several key
  10731.              strokes allow the user to control the protocol operations.
  10732.              These are listed below, and are listed on the screen after
  10733.              issuing either the _S_E_N_D or _G_E_T commands.  The operation of
  10734.              the _R_E_M_O_T_E command is purposefully silent.  The key strokes
  10735.              are available to the user during _R_E_M_O_T_E commands, for added
  10736.              flexibility.  This allows the user to cancel commands like
  10737.              _R_E_M_O_T_E _T_Y_P_E that may otherwise cause large amounts of data
  10738.              to be displayed for an extended amount of time.  The valid
  10739.              key strokes are:
  10740.  
  10741.  
  10742.              _C_o_n_t_r_o_l-_F      During data transfers using the _K_E_R_M_I_T proto-
  10743.                             col, _C_o_n_t_r_o_l-_F will terminate the current
  10744.                             transaction.  If there are more files to
  10745.                             transfer, the next transaction will be
  10746.                             started.  _M_o_d_e_l _4(_p) _K_E_R_M_I_T will send a sig-
  10747.                             nal to the remote _K_E_R_M_I_T telling it to stop
  10748.                             sending packets for the current transaction.
  10749.  
  10750.  
  10751.  
  10752.  
  10753.  
  10754.  
  10755.  
  10756.  
  10757.  
  10758.                                         - 5 -
  10759.  
  10760.  
  10761.                             If the remote _K_E_R_M_I_T understands this signal
  10762.                             (not all implementations of _K_E_R_M_I_T do), it
  10763.                             will comply, otherwise the transaction will
  10764.                             continue.
  10765.  
  10766.              _C_o_n_t_r_o_l-_B      Like  _C_o_n_t_r_o_l-_F, except that if a group of
  10767.                             files is being processed this will stop the
  10768.                             entire group.  If only a single file is being
  10769.                             _S_E_N_T or _R_E_C_E_I_V_E_D, _C_o_n_t_r_o_l-_B behaves exactly
  10770.                             like _C_o_n_t_r_o_l-_F.
  10771.  
  10772.              _C_o_n_t_r_o_l-_C      Aborts the protocol immediately.  This should
  10773.                             be a last resort to stopping a transmission
  10774.                             as it will leave the remote _K_E_R_M_I_T in an unk-
  10775.                             nown state.
  10776.  
  10777.              _C_o_n_t_r_o_l-_E      Aborts the protocol after sending an ERROR
  10778.                             packet to the remote _K_E_R_M_I_T.
  10779.  
  10780.              _C_o_n_t_r_o_l-_D      Toggles _D_E_B_U_G mode _O_N and _O_F_F.  This is help-
  10781.                             ful when trying to figure out why a particu-
  10782.                             lar host is unable to talk to _M_o_d_e_l _4(_p) _K_E_R_-
  10783.                             _M_I_T.
  10784.  
  10785.              <_E_N_T_E_R>        If you type <_E_N_T_E_R>, _M_o_d_e_l _4(_p) _K_E_R_M_I_T will
  10786.                             resend the current packet.
  10787.  
  10788.              _C_o_n_t_r_o_l-_H      Displays the list of _K_E_Y_S that you may press
  10789.                             during a transfer.  I.E.  the keys described
  10790.                             above.  This is the same message that is
  10791.                             printed when a SEND, GET, or RECEIVE command
  10792.                             is issued.
  10793.  
  10794.  
  10795.  
  10796.  
  10797.              _6.  _M_o_d_e_l _4(_p) _K_E_R_M_I_T _C_o_m_m_a_n_d_s
  10798.  
  10799.  
  10800.                   _M_o_d_e_l _4(_p) _K_E_R_M_I_T uses a subset of the the _D_E_C_S_Y_S_T_E_M-_2_0
  10801.              keyword style command language.  Each keyword may be abbre-
  10802.              viated to its minimum unique length.  "?" may be typed to
  10803.              request a list of the available options for the current
  10804.              field at any point in a command.  If insufficient characters
  10805.              have been typed to identify the current field uniquely,
  10806.              _M_o_d_e_l _4(_p) _K_E_R_M_I_T will display all available choices, and
  10807.              then reprompt to allow you to continue from that point.  If
  10808.              there are sufficient characters, then only a single choice
  10809.              will be displayed.  The following list of commands are
  10810.              available when using _M_o_d_e_l _4(_p) _K_E_R_M_I_T.
  10811.  
  10812.  
  10813.  
  10814.  
  10815.  
  10816.  
  10817.  
  10818.  
  10819.  
  10820.  
  10821.  
  10822.  
  10823.  
  10824.                                         - 6 -
  10825.  
  10826.  
  10827.              _6._1.  _B_Y_E
  10828.  
  10829.                   When talking to a remote _K_E_R_M_I_T Server, this command
  10830.                   should shut down a remote server and terminate the
  10831.                   login that you had there.  _M_o_d_e_l _4(_p) _K_E_R_M_I_T will then
  10832.                   exit to _T_R_S_D_O_S _R_e_a_d_y.
  10833.  
  10834.                        NOTE: Due to some deviations from the specifica-
  10835.                        tion, some systems do not perform exactly in this
  10836.                        manner.  You should check the documentation of the
  10837.                        _K_E_R_M_I_T on the remote system in order to obtain the
  10838.                        operation performed by this command.
  10839.  
  10840.              _6._2.  _C_L_E_A_R
  10841.  
  10842.  
  10843.                   _6._2._1.  _I_N_P_U_T-_P_O_R_T
  10844.  
  10845.                        _M_o_d_e_l _4(_p) _K_E_R_M_I_T uses the "Interrupt on received
  10846.                        character available" feature of the COM/DVR com-
  10847.                        munications line driver.  This driver is part of
  10848.                        the standard software on your system diskette.
  10849.                        All characters received via the interrupt vector,
  10850.                        are placed in a 256 byte circular buffer.  This
  10851.                        command clears all characters currently buffered.
  10852.                        This is used most commonly with the INPUT, OUTPUT,
  10853.                        PULSE, and PAUSE commands, none of which expli-
  10854.                        citly clear the input buffer.  YOU MUST DO THIS
  10855.                        YOURSELF.  The execution of this command will _n_o_t
  10856.                        send an _X_O_N character to the communications port.
  10857.                        This is also left up to you to do.
  10858.  
  10859.                   _6._2._2.  _S_C_R_E_E_N
  10860.  
  10861.                        As you would expect, this command clears the
  10862.                        screen.
  10863.  
  10864.              _6._3.  _C_L_O_S_E
  10865.  
  10866.  
  10867.                   _6._3._1.  _D_E_B_U_G-_L_O_G
  10868.  
  10869.                        Closes the file previously opened with the LOG
  10870.                        DEBUG-LOG command.  If there is not a debug log-
  10871.                        file active, then a message is printed telling you
  10872.                        so.
  10873.  
  10874.                   _6._3._2.  _S_E_S_S_I_O_N-_L_O_G
  10875.  
  10876.                        Closes the file previously opened with the LOG
  10877.                        SESSION-LOG command.  If no file is open, you will
  10878.                        be advised so.
  10879.  
  10880.  
  10881.  
  10882.  
  10883.  
  10884.  
  10885.  
  10886.  
  10887.  
  10888.  
  10889.  
  10890.                                         - 7 -
  10891.  
  10892.  
  10893.                   _6._3._3.  _T_R_A_N_S_A_C_T_I_O_N-_L_O_G
  10894.  
  10895.                        Closes the file previously opened with the LOG
  10896.                        TRANSACTION-LOG command.  As with the other log-
  10897.                        files, if a file is not currently open, then a
  10898.                        message to that affect is printed.
  10899.  
  10900.                   _6._4.  _C_O_N_N_E_C_T (_c_a_n _b_e _a_b_b_r_e_v_i_a_t_e_d _t_o '_C')
  10901.  
  10902.                        Establish a "virtual terminal" connection to any
  10903.                        host that may be connected to the serial port,
  10904.                        i.e. pass all typed characters to the serial port
  10905.                        and display all input from the serial port on the
  10906.                        screen.  A two character sequence of characters is
  10907.                        required to return the user to the _K_E_R_M_I_T program.
  10908.                        An escape character must be typed followed by a
  10909.                        'c' (Case is _n_o_t significant).  The default
  10910.                        <ESCAPE> character is entered by pressing the
  10911.                        <SHIFT> key, and then and <CLEAR> key, while hold-
  10912.                        ing the <SHIFT> key down.  Pressing '?' after the
  10913.                        <ESCAPE> character will display a list of valid
  10914.                        keystrokes that do helpful things during connect
  10915.                        mode.  The first time that you issue the _C_O_N_N_E_C_T
  10916.                        command, a message will be displayed telling you
  10917.                        what the <ESCAPE> character is.  The <ESCAPE>
  10918.                        character should generally be an uncommonly-used
  10919.                        control character.  The following characters are
  10920.                        valid following the <_E_S_C_A_P_E> character, and gen-
  10921.                        erate specific actions.  The actions are described
  10922.                        beside the character.
  10923.  
  10924.                             _C    Return to _M_o_d_e_l _4(_p) _K_E_R_M_I_T command
  10925.                                  level.  The contents of the screen and
  10926.                                  the cursor location will be saved prior
  10927.                                  to displaying the _K_E_R_M_I_T screen.  When
  10928.                                  you reconnect to the _H_O_S_T using the _K_E_R_-
  10929.                                  _M_I_T command, _C_O_N_N_E_C_T, the old screen
  10930.                                  will be restored.
  10931.  
  10932.                             _?    List available single-character com-
  10933.                                  mands, I.E. These commands.
  10934.  
  10935.                             _B    Send a TRUE modem break.
  10936.  
  10937.                             _R    Resume logging if file open, and
  10938.                                  <ESCAPE>Q was used previously to turn
  10939.                                  logging off.  See the _L_O_G command for
  10940.                                  more information.
  10941.  
  10942.                             _Q    Quit logging to file but leave it open.
  10943.  
  10944.                             _0 (_z_e_r_o)Send a null (0) character out the
  10945.                                  communications port.
  10946.  
  10947.  
  10948.  
  10949.  
  10950.  
  10951.  
  10952.  
  10953.  
  10954.  
  10955.  
  10956.                                         - 8 -
  10957.  
  10958.  
  10959.                             <_E_S_C_A_P_E>Send the <_E_S_C_A_P_E> character itself to
  10960.                                  the remote host.
  10961.  
  10962.                   _6._5.  _D_I_R _p_a_r_t_s_p_e_c
  10963.  
  10964.                        Produces a listing of the directory for
  10965.                        "partspec".  If partspec is not given, than the
  10966.                        directory will be displayed for the _D_E_F_A_U_L_T-_D_I_S_K
  10967.                        drive as established by _S_E_T _D_E_F_A_U_L_T-_D_I_S_K.
  10968.  
  10969.                   _6._6.  _E_X_I_T
  10970.  
  10971.                        Exit _M_o_d_e_l _4(_p) _K_E_R_M_I_T, and return to _T_R_S_D_O_S.
  10972.                        Before the _K_E_R_M_I_T program is terminated, all open
  10973.                        files will be closed.  This includes the LOGFILES
  10974.                        used for SESSION, TRANSACTION, and DEBUG logging.
  10975.                        The *FO, and *FI devices will also be removed.
  10976.  
  10977.                   _6._7.  _E_C_H_O
  10978.  
  10979.                        This command echoes text given as an argument to
  10980.                        the screen.  It can used in take files to put mes-
  10981.                        sages on the screen when TAKE-DISPLAY is OFF,
  10982.                        although other uses are possible.
  10983.  
  10984.                   _6._8.  _F_I_N_I_S_H
  10985.  
  10986.                        Shuts down a remote server without logging it out.
  10987.                        Leaves you at _M_o_d_e_l _4(_p) _K_E_R_M_I_T command level.  A
  10988.                        subsequent _C_O_N_N_E_C_T command will reconnect you to
  10989.                        the remote host.  The _r_e_m_o_t_e _K_E_R_M_I_T should return
  10990.                        to the mode it was in prior to entering _S_E_R_V_E_R
  10991.                        mode.
  10992.  
  10993.                   _6._9.  _G_E_T _f_i_l_e_s_p_e_c
  10994.  
  10995.                        Get allows you to retrieve files from a remote
  10996.                        host.  Get works with either a _S_E_R_V_E_R or a _K_E_R_M_I_T
  10997.                        that has initiated a _S_E_N_D command.  Filespec is a
  10998.                        filename compatible with _t_h_a_t system.  When _M_o_d_e_l
  10999.                        _4(_p) _K_E_R_M_I_T is talking to a _K_E_R_M_I_T Server, you may
  11000.                        include a filespec in a form legal to the _H_O_S_T
  11001.                        _K_E_R_M_I_T.
  11002.  
  11003.                   _6._1_0.  _I_N_P_U_T <_c_o_n_t_r_o_l _s_t_r_i_n_g>
  11004.  
  11005.                        INPUT provides one of 4 commands that provide an
  11006.                        automatic logon facility.  INPUT allows you to
  11007.                        watch for the occurrence of certain text strings
  11008.                        that are made up characters arriving in the com-
  11009.                        munications port.  This is useful in _T_A_K_E files
  11010.                        that can automatically log you onto a certain sys-
  11011.                        tem.
  11012.  
  11013.  
  11014.  
  11015.  
  11016.  
  11017.  
  11018.  
  11019.  
  11020.  
  11021.  
  11022.                                         - 9 -
  11023.  
  11024.  
  11025.                             When _I_N_P_U_T in initiated, it begins matching
  11026.                        characters in the input to those given in the con-
  11027.                        trol string.  When an exact match is found as
  11028.                        established by the _S_E_T _I_N_P_U_T options then _I_N_P_U_T
  11029.                        will return to the _K_E_R_M_I_T command level.  If _T_A_K_E
  11030.                        is active than the next line of the _T_A_K_E file will
  11031.                        be read.  The Control string may be comprised of
  11032.                        any printable _A_S_C_I_I characters.  _S_P_A_C_E must not
  11033.                        occur as either the beginning or end of the
  11034.                        string.
  11035.  
  11036.                             _A_S_C_I_I character codes 0-32 are denoted as
  11037.                        <_N_U_L> - <_S_P_A>, and <_D_E_L> represents character 127.
  11038.                        The string <_D_L_Y*> signifies an immediate delay.
  11039.                        The * should be replaced by a character.  The sig-
  11040.                        nificance of the character is this.  Decimal 48 is
  11041.                        subtracted from the _A_S_C_I_I value of the character
  11042.                        to obtain the number of seconds to delay.  Thus,
  11043.                        you can obtain delays 1-9 seconds, with no trick-
  11044.                        ery.  Delays longer than that will have to be cal-
  11045.                        culated since the formula (ASCII code - 48
  11046.                        decimal) is used to calculate the binary value to
  11047.                        use as a counter.  The "*" should be replaced with
  11048.                        the single proper ASCII character.
  11049.  
  11050.                             If you use <_D_L_Y*> in a _P_U_L_S_E command, it
  11051.                        should be noted that it will only be done once.
  11052.                        An alternative format for control characters is to
  11053.                        explicitly type a carat ("^") preceding a charac-
  11054.                        ter.  The result of subtracting 64 from the _A_S_C_I_I
  11055.                        code for the character following will then be
  11056.                        used.  Since <, >, and ^ now have special mean-
  11057.                        ings, you will need some way to specify them
  11058.                        explicitly.  To do this you should precede them
  11059.                        with a backslash, "\", character.  In this case,
  11060.                        backslash itself now must be represented as "\\".
  11061.                        Finally, any and all characters can be represented
  11062.                        using a string of the form \nnn where nnn is 1 or
  11063.                        more octal digits.  nnn is evaluated, and the
  11064.                        resulting value will be the ASCII value of the
  11065.                        character.  Some examples might be:
  11066.  
  11067.                             INPUT login:<SPA>
  11068.  
  11069.                                  Find the string "login:" followed by a
  11070.                                  space.
  11071.  
  11072.                             INPUT <SPA>^M^Jenter \\userid\\:<CR><LF>
  11073.  
  11074.                                  Find the string with a space followed by
  11075.                                  a carriage return followed by a line
  11076.                                  feed followed by the text "enter
  11077.                                  \userid\:" followed by carriage return
  11078.                                  and another linefeed.
  11079.  
  11080.  
  11081.  
  11082.  
  11083.  
  11084.  
  11085.  
  11086.  
  11087.  
  11088.                                         - 10 -
  11089.  
  11090.  
  11091.                             INPUT USERNAME\77\40
  11092.  
  11093.                                  Find the string "USERNAME? ".  Note that
  11094.                                  \77 is the _O_N_L_Y way that a question mark
  11095.                                  can be specified since a question mark
  11096.                                  is recognized by the command stream as a
  11097.                                  request for help.
  11098.  
  11099.                        While input is waiting for a match, you may type
  11100.                        characters on the keyboard to be transmitted.
  11101.                        _B_R_E_A_K will abort the _I_N_P_U_T command and if _T_A_K_E is
  11102.                        active, close the take file.  _E_S_C_A_P_E will abort
  11103.                        the INPUT command, but will just skip to the next
  11104.                        line in a _T_A_K_E file, if _T_A_K_E is active.  These
  11105.                        same 2 actions apply to the _P_U_L_S_E command while no
  11106.                        input has been received.
  11107.  
  11108.                   _6._1_1.  _K_I_L_L _w_i_l_d_s_p_e_c
  11109.  
  11110.                        This command performs the task of deleting one or
  11111.                        more files from disk.  _W_i_l_d_s_p_e_c is a wild card
  11112.                        filespec that will be evaluated.  All files that
  11113.                        match the wildspec will be removed.  A _w_i_l_d_s_p_e_c
  11114.                        may contain any characters valid is a TRSDOS
  11115.                        filespec, plus zero or more occurances of the
  11116.                        characters '*', and '$'.  These two characters
  11117.                        have special meanings.
  11118.  
  11119.                             When comparing the _w_i_l_d_s_p_e_c with the name of
  11120.                        a file, a '*' matches zero or more of the charac-
  11121.                        ters in the filename.  E.g.  If a file FOO/ASM is
  11122.                        compared with '*/ASM', then it would match,
  11123.                        because '*' can be thought of as 'FOO', and then
  11124.                        '/ASM' is matched literally.  M4*/ASM matches
  11125.                        M4MIT/ASM, M4XFER/ASM, M4SEND/ASM, and any other
  11126.                        filename that begins with M4, and ends with /ASM.
  11127.                        The '$' character matches any single character.
  11128.                        This means that FILE$/DOC matches the filename
  11129.                        FILE1/DOC, but not FILE1A/DOC.
  11130.  
  11131.                             A drivespec may be appended to the _w_i_l_d_s_p_e_c
  11132.                        to force the search for matches to be restricted
  11133.                        to a single drive.  An example might be M4*/ASM:1,
  11134.                        which limits the matches to those file on drive 1.
  11135.  
  11136.                             Normally, only visible, nonsystem files are
  11137.                        considered in the search.  However, the inclusion
  11138.                        of a parameter list containing either, or both of
  11139.                        the keywords, INVIS or SYSTEM, will include
  11140.                        invisible and/or system files.  An example would
  11141.                        be:
  11142.                             KILL (I,S) config/sys (I) backup/cmd
  11143.                        This example would cause _M_o_d_e_l _4(_p) _K_E_R_M_I_T to
  11144.                        attempt to remove the two files listed.  Note that
  11145.  
  11146.  
  11147.  
  11148.  
  11149.  
  11150.  
  11151.  
  11152.  
  11153.  
  11154.                                         - 11 -
  11155.  
  11156.  
  11157.                        as this example shows, you must specify the param-
  11158.                        eters with each _w_i_l_d_s_p_e_c that you wish to apply
  11159.                        them to, as they are nullified each time that a
  11160.                        new _w_i_l_d_s_p_e_c is evaluated.  Other examples are
  11161.                        given in the description of the _S_E_N_D command.
  11162.  
  11163.                   _6._1_2.  _L_O_C_A_L <_T_R_S_D_O_S _l_i_b_r_a_r_y _c_o_m_m_a_n_d>  (_C_a_n _b_e
  11164.                   _a_b_b_r_e_i_v_i_a_t_e_d _t_o _L)
  11165.  
  11166.                        This command allows you to issue commands from
  11167.                        within _M_o_d_e_l _4(_p) _K_E_R_M_I_T.  You must remember where
  11168.                        Model 4(p) KERMIT resides in memory, to assure
  11169.                        that you do not overwrite it.  KERMIT loads at
  11170.                        6000H, and continues up through LOW$.  From within
  11171.                        KERMIT, you can issue the command:
  11172.  
  11173.                             LOCAL MEMORY
  11174.  
  11175.                        to see where KERMIT ends.  The value of LOW$ tells
  11176.                        you this information.  KERMIT was placed at 6000H
  11177.                        to allow most of the TRSDOS library programs and
  11178.                        commands to work in conjunction with KERMIT.  Some
  11179.                        commands extend above 3000H, and must have memory
  11180.                        available up to approximately 5300H.  The COPY
  11181.                        command creates a problem because it apparently
  11182.                        tries to examine HIGH$ to see if there is space to
  11183.                        load a large portion of the source file into
  11184.                        memory before writing it to the destination.  This
  11185.                        creates problems because KERMIT moves LOW$ up so
  11186.                        that HIGH$ has a value that will allow additional
  11187.                        high memory module to be loaded.  It is suggested
  11188.                        that you not use COPY while KERMIT is running, as
  11189.                        the machine may crash when COPY completes.  This
  11190.                        is because it will have copied data into the KER-
  11191.                        MIT memory space.
  11192.  
  11193.                   _6._1_3.  _L_O_G
  11194.  
  11195.                        _6._1_3._1.  _D_E_B_U_G-_L_O_G
  11196.  
  11197.                             The debug log can be used to debug transfer
  11198.                             problems that sometimes arrise when talking
  11199.                             to a newly written KERMIT.  The information
  11200.                             written to the DEBUG-LOG is nearly identical
  11201.                             to that which is displayed on the screen when
  11202.                             the command, SET DEBUG ON, is issued, or the
  11203.                             CTRL-D key is pressed during a transfer.
  11204.                             This file can be closed explicitly with the
  11205.                             _C_L_O_S_E _D_E_B_U_G-_L_O_G command.  The EXIT command
  11206.                             also causes an implicit closing of this file.
  11207.  
  11208.  
  11209.  
  11210.  
  11211.  
  11212.  
  11213.  
  11214.  
  11215.  
  11216.  
  11217.  
  11218.  
  11219.  
  11220.                                         - 12 -
  11221.  
  11222.  
  11223.                        _6._1_3._2.  _S_E_S_S_I_O_N-_L_O_G
  11224.  
  11225.                             When CONNECTed to a foreign host as a termi-
  11226.                             nal, this command establishes a log of the
  11227.                             terminal session in the file specified.  This
  11228.                             function depends, to some extent, on the
  11229.                             remote host's ability to do _X_O_N/_X_O_F_F flow
  11230.                             control.  Without _F_L_O_W-_C_O_N_T_R_O_L, data may be
  11231.                             lost when _K_E_R_M_I_T writes to the file.  The log
  11232.                             file is closed by explicitly typing the _K_E_R_-
  11233.                             _M_I_T command _C_L_O_S_E _S_E_S_S_I_O_N-_L_O_G or implicitly
  11234.                             when _K_E_R_M_I_T is exited via the _E_X_I_T command.
  11235.                             It will also be closed if an I/O error occurs
  11236.                             in file processing for the file involved.
  11237.                             _L_O_G_G_I_N_G may be toggled on and off during _C_O_N_-
  11238.                             _N_E_C_T using the sequence of keys described in
  11239.                             the _C_O_N_N_E_C_T description.
  11240.  
  11241.                        _6._1_3._3.  _T_R_A_N_S_A_C_T_I_O_N-_L_O_G
  11242.  
  11243.                             The transaction log is used to keep a record
  11244.                             of the files transfered during a KERMIT ses-
  11245.                             sion.  The information includes whether or
  11246.                             not the transaction was SENDING, or RECEIV-
  11247.                             ING, the name of the file transfered, and the
  11248.                             number of bytes involved in the transfer.
  11249.  
  11250.                   _6._1_4.  _L_O_G_O_U_T
  11251.  
  11252.                        Logout tells a _r_e_m_o_t_e _k_e_r_m_i_t _s_e_r_v_e_r to terminate
  11253.                        itself, as well as your login session.  When this
  11254.                        is completed, you are left at _M_o_d_e_l _4(_p) _K_E_R_M_I_T
  11255.                        command level.
  11256.  
  11257.                   _6._1_5.  _O_U_T_P_U_T <_c_o_n_t_r_o_l _s_t_r_i_n_g>
  11258.  
  11259.                        This is the other side of the _I_N_P_U_T command.  Con-
  11260.                        trol string follows the same conventions as in
  11261.                        _I_N_P_U_T, and the resulting character(s) will be out-
  11262.                        put to the communications port immediately.  It
  11263.                        should be noted that _N_O characters other than what
  11264.                        you specify are transmitted.  In other words if
  11265.                        you want to simulate typing some string, followed
  11266.                        by pressing <_E_N_T_E_R>, then you will have to use a
  11267.                        command similar to:
  11268.  
  11269.                             OUTPUT mypassword<CR>
  11270.  
  11271.  
  11272.                        The <_C_R> will explicitly send the _A_S_C_I_I character
  11273.                        13 to the communications port.
  11274.  
  11275.  
  11276.  
  11277.  
  11278.  
  11279.  
  11280.  
  11281.  
  11282.  
  11283.  
  11284.  
  11285.  
  11286.                                         - 13 -
  11287.  
  11288.  
  11289.                   _6._1_6.  _P_A_U_S_E <_n_u_m_b_e_r _o_f _s_e_c_o_n_d_s>
  11290.  
  11291.                        This command is usually used in conjunction with
  11292.                        _I_N_P_U_T, _O_U_T_P_U_T, and _P_U_L_S_E as a means of syncroniz-
  11293.                        ing _M_o_d_e_l _4(_p) _K_E_R_M_I_T to a remote host.  A delay
  11294.                        of the specified number of seconds will be gen-
  11295.                        erated based on the accuracy of the 60HZ inter-
  11296.                        rupt.  No means has been made for aborting the
  11297.                        delay.  The maximum delay is 65536 seconds by
  11298.                        specifying 0 as the number.
  11299.  
  11300.                   _6._1_7.  _P_U_L_S_E <_c_o_n_t_r_o_l _s_t_r_i_n_g>
  11301.  
  11302.                        This command is an extension/combination of _I_N_P_U_T
  11303.                        and _O_U_T_P_U_T.  It allows you to transmit one or more
  11304.                        characters repeatedly until a character appears in
  11305.                        the input port.  The use of this command is valu-
  11306.                        able when logging onto systems that don't always
  11307.                        respond immediately after the reception of some
  11308.                        control character(s).  For instance, you might
  11309.                        (Now that all of the functions of this nature have
  11310.                        been described) use the following commands as part
  11311.                        of a logon sequence to log onto a computer system.
  11312.  
  11313.                             SET INPUT CASE-IGNORE ON
  11314.                             SET INPUT DISPLAY ON
  11315.                             SET OUTPUT HOST-ECHO ON
  11316.                             SET OUTPUT DISPLAY ON
  11317.                             CLEAR INPUT-PORT
  11318.                             PULSE ^T<CR>
  11319.                             INPUT <CR><LF>XYZ:
  11320.                             PAUSE 2
  11321.                             CLEAR INPUT-PORT
  11322.                             PULSE <CR>
  11323.                             INPUT Username:<SPA>
  11324.                             OUTPUT joeblow<CR>
  11325.                             INPUT <CR><LF>Terminal type:
  11326.                             OUTPUT h19<CR>
  11327.                             SET KEY 8 <DEL>
  11328.                             SET KEY 128 <ETX>
  11329.  
  11330.                        After you study this awhile, it should make sense.
  11331.                        If these commands are placed into a _T_A_K_E file,
  11332.                        then you could use a _C_O_N_N_E_C_T command after the
  11333.                        last command, to connect immediately to the host.
  11334.                        If this is done, then _o_n_l_y after you escape back
  11335.                        to _M_o_d_e_l _4(_p) _K_E_R_M_I_T, will the _T_A_K_E file finally
  11336.                        be closed.
  11337.  
  11338.                   _6._1_8.  _R_E_C_E_I_V_E <_f_i_l_e_s_p_e_c>
  11339.                        This command is synonomous with the GET command.
  11340.                        It may be abbreviated to the single character 'R',
  11341.                        as in:
  11342.  
  11343.  
  11344.  
  11345.  
  11346.  
  11347.  
  11348.  
  11349.  
  11350.  
  11351.  
  11352.                                         - 14 -
  11353.  
  11354.  
  11355.                             R *.asm
  11356.  
  11357.  
  11358.                   _6._1_9.  _R_E_M_O_T_E <_c_o_m_m_a_n_d>
  11359.  
  11360.                        _R_e_m_o_t_e commands are not supported in totality by
  11361.                        all _s_e_r_v_e_r_s.  If a _s_e_r_v_e_r supports remote com-
  11362.                        mands, then _r_e_m_o_t_e _h_e_l_p should display all of the
  11363.                        commands available to the _r_e_m_o_t_e user of the
  11364.                        server.  Below are descriptions of the _r_e_m_o_t_e com-
  11365.                        mands that _M_o_d_e_l _4(_p) _K_E_R_M_I_T knows how to send to
  11366.                        a _r_e_m_o_t_e _s_e_r_v_e_r.  The arguments to most commands
  11367.                        are dependent on the _r_e_m_o_t_e system.  You should be
  11368.                        familiar with any system before using the _r_e_m_o_t_e
  11369.                        _s_e_r_v_e_r commands available from that server.  Usu-
  11370.                        ally only a small number of these commands are
  11371.                        supported since some require abilities that some
  11372.                        operating systems just don't have.
  11373.  
  11374.  
  11375.                        _6._1_9._1.  _C_L_O_S_E-_L_O_G
  11376.  
  11377.                             Close a remote _L_O_G previously opened via the
  11378.                             command _R_E_M_O_T_E _S_T_A_R_T-_L_O_G.
  11379.  
  11380.                        _6._1_9._2.  _C_O_P_Y
  11381.  
  11382.                             Copy one file to another.
  11383.  
  11384.                        _6._1_9._3.  _C_W_D <_d_i_r_e_c_t_o_r_y _p_a_t_h>
  11385.  
  11386.                             If a particular server's operating system
  11387.                             supports the concept of separate directories,
  11388.                             then this command will allow you to change to
  11389.                             a different directory.
  11390.  
  11391.                        _6._1_9._4.  _D_E_L_E_T_E
  11392.  
  11393.                             Deletes file(s) from the _r_e_m_o_t_e system.  Any
  11394.                             arguments will probably be file names in the
  11395.                             format of the _r_e_m_o_t_e system.
  11396.  
  11397.                        _6._1_9._5.  _D_I_R
  11398.  
  11399.                             Display a list of files on the _r_e_m_o_t_e system.
  11400.  
  11401.                        _6._1_9._6.  _D_I_S_K
  11402.  
  11403.                             Display information about disk utilization on
  11404.                             the _r_e_m_o_t_e system.
  11405.  
  11406.  
  11407.  
  11408.  
  11409.  
  11410.  
  11411.  
  11412.  
  11413.  
  11414.  
  11415.  
  11416.  
  11417.  
  11418.                                         - 15 -
  11419.  
  11420.  
  11421.                        _6._1_9._7.  _H_E_L_P
  11422.  
  11423.                             Get information about _r_e_m_o_t_e capabilities on
  11424.                             the _r_e_m_o_t_e system.
  11425.  
  11426.                        _6._1_9._8.  _H_O_S_T
  11427.  
  11428.                             Execute a command on the _r_e_m_o_t_e system.
  11429.  
  11430.                        _6._1_9._9.  _K_E_R_M_I_T
  11431.  
  11432.                             Execute a _K_E_R_M_I_T command on the _r_e_m_o_t_e sys-
  11433.                             tem.  This command should accept a normal
  11434.                             _K_E_R_M_I_T command as an argument.  The command,
  11435.                             if valid, will then be executed by the remote
  11436.                             _K_E_R_M_I_T server.
  11437.  
  11438.                        _6._1_9._1_0.  _L_O_G_I_N
  11439.  
  11440.                             Create a login entity on the _r_e_m_o_t_e system.
  11441.                             This may be incorporated into a dedicated
  11442.                             server.
  11443.  
  11444.                        _6._1_9._1_1.  _M_E_S_S_A_G_E
  11445.  
  11446.                             Send a message to a user on the _r_e_m_o_t_e sys-
  11447.                             tem.
  11448.  
  11449.                        _6._1_9._1_2.  _P_R_O_G_R_A_M
  11450.  
  11451.                             Feed command input to a command executing on
  11452.                             the remote system, or control the execution
  11453.                             of a program.
  11454.  
  11455.                        _6._1_9._1_3.  _Q_U_E_R_Y-_V_A_R_I_A_B_L_E
  11456.  
  11457.                             Get the value of a variable maintained on the
  11458.                             _r_e_m_o_t_e system.
  11459.  
  11460.                        _6._1_9._1_4.  _R_E_N_A_M_E
  11461.  
  11462.                             Change the name of a file on the _r_e_m_o_t_e sys-
  11463.                             tem.
  11464.  
  11465.                        _6._1_9._1_5.  _S_E_N_D-_L_O_G
  11466.  
  11467.                             Tells the server to close any open log, and
  11468.                             then transfer it to the user.
  11469.  
  11470.                        _6._1_9._1_6.  _S_E_R_V_E_R-_S_T_A_T_U_S
  11471.  
  11472.                             Retrieve certain information about the status
  11473.                             of a REMOTE server.  The information returned
  11474.                             is dependent on the REMOTE system.
  11475.  
  11476.  
  11477.  
  11478.  
  11479.  
  11480.  
  11481.  
  11482.  
  11483.  
  11484.                                         - 16 -
  11485.  
  11486.  
  11487.                        _6._1_9._1_7.  _S_E_T-_V_A_R_I_A_B_L_E
  11488.  
  11489.                             Set the value of a variable on the _r_e_m_o_t_e
  11490.                             system.
  11491.  
  11492.                        _6._1_9._1_8.  _S_T_A_R_T-_L_O_G
  11493.  
  11494.                             Start a transaction log on the _r_e_m_o_t_e system.
  11495.  
  11496.                        _6._1_9._1_9.  _S_T_O_P-_L_O_G
  11497.  
  11498.                             Stops logging to the log file started by the
  11499.                             _R_E_M_O_T_E _S_T_A_R_T-_L_O_G command.  The file is not
  11500.                             closed.  Logging may be started again by
  11501.                             using the the command, _R_E_M_O_T_E _S_T_A_R_T-_L_O_G.
  11502.  
  11503.                        _6._1_9._2_0.  _T_Y_P_E
  11504.  
  11505.                             Display the contents of the file/files given
  11506.                             as arguments.  The _r_e_m_o_t_e server should use
  11507.                             the _K_E_R_M_I_T protocol to send the contents of
  11508.                             the specified file/files to _M_o_d_e_l _4(_p) _K_E_R_-
  11509.                             _M_I_T.  The file contents will be displayed on
  11510.                             the screen using the *SO device.
  11511.  
  11512.                        _6._1_9._2_1.  _W_H_O
  11513.  
  11514.                             Display a list of users on the _r_e_m_o_t_e system.
  11515.  
  11516.                   _6._2_0.  _S_E_N_D <_w_i_l_d_s_p_e_c>        (_M_a_y _b_e _a_b_b_r_e_v_i_a_t_e_d _t_o
  11517.                   '_S');
  11518.  
  11519.                        File specifications may contain wild card charac-
  11520.                        ters.  The recognized wild card characters are '*'
  11521.                        and '$'.  '*' means zero or more of any character.
  11522.                        '$' means exactly one of any character.  There are
  11523.                        a lot of specifics associated with wild carding,
  11524.                        and search order through the drives.
  11525.  
  11526.                             When files by the same name exist on dif-
  11527.                        ferent drives, a wild card match of one will also
  11528.                        match all other occurances.  e.g. if drive 0 con-
  11529.                        tains the file report/dat, and report.dat also
  11530.                        exist on drive 1, then the command other varia-
  11531.                        tions can be used to send only one of the 2 files.
  11532.                        'SEND */dat:1' will only match files on drive 1.
  11533.                        Another alternative would be
  11534.  
  11535.                             Case is NOT significant, so both REPORT/DAT
  11536.                        and report/dat are identical.  so "*/*" is the
  11537.                        same as "*" for all file names with an extension.
  11538.                        "*/*", however, does not match names of the form
  11539.                        "data", "fred", "file", "temp", or others without
  11540.                        extensions.  Other examples are given in the
  11541.  
  11542.  
  11543.  
  11544.  
  11545.  
  11546.  
  11547.  
  11548.  
  11549.  
  11550.                                         - 17 -
  11551.  
  11552.  
  11553.                        description of the _K_I_L_L command.
  11554.  
  11555.                   _6._2_1.  _S_E_T <_p_a_r_a_m_e_t_e_r [_v_a_l_u_e(_s)...]>
  11556.  
  11557.                        Set the specified parameter to the specified
  11558.                        value.  Possible settings:
  11559.  
  11560.  
  11561.                        _6._2_1._1.  _B_E_L_L _O_N (_o_r _O_F_F)
  11562.  
  11563.                             When _D_U_M_B terminal emulation is in effect, a
  11564.                             simple noise generator is used to produce a
  11565.                             tone like a bell each time the _B_E_L_L character
  11566.                             is received.  If you don't like it, than use
  11567.                             _S_E_T _B_E_L_L _O_F_F to disable it.
  11568.  
  11569.                        _6._2_1._2.  _B_L_O_C_K-_C_H_E_C_K-_T_Y_P_E
  11570.  
  11571.                             The options are:
  11572.  
  11573.                             _6._2_1._2._1.  _1 (_c_h_a_r_a_c_t_e_r _c_h_e_c_k_s_u_m)
  11574.  
  11575.                                  Normal, default, standard 6-bit check-
  11576.                                  sum.
  11577.  
  11578.                             _6._2_1._2._2.  _2 (_c_h_a_r_a_c_t_e_r _c_h_e_c_k_s_u_m)
  11579.  
  11580.                                  A 12-bit checksum encoded as two charac-
  11581.                                  ters.
  11582.  
  11583.                             _6._2_1._2._3.  _3 (_c_h_a_r_a_c_t_e_r _c_r_c-_c_c_i_t_t)
  11584.  
  11585.                                  A 16-bit CCITT-format Cyclic Redundancy
  11586.                                  Check,  encoded as 3 characters.
  11587.  
  11588.                             The 2 and 3 character options should only be
  11589.                             used under conditions of extreme line noise.
  11590.                             Many implementations of _K_E_R_M_I_T only support
  11591.                             the single character checksum.
  11592.  
  11593.                        _6._2_1._3.  _D_E_B_U_G_G_I_N_G _O_F_F (_o_r _O_N)
  11594.  
  11595.                             When transmitting or receiving packets, con-
  11596.                             trols whether the packets are displayed on
  11597.                             the local screen.
  11598.  
  11599.                        _6._2_1._4.  _D_E_F_A_U_L_T-_D_I_S_K <_d_r_i_v_e _n_u_m_b_e_r>
  11600.  
  11601.                             The default-drive value is used for received
  11602.                             files.  The file names created by _M_o_d_e_l _4(_p)
  11603.                             _K_E_R_M_I_T will have a ':' and the default drive
  11604.                             number affixed to the end so that they will
  11605.                             be forced to be saved on the selected drive.
  11606.  
  11607.  
  11608.  
  11609.  
  11610.  
  11611.  
  11612.  
  11613.  
  11614.  
  11615.  
  11616.                                         - 18 -
  11617.  
  11618.  
  11619.                        _6._2_1._5.  _E_I_G_H_T-_B_I_T-_Q_U_O_T_I_N_G _O_N (_o_r _O_F_F)
  11620.  
  11621.                             This command enables or disables 8th bit
  11622.                             quoting.  This is useful when a full 8 bit
  11623.                             path is available for binary file transfers.
  11624.  
  11625.                        _6._2_1._6.  _E_M_U_L_A_T_I_O_N _N_O_N_E (_o_r _D_U_M_B)
  11626.  
  11627.                             When connected as a terminal to a foreign
  11628.                             host, _S_E_T _E_M_U_L_A_T_I_O_N controls whether the
  11629.                             Model 4 emulates no terminal, allowing the
  11630.                             use of a terminal filter, or whether a _D_U_M_B
  11631.                             terminal emulation is used.  No emulation is
  11632.                             the default.
  11633.  
  11634.                        _6._2_1._7.  _E_S_C_A_P_E
  11635.  
  11636.                             Change the escape character for virtual ter-
  11637.                             minal connections.  _M_o_d_e_l _4(_p) _K_E_R_M_I_T will
  11638.                             prompt you for the new escape character,
  11639.                             which you type in locally.
  11640.  
  11641.                        _6._2_1._8.  _F_I_L_E
  11642.  
  11643.                             _6._2_1._8._1.  _D_I_S_P_O_S_I_T_I_O_N _K_E_E_P (_o_r _D_I_S_C_A_R_D)
  11644.  
  11645.                                  When the transfer of a file is inter-
  11646.                                  rupted, this tells Model 4(p) KERMIT
  11647.                                  what to do if it receives only a partial
  11648.                                  file.  If FILE-DISPOSITION is DISCARD,
  11649.                                  then any partial file is removed.  Oth-
  11650.                                  erwise, the file is left as it is when a
  11651.                                  transfer is interrupted.
  11652.  
  11653.                             _6._2_1._8._2.  _T_Y_P_E (_A_S_C_I_I _o_r _B_I_N_A_R_Y)
  11654.  
  11655.                                  Tells _M_o_d_e_l _4(_p) _K_E_R_M_I_T how to deal with
  11656.                                  the file being sent/received. It is
  11657.                                  _I_M_P_O_R_T_A_N_T to tell KERMIT if the file is
  11658.                                  in _A_S_C_I_I when sending to a _N_O_N _M_o_d_e_l
  11659.                                  _4(_p) _K_E_R_M_I_T.  The action taken with this
  11660.                                  value is as follows.  If _A_S_C_I_I mode is
  11661.                                  set, then CR-LF pairs of characters are
  11662.                                  translated to CR on input, and CR is
  11663.                                  translated to CR-LF on output.  When
  11664.                                  binary mode is in effect, this transla-
  11665.                                  tion does not occur.
  11666.  
  11667.                        _6._2_1._9.  _F_L_O_W-_C_O_N_T_R_O_L _X_O_N/_X_O_F_F (_o_r _N_O_N_E)
  11668.  
  11669.                             When this feature is set to _X_O_N/_X_O_F_F (the
  11670.                             default), _M_o_d_e_l _4(_p) _K_E_R_M_I_T will try its best
  11671.                             to obey and use _X_O_N characters and _X_O_F_F char-
  11672.                             acters for all transmitions through the
  11673.  
  11674.  
  11675.  
  11676.  
  11677.  
  11678.  
  11679.  
  11680.  
  11681.  
  11682.                                         - 19 -
  11683.  
  11684.  
  11685.                             communications port.  _N_O_N_E will disable all
  11686.                             attempts at this sort of flow- control.
  11687.  
  11688.                        _6._2_1._1_0.  _I_N_P_U_T
  11689.  
  11690.                             _6._2_1._1_0._1.  _C_A_S_E-_I_G_N_O_R_E _O_F_F (_o_r _O_N)
  11691.  
  11692.                                  Controls whether of not case matching is
  11693.                                  done on characters during the input com-
  11694.                                  mand. In most instances, you will want
  11695.                                  this _O_N.
  11696.  
  11697.                             _6._2_1._1_0._2.  _D_I_S_P_L_A_Y _O_F_F (_o_r _O_N)
  11698.  
  11699.                                  Controls the display of characters that
  11700.                                  are input during the execution of the
  11701.                                  _I_N_P_U_T command.
  11702.  
  11703.                        _6._2_1._1_1.  _K_E_Y <_k_e_y _v_a_l_u_e> <_s_t_r_i_n_g>
  11704.  
  11705.                             This command allows you to send an arbitrary
  11706.                             (the length of the _K_E_R_M_I_T command line is the
  11707.                             limit) string with a single key stroke.  The
  11708.                             definition of string is identical for that of
  11709.                             the _I_N_P_U_T, _O_U_T_P_U_T, and _P_A_U_S_E commands. KEY
  11710.                             VALUE is the ASCII value of the key stroke as
  11711.                             given in the TRSDOS manual.  If KEY VALUE is
  11712.                             not given, then you will be asked to press
  11713.                             the key corresponding to the key that you
  11714.                             wish to define.  All keys are valid in _s_t_r_i_n_g
  11715.                             except BREAK.  Pressing BREAK signals the end
  11716.                             of the definition string.  While in _C_O_N_N_E_C_T
  11717.                             mode, typing the defined key will cause the
  11718.                             characters typed as the definition to be
  11719.                             typed instead.  Defining a key to have a _N_U_L_L
  11720.                             length deletes any previous definition.
  11721.  
  11722.                        _6._2_1._1_2.  _L_O_C_A_L-_E_C_H_O _O_F_F (_o_r _O_N)
  11723.  
  11724.                             When you _C_O_N_N_E_C_T to a remote host, you must
  11725.                             set _L_O_C_A_L-_E_C_H_O _O_N if the host is half duplex,
  11726.                             _O_F_F if full duplex.
  11727.  
  11728.                        _6._2_1._1_3.  _O_U_T_P_U_T
  11729.  
  11730.                             _6._2_1._1_3._1.  _H_O_S_T-_E_C_H_O _O_N (_o_r _O_F_F)
  11731.  
  11732.                                  When using _O_U_T_P_U_T, and communicating
  11733.                                  with a remote host, the host commonly
  11734.                                  echoes the characters as you type.
  11735.                                  Since _O_U_T_P_U_T effectively types charac-
  11736.                                  ters for you, these characters may be
  11737.                                  echoed back.  If _H_O_S_T-_E_C_H_O is _O_N, _O_U_T_P_U_T
  11738.                                  will wait for the echoed character to
  11739.  
  11740.  
  11741.  
  11742.  
  11743.  
  11744.  
  11745.  
  11746.  
  11747.  
  11748.                                         - 20 -
  11749.  
  11750.  
  11751.                                  reappear in the input buffer before it
  11752.                                  sends the next. In the example for send-
  11753.                                  ing and receiving raw data, that is
  11754.                                  above, setting _H_O_S_T-_E_C_H_O _O_N, will enable
  11755.                                  us to remove the _I_N_P_U_T _T_Y_P_E
  11756.                                  _M_Y_P_R_O_G._D_A_T<_C_R><_L_F> command. Control
  11757.                                  characters are _N_O_T normally echoed, so
  11758.                                  this feature when set _O_N, will not wait
  11759.                                  for them.  If you must catch the echo of
  11760.                                  a control character, then follow the
  11761.                                  _O_U_T_P_U_T command with the appropriate
  11762.                                  _I_N_P_U_T command.
  11763.  
  11764.                             _6._2_1._1_3._2.  _D_I_S_P_L_A_Y _O_F_F (_o_r _O_N)
  11765.  
  11766.                                  This parameter when on controls the
  11767.                                  display of characters that are received
  11768.                                  when _H_O_S_T-_E_C_H_O is _O_N.  Otherwise, They
  11769.                                  are displayed based on the status of the
  11770.                                  _L_O_C_A_L-_E_C_H_O setting.
  11771.  
  11772.                        _6._2_1._1_4.  _P_R_I_N_T_E_R _O_F_F (_o_r _O_N)
  11773.  
  11774.                             Turns copying of _C_O_N_N_E_C_T session to printer
  11775.                             on  and off.  With _F_L_O_W-_C_O_N_T_R_O_L turned on,
  11776.                             and a sending host that will acknowledge the
  11777.                             _X_O_F_F, you should have no problems using the
  11778.                             printer continuously.
  11779.  
  11780.                        _6._2_1._1_5.  _R_E_C_E_I_V_E
  11781.  
  11782.                             _6._2_1._1_5._1.  _E_N_D-_O_F-_L_I_N_E <_A_S_C_I_I _c_o_d_e>
  11783.  
  11784.                                  Set the end of line character in packets
  11785.                                  to some other character than <_C_R> which
  11786.                                  is the default.
  11787.  
  11788.                             _6._2_1._1_5._2.  _P_A_D-_C_H_A_R <_A_S_C_I_I _c_o_d_e>
  11789.  
  11790.                                  If the host you are communicating with
  11791.                                  needs one or more padding characters
  11792.                                  before it receives actual data during
  11793.                                  packet transfers, this character will be
  11794.                                  sent _P_A_D_D_I_N_G times.
  11795.  
  11796.                             _6._2_1._1_5._3.  _P_A_D_D_I_N_G <_d_e_c_i_m_a_l _n_u_m_b_e_r>
  11797.  
  11798.                                  The repeat count for the number of times
  11799.                                  the padding character is transmitted.
  11800.  
  11801.                             _6._2_1._1_5._4.  _Q_U_O_T_E-_C_H_A_R_A_C_T_E_R <_A_S_C_I_I _c_o_d_e>
  11802.  
  11803.                                  The character used to quote control
  11804.                                  characters.  The default is pound "#"
  11805.  
  11806.  
  11807.  
  11808.  
  11809.  
  11810.  
  11811.  
  11812.  
  11813.  
  11814.                                         - 21 -
  11815.  
  11816.  
  11817.                             _6._2_1._1_5._5.  _S_T_A_R_T-_O_F-_P_A_C_K_E_T <_A_S_C_I_I _c_o_d_e>
  11818.  
  11819.                                  The character used to syncronize the
  11820.                                  packets that _K_E_R_M_I_T transmits.  By
  11821.                                  default <_S_O_H>.
  11822.  
  11823.                             _6._2_1._1_5._6.  _T_I_M_E-_O_U_T <_d_e_c_i_m_a_l _n_u_m_b_e_r>
  11824.  
  11825.                                  _M_o_d_e_l _4(_p) _K_E_R_M_I_T uses this value as the
  11826.                                  number of seconds to wait for a response
  11827.                                  to a packet.  If no response is received
  11828.                                  within the number of seconds given, then
  11829.                                  the packet for which the response has
  11830.                                  not been received is retransmitted.
  11831.  
  11832.                             _6._2_1._1_5._7.  _T_U_R_N-_C_H_A_R
  11833.  
  11834.                                  The character used to syncronize KERMIT
  11835.                                  when used over a half duplex line.
  11836.                                  _M_o_d_e_l _4(_p) _K_E_R_M_I_T will wait for this
  11837.                                  character at the end of a packet, and
  11838.                                  will send the SEND TURN-CHAR at the end
  11839.                                  of a packet.
  11840.  
  11841.                        _6._2_1._1_6.  _S_E_N_D
  11842.  
  11843.                             _6._2_1._1_6._1.  _E_N_D-_O_F-_L_I_N_E <_A_S_C_I_I _c_o_d_e>
  11844.  
  11845.                                  Set the end of line character in packets
  11846.                                  to some other character than <_C_R> which
  11847.                                  is the default.
  11848.  
  11849.                             _6._2_1._1_6._2.  _P_A_D-_C_H_A_R <_A_S_C_I_I _c_o_d_e>
  11850.  
  11851.                                  If the host you are communicating with
  11852.                                  needs one or more padding characters
  11853.                                  before it receives actual data during
  11854.                                  packet transfers, this character will be
  11855.                                  sent _P_A_D_D_I_N_G times.
  11856.  
  11857.                             _6._2_1._1_6._3.  _P_A_D_D_I_N_G <_d_e_c_i_m_a_l _n_u_m_b_e_r>
  11858.  
  11859.                                  The repeat count for the number of times
  11860.                                  the padding character is transmitted.
  11861.  
  11862.                             _6._2_1._1_6._4.  _Q_U_O_T_E-_C_H_A_R_A_C_T_E_R <_A_S_C_I_I _c_o_d_e>
  11863.  
  11864.                                  The character used to quote control
  11865.                                  characters.  The default is pound "#"
  11866.  
  11867.                             _6._2_1._1_6._5.  _S_T_A_R_T-_O_F-_P_A_C_K_E_T <_A_S_C_I_I _c_o_d_e>
  11868.  
  11869.                                  The character used to syncronize the
  11870.                                  packets that _K_E_R_M_I_T transmits.  By
  11871.  
  11872.  
  11873.  
  11874.  
  11875.  
  11876.  
  11877.  
  11878.  
  11879.  
  11880.                                         - 22 -
  11881.  
  11882.  
  11883.                                  default <_S_O_H>.
  11884.  
  11885.                             _6._2_1._1_6._6.  _T_I_M_E-_O_U_T <_d_e_c_i_m_a_l _n_u_m_b_e_r>
  11886.  
  11887.                                  This value is given to the _o_t_h_e_r host as
  11888.                                  its' timeout value.  You should assure
  11889.                                  that this is different from the RECEIVE
  11890.                                  TIME-OUT value so that both timeouts do
  11891.                                  not occur simultaneously.
  11892.  
  11893.                             _6._2_1._1_6._7.  _T_U_R_N-_C_H_A_R <_A_S_C_I_I _c_o_d_e>
  11894.  
  11895.                                  The character used to syncronize KERMIT
  11896.                                  when used over a half duplex line.
  11897.                                  _M_o_d_e_l _4(_p) _K_E_R_M_I_T will send this charac-
  11898.                                  ter at the end of a packet.  The RECEIVE
  11899.                                  TURN-CHAR will be waited for before data
  11900.                                  is transmitted.
  11901.  
  11902.                        _6._2_1._1_7.  _T_A_K_E-_D_I_S_P_L_A_Y _O_F_F (_o_r _O_N)
  11903.  
  11904.                             Controls the display of _T_A_K_E files as they
  11905.                             are executed.  By default this feature is
  11906.                             off.
  11907.  
  11908.                        _6._2_1._1_8.  _W_A_R_N_I_N_G _O_N (_o_r _O_F_F)
  11909.  
  11910.                             Warns user if filename conflicts when receiv-
  11911.                             ing files from remote host, and attempt to
  11912.                             generate a unique name by modifying the given
  11913.                             one.  _O_N by default.
  11914.  
  11915.                   _6._2_2.  _S_E_T_C_O_M <_T_R_S_D_O_S _S_E_T_C_O_M _c_o_m_m_a_n_d _p_a_r_a_m_e_t_e_r>
  11916.  
  11917.                        Sets/shows the status of the communications
  11918.                        driver, _C_O_M/_D_V_R.  If no arguments are given, than
  11919.                        the current status will be shown.  Any arguments
  11920.                        must be enclosed in parenthesis as the result of
  11921.                        this command, is a generated _T_R_S_D_O_S command as in:
  11922.  
  11923.                             SETCOM (B=9600,P=N,W=8)
  11924.  
  11925.                        The default values are established according to
  11926.                        you.  If you set up the driver for a certain con-
  11927.                        figuration, and then use _S_Y_S_G_E_N to save it, then
  11928.                        that will be the default.  _N_O sysgen should give
  11929.                        you:
  11930.  
  11931.                             300 BAUD
  11932.                             EVEN PARITY
  11933.                             DTR=YES
  11934.                             7 DATA BITS
  11935.                             1 STOP BIT
  11936.  
  11937.  
  11938.  
  11939.  
  11940.  
  11941.  
  11942.  
  11943.  
  11944.  
  11945.  
  11946.                                         - 23 -
  11947.  
  11948.  
  11949.                   _6._2_3.  _S_H_O_W
  11950.  
  11951.                        Allows one or ALL of the options of the _S_E_T com-
  11952.                        mand to be displayed.  Using the "?" feature will
  11953.                        aid you if you can't figure out where to find
  11954.                        something.  All of the things that can be SET can
  11955.                        be displayed.  The items not listed below can be
  11956.                        displayed by using a command like:
  11957.  
  11958.                             SHOW BLOCK
  11959.  
  11960.                        or
  11961.  
  11962.                             SHOW DEFAULT
  11963.  
  11964.                        SHOW ALL will display all of the set values except
  11965.                        keys.  You must use SHOW KEY to see these values.
  11966.  
  11967.                   _6._2_3._1.  _S_E_N_D
  11968.  
  11969.                        Displays all options described under the _S_E_T _S_E_N_D
  11970.                        command.
  11971.  
  11972.                   _6._2_3._2.  _R_E_C_E_I_V_E
  11973.  
  11974.                        Displays all options described under the _S_E_T
  11975.                        _R_E_C_E_I_V_E command.
  11976.  
  11977.                   _6._2_3._3.  _K_E_Y <_A_S_C_I_I _k_e_y _v_a_l_u_e>
  11978.  
  11979.                        If <ASCII key value> is specified, then the defin-
  11980.                        ition for the specified key number is display.
  11981.                        Otherwise, a prompt is issued for the user to type
  11982.                        the keystroke that should be taken as the key to
  11983.                        display.  \nnn is used to display all values
  11984.                        greater than 127.  ^x where x is a character 64
  11985.                        greater than 0 through 31, and 127 is used to
  11986.                        display control characters.  Any other printable
  11987.                        ASCII character is displayed normally.
  11988.  
  11989.              _6._2_4.  _S_T_A_T_U_S
  11990.  
  11991.                   Shows certain information about the status of _M_o_d_e_l
  11992.                   _4(_p) _K_E_R_M_I_T.  Items currently displayed include the
  11993.                   amount of space left in the _K_E_Y definition table, the
  11994.                   number of bytes written to files during transfers, the
  11995.                   number of bytes read from files during transfers, as
  11996.                   well as statistics on the latest transfer.
  11997.  
  11998.              _6._2_5.  _T_A_K_E <_f_i_l_e_s_p_e_c>
  11999.  
  12000.                   TAKE allows commands to be stored in a file, and then
  12001.                   executed by the _K_E_R_M_I_T command interpreter.  Only _o_n_e
  12002.                   level of _T_A_K_E files is supported.  This means that a
  12003.  
  12004.  
  12005.  
  12006.  
  12007.  
  12008.  
  12009.  
  12010.  
  12011.  
  12012.                                         - 24 -
  12013.  
  12014.  
  12015.                   _T_A_K_E command can not appear inside of a _T_A_K_E file.  No
  12016.                   checking is done to enforce this, so good luck if you
  12017.                   want to try it.  When _K_E_R_M_I_T is first entered, a check
  12018.                   is made for a file called _K_E_R_M_I_T/_I_N_I on all of the
  12019.                   active disk drives as per normal _T_R_S_D_O_S searching
  12020.                   order.  If it is found, than it is used as a _T_A_K_E file
  12021.                   where you can store initialization commands.  Pressing
  12022.                   the _B_R_E_A_K key, or the _E_N_T_E_R key during the startup of
  12023.                   KERMIT (before the TAKE file is opened) will cause _K_E_R_-
  12024.                   _M_I_T to skip processing of the _T_A_K_E file.
  12025.  
  12026.  
  12027.  
  12028.  
  12029.              _7.  _S_e_t_t_i_n_g _u_p _t_o _u_s_e _M_o_d_e_l _4(_p) _K_E_R_M_I_T
  12030.  
  12031.                   To use _M_o_d_e_l _4(_p) _K_E_R_M_I_T, you need to have your Model 4
  12032.              set up properly.  The program expects that the *CL device
  12033.              will be driven by the COM/DVR Communications Driver that
  12034.              comes with TRSDOS.  It also expects that the *SO device is
  12035.              ROUTED to the *DO device, and that the *SI device is ROUTED
  12036.              to the *KI device.  The former 2 are the defaults, and in
  12037.              general, you should not worry about them, unless you have
  12038.              changed them.  Setting up the *CL device involves typing the
  12039.              command:
  12040.  
  12041.                   SET *CL COM/DVR
  12042.  
  12043.              at the _T_R_S_D_O_S _R_e_a_d_y prompt.  If you do not do this, you will
  12044.              get a message of the form
  12045.  
  12046.                   Can't find *CL DCB
  12047.  
  12048.              from _M_o_d_e_l _4(_p) _K_E_R_M_I_T when it is starting up.  The program
  12049.              will return control to TRSDOS after issuing this message, as
  12050.              it is a fatal error.
  12051.  
  12052.                   Model 4(p) KERMIT is not a small program.  It occupies
  12053.              memory starting at 6000H, and extends up past 0D300H.  If
  12054.              you have parts of TRSDOS resident (Using the SYSTEM
  12055.              (SYSRES=....) command), or perhaps other filters or memory
  12056.              resident modules, then you should make sure that they do not
  12057.              extend below the maximum address used by the program.  The
  12058.              last memory address used by _M_o_d_e_l _4(_p) _K_E_R_M_I_T can be
  12059.              obtained by using the command
  12060.  
  12061.                   LOCAL MEMORY
  12062.  
  12063.              from within the _M_o_d_e_l _4(_p) _K_E_R_M_I_T program.
  12064.  
  12065.  
  12066.  
  12067.  
  12068.  
  12069.  
  12070.  
  12071.  
  12072.  
  12073.  
  12074.  
  12075.  
  12076.  
  12077.  
  12078.                                         - 25 -
  12079.  
  12080.  
  12081.              _8.  _I_n_s_t_a_l_l_a_t_i_o_n
  12082.  
  12083.                   To install _M_o_d_e_l _4(_p) _K_E_R_M_I_T, you must obtain the two
  12084.              files _M_4_B_O_O._B_A_S and _M_4_M_I_T._H_E_X.  Because of the size of the
  12085.              executable, the hex file could not be placed into a basic
  12086.              program as data statements.  Instead, the basic program
  12087.              opens and reads the file _M_4_M_I_T._H_E_X.  This file is an _A_S_C_I_I
  12088.              image of the executable.  All that needs to be done, is to
  12089.              run the _B_A_S_I_C program which will convert the file back to
  12090.              its original binary format.  The resulting executable should
  12091.              probably be called _K_E_R_M_I_T/_C_M_D.  Follow the prompts of the
  12092.              BASIC program and there should not be any problems.
  12093.  
  12094.              _9.  _B_u_i_l_d_i_n_g _M_o_d_e_l _4(_p) _K_E_R_M_I_T from the Source.
  12095.  
  12096.                   The Source for _M_o_d_e_l _4(_p) _K_E_R_M_I_T is in approximately 15
  12097.              modules.  The names of the modules are:
  12098.  
  12099.                   M4ADD/ASM      Code for miscellaneous routines.
  12100.  
  12101.                   M4CMD/ASM      Command parser code.
  12102.  
  12103.                   M4EQU/ASM      Mosts constants are defined here
  12104.  
  12105.                   M4FILE/ASM     Additional logfile code such as the LOG
  12106.                                  command, and the CLOSE command.
  12107.  
  12108.                   M4GET/ASM      Receive file routines + other miscel-
  12109.                                  lany.
  12110.  
  12111.                   M4KEY/ASM      Code for handling the SET KEY functions
  12112.  
  12113.                   M4LOG/ASM      INPUT, OUTPUT, PAUSE, PULSE commands.
  12114.  
  12115.                   M4MAC/ASM      Macros used in the program
  12116.  
  12117.                   M4MIT/ASM      Main entry and some command routines.
  12118.  
  12119.                   M4PKT/ASM      New packet routines for encoding and
  12120.                                  decoding packets.
  12121.  
  12122.                   M4RMT/ASM      The base of what will be the remote com-
  12123.                                  mand.
  12124.  
  12125.                   M4SEND/ASM     Send file routines.
  12126.  
  12127.                   M4SET/ASM      Set options routines.
  12128.  
  12129.                   M4SHOW/ASM     Show settings routines.
  12130.  
  12131.                   M4STR/ASM      The majority of storage, prompts, and
  12132.                                  messages.
  12133.  
  12134.  
  12135.  
  12136.  
  12137.  
  12138.  
  12139.  
  12140.  
  12141.  
  12142.  
  12143.  
  12144.                                         - 26 -
  12145.  
  12146.  
  12147.                   M4TERM/ASM     Terminal Emulation, and I/O routines.
  12148.  
  12149.                   M4WILD/ASM     Wild card file name processing.
  12150.  
  12151.                   M4XFER/ASM     File processing, and some packet stuff.
  12152.  
  12153.                   _M_o_d_e_l _4(_p) _K_E_R_M_I_T was developed using the _E_D_A_S assem-
  12154.              bler from Misosys.  Other macro assemblers should be able to
  12155.              assemble the program with minor conversions.  _M_4_M_I_T/_A_S_M is
  12156.              the main source module. It will call the other source files
  12157.              into the assembly (using the *GET directive) as needed.  If
  12158.              any system calls need to be changed, they are all defined in
  12159.              _M_4_A_D_D/_A_S_M for the most part.  All of the SVC's are coded in
  12160.              _M_4_A_D_D/_A_S_M as subroutines that are accessed by CALL Xaaaaa,
  12161.              where aaaaa is the name of the _T_R_S_D_O_S supervisor call (SVC)
  12162.              without the "@" sign.
  12163.  
  12164.                   If this version is moved to another OS, there are
  12165.              several things that you should consider.  The things that
  12166.              come to mind are:
  12167.  
  12168.  
  12169.                   1.   Consider the format of the TRSDOS directory struc-
  12170.                        ture.  The wild card routines depend on this
  12171.                        structure for validating directory entries, and
  12172.                        for retrieving the file name.
  12173.  
  12174.                   2.   There are 2 places where real time counting is
  12175.                        required.  The delay specified in a PAUSE state-
  12176.                        ment can be handled with a counter, as all other
  12177.                        processing is halted (except the interrupt tasks)
  12178.                        during the pause.  Currently, the Real Time Clock
  12179.                        task is used to measure the appropriate delay.
  12180.                        The other use of a Real Time counter occurs in the
  12181.                        Receive packet timeout.  This must be handled
  12182.                        using asyncronous processes in order to be accu-
  12183.                        rate.
  12184.  
  12185.                   3.   There exist code at the beginnning and end of the
  12186.                        segment that accesses the screen which outputs the
  12187.                        bytes 14, and 15 to the *DO device.  These are
  12188.                        used to force the cursor to be invisible before
  12189.                        the screen is accessed, and to then make it reap-
  12190.                        pear after the screen access is completed.
  12191.  
  12192.                   4.   The interrupt driven receiver must also be delt
  12193.                        with.  The code in the routine SETINT, establishes
  12194.                        the interrupt vector that the *CL driver will call
  12195.                        when a "character received interrupt" is gen-
  12196.                        erated.
  12197.  
  12198.                   5.   In many instances, the characters having values
  12199.                        16, and 17 are used to enable, and disable reverse
  12200.                        video respectively.  If the driver for *DO does
  12201.  
  12202.  
  12203.  
  12204.  
  12205.  
  12206.  
  12207.  
  12208.  
  12209.  
  12210.                                         - 27 -
  12211.  
  12212.  
  12213.                        not recognize this convention, as the current one
  12214.                        does, then these characters must be handled in
  12215.                        some manner.  I.E. either removed from the source,
  12216.                        or filtered from the terminal output stream.  The
  12217.                        PRTSTR() routine is a good place to mask these
  12218.                        characters at, as it is the sole source of output
  12219.                        for strings containing these type of characters.
  12220.  
  12221.  
  12222.                   It should be noted that _K_E_R_M_I_T/_C_M_D loads into RAM at
  12223.              6000H.  This avoids high memory filters and drivers, and
  12224.              also allows use of _T_R_S_D_O_S library commands that use low
  12225.              memory beyond 3000H, as FORMAT, and BACKUP do.  Exclusive
  12226.              use is made of the *DO device for screen output from the
  12227.              KERMIT program, for informational messages and the like.
  12228.              During connect mode, *SI and *SO are used as the input and
  12229.              output devices to allow filters to be attached that will not
  12230.              effect the operation of _M_o_d_e_l _4(_p) _K_E_R_M_I_T during command
  12231.              operations.  If you install a different driver or filter it
  12232.              must be compatible in these areas.
  12233.  
  12234.              _1_0.  _P_e_r_f_o_r_m_a_n_c_e _S_p_e_c_i_f_i_c_s _o_f _M_o_d_e_l _4(_p) _K_E_R_M_I_T
  12235.  
  12236.                   The _M_o_d_e_l _4(_p) _K_E_R_M_I_T has been tested and proven to
  12237.              work properly at 9600 BAUD with flow control on, transfer-
  12238.              ring files between 2 Model 4's.  What makes the _M_o_d_e_l _4(_p)
  12239.              _K_E_R_M_I_T perform so well is the idea of flow control, and the
  12240.              interrupt driven receiver.  With out these features, I
  12241.              expect that 2400 baud would be the reliable limit.  Flow
  12242.              control can be disabled at speeds less than or equal to
  12243.              ~2400 baud, but greater speeds require that flow control be
  12244.              functional in order to protect the integrity of data in the
  12245.              input buffer.
  12246.  
  12247.  
  12248.  
  12249.  
  12250.              _1_1.  _T_h_e _H_e_a_t_h _1_9 _F_i_l_t_e_r
  12251.  
  12252.                   The files _M_4_H_1_9_1._A_S_M, _M_4_H_1_9_2._A_S_M, _M_4_H_1_9._M_A_C, and
  12253.              _M_4_H_1_9._E_Q_U make up the sources for a Heath 19 terminal emula-
  12254.              tion filter for the TRS-80 Models 4 and 4p.  The assembler
  12255.              used was EDAS by Misosys.  To build the filter from sources,
  12256.              you need the above 4 files on a disk.  _M_4_H_1_9_1._A_S_M is the
  12257.              main source module, and it *GETs all the other necessary
  12258.              files.
  12259.  
  12260.                   The structure of the program is pretty simple.  Single
  12261.              character (non escape) sequences, are passed to the filtered
  12262.              device via the @_C_H_N_I_O svc.  This filter depends on the
  12263.              _T_R_S_D_O_S *_D_O driver being at the end of the chain.  Several
  12264.              control characters are merely translated, and then the new
  12265.              values are passed to *DO.
  12266.  
  12267.  
  12268.  
  12269.  
  12270.  
  12271.  
  12272.  
  12273.  
  12274.  
  12275.  
  12276.                                         - 28 -
  12277.  
  12278.  
  12279.                   A multi-character escape sequence is handled by
  12280.              remembering the previous characters that the filter was
  12281.              passed.  The previous characters are remembered by the pres-
  12282.              ence of a non-zero value in the contents of _S_T_A_T_E.  The
  12283.              value in _S_T_A_T_E represents the address of the code to handle
  12284.              the next character, given the previous string of characters.
  12285.  
  12286.                   The filter is relocatable, but _M_U_S_T reside below screen
  12287.              memory because it accesses it directly when performing
  12288.              several of the advanced terminal functions.  For this rea-
  12289.              son, it will never load _a_b_o_v_e _F_3_f_f_H.
  12290.  
  12291.              _1_2.  _T_h_e _S_E_T_H_1_9 _P_r_o_g_r_a_m
  12292.  
  12293.                   The _S_E_T_H_1_9 program allows you to configure a few
  12294.              options that are available to you when using the _H_1_9 _f_i_l_t_e_r.
  12295.              The _S_E_T_H_1_9 program is created from the sources _M_4_H_1_9_S._A_S_M,
  12296.              _M_4_H_1_9._E_Q_U, and _M_4_H_1_9._M_A_C.  _M_4_H_1_9_S._A_S_M is the main source
  12297.              module, and will *GET the other 2 files. The program sup-
  12298.              ports a few parameters that are listed below.
  12299.  
  12300.  
  12301.                   REMOVE         Remove and reclaim if possible.
  12302.  
  12303.                   DURATION       Length of BELL tone.
  12304.  
  12305.                   FREQUENCY      Frequency value (bigger value is lower
  12306.                                  tone) for BELL.
  12307.  
  12308.                   BELL           Turn audible BELL ON or OFF.
  12309.  
  12310.                   BLOCK          Block cursor character.
  12311.  
  12312.                   CURSOR         Normal cursor character.
  12313.  
  12314.                   STRIP8         Control display of 8 bit data.
  12315.  
  12316.                   HELP           Displays information similiar to this.
  12317.  
  12318.                   SHOW           Displays the current settings of the
  12319.                                  parameters, this is the default.
  12320.  
  12321.              These options are specified when you invoke _S_E_T_H_1_9, as per
  12322.              the usual TRSDOS 6.x parameter list.  An example is shown
  12323.              below:
  12324.  
  12325.                   SETH19 (BLOCK=191,CURSOR=23,BELL=ON,SHOW)
  12326.  
  12327.                   This command sets the normal CURSOR, and the edit mode
  12328.              CURSOR values, as well as turning the audible bell on.  The
  12329.              show parameter causes 2 lines similiar to those below to be
  12330.              printed on the screen.
  12331.  
  12332.                   Normal Cursor: 23, Block Cursor: 191
  12333.  
  12334.  
  12335.  
  12336.  
  12337.  
  12338.  
  12339.  
  12340.  
  12341.  
  12342.                                         - 29 -
  12343.  
  12344.  
  12345.                   Bell: ON, Frequency: 20, Duration: 120
  12346.                   Strip8: ON
  12347.  
  12348.  
  12349.                   The REMOVE option takes several things for granted, as
  12350.              it tries to thoroughly remove the device.  It assumes that
  12351.              the H19 filter is attached to the *HP device, and that this
  12352.              device is a filter hooked to *SO.  Further more, it assumes
  12353.              that *SO is routed to *DO.
  12354.  
  12355.                   This particular set up can be used easily if the fol-
  12356.              lowing commands are used to set up the filter:
  12357.  
  12358.                   SET *HP H19/FLT FILTER *SO *HP
  12359.  
  12360.              This is assuming that *SO is routed to *DO.  The SETH19 com-
  12361.              mand will perform these very operations if you invoke it,
  12362.              and the memory module, $_H_E_A_T_H, is not in place.
  12363.  
  12364.                   The other parameters to the SETH19 command can be used
  12365.              to control certain preferable options to the filter.  Set-
  12366.              ting _B_E_L_L off causes the filter to flash the screen when it
  12367.              receives an ASCII(7) character.  If BELL is set _O_N, then an
  12368.              audible bell is issued when an ASCII(7) is received.
  12369.  
  12370.                   When BELL is ON, then the _D_U_R_A_T_I_O_N, and _F_R_E_Q_U_E_N_C_Y
  12371.              parameters take effect.  These 2 parameters select the
  12372.              length and pitch, respectively, of the BELL tone.  The FRE-
  12373.              QUENCY value is used as a delay between oscillations of the
  12374.              sound port, so the bigger the number, the lower the tone
  12375.              will be.
  12376.  
  12377.                   The _d_e_f_a_u_l_t _D_U_R_A_T_I_O_N is set to 20, and the FREQUENCY is
  12378.              set to 125.  You can adjust them as you please.  The DURA-
  12379.              TION is inversely proportional to the FREQUENCY, since the
  12380.              delay caused by the FREQUENCY value is part of the overall
  12381.              DURATION of the sound.  This means that as you increase FRE-
  12382.              QUENCY, you must _d_e_c_r_e_a_s_e DURATION to maintain the same
  12383.              length of BELL, and vice-versa.
  12384.  
  12385.                   The _B_L_O_C_K and _C_U_R_S_O_R parameters are used to control the
  12386.              characters that are used as the cursor by the H19 filter.
  12387.              The H19 terminal has the ability to use a visual mode cur-
  12388.              sor, or a line mode cursor.  Since the normal visual mode
  12389.              cursor is usually a block cursor, the parameter BLOCK is
  12390.              used to set the ASCII value of the visual mode cursor.  The
  12391.              CURSOR parameter sets the normal line mode cursor.
  12392.  
  12393.                   The switch between cursors must be done by the HOST
  12394.              computer that is attached to the Model 4's communications
  12395.              port.  There is no magic to when the BLOCK cursor is
  12396.              selected, see the description of the recognized control
  12397.              sequences below.
  12398.  
  12399.  
  12400.  
  12401.  
  12402.  
  12403.  
  12404.  
  12405.  
  12406.  
  12407.  
  12408.                                         - 30 -
  12409.  
  12410.  
  12411.                   The STRIP8 parameter controls whether or not data is
  12412.              printed on the screen with the eighth bit set.  Normally,
  12413.              the filter now trims the eighth bit off so that parity can
  12414.              be ignored.  The command
  12415.  
  12416.                   SETH19 (STRIP8=NO)
  12417.  
  12418.              will cause the eighth bit to not be stripped.  That is to
  12419.              say, data will be used as it is received by the filter.
  12420.              Note that when this is done, some control characters with
  12421.              parity bits attached may not be recognized.
  12422.  
  12423.  
  12424.              _1_3.  _F_u_t_u_r_e _m_o_d_i_f_i_c_a_t_i_o_n_s
  12425.  
  12426.                   It should be fairly straight forward to build extra
  12427.              states into the filter so that it will recognize the ANSI
  12428.              3.64 sequences for the operations the filter knows how to
  12429.              perform.  Full support of all the ANSI 3.64 sequences would
  12430.              be a non-trivial investment in time.  The best bet here
  12431.              would, be a completely new device driver, since the overhead
  12432.              of going to *DO is already costly, and trying to implement
  12433.              scroll regions with *DO would be a HACK at best.  If some-
  12434.              body wants to do the conversion, I would like to have a copy
  12435.              of the result.
  12436.  
  12437.              _1_4.  _H_E_A_T_H-_1_9 _f_i_l_t_e_r _c_a_p_a_b_i_l_i_t_i_e_s
  12438.  
  12439.                   The HEATH-19 terminal supports several advanced video
  12440.              capabilities that make it an ideal source for a terminal
  12441.              emulation package.  Below is a list of the functions sup-
  12442.              ported by the Model 4(p) H-19 emulator, and the escape
  12443.              sequences that perform the operations.
  12444.  
  12445.              _1_5.  _H_e_a_t_h/_Z_e_n_i_t_h-_1_9 _C_o_n_t_r_o_l _C_o_d_e_s
  12446.  
  12447.                   The  Heath/Zenith-19 terminal is equivalent to the DEC
  12448.              VT52 with extensions for line and character insertion and
  12449.              deletion.  Items marked with an  asterisk  are not currently
  12450.              supported by Model 4(p) H19 emulation.
  12451.  
  12452.  
  12453.              Cursor Functions
  12454.  
  12455.                Sequence    Mnemonic    Definition
  12456.                 ESC H      HCUH        Cursor Home
  12457.                 ESC C      HCUF        Cursor Forward
  12458.                 ESC D      HCUB        Cursor Backward
  12459.                 ESC B      HCUD        Cursor Down
  12460.                 ESC A      HCUU        Cursor Up
  12461.                 ESC I      HRI         Reverse Index
  12462.                *ESC n      HCPR        Cursor Position Report
  12463.                 ESC j      HSCP        Save Cursor Position
  12464.                 ESC k      HRCP        Set Cursor to Previously Saved Position
  12465.  
  12466.  
  12467.  
  12468.  
  12469.  
  12470.  
  12471.  
  12472.  
  12473.  
  12474.                                         - 31 -
  12475.  
  12476.  
  12477.                 ESC Y      HDCA        Direct Cursor Addressing, 1-based:
  12478.                                        31+line# 31+col# (same as VT52)
  12479.  
  12480.  
  12481.  
  12482.              Erasing and Editing
  12483.  
  12484.                Sequence    Mnemonic    Definition
  12485.                 ESC E      HCD         Clear Display (Shift Erase)
  12486.                 ESC b      HBD         Erase Beginning of Display
  12487.                 ESC J      HEOP        Erase to End of Page (Erase Key)
  12488.                 ESC l      HEL         Erase Entire Line
  12489.                 ESC o      HEBL        Erase Beginning of Line
  12490.                 ESC K      HEOL        Erase to End of Line
  12491.                 ESC L      HIL         Insert Line
  12492.                 ESC M      HDL         Delete Line
  12493.                 ESC N      HDCH        Delete Character
  12494.                 ESC @      HEIM        Enter Insert Character Mode
  12495.                 ESC O      HERM        Exit Insert Character Mode
  12496.  
  12497.  
  12498.  
  12499.              Configuration
  12500.  
  12501.                Sequence    Mnemonic    Definition
  12502.                *ESC z      HRAM        Reset to Power-Up Configuration
  12503.                *ESC r Bn   HMBR        Modify Baud Rate: Bn=
  12504.                                          A=110, B=150, C=300, D=600, E=1200,
  12505.                                          F=1800, G=2000, H=2400, I=3600, J=4800,
  12506.                                          K=7200, L=9600, M=19200
  12507.  
  12508.  
  12509.                 ESC x Ps   HSM         Set Mode(s): Ps=
  12510.                *                         1 = Enable 25th line
  12511.                *                         2 = No key click
  12512.                *                         3 = Hold screen mode
  12513.                                          4 = Block cursor
  12514.                                          5 = Cursor off
  12515.                *                         6 = Keypad shifted
  12516.                *                         7 = Alternate keypad mode
  12517.                                          8 = Auto line feed on CR
  12518.                                          9 = Auto CR on line feed
  12519.  
  12520.  
  12521.                 ESC y Ps   HRM         Reset mode(s): Ps=
  12522.                *                         1 = Disable 25th line
  12523.                *                         2 = Enable key click
  12524.                *                         3 = Exit hold screen mode
  12525.                                          4 = Underscore cursor
  12526.                                          5 = Cursor on
  12527.                *                         6 = Keypad unshifted
  12528.                *                         7 = Exit alternate keypad mode
  12529.                                          8 = No auto line feed
  12530.                                          9 = No auto CR
  12531.  
  12532.  
  12533.  
  12534.  
  12535.  
  12536.  
  12537.  
  12538.  
  12539.  
  12540.                                         - 32 -
  12541.  
  12542.  
  12543.                *ESC <      HEAM        Enter ANSI Mode
  12544.  
  12545.              Modes of Operation
  12546.  
  12547.                Sequence    Mnemonic    Definition
  12548.                *ESC [      HEHS        Enter Hold Screen Mode
  12549.                *ESC \      HXHS        Exit Hold Screen Mode
  12550.                 ESC p      HERV        Enter Reverse Video Mode
  12551.                 ESC q      HXRV        Exit Reverse Video Mode
  12552.                *ESC F      HEGM        Enter Graphics Mode
  12553.                *ESC G      HXGM        Exit Graphics Mode
  12554.                *ESC t      HEKS        Enter Keypad Shifted Mode
  12555.                *ESC u      HXKS        Exit Keypad Shifted Mode
  12556.                *ESC =      HAKM        Enter Alternate Keypad Mode
  12557.                *ESC >      HXAM        Exit Alternate Keypad Mode
  12558.  
  12559.  
  12560.  
  12561.                Additional Operations
  12562.  
  12563.                Sequence    Mnemonic    Definition
  12564.                *ESC }      HDK         Keyboard Disable
  12565.                *ESC {      HEK         Keyboard Enable
  12566.                *ESC v      HEWA        Wrap Around at End of Line
  12567.                *ESC w      HXWA        Discard at End of Line
  12568.                *ESC Z      HID         Identify as VT52 (ESC / K)
  12569.                *ESC ]      HX25        Transmit 25th Line
  12570.                *ESC #      HXMP        Transmit Page
  12571.  
  12572.  
  12573.  
  12574.                Enhanced Character Support
  12575.  
  12576.                 ESC [ p1 ; ... pn m    Set Graphics Rendition
  12577.                 where p1, ..., pn are chosen from the following:
  12578.                 *0            Reset to normal character display.
  12579.                 *1            Display characters in high intensity.
  12580.                 *4            Display characters underlined.
  12581.                 *5            Display characters blinking.
  12582.                 *7            Display characters in reverse video.
  12583.  
  12584.  
  12585.  
  12586.                   The  Heath-19  transmits  the following sequences,  but
  12587.              it  will  not  respond  to them if they are received.  Model
  12588.              4(p) Kermit will transmit them only if they  are  programmed
  12589.              with SET KEY.
  12590.  
  12591.                 ESC S      HF1         Function Key #1
  12592.                 ESC T      HF2         Function Key #2
  12593.                 ESC U      HF3         Function Key #3
  12594.                 ESC V      HF4         Function Key #4
  12595.                 ESC W      HF5         Function Key #5
  12596.                 ESC P      HF7         Function Key #7
  12597.  
  12598.  
  12599.  
  12600.  
  12601.  
  12602.  
  12603.  
  12604.  
  12605.  
  12606.                                         - 33 -
  12607.  
  12608.  
  12609.                 ESC Q      HF8         Function Key #8
  12610.                 ESC R      HF9         Function Key #9
  12611.  
  12612.                   My thanks to Michael Carter and Roland Stolfa for their
  12613.              help in testing and debugging this implementation.
  12614.  
  12615.  
  12616.              Gregg Wonderly
  12617.              Department of Computing and Information Sciences
  12618.              Oklahoma State University
  12619.  
  12620.  
  12621.              UUCP: {cbosgd, ea, ihnp4, isucs1, mcvax, uokvax}!okstate!gregg
  12622.              ARPA:  gregg@A.CS.OKSTATE.EDU
  12623.  
  12624.  
  12625.  
  12626.  
  12627.  
  12628.  
  12629.  
  12630.  
  12631.  
  12632.  
  12633.  
  12634.  
  12635.  
  12636.  
  12637.  
  12638.  
  12639.  
  12640.  
  12641.  
  12642.  
  12643.  
  12644.  
  12645.  
  12646.  
  12647.  
  12648.  
  12649.  
  12650.  
  12651.  
  12652.  
  12653.  
  12654.  
  12655.  
  12656.  
  12657.  
  12658.  
  12659.  
  12660.  
  12661.  
  12662.  
  12663.  
  12664.  
  12665.  
  12666.  
  12667.  
  12668.  
  12669. <<< m4mit.hex >>>
  12670. 05064B45524D495401020060ED7322D33124D5CD008AFD228BBA210EBB110FBB0180073620EDB0
  12671. 0601210000CDC189C282602289BA218CDECDC189C282601E43164CCD408A228FBA20311E531649
  12672. CD408A2291BA202E1E53164FCD408A2293BA2027CD708AAF329AD9CD8E6011F4AACD026ECDCD8B
  12673. CD9760C3EE61115FABCD026EC32562117BAB18F5116DAB18F0CD518A1120AACD026EC3478AD511
  12674. 28CDCD026ED1C93124D5119AD91ACB7FC483891120C7CDB864112BCD3E01CD2A65C3D461219760
  12675. E5E521C1604F060009E9C3D48CC3E661C3C76BC39363C38577C33B7DC3A168C3966EC3046FC385
  12676. 62C3D162C32763C3218BC3638BC3A661C38C61C35661C36592C3D891C3E993C3539301020061C3
  12677. 2861C34163C309613E05118DD6D5CD2A65C3DD61E14F0600093600CDCF8A118DD6CD026EC39760
  12678. 3E01119DD0CD2A65C3D461326ED83E04CD2A65C3DD613A6ED84FB72006CD0E8BC39760FE03C2D4
  12679. 61CD8E60C397601169BA3E02CD2A65C3DD61B7CADD61FD2A8BBAFDCB12C62115C31169BA0600CD
  12680. 6E8920083E013265BAC39760CD518AAF3265BAC397603E051120C6CD2A65C3DD61CDCF8A3E0D12
  12681. 2119C6CD2A8AC397602A1CD37E23FE2028FAFE0D2804FE3F2013E5FDE1FD36FF4CFD360049FD36
  12682. 0142FD36020D2BCDCF8ACD2A8AC397601132C7CD026EC397601161C7CD026EC397603E04CD2A65
  12683. C3DD61119AD91ACB7FC4838911C2D93A2AD5B7C48301020062891112DA3A2BD5B7C483891169BA
  12684. 3A2CD5B7C483890E04FD210000ED5B8FBACD9189CD8E602A89BA0601CDC1892A7A8CCD4F622AC9
  12685. 8CCD4F62CDC187ED7B22D3210000FD2A8BBAFDCB126EC0C3478A060836002310FBC93E413288D6
  12686. CDCF8A3A63DE4F0600218DD6E53E00CDCD73D1C3026ED5CDCF8AD1C3026EB7C8C3518ACD026EC3
  12687. CF8A3E04CD2A65C3DD61CDCF8ACD0E8BAF3264D53E31325AD5CD4E80AF3262DE3E013263DE218D
  12688. D636463E47CDA981C39C62CDB482C39C62FE59CA9760FE452006CD5C62C39760FE4EC48F6D18CB
  12689. 3E04CD2A65C3DD61CDCF8ACDE562C33B63C39760AF3264D5CD0E8B3E31325AD5CD4E80AF3262DE
  12690. 3E013263DE218DD601020063364C3E47CDA981C32163CDB482C3F162FE59CA9564FE45CA5C62FE
  12691. 4EC48F6D18D01176C8C3026E3E04CD2A65C3DD61CDCF8ACDE562C33B63C3EE61CDCF8AC39760CD
  12692. 5D64B7201E3A2AD5B7280FAF322AD511C2D9CD8389C4518A180611D8BACD026EC39760FE012015
  12693. 3A2BD5B728EDAF322BD51112DACD8389C4518A18E43A2CD5B728D8AF322CD511EAD9CD8389C451
  12694. 8A18CFCD5D64B7CAE563FE02CA23643A2BD5B7280911BBBACD026EC397601112DAD53E02CD2A65
  12695. C3DD61B7200B2189AF1112DA012000EDB0D12162DD0600CD6789280AFE2A2806CD518AC397603E
  12696. 01322BD5C397603A2AD5B72803C3A5633E0211C2D9D5CD2A65C3DD61B7200B217DAF0102006411
  12697. C2D9012000EDB02162DBD10600CD67892804FE2A20C0AF32D5AF3E02322AD5C397603A2CD5B728
  12698. 03C3A5633E0211EAD9D5CD2A65C3DD61B7200B2173AF11EAD9012000EDB0D12162DC0600CD6789
  12699. 2804FE2A20823E01322CD5C397603E011175D0CD2A65C3D461C93E00C36E64E5D53275647EFE00
  12700. 280CE5D5CDAD89D1E120082318EFD1E1C39564CD518A11C8AACD026ED1E1C9E1232323E9E5C5D5
  12701. 1193AFD5CD158AEB3600E13E20BE20032318FAEBCD026ED1C1E1C9E1E52212D2ED7310D2ED5314
  12702. D22118D2221AD3221CD3AF320DD2320ED22F320FD23A65BAB728063AD0AFB7280ACDCF8AED5B14
  12703. D2CD026EC9ED7B10D22118D2221CD33EFF320FD22A0102006512D2E9ED7B10D22118D2221AD322
  12704. 1CD3CDCF8AAF320DD2320ED23EFF320FD2ED5B14D2CD026E2A12D2E9320CD2CD0968FE06CA9765
  12705. FE04CAF165FE01CA2C66FE02CAB267FE10CAB267FE03CAB267FE05CA5A6511C4D1CD026EC9EB22
  12706. 16D20600CD4368B7F28365E67FFE1BC8FE3F281EFE20280F782A16D2360DEBC39564210DD23600
  12707. 042A16D277232216D218D2112CA9CD0B66C3F0640600210000229AAFCD4368B7F2B765E67FFE1B
  12708. C8FE3F283978ED5B9AAFC3956404E5D5C52A9AAF0E0AF5CD318A656FF1D630F2D865C1D1E1114B
  12709. C7CD026EC39760FE0A30F04F060009229AAFC1D1E118B71164A9CD0B66C3F064CD4368B7F0E67F
  12710. FE3F20091160C9CD010200660B66C3F064FE1BC8C39564CD026EAF320DD2CDCF8AED5B14D2CD02
  12711. 6E2A1AD32B3600221AD31118D2CD026EC9ED5316D21A471313ED531ED32A1CD32220D378B7C82A
  12712. 1ED3235E231D7BFEFFFA5C67CD4368B7F25267E67FFE3FC22767E5D5AF320DD2119ABACD026E21
  12713. 0ED235D1E12A16D246237E32A2AFAF32A3AF237E3299AF234E7932A1AF23221ED3ED5B20D31AFE
  12714. 3F2816CD776713BE2320600DF28E661AFE3F2805FE00C3FB663A99AFB72841D5E5C5ED5B1ED3CD
  12715. 90683AA2AF473AA3AF80473AA4AFB838097832A3AF3AA2AF1809CDCF8A3AA2AF32A3AF914FC5ED
  12716. 5B1ED3CD026EC13E20CD8F6D0D20F8C1E1D13E03815F1600191083180A2BF2F0662801020067EF
  12717. AF320DD2CDCF8ACDCF8AED5B14D2CD026E2A1CD336002A1AD32B221AD31118D2CD026EC3F064FE
  12718. 1BC8E5D5CD8267C344672A1AD30118D2B7ED4211E7D1CD026EC30365D1E11C160019235E23567B
  12719. C39564CD7767BE200423C3476616007BB7F2656716FF1923232323221ED3052A20D3221CD3C33E
  12720. 66FE613806FE7B3002E65FC905F81C4B7BB7C81600191E04194623EB2A1ED3237E914FB82801F0
  12721. 2A20D30DFA9564EB4623EB7E23CD7767B8C0C3A067ED5318D31120C60600CD4368B7F2D467E67F
  12722. FE1BC8FE3F200E1144A9CD0B66C3F06412130418E23E0D1278B7281EE52120C6ED5B18D3CD6089
  12723. C20568EB3E03012800EDB1212700B7ED4245E1221C01020068D378C39564E1C3518AF5D5E53A0D
  12724. D2B7202D2A1AD3E51118D2B7ED5245E1CD2388DA036578320ED24806002118D2E509221AD3C1B7
  12725. ED42CA03653EFF320DD2E1D1F1C9E5C53A0DD2B7CC09682A1CD37E23221CD3FE202804FE092011
  12726. 3A0FD2B720E33EFF320FD23E20C1E11820F5AF320FD2F1C1E1FE1B2814FE3F2807FE0D2803FE0A
  12727. C0E52A1CD32B221CD3E1F680C9F5D50100001AFE002804130318F7D1F1C91147CE3E113247CE3E
  12728. 133248CE3E01CD2A65C3D46121BE684F060009E9C35B6AC3756AC3F36AC3A66AC38F69C37E6AC3
  12729. E16AC3EA6AC3D78AC38669C3AF69C3B269C3166BC36769C31969C34069C310691154CF3E01CD2A
  12730. 65C3D461326ED83E0102006904CD2A65C3DD613A6ED832B6AFC39760CDFC6A32D0AFC397603E01
  12731. 115BD1CD2A65C3D4614FFE002009CDFC6A32CD9DC39760FE03C2DD61CDFC6A32D3AFC397603E01
  12732. 113FD1CD2A65C3D4614FFE002009CDFC6A32CF9DC39760FE03C2DD61CDFC6A32D4AFC3976011B9
  12733. D03E01CD2A65C3D461326ED83E04CD2A65C3DD613A6ED83268BAC39760CDFC6A328EBAC3976011
  12734. 90D13E01CD2A65C3D461326ED84F3E04CD2A65C3DD613A6ED83259D5C39760AF18023E0132B5BA
  12735. 11D1D03E01CD2A65C3D46121CA694F060009E9C3FF69C3DF69C32E6AC33A6AC3406AC3466AC334
  12736. 6A3E06CD2A65C3DD61B7CAD4617AB728091110BACD026EC397607B324DD5C39760210102006A4F
  12737. D522B9BA3E06CD2A65C3DD61B7CAD4617AB728091110BACD026EC397602AB9BA3AB5BAB7CC4F6A
  12738. C4506AC397602153D5C3026A2157D5C3026A214BD5C3026A2151D5C3026A2155D5C3026AC30E8A
  12739. 2373C9E56F2600CD9A64E1C93E04CD2A65C3DD6111A1C9CD026ECD238A3234D5CD048CC39760CD
  12740. FC6A322DD5C397601161D03E01CD2A65C3D461326ED83E04CD2A65C3DD613A6ED8322FD5C39760
  12741. CDFC6A3230D5C39760112DCF3E01CD2A65C3D4614F060021B96A09E9C3F168C3C26AC39D6A1179
  12742. D13E01CD2A65C3D461326ED83E04CD2A65C3DD613A6ED83231D5C39760CDFC6A3233D5C39760CD
  12743. FC6A3232D5C39760CDFC6A32AAAFC3976011A4D13E0102006B01CD2A65C3D461326ED83E04CD2A
  12744. 65C3DD613A6ED8C93E06CD2A65C3D461B7285D7AB720507B320CBA3E051187D5ED53CDAFCD2A65
  12745. C3DD61218DD6220DBAF5AF320FBAF1B7281ECD1D962019CDD994C297605F3ACB9DB72806AF32CB
  12746. 9D18E87BCDB86B18E2218DD63A0FBA473A0CBACD1F91C397601110BACD026EC3976011F9ABCD02
  12747. 6ECD0D6EB728FA320CBACD17741117ACCD026E218DD60600CD0D6EB728FAFE80280D77CD177404
  12748. 3EFFB828032318E978320FBA18ADE52A0DBA7723220DBA210FBA34E1C93E04CD2A65C3DD61CD3F
  12749. 8C3A97BA3298BA3E503297BA3A12C3B7201A1128CDCD026E11D3C8CD026ECD048C11F5C8CD026E
  12750. 3E013212C33E0ECD0102006C8F6D3E1E326C6CCD586CCD776CC3976018F0E52A17C63A15C6BD28
  12751. 35F37E324D6C2C2217C62166BA35FB3A68BAB7281CC54E3A67BAB728133A97BACB3FB9380BD51E
  12752. 11CD136EAF3267BAD1C13E00BFE1C9AF3266BA3CE1C9CD126CC05FCD816D3A33D5B7C45C6D7BCD
  12753. 9E6D06001001C978326C6CC3586CCDFA90C295645F3A34D5BBCAA06CFE802006CD636DC395647B
  12754. D5CD7B6DD13A2DD5B77BC49E6DC39564CDFA9020FB47E65FFE43200ACD588C3A98BA3297BAC978
  12755. FE3F20403E0FCD8F6D0604CD9F89E52100260606CD9F8921000CCD916E3E1FCD8F6D11C2C9CD02
  12756. 6ECDFA9020FBE1F5E52100260605CD9F89E1CD916E3E0ECD8F6DF118AAE65FFE42200102006D06
  12757. CD636DC3956478FE3020081E00CD136EC39564583A34D5BB283678E65FFE5120163A2AD5FE0220
  12758. 073D322AD5C395643E07CD8F6DC39564FE52200E3A2AD5FE0120ED3C322AD5C395647BCD7B6DC3
  12759. 9564CD136E3E07CD8F6DC395647BD5CD9889D1C90E01ED5B8FBACD9189F30158980B78B120FBFB
  12760. 1E00C3136EB7C85FC3136EF5D55F3A2AD5B77BC42089D1F1C9D5C5F5FE07284ECD388AC178C1D1
  12761. C9D5C5F55F3A2FD5B728237BFE20301E21D6AF06004F097EB7281B5FFE0C2005CD8E601811FE07
  12762. 2005CD8F6D18087BED5B93BACDAD89C178C1D1C9D5C5ED5B91BACDA689C1D1C93A8EBAB728AFC5
  12763. 0E323E01D390068210FE3DD390068210FE0D20EEC10102006E18971AFE00C8B7C48F6D1318F5D5
  12764. CD1C8AD1C9D5C54B3ACFAFB7280BCD0D6EFE8020F3AF32CFAF79ED5B8FBACDAD8920F7C1D1C9AF
  12765. 32446ECD0D6EB72009CD126CCA95640018EDFE0D200A3AC587B7C84FCDEB89C9FE022818FE0628
  12766. 14FE012810FE05280CFE042808FE082804FE0320C7C640325CD5C9E5F52AB79C2B22B79C7CB520
  12767. 0A3EC932446EF1E1C3F289F1E1C90603C39F893E333247CE3248CE3E01113FCECD2A65C3D461FE
  12768. 242815FE092811326ED83E04CD2A65C3DD61CDCF8A3A6ED821CE6E4F060009019760C5E9C3BA73
  12769. C3FB72C35371C32073C3A273C30A73C39373C38473C36373C3EC72C36272C3D871C3D073C3C271
  12770. C38071C3A171C3440102006F71C3286F3E04CD2A65C3DD611158ACCD026E21FBB9ED4BFAB1B7ED
  12771. 42CD9A64CDCF8ACDEC85C3976011AFCACD026E2113001185CBCD5C743A8EBACDB874CDCF8A2115
  12772. 001156CCCD5C742151D5CD7974211300118CCBCD5C743A33D5CDB874CDCF8A2115001165CCCD5C
  12773. 742157D5CD79742113001196CBCD5C743A32D5CDB874CDCF8A2115001174CCCD5C74214FD5CD79
  12774. 7421130011A2CBCD5C743A31D5115CCBB728031164CBCD026ECDCF8A2115001185CCCD5C742155
  12775. D5CD797421130011AECBCD5C743A2DD5CDB874CDCF8A2115001196CCCD5C74214BD5CD79742113
  12776. 0011BBCBCD5C74CDD788CD048CCDDC88CDCF8A21150011A8CCCD5C74214DD5CD79740102007021
  12777. 130011C9CBCD5C743A30D5CDB874CDCF8A21150011BACCCD5C742153D5CD797421130011D8CBCD
  12778. 5C743A68BA114ACBB720031155CBCD026ECDCF8A11DDCACD026E21130011E7CBCD5C74CDD7883A
  12779. 29D5CD8F6DCDDC88CDCF8A21150011CDCCCD5C743AD3AFCDA974012006CDA074CD737421130011
  12780. F7CBCD5C743A2FD51155CBB72803116DCBCD026ECDCF8A21150011DECCCD5C743ACD9DCDA97401
  12781. 2006CDA074CD73742113001108CCCD5C74CDD7883AB6AF1174CBB72003117ECBCD026ECDDC88CD
  12782. CF8A1109CBCD026E211300111BCCCD5C74CDD7883A59D5CD8F6D110DCDCD026ECDDC88CDCF8A21
  12783. 150011EDCCCD5C743AD4AFCDA974012006CDA074CD010200717374211300112ECCCD5C743AD0AF
  12784. CDB874CDCF8A21150011FFCCCD5C743ACF9DCDA974012006CDA074CD73742113001142CCCD5C74
  12785. 3AAAAFCDB874CDCF8ACDCF8AC39760112ECCCD026E3AD0AFCDB874C3CF8A1142CCCD026E3AAAAF
  12786. CDB874C3CF8A1108CCCD026ECDD7883AB6AF1174CBB72003117ECBCD026ECDDC88C3CF8ACDCF8A
  12787. 11DECCCD026E3ACD9DCDB874CDCF8A11CDCCCD026E3AD3AFCDB874C3CF8ACDCF8A11FFCCCD026E
  12788. 3ACF9DCDB874CDCF8A11EDCCCD026E3AD4AFCDB874C3CF8A11D8CBCD026E114ACB3A68BAB7C202
  12789. 6E1155CBC3026E3E04CD2A65C3DD61CDCF8A2115001156CCCD5C743A51D5CD526ACDCF8A211500
  12790. 1165CCCD5C743A5701020072D5CD526ACDCF8A2115001174CCCD5C743A4FD5CD526ACDCF8A2115
  12791. 001185CCCD5C743A55D5CD526ACDCF8A2115001196CCCD5C743A4BD5CD526ACDCF8A21150011A8
  12792. CCCD5C743A4DD5CD526ACDCF8A21150011BACCCD5C743A53D5CD526ACDCF8AC93E04CD2A65C3DD
  12793. 61CDCF8A2115001156CCCD5C743A52D5CD526ACDCF8A2115001165CCCD5C743A58D5CD526ACDCF
  12794. 8A2115001174CCCD5C743A50D5CD526ACDCF8A2115001185CCCD5C743A56D5CD526ACDCF8A2115
  12795. 001196CCCD5C743A4CD5CD526ACDCF8A21150011A8CCCD5C743A4ED5CD526ACDCF8A21150011BA
  12796. CCCD5C743A54D5CD526ACDCF8AC91185CBCD026E3A8EBACDB874C3CF8A11AECBCD02010200736E
  12797. 3A2DD5CDB874C3CF8A11F7CBCD026E3A2FD5B71155CBCA026E116DCBC3026E112DCF3E01CD2A65
  12798. C3D461CDCF8A326ED83E04CD2A65C3DD613A6ED84F060021447309E9C36271C34D73C3757311A2
  12799. CBCD026E115CCB3A31D5B7CA026E1164CBC3026E11E7CBCD026ECDD7883A29D5CD8F6DC3DC8811
  12800. C9CBCD026E3A30D5CDB874C3CF8A1196CBCD026E3A32D5CDB874C3CF8A118CCBCD026E3A33D5CD
  12801. B874C3CF8A111BCCCD026ECDD7883A59D5CD8F6DCDDC88110DCDC3026E11BBCBCD026ECDD788CD
  12802. 048CC3DC884F097EC90977C93E06CD2A65C3DD61B728297AB7201CCDCF8A7BCD6591B4280CCDCF
  12803. 8A7EB7C8CD17742318F71127BAC3026E1110BACD02010200746EC3976011F9ABCD026ECD0D6EB7
  12804. 28FAF5CD1774F118CCFE20300EF53E5ECD8F6DF1C640E67FC38F6DFE7F28EEDA8F6D4F3E5CCD8F
  12805. 6D79E6C0CB07CB07E603C630CD8F6D79E638CB3FCB3FCB3FE607C630CD8F6D79E607C630C38F6D
  12806. D5CD9068B7ED42457DB728073E20CD8F6D10F9D1C3026E1135CBC3026E7EE5CD8D743E20CD8F6D
  12807. E1237ECD8D74CD7374C91193AF6F2600CD158AEB36001193AFCD026EC9F579CD8F6D10FAF1C911
  12808. 44CBB72803113FCB210700C35C741144CBB7CA026E113FCBC3026E000000E5C5D522C574CDA880
  12809. CDDE7421000022C574D1C1E1C9C5D5E53A5AD5D631473A49D5D6059032C7742AA6AF010000B7ED
  12810. 42F20275CD0C772201020075B4AF01000021ADAF097E21FED70977B728030C18F0793248D5AF32
  12811. ADAF2AB4AF010000B7ED42FA9675CD0C7722A6AF3A48D53247D54F060021FED7092243D52AB4AF
  12812. 7DCD9D752A43D501FED7B7ED427D3248D52AA6AF22B4AF3A48D54F3AC774B9CA9675F293750100
  12813. 003A47D5C5814F21FED7097EC121ADAF0977B728030C18E93A47D53248D54F060021FED7093600
  12814. C39675C31D753A48D5E1D1C1C9C5D5E54F3AA5AFB7CA18762AA6AF7DB920213AA8AF3C32A8AFFE
  12815. 5EFA79763AA9AFCD7C773AA8AFC620CD7C77AF32A8AFC318763AA8AFFE012027AF32A8AF79CD9D
  12816. 752A43D511FED7B7ED523AC774BDFAF3757D3247D5AF32A8AF79CD9D75C379763AA801020076AF
  12817. FE02FA18763AA9AFCD7C773AA8AFC621CD7C77AF32A8AF79E67F4779E68057B7280D3AAAAFB728
  12818. 073AABAFCD7C774879FE7F2804FE20300C3AACAFCD7C7779C640E67F4F2A43D53AACAFB8200277
  12819. 233AA5AFB7280B3AA9AFB820053AACAF77233AAAAFB7280B3AABAFB820053AACAF772371232243
  12820. D53600E1D1C1C9229EAFC5D5E5218DD6223FD54F0600E5093600E13E0132A8AF7E234FB7CA0077
  12821. 3AA5AFB728103AA9AFB9200A7ED6202332A8AF7E234FAF573AAAAFB7280B3AABAFB9200516807E
  12822. 234F3AACAFB9201B7E234FE67F5F7BFE40FADD76FE60FAE176FE3F200679D640E67F4F7AB14F3A
  12823. A8AF47DD21C1AFCDA58579CD5477200910F1C3917601020077E1D1C1C9CD518A3E01B718F43A31
  12824. D5B720103AA0AFFE0D20093E0A32A0AF6F2600C92AC5747CB5280A7E2322C574B72818180F119A
  12825. D9CDA689200EDD21C5AFCDA58532A0AF6F2600C93EFF3226D532A0AF6F67C9E5C54F3AA0AFFE0D
  12826. 20113A99BAB7280B3A31D5B7200579FE0A280A7932A0AF2A9EAFCD4181C1E1C92A43D577232243
  12827. D5C9CDCF8A3E523288D6118DD63E05CD2A65C3DD61B7280E3263DE3271D8EB36003E723288D6CD
  12828. F8772100002260D52262D522BFAFAF325FD53264D5325CD53E523299BACD9E80CD0E8B1157ADCD
  12829. 026ECD798FC397601195C83A5CD5B72807AF325CD51145C93A99BAB7C47F62C3976011A1C818F1
  12830. AF3235D52162DA220102007839D5CD0E8BC9CD4E803E31325AD5CDB482C3CB781827CD4E803E31
  12831. 325AD53A71D83263DEAF3262DE3E52CDA981C389783E31325AD5CDB482C396601800FE53203E3A
  12832. 64D53265D5AF3264D53A62DECD7180CD83803A63DE218DD6CD2F79218DD6CDEB783263DE3E59CD
  12833. A981C389783A5BD5325AD53E663288D63E46CD9E80C9FE45203FCD5762C38978DD21C1AFCD877C
  12834. 3E413288D63A2364FE01C011EAD92156AACD6964C3A878C9AF32236411EAD9CD8389C93E413288
  12835. D6DD21C5AFCD877CC39578AF325FD51803CDE3783A5FD53262DEAF3263DE3E4ECDA981C389783E
  12836. 4ECD9E80C92A62D5232262D5C93A4AD5CD2A793A4BD5CD2A793A4ED5CD2A793A50D501020079C6
  12837. 4077233A52D5CD2A793A56D577233AAAAFB728053659231803364E233A5BD577233AA9AF77233E
  12838. 09C9C6207723C93271D8C5AF4732A5AFCDB4797ED6203249D5CDB479237ED620324CD5CDB47923
  12839. 7ED620324DD5CDB479237EC640E67F324FD5CDB479237ED6203251D5CDB479237E3255D5CDB479
  12840. 233AAAAFB728147EFE592807FE4E2005AF18053E2632ABAF32AAAFCDB479237E4F3A59D5B92802
  12841. 3E31325BD5CDB479237EFE2028074F32A9AF32A5AFC1C93A71D804B8F0E1C1C9CD4E80CDB482C3
  12842. CB78FE532023CD3D7CCD2E7CC2C878CDE378218DD6CDEB783263DE3E59CDA981C389783E53CD9E
  12843. 80C9FE5A201ECD3D7CCD2E7CC2C878CDE378AF32630102007ADE3E59CDA981C389783E5ACD9E80
  12844. C9FE46203BCD347CC2C878CD7180CD83803E463299BACD9E80CD4386C38978CDF877CD78803263
  12845. DE3E59CDA981C389783E743288D63A5CD5FE5AC8AF325CD5C9FE42201BCD9E80CD347CC2C878AF
  12846. 3263DE3E59CDA981C389783E433288D6C9FE58C2C580CD347CC0CD567CCD707CCDCF8ACD788032
  12847. 63DE3E59CDA981C389783A5FD5CD7180CD83803E643288D6C911F2BACD026E1166D5CD026E3A2C
  12848. D5B7282111EAD921F2BACD6964C3DF7A2166D5CD6964C3DF7A21BEAACD6964C3DF7ACDDB80119A
  12849. D9ED5395BACDA8803E643288D6C9AF322CD511EAD9CD838918E4CD4E80CDB482C3CB78FE442067
  12850. CD347C2821CD3D7C0102007BCD2E7CC2C878CDE378AF3264D53263DE3E59CDA981C389783E25CD
  12851. 9E80C9CD7180CD83803A64D53265D53A63DECD0181C38978AF3264D53263DE4F3A5CD5B7280A4F
  12852. 3E013263DE79328DD63E59CDA981C389783A60D5E603C03E2ECD9E80C9FE462021CD3D7CCD2E7C
  12853. C2C878CDE378AF3264D53263DE3E59CDA981C389783E25CD9E80C9FE5AC2187CCD9E80CD347CC2
  12854. C878CD7180CD83803A63DEFE0120483A8DD6FE4420473A2CD5B7280C11EAD9216BAACD6964C30C
  12855. 7C3AB6AFB72829CD9A85202ACD078A2805CD518A18201156AECD026E3A2CD5B7281411EAD92156
  12856. AECD6964C30C7C1806CD9A85CC8389AF325CD5CD78803263DE3E59CDA981C389783E0102007C66
  12857. 3288D6DD21C1AFCD877CC9AF322CD511EAD9CD838918D5FE58C2C580CD2E7CC0AF3263DE3E59CD
  12858. A981C38978C93A5FD53D18033A5FD5473A62DEB8C93AB6BA473A65D5B8380AD111CBC7CD7262C3
  12859. 89783C3265D5C9ED5B93BAED5395BAAF3299BACDCF8AC9F53A99BAB7C4026EF1C9218DD63A63DE
  12860. B7C84F0600093600118DD6CD026EC3CF8A2ABFAFDD4E02DD460309AFDCBB857CE603474DDD7102
  12861. DD70037CE6FC6F2600CB3DCB3DDD4E00DD460109DD7500DD7401CDC77C21000022BFAF22C9AF22
  12862. CBAFC9F53A2CD5B72846E5D5C52ACBAF7CB52815CD237D11EAD9CD6964C3167D21E1ABCD6964C3
  12863. 167D2AC9AFCD237D11EAD9CD6964C3167D21E6ABCD0102007D6964C3167D21BEAACD6964C3167D
  12864. CDDB80C1D1E1F1C911EAD9CD8389AF322CD5C3117DD5C51193AFD5CD158AEB3600E13E20BE2003
  12865. 2318FAC1D1C9CDCF8A3E05119AD8D5CD2A65C3D461E1225DD53E0132B7AFCD31963A28A8B72009
  12866. 1190A9CD026EC39760225DD5CD4381300BCDCF8A3E13CD538AC39760CDF877AF325FD53264D521
  12867. 00002260D52262D522BFAF3E31325AD53E533288D63299BACD9E80CD0E8B1157ADCD026ECD798F
  12868. C39760CD4E803E31325AD53A59D5325BD5218DD6CDEB783263DE3A60D53262DE3E53CDA981C390
  12869. 78CDB482C39660FE592025CD347CC0CD8B803A63DE218DD6CD2F793A5BD5325AD53E463288D6CD
  12870. 9E80CD8681C3B3780102007EC9FE4EC2C580CD9E80C9CD4E80AF325CD5118DD62172D801FF007E
  12871. FE2F280DFE3A281CFE203818EDA00418EE362EEDA0047EFE203809FE3A2805EDA00418F2ED533F
  12872. D5223BD5783263DEEB36003A5FD53262DE3E46CDA981C39078CDB482C39660FE592029CD347CC0
  12873. CD8B80CDA880CD0B81C3777E180EFEFFC2B3783E5A3288D6CD9E80C93E543288D63299BAC9FE4E
  12874. C2C580CD9E80CD9480C018CD1101BBCD026E1166D5CD026E3A2CD5B7282D11EAD92101BBCD6964
  12875. C3D17E2166D5CD6964C3D17E21BEAACD6964C3D17ECDDB80180AAF322CD511EAD9CD83893E4432
  12876. 88D6C9CD4E80118DD621FED73A48D5B728054F0600EDB03A48D53263DE3A5FD532620102007FDE
  12877. 3E44CDA981C3B3783A60D5E6033E2ECC9E80CDB482C39660FE592045CD347CC0CD8B803A63DEFE
  12878. 0120133A8DD6FE5A2005325CD51807FE582003325CD53A5CD5B72809CD9E803E5A3288D6C9CD0B
  12879. 81C3547FC9FEFFC2B3783E5A3288D6CD9E80C9FE4EC2C580CD9E80CD948028DECDE378C9CD4E80
  12880. CDD0803A5CD5B728223A2CD5B7280C11EAD9216BAACD6964C307803AB6AFB728073E44328DD63E
  12881. 013263DE3E5ACDA981C39078CDB482C39660FE592043CD347CC0CD8B80CD9A85CC83893A5CD5FE
  12882. 5A281FCD4381381ACD8681C3B378AF325CD53E463288D6CD9E80DD21C5AFCD877CC93E423288D6
  12883. CD9E80DD21C5AFCD877CC9FE4EC2C580CD9E80CDE30102008078CD9480C018B0AF322CD511EAD9
  12884. CD8389C3917FCD4E80CDD0803E42CDA981C39078CDB482C39660FE59200DCD347CC0CD8B803E43
  12885. 3288D6C9FE4EC2C580CD9E80CDE378CD9480CA3080B728E3C93AB6BA473A64D5B8380AD111F6C7
  12886. CD7262C3B378B72807F53E25CD9E80F13C3264D5C93CE63F325FD5C93A64D53265D5AF3264D5C9
  12887. 2A60D5232260D5C9CD7180CD8380C378803A5FD53C473A62DEB8C94F3A99BAB7C879C38F6DAF32
  12888. 26D53248D53247D532ADAF32A8AF32A0AF21FFFF22A6AF22B4AFC9FE45C2B378CD5762C3B3783A
  12889. 5FD53262DEAF3263DEC9F5C5E5D52120C6E5CDD689360D233600E1D1CD6964CDF780E1C1F1C9AF
  12890. 32236411EAD9C3830102008189211681CD7D76CA9564C93A26D5B7C0CDDE74C39564ED5B95BACD
  12891. AD89C8CD518A3E58325CD5C9E52A9CAF77233600229CAFE1BFC9E5229CAF212781CD7D76E1C9E9
  12892. C9C5D5E506202172D8E53E20772310FC2A5DD5D1CD6089225DD5F52172D8E51166D5012000EDB0
  12893. 2166D53E03012000EDB12B3600E1119AD9CD6089F13720013FE1D1C1C93EFF3227D5AF3226D532
  12894. 28D5E5119AD92162DA0600CD6E89E12805FE2AC27A62C395643264DE2189D63A53D577233A5AD5
  12895. D631473A63DEC62380772306004F3A62DEC6207723CDAD823A64DE7723CDAD823A63DEB7280B3D
  12896. 3263DE7E23CDAD8218EF3A5AD5FE322828300F79E6C0070781E63FC6207723C32E820102008236
  12897. 00E5218AD6CD1D85E14B427A07070707E60FC620772378E60F070747790707E603B0C620772379
  12898. E63FC62077233A51D577233600233A32D5B72803360023CD4882C39660C395643A4DD54705FA59
  12899. 823A4FD55FCD136E18F33A32D5B7280C1120CDCD026E118AD6CD026E3A2BD5B728211112DA2120
  12900. CDCD6964C388822189D6CD6964C38882180AAF322BD51112DACD83892189D67EB728075FCD136E
  12901. 2318F53A57D5B728045FCD136EC39564814F3E008847C93A4CD5210000B728086F0E1ECD318A65
  12902. 6F22BB9CCD8687CDF183C39660CDC187CDD184C3C882CDE78420F5CDD184C39660CDE78428F532
  12903. 8AD64F3A5AD5D6314779D623903263DE0600CDD18401020083C39660CDE78428D73262DE328BD6
  12904. CDAD823A62DED6203262DECDD184C39660CDE78428BB326ED8328CD632D1AFCDAD823A63DE326F
  12905. D8218DD6223FD53A6FD83DFA5E83326FD8CDD184C39660CDE784288E2A3FD57723223FD5CDAD82
  12906. 18DECD3586C3D482CDD184C39660CDE784CADF82D6203270D83A5AD5FE322841301379E6C00707
  12907. 81E63F473A70D8B82858CDE378C92A3FD53600218AD6CD1D854B427A07070707E60F573A70D8BA
  12908. 20E1CDD184C39660CDE784CADF82D6203270D878E60F070747790707E603B0473A70D8B820BDCD
  12909. D184C39660CDE784CADF82D6204779E63FB820A82A3FD53600233A6ED8C39564218ED72245D5CD
  12910. 346EC349842A45D50102008477232245D5CDF38420ED3600233A32D5B7280C1118CDCD026E118F
  12911. D7CD026E3A2BD5B728151112DA2118CDCD6964C38882218FD7CD6964C38882218ED72245D53A58
  12912. D5CDD985C395643A5CD5FE412005CDEC851864FE42200E3E5A325CD51114ADCD667CC3F783FE46
  12913. 200E3E58325CD5112BADCD667CC3F783FE452022AF325CD5CDC1873E133263DE218EC9118DD64F
  12914. 0600EDB03E45CDA981C39078C39760FE43200AAF325CD5CDC187C39760FE44200F3A32D5EE0132
  12915. 32D5AF325CD5C3F783FE4820081157ADCD026E18EDAF325CD5C92A45D57E232245D5CDF384C295
  12916. 64C9E52153D5BEE1C9E52154D518F7E52151D518F1E52152D518EBE5214FD518E5E50102008521
  12917. 50D518DFE5214BD518D9E5214CD518D3E52155D518CDE52156D518C7E5C51100007EB7CA6085E5
  12918. ABE60F06004F2174850909CD63857BAE5F237AAE57E1E57ECB3FCB3FCB3FCB3FABE60F4F217485
  12919. 0909CD63857BAE5F237AAE57E123C32285C1E1C9CB3ACB1BCB3ACB1BCB3ACB1BCB3ACB1BC90000
  12920. 8110022183310442855206638773088489940AA58BB50CC68DD60EE78FF77E232237D5C9ED5B95
  12921. BA219AD9B7ED52C9E5F52ABFAF237CB53E01CCBB8522BFAF22C9AFF1E1C9E5DD6E00DD66010140
  12922. 0009DD7500DD7401B728072ACBAF0922CBAFE1C900B7C832D885CD346EC349844F3AD885B920F3
  12923. C9119CACCD026E2A60D5CD9A6411B4ACCD026E2A6201020086D5CD9A6411CCACCD026E2ABFAFCD
  12924. 9A6411E4ACCD026E2AC1AFCD9A643E4BCD8F6D11FCACCD026E2AC5AFCD9A643E4BCD8F6DC3CF8A
  12925. C53AD2AF4F3AD1AFB9C1C8C395642187D53A63DECD35811172D80108007EFE2E282EFE20385D79
  12926. FE08200A7ECDD387280D365A18097ECDE28728032318DFEDA078B120D97EFE2E2807FE20383623
  12927. 18F479FE0820043E581213362FEDA00103007EFE20381E79FE03200A7ECDD387280D365A18097E
  12928. CDE28728032318E3EDA078B120DDD5E1363A233A29D577233600E52172D81166D5012000EDB0E1
  12929. 3603223BD52172D8119AD9CD6089280E2A3BD53600119AD9CD026EC3518A219AD90128003E3AED
  12930. B123223BD52B2B22010200873FD53A30D5B72865119AD92162DA0600CD6E89205811A9C8CD7262
  12931. 119AD9CD83892A3FD5119AD9B7E5ED52E12006112EC8C3026E2B223FD52A3FD57EFE4238E13521
  12932. 9AD9E51166D5012000EDB0D12162DA0600CD6E892008119AD9CD838918D82A3BD53600119AD9CD
  12933. 026E3603119AD92162DA0600CD6789CA9564F511E4C7CD7262F1C37A62E5D5C50E002ABB9C7CB5
  12934. 282722B79C0E08CDE489200A11B99CC5CDDD89C118130CFE0B20EC11C2A9CD026E21010022BB9C
  12935. 0E007932C587C1D1E1C9E5D5C50E08CDEB8921000022B79CC1D1E1C9FE41D8FE5B3806FE61D8FE
  12936. 7BD0BFC9FE30D8FE3A30EABFC92118D20600CD0D6EFE80281B1169BACDA6892013770102008823
  12937. 04FE0D280B4F3AD0AFB779C48F6D18E6C91169BACD8389AF3265BA3E1DCD8F6D37C93A65BAB7C2
  12938. EB87FD2A8BBAFDCB126E28092118D2010050C3BA89E5D5783271D8CD238AC2B688FE08200D5F78
  12939. B728F1052B7BCD8F6D18E9FE0D2825FE18200D78B728DD3E08CD8F6D052B18F3FE1B2810FE8120
  12940. 043E1B1808FE802804FE2038C004772003051810FE0D2828FE1B2824FE80282023CD8F6DFE3FC2
  12941. 43883E08CD8F6D2BE5FDE13E20FDBEFF2807783D3E20C48F6D783D2008F5C17EFE3F7820013C47
  12942. 7EFE1B280BCB273807CB3FF610CD8F6DD1E1C93E10C38F6D3E11C38F6D203C2A15C6712C3A17C6
  12943. BD28312215C63A97BA5F2166BA347EBB38223A68BA01020089B7281C79FE132805FE112004AF32
  12944. CFAF3A67BAB720093C3267BA1E13CD136EC9F53A2AD5FE02202FF1F5FE0A20093AD5AFFE0D2822
  12945. 3E0AD532D5AF11C2D9CDAD892813CD518A11C2D9CD838911DDAACD026EAF322AD5D1F1C93E11EF
  12946. 32528AC93E4EEF32528AC93E3AEF32528AC93E3BEF32528AC93E43EF32528AC93E48EF32528AC9
  12947. 3E3CEF32528AC93E49EF32528AC93E05EF32528AC9C5F54F3E0618133E0FEF32528AC93E03EF32
  12948. 528AC9C5F54F3E04EFC132528A78C1C93E09EF32528AC93E64EF32528AC93E4CEF32528AC93E21
  12949. EF32528AC93E13EF32528AC93E1DEF32528AC93E1CEF32528AC93E1EEF32528AC93E20EF32528A
  12950. C93E10EF32528AC90102008A3E65EF32528AC93E39EF32528AC93E60EF32528AC93E61EF32528A
  12951. C93E08EF32528AC93E01EF32528AC93E19EF32528AC93E5BEF32528AC9C5F54F3E02C3B2893E52
  12952. EF32528AC96F26003E16EF32528AC93E00C5F5FD2A8BBAFDCB02B6FDCB02BEFDCB12B6F6C04FCD
  12953. CF8A3E1AC3B289FD21E188ED5B8FBA0E04CD9189110000CD408A204122C98CE5DDE1DD360646DD
  12954. 36074F3E02DD770021C08CDD7501DD7402110000CD408A201D227A8CE5DDE1DD360646DD360749
  12955. 3E01DD770021718CDD7501DD7402C91189ABCD026EC3EE61F53E0DCD8F6DF1C93E06CD2A65C3DD
  12956. 61B7CAD4617AB7201F4BCDCF892019C530061181AACD026E119BAACD026EC179C6300102008B32
  12957. 29D5C397603E20CD538AC39760F53A17C63215C6AF3266BA32CFAF3267BAF1C93E051173AECD2A
  12958. 65C3DD61B7200B3A29D53273AE3E0D3274AECDCF8ACDCF8AFD2A8BBAFD7E1BE60F2167AEFE0228
  12959. 03216BAE116FAE010400D5EDB0E1CD2A8AC397603E05119AD8D5CD2A65C3DD61B72858CDCF8AE1
  12960. 225DD5AF32B7AFCD31963A28A8B72844225DD5CD4381383C1172D80600218DD6CD6E892809FE2A
  12961. 2805CD518A1826219AD90120003E03EDB12B360011B3AACD026E119AD9CD026ECDCF8A1172D8CD
  12962. 078A28C118D5C39760CD008AFD7E0AE6F8FD770A062ECDF989FD7E0AE607C01169BA21BD9C010B
  12963. 00EDB01169BA2115C30600CD6E892803FE2AC03E010102008C3265BAC93A34D5FE20300AF5113C
  12964. C9CD026EF1F640CD8F6DC93E0FCD8F6D2100260606CD9F89210EBB0605CD9F89210026110EBB01
  12965. 8007EDB03E0ECD8F6DC9CD198C0604CD9F892210C32A0EC30603CD9F893E0ECD8F6DC9CD198C06
  12966. 04CD9F89220EC32A10C30603CD9F893E0ECD8F6DC9180CC08C04494E50240000000000CD126C28
  12967. 14CD0D6EB728F5FE8020043E1CB7C95FCD136E18E74F3A68BAB7200979FE1128DBFE1328D73A7E
  12968. 8CFE0D79200E3A31D5B7792007FE0A327E8C28C1BFC9180BD38C044F5554240000000059CD136E
  12969. 79BFC93E01116BCFCD2A65C3D4614FCDCF8A060021EF8C093E4732BCAFE9C39C8EC3568EC34C8E
  12970. C3608EC36A8EC3200102008D8FC37E8EC3928EC3A68EC3888EC3B08EC3BA8EC3C48EC3D08EC3DC
  12971. 8EC3E88EC3F48EC3008FC30C8FC3748EC3168F1187D5060032B7BAFE4A2804FE56200479121304
  12972. 0E00ED53B8AFED43BAAFCD528F3E31325AD5AF3262DE3E493288D6CDF8772100002260D52262D5
  12973. AF3299BA325FD53264D5325CD5CD0E8BCD798FC39760CD4E803A5FD53262DE21FED7118DD63ABC
  12974. AFFE432801133AB8BAB728054F0600EDB04F3ABCAFFE4328093AB7BA328DD60C3E47F5793263DE
  12975. 3E31325AD53A59D5325BD5F1CDA981C39078CDB482C39660FE5320263A63DE218DD6CD2F79218D
  12976. D6CDEB783263DE3E59CDA981C390783A5BD5325AD53E663288D6C9FE58201ACD567C0102008ECD
  12977. 707CCD8B803263DE3E59CDA981C390783E643288D6C9FE59200CCDCF8ACD707C3E433288D6C9FE
  12978. 4EC8FE452009CD5762CDCF8AC397601141ADCD026EAF3263DE3E45CDA981C39078C397603E0132
  12979. BDAF3E44C32E8D3E0132BDAF3E45C32E8D3E0132BDAF3E55C32E8D3E0132BDAF3E48C32E8D3E02
  12980. 32BDAF3E50C32E8D3E0132BDAF3E50C32E8D3E0132BDAF3E54C32E8D3E0232BDAF3E57C32E8D3E
  12981. 0232BDAF3E43C32E8D3E0232BDAF3E52C32E8D3E0232BDAF3E4BC32E8D3E0232BDAF3E4DC32E8D
  12982. 0E533E0232BDAF3E56C32E8D0E513E0232BDAF3E56C32E8D0E633E0132BDAF3E4AC32E8D0E733E
  12983. 0132BDAF3E4AC32E8D0E2B3E0132BDAF3E4AC32E8D0102008F0E2D3E0132BDAF3E4AC32E8D3E03
  12984. 32BDAF3E6CC32E8D3E0132BDAF3E51C32E8D11FED73E05CD2A65C3D4613271D83E04CD2A65C3DD
  12985. 613A71D832B8BA4F060021FED70936003E0132BDAF3E4332BCAFC34F8D3E05118DD6CD2A65C3D4
  12986. 61CD9290C3708F2187D5CDC8743A48D532B8BAC9117AACCD026EC397603A88D6FE442006CDE17E
  12987. C3798FFE462006CD0A7EC3798FFE542006CD9C7EC3798FFE5A2006CD737FC3798FFE532006CDAD
  12988. 7DC3798FFE422006CD1480C3798FFE432006CDD977C3798FFE412006CDF377C3798FFE642006CD
  12989. EB7AC3798FFE662006CDBD79C3798FFE742006CD9C7AC3798FFE522006CD0678C3798FFE722006
  12990. CD1678C3798FFE47010200902006CD7F8DC3798FFE492006CD1890C3798FCDF377C39760CD4E80
  12991. 3E31325AD53A59D5325BD5218DD6CDEB783263DE3A5FD53262DE3E49CDA981C39078CDB482C396
  12992. 60FE59C26490CD347CC0CD8B803A63DE218DD6CD2F793A5BD5325AD53E473288D6C9FE4E2004CD
  12993. E378C9FE45C290783E503249D5AF324DD5324FD53E0D3251D53E31325AD53E233255D53E473288
  12994. D6C9218DD6ED5BB8AFED4BBAAFD5C5133ABDAF47F132BDAF7EFE20202123BE28FC10060412130C
  12995. 18EF79C620E377E1D5130E003ABDAF3C32BDAF20DCD1C9380F0CEDA00C3ABDAF3C32BDAF20CBD1
  12996. C9E179C62077AF123ABDAF32B8BAB7CA95643CFE5CF032B8BAC395642AFCB97EB7280102009106
  12997. 2322FCB9BFC921FEB922FCB9CDD86DC03202BACD6591B420E33A02BABFC92203BA3205BAF57832
  12998. 01BAF1CD6591B4C47B913A01BAB7C821FBB9ED5BFAB1B7ED524F0600B7ED42300711BAABCD026E
  12999. C92A03BAD5EDB0EB36002322FAB1D12A06BA732372C921F8AF4F0600CB01300104CB81092206BA
  13000. 7E23666FC92A06BA5EAF77235677ED5308BA626BEDB1E5B7ED52220ABA2AFAB1C1B7ED42C5E5C1
  13001. E178B12802EDB0ED53FAB121F8AF0600C54E23462B78B1281CE52A08BAB7ED42F2D1916069ED4B
  13002. 0ABAB7ED424D44E17123701802E12323C110D6C93E05118DD6ED53CDAFCD2A65C3DD613E0132D3
  13003. 9DCD1D96206DCDD994C293945F3ACB9DB72806AF3201020092CB9D18E8CD136E3A2AD5B77BC420
  13004. 89FE2038D93ACF9DB728D37BF5CD126C2817CD0D6EB728F5FE80CA7694FE1BCA7F94FE81CA7F94
  13005. 18E45F3AD4AFB77BC49E6D3A2AD5B77BC42089CD3C945FF1CD3C94BB28997BFE2038941166A8C3
  13006. 6E94AF32D39DC397603E05118DD6ED53CDAFCD2A65C3DD613E0132D49D21019A0600CD1D96C2A5
  13007. 92CDD994C293945F3ACB9DB72806AF32CB9D18E773230420E2119CA8CD026EC3BE943600783201
  13008. 9BAF0E01CD649416024A3A019BB9FAE2924A0DCD55945F1C1D28144BCD5094474A0DCD5094B828
  13009. 074BCD55945F18E87B3C4ACD64941418D11E003ACA9DB728404FAF32CA9D7932CC9D4F3AD3AFB7
  13010. 280479CD9E6D3A2A01020093D5B779C420891C1C1D28194B0DCD5094CD3C944F3ACC9DCD3C94B9
  13011. 28074BCD55945F18E33A019BBB2822CD126C28C1CD0D6EB728F5FE80CA7694FE1BCA7F94FE81CA
  13012. 7F94D55FCD136ED118DEAF32D49DC397603E05118DD6ED53CDAFCD2A65C3DD613E0132D59D2104
  13013. 9B22029BCD1D96C28A93CDD994C293945F3ACB9DB72806AF32CB9D18E7732318E37723360001B8
  13014. 0BCD126C2849C5CD0D6EB7281DFE80C1CA7694FE1BCA7F94FE81CA7F94C55FCD136E3A2AD5B77B
  13015. C42089C10B78B120D121049B7EFE0D2006237E2BB728C023E55FCD136E3A2AD5B77BC42089E118
  13016. E432CA9DAF32D59DC397603E06CD2A65C3DD61B720031101006B620E1ECD318A656F0102009422
  13017. B79C0E08CDE4892014FD2A8BBAFD7E0AE6F8FD770A11B59CCDDD8918140CFE0B20E211EAA9CD02
  13018. 6E01FFFFCDF989C397602AB79C7CB520F9C39760F53ACD9DB7280BF1FE61F8FE7BF0E65F1801F1
  13019. C921019A1803210199C50600097EC1C921019A1803210199C506000977C1C9CD026E1803CD518A
  13020. 11B9A8CD026EC3BE94118EA8CD026E2A1AD336001118D2CD026EC397603AD19DB7280811CEA8CD
  13021. 026E181D3AD29DB7280811EEA8CD026E180F3AD69DB7CA9760110EA9CD026E18003AD09DB7CA97
  13022. 603A65BAB7CA97601169BACD8389AF3265BAC39760E5C5D5FE5C2041AF473C32D19DCD1D96C2D6
  13023. 95FE30FA1895FE3AF21895FE30FA0F95FE3AF20F9501020095D630CB20CB20CB208047CD1D9628
  13024. E72ACDAF2B22CDAF7778F5AF32D19DF1C3D595FE5E20163E0132D29DCD1D96C2D695D640F5AF32
  13025. D29DF1C3D595FE3CC2D5953E0132D69D21A99CCD1D96C2D695FE3E2807CD4494772318EF36FF21
  13026. 049C462311A99C1ABE2022237E13FE303806FE5B300218EF4F1AFEFF200F79FEFACAA395F5AF32
  13027. D69DF1C3D5954F7EFE2A20067932AF9C18D23EFEC5010000EDB1C110C0C3DA953AAF9CD6306F26
  13028. 000E1ECD318A656F22B79CFD2A8BBAFD7E0AE6F8FD770A0E0811B59CCDDD892AB79C7CB520F93E
  13029. 0132CB9DBFD1C1E1C9114AA8CD026EAF3C18F2E5F5FDE5FD2A8BBA2AB79C2B22B79C7CB5200CFD
  13030. CB0A86FDE1F1E1CD01020096F289C9FDCB0A46280F21000022B79C26322B7CB520FB18DFFDE1F1
  13031. E1C9E52ACDAF7E2322CDAFFE0D2803BFE1C9FE0EE1C922D79D2126A02226A8AF3228A82AD79D01
  13032. 0000ED4346A8ED4348A8AF3242A83239A83E20BE20032318FA1131A8CD598928091141AACD026E
  13033. C397603A39A8E6A020F03A42A8E6A020E93E20BE20032318FA062011269F7EFE213808CD449412
  13034. 132310F3AF127EFE213007FE0D28032318F422D79D3E209032039FCAA6973E0132049F1BEB7EFE
  13035. 2F2002360021269F3A039F4F0600092B0D281B2B0D28177EFE3A20123600237E21039F3535D630
  13036. 4FAF32049F1802AF4FC5CDCF89C294972129A811059F010800EDB0C1C579C630320D010200979F
  13037. 32E29D3E0D320E9F21E39D060011059FCD6E89C2AF9711059FCD7C89CD7C8921E39D11059FCD75
  13038. 89C27B97060821E39DC5CB66283CCB7E20383A46A8B72004CB76202E3A48A8B72004CB5E202411
  13039. 269F3E0132D99DCDE8982804AF32D99DCDBA97200ECD70983AD99DB72005C1C1C33E9601200009
  13040. C110B818A5FE1C280CCD518A11059FCD8389C3976011059FCD8389C2B497C10C3E08B9CA3E963A
  13041. 049FB7C2E796C33E962A26A8360D2126A0C9CD518A18E0CD518AC39760C5E5D50105000911E39E
  13042. 01300B7E23FE20280C2B78FE0320043E2F1213EDA010ECAF12D1D521E39E7EB7287F1AB7287BED
  13043. 53DA9D22DC9D21000022DE9D22E09D2ADC9D7EB7280102009813ED5BDA9D1ABE200B2313ED53DA
  13044. 9D22DC9D18E67EB7200DED5BDA9D1AB72005BFD1E1C1C9ED5BDA9D1AFE24200B231322DC9DED53
  13045. DA9D1834FE2A200E13ED53DA9DED53DE9D22E09D18222AE09D7CB528137EB7280F2322DC9D22E0
  13046. 9D2ADE9D22DA9D18083E01FE00D1E1C1C9C3FA97D5E5C521E39EED5B26A8D57EB72817EDA0E5D5
  13047. E10126A8B7ED42E120EE11A2A9CD026EC39760D5E10122A8B7ED42200911A2A9CD026EC397603E
  13048. 3A12133AE29D12133E2012133E0012ED5326A82128A87EF534B7200C3AB7AFB728061180A9CD02
  13049. 6EF1FEFF28C9D13AB7AFB72806CD026ECDCF8AC1E1D1C9E5D5EB7EB7280BFE24280BFE2A280723
  13050. 18F13CD1E1C9BF1801030099FA0105019B00000001A7049C2341434B06FE42454C07FE425308FE
  13051. 43414E18FE43520DFE44433111FE44433212FE44433313FE44433414FE44454C7FFE444C4510FE
  13052. 444C592AFAFE454D19FE454E5105FE454F5404FE4553431BFE45544217FE4553431BFE46460CFE
  13053. 46531CFE47531DFE485409FE4C460AFE4E414B15FE4E554C00FE52531EFE53490FFE534F0EFE53
  13054. 4F4801FE53504120FE53545802FE5355421AFE53594E16FE56531FFE56541FFE000115B59CE495
  13055. 0000776E00004B45524D49542F494E490D011BCA9D000000000000010000000000000000000000
  13056. 000000000000300125039F00004449522F5359533A300D00000000000000000000000000000000
  13057. 00000000000000010226A826A0004449522F5359533A805653595354454D0046A855494E564953
  13058. 0048A800000000000D42616420636F646520696E73696465206F66203C2E2E2E3E2773000D486F
  13059. 737420646964206E6F74206563686F206C617374206368617261637465722073656E740D000D49
  13060. 676E6F72696E67203D3E20000D537472696E6720746F6F2062696720666F722062756666657221
  13061. 0D000D4F7065726174696F6E2061626F72746564210D000D4D697373696E672063686172616374
  13062. 657220666F6C6C6F77696E67205C0D000D4D697373696E672063686172616374657220666F6C6C
  13063. 6F77696E67205E0D000D4D697373696E67203E20696E203C2E2E2E3E2073657175010226A9656E
  13064. 63650D000D10456E7465722061207465787420737472696E67110D000D10456E74657220612066
  13065. 696C652073706563696669636174696F6E21110D000D10456E746572206120446563696D616C20
  13066. 6E756D62657221110D0053656E64696E672066696C65733A0D00104E6F2066696C657320666F75
  13067. 6E64110D0010546F6F206D616E792066696C65732C206F7574206F66207370616365110D000D10
  13068. 4E6F207461736B20736C6F747320617661696C61626C6520666F722074696D656F7574110D000D
  13069. 104E6F207461736B20736C6F747320617661696C61626C6520666F722064656C61792C20757369
  13070. 6E672031207365636F6E64110D000D1043616E27010226AA74206D6F7665204C4F572420746F20
  13071. 6E65772076616C7565110D000D42616420706172616D65746572206C6973740D005472616E7361
  13072. 6374696F6E2061626F727465640D005472616E73616374696F6E2063616E63656C65640D000D44
  13073. 726976652069732077726974652070726F746563746564000D44656661756C7420647269766520
  13074. 6368616E6765640D0052656D6F76696E673A200020202054696D653A20004C6F672066696C6520
  13075. 492F4F206572726F722E20204C6F672066696C6520434C4F534544210D0020202020000D545253
  13076. 2D3830204D6F64656C203428702920545253444F5320362E32202D204B45524D4954202D205665
  13077. 7273696F6E2035010226AB2E320D427920477265676720576F6E6465726C790D0D547970652061
  13078. 203F20666F722068656C7020617420616E792074696D652E2E2E2E0D000D4E6F202A434C204443
  13079. 42210D000D4E6F202A534F20444342210D000D4E6F202A534920444342210D000D43616E206E6F
  13080. 742066696E6420612044434220666F7220746865202A4649206F72202A464F2064657669636573
  13081. 210D000D4E6F7420656E6F756768207370616365206C65667420666F7220646566696E6974696F
  13082. 6E0D004B202B2000206279746573207472616E7366657265642E000D5072657373206B65797374
  13083. 726F6B6520796F75206465736972653A20000D456E74657220646566696E697469010226AC6F6E
  13084. 20737472696E672C20656E642077697468203C425245414B3E2028323535206368617261637465
  13085. 7273204D4158290D000D52656D61696E696E67206B657920646566696E6974696F6E2073706163
  13086. 653A20000D537472696E6720746F6F206C6F6E6720666F72206F6E65207061636B6574210D000D
  13087. 4E756D626572206F66207061636B65747320203D3E20000D4E756D626572206F66207265747269
  13088. 657320203D3E20000D4279746573207472616E7366657265642020203D3E20000D4B6279746573
  13089. 207265636569766564202020203D3E20000D4B6279746573207472616E736D6974746564203D3E
  13090. 200020105B43616E63656C6C696E672062617463010226AD685D11200020105B43616E63656C6C
  13091. 696E672066696C655D1120000D556E6B6E6F776E207061636B657420747970650D000D20202020
  13092. 204354524C2D46203D3E2043616E63656C2066696C652020202020202020202020204354524C2D
  13093. 42203D3E2043616E63656C2042617463680D20202020204354524C2D43203D3E20517569742070
  13094. 726F746F636F6C202020202020202020204354524C2D41203D3E205472616E7366657220737461
  13095. 7475730D20202020204354524C2D44203D3E20546F67676C6520646562756767696E6720202020
  13096. 2020204354524C2D48203D3E2054686973206D6573736167650D20202020204354524C2D45203D
  13097. 3E2053656E6420014B26AE6572726F722C207175697420202020202020454E54455220203D3E20
  13098. 526573656E64206C617374207061636B65740D000720105B4469736361726465645D1120004341
  13099. 542044495220012273AF5452414E532F4C4F470D53455353494F4E2F4C4F470D44454255472F4C
  13100. 4F470D011699AF00000000000000000000004E000000007E0126230102B4AF0000000100000000
  13101. 0000000000000000000000000000000000000000000000000000000102030405060718091A0B0C
  13102. 1D0000101112131415161718191A1B1C1D1E1F2021000000000000000000000000000000000000
  13103. 000000000000000000000000000000000000000000000000000000000000000000000000000000
  13104. 000000000000000000000000000000000000000000000000000000000000000000000000000000
  13105. 000000000000000000000000000000000000000000000000000000000000000000000000000000
  13106. 000000000000000000000000000000000000000000000000000000000000000000000000000000
  13107. 00000000000000000000000000000102B4B0000000000000000000000000000000000000000000
  13108. 000000000000000000000000000000000000000000000000000000000000000000000000000000
  13109. 000000000000000000000000000000000000000000000000000000000000000000000000000000
  13110. 000000000000000000000000000000000000000000000000000000000000000000000000000000
  13111. 000000000000000000000000000000000000000000000000000000000000000000000000000000
  13112. 000000000000000000000000000000000000000000000000000000000000000000000000000000
  13113. 000000000000000000000000000000000000000000000000000000000000000000000000000000
  13114. 00014AB4B100000000000000000000000000000000000000000000000000000000000000000000
  13115. 000000000000000000000000000000000000000000000000000000000000000000000000FCB101
  13116. 43FCB9FEB90000000000000000000000000000000000000D56616C7565206F7574206F66207261
  13117. 6E676521210D000D4E6F20646566696E6974696F6E2065786973747300010665BA000000010187
  13118. 89BA0000000000010000000000000000B4500108204F6E65206F662074686520666F6C6C6F7769
  13119. 6E672E2E2E0D000007000000000D104C6F6766696C6520697320616C7265616479204F50454E21
  13120. 110D000D104C6F6766696C65206973206E6F74204F50454E21110D00000D526563656976696E67
  13121. 203D3E20000D53656E64696E67203D3E200001090EC300000000000030010D15C615C515C55345
  13122. 54434F4D20010220C70E10114B45524D495420342870293E000D000D10556E7265636F676E697A
  13123. 656420636F6D6D616E64110D000D10496C6C6567616C20636861726163746572110D000D104E6F
  13124. 7420636F6E6669726D6564110D00556E61626C6520746F207265636569766520696E6974696174
  13125. 650D00556E61626C6520746F20726563656976652066696C65206E616D650D00556E61626C6520
  13126. 746F207265636569766520656E64206F662066696C650D00556E61626C6520746F207265636569
  13127. 766520646174610D000D53797374656D20444F53206572726F720D004E6F2061636B6E6F776C65
  13128. 6467656D656E742066726F6D2074686520686F73740D000D556E61626C6520010220C8746F2066
  13129. 696E642066696C650D00556E61626C6520746F2072656E616D652066696C65000D556E61626C65
  13130. 20746F2074656C6C20686F73742074686174207468652073657373696F6E2069732066696E6973
  13131. 686564000D556E61626C6520746F2074656C6C20686F737420746F206C6F676F757400070D436F
  13132. 6D706C6574656400074661696C65640052656E616D696E672066696C65203D3E20000D3C436C6F
  13133. 73696E6720746865206C6F672066696C653E000D3C436F6E6E656374656420746F2072656D6F74
  13134. 6520686F73742C207479706520004320746F2072657475726E3E0D3C434C4541523E2069732043
  13135. 6F6E74726F6C2D5F0D000D3C436F6E6E6563010220C974696F6E20636C6F7365642C206261636B
  13136. 206174206D6963726F3E00436F6E74726F6C2D00070D496E746572727570746564000D46696C65
  13137. 204B494C4C4544000D10436F6E6669726D2077697468203C454E5445523E2C2063616E63656C20
  13138. 77697468203C425245414B3E110D005472616E736665722061626F727465642E2E2E0D54797065
  13139. 20746865206E657720657363617065206368617261637465723A2000100D110D0D202020203F20
  13140. 3D202054686973206D6573736167650D2020202030203D2020287A65726F29205472616E736D69
  13141. 742061204E554C4C0D2020202042203D202053656E64206D6F64656D20627265616B0D20202020
  13142. 43203D2020010220CA436C6F73652074686520636F6E6E656374696F6E0D2020202051203D2020
  13143. 51756974206C6F6767696E672073657373696F6E0D2020202052203D2020526573756D65206C6F
  13144. 6767696E672073657373696F6E0D0D547970652074686520657363617065206368617261637465
  13145. 7220616761696E20746F2073656E6420697420746F2074686520686F73742E100D110020202020
  13146. 202020202020202020202020202020202020201053656E6411202010526563656976651120207C
  13147. 20200010496E7075742073657474696E6773112020202020202020202020202020202020202020
  13148. 202020207C202000104F75747075742073657474696E677311202020202020010220CB20202020
  13149. 202020202020202020202020207C2020002020202020207C202000104F4E1100104F4646110010
  13150. 584F4E2D584F46461100104E4F4E45110010415343494911001042494E41525911001044554D42
  13151. 110010444953434152441100104B454550110042656C6C3A20005072696E7465723A2000446562
  13152. 756767696E673A200046696C6520747970653A20004C6F63616C206563686F3A20004573636170
  13153. 6520636861723A200046696C65207761726E696E673A2000466C6F7720636F6E74726F6C3A2000
  13154. 44656661756C742064726976653A2000456D756C6174696F6E20747970653A200046696C652064
  13155. 6973706F736974696F6E3A2000426C6F636B010220CC20636865636B20747970653A2000446973
  13156. 706C61792054414B452066696C653A20004569676874206269742071756F74696E673A2000456E
  13157. 642D6F662D6C696E653A2020005475726E2061726F756E643A2020005061642063686172616374
  13158. 65723A202000436F6E74726F6C2071756F74653A20200054696D65206F75742076616C75653A20
  13159. 200050616464696E67204C656E6774683A20200053746172742D6F662D7061636B65743A202000
  13160. 446973706C617920696E7075743A20200049676E6F726520636173653A202000446973706C6179
  13161. 206F75747075743A2020004D61746368206563686F3A2020002D63686172616374657200525061
  13162. 636B3D3E00010220CD535061636B3D3E001C1F001E090103425945002121000143000606010543
  13163. 4C454152003F3F0105434C4F53450042420107434F4E4E45435400060601034449520024240001
  13164. 4500030301044543484F004545010445584954000303010646494E495348001B1B010347455400
  13165. 0C0C0105494E50555400333301044B494C4C00272700014C002A2A01054C4F43414C002A2A0103
  13166. 4C4F4700090901064C4F474F5554001E1E01064F55545055540036360105504155534500393901
  13167. 0550554C5345003C3C000152000C0C010752454345495645000C0C010652454D4F544500000000
  13168. 0153000F0F010453454E44000F0F01035345540012120106534554434F4D00010220CE2D2D0104
  13169. 53484F570015150106535441545553001818010454414B4500303012130103414C4C0011130104
  13170. 42454C4C001B1B0110424C4F434B2D434845434B2D54595045000C0C0109444542554747494E47
  13171. 001515010C44454641554C542D4449534B001818011145494748542D4249542D51554F54494E47
  13172. 0006060109454D554C4154494F4E000F0F0106455343415045000000010446494C45000909010C
  13173. 464C4F572D434F4E54524F4C0027270105494E50555400292901034B4559002424010A4C4F4341
  13174. 4C2D4543484F00030301064F5554505554002D2D01075052494E54455200121201075245434549
  13175. 5645001E1E010453454E44002121010C5441010220CF4B452D444953504C4159003030030D010B
  13176. 444953504F534954494F4E00000001045459504500030301075741524E494E4700060602090107
  13177. 4449534341524400010101044B45455000000015100109434C4F53452D4C4F47002A2A0104434F
  13178. 5059001E1E0103435744000000010644454C455445000303010344495200060601044449534B00
  13179. 0909010448454C50000C0C0104484F5354000F0F01064B45524D495400121201054C4F47494E00
  13180. 363601074D455353414745002121010750524F4752414D003939010E51554552592D5641524941
  13181. 424C45002727010652454E414D45001818010853454E442D4C4F47002D2D010D5345525645522D
  13182. 5354415455010220D053003C3C010C5345542D5641524941424C45002424010953544152542D4C
  13183. 4F47003030010853544F502D4C4F47003333010454595045001B1B010357484F00151502060104
  13184. 44554D4200030301044E4F4E45000000030D01054445425547000101010753455353494F4E0000
  13185. 00010B5452414E53414354494F4E000202020C010A494E5055542D504F52540000000106534352
  13186. 45454E000303020A01044E4F4E450000000108584F4E2D584F46460001010711010B454E442D4F
  13187. 462D4C494E45000C0C01085041442D43484152000000010750414444494E47000303010F51554F
  13188. 54452D434841524143544552000F0F010F53544152542D4F462D5041434B4501FA20D154000606
  13189. 010854494D452D4F555400090901095455524E2D43484152001212020B0109484F53542D454348
  13190. 4F0000000107444953504C4159000303020D010B434153452D49474E4F52450000000107444953
  13191. 504C41590003030208010642494E41525900010101054153434949000000030801013100313101
  13192. 0132003232010133003333040500024E4F00000001024F4E00010101034F464600000000035945
  13193. 530001010D50726F6772616D206572726F722C20496E76616C696420434F4D4E442063616C6C00
  13194. 0D416D626967756F7573000D496C6C6567616C20696E7075742066696C6573706563000D000000
  13195. 00000000000000000000010E18D3000000000000000000000000014424D5000000000030000000
  13196. 000000000000001F00000000000000000000000062DB000000000000205E0F0A000000000D0D01
  13197. 0123230000313131009AD800000000000000010388D60001066ED8000000000202006000000000
  13198. 000000000000000000000000000000000000000000000000000000000000000000000000000000
  13199. 000000000000000000000000000000000000000000000000000000000000000000000000000000
  13200. 000000000000000000000000000000000000000000000000000000000000000000000000000000
  13201. 000000000000000000000000000000000000000000000000000000
  13202. ***** 854 *****
  13203. <<< m4mit.hlp >>>
  13204.         TRS-80 Model 4(p) KERMIT version 5.2 for TRSDOS 6.x, January 1986:
  13205.         
  13206.         An advanced Kermit derived from TRS-80 Kermit, which was in turn
  13207.         derived from CP/M-80 Kermit.  Sum bugs have been fixed, as well
  13208.         as the addition of wild cards in the SEND command.  The SET
  13209.         command was modified with regard to the FILE-TYPE, and
  13210.         FILE-DISPOSITION options.  These have become sub commands to a new
  13211.         SET FILE command.  The equivalent functions are now accessed via
  13212.         SET FILE TYPE, and SET FILE DISPOSITION.
  13213.         
  13214.         The following files are provided in the Kermit distribution:
  13215.         
  13216.         Assembler source, consisting of the following modules:
  13217.         
  13218.                     M4ADD.ASM       M4H191.ASM
  13219.                     M4KEY.ASM       M4MIT.ASM  
  13220.                     M4SEND.ASM      M4STR.ASM
  13221.                     M4CMD.ASM       M4H192.ASM 
  13222.                     M4LOG.ASM       M4PKT.ASM  
  13223.                     M4SET.ASM       M4TERM.ASM
  13224.                     M4GET.ASM       M4H19S.ASM
  13225.                     M4MAC.ASM       M4RMT.ASM
  13226.                     M4SHOW.ASM      M4WILD.ASM
  13227.                                     M4XFER.ASM
  13228.         
  13229.         Documentation:
  13230.         
  13231.         M4MIT.HEX    --   Hexified object module for KERMIT executable
  13232.         M4H19.HEX    --   Hexified object module for H19 filter
  13233.         M4H19S.HEX   --   Hexified object module for SETH19 program
  13234.         M4MIT.NR     --   Nroff source for M4MIT.DOC
  13235.         M4MIT.DOC    --   Documentation
  13236.         M4MIT.HLP    --   This file
  13237.         M4BOO.BAS    --   Basic program for converting the hex files to
  13238.                           runnable programs
  13239.          
  13240.         
  13241.         Here is a list of all of the command line commands that are currently
  13242.         functional:
  13243.         
  13244.                       BYE
  13245.                       CLEAR
  13246.                            INPUT-PORT
  13247.                            SCREEN
  13248.                       CLOSE
  13249.                            SESSION-LOG
  13250.                       CONNECT
  13251.                       DIR partspec
  13252.                       EXIT
  13253.                       FINISH
  13254.                       GET filespec
  13255.                       INPUT control string
  13256.                       KILL filespec
  13257.                       LOCAL TRSDOS command
  13258.                       LOG filespec
  13259.                       LOGOUT
  13260.                       OUTPUT control string
  13261.                       PAUSE number of seconds
  13262.                       PULSE control string
  13263.                       REMOTE command
  13264.                            CLOSE-LOG
  13265.                            COPY
  13266.                            CWD
  13267.                            DELETE
  13268.                            DIR
  13269.                            DISK
  13270.                            HELP
  13271.                            HOST
  13272.                            KERMIT
  13273.                            LOGIN
  13274.                            MESSAGE
  13275.                            PROGRAM
  13276.                            QUERY-VARIABLE
  13277.                            RENAME
  13278.                            SEND-LOG
  13279.                            SET-VARIABLE
  13280.                            START-LOG
  13281.                            STOP-LOG
  13282.                            TYPE
  13283.                            WHO
  13284.                       SEND filespec(s)
  13285.                       SET parameter [value(s)] ...
  13286.                            BELL ON (or OFF)
  13287.                            BLOCK-CHECK-TYPE
  13288.                                 1
  13289.                                 2
  13290.                                 3
  13291.                            DEBUGGING OFF (or ON)
  13292.                            DEFAULT-DISK (drive number)
  13293.                            EIGHT-BIT-QUOTING ON (or OFF)
  13294.                            EMULATION NONE (or DUMB)
  13295.                            ESCAPE
  13296.                            FILE
  13297.                                 DISPOSITION KEEP (or DISCARD)
  13298.                                 TYPE (ASCII or BINARY)
  13299.                            FLOW-CONTROL XON/XOFF (or NONE)
  13300.                            INPUT
  13301.                                 CASE-IGNORE OFF (or ON)
  13302.                                 DISPLAY OFF (or ON)
  13303.                            KEY <key value> string
  13304.                            LOCAL-ECHO OFF (or ON)
  13305.                            OUTPUT
  13306.                                 HOST-ECHO ON (or OFF)
  13307.                                 DISPLAY OFF (or ON)
  13308.                            PRINTER OFF (or ON)
  13309.                            RECEIVE
  13310.                                 END-OF-LINE ascii code
  13311.                                 PAD-CHAR ascii code
  13312.                                 PADDING decimal number
  13313.                                 QUOTE-CHARACTER ascii code
  13314.                                 START-OF-PACKET ascii code
  13315.                                 TIME-OUT decimal number
  13316.                                 TURN-CHAR
  13317.                            SEND
  13318.                                 END-OF-LINE ascii code
  13319.                                 PAD-CHAR ascii code
  13320.                                 PADDING decimal number
  13321.                                 QUOTE-CHARACTER ascii code
  13322.                                 START-OF-PACKET ascii code
  13323.                                 TIME-OUT decimal number
  13324.                                 TURN-CHAR
  13325.                            TAKE-DISPLAY OFF (or ON)
  13326.                            WARNING ON (or OFF)
  13327.                       SETCOM
  13328.                       SHOW
  13329.                       STATUS
  13330.                       TAKE filespec
  13331. <<< m4mit.nr >>>
  13332. .po 13
  13333. .na
  13334. .nh
  13335. .LP
  13336. .ND
  13337. .NP
  13338. .tl ''\fITRS-80 Model 4(p) KERMIT:   Version 5.2\fR''
  13339. .sp
  13340. .tl ''\fIFor Use Under TRSDOS 6.1 or Later\fR''
  13341. .sp 2
  13342. .IP \fIProgram\ by:\fR 19
  13343. Gregg Wonderly Oklahoma State University, (gregg@okstate) 
  13344. rewritten from the original Model-4 KERMIT which was derived
  13345. from the TRS-80 KERMIT done by Stan Barber, Rice University who
  13346. modified the CP/M-80 version by Bill Catchings and others.
  13347. .IP \fILanguage:\fR 19
  13348. Z80 Assembler, compatible with M80 and EDAS from Misosys
  13349. .IP \fIVersion:\fR 19
  13350. 5.2
  13351. .IP \fIDate:\fR 19
  13352. Wed Oct 22 10:17:07 CDT 1986
  13353. .IP \fIDocumentation\ by:\fR 19
  13354. Gregg Wonderly
  13355. .sp 2
  13356. .NH
  13357. Summary of TRSDOS 6.1
  13358. .sp
  13359. .PP
  13360. \fITRSDOS\fR (The Radio Shack Disk Operating System)
  13361. has a large library of built
  13362. in commands dealing with files, directory maintenance, device I/O, etc.
  13363. Programs are also used for some functions on some \fITRSDOS\fR-based DOS's.
  13364. Model 4(p) KERMIT gives you access to all of the library
  13365. commands of \fITRSDOS\fR versions 6.x via the LOCAL command.
  13366. Issue the \fILIBRARY\fR command at \fITRSDOS Ready\fR to obtain a list.
  13367. .PP
  13368. \fITRSDOS\fR file specifications can be represented as a sequence of
  13369. characters of the form
  13370. .RS
  13371. .sp
  13372. FILESPEC/EXT.PASSWORD:D
  13373. .sp
  13374. .RE
  13375. .IP \fIFILESPEC\fR 11
  13376. is the filename up to eight characters.
  13377. .IP \fIEXT\fR
  13378. is the file type, up to three characters.
  13379. .IP \fIPASSWORD\fR
  13380. is the password for that file, up to eight characters.
  13381. .IP \fID\fR
  13382. is a numerical drive specification (0-7).
  13383. .PP
  13384. File names, file types and passwords may contain letters and numbers, but the 
  13385. first character in each must be a letter.  No special characters or spaces are 
  13386. allowed.  All fields are optional except the filespec.  Any field added must be 
  13387. preceded by its special delimiter '/' for file type, '.' for passwords
  13388. and ':' for drive specifications.  Upper and lower case characters are
  13389. equivalent.
  13390. .NH
  13391. TRSDOS Commands of Interest
  13392. .sp
  13393. .NH 2
  13394. CAT PARTSPEC:D (OTHER OPTIONS)
  13395. .sp
  13396. .RS
  13397. This command is specific to \fITRSDOS\fR version
  13398. 6.2 and later.  It displays only
  13399. the names of visible files on the drive specified, or all drives if
  13400. no \fIpartspec\fR is given.  \fI(other options)\fR allows different formats
  13401. and invisible as well as system files to be selected.  See the \fITRSDOS\fR
  13402. manual for specifics
  13403. .RE
  13404. .NH 2
  13405. DIR PARTSPEC:D (OTHER OPTIONS)
  13406. .sp
  13407. .RS
  13408. DIR is common to all version of TRSDOS.  Versions after 6.1 replaced the
  13409. DIR command with CAT, and changed the DIR command so that always
  13410. produces a long listing.
  13411. .RE
  13412. .NH 2
  13413. FREE :D
  13414. .sp
  13415. .RS
  13416. Gives statistics on disk usage.  If D is present, 
  13417. it indicates a drive number, and only the
  13418. statistics for the specified disk will be shown.
  13419. .RE
  13420. .NH 2
  13421. REMOVE/PURGE FILESPEC (PARAMETERS)
  13422. .sp
  13423. .RS
  13424. Remove the file(s) given by FILESPEC from the directory and frees the space 
  13425. allocated to the file for reassignment.  Purge allows PARTSPECs that
  13426. specify groups of files.  With no PARAMETERS, PURGE prompts before
  13427. deleting any file.  REMOVE requires a full filespec as the name of the
  13428. file to remove.  REMOVE allows more than one filespec to
  13429. be given on the command line.
  13430. .RE
  13431. .NH 2
  13432. LIST FILESPEC (PARAMETERS)
  13433. .sp
  13434. .RS
  13435. Lists the file on the display.  Parameters are described in the \fITRSDOS\fR
  13436. manual in detail.  \fI(HEX)\fR is sometimes useful to display the hexidecimal
  13437. values of the characters in a file.
  13438. .RE
  13439. .NH 2
  13440. RENAME oldfile newfile
  13441. .sp
  13442. .RS
  13443. Changes the name of oldfile to newfile, provided that newfile is a 
  13444. unique file name on that disk.
  13445. .RE
  13446. .NH
  13447. Copying Disks and Files:
  13448. .RS
  13449. .NH 2
  13450. COPY file1 file2
  13451. .sp
  13452. .RS
  13453. Copies file1 and name the copy file2. If file2 exists, it 
  13454. will be replaced.
  13455. .RE
  13456. .NH 2
  13457. BACKUP :D :E
  13458. .sp
  13459. .RS
  13460. Makes a copy of the disk in drive D on the the disk in drive E.
  13461. .RE
  13462. .NH 2
  13463. FORMAT :D
  13464. .sp
  13465. .RS
  13466. Formats the disk in drive D.  The disk will be ready for any normal 
  13467. read or write operation following successful completion of this 
  13468. operation. This operation must be performed before use of a blank disk. 
  13469. Reformatting a previously formatted disk will cause all previously 
  13470. stored information to be lost.
  13471. .RE
  13472. .RE
  13473. .NH
  13474. Transfers without the KERMIT Protocol
  13475. .PP
  13476. Model 4(p) KERMIT adds
  13477. 2 logical devices to the already resident devices.  These devices are
  13478. used to access the communications port.  These devices,
  13479. *FI (File Input) and *FO (File Output), can be used as the source, and
  13480. destination of a copy command, respectively.  They make use of the status of
  13481. the SET FLOW-CONTROL parameter, to send and receive data using the 
  13482. communications port.  For instance, say you are communicating with a computer
  13483. that does not have KERMIT.  Say you also wish to transfer a file to
  13484. this computer to do some further processing.  The normal method involves
  13485. starting a program on the remote computer to collect the data into a file
  13486. on that system.  On a VAX/VMS system, you might use the CREATE command to
  13487. capture the file.  The following \fIKERMIT\fR commands will accomplish
  13488. the transmition of a file in this case.
  13489. .sp
  13490. .RS
  13491. OUTPUT CREATE MYPROG.DAT<CR>
  13492. .br
  13493. LOCAL COPY PROG/DAT *FO
  13494. .RE
  13495. .sp
  13496. The KERMIT command, OUTPUT,
  13497. will send the string "CREATE MYPROG.DAT<CR>" to the host.
  13498. Let's say for now that this is sufficient to cause all future characters sent
  13499. to the host to be placed into the file MYPROG.DAT on that system.
  13500. The KERMIT command LOCAL is then used to invoke the \fITRSDOS\fR library
  13501. command COPY.  COPY will copy the contents of the file "PROG/DAT" to the
  13502. *FO device.  The driver for this device is part of the KERMIT program,
  13503. and will take care of transmitting the data out of the communications
  13504. port to the HOST.  If the HOST sends XOFF because DATA is arriving TOO
  13505. fast, then the XON/XOFF option to the \fIKERMIT\fR command, SET FLOW-CONTROL,
  13506. will allow the transfer to pause while the HOST catches up.
  13507. You may wish to collect the contents of a file that is on another computer.
  13508. If particular computer does not have \fIKERMIT\fR,
  13509. you can use a series of commands similar to those listed below to
  13510. retrieve the file.  It should be noted that the \fISESSION-LOG\fR
  13511. can also be used to trap the contents of a file.
  13512. For that very reason, this is only one of several possible ways
  13513. to get a file from another computer that does not have \fIKERMIT\fR.
  13514. .sp
  13515. .RS
  13516. OUTPUT TYPE MYPROG.DAT<CR>    
  13517. .br
  13518. INPUT TYPE MYPROG.DAT<CR><LF>
  13519. .br
  13520. LOCAL COPY *FI MYPROG/DAT:1
  13521. .RE
  13522. .PP
  13523. It may help to
  13524. clarify the use of the \fIOUTPUT\fR command, and the corresponding
  13525. \fIINPUT\fR command.  If you use the \fIKERMIT\fR command \fICONNECT\fR to
  13526. enter terminal mode, and then proceed to tell the host
  13527. to type out a file, it may start sending data
  13528. before you can escape back, and type the \fICOPY\fR command.
  13529. This means that some
  13530. of the data would be lost.  With \fIFLOW-CONTROL\fR set to \fIXON/XOFF,\fR
  13531. and the remote
  13532. host recognizing this fact, the previous commands would not allow any data
  13533. to be lost.  The use of \fIINPUT\fR is only to remove the characters
  13534. ECHOed by the
  13535. host from the input buffer (The TEXT of the command
  13536. "TYPE MYPROG.DAT").  If you are communicating with a half-duplex system
  13537. in which \fIModel (4)p KERMIT\fR is echoing the
  13538. characters typed on the keyboard, then the \fIINPUT\fR command
  13539. need not be used.  
  13540. .sp 3
  13541. .NH
  13542. Control of File Transfers Using the KERMIT Protocol
  13543. .sp
  13544. .PP
  13545. During the transfer of a file using either \fISEND\fR, or \fIGET\fR and possibly
  13546. during the use of the \fIREMOTE\fR command, protocol operations may need to be
  13547. aborted, or altered.  Several key strokes allow
  13548. the user to control the protocol operations.  These are listed below,
  13549. and are listed on the screen after issuing either the \fISEND\fR or \fIGET\fR
  13550. commands.  The operation of the \fIREMOTE\fR command is purposefully silent.
  13551. The key strokes are available to the user during \fIREMOTE\fR commands,
  13552. for added flexibility.  This allows
  13553. the user to cancel commands like \fIREMOTE TYPE\fR that may otherwise cause
  13554. large amounts of data to be displayed for an extended amount of time.
  13555. The valid key strokes are:
  13556. .sp
  13557. .IP \fIControl-F\fR 15
  13558. During data transfers using the \fIKERMIT\fR protocol,
  13559. \fIControl-F\fR will terminate the current transaction.
  13560. If there are more files to transfer, the next transaction will be started.
  13561. \fIModel 4(p) KERMIT\fR will send a signal to the remote \fIKERMIT\fR
  13562. telling it to stop sending packets for the current transaction.
  13563. If the remote \fIKERMIT\fR understands this signal
  13564. (not all implementations of \fIKERMIT\fR
  13565. do), it will comply, otherwise the transaction will continue.
  13566. .IP \fIControl-B\fR
  13567. Like  \fIControl-F\fR, except that if a group of files is being processed
  13568. this will stop the entire group.  If only a
  13569. single file is being \fISENT\fR or \fIRECEIVED\fR, \fIControl-B\fR
  13570. behaves exactly like \fIControl-F\fR.
  13571. .IP \fIControl-C\fR
  13572. Aborts the protocol immediately.  This should be a last resort to
  13573. stopping a transmission as it will leave the remote \fIKERMIT\fR in an
  13574. unknown state.
  13575. .IP \fIControl-E\fR
  13576. Aborts the protocol after sending an ERROR packet to the remote \fIKERMIT\fR.
  13577. .IP \fIControl-D\fR
  13578. Toggles \fIDEBUG\fR mode \fION\fR and \fIOFF.\fR  This is helpful when
  13579. trying to figure out why a particular host is unable to talk to
  13580. \fIModel 4(p) KERMIT\fR.
  13581. .IP \fI<ENTER>\fR
  13582. If you type \fI<ENTER>\fR, \fIModel 4(p) KERMIT\fR will resend
  13583. the current packet.
  13584. .IP \fIControl-H\fR
  13585. Displays the list of \fIKEYS\fR that you may press during a transfer.  I.E.
  13586. the keys described above.  This is the same message that is printed when
  13587. a SEND, GET, or RECEIVE command is issued.
  13588. .sp 3
  13589. .NH
  13590. Model 4(p) KERMIT Commands
  13591. .sp
  13592. .PP
  13593. \fIModel 4(p) KERMIT\fR uses a subset of the
  13594. the \fIDECSYSTEM-20\fR keyword style command language.  Each
  13595. keyword may be abbreviated to its minimum unique length.  "?" may be typed to
  13596. request a list of the available options for the current field at any point in a
  13597. command.  If insufficient characters have been typed to identify the 
  13598. current field uniquely, \fIModel 4(p) KERMIT\fR will display all
  13599. available choices,
  13600. and then reprompt to allow you to continue from that point.  If there are
  13601. sufficient characters, then only a single choice will be displayed.  The
  13602. following list of commands are available when using \fIModel 4(p) KERMIT\fR.
  13603. .NH 2
  13604. BYE
  13605. .sp
  13606. .RS
  13607. When talking to a remote \fIKERMIT\fR Server, this command should shut down a
  13608. remote server and terminate the login that you had there.
  13609. \fIModel 4(p) KERMIT\fR will then exit to \fITRSDOS Ready\fR.
  13610. .RS
  13611. .sp
  13612. NOTE: Due to some
  13613. deviations from the specification, some systems do not perform exactly
  13614. in this manner.  You should check the documentation of the \fIKERMIT\fR on the
  13615. remote system in order to obtain the operation performed by this command.
  13616. .RE
  13617. .RE
  13618. .NH 2
  13619. CLEAR
  13620. .sp
  13621. .RS
  13622. .NH 3
  13623. INPUT-PORT
  13624. .sp
  13625. .RS
  13626. \fIModel 4(p) KERMIT\fR uses the "Interrupt on received character available"
  13627. feature of the COM/DVR communications line driver.  This driver is part of the
  13628. standard software on your system diskette.
  13629. All characters received via the interrupt vector, are placed in a 256 byte
  13630. circular buffer.  This command clears all characters currently buffered.
  13631. This is used most commonly with the INPUT, OUTPUT, PULSE, and PAUSE
  13632. commands, none of which explicitly clear the input buffer.  YOU MUST DO
  13633. THIS YOURSELF.  The execution of this command will \fInot\fR send
  13634. an \fIXON\fR character to the communications port.  This is also left
  13635. up to you to do.
  13636. .RE
  13637. .NH 3
  13638. SCREEN
  13639. .sp
  13640. .RS
  13641. As you would expect, this command clears the screen.
  13642. .RE
  13643. .RE
  13644. .NH 2
  13645. CLOSE
  13646. .sp
  13647. .RS
  13648. .NH 3
  13649. DEBUG-LOG
  13650. .sp
  13651. .RS
  13652. Closes the file previously opened with the LOG DEBUG-LOG command.  If
  13653. there is not a debug logfile active, then a message is printed telling
  13654. you so.
  13655. .RE
  13656. .NH 3
  13657. SESSION-LOG
  13658. .sp
  13659. .RS
  13660. Closes the file previously opened with the LOG SESSION-LOG command.  If
  13661. no file is open, you will be advised so.
  13662. .RE
  13663. .NH 3
  13664. TRANSACTION-LOG
  13665. .sp
  13666. .RS
  13667. Closes the file previously opened with the LOG TRANSACTION-LOG command.  As
  13668. with the other logfiles, if a file is not currently open, then a message
  13669. to that affect is printed.
  13670. .RE
  13671. .NH 2
  13672. CONNECT (can be abbreviated to 'C')
  13673. .sp
  13674. .RS
  13675. Establish a "virtual terminal" connection to any host that may be
  13676. connected to the serial port, i.e. pass all typed characters
  13677. to the serial port and display all input from the serial port on the screen.
  13678. A two character sequence of characters is required to return the user to the
  13679. \fIKERMIT\fR program.  An escape character must be typed followed by a 'c'
  13680. (Case is \fInot\fR significant).
  13681. The default <ESCAPE> character is entered by pressing the
  13682. <SHIFT> key, and then and <CLEAR> key, while holding the <SHIFT> key down.
  13683. Pressing '?'
  13684. after the <ESCAPE> character will display a list of valid keystrokes
  13685. that do helpful things during connect mode.
  13686. The first time that
  13687. you issue the \fICONNECT\fR command, a
  13688. message will be displayed telling you what the <ESCAPE> character is.
  13689. The <ESCAPE> character should generally be an uncommonly-used control character.
  13690. The following characters are valid following the \fI<ESCAPE>\fR character,
  13691. and generate specific actions.  The actions are described beside the
  13692. character.
  13693. .RS
  13694. .IP \fIC\fR
  13695. Return to \fIModel 4(p) KERMIT\fR command level.  The contents of the
  13696. screen and
  13697. the cursor location will be saved prior to displaying the \fIKERMIT\fR screen.
  13698. When you reconnect to the \fIHOST\fR using the \fIKERMIT\fR command,
  13699. \fICONNECT,\fR the old screen will be restored.
  13700. .IP _?
  13701. List available single-character commands, I.E. These commands.
  13702. .IP \fIB\fR
  13703. Send a TRUE modem break.
  13704. .IP \fIR\fR
  13705. Resume logging if file open, and <ESCAPE>Q was used
  13706. previously to turn logging off.  See the \fILOG\fR command for more
  13707. information.
  13708. .IP \fIQ\fR
  13709. Quit logging to file but leave it open.
  13710. .IP \fI0\ (zero)\fR
  13711. Send a null (0) character out the communications port.
  13712. .IP \fI<ESCAPE>\fR
  13713. Send the \fI<ESCAPE>\fR character itself to the remote host.
  13714. .RE
  13715. .RE
  13716. .NH 2
  13717. DIR partspec
  13718. .sp
  13719. .RS
  13720. Produces a listing of the directory for "partspec".  If partspec is
  13721. not given, than the directory will be displayed for the \fIDEFAULT-DISK\fR
  13722. drive as established by \fISET DEFAULT-DISK\fR.
  13723. .RE
  13724. .NH 2
  13725. EXIT
  13726. .sp
  13727. .RS
  13728. Exit \fIModel 4(p) KERMIT\fR, and return to \fITRSDOS\fR.  Before the
  13729. \fIKERMIT\fR program is terminated, all open files will be closed.  This
  13730. includes the LOGFILES used for SESSION, TRANSACTION, and DEBUG logging.
  13731. The *FO, and *FI devices will also be removed.
  13732. .RE
  13733. .NH 2
  13734. ECHO
  13735. .sp
  13736. .RS
  13737. This command echoes text given as an argument to the screen.  It can used
  13738. in take files to put messages on the screen when TAKE-DISPLAY is OFF,
  13739. although other uses are possible.
  13740. .RE
  13741. .NH 2
  13742. FINISH  
  13743. .sp
  13744. .RS
  13745. Shuts down a remote server without logging it out.
  13746. Leaves you at \fIModel 4(p) KERMIT\fR command level.
  13747. A subsequent \fICONNECT\fR command will reconnect you to the
  13748. remote host.  The \fIremote KERMIT\fR should return to the
  13749. mode it was in prior to entering \fISERVER\fR mode.
  13750. .RE
  13751. .NH 2
  13752. GET filespec
  13753. .sp
  13754. .RS
  13755. Get allows you to retrieve files from a remote host.  Get works
  13756. with either a \fISERVER\fR or a \fIKERMIT\fR that has initiated
  13757. a \fISEND\fR command.  Filespec is a filename compatible with
  13758. \fIthat\fR system.  When \fIModel 4(p) KERMIT\fR is talking to
  13759. a \fIKERMIT\fR Server, you may include
  13760. a filespec in a form legal to the \fIHOST KERMIT\fR.
  13761. .RE
  13762. .NH 2
  13763. INPUT <control string>
  13764. .sp
  13765. .RS
  13766. INPUT provides one of 4 commands that provide an automatic logon facility.
  13767. INPUT allows
  13768. you to watch for the occurrence of certain text strings that are made up
  13769. characters arriving in the communications port.
  13770. This is useful in \fITAKE\fR files that can automatically log you
  13771. onto a certain system.
  13772. .PP
  13773. When \fIINPUT\fR in initiated, it begins matching
  13774. characters in the input to those given in the control string.  When
  13775. an exact match is found as established by the \fISET INPUT\fR options then
  13776. \fIINPUT\fR will return to the \fIKERMIT\fR command level.
  13777. If \fITAKE\fR is active
  13778. than the next line of the \fITAKE\fR file will be read.  The Control string
  13779. may be comprised of any printable \fIASCII\fR characters.  \fISPACE\fR
  13780. must not occur as either the beginning or end of the string.
  13781. .PP
  13782. \fIASCII\fR character codes
  13783. 0-32 are denoted as \fI<NUL>\fR - \fI<SPA>,\fR and \fI<DEL>\fR represents
  13784. character 127.
  13785. The string \fI<DLY*>\fR signifies an immediate delay.  The * should be replaced
  13786. by a character.  The significance of the character is this.  Decimal 48
  13787. is subtracted from the \fIASCII\fR value of the character to obtain the
  13788. number of seconds to delay.  Thus, you can obtain delays
  13789. 1-9 seconds, with no trickery.  Delays longer than that will have
  13790. to be calculated since the formula (ASCII code - 48 decimal) is used
  13791. to calculate the binary value to use as a counter.  The "*" should
  13792. be replaced with the single proper ASCII character.
  13793. .PP
  13794. If you use \fI<DLY*>\fR in
  13795. a \fIPULSE\fR command, it should be noted that it will only be done once.
  13796. An alternative format for control characters is to explicitly type
  13797. a carat ("^") preceding a character.  The result of subtracting
  13798. 64 from the \fIASCII\fR code for the character following will then be
  13799. used.  Since <, >, and ^ now have special meanings, you will need
  13800. some way to specify them explicitly.  To do this you should precede
  13801. them with a backslash, "\\", character.  In this case, backslash itself
  13802. now must be represented as "\\\\".  Finally, any and all characters
  13803. can be represented using a string of the form \\nnn where nnn is 1 or
  13804. more octal digits.  nnn is evaluated, and the resulting value will
  13805. be the ASCII value of the character.  Some examples might be:
  13806. .sp
  13807. .RS
  13808. INPUT login:<SPA>
  13809. .sp
  13810. .RS
  13811. Find the string "login:" followed by a space.
  13812. .RE
  13813. .sp
  13814. INPUT <SPA>^M^Jenter \\\\userid\\\\:<CR><LF>
  13815. .sp
  13816. .RS
  13817. Find the string with a space followed by a carriage
  13818. return followed by a line feed followed by the text
  13819. "enter \\userid\\:" followed by carriage return and another
  13820. linefeed.
  13821. .RE
  13822. .sp
  13823. INPUT USERNAME\\77\\40
  13824. .sp
  13825. .RS
  13826. Find the string "USERNAME? ".  Note that \\77 is the \fIONLY\fR
  13827. way that a question mark can be specified since a question mark is
  13828. recognized by the command stream as a request for help.
  13829. .RE
  13830. .RE
  13831. .sp
  13832. While input is waiting for a match, you may type characters on the
  13833. keyboard to be transmitted.  \fIBREAK\fR will abort the \fIINPUT\fR
  13834. command and if \fITAKE\fR is active, close the take file.  \fIESCAPE\fR
  13835. will abort the INPUT command, but will just skip to the next line in
  13836. a \fITAKE\fR file, if \fITAKE\fR is active.  These same 2 actions apply
  13837. to the \fIPULSE\fR command while no input has been received.
  13838. .RE
  13839. .NH 2
  13840. KILL wildspec
  13841. .sp
  13842. .RS
  13843. This command performs the task of deleting one or more files from
  13844. disk.  \fIWildspec\fR is a wild card filespec that will be evaluated.
  13845. All files that match the \fRwildspec\fR will be removed.  A \fIwildspec\fR
  13846. may contain any characters valid is a TRSDOS filespec, plus zero or more
  13847. occurances of the characters '*', and '$'.  These two characters
  13848. have special meanings.
  13849. .PP
  13850. When comparing the \fIwildspec\fR with the
  13851. name of a file, a '*' matches zero or more of the characters in the
  13852. filename.  E.g.  If a file FOO/ASM is compared with '*/ASM', then it
  13853. would match, because '*' can be thought of as 'FOO', and then '/ASM'
  13854. is matched literally.  M4*/ASM matches M4MIT/ASM, M4XFER/ASM, M4SEND/ASM,
  13855. and any other filename that begins with M4, and ends with /ASM.  The '$'
  13856. character matches any single character.  This means that FILE$/DOC matches
  13857. the filename FILE1/DOC, but not FILE1A/DOC.
  13858. .PP
  13859. A drivespec may be appended to the \fIwildspec\fR to force the search for
  13860. matches to be restricted to a single drive.  An example might be M4*/ASM:1,
  13861. which limits the matches to those file on drive 1.
  13862. .PP
  13863. Normally, only visible, nonsystem files are considered in the search.
  13864. However, the inclusion of a parameter list containing either, or both of the
  13865. keywords, INVIS or SYSTEM, will include invisible and/or system files.
  13866. An example would be:
  13867. .RS
  13868. KILL (I,S) config/sys (I) backup/cmd
  13869. .RE
  13870. This example would cause \fIModel 4(p) KERMIT\fR to attempt to remove
  13871. the two files listed.  Note that as this example shows, you must specify
  13872. the parameters with each \fIwildspec\fR that you wish to apply them to, as
  13873. they are nullified each time that a new \fIwildspec\fR is evaluated.
  13874. Other examples are given in the description of the \fISEND\fR command.
  13875. .RE
  13876. .NH 2
  13877. LOCAL <TRSDOS library command>  (Can be abbreiviated to L)
  13878. .sp
  13879. .RS
  13880. This command allows you to issue commands from within
  13881. \fIModel 4(p) KERMIT\fR.  You must remember where Model 4(p) KERMIT
  13882. resides in memory, to assure that you do not overwrite it.  KERMIT
  13883. loads at 6000H, and continues up through LOW$.  From within KERMIT,
  13884. you can issue the command:
  13885. .RS
  13886. .sp
  13887. LOCAL MEMORY
  13888. .RE
  13889. .sp
  13890. to see where KERMIT ends.  The value of LOW$ tells you this information.
  13891. KERMIT was placed at 6000H to allow most of the TRSDOS library
  13892. programs and commands to work in conjunction with KERMIT.  Some commands
  13893. extend above 3000H, and must have memory available up to approximately
  13894. 5300H.  The COPY command creates a problem because it apparently tries
  13895. to examine HIGH$ to see if there is space to load a large portion of
  13896. the source file into memory before writing it to the destination.  This
  13897. creates problems because KERMIT moves LOW$ up so that HIGH$ has a value
  13898. that will allow additional high memory module to be loaded.  It is suggested
  13899. that you not use COPY while KERMIT is running, as the machine may crash when
  13900. COPY completes.  This is because it will have copied data into the KERMIT
  13901. memory space.
  13902. .RE
  13903. .NH 2
  13904. LOG
  13905. .RS
  13906. .NH 3
  13907. DEBUG-LOG
  13908. .sp
  13909. .RS
  13910. The debug log can be used to debug transfer problems that sometimes
  13911. arrise when talking to a newly written KERMIT.  The information written
  13912. to the DEBUG-LOG is nearly identical to that which is displayed on the
  13913. screen when the command, SET DEBUG ON, is issued, or the CTRL-D key is
  13914. pressed during a transfer.  This file can be closed explicitly with the
  13915. \fICLOSE DEBUG-LOG\fR command.  The EXIT command also causes an implicit
  13916. closing of this file.
  13917. .RE
  13918. .NH 3
  13919. SESSION-LOG
  13920. .sp
  13921. .RS
  13922. When CONNECTed to a foreign host as a terminal, this command establishes
  13923. a log of the terminal session in the file specified.
  13924. This function depends, to
  13925. some extent, on the remote host's ability to do \fIXON/XOFF\fR flow control.
  13926. Without \fIFLOW-CONTROL,\fR data may be lost when \fIKERMIT\fR writes to
  13927. the file.  The log file is closed by explicitly 
  13928. typing the \fIKERMIT\fR command \fICLOSE SESSION-LOG\fR or implicitly when
  13929. \fIKERMIT\fR is exited via the \fIEXIT\fR command.
  13930. It will also be closed if an I/O error occurs in file processing for
  13931. the file involved.  \fILOGGING\fR may be toggled on and off
  13932. during \fICONNECT\fR using the sequence of keys described in
  13933. the \fICONNECT\fR description.
  13934. .RE
  13935. .NH 3
  13936. TRANSACTION-LOG
  13937. .sp
  13938. .RS
  13939. The transaction log is used to keep a record of the files transfered
  13940. during a KERMIT session.  The information includes whether or not
  13941. the transaction was SENDING, or RECEIVING, the name of the
  13942. file transfered, and the number of bytes involved in the transfer.
  13943. .RE
  13944. .RE
  13945. .NH 2
  13946. LOGOUT  
  13947. .sp
  13948. .RS
  13949. Logout tells a \fIremote kermit server\fR to terminate itself, as
  13950. well as your login session.  When this is completed, you are left
  13951. at \fIModel 4(p) KERMIT\fR command level.
  13952. .RE
  13953. .NH 2
  13954. OUTPUT <control string>
  13955. .sp
  13956. .RS
  13957. This is the other side of the \fIINPUT\fR command.  Control string follows
  13958. the same conventions as in \fIINPUT,\fR and the resulting character(s) will
  13959. be output to the communications port immediately.  It should be noted
  13960. that \fINO\fR characters other than what you specify are transmitted.  In
  13961. other words if you want to simulate typing some string, followed by
  13962. pressing \fI<ENTER>,\fR then you will have to use a command similar to:
  13963. .sp
  13964. .RS
  13965. OUTPUT mypassword<CR>
  13966. .sp
  13967. .RE
  13968. .sp
  13969. The \fI<CR>\fR will explicitly send the \fIASCII\fR
  13970. character 13 to the communications port.
  13971. .RE
  13972. .NH 2
  13973. PAUSE <number of seconds>
  13974. .sp
  13975. .RS
  13976. This command is usually used in conjunction with \fIINPUT,\fR
  13977. \fIOUTPUT,\fR and \fIPULSE\fR as a means of syncronizing
  13978. \fIModel 4(p) KERMIT\fR to a remote host.
  13979. A delay of the specified number of seconds will be generated based on
  13980. the accuracy of the 60HZ interrupt.  No means has been made for 
  13981. aborting the delay.  The maximum delay is 65536 seconds by specifying
  13982. 0 as the number.
  13983. .RE
  13984. .NH 2
  13985. PULSE <control string>
  13986. .sp
  13987. .RS
  13988. This command is an extension/combination of \fIINPUT\fR and \fIOUTPUT.\fR
  13989. It allows you to transmit one or more characters repeatedly until a character
  13990. appears in the input port.  The use of this command is valuable when
  13991. logging onto systems that don't always respond immediately after
  13992. the reception of some control character(s).  For instance, you might
  13993. (Now that all of the functions of this nature have been described)
  13994. use the following commands as part of a logon sequence to log onto a
  13995. computer system.
  13996. .sp
  13997. .RS
  13998. SET INPUT CASE-IGNORE ON
  13999. .br
  14000. SET INPUT DISPLAY ON
  14001. .br
  14002. SET OUTPUT HOST-ECHO ON
  14003. .br
  14004. SET OUTPUT DISPLAY ON
  14005. .br
  14006. CLEAR INPUT-PORT
  14007. .br
  14008. PULSE ^T<CR>
  14009. .br
  14010. INPUT <CR><LF>XYZ:
  14011. .br
  14012. PAUSE 2
  14013. .br
  14014. CLEAR INPUT-PORT
  14015. .br
  14016. PULSE <CR>
  14017. .br
  14018. INPUT Username:<SPA>
  14019. .br
  14020. OUTPUT joeblow<CR>
  14021. .br
  14022. INPUT <CR><LF>Terminal type:
  14023. .br
  14024. OUTPUT h19<CR>
  14025. .br
  14026. SET KEY 8 <DEL>
  14027. .br
  14028. SET KEY 128 <ETX>
  14029. .RE
  14030. .sp
  14031. After you study this awhile, it should make sense.  If these commands
  14032. are placed into a \fITAKE\fR file, then
  14033. you could use a \fICONNECT\fR command after the last command, to
  14034. connect immediately to the host.  If this is done, then \fIonly\fR
  14035. after you escape back to \fIModel 4(p) KERMIT\fR, will the \fITAKE\fR file
  14036. finally be closed.
  14037. .RE
  14038. .NH 2
  14039. RECEIVE <filespec>
  14040. .RS
  14041. This command is synonomous with the GET command.  It may be abbreviated to
  14042. the single character 'R', as in:
  14043. .RS
  14044. .sp
  14045. R *.asm
  14046. .sp
  14047. .RE
  14048. .RE
  14049. .NH 2
  14050. REMOTE <command>
  14051. .sp
  14052. .RS
  14053. \fIRemote\fR commands are not supported in totality by all \fIservers\fR.
  14054. If a \fIserver\fR supports remote commands, then \fIremote help\fR should
  14055. display all of the commands available to the \fIremote\fR user of the
  14056. server.  Below are descriptions of the \fIremote\fR commands that
  14057. \fIModel 4(p) KERMIT\fR knows how to send to a \fIremote server\fR.
  14058. The arguments to most commands are dependent on the \fIremote\fR
  14059. system.  You should be familiar with any system before using the
  14060. \fIremote server\fR commands available from that server.  Usually only
  14061. a small number of these commands are supported since some require
  14062. abilities that some operating systems just don't have.
  14063. .sp
  14064. .NH 3
  14065. CLOSE-LOG
  14066. .sp
  14067. .RS
  14068. Close a remote \fILOG\fR previously opened via the command
  14069. \fIREMOTE START-LOG\fR.
  14070. .RE
  14071. .NH 3
  14072. COPY
  14073. .sp
  14074. .RS
  14075. Copy one file to another.
  14076. .RE
  14077. .NH 3
  14078. CWD <directory path>
  14079. .sp
  14080. .RS
  14081. If a particular server's operating system supports the concept of
  14082. separate directories, then this command will allow you to change to
  14083. a different directory.
  14084. .RE
  14085. .NH 3
  14086. DELETE 
  14087. .sp
  14088. .RS
  14089. Deletes file(s) from the \fIremote\fR system.  Any arguments will probably
  14090. be file names in the format of the \fIremote\fR system.
  14091. .RE
  14092. .NH 3
  14093. DIR
  14094. .sp
  14095. .RS
  14096. Display a list of files on the \fIremote\fR system.
  14097. .RE
  14098. .NH 3
  14099. DISK
  14100. .sp
  14101. .RS
  14102. Display information about disk utilization on the \fIremote\fR system.
  14103. .RE
  14104. .NH 3
  14105. HELP
  14106. .sp
  14107. .RS
  14108. Get information about \fIremote\fR capabilities on the \fIremote\fR system.
  14109. .RE
  14110. .NH 3
  14111. HOST
  14112. .sp
  14113. .RS
  14114. Execute a command on the \fIremote\fR system.
  14115. .RE
  14116. .NH 3
  14117. KERMIT
  14118. .sp
  14119. .RS
  14120. Execute a \fIKERMIT\fR command on the \fIremote\fR system.  This command should
  14121. accept a normal \fIKERMIT\fR command as an argument.  The command,
  14122. if valid, will then be executed by the remote \fIKERMIT\fR server.
  14123. .RE
  14124. .NH 3
  14125. LOGIN
  14126. .sp
  14127. .RS
  14128. Create a login entity on the \fIremote\fR system.  This may be incorporated
  14129. into a dedicated server.
  14130. .RE
  14131. .NH 3
  14132. MESSAGE
  14133. .sp
  14134. .RS
  14135. Send a message to a user on the \fIremote\fR system.
  14136. .RE
  14137. .NH 3
  14138. PROGRAM
  14139. .sp
  14140. .RS
  14141. Feed command input to a command executing on the remote system, or
  14142. control the execution of a program.
  14143. .RE
  14144. .NH 3
  14145. QUERY-VARIABLE
  14146. .sp
  14147. .RS
  14148. Get the value of a variable maintained on the \fIremote\fR system.
  14149. .RE
  14150. .NH 3
  14151. RENAME
  14152. .sp
  14153. .RS
  14154. Change the name of a file on the \fIremote\fR system.
  14155. .RE
  14156. .NH 3
  14157. SEND-LOG
  14158. .sp
  14159. .RS
  14160. Tells the server to close any open log, and then transfer it to the
  14161. user.
  14162. .RE
  14163. .NH 3
  14164. SERVER-STATUS
  14165. .sp
  14166. .RS
  14167. Retrieve certain information about the status of a REMOTE server.  The
  14168. information returned is dependent on the REMOTE system.
  14169. .RE
  14170. .NH 3
  14171. SET-VARIABLE
  14172. .sp
  14173. .RS
  14174. Set the value of a variable on the \fIremote\fR system.
  14175. .RE
  14176. .NH 3
  14177. START-LOG
  14178. .sp
  14179. .RS
  14180. Start a transaction log on the \fIremote\fR system.
  14181. .RE
  14182. .NH 3
  14183. STOP-LOG
  14184. .sp
  14185. .RS
  14186. Stops logging to the log file started by the \fIREMOTE START-LOG\fR
  14187. command.  The file is not closed.  Logging may be started again by
  14188. using the the command, \fIREMOTE START-LOG\fR.
  14189. .RE
  14190. .NH 3
  14191. TYPE
  14192. .sp
  14193. .RS
  14194. Display the contents of the file/files given as arguments.  The \fIremote\fR
  14195. server should use the \fIKERMIT\fR protocol to send the contents of the
  14196. specified file/files to \fIModel 4(p) KERMIT\fR.  The file contents will be
  14197. displayed on the screen using the *SO device.
  14198. .RE
  14199. .NH 3
  14200. WHO
  14201. .sp
  14202. .RS
  14203. Display a list of users on the \fIremote\fR system.
  14204. .RE
  14205. .RE
  14206. .NH 2
  14207. SEND <wildspec>        (May be abbreviated to 'S');
  14208. .sp
  14209. .RS
  14210. File specifications may contain wild card characters.  The recognized
  14211. wild card characters are '*' and '$'.  '*' means zero or more of
  14212. any character.  '$' means exactly one of any character.  There are a lot
  14213. of specifics associated with wild carding, and search order through the
  14214. drives.
  14215. .PP
  14216. When files by the same name exist on different drives, a wild card match
  14217. of one will also match all other occurances.  e.g. if drive 0 contains the
  14218. file report/dat, and report.dat also exist on drive 1, then the command
  14219. 'SEND */dat' will collect both names for sending.  On the other hand,
  14220. other variations can be used to send only one of the 2 files.  'SEND
  14221. */dat:1' will only match files on drive 1.  Another alternative would be
  14222. 'SEND report/dat:1' which would send only report/dat on drive 1.
  14223. .PP
  14224. Case is NOT significant, so both REPORT/DAT and report/dat are identical.
  14225. '/' is not significantly different from other characters in a file name,
  14226. so "*/*" is the same as "*" for all file names with an extension.  "*/*",
  14227. however, does not match names of the form "data", "fred", "file", "temp",
  14228. or others without extensions.  Other examples are given in the description
  14229. of the \fIKILL\fR command.
  14230. .RE
  14231. .NH 2
  14232. SET <parameter [value(s)...]>
  14233. .sp
  14234. .RS
  14235. Set the specified parameter to the specified value.  Possible settings:
  14236. .sp
  14237. .NH 3
  14238. BELL ON (or OFF)
  14239. .sp
  14240. .RS
  14241. When \fIDUMB\fR terminal emulation is in effect, a simple noise generator
  14242. is used to produce a tone like a bell each time the \fIBELL\fR character is
  14243. received.  If you don't like it, than use \fISET BELL OFF\fR to disable it.
  14244. .RE
  14245. .NH 3
  14246. BLOCK-CHECK-TYPE
  14247. .sp
  14248. .RS
  14249. The options are:
  14250. .NH 4
  14251. 1 (character checksum)
  14252. .sp
  14253. .RS
  14254. Normal, default, standard 6-bit checksum.
  14255. .RE
  14256. .NH 4
  14257. 2 (character checksum)
  14258. .sp
  14259. .RS
  14260. A 12-bit checksum encoded as two characters.
  14261. .RE
  14262. .NH 4
  14263. 3 (character crc-ccitt)
  14264. .sp
  14265. .RS
  14266. A 16-bit CCITT-format Cyclic Redundancy Check,  encoded
  14267. as 3 characters.
  14268. .RE
  14269. .sp
  14270. The 2 and 3 character options should only be used under
  14271. conditions of extreme line noise.  Many implementations of \fIKERMIT\fR
  14272. only support the single character checksum.
  14273. .RE
  14274. .NH 3
  14275. DEBUGGING OFF (or ON)
  14276. .sp
  14277. .RS
  14278. When transmitting or receiving packets, controls whether the
  14279. packets are displayed on the local screen.
  14280. .RE
  14281. .NH 3
  14282. DEFAULT-DISK <drive number>
  14283. .sp
  14284. .RS
  14285. The default-drive value is used for received files.  The file names created
  14286. by \fIModel 4(p) KERMIT\fR will have a ':' and the default drive number
  14287. affixed to the end so that they will be forced to be saved on the selected
  14288. drive.
  14289. .RE
  14290. .NH 3
  14291. EIGHT-BIT-QUOTING ON (or OFF)
  14292. .sp
  14293. .RS
  14294. This command enables or disables 8th bit quoting.  This is useful when
  14295. a full 8 bit path is available for binary file transfers.
  14296. .RE
  14297. .NH 3
  14298. EMULATION NONE (or DUMB)
  14299. .sp
  14300. .RS
  14301. When connected as a terminal to a foreign host, \fISET EMULATION\fR controls
  14302. whether the Model 4 emulates no terminal, allowing the use
  14303. of a terminal filter, or whether a \fIDUMB\fR terminal emulation is used.
  14304. No emulation is the default.
  14305. .RE
  14306. .NH 3
  14307. ESCAPE  
  14308. .sp
  14309. .RS
  14310. Change the escape character for virtual terminal connections.
  14311. \fIModel 4(p) KERMIT\fR will prompt you for the new escape 
  14312. character, which you type in locally.
  14313. .RE
  14314. .NH 3
  14315. FILE
  14316. .RS
  14317. .NH 4
  14318. DISPOSITION KEEP (or DISCARD)
  14319. .sp
  14320. .RS
  14321. When the transfer of a file is interrupted, this tells Model 4(p) KERMIT
  14322. what to do if it receives only a partial file.  If FILE-DISPOSITION is
  14323. DISCARD, then any partial file is removed.  Otherwise, the file is left as
  14324. it is when a transfer is interrupted.
  14325. .RE
  14326. .NH 4
  14327. TYPE (ASCII or BINARY)
  14328. .sp
  14329. .RS
  14330. Tells \fIModel 4(p) KERMIT\fR how to deal with the file being
  14331. sent/received. It is \fIIMPORTANT\fR to tell KERMIT if the file
  14332. is in \fIASCII\fR when sending to a \fINON Model 4(p) KERMIT\fR.
  14333. The action taken with this value is as follows.  If \fIASCII\fR mode
  14334. is set, then CR-LF pairs of characters are translated to CR on
  14335. input, and CR is translated to CR-LF on output.  When binary mode
  14336. is in effect, this translation does not occur.
  14337. .RE
  14338. .RE
  14339. .NH 3
  14340. FLOW-CONTROL XON/XOFF (or NONE)
  14341. .sp
  14342. .RS
  14343. When this feature is set to \fIXON/XOFF\fR (the default),
  14344. \fIModel 4(p) KERMIT\fR
  14345. will try its best to obey and use \fIXON\fR characters and \fIXOFF\fR
  14346. characters for all transmitions through the communications
  14347. port.  \fINONE\fR will disable all attempts at this sort of flow-
  14348. control.
  14349. .RE
  14350. .NH 3
  14351. INPUT
  14352. .RS
  14353. .NH 4
  14354. CASE-IGNORE OFF (or ON)
  14355. .sp
  14356. .RS
  14357. Controls whether of not case matching is done on
  14358. characters during the input command. In most
  14359. instances, you will want this \fION\fR.
  14360. .RE
  14361. .NH 4
  14362. DISPLAY OFF (or ON)
  14363. .sp
  14364. .RS
  14365. Controls the display of characters that are input
  14366. during the execution of the \fIINPUT\fR command.
  14367. .RE
  14368. .RE
  14369. .NH 3
  14370. KEY <key value> <string>
  14371. .sp
  14372. .RS
  14373. This command allows you to send an arbitrary (the length of the
  14374. \fIKERMIT\fR command line is the limit)
  14375. string with a single key stroke.  The definition of string is identical
  14376. for that of the \fIINPUT\fR, \fIOUTPUT\fR, and \fIPAUSE\fR commands. 
  14377. KEY VALUE is the ASCII value of the key stroke as given in the TRSDOS
  14378. manual.  If KEY VALUE is not given, then you will be asked to press
  14379. the key corresponding to the key that you wish to define.  All keys are valid
  14380. in \fIstring\fR except BREAK.  Pressing BREAK signals the end of the definition
  14381. string.  While in \fICONNECT\fR mode, typing the defined key will cause the
  14382. characters typed as the definition to be typed instead.  Defining a key
  14383. to have a \fINULL\fR length deletes any previous definition.
  14384. .RE
  14385. .NH 3
  14386. LOCAL-ECHO OFF (or ON)
  14387. .sp
  14388. .RS
  14389. When you \fICONNECT\fR to a remote host, you must set \fILOCAL-ECHO ON\fR
  14390. if the host is half duplex, \fIOFF\fR if full duplex.
  14391. .RE
  14392. .NH 3
  14393. OUTPUT
  14394. .RS
  14395. .NH 4
  14396. HOST-ECHO ON (or OFF)
  14397. .sp
  14398. .RS
  14399. When using \fIOUTPUT\fR, and communicating with a remote host,
  14400. the host commonly echoes the characters as you type.
  14401. Since \fIOUTPUT\fR effectively types characters for you, 
  14402. these characters may be echoed back.  If \fIHOST-ECHO\fR is 
  14403. \fION\fR, \fIOUTPUT\fR will wait for the echoed character to 
  14404. reappear in the input buffer before it sends the next.  
  14405. In the example for sending and receiving raw data, 
  14406. that is above, setting \fIHOST-ECHO ON\fR, will enable us 
  14407. to remove the \fIINPUT TYPE MYPROG.DAT<CR><LF>\fR command.  
  14408. Control characters are \fINOT\fR normally echoed, so this 
  14409. feature when set \fION\fR, will not wait for them.  If you
  14410. must catch the echo of a control character, then
  14411. follow the \fIOUTPUT\fR command with the appropriate \fIINPUT\fR
  14412. command.
  14413. .RE
  14414. .NH 4
  14415. DISPLAY OFF (or ON)
  14416. .sp
  14417. .RS
  14418. This parameter when on controls the display of characters
  14419. that are received when \fIHOST-ECHO\fR is \fION\fR.  Otherwise,
  14420. They are displayed based on the status of the \fILOCAL-ECHO\fR
  14421. setting.
  14422. .RE
  14423. .RE
  14424. .NH 3
  14425. PRINTER OFF (or ON)
  14426. .sp
  14427. .RS
  14428. Turns copying of \fICONNECT\fR session to printer on  and
  14429. off.  With \fIFLOW-CONTROL\fR turned on, and a sending host that will
  14430. acknowledge the \fIXOFF\fR, you should have no problems using the
  14431. printer continuously.
  14432. .RE
  14433. .NH 3
  14434. RECEIVE
  14435. .RS
  14436. .NH 4
  14437. END-OF-LINE <ASCII code>
  14438. .sp
  14439. .RS
  14440. Set the end of line character in packets to some other
  14441. character than \fI<CR>\fR which is the default.
  14442. .RE
  14443. .NH 4
  14444. PAD-CHAR <ASCII code>
  14445. .sp
  14446. .RS
  14447. If the host you are communicating with needs one or
  14448. more padding characters before it receives actual data
  14449. during packet transfers, this character will be sent
  14450. \fIPADDING\fR times.
  14451. .RE
  14452. .NH 4
  14453. PADDING <decimal number>
  14454. .sp
  14455. .RS
  14456. The repeat count for the number of times the padding
  14457. character is transmitted.
  14458. .RE
  14459. .NH 4
  14460. QUOTE-CHARACTER <ASCII code>
  14461. .sp
  14462. .RS
  14463. The character used to quote control characters.  The default is pound "#"
  14464. .RE
  14465. .NH 4
  14466. START-OF-PACKET <ASCII code>
  14467. .sp
  14468. .RS
  14469. The character used to syncronize the packets that
  14470. \fIKERMIT\fR transmits.  By default \fI<SOH>\fR.
  14471. .RE
  14472. .NH 4
  14473. TIME-OUT <decimal number>
  14474. .sp
  14475. .RS
  14476. \fIModel 4(p) KERMIT\fR uses this value as the number of seconds to wait for
  14477. a response to a packet.  If no response is received within the number of
  14478. seconds given, then the packet for which the response has not been received
  14479. is retransmitted.
  14480. .RE
  14481. .NH 4
  14482. TURN-CHAR
  14483. .sp
  14484. .RS
  14485. The character used to syncronize KERMIT when used over a half duplex
  14486. line.  \fIModel 4(p) KERMIT\fR will wait for this character at the
  14487. end of a packet, and will send the SEND TURN-CHAR at the end of a packet.
  14488. .RE
  14489. .RE
  14490. .NH 3
  14491. SEND
  14492. .RS
  14493. .NH 4
  14494. END-OF-LINE <ASCII code>
  14495. .sp
  14496. .RS
  14497. Set the end of line character in packets to some other
  14498. character than \fI<CR>\fR which is the default.
  14499. .RE
  14500. .NH 4
  14501. PAD-CHAR <ASCII code>
  14502. .sp
  14503. .RS
  14504. If the host you are communicating with needs one or
  14505. more padding characters before it receives actual data
  14506. during packet transfers, this character will be sent
  14507. \fIPADDING\fR times.
  14508. .RE
  14509. .NH 4
  14510. PADDING <decimal number>
  14511. .sp
  14512. .RS
  14513. The repeat count for the number of times the padding
  14514. character is transmitted.
  14515. .RE
  14516. .NH 4
  14517. QUOTE-CHARACTER <ASCII code>
  14518. .sp
  14519. .RS
  14520. The character used to quote control characters.  The default is pound "#"
  14521. .RE
  14522. .NH 4
  14523. START-OF-PACKET <ASCII code>
  14524. .sp
  14525. .RS
  14526. The character used to syncronize the packets that
  14527. \fIKERMIT\fR transmits.  By default \fI<SOH>\fR.
  14528. .RE
  14529. .NH 4
  14530. TIME-OUT <decimal number>
  14531. .sp
  14532. .RS
  14533. This value is given to the \fIother\fR host as its' timeout value.  You
  14534. should assure that this is different from the RECEIVE TIME-OUT value so
  14535. that both timeouts do not occur simultaneously.
  14536. .RE
  14537. .NH 4
  14538. TURN-CHAR <ASCII code>
  14539. .sp
  14540. .RS
  14541. The character used to syncronize KERMIT when used over a half duplex
  14542. line.  \fIModel 4(p) KERMIT\fR will send this character at the end of a
  14543. packet.  The RECEIVE TURN-CHAR will be waited for before data is transmitted.
  14544. .RE
  14545. .RE
  14546. .NH 3
  14547. TAKE-DISPLAY OFF (or ON)
  14548. .sp
  14549. .RS
  14550. Controls the display of \fITAKE\fR files as they are executed.
  14551. By default this feature is off.
  14552. .RE
  14553. .NH 3
  14554. WARNING ON (or OFF)
  14555. .sp
  14556. .RS
  14557. Warns user if filename conflicts when receiving files from
  14558. remote host, and attempt to generate a unique name by modifying
  14559. the given one.  \fION\fR by default.
  14560. .RE
  14561. .RE
  14562. .NH 2
  14563. SETCOM <TRSDOS SETCOM command parameter>
  14564. .sp
  14565. .RS
  14566. Sets/shows the status of the communications driver, \fICOM/DVR\fR.  If no
  14567. arguments are given, than the current status will be shown.  Any
  14568. arguments must be enclosed in parenthesis as the result of this
  14569. command, is a generated \fITRSDOS\fR command as in:
  14570. .RS
  14571. .sp
  14572. SETCOM (B=9600,P=N,W=8)
  14573. .RE
  14574. .sp
  14575. The default values are established according to you.  If you set up
  14576. the driver for a certain configuration, and then use \fISYSGEN\fR to save
  14577. it, then that will be the default.  \fINO\fR sysgen should give you:
  14578. .RS
  14579. .sp
  14580. 300 BAUD
  14581. .br
  14582. EVEN PARITY
  14583. .br
  14584. DTR=YES
  14585. .br
  14586. 7 DATA BITS
  14587. .br
  14588. 1 STOP BIT
  14589. .RE
  14590. .RE
  14591. .sp
  14592. .NH 2
  14593. SHOW
  14594. .sp
  14595. .RS
  14596. Allows one or ALL of the options of the \fISET\fR command to be displayed.
  14597. Using the "?" feature will aid you if you can't figure out where to
  14598. find something.  All of the things that can be SET can be displayed.
  14599. The items not listed below can be displayed by using a command like:
  14600. .RS
  14601. .sp
  14602. SHOW BLOCK
  14603. .RE
  14604. .sp
  14605. or
  14606. .sp
  14607. .RS
  14608. SHOW DEFAULT
  14609. .RE
  14610. .sp
  14611. SHOW ALL will display all of the set values except keys.  You must use
  14612. SHOW KEY to see these values.
  14613. .RE
  14614. .NH 3
  14615. SEND
  14616. .sp
  14617. .RS
  14618. Displays all options described under the \fISET SEND\fR command.
  14619. .RE
  14620. .NH 3
  14621. RECEIVE
  14622. .sp
  14623. .RS
  14624. Displays all options described under the \fISET RECEIVE\fR command.
  14625. .RE
  14626. .NH 3
  14627. KEY <ASCII key value>
  14628. .sp
  14629. .RS
  14630. If <ASCII key value> is specified, then the definition for the specified
  14631. key number is display.  Otherwise, a prompt is issued for the user to
  14632. type the keystroke that should be taken as the key to display.  \\nnn
  14633. is used to display all values greater than 127.  ^x where x is a
  14634. character 64 greater than 0 through 31, and 127 is used to display
  14635. control characters.  Any other printable ASCII character is displayed
  14636. normally.
  14637. .RE
  14638. .RE
  14639. .NH 2
  14640. STATUS
  14641. .sp
  14642. .RS
  14643. Shows certain information about the status of \fIModel 4(p) KERMIT\fR.  Items
  14644. currently displayed include the amount of space left in the \fIKEY\fR definition
  14645. table, the number of bytes written to files during transfers, the number
  14646. of bytes read from files during transfers, as well as statistics on the
  14647. latest transfer.
  14648. .RE
  14649. .NH 2
  14650. TAKE <filespec>
  14651. .sp
  14652. .RS
  14653. TAKE allows commands to be stored in a file, and then executed by
  14654. the \fIKERMIT\fR command interpreter.  Only \fIone\fR level of \fITAKE\fR
  14655. files is
  14656. supported.  This means that a \fITAKE\fR command can not appear inside of
  14657. a \fITAKE\fR file.  No checking is done to enforce this, so good luck if you
  14658. want to try it.  When \fIKERMIT\fR is first entered, a check is made for
  14659. a file called \fIKERMIT/INI\fR on all of the active disk drives as per
  14660. normal \fITRSDOS\fR searching order.  If it is found, than it is used as
  14661. a \fITAKE\fR file where you can store initialization commands.  Pressing the
  14662. \fIBREAK\fR key, or the \fIENTER\fR key during the startup of KERMIT (before the
  14663. TAKE file is opened) will cause \fIKERMIT\fR to skip
  14664. processing of the \fITAKE\fR file.
  14665. .RE
  14666. .sp 3
  14667. .NH
  14668. Setting up to use Model 4(p) KERMIT
  14669. .PP
  14670. To use \fIModel 4(p) KERMIT\fR, you need to have your Model 4 set up
  14671. properly.  The program expects that the *CL device will be driven by the
  14672. COM/DVR Communications Driver that comes with TRSDOS.  It also expects that
  14673. the *SO device is ROUTED to the *DO device, and that the *SI device is
  14674. ROUTED to the *KI device.  The former 2 are the defaults, and in general,
  14675. you should not worry about them, unless you have changed them.  Setting up
  14676. the *CL device involves typing the command:
  14677. .RS
  14678. .sp
  14679. SET *CL COM/DVR
  14680. .RE
  14681. .sp
  14682. at the \fITRSDOS Ready\fR prompt.  If you do not do this, you will get a message
  14683. of the form
  14684. .RS
  14685. .sp
  14686. Can't find *CL DCB
  14687. .RE
  14688. .sp
  14689. from \fIModel 4(p) KERMIT\fR when it is starting up.  The program will return
  14690. control to TRSDOS after issuing this message, as it is a fatal error.
  14691. .PP
  14692. \fRModel 4(p) KERMIT\fR is not a small program.  It occupies memory starting
  14693. at 6000H, and extends up past 0D300H.  If you have parts of TRSDOS resident
  14694. (Using the SYSTEM (SYSRES=....) command), or perhaps other filters or memory
  14695. resident modules, then you should make sure that they do not extend below
  14696. the maximum address used by the program.
  14697. The last memory address used by \fIModel 4(p) KERMIT\fR can
  14698. be obtained by using the command
  14699. .RS
  14700. .sp
  14701. LOCAL MEMORY
  14702. .RE
  14703. .sp
  14704. from within the \fIModel 4(p) KERMIT\fR program.
  14705. .sp 3
  14706. .NH
  14707. Installation
  14708. .PP
  14709. To install \fIModel 4(p) KERMIT\fR, you must obtain the two
  14710. files \fIM4BOO.BAS\fR and \fIM4MIT.HEX\fR.  Because of the size of the
  14711. executable, the hex file could not be placed into a basic program as data
  14712. statements.  Instead, the basic program
  14713. opens and reads the file \fIM4MIT.HEX\fR.  This file is an \fIASCII\fR image of
  14714. the executable.  All that needs to be done, is to run the \fIBASIC\fR program
  14715. which will convert the file back to its original binary format.
  14716. The resulting executable should probably be called \fIKERMIT/CMD\fR.
  14717. Follow the prompts of the BASIC program and there should not be any problems.
  14718. .NH
  14719. Building \fIModel 4(p) KERMIT\fR from the Source.
  14720. .PP
  14721. The Source for \fIModel 4(p) KERMIT\fR is in approximately 15 modules.  The
  14722. names of the modules are:
  14723. .RS
  14724. .IP M4ADD/ASM 15
  14725. Code for miscellaneous routines.
  14726. .IP M4CMD/ASM
  14727. Command parser code.
  14728. .IP M4EQU/ASM
  14729. Mosts constants are defined here
  14730. .IP M4FILE/ASM
  14731. Additional logfile code such as the LOG command, and the CLOSE command.
  14732. .IP M4GET/ASM
  14733. Receive file routines + other miscellany.
  14734. .IP M4KEY/ASM
  14735. Code for handling the SET KEY functions
  14736. .IP M4LOG/ASM
  14737. INPUT, OUTPUT, PAUSE, PULSE commands.
  14738. .IP M4MAC/ASM
  14739. Macros used in the program
  14740. .IP M4MIT/ASM
  14741. Main entry and some command routines.
  14742. .IP M4PKT/ASM
  14743. New packet routines for encoding and decoding packets.
  14744. .IP M4RMT/ASM
  14745. The base of what will be the remote command.
  14746. .IP M4SEND/ASM
  14747. Send file routines.
  14748. .IP M4SET/ASM
  14749. Set options routines.
  14750. .IP M4SHOW/ASM
  14751. Show settings routines.
  14752. .IP M4STR/ASM
  14753. The majority of storage, prompts, and messages.
  14754. .IP M4TERM/ASM
  14755. Terminal Emulation, and I/O routines.
  14756. .IP M4WILD/ASM
  14757. Wild card file name processing.
  14758. .IP M4XFER/ASM
  14759. File processing, and some packet stuff.
  14760. .RE
  14761. .PP
  14762. \fIModel 4(p) KERMIT\fR was developed using the \fIEDAS\fR assembler from
  14763. Misosys.  Other macro assemblers should be able to assemble the program
  14764. with minor conversions.
  14765. \fIM4MIT/ASM\fR is the main source module. It will call the other
  14766. source files into 
  14767. the assembly (using the *GET directive) as needed.
  14768. If any system calls need to be changed, they are 
  14769. all defined in \fIM4ADD/ASM\fR
  14770. for the most part.  All of the SVC's are coded in
  14771. \fIM4ADD/ASM\fR as subroutines that are accessed by CALL Xaaaaa, where aaaaa is
  14772. the name of the \fITRSDOS\fR supervisor call (SVC) without the "@" sign.
  14773. .PP
  14774. If this version is moved to another OS, there are several things that you
  14775. should consider.  The things that come to mind are:
  14776. .sp
  14777. .RS
  14778. .IP 1. 5
  14779. Consider the format of the TRSDOS directory structure.  The wild card routines
  14780. depend on this structure for validating directory entries, and for retrieving
  14781. the file name.
  14782. .IP 2.
  14783. There are 2 places where real time counting is required.  The delay specified
  14784. in a PAUSE statement can be handled with a counter, as all other processing
  14785. is halted (except the interrupt tasks) during the pause.  Currently, the
  14786. Real Time Clock task is used to measure the appropriate delay.  The other
  14787. use of a Real Time counter occurs in the Receive packet timeout.  This must
  14788. be handled using asyncronous processes in order to be accurate.
  14789. .IP 3.
  14790. There exist code at the beginnning and end of the segment that accesses the
  14791. screen which outputs the bytes 14, and 15 to the *DO device.  These are used
  14792. to force the cursor to be invisible before the screen is accessed, and to then
  14793. make it reappear after the screen access is completed.
  14794. .IP 4.
  14795. The interrupt driven receiver must also be delt with.  The code in the
  14796. routine SETINT, establishes the interrupt vector that the *CL driver will
  14797. call when a "character received interrupt" is generated.
  14798. .IP 5.
  14799. In many instances, the characters having values 16, and 17 are used to
  14800. enable, and disable reverse video respectively.  If the driver for *DO
  14801. does not recognize this convention, as the current one does, then these
  14802. characters must be handled in some manner.  I.E. either removed from the
  14803. source, or filtered from the terminal output stream.  The PRTSTR() routine
  14804. is a good place to mask these characters at, as it is the sole source of
  14805. output for strings containing these type of characters.
  14806. .RE
  14807. .sp
  14808. .PP
  14809. It should be noted that \fIKERMIT/CMD\fR loads into RAM at 6000H.  This avoids
  14810. high memory filters and drivers, and also allows use of \fITRSDOS\fR library
  14811. commands that use low memory beyond 3000H, as FORMAT, and BACKUP do.
  14812. Exclusive use is made of the *DO device for screen output from the KERMIT
  14813. program, for informational messages and the like.  During
  14814. connect mode, *SI and *SO are used as the input and output
  14815. devices to allow filters to be attached that will not effect the operation
  14816. of \fIModel 4(p) KERMIT\fR during command operations.
  14817. If you install a different driver or filter it must be compatible in
  14818. these areas.
  14819. .NH
  14820. Performance Specifics of Model 4(p) KERMIT
  14821. .PP
  14822. The \fIModel 4(p) KERMIT\fR has been tested and proven to work properly at
  14823. 9600 BAUD with flow control on, transferring files between 2 Model 4's.
  14824. What makes the \fIModel 4(p) KERMIT\fR perform so well is
  14825. the idea of flow control, and the interrupt driven receiver.  With out these
  14826. features, I expect that 2400 baud would be the reliable limit.  Flow control
  14827. can be disabled at speeds less than or equal to ~2400 baud, but greater speeds
  14828. require that flow control be functional in order to protect the integrity of
  14829. data in the input buffer.  
  14830. .sp 3
  14831. .NH
  14832. The Heath 19 Filter
  14833. .PP
  14834. The files \fIM4H191.ASM, M4H192.ASM, M4H19.MAC\fR, and \fIM4H19.EQU\fR
  14835. make up the sources for a Heath 19 terminal emulation filter for the
  14836. TRS-80 Models 4 and 4p.  The assembler used was EDAS by Misosys.
  14837. To build the filter from sources, you need the above 4 files on a
  14838. disk.  \fIM4H191.ASM\fR is the main source module, and it *GETs all the other
  14839. necessary files.
  14840. .PP
  14841. The structure of the program is pretty simple.  Single character
  14842. (non escape) sequences, are passed to the
  14843. filtered device via the \fI@CHNIO\fR svc.  This filter depends on the
  14844. \fITRSDOS *DO\fR driver being at the end of the chain.  Several control
  14845. characters are merely translated, and then the new values are passed
  14846. to *DO.
  14847. .PP
  14848. A multi-character escape sequence is handled by remembering the previous
  14849. characters that the filter was passed.  The previous characters are
  14850. remembered by the presence of a non-zero value in the contents
  14851. of \fISTATE\fR.  The value in \fISTATE\fR represents the address of
  14852. the code to
  14853. handle the next character, given the previous string of characters.
  14854. .PP
  14855. The filter is relocatable, but \fIMUST\fR reside below screen memory because
  14856. it accesses it directly when performing several of the advanced terminal
  14857. functions.  For this reason, it will never load \fIabove F3ffH\fR.
  14858. .NH
  14859. The SETH19 Program
  14860. .PP
  14861. The \fISETH19\fR program allows you to configure a few options
  14862. that are available to you when using the \fIH19 filter\fR.
  14863. The \fISETH19\fR program is created from the sources
  14864. \fIM4H19S.ASM, M4H19.EQU,\fR and \fIM4H19.MAC\fR.  \fIM4H19S.ASM\fR
  14865. is the main source module, and will *GET the other 2 files.  
  14866. The program supports a few parameters that are listed below.
  14867. .RS
  14868. .sp
  14869. .IP REMOVE 15
  14870. Remove and reclaim if possible.
  14871. .IP DURATION
  14872. Length of BELL tone.
  14873. .IP FREQUENCY
  14874. Frequency value (bigger value is lower tone) for BELL.
  14875. .IP BELL
  14876. Turn audible BELL ON or OFF.
  14877. .IP BLOCK
  14878. Block cursor character.
  14879. .IP CURSOR
  14880. Normal cursor character.
  14881. .IP STRIP8
  14882. Control display of 8 bit data.
  14883. .IP HELP
  14884. Displays information similiar to this.
  14885. .IP SHOW
  14886. Displays the current settings of the parameters, this is the default.
  14887. .LP
  14888. .RE
  14889. These options are specified when you invoke \fISETH19\fR, as per the usual
  14890. TRSDOS 6.x parameter list.  An example is shown below:
  14891. .RS
  14892. .sp
  14893. SETH19 (BLOCK=191,CURSOR=23,BELL=ON,SHOW)
  14894. .RE
  14895. .PP
  14896. This command sets the normal CURSOR, and the edit mode CURSOR values, as
  14897. well as turning the audible bell on.  The show parameter causes 2
  14898. lines similiar to those below to be printed on the screen.
  14899. .RS
  14900. .sp
  14901. Normal Cursor: 23, Block Cursor: 191
  14902. .br
  14903. Bell: ON, Frequency: 20, Duration: 120
  14904. .br
  14905. Strip8: ON
  14906. .sp
  14907. .RE
  14908. .PP
  14909. The REMOVE option takes several things for granted, as it tries to
  14910. thoroughly remove the device.  It assumes that the H19 filter is
  14911. attached to the *HP device, and that this device is a filter hooked
  14912. to *SO.  Further more, it assumes that *SO is routed to *DO.
  14913. .PP
  14914. This particular set up can be used easily if the following commands
  14915. are used to set up the filter:
  14916. .RS
  14917. .sp
  14918. SET *HP H19/FLT
  14919. FILTER *SO *HP
  14920. .RE
  14921. .sp
  14922. This is assuming that *SO is routed to *DO.  The SETH19 command
  14923. will perform these very operations if you invoke it, and the memory
  14924. module, \fI$HEATH\fR, is not in place.
  14925. .PP
  14926. The other parameters to the SETH19 command can be used to control
  14927. certain preferable options to the filter.  Setting \fIBELL\fR off causes
  14928. the filter to flash the screen when it receives an ASCII(7) character.
  14929. If BELL is set \fION\fR, then an audible bell is issued when an ASCII(7) is
  14930. received.
  14931. .PP
  14932. When BELL is ON, then the \fIDURATION,\fR and \fIFREQUENCY\fR parameters take
  14933. effect.  These 2 parameters select the length and pitch, respectively,
  14934. of the BELL tone.  The FREQUENCY value is used as a delay between
  14935. oscillations of the sound port, so the bigger the number, the lower the
  14936. tone will be.
  14937. .PP
  14938. The \fIdefault DURATION\fR is set to 20, and the FREQUENCY
  14939. is set to 125.  You can adjust them as you please.  The DURATION
  14940. is inversely proportional to the FREQUENCY, since the delay caused
  14941. by the FREQUENCY value is part of the overall DURATION of the sound.
  14942. This means that as you increase FREQUENCY, you must \fIdecrease\fR
  14943. DURATION to maintain the same length of BELL, and vice-versa.
  14944. .PP
  14945. The \fIBLOCK\fR and \fICURSOR\fR parameters are used to control
  14946. the characters that are used as the cursor by the H19 filter.
  14947. The H19 terminal has the
  14948. ability to use a visual mode cursor, or a line mode cursor.  Since
  14949. the normal visual mode cursor is usually a block cursor, the parameter
  14950. BLOCK is used to set the ASCII value of the visual mode cursor.  The
  14951. CURSOR parameter sets the normal line mode cursor.
  14952. .PP
  14953. The switch between cursors must be done by the HOST computer that is
  14954. attached to the Model 4's communications port.  There is no magic
  14955. to when the BLOCK cursor is selected, see the description of the
  14956. recognized control sequences below.
  14957. .PP
  14958. The STRIP8 parameter controls whether or not data is printed on the
  14959. screen with the eighth bit set.  Normally, the filter now trims the
  14960. eighth bit off so that parity can be ignored.  The command
  14961. .RS
  14962. .sp
  14963. SETH19 (STRIP8=NO)
  14964. .RE
  14965. .sp
  14966. will cause the eighth bit to not be stripped.  That is to say, data will be
  14967. used as it is received by the filter.  Note that when this is done, some
  14968. control characters with parity bits attached may not be recognized.
  14969. .PP
  14970. .NH
  14971. Future modifications
  14972. .PP
  14973. It should be fairly straight forward to build extra states into the
  14974. filter so that it will recognize the ANSI 3.64 sequences for the
  14975. operations the filter knows how to perform.  Full support of all
  14976. the ANSI 3.64 sequences would be a non-trivial investment in time.  The
  14977. best bet here would, be a completely new device driver, since the
  14978. overhead of going to *DO is already costly, and trying to implement
  14979. scroll regions with *DO would be a HACK at best.
  14980. If somebody wants to do the conversion, I would like to have a
  14981. copy of the result.
  14982. .NH
  14983. HEATH-19 filter capabilities
  14984. .PP
  14985. The HEATH-19 terminal supports several advanced video capabilities
  14986. that make it an ideal source for a terminal emulation package.  Below
  14987. is a list of the functions supported by the Model 4(p) H-19 emulator,
  14988. and the escape sequences that perform the operations.
  14989. .NH
  14990. Heath/Zenith-19 Control Codes
  14991. .PP
  14992. The  Heath/Zenith-19 terminal is equivalent to the DEC VT52 with extensions for
  14993. line and character insertion and deletion.  Items marked with an  asterisk  are
  14994. not currently supported by Model 4(p) H19 emulation.
  14995. .sp 2
  14996. .na
  14997. .nf
  14998. Cursor Functions
  14999. .sp
  15000.   Sequence    Mnemonic    Definition
  15001. .br
  15002.    ESC H      HCUH        Cursor Home
  15003. .br
  15004.    ESC C      HCUF        Cursor Forward
  15005. .br
  15006.    ESC D      HCUB        Cursor Backward
  15007. .br
  15008.    ESC B      HCUD        Cursor Down
  15009. .br
  15010.    ESC A      HCUU        Cursor Up
  15011. .br
  15012.    ESC I      HRI         Reverse Index
  15013. .br
  15014.   *ESC n      HCPR        Cursor Position Report
  15015. .br
  15016.    ESC j      HSCP        Save Cursor Position
  15017. .br
  15018.    ESC k      HRCP        Set Cursor to Previously Saved Position
  15019. .br
  15020.    ESC Y      HDCA        Direct Cursor Addressing, 1-based:
  15021. .br
  15022.                           31+line# 31+col# (same as VT52)
  15023. .sp 3
  15024. Erasing and Editing
  15025. .sp
  15026.   Sequence    Mnemonic    Definition
  15027. .br
  15028.    ESC E      HCD         Clear Display (Shift Erase)
  15029. .br
  15030.    ESC b      HBD         Erase Beginning of Display
  15031. .br
  15032.    ESC J      HEOP        Erase to End of Page (Erase Key)
  15033. .br
  15034.    ESC l      HEL         Erase Entire Line
  15035. .br
  15036.    ESC o      HEBL        Erase Beginning of Line
  15037. .br
  15038.    ESC K      HEOL        Erase to End of Line
  15039. .br
  15040.    ESC L      HIL         Insert Line
  15041. .br
  15042.    ESC M      HDL         Delete Line
  15043. .br
  15044.    ESC N      HDCH        Delete Character
  15045. .br
  15046.    ESC @      HEIM        Enter Insert Character Mode
  15047. .br
  15048.    ESC O      HERM        Exit Insert Character Mode
  15049. .sp 3
  15050. Configuration
  15051. .sp
  15052.   Sequence    Mnemonic    Definition
  15053. .br
  15054.   *ESC z      HRAM        Reset to Power-Up Configuration
  15055. .br
  15056.   *ESC r Bn   HMBR        Modify Baud Rate: Bn=
  15057. .br
  15058.                             A=110, B=150, C=300, D=600, E=1200,
  15059. .br
  15060.                             F=1800, G=2000, H=2400, I=3600, J=4800,
  15061. .br
  15062.                             K=7200, L=9600, M=19200
  15063. .sp 2
  15064.    ESC x Ps   HSM         Set Mode(s): Ps=
  15065. .br
  15066.   *                         1 = Enable 25th line
  15067. .br
  15068.   *                         2 = No key click
  15069. .br
  15070.   *                         3 = Hold screen mode
  15071. .br
  15072.                             4 = Block cursor
  15073. .br
  15074.                             5 = Cursor off
  15075. .br
  15076.   *                         6 = Keypad shifted
  15077. .br
  15078.   *                         7 = Alternate keypad mode
  15079. .br
  15080.                             8 = Auto line feed on CR
  15081. .br
  15082.                             9 = Auto CR on line feed
  15083. .sp 2
  15084.    ESC y Ps   HRM         Reset mode(s): Ps=
  15085. .br
  15086.   *                         1 = Disable 25th line
  15087. .br
  15088.   *                         2 = Enable key click
  15089. .br
  15090.   *                         3 = Exit hold screen mode
  15091. .br
  15092.                             4 = Underscore cursor
  15093. .br
  15094.                             5 = Cursor on
  15095. .br
  15096.   *                         6 = Keypad unshifted
  15097. .br
  15098.   *                         7 = Exit alternate keypad mode
  15099. .br
  15100.                             8 = No auto line feed
  15101. .br
  15102.                             9 = No auto CR
  15103. .sp 2
  15104.   *ESC <      HEAM        Enter ANSI Mode
  15105. .sp
  15106. Modes of Operation
  15107. .sp
  15108.   Sequence    Mnemonic    Definition
  15109. .br
  15110.   *ESC [      HEHS        Enter Hold Screen Mode
  15111. .br
  15112.   *ESC \\      HXHS        Exit Hold Screen Mode
  15113. .br
  15114.    ESC p      HERV        Enter Reverse Video Mode
  15115. .br
  15116.    ESC q      HXRV        Exit Reverse Video Mode
  15117. .br
  15118.   *ESC F      HEGM        Enter Graphics Mode
  15119. .br
  15120.   *ESC G      HXGM        Exit Graphics Mode
  15121. .br
  15122.   *ESC t      HEKS        Enter Keypad Shifted Mode
  15123. .br
  15124.   *ESC u      HXKS        Exit Keypad Shifted Mode
  15125. .br
  15126.   *ESC =      HAKM        Enter Alternate Keypad Mode
  15127. .br
  15128.   *ESC >      HXAM        Exit Alternate Keypad Mode
  15129. .sp 3
  15130.   Additional Operations
  15131. .sp
  15132.   Sequence    Mnemonic    Definition
  15133. .br
  15134.   *ESC }      HDK         Keyboard Disable
  15135. .br
  15136.   *ESC {      HEK         Keyboard Enable
  15137. .br
  15138.   *ESC v      HEWA        Wrap Around at End of Line
  15139. .br
  15140.   *ESC w      HXWA        Discard at End of Line
  15141. .br
  15142.   *ESC Z      HID         Identify as VT52 (ESC / K)
  15143. .br
  15144.   *ESC ]      HX25        Transmit 25th Line
  15145. .br
  15146.   *ESC #      HXMP        Transmit Page
  15147. .sp 3
  15148.   Enhanced Character Support
  15149. .sp
  15150.    ESC [ p1 ; ... pn m    Set Graphics Rendition
  15151. .br
  15152.    where p1, ..., pn are chosen from the following:
  15153. .br
  15154.    *0            Reset to normal character display.
  15155. .br
  15156.    *1            Display characters in high intensity.
  15157. .br
  15158.    *4            Display characters underlined.
  15159. .br
  15160.    *5            Display characters blinking.
  15161. .br
  15162.    *7            Display characters in reverse video.
  15163. .br
  15164. .fo
  15165. .ad
  15166. .sp 2
  15167. .PP
  15168. The  Heath-19  transmits  the following sequences, but
  15169. it will not respond to
  15170. them if they are received.  Model 4(p) Kermit will transmit them
  15171. only if they are programmed with SET KEY.
  15172. .sp
  15173. .nf
  15174. .na
  15175.    ESC S      HF1         Function Key #1
  15176. .br
  15177.    ESC T      HF2         Function Key #2
  15178. .br
  15179.    ESC U      HF3         Function Key #3
  15180. .br
  15181.    ESC V      HF4         Function Key #4
  15182. .br
  15183.    ESC W      HF5         Function Key #5
  15184. .br
  15185.    ESC P      HF7         Function Key #7
  15186. .br
  15187.    ESC Q      HF8         Function Key #8
  15188. .br
  15189.    ESC R      HF9         Function Key #9
  15190. .fo
  15191. .PP
  15192. My thanks to Michael Carter and Roland Stolfa for their help in testing and
  15193. debugging this implementation.
  15194. .sp 2
  15195. .nf
  15196. Gregg Wonderly
  15197. .br
  15198. Department of Computing and Information Sciences
  15199. .br
  15200. Oklahoma State University
  15201. .sp 2
  15202. UUCP: {cbosgd, ea, ihnp4, isucs1, mcvax, uokvax}!okstate!gregg
  15203. .br
  15204. ARPA:  gregg@A.CS.OKSTATE.EDU
  15205.