TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: PETER MAGNUSSON
from: MORITZ BARTL
date: 1997-12-19 13:33:00
subject: shut down computer

Peter has told All someting about "shut down computer":
PM> As you know, Windows95 is able to make several computers,
PM> including IBM, turn their power off. Anyone have some assembler
PM> code that does that?
The following one is NOT my source, found it in the local ASM-Area.
Don't know if it works correctly.
================ CUT ================
IDEAL           ; TASM ruuules...
MODEL TINY      ; should become a COM-file
CODESEG
org 0100h
;---------------------------------------------------------------------------
FLUSHWAIT = 2   ; number of seconds to wait for the drives to finish
                ; writing after the caches has been flushed
;---------------------------------------------------------------------------
start:
                mov   dx,offset m_newline
                mov   ah,9
                int   21h
 ; *** first check if smartdrv is active and if so,
 ; *** flush it's caches (only for smartdrv v4+)
                xor   bx,bx             ; installation check
                mov   cx,0ebabh
                mov   ax,4a10h
                int   2fh
                cmp   ax,0babeh
                jne   apm
                mov   dx,offset m_flushcache  ; just a short msg to the user
                mov   ah,9
                int   21h
                mov   bx,1              ; flush the caches
                mov   ax,4a10h
                int   2fh
                cli                     ; reset the pit, just to be sure
                mov   al,36h
                out   43h,al
                xor   ax,ax
                out   40h,al
                out   40h,al
                sti
                mov   es,ax
                mov   [es:046ch],ax     ; wait some time (s.a.)
                mov   ax,FLUSHWAIT*19
waitloop:       cmp   ax,[es:046ch]
                ja    waitloop
 ; *** second, check if the BIOS has the APM-extensions
 ; *** and if yes, try to power-off
apm:            xor   bx,bx             ; installation check
                mov   ax,5300h
                int   15h
                jc    dopoweroff
                cmp   bx,504dh
                jne   dopoweroff
                xor   bx,bx             ; disconnect any other client
                mov   ax,5304h
                int   15h
                xor   bx,bx             ; real-mode connect
                mov   ax,5301h
                int   15h
                jc    dopoweroff
                mov   bx,0001h          ; system shutdown
                mov   cx,0003h
                mov   ax,5307h
                int   15h
 ; *** third, if there is no APM-BIOS or the power can't be
 ; *** switched off automatically, tell the user to do it...
dopoweroff:     mov   dx,offset m_dopoweroff  ; another short user-msg
                mov   ah,9
                int   21h
endless:        jmp   endless
 ; *** the program's messages
m_flushcache    db    'Flushing the SmartDrive caches...',13,10
                db    'Please wait for the drives to finish writing...'
m_newline       db    13,10,36
m_dopoweroff    db    'You can safely turn me off now...',36
 ; *** that's all folks!
END start
================ CUT ================
 :::::::: Moritz Bartl :::::::::
--- Lamer Mail v1.7 R
---------------
* Origin: - just me - (2:2480/56.17)

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™.