home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
lan
/
lanutsrc.arj
/
RXMCOM.ASM
< prev
next >
Wrap
Assembly Source File
|
1991-03-13
|
8KB
|
280 lines
INCLUDE \ASM\INCLUDE\BIOS.INC
INCLUDE DEFS.INC
MSG_OFFS EQU 66 ; position of message text in buffer
BIOS_SEG EQU 0040h ; seg address of BIOS data area
KBD_HEAD EQU 01Ah ; offset of keyboard head ptr
KBD_TAIL EQU 01Ch ; offset of keyboard tail ptr
LOGOUT_SERVICE EQU 80h
RUN_SERVICE EQU 81h
msv SEGMENT
ASSUME CS:msv
ASSUME DS:msv
ASSUME ES:msv
ASSUME SS:NOTHING
ORG 0
SEG_ORG EQU $
ORG 100h
main PROC FAR
start: jmp init ; Do initialization section
;*******************************************************************
; LANOS VECTOR TSR portion of Resident Extensions
; The LANOS portion simply sets a message received flag and
; exits, leaving the actual processing of the message to an
; interrupt.
;*******************************************************************
MSV_entry: jmp first ; skip data area
msg_flag db 0
kbd_busy db 0 ; still stuffin' that buffer
kbd_index dw 0 ; current position in string
msg_state db 0 ; storage for old msg flag
msg_address dd ? ; message address data
old_msr dd ?
old_vector2 dd ? ; old DOS service vector
old_stk_seg dw ? ; Calling program's stack info
old_b_ptr dw ?
old_stk_ptr dw ?
new_stk_seg dw ?
new_stk_ptr dw OFFSET TOS
dw 60 dup (?) ; local stack data area
TOS equ $
;************************************************************************
; Start of actual LANOS message handler. This message handler should
; be loaded last.
;************************************************************************
first:
push ax ; save the regs we're gonna use
mov word ptr cs:msg_address,bx ; save address of incoming message
mov word ptr cs:msg_address + 2,es
mov al,es:[bx]+1 ; get the MB_type field
cmp al,80h ; is it for us?
jl END_MSH ; if less than 80h it's not ours
mov cs:msg_flag,al ; save the message type.
pop ax ; restore ax
iret ; back to originally scheduled program
END_MSH:
pop ax ; restore AX register
jmp cs:old_msr ; call everyone else...
;*****************************************************************************
; Interrupt E0 handler --- this is apparently something that LANtastic uses
; internally to indicate when DOS is safe.
;*****************************************************************************
INT_E0 DD 0
DOSFREE:
PUSHF
CALL CS:old_vector2 ; give everyone else a chance...
push ax ; save the regs we're using
push dx
mov al,cs:msg_flag ; get message flag
cmp al,0 ; have our services been requested?
jz Done_E0 ; If not, skip this stuff
CHK_LOGOUT:
cmp al,LOGOUT_SERVICE ; is it a logout request?
jne CHK_RUN ; if not, continue
call logout ; execute the logout
mov cs:msg_flag,0 ; reset the message flag
jmp Done_E0 ; all done.
CHK_RUN:
cmp al,RUN_SERVICE ; is it a remote RUN request?
jne Done_E0
cmp cs:kbd_busy,0 ; are we already stuffing the buffer?
jnz DO_RUN
inc cs:kbd_busy ; set the busy flag
mov cs:kbd_index,66 ; set our string pointer to the text.
DO_RUN:
; Note -- stuff_buffer is responsible for clearing msg_flag and kbd_busy when
; it has stuffed all the characters into the buffer and added a carriage
; return
call stuff_buffer ; Enter a character into der buffer.
Done_E0:
pop dx
pop ax
iret
;*****************************************************************************
; Logs the computer out of the specified server
;*****************************************************************************
logout PROC near
push di
push ax
push es
mov di,word ptr cs:msg_address ; put server name in ES:DI
add di,MSG_OFFS ; point to message text
mov ax,word ptr cs:msg_address+2
mov es,ax
mov ax,5F82h ; log out of the server
int 21h ; do it!
pop es
pop ax
pop di
ret
logout ENDP
;*****************************************************************************
; Stuffs the specified command in the keyboard buffer, one key at a time.
;
;*****************************************************************************
Stuff_Buffer PROC near
@NewStack
cli ; forbid interrupts
; Point DS to our command string buffer
mov ax,word ptr cs:msg_address+2 ; point data segment to msg buffer
mov ds,ax
mov si,word ptr cs:msg_address
add si,cs:kbd_index ; get our offset
mov al,byte ptr ds:[si] ; get the next character
cmp al,0 ; is it the terminator
jnz Start_Stuff ; if not, continue
mov cs:kbd_busy,0 ; clear keyboard busy flag
mov cs:msg_flag,0 ; clear message flag
mov al,13 ; convert char to return
; point ES to the BIOS data area
Start_Stuff:
mov bx, BIOS_SEG
mov es, bx
mov bx, word ptr es:[KBD_TAIL] ; is anything in the buffer?
cmp bx, word ptr es:[KBD_HEAD]
jnz Done_Stuff ; if so, then don't do anything
inc cs:kbd_index ; point to the next char
mov es:[bx],ax ; save the keystroke
inc bx
inc bx ; move the tail pointer
cmp bx,3Eh ; check for buffer wrap
jl Set_Kbd_Ptrs ; have we wrapped?
mov bx,1Eh ; if so, back to start of buffer
Set_Kbd_Ptrs:
mov word ptr es:[KBD_TAIL],bx ; set the keyboard buffer ptr.
Done_Stuff:
@OldStack
ret
Stuff_Buffer ENDP
LAST_BYTE EQU $
;
; Initialization -- thrown away after load
;
;*********************************************************************
; Subroutines
;********************************************************************
PRT_STR PROC NEAR
;
; Write ASCIIZ string pointed to by ES:DI at current cursor position
;
L3:
mov al,es:[di] ; get the character
or al,al ; See if it's a zero
jz L4 ; Yes- we're done
mov bx,7 ; display page 0, fg color 7
mov ah,0Eh ; Write char / tty mode
int 10h ; Display the character
inc di ; get the next char
jmp short L3
L4:
ret
PRT_STR ENDP
title1 db " SoftMagic Resident Extension Module V1.0 for LANtastic",13,10,0
title2 db "Copyright 1990 by SoftMagic, Inc. All rights Reserved.",13,10,0
title3 db " LANtastic is a trademark of Artisoft, Inc.",13,10,0
IFDEF SHAREWARE
title5 db 7,"Thanks for trying this unregistered ShareWare Version!",7,7,13,10,0
ENDIF
init:
@NewStack ; Set up local stack
push cs
pop es
; Display title messge
mov di,OFFSET title1
call PRT_STR
mov di,OFFSET title2
call PRT_STR
mov di,OFFSET title3
call PRT_STR
IFDEF SHAREWARE
mov di,OFFSET title5
call PRT_STR
ENDIF
; Get old LANOS message handler vector
mov ax,5FE2h
int 21h
mov word ptr old_msr,bx ; Save the location of the old vector
mov word ptr old_msr+2,es
;
; Replace the LANOS message service
;
mov ax,cs
mov es,ax
mov ax,5FE3h
mov bx,OFFSET MSV_entry
int 21H
;
; Replace LANtastic's internal DOS free vector
;
MOV AX,5FE0H
INT 21H ; GET THE DOS FREE VECTOR
MOV WORD PTR old_vector2,BX
MOV WORD PTR old_vector2+2,ES
;
; Set vector to our routine
;
push cs
pop es
MOV BX,OFFSET DOSFREE
MOV AX,5FE1H
INT 21H
; Terminate and stay resident
@OldStack ; Restore caller's stack
mov dx,(offset LAST_BYTE - SEG_ORG + 15) shr 4
mov ah,31h ; free memory and leave
int 21h
main ENDP
msv ENDS
END start