home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 December
/
simtel1292_SIMTEL_1292_Walnut_Creek.iso
/
msdos
/
sysutl
/
aux2.arc
/
AUX2.ASM
< prev
next >
Wrap
Assembly Source File
|
1987-03-20
|
4KB
|
214 lines
title aux2 - com2 AUX driver
;
; This program will make the AUX driver talk to the COM2 port so that Windows
; can have it's debugging terminal on COM2.
;
; Copyright (c) Steve Brozosky, 1987
;
; Steve Brozosky
; 2555 Raven Road
; Pleasanton, CA 94566
;
;
; This program is available for the Public Domain.
;
;
; Version 1.00 January 19, 1987
;
;
; To use, add the following line to your CONFIG.SYS:
;
; device=aux2.sys
;
;
; To Build this program:
;
; masm aux2;
; link aux2;
; exe2bin aux2 aux2.sys
;
Cseg segment para public 'code'
Request equ es:[bx] ;pointer to request header
RequestH Struc ;Request header structure
db ? ;length of Request Header (including data)
db ? ;unit code
Command db ? ;command code
Status dw ? ;status
dq ? ;reserved for DOS
Media db ? ;media descriptor byte
AddrOff dw ? ;transfer address
AddrSeg dw ?
Count dw ? ;byte/sector count value
Sector dw ? ;starting sector value
RequestH Ends
Aux2 proc far
assume cs:Cseg, ds:nothing, es:nothing
begin:
NextDev dd -1 ;no more devices
Attribute dw 1000100000000000b ;char device, supports open
Strategy dw AuxStrategy ;ptr to device strategy code
Interrupt dw AuxInt ;ptr of drive interrupt code
devName db 'AUX ' ;logical name
RequestOff dw ?
RequestSeg dw ?
;
; function table
;
funTab label word
dw Init ;Initialization
dw MediaCheck ;Media check
dw BuildBpb ;Build BIOS parm block
dw IoCtlIn ;I/O control read
dw Read ;Read
dw NdRead ;Nondestructive read
dw InStat ;Input status
dw InFlush ;Flush input buffers
dw Write ;Write
dw WriteVerify ;Write with verify
dw OutStat ;Output statuc
dw OutFlush ;Flush output buffers
dw IoCtlOut ;I/O control write
dw Open ;Open
dw Close ;Close
;
; Strategy Routine.
;
; Input:
; es:bx Address of Request Header
;
AuxStrategy:
mov cs:RequestSeg,es ;save segment of request header
mov cs:RequestOff,bx ;save offset of request header
ret ;and just return
;
; Interrupt Routine.
;
; Will process the previous request header.
;
AuxInt:
pushf ;save everything first
push ds
push es
push ax
push bx
push cx
push dx
push di
push si
cld
les bx,dword ptr cs:RequestOff ;point to request header
mov al,Request.Command ;get command code
shl al,1 ;make into 16 bit offset
xor ah,ah ;clear high bits
lea di,funTab ;get address of function table
add di,ax ;now point to appropriate routine
jmp word ptr [di] ;and go to it
;
; Output Routines.
;
Write:
WriteVerify:
mov cx, Request.Count ;get number of bytes to write
lds si,dword ptr Request.AddrOff ;point to data
;
OLoop:
lodsb ;get byte to output
mov ah,1 ;transmit character
mov dx,1 ;go to com2
int 14h ;call BIOS comm output routine
;no error checking is done here
loop OLoop ;send out whole string
jmp done ;and exit driver
;
;
; Input Routine (Read 1 byte)
;
Read:
les di,dword ptr Request.AddrOff ;point to buffer
;
mov dx,1 ;go to com2
mov ah,2 ;receive char from comm port
int 14h ;call BIOS routine
;
stosb ;put byte into buffer
;
jmp done ;all done, exit driver
;
; These routines are not supported and should just return
; with done flag set.
;
MediaCheck:
BuildBpb:
IoCtlIn:
IoCtlOut:
NdRead:
InStat:
InFlush:
OutStat:
OutFlush:
Open:
Close:
done:
or Request.Status,0100h ;set done flag in header
;
pop si ;and restore registers
pop di
pop dx
pop cx
pop bx
pop ax
pop es
pop ds
popf
ret
;
; Initialization routine. Will display message and tell caller
; where end of driver is. This init code will then be discarded.
;
Init:
mov ah,9 ;print to console
mov dx,offset SignOn ;print signon
int 21h ;call DOS
;
mov Request.AddrSeg, cs ;put last address in header
mov Request.AddrOff, offset Init
jmp done ;and return from driver
;
;
; Signon information
;
SignOn:
db 13,10
db 'AUX2.SYS Version 1.00 Steve Brozosky',13,10
db 'AUX Port Now Redirected to COM2.',13,10,13,10,'$'
;
;
; Copyright information
;
db 'Copyright (c) Steve Brozosky, Pleasanton, California, 1987'
;
Aux2 endP
Cseg endS
end