mirror of
https://github.com/cc65/cc65.git
synced 2024-12-21 05:29:52 +00:00
Merge branch 'master' into fptest
This commit is contained in:
commit
3cfcdf94d1
@ -204,6 +204,18 @@ char* nextLine (FILE* f);
|
||||
|
||||
### Header files
|
||||
|
||||
* All Headers should start with a copyright/license banner
|
||||
* Function prototypes must be a single line, not contain the redundant
|
||||
"extern" keyword, and followed by a brief comment that explains what
|
||||
the function does, and separated from the next prototype by a blank
|
||||
line:
|
||||
|
||||
~~~C
|
||||
void __fastcall__ cclear (unsigned char length);
|
||||
/* Clear part of a line (write length spaces). */
|
||||
|
||||
~~~
|
||||
|
||||
Headers that belong to the standard library (libc) must
|
||||
conform with the C standard. That means:
|
||||
|
||||
|
@ -66,3 +66,9 @@
|
||||
.global _clock_settime
|
||||
.global _localtime
|
||||
.global _mktime
|
||||
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Constants
|
||||
|
||||
CLOCK_REALTIME = 0
|
||||
|
@ -155,6 +155,7 @@ function.
|
||||
<item><ref id="atmos_tick" name="atmos_tick">
|
||||
<item><ref id="atmos_tock" name="atmos_tock">
|
||||
<item><ref id="atmos_zap" name="atmos_zap">
|
||||
<item><ref id="waitvsync" name="waitvsync">
|
||||
</itemize>
|
||||
|
||||
|
||||
@ -8358,6 +8359,7 @@ only in the presence of a prototype.
|
||||
<descrip>
|
||||
<tag/Function/Wait until the start of the next video frame.
|
||||
<tag/Header/<tt/
|
||||
<ref id="atmos.h" name="atmos.h">,
|
||||
<ref id="cbm.h" name="cbm.h">,
|
||||
<ref id="gamate.h" name="gamate.h">,
|
||||
<ref id="nes.h" name="nes.h">,
|
||||
@ -8365,6 +8367,7 @@ only in the presence of a prototype.
|
||||
<tag/Declaration/<tt/void waitvsync (void);/
|
||||
<tag/Description/Wait for vertical sync, to reduce flickering.
|
||||
<tag/Availability/Platforms served by the headers above
|
||||
(Atmos requires the VSync hack)
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
@ -220,17 +220,17 @@
|
||||
/* Color register functions */
|
||||
/*****************************************************************************/
|
||||
|
||||
extern void __fastcall__ _setcolor (unsigned char color_reg, unsigned char hue, unsigned char luminance);
|
||||
extern void __fastcall__ _setcolor_low (unsigned char color_reg, unsigned char color_value);
|
||||
extern unsigned char __fastcall__ _getcolor (unsigned char color_reg);
|
||||
void __fastcall__ _setcolor (unsigned char color_reg, unsigned char hue, unsigned char luminance);
|
||||
void __fastcall__ _setcolor_low (unsigned char color_reg, unsigned char color_value);
|
||||
unsigned char __fastcall__ _getcolor (unsigned char color_reg);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Other screen functions */
|
||||
/*****************************************************************************/
|
||||
|
||||
extern void waitvsync (void); /* wait for start of next frame */
|
||||
extern int __fastcall__ _graphics (unsigned char mode); /* mode value same as in BASIC */
|
||||
extern void __fastcall__ _scroll (signed char numlines);
|
||||
void waitvsync (void); /* wait for start of next frame */
|
||||
int __fastcall__ _graphics (unsigned char mode); /* mode value same as in BASIC */
|
||||
void __fastcall__ _scroll (signed char numlines);
|
||||
/* numlines > 0 scrolls up */
|
||||
/* numlines < 0 scrolls down */
|
||||
|
||||
@ -239,18 +239,18 @@ extern void __fastcall__ _scroll (signed char numlines);
|
||||
/* Sound function */
|
||||
/*****************************************************************************/
|
||||
|
||||
extern void __fastcall__ _sound (unsigned char voice, unsigned char frequency, unsigned char distortion, unsigned char volume);
|
||||
void __fastcall__ _sound (unsigned char voice, unsigned char frequency, unsigned char distortion, unsigned char volume);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Misc. functions */
|
||||
/*****************************************************************************/
|
||||
|
||||
extern unsigned char get_ostype(void); /* get ROM version */
|
||||
extern unsigned char get_tv(void); /* get TV system */
|
||||
extern void _save_vecs(void); /* save system vectors */
|
||||
extern void _rest_vecs(void); /* restore system vectors */
|
||||
extern char *_getdefdev(void); /* get default floppy device */
|
||||
extern unsigned char _is_cmdline_dos(void); /* does DOS support command lines */
|
||||
unsigned char get_ostype(void); /* get ROM version */
|
||||
unsigned char get_tv(void); /* get TV system */
|
||||
void _save_vecs(void); /* save system vectors */
|
||||
void _rest_vecs(void); /* restore system vectors */
|
||||
char *_getdefdev(void); /* get default floppy device */
|
||||
unsigned char _is_cmdline_dos(void); /* does DOS support command lines */
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -94,7 +94,7 @@ extern void atr5200std_joy[]; /* referred to by joy_static_stddrv[] */
|
||||
#define _bordercolor(color) 0
|
||||
|
||||
/* wait for start of next frame */
|
||||
extern void waitvsync (void);
|
||||
void waitvsync (void);
|
||||
|
||||
/* end of atari5200.h */
|
||||
#endif
|
||||
|
@ -52,7 +52,7 @@
|
||||
/* No support for dynamically loadable drivers */
|
||||
#define DYN_DRV 0
|
||||
|
||||
extern unsigned char get_tv(void); /* get TV system */
|
||||
unsigned char get_tv(void); /* get TV system */
|
||||
|
||||
#include <_tia.h>
|
||||
#define TIA (*(struct __tia*)0x0000)
|
||||
|
@ -169,6 +169,9 @@ void atmos_tock (void);
|
||||
void atmos_zap (void);
|
||||
/* Raygun sound effect */
|
||||
|
||||
void waitvsync (void);
|
||||
/* Wait for start of next frame */
|
||||
|
||||
|
||||
|
||||
/* End of atmos.h */
|
||||
|
18
libsrc/atmos/waitvsync.s
Normal file
18
libsrc/atmos/waitvsync.s
Normal file
@ -0,0 +1,18 @@
|
||||
;
|
||||
; Written by Stefan Haubenthal <polluks@sdf.org>, requires VSync hack
|
||||
;
|
||||
; void waitvsync (void);
|
||||
;
|
||||
|
||||
.export _waitvsync
|
||||
|
||||
.include "atmos.inc"
|
||||
|
||||
.proc _waitvsync
|
||||
|
||||
lda #%00010000 ; CB1
|
||||
wait: and VIA::PRA2
|
||||
bne wait
|
||||
rts
|
||||
|
||||
.endproc
|
@ -23,8 +23,8 @@ _waitvsync:
|
||||
|
||||
@c80:
|
||||
;FIXME: do we have to switch banks?
|
||||
lda #$20
|
||||
@l3:
|
||||
lda VDC_INDEX
|
||||
and #$20
|
||||
and VDC_INDEX
|
||||
beq @l3
|
||||
rts
|
||||
|
@ -1,7 +0,0 @@
|
||||
#include <string.h>
|
||||
|
||||
char * __fastcall__ stpcpy (char * dst, const char * src)
|
||||
{
|
||||
strcpy (dst, src);
|
||||
return dst + strlen (src);
|
||||
}
|
22
libsrc/common/stpcpy.s
Normal file
22
libsrc/common/stpcpy.s
Normal file
@ -0,0 +1,22 @@
|
||||
;
|
||||
; Colin Leroy-Mira, 4 Sept. 2024
|
||||
;
|
||||
; char* stpcpy (char* dest, const char* src);
|
||||
;
|
||||
|
||||
.export _stpcpy
|
||||
.import _strcpy
|
||||
|
||||
.importzp tmp1, ptr2
|
||||
|
||||
_stpcpy:
|
||||
jsr _strcpy
|
||||
|
||||
ldx ptr2+1 ; Load dest pointer's last high byte
|
||||
tya ; Get the last offset strcpy wrote to
|
||||
|
||||
clc
|
||||
adc ptr2 ; Add to low byte value
|
||||
bcc :+
|
||||
inx
|
||||
: rts ; Return pointer to dest's terminator
|
@ -25,6 +25,9 @@ L1: lda (ptr1),y
|
||||
inc ptr2+1
|
||||
bne L1
|
||||
|
||||
L9: lda ptr2 ; X still contains high byte
|
||||
rts
|
||||
L9: lda ptr2 ; X still contains dest's original high byte
|
||||
|
||||
; On exit, we want AX to be dest (as this is what strcpy returns).
|
||||
; We also want (ptr2),y to still point to dest's terminator, as this
|
||||
; is used by stpcpy().
|
||||
rts
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
.export _time
|
||||
|
||||
.import decsp1, ldeaxi
|
||||
.import pusha, ldeaxi
|
||||
.importzp ptr1, sreg, tmp1, tmp2
|
||||
|
||||
.include "time.inc"
|
||||
@ -22,7 +22,8 @@
|
||||
|
||||
; Get the time (machine dependent)
|
||||
|
||||
jsr decsp1
|
||||
lda #CLOCK_REALTIME
|
||||
jsr pusha
|
||||
lda #<time
|
||||
ldx #>time
|
||||
jsr _clock_gettime
|
||||
|
@ -9,8 +9,7 @@
|
||||
.include "pet.inc"
|
||||
|
||||
_waitvsync:
|
||||
@l1:
|
||||
lda VIA_PB
|
||||
and #%00100000
|
||||
bne @l1
|
||||
lda #%00100000
|
||||
: and VIA_PB
|
||||
bne :-
|
||||
rts
|
||||
|
@ -313,6 +313,13 @@ static unsigned ParsePointerInit (const Type* T)
|
||||
/* Optional opening brace */
|
||||
unsigned BraceCount = OpeningCurlyBraces (0);
|
||||
|
||||
/* We warn if an initializer for a scalar contains braces, because this is
|
||||
** quite unusual and often a sign for some problem in the input.
|
||||
*/
|
||||
if (BraceCount > 0) {
|
||||
Warning ("Braces around scalar initializer");
|
||||
}
|
||||
|
||||
/* Expression */
|
||||
ExprDesc ED = NoCodeConstExpr (hie1);
|
||||
TypeConversion (&ED, T);
|
||||
|
3
test/ref/bug2134.c
Normal file
3
test/ref/bug2134.c
Normal file
@ -0,0 +1,3 @@
|
||||
int i = { 0 };
|
||||
char* p = { 0 };
|
||||
int main() { return 0; }
|
2
test/ref/bug2134.cref
Normal file
2
test/ref/bug2134.cref
Normal file
@ -0,0 +1,2 @@
|
||||
bug2134.c:1: Warning: Braces around scalar initializer
|
||||
bug2134.c:2: Warning: Braces around scalar initializer
|
@ -8,10 +8,12 @@
|
||||
#define STR_SHORT "Hello, World!"
|
||||
#define STR_LONG "This is a longer test string for stpcpy."
|
||||
|
||||
char dest[512];
|
||||
char multi_page[300];
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
char dest[50];
|
||||
const char *src_empty;
|
||||
const char *src_short;
|
||||
const char *src_long;
|
||||
@ -38,7 +40,14 @@ main ()
|
||||
assert(end == &dest[sizeof (STR_LONG) - 1]);
|
||||
printf ("Test 3 passed.\n");
|
||||
|
||||
memset(multi_page, 'a', sizeof(multi_page)-1);
|
||||
multi_page[sizeof(multi_page)-1] = '\0';
|
||||
end = stpcpy (dest, multi_page);
|
||||
assert(!strcmp (dest, multi_page));
|
||||
assert(!*end);
|
||||
assert(end == &dest[sizeof (multi_page) - 1]);
|
||||
printf ("Test 4 passed.\n");
|
||||
|
||||
printf ("All tests passed.\n");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user