! SCSI interface and Thorn EMI tape streamer driving routines
! RWT January 1987

%externalroutinespec scsi reset
%externalroutinespec scsi select
%externalintegerspec scsiinitiator,scsitarget
%externalintegerfnspec scsi phase(%integer phase,count,%bytename b)
%constinteger -
 data out phase    = 16_0000,
 data in phase     = 16_0100,
 command phase     = 16_0200,
 status in phase   = 16_0300,
 message out phase = 16_0600,
 message in phase  = 16_0700

! Status bits
%constinteger sensemask=15,ili=1<<5,eom=1<<6,fm=1<<7,
  fby=1<<8,dby=1<<9,ldpt=1<<10,eot=1<<11,
  rdy=1<<12,onl=1<<13,rwdg=1<<14,fptd=1<<15,
  ident=1<<16,hsp=1<<17,her=1<<18,cer=1<<19,dfm=1<<20,nrz=1<<21

! Mode bits
%constinteger pe3200      = 16_80000000,
              pe1600      = 16_02000000,
              defaultdensity        = 0,
              buffered    = 16_00100000,
              nonbuffered           = 0,
              fast        = 16_000f0000,
              slow                  = 0,
              variableblocksize     = 0,
              densitymask = 16_ff000000,
              buffermask  = 16_00700000,
              speedmask   = 16_000f0000,
              sizemask    = 16_0000ffff

%externalintegerspec tape residue, tape status
%externalroutinespec tape show sense(%integer status)
%externalroutinespec tape show mode(%integer mode)
%externalintegerfnspec tape command -
  (%integer code,param,%bytename b,%integername length)
%externalroutinespec tape mode select(%integer x)
%externalintegerfnspec tape mode sense
%externalpredicatespec tape unit ready
%externalroutinespec tape rewind and wait
%externalroutinespec tape rewind off line
%externalroutinespec tape unload
%externalroutinespec tape erase three inches
%externalroutinespec tape erase to end
%externalintegerfnspec tape read block(%bytename b,%integer bytes)
%externalintegerfnspec tape reverse read block(%bytename b,%integer bytes)
%externalintegerfnspec tape write block(%bytename b,%integer bytes)
%externalintegerfnspec tape read blocks(%bytename b,%integer bytes)
%externalintegerfnspec tape reverse read blocks(%bytename b,%integer bytes)
%externalintegerfnspec tape write blocks(%bytename b,%integer bytes)
%externalroutinespec tape write marks(%integer n)
%externalroutinespec tape space blocks(%integer n)
%externalroutinespec tape space marks(%integer n)
%externalroutinespec tape space consecutive(%integer n)
%externalroutinespec reverse buffer(%bytename b,%integer bytes)
