< -->

Program CD_ROM;
type
  DevList = record
    Lt : Byte;
    Padr  : Pointer;
  end;
var
  Buffer : array[0..16383] of Byte;
  ChBf   : array[0..16383] of Char absolute Buffer;
  DrvLt, CDROMLt : Word;
  DL : array[0..10] of DevList;
  CopyrightFn : array[0..37] of Char;
  xt, yt : Byte;
  i : Word;
Procedure PutChr(C:Char; Col : Byte); Assembler;
asm
   mov ah, $09
   mov bh, 0
   mov bl, Byte Ptr Col
   mov al, Byte ptr C
   mov cx, 1
   int $10
end;
{----------------}
Procedure PutCursor(xx, yy : Byte);
begin
 xt := xx;
 yt := yy;
 asm
   mov ah, 2
   mov dh, Byte Ptr yy
   mov dl, Byte Ptr xx
   dec dh
   dec dl
   mov bh, 0
   int $10
 end;
end;
Procedure WriteCharXY(x, y, Attr : Byte; c : Char);
begin
  PutCursor(X, Y);
  PutChr(c, Attr);
end;
Function KeyPressed : Boolean;Assembler;
asm
 mov ah, $0B
 int $21
end;
Function ScanKey : Byte; Assembler;
asm
   in   al, 60h
end;
Function ReadKey : Byte; assembler;
asm
    xor ax,ax
    int 16h
end;
Procedure CD_Install(var CDROMn, StartDl : Word); Assembler;
asm
    mov	ax, 1500h
    xor bx, bx
    int	2Fh
    mov word ptr CDROMn, bx
    mov word ptr StartDl, cx
end;
Procedure GetCD_DriveDevice; Assembler;
asm
    push es
    mov ax, seg DL
    mov es, ax
    mov bx, offset DL
    mov	ax, 1501h
    int	2Fh
    pop es
end;
Procedure Copyright(Disk : Word); Assembler;
asm
   push es
   mov  cx, word ptr Disk
   mov  ax, seg CopyRightFn
   mov  es, ax
   mov  ax, 1502h
   mov  bx, offset CopyRightFn
   int  2Fh
   pop  es
end;
Procedure WriteCopyRights;
var
  i : Byte;
begin
  for i := 0 to 37 do Write(CopyRightFn);
  WriteLn;
end;
Procedure ReadVTOC; Assembler;
asm
   push es
   mov  ax, Seg Buffer
   mov  es, ax
   mov  bx, offset Buffer
   mov  ax, 1505h
   int  2Fh
   pop  es
end;
Function AbsDiskRead(Drive, SecHi, SecLo, SecChn : Word) : Byte; Assembler;
asm
   push es
   mov  ax, Seg Buffer
   mov  es, ax
   mov  bx, offset Buffer
   mov  ax, 1508h
   int  2Fh
   pop  es
{
; ES:BX	-> buffer, CX =	drive number (0=A:)
; SI:DI	= starting sector number, DX = number of sectors to read
; Return: CF set on error, AL =	error code (15=invalid drive,21=not ready)
; CF clear if successful
}
end;
Procedure AbsDiskWrite(Drive, SecHi, SecLo, SecChn : Word); Assembler;
asm
   push es
   mov  ax, Seg Buffer
   mov  es, ax
   mov  bx, offset Buffer
   mov  ax, 1509h
   int  2Fh
   pop  es
{
; ES:BX	-> buffer, CX =	drive number (0=A:)
; SI:DI	= starting sector number, DX = number of sectors to write
}
end;
Procedure x; Assembler;
asm
   mov  ax, 1500h
   int  2Fh
end;
begin
  CD_Install(CDROMLt, DrvLt);
  WriteLn('Номер CD-ROM: ', CDROMLt, ', начальный диск: ', DrvLt);
  GetCD_DriveDevice;
  WriteLn(DL[0].Lt);
  WriteLn(DL[1].Lt);
  CopyRight(0);
  WriteCopyRights;
  for i := 0 to 22 do
   WriteLn(AbsDiskRead(i, 0, 1, 1));
  AbsDiskWrite(9, 0, 1, 1)
