; MXO-N815ASM - NEC PC-8801 computer overlay file for MEX - 12/27/84 REV: EQU 15 ;Overlay revision level ; ; You will want to look this file over carefully. There are a number of ; options that you can use to configure the program to suit your taste. ; This file adapts the NEC PC-8801A computer to the MEX modem program. ; This overlay uses interrupt processing, necessary at ; higher Baud rates (>300). Changes cause more efficient operation at ; Baud rates of 300 and lower also. For most applications you will want ; to set the RS-232 jumper to position #5. You can then select either ; 300 or 1200 (default) baud via the SET BAUD command. ; ; Note that all overlays may freely use memory up to 0CFFH. If your ; overlay must work with the MEX Smartmodem overlay (MXO-SMxx.ASM), ; the physical modem overlay should terminate by 0900H. ; ; 12/27/84 - Simplified the baud rate setting routines by eliminating ; the SET JUMPER routine. You now simply choose the baud rate ; you want and you are prompted as to what RS-232 jumper ; is required. Note that for most applications you will ; still want to keep the jumper in position #5 as this ; allows 300 and 1200 baud operation. ; Upped rev. to 15 -Dave Kerr ; ; 12/09/84 - Fixed the Data Carrier Detect message. It seems that there ; is a discrepancy between the schematics and the actual ; circuit board as far as the circuits that multiplex the cassette ; and RS-232 data are concerned. It is necessary to command them ; to operate in the synchronous RS-232 mode even though you ; are running them in the async mode. This should work provided ; that jumper #2 is set to the 'I' mode for internal sync. ; Upped rev to 14 -Dave Kerr ; ; ; 10/26/84 - Fixed bugs in the SET PARITY and SET BAUD routines ; also set the interrupts back to the way they were on exiting ; the program. Rev. = 13 - Dave Kerr ; ; 09/29/84 - Rewrote the RS-232 interrupt service routine, and the modem ; status/input/output routines. The routines are now ; contained in the overlay instead of a separate "INSTALL8" ; driver file. Upped revision to 12 - Dave Kerr ; ; 08/28/84- Put into MEX format. Now uses MEX service processor, ; option added to allow use of higher baud rates than 1200 ; via the SET command. These require changing the serial port ; jumper to another position, however. When selecting a new baud ; rate the user is reminded to double check the jumper's position, ; as this command only notifies the program that you intend to ; change it. You must manually change the position yourself. ; A side effect of changing the jumper position is that the baud ; rate is also changed. See the set jumper routine for more details. ; ; Syntax: SET JUMPER 5-8 ; The file was also renamed to MXO-N810.ASM - Dave Kerr ; ; 07/10/84 - Altered for Install8 MODEM7B.DRV drivers ; - Renamed to M7NE-2.ASM - Steven Sarna ; 11/11/83 - Renamed to M7NE-1.ASM, no changes - Irv Hoff ; 07/27/83 - Renamed for use with MDM712 - Irv Hoff ; 07/01/83 - Revised for use with MDM711 - Irv Hoff ; 06/22/83 - Revised for use with MDM710 - Irv Hoff ; 06/22/83 - Altered for use with MDM710 - Irv Hoff ; 06/22/83 - Altered MDM708DP for the NEC 8001 ; computer using an external modem - Irv Hoff ; ; = = = = = = = = = = = = = = = = = = ; TAB: EQU 09H ;TAB CHARACTER BELL: EQU 07H ;bell CR: EQU 0DH ;carriage return ESC: EQU 1BH ;escape LF: EQU 0AH ;linefeed ; YES: EQU 0FFH NO: EQU 0 ; ; WBOOT: EQU 01H ;CP/M Warm boot location IOBYTE: EQU 03H ;CP/M I/O Byte location PORT: EQU 20H MODCTL1: EQU PORT+1 ;Modem status port MODDATP: EQU PORT ;NEC PC-8801 serial data port ; ; Video attributes ; INV$VIDEO EQU ')' ;ESC along with this for inverse video NORM$VIDEO EQU '(' ;And normal video BLINK$ON EQU '}' ;Blinking video on BLINK$OFF EQU '{' ;Blinking video off ; ;8251 COMMAND INSTRUCTION FORMAT ; RES: EQU 0100$0000B ; Internal Reset (To mode instruction) RTS: EQU 0010$0000B ; Request to send ERR: EQU 0001$0000B ; Error Reset BRK: EQU 0000$1000B ; Send Break REN: EQU 0000$0100B ; Recieve Enable DTR: EQU 0000$0010B ; Data terminal ready TEN: EQU 0000$0001B ; Transmit Enable ;8251 MODE INTRUCTION FORMAT STOP1: EQU 0100$0000B ;Framing Control, 1 Stop bit STOP1$5: EQU 1000$0000B ;1 and 1/2 Stop bits STOP2: EQU 1100$0000B ;2 Stop bits NO: EQU 00$0000B ;No Parity ODD: EQU 01$0000B ;Odd parity EVEN: EQU 11$0000B ;Even parity FIVE: EQU 0000B ;Five bit character length SIX: EQU 0100B ;Six bit character length SEVEN: EQU 1000B ;Seven bit character length EIGHT: EQU 1100B ;Eight bit character length X1: EQU 01B ;Asynchronous times one X16: EQU 10B ;Asynchronous times sixteen X64: EQU 11B ;Asynchronous times sixty-four ; 8251 COMMAND READ MASK VALUES TXRDYMSK EQU 0000$0001B RXRDYMSK EQU 0000$0010B TXEMSK EQU 0000$0100B PARERRMSK EQU 0000$1000B OVRNERRMSK EQU 0001$0000B FRAMERRMSK EQU 0010$0000B SYNDETMSK EQU 0100$0000B DSRMSK EQU 1000$0000B ; OTHER PORTS AND MASK EQUATES DCDPORT EQU 40H ;DCD data port DCDMSK EQU 0000$0100B ;DCD data bit mask RS$VECTOR EQU 0FF00H ;location where the RS-232 vector goes ; ; System control port data (output port 30H) ; SYS$OUT EQU 30H CMT$600 EQU 0000$0000B ;Cassette baud=600 CMT$1200 EQU 0001$0000B ;Cassette baud=1200 RS232$ASYNC EQU 0010$0000B ;Asynchronous RS-232 RS232$SYNC EQU 0011$0000B ;Synchronous RS-232 CMT$OFF EQU 0000$1000B ;Cass. motor off CMT$MARK EQU 0000$0100B ;Cass. carrier=mark CRT$BW EQU 0000$0010B ;CRT is in black & white mode CRT$80 EQU 0000$0001B ;CRT is in 80 char/row mode ; ; Interrupt mask port data ; INTMSK EQU 0E6H ;INTERRUPT MASK PORT MSKREG EQU 0FFFEH ;IMAGE OF I/O PORT E6H RTMF EQU 0000$0001B ;Enable real time interrupts VRMF EQU 0000$0010B ;Enable vert. retrace interrupts RXMF EQU 0000$0100B ;Enable RxRDY interrupts ; ; Interrupt controller port data ; UP8214 EQU 0E4H ;UPD8214 interrupt controller port ALL$INT$EN EQU 0000$1000B ;Enable all interrupts, ignore current ;status register ; ; MEX service processor stuff ... MEX supports an overlay service ; processor, located at 0D00H (and maintained at this address from ; version to version). If your overlay needs to call BDOS for any ; reason, it should call MEX instead; function calls below about ; 240 are simply passed on to the BDOS (console and list I/O calls ; are specially handled to allow modem port queueing, which is why ; you should call MEX instead of BDOS). MEX uses function calls ; above about 244 for special overlay services (described below). ; ; Some sophisticated overlays may need to do file I/O; if so, use ; the PARSFN MEX call with a pointer to the FCB in DE to parse out ; the name. This FCB should support a spare byte immediately pre- ; ceeding the actual FCB (to contain user # information). If you've ; used MEX-10 for input instead of BDOS-10 (or you're parsing part ; of a SET command line that's already been input), then MEX will ; take care of DU specs, and set up the FCB accordingly. There- ; after all file I/O calls done through the MEX service processor ; will handle drive and user with no further effort necessary on ; the part of the programmer. ; MEX EQU 0D00H ;address of the service processor INMDM EQU 255 ;get char from port to A, CY=no more in 100 ms TIMER EQU 254 ;delay 100ms * reg B TMDINP EQU 253 ;B=# secs to wait for char, cy=no char CHEKCC EQU 252 ;check for ^C from KBD, Z=present SNDRDY EQU 251 ;test for modem-send ready RCVRDY EQU 250 ;test for modem-receive ready SNDCHR EQU 249 ;send a character to the modem (after sndrdy) RCVCHR EQU 248 ;recv a char from modem (after rcvrdy) LOOKUP EQU 247 ;table search: see CMDTBL comments for info PARSFN EQU 246 ;parse filename from input stream ret the code BDPARS EQU 245 ;parse baud-rate from input stream SBLANK EQU 244 ;scan input stream to next non-blank EVALA EQU 243 ;evaluate numeric from input stream LKAHED EQU 242 ;get next char w/o removing from input GNC EQU 241 ;get char from input, cy=1 if none ILP EQU 240 ;inline print DECOUT EQU 239 ;decimal output PRBAUD EQU 238 ;print baud rate PRNTBL EQU 237 ;This function is passed a MEX format ;command table pointer in HL (eg, your ;SET command table). It prints ;the table in columnar format...returns ;carry=1 if the console aborted with ;^C while the table was being printed. PRID EQU 236 ;Prints the MEX current MEX ID string ;on the console CONOUT EQU 2 ;simulated BDOS function 2: console char out PRINT EQU 9 ;simulated BDOS function 9: print string INBUF EQU 10 ;input buffer, same structure as BDOS 10 ;************************************************************************ ;* * ;* Start of the program.. the following lines are in a fixed format * ;* do not insert or delete any of the define byte locations. * ;* * ;************************************************************************ ORG 0100H DS 3 ; 100H PMMIMODEM: DB NO ;Yes=PMMI modem \ / These 2 locations 103H SMARTMODEM: DB NO ;Yes=SMARTMODEM / \ aren't used by MEX 104H TOUCHPULSE: DB 'T' ;T=touch, P=pulse dial(not used by MEX 105H CLOCK: DB 19 ;Clock speed times 10 up to 25.5 Mhz. 106H MSPEED: DB 5 ;0=110 1=300 2=450 3=600 4=710 5=1200 107H ;6=2400 7=4800 8=9600 9=19200 default BYTDLY: DB 5 ;0=0 delay 1=10ms 5=50 ms - 9=90 ms 108H ;default time to send character in ter- ;minal mode file transfer for slow BBS. CRDLY: DB 5 ;0=0 delay 1=100 ms 5=500 ms - 9=900 ms 109H ;default time for extra wait after CRLF ;in terminal mode file transfer NOOFCOL: DB 5 ;number of DIR columns shown 10AH SETUPTST: DB YES ;yes=user-added Setup routine 10BH SCRNTEST: DB YES ;cursor control routine 10CH ACKNAK: DB YES ;yes=resend a record after any non-ACK 10DH ;no=resend a record after a valid NAK BAKUPBYTE: DB YES ;yes=change any file same name to .BAK 10EH CRCDFLT: DB NO ;yes=default to CRC checking 10FH TOGGLECRC: DB YES ;yes=allow toggling of CRC to Checksum 110H CONVBKSP: DB NO ;yes=convert backspace to rub 111H TOGGLEBK: DB YES ;yes=allow toggling of bksp to rub 112H ADDLF: DB NO ;no=no LF after CR to send file in 113H ;terminal mode (added by remote echo) TOGGLELF: DB YES ;yes=allow toggling of LF after CR 114H TRANLOGON: DB NO ;yes=allow transmission of logon 115H ;write logon sequence at location LOGON SAVCCP: DB YES ;yes=do not overwrite CCP 116H LOCONEXTCHR: DB NO ;yes=local command if EXTCHR precedes 117H ;no=external command if EXTCHR precedes TOGGLELOC: DB YES ;yes=allow toggling of LOCONEXTCHR 118H LSTTST: DB YES ;no=printer not available (modem) 119H XOFFTST: DB YES ;yes=chcks for XOFF from remote while 11AH ;sending a file in terminal mode XONWAIT: DB NO ;yes=wait for XON after CR while 11BH ;sending a file in terminal mode TOGXOFF: DB YES ;yes=allow toggling of XOFF checking 11CH IGNORCTL: DB NO ;yes=CTL-chars above ^M not displayed 11DH EXTRA1: DB 0 ;for future expansion 11EH EXTRA2: DB 0 ;for future expansion 11FH BRKCHR: DB '@'-40H ;^@ = Send a 300 ms. break tone 120H NOCONNCT: DB 'N'-40H ;^N = Disconnect from the phone line 121H LOGCHR: DB 'L'-40H ;^L = Send logon 122H LSTCHR: DB 'P'-40H ;^P = Toggle printer 123H UNSAVE: DB 'R'-40H ;^R = Close input text buffer 124H TRANCHR: DB 'T'-40H ;^T = Transmit file to remote 125H SAVECHR: DB 'Y'-40H ;^Y = Open input text buffer 126H EXTCHR: DB '^'-40H ;^^ = Send next character 127H ; ; DS 2 ; 128H ; ; IN$MODCTL1: IN MODCTL1 ;In modem control port 12AH RET ;left here for port I.D. ; ;not really used. DS 7 OUT$MODDATP: OUT MODDATP ;Out modem data port 134H RET DS 7 IN$MODDATP: JMP SER$IN ;In modem data port 13EH DS 7 ;replaced by interrupt routines ANI$MODRCVB: ANI RXRDYMSK ;Logical AND performed. 148H RET CPI$MODRCVR: JMP SER$IN$S ;Compare replaced by interrupt 14BH ; ;status routine. ANI$MODSNDB: ANI TXRDYMSK ;Logical AND performed. 14EH RET CPI$MODSNDR: CPI TXRDYMSK ;Ready to out another char.? 151H RET ; ; ; Unused area: was once used for special PMMI functions, ; Now used only to retain compatibility with MDM overlays. ; You may use this area for any miscellaneous storage you'd ; like but the length of the area *must* be 12 bytes. ; DS 12 ; ; Special modem function jump table: if your overlay cannot handle ; some of these, change the jump to "DS 3", so the code present in ; MEX will be retained. Thus, if your modem can't dial, change the ; JMP PDIAL at DIALV to DS 3, and MEX will print a "not-implemented" ; diagnostic for any commands that require dialing. ; ; DIALV dials the digit in A. See the comments at PDIAL for specs. ; ; DISCV disconnects the modem ; ; GOODBV is called just before MEX exits to CP/M. If your overlay ; requires some exit cleanup, do it here. ; ; INMODV is called when MEX starts up; use INMODV to initialize the modem. ; ; NEWBDV is used for phone-number baud rates and is called with a baud-rate ; code in the A register, value as follows: ; ; A=0: 110 baud A=1: 300 baud A=2: 450 baud ; A=3: 600 baud A=4: 710 baud A=5: 1200 baud ; A=6: 2400 baud A=7: 4800 baud A=8: 19200 baud ; ; If your overlay supports the passed baud rate, it should store the ; value passed in A at MSPEED (107H), and set the requested rate. If ; the value passed is not supported, you should simply return (with- ; out modifying MSPEED) -or- optionally request a baud-rate from the ; user interactively. ; ; NOPARV is called at the end of each file transfer; your overlay may simply ; return here, or you may want to restore parity if you set no-parity ; in the following vector (this is the case with the PMMI overlay). ; ; PARITV is called at the start of each file transfer; your overlay may simply ; return here, or you may want to enable parity detection (this is the ; case with the PMMI overlay). ; ; SETUPV is the user-defined command ... to use this routine to build your own ; MEX command, set the variable SETFL (10BH) non-zero, and add your SET ; code. You can use the routine presented in the PMMI overlay as a ; guide for parsing, table lookup, etc. ; ; SPMENU is provided only for MDM compatibility, and is not used by MEX 1.0 for ; any purpose (it will be gone in MEX 2). ; ; VERSNV is called immediately after MEX prints its sign-on message at cold ; startup -- use this to identify your overlay in the sign-on message ; (include overlay version number in the line). ; BREAKV is provided for sending a BREAK (-B in terminal mode). If your ; modem doesn't support BREAK, or you don't care to code a BREAK rou- ; tine, you may simply execute a RET instruction. ; LOGONPTR: DS 2 ;MDM compat. not used by MEX 160H DIALV: DS 3 ;dial digit in A 162H DISCV: JMP PDISC ;disconnect the modem 165H GOODBV: JMP CPM$EXIT ;called before exit to CP/M 168H INMODV: JMP INITMOD ;initialization. Called at cold-start 16BH NEWBDV: RET ! NOP ! NOP ;set baud rate 16EH NOPARV: RET ! NOP ! NOP ;set modem for no-parity 171H PARITV: RET ! NOP ! NOP ;set modem parity 174H SETUPV: JMP SETCMD ;SET cmd 177H SPMENV: DS 3 ;not used with MEX 17AH VERSNV: JMP SYSVER ;Overlay's voice in the sign-on message 17DH BREAKV: JMP SENDBRK ;send a break 180H ; ; The following jump vector provides the overlay with access to special ; routines in the main program (retained and supported in the main pro- ; gram for MDM overlay compatibility). These should not be modified by ; the overlay. ; ; Note that for MEX 2.0 compatibility, you should not try to use these ; routines, since this table will go away with MEX 2.0 (use the MEX ; service call processor instead). ; ILPRTV: DS 3 ;replace with MEX function 9 183H INBUFV: DS 3 ;replace with MEX function 10 186H ILCMPV: DS 3 ;replace with table lookup funct. 247 189H INMDMV: DS 3 ;replace with MEX function 255 18CH NXSCRV: DS 3 ;not supported by MEX (returns w/no action) 18FH TIMERV: DS 3 ;replace with MEX function 254 192H ; ; ; Clear/screen and clear/end-of-screen. Each routine must use the ; full 9 bytes alloted (may be padded with nulls). ; ; These routines (and other screen routines that MEX 2.0 will sup- ; port) will be accessed through a jump table in 2.0, and will be ; located in an area that won't tie the screen functions to the ; modem overlay (as the MDM format does). CLREOS: LXI D,EOSMSG ;CLEAR TO END OF SCREEN 195H MVI C,PRINT CALL MEX RET ; CLRSCRN: LXI D,CLSMSG ;Home cursur & clear screen 19EH MVI C,PRINT CALL MEX RET ; 1A6H ; ;=========================================================================== ; ; -------END OF THE FIXED FORMAT AREA------- ; ;=========================================================================== EOSMSG: DB ESC,59H,'$' ;Clr. to end of screen msg. CLSMSG: DB 1EH,ESC,59H,'$' ;Home cursur, then clr. to eos ; SYSVER: LXI D,SOMESG ;Sign on message MVI C,PRINT CALL MEX RET SOMESG: DB 'NEC PC-8801A OVERLAY V.' DB REV/10+'0' DB '.' DB REV MOD 10+'0' DB ':',CR,LF DB '$' ; This routine allows a 300 ms. break tone to be send to reset some ; time-share computers. ; SENDBRK: MVI A,RTS+ERR+BRK+REN+DTR+TEN ;SEND A BREAK TONE JMP GOODBYE1 ; ; This routine sends a 300 ms. break tone and sets DTR low for the same ; length of time to disconnect some modems such as the Bell 212A, etc. ; PDISC: MVI A,ERR+BRK+TEN ;Send break, turn off RTS & DTR ; GOODBYE1: OUT MODCTL1 ;Send to status port MVI B,3 ;WAIT 300 MS. MVI C,TIMER CALL MEX MVI A,RTS+ERR+REN+DTR+TEN ;Normal send/receive with RTS & DTR OUT MODCTL1 ;Send to status port RET ; ; ; PC-8801 initialization - sets the 8251A usart for 8 bits,1 stop bit,DTR high ; The clock rate is then divided by either 16 or 64 (giving 1200 or 300 baud) ; via the "SET" command. Set at present to default to 1200 baud with the ; RS-232 jumper at position 5. ; INITMOD: CALL INITUSART ;Reset the usart to the mode instruction state ; INITMOD1: MVI A,STOP1+NO+EIGHT+X16 ;Default to divede by 16 for 1200 baud OUT MODCTL1 ;Modem status port MVI A,RTS+ERR+REN+DTR+TEN ;RTS, DTR, RCV, XMT, ERROR RESET OUT MODCTL1 ;Modem status port MVI A,RS232$SYNC+CMT$OFF+CRT$BW+CRT$80 OUT SYS$OUT ; ;Set up for interrupt driven RS-232 processing ; DI LDA MSKREG ;Keep previous state STA INT$MASK$SAVE ;Of the interrupt masks MVI A,RTMF+VRMF+RXMF OUT INTMSK STA MSKREG LHLD RS$VECTOR ;get the current RS-232 interrupt vector SHLD INT$VECTOR$SAVE ;Save it away LXI H, INT$RS232 ;where to go on a RXRDY interrupt SHLD RS$VECTOR ;address for the interrupt RS-232 vector EI IN MODDATP ;get rid of any characters left IN MODDATP ;in the usart RET ; ;This subroutine puts the usart in the mode instruction state ; INITUSART: MVI A,00 ;insure out of mode OUT MODCTL1 ;modem status port OUT MODCTL1 OUT MODCTL1 ;three times to get to known state MVI A, RES ;initialize usart OUT MODCTL1 ;to the mode instruction state RET ; ; This subroutine sets the usart to the parity and baud ; rate settings specified in the USARTSAVE ; memory location. ; SET$USART: PUSH H LXI H, USARTSAVE ;Get the baudrate and parity states MOV A,M INX H ADD M ADI STOP1 ;form usart control word OUT MODCTL1 ;set the usart mode word MVI A,RTS+ERR+REN+DTR+TEN ;Form the usart command word OUT MODCTL1 ;Write it out POP H RET ; ; NEC PC-8801A serial subroutines. This uses an interrupt driven RS-232 ; routine to keep up at high ( >300 ) baud rates. The interrupt routine ; sets up a buffer that is 256 bytes long. ; ;************************************************************************ ;* * ;* Serial input status routine: returns with A=00 if there is data in * ;* the buffer, or A=FF if there is no data * ;* * ;************************************************************************ SER$IN$S: DI PUSH B PUSH H LXI H,SER$BASE ;interrupt buffer base address LDA WRITE$OFFSET ;pointer to the next location to write to MOV B,A LDA READ$OFFSET ;pointer to the next byte to be read CMP B ;read addr=write addr? JNZ INSTAT$EXIT XRA A ;yes so reset the pointers to the buffer STA READ$OFFSET STA WRITE$OFFSET DCR A ;A=FF, means no data to read out POP H POP B EI RET INSTAT$EXIT: ;there is data in the buffer, return XRA A ;with A=0 and flags set. POP H POP B EI RET ;************************************************************************ ;* * ;* Serial input routine: returns with A=(next char) if there was * ;* data in the buffer, or A=00 (null char) * ;* if there is no data * ;* * ;************************************************************************ SER$IN: CALL SER$IN$S ;See if there are any characters to read ORA A ;flags set JZ SER$IN$CONT ;There is data, continue XRA A ;There was no data, return a null character RET SER$IN$CONT: DI PUSH H PUSH D LXI H,SER$BASE LDA READ$OFFSET MVI D,00 MOV E,A DAD D ;full address to read data from INR A ;update the read pointer to next byte STA READ$OFFSET MOV A,M ;get the data POP D POP H EI RET ; ;The following is an interrupt service routine for the RS-232 input channel ;Arrive here on an Rxrdy interrupt INT$RS232: DI PUSH PSW ;Save regs. PUSH B PUSH D PUSH H LXI H,SER$BASE ;buffer base address LDA WRITE$OFFSET CPI 0F0H ;Close to full yet? JZ INT$EXIT ;If so then don't store any more chars. MVI D,00 MOV E,A DAD D ;Form the full memory address INR A STA WRITE$OFFSET ;Update the write pointer IN MODDATP ;read the RS-232 port MOV M,A ;to the buffer INT$EXIT: POP H POP D POP B MVI A,ALL$INT$EN OUT UP8214 ;fix the interrupts POP PSW EI RET SER$BASE: DS 0FFH ;256 byte long buffer base READ$OFFSET: DB 0 ;offset pointing to location to be read WRITE$OFFSET: DB 0 ;offset pointing to location to write to ; ;================================================================== ; ; THIS IS THE SET COMMAND PROCESSOR ; ;================================================================== ; ; ; Control is passed here after MEX parses a SET command. ; SETCMD: MVI C,SBLANK ;any arguments? CALL MEX JC SETSHO ;if not, go print out values LXI D,CMDTBL ;parse command CALL TSRCH ;from table PUSH H ;any address on stack RNC ;if we have one, execute it POP H ;nope, fix stack CALL ILPRT DB CR,LF,' COMMAND NOT FOUND IN TABLE ',CR,LF,0 RET SETERR: LXI D,SETEMS ;print error MVI C,PRINT CALL MEX RET ; SETEMS: DB CR,LF,'SET command error',CR,LF,'$' ; ; SET command table ... note that tables are constructed of command- ; name (terminated by high bit=1) followed by word-data-value returned ; in HL by MEX service processor LOOKUP. Table must be terminated by ; a binary zero. ; ; Note that LOOKUP attempts to find the next item in the input stream ; in the table passed to it in DE... if found, the table data item is ; returned in HL; if not found, LOOKUP returns carry set. ; CMDTBL: DB '?'+80H ;"set ?" DW STHELP DB 'BAU','D'+80H ;"set baud" DW STBAUD DB 'PARIT','Y'+80H ;Set parity DW SETPARITY DB 0 ;<<=== table terminator ; ; SET : print current statistics ; SETSHO: CALL CARRSH ;show carrier present/not present LXI H,SHOTBL ;get table of SHOW subroutines SETSLP: MOV E,M ;get table address INX H MOV D,M INX H MOV A,D ;end of table? ORA E RZ ;exit if so PUSH H ;save table pointer XCHG ;adrs to HL CALL GOHL ;do it CALL CRLF ;print newline MVI C,CHEKCC ;check for console abort CALL MEX POP H ;it's done JNZ SETSLP ;continue if no abort RET ; GOHL: PCHL ; ; table of SHOW subroutines ; SHOTBL: DW BDSHOW DW PARSHOW DW 0 ;<<== table terminator ; ; SET ? processor ; STHELP: LXI D,HLPMSG MVI C,PRINT CALL MEX RET ; ; The help message ; HLPMSG: DB CR,LF,'SET command, PC-8801A version:',CR,LF,LF DB CR,LF,'SET BAUD ' LOWSPD: DB ' 300, 600, 1200, 2400, 4800 9600' DB CR,LF,'SET PARITY EVEN ODD NONE' DB CR,LF,'$' CARRSH: ;Show the state of the data carrier ;detect (DCD) line. LXI D,NOMESG ;tell about carrier CALL CARRCK ;check for it MVI C,PRINT CNZ MEX ;print the "NO" if no carrier LXI D,CARMSG ;print "carrier present" MVI C,PRINT CALL MEX RET ; NOMESG: DB 'no $' CARMSG: DB 'carrier present',CR,LF,'$' ; ; ; check the PC-8801A for data carrier detect (DCD) (NZ=no) ; CARRCK: IN DCDPORT ;DCD DATA PORT BYTE ANI DCDMSK ;Extract the proper bit RET ; ; SET BAUD processor ; STBAUD: MVI C,BDPARS ;function code, parse baudrt from input line CALL MEX ;let MEX look up code, return it in A. JNC BAUDCONT1 ;valid code for MEX continue CALL ILPRT DB CR,LF,'That baudrate is not supported by MEX',CR,LF,0 RET BAUDCONT1: CALL PBAUD ;no, try to set it BDSHOW: CALL ILPRT ;display baud and jumper info DB 'Baud rate:',TAB,' ' BDBAUD: DB '1200' ;This is updated whenever baudrate is changed DB CR,LF,BELL DB ESC,INV$VIDEO,ESC,BLINK$ON DB 'RS-232 JUMPER MUST BE IN POSITION #' JUMP$MSG: DB '5' DB ESC,NORM$VIDEO,ESC,BLINK$OFF,BELL DB 0 RET ; ; Set baud-rate code in A (if supported by your modem overlay). NEC-8801 ; supports only two rates, for a given jumper position. NOTE: this routine ; (ie, the one vectored through NEWBDV) should update MSPEED with the ; passed code, but ONLY if that rate is supported by the hardware. ; This also must update the following values: CURRBAUD, ; BDBAUD, USARTSAVE & MSPEED. ; ; ; ++++++++++JUMPER-CLOCK RATE SELECTION TABLE++++++++++++ ; ; *The values surrounded by stars are the ones that are implimented* ; ; CLOCK RATE ; Jumper pos Divisor=16 Divisor=64 ; ; 1 75 18.75 Not supported ; 2 150 37.5 Not supported ; 3 300 75 Not supported ; 4 *600* 150 ; 5 *1200* *300* ; 6 *2400* 600 ; 7 *4800* 1200 ; 8 *9600* 2400 ; PBAUD: PUSH H ;don't alter anybody PUSH D PUSH B MOV E,A ;code to DE - save for later MVI D,0 LXI H,BAUDTB ;offset into table DAD D MOV A,M ;fetch code ORA A ;0? (means unsupported code) JNZ PBCONT ;O.K. so continue CALL ILPRT DB CR,LF,'That baudrate is not supported by this overlay' DB CR,LF,0 JMP PBEXIT PBCONT: STA USARTSAVE ;Keep track of the baudrate CALL INITUSART ;get to the mode state CALL SET$USART ;Write out the usart parameters MOV A,E ;get speed code back STA MSPEED ;make it current LXI H,JUMP$TABLE ;Get the required jumper for the DAD D ;chosen baud rate MOV A,M STA JUMP$MSG ;into the jumper message MOV A,E ;Restore the baud code ; ;Next update the baudrate displayed in BDSHOW ; LXI H,TRANSTBL ;Point to the mspeed to currbaud xlate tbl. DAD D ;Offset by the MSPEED value MOV A,M ;Get the currbaud number STA CURRBAUD LXI H,BAUDVALS ;setup to move baudrate values MOV E,A ;Offset DAD D ;Point to the new baud value to move LXI B,BDBAUD ;Destination CALL MOVE4 ;Move it PBEXIT: POP B ;all done POP D POP H RET ; ;The following is the table used to translate between the MSPEED code ;and the CURRBAUD pointer value. The order is the same as that outlined ;for the MSPEED data byte. X means that this overlay does not support ;that baudrate. ; TRANSTBL: DB 'X',0,'X',4,'X',8,12,16,20 ; ; table of baud rate divisors for supported rates ; BAUDTB: DB 0,X64,0,X16,0 ;110,300,450,600,710 DB X16,X16,X16,X16,0 ;1200,2400,4800,9600,19200 ; ; ; These routines can be used for your equipment. End with RET. If ; using the Hayes Smartmodem this is unavailable without a special ad- ; dress change. ; SPCLMENU: RET ; ;************************************************************************ ;* * ;* Setup PC-8801 for odd/even/no parity. * ;* the choices are odd or even parity with seven bits * ;* or no parity with eight bits * ;* * ;************************************************************************ SETPARITY: MVI C,SBLANK ;Any arguments? CALL MEX JNC SPARCONT ;YES CONTINUE CALL ILPRT DB CR,LF,'No parity option given',CR,LF,0 RET SPARCONT: LXI D,PARTBL CALL TSRCH ;Get the parity argument JNC PCONT ;valid argument CALL ILPRT DB CR,LF,'Not a valid parity setting',CR,LF,0 RET PCONT: MOV A,H ;get PARPTR STA PARPTR ;Pointer to parity table MOV A,L ;Get the new parity byte STA USARTSAVE+1 ;Keep track of parity & character length CALL INITUSART ;get usart in known state CALL SET$USART ;set the new usart parameters PARSHOW: LXI H,PARVALS ;parity values table LDA PARPTR ;offset according to the parity MOV E,A MVI D,0 ;put where it belongs DAD D XCHG ;DE points to current parity MVI C,PRINT CALL MEX ;display type of parity MVI C,PRINT LXI D,PARMSG CALL MEX ;Display the rest of the msg. RET ; ; The following table has data that are used to set the usart ; to the various parities. MSB is the PARPTR, LSB is the usart control. ; consisting of the desired parity, and seven (odd,even) or eight (no) ; bit data words ; PARTBL: DB 'EVE','N'+80H DB EVEN+SEVEN ;Even parity and seven bits DB 00 ;PARPTR DB 'OD','D'+80H DB ODD+SEVEN DB 06 DB 'NON','E'+80H DB NO+EIGHT DB 0BH DB 0 ;end of parity table PARMSG: DB 'PARITY SET','$' ; ; ; exit routine ; CPM$EXIT: DI LDA INT$MASK$SAVE ;reset the interrupts OUT INTMSK ;to their initial state STA MSKREG LHLD INT$VECTOR$SAVE ;get the previous vector SHLD 0FF00H ;RS-232 vector location EI RET ; ; ; ; ;========================================================= ; ; Misc. subroutines follow ; ;========================================================= ; ; ; ;This routine copies the 4 bytes pointed to by HL to the destination ;pointed to by BC. It is used to write the current baudrate into the ;various print routines. ; MOVE4: PUSH D PUSH H MVI D,04 ;FOUR BYTES TO MOVE MOVE4LOOP: MOV A,M STAX B INX H INX B DCR D JNZ MOVE4LOOP ;any more? POP H POP D RET ; ; Compare next input-stream item in table @DE; CY=1 ; if not found, else HL=matched data item ; TSRCH: MVI C,LOOKUP ;get function code JMP MEX ;pass to MEX processor ; ; Print in-line message ... blows away C register ; ILPRT: MVI C,ILP ;get function code JMP MEX ;go do it ; ; Newline on console ; CRLF: MVI A,CR CALL TYPE MVI A,LF ;fall into TYPE ; ; type char in A on console ; TYPE: PUSH H ;save 'em PUSH D PUSH B MOV E,A ;align output character MVI C,CONOUT ;print via MEX CALL MEX POP B POP D POP H RET ; ; Data area ; USARTSAVE: DB X16,NO+EIGHT ;1st byte is for the current baudrate ;divisor, 2nd is for the parity and ;character length. Default is for ;eight bits,no parity,x16 clock divisor ;(1200 baud for jumper pos #5) BAUDVALS: DB ' 300' DB ' 600' DB '1200' ;Supported baud rate values for the DB '2400' ;various jumper settings assuming DB '4800' ;a 16x clock rate. Thus for a given DB '9600' ;jumper pos. this rate and 1/4 of this ;rate are available. CURRBAUD: DB 8 ;Pointer to 1st. char. of chosen baud ;in the BAUDVALS table. Default is 1200. PARPTR: DB 0BH ;Offset to the PARVALS table for the ;current parity. (Default= NO) PARVALS: DB 'EVEN ','$' DB 'ODD ','$' DB 'NO ','$' ; ; Table to translate from the MSPEED baud rate code to the required ; jumper position. '*' if not supported ; JUMP$TABLE: DB '*','5','*','4','*' ;110,300,450,600,710 DB '5','6','7','8','*' ;1200,2400,4800,9600,19200 INT$FLAG: DB 0FFH ;Flag, used in serial status and input routines INT$VECTOR$SAVE: DW 0 ;storage for the RS-232 interrupt vector INT$MASK$SAVE: DB 0 ;Storage for the interrupt mask END