|
DOSforever
金牌会员
     
积分 4639
发帖 2239
注册 2005-1-30
状态 离线
|
『第 16 楼』:
使用 LLM 解释/回答一下
已经试过好几遍了,都是如此。有关过程的输入输出显示如上所贴。即使我有输入错误的话(指语法上的)你的程序应该不会执行而是给出用法提示的吧。而且有趣的是,每次保存得到错误扇区的内容都不一样,呵呵。
延迟主要出现在 "100% sectors done." 和显示最后一行的 "Done." 之间。我只读一个扇区,就算是386的机器也不可能有让人能够感觉得到的延迟啊。你写一万个扇区大约才只需要2、3秒,而我估计着大约有半秒的延迟。
关于我的 DOS 内存配置环境可以参看这里:
http://www.cn-dos.net/forum/viewthread.php?tid=21215
使用的 DOS 版本为 MS-DOS 6.22。
奇怪的是,我在 Windows98 的 DOS 窗口下测试反倒可以得到正确的结果(仅读MBR)
不过,现在,告诉你个好消息,我找到问题的所在了。原来是由于加载了 DOS 下的 DMA 驱动引起。我现在使用的 DMA 驱动是 UDMA2 2.7 版。
另外我不懂你用的是什么编译器,为什么可以混合使用 C 和 C++ 的注释方式?
I've tried several times, and it's all like this. The input and output related to the process are displayed as pasted above. Even if I have an input error (referring to grammatical errors), your program shouldn't execute but should give a usage prompt, right? And interestingly, the content of the error sector saved each time is different, heh.
The delay mainly occurs between "100% sectors done." and the last line "Done." displayed. I'm only reading one sector, and even on a 386 machine, there shouldn't be a perceptible delay. You write about ten thousand sectors and it only takes about 2 or 3 seconds, and I estimate there's about a half-second delay.
You can refer to my DOS memory configuration environment here:
http://www.cn-dos.net/forum/viewthread.php?tid=21215
The DOS version used is MS-DOS 6.22.
Strangely, when I tested in the DOS window of Windows 98, I could get the correct result (only reading the MBR).
But now, let you know a good news, I found the cause of the problem. It turned out to be due to loading the DMA driver under DOS. The DMA driver I'm using is version 2.7 of UDMA2.
Also, I don't know what compiler you're using, why can you mix the comment styles of C and C++?
|

DOS倒下了,但永远不死
DOS NEVER DIES !
投票调查:
http://www.cn-dos.net/forum/viewthread.php?tid=46187
本人尚未解决的疑难问题:
http://www.cn-dos.net/forum/viewthread.php?tid=15135
http://www.cn-dos.net/forum/viewthread.php?tid=47663
http://www.cn-dos.net/forum/viewthread.php?tid=48747 |
|
2006-7-9 21:06 |
|
|
GOTOmsdos
铂金会员
       C++启程者
积分 5154
发帖 1827
注册 2003-7-18
状态 离线
|
『第 17 楼』:
使用 LLM 解释/回答一下
哦,感谢参与测试!
写这个程序,并没有考虑诸如 CPU类型,操作系统类型和有关硬盘的驱动的兼容性
等等问题,所以出一些问题,也是在所难免的,毕竟不是商用软件。。
程序的开发配置:
奔3,733
MSDOS 7.1
Turbo C ++ 3.0(如用Borland C++ 3.1,也基本一样)
一般,C++编译器都是兼容C规范的(包括注释),反过来自然就不行了。
Oh, thanks for participating in the test!
When writing this program, issues such as CPU type, operating system type, and hard drive driver compatibility were not considered, so it's inevitable that some problems will occur. After all, it's not a commercial software.
Program development configuration:
Pentium III, 733
MSDOS 7.1
Turbo C ++ 3.0 (if Borland C++ 3.1 is used, it's basically the same)
Generally, C++ compilers are compatible with the C specification (including comments), but the opposite is not true.
|
|
2006-7-9 22:01 |
|
|
DOSforever
金牌会员
     
积分 4639
发帖 2239
注册 2005-1-30
状态 离线
|
|
2006-7-9 23:27 |
|
|
GOTOmsdos
铂金会员
       C++启程者
积分 5154
发帖 1827
注册 2003-7-18
状态 离线
|
『第 19 楼』:
使用 LLM 解释/回答一下
恩,处理分区链表,还是很复杂的,因为就要费很大的事从第一分区表去依次找出后面的分区表,尤其是要处理扩展分区,及其中的逻辑驱动器。。。还是挺复杂的。
你懂汇编,理解C应该没什么大问题吧? 熟悉一下语法就行了。。
(刚刚为源码加了基本原理,注释,重新上传了,理解起来就容易一些。。)
现在又在98的MS-DOS提示符下测试,除了不支持扩展INT13外,一切都准确无误(用SPFDISK做验证),而且写一万个扇区,一秒钟都不要!(可能是磁盘高速缓冲驱动的作用,我在纯DOS下,是没有加载任何磁盘缓冲驱动的,所以需要3秒左右。。)
但不知道为什么不支持扩展INT13?
是不是98加了什么硬盘限制?
Last edited by GOTOmsdos on 2006-7-9 at 23:56 ]
Well, handling the partition chain is still quite complicated because you have to go through the first partition table one by one to find the subsequent partition tables, especially dealing with extended partitions and the logical drives within them... It's quite complicated.
You know assembly, so it shouldn't be a big problem to understand C? Just get familiar with the syntax.
(Just added the basic principles and comments to the source code and re-uploaded it, so it's easier to understand...)
Now testing under the MS-DOS prompt in 98, everything is accurate except it doesn't support extended INT13 (verified with SPFDISK), and it takes less than a second to write ten thousand sectors! (Maybe it's the effect of the disk cache driver. I'm in pure DOS without loading any disk cache driver, so it takes about 3 seconds.)
But I don't know why it doesn't support extended INT13?
Is it because 98 added some hard disk restrictions?
Last edited by GOTOmsdos on 2006-7-9 at 23:56 ]
|
|
2006-7-9 23:43 |
|
|
DOSforever
金牌会员
     
积分 4639
发帖 2239
注册 2005-1-30
状态 离线
|
|
2006-7-9 23:53 |
|
|
GOTOmsdos
铂金会员
       C++启程者
积分 5154
发帖 1827
注册 2003-7-18
状态 离线
|
『第 21 楼』:
使用 LLM 解释/回答一下
是98 MSDOS窗口
程序提示不支持(代码写了检测,用扩展INT13的41号功能,AH返回1和BX不是AA55就表示不支持。。)是啊,照理,支持不支持是由硬盘控制器和BIOS决定的啊
不理解。。
另外,我写的是 返回0和AA55都要满足,
是不是只要返回0就行了?(不一定返回AA55?)
等一下,我试一下 。。
It's the 98 MSDOS window. The program prompts that it's not supported (the code has a check, using the extended INT13 function 41, if AH returns 1 and BX is not AA55, it means not supported...). Yes, logically, whether it's supported or not is determined by the hard disk controller and BIOS. I don't understand. Also, what I wrote is that both returning 0 and AA55 need to be satisfied. Is it just that returning 0 is enough? (Not necessarily returning AA55?) Wait a minute, I'll test it.
|
|
2006-7-10 00:02 |
|
|
GOTOmsdos
铂金会员
       C++启程者
