Category : Assembly Language Source Code
Archive   : KEYCOMM.ZIP
Filename : KEYCOMM.ASM
; This is a modified version of a very simple comm program from
; NRI. The original was made up of a bunch of subroutines that were called
; one after another. I just converted it so that there are no call instructions
; or returns, except for the interupt service routine.
; Trilobyte user #151
; Electric Dreams BBS
; 1-414-654-9159
; or
;Duane Saaski
;Exec pc
mov ah,09h
mov dx,offset hello
int 21h ;print hello message
jmp start
old_seg dw 00
old_off dw 00
buf_ptr dw 00
dis_ptr dw 00
buf_end dw 0ffh
start: mov ah,35h
mov al,0ch
int 21h ;get com1 interupt vector
mov old_seg,es
mov old_off,bx
mov dx,offset com
mov ah,25h
mov al,0ch
int 21h ;store new com1 interupt vector
mov dx,03f9h
mov al,1
out dx,al ;select type of com1 interupt
in al,21h
and al,not 10h
out 21h,al ;program interupt chip
push ds ;save old data segment
mov ds,cs
mov al,0bh
mov dx,03fc ;modem control
out dx,al
mov al,80h
mov dx,03fbh
out dx,al ;divisor access
mov al,60h
mov dx,03f8h
out dx,al ;set baud rate
inc dx
mov al,00
out dx,al
mov dx,03fbh
mov al,3
out dx,al ;set line parameters
display: mov bx,dis_ptr
cmp bx,buf_ptr ;jump to key polling if
jz key ;there is no new char in buffer
mov al,[buffer+bx] ;get character from buffer
inc bx ;increment dis_ptr in bx
cmp bx,buf_end ;see if at end of buffer
jne roomy2
xor bx,bx ;set dis_ptr to 0
roomy2: mov dis_ptr,bx
mov ah,0eh
mov bh,0
int 10h ;output teletype character
key: mov dx,03fdh
in al,dx ;check if transmit hold reg. is empty
test al,20h
jz display ;if full goto display
mov ah,6
mov dl,0ffh
int 21h ;keyboard input
jz display ;if no character,leave
cmp al,01bh ;check for escape
jz exit
mov dx,03f8h
out dx,al ;output to com1
jmp display
com: sti ;start of interupt service
push ax,bx,dx,ds
push cs
pop ds
mov dx,03f8h ;get character on-line
in al,dx
cli
mov bx,buf_ptr ;get buffer pointer
mov [buffer+bx],al ;stick character in buffer
inc bx ;increment buffer pointer
cmp bx,buf_end ;see if at end of buffer
jne roomy1 ;if not goto roomy1
xor bx,bx ;if so, set buf_ptr to zero
roomy1: mov buf_ptr,bx ;save buf_ptr
sti ;turn interupts on
mov al,20h ;end of interupt
out 20h,al ;instruction
pop ds,dx,bx,ax
iret
exit: pop ds ;get ds back
mov ah,9
mov dx,offset bye_msg
int 21h ;print goodbye message
mov al,0
mov dx,03f9h ;turn off 8250 interupts
out dx,al
in al,21h ;turn off com1 in interupt chip
or al,10h
out 21h,al
push ds
mov dx,old_off ; -------
mov ds,old_seg ; ^
mov ah,25h ; |
mov al,0ch ; |
int 21h ;replace interupt vector
pop ds
mov ah,4ch
mov al,0
int 21h ;program end
bye_msg: db 'Program terminated.',13,10,'$'
hello: db 'Com1--1200-8-N-1 hit esc key to exit.',13,10,'$'
buffer db 256 dup(0)
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/