(***************************************************************************) (** **) (** DDUtils By John Richardson and Dan Vanderboom **) (** Copyright 1990 John Richardson and Dan Vanderboom **) (** **) (** TopSoft Support Systems **) (** 2135 Possum Ct. **) (** Brookfield, Wi 53045 **) (** (414)796-8408 Data 12/24 **) (** **) (** **) (***************************************************************************) (** **) (** **) (** v1.00: Initial Release. **) (** v1.10: Added 9 more new procedures/functions. **) (** v2.00: Rewrote into assembly **) (** **) (***************************************************************************) Unit DDutils; Interface Uses Dos; Function DDActive:Boolean; Procedure Give_Time(Amount:Integer); Procedure Task_Off; Procedure Task_On; Function Invisible:Boolean; Procedure Switch; Procedure Resume_Invisible; Procedure Kill_Other_Job; Procedure Suspend_Invisible; Procedure Clear_KeyBoard_Buffer; Function Send_Char(Ch:Char):Boolean; Function Program_Status:Integer; Function Task_Number:Integer; Function Other_Status:Integer; Procedure Time_Sharing(Num:Integer); Function Current_TimeShare:Integer; {=========================================================================} Implementation {=========================================================================} Function DDActive:Boolean; Assembler; ASM MOV AX,0E400H INT 21H CMP AL,00H JE @not_active MOV AL,01H @not_active: End; {=========================================================================} Procedure Give_Time(Amount:Integer); Assembler; ASM MOV AH,0EEH MOV AL,BYTE PTR Amount INT 21H End; {=========================================================================} Procedure Task_Off; Assembler; ASM MOV AH,0EAH INT 21H End; {=========================================================================} Procedure Task_On; Assembler; ASM MOV AH,0EBH INT 21H End; {=========================================================================} Function Invisible:Boolean; Assembler; ASM MOV AX,0E400H INT 21H MOV BL,AL XOR AL,AL { zero register } CMP BL,02H JNE @no_invis MOV AL,01H JMP @done @no_invis: MOV AL,00H @done: End; {=========================================================================} Procedure Switch; Assembler; ASM MOV AH,0E0H MOV AL,1 INT 21H End; {=========================================================================} Procedure Resume_Invisible; Assembler; ASM MOV AH,0E0H MOV AL,73H INT 21H End; {=========================================================================} Procedure Kill_Other_Job; Assembler; ASM MOV AH,0E0H MOV AL,074H INT 21H End; {=========================================================================} Procedure Suspend_Invisible; Assembler; ASM MOV AH,0E0H MOV AL,075H INT 21H End; {=========================================================================} Procedure Clear_Keyboard_Buffer; Assembler; ASM MOV AH,0E1H INT 21H End; {=========================================================================} Function Send_Char(Ch:Char):Boolean; Assembler; ASM MOV AH,0E2H MOV DL,BYTE PTR CH INT 21H CMP AL,0 JNE @1 MOV AL,01H @1: End; {=========================================================================} Function Program_Status:Integer; Assembler; ASM MOV AH,0E4H INT 21H {Program_Status := Regs.al;} { al = 1 program is visible } { al = 1 program is invisibile } { al = any other value means DoubleDOS not running } { ah = task number (0=top, 1=bottom job) } End; {=========================================================================} Function Task_Number:Integer; Assembler; ASM MOV AH,0E4H INT 21H {MOV AX,AH} {Task_Number := Regs.ah;} { 0=top, 1=bottom } End; {=========================================================================} Function Other_Status:Integer; Assembler; ASM MOV AH,0E5H INT 21H {MOV AX,AL} {Other_Status := Regs.al;} { al = 0 no program running } { al = 1 program is running } { al = 2 program is suspended } End; {=========================================================================} Procedure Time_Sharing(Num:Integer); Assembler; ASM { Num Variable } { 0 = visible program gets 70% invisible gets 30% (default) } { 1 = visible program gets 50% invisible gets 50% of time } { 2 = visible program gets 30% invisible gets 70% of time } { 3 = top program gets 70% bottom program gets 30% of time } { 4 = top program gets 30% bottom program gets 70% of time } { 5 = returns current priotity setting in al } MOV AH,0E9H MOV AL,BYTE PTR Num INT 21H End; {=========================================================================} Function Current_TimeShare:Integer; Assembler; ASM MOV AH,0E9H MOV AL,5 INT 21H {MOV AX,AL} {Current_TimeShare := Regs.al;} End; {=========================================================================} End.