mirror of
https://github.com/cc65/cc65.git
synced 2024-12-24 11:31:31 +00:00
Merge branch 'cc65:master' into master
This commit is contained in:
commit
4973fc2246
112
doc/funcref.sgml
112
doc/funcref.sgml
@ -298,6 +298,16 @@ function.
|
||||
</itemize>
|
||||
|
||||
|
||||
<sect1><tt/creativision.h/<label id="creativision.h"><p>
|
||||
|
||||
<itemize>
|
||||
<item><ref id="bios_playsound" name="bios_playsound">
|
||||
<item><ref id="psg_delay" name="psg_delay">
|
||||
<item><ref id="psg_outb" name="psg_outb">
|
||||
<item><ref id="psg_silence" name="psg_silence">
|
||||
</itemize>
|
||||
|
||||
|
||||
<sect1><tt/ctype.h/<label id="ctype.h"><p>
|
||||
|
||||
<itemize>
|
||||
@ -1659,6 +1669,41 @@ used in presence of a prototype.
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>bios_playsound<label id="bios_playsound"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Play sound sequence.
|
||||
<tag/Header/<tt/<ref id="creativision.h" name="creativision.h">/
|
||||
<tag/Declaration/<tt/void __fastcall__ bios_playsound(void *a, unsigned char b);/
|
||||
<tag/Description/The function may play chords based on a BASIC statement,
|
||||
note and duration are defined in the manual chapter 13 on page 102 resp. 103.
|
||||
<tag/Notes/<itemize>
|
||||
<item>BASIC has a fixed tempo of 18.
|
||||
<item>The function is only available as fastcall function, so it may only be
|
||||
used in presence of a prototype.
|
||||
</itemize>
|
||||
<tag/Availability/Creativision
|
||||
<tag/See also/
|
||||
<ref id="psg_delay" name="psg_delay">,
|
||||
<ref id="psg_outb" name="psg_outb">
|
||||
<tag/Example/
|
||||
<verb>
|
||||
static const unsigned char notes[] = {
|
||||
0x77, 0x4F, 0x37,
|
||||
0x4B, 0x05, 0xBB,
|
||||
0x4F, 0x27, 0x83,
|
||||
0x93, 0x9B, 0x93,
|
||||
0x17, 0x4F, 0x96,
|
||||
0xAB, 0x17, 0x4F,
|
||||
0x0E
|
||||
};
|
||||
bios_playsound (notes, sizeof notes);
|
||||
</verb>
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>bgcolor<label id="bgcolor"><p>
|
||||
|
||||
<quote>
|
||||
@ -5769,6 +5814,73 @@ be used in presence of a prototype.
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>psg_delay<label id="psg_delay"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Delay for a short period of time.
|
||||
<tag/Header/<tt/<ref id="creativision.h" name="creativision.h">/
|
||||
<tag/Declaration/<tt/void __fastcall__ psg_delay(unsigned char b);/
|
||||
<tag/Description/The function specifies how long each note or pause between
|
||||
notes should last.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is only available as fastcall function, so it may only be
|
||||
used in presence of a prototype.
|
||||
</itemize>
|
||||
<tag/Availability/Creativision
|
||||
<tag/See also/
|
||||
<ref id="psg_outb" name="psg_outb">,
|
||||
<ref id="psg_silence" name="psg_silence">
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>psg_outb<label id="psg_outb"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Output a byte.
|
||||
<tag/Header/<tt/<ref id="creativision.h" name="creativision.h">/
|
||||
<tag/Declaration/<tt/void __fastcall__ psg_outb(unsigned char b);/
|
||||
<tag/Description/The function will send a PSG byte and wait for acknowledge.
|
||||
<tag/Notes/<itemize>
|
||||
<item>The function is only available as fastcall function, so it may only be
|
||||
used in presence of a prototype.
|
||||
</itemize>
|
||||
<tag/Availability/Creativision
|
||||
<tag/See also/
|
||||
<ref id="psg_delay" name="psg_delay">,
|
||||
<ref id="psg_silence" name="psg_silence">
|
||||
<tag/Example/
|
||||
<verb>
|
||||
psg_outb (0x80); // Latch frequency
|
||||
psg_outb (0x07); // Frequency byte 2
|
||||
psg_outb (0x90); // Channel 0 full volume
|
||||
</verb>
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>psg_silence<label id="psg_silence"><p>
|
||||
|
||||
<quote>
|
||||
<descrip>
|
||||
<tag/Function/Set volume off on each channel.
|
||||
<tag/Header/<tt/<ref id="creativision.h" name="creativision.h">/
|
||||
<tag/Declaration/<tt/void psg_silence(void);/
|
||||
<tag/Description/The function sends $9F, $BF, $DF, $FF to the PSG.
|
||||
<tag/Notes/<itemize>
|
||||
</itemize>
|
||||
<tag/Availability/Creativision
|
||||
<tag/See also/
|
||||
<ref id="psg_delay" name="psg_delay">,
|
||||
<ref id="psg_outb" name="psg_outb">
|
||||
<tag/Example/None.
|
||||
</descrip>
|
||||
</quote>
|
||||
|
||||
|
||||
<sect1>qsort<label id="qsort"><p>
|
||||
|
||||
<quote>
|
||||
|
@ -190,6 +190,9 @@ EXELIST_atarixl = $(EXELIST_atari)
|
||||
EXELIST_atari2600 = \
|
||||
atari2600hello
|
||||
|
||||
EXELIST_atari5200 = \
|
||||
notavailable
|
||||
|
||||
EXELIST_atmos = \
|
||||
ascii \
|
||||
hello \
|
||||
|
@ -106,6 +106,18 @@ $(WORKDIR)/bug1263.$1.$2.prg: bug1263.c | $(WORKDIR)
|
||||
$(if $(QUIET),echo misc/bug1263.$1.$2.prg)
|
||||
$(NOT) $(CC65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
|
||||
|
||||
# should compile, but gives an error
|
||||
$(WORKDIR)/bug1357.$1.$2.prg: bug1357.c | $(WORKDIR)
|
||||
@echo "FIXME: " $$@ "currently does not compile."
|
||||
$(if $(QUIET),echo misc/bug1357.$1.$2.prg)
|
||||
$(NOT) $(CC65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
|
||||
|
||||
# should compile, but compiler exits with internal error
|
||||
$(WORKDIR)/bug1211-ice-move-refs-2.$1.$2.prg: bug1211-ice-move-refs-2.c | $(WORKDIR)
|
||||
@echo "FIXME: " $$@ "currently does not compile."
|
||||
$(if $(QUIET),echo misc/bug1211-ice-move-refs-2.$1.$2.prg)
|
||||
$(NOT) $(CC65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
|
||||
|
||||
# this one requires --std=c89, it fails with --std=c99
|
||||
$(WORKDIR)/bug1265.$1.$2.prg: bug1265.c | $(WORKDIR)
|
||||
$(if $(QUIET),echo misc/bug1265.$1.$2.prg)
|
||||
|
30
test/misc/bug1357.c
Normal file
30
test/misc/bug1357.c
Normal file
@ -0,0 +1,30 @@
|
||||
|
||||
/* issue #1357 - X Macros don't work with C preprocessor */
|
||||
|
||||
#define OPCODES(X) \
|
||||
X(PUSHNIL) \
|
||||
X(PUSHTRUE) \
|
||||
X(PUSHFALSE)
|
||||
|
||||
enum {
|
||||
#define X(op) op,
|
||||
OPCODES(X)
|
||||
#undef X
|
||||
N_OPS
|
||||
};
|
||||
|
||||
/* cc65 -E bug1357.c -o bug1357.c.pre
|
||||
should produce something like this:
|
||||
|
||||
enum {
|
||||
PUSHNIL,
|
||||
PUSHTRUE,
|
||||
PUSHFALSE,
|
||||
N_OPS
|
||||
};
|
||||
*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
@ -1,6 +1,13 @@
|
||||
This directory contains test code for automatic regression testing of the CC65
|
||||
compiler.
|
||||
compiler and tools.
|
||||
|
||||
/asm - contains the assembler regression tests
|
||||
|
||||
/dasm - contains the disassembler regression tests
|
||||
|
||||
|
||||
/val, /ref and /err generally contain the tests that are used to verify that the
|
||||
compiler is working as expected (when the tests behave as described):
|
||||
|
||||
/val - The bulk of tests are contained here, individual tests should exit with
|
||||
an exit code of EXIT_SUCCESS when they pass, or EXIT_FAILURE on error.
|
||||
@ -9,6 +16,9 @@ compiler.
|
||||
|
||||
/err - contains tests that MUST NOT compile
|
||||
|
||||
|
||||
/todo and /misc generally contain the tests that fail because of known bugs:
|
||||
|
||||
/todo - These tests fail due to open compiler issues.
|
||||
|
||||
The makefile in this directory _expects_ the tests to fail, because of
|
||||
@ -16,9 +26,6 @@ compiler.
|
||||
moved to /val in the PR fixing the issue, which will make CI pass again.
|
||||
No changes to makefiles are required!
|
||||
|
||||
/asm - contains the assembler regression tests
|
||||
|
||||
/dasm - contains the disassembler regression tests
|
||||
|
||||
/misc - a few tests that need special care of some sort
|
||||
|
||||
|
49
test/val/bug263.c
Normal file
49
test/val/bug263.c
Normal file
@ -0,0 +1,49 @@
|
||||
|
||||
/* issue #263 - cc65 miscompiles w/ a static variable and -O */
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int failures = 0;
|
||||
|
||||
void __fastcall__ set_vram_update(unsigned char *ptr)
|
||||
{
|
||||
printf("set_vram_update: %04x\n", ptr);
|
||||
if (ptr != NULL) {
|
||||
failures++;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char __fastcall__ ppu_wait_nmi(void)
|
||||
{
|
||||
// we need to make sure somehow the akku is not zero before the break
|
||||
return 0x1234;
|
||||
}
|
||||
|
||||
unsigned char ctrl, ret, i;
|
||||
|
||||
unsigned char gameloop (void)
|
||||
{
|
||||
ctrl = 0;
|
||||
ret = 0;
|
||||
while(1) {
|
||||
if (ctrl & 1) {
|
||||
while (--i) {
|
||||
ppu_wait_nmi();
|
||||
}
|
||||
break;
|
||||
}
|
||||
ctrl = 1;
|
||||
}
|
||||
// This will pass garbage, not NULL.
|
||||
set_vram_update(NULL);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
gameloop();
|
||||
printf("failures: %d\n", failures);
|
||||
return failures;
|
||||
}
|
||||
|
52
test/val/bug897.c
Normal file
52
test/val/bug897.c
Normal file
@ -0,0 +1,52 @@
|
||||
|
||||
/* issue #897 - __asm__()-referenced code-labels are generated for only branches and jumps */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static unsigned char *srcptr, *dstptr;
|
||||
|
||||
#define COPY_LEN 16
|
||||
|
||||
void test(void)
|
||||
{
|
||||
asm("lda %v", srcptr);
|
||||
asm("sta %g+1", s2b_copy_from);
|
||||
asm("lda %v+1", srcptr);
|
||||
asm("sta %g+2", s2b_copy_from);
|
||||
|
||||
asm("lda %v", dstptr);
|
||||
asm("sta %g+1", s2b_copy_to);
|
||||
asm("lda %v+1", dstptr);
|
||||
asm("sta %g+2", s2b_copy_to);
|
||||
|
||||
asm("ldy #%b", COPY_LEN-1);
|
||||
s2b_copy_from:
|
||||
asm("lda $FFFF,y");
|
||||
s2b_copy_to:
|
||||
asm("sta $FFFF,y");
|
||||
asm("dey");
|
||||
asm("bpl %g", s2b_copy_from);
|
||||
}
|
||||
|
||||
unsigned char src[16] = "0123456789abcdef";
|
||||
unsigned char dest[16];
|
||||
|
||||
int failures = 0;
|
||||
|
||||
unsigned char i;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
srcptr = src;
|
||||
dstptr = dest;
|
||||
test();
|
||||
for (i = 0; i < COPY_LEN; i++) {
|
||||
printf("%d %02x %02x\n", i, src[i], dest[i]);
|
||||
if (src[i] != dest[i]) {
|
||||
failures++;
|
||||
}
|
||||
}
|
||||
printf("failures: %d\n", failures);
|
||||
return failures;
|
||||
}
|
Loading…
Reference in New Issue
Block a user