home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
RBBS in a Box Volume 1 #3.1
/
RBBSIABOX31.cdr
/
medi
/
mdmibm.asm
< prev
next >
Wrap
Assembly Source File
|
1990-10-01
|
5KB
|
192 lines
; ---- I/O DEPENDENT OVERLAY TO FRONT OF MODEM PROGRAM---
;
; ==== IBM PC VERSION FOR MAIN SERIAL PORT ====
;
;
ORG 103H
title 'Modifications made 6.3.84 (LSZ)'
PAGE 60,96
TRUE EQU OFFH
FALSE EQU OOH
;
;THESE ROUTINES ARE AT THE BEGINNING OF THE PROGRAM SO
;THEY CAN BE PATCHED BY A MONITER WITHOUT RE-ASSEMBLING
;THE PROGRAM.
;
PMMIBYTE: DB FALSE ;TRUE=PMMI MODEM
; PMMI NOT IMPLEMENTED IN THIS
; VERSION
IMSAIBYTE: DB FALSE ;TRUE=IMSAI FRONT PANEL
FASTCLK: DB FALSE ;8 MHZ OR GREATER
BAKUPBYTE: DB TRUE ;TRUE=MAKE .BAK FILE
XPRFLG: DB FALSE ;TRUE=NO MENU, FALSE=PRINT MENU
;
XINIT: JMP MXINIT ; INIT MODEM ROUTINES (NOT HARDWARE)
INXMDATA: JMP MXIN ; GET DATA FROM MODEM
OTXMDATA: JMP MXOUT ; OUTPUT DATA TO MODEM
INXSTAT: JMP MXISTAT ; TEST FOR INPUT DATA
OTXSTAT: JMP MXOSTAT ; TEST IF OK TO OUTPUT DATA
XSETXBAUD: JMP MXSETBAUD ; SETUP BAUDRATE
JPXINITMOD: JMP MXINITH ; INIT MODEM HARDWARE
;
MODCTLP: EQU 3FDH ; PUT YOUR MODEM CONTROL PORT HERE
MODSNDB: EQU 20H ; YOUR BIT TO TEST FOR SEND
MODSNDR: EQU 20H ; YOUR VALUE WHEN READY
MODRCVB: EQU 01H ; YOUR BIT TO TEST FOR RECEIVE
MODRCVR: EQU 01H ; YOUR VALUE WHEN READY
MODDATP: EQU 3F8H ; YOUR MODEM DATA PORT
;
; --- INPUT DATA FROM MODEM ---
;
MXIN: PUSH DX
MOV DX,MODDATP
INB DX
POP DX
RET
;
; --- OUTPUT DATA TO MODEM ---
;
MXOUT: PUSH DX
MOV DX,MODDATP
OUTB DX
POP DX
RET
;
; --- TEST IF DATA IS AVAILABLE FROM MODEM ---
;
MXISTAT: PUSH DX
MOV DX,MODCTLP
INB DX
POP DX
AND AL,MODRCVB
CMP AL,MODRCVR
RET ; RETURN WITH Z SET IF DATA IS READY
;
; --- TEST IF MODEM IS READY TO BE SENT NEXT CHAR. ---
;
MXOSTAT: PUSH DX
MOV DX,MODCTLP
INB DX
POP DX
AND AL,MODSNDB
CMP AL,MODSNDR
RET ; RETURN WITH Z SET IF MODEM IS READY
;
; --- INIT MODEM ROUTINES AND POSSIBLE STARTUP MESSAGE ---
; THIS MUST NOT INIT THE MODEM HARDWARE AND NEED
; NOT PRESERVE ANY REGISTERS.
;
MXINIT: MOV DX,MSG ; POINT TO MESSAGE
MOV CL,9
CALL 05H ; USE BDOS CALL TO PRINT STRING
;
;
; --- INIT THE 8250 FOR 8 BITS, NO PARITY, AND 1 STOP BIT ---
;
MOV DX,MODDATP+3 ; POINT TO LINE CONTROL REG.
MOV AL,13H ; SET TO 8 BITS, NO PARITY, SETUP MODE
OUTB DX ; 1 STOP BIT
;
MOV DX,MODDATP+1 ; POINT TO INTERRUPT ENABLE REG.
MOV AL,0
OUTB DX ; DISABLE INTERRUPTS ON THIS UNIT
;
MOV DX,MODDATP+4 ; POINT TO MODEM CONTROL REG.
MOV AL,0CH ; SET DTR & RTS
OUTB DX
;
RET
;
;CR: EQU 0DH
;LF: EQU 0AH
MSG: DB CR,LF
DB ' VERSION FOR IBM PC MAIN SERIAL PORT '
DB CR,LF,'$'
;
; --- INIT MODEM HARDWARE IF NECESSARY ---
; THIS ROUTINE MAY BE CALLED SEVERAL TIMES, SO BE
; SURE THAT THIS WILL NOT HANG UP THE HARDWARE.
;
MXINITH: RET
;
;
; --- SET HARDWARE BAUDRATE FROM STRING POINTED TO BY---
; (H,L). IF THE STRING STARTS WITH AN ASCII SPACE,
; SET THE BAUDRATE TO THE DEFAULT VALUE. IF THE
; REQUEST IS NOT VALID, RETURN WITH CARRY SET.
; NOTE: THE INTERNAL ROUTINES ONLY COPY THE
; FIRST 3 CHARACTERS OF THE BAUDRATE
; INTO THE STRING POINTED TO BY (H,L)
;
MXSETBAUD:
PUSH BX
PUSH DX
PUSH CX
MOV [PTR],BX ; SAVE POINTER
MOV AL,[BX] ; GET FIRST CHAR.
CMP AL,' ' ; IS IT A SPACE (300 BAUD)
MOV DX,B300 ; POINT TO 300 BAUD SEQUENCE
JZ SETUP ; SET BAUDRATE
MOV DX,BDTAB ; POINT TO TABLE OF BAUDRATES
MOV CH,NTAB ; GET # OF ENTRYS TO SEARCH THRU
;
SLOOP: MOV BX,[PTR] ; GET POINTER TO BAUDRATE STRING
PUSH DX ; SAVE TABLE POINTER
;
MOV CL,3 ; SET LENGTH OF ASCII BAUDRATE
SLOOP1: MOV SI,DX
LODB ; GET STRING VALUE FROM TABLE
CMP AL,[BX] ; MATCH INPUT STRING?
JNZ X1 ; NO, SO TRY NEXT TABLE ENTRY
INC BX ; MATCH, SO INC POINTERS TO TEST NEXT CHAR.
INC DX
DEC CL ; COUNT DOWN CHARACTERS
JNZ SLOOP1 ; LOOP TO TEST ALL 3 CHARACTERS
;
X1: POP DX ; GET POINTER BACK
JZ SETUP ; IF MATCH, SET BAUDRATE AND RETURN
ADD DX,4 ; POINT TO NEXT TABLE ENTRY
DEC CH ; COUNT DOWN # OF TABLE ENTRYS
JNZ SLOOP ; LOOP TO TEST ALL VALID ENTRYS
STC ; SET ERROR CONDITION IF NO MATCH
JMP XRET
;
SETUP: MOV BX,3
ADD BX,DX ; POINT TO BAUDRATE SETUP WORDS
MOV AL,[BX] ; GET ONE
MOV DX,0 ; SELECT DEVICE #0
MOV AH,0 ; SELECT INIT FUNCTION
INT 14H
XOR AL,AL ; RESET CARRY
XRET: POP CX
POP DX
POP BX
RET
;
;
; --- BAUDRATE TABLE FOR IBM SETUPS ---
; ( AND UART CONTROL BIT )
;
BDTAB:
DB '110',3
DB '150',23H
B300: DB '300',43H
DB '600',63H
; HERE INPUTS OF 120,240,480,960 ARE FOR 1200, 2400, ...
DB '120',83H
;
DB '240',0A3H
DB '480',0C3H
DB '960',0E3H
;
ENTAB: EQU $
;
NTAB: EQU 8 ; [ENTAB-BDTAB]/5 ; # OF TABLE ENTRYS
;
PTR: DS 2 ; BUFFER TO SAVE POINTER
;
;
ORG 300H ; START OF PROGRAM
PUT 300H
; ----------------------------------------------------