Category : Assembly Language Source Code
Archive   : TASMSWAN.ZIP
Filename : TRM.ASM

 
Output of file : TRM.ASM contained in archive : TASMSWAN.ZIP
%TITLE "Terminal Emulator with control-code debugging"

IDEAL
DOSSEG
MODEL small
STACK 1024

;--------- from AYSNCH.obj
EXTRN ComPort:abs

cr EQU 13
lf EQU 10
bd9600 EQU 0e3h
ExitKey EQU 100

DATASEG

exitCode db 0
welcome db cr,lf,'Terminal Emulator by Tom Swan',cr,lf
db cr,lf,'Configured for 9600 baud.'
db cr,lf,'Displays control codes in brackets for debugging'
db cr,lf,'an RS232 serial line.'
db cr,lf,'>>>> Press F10 to exit <<<<',cr,lf,lf,0
string db 80 DUP (?)

CODESEG

;--------- from ASYNCH.obj
EXTRN AsynchInit:proc, AsynchStop:proc, AsynchStat:proc
EXTRN AsynchOut:proc, AsynchIn:proc, AsynchInStat:proc
;--------- from KEYBOARD.obj
EXTRN KeyWaiting:proc, GetCh:proc
;--------- from BINASC.obj
EXTRN BinToAscDec:proc
;--------- from STRIO.obj
EXTRN StrWrite:proc

Start:
mov ax,@data
mov ds,ax
mov es,ax
mov di, offset welcome
call StrWrite
mov ah,0
mov al,bd9600
mov dx,ComPort
int 14h
call AsynchInit
Emulate:
call AsynchInStat
or dx,dx
jz @@10
call AsynchIn
call DispChar
jmp Emulate
@@10:
call KeyWaiting
jz Emulate
call GetCh
jnz @@20
cmp al,ExitKey
je Exit
@@20:
call AsynchOut
jmp Emulate
Exit:
call AsynchStop
mov ah,04Ch
mov al,[exitCode]
int 21h

%NEWPAGE
;------------------------------------------------------------------------
; DispChar/OneChar - display any ASCII value
;------------------------------------------------------------------------
; Input: al = ASCII value (0...255)
; Output: none
; NOTE: control codes are displayed as [13], [10], etc
; for debugging a serial I/O line.
; Registers: ax,cx,dl,di
;------------------------------------------------------------------------
PROC DispChar
cmp al,32
jae OneChar
xor ah,ah
mov cx,1
mov di, offset string
call BinToAscDec
mov al, '['
call OneChar
call StrWrite
mov al, ']'
PROC OneChar
mov dl,al
mov ah,2
int 21h
ret
ENDP OneChar

ENDP DispChar

END Start


  3 Responses to “Category : Assembly Language Source Code
Archive   : TASMSWAN.ZIP
Filename : TRM.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: http://www.os2museum.com/wp/mtswslnk/