BBS: Inland Empire Archive Date: 02-10-93 (11:19) Number: 235 From: FRANCOIS ROY Refer#: NONE To: TRENT SHIRLEY Recvd: NO Subj: Re: CD-ROM RECOGNITION Conf: (2) Quik_Bas
You can use CALL INTERRUPT to read the ISO-9660 sectors via MSCDEX. The VTOC
(Volume Table of Contents) is accessible as shown below; I don't have its
structure so can't tell you what the fields mean, but I can betcha no two are
alike... the VTOC is a 2048-byte string; I defined my buffer in CDVTOC with a
length of 4096 because for some reason 2048 gives me String Space Corrupt
errors... the demo routine below prints the first 800 bytes of the VTOC but
you may want to store the whole 2048 bytes as the CD's "fingerprint".
The code snippet below is for QB; QBX far strings need a small alteration.
DECLARE SUB CDVTOC (D$, V$)
DECLARE SUB CDDRIVE (DR$)
TYPE REGTYPE ' For CALL INTERRUPT
AX AS INTEGER
BX AS INTEGER
CX AS INTEGER
DX AS INTEGER
BP AS INTEGER
SI AS INTEGER
DI AS INTEGER
FL AS INTEGER
DS AS INTEGER
ES AS INTEGER
END TYPE
DIM SHARED INR AS REGTYPE, OUR AS REGTYPE
CALL CDDRIVE(D$)
PRINT "Drive:"; D$
CALL CDVTOC(D$, V$)
PRINT LEFT$(V$, 800)
END
SUB CDDRIVE (DR$) STATIC
DR$ = STRING$(32, 0)
INR.AX = &H150D
INR.BX = SADD(DR$)
INR.ES = SSEG(DR$)
CALL InterruptX(&H2F, INR, OUR)
IF ASC(DR$) = 0 THEN DR$ = "" ELSE DR$ = CHR$(ASC(DR$) + 65) + ":"
END SUB
SUB CDVTOC (D$, V$) STATIC
REM Reads VTOC
DR$ = STRING$(4096, 0)
INR.AX = &H1505
INR.BX = SADD(DR$)
INR.CX = INSTR("ABCDEFGHIJKLMNOP", LEFT$(D$, 1)) - 1
INR.DX = 0 ' 1st volume descriptor
INR.ES = SSEG(DR$)
CALL InterruptX(&H2F, INR, OUR)
REM AX=1 is normal and indicates a standard vol. descr.
REM AX=15 is 'Invalid Drive' and 21 is 'Not Ready'. 255 means no vol. desc.
IF OUR.AX > 1 THEN V$ = "Error" + STR$(OUR.AX) ELSE V$ = DR$
END SUB
--- ME2_1104
* Origin: Out of String Space - the Final Frontier (Fidonet 1:163/506.2)

Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET