/* Load the system specific files here, if needed */
-#ifdef __C64__
-#ifndef _C64_H
-#include <c64.h>
-#endif
-#endif
-
-#ifdef __C128__
-#ifndef _C128_H
-#include <c128.h>
-#endif
-#endif
-
-#ifdef __PLUS4__
-#ifndef _PLUS4_H
-#include <plus4.h>
-#endif
-#endif
-
-#ifdef __CBM610__
-#ifndef _CBM610_H
-#include <cbm610.h>
-#endif
-#endif
-
-#ifdef __PET__
-#ifndef _PET_H
-#include <pet.h>
-#endif
+#if defined(__C64__) && !defined(_C64_H)
+# include <c64.h>
+#elif defined(__C128__) && !defined(_C128_H)
+# include <c128.h>
+#elif defined(__PLUS4__) && !defined(_PLUS4_H)
+# include <plus4.h>
+#elif defined(__CBM610__) && !defined(_CBM610_H)
+# include <cbm610.h>
+#elif defined(__PET__) && !defined(_PET_H)
+# include <pet.h>
#endif
void __fastcall__ cbm_k_bsout (unsigned char C);
void __fastcall__ cbm_k_clrch (void);
-/* BASIC-like functions
+
+
+/* BASIC-like file I/O functions
*
- * All cbm_* IO functions set extern unsigned char _oserror in case
- * of an error. For the meaning of the errorcode see the table below.
+ * All cbm_* IO functions set _oserror (see errno.h) in case of an
+ * error. For the meaning of the errorcode see the table below.
*/
+
+
+
unsigned char cbm_load(const char* name, unsigned char device,
unsigned int addr);
/* Loads file "name" from given device to given address or to the load
* 9 = illegal device number
*/
+
+
/* End of cbm.h */
#endif
+
+
extern unsigned char _ctype[256];
-#define isalnum(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\tand\t#$07"), __AX__)
-#define isalpha(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\tand\t#$03"), __AX__)
-#define isblank(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\tand\t#$80"), __AX__)
-#define iscntrl(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\tand\t#$10"), __AX__)
-#define isdigit(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\tand\t#$04"), __AX__)
-#define isgraph(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\teor\t#$30\n\tand\t#$30"), __AX__)
-#define islower(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\tand\t#$01"), __AX__)
-#define isprint(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\teor\t#$10\n\tand\t#$10"), __AX__)
-#define ispunct(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\teor\t#$37\n\tand\t#$37"), __AX__)
-#define isspace(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\tand\t#$60"), __AX__)
-#define isupper(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\tand\t#$02"), __AX__)
-#define isxdigit(c) (__AX__ = (c), __asm__ ("\ttay\n\tlda\t__ctype,y\n\tand\t#$08"), __AX__)
+#define isalnum(c) (__AX__ = (c), __asm__ ("tay\n lda __ctype,y\n and #$07"), __AX__)
+#define isalpha(c) (__AX__ = (c), __asm__ ("tay\n lda __ctype,y\n and #$03"), __AX__)
+#define isblank(c) (__AX__ = (c), __asm__ ("tay\n lda __ctype,y\n and #$80"), __AX__)
+#define iscntrl(c) (__AX__ = (c), __asm__ ("tay\n lda __ctype,y\n and #$10"), __AX__)
+#define isdigit(c) (__AX__ = (c), __asm__ ("tay\n lda __ctype,y\n and #$04"), __AX__)
+#define isgraph(c) (__AX__ = (c), __asm__ ("tay\n lda __ctype,y\n eor #$30\n and #$30"), __AX__)
+#define islower(c) (__AX__ = (c), __asm__ ("tay\n lda __ctype,y\n and #$01"), __AX__)
+#define isprint(c) (__AX__ = (c), __asm__ ("tay\n lda __ctype,y\n eor #$10\n and #$10"), __AX__)
+#define ispunct(c) (__AX__ = (c), __asm__ ("tay\n lda __ctype,y\n eor #$37\n and #$37"), __AX__)
+#define isspace(c) (__AX__ = (c), __asm__ ("tay\n lda __ctype,y\n and #$60"), __AX__)
+#define isupper(c) (__AX__ = (c), __asm__ ("tay\n lda __ctype,y\n and #$02"), __AX__)
+#define isxdigit(c) (__AX__ = (c), __asm__ ("tay\n lda __ctype,y\n and #$08"), __AX__)