[Original] DOS Under the TSR Program Compilation Demo Code 2 - Black Screen Protection Procedure

xiaoxiao2021-03-06  41

Windows provides a screen saver that automatically runs our prior design screen saver when we do not operate the computer in the specified time.

Below we implement a simple black screen protection program at DOS.

note:

1. If you run the Minglun Five Master Speed, then this program will not work, and the possible reason is that Minglun Five Master Changes the relevant DOS interrupt without callback.

2. If you want to use in the WINDOW 95/98 MS-DOS mode, you should set the MS-DOS mode window to full screen.

3. Win 2000 / XP did not test.

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

; File Name: Safescr.asm

Differenties: Close the screen display (black screen) in the specified time

;

; Servers: Huang Zhibin March 2003 Guangxi Hechi

;

; Reference: Computer Daily, binders in 1996, on page 243 code, Software News 1993 Completed on page 114 code

Shen Ming: You can freely reprint, and you should save your integrity. And you cannot use commercial purposes

;

, Said:

1. The first time running is always stationed, and the memory is repeated again.

2. If you run the Minglun five master, then this program will not work.

The possible reason is that Minglun Five Master Changes; related DOS interruptions, without callback.

2. If you want to use in the WINDOW 95/98 MS-DOS mode, you should set the MS-DOS mode window to full screen.

3. Win 2000 / XP did not test. LOG

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<<<<<

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<<<<

Name:

Function:; Author: Purple Endurer

; Reference: Computer Paper 1996u243, Software 1993 P114

; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<<< cseg segment

Assume CS: CSEG, DS: CSEG

ORG 100H

START: JMP @init

; ====================

Old1caddr Label DWORD

Old1Coff dw?

Old1cseg dw?

Old09addr label dword

OLD09OFF DW?

OLD09seg dw?

MCB_EVB DW?; MCB: MEMMORY Control Block

MCB_PSP DW?

SHOW DW 1

Count dw 0

Varlen Equ $ - Old1CADDR

Time EQU 1000

; ///

New1ch Proc Far

; ///

STI

Push AX

Push bx

INC CS: [count]

MOV AX, CS: [Time]

CMP CS: [count], Time

JNE @ new1chend

MOV BL, 36H

MOV AX, 1201H

INT 10h

MOV CS: [count], 0

MOV CS: [Show], 0

@ New1chend:

POP BX

POP AX

JMP CS: Old1CADDR

NEW1CH ENDP

; ///

New09h Proc Far

STI

Push AX

Push BX

CMP CS: [Show], 1h

JE @ new09hend

MOV CS: [Show], 0H

MOV BL, 36H

MOV AX, 1200H

INT 10h

@ New09hend:

MOV CS: [count], 0

POP BX

POP AX

JMP CS: OLD09ADDR

NEW09H ENDP

; ///

@Init:

MOV AX, 3509H; Get Current 1ch Interrupt Vector

Int 21h

CMP BX, OFFSET NEW09H; HAS BEEN INTALLED?

JNZ @Install; no install

MOV DX, Offset strmsgunsTall

Mov Ah, 09h

Int 21h

MOV BX, 1CH * 04H; Restore OLD 1CH Interrupt Vector

XOR AX, AX; To System Interrupt Vector Talbe

MOV DS, AX

MOV AX, ES: [OLD1COFF]

MOV DS: [BX], AX

MOV AX, ES: [OLD1CSEG]

MOV DS: [BX 2], AX

MOV BX, 09H * 04H; Restore Old 09h InterRupt Vector

MOV AX, ES: [OLD09OFF]; To System Interrupt Vector Talbe; XOR AX, AX

; MOV DS, AX; DS Must Equal 0

MOV DS: [BX], AX

MOV AX, ES: [OLD09SEG]

MOV DS: [BX 2], AX

MOV BX, 1; Release Evirenment Parameter Block

MOV AX, ES: [MCB_EVB]

MOV DS, AX

MOV Word PTR DS: [BX], 0

MOV AX, ES: [MCB_PSP]; Release TSR

MOV DS, AX

MOV Word PTR DS: [BX], 0

MOV AX, 4C00H

Int 21h

@Install:

; MOV AX, 3509H; Get Current 1ch Interrupt Vector

; INT 21h

MOV old09seg, es; store current 09h interrupt vector

MOV OLD09OFF, BX

MOV DX, OFFSET New09h; Set New 09h Interrupt Vector

MOV AX, 2509H

Int 21h

MOV AX, 351CH; Get Current 1ch Interrupt Vector

Int 21h

Mov Old1cseg, ES; Store Current 1ch Interrupt Vector

MOV Old1Coff, BX

Mov DX, Offset New1Ch; Set New 1ch Interrupt Vector

MOV AX, 251CH

Int 21h

MOV DX, Offset strmsginstall

Mov Ah, 09h

Int 21h

Store The Address of Evirenment Parameter Block

MOV AX, CS

Dec AX

MOV [MCB_PSP], AX; MOV CS: [MCB_PSP], AX

MOV BX, 2CH

MOV AX, [BX]; MOV AX, CS: [BX]

Dec AX

MOV CS: [MCB_EVB], AX

Mov dx, offset @init

Add dx, Varlen 2

MOV CL, 04H

SHR DX, CL

MOV AX, 3100H

Int 21h

; ====================

STRMSGINSTALL DB 07H, "Screensafer Installed! $"

STRMSGUNSTALL DB 07H, "Screensafer Uninstalled! $"

CSEG Ends

End Start

转载请注明原文地址:https://www.9cbs.com/read-75405.html

New Post(0)