#include <stdio.h>
char ah,al,bh,bl,ch,cl,dh,dl,buffer[4096];
unsigned ax,bx,cx,dx,si,di,bp,ds,es;  int fd,m;

main(){
        fd=fopen("c:buf4-14.z","w");
		   cl=0x17;	/* C */
		   dh=0x00;	/* H */
		   dl=0x01;	/* R */
		   ch=0x01;	/* N */
		        bh=1;	/* Count */
#asm
	mov	ah,03h
	mov	al,10h
	int	1bh		; Reset
#
        bp=&buffer;
        es=_showds();
#asm
	push	es
        mov     bp,word bp_
        mov     es,word es_
	mov	bh,byte bh_
	mov	bl,0
	mov	ch,1
	mov	cl,byte cl_
	mov	dh,byte dh_
	mov	dl,byte dl_
        mov     ah,11010110b
        mov     al,10h
        int     1bh             ; Read Disc BIOS
        pushf
        pop     cx
        mov     byte ah_,ah
        and     cl,1
        mov     byte cl_,cl
	pop	es
#
	m=256*bh;
	printf("\n\nResult = %02x,%02x",cl,ah);
	printf(" : Counts = %d",m);
        if(cl==0){
		write(fd,buffer,m);
		puts("   =====  O K  =====\n");
        }
	else{
		puts("\n\t!!! E R R O R !!!\n");
	}
	close(fd);
	exit(0);
}

