中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-29 11:31
47,816 topics / 349,916 posts / today 0 new / 48,265 members
DOS开发编程 & 发展交流 (开发室) » Source code for shutting down under DOS (assembly language)
Printable Version  3,699 / 4
Floor1 ko20010214 Posted 2003-06-30 00:00
版主 Posts 1,628 Credits 7,296
.Model tiny
.Code
Org 100h
Start:

mov ax,5300h
xor bx,bx
int 15h ; Check APM install
jnb @@1
jmp ExitSys

@@1:
cmp bx,504Dh ; sign
jz @@2
jmp ExitSys

@@2:
cmp ax,101h ; ver 1.1
jnb @@3
jmp ExitSys

@@3:
push cx
mov Version,ax
mov ax,5400h
xor bx,bx
int 2Fh ; power.exe install check?
xor ax,ax
cmp bx,504Dh
jnz @@4
push ax ; power.exe version
mov ax,5401h
mov bx,100h
int 2Fh ; set management enable
pop ax
jb @@4
inc ax
@@4:
pop cx
push ax
push bx
push cx
mov ax,5301h
xor bx,bx
int 15h ; real-mode interface
mov ax,530Eh
xor bx,bx
mov cx,101h
int 15h ; driver version
mov ax,530Fh
mov bx,1
mov cx,bx
int 15h ; engage power management
mov ax,5308h
mov bx,1
mov cx,bx
int 15h ; enable power mamagement
mov ax,5307h
mov bx,1
mov cx,3
int 15h ; power off
pop cx ; support device

test cl,8 ; BIOS power management disable?
jz @@5
push cx
mov ax,5308h
mov bx,1
xor cx,cx
int 15h ; system stand-by
pop cx

@@5:
test cl,10h ; BIOS power disengaged
jz @@6
mov ax,530Fh
mov bx,1
xor cx,cx
int 15h ; disengage power management

@@6:
mov ax,5304h
xor bx,bx
int 15h ; disconnect interface
pop bx
pop ax
test ax,ax
jz ExitSys
mov ax,5401h
mov bl,bh
mov bh,1
int 2Fh ; set APM firmware power manager enable

ExitSys:

mov ax,4c00h
int 21h

Version DW ?

End Start
Floor2 狐狸 Posted 2003-06-30 00:00
初级用户 Posts 6 Credits 118
I'll give it a try.
Floor3 bgn Posted 2003-07-02 00:00
中级用户 Posts 78 Credits 349
Thank you, I will cherish it.
Floor4 maple Posted 2003-07-24 00:00
中级用户 Posts 137 Credits 417
Floor5 qingwashaoye Posted 2017-02-02 21:47
中级用户 Posts 74 Credits 271
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023