China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-01 11:07
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » Turn off the display for DOS software View 2,289 Replies 13
Original Poster Posted 2006-04-07 22:18 ·  中国 浙江 杭州 华数宽带
新手上路
Credits 8
Posts 2
Joined 2006-04-07 22:02
20-year member
UID 53495
Status Offline
Windows has power-saving mode, and the display can be automatically turned off when not in use for a long time. Then, can DOS do that? It's best to implement it with TC.
I found a dpmsave.exe. As soon as I run it, it turns off the display, and pressing any key turns it on. I don't know how to implement it.
Floor 2 Posted 2006-04-09 16:50 ·  中国 浙江 杭州 华数宽带
新手上路
Credits 8
Posts 2
Joined 2006-04-07 22:02
20-year member
UID 53495
Status Offline
Where are the experts?
Floor 3 Posted 2006-04-10 23:35 ·  中国 江苏 苏州 电信
初级用户
Credits 46
Posts 21
Joined 2006-03-08 22:23
20-year member
UID 51619
Gender Male
From 中华人民共和国
Status Offline
Is it big or not? Can't you just take a look at the anti-Jiang compilation? It seems to be implemented by calling INT 10H. Specifically, I forgot!
Floor 4 Posted 2006-04-11 22:37 ·  中国 广东 广州 白云区 电信
金牌会员
★★★★
D◎$ Fαп
Credits 4,562
Posts 1,883
Joined 2004-01-19 00:00
22-year member
UID 15812
Gender Male
From 广东广州
Status Offline
I wrote such a program 6 years ago, calling the 4F10H sub-interrupt of INT 10H.

#include <dos.h>
main()
{
union REGS in,out;
/* Close monitor*/
in.x.ax=0x4f10;
in.x.bl=0x01;
in.x.bh=0x02;
int86(0x10,&in,&out);

/* Press any key to continue*/
getch();

/* Turn on monitor */
in.x.ax=0x4f10;
in.x.bl=0x01;
in.x.bh=0x0;
int86(0x10,&in,&out);
return;
}


[ Last edited by JonePeng on 2006-4-11 at 22:39 ]
----====≡≡≡≡ 我的至爱,永远是MSDOS!≡≡≡≡====----
Floor 5 Posted 2006-04-16 23:43 ·  中国 四川 绵阳 电信
高级用户
★★
Credits 587
Posts 282
Joined 2006-04-10 03:40
20-year member
UID 53599
Gender Male
Status Offline
Meddlesome
Press with hand and also tap the keyboard twice...
Floor 6 Posted 2006-04-17 00:17 ·  中国 上海 虹口区 电信
高级用户
★★
Credits 653
Posts 252
Joined 2006-04-16 19:48
20-year member
UID 53939
Status Offline
Originally posted by xuantian at 2006-4-16 23:43:
Meddlesome
It's two keystrokes less to press with the hand....


Makes sense. Anyway, since I have to execute this program manually every time, it's better to just press the monitor power button, heh
Floor 7 Posted 2006-04-21 00:07 ·  中国 广东 广州 天河区 电信
金牌会员
★★★★
D◎$ Fαп
Credits 4,562
Posts 1,883
Joined 2004-01-19 00:00
22-year member
UID 15812
Gender Male
From 广东广州
Status Offline
Re xuantian & asbai:

Your ideas are relatively one-sided.

What if the monitor's buttons fail or break?

The small program I made is to solve the problem of the second-hand monitor buttons I used before.

