中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟
中国DOS联盟论坛
现在时间是 2026-08-29 10:48
47,816 主题排行 / 349,916 发帖 / 今日 0 篇 / 48,265 会员排行
DOS开发编程 & 发展交流 (开发室) » DOS下关机的源程序(汇编)
可打印版本  3,698 / 4
第1楼 ko20010214 发表于 2003-06-30 00:00
版主 发帖 1,628 积分 7,296
DOS下关机的源程序(汇编)
.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
第2楼 狐狸 发表于 2003-06-30 00:00
初级用户 发帖 6 积分 118
我试试看行不行。:)
第3楼 bgn 发表于 2003-07-02 00:00
中级用户 发帖 78 积分 349

谢谢你了,我会珍惜的。
第4楼 maple 发表于 2003-07-24 00:00
中级用户 发帖 137 积分 417
THANK YOU!
第5楼 qingwashaoye 发表于 2017-02-02 21:47
中级用户 发帖 74 积分 271
save,thank you
[ 联系联盟系统管理团队 - 中国DOS联盟 - 标准版 ]
Sponsored by ifanr Inc | © 2001–2023