home *** CD-ROM | disk | FTP | other *** search
/ ftp.whtech.com / ftp.whtech.com.7z / ftp.whtech.com / emulators / v9t9 / linux / sources / V9t9 / source / pab.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-10-19  |  1.8 KB  |  98 lines

  1.  
  2. #ifndef __PAB_H__
  3. #define __PAB_H__
  4.  
  5. /*
  6.     Defines to handle the PAB (peripheral access block) by 
  7.     emulated device DSRS.  
  8.     
  9.     The PAB holds information sent to the DSR describing the
  10.     device, filename, record, operation, etc., used in an
  11.     I/O request.
  12.     
  13.     PABs are stored in the VDP RAM, and the emulated device code accesses
  14.     the VDP RAM directly.  We must synchronize the VDP with the changes we
  15.     make to it, so that the screen will be updated as necessary.
  16. */
  17.  
  18. /*    File operations (byte 0, opcode)*/
  19. enum
  20. {
  21.     f_open,
  22.     f_close,
  23.     f_read,
  24.     f_write,
  25.     f_seek,
  26.     f_load,
  27.     f_save,
  28.     f_delete,
  29.     f_scratch,
  30.     f_status
  31. };
  32.  
  33. /*    File open codes (byte 1, pflags) */
  34. enum
  35. {
  36.     m_openmode = 3 << 1,
  37.     m_update = 0 << 1,
  38.     m_output = 1 << 1,
  39.     m_input = 2 << 1,
  40.     m_append = 3 << 1
  41. };
  42.  
  43. /*    Flags set for types of file access (byte 1, pflags)
  44.     (0x80 never really used) */
  45. enum
  46. {
  47.     fp_program = 0x80,
  48.     fp_variable = 0x10,
  49.     fp_internal = 0x8,
  50.     fp_relative = 0x1
  51. };
  52.  
  53. /*    Error codes (byte 1, pflags)*/
  54. enum
  55. {
  56.     m_error    = 0x7 << 5,
  57.  
  58.     e_baddevice = 0x0,
  59.     e_readonly = 1 << 5,
  60.     e_badopenmode = 2 << 5,
  61.     e_illegal = 3 << 5,
  62.     e_outofspace = 4 << 5,
  63.     e_endoffile    = 5 << 5,
  64.     e_hardwarefailure = 6 << 5,
  65.     e_badfiletype = 7 << 5
  66. };
  67.  
  68. /*    Status codes */
  69. enum
  70. {
  71.     st_filenotfound = 0x80,
  72.     st_readonly = 0x40,
  73.     st_internal = 0x10,
  74.     st_program = 8,
  75.     st_variable = 4,
  76.     st_diskfull = 2,
  77.     st_eof = 1
  78. };
  79.  
  80.  
  81. /*    This maps directly onto the VDP */
  82. typedef struct
  83. {
  84.     u8    opcode;        /* file operation (f_xxx) */
  85.     u8    pflags;        /* file access code (fp_xxx) + open mode (m_xxx) */
  86.     u16    addr;        /* VDP record address */
  87.     u8    preclen;    /* file record length */
  88.     u8    charcount;    /* characters used in record */
  89.     u16    recnum;        /* current record (seek position) */
  90.     u8    scrnoffs;    /* screen offset (for CSx) */
  91.     u8    namelen;    /* length of filename following */
  92.     u8    name[0];    /* filename */
  93. }    pabrec;
  94.  
  95. //extern    pabrec    *pabaddr;    /* VDP location of current PAB */
  96.  
  97. #endif
  98.