积分 5154
发帖 1827
注册 2003-7-18
状态 离线
|
『第 22 楼』:
使用 LLM 解释/回答一下
哇! 有重大发现!
把检测代码改成只要返回AA55就表示支持了!
程序运行,支持的,而且运行后的结果跟SPFDISK的一样!
说明,有关扩展13的资料出了问题!支持的话,AH不一定返回0,或者会有特殊情况等等(比如操作系统关系,如DMA,磁盘缓冲驱动等等),不会保证返回0。而会返回AA55的。。
这样,代码又得到了改进。。
Wow! There is a major discovery!
Change the detection code to just return AA55 to indicate support!
The program runs, supports it, and the result after running is the same as SPFDISK!
It shows that the information about extension 13 is wrong! If it supports, AH doesn't necessarily return 0, or there will be special cases, etc. (such as operating system relationship, such as DMA, disk buffer driver, etc.), it won't guarantee to return 0. But it will return AA55.
In this way, the code has been improved again.
|
|
2006-7-10 00:26 |
|
|
qb45
高级用户
   
积分 677
发帖 194
注册 2003-9-13
状态 离线
|
『第 23 楼』:
使用 LLM 解释/回答一下
在WIN98中流传着一个误解,说WIN中无法写主引导区MBR,也无法写扇区,包括DISKGEN,诺顿的DISKEDIT工具包,那时他们都在程序中加入了检测操作系统是否为WIN的功能,如果是WIN就提示或者直接退出。
我在98的MSDOS下用qbasic做硬盘工具的时候也以为是这样,在运用扩展INT13的实践中,我做MBR清0,真的就清掉了,也可以写任意的扇区,但是用老的INT13的确只能读无法写。
希望能给大家一个启示。
我的程序把6.4G的老硬盘完全清0,总共用了7分钟左右,不知道用C或者是汇编写的同类程序时间快多少。
There is a misunderstanding in WIN98 that it is impossible to write the master boot record MBR or sectors in WIN, including tools like DISKGEN and Norton's DISKEDIT toolkit. At that time, they all added a function to detect whether the operating system was WIN in the program, and if it was WIN, they would prompt or directly exit.
When I was making a hard disk tool with qbasic under MSDOS of 98, I also thought so. In the practice of using the extended INT13, I cleared the MBR to zero, and really cleared it, and could write any sector, but the old INT13 could only read and not write.
I hope to give everyone an inspiration.
My program completely cleared a 6.4G old hard disk to zero, and it took about 7 minutes in total. I don't know how much faster the same kind of program written in C or assembly language would be.
|

我(QB45)的照片与简历
http://www.programfan.com/club/showbbs.asp?id=197280
|
|
2006-7-10 07:38 |
|
|
GOTOmsdos
铂金会员
       C++启程者
积分 5154
发帖 1827
注册 2003-7-18
状态 离线
|
『第 24 楼』:
使用 LLM 解释/回答一下
不懂 qbasic, BASIC系列可能是解释性的吧? 速度可能会慢一些
据说,C的效率只比汇编差那么一点点
刚才为我的代码加上了,如果读写出错,给出提示
更新了
Don't understand qbasic, the BASIC series may be interpreted? The speed may be a bit slower. It is said that the efficiency of C is only a little worse than assembly. Just now, I added that if there is an error in reading and writing, give a prompt. Updated.
|
|
2006-7-10 22:29 |
|
|
GOTOmsdos
铂金会员
       C++启程者
积分 5154
发帖 1827
注册 2003-7-18
状态 离线
|
『第 25 楼』:
使用 LLM 解释/回答一下
TO DOSforever
刚刚加了如果出错的提示,代码更新了
其中有一项好像跟DMA设置有关
很希望你有时间在测试一下,看是不是有相应的出错提示出来?
我机子试了,好像扩展13的出错提示会出来,但是同样的错误,基本的13中断不给出错提示,好像都认为是成功的(有意换上坏硬盘,扩展13能给出 STATUS ERROR的提示),这点,我搞不懂。。。
Last edited by GOTOmsdos on 2006-7-11 at 15:37 ]
TO DOSforever
Just added error prompt if there is an error, and the code has been updated.
One of them seems to be related to DMA settings.
I really hope you have time to test it again to see if the corresponding error prompt comes out?
I tested on my machine. It seems that the error prompt for extended 13 will come out, but for the same error, the basic 13 interrupt does not give an error prompt, and it seems that it is all considered successful (intentionally replaced with a bad hard disk, extended 13 can give a STATUS ERROR prompt). This point, I don't understand...
Last edited by GOTOmsdos on 2006-7-11 at 15:37 ]
|
|
2006-7-11 02:59 |
|
|
GOTOmsdos
铂金会员
       C++启程者
积分 5154
发帖 1827
注册 2003-7-18
状态 离线
|
『第 26 楼』:
使用 LLM 解释/回答一下
TO DOSFOREVER
能不能把你的UDMA DOS驱动贴上来,我也来试一试 ?
*********
刚刚下载了UDMA2,说明中写了只支持 VIA 主板芯片组啊
你主板是吗?
Last edited by GOTOmsdos on 2006-7-11 at 12:26 ]
TO DOSFOREVER
Can you post your UDMA DOS driver here? I also want to give it a try?
*********
Just downloaded UDMA2, and the instructions say it only supports VIA motherboard chipsets. Is your motherboard...?
Last edited by GOTOmsdos on 2006-7-11 at 12:26 ]
|
|
2006-7-11 11:20 |
|
|
johnsonlam
银牌会员
     阿林
积分 1410
发帖 497
注册 2004-6-28 来自 九龍,香港
状态 离线
|
『第 27 楼』:
使用 LLM 解释/回答一下
Originally posted by GOTOmsdos at 2006-7-11 11:20 AM:
TO DOSFOREVER
能不能把你的UDMA DOS驱动贴上来,我也来试一试 ?
*********
刚刚下载了UDMA2,说明中写了只支持 VIA 主板芯片组啊
你主板是吗?
你 說 的 是 VIA 提 供 的 UDMA2 嗎 ?
如 果 沒 有 作 者 名 字 的 UDMA2.SYS , 就 是 Jack Ellis 的 , 很 舊 已 被 QDMA 取 代 。
http://johnson.tmfc.net/dos
單 擊 左 面 的 QDMA 下 載 試 試 吧 !
Originally posted by GOTOmsdos at 2006-7-11 11:20 AM:
TO DOSFOREVER
Can you post your UDMA DOS driver here, I also want to give it a try?
*********
Just downloaded UDMA2, the instructions say it only supports VIA motherboard chipsets.
Is your motherboard?
Are you talking about the UDMA2 provided by VIA?
If there is no UDMA2.SYS with the author's name, it is Jack Ellis's, which is very old and has been replaced by QDMA.
http://johnson.tmfc.net/dos
Click the QDMA on the left to download and try!
|

我 的 網 站 - http://optimizr.dyndns.org
|
|
2006-7-11 14:46 |
|
|
zyl910
中级用户
  
积分 282
发帖 126
注册 2006-5-17
状态 离线
|
『第 28 楼』:
使用 LLM 解释/回答一下
不记得从QuickBASIC那个版本开始(好像是4.0)
QB不是以纯解释方式运行的
而是编译成P代码,运行时再即时编译(与现在Java、.Net用的技术差不多)
所以速度并没慢多少
而且现在是调用中断
时间主要耗在中断服务程序上
即此时的瓶颈是硬盘读写速度
可笑的是
十多年前QB使用P代码和即时编译仍被人认为是低效的解释执行过程
而现在Java、.Net鼓吹虚拟机技术
越来越感觉的这几十年来计算机科学领域并没有太大的进展
只是随着硬件技术的发展,应用领域急剧的扩展而以
I don't remember from which version of QuickBASIC it started (it seems to be 4.0). QB is not running in a pure interpretation mode. Instead, it is compiled into P-code and then just-in-time compiled during runtime (similar to the technology used in Java and .Net now). So the speed is not much slower. And now it's calling interrupts. The time is mainly spent in the interrupt service routine. That is, the bottleneck at this time is the hard disk reading and writing speed. Ridiculously, more than ten years ago, QB using P-code and just-in-time compilation was still regarded by people as an inefficient interpretation execution process, while now Java and .Net advocate virtual machine technology. I'm more and more feeling that there hasn't been much progress in the field of computer science in these decades, just with the development of hardware technology, the application fields have expanded sharply and that's all.
|

