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:23
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Who has a small program that can read and write the boot sectors of floppy disks and hard disks View 2,198 Replies 11
Original Poster Posted 2004-03-07 00:00 ·  中国 北京 联通
银牌会员
★★★
nre
Credits 1,210
Posts 361
Joined 2002-12-28 00:00
23-year member
UID 629
Gender Male
Status Offline
For use under DOS, as small as possible

Teamwork !
Floor 2 Posted 2004-03-08 00:00 ·  中国 广东 广州 电信
铂金会员
★★★★
C++启程者
Credits 5,154
Posts 1,827
Joined 2003-07-18 00:00
23-year member
UID 7105
Gender Male
Status Offline
Isn't debug the most suitable? Do you need anything else with it?
Floor 3 Posted 2004-03-08 00:00 ·  中国 福建 厦门 教育网
初级用户
Credits 152
Posts 10
Joined 2004-03-06 00:00
22-year member
UID 19335
Gender Male
Status Offline
I saw a book about CD burning mention a small software for reading sectors. Be careful to pay attention, maybe you can find it.
Floor 4 Posted 2004-03-08 00:00 ·  中国 福建 厦门 教育网
初级用户
Credits 152
Posts 10
Joined 2004-03-06 00:00
22-year member
UID 19335
Gender Male
Status Offline
I saw a book about CD burning mentioned a small software for reading sectors. Be careful and you might be able to find it.
Floor 5 Posted 2004-03-09 00:00 ·  中国 山东 烟台 芝罘区 联通
银牌会员
★★★
天的白色影子
Credits 2,343
Posts 636
Joined 2004-03-06 00:00
22-year member
UID 19350
Gender Male
Status Offline
Debug is the best, very small, and not hard to find.

Read disk boot sector
-L 100 0 0 1
-N boot.dat
-W
-Q


Write disk boot sector
-N boot.dat
-L
-W 100 0 0 1
-Q
100 refers to the memory address for saving or reading
The first 0 refers to drive A, drive C is 2, and so on
Floor 6 Posted 2004-03-13 00:00 ·  中国 北京 东城区 联通
银牌会员
★★★
nre
Credits 1,210
Posts 361
Joined 2002-12-28 00:00
23-year member
UID 629
Gender Male
Status Offline
Thanks, may I ask how to use DEBUG to generate a program with parameters as above, for example, the file name is bs.com. I want the program to be able to achieve bs 0 boot.dat to A and bs 1 boot.dat to B.

Teamwork !
Floor 7 Posted 2004-03-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 nre:

You can use batch processing to create an interface. The following is a simple code:
::BOOTMAN.BAT - By Will Sort, 2004/03/13
@echo off
if == goto help
set file=%3
if == set file=boot_%2.dat
for %%a in (S s SAVE save) do if == goto save
for %%a in (L l load save) do if == goto load

:help
echo.
echo BOOTMAN.BAT - Boot sector save/restore tool
echo.
echo Usage: BOOTMAN specifies operation specifies disk
echo Operation: S s SAVE save are all for saving, L l LOAD load are all for restoring;
echo Disk: A is 0, B is 1, and so on
echo File: Complete file name, if not specified, it is boot_disk parameter.dat
goto end

:savepre
echo L 100 %2 0 1>%temp%.\bootman.asd
echo N %file%>>%temp%.\bootman.asd
echo W>>%temp%.\bootman.asd
echo Q>>%temp%.\bootman.asd
goto operate

:loadpre
echo L 100 %2 0 1>%temp%.\bootman.asd
echo N %file%>>%temp%.\bootman.asd
echo W>>%temp%.\bootman.asd
echo Q>>%temp%.\bootman.asd
goto operate

perate
if not exist %temp%.\bootman.asd
debug nul
echo Operation completed!
del %temp%.\bootmam.asd
set file=

:end

This is a command-line direct operation interface program. It can also be made into a wizard-type interface. You can refer to the following program
Written on the spot, not tested, please use it with caution, building!
http://model.chinajewelry.net/dos/dosbbs/dispbbs.asp?boardID=6&ID=9587


※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 8 Posted 2004-03-13 00:00 ·  中国 北京 东城区 联通
银牌会员
★★★
nre
Credits 1,210
Posts 361
Joined 2002-12-28 00:00
23-year member
UID 629
Gender Male
Status Offline
Thank you very much!!!

Teamwork !
Floor 9 Posted 2004-03-14 00:00 ·  中国 河北 石家庄 联通
铂金会员
★★★★
网络独行侠
Credits 6,962
Posts 2,753
Joined 2003-04-16 00:00
23-year member
UID 1565
Gender Male
From 河北保定
Status Offline
Bart's MKBT can read and write boot sectors, and it seems to support the boot sectors of NT/2k/2003 as well.

Link: http://www.nu2.nu/mkbt

Read: mkbt -x -c c: c:\bootsect.bin
Write: mkbt -x c:\bootsect.bin c:
偶只喜欢回答那些标题和描述都很清晰的帖子!
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人!
Floor 10 Posted 2004-03-15 00:00 ·  中国 黑龙江 齐齐哈尔 联通
高级用户
★★
Credits 919
Posts 198
Joined 2004-01-17 00:00
22-year member
UID 15706
Gender Male
Status Offline
The following is the speech of qzwqzw on 2004-3-9 21:43:16:
Debug is the best, also very small, and not to worry about not finding.

 Read disk boot sector
-L 100 0 0 1
-N boot.dat
-W
-Q


 Write disk boot sector
-N boot.dat
-L
-W 100 0 0 1
-Q
100 refers to the memory address for saving or reading
The first 0 refers to drive A, drive C is 2, and so on




Can the boot of a floppy disk be written to a hard disk? ? ?
Floor 11 Posted 2004-03-15 00:00 ·  中国 山东 烟台 福山区 联通
银牌会员
★★★
天的白色影子
Credits 2,343
Posts 636
Joined 2004-03-06 00:00
22-year member
UID 19350
Gender Male
Status Offline
Sure, and it's simpler.

-L 100 0 0 1
-W 100 2 0 1
-Q

The above is written to the C drive. For the D drive, change the 2 in the W line to 3, and so on for other drives.
Floor 12 Posted 2004-03-20 00:00 ·  中国 辽宁 朝阳 联通
铂金会员
★★★★
痴迷DOS者
Credits 5,798
Posts 1,924
Joined 2003-06-20 00:00
23-year member
UID 5583
Gender Male
From 金獅電腦軟體工作室
Status Offline
Please go to http://model.chinajewelry.net/dos/dosbbs/dispbbs.asp?boardID=6&ID=9076 to take a look. There is a small program I wrote there, which has code for reading and writing the floppy disk boot sector. It may be helpful to the楼主.
熟能生巧,巧能生精,一艺不精,终生无成,精亦求精,始有所成,臻于完美,永无止境!
金狮電腦軟體工作室愿竭诚为您服务!
QQ群:8393170(定期清理不发言者)
个人网站:http://www.520269.cn
电子邮件:doujiehui@vip.qq.com
微信公众号: doujiehui
Forum Jump: