China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-01 02:20
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » BASIC source code to determine whether a CD-ROM drive is installed View 747 Replies 1
Original Poster Posted 2003-09-20 00:00 ·  中国 湖北 宜昌 电信
高级用户
★★
Credits 677
Posts 194
Joined 2003-09-13 00:00
22-year member
UID 9778
Gender Male
Status Offline
'$INCLUDE: 'qb.bi'
DIM SHARED ax, bx, cx, dx
PRINT "The CD-ROM drive letter is ";disk$

FUNCTION disk$
DIM d$(25)
d$(0) = "A:": d$(1) = "B:": d$(2) = "C:": d$(3) = "D:": d$(4) = "E:": d$(5) = "F:"
d$(6) = "G:": d$(7) = "H:": d$(8) = "I:": d$(9) = "J:": d$(10) = "K:": d$(11) = "L:"
ax = &H1500
int2f
IF bx = 0 THEN PRINT "No CD-ROM found --No CDRom" ELSE disk$ = d$(cx)
END FUNCTION

SUB int2f
InRegs.ax = ax
InRegs.bx = bx
InRegs.cx = cx
InRegs.dx = dx
InRegs.flags = flags
INTERRUPTX &H2F, InRegs, OutRegs
ax = OutRegs.ax
bx = OutRegs.bx
cx = OutRegs.cx
dx = OutRegs.dx
flags = OutRegs.flags
END SUB

Floor 2 Posted 2003-09-29 00:00 ·  中国 湖北 宜昌 电信
高级用户
★★
Credits 677
Posts 194
Joined 2003-09-13 00:00
22-year member
UID 9778
Gender Male
Status Offline
Explanation: INT 2F interrupt, entry AH=15H
If BX returns zero, there is no CD-ROM drive!
Forum Jump: