; BAUDSET.ASM -- A Baudrate Setting Program Created Using IMP Overlays ; ; 26-Sep-87 Jerry Levy ; 1129 Dundee Drive ; Dresher, PA 19025 ; 215 657-0898 (voice) ; ; Program which, when overlaid with an IMP overlay, allows setting ; baudrate or any other changes selectable from the IMP overlay set ; prompt. Identifies our system by making use of the sign-on string ; in the overlay. Remember to look over the IMP overlay and set any ; equates neded to customize for your setup before assembling. It is ; suggested you customize even though most settings are not required ; by the few subroutines used by us. Some things, however, like slot ; number, etc., must be set by you. ; ; I thought this approach was a neat way to arrive at a fairly general ; baudrate setting program even if most IMP inserts don't allow for the ; complete range of standard baudrates since it's easy to add others. ; I needed something to reset baudrates for non-modem use of my serial ; I/O port. In my case I added all other baudrates I needed and I also ; added 7E1 and 8N1 data-word-format selection which additionally I had ; a need for. ; ; OVERLAY SIZE: The standard IMP overlay, for use with IMP itself, ; cannot extend beyond 3FFH (loads from 0100H-3FFH). BAUDSET can ; accept larger overlays (that run from 0100H-059FH) which allows for ; addition of more baudrates, etc. ; ; ACKNOWLEDGEMENT: ; Irv Hoff's IMP communication program, and overlays for it that ; are used for customizing BAUDSET, provided the seed idea for ; this program. My inline-print subroutine was pinched from ; Irv's IMP.COM, and the inline-compare routine I use is a fixed- ; up version of Irv's. ; ; Please contact me if you encounter any problem with this program ; for any IMP overlay. I will adjust this program as necessary. ; ; TO ASSEMBLE AND OVERLAY ; You need MAC and RMAC (DRI) ; LINK (DRI) ; MLOAD (NightOwl Software) ; SYSLIB.REL (Echelon) ; ; (1) RMAC BAUDSET $PZSZ ; (2) LINK BAUDSET,SYSLIB[S] ; (3) MAC IMPOVLY.ASM $PZSZ Whatever overlay applies ; (4) MLOAD BAUDSET.COM=BAUDSET.COM,IMPOVLY.HEX ; ; Provides a ready-to-use overlaid file named BAUDSET.COM. ; ; ; Any overlaid file may be re-overlaid with another IMP overlay by ; doing steps (3) and (4) without repeating steps (1) and (2). EXTRN BLINE,PAUSE ; Found in SYSLIB.REL OFFSET EQU 0100H ; RMAC default load offset LF EQU 0AH CR EQU 0DH CONOUT EQU 02H BDOS EQU 0005H BEGIN: ORG 0100H-OFFSET JMP START MSPEED: DS 1 ; Jump vectors and what they do, copied from a typical IMP overlay. Filled ; in as appropriate either by our INIT: routine, or by overlaying with the ; proper IMP overlay. ORG 159H-OFFSET ; Start of IMP/IMP Overlay jump table J$EXITVEC:DS 3 ; Special exit vector 159H J$GOODBYE:DS 3 ; Disconnects modem by dropping DTR 15CH J$INITMOD:DS 3 ; Initializes modem, autosets baudrate 15FH J$STUPR: DS 3 ; SET routine to change baudrate 162H J$SYSVR: DS 3 ; Signon message 165H J$STRNGA: DS 3 ; 1200 bps "AT" string 168H J$STRNG1: DS 3 ; 2400 bps "AT" string 16BH J$CMDSPL: DS 3 ; Entry of baudrate on command line 16EH J$CRLF: DS 3 ; Turns up one new line on display 171H J$DIAL: DS 3 ; Start of dialing routine 174H J$DSCONT: DS 3 ; Terminates modem use 177H J$GOLST: DS 3 ; Printer routine, needed by Apple //e 17AH J$ILPRT: DS 3 ; Prints an inline string, 0 to end 17DH J$INBUF: DS 3 ; Stores a keybd string for comparison 180H J$INLNCP: DS 3 ; Inline "compare strings" routine 183H J$INMDM: DS 3 ; Max .1 sec wait for modem character 186H J$RCVRSP: DS 3 ; For 3801 I/O use (TV-803) 189H J$SNDCHR: DS 3 ; Sends a character to the modem 18CH J$SNDSTR: DS 3 ; Sends a string to the modem, $ to end 18FH J$TIMER: DS 3 ; .1 second timer (amount in 'B' reg.) 192H J$BREAK: DS 3 ; Break routine 195H J$NEW2: DS 3 ; For future needs 198H MANUAL: DS 1 ; For manual selection flag 19BH J$300: DS 3 ; Sets baudrate to 300 baud 19CH J$1200: DS 3 ; Sets baudrate to 1200 bps 19FH J$2400: DS 3 ; Sets baudrate to 2400 bps 1A2H START: ORG 0600H-OFFSET ; We can use large, elaborated overlays ; that load to address 600h rather than 400h CALL ILPRT DB CR,LF,'BAUDSET - Baudrate Setter Created Using IMP Overlay' DB CR,LF,' 26-Sep-87 Jerry Levy' DB CR,LF,CR,LF,0 CALL INIT ; Initialize MSPEED and jumps in jump table CALL J$SYSVR ; Identify our system CALL CRLF ; Turn up new line CALL CRLF CALL J$INITMOD ; Initialize I/O settings and prompt for reset RET ; In-line print routine ILPRT: XTHL ; So HL points to string NXT: MOV A,M ; Get first/next char ORA A ; A null? JZ IPDONE ; Done if yes PUSH B ; Otherwise output char PUSH D PUSH H MOV E,A MVI C,CONOUT CALL BDOS POP H POP D POP B INX H ; Advance pointer JMP NXT ; Loop IPDONE: XTHL ; Set return address to byte following string RET ; In-line compare routine. String we inputted is found at buffer+2. INLNCP: XTHL ; HL points to reference string LXI D,BUFFER+2 ; We use our own buffer, not BAUDBUF ; buffer referenced in the IMP overlay PUSH D ; Save pointer to buffer+2 location NXTCP: MOV A,M ; Get first/next char in reference string ORA A ; A null? maybe done, check further JZ CKDONE LDAX D ; Does char in reference string match ; corresponding char we entered? CMP M JNZ WALK ; No match, so exit INX H ; Advance pointers INX D JMP NXTCP ; Loop WALK: ; Exit after match has failed, but before we XRA A ; do, walk through the in-line reference NEXT: INX H ; to the final null terminator so the CMP M ; return address we set on exit will be JNZ NEXT ; correct NOMATCH: STC ; Set carry flag to report "not successful" JMP CPDONE CKDONE: ; Final byte in reference string was a null... LDAX D ; ...is corresponding byte we entered one too? ORA A ; Then carry is clear JNZ NOMATCH CPDONE: POP D ; Restore pointer, finish up INX H XTHL ; Set return address to byte after ref. string RET ; String input -- Get baudrate we want to set to. Buffer is at end ; of program. BYTES EQU 6 ; Maximum number of chars allowed in entry INBUF: MVI A,0FFH ; Upper-case flag for BLINE routine LXI H,BUFFER ; Buffer used by BLINE CALL BLINE ; SYSLIB input-string routine RET ; Routine to control whether a comand-line baudrate entry is permitted. ; We don't allow, so we simply ret but must do so with carry set. CMDSPL: STC RET ; Turn up new line CRLF: CALL ILPRT DB CR,LF,0 RET ; Printer setup. We don't do any. GOLST: RET ; Delay routine. This provides adequate delay for 6MHz processor. ; Delays will be longer for slower clocks. No problems are created ; by longer delays, which will be the case if your clock runs at less ; than 6 MHz. Also, if you are faster, that, too, is OK. ; ; On entry, B holds number of tenths of a second delay that is desired. TIMER: LXI H,0 MOV L,B ; Transfer the desired delay amount to HL MVI B,6 ; 6 MHz processor CALL PAUSE ; SYSLIB routine RET ; Initialize vectors in jump table. INIT: MVI A,0FFH ; Forces INITMOD in the overlay to pass STA MSPEED ; to pass us through to STUPR routine MVI A,JMP ; j$cmdspl: jmp cmdspl STA J$CMDSPL LXI H,CMDSPL SHLD J$CMDSPL+1 ; MVI A,JMP ; j$crlf: jmp crlf STA J$CRLF LXI H,CRLF SHLD J$CRLF+1 ; MVI A,JMP ; j$golst: jmp golst STA J$GOLST LXI H,GOLST SHLD J$GOLST+1 ; MVI A,JMP ; j$ilprt: jmp ilprt STA J$ILPRT LXI H,ILPRT SHLD J$ILPRT+1 ; MVI A,JMP ; j$inbuf: jmp inbuf STA J$INBUF LXI H,INBUF SHLD J$INBUF+1 ; MVI A,JMP ; j$inlncp: jmp inlncp STA J$INLNCP LXI H,INLNCP SHLD J$INLNCP+1 ; MVI A,JMP ; j$timer: jmp timer STA J$TIMER LXI H,TIMER SHLD J$TIMER+1 ; RET ; Buffer for the BLINE subroutine BUFFER: DB BYTES DS 1 ; Count DS BYTES+1 ; Buffer includes room for a null-byte ; terminator