In addition, you can also create a shortcut of this program under Windows and place it in the quick launch bar of the taskbar, so that you can click this icon to avoid pressing the monitor switch.
----====≡≡≡≡ 我的至爱,永远是MSDOS!≡≡≡≡====----
Floor 8 Posted 2006-04-23 14:47 ·  中国 广西 柳州 电信
初级用户
Credits 70
Posts 22
Joined 2006-04-22 17:34
20-year member
UID 54267
Gender Male
Status Offline
Can we write it in a way of port reading and writing????
Floor 9 Posted 2006-05-17 14:51 ·  中国 北京 教育网
初级用户
Credits 84
Posts 28
Joined 2006-05-03 22:36
20-year member
UID 54894
Gender Male
Status Offline
Can the monitor be directly turned on when booting? My monitor button is broken. It can't be turned on after being turned off.
Floor 10 Posted 2006-05-18 10:57 ·  中国 广东 广州 白云区 电信
金牌会员
★★★★
D◎$ Fαп
Credits 4,562
Posts 1,883
Joined 2004-01-19 00:00
22-year member
UID 15812
Gender Male
From 广东广州
Status Offline
Originally posted by waynebeat at 2006-5-17 14:51:
Can the monitor
be turned on directly when booting?
My monitor button is broken
and it can't be turned on after being turned off.

Hehe, then don't turn off the monitor after shutting down.
----====≡≡≡≡ 我的至爱,永远是MSDOS!≡≡≡≡====----
Floor 11 Posted 2006-05-24 02:34 ·  中国 重庆 北碚区 电信
新手上路
Credits 2
Posts 1
Joined 2006-05-24 02:31
20-year member
UID 55894
Gender Male
Status Offline
```c
void crtoff()/*Turn off the display*/
{
int crtflag;/*Flag indicating whether the display supports power-saving mode*/
union REGS inregs,outregs;
inregs.x.ax=0x4f10;
inregs.x.bx=0;
int86(0x10,&inregs,&outregs);
if(outregs.h.al==0x4f)/*If the display supports power-saving mode, turn it off*/
{
inregs.x.ax=0x4f10;
inregs.x.bx=0x0201;
int86(0x10,&inregs,&outregs);
inregs.x.ax=0x4f10;
inregs.x.bx=0x0301;
int86(0x10,&inregs,&outregs);
crtflag=1;
}
else /*Otherwise, disable display refresh*/
{
inregs.x.ax=0x1201;
inregs.h.bl=0x36;
int86(0x10,&inregs,&outregs);
crtflag=0;
}
while(bioskey(1)==0&&Minf==0) /*Wait for keyboard or mouse information to turn on the display*/
GetMouseState(&Minf);
if(crtflag)/*If the display supports power-saving mode, turn it on*/
{
inregs.x.ax=0x4f10;
inregs.x.bx=0x1;
int86(0x10,&inregs,&outregs);
}
else/*Otherwise, allow display refresh*/
{
inregs.x.ax=0x1200;
inregs.h.bl=0x36;
int86(0x10,&inregs,&outregs);
}
}
```
Floor 12 Posted 2006-06-30 14:47 ·  中国 广东 深圳 天威有线宽带(关内)
初级用户
Credits 96
Posts 44
Joined 2006-06-26 17:52
20-year member
UID 57603
Gender Male
From 深圳
Status Offline
I'm not very familiar with assembly!
Floor 13 Posted 2006-07-01 16:52 ·  中国 四川 自贡 电信
初级用户
Credits 20
Posts 9
Joined 2006-06-12 03:06
20-year member
UID 56897
Gender Male
Status Offline
```c
#define DPMS_ON 0
#define DPMS_WAIT 1
#define DPMS_SUSPEND 2
#define DPMS_OFF 4

//---------------------------------------------------------------------------
// Set DPMS status
//
// Set the monitor energy-saving status
//---------------------------------------------------------------------------
BYTE yana_SetDPMSStatus(BYTE Act)
{
union REGS r;

r.w.ax = 0x4F10;
r.h.bl = 1;
r.h.bh = Act;
int386(0x10, &r, &r);
return (r.h.al == 0x4F); // If AL != 4Fh, return FALSE
}
```
Floor 14 Posted 2008-01-11 22:06 ·  中国 浙江 嘉兴 海宁市 电信
中级用户
★★
Credits 360
Posts 216
Joined 2007-05-29 17:41
19-year member
UID 89677
Gender Male
Status Offline
Is there any way to test the above code?

Sorry, I really don't understand C language programming. Even if I have the code, I don't know how to test it!
Forum Jump: