; Blokada automatycznego wycznia pyt ATX
; ukasz Odziewa (c) kwiecie 1998
            P286
            .MODEL SMALL
            .code

            ORG 100h

            ASSUME cs:@code,ds:@code,es:nothing

ptest       = 0FCABh ; zabezpieczenie przed
answer      = 0BAFEh ; wielokrotnym zaadowaniem

Start:
            push cs
            pop ds
            mov ax,ptest
            int 15h
            cmp ax,answer
            jz isinstalled
            mov ax,3515h
            int 21h
            mov WORD PTR [Vect15],bx
            mov bx,es
            mov WORD PTR [Vect15_],bx
            mov dx,OFFSET I15
            mov ax,2515h
            int 21h
            mov ax,3100h
            mov dx,20h
            int 21h

isinstalled:
            mov ah,4Ch
            int 21h

Vect15:     xor ax,ax
Vect15_:    xor ax,ax

line        db '͝'
            db ' SHUTDOWN (Y/N) ? '
            db 'ͼ'
I15:
            pushf
            cmp ax,ptest
            jz testing
            cmp ax,5307h
            jnz end15
            cmp bx,1
            jnz end15
            cmp cx,3   ; OFF
            jz shut15
            cmp cx,2   ; SUSPEND
            jz shut15
            cmp cx,1   ; STAND-BY
            jz shut15
shut15:
            pusha
            push ds
            push cs
            pop ds

            ASSUME cs:@code,ds:@code,es:nothing

            mov ax,0b800h
            mov es,ax
            mov di,1660d
            cld
            mov si,OFFSET line
            mov al,4Eh    ;red+yellow
l1:
            mov cx,20
l2:
            movsb
            stosb
            loop l2
            add di,120
            cmp di,2080d
            jc l1
            mov ah,2
            mov dl,7
            int 21h
            mov ah,7
            int 21h
            cmp al,'y'
            jz Shut
            cmp al,'Y'
            jz Shut
            pop ds
            popa
            popf
            stc
            iret
Shut:
            pop ds
            popa
testing:
            mov ax,answer
            popf
            iret
end15:
            popf
            jmp DWORD PTR cs:[Vect15]

END Start

Stron opracowa Micha Szulowski