OPEN"MSCDEX01" FOR RANDOM AS #1
IOCTL #1,CHR$(3) 'open
IOCTL #1,CHR$(10) 'close
CLOSE
Greetings from Germany...
Daniel
+------------------------------------------------------------------------+
| HUCK @ Nobody.gun.de ObOd¥ in M'Gladbach 02166 / 185293 |
+------------------------------------------------------------------------+
You wouldn't happen to have similar code for playing the CDs, would you?
-Jesse
> +------------------------------------------------------------------------+
> | HUCK @ Nobody.gun.de ObOd¥ in M'Gladbach 02166 / 185293 |
> +------------------------------------------------------------------------+
--
====================================
Very funny Scotty!
Now beam down my clothes!
====================================
Jesse Dorland <jessed...@hotmail.com> wrote in article <12D495...@hotmail.com>...
> Daniel Bellen wrote:
> >
> > > Anyone know how to open or close the cdrom drive in Qbasic or
> > > VisualBasic3? And how to see if the drive is opned or closed? Any info
> > > would be greatly appreciated. Thanks
> >
> > OPEN"MSCDEX01" FOR RANDOM AS #1
> > IOCTL #1,CHR$(3) 'open
> > IOCTL #1,CHR$(10) 'close
> > CLOSE
> > Greetings from Germany...
> > Daniel
All I get is an Illegal Function call when I try this code. It also creates a file called MSCDEX01 with 0 byte length (Since there were no writes to it this is what I would expect.)
Tom Lake
TO>> > OPEN"MSCDEX01" FOR RANDOM AS #1
TO>> > IOCTL #1,CHR$(3) 'open
TO>> > IOCTL #1,CHR$(10) 'close
TO>> > CLOSE
TO>All I get is an Illegal Function call when I try this code. It also
TO>creates a file called MSCDEX01 with 0 byte length (Since there were no
TO>writes to it this is what I would expect.)
THat's because it isn't MSCDEX01 on all computers. It changes depending
on what software, and what type of CD-ROM you have. On my computer I
have to replace MSCDEX01 with DMSCD01 ... I think there is a way to
obtain the device name to use through interrupt 02Fh but I've never
looked. (If there is, that would allow you to write some CD routines
compatible with various different set ups)
I've actually found a CD player written in BASIC so I know there's a
way. (Compiled code)
Has been and will be more this next issue. =) Believe it or not, I am
sitting here with an open cdrom drive after it came up with lotsa errors
after running that program in QBasic, win95 didnt like it heh =)
Cheers,
--
Peter Cooper
>Daniel Bellen wrote:
>>
>> > Anyone know how to open or close the cdrom drive in Qbasic or
>> > VisualBasic3? And how to see if the drive is opned or closed? Any info
>> > would be greatly appreciated. Thanks
>>
>> OPEN"MSCDEX01" FOR RANDOM AS #1
>> IOCTL #1,CHR$(3) 'open
>> IOCTL #1,CHR$(10) 'close
Um... I may be mistaken, but isn't this supposed to be 0 and 5?
>> CLOSE
>> Greetings from Germany...
>> Daniel
>You wouldn't happen to have similar code for playing the CDs, would you?
>
>-Jesse
Playing Cd's is way more complicated, since you've got to construct a
controlblock with a lot of info. Also, above example will not work if
you're running windows (95) since that overrides mscdex. Also, what if
someone is using a non-standard devicedriver name? default is
MSCD001,but a lot of people I know (including myself) use different
names for this one.
In the Basic Fanzine that has been/will be ( ;) ) QBasic code to
perform all these operations, including playing the CD. I've converted
this all to PB, but since the PB REG(x) is apparently slightly
incompatible with Windows 95 I'm still busy to make it 95-compatible.
I will probably succeed, it just takes some time. ;-)
Marc van den Dikkenberg
-----------------------------o---------------------
http://145.89.78.151/~excel | Programming Archives
http://www.xs4all.nl/~excel | antU, Humour, Sci-Fi
EX>Um... I may be mistaken, but isn't this supposed to be 0 and 5?
You're right.
First of all! I once tried opening the device driver and using IOCTL to
do this, but let's just say that after looking about an hour for a backup
of the driver everything was alright! I personally dislike this method of
programming the cd-rom. Since the driver has already been loaded in
memory, you can access all the cd-rom functions via interrupts. This
means you test if the driver has been installed, construct your
request/control headers in memory and use interrupts to activate the
instructions you have given in the headers. To see one way of how you can
do this keep reading the fanzine. If you are a QBASIC user then check out
my web page for a downloadable conversion of the prog from the fanzine.
> Um... I may be mistaken, but isn't this supposed to be 0 and 5?
According to my docs you are right, Code 0 is EJECT DISK for a IOCTL
Write and 5 is CLOSE TRAY.
> >> CLOSE
> >> Greetings from Germany...
> >> Daniel
>
> >You wouldn't happen to have similar code for playing the CDs, would you?
> >
> >-Jesse
>
> Playing Cd's is way more complicated, since you've got to construct a
> controlblock with a lot of info. Also, above example will not work if
> you're running windows (95) since that overrides mscdex. Also, what if
Yep, that's right! You will not only need a request header, but also a
control block to play CDs. But, it's not that much more complicated. You
request header should have the following format:
Field Size Entry
byte Length in bytes of request header
byte 0
byte 132 (Command Code for PLAY AUDIO)
word 0 (contains status after call)
8 bytes all 0 (Reserved)
byte addressing mode (0=HSG, 1=RBA)
dword starting sector number (depends on addressing
mode)
dword number of sectors to read
> someone is using a non-standard devicedriver name? default is
> MSCD001,but a lot of people I know (including myself) use different
> names for this one.
Again, opening the actual device driver on the disk can be dangerous.
> In the Basic Fanzine that has been/will be ( ;) ) QBasic code to
> perform all these operations, including playing the CD. I've converted
> this all to PB, but since the PB REG(x) is apparently slightly
> incompatible with Windows 95 I'm still busy to make it 95-compatible.
> I will probably succeed, it just takes some time. ;-)
Aha! That's interesting. Another reason not to switch to Windows 95. Have
you tried inline assembler? Oh yeah, it would really interest me how my
program/tutorial is working out for all of you (bugs, problems,
quirks,...)! Thanks!
Hope this cleared some things up!
Marco Koegler
mk...@fidnet.com
http://www.umr.edu/~marco
PS: The QBASIC version (PCD3.ZIP) on my homepage also contains a
translation of the interrupt routines into CALL ABSOLUTE's with ASM
equivalents in REMarks on the side.
>> perform all these operations, including playing the CD. I've converted
>> this all to PB, but since the PB REG(x) is apparently slightly
>> incompatible with Windows 95 I'm still busy to make it 95-compatible.
>> I will probably succeed, it just takes some time. ;-)
>
>Aha! That's interesting. Another reason not to switch to Windows 95. Have
>you tried inline assembler? Oh yeah, it would really interest me how my
>program/tutorial is working out for all of you (bugs, problems,
>quirks,...)! Thanks!
Yes, and inline ASM is working fine. I just need to know how to use
VARSEG and VARPTR in this context, though.
It's very weird:
REG %ax,<something>
REG %bx,<something>
CALL INTERURPT &H<x>
May give a different result than
! mov AX,<something>
! mov BX,<something>
! int &H<x>
But ofcourse you can always translate the above stuff into inline ASM
to make it work. That's what I'm doing right now...