home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-386-Vol-2of3.iso
/
b
/
batdoor.zip
/
GETMODE.ZIP
/
GETMODE.ASM
next >
Wrap
Assembly Source File
|
1986-11-21
|
5KB
|
123 lines
;
; GETMODE : Indicates Graphics Mode type for Remote PCBoard DOORS users.
;
; Courtesy of: The BBS of Excellence (312)398-2872
;
; If the user exit through a DOOR in non-Graphics mode, then the
; returned errorlevel will be 0. An errorlevel of 1 indicates
; ANSI graphics is desired, and an errorlevel of 3 indicates that
; PCBOARD.SYS could not be found.
;
cseg segment byte public 'CODE'
assume cs:cseg,ds:cseg,es:cseg
org 100h
GetMode proc near
jmp MainCode ; Skip over constant
;
ASCIIZ dw ? ; Holder for ASCIIZ string address
Handle dw ? ; Save area for file "handle"
DataArea db 60 dup(?)
ModeType db 0
;
MainCode:
Call ValidateEntry ; Validate the Command line entry format
Call OpenFile ; Go Open the file
Call ReadFile ; Read the file
Lea SI,DataArea+56 ; Point to the indicator
Mov AL,[SI] ; Get the byte
Cmp AL,'-' ; Is it graphics ?
Jnz EndMode ; No..take the default
Mov AL,1 ; Set up for
Mov ModeType,AL ; Graphics
EndMode:
Call CloseFile ; Close the file
Mov AH,4Ch ; Set up for errorlevel
Mov AL,ModeType ; Get the return code
Int 21h ; Terminate program
GetMode endp
ValidateEntry Proc Near
mov SI,80h ; point to the command buffer
Xor CX,CX ; Init the loop counter
Mov CL,[SI] ; Get the input length
Cmp CL,0 ; Was there no input ?
JZ BadEntry ; True...then abort
SkipLoop:
Inc SI ; Point to the next byte
Mov DL,[SI] ; Get the character
Cmp DL,' ' ; Is it Blank ?
Jnz ByteFound ; No...continue
Loop SkipLoop ; Else, keep on looking
ByteFound:
Mov ASCIIZ,SI ; Save the pointer
Cmp DL,97 ; Is it in lower case ?
Jb UpperCase ; No..don't change it
Sub DL,32 ; Make it upper case
UpperCase:
Cmp DL,'A' ; Is it Alpha ?
Jb BadEntry ; No...Abort
Cmp DL,'E' ; Is it too high ?
Ja BadEntry ; Yes..Abort
Inc SI ; Point to the colon
Mov DL,[SI] ; Get the character
Cmp DL,':' ; Is it a Colon ?
Jnz BadEntry ; No..Abort
Inc SI ; Point to the Slash
Mov DL,[SI] ; Get the character
Cmp DL,'\' ; Is it a slash ?
Jnz BadEntry ; No...Abort
;
LoopToEnd:
Inc SI ; Skip to the next character
Mov DL,[SI] ; Get the character
Cmp DL,13 ; End of the line ?
Jnz LoopToEnd ; No...keep on scanning
Xor AL,AL ; Init the work area
Mov [SI],AL ; Add an end-of-ASCIIZ indicator
Jmp ExitValidation ; Exit this routine
BadEntry:
Mov AL,3 ; Set up bad errorlevel
Mov AH,4Ch ; Prepare to exit
Int 21h ; Abort processing
ExitValidation:
Ret
ValidateEntry Endp
OpenFile Proc Near
Mov DX,ASCIIZ ; Point to the ASCIIZ string
Xor AL,AL ; No file protection
Mov AH,61 ; Set up the command
Int 21h ; Do the Open
Jc CantOpen ; If unable to open, tell the user
Mov Handle,AX ; Save the "handle"
Jmp ExitOpen ; Exit this routine
CantOpen:
Mov AL,3 ; Setup BAD errorlevel
Mov AH,4Ch ; Prepare to terminate
Int 21h ; Terminate processing
ExitOpen:
Ret ; Return to the caller
OpenFile Endp
CloseFile Proc Near
Mov DX,Handle ; Get the file handle
Xor AX,AX ; Init the work register
Mov AH,62 ; Set up the command
Int 21h ; Execute it
Ret ; Return to caller
CloseFile Endp
ReadFile Proc Near
Mov BX,Handle ; Get the file handle name
Lea DX,DataArea ; Point to the file area
Mov CX,60 ; Read 60 bytes
Xor AX,AX ; Init the work register
Mov AH,63 ; Set up the command
Int 21h ; Execute it
Ret
ReadFile Endp
CSEG Ends
End GetMode