1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-27 00:29:31 +00:00

extra underscores for _randomize and _swap

This commit is contained in:
mrdudz 2022-08-29 20:52:35 +02:00
parent 145adf61ea
commit 89c08dc6d4
18 changed files with 62 additions and 50 deletions

View File

@ -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);

View File

@ -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 */

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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