1
0
mirror of https://github.com/cc65/cc65.git synced 2025-02-28 05:30:23 +00:00

Merge branch 'master' into split2089-workflow-docs-artifact

This commit is contained in:
Brad Smith 2023-05-07 13:34:37 -04:00 committed by GitHub
commit 8b682b3c5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 1252 additions and 50 deletions

View File

@ -72,3 +72,7 @@ jobs:
- name: Build app (release)
run: msbuild src\cc65.sln -t:rebuild -property:Configuration=Release
# The regression tests are currently too slow to run for this Windows build,
# but the "Windows Test Manual" workflow (windows-test-manual.yml) can by
# manually dispatched from the Actions menu to test as needed.

View File

@ -29,6 +29,10 @@ jobs:
- name: Build app (release)
run: msbuild src\cc65.sln -t:rebuild -property:Configuration=Release
# The regression tests are currently too slow to run for this Windows build,
# but the "Windows Test Manual" workflow (windows-test-manual.yml) can by
# manually dispatched from the Actions menu to test as needed.
build_linux:
name: Build, Test, and Snapshot (Linux)
if: github.repository == 'cc65/cc65'
@ -115,9 +119,8 @@ jobs:
git config push.default simple
git add -A
# prevent failure when there is nothing to commit
if git commit -m "Updated from https://github.com/cc65/cc65/commit/${GITHUB_SHA}" ; then
git push
fi
git diff-index --quiet HEAD || git commit -m "Updated from https://github.com/cc65/cc65/commit/${GITHUB_SHA}"
git push
- name: Package offline documents.
run: 7z a cc65-snapshot-docs.zip ./html/*.*
- name: Upload a Documents Snapshot Zip

View File

@ -0,0 +1,43 @@
name: Windows Test Manual
# Manually dispatched because it's much slower than the Linux test.
on:
workflow_dispatch:
jobs:
build_windows:
name: Build, Test (Windows MSVC)
runs-on: windows-latest
steps:
- name: Git Setup
shell: bash
run: git config --global core.autocrlf input
- name: Checkout source
uses: actions/checkout@v3
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1
- name: Build app (MSVC debug)
run: msbuild src\cc65.sln -t:rebuild -property:Configuration=Debug
- name: Build app (MSVC release)
run: msbuild src\cc65.sln -t:rebuild -property:Configuration=Release
- name: Build utils (MinGW)
shell: cmd
run: make -j2 util
- name: Build the platform libraries (make lib)
shell: cmd
run: make -j2 lib QUIET=1
- name: Run the regression tests (make test)
shell: cmd
run: make test QUIET=1
- name: Test that the samples can be built (make samples)
shell: cmd
run: make -j2 samples

View File

@ -21,7 +21,7 @@ mostlyclean clean:
avail unavail bin:
@$(MAKE) -C src --no-print-directory $@
lib:
lib libtest:
@$(MAKE) -C libsrc --no-print-directory $@
doc html info:
@ -43,7 +43,7 @@ util:
checkstyle:
@$(MAKE) -C .github/checks --no-print-directory $@
# simple "test" target, only run regression tests for c64 target
# runs regression tests, requires libtest target libraries
test:
@$(MAKE) -C test --no-print-directory $@

View File

@ -754,6 +754,8 @@ Here is a description of all the command line options:
Warn about unused function parameters.
<tag><tt/unused-var/</tag>
Warn about unused variables.
<tag><tt/const-overflow/</tag>
Warn if numerical constant conversion implies overflow. (Disabled by default.)
</descrip>
The full list of available warning names can be retrieved by using the

View File

@ -187,8 +187,21 @@ Currently the following extra screen configuration modules are implemented:
<itemize>
<item><tt>osic1p-screen-s3-32x28.o</tt>: 32 columns by 28 lines mode
for Briel Superboard ///</item>
<item><tt>osic1p-screen-c1p-48x12.s</tt>: 48 columns by 12 lines mode
for Challenger 1P</item>
</itemize>
On the Briel Superboard /// you enter 32 column mode by holding down
the BREAK key on powerup.
On the Challenger 1P you can enable 48 column mode by writing a 1 to
bit 0 of address &dollar;D800, and writing a 0 to go back to 24 column mode.
You can use code like the following to do this:
<tscreen><verb>
*(char*)0xd800 = 1; /* Switch to 48 column mode */
</verb></tscreen>
<sect>Limitations<p>
<sect1>stdio implementation<p>

View File

@ -39,6 +39,10 @@ TARGETS = apple2 \
sym1 \
telestrat
TARGETTEST = none \
sim6502 \
sim65c02
DRVTYPES = emd \
joy \
mou \
@ -53,7 +57,7 @@ OUTPUTDIRS := lib
$(subst ../,,$(wildcard ../target/*/drv/*)) \
$(subst ../,,$(wildcard ../target/*/util))
.PHONY: all mostlyclean clean install zip lib $(TARGETS)
.PHONY: all mostlyclean clean install zip lib libtest $(TARGETS)
.SUFFIXES:
@ -81,6 +85,8 @@ datadir = $(PREFIX)/share/cc65
all lib: $(TARGETS)
libtest: $(TARGETTEST)
mostlyclean:
$(call RMDIR,../libwrk)

View File

