1 /*****************************************************************************/
5 /* CBM system specific definitions */
9 /* (C) 1998-2000 Ullrich von Bassewitz */
11 /* D-70597 Stuttgart */
12 /* EMail: uz@musoftware.de */
15 /* This software is provided 'as-is', without any expressed or implied */
16 /* warranty. In no event will the authors be held liable for any damages */
17 /* arising from the use of this software. */
19 /* Permission is granted to anyone to use this software for any purpose, */
20 /* including commercial applications, and to alter it and redistribute it */
21 /* freely, subject to the following restrictions: */
23 /* 1. The origin of this software must not be misrepresented; you must not */
24 /* claim that you wrote the original software. If you use this software */
25 /* in a product, an acknowledgment in the product documentation would be */
26 /* appreciated but is not required. */
27 /* 2. Altered source versions must be plainly marked as such, and must not */
28 /* be misrepresented as being the original software. */
29 /* 3. This notice may not be removed or altered from any source */
32 /*****************************************************************************/
41 /* Load the system specific files here, if needed */
74 /* Characters codes (CBM charset) */
77 #define CH_ULCORNER 176
78 #define CH_URCORNER 174
79 #define CH_LLCORNER 173
80 #define CH_LRCORNER 189
86 #define CH_CURS_UP 145
87 #define CH_CURS_DOWN 17
88 #define CH_CURS_LEFT 157
89 #define CH_CURS_RIGHT 29
97 /* Kernel level functions */
98 void __fastcall__ cbm_k_setlfs (unsigned char LFN, unsigned char DEV,
100 void __fastcall__ cbm_k_setnam (const char* Name);
101 unsigned char __fastcall__ cbm_k_load(unsigned char flag, unsigned addr);
102 unsigned char __fastcall__ cbm_k_save(unsigned int start, unsigned int end);
103 unsigned char __fastcall__ cbm_k_open (void);
104 void __fastcall__ cbm_k_close (unsigned char FN);
105 unsigned char __fastcall__ cbm_k_readst (void);
106 unsigned char __fastcall__ cbm_k_chkin (unsigned char FN);
107 unsigned char __fastcall__ cbm_k_ckout (unsigned char FN);
108 unsigned char __fastcall__ cbm_k_basin (void);
109 void __fastcall__ cbm_k_bsout (unsigned char C);
110 void __fastcall__ cbm_k_clrch (void);
112 /* BASIC-like functions
114 * All cbm_* IO functions set extern unsigned char _oserror in case
115 * of an error. For the meaning of the errorcode see the table below.
117 unsigned char cbm_load(const char* name, unsigned char device,
119 /* Loads file "name" from given device to given address or to the load
120 * address of the file if addr is 0 (like load"name",8,1 in BASIC)
121 * Returns 0 if loading was successful otherwise an errorcode (see table
125 unsigned char cbm_save(const char* name, unsigned char device,
126 unsigned int start, unsigned int end);
127 /* Saves a memory area from start to end-1 to a file.
128 * Returns 0 if saving was successful, otherwise an errorcode (see table
132 unsigned char cbm_open(unsigned char lfn, unsigned char device,
133 unsigned char sec_addr, const char* name);
134 /* Opens a file. Works just like the BASIC command.
135 * Returns 0 if opening was successful, otherwise an errorcode (see table
139 void __fastcall__ cbm_close (unsigned char lfn);
142 int cbm_read(unsigned char lfn, void* buffer, unsigned int size);
143 /* Reads up to "size" bytes from a file to "buffer".
144 * Returns the number of actually read bytes, 0 if there are no bytes left
145 * (EOF) or -1 in case of an error. _oserror contains an errorcode then (see
149 int cbm_write(unsigned char lfn, void* buffer, unsigned int size);
150 /* Writes up to "size" bytes from "buffer" to a file.
151 * Returns the number of actually written bytes or -1 in case of an error.
152 * _oserror contains an errorcode then (see table below).
155 /* Errorcodes of cbm_* I/O functions:
157 * errorcode BASIC error
162 * 5 = device not present
164 * 7 = not output file
165 * 8 = missing filename
166 * 9 = illegal device number