1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-01 13:41:34 +00:00

Changed multi-line C comments into another style.

The left side doesn't look unbalanced.
This commit is contained in:
Greg King 2014-06-30 05:10:35 -04:00
parent 132d57f1ad
commit 0390c34e88
502 changed files with 8869 additions and 8884 deletions

View File

@ -82,21 +82,21 @@ struct regs {
#define F6502_C 0x01 /* C flag */ #define F6502_C 0x01 /* C flag */
/* Function to call any machine language subroutine. All registers in the /* Function to call any machine language subroutine. All registers in the
* regs structure are passed into the routine and the results are passed ** regs structure are passed into the routine and the results are passed
* out. The B flag is ignored on input. The called routine must end with ** out. The B flag is ignored on input. The called routine must end with
* an RTS. ** an RTS.
*/ */
void __fastcall__ _sys (struct regs* r); void __fastcall__ _sys (struct regs* r);
/* Set and reset the break vector. The given user function is called if /* Set and reset the break vector. The given user function is called if
* a break occurs. The values of the registers may be read from the brk_... ** a break occurs. The values of the registers may be read from the brk_...
* variables. The value in brk_pc will point to the address that contains ** variables. The value in brk_pc will point to the address that contains
* the brk instruction. ** the brk instruction.
* The set_brk function will install an exit handler that will reset the ** The set_brk function will install an exit handler that will reset the
* vector if the program ends. ** vector if the program ends.
*/ */
extern unsigned char brk_a; /* A register value */ extern unsigned char brk_a; /* A register value */
extern unsigned char brk_x; /* X register value */ extern unsigned char brk_x; /* X register value */

View File

@ -36,10 +36,10 @@
/* Define a structure with the 6522 register offsets. /* Define a structure with the 6522 register offsets.
* NOTE: The timer registers are not declared as 16 bit registers, because ** NOTE: The timer registers are not declared as 16 bit registers, because
* the order in which the two 8 bit halves are written is important, and ** the order in which the two 8 bit halves are written is important, and
* the compiler doesn't guarantee any order when writing 16 bit values. ** the compiler doesn't guarantee any order when writing 16 bit values.
*/ */
struct __6522 { struct __6522 {
unsigned char prb; /* Port register B */ unsigned char prb; /* Port register B */
unsigned char pra; /* Port register A */ unsigned char pra; /* Port register A */

View File

@ -39,9 +39,9 @@
/* Define a structure with the 6525 register offsets. The shadow registers /* Define a structure with the 6525 register offsets. The shadow registers
* (if port C is unused) are currently not implemented, we would need a ** (if port C is unused) are currently not implemented, we would need a
* union to do that, however that would introduce an additional name. ** union to do that, however that would introduce an additional name.
*/ */
struct __6525 { struct __6525 {
unsigned char pra; /* Port register A */ unsigned char pra; /* Port register A */
unsigned char prb; /* Port register B */ unsigned char prb; /* Port register B */

View File

@ -39,10 +39,10 @@
/* Define a structure with the 6526 register offsets. /* Define a structure with the 6526 register offsets.
* NOTE: The timer registers are not declared as 16 bit registers, because ** NOTE: The timer registers are not declared as 16 bit registers, because
* the order in which the two 8 bit halves are written is important, and ** the order in which the two 8 bit halves are written is important, and
* the compiler doesn't guarantee any order when writing 16 bit values. ** the compiler doesn't guarantee any order when writing 16 bit values.
*/ */
struct __6526 { struct __6526 {
unsigned char pra; /* Port register A */ unsigned char pra; /* Port register A */
unsigned char prb; /* Port register B */ unsigned char prb; /* Port register B */

View File

@ -1,9 +1,9 @@
/* /*
* _heap.h ** _heap.h
* **
* Ullrich von Bassewitz, 1998-06-03, 2004-12-19 ** Ullrich von Bassewitz, 1998-06-03, 2004-12-19
* **
*/ */
@ -12,11 +12,11 @@
/* Structure that preceeds a user block in most cases. /* Structure that preceeds a user block in most cases.
* The aligned_malloc function may generate blocks where the start pointer ** The aligned_malloc function may generate blocks where the start pointer
* and size are splitted to handle a memory hole that is needed for ** and size are splitted to handle a memory hole that is needed for
* alignment. ** alignment.
*/ */
struct usedblock { struct usedblock {
unsigned size; unsigned size;
struct usedblock* start; struct usedblock* start;
@ -26,8 +26,8 @@ struct usedblock {
#define HEAP_ADMIN_SPACE sizeof (struct usedblock) #define HEAP_ADMIN_SPACE sizeof (struct usedblock)
/* The data type used to implement the free list. /* The data type used to implement the free list.
* Beware: Field order is significant! ** Beware: Field order is significant!
*/ */
struct freeblock { struct freeblock {
unsigned size; unsigned size;
struct freeblock* next; struct freeblock* next;

View File

@ -39,8 +39,8 @@
/* Define a structure with the vic register offsets. In cc65 mode, there /* Define a structure with the vic register offsets. In cc65 mode, there
* are aliases for the field accessible as arrays. ** are aliases for the field accessible as arrays.
*/ */
#if __CC65_STD__ == __CC65_STD_CC65__ #if __CC65_STD__ == __CC65_STD_CC65__
struct __vic2 { struct __vic2 {
union { union {

View File

@ -109,23 +109,23 @@
extern unsigned char _dos_type; extern unsigned char _dos_type;
/* Valid _dos_type values: /* Valid _dos_type values:
* **
* AppleDOS 3.3 - 0x00 ** AppleDOS 3.3 - 0x00
* ProDOS 8 1.0.1 - 0x10 ** ProDOS 8 1.0.1 - 0x10
* ProDOS 8 1.0.2 - 0x10 ** ProDOS 8 1.0.2 - 0x10
* ProDOS 8 1.1.1 - 0x11 ** ProDOS 8 1.1.1 - 0x11
* ProDOS 8 1.2 - 0x12 ** ProDOS 8 1.2 - 0x12
* ProDOS 8 1.3 - 0x13 ** ProDOS 8 1.3 - 0x13
* ProDOS 8 1.4 - 0x14 ** ProDOS 8 1.4 - 0x14
* ProDOS 8 1.5 - 0x15 ** ProDOS 8 1.5 - 0x15
* ProDOS 8 1.6 - 0x16 ** ProDOS 8 1.6 - 0x16
* ProDOS 8 1.7 - 0x17 ** ProDOS 8 1.7 - 0x17
* ProDOS 8 1.8 - 0x18 ** ProDOS 8 1.8 - 0x18
* ProDOS 8 1.9 - 0x18 (!) ** ProDOS 8 1.9 - 0x18 (!)
* ProDOS 8 2.0.1 - 0x21 ** ProDOS 8 2.0.1 - 0x21
* ProDOS 8 2.0.2 - 0x22 ** ProDOS 8 2.0.2 - 0x22
* ProDOS 8 2.0.3 - 0x23 ** ProDOS 8 2.0.3 - 0x23
*/ */
@ -136,9 +136,9 @@ extern unsigned char _dos_type;
/* The file stream implementation and the POSIX I/O functions will use the /* The file stream implementation and the POSIX I/O functions will use the
* following variables to determine the file type, aux type and creation time ** following variables to determine the file type, aux type and creation time
* stamp to use. ** stamp to use.
*/ */
extern unsigned char _filetype; /* Default: 6 */ extern unsigned char _filetype; /* Default: 6 */
extern unsigned int _auxtype; /* Default: 0 */ extern unsigned int _auxtype; /* Default: 0 */
extern struct { extern struct {
@ -179,18 +179,18 @@ void rebootafterexit (void);
#define ser_apple2_slot(num) ser_ioctl (0, (void*) (num)) #define ser_apple2_slot(num) ser_ioctl (0, (void*) (num))
/* Select a slot number from 1 to 7 prior to ser_open. /* Select a slot number from 1 to 7 prior to ser_open.
* The default slot number is 2. ** The default slot number is 2.
*/ */
#define tgi_apple2_mix(onoff) tgi_ioctl (0, (void*) (onoff)) #define tgi_apple2_mix(onoff) tgi_ioctl (0, (void*) (onoff))
/* If onoff is 1, graphics/text mixed mode is enabled. /* If onoff is 1, graphics/text mixed mode is enabled.
* If onoff is 0, graphics/text mixed mode is disabled. ** If onoff is 0, graphics/text mixed mode is disabled.
*/ */
/* The following #defines will cause the matching functions calls in conio.h /* 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 ** to be overlaid by macros with the same names, saving the function call
* overhead. ** overhead.
*/ */
#define _textcolor(color) COLOR_WHITE #define _textcolor(color) COLOR_WHITE
#define _bgcolor(color) COLOR_BLACK #define _bgcolor(color) COLOR_BLACK
#define _bordercolor(color) COLOR_BLACK #define _bordercolor(color) COLOR_BLACK

View File

@ -109,8 +109,8 @@ extern void a2e_lo_tgi[];
void __fastcall__ textframe (unsigned char width, unsigned char height, void __fastcall__ textframe (unsigned char width, unsigned char height,
unsigned char style); unsigned char style);
/* Output a frame on the text screen with the given width and height /* Output a frame on the text screen with the given width and height
* starting at the current cursor position and using the given style. ** starting at the current cursor position and using the given style.
*/ */
void __fastcall__ textframexy (unsigned char x, unsigned char y, void __fastcall__ textframexy (unsigned char x, unsigned char y,
unsigned char width, unsigned char height, unsigned char width, unsigned char height,
@ -119,8 +119,8 @@ void __fastcall__ textframexy (unsigned char x, unsigned char y,
unsigned __fastcall__ videomode (unsigned mode); unsigned __fastcall__ videomode (unsigned mode);
/* Set the video mode, return the old mode. Call with one of the VIDEOMODE_xx /* Set the video mode, return the old mode. Call with one of the VIDEOMODE_xx
* constants. ** constants.
*/ */

View File

@ -141,21 +141,21 @@ extern void c128_vdc2_tgi[];
unsigned __fastcall__ videomode (unsigned Mode); unsigned __fastcall__ videomode (unsigned Mode);
/* Set the video mode, return the old mode. Call with one of the VIDEOMODE_xx /* Set the video mode, return the old mode. Call with one of the VIDEOMODE_xx
* constants. ** constants.
*/ */
void toggle_videomode (void); void toggle_videomode (void);
/* Toggle the video mode between 40 and 80 chars (calls SWAPPER). /* Toggle the video mode between 40 and 80 chars (calls SWAPPER).
* THIS FUNCTION IS DEPRECATED, please use videomode instead! ** THIS FUNCTION IS DEPRECATED, please use videomode instead!
*/ */
void c64mode (void); void c64mode (void);
/* Switch the C128 into C64 mode. Note: This function will not return! */ /* Switch the C128 into C64 mode. Note: This function will not return! */
void fast (void); void fast (void);
/* Switch the CPU into 2MHz mode. Note: This will disable video when in /* Switch the CPU into 2MHz mode. Note: This will disable video when in
* 40 column mode. ** 40 column mode.
*/ */
void slow (void); void slow (void);
/* Switch the CPU into 1MHz mode. */ /* Switch the CPU into 1MHz mode. */

View File

@ -82,8 +82,8 @@
/* The file stream implementation and the POSIX I/O functions will /* The file stream implementation and the POSIX I/O functions will
* use the following variable to determine the file type to use. ** use the following variable to determine the file type to use.
*/ */
extern char _filetype; /* Defaults to 's' */ extern char _filetype; /* Defaults to 's' */
@ -162,10 +162,10 @@ unsigned char get_tv (void);
/* Constants to use with cbm_open() for openning a file for reading or /* Constants to use with cbm_open() for openning a file for reading or
* writing without the need to append ",r" or ",w" to the filename. ** writing without the need to append ",r" or ",w" to the filename.
* **
* e.g., cbm_open(2, 8, CBM_READ, "0:data,s"); ** e.g., cbm_open(2, 8, CBM_READ, "0:data,s");
*/ */
#define CBM_READ 0 /* default is ",p" */ #define CBM_READ 0 /* default is ",p" */
#define CBM_WRITE 1 /* ditto */ #define CBM_WRITE 1 /* ditto */
#define CBM_SEQ 2 /* default is ",r" -- or ",s" when writing */ #define CBM_SEQ 2 /* default is ",r" -- or ",s" when writing */
@ -202,79 +202,79 @@ void cbm_k_unlsn (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. ** in case of an error.
* **
* error-code BASIC error ** error-code BASIC error
* ---------- ----------- ** ---------- -----------
* 1 = too many files ** 1 = too many files
* 2 = file open ** 2 = file open
* 3 = file not open ** 3 = file not open
* 4 = file not found ** 4 = file not found
* 5 = device not present ** 5 = device not present
* 6 = not input-file ** 6 = not input-file
* 7 = not output-file ** 7 = not output-file
* 8 = missing file-name ** 8 = missing file-name
* 9 = illegal device-number ** 9 = illegal device-number
* **
* 10 = STOP-key pushed ** 10 = STOP-key pushed
* 11 = general I/O-error ** 11 = general I/O-error
*/ */
unsigned int cbm_load (const char* name, unsigned char device, void* data); unsigned int cbm_load (const char* name, unsigned char device, void* data);
/* Loads file "name", from given device, to given address -- or, to the load /* Loads file "name", from given device, to given address -- or, to the load
* address of the file if "data" is the null pointer (like load"name",8,1 ** address of the file if "data" is the null pointer (like load"name",8,1
* in BASIC). ** in BASIC).
* Returns number of bytes that were loaded if loading was successful; ** 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, unsigned char __fastcall__ cbm_save (const char* name, unsigned char device,
const void* addr, unsigned int size); const void* addr, unsigned int size);
/* Saves "size" bytes, starting at "addr", to a file. /* Saves "size" bytes, starting at "addr", to a file.
* Returns 0 if saving was successful, otherwise an error-code (see table ** Returns 0 if saving was successful, otherwise an error-code (see table
* above). ** above).
*/ */
unsigned char __fastcall__ cbm_open (unsigned char lfn, unsigned char device, unsigned char __fastcall__ cbm_open (unsigned char lfn, unsigned char device,
unsigned char sec_addr, const char* name); unsigned char sec_addr, const char* name);
/* Opens a file. Works just like the BASIC command. /* Opens a file. Works just like the BASIC command.
* Returns 0 if openning was successful, otherwise an error-code (see table ** Returns 0 if openning was successful, otherwise an error-code (see table
* above). ** above).
*/ */
void __fastcall__ cbm_close (unsigned char lfn); void __fastcall__ cbm_close (unsigned char lfn);
/* Closes a file */ /* Closes a file */
int __fastcall__ cbm_read (unsigned char lfn, void* buffer, unsigned int size); int __fastcall__ cbm_read (unsigned char lfn, void* buffer, unsigned int size);
/* Reads up to "size" bytes from a file into "buffer". /* Reads up to "size" bytes from a file into "buffer".
* Returns the number of actually-read bytes, 0 if there are no bytes left. ** 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.) ** above). (Remember: 0 means end-of-file; -1 means error.)
*/ */
int __fastcall__ cbm_write (unsigned char lfn, const void* buffer, int __fastcall__ cbm_write (unsigned char lfn, const void* buffer,
unsigned int size); unsigned int size);
/* Writes up to "size" bytes from "buffer" to a file. /* Writes up to "size" bytes from "buffer" to a file.
* Returns the number of actually-written bytes, or -1 in case of an error; ** 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, ...); unsigned char cbm_opendir (unsigned char lfn, unsigned char device, ...);
/* Opens directory listing. Returns 0 if opening directory was successful; /* Opens directory listing. Returns 0 if opening directory was successful;
* otherwise, an error-code corresponding to cbm_open(). As an optional ** otherwise, an error-code corresponding to cbm_open(). As an optional
* argument, the name of the directory may be passed to the function. If ** argument, the name of the directory may be passed to the function. If
* no explicit name is specified, "$" is used. ** no explicit name is specified, "$" is used.
*/ */
unsigned char __fastcall__ cbm_readdir (unsigned char lfn, unsigned char __fastcall__ cbm_readdir (unsigned char lfn,
struct cbm_dirent* l_dirent); struct cbm_dirent* l_dirent);
/* Reads one directory line into cbm_dirent structure. /* Reads one directory line into cbm_dirent structure.
* Returns 0 if reading directory-line was successful. ** Returns 0 if reading directory-line was successful.
* Returns non-zero if reading directory failed, or no more file-names to read. ** Returns non-zero if reading directory failed, or no more file-names to read.
* Returns 2 on last line. Then, l_dirent->size = the number of "blocks free." ** Returns 2 on last line. Then, l_dirent->size = the number of "blocks free."
*/ */
void __fastcall__ cbm_closedir (unsigned char lfn); void __fastcall__ cbm_closedir (unsigned char lfn);
/* Closes directory by cbm_close(lfn) */ /* Closes directory by cbm_close(lfn) */

View File

@ -138,9 +138,9 @@ void __fastcall__ pokewsys (unsigned addr, unsigned val);
/* The following #defines will cause the matching functions calls in conio.h /* 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 ** to be overlaid by macros with the same names, saving the function call
* overhead. ** overhead.
*/ */
#define _textcolor(color) COLOR_WHITE #define _textcolor(color) COLOR_WHITE
#define _bgcolor(color) COLOR_BLACK #define _bgcolor(color) COLOR_BLACK
#define _bordercolor(color) COLOR_BLACK #define _bordercolor(color) COLOR_BLACK

View File

@ -52,9 +52,9 @@
/* CBM FILE TYPES. The definitions are used within standard headers, so we /* CBM FILE TYPES. The definitions are used within standard headers, so we
* be careful with identifiers in the user name space. ** be careful with identifiers in the user name space.
* "Regular" files have a special bit set so it's easier to pick them out. ** "Regular" files have a special bit set so it's easier to pick them out.
*/ */
#define _CBM_T_REG 0x10U /* Bit set for regular files */ #define _CBM_T_REG 0x10U /* Bit set for regular files */
#define _CBM_T_SEQ 0x10U #define _CBM_T_SEQ 0x10U
#define _CBM_T_PRG 0x11U #define _CBM_T_PRG 0x11U
@ -93,12 +93,12 @@
unsigned char __fastcall__ _cbm_filetype (unsigned char c); unsigned char __fastcall__ _cbm_filetype (unsigned char c);
/* Map the start character for a file type to one of the file types above. /* Map the start character for a file type to one of the file types above.
* Note: 'd' will always mapped to CBM_T_DEL. The calling function has to ** Note: 'd' will always mapped to CBM_T_DEL. The calling function has to
* look at the following character to determine if the file type is actually ** look at the following character to determine if the file type is actually
* CBM_T_DIR. ** CBM_T_DIR.
* This is a function used by the implementation. There is usually no need ** This is a function used by the implementation. There is usually no need
* to call it from user code. ** to call it from user code.
*/ */

View File

@ -46,17 +46,17 @@
long __fastcall__ cc65_idiv32by16r16 (long rhs, int lhs); long __fastcall__ cc65_idiv32by16r16 (long rhs, int lhs);
/* Divide a 32 bit signed value by a 16 bit signed value yielding a 16 /* Divide a 32 bit signed value by a 16 bit signed value yielding a 16
* bit result and a 16 bit remainder. The former is returned in the lower 16 ** bit result and a 16 bit remainder. The former is returned in the lower 16
* bit of the result, the latter in the upper. If you don't need the ** bit of the result, the latter in the upper. If you don't need the
* remainder, just assign (or cast) to an int. ** remainder, just assign (or cast) to an int.
*/ */
unsigned long __fastcall__ cc65_udiv32by16r16 (unsigned long rhs, unsigned lhs); unsigned long __fastcall__ cc65_udiv32by16r16 (unsigned long rhs, unsigned lhs);
/* Divide a 32 bit unsigned value by a 16 bit unsigned value yielding a 16 /* Divide a 32 bit unsigned value by a 16 bit unsigned value yielding a 16
* bit result and a 16 bit remainder. The former is returned in the lower 16 ** bit result and a 16 bit remainder. The former is returned in the lower 16
* bit of the result, the latter in the upper. If you don't need the ** bit of the result, the latter in the upper. If you don't need the
* remainder, just assign (or cast) to an unsigned. ** remainder, just assign (or cast) to an unsigned.
*/ */
int __fastcall__ cc65_imul8x8r16 (signed char lhs, signed char rhs); int __fastcall__ cc65_imul8x8r16 (signed char lhs, signed char rhs);
/* Multiplicate two signed 8 bit to yield an signed 16 bit result */ /* Multiplicate two signed 8 bit to yield an signed 16 bit result */
@ -69,21 +69,21 @@ unsigned __fastcall__ cc65_umul8x8r16 (unsigned char lhs, unsigned char rhs);
unsigned long __fastcall__ cc65_umul16x8r32 (unsigned lhs, unsigned char rhs); unsigned long __fastcall__ cc65_umul16x8r32 (unsigned lhs, unsigned char rhs);
/* Multiplicate an unsigned 16 bit by an unsigned 8 bit number yielding a 24 /* Multiplicate an unsigned 16 bit by an unsigned 8 bit number yielding a 24
* bit unsigned result that is extended to 32 bits for easier handling from C. ** bit unsigned result that is extended to 32 bits for easier handling from C.
*/ */
unsigned long __fastcall__ cc65_umul16x16r32 (unsigned lhs, unsigned rhs); unsigned long __fastcall__ cc65_umul16x16r32 (unsigned lhs, unsigned rhs);
/* Multiplicate two unsigned 16 bit to yield an unsigned 32 bit result */ /* Multiplicate two unsigned 16 bit to yield an unsigned 32 bit result */
int __fastcall__ cc65_sin (unsigned x); int __fastcall__ cc65_sin (unsigned x);
/* Return the sine of the argument, which must be in range 0..360. The result /* Return the sine of the argument, which must be in range 0..360. The result
* is in 8.8 fixed point format, which means that 1.0 = $100 and -1.0 = $FF00. ** is in 8.8 fixed point format, which means that 1.0 = $100 and -1.0 = $FF00.
*/ */
int __fastcall__ cc65_cos (unsigned x); int __fastcall__ cc65_cos (unsigned x);
/* Return the cosine of the argument, which must be in range 0..360. The result /* Return the cosine of the argument, which must be in range 0..360. The result
* is in 8.8 fixed point format, which means that 1.0 = $100 and -1.0 = $FF00. ** is in 8.8 fixed point format, which means that 1.0 = $100 and -1.0 = $FF00.
*/ */

View File

@ -34,18 +34,18 @@
/* /*
* This is the direct console interface for cc65. I do not like the function ** This is the direct console interface for cc65. I do not like the function
* names very much, but the first version started as a rewrite of Borland's ** names very much, but the first version started as a rewrite of Borland's
* conio, and, even if the interface has changed, the names did not. ** conio, and, even if the interface has changed, the names did not.
* **
* The interface does direct screen I/O, so it is fast enough for most ** The interface does direct screen I/O, so it is fast enough for most
* programs. I did not implement text windows, since many applications do ** programs. I did not implement text windows, since many applications do
* not need them and should not pay for the additional overhead. It should ** not need them and should not pay for the additional overhead. It should
* be easy to add text windows on a higher level if needed, ** be easy to add text windows on a higher level if needed,
* **
* Most routines do not check the parameters. This may be unfortunate but is ** Most routines do not check the parameters. This may be unfortunate but is
* also related to speed. The coordinates are always 0/0 based. ** also related to speed. The coordinates are always 0/0 based.
*/ */
@ -128,9 +128,9 @@ int __fastcall__ vcprintf (const char* format, va_list ap);
char cgetc (void); char cgetc (void);
/* Return a character from the keyboard. If there is no character available, /* Return a character from the keyboard. If there is no character available,
* the function waits until the user does press a key. If cursor is set to ** the function waits until the user does press a key. If cursor is set to
* 1 (see below), a blinking cursor is displayed while waiting. ** 1 (see below), a blinking cursor is displayed while waiting.
*/ */
int cscanf (const char* format, ...); int cscanf (const char* format, ...);
/* Like scanf(), but uses direct keyboard input */ /* Like scanf(), but uses direct keyboard input */
@ -140,14 +140,14 @@ int __fastcall__ vcscanf (const char* format, va_list ap);
unsigned char __fastcall__ cursor (unsigned char onoff); unsigned char __fastcall__ cursor (unsigned char onoff);
/* If onoff is 1, a cursor is displayed when waiting for keyboard input. If /* If onoff is 1, a cursor is displayed when waiting for keyboard input. If
* onoff is 0, the cursor is hidden when waiting for keyboard input. The ** onoff is 0, the cursor is hidden when waiting for keyboard input. The
* function returns the old cursor setting. ** function returns the old cursor setting.
*/ */
unsigned char __fastcall__ revers (unsigned char onoff); unsigned char __fastcall__ revers (unsigned char onoff);
/* Enable/disable reverse character display. This may not be supported by /* Enable/disable reverse character display. This may not be supported by
* the output device. Return the old setting. ** the output device. Return the old setting.
*/ */
unsigned char __fastcall__ textcolor (unsigned char color); unsigned char __fastcall__ textcolor (unsigned char color);
/* Set the color for text output. The old color setting is returned. */ /* Set the color for text output. The old color setting is returned. */
@ -160,16 +160,16 @@ unsigned char __fastcall__ bordercolor (unsigned char color);
void __fastcall__ chline (unsigned char length); void __fastcall__ chline (unsigned char length);
/* Output a horizontal line with the given length starting at the current /* Output a horizontal line with the given length starting at the current
* cursor position. ** cursor position.
*/ */
void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length); void __fastcall__ chlinexy (unsigned char x, unsigned char y, unsigned char length);
/* Same as "gotoxy (x, y); chline (length);" */ /* Same as "gotoxy (x, y); chline (length);" */
void __fastcall__ cvline (unsigned char length); void __fastcall__ cvline (unsigned char length);
/* Output a vertical line with the given length at the current cursor /* Output a vertical line with the given length at the current cursor
* position. ** position.
*/ */
void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length); void __fastcall__ cvlinexy (unsigned char x, unsigned char y, unsigned char length);
/* Same as "gotoxy (x, y); cvline (length);" */ /* Same as "gotoxy (x, y); cvline (length);" */
@ -196,14 +196,14 @@ void __fastcall__ cputhex16 (unsigned val);
/* On some platforms, functions are not available or are dummys. To suppress /* On some platforms, functions are not available or are dummys. To suppress
* the call to these functions completely, the platform header files may ** the call to these functions completely, the platform header files may
* define macros for these functions that start with an underline. If such a ** define macros for these functions that start with an underline. If such a
* macro exists, a new macro is defined here, that expands to the one with the ** macro exists, a new macro is defined here, that expands to the one with the
* underline. The reason for this two stepped approach is that it is sometimes ** underline. The reason for this two stepped approach is that it is sometimes
* necessary to take the address of the function, which is not possible when ** necessary to take the address of the function, which is not possible when
* using a macro. Since the function prototype is still present, #undefining ** using a macro. Since the function prototype is still present, #undefining
* the macro will give access to the actual function. ** the macro will give access to the actual function.
*/ */
#if defined(_textcolor) #if defined(_textcolor)
# define textcolor(x) _textcolor(x) # define textcolor(x) _textcolor(x)

View File

@ -85,12 +85,12 @@ unsigned char __fastcall__ toascii (unsigned char c);
/* When inlining-of-known-functions is enabled, overload most of the above /* When inlining-of-known-functions is enabled, overload most of the above
* functions by macroes. The function prototypes are available again after ** functions by macroes. The function prototypes are available again after
* #undef'ing the macroes. ** #undef'ing the macroes.
* Please note that the following macroes do NOT handle EOF correctly, as ** Please note that the following macroes do NOT handle EOF correctly, as
* stated in the manual. If you need correct behaviour for EOF, don't ** stated in the manual. If you need correct behaviour for EOF, don't
* use -Os, or #undefine the following macroes. ** use -Os, or #undefine the following macroes.
*/ */
#ifdef __OPT_s__ #ifdef __OPT_s__
#define isalnum(c) (__AX__ = (c), \ #define isalnum(c) (__AX__ = (c), \

View File

@ -34,24 +34,24 @@
/* /*
* This is the interface to the cc65 debugger. Since many of the functions ** This is the interface to the cc65 debugger. Since many of the functions
* used for the debugger are quite usable even in another context, they ** used for the debugger are quite usable even in another context, they
* are declared here. ** are declared here.
* **
* To use the debugger, just call DbgInit in your application. Once it has ** To use the debugger, just call DbgInit in your application. Once it has
* been called, the debugger will catch any BRK opcode. Use the BREAK macro ** been called, the debugger will catch any BRK opcode. Use the BREAK macro
* defined below to insert breakpoints into your code. ** defined below to insert breakpoints into your code.
* **
* There are currently a lot of things that cannot be debugged, graphical ** There are currently a lot of things that cannot be debugged, graphical
* applications are an example. The debugger does not save your screen ** applications are an example. The debugger does not save your screen
* contents, so even your text screen gets destroyed. However, you can ** contents, so even your text screen gets destroyed. However, you can
* debug the C and runtime library, even if the debugger is using this ** debug the C and runtime library, even if the debugger is using this
* stuff itself. ** stuff itself.
* **
* Note: When using the debugger, there are some other identifiers with ** Note: When using the debugger, there are some other identifiers with
* external linkage, that start with Dbg. Avoid those names if you use the ** external linkage, that start with Dbg. Avoid those names if you use the
* module. ** module.
*/ */
@ -68,35 +68,35 @@
unsigned __fastcall__ DbgDisAsm (unsigned Addr, char* Buf, unsigned char Len); unsigned __fastcall__ DbgDisAsm (unsigned Addr, char* Buf, unsigned char Len);
/* Disassemble one instruction at address addr into the given buffer. /* Disassemble one instruction at address addr into the given buffer.
* The resulting line has the format, "AAAA__BB_BB_BB___OPC_OPERAND", ** The resulting line has the format, "AAAA__BB_BB_BB___OPC_OPERAND",
* where AAAA is the hexadecimal representation of addr, BB are the ** where AAAA is the hexadecimal representation of addr, BB are the
* bytes (in hex) that make the instruction, OPC is the mnemonic, and ** bytes (in hex) that make the instruction, OPC is the mnemonic, and
* OPERAND is an operand for the instruction. ** OPERAND is an operand for the instruction.
* The buffer is filled with spaces up to the given length and terminated as ** The buffer is filled with spaces up to the given length and terminated as
* a usual C string. NOTE: Buf must be able to hold Len+1 characters. ** a usual C string. NOTE: Buf must be able to hold Len+1 characters.
* The function returns the length of the disassembled instruction, so, ** The function returns the length of the disassembled instruction, so,
* to disassemble the next instruction, add the return value to addr ** to disassemble the next instruction, add the return value to addr
* and call the function again. ** and call the function again.
*/ */
unsigned __fastcall__ DbgDisAsmLen (unsigned Addr); unsigned __fastcall__ DbgDisAsmLen (unsigned Addr);
/* Disassemble one instruction, but do only return the length, do not /* Disassemble one instruction, but do only return the length, do not
* create a visible representation. This function is useful when ** create a visible representation. This function is useful when
* disassembling backwards, it is much faster than DbgDisAsm. ** disassembling backwards, it is much faster than DbgDisAsm.
*/ */
int __fastcall__ DbgIsRAM (unsigned Addr); int __fastcall__ DbgIsRAM (unsigned Addr);
/* Return true if we can read and write the given address */ /* Return true if we can read and write the given address */
char* DbgMemDump (unsigned Addr, char* Buf, unsigned char Len); char* DbgMemDump (unsigned Addr, char* Buf, unsigned char Len);
/* Create a line of a memory dump in the given buffer. The buffer contains /* Create a line of a memory dump in the given buffer. The buffer contains
* the starting address (4 digits hex), then Len bytes in this format: ** the starting address (4 digits hex), then Len bytes in this format:
* "AAAA__XX_YY_ZZ_...". The passed char buffer must hold Len*3+5 bytes ** "AAAA__XX_YY_ZZ_...". The passed char buffer must hold Len*3+5 bytes
* plus a terminator byte. ** plus a terminator byte.
* The function does not work correctly if the created string is longer ** The function does not work correctly if the created string is longer
* than 255 bytes. ** than 255 bytes.
* The return value is Buf. ** The return value is Buf.
*/ */
@ -108,8 +108,8 @@ char* DbgMemDump (unsigned Addr, char* Buf, unsigned char Len);
void __fastcall__ DbgInit (unsigned unused); void __fastcall__ DbgInit (unsigned unused);
/* Initialize the debugger. Use 0 as parameter. The debugger will popup on /* Initialize the debugger. Use 0 as parameter. The debugger will popup on
* next brk encountered. ** next brk encountered.
*/ */
#define BREAK() __asm__ ("brk") #define BREAK() __asm__ ("brk")
/* Use this to insert breakpoints into your code */ /* Use this to insert breakpoints into your code */

View File

@ -36,10 +36,10 @@
/* Please note: All functions in this file will set _oserror *and* return its /* 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 ** 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 ** will be set. All function will also set _oserror in case of successful
* execution, effectively clearing it. ** execution, effectively clearing it.
*/ */

View File

@ -56,10 +56,10 @@
#define EM_ERR_INSTALLED 5 /* A driver is already installed */ #define EM_ERR_INSTALLED 5 /* A driver is already installed */
/* Parameters for the em_copy_... functions. NOTE: The first seven bytes /* Parameters for the em_copy_... functions. NOTE: The first seven bytes
* have the same order and alignment as needed for the Commodore REU, so ** have the same order and alignment as needed for the Commodore REU, so
* don't change the order without changing the assembler file that defines ** don't change the order without changing the assembler file that defines
* the struct offsets and the code in the REU driver. ** the struct offsets and the code in the REU driver.
*/ */
struct em_copy { struct em_copy {
void* buf; /* Memory buffer to copy from or to */ void* buf; /* Memory buffer to copy from or to */
unsigned char offs; /* Offset into page */ unsigned char offs; /* Offset into page */
@ -87,44 +87,44 @@ unsigned char __fastcall__ em_install (void* driver);
unsigned char em_uninstall (void); unsigned char em_uninstall (void);
/* Uninstall the currently loaded driver and return an error code. /* Uninstall the currently loaded driver and return an error code.
* Note: This call does not free allocated memory. ** Note: This call does not free allocated memory.
*/ */
unsigned em_pagecount (void); unsigned em_pagecount (void);
/* Return the total number of 256 byte pages available in extended memory. */ /* Return the total number of 256 byte pages available in extended memory. */
void* __fastcall__ em_map (unsigned page); void* __fastcall__ em_map (unsigned page);
/* Unmap the current page from memory and map a new one. The function returns /* Unmap the current page from memory and map a new one. The function returns
* a pointer to the location of the page in memory. Note: Without calling ** a pointer to the location of the page in memory. Note: Without calling
* em_commit, the old contents of the memory window may be lost! ** em_commit, the old contents of the memory window may be lost!
*/ */
void* __fastcall__ em_use (unsigned page); void* __fastcall__ em_use (unsigned page);
/* Tell the driver that the memory window is associated with a given page. /* Tell the driver that the memory window is associated with a given page.
* This call is very similar to em_map. The difference is that the driver ** This call is very similar to em_map. The difference is that the driver
* does not necessarily transfer the current contents of the extended ** does not necessarily transfer the current contents of the extended
* memory into the returned window. If you're going to just write to the ** memory into the returned window. If you're going to just write to the
* window and the current contents of the window are invalid or no longer ** window and the current contents of the window are invalid or no longer
* use, this call may perform better than em_map. ** use, this call may perform better than em_map.
*/ */
void em_commit (void); void em_commit (void);
/* Commit changes in the memory window to extended storage. If the contents /* Commit changes in the memory window to extended storage. If the contents
* of the memory window have been changed, these changes may be lost if ** of the memory window have been changed, these changes may be lost if
* em_map, em_copyfrom or em_copyto are called without calling em_commit ** em_map, em_copyfrom or em_copyto are called without calling em_commit
* first. Note: Not calling em_commit does not mean that the changes are ** first. Note: Not calling em_commit does not mean that the changes are
* discarded, it does just mean that some drivers will discard the changes. ** discarded, it does just mean that some drivers will discard the changes.
*/ */
void __fastcall__ em_copyfrom (const struct em_copy* copy_data); void __fastcall__ em_copyfrom (const struct em_copy* copy_data);
/* Copy from extended into linear memory. Note: This may invalidate the /* Copy from extended into linear memory. Note: This may invalidate the
* currently mapped page. ** currently mapped page.
*/ */
void __fastcall__ em_copyto (const struct em_copy* copy_data); void __fastcall__ em_copyto (const struct em_copy* copy_data);
/* Copy from linear into extended memory. Note: This may invalidate the /* Copy from linear into extended memory. Note: This may invalidate the
* currently mapped page. ** currently mapped page.
*/ */

View File

@ -7,7 +7,7 @@
/* */ /* */
/* */ /* */
/* (C) 2002-2003 Ullrich von Bassewitz */ /* (C) 2002-2003 Ullrich von Bassewitz */
/* Römerstrasse 52 */ /* Roemerstrasse 52 */
/* D-70794 Filderstadt */ /* D-70794 Filderstadt */
/* EMail: uz@cc65.org */ /* EMail: uz@cc65.org */
/* */ /* */
@ -45,8 +45,8 @@
/* A structure that describes the header of an extended memory driver loaded /* A structure that describes the header of an extended memory driver loaded
* into memory. ** into memory.
*/ */
typedef struct { typedef struct {
/* Driver header */ /* Driver header */

View File

@ -84,23 +84,23 @@ extern int _errno;
int __fastcall__ _osmaperrno (unsigned char oserror); int __fastcall__ _osmaperrno (unsigned char oserror);
/* Map an operating system specific error code (for example from _oserror) /* Map an operating system specific error code (for example from _oserror)
* into one of the E... codes above. It is user callable. ** into one of the E... codes above. It is user callable.
*/ */
unsigned char __fastcall__ _seterrno (unsigned char code); unsigned char __fastcall__ _seterrno (unsigned char code);
/* Set errno to a specific error code and return zero. Used by the library */ /* Set errno to a specific error code and return zero. Used by the library */
int __fastcall__ _directerrno (unsigned char code); int __fastcall__ _directerrno (unsigned char code);
/* Set errno to a specific error code, clear _oserror and return -1. Used /* Set errno to a specific error code, clear _oserror and return -1. Used
* by the library. ** by the library.
*/ */
int __fastcall__ _mappederrno (unsigned char code); int __fastcall__ _mappederrno (unsigned char code);
/* Set _oserror to the given platform specific error code. If it is a real /* 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 ** error code (not zero) set errno to the corresponding system error code
* and return -1. Otherwise return zero. ** and return -1. Otherwise return zero.
* Used by the library. ** Used by the library.
*/ */

View File

@ -34,9 +34,9 @@
/* Note: This file is not fully ISO 9899-1999 compliant because cc65 lacks /* Note: This file is not fully ISO 9899-1999 compliant because cc65 lacks
* a 64 bit data types and is not able to return structs > 4 bytes. The ** a 64 bit data types and is not able to return structs > 4 bytes. The
* declarations have been adjusted accordingly or left out. ** declarations have been adjusted accordingly or left out.
*/ */

View File

@ -99,8 +99,8 @@ unsigned char __fastcall__ joy_install (void* driver);
unsigned char joy_uninstall (void); unsigned char joy_uninstall (void);
/* Uninstall the currently loaded driver and return an error code. /* Uninstall the currently loaded driver and return an error code.
* Note: This call does not free allocated memory. ** Note: This call does not free allocated memory.
*/ */
unsigned char joy_count (void); unsigned char joy_count (void);
/* Return the number of joysticks supported by the driver */ /* Return the number of joysticks supported by the driver */

View File

@ -7,7 +7,7 @@
/* */ /* */
/* */ /* */
/* (C) 2002-2006, Ullrich von Bassewitz */ /* (C) 2002-2006, Ullrich von Bassewitz */
/* Römerstrasse 52 */ /* Roemerstrasse 52 */
/* D-70794 Filderstadt */ /* D-70794 Filderstadt */
/* EMail: uz@cc65.org */ /* EMail: uz@cc65.org */
/* */ /* */
@ -45,8 +45,8 @@
/* A structure that describes the header of a joystick driver loaded into /* A structure that describes the header of a joystick driver loaded into
* memory. ** memory.
*/ */
typedef struct { typedef struct {
/* Driver header */ /* Driver header */
@ -88,4 +88,3 @@ void joy_clear_ptr (void);

View File

@ -34,8 +34,8 @@
/* Exports structures and functions to load relocatable o65 modules at /* Exports structures and functions to load relocatable o65 modules at
* runtime. ** runtime.
*/ */
@ -45,22 +45,22 @@
/* The following struct is passed to the module loader. It contains stuff, /* The following struct is passed to the module loader. It contains stuff,
* the loader needs to work, and another area where the loader will place ** the loader needs to work, and another area where the loader will place
* informational data if it was successful. You will have to check the return ** informational data if it was successful. You will have to check the return
* code of mod_load before accessing any of these additional struct members. ** code of mod_load before accessing any of these additional struct members.
*/ */
struct mod_ctrl { struct mod_ctrl {
/* Parameters passed into the loader routine. The member callerdata /* Parameters passed into the loader routine. The member callerdata
* is an opaque 16 bit datatype that may be used by the caller to ** is an opaque 16 bit datatype that may be used by the caller to
* pass data through to the read routine. The read routine is used by the ** pass data through to the read routine. The read routine is used by the
* loader to load any required data. There are several calls where the ** loader to load any required data. There are several calls where the
* read routine is passed a count of 1, so you may choose to make this ** read routine is passed a count of 1, so you may choose to make this
* a special case when implementing read(). The read() should return the ** a special case when implementing read(). The read() should return the
* number of bytes actually read. If the return value differs from the ** number of bytes actually read. If the return value differs from the
* passed count, this is considered an error. ** passed count, this is considered an error.
* NOTE: read() is designed so that the POSIX read() routine can be used ** NOTE: read() is designed so that the POSIX read() routine can be used
* for this vector, if you're loading from disk. ** for this vector, if you're loading from disk.
*/ */
int __fastcall__ (*read) (int callerdata, void* buffer, unsigned count); int __fastcall__ (*read) (int callerdata, void* buffer, unsigned count);
int callerdata; int callerdata;
@ -74,15 +74,15 @@ struct mod_ctrl {
unsigned char __fastcall__ mod_load (struct mod_ctrl* ctrl); unsigned char __fastcall__ mod_load (struct mod_ctrl* ctrl);
/* Load a module into memory and relocate it. The function will return an /* Load a module into memory and relocate it. The function will return an
* error code (see below). If MLOAD_OK is returned, the outgoing fields in ** error code (see below). If MLOAD_OK is returned, the outgoing fields in
* the passed mod_ctrl struct contain information about the module just ** the passed mod_ctrl struct contain information about the module just
* loaded. ** loaded.
*/ */
void __fastcall__ mod_free (void* module); void __fastcall__ mod_free (void* module);
/* Free a loaded module. Note: The given pointer is the pointer to the /* Free a loaded module. Note: The given pointer is the pointer to the
* module memory, not a pointer to a control structure. ** module memory, not a pointer to a control structure.
*/ */

View File

@ -79,9 +79,9 @@ struct mouse_box {
}; };
/* Structure containing mouse callback functions. These functions are declared /* Structure containing mouse callback functions. These functions are declared
* in C notation here, but they cannot be C functions (at least not easily), ** in C notation here, but they cannot be C functions (at least not easily),
* since they may be called from within an interrupt. ** since they may be called from within an interrupt.
*/ */
struct mouse_callbacks { struct mouse_callbacks {
void (*hide) (void); void (*hide) (void);
@ -92,23 +92,23 @@ struct mouse_callbacks {
void (*prep) (void); void (*prep) (void);
/* Prepare to move the mouse cursor. This function is called, /* Prepare to move the mouse cursor. This function is called,
* even when the cursor is currently invisible. ** even when the cursor is currently invisible.
*/ */
void (*draw) (void); void (*draw) (void);
/* Draw the mouse cursor. This function is called, /* Draw the mouse cursor. This function is called,
* even when the cursor is currently invisible. ** even when the cursor is currently invisible.
*/ */
void __fastcall__ (*movex) (int x); void __fastcall__ (*movex) (int x);
/* Move the mouse cursor to the new X coordinate. This function is called, /* Move the mouse cursor to the new X coordinate. This function is called,
* even when the cursor is currently invisible. ** even when the cursor is currently invisible.
*/ */
void __fastcall__ (*movey) (int y); void __fastcall__ (*movey) (int y);
/* Move the mouse cursor to the new Y coordinate. This function is called, /* Move the mouse cursor to the new Y coordinate. This function is called,
* even when the cursor is currently invisible. ** even when the cursor is currently invisible.
*/ */
}; };
@ -155,43 +155,43 @@ const char* __fastcall__ mouse_geterrormsg (unsigned char code);
void mouse_hide (void); void mouse_hide (void);
/* Hide the mouse. The function manages a counter and may be called more than /* Hide the mouse. The function manages a counter and may be called more than
* once. For each call to mouse_hide there must be a call to mouse_show to make ** once. For each call to mouse_hide there must be a call to mouse_show to make
* the mouse visible again. ** the mouse visible again.
*/ */
void mouse_show (void); void mouse_show (void);
/* Show the mouse. See mouse_hide() for more information. */ /* Show the mouse. See mouse_hide() for more information. */
void __fastcall__ mouse_setbox (const struct mouse_box* box); void __fastcall__ mouse_setbox (const struct mouse_box* box);
/* Set the bounding box for the mouse pointer movement. The mouse X and Y /* Set the bounding box for the mouse pointer movement. The mouse X and Y
* coordinates will never go outside the given box. ** coordinates will never go outside the given box.
* NOTE: The function does *not* check if the mouse is currently inside the ** NOTE: The function does *not* check if the mouse is currently inside the
* given margins. The proper way to use this function therefore is: ** given margins. The proper way to use this function therefore is:
* **
* - Hide the mouse ** - Hide the mouse
* - Set the bounding box ** - Set the bounding box
* - Place the mouse at the desired position ** - Place the mouse at the desired position
* - Show the mouse again. ** - Show the mouse again.
* **
* NOTE2: When setting the box to something that is larger than the actual ** NOTE2: When setting the box to something that is larger than the actual
* screen, the positioning of the mouse cursor can fail. If such margins ** screen, the positioning of the mouse cursor can fail. If such margins
* are really what you want, you have to use your own cursor routines. ** are really what you want, you have to use your own cursor routines.
*/ */
void __fastcall__ mouse_getbox (struct mouse_box* box); void __fastcall__ mouse_getbox (struct mouse_box* box);
/* Get the current bounding box for the mouse pointer movement. */ /* Get the current bounding box for the mouse pointer movement. */
void __fastcall__ mouse_move (int x, int y); void __fastcall__ mouse_move (int x, int y);
/* Set the mouse cursor to the given position. If a mouse cursor is defined /* Set the mouse cursor to the given position. If a mouse cursor is defined
* and currently visible, the mouse cursor is also moved. ** and currently visible, the mouse cursor is also moved.
* NOTE: This function does not check if the given position is valid and ** NOTE: This function does not check if the given position is valid and
* inside the bounding box. ** inside the bounding box.
*/ */
unsigned char mouse_buttons (void); unsigned char mouse_buttons (void);
/* Return a bit mask encoding the states of the mouse buttons. Use the /* Return a bit mask encoding the states of the mouse buttons. Use the
* MOUSE_BTN_XXX flags to decode a specific button. ** MOUSE_BTN_XXX flags to decode a specific button.
*/ */
void __fastcall__ mouse_pos (struct mouse_pos* pos); void __fastcall__ mouse_pos (struct mouse_pos* pos);
/* Return the current mouse position. */ /* Return the current mouse position. */
@ -201,8 +201,8 @@ void __fastcall__ mouse_info (struct mouse_info* info);
unsigned char __fastcall__ mouse_ioctl (unsigned char code, void* data); unsigned char __fastcall__ mouse_ioctl (unsigned char code, void* data);
/* Call the driver-specific ioctl function. Return an error code. /* Call the driver-specific ioctl function. Return an error code.
* NON-PORTABLE! ** NON-PORTABLE!
*/ */

View File

@ -34,12 +34,12 @@
/* This files exports structures and constants to handle the o65 relocatable /* This files exports structures and constants to handle the o65 relocatable
* file format as defined by Andre Fachat. See the original document under ** file format as defined by Andre Fachat. See the original document under
* **
* http://www.6502.org/users/andre/o65/fileformat.html ** http://www.6502.org/users/andre/o65/fileformat.html
* **
* for more information. ** for more information.
*/ */

View File

@ -54,20 +54,20 @@ extern void __fastcall__ (*pen_adjuster) (unsigned char *pValue);
void __fastcall__ pen_calibrate (unsigned char *XOffset); void __fastcall__ pen_calibrate (unsigned char *XOffset);
/* Ask the user to help to calibrate a lightpen. Changes the screen! /* Ask the user to help to calibrate a lightpen. Changes the screen!
* A pointer to this function can be put into pen_adjuster. ** A pointer to this function can be put into pen_adjuster.
*/ */
void __fastcall__ pen_adjust (const char *filename); void __fastcall__ pen_adjust (const char *filename);
/* Get a lightpen calibration value from a file if it exists. Otherwise, call /* Get a lightpen calibration value from a file if it exists. Otherwise, call
* pen_calibrate() to create a value; then, write it into a file, so that it ** pen_calibrate() to create a value; then, write it into a file, so that it
* will be available at the next time that the lightpen is used. ** will be available at the next time that the lightpen is used.
* Might change the screen. ** Might change the screen.
* pen_adjust() is optional; if you want to use its feature, ** pen_adjust() is optional; if you want to use its feature,
* then it must be called before a driver is installed. ** then it must be called before a driver is installed.
* Note: This function merely saves the file-name pointer, and sets ** Note: This function merely saves the file-name pointer, and sets
* the pen_adjuster pointer. The file will be read only when a driver ** the pen_adjuster pointer. The file will be read only when a driver
* is installed, and only if that driver wants to be calibrated. ** is installed, and only if that driver wants to be calibrated.
*/ */

View File

@ -7,7 +7,7 @@
/* */ /* */
/* */ /* */
/* (C) 1998-2005 Ullrich von Bassewitz */ /* (C) 1998-2005 Ullrich von Bassewitz */
/* Römerstraße 52 */ /* Roemerstrasse 52 */
/* D-70794 Filderstadt */ /* D-70794 Filderstadt */
/* EMail: uz@cc65.org */ /* EMail: uz@cc65.org */
/* */ /* */
@ -92,9 +92,9 @@ extern void pet_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */
/* The following #defines will cause the matching functions calls in conio.h /* 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 ** to be overlaid by macros with the same names, saving the function call
* overhead. ** overhead.
*/ */
#define _textcolor(color) COLOR_WHITE #define _textcolor(color) COLOR_WHITE
#define _bgcolor(color) COLOR_BLACK #define _bgcolor(color) COLOR_BLACK
#define _bordercolor(color) COLOR_BLACK #define _bordercolor(color) COLOR_BLACK

View File

@ -92,8 +92,8 @@
#define SER_HS_SW 0x02 /* Software handshake */ #define SER_HS_SW 0x02 /* Software handshake */
/* Bit masks to mask out things from the status returned by ser_status. /* Bit masks to mask out things from the status returned by ser_status.
* These are 6551 specific and must be mapped by drivers for other chips. ** These are 6551 specific and must be mapped by drivers for other chips.
*/ */
#define SER_STATUS_PE 0x01 /* Parity error */ #define SER_STATUS_PE 0x01 /* Parity error */
#define SER_STATUS_FE 0x02 /* Framing error */ #define SER_STATUS_FE 0x02 /* Framing error */
#define SER_STATUS_OE 0x04 /* Overrun error */ #define SER_STATUS_OE 0x04 /* Overrun error */
@ -141,8 +141,8 @@ unsigned char __fastcall__ ser_install (void* driver);
unsigned char ser_uninstall (void); unsigned char ser_uninstall (void);
/* Uninstall the currently loaded driver and return an error code. /* Uninstall the currently loaded driver and return an error code.
* Note: This call does not free allocated memory. ** Note: This call does not free allocated memory.
*/ */
unsigned char __fastcall__ ser_open (const struct ser_params* params); unsigned char __fastcall__ ser_open (const struct ser_params* params);
/* "Open" the port by setting the port parameters and enable interrupts. */ /* "Open" the port by setting the port parameters and enable interrupts. */
@ -152,14 +152,14 @@ unsigned char ser_close (void);
unsigned char __fastcall__ ser_get (char* b); unsigned char __fastcall__ ser_get (char* b);
/* Get a character from the serial port. If no characters are available, the /* Get a character from the serial port. If no characters are available, the
* function will return SER_ERR_NO_DATA, so this is not a fatal error. ** function will return SER_ERR_NO_DATA, so this is not a fatal error.
*/ */
unsigned char __fastcall__ ser_put (char b); unsigned char __fastcall__ ser_put (char b);
/* Send a character via the serial port. There is a transmit buffer, but /* Send a character via the serial port. There is a transmit buffer, but
* transmitting is not done via interrupt. The function returns ** transmitting is not done via interrupt. The function returns
* SER_ERR_OVERFLOW if there is no space left in the transmit buffer. ** SER_ERR_OVERFLOW if there is no space left in the transmit buffer.
*/ */
unsigned char __fastcall__ ser_status (unsigned char* status); unsigned char __fastcall__ ser_status (unsigned char* status);
/* Return the serial port status. */ /* Return the serial port status. */

View File

@ -34,8 +34,8 @@
/* Note: This file is not fully ISO 9899-1999 compliant because cc65 lacks /* Note: This file is not fully ISO 9899-1999 compliant because cc65 lacks
* a 64 bit data types. The declarations have been adjusted accordingly. ** a 64 bit data types. The declarations have been adjusted accordingly.
*/ */

View File

@ -71,13 +71,13 @@ void __fastcall__ free (void* block);
#if __CC65_STD__ == __CC65_STD_CC65__ #if __CC65_STD__ == __CC65_STD_CC65__
int __fastcall__ posix_memalign (void** memptr, size_t alignment, size_t size); int __fastcall__ posix_memalign (void** memptr, size_t alignment, size_t size);
/* Allocate a block of memory with the given "size", which is aligned to a /* Allocate a block of memory with the given "size", which is aligned to a
* memory address that is a multiple of "alignment". "alignment" MUST NOT be ** memory address that is a multiple of "alignment". "alignment" MUST NOT be
* zero, and MUST be a power of two; otherwise, this function will return ** zero, and MUST be a power of two; otherwise, this function will return
* EINVAL. The function returns ENOMEM if not enough memory is available ** EINVAL. The function returns ENOMEM if not enough memory is available
* to satisfy the request. "memptr" must point to a variable; that variable ** to satisfy the request. "memptr" must point to a variable; that variable
* will return the address of the allocated memory. Use free() to release that ** will return the address of the allocated memory. Use free() to release that
* allocated block. ** allocated block.
*/ */
#endif #endif
void __fastcall__ _heapadd (void* mem, size_t size); void __fastcall__ _heapadd (void* mem, size_t size);

View File

@ -65,8 +65,8 @@ void* __fastcall__ memmove (void* dest, const void* src, size_t count);
void* __fastcall__ memset (void* s, int c, size_t count); void* __fastcall__ memset (void* s, int c, size_t count);
/* The following is an internal function, the compiler will replace memset /* The following is an internal function, the compiler will replace memset
* with it if the fill value is zero. Never use this one directly! ** 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: */ /* Non standard: */

View File

@ -98,9 +98,9 @@ struct __sv_dma {
/* Counters incremented asynchronously! /* Counters incremented asynchronously!
* If you want more complex, copy the crt0.s file from the libsrc/supervision ** If you want more complex, copy the crt0.s file from the libsrc/supervision
* directory and code them yourself (in assembler) ** directory and code them yourself (in assembler)
*/ */
extern unsigned char sv_nmi_counter; extern unsigned char sv_nmi_counter;
extern unsigned char sv_timer_irq_counter; extern unsigned char sv_timer_irq_counter;
extern unsigned char sv_timer_dma_counter; extern unsigned char sv_timer_dma_counter;

View File

@ -7,7 +7,7 @@
/* */ /* */
/* */ /* */
/* (C) 2003 Ullrich von Bassewitz */ /* (C) 2003 Ullrich von Bassewitz */
/* Römerstrasse 52 */ /* Roemerstrasse 52 */
/* D-70794 Filderstadt */ /* D-70794 Filderstadt */
/* EMail: uz@cc65.org */ /* EMail: uz@cc65.org */
/* */ /* */
@ -45,30 +45,30 @@
/* /*
* Suggested field contents: ** Suggested field contents:
* **
* sysname ** sysname
* Should contain the name of the underlying operating system, or "cc65" ** Should contain the name of the underlying operating system, or "cc65"
* if the program runs on the bare machine. ** if the program runs on the bare machine.
* **
* nodename ** nodename
* Is empty or may be defined by the implementor. ** Is empty or may be defined by the implementor.
* **
* release ** release
* Contains the operating system release or the major/minor cc65 version ** Contains the operating system release or the major/minor cc65 version
* if sysname contains "cc65". ** if sysname contains "cc65".
* **
* version ** version
* Contains the operating system version or the cc65 patch version if ** Contains the operating system version or the cc65 patch version if
* sysname contains "cc65". ** sysname contains "cc65".
* **
* machine ** machine
* Contains the complete name of the machine, like "Commodore 64", ** Contains the complete name of the machine, like "Commodore 64",
* "Oric Atmos" or similar. ** "Oric Atmos" or similar.
* **
* Beware: The library sources written in assembler have knowledge about this ** Beware: The library sources written in assembler have knowledge about this
* struct! ** struct!
*/ */
struct utsname { struct utsname {
char sysname[17]; char sysname[17];
char nodename[9]; char nodename[9];

View File

@ -80,44 +80,44 @@ void __fastcall__ tgi_load_driver (const char* name);
void tgi_unload (void); void tgi_unload (void);
/* Uninstall, then unload the currently loaded driver. Will call tgi_done if /* Uninstall, then unload the currently loaded driver. Will call tgi_done if
* necessary. ** necessary.
*/ */
void __fastcall__ tgi_install (void* driver); void __fastcall__ tgi_install (void* driver);
/* Install an already loaded driver. */ /* Install an already loaded driver. */
void tgi_uninstall (void); void tgi_uninstall (void);
/* Uninstall the currently loaded driver but do not unload it. Will call /* Uninstall the currently loaded driver but do not unload it. Will call
* tgi_done if necessary. ** tgi_done if necessary.
*/ */
void tgi_init (void); void tgi_init (void);
/* Initialize the already loaded graphics driver. */ /* Initialize the already loaded graphics driver. */
void tgi_done (void); void tgi_done (void);
/* End graphics mode, switch back to text mode. Will NOT uninstall or unload /* End graphics mode, switch back to text mode. Will NOT uninstall or unload
* the driver! ** the driver!
*/ */
const tgi_vectorfont* __fastcall__ tgi_load_vectorfont (const char* name); const tgi_vectorfont* __fastcall__ tgi_load_vectorfont (const char* name);
/* Load a vector font into memory and return it. In case of errors, NULL is /* Load a vector font into memory and return it. In case of errors, NULL is
* returned and an error is set, which can be retrieved using tgi_geterror. ** returned and an error is set, which can be retrieved using tgi_geterror.
* To use the font, it has to be installed using tgi_install_vectorfont. ** To use the font, it has to be installed using tgi_install_vectorfont.
*/ */
void __fastcall__ tgi_install_vectorfont (const tgi_vectorfont* font); void __fastcall__ tgi_install_vectorfont (const tgi_vectorfont* font);
/* Install a vector font for use. More than one vector font can be loaded, /* Install a vector font for use. More than one vector font can be loaded,
* but only one can be active. This function is used to tell which one. Call ** but only one can be active. This function is used to tell which one. Call
* with a NULL pointer to uninstall the currently installed font. ** with a NULL pointer to uninstall the currently installed font.
*/ */
void __fastcall__ tgi_free_vectorfont (const tgi_vectorfont* font); void __fastcall__ tgi_free_vectorfont (const tgi_vectorfont* font);
/* Free a vector font that was previously loaded into memory. */ /* Free a vector font that was previously loaded into memory. */
unsigned char tgi_geterror (void); unsigned char tgi_geterror (void);
/* Return the error code for the last operation. This will also clear the /* Return the error code for the last operation. This will also clear the
* error. ** error.
*/ */
const char* __fastcall__ tgi_geterrormsg (unsigned char code); const char* __fastcall__ tgi_geterrormsg (unsigned char code);
/* Get an error message describing the error in code. */ /* Get an error message describing the error in code. */
@ -139,8 +139,8 @@ unsigned char tgi_getcolorcount (void);
unsigned char tgi_getmaxcolor (void); unsigned char tgi_getmaxcolor (void);
/* Return the maximum supported color number (the number of colors would /* Return the maximum supported color number (the number of colors would
* then be getmaxcolor()+1). ** then be getmaxcolor()+1).
*/ */
void __fastcall__ tgi_setcolor (unsigned char color); void __fastcall__ tgi_setcolor (unsigned char color);
/* Set the current drawing color. */ /* Set the current drawing color. */
@ -150,8 +150,8 @@ unsigned char tgi_getcolor (void);
void __fastcall__ tgi_setpalette (const unsigned char* palette); void __fastcall__ tgi_setpalette (const unsigned char* palette);
/* Set the palette (not available with all drivers/hardware). palette is /* Set the palette (not available with all drivers/hardware). palette is
* a pointer to as many entries as there are colors. ** a pointer to as many entries as there are colors.
*/ */
const unsigned char* tgi_getpalette (void); const unsigned char* tgi_getpalette (void);
/* Return the current palette. */ /* Return the current palette. */
@ -164,26 +164,26 @@ unsigned tgi_getxres (void);
unsigned tgi_getmaxx (void); unsigned tgi_getmaxx (void);
/* Return the maximum x coordinate. The resolution in x direction is /* Return the maximum x coordinate. The resolution in x direction is
* getmaxx() + 1 ** getmaxx() + 1
*/ */
unsigned tgi_getyres (void); unsigned tgi_getyres (void);
/* Return the resolution in Y direction. */ /* Return the resolution in Y direction. */
unsigned tgi_getmaxy (void); unsigned tgi_getmaxy (void);
/* Return the maximum y coordinate. The resolution in y direction is /* Return the maximum y coordinate. The resolution in y direction is
* getmaxy() + 1 ** getmaxy() + 1
*/ */
unsigned tgi_getaspectratio (void); unsigned tgi_getaspectratio (void);
/* Returns the aspect ratio for the loaded driver. The aspect ratio is an /* Returns the aspect ratio for the loaded driver. The aspect ratio is an
* 8.8 fixed point value. ** 8.8 fixed point value.
*/ */
void __fastcall__ tgi_setaspectratio (unsigned aspectratio); void __fastcall__ tgi_setaspectratio (unsigned aspectratio);
/* Set a new aspect ratio for the loaded driver. The aspect ratio is an /* Set a new aspect ratio for the loaded driver. The aspect ratio is an
* 8.8 fixed point value. ** 8.8 fixed point value.
*/ */
unsigned char __fastcall__ tgi_getpixel (int x, int y); unsigned char __fastcall__ tgi_getpixel (int x, int y);
/* Get the color value of a pixel. */ /* Get the color value of a pixel. */
@ -196,89 +196,89 @@ void __fastcall__ tgi_gotoxy (int x, int y);
void __fastcall__ tgi_line (int x1, int y1, int x2, int y2); void __fastcall__ tgi_line (int x1, int y1, int x2, int y2);
/* Draw a line in the current drawing color. The graphics cursor will /* Draw a line in the current drawing color. The graphics cursor will
* be set to x2/y2 by this call. ** be set to x2/y2 by this call.
*/ */
void __fastcall__ tgi_lineto (int x2, int y2); void __fastcall__ tgi_lineto (int x2, int y2);
/* Draw a line in the current drawing color from the graphics cursor to the /* Draw a line in the current drawing color from the graphics cursor to the
* new end point. The graphics cursor will be updated to x2/y2. ** new end point. The graphics cursor will be updated to x2/y2.
*/ */
void __fastcall__ tgi_circle (int x, int y, unsigned char radius); void __fastcall__ tgi_circle (int x, int y, unsigned char radius);
/* Draw a circle in the current drawing color. */ /* Draw a circle in the current drawing color. */
void __fastcall__ tgi_ellipse (int x, int y, unsigned char rx, unsigned char ry); void __fastcall__ tgi_ellipse (int x, int y, unsigned char rx, unsigned char ry);
/* Draw a full ellipse with center at x/y and radii rx/ry using the current /* Draw a full ellipse with center at x/y and radii rx/ry using the current
* drawing color. ** drawing color.
*/ */
void __fastcall__ tgi_arc (int x, int y, unsigned char rx, unsigned char ry, void __fastcall__ tgi_arc (int x, int y, unsigned char rx, unsigned char ry,
unsigned sa, unsigned ea); unsigned sa, unsigned ea);
/* Draw an ellipse arc with center at x/y and radii rx/ry using the current /* Draw an ellipse arc with center at x/y and radii rx/ry using the current
* drawing color. The arc covers the angle between sa and ea (startangle and ** drawing color. The arc covers the angle between sa and ea (startangle and
* endangle), which must be in the range 0..360 (otherwise the function may ** endangle), which must be in the range 0..360 (otherwise the function may
* bevave unextectedly). ** bevave unextectedly).
*/ */
void __fastcall__ tgi_pieslice (int x, int y, unsigned char rx, unsigned char ry, void __fastcall__ tgi_pieslice (int x, int y, unsigned char rx, unsigned char ry,
unsigned sa, unsigned ea); unsigned sa, unsigned ea);
/* Draw an ellipse pie slice with center at x/y and radii rx/ry using the /* Draw an ellipse pie slice with center at x/y and radii rx/ry using the
* current drawing color. The pie slice covers the angle between sa and ea ** current drawing color. The pie slice covers the angle between sa and ea
* (startangle and endangle), which must be in the range 0..360 (otherwise the ** (startangle and endangle), which must be in the range 0..360 (otherwise the
* function may behave unextectedly). ** function may behave unextectedly).
*/ */
void __fastcall__ tgi_bar (int x1, int y1, int x2, int y2); void __fastcall__ tgi_bar (int x1, int y1, int x2, int y2);
/* Draw a bar (a filled rectangle) using the current color. */ /* Draw a bar (a filled rectangle) using the current color. */
void __fastcall__ tgi_settextdir (unsigned char dir); void __fastcall__ tgi_settextdir (unsigned char dir);
/* Set the direction for text output. dir is one of the TGI_TEXT_XXX /* Set the direction for text output. dir is one of the TGI_TEXT_XXX
* constants. ** constants.
*/ */
void __fastcall__ tgi_settextscale (unsigned width, unsigned height); void __fastcall__ tgi_settextscale (unsigned width, unsigned height);
/* Set the scaling for text output. The scaling factors for width and height /* Set the scaling for text output. The scaling factors for width and height
* are 8.8 fixed point values. This means that $100 = 1 $200 = 2 etc. ** are 8.8 fixed point values. This means that $100 = 1 $200 = 2 etc.
*/ */
void __fastcall__ tgi_settextstyle (unsigned width, unsigned height, void __fastcall__ tgi_settextstyle (unsigned width, unsigned height,
unsigned char dir, unsigned char font); unsigned char dir, unsigned char font);
/* Set the style for text output. The scaling factors for width and height /* Set the style for text output. The scaling factors for width and height
* are 8.8 fixed point values. This means that $100 = 1 $200 = 2 etc. ** are 8.8 fixed point values. This means that $100 = 1 $200 = 2 etc.
* dir is one of the TGI_TEXT_XXX constants. font is one of the TGI_FONT_XXX ** dir is one of the TGI_TEXT_XXX constants. font is one of the TGI_FONT_XXX
* constants. ** constants.
*/ */
unsigned __fastcall__ tgi_gettextwidth (const char* s); unsigned __fastcall__ tgi_gettextwidth (const char* s);
/* Calculate the width of the text in pixels according to the current text /* Calculate the width of the text in pixels according to the current text
* style. ** style.
*/ */
unsigned __fastcall__ tgi_gettextheight (const char* s); unsigned __fastcall__ tgi_gettextheight (const char* s);
/* Calculate the height of the text in pixels according to the current text /* Calculate the height of the text in pixels according to the current text
* style. ** style.
*/ */
void __fastcall__ tgi_outtext (const char* s); void __fastcall__ tgi_outtext (const char* s);
/* Output text at the current graphics cursor position. The graphics cursor /* Output text at the current graphics cursor position. The graphics cursor
* is moved to the end of the text. ** is moved to the end of the text.
*/ */
void __fastcall__ tgi_outtextxy (int x, int y, const char* s); void __fastcall__ tgi_outtextxy (int x, int y, const char* s);
/* Output text at the given cursor position. The graphics cursor is moved to /* Output text at the given cursor position. The graphics cursor is moved to
* the end of the text. ** the end of the text.
*/ */
unsigned __fastcall__ tgi_ioctl (unsigned char code, void* data); unsigned __fastcall__ tgi_ioctl (unsigned char code, void* data);
/* Call the driver specific control function. What this function does for /* Call the driver specific control function. What this function does for
* a specific code depends on the driver. The driver will set an error ** a specific code depends on the driver. The driver will set an error
* for unknown codes or values. ** for unknown codes or values.
*/ */
int __fastcall__ tgi_imulround (int rhs, int lhs); int __fastcall__ tgi_imulround (int rhs, int lhs);
/* Helper function for functions using sine/cosine: Multiply two values, one /* Helper function for functions using sine/cosine: Multiply two values, one
* being an 8.8 fixed point one, and return the rounded and scaled result. ** being an 8.8 fixed point one, and return the rounded and scaled result.
*/ */

View File

@ -78,8 +78,8 @@ struct tgi_vectorfont {
void __fastcall__ tgi_vectorchar (char C); void __fastcall__ tgi_vectorchar (char C);
/* Draw one character of the vector font at the current graphics cursor /* Draw one character of the vector font at the current graphics cursor
* position using the current font magnification. ** position using the current font magnification.
*/ */

View File

@ -7,7 +7,7 @@
/* */ /* */
/* */ /* */
/* (C) 1998-2012 Ullrich von Bassewitz */ /* (C) 1998-2012 Ullrich von Bassewitz */
/* Römerstrasse 52 */ /* Roemerstrasse 52 */
/* D-70794 Filderstadt */ /* D-70794 Filderstadt */
/* EMail: uz@cc65.org */ /* EMail: uz@cc65.org */
/* */ /* */
@ -104,7 +104,8 @@ unsigned _clocks_per_sec (void);
# define CLOCKS_PER_SEC 1 /* ANSI */ # define CLOCKS_PER_SEC 1 /* ANSI */
#elif defined(__LYNX__) #elif defined(__LYNX__)
/* The clock-rate depends on the video scan-rate; /* The clock-rate depends on the video scan-rate;
** so, read it at run-time. */ ** so, read it at run-time.
*/
extern clock_t _clk_tck (void); extern clock_t _clk_tck (void);
# define CLK_TCK _clk_tck() # define CLK_TCK _clk_tck()
# define CLOCKS_PER_SEC _clk_tck() # define CLOCKS_PER_SEC _clk_tck()
@ -114,10 +115,10 @@ extern clock_t _clk_tck (void);
time_t _systime (void); time_t _systime (void);
/* Similar to time(), but: /* Similar to time(), but:
* - Is not ISO C ** - Is not ISO C
* - Does not take the additional pointer ** - Does not take the additional pointer
* - Does not set errno when returning -1 ** - Does not set errno when returning -1
*/ */
/* ISO C function prototypes */ /* ISO C function prototypes */
char* __fastcall__ asctime (const struct tm* timep); char* __fastcall__ asctime (const struct tm* timep);

View File

@ -3,10 +3,10 @@
; ;
; time_t _systime (void); ; time_t _systime (void);
; /* Similar to time(), but: ; /* Similar to time(), but:
; * - Is not ISO C ; ** - Is not ISO C
; * - Does not take the additional pointer ; ** - Does not take the additional pointer
; * - Does not set errno when returning -1 ; ** - Does not set errno when returning -1
; */ ; */
; ;
.include "time.inc" .include "time.inc"

View File

@ -1,7 +1,7 @@
; This file defines the EXE file "trailer" which sets the entry point ; This file defines the EXE file "trailer" which sets the entry point
.export __AUTOSTART__: absolute = 1 .export __AUTOSTART__: absolute = 1
.import start .import start
.include "atari.inc" .include "atari.inc"

View File

@ -194,7 +194,7 @@ delay1: ldx #0
end: end:
.ifndef __ATARIXL__ .ifndef __ATARIXL__
tmp: ; outside of the load chunk, some kind of poor man's .bss tmp: ; outside of the load chunk, some kind of poor man's .bss
.endif .endif
; ------------------------------------------------------------------------ ; ------------------------------------------------------------------------

View File

@ -3,10 +3,10 @@
; ;
; time_t _systime (void); ; time_t _systime (void);
; /* Similar to time(), but: ; /* Similar to time(), but:
; * - Is not ISO C ; ** - Is not ISO C
; * - Does not take the additional pointer ; ** - Does not take the additional pointer
; * - Does not set errno when returning -1 ; ** - Does not set errno when returning -1
; */ ; */
; ;
.export __systime .export __systime

View File

@ -1,12 +1,12 @@
/* w2cas.c -- write file to cassette /* w2cas.c -- write file to cassette
* **
* This program writes a boot file (typically linked with ** This program writes a boot file (typically linked with
* 'atari-cassette.cfg') to the cassette. ** 'atari-cassette.cfg') to the cassette.
* Only files < 32K are supported, since the loading of ** Only files < 32K are supported, since the loading of
* larger files requires a special loader inside the program. ** larger files requires a special loader inside the program.
* **
* Christian Groessler, chris@groessler.org, 2014 ** Christian Groessler, chris@groessler.org, 2014
*/ */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -3,10 +3,10 @@
; ;
; time_t _systime (void); ; time_t _systime (void);
; /* Similar to time(), but: ; /* Similar to time(), but:
; * - Is not ISO C ; ** - Is not ISO C
; * - Does not take the additional pointer ; ** - Does not take the additional pointer
; * - Does not set errno when returning -1 ; ** - Does not set errno when returning -1
; */ ; */
; ;
.export __systime .export __systime

View File

@ -3,8 +3,8 @@
; ;
; void fast (void); ; void fast (void);
; /* Switch the CPU into 2MHz mode. Note: This will disable video when in ; /* Switch the CPU into 2MHz mode. Note: This will disable video when in
; * 40 column mode. ; ** 40 column mode.
; */ ; */
; ;
.export _fast .export _fast

View File

@ -3,10 +3,10 @@
; ;
; time_t _systime (void); ; time_t _systime (void);
; /* Similar to time(), but: ; /* Similar to time(), but:
; * - Is not ISO C ; ** - Is not ISO C
; * - Does not take the additional pointer ; ** - Does not take the additional pointer
; * - Does not set errno when returning -1 ; ** - Does not set errno when returning -1
; */ ; */
; ;
.include "time.inc" .include "time.inc"

View File

@ -3,10 +3,10 @@
; ;
; time_t _systime (void); ; time_t _systime (void);
; /* Similar to time(), but: ; /* Similar to time(), but:
; * - Is not ISO C ; ** - Is not ISO C
; * - Does not take the additional pointer ; ** - Does not take the additional pointer
; * - Does not set errno when returning -1 ; ** - Does not set errno when returning -1
; */ ; */
; ;
.export __systime .export __systime

View File

@ -3,10 +3,10 @@
; ;
; time_t _systime (void); ; time_t _systime (void);
; /* Similar to time(), but: ; /* Similar to time(), but:
; * - Is not ISO C ; ** - Is not ISO C
; * - Does not take the additional pointer ; ** - Does not take the additional pointer
; * - Does not set errno when returning -1 ; ** - Does not set errno when returning -1
; */ ; */
; ;
.include "time.inc" .include "time.inc"

View File

@ -1,20 +1,21 @@
/* /*
* Marc 'BlackJack' Rintsch, 06.03.2001 ** Marc 'BlackJack' Rintsch, 06.03.2001
* **
* unsigned int cbm_load(const char* name, ** unsigned int cbm_load(const char* name,
* unsigned char device, ** unsigned char device,
* const unsigned char* data); ** const unsigned char* data);
*/ */
#include <cbm.h> #include <cbm.h>
/* loads file "name" from given device to given address or to the load address /* loads file "name" from given device to given address or to the load address
* of the file if "data" is 0 ** of the file if "data" is 0
*/ */
unsigned int cbm_load(const char* name, unsigned char device, void* data) unsigned int cbm_load(const char* name, unsigned char device, void* data)
{ {
/* LFN is set to 0 but it's not needed for loading. /* LFN is set to 0; but, it's not needed for loading
* (BASIC V2 sets it to the value of the SA for LOAD) */ ** (BASIC V2 sets it to the value of the SA for LOAD).
*/
cbm_k_setlfs(0, device, data == 0); cbm_k_setlfs(0, device, data == 0);
cbm_k_setnam(name); cbm_k_setnam(name);
return (cbm_k_load(0, (unsigned int)data) - (unsigned int)data); return (cbm_k_load(0, (unsigned int)data) - (unsigned int)data);

View File

@ -8,9 +8,9 @@
; unsigned char sec_addr, ; unsigned char sec_addr,
; const char* name); ; const char* name);
; /* Opens a file. Works just like the BASIC command. ; /* Opens a file. Works just like the BASIC command.
; * Returns 0 if opening was successful, otherwise an errorcode (see table ; ** Returns 0 if opening was successful, otherwise an errorcode (see table
; * below). ; ** below).
; */ ; */
; { ; {
; cbm_k_setlfs(lfn, device, sec_addr); ; cbm_k_setlfs(lfn, device, sec_addr);
; cbm_k_setnam(name); ; cbm_k_setnam(name);

View File

@ -5,10 +5,10 @@
; ;
; int __fastcall__ cbm_read (unsigned char lfn, void* buffer, unsigned int size) ; int __fastcall__ cbm_read (unsigned char lfn, void* buffer, unsigned int size)
; /* Reads up to "size" bytes from a file to "buffer". ; /* Reads up to "size" bytes from a file to "buffer".
; * Returns the number of actually read bytes, 0 if there are no bytes left ; ** Returns the number of actually read bytes, 0 if there are no bytes left
; * (EOF) or -1 in case of an error. _oserror contains an errorcode then (see ; ** (EOF) or -1 in case of an error. _oserror contains an errorcode then (see
; * table below). ; ** table below).
; */ ; */
; { ; {
; static unsigned int bytesread; ; static unsigned int bytesread;
; static unsigned char tmp; ; static unsigned char tmp;
@ -22,9 +22,10 @@
; tmp = cbm_k_basin(); ; tmp = cbm_k_basin();
; ;
; /* the kernal routine BASIN sets ST to EOF if the end of file ; /* the kernal routine BASIN sets ST to EOF if the end of file
; * is reached the first time, then we have store tmp. ; ** is reached the first time, then we have store tmp.
; * every subsequent call returns EOF and READ ERROR in ST, then ; ** every subsequent call returns EOF and READ ERROR in ST, then
; * we have to exit the loop here immidiatly. */ ; ** we have to exit the loop here immediatly.
; */
; if (cbm_k_readst() & 0xBF) break; ; if (cbm_k_readst() & 0xBF) break;
; ;
; ((unsigned char*)buffer)[bytesread++] = tmp; ; ((unsigned char*)buffer)[bytesread++] = tmp;

View File

@ -1,17 +1,17 @@
/* /*
* Marc 'BlackJack' Rintsch, 11.03.2001 ** Marc 'BlackJack' Rintsch, 11.03.2001
* **
* unsigned char cbm_save(const char* name, ** unsigned char cbm_save(const char* name,
* char device, ** char device,
* unsigned char* data, ** unsigned char* data,
* unsigned int size); ** unsigned int size);
*/ */
#include <cbm.h> #include <cbm.h>
#include <errno.h> #include <errno.h>
/* saves a memory area from start to end-1 to a file. /* saves a memory area from start to end-1 to a file.
*/ */
unsigned char __fastcall__ cbm_save (const char* name, unsigned char __fastcall__ cbm_save (const char* name,
unsigned char device, unsigned char device,
const void* data, const void* data,

View File

@ -1,7 +1,7 @@
/* /*
* Internal include file, do not use directly. ** Internal include file, do not use directly.
* Written by Ullrich von Bassewitz. Based on code by Groepaz. ** Written by Ullrich von Bassewitz. Based on code by Groepaz.
*/ */
@ -36,15 +36,15 @@ struct DIR {
unsigned char __fastcall__ _dirread (DIR* dir, void* buf, unsigned char count); unsigned char __fastcall__ _dirread (DIR* dir, void* buf, unsigned char count);
/* Read characters from the directory into the supplied buffer. Makes sure, /* Read characters from the directory into the supplied buffer. Makes sure,
* errno is set in case of a short read. Return true if the read was ** errno is set in case of a short read. Return true if the read was
* successful and false otherwise. ** successful and false otherwise.
*/ */
unsigned char __fastcall__ _dirread1 (DIR* dir, void* buf); unsigned char __fastcall__ _dirread1 (DIR* dir, void* buf);
/* Read one byte from the directory into the supplied buffer. Makes sure, /* Read one byte from the directory into the supplied buffer. Makes sure,
* errno is set in case of a short read. Return true if the read was ** errno is set in case of a short read. Return true if the read was
* successful and false otherwise. ** successful and false otherwise.
*/ */

View File

@ -16,9 +16,9 @@
; ;
; unsigned char __fastcall__ _dirread1 (DIR* dir, void* buf); ; unsigned char __fastcall__ _dirread1 (DIR* dir, void* buf);
; /* Read one byte from the directory into the supplied buffer. Makes sure, ; /* Read one byte from the directory into the supplied buffer. Makes sure,
; * errno is set in case of a short read. Return true if the read was ; ** errno is set in case of a short read. Return true if the read was
; * successful and false otherwise. ; ** successful and false otherwise.
; */ ; */
__dirread1: __dirread1:
@ -31,9 +31,9 @@ __dirread1:
; ;
; unsigned char __fastcall__ _dirread (DIR* dir, void* buf, unsigned char count); ; unsigned char __fastcall__ _dirread (DIR* dir, void* buf, unsigned char count);
; /* Read characters from the directory into the supplied buffer. Makes sure, ; /* Read characters from the directory into the supplied buffer. Makes sure,
; * errno is set in case of a short read. Return true if the read was ; ** errno is set in case of a short read. Return true if the read was
; * successful and false otherwise. ; ** successful and false otherwise.
; */ ; */
__dirread: __dirread:

View File

@ -1,6 +1,6 @@
/* /*
* Ullrich von Bassewitz, 2012-05-30. Based on code by Groepaz. ** Ullrich von Bassewitz, 2012-05-30. Based on code by Groepaz.
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -18,8 +18,8 @@ DIR* __fastcall__ opendir (register const char* name)
DIR d; DIR d;
/* Setup the actual file name that is sent to the disk. We accept "0:", /* Setup the actual file name that is sent to the disk. We accept "0:",
* "1:" and "." as directory names. ** "1:" and "." as directory names.
*/ */
d.name[0] = '$'; d.name[0] = '$';
if (name == 0 || name[0] == '\0' || (name[0] == '.' && name[1] == '\0')) { if (name == 0 || name[0] == '\0' || (name[0] == '.' && name[1] == '\0')) {
d.name[1] = '\0'; d.name[1] = '\0';

View File

@ -1,6 +1,6 @@
/* /*
* Ullrich von Bassewitz, 2012-05-30. Based on code by Groepaz. ** Ullrich von Bassewitz, 2012-05-30. Based on code by Groepaz.
*/ */
@ -53,9 +53,9 @@ struct dirent* __fastcall__ readdir (register DIR* dir)
dir->off += count + 4; dir->off += count + 4;
/* End of directory is reached if the buffer contains "blocks free". It is /* End of directory is reached if the buffer contains "blocks free". It is
* sufficient here to check for the leading 'b'. buffer will contain at ** sufficient here to check for the leading 'b'. buffer will contain at
* least one byte if we come here. ** least one byte if we come here.
*/ */
if (buffer[0] == 'b') { if (buffer[0] == 'b') {
goto exitpoint; goto exitpoint;
} }

View File

@ -1,6 +1,6 @@
/* /*
* Ullrich von Bassewitz, 2012-06-03. Based on code by Groepaz. ** Ullrich von Bassewitz, 2012-06-03. Based on code by Groepaz.
*/ */
#include <fcntl.h> #include <fcntl.h>
#include <unistd.h> #include <unistd.h>

View File

@ -4,10 +4,10 @@
; ;
; time_t _systime (void); ; time_t _systime (void);
; /* Similar to time(), but: ; /* Similar to time(), but:
; * - Is not ISO C ; ** - Is not ISO C
; * - Does not take the additional pointer ; ** - Does not take the additional pointer
; * - Does not set errno when returning -1 ; ** - Does not set errno when returning -1
; */ ; */
; ;
.include "time.inc" .include "time.inc"

View File

@ -4,10 +4,10 @@
; ;
; time_t _systime (void); ; time_t _systime (void);
; /* Similar to time(), but: ; /* Similar to time(), but:
; * - Is not ISO C ; ** - Is not ISO C
; * - Does not take the additional pointer ; ** - Does not take the additional pointer
; * - Does not set errno when returning -1 ; ** - Does not set errno when returning -1
; */ ; */
; ;
.include "time.inc" .include "time.inc"

View File

@ -1,8 +1,8 @@
/* /*
* _afailed.c ** _afailed.c
* **
* Ullrich von Bassewitz, 06.06.1998 ** Ullrich von Bassewitz, 06.06.1998
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* _file.h ** _file.h
* **
* (C) Copyright 1998, 2002 Ullrich von Bassewitz (uz@cc65.org) ** (C) Copyright 1998, 2002 Ullrich von Bassewitz (uz@cc65.org)
* **
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* Ullrich von Bassewitz, 11.08.1998 ** Ullrich von Bassewitz, 11.08.1998
* **
* Hex conversion table. Must be in C since the compiler will convert ** Hex conversion table. Must be in C since the compiler will convert
* to the correct character set for the target platform. ** to the correct character set for the target platform.
*/ */

View File

@ -1,11 +1,11 @@
/* /*
* Ullrich von Bassewitz, 2012-11-26 ** Ullrich von Bassewitz, 2012-11-26
* **
* Minimum value of a long. Is used in ascii conversions, since this value ** Minimum value of a long. Is used in ascii conversions, since this value
* has no positive counterpart than can be represented in 32 bits. In C, ** has no positive counterpart than can be represented in 32 bits. In C,
* since the compiler will convert to the correct character set for the ** since the compiler will convert to the correct character set for the
* target platform. ** target platform.
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* _printf.h ** _printf.h
* **
* (C) Copyright 1998 Ullrich von Bassewitz (uz@cc65.org) ** (C) Copyright 1998 Ullrich von Bassewitz (uz@cc65.org)
* **
*/ */
@ -21,9 +21,9 @@ typedef void (*outfunc) (struct outdesc* desc, const char* buf, unsigned count);
/* Control structure passed to the low level worker function. /* Control structure passed to the low level worker function.
* Beware: This function will access the structure on the assembly level, ** Beware: This function will access the structure on the assembly level,
* so check this when altering the structure. ** so check this when altering the structure.
*/ */
struct outdesc { struct outdesc {
int ccount; /* Character counter */ int ccount; /* Character counter */
outfunc fout; /* Routine used to output data */ outfunc fout; /* Routine used to output data */

View File

@ -1,13 +1,13 @@
/* /*
* _scanf.c ** _scanf.c
* **
* (c) Copyright 2001-2005, Ullrich von Bassewitz <uz@cc65.org> ** (c) Copyright 2001-2005, Ullrich von Bassewitz <uz@cc65.org>
* 2005-01-24, Greg King <gngking@erols.com> ** 2005-01-24, Greg King <greg.king5@ver5z6n.net>
* **
* This is the basic layer for all scanf-type functions. It should be ** This is the basic layer for all scanf-type functions. It should be
* rewritten in assembly, at some time in the future. So, some of the code ** rewritten in assembly, at some time in the future. So, some of the code
* is not as elegant as it could be. ** is not as elegant as it could be.
*/ */
@ -76,12 +76,12 @@ static const unsigned char Bits[CHAR_BIT] = {
}; };
/* We need C to be 16 bits since we cannot check for EOF otherwise. /* We need C to be 16 bits since we cannot check for EOF otherwise.
* Unfortunately, this causes the code to be quite larger, even if for most ** Unfortunately, this causes the code to be quite larger, even if for most
* purposes, checking the low byte would be enough, since if C is EOF, the ** purposes, checking the low byte would be enough, since if C is EOF, the
* low byte will not match any useful character anyway (at least for the ** low byte will not match any useful character anyway (at least for the
* supported platforms - I know that this is not portable). So the following ** supported platforms - I know that this is not portable). So the following
* macro is used to access just the low byte of C. ** macro is used to access just the low byte of C.
*/ */
#define CHAR(c) (*((unsigned char*)&(c))) #define CHAR(c) (*((unsigned char*)&(c)))
@ -93,16 +93,16 @@ static const unsigned char Bits[CHAR_BIT] = {
/* We don't want the optimizer to ruin our "perfect" ;-) /* We don't want the optimizer to ruin our "perfect" ;-)
* assembly code! ** assembly code!
*/ */
#pragma optimize (push, off) #pragma optimize (push, off)
static unsigned FindBit (void) static unsigned FindBit (void)
/* Locate the character's bit in the charset array. /* Locate the character's bit in the charset array.
* < .A - Argument character ** < .A - Argument character
* > .X - Offset of the byte in the character-set mask ** > .X - Offset of the byte in the character-set mask
* > .A - Bit-mask ** > .A - Bit-mask
*/ */
{ {
asm ("pha"); asm ("pha");
asm ("lsr a"); /* Divide by CHAR_BIT */ asm ("lsr a"); /* Divide by CHAR_BIT */
@ -250,8 +250,8 @@ static void ReadChar (void)
asm ("stx %v+1", C); asm ("stx %v+1", C);
/* If C is EOF, don't bump the character counter. /* If C is EOF, don't bump the character counter.
* Only the high-byte needs to be checked. ** Only the high-byte needs to be checked.
*/ */
asm ("inx"); asm ("inx");
asm ("beq %g", Done); asm ("beq %g", Done);
@ -311,12 +311,12 @@ static void SkipWhite (void)
static void ReadSign (void) static void ReadSign (void)
/* Read an optional sign and skip it. Store 1 in Positive if the value is /* Read an optional sign and skip it. Store 1 in Positive if the value is
* positive, store 0 otherwise. ** positive, store 0 otherwise.
*/ */
{ {
/* We can ignore the high byte of C here, since if it is EOF, the lower /* We can ignore the high byte of C here, since if it is EOF, the lower
* byte won't match anyway. ** byte won't match anyway.
*/ */
asm ("lda %v", C); asm ("lda %v", C);
asm ("cmp #'-'"); asm ("cmp #'-'");
asm ("bne %g", NotNeg); asm ("bne %g", NotNeg);
@ -380,11 +380,11 @@ static void __fastcall__ ReadInt (unsigned char Base)
static void AssignInt (void) static void AssignInt (void)
/* Assign the integer value in Val to the next argument. The function makes /* Assign the integer value in Val to the next argument. The function makes
* several non-portable assumptions, to reduce code size: ** several non-portable assumptions, to reduce code size:
* - signed and unsigned types have the same representation. ** - signed and unsigned types have the same representation.
* - short and int have the same representation. ** - short and int have the same representation.
* - all pointer types have the same representation. ** - all pointer types have the same representation.
*/ */
{ {
if (NoAssign == false) { if (NoAssign == false) {
@ -416,8 +416,8 @@ Done: ;
static void __fastcall__ ScanInt (unsigned char Base) static void __fastcall__ ScanInt (unsigned char Base)
/* Scan an integer including white space, sign and optional base spec, /* Scan an integer including white space, sign and optional base spec,
* and store it into IntVal. ** and store it into IntVal.
*/ */
{ {
/* Skip whitespace */ /* Skip whitespace */
SkipWhite (); SkipWhite ();
@ -440,8 +440,8 @@ static void __fastcall__ ScanInt (unsigned char Base)
Base = 8; Base = 8;
/* Restart at the beginning of the number because it might /* Restart at the beginning of the number because it might
* be only a single zero digit (which already was read). ** be only a single zero digit (which already was read).
*/ */
PushBack (); PushBack ();
C = '0'; C = '0';
} }
@ -483,8 +483,8 @@ static char GetFormat (void)
int __fastcall__ _scanf (const struct scanfdata* D, int __fastcall__ _scanf (const struct scanfdata* D,
const char* format_, va_list ap_) const char* format_, va_list ap_)
/* This is the routine used to do the actual work. It is called from several /* This is the routine used to do the actual work. It is called from several
* types of wrappers to implement the actual ISO xxscanf functions. ** types of wrappers to implement the actual ISO xxscanf functions.
*/ */
{ {
register char* S; register char* S;
bool HaveWidth; /* True if a width was given */ bool HaveWidth; /* True if a width was given */
@ -492,9 +492,9 @@ int __fastcall__ _scanf (const struct scanfdata* D,
char Start; /* Walks over a range */ char Start; /* Walks over a range */
/* Place copies of the arguments into global variables. This is not very /* Place copies of the arguments into global variables. This is not very
* nice, but on a 6502 platform it gives better code, since the values ** nice, but on a 6502 platform it gives better code, since the values
* do not have to be passed as parameters. ** do not have to be passed as parameters.
*/ */
D_ = D; D_ = D;
format = format_; format = format_;
ap = ap_; ap = ap_;
@ -505,8 +505,8 @@ int __fastcall__ _scanf (const struct scanfdata* D,
CharCount = 0; CharCount = 0;
/* Set up the jump "label". CheckEnd() will use that label when EOF /* Set up the jump "label". CheckEnd() will use that label when EOF
* is reached. ReadInt() will use it when number-conversion fails. ** is reached. ReadInt() will use it when number-conversion fails.
*/ */
if ((unsigned char) setjmp (JumpBuf) == RC_OK) { if ((unsigned char) setjmp (JumpBuf) == RC_OK) {
Again: Again:
@ -523,9 +523,9 @@ Again:
if ((bool) isspace ((int) F)) { if ((bool) isspace ((int) F)) {
/* Special white space handling: Any whitespace in the /* Special white space handling: Any whitespace in the
* format string matches any amount of whitespace including ** format string matches any amount of whitespace including
* none(!). So this match will never fail. ** none(!). So this match will never fail.
*/ */
SkipWhite (); SkipWhite ();
continue; continue;
} }
@ -537,8 +537,8 @@ Percent:
if (C != (int) F) { if (C != (int) F) {
/* A mismatch -- we will stop scanning the input, /* A mismatch -- we will stop scanning the input,
* and return the number of assigned conversions. ** and return the number of assigned conversions.
*/ */
goto NoConv; goto NoConv;
} }
@ -572,18 +572,18 @@ Percent:
if (Width == 0) { if (Width == 0) {
/* Invalid specification */ /* Invalid specification */
/* Note: This method of leaving the function might seem /* Note: This method of leaving the function might seem
* to be crude, but it optimizes very well because ** to be crude, but it optimizes very well because
* the four exits can share this code. ** the four exits can share this code.
*/ */
_seterrno (EINVAL); _seterrno (EINVAL);
Assignments = EOF; Assignments = EOF;
PushBack (); PushBack ();
return Assignments; return Assignments;
} }
/* Increment-and-test makes better code than test-and-decrement /* Increment-and-test makes better code than test-and-decrement
* does. So, change the width into a form that can be used in ** does. So, change the width into a form that can be used in
* that way. ** that way.
*/ */
Width = ~Width; Width = ~Width;
/* 3. Length modifier */ /* 3. Length modifier */
@ -618,9 +618,9 @@ Percent:
/* 4. Conversion specifier */ /* 4. Conversion specifier */
switch (F) { switch (F) {
/* 'd' and 'u' conversions are actually the same, since the /* 'd' and 'u' conversions are actually the same, since the
* standard says that even the 'u' modifier allows an ** standard says that even the 'u' modifier allows an
* optionally signed integer. ** optionally signed integer.
*/ */
case 'd': /* Optionally signed decimal integer */ case 'd': /* Optionally signed decimal integer */
case 'u': case 'u':
ScanInt (10); ScanInt (10);
@ -676,9 +676,9 @@ Percent:
if (NoAssign == false) { if (NoAssign == false) {
S = va_arg (ap, char*); S = va_arg (ap, char*);
/* ## This loop is convenient for us, but it isn't /* ## This loop is convenient for us, but it isn't
* standard C. The standard implies that a failure ** standard C. The standard implies that a failure
* shouldn't put anything into the array argument. ** shouldn't put anything into the array argument.
*/ */
while (++Width) { while (++Width) {
CheckEnd (); /* Is it a matching failure? */ CheckEnd (); /* Is it a matching failure? */
*S++ = C; *S++ = C;
@ -705,8 +705,8 @@ Percent:
} }
if (F == ']') { if (F == ']') {
/* Empty sets aren't allowed; so, a right-bracket /* Empty sets aren't allowed; so, a right-bracket
* at the beginning must be a member of the set. ** at the beginning must be a member of the set.
*/ */
AddCharToSet (F); AddCharToSet (F);
GetFormat (); GetFormat ();
} }
@ -725,8 +725,8 @@ Percent:
break; break;
default: default:
/* Include all characters /* Include all characters
* that are in the range. ** that are in the range.
*/ */
while (1) { while (1) {
AddCharToSet (Start); AddCharToSet (Start);
if (Start == F) { if (Start == F) {
@ -756,9 +756,9 @@ Percent:
} }
/* We have the set in CharSet. Read characters and /* We have the set in CharSet. Read characters and
* store them into a string while they are part of ** store them into a string while they are part of
* the set. ** the set.
*/ */
Match = false; Match = false;
if (NoAssign == false) { if (NoAssign == false) {
S = va_arg (ap, char*); S = va_arg (ap, char*);
@ -782,10 +782,10 @@ Percent:
case 'p': case 'p':
/* Pointer, general format is 0xABCD. /* Pointer, general format is 0xABCD.
* %hhp --> zero-page pointer ** %hhp --> zero-page pointer
* %hp --> near pointer ** %hp --> near pointer
* %lp --> far pointer ** %lp --> far pointer
*/ */
SkipWhite (); SkipWhite ();
if (CHAR (C) != '0') { if (CHAR (C) != '0') {
goto NoConv; goto NoConv;
@ -806,8 +806,8 @@ Percent:
case 'n': case 'n':
/* Store the number of characters consumed so far /* Store the number of characters consumed so far
* (the read-ahead character hasn't been consumed). ** (the read-ahead character hasn't been consumed).
*/ */
IntVal = (long) (CharCount - (C == EOF ? 0u : 1u)); IntVal = (long) (CharCount - (C == EOF ? 0u : 1u));
AssignInt (); AssignInt ();
/* Don't count it. */ /* Don't count it. */
@ -849,9 +849,9 @@ Percent:
NoConv: NoConv:
/* Coming here means a failure. If that happens at EOF, with no /* Coming here means a failure. If that happens at EOF, with no
* conversion attempts, then it is considered an error; otherwise, ** conversion attempts, then it is considered an error; otherwise,
* the number of assignments is returned (the default behaviour). ** the number of assignments is returned (the default behaviour).
*/ */
if (C == EOF && Converted == false) { if (C == EOF && Converted == false) {
Assignments = EOF; /* Special case: error */ Assignments = EOF; /* Special case: error */
} }

View File

@ -1,9 +1,9 @@
/* /*
* _scanf.h ** _scanf.h
* **
* (c) Copyright 2004, Ullrich von Bassewitz <uz@cc65.org> ** (c) Copyright 2004, Ullrich von Bassewitz <uz@cc65.org>
* **
*/ */
@ -13,8 +13,8 @@
/* Type of the function that is called to input data. The function will /* Type of the function that is called to input data. The function will
* return EOF if no more data is available. ** return EOF if no more data is available.
*/ */
typedef int __fastcall__ (*getfunc) (void* data); typedef int __fastcall__ (*getfunc) (void* data);
/* Type of the function that is called to put back unused data */ /* Type of the function that is called to put back unused data */
@ -23,9 +23,9 @@ typedef int __fastcall__ (*ungetfunc) (int c, void* data);
/* Control structure passed to the low level worker function. /* Control structure passed to the low level worker function.
* Beware: This structure is mirrored in the _scanf.inc assembler include ** Beware: This structure is mirrored in the _scanf.inc assembler include
* file, so check this when altering the structure. ** file, so check this when altering the structure.
*/ */
struct scanfdata { struct scanfdata {
getfunc get; /* Pointer to input routine */ getfunc get; /* Pointer to input routine */
ungetfunc unget; /* Pointer to pushback routine */ ungetfunc unget; /* Pointer to pushback routine */

View File

@ -1,8 +1,8 @@
/* /*
* abort.c ** abort.c
* **
* Ullrich von Bassewitz, 02.06.1998 ** Ullrich von Bassewitz, 02.06.1998
*/ */

View File

@ -1,8 +1,8 @@
/* /*
* bsearch.c ** bsearch.c
* **
* Ullrich von Bassewitz, 17.06.1998 ** Ullrich von Bassewitz, 17.06.1998
*/ */
@ -33,9 +33,9 @@ void* __fastcall__ bsearch (const void* key, const void* base, size_t n,
last = current - 1; last = current - 1;
if (result == 0) { if (result == 0) {
/* Found one entry that matches the search key. However there may be /* Found one entry that matches the search key. However there may be
* more than one entry with the same key value and ANSI guarantees ** more than one entry with the same key value and ANSI guarantees
* that we return the first of a row of items with the same key. ** that we return the first of a row of items with the same key.
*/ */
found = 1; found = 1;
} }
} }

View File

@ -12,8 +12,8 @@
; ---------------------------------------------------------------------------- ; ----------------------------------------------------------------------------
; int __fastcall__ _directerrno (unsigned char code); ; int __fastcall__ _directerrno (unsigned char code);
; /* Set errno to a specific error code, clear _oserror and return -1. Used ; /* Set errno to a specific error code, clear _oserror and return -1. Used
; * by the library. ; ** by the library.
; */ ; */
__directerrno: __directerrno:
jsr __seterrno ; Set errno, returns with A = 0 jsr __seterrno ; Set errno, returns with A = 0
@ -23,10 +23,10 @@ __directerrno:
; ---------------------------------------------------------------------------- ; ----------------------------------------------------------------------------
; int __fastcall__ _mappederrno (unsigned char code); ; int __fastcall__ _mappederrno (unsigned char code);
; /* Set _oserror to the given platform specific error code. If it is a real ; /* 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 ; ** error code (not zero) set errno to the corresponding system error code
; * and return -1. Otherwise return zero. ; ** and return -1. Otherwise return zero.
; * Used by the library. ; ** Used by the library.
; */ ; */
__mappederrno: __mappederrno:
sta __oserror ; Store the error code sta __oserror ; Store the error code

View File

@ -1,11 +1,8 @@
/* /*
* errormsg.c ** errormsg.c
* **
* Ullrich von Bassewitz, 17.05.2000 ** Ullrich von Bassewitz, 17.05.2000
* */
* Must be a C function, since we have otherwise problems with the different
* character sets.
*/

View File

@ -1,8 +1,8 @@
/* /*
* fdopen.c ** fdopen.c
* **
* Ullrich von Bassewitz, 17.06.1998 ** Ullrich von Bassewitz, 17.06.1998
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* fgetc.c ** fgetc.c
* **
* (C) Copyright 1998, 2002 Ullrich von Bassewitz (uz@cc65.org) ** (C) Copyright 1998, 2002 Ullrich von Bassewitz (uz@cc65.org)
* **
*/ */

View File

@ -1,8 +1,8 @@
/* /*
* fgetpos.c ** fgetpos.c
* **
* Christian Groessler, 07-Aug-2000 ** Christian Groessler, 07-Aug-2000
*/ */

View File

@ -1,8 +1,8 @@
/* /*
* Ullrich von Bassewitz, 11.08.1998 ** Ullrich von Bassewitz, 11.08.1998
* **
* char* fgets (char* s, int size, FILE* f); ** char* fgets (char* s, int size, FILE* f);
*/ */

View File

@ -1,8 +1,8 @@
/* /*
* fputc.c ** fputc.c
* **
* Ullrich von Bassewitz, 02.06.1998 ** Ullrich von Bassewitz, 02.06.1998
*/ */

View File

@ -1,8 +1,8 @@
/* /*
* int fputs (const char* s, FILE* f); ** int fputs (const char* s, FILE* f);
* **
* Ullrich von Bassewitz, 11.08.1998 ** Ullrich von Bassewitz, 11.08.1998
*/ */

View File

@ -10,8 +10,8 @@
; ;
; void free (void* block) ; void free (void* block)
; /* Release an allocated memory block. The function will accept NULL pointers ; /* Release an allocated memory block. The function will accept NULL pointers
; * (and do nothing in this case). ; ** (and do nothing in this case).
; */ ; */
; { ; {
; unsigned* b; ; unsigned* b;
; unsigned size; ; unsigned size;
@ -34,8 +34,8 @@
; _hptr = (unsigned*) (((int) _hptr) - size); ; _hptr = (unsigned*) (((int) _hptr) - size);
; ;
; /* Check if the last block in the freelist is now at heap top. If so, ; /* Check if the last block in the freelist is now at heap top. If so,
; * remove this block from the freelist. ; ** remove this block from the freelist.
; */ ; */
; if (f = _hlast) { ; if (f = _hlast) {
; if (((int) f) + f->size == (int) _hptr) { ; if (((int) f) + f->size == (int) _hptr) {
; /* Remove the last block */ ; /* Remove the last block */
@ -185,10 +185,10 @@ _free: sta ptr2
; ;
; void _hadd (void* mem, size_t size) ; void _hadd (void* mem, size_t size)
; /* Add an arbitrary memory block to the heap. This function is used by ; /* Add an arbitrary memory block to the heap. This function is used by
; * free(), but it does also allow usage of otherwise unused memory ; ** free(), but it does also allow usage of otherwise unused memory
; * blocks as heap space. The given block is entered in the free list ; ** blocks as heap space. The given block is entered in the free list
; * without any checks, so beware! ; ** without any checks, so beware!
; */ ; */
; { ; {
; struct freeblock* f; ; struct freeblock* f;
; struct freeblock* left; ; struct freeblock* left;
@ -212,10 +212,10 @@ _free: sta ptr2
; } else { ; } else {
; ;
; /* We have to search the free list. As we are doing so, we check ; /* We have to search the free list. As we are doing so, we check
; * if it is possible to combine this block with another already ; ** if it is possible to combine this block with another already
; * existing block. Beware: The block may be the "missing link" ; ** existing block. Beware: The block may be the "missing link"
; * between *two* other blocks. ; ** between *two* other blocks.
; */ ; */
; left = 0; ; left = 0;
; right = _hfirst; ; right = _hfirst;
; while (right && f > right) { ; while (right && f > right) {
@ -224,10 +224,10 @@ _free: sta ptr2
; } ; }
; ;
; ;
; /* Ok, the current block must be inserted between left and right (but ; /* OK, the current block must be inserted between left and right (but
; * beware: one of the two may be zero!). Also check for the condition ; ** beware: one of the two may be zero!). Also check for the condition
; * that we have to merge two or three blocks. ; ** that we have to merge two or three blocks.
; */ ; */
; if (right) { ; if (right) {
; /* Check if we must merge the block with the right one */ ; /* Check if we must merge the block with the right one */
; if (((unsigned) f) + size == (unsigned) right) { ; if (((unsigned) f) + size == (unsigned) right) {

View File

@ -1,8 +1,8 @@
/* /*
* freopen.c ** freopen.c
* **
* Ullrich von Bassewitz, 17.06.1998 ** Ullrich von Bassewitz, 17.06.1998
*/ */
@ -28,8 +28,8 @@ FILE* __fastcall__ freopen (const char* name, const char* mode, FILE* f)
} }
/* Close the file. Don't bother setting the flag, it will get /* Close the file. Don't bother setting the flag, it will get
* overwritten by _fopen. ** overwritten by _fopen.
*/ */
if (close (f->f_fd) < 0) { if (close (f->f_fd) < 0) {
/* An error occured, errno is already set */ /* An error occured, errno is already set */
return 0; return 0;

View File

@ -27,8 +27,8 @@ ParamSize: .res 1 ; Number of parameter bytes
; va_start (ap, format); ; va_start (ap, format);
; ;
; /* Call vfscanf(). Since we know that va_end won't do anything, we will ; /* Call vfscanf(). Since we know that va_end won't do anything, we will
; * save the call and return the value directly. ; ** save the call and return the value directly.
; */ ; */
; return vfscanf (f, format, ap); ; return vfscanf (f, format, ap);
; } ; }
; ;

View File

@ -1,9 +1,9 @@
/* /*
* fseek.c ** fseek.c
* **
* Christian Groessler, 2000-08-07 ** Christian Groessler, 2000-08-07
* Ullrich von Bassewitz, 2004-05-12 ** Ullrich von Bassewitz, 2004-05-12
*/ */
@ -31,8 +31,8 @@ int __fastcall__ fseek (register FILE* f, long offset, int whence)
} }
/* If we have a pushed back character, and whence is relative to the /* If we have a pushed back character, and whence is relative to the
* current position, correct the offset. ** current position, correct the offset.
*/ */
if ((f->f_flags & _FPUSHBACK) && whence == SEEK_CUR) { if ((f->f_flags & _FPUSHBACK) && whence == SEEK_CUR) {
--offset; --offset;
} }
@ -41,11 +41,11 @@ int __fastcall__ fseek (register FILE* f, long offset, int whence)
res = lseek(f->f_fd, offset, whence); res = lseek(f->f_fd, offset, whence);
/* If the seek was successful. Discard any effects of the ungetc function, /* If the seek was successful. Discard any effects of the ungetc function,
* and clear the end-of-file indicator. Otherwise set the error indicator ** and clear the end-of-file indicator. Otherwise set the error indicator
* on the stream, and return -1. We will check for >= 0 here, because that ** on the stream, and return -1. We will check for >= 0 here, because that
* saves some code, and we don't have files with 2 gigabytes in size ** saves some code, and we don't have files with 2 gigabytes in size
* anyway:-) ** anyway:-)
*/ */
if (res >= 0) { if (res >= 0) {
f->f_flags &= ~(_FEOF | _FPUSHBACK); f->f_flags &= ~(_FEOF | _FPUSHBACK);
return 0; return 0;

View File

@ -1,8 +1,8 @@
/* /*
* fsetpos.c ** fsetpos.c
* **
* Christian Groessler, 07-Aug-2000 ** Christian Groessler, 07-Aug-2000
*/ */

View File

@ -1,9 +1,9 @@
/* /*
* ftell.c ** ftell.c
* **
* Christian Groessler, 2000-08-07 ** Christian Groessler, 2000-08-07
* Ullrich von Bassewitz, 2004-05-13 ** Ullrich von Bassewitz, 2004-05-13
*/ */
@ -34,8 +34,8 @@ long __fastcall__ ftell (register FILE* f)
pos = lseek (f->f_fd, 0L, SEEK_CUR); pos = lseek (f->f_fd, 0L, SEEK_CUR);
/* If we didn't have an error, correct the return value in case we have /* If we didn't have an error, correct the return value in case we have
* a pushed back character. ** a pushed back character.
*/ */
if (pos > 0 && (f->f_flags & _FPUSHBACK)) { if (pos > 0 && (f->f_flags & _FPUSHBACK)) {
--pos; --pos;
} }

View File

@ -1,8 +1,8 @@
/* /*
* getchar.c ** getchar.c
* **
* Ullrich von Bassewitz, 11.12.1998 ** Ullrich von Bassewitz, 11.12.1998
*/ */

View File

@ -1,17 +1,17 @@
/* /*
* This is part of a changed public domain getopt implementation that ** This is part of a changed public domain getopt implementation that
* had the following text on top: ** had the following text on top:
* **
* I got this off net.sources from Henry Spencer. ** I got this off net.sources from Henry Spencer.
* It is a public domain getopt(3) like in System V. ** It is a public domain getopt(3) like in System V.
* I have made the following modifications: ** I have made the following modifications:
* **
* A test main program was added, ifdeffed by GETOPT. ** A test main program was added, ifdeffed by GETOPT.
* This main program is a public domain implementation ** This main program is a public domain implementation
* of the getopt(1) program like in System V. The getopt ** of the getopt(1) program like in System V. The getopt
* program can be used to standardize shell option handling. ** program can be used to standardize shell option handling.
* e.g. cc -DGETOPT getopt.c -o getopt ** e.g. cc -DGETOPT getopt.c -o getopt
*/ */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -1,8 +1,8 @@
/* /*
* gets.c ** gets.c
* **
* Ullrich von Bassewitz, 11.08.1998 ** Ullrich von Bassewitz, 11.08.1998
*/ */

View File

@ -1,8 +1,8 @@
/* /*
* locale.c ** locale.c
* **
* Ullrich von Bassewitz, 11.12.1998 ** Ullrich von Bassewitz, 11.12.1998
*/ */

View File

@ -55,9 +55,9 @@ struct tm* __fastcall__ localtime (const time_t* timep)
} }
/* Since our ints are just 16 bits, split the given time into seconds, /* Since our ints are just 16 bits, split the given time into seconds,
* hours and days. Each of the values will fit in a 16 bit variable. ** hours and days. Each of the values will fit in a 16 bit variable.
* The mktime routine will then do the rest. ** The mktime routine will then do the rest.
*/ */
timebuf.tm_sec = t % 3600; timebuf.tm_sec = t % 3600;
timebuf.tm_min = 0; timebuf.tm_min = 0;
timebuf.tm_hour = (t / 3600) % 24; timebuf.tm_hour = (t / 3600) % 24;

View File

@ -10,17 +10,17 @@
; ;
; void* malloc (size_t size) ; void* malloc (size_t size)
; /* Allocate memory from the given heap. The function returns a pointer to the ; /* Allocate memory from the given heap. The function returns a pointer to the
; * allocated memory block or a NULL pointer if not enough memory is available. ; ** allocated memory block or a NULL pointer if not enough memory is available.
; * Allocating a zero size block is not allowed. ; ** Allocating a zero size block is not allowed.
; */ ; */
; { ; {
; struct freeblock* f; ; struct freeblock* f;
; unsigned* p; ; unsigned* p;
; ;
; ;
; /* Check for a size of zero, then add the administration space and round ; /* Check for a size of zero, then add the administration space and round
; * up the size if needed. ; ** up the size if needed.
; */ ; */
; if (size == 0) { ; if (size == 0) {
; return 0; ; return 0;
; } ; }
@ -39,10 +39,10 @@
; if (f) { ; if (f) {
; ;
; /* We found a block big enough. If the block can hold just the ; /* We found a block big enough. If the block can hold just the
; * requested size, use the block in full. Beware: When slicing blocks, ; ** requested size, use the block in full. Beware: When slicing blocks,
; * there must be space enough to create a new one! If this is not the ; ** there must be space enough to create a new one! If this is not the
; * case, then use the complete block. ; ** case, then use the complete block.
; */ ; */
; if (f->size - size < sizeof (struct freeblock)) { ; if (f->size - size < sizeof (struct freeblock)) {
; ;
; /* Use the actual size */ ; /* Use the actual size */
@ -66,9 +66,9 @@
; ;
; } else { ; } else {
; ;
; /* We must slice the block found. Cut off space from the upper ; /* We must slice the block found. Cut off space from the upper
; * end, so we can leave the actual free block chain intact. ; ** end, so we can leave the actual free block chain intact.
; */ ; */
; ;
; /* Decrement the size of the block */ ; /* Decrement the size of the block */
; f->size -= size; ; f->size -= size;
@ -84,8 +84,8 @@
; } else { ; } else {
; ;
; /* We did not find a block big enough. Try to use new space from the ; /* We did not find a block big enough. Try to use new space from the
; * heap top. ; ** heap top.
; */ ; */
; if (((unsigned) _hend) - ((unsigned) _hptr) < size) { ; if (((unsigned) _hend) - ((unsigned) _hptr) < size) {
; /* Out of heap space */ ; /* Out of heap space */
; return 0; ; return 0;

View File

@ -77,9 +77,9 @@ static unsigned char __fastcall__ IsLeapYear (unsigned Year)
time_t __fastcall__ mktime (register struct tm* TM) time_t __fastcall__ mktime (register struct tm* TM)
/* Make a time in seconds since 1/1/1970 from the broken down time in TM. /* Make a time in seconds since 1/1/1970 from the broken down time in TM.
* A call to mktime does also correct the time in TM to contain correct ** A call to mktime does also correct the time in TM to contain correct
* values. ** values.
*/ */
{ {
register div_t D; register div_t D;
int Max; int Max;
@ -118,8 +118,8 @@ time_t __fastcall__ mktime (register struct tm* TM)
TM->tm_mday += D.quot; TM->tm_mday += D.quot;
/* Adjust month and year. This is an iterative process, since changing /* Adjust month and year. This is an iterative process, since changing
* the month will change the allowed days for this month. ** the month will change the allowed days for this month.
*/ */
while (1) { while (1) {
/* Make sure, month is in the range 0..11 */ /* Make sure, month is in the range 0..11 */
@ -131,8 +131,8 @@ time_t __fastcall__ mktime (register struct tm* TM)
TM->tm_year += D.quot; TM->tm_year += D.quot;
/* Now check if mday is in the correct range, if not, correct month /* Now check if mday is in the correct range, if not, correct month
* and eventually year and repeat the process. ** and eventually year and repeat the process.
*/ */
if (TM->tm_mon == FEBRUARY && IsLeapYear (TM->tm_year + 1900)) { if (TM->tm_mon == FEBRUARY && IsLeapYear (TM->tm_year + 1900)) {
Max = 29; Max = 29;
} else { } else {
@ -154,18 +154,18 @@ time_t __fastcall__ mktime (register struct tm* TM)
} }
/* Ok, all time/date fields are now correct. Calculate the days in this /* Ok, all time/date fields are now correct. Calculate the days in this
* year. ** year.
*/ */
TM->tm_yday = MonthDays[TM->tm_mon] + TM->tm_mday - 1; TM->tm_yday = MonthDays[TM->tm_mon] + TM->tm_mday - 1;
if (TM->tm_mon > FEBRUARY && IsLeapYear (TM->tm_year + 1900)) { if (TM->tm_mon > FEBRUARY && IsLeapYear (TM->tm_year + 1900)) {
++TM->tm_yday; ++TM->tm_yday;
} }
/* Calculate days since 1/1/1970. In the complete epoch (1/1/1970 to /* Calculate days since 1/1/1970. In the complete epoch (1/1/1970 to
* somewhere in 2038) all years dividable by 4 are leap years, so ** somewhere in 2038) all years dividable by 4 are leap years, so
* dividing by 4 gives the days that must be added cause of leap years. ** dividing by 4 gives the days that must be added cause of leap years.
* (and the last leap year before 1970 was 1968) ** (and the last leap year before 1970 was 1968)
*/ */
DayCount = ((unsigned) (TM->tm_year-70)) * 365U + DayCount = ((unsigned) (TM->tm_year-70)) * 365U +
(((unsigned) (TM->tm_year-(68+1))) / 4) + (((unsigned) (TM->tm_year-(68+1))) / 4) +
TM->tm_yday; TM->tm_yday;

View File

@ -7,7 +7,7 @@
/* */ /* */
/* */ /* */
/* (C) 2004-2005 Ullrich von Bassewitz */ /* (C) 2004-2005 Ullrich von Bassewitz */
/* Römerstrasse 52 */ /* Roemerstrasse 52 */
/* D-70794 Filderstadt */ /* D-70794 Filderstadt */
/* EMail: uz@cc65.org */ /* EMail: uz@cc65.org */
/* */ /* */
@ -43,23 +43,23 @@
/* This is a very simple version of an aligned memory allocator. We will /* This is a very simple version of an aligned memory allocator. We will
* allocate a greater block, so that we can place the aligned block (that is ** allocate a greater block, so that we can place the aligned block (that is
* returned) within it. We use our knowledge about the internal heap ** returned) within it. We use our knowledge about the internal heap
* structures to free the unused parts of the bigger block (the two chunks ** structures to free the unused parts of the bigger block (the two chunks
* below and above the aligned block). ** below and above the aligned block).
*/ */
int __fastcall__ posix_memalign (void** memptr, size_t alignment, size_t size) int __fastcall__ posix_memalign (void** memptr, size_t alignment, size_t size)
/* Allocate a block of memory with the given "size", which is aligned to a /* Allocate a block of memory with the given "size", which is aligned to a
* memory address that is a multiple of "alignment". "alignment" MUST NOT be ** memory address that is a multiple of "alignment". "alignment" MUST NOT be
* zero, and MUST be a power of two; otherwise, this function will return ** zero, and MUST be a power of two; otherwise, this function will return
* EINVAL. The function returns ENOMEM if not enough memory is available ** EINVAL. The function returns ENOMEM if not enough memory is available
* to satisfy the request. "memptr" must point to a variable; that variable ** to satisfy the request. "memptr" must point to a variable; that variable
* will return the address of the allocated memory. Use free() to release that ** will return the address of the allocated memory. Use free() to release that
* allocated block. ** allocated block.
*/ */
{ {
size_t rawsize; size_t rawsize;
size_t uppersize; size_t uppersize;
@ -81,11 +81,11 @@ int __fastcall__ posix_memalign (void** memptr, size_t alignment, size_t size)
} }
/* Augment the block size up to the alignment, and allocate memory. /* Augment the block size up to the alignment, and allocate memory.
* We don't need to account for the additional admin. data that's needed to ** We don't need to account for the additional admin. data that's needed to
* manage the used block, because the block returned by malloc() has that ** manage the used block, because the block returned by malloc() has that
* overhead added one time; and, the worst thing that might happen is that ** overhead added one time; and, the worst thing that might happen is that
* we cannot free the upper and lower blocks. ** we cannot free the upper and lower blocks.
*/ */
b = malloc (size + alignment); b = malloc (size + alignment);
/* Handle out-of-memory */ /* Handle out-of-memory */
@ -95,26 +95,26 @@ int __fastcall__ posix_memalign (void** memptr, size_t alignment, size_t size)
} }
/* Create (and return) a new pointer that points to the user-visible /* Create (and return) a new pointer that points to the user-visible
* aligned block. ** aligned block.
*/ */
u = *memptr = (struct usedblock*) (((unsigned)b + alignment) & ~alignment); u = *memptr = (struct usedblock*) (((unsigned)b + alignment) & ~alignment);
/* Get a pointer to the (raw) upper block */ /* Get a pointer to the (raw) upper block */
p = (struct usedblock*) ((char*)u + size); p = (struct usedblock*) ((char*)u + size);
/* Get the raw-block pointer, which is located just below the visible /* Get the raw-block pointer, which is located just below the visible
* unaligned block. The first word of this raw block is the total size ** unaligned block. The first word of this raw block is the total size
* of the block, including the admin. space. ** of the block, including the admin. space.
*/ */
b = (b-1)->start; b = (b-1)->start;
rawsize = b->size; rawsize = b->size;
/* Check if we can free the space above the user block. That is the case /* Check if we can free the space above the user block. That is the case
* if the size of the block is at least sizeof (struct freeblock) bytes, ** if the size of the block is at least sizeof (struct freeblock) bytes,
* and the size of the remaining block is at least that size, too. ** and the size of the remaining block is at least that size, too.
* If the upper block is smaller, then we just will pass it to the caller, ** If the upper block is smaller, then we just will pass it to the caller,
* together with the requested aligned block. ** together with the requested aligned block.
*/ */
uppersize = rawsize - (lowersize = (char*)p - (char*)b); uppersize = rawsize - (lowersize = (char*)p - (char*)b);
if (uppersize >= sizeof (struct freeblock) && if (uppersize >= sizeof (struct freeblock) &&
lowersize >= sizeof (struct freeblock)) { lowersize >= sizeof (struct freeblock)) {
@ -131,20 +131,20 @@ int __fastcall__ posix_memalign (void** memptr, size_t alignment, size_t size)
} }
/* Check if we can free the space below the user block. That is the case /* Check if we can free the space below the user block. That is the case
* if the size of the block is at least sizeof (struct freeblock) bytes, ** if the size of the block is at least sizeof (struct freeblock) bytes,
* and the size of the remaining block is at least that size, too. If the ** and the size of the remaining block is at least that size, too. If the
* lower block is smaller, we just will pass it to the caller, together ** lower block is smaller, we just will pass it to the caller, together
* with the requested aligned block. ** with the requested aligned block.
* Beware: We need an additional struct usedblock, in the lower block, ** Beware: We need an additional struct usedblock, in the lower block,
* which is part of the block that is passed back to the caller. ** which is part of the block that is passed back to the caller.
*/ */
lowersize = ((char*)u - (char*)b) - sizeof (struct usedblock); lowersize = ((char*)u - (char*)b) - sizeof (struct usedblock);
if ( lowersize >= sizeof (struct freeblock) && if ( lowersize >= sizeof (struct freeblock) &&
(rawsize - lowersize) >= sizeof (struct freeblock)) { (rawsize - lowersize) >= sizeof (struct freeblock)) {
/* b already points to the raw lower-block. /* b already points to the raw lower-block.
* Set up the usedblock structure. ** Set up the usedblock structure.
*/ */
b->size = lowersize; b->size = lowersize;
b->start = b; b->start = b;
@ -159,11 +159,11 @@ int __fastcall__ posix_memalign (void** memptr, size_t alignment, size_t size)
} }
/* u points to the user-visible block, while b points to the raw block, /* u points to the user-visible block, while b points to the raw block,
* and rawsize contains the length of the raw block. Set up the usedblock ** and rawsize contains the length of the raw block. Set up the usedblock
* structure, but beware: If we didn't free the lower block, then it is ** structure, but beware: If we didn't free the lower block, then it is
* split; which means that we must use b to write the size, ** split; which means that we must use b to write the size,
* and u to write the start field. ** and u to write the start field.
*/ */
b->size = rawsize; b->size = rawsize;
(u-1)->start = b; (u-1)->start = b;

View File

@ -1,8 +1,8 @@
/* /*
* puts.c ** puts.c
* **
* Ullrich von Bassewitz, 11.08.1998 ** Ullrich von Bassewitz, 11.08.1998
*/ */

View File

@ -1,8 +1,8 @@
/* /*
* qsort.c ** qsort.c
* **
* Ullrich von Bassewitz, 09.12.1998 ** Ullrich von Bassewitz, 09.12.1998
*/ */
@ -14,8 +14,8 @@ static void QuickSort (register unsigned char* Base, int Lo, int Hi,
register size_t Size, register size_t Size,
int (*Compare)(const void*, const void*)) int (*Compare)(const void*, const void*))
/* Internal recursive function. Works with ints, but this shouldn't be /* Internal recursive function. Works with ints, but this shouldn't be
* a problem. ** a problem.
*/ */
{ {
int I, J; int I, J;
@ -62,5 +62,3 @@ void __fastcall__ qsort (void* base, size_t nmemb, size_t size,

View File

@ -66,10 +66,10 @@ void* __fastcall__ realloc (void* block, register size_t size)
} }
/* The word below the user block contains a pointer to the start of the /* The word below the user block contains a pointer to the start of the
* raw memory block. The first word of this raw memory block is the full ** raw memory block. The first word of this raw memory block is the full
* size of the block. Get a pointer to the real block, get the old block ** size of the block. Get a pointer to the real block, get the old block
* size. ** size.
*/ */
b = (((struct usedblock*) block) - 1)->start; b = (((struct usedblock*) block) - 1)->start;
oldsize = b->size; oldsize = b->size;
@ -87,16 +87,16 @@ void* __fastcall__ realloc (void* block, register size_t size)
} }
/* The given block was not located on top of the heap, or there's no /* The given block was not located on top of the heap, or there's no
* room left. Try to allocate a new block and copy the data. ** room left. Try to allocate a new block and copy the data.
*/ */
if (newblock = malloc (size)) { if (newblock = malloc (size)) {
/* Adjust the old size to the user visible portion */ /* Adjust the old size to the user visible portion */
oldsize -= HEAP_ADMIN_SPACE; oldsize -= HEAP_ADMIN_SPACE;
/* If the new block is larger than the old one, copy the old /* If the new block is larger than the old one, copy the old
* data only ** data only
*/ */
if (size > oldsize) { if (size > oldsize) {
size = oldsize; size = oldsize;
} }
@ -110,4 +110,3 @@ void* __fastcall__ realloc (void* block, register size_t size)

View File

@ -1,8 +1,8 @@
/* /*
* rewind.c ** rewind.c
* **
* Christian Groessler, 07-Aug-2000 ** Christian Groessler, 07-Aug-2000
*/ */

View File

@ -1,10 +1,10 @@
/* /*
* sleep.c ** sleep.c
* **
* Stefan Haubenthal, 2003-06-11 ** Stefan Haubenthal, 2003-06-11
* Ullrich von Bassewitz, 2003-06-12 ** Ullrich von Bassewitz, 2003-06-12
* **
*/ */

View File

@ -28,8 +28,8 @@ ParamSize: .res 1 ; Number of parameter bytes
; va_start (ap, format); ; va_start (ap, format);
; ;
; /* Call vsscanf(). Since we know that va_end won't do anything, we will ; /* Call vsscanf(). Since we know that va_end won't do anything, we will
; * save the call and return the value directly. ; ** save the call and return the value directly.
; */ ; */
; return vsscanf (str, format, ap); ; return vsscanf (str, format, ap);
; } ; }
; ;

View File

@ -1,15 +1,15 @@
/* /*
* strqtok() is like strtok(): It finds pieces of text, in a string, that are ** strqtok() is like strtok(): It finds pieces of text, in a string, that are
* surrounded by given delimiter characters. It returns each piece, in turn, ** surrounded by given delimiter characters. It returns each piece, in turn,
* as a string, until every piece has been found. Then, it returns NULL. But, ** as a string, until every piece has been found. Then, it returns NULL. But,
* strqtok() recognizes quotation marks. A mark makes delimiters look ordinary ** strqtok() recognizes quotation marks. A mark makes delimiters look ordinary
* until another quotation mark is seen. That allows us to include delimiters ** until another quotation mark is seen. That allows us to include delimiters
* in tokens. (This version doesn't allow escaped quotation marks.) ** in tokens. (This version doesn't allow escaped quotation marks.)
* **
* 2014-04-19, Daniel Serpell ** 2014-04-19, Daniel Serpell
* 2014-04-21, Paul Foerster ** 2014-04-21, Paul Foerster
* 2014-04-25, Greg King ** 2014-04-25, Greg King
*/ */
#include <string.h> #include <string.h>
@ -49,8 +49,8 @@ char* __fastcall__ strqtok (register char* s1, const char* s2)
} }
if (c == '\0') { if (c == '\0') {
/* The end of the last token is the end of the token list; /* The end of the last token is the end of the token list;
* don't go beyond it. ** don't go beyond it.
*/ */
goto found; goto found;
} }
@ -70,8 +70,8 @@ char* __fastcall__ strqtok (register char* s1, const char* s2)
/* Search for the end of a quoted token. */ /* Search for the end of a quoted token. */
if ((s1 = strchr (s1, '\"')) == NULL) { if ((s1 = strchr (s1, '\"')) == NULL) {
/* The quoted token ended with '\0'; therefore, point to a '\0', /* The quoted token ended with '\0'; therefore, point to a '\0',
* so that the next call will return NULL. ** so that the next call will return NULL.
*/ */
next = ""; next = "";
return start; return start;
} }

View File

@ -1,8 +1,8 @@
/* /*
* strtok.c ** strtok.c
* **
* Ullrich von Bassewitz, 11.12.1998 ** Ullrich von Bassewitz, 11.12.1998
*/ */
@ -43,8 +43,8 @@ char* __fastcall__ strtok (register char* s1, const char* s2)
} }
/* Search the address of the first element in s1 that equals none /* Search the address of the first element in s1 that equals none
* of the characters in s2. ** of the characters in s2.
*/ */
while ((c = *s1) && strchr (s2, c) != 0) { while ((c = *s1) && strchr (s2, c) != 0) {
++s1; ++s1;
} }

View File

@ -33,8 +33,8 @@ long __fastcall__ strtol (const char* nptr, char** endptr, int base)
} }
/* If base is zero, we may have a 0 or 0x prefix. If base is 16, we may /* If base is zero, we may have a 0 or 0x prefix. If base is 16, we may
* have a 0x prefix. ** have a 0x prefix.
*/ */
if (base == 0) { if (base == 0) {
if (*S == '0') { if (*S == '0') {
++S; ++S;
@ -52,8 +52,8 @@ long __fastcall__ strtol (const char* nptr, char** endptr, int base)
} }
/* Determine the maximum valid number and (if the number is equal to this /* Determine the maximum valid number and (if the number is equal to this
* value) the maximum valid digit. ** value) the maximum valid digit.
*/ */
if (Minus) { if (Minus) {
MaxVal = LONG_MIN; MaxVal = LONG_MIN;
} else { } else {
@ -98,8 +98,8 @@ long __fastcall__ strtol (const char* nptr, char** endptr, int base)
} }
/* Store the end pointer. If no conversion was performed, the value of /* Store the end pointer. If no conversion was performed, the value of
* nptr is returned in endptr. ** nptr is returned in endptr.
*/ */
if (endptr) { if (endptr) {
if (CvtCount > 0) { if (CvtCount > 0) {
*endptr = (char*) S; *endptr = (char*) S;

View File

@ -33,8 +33,8 @@ unsigned long __fastcall__ strtoul (const char* nptr, char** endptr, int base)
} }
/* If base is zero, we may have a 0 or 0x prefix. If base is 16, we may /* If base is zero, we may have a 0 or 0x prefix. If base is 16, we may
* have a 0x prefix. ** have a 0x prefix.
*/ */
if (base == 0) { if (base == 0) {
if (*S == '0') { if (*S == '0') {
++S; ++S;
@ -52,8 +52,8 @@ unsigned long __fastcall__ strtoul (const char* nptr, char** endptr, int base)
} }
/* Determine the maximum valid number and (if the number is equal to this /* Determine the maximum valid number and (if the number is equal to this
* value) the maximum valid digit. ** value) the maximum valid digit.
*/ */
MaxDigit = ULONG_MAX % base; MaxDigit = ULONG_MAX % base;
MaxVal = ULONG_MAX / base; MaxVal = ULONG_MAX / base;
@ -93,8 +93,8 @@ unsigned long __fastcall__ strtoul (const char* nptr, char** endptr, int base)
} }
/* Store the end pointer. If no conversion was performed, the value of /* Store the end pointer. If no conversion was performed, the value of
* nptr is returned in endptr. ** nptr is returned in endptr.
*/ */
if (endptr) { if (endptr) {
if (CvtCount > 0) { if (CvtCount > 0) {
*endptr = (char*) S; *endptr = (char*) S;

View File

@ -1,8 +1,8 @@
/* /*
* strxfrm.c ** strxfrm.c
* **
* Ullrich von Bassewitz, 11.12.1998 ** Ullrich von Bassewitz, 11.12.1998
*/ */

Some files were not shown because too many files have changed in this diff Show More