+/*****************************************************************************/
+/* Variables */
+/*****************************************************************************/
+
+
+
+/* The file stream implementation and the POSIX I/O functions will use the
+ * following variables to determine the file type and the disk unit to use.
+ */
+extern unsigned char _curunit; /* Defaults to current when program started */
+extern char _filetype; /* Defaults to 'u' */
+
+
+
+/*****************************************************************************/
+/* Character-codes (CBM charset) */
+/*****************************************************************************/
+
+
+
+#define CH_HLINE 192
+#define CH_VLINE 221
+#define CH_ULCORNER 176
+#define CH_URCORNER 174
+#define CH_LLCORNER 173
+#define CH_LRCORNER 189
+#define CH_TTEE 178
+#define CH_BTEE 177
+#define CH_LTEE 171
+#define CH_RTEE 179
+#define CH_CROSS 219
+#define CH_CURS_UP 145
+#define CH_CURS_DOWN 17
+#define CH_CURS_LEFT 157
+#define CH_CURS_RIGHT 29
+#define CH_PI 222
+#define CH_HOME 19
+#define CH_DEL 20
+#define CH_INS 148
+#define CH_ENTER 13
+#define CH_STOP 3
+#define CH_LIRA 92
+#define CH_ESC 27
+
+
+
+/*****************************************************************************/
+/* Definitions for directory reading functions */
+/*****************************************************************************/
+
+
+
+/* CBM FILE TYPES */
+#define CBM_T_DEL 0
+#define CBM_T_SEQ 1
+#define CBM_T_PRG 2
+#define CBM_T_USR 3
+#define CBM_T_REL 4
+#define CBM_T_CBM 5 /* 1581 sub-partition */
+#define CBM_T_DIR 6 /* IDE64 and CMD sub-directory */
+#define CBM_T_LNK 7 /* IDE64 soft-link */
+#define CBM_T_VRP 8 /* Vorpal fast-loadable format */
+#define CBM_T_OTHER 9 /* File-type not recognized */
+#define CBM_T_HEADER 10 /* Disk header / title */
+
+/* CBM FILE ACCESS */
+#define CBM_A_RO 1 /* Read only */
+#define CBM_A_WO 2 /* Write only */
+#define CBM_A_RW 3 /* Read, Write */
+
+struct cbm_dirent {
+ char name[17]; /* File name in PetSCII, limited to 16 chars */
+ unsigned int size; /* Size, in 254-/256-byte blocks */
+ unsigned char type;
+ unsigned char access;
+};
+
+
+
+/*****************************************************************************/
+/* Machine info */
+/*****************************************************************************/
+
+
+
+#define TV_NTSC 0
+#define TV_PAL 1
+#define TV_OTHER 2
+
+unsigned char get_tv (void);
+/* Return the video mode the machine is using. */
+
+
+
+/*****************************************************************************/
+/* CBM kernal functions */
+/*****************************************************************************/
+
+
+
+/* Constants to use with cbm_open() for openning a file for reading or