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 07:47
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » How to determine the system's boot mode? View 1,276 Replies 13
Original Poster Posted 2003-04-01 00:00 ·  中国 山东 烟台 联通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
To All:

I am working on a batch file program, and in it I need to determine which of the following the most recent system startup mode was:
1. cold boot
2. warm boot
3. reset boot
Please tell me what approach can be used to solve this?
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 2 Posted 2003-04-02 00:00 ·  中国 广东 佛山 禅城区 电信
元老会员
★★★★
Credits 5,170
Posts 1,637
Joined 2002-10-16 00:00
23-year member
UID 8
Gender Male
From 广东佛山
Status Offline
The question is, where in the computer do these three boot modes leave recorded information?
In fact, these three boot modes do not leave any differing recorded information inside the computer. Therefore it is impossible to distinguish between these three modes.
我的网志
http://hzmys.blog.163.com/
我的网盘
firststep.qjwm.com
fsmys.ys168.com
ssmys.ys168.com
www.brsbox.com/fsmys
www.brsbox.com/ssmys
www.brsbox.com/ccdos
Floor 3 Posted 2003-04-04 00:00 ·  中国 山东 烟台 联通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
To mys:

There should be some difference.

It is said that the difference between a warm boot and a cold boot is that during a warm boot the memory is not checked again. Of course, it is possible that both clear memory, but at least this shows that the BIOS program entry point they use is different, and the former does not involve powering on. I want to know whether there are any hardware ports or CMOS chips that can record these differences.
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 4 Posted 2003-04-04 00:00 ·  中国 河北 石家庄 联通
银牌会员
★★★
Credits 1,835
Posts 648
Joined 2002-11-08 00:00
23-year member
UID 197
Gender Male
Status Offline
I seem to remember that a mark was made somewhere in memory, but because programs read and write memory while running, that does not seem very likely.
Floor 5 Posted 2003-05-03 00:00 ·  加拿大 Telus
系统支持
★★★★★★
“新DOS时代”站长
Credits 27,736
Posts 10,521
Joined 2002-10-09 12:00
23-year member
UID 9
Status Offline
Finally found a way to determine it. Using a piece of software called OnBoot can easily solve the problem.
Wengier - 新DOS时代

欢迎大家来到我的“新DOS时代”网站,里面有各类DOS软件和资料,地址:
http://wendos.mycool.net/

E-Mail & MSN: wengierwu AT hotmail.com (最近比较忙,有事请联系DOSroot和雨露,谢谢!)

Floor 6 Posted 2003-05-03 00:00 ·  中国 河北 石家庄 联通
银牌会员
★★★
Credits 1,835
Posts 648
Joined 2002-11-08 00:00
23-year member
UID 197
Gender Male
Status Offline
Boss, post it up here.
Floor 7 Posted 2004-02-02 00:00 ·  中国 山西 运城 联通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re Wengier:

Some time ago I found onboot, but after testing it on my old AVI 386 notebook, it treated both warm boot and cold boot as cold boot. Is it a machine-specific problem? That notebook has no reset button, and uses an AMI BIOS.
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 8 Posted 2004-02-05 00:00 ·  中国 山西 运城 联通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re Wengier:

Finally found a bit of information. In the BIOS communication area at a low memory address there is a marker word:

At 0040:0072, the 2-byte content is 0000h during reset or cold boot, and 1234h during a CAD warm boot.

But I doubt whether this location can be accessed directly under WINDOWS protected mode.
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 9 Posted 2004-02-20 00:00 ·  中国 广东 河源 电信
高级用户
★★
Credits 916
Posts 201
Joined 2003-05-04 00:00
23-year member
UID 1849
Gender Male
Status Offline
So how exactly was it solved, can willsort talk about it?
Also, I tried the onboot software introduced by the moderator, but I don't know how to use it. Moderator, can you teach me?
I used it like this:
onboot warm goto ok

k
echo ok!

But when doing a warm boot, it still doesn't jump to OK and display OK
Floor 10 Posted 2004-02-20 00:00 ·  中国 广东 深圳 南山区 电信
初级用户
★★
鹰击长空
Credits 271
Posts 61
Joined 2003-08-20 00:00
22-year member
UID 8964
Gender Male
Status Offline
What the poster above said is correct,

There is such a marker word in the BIOS data area:
0040:0072 word is 0000h during reset or cold boot;
during a warm boot it is 1234h;
this part is the BIOS data area and will not be occupied by other programs.
适合的,就是最好的!
DOS,永远的初恋情人。
Floor 11 Posted 2004-03-23 00:00 ·  中国 上海 嘉定区 电信
初级用户
Credits 110
Posts 5
Joined 2004-03-23 00:00
22-year member
UID 20883
Gender Male
Status Offline
It may also be 4321h, or 0064h, so there are still slight differences here.

At 40:72h,
0000h cold boot checks memory, all memory contents are lost.
1234h warm boot ignores memory check, all memory contents may be lost.
4321h warm boot ignores memory check, RAM remains unchanged.
0064h BIOS loop test

In addition, most notebook BIOSes provide a record called Powerlog. This LOG is one or two BYTEs, written in EEPROM. It records the conditions of the previous few power-ons. Among them it can tell whether it was a cold boot or warm boot, whether shutdown was normal or abnormal, and even whether it was a WINDOWS shutdown. For example, DELL machines all have this LOG.
Floor 12 Posted 2004-03-23 00:00 ·  中国 山西 太原 联通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re allan^:

Question: are the things you mentioned closely related to the BIOS version? On relatively old models (for example the AVI386 I mentioned, or other 386-class desktops), are there any related records or byte contents?

Also, I actually observed the byte content at 42:70 under different conditions with DEBUG, and tested a total of three different machine types, including two notebooks and two desktops. Each time I entered WINDOWS DOS real mode, and found that whether it was a cold boot, warm boot, or reset boot, the content was always 0000. What is the reason for this?

Finally, I want to ask brother allan^, where can detailed related materials be found? Many thanks!
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 13 Posted 2004-03-24 00:00 ·  中国 上海 松江区 电信
初级用户
Credits 110
Posts 5
Joined 2004-03-23 00:00
22-year member
UID 20883
Gender Male
Status Offline
POWER LOG is indeed closely related to the BIOS, and old BIOSes probably do not support it.

Also, the rewriting of 42:70 in the BDA (BIOS DATA AREA) is effective in real mode, not under WINDOWS Vx86 mode; under WINDOWS this place is no longer used.
I suggest you use a pure DOS environment, such as DOS6.22, to verify it.

As for the BDA part, Frank van Gilluwe's The Undocumented PC (PC Technical Inside Story) explains it. As for POWERLOG, I think books currently on the market probably do not mention it.
Floor 14 Posted 2004-04-13 00:00 ·  中国 山西 运城 联通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
Re allan^:

Very sorry, I have been very busy for a while and did not reply in time.

By the pure DOS environment you mentioned, you mean a real-mode DOS environment without loading EMM386, right? I will go back and try it, hope it works.
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Forum Jump: