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-06-24 08:25
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » [Recommendation] I propose that someone take the lead in establishing a DOS kernel development project StickyI View 84,060 Replies 82
Floor 16 Posted 2007-01-27 14:03 ·  中国 香港 Cyber_Express通信公司
银牌会员
★★★
阿林
Credits 1,410
Posts 497
Joined 2004-06-28 00:00
21-year member
UID 27551
Gender Male
From 九龍,香港
Status Offline

Originally posted by Buddha doesn't light at 2007-1-23 07:50 AM:
I have a immature opinion by myself, and describe as follows. I'm not familiar with DOS, however, I also feel that the volume of DOS is not particularly frightening, so, it is possible that we dissect it.


Only after seeing what Wengier said did I know that you are the author of GRUB for DOS, which is really modest. You know more than many people.


First of all, I find that the booting process of DOS is very mysterious. I think we should form a branch team to study the booting of MS-DOS. That is to say, analyze its booting code item by item. Then strip out the parts that truly belong to the kernel.


Then it is to reverse assemble...

In fact, we can also refer to the source code of FreeDOS. Understanding "how to boot" is more meaningful than purely copying.


I have just heard of LZ-DOS for the first time. Thank you. I think this is very good. If it can support the running of win.com, we can start our research from it. We don't copy it, but, I think, we study the secrets hidden by Microsoft, which does not constitute infringement.

Wengier has reduced the IO of more than 200 KB by half. I think there should still be a lot of superfluous things in this half, for example, purely for encryption, deliberately making it incomprehensible. After we "unpack" it, we can reveal the prototype of the real DOS kernel.


In fact, to be completely non-infringing, we can only start from FreeDOS, because reverse assembly is also inappropriate, but learning from it without copying is the spirit of GNU.

LZ-DOS is an improvement of the core MS-DOS 7.10 (the booting part of Win98SE). Russians only removed what they thought was useless (probably the Win98SE GUI part).


Of course, ralf brown's interrupt list is very good. We can check whether FreeDOS fully implements the functions in this list. If there are any omissions, we can make patches to improve it. In this way, it is also possible to make FreeDOS run win.com.


It is not feasible to join FreeDOS, because the developers there are not of one mind. We can just borrow the knowledge in the files.


In short, this project is very huge and needs everyone to do it together. Everyone can start from different angles and different entry points. Then, everyone exchanges experiences, learns from each other's strengths, and learns from each other.

Well, that's just my idea, and it can be regarded as my contribution to this proposal.


Very good, but there still needs a leader to organize the development and testing team.
我 的 網 站 - http://optimizr.dyndns.org
Floor 17 Posted 2007-01-27 14:08 ·  中国 香港 Cyber_Express通信公司
银牌会员
★★★
阿林
Credits 1,410
Posts 497
Joined 2004-06-28 00:00
21-year member
UID 27551
Gender Male
From 九龍,香港
Status Offline

Originally posted by Budian at 2007-1-24 07:46 AM:
I hope someone comes forward to maintain this project. However, if really no one can come forward, actually, without a leader, a flock of sheep can also move forward.


Excuse me...

"The flock of sheep each take their own place" is the process of FreeDOS. For a full 10 years, its compatibility is still not as good as a LZ-DOS... Division of labor and cooperation is very important, otherwise it will become the sticky situation of FreeDOS
我 的 網 站 - http://optimizr.dyndns.org
Floor 18 Posted 2007-01-27 14:13 ·  中国 香港 Cyber_Express通信公司
银牌会员
★★★
阿林
Credits 1,410
Posts 497
Joined 2004-06-28 00:00
21-year member
UID 27551
Gender Male
From 九龍,香港
Status Offline
Originally posted by Buddha</i> at 2007-1-27 08:34 AM:
I downloaded LZ-DOS, and its IO.SYS is very small, only 74 KB. Is there really no one using it? What a pity!



Lucho's single-floppy version has the dual kernel of LZ-DOS + E.DR-DOS...
Also has tools such as QCACHE, QHIMEM, QCDROM, AEFDISK, FM, etc.

http://johnson.tmfc.net/dos/lucho.html
我 的 網 站 - http://optimizr.dyndns.org
Floor 19 Posted 2007-01-27 16:27 ·  加拿大 多伦多大学
系统支持
★★★★★★
“新DOS时代”站长
Credits 27,736
Posts 10,521
Joined 2002-10-09 12:00
23-year member
UID 9
Status Offline
Originally posted by johnsonlam at 2007-1-27 01:03 AM:


LZ-DOS is an improvement of the core MS-DOS 7.10 (the boot part of Win98SE). Russians only removed what they thought was useless things (probably the Win98SE GUI part).



Regarding this LZ-DOS, in fact, I had studied it last year. At that time, after research, it was determined that its English/Russian version of the IO.SYS file was simply modified and compressed on the basis of the English/Russian version of the MS-DOS 7.1 kernel, and the COMMAND.COM was modified on the basis of DOS 6.x. There were some discussions in the forum about its compatibility and compression issues, such as here:

http://www.cn-dos.net/forum/viewthread.php?tid=21627

At that time, it was found through research that the Russian did not remove the Win9x GUI support part, nor did he delete any important functions. The reason why the volume is relatively small is mainly because it has been compressed. It can start the Win9x GUI normally (which I verified at that time), but there are two points to note, namely path setting and default language code page. Because its English version is modified and compressed on the basis of the English version of the MS-DOS 7.1 kernel, its default language code page is 437. And there is a requirement for Win98 startup, that is, the path setting in MSDOS.SYS must be correct, and the DOS startup code page must be the same as the Win98 code page, otherwise a registry error prompt will appear. For the former, I have posted a special post in the forum for detailed introduction; for the latter, if the code pages are not the same, you can use the COUNTRY command in CONFIG.SYS to modify. At that time, through these settings, I successfully started various Chinese and English versions of WIN from Win3.x to 98SE on LZ-DOS.
Wengier - 新DOS时代

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

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

Floor 20 Posted 2007-01-28 02:56 ·  中国 香港 Cyber_Express通信公司
银牌会员
★★★
阿林
Credits 1,410
Posts 497
Joined 2004-06-28 00:00
21-year member
UID 27551
Gender Male
From 九龍,香港
Status Offline
Originally posted by Wengier at 2007-1-27 04:27 PM:
At that time, it was found through research that the Russian didn't remove the Win9x GUI support part, nor did he delete any important functions. The main reason why the size is relatively small is mainly because it has been compressed.



Thank you, I missed it.

The Russian revealed that this is for "internal, special, military and space" use!!

The problem is -- we lack software...
我 的 網 站 - http://optimizr.dyndns.org
Floor 21 Posted 2007-01-28 04:40 ·  中国 河南 南阳 联通
银牌会员
★★★★
不甘寂寞的人
Credits 2,491
Posts 1,115
Joined 2003-09-24 00:00
22-year member
UID 10292
Gender Male
Status Offline
johnsonlam: Your Q series is included in many utility software. In contrast, the understanding of grub4dos is still very low. Actually, I only found out a few days ago that you are the author of Q. And precisely because of this, I reposted the post in the development room. I never came to the development room before.

Although I know you are suitable for being the development and management person of this project, I am also embarrassed to say it directly. After all, you already have your own project, and considering that adding extra pressure on you is not good.

I have another proposal. Those who come here should preferably state whether they can be a maintainer. If not, they should state the reason for not being able to. Considering that some people can actually be maintainers but are not very proactive, I think it is necessary to add this proposal to promote this matter.

In addition, I think we should not be too rigid about the "infringement" issue. If we strictly follow the EULA, we can do nothing. I think that is just a tight rein. We can ask software companies, is it completely reasonable for you to hide technical secrets? How can we know if there are bombs in your product without disassembling? Our understanding of "reasonableness" may be different. Humans are advanced animals, so thoughts determine actions. Let's not forget that Microsoft's actions may not be reasonable and legal (Microsoft has also been sued and lost). I think as long as we make it so that possible accusers can't find any handle. Again, don't overbind your own hands and feet.

Of course, I don't mean to "steal" other people's code at all. If we master its technical secrets, we don't need to "steal" at all. And to master technical secrets, how can you do without debug? I have read "Unpublished DOS Core Technology" before. Authors like this are all proficient players of debug. I think debug is legal; otherwise, why does DOS come with this tool? Our purpose is to find out those secrets that Microsoft shouldn't hide, which does not constitute an infringement of its intellectual property rights. Strictly speaking, its secrets are nothing but used to strangle competitors, which belongs to the category of unfair competition. Therefore, strictly speaking, we have the right to require Microsoft to disclose those secrets, at least morally, Microsoft should do so. So don't worry, our approach is completely reasonable, legal, and reasonable.

---------------

Also, the latest report: Set Backup and Optimize in scanreg.ini to zero, change it to this:

;Registry backup is skipped altogether if this is set to 0
Backup=0

;Registry automatic optimization is skipped if this is set to 0
Optimize=0

In addition, disable scanregw in msconfig. In this way, Windows 98SE can start.

-----------------------

However, since this is just a compressed product, then it is of no significance. I am going to study the startup process of IO.SYS and post my research experience here. Wengier and everyone, if you have any suggestions and warnings, hurry up and say, so that I don't go the wrong way.
因为我们亲手创建,这个世界更加美丽。
Floor 22 Posted 2007-01-28 07:59 ·  中国 香港 Cyber_Express通信公司
银牌会员
★★★
阿林
Credits 1,410
Posts 497
Joined 2004-06-28 00:00
21-year member
UID 27551
Gender Male
From 九龍,香港
Status Offline

Originally posted by Budian at 2007-1-28 04:40 AM:
johnsonlam: Your Q series is included in many utility software. In comparison, the awareness of grub4dos is still very low. Actually, I only found out a few days ago that you are the author of Q. And precisely because of this, I reposted the post in the development room. I never came to the development room before.


You misunderstood. I am in charge of the website and contact, and the author is Jack Ellis.


Although I know you are suitable for being the development and management person of this project, I am also embarrassed to say it directly. After all, you already have a project on hand, and considering that adding additional pressure to you is not good.


Sorry, Jack is currently not interested in participating in other plans and only wants to do a good job on the current Q-series drivers.


I have another proposal. Those who come here should preferably state whether they can be a maintainer. If they cannot be, please state the reason for not being able to. Considering that some people can actually be maintainers but are not very proactive, I think it is necessary to add this proposal to promote this matter.


I think that if one has to be a maintainer, many people will have pressure. I don't know programming and don't understand assembly language, otherwise I would have helped.


In addition, I think we shouldn't be too stuck on the "infringement" issue. If we strictly follow the EULA, we can't do anything. I think that's just a tight rein. We can ask software companies, is it completely reasonable for you to hide technical secrets? If we don't disassemble, how can we know if there is dynamite in your product? Our understanding of "reasonableness" may be biased. Humans are advanced animals, so thoughts determine actions. Let's not forget that Microsoft's actions are not necessarily reasonable and legal (Microsoft has also been sued and lost). I think as long as we make it so that those possible accusers can't find any handle. Again, don't overbind your own hands and feet.


We don't need full recognition from US or international law, but what you said is right. The selfishness of software companies has made human progress too slow. We don't have to comply completely.

But I think there should be a moral bottom line. We can't copy others and claim it as our own. We should be on the right side in terms of courtesy and morality. We can disassemble but can't copy MS's source code. I agree with not overbinding our own hands and feet.


Of course I don't mean to "steal" someone's code. If we master their technical secrets, we don't need to "steal" at all. And to master technical secrets, how can you do without debug? I have read "Unpublished DOS Core Technology" before. Authors like that are all proficient players of debug. I think debug is legal, otherwise why would DOS come with this tool? Our purpose is to find out those secrets of Microsoft that shouldn't be hidden, which doesn't constitute an infringement of its intellectual property rights. Strictly speaking, those secrets of it are nothing but to strangle competitors, which belongs to the category of unfair competition. Therefore, strictly speaking, we have the right to require Microsoft to disclose those secrets, at least morally, Microsoft should do so. So don't worry, our approach is completely reasonable, legal and reasonable.


Completely agree.


However, since this is just a compressed product, then it has no meaning. I am going to study the boot process of IO.SYS and post my research insights here. Wengier and everyone, if you have any suggestions and advice, hurry up and say, so that I don't go the wrong way.


After listening to Brother Jack talk a lot about driver knowledge, I think there may still be room for improvement.
我 的 網 站 - http://optimizr.dyndns.org
Floor 23 Posted 2007-01-28 11:41 ·  中国 江苏 苏州 电信
银牌会员
★★★
Credits 2,227
Posts 790
Joined 2005-01-27 00:00
21-year member
UID 35703
Gender Male
Status Offline
Regarding IO.EXE/.SYS:
Although I know that 704--726 is decrypting the code from 205--704 and writing it to 202--703,
I myself wrote the decryption code and tried to modify the file header, and finally updated the boot image with this new IO.SYS, and it started successfully in QEMU.

Just now I couldn't find the entry of LZDOS's IO.SYS/EXE?
Please WENGIER give everyone a little hint!!!

[ Last edited by 本是 on 2007-1-28 at 12:46 PM ]
Attachments
io.rar (73.62 KiB, Credits to download 1 pts, Downloads: 13)
io_sys.gif
my major is english----my love is dos----my teacher is the buddha----my friends--how about U
Floor 24 Posted 2007-01-28 11:58 ·  中国 河南 南阳 联通
银牌会员
★★★★
不甘寂寞的人
Credits 2,491
Posts 1,115
Joined 2003-09-24 00:00
22-year member
UID 10292
Gender Male
Status Offline
johnsonlam: I was careless. Thank you for the clarification. Also, I can very much understand your and Jack's thoughts. Then we'll just wait and see if anyone volunteers.

Original poster: Well done! I really want to get this modified IO.SYS from you. Can you make a download link?
因为我们亲手创建,这个世界更加美丽。
Floor 25 Posted 2007-01-31 22:37 ·  中国 辽宁 朝阳 联通
铂金会员
★★★★
痴迷DOS者
Credits 5,798
Posts 1,924
Joined 2003-06-20 00:00
23-year member
UID 5583
Gender Male
From 金獅電腦軟體工作室
Status Offline
You can refer to the source code of DOS 6.0 publicly released by Micro$oft Corporation. It is about 20MB approximately.
熟能生巧,巧能生精,一艺不精,终生无成,精亦求精,始有所成,臻于完美,永无止境!
金狮電腦軟體工作室愿竭诚为您服务!
QQ群:8393170(定期清理不发言者)
个人网站:http://www.520269.cn
电子邮件:doujiehui@vip.qq.com
微信公众号: doujiehui
Floor 26 Posted 2007-02-01 23:22 ·  中国 河南 南阳 联通
银牌会员
★★★★
不甘寂寞的人
Credits 2,491
Posts 1,115
Joined 2003-09-24 00:00
22-year member
UID 10292
Gender Male
Status Offline
This is: I downloaded your IO.SYS and found another secret.

1. How come your IO.SYS is exactly the same length as LZ-DOS's IO.SYS, both 75885 bytes? If LZ means "compression", then I think its significance is not great. It's not as practical as wengier's io.sys. "Compression" can only increase the difficulty of our unpacking, so it's a bad practice. The IO.SYS in WinME is compressed.

2. Directly overwriting Microsoft's IO.SYS with your IO.SYS results in being unable to boot DOS (it will freeze).

3. Keep Microsoft's IO.SYS as C:\IO.SYS. At this time, by using GRUB's chainloader to boot your IO.SYS (which has been renamed to IO_1.SYS), then you can successfully enter DOS and also enter Win98.

4. Use your IO.SYS as C:\IO.SYS and rename Microsoft's IO.SYS to IO_MS.SYS. At this time, even if you use GRUB's chainloader to boot IO_MS.SYS, it's all a failure. It seems like it freezes, but the NumLock key on the keyboard can switch the NumLOCK indicator light. You can also restart the machine with Ctrl+Alt+Del.

This last phenomenon shows that GRUB's chainloader hasn't grasped the deep secret of IO.SYS.
因为我们亲手创建,这个世界更加美丽。
Floor 27 Posted 2007-02-02 01:31 ·  中国 江苏 苏州 电信
银牌会员
★★★
Credits 2,227
Posts 790
Joined 2005-01-27 00:00
21-year member
UID 35703
Gender Male
Status Offline
Originally posted by Budian at 2007-2-1 23:22:
Originally: I downloaded your IO.SYS and discovered another secret.
...


1. My this IO.SYS was originally the IO.SYS of LZ-DOS, just decrypted a segment, and the file length was not changed.

2. Regarding the crash problem, it is suggested
debug io.sys
e 0002 ce 01 b3 01
w
q
Change back to the original value. In this way, the EXE file header will be the same as the original LZ's. There should be no crash problem.

3. Even if it is encrypted, it can be used after decryption. Because there is a secret in it! Maybe they added, subtracted, multiplied and divided something...
my major is english----my love is dos----my teacher is the buddha----my friends--how about U
Floor 28 Posted 2007-02-13 03:21 ·  中国 上海 普陀区 电信
银牌会员
★★★
永遠的DOS~~~
Credits 1,200
Posts 466
Joined 2005-02-01 00:00
21-year member
UID 35867
Gender Male
From 上海
Status Offline
I think the research on IO.SYS of MSDOS 8.0 can also be regarded as a part of this project.
32位才是DOS未来的希望
个人网志:http://sololand.moe
Floor 29 Posted 2007-03-04 12:21 ·  中国 河南 南阳 联通
银牌会员
★★★★
不甘寂寞的人
Credits 2,491
Posts 1,115
Joined 2003-09-24 00:00
22-year member
UID 10292
Gender Male
Status Offline
From the analysis of this boot process, it can be known that after IO.SYS takes over control, the entry point is at the beginning of the second sector.

IO.SYS is loaded into 4 sectors by the boot sector, and the loaded address is 0000:0700, and the control transfer CS:IP=0070:0200, which is the beginning of the second sector of IO.SYS. In addition, BP, SP, SI, DI, SS, DS, ES and the stack contents are all meaningful, and detailed explanations are made in the following comments.

2181:7C00 EB 3C 90 4D-53 57 49 4E-34 2E 31 00-02 04 04 00 .<.MSWIN4.1.....
2181:7C10 02 00 02 00-00 F8 F8 00-20 00 40 00-20 00 00 00 ........ .@. ...
2181:7C20 E0 DF 03 00-80 00 29 FA-6F 0B 00 55-53 42 5A 49 ......).o..USBZI
2181:7C30 50 2D 42 4F-4F 54 46 41-54 31 36 00-00 00 P-BOOTFAT16...

2181:7C3E 33 C9 xor cx,cx ;CX=0
2181:7C40 8E D1 mov ss,cx ;SS=0
2181:7C42 BC FC 7B mov sp,7BFC ;SP=7BFC
2181:7C45 16 push ss
2181:7C46 07 pop es ;ES=0
2181:7C47 BD 78 00 mov bp,0078 ;BP=78
2181:7C4A C5 76 00 lds si, ;DS:SI->floppy param
2181:7C4D 1E push ds
2181:7C4E 56 push si ;Save floppy param
2181:7C4F 16 push ss
2181:7C50 55 push bp ;Save 0000:0078
2181:7C51 BF 22 05 mov di,0522 ;DI=0522
2181:7C54 89 7E 00 mov ,di ;Set 0000:0522 as...
2181:7C57 89 4E 02 mov ,cx ;...new floppy param
2181:7C5A B1 0B mov cl,000B ;CX=000B
2181:7C5C FC cld
2181:7C5D F3 A4 repz movsb ;copy old param to new
2181:7C5F 06 push es
2181:7C60 1F pop ds ;DS=0
2181:7C61 BD 00 7C mov bp,7C00 ;BP=7C00
2181:7C64 C6 45 FE 0F mov byte ,000F ;modify floppy param
2181:7C68 38 4E 24 cmp ,cl ;drive is floppy?
2181:7C6B 7D 20 jge 7C8D ;yes. jump.

hard drive: check partition table for EBIOS indicator

2181:7C6D 8B C1 mov ax,cx ;AX=CX=0
2181:7C6F 99 cwd ;DX=0

2181:7C70 E8 7E 01 call 7DF1 ;read the MBR sector

2181:7C73 83 EB 3A sub bx,003A ;startLBA of entry 0
2181:7C76 66 A1 1C 7C mov eax, ;EAX=hidden sectors

2181:7C7A 66 3B 07 cmp eax, ;match?
2181:7C7D 8A 57 FC mov dl, ;DL=partition type
2181:7C80 75 06 jnz 7C88 ;not match, skip
2181:7C82 80 CA 02 or dl,0002 ;if the type is 0C
;let it be 0E
2181:7C85 88 56 02 mov ,dl ;set EBIOS flag in 7C02

2181:7C88 80 C3 10 add bl,0010 ;next entry
2181:7C8B 73 ED jnb 7C7A ;carry set if done

the real deal begins here

2181:7C8D 33 C9 xor cx,cx ;CX=0
2181:7C8F FE 06 D8 7D inc byte ;Change IO to JO

2181:7C93 8A 46 10 mov al, ;AL=number of FATs
2181:7C96 98 cbw ;AX=number of FATs
2181:7C97 F7 66 16 mul word ;sectors per FAT
;DX:AX=sectors in FATs
2181:7C9A 03 46 1C add ax,
2181:7C9D 13 56 1E adc dx, ;Add hidden sectors
2181:7CA0 03 46 0E add ax, ;Add reserved sectors
2181:7CA3 13 D1 adc dx,cx ;DX:AX->root dir
2181:7CA5 8B 76 11 mov si, ;SI=root dir entries

2181:7CA8 60 pushaw

2181:7CA9 89 46 FC mov ,ax ;
2181:7CAC 89 56 FE mov ,dx ;save DX:AX on stack
2181:7CAF B8 20 00 mov ax,0020 ;AX=dir entry length
2181:7CB2 F7 E6 mul si ;DX:AX=root dir size
2181:7CB4 8B 5E 0B mov bx, ;BX=sector size
2181:7CB7 03 C3 add ax,bx
2181:7CB9 48 dec ax
2181:7CBA F7 F3 div bx ;AX=root dir sectors
2181:7CBC 01 46 FC add ,ax
2181:7CBF 11 4E FE adc ,cx ;stack->Data area

2181:7CC2 61 popaw

2181:7CC3 BF 00 07 mov di,0700 ;DI=0700
2181:7CC6 E8 28 01 call 7DF1 ;read root dir
2181:7CC9 72 3E jb 7D09

2181:7CCB 38 2D cmp ,ch
2181:7CCD 74 17 jz 7CE6 ;failure find file

2181:7CCF 60 pushaw
2181:7CD0 B1 0B mov cl,000B ;find kernel filename
2181:7CD2 BE D8 7D mov si,7DD8
2181:7CD5 F3 A6 repz cmpsb
2181:7CD7 61 popaw

2181:7CD8 74 3D jz 7D17 ;found, jump
2181:7CDA 4E dec si ;SI=rest entries
2181:7CDB 74 09 jz 7CE6 ;not found, failure
2181:7CDD 83 C7 20 add di,0020 ;next entry
2181:7CE0 3B FB cmp di,bx ;end?
2181:7CE2 72 E7 jb 7CCB ;no, check the entry
2181:7CE4 EB DD jmp 7CC3 ;yes, load 1 sector

2181:7CE6 FE 0E D8 7D dec byte ;Change JO to IO
2181:7CEA 7B A7 jnp 7C93 ;find again
2181:7CEC BE 7F 7D mov si,7D7F ;not found

print error message:
SI=7D7F "invalid system disk"
SI=7D80 "Disk I/O error"
SI=7D82 "Replace the disk, and then press any key..."

2181:7CEF AC lodsb
2181:7CF0 98 cbw


2181:7CF1 03 F0 add si,ax

display string DS:SI, if encountered FF, then
display "Replace the disk, and then press any key..."
if encountered 00, wait for a key press and reboot.

2181:7CF3 AC lodsb
2181:7CF4 98 cbw
2181:7CF5 40 inc ax
2181:7CF6 74 0C jz 7D04
2181:7CF8 48 dec ax
2181:7CF9 74 13 jz 7D0E

display char in AL

2181:7CFB B4 0E mov ah,000E
2181:7CFD BB 07 00 mov bx,0007
2181:7D00 CD 10 int 10
2181:7D02 EB EF jmp 7CF3

display "Replace the disk, and then press any key..."

2181:7D04 BE 82 7D mov si,7D82
2181:7D07 EB E6 jmp 7CEF

display "Disk I/O error"

2181:7D09 BE 80 7D mov si,7D80
2181:7D0C EB E1 jmp 7CEF

2181:7D0E CD 16 int 16
2181:7D10 5E pop si
2181:7D11 1F pop ds ;DS:SI=0000:0078
2181:7D12 66 8F 04 pop dword ;restore original...
;...floppy params
2181:7D15 CD 19 int 19

the kernel file was found

2181:7D17 BE 81 7D mov si,7D81 ;error message
2181:7D1A 8B 7D 1A mov di, ;start cluster
2181:7D1D 8D 45 FE lea ax,
2181:7D20 8A 4E 0D mov cl, ;sectors per cluster
2181:7D23 F7 E1 mul cx ;DX:AX=sectors
2181:7D25 03 46 FC add ax,
2181:7D28 13 56 FE adc dx, ;DX:AX=LBA
2181:7D2B B1 04 mov cl,0004 ;read 4 sectors
2181:7D2D E8 C2 00 call 7DF2 ;... to 0000:0700
2181:7D30 72 D7 jb 7D09

Transfer control to the second sector of IO.SYS, with

SS=DS=ES=0000

SP=7BF4

BP=7C00

SI=error message "invalid system disk"

DI=start cluster number of IO.SYS

==0078

==0000

==OFFSET of FLOPPY PARAMS

==SEGMENT of FLOPPY PARAMS

===LBA of data area


2181:7D32 EA 00 02 70 00 jmp 0070:0200 ;CS:IP=0070:0200






2181:7D37 52 push dx ;DX:AX=LBA lo 32 bits
2181:7D38 50 push ax
2181:7D39 06 push es ;ES:BX=buffer
2181:7D3A 53 push bx
2181:7D3B 6A 01 push 0001 ;read 1 sector
2181:7D3D 6A 10 push 0010 ;EBIOS packet size

begin geometry translation: LBA to CHS

