Merge branch 'cc65:master' into master
This commit is contained in:
@@ -37,13 +37,20 @@ struct freeblock {
|
||||
|
||||
|
||||
/* Variables that describe the heap */
|
||||
extern unsigned* _heaporg; /* Bottom of heap */
|
||||
extern unsigned* _heapptr; /* Current top */
|
||||
extern unsigned* _heapend; /* Upper limit */
|
||||
extern struct freeblock* _heapfirst; /* First free block in list */
|
||||
extern struct freeblock* _heaplast; /* Last free block in list */
|
||||
|
||||
extern unsigned* __heaporg; /* Bottom of heap */
|
||||
extern unsigned* __heapptr; /* Current top */
|
||||
extern unsigned* __heapend; /* Upper limit */
|
||||
extern struct freeblock* __heapfirst; /* First free block in list */
|
||||
extern struct freeblock* __heaplast; /* Last free block in list */
|
||||
|
||||
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||
/* define old name with one underscore for backwards compatibility */
|
||||
#define _heaporg __heaporg
|
||||
#define _heapptr __heapptr
|
||||
#define _heapend __heapend
|
||||
#define _heapfirst __heapfirst
|
||||
#define _heaplast __heaplast
|
||||
#endif
|
||||
|
||||
/* End of _heap.h */
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ extern struct {
|
||||
extern void a2_auxmem_emd[];
|
||||
extern void a2_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
|
||||
extern void a2_stdmou_mou[]; /* Referred to by mouse_static_stddrv[] */
|
||||
extern void a2_ssc_ser[];
|
||||
extern void a2_ssc_ser[]; /* Referred to by ser_static_stddrv[] */
|
||||
extern void a2_hi_tgi[]; /* Referred to by tgi_static_stddrv[] */
|
||||
extern void a2_lo_tgi[];
|
||||
#endif
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
extern void a2e_auxmem_emd[];
|
||||
extern void a2e_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
|
||||
extern void a2e_stdmou_mou[]; /* Referred to by mouse_static_stddrv[] */
|
||||
extern void a2e_ssc_ser[];
|
||||
extern void a2e_ssc_ser[]; /* Referred to by ser_static_stddrv[] */
|
||||
extern void a2e_hi_tgi[]; /* Referred to by tgi_static_stddrv[] */
|
||||
extern void a2e_lo_tgi[];
|
||||
|
||||
|
||||
@@ -42,8 +42,8 @@
|
||||
#ifdef NDEBUG
|
||||
# define assert(expr)
|
||||
#else
|
||||
extern void __fastcall__ _afailed (const char*, unsigned);
|
||||
# define assert(expr) ((expr)? (void)0 : _afailed(__FILE__, __LINE__))
|
||||
extern void __fastcall__ __afailed (const char*, unsigned);
|
||||
# define assert(expr) ((expr)? (void)0 : __afailed(__FILE__, __LINE__))
|
||||
#endif
|
||||
|
||||
/* TODO: Guard with #if __CC65_STD__ >= __CC65_STD_C11__ if there
|
||||
|
||||
@@ -261,7 +261,7 @@ extern void atrst_mou[]; /* referred to by mouse_static_stddrv[]
|
||||
extern void atrami_mou[];
|
||||
extern void atrtrk_mou[];
|
||||
extern void atrtt_mou[];
|
||||
extern void atrrdev_ser[];
|
||||
extern void atrrdev_ser[]; /* referred to by ser_static_stddrv[] */
|
||||
extern void atr3_tgi[];
|
||||
extern void atr4_tgi[];
|
||||
extern void atr5_tgi[];
|
||||
@@ -286,7 +286,7 @@ extern void atrxst_mou[]; /* referred to by mouse_static_stddrv[]
|
||||
extern void atrxami_mou[];
|
||||
extern void atrxtrk_mou[];
|
||||
extern void atrxtt_mou[];
|
||||
extern void atrxrdev_ser[];
|
||||
extern void atrxrdev_ser[]; /* referred to by ser_static_stddrv[] */
|
||||
extern void atrx3_tgi[];
|
||||
extern void atrx4_tgi[];
|
||||
extern void atrx5_tgi[];
|
||||
|
||||
@@ -133,7 +133,7 @@
|
||||
/* The addresses of the static drivers */
|
||||
extern void atmos_pase_joy[]; /* Referred to by joy_static_stddrv[] */
|
||||
extern void atmos_ijk_joy[];
|
||||
extern void atmos_acia_ser[];
|
||||
extern void atmos_acia_ser[]; /* Referred to by ser_static_stddrv[] */
|
||||
extern void atmos_228_200_3_tgi[];
|
||||
extern void atmos_240_200_2_tgi[]; /* Referred to by tgi_static_stddrv[] */
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ extern void c128_1351_mou[]; /* Referred to by mouse_static_stddrv[] */
|
||||
extern void c128_joy_mou[];
|
||||
extern void c128_inkwell_mou[];
|
||||
extern void c128_pot_mou[];
|
||||
extern void c128_swlink_ser[];
|
||||
extern void c128_swlink_ser[]; /* Referred to by ser_static_stddrv[] */
|
||||
extern void c128_hi_tgi[];
|
||||
extern void c128_vdc_tgi[]; /* Referred to by tgi_static_stddrv[] */
|
||||
extern void c128_vdc2_tgi[];
|
||||
|
||||
@@ -155,7 +155,7 @@ extern void c64_1351_mou[]; /* Referred to by mouse_static_stddrv[]
|
||||
extern void c64_joy_mou[];
|
||||
extern void c64_inkwell_mou[];
|
||||
extern void c64_pot_mou[];
|
||||
extern void c64_swlink_ser[];
|
||||
extern void c64_swlink_ser[]; /* Referred to by ser_static_stddrv[] */
|
||||
extern void c64_hi_tgi[]; /* Referred to by tgi_static_stddrv[] */
|
||||
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ void cbm_k_untlk (void);
|
||||
|
||||
|
||||
|
||||
/* The cbm_* I/O functions below set _oserror (see errno.h),
|
||||
/* The cbm_* I/O functions below set __oserror (see errno.h),
|
||||
** in case of an error.
|
||||
**
|
||||
** error-code BASIC error
|
||||
@@ -251,7 +251,7 @@ unsigned int __fastcall__ cbm_load (const char* name, unsigned char device, void
|
||||
** address of the file if "data" is the null pointer (like load"name",8,1
|
||||
** in BASIC).
|
||||
** Returns number of bytes that were loaded if loading was successful;
|
||||
** otherwise 0, "_oserror" contains an error-code, then (see table above).
|
||||
** otherwise 0, "__oserror" contains an error-code, then (see table above).
|
||||
*/
|
||||
|
||||
unsigned char __fastcall__ cbm_save (const char* name, unsigned char device,
|
||||
@@ -274,7 +274,7 @@ void __fastcall__ cbm_close (unsigned char lfn);
|
||||
int __fastcall__ cbm_read (unsigned char lfn, void* buffer, unsigned int size);
|
||||
/* Reads up to "size" bytes from a file into "buffer".
|
||||
** Returns the number of actually-read bytes, 0 if there are no bytes left.
|
||||
** -1 in case of an error; then, _oserror contains an error-code (see table
|
||||
** -1 in case of an error; then, __oserror contains an error-code (see table
|
||||
** above). (Remember: 0 means end-of-file; -1 means error.)
|
||||
*/
|
||||
|
||||
@@ -282,7 +282,7 @@ int __fastcall__ cbm_write (unsigned char lfn, const void* buffer,
|
||||
unsigned int size);
|
||||
/* Writes up to "size" bytes from "buffer" to a file.
|
||||
** Returns the number of actually-written bytes, or -1 in case of an error;
|
||||
** _oserror contains an error-code, then (see above table).
|
||||
** __oserror contains an error-code, then (see above table).
|
||||
*/
|
||||
|
||||
unsigned char cbm_opendir (unsigned char lfn, unsigned char device, ...);
|
||||
|
||||
@@ -128,7 +128,7 @@ extern void cbm510_inkwl_mou[];
|
||||
extern void cbm510_joy_mou[]; /* Referred to by mouse_static_stddrv[] */
|
||||
extern void cbm510_ram_emd[];
|
||||
extern void cbm510_std_joy[]; /* Referred to by joy_static_stddrv[] */
|
||||
extern void cbm510_std_ser[];
|
||||
extern void cbm510_std_ser[]; /* Referred to by ser_static_stddrv[] */
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
|
||||
/* The addresses of the static drivers */
|
||||
extern void cbm610_ram_emd[];
|
||||
extern void cbm610_std_ser[];
|
||||
extern void cbm610_std_ser[]; /* Referred to by ser_static_stddrv[] */
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -35,9 +35,9 @@
|
||||
|
||||
|
||||
|
||||
/* Please note: All functions in this file will set _oserror *and* return its
|
||||
** value. The only exception is dio_open, which will return NULL, but _oserror
|
||||
** will be set. All function will also set _oserror in case of successful
|
||||
/* Please note: All functions in this file will set __oserror *and* return its
|
||||
** value. The only exception is dio_open, which will return NULL, but __oserror
|
||||
** will be set. All function will also set __oserror in case of successful
|
||||
** execution, effectively clearing it.
|
||||
*/
|
||||
|
||||
|
||||
@@ -45,12 +45,17 @@
|
||||
|
||||
|
||||
/* Operating system specific error code */
|
||||
extern unsigned char _oserror;
|
||||
extern unsigned char __oserror;
|
||||
|
||||
extern int _errno;
|
||||
#if __CC65_STD__ >= __CC65_STD_CC65__
|
||||
/* define the name with just one underscore for backwards compatibility */
|
||||
#define _oserror __oserror
|
||||
#endif
|
||||
|
||||
extern int __errno;
|
||||
/* System errors go here */
|
||||
|
||||
#define errno _errno
|
||||
#define errno __errno
|
||||
/* errno must be a macro */
|
||||
|
||||
|
||||
@@ -83,27 +88,45 @@ extern int _errno;
|
||||
|
||||
|
||||
|
||||
int __fastcall__ _osmaperrno (unsigned char oserror);
|
||||
/* Map an operating system specific error code (for example from _oserror)
|
||||
int __fastcall__ __osmaperrno (unsigned char oserror);
|
||||
/* Map an operating system specific error code (for example from __oserror)
|
||||
** into one of the E... codes above. It is user callable.
|
||||
*/
|
||||
|
||||
unsigned char __fastcall__ _seterrno (unsigned char code);
|
||||
#if __CC65_STD__ >= __CC65_STD_CC65__
|
||||
/* define the name with just one underscore for backwards compatibility */
|
||||
#define _osmaperrno __osmaperrno
|
||||
#endif
|
||||
|
||||
unsigned char __fastcall__ __seterrno (unsigned char code);
|
||||
/* Set errno to a specific error code and return zero. Used by the library */
|
||||
|
||||
int __fastcall__ _directerrno (unsigned char code);
|
||||
/* Set errno to a specific error code, clear _oserror and return -1. Used
|
||||
#if __CC65_STD__ >= __CC65_STD_CC65__
|
||||
/* define the name with just one underscore for backwards compatibility */
|
||||
#define _seterrno __seterrno
|
||||
#endif
|
||||
|
||||
int __fastcall__ __directerrno (unsigned char code);
|
||||
/* Set errno to a specific error code, clear __oserror and return -1. Used
|
||||
** by the library.
|
||||
*/
|
||||
|
||||
int __fastcall__ _mappederrno (unsigned char code);
|
||||
/* Set _oserror to the given platform specific error code. If it is a real
|
||||
#if __CC65_STD__ >= __CC65_STD_CC65__
|
||||
/* define the name with just one underscore for backwards compatibility */
|
||||
#define _directerrno __directerrno
|
||||
#endif
|
||||
|
||||
int __fastcall__ __mappederrno (unsigned char code);
|
||||
/* Set __oserror to the given platform specific error code. If it is a real
|
||||
** error code (not zero) set errno to the corresponding system error code
|
||||
** and return -1. Otherwise return zero.
|
||||
** Used by the library.
|
||||
*/
|
||||
|
||||
|
||||
#if __CC65_STD__ >= __CC65_STD_CC65__
|
||||
/* define the name with just one underscore for backwards compatibility */
|
||||
#define _mappederrno __mappederrno
|
||||
#endif
|
||||
|
||||
/* End of errno.h */
|
||||
#endif
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
|
||||
/* The addresses of the static drivers */
|
||||
extern void lynx_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
|
||||
extern void lynx_comlynx_ser[];
|
||||
extern void lynx_comlynx_ser[]; /* Referred to by ser_static_stddrv[] */
|
||||
extern void lynx_160_102_16_tgi[]; /* Referred to by tgi_static_stddrv[] */
|
||||
|
||||
|
||||
|
||||
@@ -36,6 +36,24 @@
|
||||
# error "This module may only be used when compiling for the Challenger 1P!"
|
||||
#endif
|
||||
|
||||
/* Colors are not functional, display is black and white only. */
|
||||
#define COLOR_BLACK 0x00
|
||||
#define COLOR_WHITE 0x01
|
||||
|
||||
#define CH_ULCORNER 0xCC
|
||||
#define CH_URCORNER 0xCD
|
||||
#define CH_LLCORNER 0xCB
|
||||
#define CH_LRCORNER 0xCE
|
||||
#define CH_TTEE 0xD9
|
||||
#define CH_BTEE 0xD7
|
||||
#define CH_LTEE 0xD8
|
||||
#define CH_RTEE 0xDA
|
||||
#define CH_CROSS 0xDB
|
||||
#define CH_HLINE 0x94
|
||||
#define CH_VLINE 0x95
|
||||
|
||||
#define CH_ENTER 0x0D
|
||||
|
||||
/* The following #defines will cause the matching functions calls in conio.h
|
||||
** to be overlaid by macros with the same names, saving the function call
|
||||
** overhead.
|
||||
@@ -43,5 +61,6 @@
|
||||
#define _textcolor(color) COLOR_WHITE
|
||||
#define _bgcolor(color) COLOR_BLACK
|
||||
#define _bordercolor(color) COLOR_BLACK
|
||||
#define _cpeekcolor(color) COLOR_WHITE
|
||||
|
||||
#endif
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
|
||||
/* The addresses of the static drivers */
|
||||
extern void plus4_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
|
||||
extern void plus4_stdser_ser[];
|
||||
extern void plus4_stdser_ser[]; /* Referred to by ser_static_stddrv[] */
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -123,6 +123,13 @@ struct ser_params {
|
||||
unsigned char handshake; /* Type of handshake to use */
|
||||
};
|
||||
|
||||
/* The name of the standard serial driver for a platform */
|
||||
extern const char ser_stddrv[];
|
||||
|
||||
/* The address of the static standard serial driver for a platform */
|
||||
extern const void ser_static_stddrv[];
|
||||
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
|
||||
@@ -42,8 +42,8 @@ typedef char jmp_buf [5];
|
||||
|
||||
|
||||
|
||||
int __fastcall__ _setjmp (jmp_buf buf);
|
||||
#define setjmp _setjmp /* ISO insists on a macro */
|
||||
int __fastcall__ __setjmp (jmp_buf buf);
|
||||
#define setjmp __setjmp /* ISO insists on a macro */
|
||||
void __fastcall__ longjmp (jmp_buf buf, int retval) __attribute__((noreturn));
|
||||
|
||||
|
||||
|
||||
@@ -45,12 +45,12 @@ typedef unsigned char sig_atomic_t;
|
||||
typedef void __fastcall__ (*__sigfunc) (int);
|
||||
|
||||
/* Functions that implement SIG_IGN and SIG_DFL */
|
||||
void __fastcall__ _sig_ign (int);
|
||||
void __fastcall__ _sig_dfl (int);
|
||||
void __fastcall__ __sig_ign (int);
|
||||
void __fastcall__ __sig_dfl (int);
|
||||
|
||||
/* Standard signal handling functions */
|
||||
#define SIG_DFL _sig_dfl
|
||||
#define SIG_IGN _sig_ign
|
||||
#define SIG_DFL __sig_dfl
|
||||
#define SIG_IGN __sig_ign
|
||||
#define SIG_ERR ((__sigfunc) 0x0000)
|
||||
|
||||
/* Signal numbers */
|
||||
|
||||
@@ -147,7 +147,11 @@ int __fastcall__ vfscanf (FILE* f, const char* format, __va_list ap);
|
||||
FILE* __fastcall__ fdopen (int fd, const char* mode); /* Unix */
|
||||
int __fastcall__ fileno (FILE* f); /* Unix */
|
||||
#endif
|
||||
void __fastcall__ _poserror (const char* msg); /* cc65 */
|
||||
void __fastcall__ __poserror (const char* msg); /* cc65 */
|
||||
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||
/* define old name with one underscore for backwards compatibility */
|
||||
#define _poserror __poserror
|
||||
#endif
|
||||
|
||||
/* Masking macros for some functions */
|
||||
#define getc(f) fgetc (f) /* ANSI */
|
||||
|
||||
@@ -92,24 +92,44 @@ int __fastcall__ posix_memalign (void** memptr, size_t alignment, size_t size);
|
||||
*/
|
||||
#endif
|
||||
|
||||
void __fastcall__ _heapadd (void* mem, size_t size);
|
||||
void __fastcall__ __heapadd (void* mem, size_t size);
|
||||
/* Add a block to the heap */
|
||||
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||
/* define old name with one underscore for backwards compatibility */
|
||||
#define _heapadd __heapadd
|
||||
#endif
|
||||
|
||||
size_t __fastcall__ _heapblocksize (const void* block);
|
||||
size_t __fastcall__ __heapblocksize (const void* block);
|
||||
/* Return the size of an allocated block */
|
||||
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||
/* define old name with one underscore for backwards compatibility */
|
||||
#define _heapblocksize __heapblocksize
|
||||
#endif
|
||||
|
||||
size_t _heapmemavail (void);
|
||||
size_t __heapmemavail (void);
|
||||
/* Return the total free heap space */
|
||||
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||
/* define old name with one underscore for backwards compatibility */
|
||||
#define _heapmemavail __heapmemavail
|
||||
#endif
|
||||
|
||||
size_t _heapmaxavail (void);
|
||||
size_t __heapmaxavail (void);
|
||||
/* Return the size of the largest free block on the heap */
|
||||
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||
/* define old name with one underscore for backwards compatibility */
|
||||
#define _heapmaxavail __heapmaxavail
|
||||
#endif
|
||||
|
||||
|
||||
/* Random numbers */
|
||||
#define RAND_MAX 0x7FFF
|
||||
int rand (void);
|
||||
void __fastcall__ srand (unsigned seed);
|
||||
void _randomize (void); /* Non-standard */
|
||||
void __randomize (void); /* Non-standard */
|
||||
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||
/* define old name with one underscore for backwards compatibility */
|
||||
#define _randomize __randomize
|
||||
#endif
|
||||
|
||||
/* Other standard stuff */
|
||||
void abort (void) __attribute__ ((noreturn));
|
||||
@@ -130,7 +150,11 @@ unsigned long __fastcall__ strtoul (const char* nptr, char** endptr, int base);
|
||||
int __fastcall__ system (const char* s);
|
||||
|
||||
/* Non-ANSI functions */
|
||||
void __fastcall__ _swap (void* p, void* q, size_t size);
|
||||
void __fastcall__ __swap (void* p, void* q, size_t size);
|
||||
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||
/* define old name with one underscore for backwards compatibility */
|
||||
#define _swap __swap
|
||||
#endif
|
||||
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||
char* __fastcall__ itoa (int val, char* buf, int radix);
|
||||
char* __fastcall__ utoa (unsigned val, char* buf, int radix);
|
||||
|
||||
@@ -74,7 +74,7 @@ void* __fastcall__ memset (void* s, int c, size_t count);
|
||||
/* The following is an internal function, the compiler will replace memset
|
||||
** with it if the fill value is zero. Never use this one directly!
|
||||
*/
|
||||
void* __fastcall__ _bzero (void* ptr, size_t n);
|
||||
void* __fastcall__ __bzero (void* ptr, size_t n);
|
||||
|
||||
/* Non standard: */
|
||||
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||
@@ -92,8 +92,12 @@ char* __fastcall__ strupper (char* s);
|
||||
char* __fastcall__ strqtok (char* s1, const char* s2);
|
||||
#endif
|
||||
|
||||
const char* __fastcall__ _stroserror (unsigned char errcode);
|
||||
const char* __fastcall__ __stroserror (unsigned char errcode);
|
||||
/* Map an operating system error number to an error message. */
|
||||
#if __CC65_STD__ == __CC65_STD_CC65__
|
||||
/* define old name with one underscore for backwards compatibility */
|
||||
#define _stroserror __stroserror
|
||||
#endif
|
||||
|
||||
|
||||
/* End of string.h */
|
||||
|
||||
@@ -89,8 +89,8 @@ struct tm {
|
||||
# define CLOCKS_PER_SEC 10
|
||||
#elif defined(__ATARI__) || defined (__LYNX__)
|
||||
/* Read the clock rate at runtime */
|
||||
clock_t _clocks_per_sec (void);
|
||||
# define CLOCKS_PER_SEC _clocks_per_sec()
|
||||
clock_t __clocks_per_sec (void);
|
||||
# define CLOCKS_PER_SEC __clocks_per_sec()
|
||||
#endif
|
||||
#define CLOCK_REALTIME 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user