Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening the CD-ROM drive

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Could somebody please tell me if there is some way in BASIC to open the CD-ROM drive? Surely there is an interrupt that will do the job. Thanks.
 
you'd have to learn about how to interface with the ACPI , which I dont think is possible from Qb. [sig]<p>Karl<br><a href=mailto:kb244@kb244.com>kb244@kb244.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
[/sig]
 
'Here is some code snippets to do it using MSCDEX.
'Get the whole CD player at 'that has CD Eject and close.

DEFINT A-Z
SUB SCDEject
'ejects a CD
Preprh 12
Prepcb 0
Call10
END SUB

SUB Preprh (command%) STATIC
' Prepares the request header for a given command code
'
' ARGS: command% - command code
' RET: - correctly dimensioned request header rh()
' - correctly filled in fields for basic request
' header

SELECT CASE command%
CASE 3, 12 'IOCTL Input , IOCTL Output
rhlength% = 26
CASE 132 'Play
rhlength% = 22
CASE 133, 136 'Pause, Resume
rhlength% = 13
END SELECT

REDIM rh(1 TO rhlength%) AS STRING * 1
rh(1) = CHR$(rhlength%)
rh(2) = CHR$(drivearray(Drive, 2))
rh(3) = CHR$(command%)
END SUB

'$INCLUDE: 'qb.bi'
DIM SHARED inregsx AS RegTypeX
DIM SHARED outregsx AS RegTypeX



TYPE tracktype
start AS LONG
length AS LONG
ctrlinfo AS INTEGER
END TYPE

TYPE disktype
Low AS INTEGER
High AS INTEGER
Leadout AS LONG
END TYPE

'$DYNAMIC
'----------------------------------------------------------------
COMMON SHARED Baseport% 'for Sound Blaster card
COMMON SHARED SBMyVol% 'volume setting
COMMON SHARED CDDEBUG%
'env/status vars
COMMON SHARED CDDoorOpen% 'is cd tray/door open? Door in CDLIB
COMMON SHARED playing AS INTEGER 'is CD playing?
COMMON SHARED paused AS INTEGER
COMMON SHARED Stopped AS INTEGER
COMMON SHARED Drive AS INTEGER 'default drive

COMMON SHARED drv% 'current drive
COMMON SHARED rhlength% 'length of request header
COMMON SHARED cblength% 'length of control block
COMMON SHARED max& 'length of control block
COMMON SHARED numdrives AS INTEGER
COMMON SHARED first AS INTEGER 'drive letter of first CD drive : int
DIM SHARED drivearray(X, Y) AS INTEGER
DIM SHARED rh(Z) AS STRING * 1 'request header - dynamic array
DIM SHARED cb(Z) AS STRING * 1 'command block - dynamic array
DIM SHARED trackinfo(Z) AS tracktype
DIM SHARED diskinfo(Z) AS disktype

'Define some default values
ver$ = &quot;4.60&quot;
CONST frameto100 = 1.333
CONST true = 1, false = 0
CONST skiplength& = 750&
paused1% = false
CDDoorOpen% = false
CDDEBUG% = false: 'A crude form of error correction in subs
max& = 0:
trlen& = 1
Baseport% = &H210
SBMyVol% = 8
vbar$ = CHR$(179)
r1 = 5: c1 = 1: c2 = 45: 'position of track info

SUB Prepcb (code%) STATIC
' Prepares the control block for a given subfunction
' Checks whether cb() is used for IOCTL INPUT or OUTPUT
'
' ARGS: code% - control block code
' RET: - correctly dimensioned control block cb()
' - correctly filled in fields for entire request
' header
IF ASC(rh(3)) = 3 THEN
SELECT CASE code%
CASE 1
length% = 6
CASE 4
length% = 9
CASE 6
length% = 5
CASE 9
length% = 2
CASE 10, 11
length% = 7
CASE 12, 15
length% = 11
END SELECT
ELSE
SELECT CASE code%
CASE 0, 2, 5
length% = 1
CASE 1
length% = 2
CASE 3
length% = 9
END SELECT
END IF

