home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Jason Aller Floppy Collection
/
127.img
/
DDOS501.ZIP
/
DDSWITCH.ASM
< prev
next >
Wrap
Assembly Source File
|
1986-04-12
|
2KB
|
72 lines
SUBTTL SWITCH ROUTINE FOR A COMPILED BASIC PROGRAM
;VERSION 1.00 4/12/86
PAGE 60,132
;THIS ROUTINE SHOULD BE ASSEMBLED AND THEN LINKED INTO A COMPILED
;BASIC PROGRAM. THE BASIC PROGRAM JUST NEEDS THE FOLLOWING LINE:
; CALL SOFFSET(SWITCH)
;NOTES:
;1. WHEN YOU COMPILE THE BASIC PROGRAM YOU MUST USE THE "O" OPTION
; EXAMPLE: BASCOM/O
;2. REFER TO DDSWITCH.BAS FOR AN EXPLANATION OF "SWITCH" VALUES.
;3. SWITCH MUST BE DEFINED AS AN INTEGER
CODE SEGMENT
ASSUME CS:CODE,DS:CODE,ES:CODE,SS:CODE
PUBLIC SOFFSET
EXTENDED_CODE DB 0 ;0=NO EXTENDED CODE PENDING; 1=EXTENDED CODE PENDING
SOFFSET PROC FAR
PUSH BP
MOV BP,SP ;GET STACK POINTER
MOV SI,[BP+6]
LODSW ;GET SWITCH VALUE
CMP AL,1
JZ MAKE_INVISIBLE ;MAKE THE PROGRAM INVISIBLE
JA TWO_OR_ABOVE
DO_SWITCH:
MOV AX,0E001H
INTERRUPT21:
INT 21H ;SWITCH TO THE OTHER TASK
RETURN_TO_BASIC:
POP BP ;RESTORE BP REGISTER
RET 2 ;RETURN TO MAIN BASIC PROGRAM MODULE
MAKE_INVISIBLE:
MOV AH,0E4H
INT 21H ;SEE IF IT IS VISIBLE OR INVISIBLE
CMP AL,2
JNZ DO_SWITCH ;IT IS VISIBLE SO DO SWITCH
JMP RETURN_TO_BASIC ;ALREADY INVISIBLE
TWO_OR_ABOVE:
CMP AL,2 ;DO THEY WANT TO SWITCH OR WHAT ??
JNZ DO_SPECIAL_FUNCTION ;THEY WANT TO DO A SPECIAL FUNCTION
MOV AH,0E4H ;THEY WANT TO MAKE PROGRAM VISIBLE
INT 21H ;SEE IF ALREADY VISIBLE
CMP AL,1
JNZ DO_SWITCH ;IT IS INVISIBLE - SO DO SWITCH
JMP RETURN_TO_BASIC ;ALREADY VISIBLE
DO_SPECIAL_FUNCTION:
XCHG AH,AL ;PUT FUNCTION NUMBER IN THE AH
CMP AH,0E2H ;ARE THEY SENDING KEYS
JZ SENDING_KEY
CMP AH,0E3H
JNZ INTERRUPT21 ;NOT SENDING KEY - DO INTERRUPT
SENDING_KEY:
CMP AL,0
JZ SET_EXTENDED_CODE ;THEY WILL BE SENDING EXTENDED CODE
CMP CS:EXTENDED_CODE,0
JZ INTERRUPT21 ;NO EXTENDED CODE IN PROGRESS
MOV CS:EXTENDED_CODE,0
MOV DH,AL
MOV AL,0FFH ;FLAG DOUBLEDOS THAT THIS IS EXTENDED CODE
XOR DL,DL
JMP INTERRUPT21 ;SEND EXTENDED CODE
SET_EXTENDED_CODE:
MOV CS:EXTENDED_CODE,1
JMP RETURN_TO_BASIC ;WAIT FOR CODE CHARACTER CODE
SOFFSET ENDP
CODE ENDS
END