; ; Turn on checksum flag, insure sending 128 byte blocks ; setnak: lda bchflg ora a jnz setnak1; In batch mode now, exit xra a sta crcflg; Ensure in checksum mode sta kflg; Defaults to 128 byte blocks call ilprt db cr,lf,'checksum requested',cr,lf,0 ret setnak1: call ilprt; and ignore checksum request db cr,lf,'checksum not used for batch mode',cr,lf,0 ; " " ; Waits for initial NAK - to ensure no data is sent until the receiving ; program is ready, this routine waits for the first timeout-nak or the ; letter 'C' for CRC from the receiver. If CRC is in effect then Cyclic ; Redundancy Checks are used instead of checksums. 'E' contains the ; number of seconds to wait. If the first character received is CANCEL ; (CTL-X) then the send will be aborted as though it had timed out. ; waitnak: call funchk; Check function keys mvi b,1; Timeout delay mov a,b sta remoff; Show future diplays to local CRT only call recv; Wait up to 1 sec for char jc waitn1; No char this time cpi crc; Was it a 'CRC' request? jz waitk cpi ksnd; Requesting 1k? jz setk; Exit if yes, otherwise set CRC cpi nak; A 'NAK' indicating checksum? jz setnak; Yes, go put checksum in effect cpi cancel; Was it a cancel (CTL-X)? jz abort; Yes, abort waitn1: dcr e; Finished yet? jz abort; Yes, abort jmp waitnak; No, loop ; waitk: mvi b,1; Got a 'C', wait up to 1 sec for 'K' call recv jc setcrc; Didn't get anything so not using 1k ani 7FH cpi '{' jz waitk; Disregard noisy lines cpi ksnd jz setk; Requesting 1k, else set CRC ; " " ; Turn on the flag for CRC ; setcrc: lda kflg; KFLG manually set from 'SK'? ora a jnz setk; If yes, keep it set setc1: xra a sta kflg; Defaults to 128 byte blocks inr a sta crcflg; Insures in CRC mode call ilprt db cr,lf,'CRC requested',cr,lf,0 ret ; ; Turn on the flag for 1k blocks and insure in CRC mode ; setk: call mspeed cpi 5; 1k request for 1200 bps or more jc setc1; Don't allow 1k if less than 1200 bps sta kflg; Set the flag for 1k blocks sta crcflg; Insures in 'CRC' mode call ilprt db cr,lf,'1k requested',cr,lf,0 ret ; ; ; This routine moves the filename from the default command line ; buffer to the file control block (FCB). ; movefcb: lhld savehl; Get position on command line call getb; Get numeric position lxi d,fcb+1 call movenam; Move name to FCB xra a sta fcbrno; Zero record number sta fcbext; Zero extent lda optsav; This going to be a library file? cpi 'L' rnz; If not, finished ; " " ; Handles library entries, first checks for proper .LBR extent. ; If no extent was included, it adds one itself. shld savehl lxi h,fcb+9; 1st 'typ' char mov a,m cpi ' ' jz noext; No type, make one cpi 'L'; Check 1st char in type jnz lbrerr inx h mov a,m cpi 'B'; Check 2nd char in type jnz lbrerr inx h mov a,m cpi 'R'; Check 3rd char in type jnz lbrerr ; " " ; Get the name of the desired file in the library ; movef1: lhld savehl; Get current position on command line call chkmsp; See if valid library member file name inr b; Increment for move name lxi d,memfcb; Store member name in special buffer ; " " ; Move a file name from the 'TBUF' command line buffer into FCB ; movenam: mvi c,1 ; " " moven1: mov a,m cpi ' '+1; Name ends with space or return jc moven3; Fill with spaces if needed cpi '.' jz chkfil; File name might be less than 8 chars. stax d; Store inx d; Next position to store the character inr c; One less to go mov a,c cpi 12+1 jnc noname; 11 chars. maximum filename plus extent ; " " moven2: inx h; Next char. in file name dcr b jnz moven1 jmp opterr; End of name, see if done yet ; ; See if any spaces needed between file name and .ext chkfil: mvi a,8 call fillsp; Fill with spaces jmp moven2 ; ; Fill filename and extension with blanks if needed moven3: mvi a,8 call fillsp mvi a,11 ; " " ; Fill filename area with spaces, and 1st .typ char. fillsp: cmp c rc; Up to 1st char in .ext now xchg mvi m,' '; Be sure there is a blank there now xchg inr c inx d jmp fillsp ; ; Check for any spaces prior to library member file name, if none (or ; only spaces remaining), no name. ; chkmsp: dcr b jz memerr mov a,m cpi ' '+1 rnc inx h jmp chkmsp ; ; Gets the count of characters remaining on the command line ; getb: mov a,l sui tbuf+2; Start location of 1st command mov b,a; Store for now lda tbuf; Find length of command line sub b; Subtract those already used mov b,a; Now have number of bytes remaining ret ; lbrerr: call erxit db cr,lf,'++ Invalid library name ++','$' ; memerr: call ilprt db cr,lf,cr,lf,'++ No library member file requested ++',cr,lf,0 jmp opterr ; ; Add .LBR extent to the library file name ; noext: lxi h,fcb+9; Location of extent mvi m,'L' inx h mvi m,'B' inx h mvi m,'R' jmp movef1; Now get the library member name ; ; Output to console (single or double on remoff flag) ; a,f ctype: push d mov e,a; Character to 'E' in case BDOS (normal) lda remoff; Want to bypass 'BYE' output to modem? ora a push psw cnz conout; To local console only pop psw; one or the other mvi a,wrcon; BDOS console output, to CRT and modem cz dos; Since 'BYE' intercepts the char. pop d ret ; ; 0 terminated string hl^ to console (single/double on remoff flag) ; a,f,h,l tstr: mov a,m inx h ora a rz call ctype jmp tstr ; ; cr/lf out ; a,f crlf: call ilprt db cr,lf,0 ret ; ; Inline print of message, 0 terminated ; a,f ilprt: xthl; Save HL, get HL=message mov a,m; Get the char inx h xthl ora a rz; past end of message call ctype jmp ilprt ; ; Check to see if SYSOP has typed a function key funchk: push psw call constat; Does it all with BYERSX pop psw ret ;