# define BLKSIZ 512 /* tape block size */
int count
, sector
, isector
, icount
;
char *bufptr
, input
[128] , *ibufptr
;
* Stand-alone program to copy VAX LSI RX11 floppy diskette to
* memory and back to floppy.
* Floppy sector no.'s start at 1 for controller - start at 0
* Floppy track no.'s start at 0.
putlin("flpcpy : Floppy-to-Memory-to-Floppy Copy") ;
putstr("floppy sector offset : ") ;
if ((sector
< 0) || (sector
>= MAXSEC
)) goto doff
;
putstr("no. of input sectors : ") ;
if (count
< 0) goto gknt
;
if (count
== 0) count
= MAXSEC
;
if (flio(FL_RS
)) { /* read */
putlin("floppy input error") ;
putlin("floppy read complete") ;
putlin("mount new floppy - type any key when ready") ;
putlin("floppy output error") ;
putlin("floppy write complete") ;
ibufptr
= bufptr
= (char *)(((int)&end
+511) & 017777777000) ;
* Function to read/write 1 sector from floppy disc.
* 'sector' is sector no.-1 to read into 'input[]'.
* Return (-1) for error, else return (0) .
register unsigned int c
;
/* compute start track & sector from current sector 'sector'. */
t
= sector
/RXSTRK
; /* track no. */
s
= sector
%RXSTRK
+ 1 ; /* sector */
mtpr(TXDB
,func
) ; /* Floppy Read/Write Sector command */
mtpr(TXDB
,s
|FL_DATA
) ; /* supply sector no. to floppy interface */
mtpr(TXDB
,t
|FL_DATA
) ; /* track no. */
if (func
== FL_RS
) { /* Read Sector */
/* wait for read to complete */
if (fldone()) return(-1) ;
/* loop to read sector bytes from interface */
for (j
= 0 ; j
< RXBYSEC
; j
++) {
flrwait() ; /* wait till ready */
(*bufptr
++) = mfpr(RXDB
) ; /*get data byte-assume from floppy*/
if (func
== FL_WS
) { /* Write Sector */
for (j
= 0 ; j
< RXBYSEC
; j
++) {
/* send byte over interface */
if (fldone()) return(-1) ;