REDIM cb(1 TO length%) AS STRING * 1

cb(1) = CHR$(code%)

'Update address of cb() in rh()
rh(15) = CHR$(lbyte(VARPTR(cb(1))))
rh(16) = CHR$(hbyte(VARPTR(cb(1))))
rh(17) = CHR$(lbyte(VARSEG(cb(1))))
rh(18) = CHR$(hbyte(VARSEG(cb(1))))
'Number of bytes to transfer
rh(19) = CHR$(lbyte(length%))
rh(20) = CHR$(hbyte(length%))

END SUB
 
Might wana make that into a FAQ, looks lengthy too for the task. [sig]<p>Karl<br><a href=mailto:kb244@kb244.com>kb244@kb244.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
[/sig]
 
Toshi are you a human or a computer??

If you're human, why won't you sign on and become a member? I, too, would like to give you a Tek-Tip Vote (actually about fifty votes).

You don't have to put in an E-mail address you know. [sig]<p> <br><a href=mailto: > </a><br><a href= > </a><br>English is too hard to learn, the vowles change too much like come/home, comb/tomb, book/school, high/bye/sty, etc., etc. So should I say Geez or Sheez or Cheeze? hehe.[/sig]
 
I've said it before and here it goes again: Toshi is truly awesome. I could quit my day job if I possesed a small fraction of Toshi's knowledge of QB.

MiggyD, I'm beginning to think that simple compliments are all the reward Toshi needs. My hat is off.
[sig]<p> <br><a href=mailto: > </a><br><a href= plain black box</a><br>Don't sit down. It's time to dig another one.[/sig]
 
Alt255, I'm starting to think you're right.

So....

to Toshi, I'll give you two thumbs up for being an all-around good guy.

I'd also give you two big toes up, but I'm wearing shoes right now, so I can't.

Too bad he's human though. I guess I was hopeing he was an AI or a cyborg so I could ask around and find out where to buy a &quot;Toshi&quot;!! <smiles> [sig]<p> <br><a href=mailto: > </a><br><a href= > </a><br>English is too hard to learn, the vowles change too much like come/home, comb/tomb, book/school, high/bye/sty, etc., etc. So should I say Geez or Sheez or Cheeze? hehe.[/sig]
 
Alt255 and MiggyD,
You are both right. I used to volunteer tutor my peers in math and sciences in high school, but in college, I was often the one who was asking for help. It feels good to be appreciated for helping; on the flipside, it is wonderful to have pressing questions answered in a courteous manner. I believe that sharing knowledge benefits all.
 
See, MiggyD... Toshi is human. A very good one too! I don't think you will ever be able to buy the technology that drives the Toshi machine. It is driven by heart.

In any case, Toshi, thanks for coming around. We savor every word you type.


[sig]<p> <br><a href=mailto: > </a><br><a href= plain black box</a><br>"Suffice it to say that adding disk drives and a disk operating system to a personal microcomputer is guaranteed to increase its power dramatically."<br>
<u><b>CP/M and the Personal Computer</u></b>[/sig]
 

Toshi, I meant it. You realy are a VERY GOOD GUY!!! (or to be policitally correct-->very good person)

I probably won't ever get as much retentive memory as you apparently have. But sincerly, I'm honored to be in your presence. I, myself, am going to start college shortly to get my A.S. in computer information systems. So, I'll probably have some questions that you (and maybe some others) could guid me to the answers.

All in all, this posting is for you Toshi: YOU ARE THE MAN!! [sig]<p> <br><a href=mailto: > </a><br><a href= > </a><br>English is too hard to learn, the vowles change too much like come/home, comb/tomb, book/school, high/bye/sty, etc., etc. So should I say Geez or Sheez or Cheeze? hehe.[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top