|
profree
中级用户
  
积分 478
发帖 132
注册 2003-7-2
状态 离线
|
『楼 主』:
怎么用C语言编写控制光驱的程序?
使用 LLM 解释/回答一下
找到了一些资料都是汇编的,汇编又不懂,怎么用C语言写?谢谢
Found some materials, all are in assembly, but I don't understand assembly. How to write it in C language? Thanks
|
|
2004-8-19 00:00 |
|
|
zhaojinpo
初级用户
 
积分 183
发帖 31
注册 2002-11-30
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
One should know one's limits, and should not be overreaching!
|

我的论坛 http://zjp-vlk.vicp.net/bbs 我在它就在! |
|
2004-8-19 00:00 |
|
|
wchong
银牌会员
    
积分 1186
发帖 510
注册 2004-7-30
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
2楼的英文很好吗?翻译点儿共享啊!
Is the English of the 2nd floor very good? Translate some shares!
|
|
2004-8-20 00:00 |
|
|
JonePeng
金牌会员
      D◎$ Fαп
积分 4562
发帖 1883
注册 2004-1-19 来自 广东广州
状态 离线
|
   『第 4 楼』:
使用 LLM 解释/回答一下
下面的程序是我几年前把一个CD播放器程序缩改成打开、关闭光驱的小程序,送给你玩玩吧。不过有个缺点,只能在纯DOS下运行,在Win9x的DOS窗口下运行时,如果光驱没有光盘是打不开的,但可以关闭。
#include<dos.h>
int ppp=0
unsigned int cdnum
char getbuff,setbuff
char stop={0x0d,0,0x85,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
char setcd={0x1a,0,0x0c,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
char getcd={0x1a,0,0x03,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
main()
{int i
_BX=0
_AX=0x1500
geninterrupt(0x2f)
if(ppp==0){cdnum=_CX
_AX=FP_OFF(getbuff)
_BX=FP_SEG(getbuff)
getcd=_AL
getcd=_AH
getcd=_BL
getcd=_BH
_AX=FP_OFF(setbuff)
_BX=FP_SEG(setbuff)
setcd=_AL
setcd=_AH
setcd=_BL
setcd=_BH
for(i=0
{
getcd=5
getbuff=0x06
_ES=FP_SEG(getcd)
_BX=FP_OFF(getcd)
_CX=cdnum
_AX=0x1510
geninterrupt(0x2f)
}
ch=getbuff&0x01
if(ch==0)i=0
else i=1
if(i==0)
{_ES=FP_SEG(stop)
_BX=FP_OFF(stop)
_CX=cdnum
_AX=0x1510
geninterrupt(0x2f)
setcd=1
setbuff=0
_ES=FP_SEG(setcd)
_BX=FP_OFF(setcd)
_CX=cdnum
_AX=0x1510
geninterrupt(0x2f)
}
else
{ /*Close CD*/
setcd=1
setbuff=5
_ES=FP_SEG(setcd)
_BX=FP_OFF(setcd)
_CX=cdnum
_AX=0x1510
geninterrupt(0x2f)
}
}
Last edited by JonePeng on 2006-5-1 at 00:48 ]
The following program is a small program I shrank from a CD player program a few years ago to open and close the CD drive, for you to play with. But there is a shortcoming, it can only run in pure DOS. When running in the DOS window of Win9x, if there is no disc in the CD drive, it cannot be opened, but it can be closed.
#include<dos.h>
int ppp=0
unsigned int cdnum
char getbuff,setbuff
char stop={0x0d,0,0x85,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
char setcd={0x1a,0,0x0c,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
char getcd={0x1a,0,0x03,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
main()
{int i
_BX=0
_AX=0x1500
geninterrupt(0x2f)
if(ppp==0){cdnum=_CX
_AX=FP_OFF(getbuff)
_BX=FP_SEG(getbuff)
getcd=_AL
getcd=_AH
getcd=_BL
getcd=_BH
_AX=FP_OFF(setbuff)
_BX=FP_SEG(setbuff)
setcd=_AL
setcd=_AH
setcd=_BL
setcd=_BH
for(i=0
{
getcd=5
getbuff=0x06
_ES=FP_SEG(getcd)
_BX=FP_OFF(getcd)
_CX=cdnum
_AX=0x1510
geninterrupt(0x2f)
}
ch=getbuff&0x01
if(ch==0)i=0
else i=1
if(i==0)
{_ES=FP_SEG(stop)
_BX=FP_OFF(stop)
_CX=cdnum
_AX=0x1510
geninterrupt(0x2f)
setcd=1
setbuff=0
_ES=FP_SEG(setcd)
_BX=FP_OFF(setcd)
_CX=cdnum
_AX=0x1510
geninterrupt(0x2f)
}
else
{ /*Close CD*/
setcd=1
setbuff=5
_ES=FP_SEG(setcd)
_BX=FP_OFF(setcd)
_CX=cdnum
_AX=0x1510
geninterrupt(0x2f)
}
}
Last edited by JonePeng on 2006-5-1 at 00:48 ]
|

----====≡≡≡≡ 我的至爱,永远是MSDOS!≡≡≡≡====----
|
|
2004-8-20 00:00 |
|
|
profree
中级用户
  
积分 478
发帖 132
注册 2003-7-2
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
以下是引用zhaojinpo在2004-8-19 22:22:40的发言:从 http://www.he.net/~marcj/cdrom.html 你可以看到介绍! ftp://ftp.he.net/pub/marcj/cdrom.c 有源代码!
The following is the statement from zhaojinpo on 2004-8-19 22:22:40: You can see the introduction from http://www.he.net/~marcj/cdrom.html! The source code is at ftp://ftp.he.net/pub/marcj/cdrom.c
|
|
2004-8-21 00:00 |
|
|
JonePeng
金牌会员
      D◎$ Fαп
积分 4562
发帖 1883
注册 2004-1-19 来自 广东广州
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
ftp://ftp.he.net/pub/marcj/cdrom.c 我试过了,可是好像有些问题,怎么光驱没有任何反应啊?既不打开也不关闭,更不会读盘!楼主的意思是要编个程序来打开和关闭光驱,而上面的经我改编的C程序很好用,把编译成的EXE改名为EJ.EXE,只要在DOS下按EJ回车,就可以打开光驱,在输入就关闭,我总喜欢用它。^_^
ftp://ftp.he.net/pub/marcj/cdrom.c I tried it, but there seems to be some problem. Why is there no reaction from the CD drive? It doesn't open, close, or read the disc! The LZ means to compile a program to open and close the CD drive, and the above C program I adapted works well. Rename the compiled EXE to EJ.EXE. Just press EJ and hit Enter under DOS to open the CD drive, and input again to close it. I always like to use it. ^_^
|

----====≡≡≡≡ 我的至爱,永远是MSDOS!≡≡≡≡====----
|
|
2004-8-23 00:00 |
|
|
profree
中级用户
  
积分 478
发帖 132
注册 2003-7-2
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
对,我用过ftp://ftp.he.net/pub/marcj/cdrom.c这个文件,好像没有什么用处,什么反应都没有,4楼的那个程序不错,谢谢
Yes, I used the file ftp://ftp.he.net/pub/marcj/cdrom.c, but it seems to be of no use and there's no response. The program on the 4th floor is pretty good, thank you.
|
|
2004-8-25 00:00 |
|
|
qingfen
初级用户
 
积分 70
发帖 22
注册 2006-4-22
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
我希望能用端口编程而不是用中断来编写??
I hope to use port programming instead of interrupts to write??
|
|
2006-4-22 21:18 |
|
|
johnsonlam
银牌会员
     阿林
积分 1410
发帖 497
注册 2004-6-28 来自 九龍,香港
状态 离线
|
『第 9 楼』:
有 现 成 的 啊 (QCDROM) , 自 己 编 程 不 容 易 !
使用 LLM 解释/回答一下
QCDROM 『 汇 编 语 言 大 师 』( 我 说 的 ) 出 品 , 支 援 UltraDMA , 相 当 稳 定 , 配 合 SHSUCDX V3.03A (Jack R. Ellis 修 正 版 ) 就 更 "快" 了 !
http://johnson.tmfc.net/freedos
内 有 QCDROM 及 SHCDX33A 下 载 !
Last edited by johnsonlam on 2006-4-24 at 11:40 ]
QCDROM "Assembly Language Master" (I said) produced, supports UltraDMA, quite stable, with SHSUCDX V3.03A (Jack R. Ellis modified version) is even more "fast"!
http://johnson.tmfc.net/freedos
There are QCDROM and SHCDX33A downloads!
Last edited by johnsonlam on 2006-4-24 at 11:40 ]
|

我 的 網 站 - http://optimizr.dyndns.org
|
|
2006-4-24 11:39 |
|
|
qingfen
初级用户
 
积分 70
发帖 22
注册 2006-4-22
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
我想问一下4楼版主这句语句:
for(i=0;i<2;i++) 和 ch=getbuff&0x01;
的 i< 有什么作用,还有好像 lt,amp 都没有定义吧?
Last edited by qingfen on 2006-4-26 at 01:10 ]
I want to ask about the statement of the moderator on the 4th floor:
for(i=0;i<2;i++) and ch=getbuff&0x01;
What is the function of i<, and it seems that lt, amp are not defined?
Last edited by qingfen on 2006-4-26 at 01:10 ]
|
|
2006-4-25 03:07 |
|
|
JonePeng
金牌会员
      D◎$ Fαп
积分 4562
发帖 1883
注册 2004-1-19 来自 广东广州
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
Originally posted by qingfen at 2006-4-25 03:07:
for(i=0;i<2;i++) 和 ch=getbuff&0x01;
的 i< 有什么作用,还有好像 lt,amp 都没有定义吧?
以前该论坛是DVBBS的论坛,对源程序的“&”和大小于符号特别敏感,会将“&”变成“&”,小于号变成“%lt”等。现在4楼的源程序已更新了。
Originally posted by qingfen at 2006-4-25 03:07:
for(i=0;i < 2;i++) and ch=getbuff & 0x01;
What is the function of i <, and it seems that lt and amp are not defined?
Previously, this forum was a DVBBS forum, which was particularly sensitive to the "&" and less-than symbols in the source code, turning "&" into "&" and less-than signs into "%lt" and so on. Now the source code on the 4th floor has been updated.
|

----====≡≡≡≡ 我的至爱,永远是MSDOS!≡≡≡≡====----
|
|
2006-5-1 00:51 |
|
|
CrazyWind
初级用户
 
积分 131
发帖 12
注册 2004-3-2
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
控制光驱开关的原理是什么?每个光驱都一样的吗?
某“XXX中断大全”里有介绍吗?
What is the principle of controlling the CD-ROM drive switch? Are all CD-ROM drives the same? Is there an introduction in some "XXX Interrupt Compendium"?
|
|
2006-5-3 10:16 |
|
|
qingfen
初级用户
 
积分 70
发帖 22
注册 2006-4-22
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
哦,是这样呀,但是在在windows系统里怎么能兼容那么多光驱呢?
还有内核驱动和设备驱动有什么区别呢?
Oh, that's how it is. But how can Windows system be compatible with so many CD-ROM drives? And what's the difference between kernel drivers and device drivers?
|
|
2006-5-5 13:12 |
|
|
darkradx
高级用户
   
积分 972
发帖 420
注册 2004-5-16
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
ATAPI Spec自己掰啊
Bend it yourself regarding ATAPI Spec
|

平生进退如飙风 |
|
2006-5-5 20:56 |
|
|