@ -34,8 +34,7 @@ ram_top := __MAIN_START__ + __MAIN_SIZE__
.ifdef ASM
.include "osic1p.inc"
.macpack generic
.include "screen-c1p-24x24.s"
load := $08 ; private variables
count := $0A
@ -45,7 +44,7 @@ GETCHAR := $FFBF ; gets one character from ACIA
FIRSTVISC = $85 ; Offset of first visible character in video RAM
LINEDIST = $20 ; Offset in video RAM between two lines
ldy #<$0000
ldy #$00
lda #<load_addr
ldx #>load_addr
sta load
@ -57,9 +56,9 @@ LINEDIST = $20 ; Offset in video RAM between two lines
stx count+1 ; save size with each byte incremented separately
L1: dec count
bnz L2
bne L2
dec count+1
bze L3
beq L3
L2: jsr GETCHAR ; (doesn't change .Y)
sta (load),y
@ -70,12 +69,12 @@ L2: jsr GETCHAR ; (doesn't change .Y)
lsr a
and #8 - 1
ora #$10 ; eight arrow characters
sta SCRNBASE + FIRSTVISC + 2 * LINEDIST + 11
sta C1P_SCR_BASE + FIRSTVISC + 2 * LINEDIST + 11
iny
bnz L1
bne L1
inc load+1
bnz L1 ; branch always
bne L1 ; branch always
L3: jmp load_addr
@ -112,18 +111,15 @@ CR = $0D
hex2 >load_addr
.byte CR, "85", CR, "08", CR
.byte "86", CR, "09", CR
.byte "A9", CR
hex2 <load_size
.byte CR, "49", CR, "FF", CR
.byte "85", CR, "0A", CR
.byte "A9", CR
hex2 >load_size
.byte CR, "49", CR, "FF", CR
.byte "85", CR, "0B", CR
.byte "E6", CR, "0A", CR
.byte "A2", CR
hex2 (<load_size) + 1
.byte CR, "86", CR, "0A", CR
.byte "A2", CR
hex2 (>load_size) + 1
.byte CR, "86", CR, "0B", CR
.byte "C6", CR, "0A", CR
.byte "D0", CR, "04", CR
.byte "E6", CR, "0B", CR
.byte "C6", CR, "0B", CR
.byte "F0", CR, "16", CR
.byte "20", CR, "BF", CR, "FF", CR
.byte "91", CR, "08", CR

View File

@ -0,0 +1,16 @@
;
; Implementation of screen-layout related functions for Challenger 1P in 48x12 mode.
;
.include "../osiscreen.inc"
C1P_SCR_BASE := $D000 ; Base of C1P video RAM
C1P_VRAM_SIZE = $0400 ; Size of C1P video RAM (1 kB)
C1P_SCR_WIDTH = $30 ; Screen width
C1P_SCR_HEIGHT = $0C ; Screen height
C1P_SCR_FIRSTCHAR = $8B ; Offset of cursor position (0, 0) from base
; of video RAM
C1P_SCROLL_DIST = $40 ; Memory distance for scrolling by one line
osi_screen_funcs C1P_SCR_BASE, C1P_VRAM_SIZE, C1P_SCR_FIRSTCHAR, \
C1P_SCR_WIDTH, C1P_SCR_HEIGHT, C1P_SCROLL_DIST

View File

@ -496,7 +496,7 @@ static ExprNode* FuncIsMnemonic (void)
/* Skip the name */
NextTok ();
return GenLiteralExpr (Instr > 0);
return GenLiteralExpr (Instr >= 0);
}

View File

@ -79,6 +79,7 @@ IntStack WarnUnusedLabel = INTSTACK(1); /* - unused labels */
IntStack WarnUnusedParam = INTSTACK(1); /* - unused parameters */
IntStack WarnUnusedVar = INTSTACK(1); /* - unused variables */
IntStack WarnUnusedFunc = INTSTACK(1); /* - unused functions */
IntStack WarnConstOverflow = INTSTACK(0); /* - overflow conversion of numerical constants */
/* Map the name of a warning to the intstack that holds its state */
typedef struct WarnMapEntry WarnMapEntry;
@ -102,6 +103,7 @@ static WarnMapEntry WarnMap[] = {
{ &WarnUnusedLabel, "unused-label" },
{ &WarnUnusedParam, "unused-param" },
{ &WarnUnusedVar, "unused-var" },
{ &WarnConstOverflow, "const-overflow" },
};
Collection DiagnosticStrBufs;

View File

@ -76,6 +76,7 @@ extern IntStack WarnUnusedLabel; /* - unused labels */
extern IntStack WarnUnusedParam; /* - unused parameters */
extern IntStack WarnUnusedVar; /* - unused variables */
extern IntStack WarnUnusedFunc; /* - unused functions */
extern IntStack WarnConstOverflow; /* - overflow conversion of numerical constants */
/* Forward */
struct StrBuf;

View File

@ -39,6 +39,8 @@
#include <errno.h>
#include <ctype.h>
#include <math.h>
#include <inttypes.h>
#include <limits.h>
/* common */
#include "chartype.h"
@ -151,6 +153,11 @@ static const struct Keyword {
#define IT_ULONG 0x08
/* Internal type for numeric constant scanning.
** Size must be explicit for cross-platform uniformity.
*/
typedef uint32_t scan_t;
/*****************************************************************************/
/* code */
@ -521,7 +528,8 @@ static void NumericConst (void)
int IsFloat;
char C;
unsigned DigitVal;
unsigned long IVal; /* Value */
scan_t IVal; /* Scanned value. */
int Overflow;
/* Get the pp-number first, then parse on it */
CopyPPNumber (&Src);
@ -575,6 +583,7 @@ static void NumericConst (void)
/* Since we now know the correct base, convert the input into a number */
SB_SetIndex (&Src, Index);
IVal = 0;
Overflow = 0;
while ((C = SB_Peek (&Src)) != '\0' && (Base <= 10 ? IsDigit (C) : IsXDigit (C))) {
DigitVal = HexVal (C);
if (DigitVal >= Base) {
@ -582,9 +591,17 @@ static void NumericConst (void)
SB_Clear (&Src);
break;
}
IVal = (IVal * Base) + DigitVal;
/* Test result of adding digit for overflow. */
if (((scan_t)(IVal * Base + DigitVal) / Base) != IVal) {
Overflow = 1;
}
IVal = IVal * Base + DigitVal;
SB_Skip (&Src);
}
if (Overflow) {
Error ("Numerical constant \"%s\" too large for internal %d-bit representation",
SB_GetConstBuf (&Src), (int)(sizeof(IVal)*CHAR_BIT));
}
/* Distinguish between integer and floating point constants */
if (!IsFloat) {

View File

@ -55,7 +55,7 @@
static void DoConversion (ExprDesc* Expr, const Type* NewType)
static void DoConversion (ExprDesc* Expr, const Type* NewType, int Explicit)
/* Emit code to convert the given expression to a new type. */
{
const Type* OldType;
@ -128,6 +128,7 @@ static void DoConversion (ExprDesc* Expr, const Type* NewType)
** internally already represented by a long.
*/
if (NewBits <= OldBits) {
long OldVal = Expr->IVal;
/* Cut the value to the new size */
Expr->IVal &= (0xFFFFFFFFUL >> (32 - NewBits));
@ -139,6 +140,10 @@ static void DoConversion (ExprDesc* Expr, const Type* NewType)
Expr->IVal |= shl_l (~0UL, NewBits);
}
}
if ((OldVal != Expr->IVal) && IS_Get (&WarnConstOverflow) && !Explicit) {
Warning ("Implicit conversion of constant overflows %d-bit destination", NewBits);
}
}
/* Do the integer constant <-> absolute address conversion if necessary */
@ -283,7 +288,7 @@ void TypeConversion (ExprDesc* Expr, const Type* NewType)
/* Both types must be complete */
if (!IsIncompleteESUType (NewType) && !IsIncompleteESUType (Expr->Type)) {
/* Do the actual conversion */
DoConversion (Expr, NewType);
DoConversion (Expr, NewType, 0);
} else {
/* We should have already generated error elsewhere so that we
** could just silently fail here to avoid excess errors, but to
@ -330,7 +335,7 @@ void TypeCast (ExprDesc* Expr)
ReplaceType (Expr, NewType);
} else if (IsCastType (Expr->Type)) {
/* Convert the value. The result has always the new type */
DoConversion (Expr, NewType);
DoConversion (Expr, NewType, 1);
} else {
TypeCompatibilityDiagnostic (NewType, Expr->Type, 1,
"Cast to incompatible type '%s' from '%s'");

View File

@ -850,14 +850,25 @@ static char *filterInput (FILE *F, char *tbl)
/* loads file into buffer filtering it out */
int a, prevchar = -1, i = 0, bracket = 0, quote = 1;
for (;;) {
a = getc(F);
if ((a == '\n') || (a == '\015')) a = ' ';
if (a == ',' && quote) a = ' ';
if (a == '\042') quote =! quote;
a = getc(F);
while (1) {
if (i >= BLOODY_BIG_BUFFER) {
AbEnd ("File too large for internal parsing buffer (%d bytes)",BLOODY_BIG_BUFFER);
}
if (((a == '\n') || (a == '\015')) ||
(a == ',' && quote)) {
a = ' ';
}
if (a == '\042') {
quote =! quote;
}
if (quote) {
if ((a == '{') || (a == '(')) bracket++;
if ((a == '}') || (a == ')')) bracket--;
if ((a == '{') || (a == '(')) {
bracket++;
}
if ((a == '}') || (a == ')')) {
bracket--;
}
}
if (a == EOF) {
tbl[i] = '\0';
@ -873,13 +884,18 @@ static char *filterInput (FILE *F, char *tbl)
if (a == ';' && quote) {
do {
a = getc (F);
} while (a != '\n');
fseek (F, -1, SEEK_CUR);
} while (a != '\n' && a != EOF);
/* Don't discard this newline/EOF, continue to next loop.
** A previous implementation used fseek(F,-1,SEEK_CUR),
** which is invalid for text mode files, and was unreliable across platforms.
*/
continue;
} else {
tbl[i++] = a;
prevchar = a;
}
}
a = getc(F);
}
if (bracket != 0) AbEnd ("There are unclosed brackets!");

View File

@ -36,6 +36,7 @@
#include <string.h>
#include <stdlib.h>
#include <errno.h>
#include <limits.h>
/* common */
#include "abend.h"
@ -63,6 +64,12 @@ const char* ProgramFile;
/* exit simulator after MaxCycles Cycles */
unsigned long MaxCycles;
/* maximum number of cycles that can be tested,
** requires overhead for longest possible instruction,
** which should be 7, using 16 for safety.
*/
#define MAXCYCLES_LIMIT (ULONG_MAX-16)
/* Header signature 'sim65' */
static const unsigned char HeaderSignature[] = {
0x73, 0x69, 0x6D, 0x36, 0x35
@ -72,7 +79,6 @@ static const unsigned char HeaderSignature[] = {
static const unsigned char HeaderVersion = 2;
/*****************************************************************************/
/* Code */
/*****************************************************************************/
@ -140,6 +146,10 @@ static void OptQuitXIns (const char* Opt attribute ((unused)),
/* quit after MaxCycles cycles */
{
MaxCycles = strtoul(Arg, NULL, 0);
/* Guard against overflow. */
if (MaxCycles >= MAXCYCLES_LIMIT) {
Error("'-x parameter out of range. Max: %lu",MAXCYCLES_LIMIT);
}
}
static unsigned char ReadProgramFile (void)
@ -184,6 +194,7 @@ static unsigned char ReadProgramFile (void)
}
/* Get load address */
Val2 = 0; /* suppress uninitialized variable warning */
if (((Val = fgetc(F)) == EOF) ||
((Val2 = fgetc(F)) == EOF)) {
Error ("'%s': Header missing load address", ProgramFile);

View File

@ -242,7 +242,15 @@ static void PVClose (CPURegs* Regs)
Print (stderr, 2, "PVClose ($%04X)\n", FD);
RetVal = close (FD);
if (FD != 0xFFFF) {
RetVal = close (FD);
} else {
/* test/val/constexpr.c "abuses" close, expecting close(-1) to return -1.
** This behaviour is not the same on all target platforms.
** MSVC's close treats it as a fatal error instead and terminates.
*/
RetVal = 0xFFFF;
}
SetAX (Regs, RetVal);
}

View File

@ -22,6 +22,7 @@ continue:
@$(MAKE) -C val all
@$(MAKE) -C ref all
@$(MAKE) -C err all
@$(MAKE) -C standard all
@$(MAKE) -C misc all
@$(MAKE) -C todo all
@ -31,6 +32,7 @@ mostlyclean:
@$(MAKE) -C val clean
@$(MAKE) -C ref clean
@$(MAKE) -C err clean
@$(MAKE) -C standard clean
@$(MAKE) -C misc clean
@$(MAKE) -C todo clean

View File

@ -22,7 +22,8 @@ ifdef QUIET
NULLERR = 2>$(NULLDEV)
endif
SIM65FLAGS = -x 5000000000
# sim65 can support 64-bit cycle counts on some platforms, but not all. This must fit in 32-bit.
SIM65FLAGS = -x 4000000000
CA65 := $(if $(wildcard ../../../bin/ca65*),..$S..$S..$Sbin$Sca65,ca65)
LD65 := $(if $(wildcard ../../../bin/ld65*),..$S..$S..$Sbin$Sld65,ld65)

846
test/asm/val/ismnemonic.s Normal file
View File

@ -0,0 +1,846 @@
; Tests to ensure .ismnemonic is working correctly
; The .ismnemonic function calls FindInstruction internally,
; which is how the assembler detects all instructions
;
; Currently supported CPUs:
; "6502"
; "6502X"
; "6502DTV"
; "65SC02"
; "65C02"
; "4510"
; "huc6280"
; "65816"
; "sweet16"
; count any errors:
ismnemonic_error .set 0
; macro to test an instruction
.macro test_Ismnemonic instr
.if .ismnemonic(instr)
; do nothing
.else
ismnemonic_error .set 1
.endif
.endmacro
; test .feature ubiquitous_idents
; allow overloading mnemonics
.feature ubiquitous_idents
.setcpu "6502"
; make an adc macro
.macro adc
.endmacro
; should not match
.if .ismnemonic(adc)
ismnemonic_error .set 1
.endif
.delmac adc
; test all instructions:
; there is no instruction table for "none", make sure 'adc' (common to all CPUs) and 'add' (sweet16) doesn't match
.setcpu "none"
.if .ismnemonic(adc) || .ismnemonic(add)
ismnemonic_error .set 1
.endif
.setcpu "6502"
test_Ismnemonic adc
test_Ismnemonic and
test_Ismnemonic asl
test_Ismnemonic bcc
test_Ismnemonic bcs
test_Ismnemonic beq
test_Ismnemonic bit
test_Ismnemonic bmi
test_Ismnemonic bne
test_Ismnemonic bpl
test_Ismnemonic brk
test_Ismnemonic bvc
test_Ismnemonic bvs
test_Ismnemonic clc
test_Ismnemonic cld
test_Ismnemonic cli
test_Ismnemonic clv
test_Ismnemonic cmp
test_Ismnemonic cpx
test_Ismnemonic cpy
test_Ismnemonic dec
test_Ismnemonic dex
test_Ismnemonic dey
test_Ismnemonic eor
test_Ismnemonic inc
test_Ismnemonic inx
test_Ismnemonic iny
test_Ismnemonic jmp
test_Ismnemonic jsr
test_Ismnemonic lda
test_Ismnemonic ldx
test_Ismnemonic ldy
test_Ismnemonic lsr
test_Ismnemonic nop
test_Ismnemonic ora
test_Ismnemonic pha
test_Ismnemonic php
test_Ismnemonic pla
test_Ismnemonic plp
test_Ismnemonic rol
test_Ismnemonic ror
test_Ismnemonic rti
test_Ismnemonic rts
test_Ismnemonic sbc
test_Ismnemonic sec
test_Ismnemonic sed
test_Ismnemonic sei
test_Ismnemonic sta
test_Ismnemonic stx
test_Ismnemonic sty
test_Ismnemonic tax
test_Ismnemonic tay
test_Ismnemonic tsx
test_Ismnemonic txa
test_Ismnemonic txs
test_Ismnemonic tya
.setcpu "6502X"
test_Ismnemonic adc
test_Ismnemonic alr
test_Ismnemonic anc
test_Ismnemonic and
test_Ismnemonic ane
test_Ismnemonic arr
test_Ismnemonic asl
test_Ismnemonic axs
test_Ismnemonic bcc
test_Ismnemonic bcs
test_Ismnemonic beq
test_Ismnemonic bit
test_Ismnemonic bmi
test_Ismnemonic bne
test_Ismnemonic bpl
test_Ismnemonic brk
test_Ismnemonic bvc
test_Ismnemonic bvs
test_Ismnemonic clc
test_Ismnemonic cld
test_Ismnemonic cli
test_Ismnemonic clv
test_Ismnemonic cmp
test_Ismnemonic cpx
test_Ismnemonic cpy
test_Ismnemonic dcp
test_Ismnemonic dec
test_Ismnemonic dex
test_Ismnemonic dey
test_Ismnemonic eor
test_Ismnemonic inc
test_Ismnemonic inx
test_Ismnemonic iny
test_Ismnemonic isc
test_Ismnemonic jam
test_Ismnemonic jmp
test_Ismnemonic jsr
test_Ismnemonic las
test_Ismnemonic lax
test_Ismnemonic lda
test_Ismnemonic ldx
test_Ismnemonic ldy
test_Ismnemonic lsr
test_Ismnemonic nop
test_Ismnemonic ora
test_Ismnemonic pha
test_Ismnemonic php
test_Ismnemonic pla
test_Ismnemonic plp
test_Ismnemonic rla
test_Ismnemonic rol
test_Ismnemonic ror
test_Ismnemonic rra
test_Ismnemonic rti
test_Ismnemonic rts
test_Ismnemonic sax
test_Ismnemonic sbc
test_Ismnemonic sec
test_Ismnemonic sed
test_Ismnemonic sei
test_Ismnemonic sha
test_Ismnemonic shx
test_Ismnemonic shy
test_Ismnemonic slo
test_Ismnemonic sre
test_Ismnemonic sta
test_Ismnemonic stx
test_Ismnemonic sty
test_Ismnemonic tas
test_Ismnemonic tax
test_Ismnemonic tay
test_Ismnemonic tsx
test_Ismnemonic txa
test_Ismnemonic txs
test_Ismnemonic tya
.setcpu "6502DTV"
test_Ismnemonic adc
test_Ismnemonic alr
test_Ismnemonic anc
test_Ismnemonic and
test_Ismnemonic ane
test_Ismnemonic arr
test_Ismnemonic asl
test_Ismnemonic axs
test_Ismnemonic bcc
test_Ismnemonic bcs
test_Ismnemonic beq
test_Ismnemonic bit
test_Ismnemonic bmi
test_Ismnemonic bne
test_Ismnemonic bpl
test_Ismnemonic bra
test_Ismnemonic brk
test_Ismnemonic bvc
test_Ismnemonic bvs
test_Ismnemonic clc
test_Ismnemonic cld
test_Ismnemonic cli
test_Ismnemonic clv
test_Ismnemonic cmp
test_Ismnemonic cpx
test_Ismnemonic cpy
test_Ismnemonic dec
test_Ismnemonic dex
test_Ismnemonic dey
test_Ismnemonic eor
test_Ismnemonic inc
test_Ismnemonic inx
test_Ismnemonic iny
test_Ismnemonic jmp
test_Ismnemonic jsr
test_Ismnemonic las
test_Ismnemonic lax
test_Ismnemonic lda
test_Ismnemonic ldx
test_Ismnemonic ldy
test_Ismnemonic lsr
test_Ismnemonic nop
test_Ismnemonic ora
test_Ismnemonic pha
test_Ismnemonic php
test_Ismnemonic pla
test_Ismnemonic plp
test_Ismnemonic rla
test_Ismnemonic rol
test_Ismnemonic ror
test_Ismnemonic rra
test_Ismnemonic rti
test_Ismnemonic rts
test_Ismnemonic sac
test_Ismnemonic sbc
test_Ismnemonic sec
test_Ismnemonic sed
test_Ismnemonic sei
test_Ismnemonic sha
test_Ismnemonic shx
test_Ismnemonic shy
test_Ismnemonic sir
test_Ismnemonic sta
test_Ismnemonic stx
test_Ismnemonic sty
test_Ismnemonic tax
test_Ismnemonic tay
test_Ismnemonic tsx
test_Ismnemonic txa
test_Ismnemonic txs
test_Ismnemonic tya
.setcpu "65SC02"
test_Ismnemonic adc
test_Ismnemonic and
test_Ismnemonic asl
test_Ismnemonic bcc
test_Ismnemonic bcs
test_Ismnemonic beq
test_Ismnemonic bit
test_Ismnemonic bmi
test_Ismnemonic bne
test_Ismnemonic bpl
test_Ismnemonic bra
test_Ismnemonic brk
test_Ismnemonic bvc
test_Ismnemonic bvs
test_Ismnemonic clc
test_Ismnemonic cld
test_Ismnemonic cli
test_Ismnemonic clv
test_Ismnemonic cmp
test_Ismnemonic cpx
test_Ismnemonic cpy
test_Ismnemonic dea
test_Ismnemonic dec
test_Ismnemonic dex
test_Ismnemonic dey
test_Ismnemonic eor
test_Ismnemonic ina
test_Ismnemonic inc
test_Ismnemonic inx
test_Ismnemonic iny
test_Ismnemonic jmp
test_Ismnemonic jsr
test_Ismnemonic lda
test_Ismnemonic ldx
test_Ismnemonic ldy
test_Ismnemonic lsr
test_Ismnemonic nop
test_Ismnemonic ora
test_Ismnemonic pha
test_Ismnemonic php
test_Ismnemonic phx
test_Ismnemonic phy
test_Ismnemonic pla
test_Ismnemonic plp
test_Ismnemonic plx
test_Ismnemonic ply
test_Ismnemonic rol
test_Ismnemonic ror
test_Ismnemonic rti
test_Ismnemonic rts
test_Ismnemonic sbc
test_Ismnemonic sec
test_Ismnemonic sed
test_Ismnemonic sei
test_Ismnemonic sta
test_Ismnemonic stx
test_Ismnemonic sty
test_Ismnemonic stz
test_Ismnemonic tax
test_Ismnemonic tay
test_Ismnemonic trb
test_Ismnemonic tsb
test_Ismnemonic tsx
test_Ismnemonic txa
test_Ismnemonic txs
test_Ismnemonic tya
.setcpu "65C02"
test_Ismnemonic adc
test_Ismnemonic and
test_Ismnemonic asl
test_Ismnemonic bbr0
test_Ismnemonic bbr1
test_Ismnemonic bbr2
test_Ismnemonic bbr3
test_Ismnemonic bbr4
test_Ismnemonic bbr5
test_Ismnemonic bbr6
test_Ismnemonic bbr7
test_Ismnemonic bbs0
test_Ismnemonic bbs1
test_Ismnemonic bbs2
test_Ismnemonic bbs3
test_Ismnemonic bbs4
test_Ismnemonic bbs5
test_Ismnemonic bbs6
test_Ismnemonic bbs7
test_Ismnemonic bcc
test_Ismnemonic bcs
test_Ismnemonic beq
test_Ismnemonic bit
test_Ismnemonic bmi
test_Ismnemonic bne
test_Ismnemonic bpl
test_Ismnemonic bra
test_Ismnemonic brk
test_Ismnemonic bvc
test_Ismnemonic bvs
test_Ismnemonic clc
test_Ismnemonic cld
test_Ismnemonic cli
test_Ismnemonic clv
test_Ismnemonic cmp
test_Ismnemonic cpx
test_Ismnemonic cpy
test_Ismnemonic dea
test_Ismnemonic dec
test_Ismnemonic dex
test_Ismnemonic dey
test_Ismnemonic eor
test_Ismnemonic ina
test_Ismnemonic inc
test_Ismnemonic inx
test_Ismnemonic iny
test_Ismnemonic jmp
test_Ismnemonic jsr
test_Ismnemonic lda
test_Ismnemonic ldx
test_Ismnemonic ldy
test_Ismnemonic lsr
test_Ismnemonic nop
test_Ismnemonic ora
test_Ismnemonic pha
test_Ismnemonic php
test_Ismnemonic phx
test_Ismnemonic phy
test_Ismnemonic pla
test_Ismnemonic plp
test_Ismnemonic plx
test_Ismnemonic ply
test_Ismnemonic rmb0
test_Ismnemonic rmb1
test_Ismnemonic rmb2
test_Ismnemonic rmb3
test_Ismnemonic rmb4
test_Ismnemonic rmb5
test_Ismnemonic rmb6
test_Ismnemonic rmb7
test_Ismnemonic rol
test_Ismnemonic ror
test_Ismnemonic rti
test_Ismnemonic rts
test_Ismnemonic sbc
test_Ismnemonic sec
test_Ismnemonic sed
test_Ismnemonic sei
test_Ismnemonic smb0
test_Ismnemonic smb1
test_Ismnemonic smb2
test_Ismnemonic smb3
test_Ismnemonic smb4
test_Ismnemonic smb5
test_Ismnemonic smb6
test_Ismnemonic smb7
test_Ismnemonic sta
test_Ismnemonic stp
test_Ismnemonic stx
test_Ismnemonic sty
test_Ismnemonic stz
test_Ismnemonic tax
test_Ismnemonic tay
test_Ismnemonic trb
test_Ismnemonic tsb
test_Ismnemonic tsx
test_Ismnemonic txa
test_Ismnemonic txs
test_Ismnemonic tya
test_Ismnemonic wai
.setcpu "4510"
test_Ismnemonic adc
test_Ismnemonic and
test_Ismnemonic asl
test_Ismnemonic asr
test_Ismnemonic asw
test_Ismnemonic bbr0
test_Ismnemonic bbr1
test_Ismnemonic bbr2
test_Ismnemonic bbr3
test_Ismnemonic bbr4
test_Ismnemonic bbr5
test_Ismnemonic bbr6
test_Ismnemonic bbr7
test_Ismnemonic bbs0
test_Ismnemonic bbs1
test_Ismnemonic bbs2
test_Ismnemonic bbs3
test_Ismnemonic bbs4
test_Ismnemonic bbs5
test_Ismnemonic bbs6
test_Ismnemonic bbs7
test_Ismnemonic bcc
test_Ismnemonic bcs
test_Ismnemonic beq
test_Ismnemonic bit
test_Ismnemonic bmi
test_Ismnemonic bne
test_Ismnemonic bpl
test_Ismnemonic bra
test_Ismnemonic brk
test_Ismnemonic bsr
test_Ismnemonic bvc
test_Ismnemonic bvs
test_Ismnemonic clc
test_Ismnemonic cld
test_Ismnemonic cle
test_Ismnemonic cli
test_Ismnemonic clv
test_Ismnemonic cmp
test_Ismnemonic cpx
test_Ismnemonic cpy
test_Ismnemonic cpz
test_Ismnemonic dea
test_Ismnemonic dec
test_Ismnemonic dew
test_Ismnemonic dex
test_Ismnemonic dey
test_Ismnemonic dez
test_Ismnemonic eom
test_Ismnemonic eor
test_Ismnemonic ina
test_Ismnemonic inc
test_Ismnemonic inw
test_Ismnemonic inx
test_Ismnemonic iny
test_Ismnemonic inz
test_Ismnemonic jmp
test_Ismnemonic jsr
test_Ismnemonic lbcc
test_Ismnemonic lbcs
test_Ismnemonic lbeq
test_Ismnemonic lbmi
test_Ismnemonic lbne
test_Ismnemonic lbpl
test_Ismnemonic lbra
test_Ismnemonic lbvc
test_Ismnemonic lbvs
test_Ismnemonic lda
test_Ismnemonic ldx
test_Ismnemonic ldy
test_Ismnemonic ldz
test_Ismnemonic lsr
test_Ismnemonic map
test_Ismnemonic neg
test_Ismnemonic nop
test_Ismnemonic ora
test_Ismnemonic pha
test_Ismnemonic phd
test_Ismnemonic php
test_Ismnemonic phw
test_Ismnemonic phx
test_Ismnemonic phy
test_Ismnemonic phz
test_Ismnemonic pla
test_Ismnemonic plp
test_Ismnemonic plx
test_Ismnemonic ply
test_Ismnemonic plz
test_Ismnemonic rmb0
test_Ismnemonic rmb1
test_Ismnemonic rmb2
test_Ismnemonic rmb3
test_Ismnemonic rmb4
test_Ismnemonic rmb5
test_Ismnemonic rmb6
test_Ismnemonic rmb7
test_Ismnemonic rol
test_Ismnemonic ror
test_Ismnemonic row
test_Ismnemonic rti
test_Ismnemonic rtn
test_Ismnemonic rts
test_Ismnemonic sbc
test_Ismnemonic sec
test_Ismnemonic sed
test_Ismnemonic see
test_Ismnemonic sei
test_Ismnemonic smb0
test_Ismnemonic smb1
test_Ismnemonic smb2
test_Ismnemonic smb3
test_Ismnemonic smb4
test_Ismnemonic smb5
test_Ismnemonic smb6
test_Ismnemonic smb7
test_Ismnemonic sta
test_Ismnemonic stx
test_Ismnemonic sty
test_Ismnemonic stz
test_Ismnemonic tab
test_Ismnemonic tax
test_Ismnemonic tay
test_Ismnemonic taz
test_Ismnemonic tba
test_Ismnemonic trb
test_Ismnemonic tsb
test_Ismnemonic tsx
test_Ismnemonic tsy
test_Ismnemonic txa
test_Ismnemonic txs
test_Ismnemonic tya
test_Ismnemonic tys
test_Ismnemonic tza
.setcpu "HuC6280"
test_Ismnemonic adc
test_Ismnemonic and
test_Ismnemonic asl
test_Ismnemonic bbr0
test_Ismnemonic bbr1
test_Ismnemonic bbr2
test_Ismnemonic bbr3
test_Ismnemonic bbr4
test_Ismnemonic bbr5
test_Ismnemonic bbr6
test_Ismnemonic bbr7
test_Ismnemonic bbs0
test_Ismnemonic bbs1
test_Ismnemonic bbs2
test_Ismnemonic bbs3
test_Ismnemonic bbs4
test_Ismnemonic bbs5
test_Ismnemonic bbs6
test_Ismnemonic bbs7
test_Ismnemonic bcc
test_Ismnemonic bcs
test_Ismnemonic beq
test_Ismnemonic bit
test_Ismnemonic bmi
test_Ismnemonic bne
test_Ismnemonic bpl
test_Ismnemonic bra
test_Ismnemonic brk
test_Ismnemonic bsr
test_Ismnemonic bvc
test_Ismnemonic bvs
test_Ismnemonic cla
test_Ismnemonic clc
test_Ismnemonic cld
test_Ismnemonic cli
test_Ismnemonic clv
test_Ismnemonic clx
test_Ismnemonic cly
test_Ismnemonic cmp
test_Ismnemonic cpx
test_Ismnemonic cpy
test_Ismnemonic csh
test_Ismnemonic csl
test_Ismnemonic dea
test_Ismnemonic dec
test_Ismnemonic dex
test_Ismnemonic dey
test_Ismnemonic eor
test_Ismnemonic ina
test_Ismnemonic inc
test_Ismnemonic inx
test_Ismnemonic iny
test_Ismnemonic jmp
test_Ismnemonic jsr
test_Ismnemonic lda
test_Ismnemonic ldx
test_Ismnemonic ldy
test_Ismnemonic lsr
test_Ismnemonic nop
test_Ismnemonic ora
test_Ismnemonic pha
test_Ismnemonic php
test_Ismnemonic phx
test_Ismnemonic phy
test_Ismnemonic pla
test_Ismnemonic plp
test_Ismnemonic plx
test_Ismnemonic ply
test_Ismnemonic rmb0
test_Ismnemonic rmb1
test_Ismnemonic rmb2
test_Ismnemonic rmb3
test_Ismnemonic rmb4
test_Ismnemonic rmb5
test_Ismnemonic rmb6
test_Ismnemonic rmb7
test_Ismnemonic rol
test_Ismnemonic ror
test_Ismnemonic rti
test_Ismnemonic rts
test_Ismnemonic sax
test_Ismnemonic say
test_Ismnemonic sbc
test_Ismnemonic sec
test_Ismnemonic sed
test_Ismnemonic sei
test_Ismnemonic set
test_Ismnemonic smb0
test_Ismnemonic smb1
test_Ismnemonic smb2
test_Ismnemonic smb3
test_Ismnemonic smb4
test_Ismnemonic smb5
test_Ismnemonic smb6
test_Ismnemonic smb7
test_Ismnemonic st0
test_Ismnemonic st1
test_Ismnemonic st2
test_Ismnemonic sta
test_Ismnemonic stx
test_Ismnemonic sty
test_Ismnemonic stz
test_Ismnemonic sxy
test_Ismnemonic tai
test_Ismnemonic tam
test_Ismnemonic tam0
test_Ismnemonic tam1
test_Ismnemonic tam2
test_Ismnemonic tam3
test_Ismnemonic tam4
test_Ismnemonic tam5
test_Ismnemonic tam6
test_Ismnemonic tam7
test_Ismnemonic tax
test_Ismnemonic tay
test_Ismnemonic tdd
test_Ismnemonic tia
test_Ismnemonic tii
test_Ismnemonic tin
test_Ismnemonic tma
test_Ismnemonic tma0
test_Ismnemonic tma1
test_Ismnemonic tma2
test_Ismnemonic tma3
test_Ismnemonic tma4
test_Ismnemonic tma5
test_Ismnemonic tma6
test_Ismnemonic tma7
test_Ismnemonic trb
test_Ismnemonic tsb
test_Ismnemonic tst
test_Ismnemonic tsx
test_Ismnemonic txa
test_Ismnemonic txs
test_Ismnemonic tya
.setcpu "65816"
test_Ismnemonic adc
test_Ismnemonic and
test_Ismnemonic asl
test_Ismnemonic bcc
test_Ismnemonic bcs
test_Ismnemonic beq
test_Ismnemonic bit
test_Ismnemonic bmi
test_Ismnemonic bne
test_Ismnemonic bpl
test_Ismnemonic bra
test_Ismnemonic brk
test_Ismnemonic brl
test_Ismnemonic bvc
test_Ismnemonic bvs
test_Ismnemonic clc
test_Ismnemonic cld
test_Ismnemonic cli
test_Ismnemonic clv
test_Ismnemonic cmp
test_Ismnemonic cop
test_Ismnemonic cpa
test_Ismnemonic cpx
test_Ismnemonic cpy
test_Ismnemonic dea
test_Ismnemonic dec
test_Ismnemonic dex
test_Ismnemonic dey
test_Ismnemonic eor
test_Ismnemonic ina
test_Ismnemonic inc
test_Ismnemonic inx
test_Ismnemonic iny
test_Ismnemonic jml
test_Ismnemonic jmp
test_Ismnemonic jsl
test_Ismnemonic jsr
test_Ismnemonic lda
test_Ismnemonic ldx
test_Ismnemonic ldy
test_Ismnemonic lsr
test_Ismnemonic mvn
test_Ismnemonic mvp
test_Ismnemonic nop
test_Ismnemonic ora
test_Ismnemonic pea
test_Ismnemonic pei
test_Ismnemonic per
test_Ismnemonic pha
test_Ismnemonic phb
test_Ismnemonic phd
test_Ismnemonic phk
test_Ismnemonic php
test_Ismnemonic phx
test_Ismnemonic phy
test_Ismnemonic pla
test_Ismnemonic plb
test_Ismnemonic pld
test_Ismnemonic plp
test_Ismnemonic plx
test_Ismnemonic ply
test_Ismnemonic rep
test_Ismnemonic rol
test_Ismnemonic ror
test_Ismnemonic rti
test_Ismnemonic rtl
test_Ismnemonic rts
test_Ismnemonic sbc
test_Ismnemonic sec
test_Ismnemonic sed
test_Ismnemonic sei
test_Ismnemonic sep
test_Ismnemonic sta
test_Ismnemonic stp
test_Ismnemonic stx
test_Ismnemonic sty
test_Ismnemonic stz
test_Ismnemonic swa
test_Ismnemonic tad
test_Ismnemonic tas
test_Ismnemonic tax
test_Ismnemonic tay
test_Ismnemonic tcd
test_Ismnemonic tcs
test_Ismnemonic tda
test_Ismnemonic tdc
test_Ismnemonic trb
test_Ismnemonic tsa
test_Ismnemonic tsb
test_Ismnemonic tsc
test_Ismnemonic tsx
test_Ismnemonic txa
test_Ismnemonic txs
test_Ismnemonic txy
test_Ismnemonic tya
test_Ismnemonic tyx
test_Ismnemonic wai
test_Ismnemonic wdm
test_Ismnemonic xba
test_Ismnemonic xce
.setcpu "sweet16"
test_Ismnemonic add
test_Ismnemonic bc
test_Ismnemonic bk
test_Ismnemonic bm
test_Ismnemonic bm1
test_Ismnemonic bnc
test_Ismnemonic bnm1
test_Ismnemonic bnz
test_Ismnemonic bp
test_Ismnemonic br
test_Ismnemonic bs
test_Ismnemonic bz
test_Ismnemonic cpr
test_Ismnemonic dcr
test_Ismnemonic inr
test_Ismnemonic ld
test_Ismnemonic ldd
test_Ismnemonic pop
test_Ismnemonic popd
test_Ismnemonic rs
test_Ismnemonic rtn
test_Ismnemonic set
test_Ismnemonic st
test_Ismnemonic std
test_Ismnemonic stp
test_Ismnemonic sub
.setcpu "6502"
.import _exit
.export _main
_main:
.if ismnemonic_error
ldx #$01
.else
ldx #$00
.endif
txa
jmp _exit

View File

@ -0,0 +1,7 @@
/* too big for internal integer representation */
unsigned long huge = 4294967296;
int main(void)
{
return 0;
}

View File

@ -0,0 +1,20 @@
/* Integer constant overflow warnings. */
/* Warnings as errors. */
#pragma warn(error,on)
/* Warn on const overflow */
#pragma warn(const-overflow,on)
unsigned char a = 256;
signed char b = 128;
unsigned char c = -129;
unsigned short int d = 0x00010000;
unsigned short int e = 0x80000000;
signed short int f = 32768L;
signed short int g = -32769L;
int main(void)
{
return 0;
}

View File

@ -163,6 +163,11 @@ $(WORKDIR)/goto.$1.$2.prg: goto.c $(ISEQUAL) | $(WORKDIR)
$(CC65) -t sim$2 -$1 -o $$@ $$< 2>$(WORKDIR)/goto.$1.$2.out
$(ISEQUAL) $(WORKDIR)/goto.$1.$2.out goto.ref
# should not compile until 3-byte struct by value tests are re-enabled
$(WORKDIR)/struct-by-value.$1.$2.prg: struct-by-value.c | $(WORKDIR)
$(if $(QUIET),echo misc/struct-by-value.$1.$2.prg)
$(NOT) $(CC65) -t sim$2 -$1 -o $$@ $$< $(NULLERR)
# the rest are tests that fail currently for one reason or another
$(WORKDIR)/sitest.$1.$2.prg: sitest.c | $(WORKDIR)
@echo "FIXME: " $$@ "currently does not compile."

156
test/misc/struct-by-value.c Normal file
View File

@ -0,0 +1,156 @@
/* This test ensures that compilation fails if a 3-byte struct by value
** is attempted, to avoid re-introducting a bug by accident:
** https://github.com/cc65/cc65/issues/2022
** When 3-byte structs are re-enabled, this test will compile,
** which should trigger a "misc" test failure.
** When this happens:
** Delete this comment from the top.
** Replace test/val/struct-by-value.c with this one.
** See:
** https://github.com/cc65/cc65/issues/2086
*/
/* Test of passing and returning structs by value.
Structs of 1, 2, 3, 4 bytes are supported.
Note that structs of 3 bytes had a past issue:
https://github.com/cc65/cc65/issues/2022
*/
int fail = 0;
struct s1 { char a; };
struct s2 { char a, b; };
struct s3 { char a, b, c; };
struct s4 { char a, b, c, d; };
const struct s1 c1 = { 1 };
const struct s2 c2 = { 2, 3 };
const struct s3 c3 = { 4, 5, 6 };
const struct s4 c4 = { 7, 8, 9, 10 };
struct s1 return1() { return c1; }
struct s2 return2() { return c2; }
struct s3 return3() { return c3; }
struct s4 return4() { return c4; }
int compare1(struct s1 a, struct s1 b)
{
if (a.a != b.a) return 1;
return 0;
}
int compare2(struct s2 a, struct s2 b)
{
if (a.a != b.a) return 1;
if (a.b != b.b) return 1;
return 0;
}
int compare3(struct s3 a, struct s3 b)
{
if (a.a != b.a) return 1;
if (a.b != b.b) return 1;
if (a.c != b.c) return 1;
return 0;
}
int compare4(struct s4 a, struct s4 b)
{
if (a.a != b.a) return 1;
if (a.b != b.b) return 1;
if (a.c != b.c) return 1;
if (a.d != b.d) return 1;
return 0;
}
int pass1(struct s1 p1)
{
struct s1 a1;
a1 = p1;
if (a1.a != c1.a) return 1;
return 0;
}
int pass2(struct s2 p2)
{
struct s2 a2;
a2 = p2;
if (a2.a != c2.a) return 1;
if (a2.b != c2.b) return 1;
return 0;
}
int pass3(struct s3 p3)
{
struct s3 a3;
a3 = p3;
if (a3.a != c3.a) return 1;
if (a3.b != c3.b) return 1;
if (a3.c != c3.c) return 1;
return 0;
}
int pass4(struct s4 p4)
{
struct s4 a4;
a4 = p4;
if (a4.a != c4.a) return 1;
if (a4.b != c4.b) return 1;
if (a4.c != c4.c) return 1;
if (a4.d != c4.d) return 1;
return 0;
}
void reset(char* gg)
{
char i;
for (i=0;i<5;++i) gg[i] = 128+i;
}
int test(char* gg, char start)
{
char i;
for (i=start;i<5;++i)
if (gg[i] != 128+i) return 1;
return 0;
}
int main()
{
/* Used to check #2022 bug condition of extra bytes being overwritten. */
union
{
char gg[5];
struct s1 g1;
struct s2 g2;
struct s3 g3;
struct s4 g4;
} guard;
reset(guard.gg);
guard.g1 = return1();
fail += compare1(guard.g1,c1);
fail += test(guard.gg,1);
reset(guard.gg);
guard.g2 = return2();
fail += compare2(guard.g2,c2);
fail += test(guard.gg,2);
reset(guard.gg);
guard.g3 = return3();
fail += compare3(guard.g3,c3);
fail += test(guard.gg,3);
reset(guard.gg);
guard.g4 = return4();
fail += compare4(guard.g4,c4);
fail += test(guard.gg,4);
fail += pass1(c1);
fail += pass2(c2);
fail += pass3(c3);
fail += pass4(c4);
return fail;
}

View File

@ -68,7 +68,11 @@ compiler is working as expected (when the tests behave as described):
which will require additional changes to the makefile(s).
To run the tests use "make" in this (top) directory, the makefile should exit
These tests only require a subset of the platform libraries. In the (top)
directory above this one, "make libtest" can be used to build only those
libraries needed for testing, instead of "make lib".
To run the tests use "make" in this (test) directory, the makefile should exit
with no error.
When a test failed you can use "make continue" to run further tests.

View File

@ -22,7 +22,8 @@ ifdef QUIET
NULLERR = 2>$(NULLDEV)
endif
SIM65FLAGS = -x 5000000000 -c
# sim65 can support 64-bit cycle counts on some platforms, but not all. This must fit in 32-bit.
SIM65FLAGS = -x 4000000000 -c
CC65 := $(if $(wildcard ../../bin/cc65*),..$S..$Sbin$Scc65,cc65)
CA65 := $(if $(wildcard ../../bin/ca65*),..$S..$Sbin$Sca65,ca65)

View File

@ -31,7 +31,7 @@ CA65 := $(if $(wildcard ../../bin/ca65*),..$S..$Sbin$Sca65,ca65)
LD65 := $(if $(wildcard ../../bin/ld65*),..$S..$Sbin$Sld65,ld65)
SIM65 := $(if $(wildcard ../../bin/sim65*),..$S..$Sbin$Ssim65,sim65)
WORKDIR = ../../testwrk/val
WORKDIR = ../../testwrk/todo
OPTIONS = g O Os Osi Osir Osr Oi Oir Or
@ -49,7 +49,7 @@ $(WORKDIR):
define PRG_template
$(WORKDIR)/%.$1.$2.prg: %.c | $(WORKDIR)
$(if $(QUIET),echo val/$$*.$1.$2.prg)
$(if $(QUIET),echo todo/$$*.$1.$2.prg)
$(CC65) -t sim$2 $$(CC65FLAGS) -$1 -o $$(@:.prg=.s) $$< $(NULLERR)
$(CA65) -t sim$2 -o $$(@:.prg=.o) $$(@:.prg=.s) $(NULLERR)
$(LD65) -t sim$2 -o $$@ $$(@:.prg=.o) sim$2.lib $(NULLERR)

View File

@ -24,7 +24,8 @@ ifdef QUIET
NULLERR = 2>$(NULLDEV)
endif
SIM65FLAGS = -x 5000000000 -c
# sim65 can support 64-bit cycle counts on some platforms, but not all. This must fit in 32-bit.
SIM65FLAGS = -x 4000000000 -c
CC65 := $(if $(wildcard ../../bin/cc65*),..$S..$Sbin$Scc65,cc65)
CA65 := $(if $(wildcard ../../bin/ca65*),..$S..$Sbin$Sca65,ca65)

View File

@ -20,3 +20,4 @@
#define SIZEOF_LONG_32BIT
#define UNSIGNED_CHARS
#define UNSIGNED_BITFIELDS
#define INTEGER_CONSTANT_MAX_32BIT

View File

@ -4,6 +4,14 @@
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
*/
/* INTEGER_CONSTANT_MAX_32BIT
** This suppresses constants longer than 32-bit, which are now an error:
** https://github.com/cc65/cc65/pull/2084
** Because cc65's internal representation is implicitly/explicitly
** 32-bit in many places, values larger than this aren't representable,
** but also can't be checked for overflow once accepted.
*/
#include "common.h"
struct defs {
@ -62,7 +70,12 @@ long pow2(long n) {
return s;
}
long d[39], o[39], x[39];
#ifndef INTEGER_CONSTANT_MAX_32BIT
#define CTCOUNT 39
#else
#define CTCOUNT 36
#endif
long d[CTCOUNT], o[CTCOUNT], x[CTCOUNT];
#ifndef NO_OLD_FUNC_DECL
s241(pd0)
@ -212,13 +225,15 @@ int s241(struct defs *pd0) {
d[33] = 1073741823; o[33] = 07777777777; x[33] = 0x3fffffff;
d[34] = 1073741824; o[34] = 010000000000; x[34] = 0x40000000;
d[35] = 4294967295; o[35] = 037777777777; x[35] = 0xffffffff;
#if CTCOUNT > 36
d[36] = 4294967296; o[36] = 040000000000; x[36] = 0x100000000;
d[37] = 68719476735; o[37] = 0777777777777; x[37] = 0xfffffffff;
d[38] = 68719476736; o[38] = 01000000000000; x[38] = 0x1000000000;
#endif
/* WHEW! */
for (j=0; j<39; j++){
for (j=0; j<CTCOUNT; j++){
if ( g[j] != d[j]
|| d[j] != o[j]
|| o[j] != x[j]) {