end.
{
		mov	ah, 15h
		mov	al, 0
		int	2Fh		;  Multiplex - CDROM - INSTALLATION CHECK
					; BX = 0000h
					; Return: BX = number of CDROM drive letters used
					; CX = starting	drive letter (0=A:)
		mov	ah, 15h
		mov	al, 1
		int	2Fh		;  Multiplex - CDROM - GET DRIVE DEVICE	LIST
					; ES:BX	-> buffer to hold drive	letter list
					; Return: buffer filled, for each drive	letter
					; BYTE	subunit number in driver
					; DWORD	address	of device driver header
		mov	ah, 15h
		mov	al, 2
		int	2Fh		;  Multiplex - CDROM - GET COPYRIGHT FILE NAME
					; ES:BX	-> 38-byte buffer for name of copyright	file
					; CX = drive number (0=A:)
					; Return: CF set if drive is not a CDROM drive,	AX = 15	(invalid drive)
					; CF clear if successful
		mov	ah, 15h
		mov	al, 3
		int	2Fh		;  Multiplex - CDROM - GET ABSTRACT FILE NAME
					; ES:BX	-> 38-byte buffer for name of abstract file
					; CX = drive number (0=A:)
					; Return: CF set if drive is not a CDROM drive,	AX = 15	(invalid drive)
					; CF clear if successful
		mov	ah, 15h
		mov	al, 4
		int	2Fh		;  Multiplex - CDROM - GET BIBLIOGRAPHIC DOC FILE NAME
					; ES:BX	-> 38-byte buffer for name of bibliographic documentation file
					; CX = drive number (0=A:)
					; Return: CF set if drive is not a CDROM drive,	AX = 15	(invalid drive)
					; CF clear if successful
		mov	ah, 15h
		mov	al, 5
		int	2Fh		;  Multiplex - CDROM - READ VTOC
					; ES:BX	-> 2048-byte buffer CX = drive number (0=A:)
					; DX = sector index (0=first volume descriptor,1=second,...)
					; Return: CF set on error, AX =	error code
					; CF clear if successful, AX = volume descriptor type
		mov	ah, 15h
		mov	al, 6
		int	2Fh		;  Multiplex - CDROM - TURN DEBUGGING ON
					; BX = debugging function to enable
		mov	ah, 15h
		mov	al, 7
		int	2Fh		;  Multiplex - CDROM - TURN DEBUGGING OFF
					; BX = debugging function to disable
		mov	ah, 15h
		mov	al, 8
		int	2Fh		;  Multiplex - CDROM - ABSOLUTE	DISK READ
					; ES:BX	-> buffer, CX =	drive number (0=A:)
					; SI:DI	= starting sector number, DX = number of sectors to read
					; Return: CF set on error, AL =	error code (15=invalid drive,21=not ready)
					; CF clear if successful
		mov	ah, 15h
		mov	al, 9
		int	2Fh		;  Multiplex - CDROM - ABSOLUTE	DISK WRITE
					; ES:BX	-> buffer, CX =	drive number (0=A:)
					; SI:DI	= starting sector number, DX = number of sectors to write
		mov	ah, 15h
		mov	al, 0Ah
		int	2Fh		;  Multiplex - CDROM - RESERVED
		mov	ah, 15h
		mov	al, 0Bh
		int	2Fh		;  Multiplex - CDROM - 2.00 - DRIVE CHECK
					; CX = drive number (0=A:)
					; Return: BX = ADADh if	MSCDEX.EXE installed
					; AX = 0000h if	drive not supported
					; nonzero if supported
		mov	ah, 15h
		mov	al, 0Ch
		int	2Fh		;  Multiplex - CDROM - 2.00 - GET MSCDEX.EXE VERSION
					; Return: BH = major version
					; BL = minor version
		mov	ah, 15h
		mov	al, 0Dh
		int	2Fh		;  Multiplex - CDROM - 2.00 - GET CDROM	DRIVE LETTERS
					; ES:BX	-> buffer for drive letter list	(1 byte	per drive)
					; Return: buffer filled	with drive numbers (0=A:).  Each byte corresponds
					; to the drive in the same position for	function 1501h
		mov	ah, 15h
		mov	al, 0Eh
		int	2Fh		;  Multiplex - CDROM - 2.00 - GET/SET VOLUME DESCRIPTOR	PREFERENCE
					; BX = 00h get preference / 01h	set preference
					; CX = drive number (0=A:)
					; Return: CF set on error, AX =	error code
					; CF clear if successful
		mov	ah, 15h
		mov	al, 0Fh
		int	2Fh		;  Multiplex - CDROM - 2.00 - GET DIRECTORY ENTRY
					; CX = drive number (0=A:), ES:BX -> ASCIZ path	name
					; SI:DI	-> 255-byte buffer for directory entry
					; Return: CF set on error, AX =	error code
					; CF clear if succesful, AX = disk format
		mov	ah, 15h
		mov	al, 10h
		int	2Fh		;  Multiplex - CDROM - 2.10 - SEND DEVICE DRIVER REQUEST
					; CX = CD-ROM drive letter (0 =	A, 1 = B, etc)
					; ES:BX	-> CD-ROM device driver	request	header (see AX=0802h)
}

Назад