人类存在的目的就是试图理解人类为何存在 |
|
2006-7-11 15:20 |
|
|
asbai
高级用户
   
积分 653
发帖 252
注册 2006-4-16
状态 离线
|
『第 29 楼』:
使用 LLM 解释/回答一下
Originally posted by zyl910 at 2006-7-11 15:20:
不记得从QuickBASIC那个版本开始(好像是4.0)
QB不是以纯解释方式运行的
而是编译成P代码,运行时再即时编译(与现在Java、.Net用的技术差不多)
扠...
兄台此言差以,即时编译(JIT,Just In Time)技术与语言效率并没有特别大的关系。主要是语言本身的设计问题。
具体来说,使用了垃圾回收和自动存储管理;无类型变量;反射等机制的语言本身就是低效的。这样的语言即使直接编译成机器码也快不起来,有意思的是,这样做甚至会更慢,IBM知识库里有一篇文章专门测量了各种情况下,Java运行的效率:Weighing in on Java native compilation( http://www-128.ibm.com/developerworks/library/j-native.html)。
当然,用C写出来的程序也不一定就比用QB/Java之类的来得快,程序运行效率取决于一些其它条件:
1. 程序使用的算法
例如:用C写的冒泡排序算法和QB写的快速排序算法相比,如果要输入的集合足够大,QB的快速排序一定比C的冒泡排序快。
2. 程序是否大量使用外挂模块
例如:极端情况下,可以构造出这样的代码,VB程序直接调用某个DLL和COM组件的入口,然后所有操作都由这些由C或其它语言实现的外挂组件完成。
等等。
不使用相同算法的比较不是语言效率间的对决,而是程序员个人技艺间的碰撞。
大部分运行时间都依赖外挂组件的比较同样也不能看作两种语言运行效率间的公平测试。
Last edited by asbai on 2006-7-11 at 20:48 ]
Originally posted by zyl910 at 2006-7-11 15:20:
I can't remember from which version of QuickBASIC it started (it seems to be 4.0)
QB does not run in a purely interpreted manner
but compiles into P-code and then just-in-time compiles at runtime (similar to the technology used in Java and .Net nowadays)
Oh...
Sir, what you said is wrong. The just-in-time compilation (JIT, Just In Time) technology is not particularly related to the efficiency of the language. It's mainly a design issue of the language itself.
Specifically, languages that use garbage collection and automatic storage management; untyped variables; reflection and other mechanisms are inherently inefficient. Such languages won't run fast even if directly compiled into machine code. Interestingly, it might even be slower. There's an article in IBM's knowledge base that specifically measures the efficiency of Java running in various situations: Weighing in on Java native compilation ( http://www-128.ibm.com/developerworks/library/j-native.html).
Of course, a program written in C isn't necessarily faster than one written in QB/Java, etc. The running efficiency of a program depends on some other conditions:
1. The algorithm used in the program
For example: Comparing a bubble sort algorithm written in C with a quick sort algorithm written in QB, if the set to be input is large enough, QB's quick sort will definitely be faster than C's bubble sort.
2. Whether the program uses a large number of external modules
For example: In an extreme case, you can construct code where a VB program directly calls the entry of a certain DLL and COM component, and then all operations are completed by these external components implemented in C or other languages.
Etc.
Comparisons that don't use the same algorithm aren't a contest of language efficiency, but a collision of programmers' individual skills.
Comparisons where most of the running time relies on external components also can't be regarded as a fair test of the running efficiency of the two languages.
Last edited by asbai on 2006-7-11 at 20:48 ]
|
|
2006-7-11 20:46 |
|
|
GOTOmsdos
铂金会员
       C++启程者
积分 5154
发帖 1827
注册 2003-7-18
状态 离线
|
|
2006-7-11 22:21 |
|