diff --git a/include/stdlib.h b/include/stdlib.h index 53d73bb8d..4e7ffbd6a 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -125,7 +125,11 @@ size_t __heapmaxavail (void); #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)); @@ -146,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); diff --git a/include/string.h b/include/string.h index 1bd83b385..bda960173 100644 --- a/include/string.h +++ b/include/string.h @@ -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 */ diff --git a/libsrc/apple2/randomize.s b/libsrc/apple2/randomize.s index 1558d85a7..e9cd063b8 100644 --- a/libsrc/apple2/randomize.s +++ b/libsrc/apple2/randomize.s @@ -1,16 +1,16 @@ ; ; Ullrich von Bassewitz, 07.11.2002 ; -; void _randomize (void); +; void __randomize (void); ; /* Initialize the random number generator */ ; - .export __randomize + .export ___randomize .import _srand .include "apple2.inc" -__randomize: +___randomize: ldx RNDH ; Use random value supplied by ROM lda RNDL jmp _srand ; Initialize generator diff --git a/libsrc/atari/randomize.s b/libsrc/atari/randomize.s index 915fee3bd..d004a7c19 100644 --- a/libsrc/atari/randomize.s +++ b/libsrc/atari/randomize.s @@ -1,16 +1,16 @@ ; ; Christian Groessler, 06.11.2002 ; -; void _randomize (void); +; void __randomize (void); ; /* Initialize the random number generator */ ; - .export __randomize + .export ___randomize .import _srand .include "atari.inc" -__randomize: +___randomize: ldx VCOUNT ; Use vertical line counter as high byte lda RTCLOK+2 ; Use clock as low byte jmp _srand ; Initialize generator diff --git a/libsrc/atari5200/randomize.s b/libsrc/atari5200/randomize.s index 978ccf3f3..5c554b5f8 100644 --- a/libsrc/atari5200/randomize.s +++ b/libsrc/atari5200/randomize.s @@ -1,16 +1,16 @@ ; ; Christian Groessler, 01-Mar-2014 ; -; void _randomize (void); +; void __randomize (void); ; /* Initialize the random number generator */ ; - .export __randomize + .export ___randomize .import _srand .include "atari5200.inc" -__randomize: +___randomize: ldx VCOUNT ; Use vertical line counter as high byte lda RTCLOK+1 ; Use clock as low byte jmp _srand ; Initialize generator diff --git a/libsrc/c128/randomize.s b/libsrc/c128/randomize.s index ae63184a4..2b7754e86 100644 --- a/libsrc/c128/randomize.s +++ b/libsrc/c128/randomize.s @@ -2,16 +2,16 @@ ; 2002-11-05, Ullrich von Bassewitz ; 2015-09-11, Greg King ; -; void _randomize (void); +; void __randomize (void); ; /* Initialize the random number generator */ ; - .export __randomize + .export ___randomize .import _srand .include "c128.inc" -__randomize: +___randomize: ldx VIC_HLINE ; Use VIC rasterline as high byte lda TIME+2 ; Use 60HZ clock as low byte jmp _srand ; Initialize generator diff --git a/libsrc/c16/randomize.s b/libsrc/c16/randomize.s index 796ad118b..0d1ccaf03 100644 --- a/libsrc/c16/randomize.s +++ b/libsrc/c16/randomize.s @@ -2,16 +2,16 @@ ; 2002-11-05, Ullrich von Bassewitz ; 2015-09-11, Greg King ; -; void _randomize (void); +; void __randomize (void); ; /* Initialize the random number generator */ ; - .export __randomize + .export ___randomize .import _srand .include "plus4.inc" -__randomize: +___randomize: ldx TED_VLINELO ; Use TED rasterline as high byte lda TIME+2 ; Use 60HZ clock as low byte jmp _srand ; Initialize generator diff --git a/libsrc/c64/randomize.s b/libsrc/c64/randomize.s index a875203af..da32dfc28 100644 --- a/libsrc/c64/randomize.s +++ b/libsrc/c64/randomize.s @@ -2,16 +2,16 @@ ; 2002-11-05, Ullrich von Bassewitz ; 2015-09-11, Greg King ; -; void _randomize (void); +; void __randomize (void); ; /* Initialize the random number generator */ ; - .export __randomize + .export ___randomize .import _srand .include "c64.inc" -__randomize: +___randomize: ldx VIC_HLINE ; Use VIC rasterline as high byte lda TIME+2 ; Use 60HZ clock as low byte jmp _srand ; Initialize generator diff --git a/libsrc/cbm510/randomize.s b/libsrc/cbm510/randomize.s index 75c419ccb..8d21cde15 100644 --- a/libsrc/cbm510/randomize.s +++ b/libsrc/cbm510/randomize.s @@ -2,15 +2,15 @@ ; 2002-11-05, Ullrich von Bassewitz ; 2015-09-11, Greg King ; -; void _randomize (void); +; void __randomize (void); ; /* Initialize the random number generator */ ; - .export __randomize + .export ___randomize .import _srand .importzp time -__randomize: +___randomize: ldx time+2 ; Use 50/60HZ clock lda time+1 jmp _srand ; Initialize generator diff --git a/libsrc/cbm610/randomize.s b/libsrc/cbm610/randomize.s index 75c419ccb..8d21cde15 100644 --- a/libsrc/cbm610/randomize.s +++ b/libsrc/cbm610/randomize.s @@ -2,15 +2,15 @@ ; 2002-11-05, Ullrich von Bassewitz ; 2015-09-11, Greg King ; -; void _randomize (void); +; void __randomize (void); ; /* Initialize the random number generator */ ; - .export __randomize + .export ___randomize .import _srand .importzp time -__randomize: +___randomize: ldx time+2 ; Use 50/60HZ clock lda time+1 jmp _srand ; Initialize generator diff --git a/libsrc/common/_swap.s b/libsrc/common/_swap.s index 9ad771de1..ba3e5922d 100644 --- a/libsrc/common/_swap.s +++ b/libsrc/common/_swap.s @@ -1,15 +1,15 @@ ; ; Ullrich von Bassewitz, 1998-12-09, 2004-11-30 ; -; void __fastcall__ _swap (void* p, void* q, size_t size); +; void __fastcall__ __swap (void* p, void* q, size_t size); ; - .export __swap + .export ___swap .import popax, popptr1 .importzp ptr1, ptr2, ptr3 -__swap: eor #$FF +___swap: eor #$FF sta ptr3 txa eor #$FF diff --git a/libsrc/common/qsort.c b/libsrc/common/qsort.c index 991db3ba1..913165814 100644 --- a/libsrc/common/qsort.c +++ b/libsrc/common/qsort.c @@ -32,13 +32,13 @@ static void QuickSort (register unsigned char* Base, int Lo, int Hi, J -= Size; } if (I <= J) { - _swap (Base + I, Base + J, Size); + __swap (Base + I, Base + J, Size); I += Size; J -= Size; } } if (J != Lo) { - _swap (Base + J, Base + Lo, Size); + __swap (Base + J, Base + Lo, Size); } if (((unsigned) J) * 2 > (Hi + Lo)) { QuickSort (Base, J + Size, Hi, Size, Compare); diff --git a/libsrc/cx16/randomize.s b/libsrc/cx16/randomize.s index 3d965c82a..49051e012 100644 --- a/libsrc/cx16/randomize.s +++ b/libsrc/cx16/randomize.s @@ -1,14 +1,14 @@ ; ; 2020-05-02, Greg King ; -; void _randomize (void); +; void __randomize (void); ; /* Initialize the random number generator */ ; - .export __randomize + .export ___randomize .import ENTROPY_GET, _srand -__randomize: +___randomize: jsr ENTROPY_GET jmp _srand ; Initialize generator diff --git a/libsrc/geos-common/system/randomize.s b/libsrc/geos-common/system/randomize.s index 67c217d80..d8f821356 100644 --- a/libsrc/geos-common/system/randomize.s +++ b/libsrc/geos-common/system/randomize.s @@ -1,16 +1,16 @@ ; ; Ullrich von Bassewitz, 05.11.2002 ; -; void _randomize (void); +; void __randomize (void); ; /* Initialize the random number generator */ ; - .export __randomize + .export ___randomize .import _srand .include "geossym.inc" -__randomize: +___randomize: lda random ; get random value from internal generator ldx random+1 jmp _srand ; and use it as seed diff --git a/libsrc/nes/randomize.s b/libsrc/nes/randomize.s index 8df4fb88a..a146fef1b 100644 --- a/libsrc/nes/randomize.s +++ b/libsrc/nes/randomize.s @@ -1,16 +1,16 @@ ; ; Ullrich von Bassewitz, 2003-05-02 ; -; void _randomize (void); +; void __randomize (void); ; /* Initialize the random number generator */ ; - .export __randomize + .export ___randomize .import _srand .include "nes.inc" -__randomize: +___randomize: ldx tickcount ; Use tick clock lda tickcount+1 jmp _srand ; Initialize generator diff --git a/libsrc/pet/randomize.s b/libsrc/pet/randomize.s index 44bf4c38e..a173cf076 100644 --- a/libsrc/pet/randomize.s +++ b/libsrc/pet/randomize.s @@ -2,16 +2,16 @@ ; 2002-11-05, Ullrich von Bassewitz ; 2015-09-11, Greg King ; -; void _randomize (void); +; void __randomize (void); ; /* Initialize the random number generator */ ; - .export __randomize + .export ___randomize .import _srand .include "pet.inc" -__randomize: +___randomize: ldx TIME+2 lda TIME+1 ; Use 60HZ clock jmp _srand ; Initialize generator diff --git a/libsrc/plus4/randomize.s b/libsrc/plus4/randomize.s index 796ad118b..0d1ccaf03 100644 --- a/libsrc/plus4/randomize.s +++ b/libsrc/plus4/randomize.s @@ -2,16 +2,16 @@ ; 2002-11-05, Ullrich von Bassewitz ; 2015-09-11, Greg King ; -; void _randomize (void); +; void __randomize (void); ; /* Initialize the random number generator */ ; - .export __randomize + .export ___randomize .import _srand .include "plus4.inc" -__randomize: +___randomize: ldx TED_VLINELO ; Use TED rasterline as high byte lda TIME+2 ; Use 60HZ clock as low byte jmp _srand ; Initialize generator diff --git a/libsrc/vic20/randomize.s b/libsrc/vic20/randomize.s index 69cf07bb3..ac2c09a7d 100644 --- a/libsrc/vic20/randomize.s +++ b/libsrc/vic20/randomize.s @@ -2,16 +2,16 @@ ; 2002-11-05, Ullrich von Bassewitz ; 2015-09-11, Greg King ; -; void _randomize (void); +; void __randomize (void); ; /* Initialize the random number generator */ ; - .export __randomize + .export ___randomize .import _srand .include "vic20.inc" -__randomize: +___randomize: lda VIC_LINES ; Get overflow bit asl a ; Shift bit 7 into carry lda VIC_HLINE ; Get bit 1-8 of rasterline