
need help: MSCDEX CD-ROM programming in QB 4.5
Hi,
I'm writting a cd audio player as the final project for my computer
class. I've already been able to do most of it (play, stop, resume,
etc..), but am having problems getting the Disc's UPC code (i need this
because i have to build a disc database, and this is the only accurate
way of identifyling a particular cd)...
Here's the code for the subroutine...
All the variable ARE being passed correctly (i quatruple-checked that!)
SUB getupc (devnam$, upc$) 'devnam$ is the device name (usually
MSCD001)
DIM inreg AS regtypex 'Input / output registers
DIM outreg AS regtypex
OPEN devnam$ FOR BINARY AS #1
filehandle% = FILEATTR(1, 2)
inreg.bx = filehandle%
inreg.cx = 11 'Length of control block
inreg.ax = &H4402 ' IOCTL function 2 (read)
upc$ = CHR$(14) + STRING$(10, 0)'Control Block (code 14 = get upc)
inreg.ds = VARSEG(upc$) 'DS:DX = pointer to control block
inreg.dx = SADD(upc$)
CALL interruptx(&H21, inreg, outreg)
FOR i% = 1 TO 11 'print UPC code (temp. code for testing only)
PRINT ASC(MID$(upc$, i%, 1)); 'This returns 14, 0, 0 etc.. (the
control block
'was not modified in any way)
NEXT i%
PRINT outreg.ax 'AX returns 11 (# of bytes read = no error)
SLEEP
CLOSE #1
END SUB
Is there anyone who has done this before and can help me??
I would really appreciate it!
-Juanfe
(P.S.) Please try to reply by mail... Also, if you're trying to write
a cd player and are even MORE clueless than i am, then e-mail me and
i'll happily
send you my code (most of it works!) + full docs on MSCDEX.
Thanks In Advance!