Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : CLIPDIAL.ZIP
Filename : MODEM.ASM

Output of file : MODEM.ASM contained in archive : CLIPDIAL.ZIP
;*: Program: MODEM.ASM
;*: System: Clipdial Intelligent Phone Dialer V#1.0
;*: Author: Glendon Todd / Vega Group
;*: Copyright (c) 1987, Public Domain by Glendon Todd
;*: Documented: 11/26/87 12:20 SNAP! version 2.01

; This source file contains the assembly language routines that Clipdial
; uses to control and to communicate with the PC serial ports. Included
; are serial port initialization code, a routine that returns the status of
; the serial port's DSR status line, and a routine which transmits modem
; command strings (AT-prefixed) to a Hayes-compatible modem and which
; controls the serial port's DTR line appropriately.
; The DTR control and command transmission code are based on the DOSMODEM
; utilities written by Donovan Kuhn and John Niedfeldt.

; For support, comments, questions or whatever, contact :
; Glendon Todd
; 312 Van Buren St.
; Falls Church, VA 22046
; Compuserve 71121,352
; Voice (703) 532-8191

upcase macro char
local nocvt


upcase al


cmp char,'a'
jb nocvt
cmp char,'z'
ja nocvt
sub char,32

page 66,132
extrn _retl:far ; return logical true or false

prog segment byte public 'PROG'
assume CS:prog, DS:prog

arg_str equ byte ptr es:[si]

public auxout

auxout proc far
push ax
mov dx,base
add dx,5

in al,dx
and al,20h
jz txlp

pop ax
sub dx,5
out dx,al
auxout endp

; DSR - Procedure returns value of DSR line from modem.
; Currently works for Com1 only.
; Input arguments - none.
; Returns status as logical True/False.
public dsr
dsr proc far
mov dx,03FEh
in al,dx
and ax,0030h

push ax ; put return value on the stack
call _retl ; return logical value to clipper
pop ax ; restore the stack

dsr endp

; MODEMCMD - Transmits a command string to a Hayes-compatible modem.
; Input arguments - Pointer to string - command to be transmitted.
; Modemcmd will initialize the comm. port, control DTR as necessary,
; prefix the command with "AT", and terminate it with a CR (0Dh).
public modemcmd
modemcmd proc far
jmp modemcmd1

base dw 0

push bp
mov bp,sp
push es
mov es,[bp+8]
mov bx,[bp+6]
mov ch,0 ;default com port (COM1:)
mov si,bx
mov cl,[arg_str] ;space off leading spaces
cmp cl,' '
jz modemcmd2

cmp cl,'?'
jz errexit

upcase cl ;using UPCASE without a parameter
cmp cl,'C' ;(defaults to AL)
jnz nocom

mov cl,[arg_str][1]
upcase cl ;using UPCASE using another register
cmp cl,'O'
jnz nocom

mov cl,[arg_str][2]
upcase cl ;using UPCASE with cl as the parm
cmp cl,'M'
jnz nocom

cmp byte ptr [arg_str][4],':'
jz check_port

lea dx,errmsg
mov ah,9
int 21h
jmp exit

mov al,[arg_str][3] ;get the com number
sub al,'1' ;convert to binary
cmp al,3 ;greater than com4?
ja errexit

add si,5

mov ch,al
xor bh,bh
shl ch,1 ;ch holds comm. port number

mov ah,0 ;service 0 - initialize comm. port
mov al,83h ;sets port to 1200,N,8,1
;change 83h to 43h for 300 baud,
;0A3h for 2400 baud
mov dh,0
mov dl,ch ;serial port number from ch
int 14h

mov ax,40h
mov ds,ax
push bx
mov bh,0
mov bl,ch
mov ax,ds:[bx]
pop bx
push cs
pop ds

cmp ax,0
jnz comok

lea dx,ncstr
jmp errexit1

mov base,ax ;comm port base address

mov dx,ax
add dx,4
in al,dx ;get comm port status
or al,3 ;set dtr bit
out dx,al
push dx

mov al,'A'
call auxout
mov al,'T'
call auxout

mov al,[arg_str]
inc si
cmp al,0
jz atdone
call auxout
jmp outlp
mov al,0Dh ;CR
call auxout
pop dx
in al,dx
and al,0fch
out dx,al
pop es
pop bp
modemcmd endp

errmsg db 'Usage: AT [COM1:|COM2:|COM3:|COM4:] command string',13,10,'$'
ncstr db 'COM port not found',13,10,'$'

prog ends

  3 Responses to “Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : CLIPDIAL.ZIP
Filename : MODEM.ASM

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: