TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: SYLVAIN LAUZON
from: DENIS BOYLES
date: 1997-04-08 11:58:00
subject: Bosskey.Asm 1/

;[BOSSKEY.ASM] - v1.00 Public Domain (pd) 1997 by Denis Boyles
;              ! Arrowsoft Assembler v1.00D (MASM v3.0)
;              ? A demonstration "hot-key" TSR program that utilizes the 
NDOS
;                flag. The program is a "Boss Screen" that's activated by
;                pressing ALT-SYSRQ. Upon entry, INDOS is checked to see if
;                it's safe to call DOS functions.
;
;                If it's safe, the progam saves the current text screen,
;                clears it and displays the "Boss Screen". Which is nothing
;                more than a "Command Prompt" lookalike. Pressing a key will
;                restore the screen and return to the interrupted program.
;
;              * ALT-SYSRQ checking requires AT+ computer.
;                CGA+ is required for the save/restore of the screen.
;                Video mode changes are NOT intercepted, so be careful.
KEYBOARD    EQU 16h                    ;define KEYBOARD services interrupt
DOS         EQU 21h                    ;define DOS services interrupt
LF          EQU 0Ah                    ;define linefeed character
CR          EQU 0Dh                    ;define carriage return character
DUL         EQU '$'                    ;define dollar sign string terminator
PRG SEGMENT
    ASSUME CS:PRG,DS:PRG
    ORG 0100h
;[START]-------------------------------------------------------------------
;   DOS Program Entry Point.
START:
    jmp     main
;[DATA]--------------------------------------------------------------------
;   TSR Local variables are kept here.
InCAS       db 0                       ;our own "flag" for program activation
InDOS       dd ?                       ;pointer address to INDOS flag
OldCas      dd ?                       ;pointer address of previous casette 
INT
buffer      db 4096 dup(?)             ;buffer to store one 80x25 text screen
banner      db CR,"Microsoft(R) MS-DOS(R) Version 6.20",CR,LF
            db "             (C)Copyright Microsoft Corp 1981-1993.",CR,LF,LF
            db "C:\>"
            db DUL
;[NEWCAS]------------------------------------------------------------------
;   Our new casette interrupt handler (15h) which intercepts ALT-SYSRQ.
NewCas PROC
    cmp     AX,8500h                   ;keyboard calls this if ALT-SYSRQ 
ress
    jne     NC1                        ;if not, then chain to previous 
ndler
    push    AX                         ;save ALL used registers
    push    CX
    push    DX
    push    DS
    push    ES
    push    DI
    push    SI
    lds     SI,CS:[InDOS]              ;DS:SI = INDOS pointer address
    lodsb                              ;load INDOS flag into AL
    or      AL,AL                      ;test for zero condition
    jnz     NC0                        ;if 1 then INDOS so exit handler
    mov     AL,CS:[InCAS]              ;load handler flag into AL
    or      AL,AL                      ;test for zero condition
    jnz     NC0                        ;if 1 then already in handler, exit
    not     AL                         ;otherwise, flip flag, 0=FF=0
    mov     CS:[InCAS],AL              ;store back into memory
    call    SaveScreen                 ;save current text screen to buffer
    call    ClearScreen                ;clear current text screen
    push    CS                         ;save CS to stack so we can
    pop     DS                         ;load it back as DS to access data
    mov     AH,09h                     ;DOS - Print an ASCID String
    mov     DX,offset banner           ;DS:DX -> string to print
    int     DOS                        ;DOS - call interrupt to print string
    xor     AH,AH                      ;KEYBOARD - Read Keyboard
    int     KEYBOARD                   ;KEYBOARD - call interrupt for 
ypress
    call    LoadScreen                 ;restore text screen from buffer
    mov     AL,[InCAS]                 ;load handler flag into AL
    not     AL                         ;flip it back off FF=0=FF
    mov     [InCAS],AL                 ;store back into memory
NC0:                                   ;come here when ALT-SYSRQ was pressed
    pop     SI                          ;restore ALL saved registers
    pop     DI
    pop     ES
    pop     DS
    pop     DX
    pop     CX
    pop     AX
NC1:                                   ;come here if ALT-SYSRQ was NOT 
ressed
    jmp     CS:[OldCas]                 ;chain to previous interrupt handler
NewCas ENDP
;[SAVESCREEN]--------------------------------------------------------------
;   Saves the current 80x25 color screen into the memory buffer.
SaveScreen PROC
    mov     AX,0B800h                  ;AX = B800h (color RAM segment)
    mov     DS,AX                      ;DS = AX = set source segment
    xor     SI,SI                      ;zero out source index
    push    CS                         ;save CS onto the stack to
    pop     ES                         ;load it back as ES, destination
    mov     DI,offset buffer           ;DI = destination offset to buffer
    mov     CX,2048                    ;CX = 4096 / 2 WORDS data to copy
    rep     movsw                      ;copy RAM to BUFFER
    ret
SaveScreen ENDP
;[CLEARSCREEN]-------------------------------------------------------------
;   Clears the current screen to the default DOS colors.
ClearScreen PROC
    mov     AX,0B800h                  ;AX = B800h (color RAM segment)
    mov     ES,AX                      ;ES = AX = destination segment
    xor     DI,DI                      ;zero out destination index
    mov     AX,0720h                   ;AH = gray on black, AL = space
    mov     CX,2048                    ;CX = 4096 / 2 WORDS data to set
    rep     stosw                      ;fill screen with AX attribute
    ret
ClearScreen ENDP
>>> Continued to next message
 * OLX 2.1 TD * Unable to locate Coffee -- Operator Halted!
--- Maximus/2 3.01
---------------
* Origin: Frog Hollow Port Moody BC 604-469-0264/0284 (1:153/290)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.