2181:7D3F 91 xchg ax,cx ;save AX to CX
2181:7D40 8B 46 18 mov ax, ;AX=sectors per track
2181:7D43 A2 26 05 mov ,al ;modify floppy param
2181:7D46 96 xchg ax,si ;SI=sectors per track
2181:7D47 92 xchg ax,dx ;AX=DX
2181:7D48 33 D2 xor dx,dx
2181:7D4A F7 F6 div si ;AX=quo, DX=res
2181:7D4C 91 xchg ax,cx ;restore AX from CX
;CX=quo
;DX:AX=the rest sectors
2181:7D4D F7 F6 div si ;AX=quo, DX=res
2181:7D4F 42 inc dx ;DX=sector
2181:7D50 87 CA xchg cx,dx ;CX=sector, DX=old quo
;DX:AX=quo
2181:7D52 F7 76 1A div word ;heads
;AX=cyl, DX=head
2181:7D55 8A F2 mov dh,dl ;DH=head
2181:7D57 8A E8 mov ch,al ;CH=cyl. lo 8 bits
2181:7D59 C0 CC 02 ror ah,02 ;AH=cyl. hi 2 bits
2181:7D5C 0A CC or cl,ah ;put into CL

end geometry translation: LBA to CHS

2181:7D5E B8 01 02 mov ax,0201 ;read 1 sector
2181:7D61 80 7E 02 0E cmp byte ,000E ;USE EBIOS?
2181:7D65 75 04 jnz 7D6B ;no, skip
2181:7D67 B4 42 mov ah,0042 ;yes, set AH=42
2181:7D69 8B F4 mov si,sp ;DS:SI->packet

2181:7D6B 8A 56 24 mov dl, ;drive number
2181:7D6E CD 13 int 13 ;BIOS disk call
2181:7D70 61 popaw ;discard packet
2181:7D71 61 popaw ;restore regs
2181:7D72 72 0A jb 7D7E ;failure jump
2181:7D74 40 inc ax ;next sector
2181:7D75 75 01 jnz 7D78
2181:7D77 42 inc dx
2181:7D78 03 5E 0B add bx, ;buffer
2181:7D7B 49 dec cx
2181:7D7C 75 77 jnz 7DF5 ;continue to read
;until done
2181:7D7E C3 ret

2181:7D7F 03 .
2181:7D80 18 01 27 0D-0A 49 6E 76-61 6C 69 64-20 73 79 73 ..'..Invalid sys
2181:7D90 74 65 6D 20-64 69 73 6B-FF 0D 0A 44-69 73 6B 20 tem disk...Disk
2181:7DA0 49 2F 4F 20-65 72 72 6F-72 FF 0D 0A-52 65 70 6C I/O error...Repl
2181:7DB0 61 63 65 20-74 68 65 20-64 69 73 6B-2C 20 61 6E ace the disk, an
2181:7DC0 64 20 74 68-65 6E 20 70-72 65 73 73-20 61 6E 79 d then press any
2181:7DD0 20 6B 65 79-0D 0A 00 00-49 4F 20 20-20 20 20 20 key....IO
2181:7DE0 53 59 53 4D-53 44 4F 53-20 20 20 53-59 53 7F 01 SYSMSDOS SYS.
2181:7DF0 00 .

subroutine: read sectors

2181:7DF1 41 inc cx ;CX=1

CX=sectors to read

2181:7DF2 BB 00 07 mov bx, 0700 ;ES:BX=0000:0700

BX=buffer

2181:7DF5 60 pushaw
2181:7DF6 66 6A 00 push 00000000
2181:7DF9 E9 3B FF jmp 7D37

2181:7DFC 00 00 55 AA ..U.
因为我们亲手创建,这个世界更加美丽。
Floor 30 Posted 2007-03-07 05:47 ·  中国 上海 松江区 电信
新手上路
Credits 4
Posts 2
Joined 2007-03-07 03:48
19-year member
UID 80957
Gender Male
Status Offline
Forum Jump: