mirror of
https://github.com/cc65/cc65.git
synced 2025-01-15 07:31:32 +00:00
Merge branch 'master' of https://github.com/cc65/cc65 into c1p
This commit is contained in:
commit
91e21ae024
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,5 +8,6 @@
|
||||
/mou/
|
||||
/ser/
|
||||
/targetutil/
|
||||
/testwrk/
|
||||
/tgi/
|
||||
/wrk/
|
||||
|
@ -6,21 +6,20 @@ all: gh-pages sf-files
|
||||
|
||||
GH_NAME = Oliver Schmidt
|
||||
GH_MAIL = ol.sc@web.de
|
||||
GH_PATH = ../gh-pages
|
||||
GH_PATH = ../doc
|
||||
|
||||
gh-pages:
|
||||
ifdef GH_TOKEN
|
||||
@echo 'git clone --branch=gh-pages https://$$(GH_TOKEN)@github.com/cc65/cc65.git $(GH_PATH)'
|
||||
@git clone --branch=gh-pages https://$(GH_TOKEN)@github.com/cc65/cc65.git $(GH_PATH)
|
||||
@echo 'git clone --branch=gh-pages https://$$(GH_TOKEN)@github.com/cc65/doc.git $(GH_PATH)'
|
||||
@git clone --branch=gh-pages https://$(GH_TOKEN)@github.com/cc65/doc.git $(GH_PATH)
|
||||
cd $(GH_PATH) && git config user.name "$(GH_NAME)"
|
||||
cd $(GH_PATH) && git config user.email "$(GH_MAIL)"
|
||||
cd $(GH_PATH) && git config push.default simple
|
||||
cd $(GH_PATH) && $(RM) -r doc
|
||||
cd $(GH_PATH) && mkdir doc
|
||||
cp html/*.* $(GH_PATH)/doc
|
||||
cd $(GH_PATH) && git add -A doc
|
||||
$(RM) $(GH_PATH)/*.*
|
||||
cp html/*.* $(GH_PATH)
|
||||
cd $(GH_PATH) && git add -A
|
||||
-cd $(GH_PATH) && git commit -m "Updated from commit $(TRAVIS_COMMIT)."
|
||||
cd $(GH_PATH) && git push
|
||||
cd $(GH_PATH) && git push -q
|
||||
endif
|
||||
|
||||
SF_USER = oliverschmidt
|
||||
|
@ -1,8 +1,8 @@
|
||||
[documentation](http://cc65.github.io/cc65/doc)
|
||||
[documentation](http://cc65.github.io/doc)
|
||||
|
||||
[wiki](https://github.com/cc65/wiki/wiki)
|
||||
[wiki](http://github.com/cc65/wiki/wiki)
|
||||
|
||||
[![build status](https://travis-ci.org/cc65/cc65.png)](https://travis-ci.org/cc65/cc65/builds)
|
||||
[![build status](http://travis-ci.org/cc65/cc65.png)](http://travis-ci.org/cc65/cc65/builds)
|
||||
|
||||
cc65 is a complete cross development package for 65(C)02 systems, including
|
||||
a powerful macro assembler, a C compiler, linker, librarian and several
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<article>
|
||||
<title>cc65 Documentation Overview
|
||||
<author><url url="https://github.com/cc65/cc65/">
|
||||
<author><url url="http://cc65.github.io/doc">
|
||||
<date>
|
||||
|
||||
<sect>Program documentation<p>
|
||||
|
98
libsrc/apple2/lseek.s
Normal file
98
libsrc/apple2/lseek.s
Normal file
@ -0,0 +1,98 @@
|
||||
;
|
||||
; Peter Ferrie, 21.11.2014
|
||||
;
|
||||
; off_t __fastcall__ lseek(int fd, off_t offset, int whence);
|
||||
;
|
||||
|
||||
.export _lseek
|
||||
.import popax
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "errno.inc"
|
||||
.include "mli.inc"
|
||||
.include "filedes.inc"
|
||||
|
||||
_lseek:
|
||||
; Save whence
|
||||
sta tmp1
|
||||
stx tmp2
|
||||
|
||||
; Get and save offset
|
||||
jsr popax
|
||||
sta ptr1
|
||||
stx ptr1+1
|
||||
jsr popax
|
||||
sta ptr2
|
||||
|
||||
; Get and process fd
|
||||
jsr popax
|
||||
jsr getfd ; Returns A, Y and C
|
||||
bcs errno
|
||||
|
||||
; Check for device
|
||||
cmp #$80
|
||||
bcs einval
|
||||
|
||||
; Valid whence values are 0..2
|
||||
ldx tmp2
|
||||
bne einval
|
||||
ldx tmp1
|
||||
cpx #3
|
||||
bcs einval
|
||||
|
||||
; Set fd
|
||||
sta mliparam + MLI::MARK::REF_NUM
|
||||
|
||||
txa
|
||||
beq cur
|
||||
lda #GET_EOF_CALL
|
||||
dex
|
||||
beq end
|
||||
|
||||
; SEEK_SET
|
||||
dex
|
||||
txa
|
||||
tay
|
||||
beq seek_common
|
||||
|
||||
; SEEK_CUR
|
||||
cur:
|
||||
lda #GET_MARK_CALL
|
||||
|
||||
; SEEK_END
|
||||
end:
|
||||
; MARK_COUNT must == EOF_COUNT, otherwise unexpected behaviour
|
||||
.assert MARK_COUNT = EOF_COUNT, error
|
||||
ldx #MARK_COUNT
|
||||
jsr callmli
|
||||
bcs oserr
|
||||
lda mliparam + MLI::MARK::POSITION
|
||||
ldx mliparam + MLI::MARK::POSITION+1
|
||||
ldy mliparam + MLI::MARK::POSITION+2
|
||||
|
||||
seek_common:
|
||||
adc ptr1
|
||||
sta mliparam + MLI::MARK::POSITION
|
||||
txa
|
||||
adc ptr1+1
|
||||
sta mliparam + MLI::MARK::POSITION+1
|
||||
tya
|
||||
adc ptr2
|
||||
sta mliparam + MLI::MARK::POSITION+2
|
||||
|
||||
; Set file pointer
|
||||
lda #SET_MARK_CALL
|
||||
ldx #MARK_COUNT
|
||||
jsr callmli
|
||||
bcs oserr
|
||||
|
||||
rts
|
||||
|
||||
; Load errno code
|
||||
einval: lda #EINVAL
|
||||
|
||||
; Set __errno
|
||||
errno: jmp __directerrno
|
||||
|
||||
; Set __oserror
|
||||
oserr: jmp __mappederrno
|
@ -215,7 +215,7 @@ static const struct {
|
||||
/* Instruction table for the 6502 with illegal instructions */
|
||||
static const struct {
|
||||
unsigned Count;
|
||||
InsDesc Ins[70];
|
||||
InsDesc Ins[75];
|
||||
} InsTab6502X = {
|
||||
sizeof (InsTab6502X.Ins) / sizeof (InsTab6502X.Ins[0]),
|
||||
{
|
||||
@ -223,6 +223,7 @@ static const struct {
|
||||
{ "ALR", 0x0800000, 0x4B, 0, PutAll }, /* X */
|
||||
{ "ANC", 0x0800000, 0x0B, 0, PutAll }, /* X */
|
||||
{ "AND", 0x080A26C, 0x20, 0, PutAll },
|
||||
{ "ANE", 0x0800000, 0x8B, 0, PutAll }, /* X */
|
||||
{ "ARR", 0x0800000, 0x6B, 0, PutAll }, /* X */
|
||||
{ "ASL", 0x000006e, 0x02, 1, PutAll },
|
||||
{ "AXS", 0x0800000, 0xCB, 0, PutAll }, /* X */
|
||||
@ -256,12 +257,12 @@ static const struct {
|
||||
{ "JMP", 0x0000808, 0x4c, 6, PutJMP },
|
||||
{ "JSR", 0x0000008, 0x20, 7, PutAll },
|
||||
{ "LAS", 0x0000200, 0xBB, 0, PutAll }, /* X */
|
||||
{ "LAX", 0x000A30C, 0xA3, 1, PutAll }, /* X */
|
||||
{ "LAX", 0x080A30C, 0xA3, 11, PutAll }, /* X */
|
||||
{ "LDA", 0x080A26C, 0xa0, 0, PutAll },
|
||||
{ "LDX", 0x080030C, 0xa2, 1, PutAll },
|
||||
{ "LDY", 0x080006C, 0xa0, 1, PutAll },
|
||||
{ "LSR", 0x000006F, 0x42, 1, PutAll },
|
||||
{ "NOP", 0x0000001, 0xea, 0, PutAll },
|
||||
{ "NOP", 0x080006D, 0x00, 10, PutAll }, /* X */
|
||||
{ "ORA", 0x080A26C, 0x00, 0, PutAll },
|
||||
{ "PHA", 0x0000001, 0x48, 0, PutAll },
|
||||
{ "PHP", 0x0000001, 0x08, 0, PutAll },
|
||||
@ -278,11 +279,15 @@ static const struct {
|
||||
{ "SEC", 0x0000001, 0x38, 0, PutAll },
|
||||
{ "SED", 0x0000001, 0xf8, 0, PutAll },
|
||||
{ "SEI", 0x0000001, 0x78, 0, PutAll },
|
||||
{ "SHA", 0x0002200, 0x93, 1, PutAll }, /* X */
|
||||
{ "SHX", 0x0000200, 0x9e, 1, PutAll }, /* X */
|
||||
{ "SHY", 0x0000040, 0x9c, 1, PutAll }, /* X */
|
||||
{ "SLO", 0x000A26C, 0x03, 0, PutAll }, /* X */
|
||||
{ "SRE", 0x000A26C, 0x43, 0, PutAll }, /* X */
|
||||
{ "STA", 0x000A26C, 0x80, 0, PutAll },
|
||||
{ "STX", 0x000010c, 0x82, 1, PutAll },
|
||||
{ "STY", 0x000002c, 0x80, 1, PutAll },
|
||||
{ "TAS", 0x0000200, 0x9b, 0, PutAll }, /* X */
|
||||
{ "TAX", 0x0000001, 0xaa, 0, PutAll },
|
||||
{ "TAY", 0x0000001, 0xa8, 0, PutAll },
|
||||
{ "TSX", 0x0000001, 0xba, 0, PutAll },
|
||||
@ -783,9 +788,9 @@ static const InsTable* InsTabs[CPU_COUNT] = {
|
||||
const InsTable* InsTab = (const InsTable*) &InsTab6502;
|
||||
|
||||
/* Table to build the effective 65xx opcode from a base opcode and an
|
||||
** addressing mode.
|
||||
** addressing mode. (The value in the table is ORed with the base opcode)
|
||||
*/
|
||||
static unsigned char EATab[10][AM65I_COUNT] = {
|
||||
static unsigned char EATab[12][AM65I_COUNT] = {
|
||||
{ /* Table 0 */
|
||||
0x00, 0x00, 0x05, 0x0D, 0x0F, 0x15, 0x1D, 0x1F,
|
||||
0x00, 0x19, 0x12, 0x00, 0x07, 0x11, 0x17, 0x01,
|
||||
@ -846,6 +851,18 @@ static unsigned char EATab[10][AM65I_COUNT] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00
|
||||
},
|
||||
{ /* Table 10 (NOPs) */
|
||||
0xea, 0x00, 0x04, 0x0c, 0x00, 0x14, 0x1c, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
|
||||
0x00, 0x00, 0x00
|
||||
},
|
||||
{ /* Table 11 (LAX) */
|
||||
0x08, 0x08, 0x04, 0x0C, 0x00, 0x14, 0x1C, 0x00,
|
||||
0x14, 0x1C, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08,
|
||||
0x00, 0x00, 0x80
|
||||
},
|
||||
};
|
||||
|
||||
/* Table to build the effective SWEET16 opcode from a base opcode and an
|
||||
|
@ -51,7 +51,7 @@
|
||||
const OpcDesc OpcTable_6502X[256] = {
|
||||
{ "brk", 1, flNone, OH_Implicit }, /* $00 */
|
||||
{ "ora", 2, flUseLabel, OH_DirectXIndirect }, /* $01 */
|
||||
{ "kil", 1, flNone, OH_Implicit }, /* $02 */
|
||||
{ "jam", 1, flNone, OH_Implicit }, /* $02 */
|
||||
{ "slo", 2, flUseLabel, OH_DirectXIndirect }, /* $03 */
|
||||
{ "nop", 2, flUseLabel, OH_Direct }, /* $04 */
|
||||
{ "ora", 2, flUseLabel, OH_Direct }, /* $05 */
|
||||
@ -67,7 +67,7 @@ const OpcDesc OpcTable_6502X[256] = {
|
||||
{ "slo", 3, flUseLabel|flAbsOverride, OH_Absolute }, /* $0f */
|
||||
{ "bpl", 2, flLabel, OH_Relative }, /* $10 */
|
||||
{ "ora", 2, flUseLabel, OH_DirectIndirectY }, /* $11 */
|
||||
{ "kil", 1, flNone, OH_Implicit }, /* $12 */
|
||||
{ "jam", 1, flNone, OH_Implicit }, /* $12 */
|
||||
{ "slo", 2, flUseLabel, OH_DirectIndirectY }, /* $13 */
|
||||
{ "nop", 2, flUseLabel, OH_DirectX }, /* $14 */
|
||||
{ "ora", 2, flUseLabel, OH_DirectX }, /* $15 */
|
||||
@ -83,7 +83,7 @@ const OpcDesc OpcTable_6502X[256] = {
|
||||
{ "slo", 3, flUseLabel|flAbsOverride, OH_AbsoluteX }, /* $1f */
|
||||
{ "jsr", 3, flLabel, OH_Absolute }, /* $20 */
|
||||
{ "and", 2, flUseLabel, OH_DirectXIndirect }, /* $21 */
|
||||
{ "kil", 1, flNone, OH_Implicit, }, /* $22 */
|
||||
{ "jam", 1, flNone, OH_Implicit, }, /* $22 */
|
||||
{ "rla", 2, flUseLabel, OH_DirectXIndirect }, /* $23 */
|
||||
{ "bit", 2, flUseLabel, OH_Direct }, /* $24 */
|
||||
{ "and", 2, flUseLabel, OH_Direct }, /* $25 */
|
||||
@ -99,7 +99,7 @@ const OpcDesc OpcTable_6502X[256] = {
|
||||
{ "rla", 3, flUseLabel|flAbsOverride, OH_Absolute }, /* $2f */
|
||||
{ "bmi", 2, flLabel, OH_Relative }, /* $30 */
|
||||
{ "and", 2, flUseLabel, OH_DirectIndirectY }, /* $31 */
|
||||
{ "kil", 1, flNone, OH_Implicit }, /* $32 */
|
||||
{ "jam", 1, flNone, OH_Implicit }, /* $32 */
|
||||
{ "rla", 2, flUseLabel, OH_DirectIndirectY }, /* $33 */
|
||||
{ "nop", 2, flUseLabel, OH_DirectX }, /* $34 */
|
||||
{ "and", 2, flUseLabel, OH_DirectX }, /* $35 */
|
||||
@ -115,7 +115,7 @@ const OpcDesc OpcTable_6502X[256] = {
|
||||
{ "rla", 3, flUseLabel|flAbsOverride, OH_AbsoluteX }, /* $3f */
|
||||
{ "rti", 1, flNone, OH_Rts }, /* $40 */
|
||||
{ "eor", 2, flUseLabel, OH_DirectXIndirect }, /* $41 */
|
||||
{ "kil", 1, flNone, OH_Implicit }, /* $42 */
|
||||
{ "jam", 1, flNone, OH_Implicit }, /* $42 */
|
||||
{ "sre", 2, flUseLabel, OH_DirectXIndirect }, /* $43 */
|
||||
{ "nop", 2, flUseLabel, OH_Direct }, /* $44 */
|
||||
{ "eor", 2, flUseLabel, OH_Direct }, /* $45 */
|
||||
@ -131,7 +131,7 @@ const OpcDesc OpcTable_6502X[256] = {
|
||||
{ "sre", 3, flUseLabel|flAbsOverride, OH_Absolute }, /* $4f */
|
||||
{ "bvc", 2, flLabel, OH_Relative }, /* $50 */
|
||||
{ "eor", 2, flUseLabel, OH_DirectIndirectY }, /* $51 */
|
||||
{ "kil", 1, flNone, OH_Implicit }, /* $52 */
|
||||
{ "jam", 1, flNone, OH_Implicit }, /* $52 */
|
||||
{ "sre", 2, flUseLabel, OH_DirectIndirectY }, /* $53 */
|
||||
{ "nop", 2, flUseLabel, OH_DirectX }, /* $54 */
|
||||
{ "eor", 2, flUseLabel, OH_DirectX }, /* $55 */
|
||||
@ -147,7 +147,7 @@ const OpcDesc OpcTable_6502X[256] = {
|
||||
{ "sre", 3, flUseLabel|flAbsOverride, OH_AbsoluteX }, /* $5f */
|
||||
{ "rts", 1, flNone, OH_Rts }, /* $60 */
|
||||
{ "adc", 2, flUseLabel, OH_DirectXIndirect }, /* $61 */
|
||||
{ "kil", 1, flNone, OH_Implicit }, /* $62 */
|
||||
{ "jam", 1, flNone, OH_Implicit }, /* $62 */
|
||||
{ "rra", 2, flUseLabel, OH_DirectXIndirect }, /* $63 */
|
||||
{ "nop", 2, flUseLabel, OH_Direct }, /* $64 */
|
||||
{ "adc", 2, flUseLabel, OH_Direct }, /* $65 */
|
||||
@ -163,7 +163,7 @@ const OpcDesc OpcTable_6502X[256] = {
|
||||
{ "rra", 3, flUseLabel|flAbsOverride, OH_Absolute }, /* $6f */
|
||||
{ "bvs", 2, flLabel, OH_Relative }, /* $70 */
|
||||
{ "adc", 2, flUseLabel, OH_DirectIndirectY }, /* $71 */
|
||||
{ "kil", 1, flNone, OH_Implicit }, /* $72 */
|
||||
{ "jam", 1, flNone, OH_Implicit }, /* $72 */
|
||||
{ "rra", 2, flUseLabel, OH_DirectIndirectY }, /* $73 */
|
||||
{ "nop", 2, flUseLabel, OH_DirectX }, /* $74 */
|
||||
{ "adc", 2, flUseLabel, OH_DirectX }, /* $75 */
|
||||
@ -195,7 +195,7 @@ const OpcDesc OpcTable_6502X[256] = {
|
||||
{ "sax", 3, flUseLabel|flAbsOverride, OH_Absolute }, /* $8f */
|
||||
{ "bcc", 2, flLabel, OH_Relative }, /* $90 */
|
||||
{ "sta", 2, flUseLabel, OH_DirectIndirectY }, /* $91 */
|
||||
{ "kil", 1, flNone, OH_Implicit }, /* $92 */
|
||||
{ "jam", 1, flNone, OH_Implicit }, /* $92 */
|
||||
{ "ahx", 2, flUseLabel, OH_DirectIndirectY }, /* $93 */
|
||||
{ "sty", 2, flUseLabel, OH_DirectX }, /* $94 */
|
||||
{ "sta", 2, flUseLabel, OH_DirectX }, /* $95 */
|
||||
@ -227,7 +227,7 @@ const OpcDesc OpcTable_6502X[256] = {
|
||||
{ "lax", 3, flUseLabel|flAbsOverride, OH_Absolute }, /* $af */
|
||||
{ "bcs", 2, flLabel, OH_Relative }, /* $b0 */
|
||||
{ "lda", 2, flUseLabel, OH_DirectIndirectY }, /* $b1 */
|
||||
{ "kil", 1, flNone, OH_Implicit }, /* $b2 */
|
||||
{ "jam", 1, flNone, OH_Implicit }, /* $b2 */
|
||||
{ "lax", 2, flUseLabel, OH_DirectIndirectY }, /* $b3 */
|
||||
{ "ldy", 2, flUseLabel, OH_DirectX }, /* $b4 */
|
||||
{ "lda", 2, flUseLabel, OH_DirectX }, /* $b5 */
|
||||
@ -259,7 +259,7 @@ const OpcDesc OpcTable_6502X[256] = {
|
||||
{ "dcp", 3, flUseLabel|flAbsOverride, OH_Absolute }, /* $cf */
|
||||
{ "bne", 2, flLabel, OH_Relative }, /* $d0 */
|
||||
{ "cmp", 2, flUseLabel, OH_DirectIndirectY }, /* $d1 */
|
||||
{ "kil", 1, flNone, OH_Implicit }, /* $d2 */
|
||||
{ "jam", 1, flNone, OH_Implicit }, /* $d2 */
|
||||
{ "dcp", 2, flUseLabel, OH_DirectIndirectY }, /* $d3 */
|
||||
{ "nop", 2, flUseLabel, OH_DirectX }, /* $d4 */
|
||||
{ "cmp", 2, flUseLabel, OH_DirectX }, /* $d5 */
|
||||
@ -291,7 +291,7 @@ const OpcDesc OpcTable_6502X[256] = {
|
||||
{ "isc", 3, flUseLabel|flAbsOverride, OH_Absolute }, /* $ef */
|
||||
{ "beq", 2, flLabel, OH_Relative }, /* $f0 */
|
||||
{ "sbc", 2, flUseLabel, OH_DirectIndirectY }, /* $f1 */
|
||||
{ "kil", 1, flNone, OH_Implicit }, /* $f2 */
|
||||
{ "jam", 1, flNone, OH_Implicit }, /* $f2 */
|
||||
{ "isc", 2, flUseLabel, OH_DirectIndirectY }, /* $f3 */
|
||||
{ "nop", 2, flUseLabel, OH_DirectX }, /* $f4 */
|
||||
{ "sbc", 2, flUseLabel, OH_DirectX }, /* $f5 */
|
||||
|
@ -60,7 +60,8 @@
|
||||
/* Name of program file */
|
||||
const char* ProgramFile;
|
||||
|
||||
|
||||
/* exit simulator after MaxCycles Cycles */
|
||||
unsigned long MaxCycles = 0;
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Code */
|
||||
@ -75,6 +76,7 @@ static void Usage (void)
|
||||
" -h\t\t\tHelp (this text)\n"
|
||||
" -v\t\t\tIncrease verbosity\n"
|
||||
" -V\t\t\tPrint the simulator version number\n"
|
||||
" -x <num>\t\tExit simulator after <num> cycles\n"
|
||||
"\n"
|
||||
"Long options:\n"
|
||||
" --help\t\tHelp (this text)\n"
|
||||
@ -111,7 +113,12 @@ static void OptVersion (const char* Opt attribute ((unused)),
|
||||
fprintf (stderr, "sim65 V%s\n", GetVersionAsString ());
|
||||
}
|
||||
|
||||
|
||||
static void OptQuitXIns (const char* Opt attribute ((unused)),
|
||||
const char* Arg attribute ((unused)))
|
||||
/* quit after MaxCycles cycles */
|
||||
{
|
||||
MaxCycles = strtoul(Arg, NULL, 0);
|
||||
}
|
||||
|
||||
static void ReadProgramFile (void)
|
||||
/* Load program into memory */
|
||||
@ -197,6 +204,10 @@ int main (int argc, char* argv[])
|
||||
OptVersion (Arg, 0);
|
||||
break;
|
||||
|
||||
case 'x':
|
||||
OptQuitXIns (Arg, GetArg (&I, 2));
|
||||
break;
|
||||
|
||||
default:
|
||||
UnknownOption (Arg);
|
||||
break;
|
||||
@ -225,6 +236,11 @@ int main (int argc, char* argv[])
|
||||
|
||||
while (1) {
|
||||
ExecuteInsn ();
|
||||
if (MaxCycles && (GetCycles () >= MaxCycles)) {
|
||||
Error ("Maximum number of cycles reached.");
|
||||
exit (-99); /* do not ues EXIT_FAILURE to avoid conflicts with the
|
||||
same value being used in a test program */
|
||||
}
|
||||
}
|
||||
|
||||
/* Return an apropriate exit code */
|
||||
|
1
test/.gitignore
vendored
Normal file
1
test/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.o
|
52
test/Makefile
Normal file
52
test/Makefile
Normal file
@ -0,0 +1,52 @@
|
||||
|
||||
# toplevel makefile for the regression tests
|
||||
|
||||
MAKE := make --no-print-dir
|
||||
|
||||
ifneq ($(shell echo),)
|
||||
CMD_EXE = 1
|
||||
endif
|
||||
|
||||
ifdef CMD_EXE
|
||||
RM := del /f
|
||||
EXE := .exe
|
||||
MKDIR = mkdir
|
||||
RMDIR = rmdir
|
||||
else
|
||||
RM := rm -f
|
||||
EXE :=
|
||||
MKDIR = mkdir -p
|
||||
RMDIR = rmdir
|
||||
endif
|
||||
|
||||
WORKDIR := ../testwrk
|
||||
|
||||
.PHONY: dotests clean
|
||||
|
||||
all: dotests
|
||||
|
||||
$(WORKDIR):
|
||||
@$(MKDIR) $(WORKDIR)
|
||||
|
||||
$(WORKDIR)/bdiff$(EXE): $(WORKDIR)
|
||||
@$(CC) -o $(WORKDIR)/bdiff$(EXE) bdiff.c
|
||||
|
||||
dotests: $(WORKDIR)/bdiff$(EXE)
|
||||
@$(MAKE) -C val clean all
|
||||
@$(MAKE) -C ref clean all
|
||||
@$(MAKE) -C err clean all
|
||||
@$(MAKE) -C misc clean all
|
||||
|
||||
continue: $(WORKDIR)/bdiff$(EXE)
|
||||
@$(MAKE) -C val all
|
||||
@$(MAKE) -C ref all
|
||||
@$(MAKE) -C err all
|
||||
@$(MAKE) -C misc all
|
||||
|
||||
clean:
|
||||
@$(MAKE) -C val clean
|
||||
@$(MAKE) -C ref clean
|
||||
@$(MAKE) -C err clean
|
||||
@$(MAKE) -C misc clean
|
||||
@$(RM) $(WORKDIR)/bdiff$(EXE)
|
||||
@$(RMDIR) $(WORKDIR)
|
28
test/bdiff.c
Normal file
28
test/bdiff.c
Normal file
@ -0,0 +1,28 @@
|
||||
|
||||
// minimal tool to compare two binaries
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
FILE *f1, *f2;
|
||||
if (argc < 3) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
f1 = fopen(argv[1], "rb");
|
||||
f2 = fopen(argv[2], "rb");
|
||||
if ((f1 == NULL) || (f2 == NULL)) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
for(;;) {
|
||||
if (feof(f1) && feof(f2)) {
|
||||
return EXIT_SUCCESS;
|
||||
} else if (feof(f1) || feof(f2)) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
if (fgetc(f1) != fgetc(f2)) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
}
|
52
test/err/Makefile
Normal file
52
test/err/Makefile
Normal file
@ -0,0 +1,52 @@
|
||||
|
||||
# makefile for the tests that MUST NOT compile
|
||||
|
||||
ifneq ($(shell echo),)
|
||||
CMD_EXE = 1
|
||||
endif
|
||||
|
||||
CC65FLAGS = -t sim6502
|
||||
|
||||
CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
|
||||
|
||||
ifdef CMD_EXE
|
||||
RM := del /f
|
||||
else
|
||||
RM := rm -f
|
||||
endif
|
||||
|
||||
WORKDIR := ./../../testwrk
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
SOURCES := $(wildcard *.c)
|
||||
TESTS := $(SOURCES:%.c=$(WORKDIR)/%.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.o.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.os.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osi.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osir.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oi.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oir.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.or.prg)
|
||||
|
||||
all: $(TESTS)
|
||||
|
||||
$(WORKDIR)/%.prg: %.c
|
||||
! $(CL65) $(CC65FLAGS) $< -o $@
|
||||
$(WORKDIR)/%.o.prg: %.c
|
||||
! $(CL65) -O $(CC65FLAGS) $< -o $@
|
||||
$(WORKDIR)/%.os.prg: %.c
|
||||
! $(CL65) -Os $(CC65FLAGS) $< -o $@
|
||||
$(WORKDIR)/%.osi.prg: %.c
|
||||
! $(CL65) -Osi $(CC65FLAGS) $< -o $@
|
||||
$(WORKDIR)/%.osir.prg: %.c
|
||||
! $(CL65) -Osir $(CC65FLAGS) $< -o $@
|
||||
$(WORKDIR)/%.oi.prg: %.c
|
||||
! $(CL65) -Oi $(CC65FLAGS) $< -o $@
|
||||
$(WORKDIR)/%.oir.prg: %.c
|
||||
! $(CL65) -Oir $(CC65FLAGS) $< -o $@
|
||||
$(WORKDIR)/%.or.prg: %.c
|
||||
! $(CL65) -Or $(CC65FLAGS) $< -o $@
|
||||
clean:
|
||||
@$(RM) $(TESTS)
|
||||
@$(RM) $(SOURCES:%.c=$(WORKDIR)/%.o)
|
67
test/misc/Makefile
Normal file
67
test/misc/Makefile
Normal file
@ -0,0 +1,67 @@
|
||||
|
||||
# makefile for the remaining tests that need special care in one way or another
|
||||
|
||||
ifneq ($(shell echo),)
|
||||
CMD_EXE = 1
|
||||
endif
|
||||
|
||||
CC65FLAGS = -t sim6502
|
||||
SIM65FLAGS = -x 200000000
|
||||
|
||||
CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
|
||||
SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65)
|
||||
|
||||
ifdef CMD_EXE
|
||||
RM := del /f
|
||||
else
|
||||
RM := rm -f
|
||||
endif
|
||||
|
||||
WORKDIR := ./../../testwrk
|
||||
|
||||
DIFF := $(WORKDIR)/bdiff
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
SOURCES := $(wildcard *.c)
|
||||
TESTS := $(SOURCES:%.c=$(WORKDIR)/%.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.o.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.os.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osi.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osir.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oi.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oir.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.or.prg)
|
||||
|
||||
# FIXME: actually use/build differently optimized programs here
|
||||
|
||||
all: $(TESTS)
|
||||
|
||||
# should compile, but then hangs in an endless loop
|
||||
$(WORKDIR)/endless%prg: endless.c
|
||||
$(CL65) $(CC65FLAGS) $< -o $@
|
||||
! $(SIM65) $(SIM65FLAGS) $@
|
||||
|
||||
# these need reference data that cant be generated by a host compiled program
|
||||
# in a useful way
|
||||
$(WORKDIR)/limits%prg: limits.c
|
||||
$(CL65) $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/limits.out
|
||||
$(DIFF) $(WORKDIR)/limits.out limits.ref
|
||||
|
||||
# the rest are tests that fail currently for one reason or another
|
||||
$(WORKDIR)/fields%prg: fields.c
|
||||
@echo "FIXME: " $@ "will currently fail"
|
||||
$(CL65) $(CC65FLAGS) $< -o $@
|
||||
-$(SIM65) $(SIM65FLAGS) $@
|
||||
$(WORKDIR)/sitest%prg: sitest.c
|
||||
@echo "FIXME: " $@ "will currently fail"
|
||||
-$(CL65) $(CC65FLAGS) $< -o $@
|
||||
-$(SIM65) $(SIM65FLAGS) $@
|
||||
|
||||
clean:
|
||||
@$(RM) $(TESTS)
|
||||
@$(RM) $(SOURCES:%.c=$(WORKDIR)/%.o)
|
||||
@$(RM) $(SOURCES:%.c=$(WORKDIR)/%.out)
|
||||
|
||||
|
22
test/misc/common.h
Normal file
22
test/misc/common.h
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define NO_OLD_FUNC_DECL
|
||||
#define NO_TYPELESS_INT
|
||||
#define NO_TYPELESS_INT_PTR
|
||||
#define MAIN_RETURNS_INT
|
||||
#define NO_IMPLICIT_FUNC_PROTOTYPES
|
||||
#define NO_FLOATS
|
||||
#define NO_WCHAR
|
||||
#define NO_EMPTY_FUNC_ARGS
|
||||
#define NO_SLOPPY_STRUCT_INIT
|
||||
#define NO_FUNCS_TAKE_STRUCTS
|
||||
#define NO_FUNCS_RETURN_STRUCTS
|
||||
#define CAST_STRUCT_PTR
|
||||
#define NO_TYPELESS_STRUCT_PTR
|
||||
#define NO_IMPLICIT_FUNCPTR_CONV
|
||||
#define SIZEOF_INT_16BIT
|
||||
#define SIZEOF_LONG_32BIT
|
||||
#define UNSIGNED_CHARS
|
||||
#define UNSIGNED_BITFIELDS
|
13
test/misc/endless.c
Normal file
13
test/misc/endless.c
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printf("entering endless loop\n");
|
||||
for(;;) {
|
||||
;
|
||||
}
|
||||
printf("error: should not come here\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
@ -4,6 +4,8 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef NO_BITFIELDS
|
||||
|
||||
main()
|
24
test/misc/limits.ref
Normal file
24
test/misc/limits.ref
Normal file
@ -0,0 +1,24 @@
|
||||
CHAR_MAX: 0x000000ff=255
|
||||
UCHAR_MAX: 0x000000ff=255
|
||||
SCHAR_MAX: 0x0000007f=127
|
||||
SHRT_MAX: 0x00007fff=32767
|
||||
USHRT_MAX: 0x0000ffff=-1
|
||||
SSHRT_MAX: 0x00007fff=32767
|
||||
INT_MAX: 0x00007fff=32767
|
||||
UINT_MAX: 0x0000ffff=-1
|
||||
SINT_MAX: 0x00007fff=32767
|
||||
LONG_MAX: 0x7fffffff=2147483647
|
||||
ULONG_MAX: 0xffffffff=-1
|
||||
SLONG_MAX: 0x7fffffff=2147483647
|
||||
CHAR_MIN: 0x00000000=0
|
||||
UCHAR_MIN: 0x00000000=0
|
||||
SCHAR_MIN: 0x0000ff80=-128
|
||||
SHRT_MIN: 0x00008000=-32768
|
||||
USHRT_MIN: 0x00000000=0
|
||||
SSHRT_MIN: 0x00008000=-32768
|
||||
INT_MIN: 0x00008000=-32768
|
||||
UINT_MIN: 0x00000000=0
|
||||
SINT_MIN: 0x00008000=-32768
|
||||
LONG_MIN: 0x80000000=-2147483648
|
||||
ULONG_MIN: 0x00000000=0
|
||||
SLONG_MIN: 0x80000000=-2147483648
|
25
test/readme.txt
Normal file
25
test/readme.txt
Normal file
@ -0,0 +1,25 @@
|
||||
This directory contains test code for automatic regression testing of the CC65
|
||||
compiler.
|
||||
|
||||
|
||||
/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
|
||||
|
||||
/ref - these tests produce output that must be compared with reference output
|
||||
|
||||
/err - contains tests that MUST NOT compile
|
||||
|
||||
/misc - a few tests that need special care of some sort
|
||||
|
||||
|
||||
to run the tests use "make" in this (top) directory, the makefile should exit
|
||||
with no error.
|
||||
|
||||
when a test failed you can use "make continue" to run further tests
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
TODO:
|
||||
|
||||
- reduce usage of "common.h" to a minimum
|
||||
- convert more tests from using reference output to returning an exit code
|
@ -4,6 +4,8 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int up[15], down[15], rows[8], x[8];
|
||||
void queens(int c);
|
||||
void print(void);
|
||||
|
92
test/ref/Makefile
Normal file
92
test/ref/Makefile
Normal file
@ -0,0 +1,92 @@
|
||||
|
||||
# makefile for the regression tests that generate output which has to be
|
||||
# compared with reference output
|
||||
|
||||
ifneq ($(shell echo),)
|
||||
CMD_EXE = 1
|
||||
endif
|
||||
|
||||
CC65FLAGS = -t sim6502
|
||||
SIM65FLAGS = -x 200000000
|
||||
|
||||
CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
|
||||
SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65)
|
||||
|
||||
ifdef CMD_EXE
|
||||
RM := del /f
|
||||
else
|
||||
RM := rm -f
|
||||
endif
|
||||
|
||||
WORKDIR := ./../../testwrk
|
||||
|
||||
DIFF := $(WORKDIR)/bdiff
|
||||
|
||||
CFLAGS := -O2 -Wall -W -Wextra -fwrapv -fno-strict-overflow
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
REFS := $(patsubst %.c,$(WORKDIR)/%.ref,$(wildcard *.c))
|
||||
|
||||
SOURCES := $(wildcard *.c)
|
||||
TESTS := $(SOURCES:%.c=$(WORKDIR)/%.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.o.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.os.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osi.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osir.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oi.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oir.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.or.prg)
|
||||
|
||||
all: $(REFS) $(TESTS)
|
||||
|
||||
$(WORKDIR)/%.ref: %.c
|
||||
$(CC) $(CFLAGS) $< -o $(WORKDIR)/$*.host
|
||||
$(WORKDIR)/$*.host > $@
|
||||
|
||||
$(WORKDIR)/%.prg: %.c $(WORKDIR)/%.ref
|
||||
$(CL65) $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out
|
||||
$(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref
|
||||
|
||||
$(WORKDIR)/%.o.prg: %.c $(WORKDIR)/%.ref
|
||||
$(CL65) -O $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out
|
||||
$(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref
|
||||
|
||||
$(WORKDIR)/%.os.prg: %.c $(WORKDIR)/%.ref
|
||||
$(CL65) -Os $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out
|
||||
$(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref
|
||||
|
||||
$(WORKDIR)/%.osi.prg: %.c $(WORKDIR)/%.ref
|
||||
$(CL65) -Osi $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out
|
||||
$(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref
|
||||
|
||||
$(WORKDIR)/%.osir.prg: %.c $(WORKDIR)/%.ref
|
||||
$(CL65) -Osir $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out
|
||||
$(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref
|
||||
|
||||
$(WORKDIR)/%.oi.prg: %.c $(WORKDIR)/%.ref
|
||||
$(CL65) -Oi $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out
|
||||
$(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref
|
||||
|
||||
$(WORKDIR)/%.oir.prg: %.c $(WORKDIR)/%.ref
|
||||
$(CL65) -Oir $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out
|
||||
$(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref
|
||||
|
||||
$(WORKDIR)/%.or.prg: %.c $(WORKDIR)/%.ref
|
||||
$(CL65) -Or $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@ > $(WORKDIR)/$*.out
|
||||
$(DIFF) $(WORKDIR)/$*.out $(WORKDIR)/$*.ref
|
||||
|
||||
clean:
|
||||
@$(RM) $(TESTS)
|
||||
@$(RM) $(SOURCES:%.c=$(WORKDIR)/%.o)
|
||||
@$(RM) $(SOURCES:%.c=$(WORKDIR)/%.out)
|
||||
@$(RM) $(SOURCES:%.c=$(WORKDIR)/%.ref)
|
||||
@$(RM) $(SOURCES:%.c=$(WORKDIR)/%.host)
|
@ -5,6 +5,8 @@
|
||||
!!AUTHOR!!
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
long a; /* must be static life */
|
||||
long b; /* must be static life */
|
||||
|
||||
|
@ -13,6 +13,8 @@ optimizations. If I remove the struct inside f() it compiles fine ?!?
|
||||
Best, Oliver
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
void f(void){struct{int i;}d;}
|
||||
struct{void(*p)(void);}s={f};
|
||||
|
||||
|
@ -5,6 +5,8 @@
|
||||
!!AUTHOR!!
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
cc65 doesn't compile this, if i use the "-O"-option.
|
||||
but it works with "while(!0)"; instead of "for(;;);"
|
||||
|
@ -5,6 +5,8 @@
|
||||
!!AUTHOR!!
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
there is a bug in the preprocessor (i think) ... the following works
|
||||
(compiles) correctly:
|
||||
|
@ -5,6 +5,8 @@
|
||||
!!AUTHOR!!
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct Record {
|
||||
struct Record *PtrComp;
|
||||
int x;
|
||||
|
@ -5,6 +5,8 @@
|
||||
!!AUTHOR!! Oliver Schmidt
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
After spending a "little" time I finally succeeded in isolating an
|
||||
(maybe THE) optimizer bug causing Contiki to fail.
|
||||
|
@ -18,6 +18,8 @@
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int foo=0,bar=2;
|
||||
|
||||
int main(void)
|
||||
|
@ -5,6 +5,8 @@
|
||||
!!AUTHOR!! Johan Kotlinski
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
This produces the compiler error "test.c(9): Error: Assignment to const"
|
||||
Shouldn't be an error, should it? baz is const, bar isn't.
|
||||
|
@ -5,6 +5,8 @@
|
||||
!!AUTHOR!! Johan Kotlinski
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
...gives "test.c(2): Error: Variable `foo' has unknown size" using -Cl.
|
||||
Is it really unknown?
|
||||
|
@ -8,6 +8,8 @@
|
||||
test2 and test3 will result in an endless loop (SVN version: 4974M)
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define OPENTEST()
|
||||
#define CLOSETEST()
|
||||
|
||||
|
@ -8,11 +8,16 @@
|
||||
cf - print character frequencies
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
FILE *in;
|
||||
|
||||
#define INFILE "cf.in"
|
||||
#define GETCHAR() fgetc(in)
|
||||
|
||||
#ifndef NO_FLOATS
|
||||
float f[0x100];
|
||||
@ -35,6 +40,11 @@ char *argv[];
|
||||
signed cutoff;
|
||||
#endif
|
||||
|
||||
in = fopen(INFILE, "rb");
|
||||
if (in == NULL) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (argc <= 1)
|
||||
#ifndef NO_FLOATS
|
||||
cutoff = 0.0;
|
||||
@ -176,6 +186,6 @@ char *argv[];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
fclose(in);
|
||||
return 0;
|
||||
}
|
||||
|
19
test/ref/cf.in
Executable file
19
test/ref/cf.in
Executable file
@ -0,0 +1,19 @@
|
||||
start cf.input >
|
||||
The sky above the port was the color of television, tuned
|
||||
to a dead channel.
|
||||
"It's not like I'm using," Case heard someone say, as he
|
||||
shouldered his way through the crowd around the door of the
|
||||
Chat. "It's like my body's developed this massive drug deficiency."
|
||||
It was a Sprawl voice and a Sprawl joke. The Chatsubo
|
||||
was a bar for professional expatriates; you could drink there
|
||||
for a week and never hear two words in Japanese.
|
||||
Ratz was tending bar, his prosthetic arm jerking monotonously
|
||||
as he filled a tray of glasses with draft Kirin. He saw
|
||||
Case and smiled, his teeth a web work of East European steel
|
||||
and brown decay. Case found a place at the bar, between the
|
||||
unlikely tan on one of Lonny Zone's whores and the crisp naval
|
||||
uniform of a tall African whose cheekbones were ridged with
|
||||
Joe boys," Ratz said, shoving a draft across the bar with his
|
||||
good hand. "Maybe some business with you, Case?"
|
||||
Case shrugged. The girl to his right giggled and nudged
|
||||
< end cf.input
|
@ -4,6 +4,7 @@
|
||||
!!LICENCE!! Public Domain
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include <limits.h>
|
||||
#include <ctype.h>
|
||||
|
||||
|
22
test/ref/common.h
Normal file
22
test/ref/common.h
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define NO_OLD_FUNC_DECL
|
||||
#define NO_TYPELESS_INT
|
||||
#define NO_TYPELESS_INT_PTR
|
||||
#define MAIN_RETURNS_INT
|
||||
#define NO_IMPLICIT_FUNC_PROTOTYPES
|
||||
#define NO_FLOATS
|
||||
#define NO_WCHAR
|
||||
#define NO_EMPTY_FUNC_ARGS
|
||||
#define NO_SLOPPY_STRUCT_INIT
|
||||
#define NO_FUNCS_TAKE_STRUCTS
|
||||
#define NO_FUNCS_RETURN_STRUCTS
|
||||
#define CAST_STRUCT_PTR
|
||||
#define NO_TYPELESS_STRUCT_PTR
|
||||
#define NO_IMPLICIT_FUNCPTR_CONV
|
||||
#define SIZEOF_INT_16BIT
|
||||
#define SIZEOF_LONG_32BIT
|
||||
#define UNSIGNED_CHARS
|
||||
#define UNSIGNED_BITFIELDS
|
@ -4,6 +4,9 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include <stdio.h>
|
||||
|
||||
signed char c;
|
||||
signed short s;
|
||||
signed int i;
|
||||
|
@ -4,12 +4,13 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
/* todo: add back conditional stuff here ! */
|
||||
|
||||
typedef struct { int codes[3]; char name[6]; } Word;
|
||||
|
||||
#ifdef NO_IMPLICIT_FUNC_PROTOTYPES
|
||||
|
||||
#ifdef NO_IMPLICIT_FUNC_PROTOTYPES
|
||||
|
||||
#ifdef NO_OLD_FUNC_DECL
|
||||
f();
|
||||
void g(Word *p);
|
||||
@ -42,8 +43,8 @@ Word words[] = {
|
||||
|
||||
/*int x[][5] = { 1, 2, 3, 4, 0, { 5, 6 }, { 7 } };*/
|
||||
int x[][5] = { {1, 2, 3, 4, 0 }, { 5, 6 }, { 7 } };
|
||||
int *y[] = { x[0], x[1], x[2], 0 };
|
||||
|
||||
int *y[] = { x[0], x[1], x[2], 0 };
|
||||
|
||||
main()
|
||||
{
|
||||
int i, j;
|
||||
|
@ -5,6 +5,8 @@
|
||||
!!AUTHOR!! Groepaz/Hitmen
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
#if 1
|
||||
|
@ -4,6 +4,8 @@
|
||||
!!LICENCE!! GPL (?), read COPYING.GPL
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/*
|
||||
* Sample OTCC C example. You can uncomment the first line and install
|
||||
* otcc in /usr/local/bin to make otcc scripts !
|
||||
|
@ -4,11 +4,14 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef NO_FLOATS
|
||||
|
||||
main()
|
||||
{
|
||||
printf("NO_FLOATS\n\r");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
@ -4,6 +4,7 @@
|
||||
!!LICENCE!! public domain
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include <stdio.h>
|
||||
|
||||
/*
|
||||
@ -101,11 +102,11 @@ static void test30(void)
|
||||
cc65 seems to have problems here aswell ;/
|
||||
*/
|
||||
|
||||
int main(void) {
|
||||
int main(void) {
|
||||
test1();
|
||||
test2();
|
||||
test30();
|
||||
test31();
|
||||
/* test32(); */
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
|
@ -4,6 +4,7 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifndef NO_FUNCS_TAKE_STRUCTS
|
||||
|
@ -4,6 +4,8 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
typedef struct point { int x,y; } point;
|
||||
typedef struct rect { point pt1, pt2; } rect;
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef NO_IMPLICIT_FUNC_PROTOTYPES
|
||||
|
@ -11,6 +11,9 @@
|
||||
|
||||
#define MAXWORDS 250
|
||||
|
||||
FILE *in;
|
||||
#define getchar() fgetc(in)
|
||||
|
||||
struct node
|
||||
{
|
||||
int count; /* frequency count */
|
||||
@ -122,11 +125,17 @@ int main(void)
|
||||
struct node *root;
|
||||
char word[20];
|
||||
|
||||
in = fopen("wf1.in","rb");
|
||||
if (in == NULL) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
root = 0;
|
||||
next = 0;
|
||||
while (getword(word))
|
||||
lookup(word, &root)->count++;
|
||||
tprint(root);
|
||||
|
||||
fclose(in);
|
||||
return 0;
|
||||
}
|
||||
|
17
test/ref/wf1.in
Normal file
17
test/ref/wf1.in
Normal file
@ -0,0 +1,17 @@
|
||||
The sky above the port was the color of television, tuned
|
||||
to a dead channel.
|
||||
"It's not like I'm using," Case heard someone say, as he
|
||||
shouldered his way through the crowd around the door of the
|
||||
Chat. "It's like my body's developed this massive drug deficiency."
|
||||
It was a Sprawl voice and a Sprawl joke. The Chatsubo
|
||||
was a bar for professional expatriates; you could drink there
|
||||
for a week and never hear two words in Japanese.
|
||||
Ratz was tending bar, his prosthetic arm jerking monotonously
|
||||
as he filled a tray of glasses with draft Kirin. He saw
|
||||
Case and smiled, his teeth a web work of East European steel
|
||||
and brown decay. Case found a place at the bar, between the
|
||||
unlikely tan on one of Lonny Zone's whores and the crisp naval
|
||||
uniform of a tall African whose cheekbones were ridged with
|
||||
Joe boys," Ratz said, shoving a draft across the bar with his
|
||||
good hand. "Maybe some business with you, Case?"
|
||||
Case shrugged. The girl to his right giggled and nudged
|
@ -6,6 +6,8 @@
|
||||
|
||||
/*#define STANDALONE*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifndef YACCDBG
|
||||
|
||||
#include <stdio.h>
|
||||
@ -19,6 +21,9 @@
|
||||
|
||||
#endif
|
||||
|
||||
FILE *infile, *outfile;
|
||||
#define getchar() fgetc(infile)
|
||||
|
||||
/* hack the original tables to work with both petscii and ascii */
|
||||
#define CHARSETHACK
|
||||
|
||||
@ -61,7 +66,6 @@ int yymorfg;
|
||||
extern char *yysptr, yysbuf[];
|
||||
int yytchar;
|
||||
|
||||
/*FILE *yyin ={stdin}, *yyout ={stdout};*/
|
||||
#define yyin infile
|
||||
#define yyout outfile
|
||||
|
||||
@ -665,7 +669,13 @@ yyunput(c)
|
||||
main()
|
||||
{
|
||||
printf("main start\n");
|
||||
infile = fopen("yacc.in","rb");
|
||||
if (infile == NULL) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
outfile = stdout;
|
||||
yyparse();
|
||||
fclose(infile);
|
||||
printf("main end\n");
|
||||
return 0;
|
||||
}
|
||||
|
3
test/ref/yacc.in
Executable file
3
test/ref/yacc.in
Executable file
@ -0,0 +1,3 @@
|
||||
x=(e+1)*3/(3+7)
|
||||
|
||||
|
@ -5,6 +5,8 @@
|
||||
!!AUTHOR!! Groepaz/Hitmen
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
# define YYTYPE char
|
||||
struct yywork
|
||||
{
|
||||
|
70
test/val/Makefile
Normal file
70
test/val/Makefile
Normal file
@ -0,0 +1,70 @@
|
||||
|
||||
# makefile for the regression tests that return an error code on failure
|
||||
|
||||
ifneq ($(shell echo),)
|
||||
CMD_EXE = 1
|
||||
endif
|
||||
|
||||
CC65FLAGS = -t sim6502
|
||||
SIM65FLAGS = -x 200000000
|
||||
|
||||
CL65 := $(if $(wildcard ../../bin/cl65*),../../bin/cl65,cl65)
|
||||
SIM65 := $(if $(wildcard ../../bin/sim65*),../../bin/sim65,sim65)
|
||||
|
||||
ifdef CMD_EXE
|
||||
RM := del /f
|
||||
else
|
||||
RM := rm -f
|
||||
endif
|
||||
|
||||
WORKDIR := ./../../testwrk
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
SOURCES := $(wildcard *.c)
|
||||
TESTS := $(SOURCES:%.c=$(WORKDIR)/%.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.o.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.os.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osi.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.osir.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oi.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.oir.prg)
|
||||
TESTS += $(SOURCES:%.c=$(WORKDIR)/%.or.prg)
|
||||
|
||||
all: $(TESTS)
|
||||
|
||||
$(WORKDIR)/%.prg: %.c
|
||||
$(CL65) $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@
|
||||
|
||||
$(WORKDIR)/%.o.prg: %.c
|
||||
$(CL65) -O $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@
|
||||
|
||||
$(WORKDIR)/%.os.prg: %.c
|
||||
$(CL65) -Os $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@
|
||||
|
||||
$(WORKDIR)/%.osi.prg: %.c
|
||||
$(CL65) -Osi $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@
|
||||
|
||||
$(WORKDIR)/%.osir.prg: %.c
|
||||
$(CL65) -Osir $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@
|
||||
|
||||
$(WORKDIR)/%.oi.prg: %.c
|
||||
$(CL65) -Oi $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@
|
||||
|
||||
$(WORKDIR)/%.oir.prg: %.c
|
||||
$(CL65) -Oir $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@
|
||||
|
||||
$(WORKDIR)/%.or.prg: %.c
|
||||
$(CL65) -Or $(CC65FLAGS) $< -o $@
|
||||
$(SIM65) $(SIM65FLAGS) $@
|
||||
|
||||
clean:
|
||||
@$(RM) $(TESTS)
|
||||
@$(RM) $(SOURCES:%.c=$(WORKDIR)/%.o)
|
BIN
test/val/add1.o
BIN
test/val/add1.o
Binary file not shown.
Binary file not shown.
@ -4,6 +4,8 @@
|
||||
!!LICENCE!! GPL, read COPYING.GPL
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <limits.h>
|
||||
|
BIN
test/val/add3.o
BIN
test/val/add3.o
Binary file not shown.
Binary file not shown.
BIN
test/val/add4.o
BIN
test/val/add4.o
Binary file not shown.
Binary file not shown.
@ -5,6 +5,7 @@
|
||||
!!AUTHOR!! Johan Kotlinski
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
struct {
|
||||
|
22
test/val/common.h
Normal file
22
test/val/common.h
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define NO_OLD_FUNC_DECL
|
||||
#define NO_TYPELESS_INT
|
||||
#define NO_TYPELESS_INT_PTR
|
||||
#define MAIN_RETURNS_INT
|
||||
#define NO_IMPLICIT_FUNC_PROTOTYPES
|
||||
#define NO_FLOATS
|
||||
#define NO_WCHAR
|
||||
#define NO_EMPTY_FUNC_ARGS
|
||||
#define NO_SLOPPY_STRUCT_INIT
|
||||
#define NO_FUNCS_TAKE_STRUCTS
|
||||
#define NO_FUNCS_RETURN_STRUCTS
|
||||
#define CAST_STRUCT_PTR
|
||||
#define NO_TYPELESS_STRUCT_PTR
|
||||
#define NO_IMPLICIT_FUNCPTR_CONV
|
||||
#define SIZEOF_INT_16BIT
|
||||
#define SIZEOF_LONG_32BIT
|
||||
#define UNSIGNED_CHARS
|
||||
#define UNSIGNED_BITFIELDS
|
@ -17,9 +17,6 @@ unsigned char success = 0;
|
||||
unsigned char failures = 0;
|
||||
unsigned char dummy = 0;
|
||||
|
||||
#ifdef SUPPORT_BIT_TYPES
|
||||
bit bit0 = 0;
|
||||
#endif
|
||||
int int0 = 0;
|
||||
int int1 = 0;
|
||||
char char0 = 0;
|
||||
@ -291,19 +288,16 @@ void c_minus1(void)
|
||||
printf("(long0 != -1)\n");
|
||||
if(long0 != -1)
|
||||
{
|
||||
LOG_ERROR(1);
|
||||
failures++;
|
||||
}
|
||||
printf("(long0 > 0)\n");
|
||||
if(long0 > 0)
|
||||
{
|
||||
LOG_ERROR(1);
|
||||
failures++;
|
||||
}
|
||||
printf("(long1 < 0)\n");
|
||||
if(long1 < 0)
|
||||
{
|
||||
LOG_ERROR(1);
|
||||
failures++;
|
||||
}
|
||||
/*
|
||||
|
@ -4,6 +4,8 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
@ -4,6 +4,8 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
@ -4,6 +4,8 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
@ -4,6 +4,8 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
@ -4,6 +4,8 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
@ -4,6 +4,8 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifndef CQ26_INCLUDED
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
|
129
test/val/cq4.c
129
test/val/cq4.c
@ -4,6 +4,8 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
@ -41,7 +43,124 @@ struct defs {
|
||||
int crc; /* Cumulative return code */
|
||||
char rfs[8]; /* Return from section */
|
||||
|
||||
/*#include "cq26.c"*/ /* hardware check */
|
||||
#define CQ26_INCLUDED
|
||||
/*
|
||||
section s26, which pokes around at the hardware
|
||||
trying to figure out the characteristics of the machine that
|
||||
it is running on, saves information that is subsequently
|
||||
used by sections s626, s72, and s757. If this program is
|
||||
to be broken up into smallish pieces, say for running on
|
||||
a microcomputer, take care to see that s26 is called before
|
||||
calling any of the latter three sections.
|
||||
*/
|
||||
|
||||
/*
|
||||
2.6 Hardware Characteristics
|
||||
*/
|
||||
|
||||
#ifndef NO_OLD_FUNC_DECL
|
||||
s26(pd0)
|
||||
struct defs *pd0;
|
||||
{
|
||||
#else
|
||||
s26(struct defs *pd0) {
|
||||
#endif
|
||||
static char qs26[8] = "s26 ";
|
||||
char *ps, *pt;
|
||||
char c0, c1;
|
||||
#ifndef NO_FLOATS
|
||||
float temp, one, delta;
|
||||
double tempd, oned;
|
||||
#endif
|
||||
static char s[] = "%3d bits in %ss.\n";
|
||||
static char s2[] = "%e is the least number that can be added to 1. (%s).\n";
|
||||
|
||||
ps = qs26;
|
||||
pt = pd0->rfs;
|
||||
|
||||
while(*pt++ = *ps++);
|
||||
|
||||
/* Here, we shake the machinery a little to see what falls
|
||||
out. First, we find out how many bits are in a char. */
|
||||
|
||||
pd0->cbits = 0;
|
||||
c0 = 0;
|
||||
c1 = 1;
|
||||
|
||||
while(c0 != c1) {
|
||||
c1 = c1<<1;
|
||||
pd0->cbits = pd0->cbits+1;
|
||||
}
|
||||
/* That information lets us determine the size of everything else. */
|
||||
|
||||
pd0->ibits = pd0->cbits * sizeof(int);
|
||||
pd0->sbits = pd0->cbits * sizeof(short);
|
||||
pd0->lbits = pd0->cbits * sizeof(long);
|
||||
pd0->ubits = pd0->cbits * sizeof(unsigned);
|
||||
#ifndef NO_FLOATS
|
||||
pd0->fbits = pd0->cbits * sizeof(float);
|
||||
pd0->dbits = pd0->cbits * sizeof(double);
|
||||
#endif
|
||||
|
||||
/* We have now almost reconstructed the table in section 2.6, the
|
||||
exception being the range of the floating point hardware.
|
||||
Now there are just so many ways to conjure up a floating point
|
||||
representation system that it's damned near impossible to guess
|
||||
what's going on by writing a program to interpret bit patterns.
|
||||
Further, the information isn't all that useful, if we consider
|
||||
the fact that machines that won't handle numbers between 10**30
|
||||
and 10**-30 are very hard to find, and that people playing with
|
||||
numbers outside that range have a lot more to worry about than
|
||||
just the capacity of the characteristic.
|
||||
|
||||
A much more useful measure is the precision, which can be ex-
|
||||
pressed in terms of the smallest number that can be added to
|
||||
1. without loss of significance. We calculate that here, for
|
||||
float and double. */
|
||||
|
||||
#ifndef NO_FLOATS
|
||||
one = 1.;
|
||||
delta = 1.;
|
||||
temp = 0.;
|
||||
while(temp != one) {
|
||||
temp = one+delta;
|
||||
delta = delta/2.;
|
||||
}
|
||||
pd0->fprec = delta * 4.;
|
||||
oned = 1.;
|
||||
delta = 1.;
|
||||
tempd = 0.;
|
||||
while(tempd != oned) {
|
||||
tempd = oned+delta;
|
||||
delta = delta/2.;
|
||||
}
|
||||
pd0->dprec = delta * 4.;
|
||||
#endif
|
||||
|
||||
/* Now, if anyone's interested, we publish the results. */
|
||||
|
||||
#ifndef CQ26_INCLUDED
|
||||
if(pd0->flgm != 0) {
|
||||
printf(s,pd0->cbits,"char");
|
||||
printf(s,pd0->ibits,"int");
|
||||
printf(s,pd0->sbits,"short");
|
||||
printf(s,pd0->lbits,"long");
|
||||
printf(s,pd0->ubits,"unsigned");
|
||||
printf(s,pd0->fbits,"float");
|
||||
printf(s,pd0->dbits,"double");
|
||||
#ifndef NO_FLOATS
|
||||
printf(s2,pd0->fprec,"float");
|
||||
printf(s2,pd0->dprec,"double");
|
||||
#else
|
||||
printf("NO_FLOATS\n");
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
/* Since we are only exploring and perhaps reporting, but not
|
||||
testing any features, we cannot return an error code. */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int extvar;
|
||||
|
||||
@ -125,10 +244,13 @@ implementation */
|
||||
|
||||
target = ~0U;
|
||||
mask = 1;
|
||||
printf("sizeof target: %08x pd0->cbits: %08x\n", sizeof target, pd0->cbits);
|
||||
printf("mask: %08x target: %08x\n", mask, target);
|
||||
|
||||
for(j=0; j<(sizeof target)*pd0->cbits; j++){
|
||||
mask = mask⌖
|
||||
target = target>>1;
|
||||
printf("mask: %08x target: %08x\n", mask, target);
|
||||
}
|
||||
|
||||
if(mask != 1 || target != 0){
|
||||
@ -200,11 +322,12 @@ setev(){
|
||||
int section(int j,void* pd0){
|
||||
#endif
|
||||
switch(j){
|
||||
case 0: return s4(pd0);
|
||||
case 0: return s26(pd0);
|
||||
case 1: return s4(pd0);
|
||||
}
|
||||
}
|
||||
|
||||
#define cq_sections 1
|
||||
#define cq_sections 2
|
||||
|
||||
/*
|
||||
C REFERENCE MANUAL (main)
|
||||
|
@ -4,6 +4,8 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
@ -4,6 +4,8 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
@ -4,6 +4,8 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/*include "cq26.c"*/ /* hardware check */
|
||||
|
||||
struct defs {
|
||||
|
@ -4,6 +4,8 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
@ -4,6 +4,8 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
@ -4,6 +4,8 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
@ -4,6 +4,8 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
@ -4,6 +4,8 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
@ -4,6 +4,8 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
@ -4,6 +4,8 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
@ -4,6 +4,8 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
@ -4,6 +4,8 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
@ -4,6 +4,8 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
@ -4,6 +4,8 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
@ -4,6 +4,8 @@
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
struct defs {
|
||||
int cbits; /* No. of bits per char */
|
||||
int ibits; /* int */
|
||||
|
6
testcode/assembler/.gitignore
vendored
Normal file
6
testcode/assembler/.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
chkillegal.bin
|
||||
chklegal.bin
|
||||
chkall.bin
|
||||
legal.o
|
||||
illegal.o
|
||||
all.o
|
25
testcode/assembler/Makefile
Normal file
25
testcode/assembler/Makefile
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
all: chklegal.bin chkillegal.bin chkall.bin
|
||||
@#
|
||||
|
||||
.PHONY: chklegal.bin chkillegal.bin chkall.bin
|
||||
|
||||
chklegal.bin: legal.s
|
||||
../../bin/cl65 --target none --cpu 6502X -o chklegal.bin legal.s
|
||||
diff -q legal.ref chklegal.bin || hex chklegal.bin
|
||||
|
||||
chkillegal.bin: illegal.s
|
||||
../../bin/cl65 --target none --cpu 6502X -o chkillegal.bin illegal.s
|
||||
diff -q illegal.ref chkillegal.bin || hex chkillegal.bin
|
||||
|
||||
chkall.bin: all.s
|
||||
../../bin/cl65 --target none --cpu 6502X -o chkall.bin all.s
|
||||
|
||||
ref: legal.s illegal.s
|
||||
../../bin/cl65 --target none --cpu 6502X -o legal.ref legal.s
|
||||
../../bin/cl65 --target none --cpu 6502X -o illegal.ref illegal.s
|
||||
|
||||
clean:
|
||||
rm -f legal.o chklegal.bin
|
||||
rm -f illegal.o chkillegal.bin
|
||||
rm -f all.o chkall.bin
|
260
testcode/assembler/all.s
Normal file
260
testcode/assembler/all.s
Normal file
@ -0,0 +1,260 @@
|
||||
.setcpu "6502X"
|
||||
|
||||
; all legal and illegal opcodes as they would be disassembled by da65
|
||||
; note that this would not assemble into the exact same binary
|
||||
|
||||
brk ; 00
|
||||
ora ($12,x) ; 01 12
|
||||
jam ; 02
|
||||
slo ($12,x) ; 03 12
|
||||
nop $12 ; 04 12
|
||||
ora $12 ; 05 12
|
||||
asl $12 ; 06 12
|
||||
slo $12 ; 07 12
|
||||
php ; 08
|
||||
ora #$12 ; 09 12
|
||||
asl a ; 0a
|
||||
anc #$12 ; 0b 12
|
||||
nop $1234 ; 0c 34 12
|
||||
ora $1234 ; 0d 34 12
|
||||
asl $1234 ; 0e 34 12
|
||||
slo $1234 ; 0f 34 12
|
||||
bpl *+$14 ; 10 12
|
||||
ora ($12),y ; 11 12
|
||||
jam ; 12
|
||||
slo ($12),y ; 13 12
|
||||
nop $12,x ; 14 12
|
||||
ora $12,x ; 15 12
|
||||
asl $12,x ; 16 12
|
||||
slo $12,x ; 17 12
|
||||
clc ; 18
|
||||
ora $1234,y ; 19 34 12
|
||||
nop ; 1a
|
||||
slo $1234,y ; 1b 34 12
|
||||
nop $1234,x ; 1c 34 12
|
||||
ora $1234,x ; 1d 34 12
|
||||
asl $1234,x ; 1e 34 12
|
||||
slo $1234,x ; 1f 34 12
|
||||
jsr $1234 ; 20 34 12
|
||||
and ($12,x) ; 21 12
|
||||
jam ; 22
|
||||
rla ($12,x) ; 23 12
|
||||
bit $12 ; 24 12
|
||||
and $12 ; 25 12
|
||||
rol $12 ; 26 12
|
||||
rla $12 ; 27 12
|
||||
plp ; 28
|
||||
and #$12 ; 29 12
|
||||
rol a ; 2a
|
||||
anc #$12 ; 2b 12
|
||||
bit $1234 ; 2c 34 12
|
||||
and $1234 ; 2d 34 12
|
||||
rol $1234 ; 2e 34 12
|
||||
rla $1234 ; 2f 34 12
|
||||
bmi *+$14 ; 30 12
|
||||
and ($12),y ; 31 12
|
||||
jam ; 32
|
||||
rla ($12),y ; 33 12
|
||||
nop $12,x ; 34 12
|
||||
and $12,x ; 35 12
|
||||
rol $12,x ; 36 12
|
||||
rla $12,x ; 37 12
|
||||
sec ; 38
|
||||
and $1234,y ; 39 34 12
|
||||
nop ; 3a
|
||||
rla $1234,y ; 3b 34 12
|
||||
nop $1234,x ; 3c 34 12
|
||||
and $1234,x ; 3d 34 12
|
||||
rol $1234,x ; 3e 34 12
|
||||
rla $1234,x ; 3f 34 12
|
||||
rti ; 40
|
||||
eor ($12,x) ; 41 12
|
||||
jam ; 42
|
||||
sre ($12,x) ; 43 12
|
||||
nop $12 ; 44 12
|
||||
eor $12 ; 45 12
|
||||
lsr $12 ; 46 12
|
||||
sre $12 ; 47 12
|
||||
pha ; 48
|
||||
eor #$12 ; 49 12
|
||||
lsr a ; 4a
|
||||
alr #$12 ; 4b 12
|
||||
jmp $1234 ; 4c 34 12
|
||||
eor $1234 ; 4d 34 12
|
||||
lsr $1234 ; 4e 34 12
|
||||
sre $1234 ; 4f 34 12
|
||||
bvc *+$14 ; 50 12
|
||||
eor ($12),y ; 51 12
|
||||
jam ; 52
|
||||
sre ($12),y ; 53 12
|
||||
nop $12,x ; 54 12
|
||||
eor $12,x ; 55 12
|
||||
lsr $12,x ; 56 12
|
||||
sre $12,x ; 57 12
|
||||
cli ; 58
|
||||
eor $1234,y ; 59 34 12
|
||||
nop ; 5a
|
||||
sre $1234,y ; 5b 34 12
|
||||
nop $1234,x ; 5c 34 12
|
||||
eor $1234,x ; 5d 34 12
|
||||
lsr $1234,x ; 5e 34 12
|
||||
sre $1234,x ; 5f 34 12
|
||||
rts ; 60
|
||||
adc ($12,x) ; 61 12
|
||||
jam ; 62
|
||||
rra ($12,x) ; 63 12
|
||||
nop $12 ; 64 12
|
||||
adc $12 ; 65 12
|
||||
ror $12 ; 66 12
|
||||
rra $12 ; 67 12
|
||||
pla ; 68
|
||||
adc #$12 ; 69 12
|
||||
ror a ; 6a
|
||||
arr #$12 ; 6b 12
|
||||
jmp ($1234) ; 6c 34 12
|
||||
adc $1234 ; 6d 34 12
|
||||
ror $1234 ; 6e 34 12
|
||||
rra $1234 ; 6f 34 12
|
||||
bvs *+$14 ; 70 12
|
||||
adc ($12),y ; 71 12
|
||||
jam ; 72
|
||||
rra ($12),y ; 73 12
|
||||
nop $12,x ; 74 12
|
||||
adc $12,x ; 75 12
|
||||
ror $12,x ; 76 12
|
||||
rra $12,x ; 77 12
|
||||
sei ; 78
|
||||
adc $1234,y ; 79 34 12
|
||||
nop ; 7a
|
||||
rra $1234,y ; 7b 34 12
|
||||
nop $1234,x ; 7c 34 12
|
||||
adc $1234,x ; 7d 34 12
|
||||
ror $1234,x ; 7e 34 12
|
||||
rra $1234,x ; 7f 34 12
|
||||
nop #$12 ; 80 12
|
||||
sta ($12,x) ; 81 12
|
||||
nop #$12 ; 82 12
|
||||
sax ($12,x) ; 83 12
|
||||
sty $12 ; 84 12
|
||||
sta $12 ; 85 12
|
||||
stx $12 ; 86 12
|
||||
sax $12 ; 87 12
|
||||
dey ; 88
|
||||
nop #$12 ; 89 12
|
||||
txa ; 8a
|
||||
ane #$12 ; 8b 12
|
||||
sty $1234 ; 8c 34 12
|
||||
sta $1234 ; 8d 34 12
|
||||
stx $1234 ; 8e 34 12
|
||||
sax $1234 ; 8f 34 12
|
||||
bcc *+$14 ; 90 12
|
||||
sta ($12),y ; 91 12
|
||||
jam ; 92
|
||||
sha ($12),y ; 93 12
|
||||
sty $12,x ; 94 12
|
||||
sta $12,x ; 95 12
|
||||
stx $12,y ; 96 12
|
||||
sax $12,y ; 97 12
|
||||
tya ; 98
|
||||
sta $1234,y ; 99 34 12
|
||||
txs ; 9a
|
||||
tas $1234,y ; 9b 34 12
|
||||
shy $1234,x ; 9c 34 12
|
||||
sta $1234,x ; 9d 34 12
|
||||
shx $1234,y ; 9e 34 12
|
||||
sha $1234,y ; 9f 34 12
|
||||
ldy #$12 ; a0 12
|
||||
lda ($12,x) ; a1 12
|
||||
ldx #$12 ; a2 12
|
||||
lax ($12,x) ; a3 12
|
||||
ldy $12 ; a4 12
|
||||
lda $12 ; a5 12
|
||||
ldx $12 ; a6 12
|
||||
lax $12 ; a7 12
|
||||
tay ; a8
|
||||
lda #$12 ; a9 12
|
||||
tax ; aa
|
||||
lax #$12 ; ab 12
|
||||
ldy $1234 ; ac 34 12
|
||||
lda $1234 ; ad 34 12
|
||||
ldx $1234 ; ae 34 12
|
||||
lax $1234 ; af 34 12
|
||||
bcs *+$14 ; b0 12
|
||||
lda ($12),y ; b1 12
|
||||
jam ; b2
|
||||
lax ($12),y ; b3 12
|
||||
ldy $12,x ; b4 12
|
||||
lda $12,x ; b5 12
|
||||
ldx $12,y ; b6 12
|
||||
lax $12,y ; b7 12
|
||||
clv ; b8
|
||||
lda $1234,y ; b9 34 12
|
||||
tsx ; ba
|
||||
las $1234,y ; bb 34 12
|
||||
ldy $1234,x ; bc 34 12
|
||||
lda $1234,x ; bd 34 12
|
||||
ldx $1234,y ; be 34 12
|
||||
lax $1234,y ; bf 34 12
|
||||
cpy #$12 ; c0 12
|
||||
cmp ($12,x) ; c1 12
|
||||
nop #$12 ; c2 12
|
||||
dcp ($12,x) ; c3 12
|
||||
cpy $12 ; c4 12
|
||||
cmp $12 ; c5 12
|
||||
dec $12 ; c6 12
|
||||
dcp $12 ; c7 12
|
||||
iny ; c8
|
||||
cmp #$12 ; c9 12
|
||||
dex ; ca
|
||||
axs #$12 ; cb 12
|
||||
cpy $1234 ; cc 34 12
|
||||
cmp $1234 ; cd 34 12
|
||||
dec $1234 ; ce 34 12
|
||||
dcp $1234 ; cf 34 12
|
||||
bne *+$14 ; d0 12
|
||||
cmp ($12),y ; d1 12
|
||||
jam ; d2
|
||||
dcp ($12),y ; d3 12
|
||||
nop $12,x ; d4 12
|
||||
cmp $12,x ; d5 12
|
||||
dec $12,x ; d6 12
|
||||
dcp $12,x ; d7 12
|
||||
cld ; d8
|
||||
cmp $1234,y ; d9 34 12
|
||||
nop ; da
|
||||
dcp $1234,y ; db 34 12
|
||||
nop $1234,x ; dc 34 12
|
||||
cmp $1234,x ; dd 34 12
|
||||
dec $1234,x ; de 34 12
|
||||
dcp $1234,x ; df 34 12
|
||||
cpx #$12 ; e0 12
|
||||
sbc ($12,x) ; e1 12
|
||||
nop #$12 ; e2 12
|
||||
isc ($12,x) ; e3 12
|
||||
cpx $12 ; e4 12
|
||||
sbc $12 ; e5 12
|
||||
inc $12 ; e6 12
|
||||
isc $12 ; e7 12
|
||||
inx ; e8
|
||||
sbc #$12 ; e9 12
|
||||
nop ; ea
|
||||
sbc #$12 ; eb 12
|
||||
cpx $1234 ; ec 34 12
|
||||
sbc $1234 ; ed 34 12
|
||||
inc $1234 ; ee 34 12
|
||||
isc $1234 ; ef 34 12
|
||||
beq *+$14 ; f0 12
|
||||
sbc ($12),y ; f1 12
|
||||
jam ; f2
|
||||
isc ($12),y ; f3 12
|
||||
nop $12,x ; f4 12
|
||||
sbc $12,x ; f5 12
|
||||
inc $12,x ; f6 12
|
||||
isc $12,x ; f7 12
|
||||
sed ; f8
|
||||
sbc $1234,y ; f9 34 12
|
||||
isc $1234,y ; fb 34 12
|
||||
nop $1234,x ; fc 34 12
|
||||
sbc $1234,x ; fd 34 12
|
||||
inc $1234,x ; fe 34 12
|
||||
isc $1234,x ; ff 34 12
|
1
testcode/assembler/illegal.ref
Normal file
1
testcode/assembler/illegal.ref
Normal file
@ -0,0 +1 @@
|
||||
444'/4?4;4#73O4_4[4GCWSo44{4gcwsΟ4ί4Ϋ4ΗΓΧΣο4<12>4ϋ4ηγχσ<12>4‡ƒ—―4Ώ4§£³·kKΛ44€“<12>4<12>4<12>4›4»4«‹
|
@ -1,43 +1,135 @@
|
||||
|
||||
.setcpu "6502X"
|
||||
|
||||
; all so called "illegal" opcodes. duplicated (functionally identical) ones
|
||||
; are commented out
|
||||
|
||||
.macro test opc
|
||||
; first all totally stable undocs:
|
||||
|
||||
opc $00
|
||||
opc $00,x
|
||||
opc ($00,x)
|
||||
opc ($00),y
|
||||
opc $1234
|
||||
opc $1234,x
|
||||
opc $1234,y
|
||||
slo $12 ; 07 12
|
||||
slo $1234 ; 0f 34 12
|
||||
slo $1234,x ; 1f 34 12
|
||||
slo $1234,y ; 1b 34 12
|
||||
slo ($12,x) ; 03 12
|
||||
slo $12,x ; 17 12
|
||||
slo ($12),y ; 13 12
|
||||
|
||||
.endmacro
|
||||
rla $12 ; 27 12
|
||||
rla $1234 ; 2f 34 12
|
||||
rla $1234,x ; 3f 34 12
|
||||
rla $1234,y ; 3b 34 12
|
||||
rla ($12,x) ; 23 12
|
||||
rla $12,x ; 37 12
|
||||
rla ($12),y ; 33 12
|
||||
|
||||
sre $1234 ; 4f 34 12
|
||||
sre $1234,x ; 5f 34 12
|
||||
sre $1234,y ; 5b 34 12
|
||||
sre $12 ; 47 12
|
||||
sre ($12,x) ; 43 12
|
||||
sre $12,x ; 57 12
|
||||
sre ($12),y ; 53 12
|
||||
|
||||
test slo
|
||||
test rla
|
||||
test sre
|
||||
test rra
|
||||
test dcp
|
||||
test isc
|
||||
rra $1234 ; 6f 34 12
|
||||
rra $1234,x ; 7f 34 12
|
||||
rra $1234,y ; 7b 34 12
|
||||
rra $12 ; 67 12
|
||||
rra ($12,x) ; 63 12
|
||||
rra $12,x ; 77 12
|
||||
rra ($12),y ; 73 12
|
||||
|
||||
sax $00
|
||||
sax $00,y
|
||||
sax ($00,x)
|
||||
sax $1234
|
||||
dcp $1234 ; cf 34 12
|
||||
dcp $1234,x ; df 34 12
|
||||
dcp $1234,y ; db 34 12
|
||||
dcp $12 ; c7 12
|
||||
dcp ($12,x) ; c3 12
|
||||
dcp $12,x ; d7 12
|
||||
dcp ($12),y ; d3 12
|
||||
|
||||
lax $00
|
||||
lax $00,y
|
||||
lax ($00,x)
|
||||
lax ($00),y
|
||||
lax $1234
|
||||
lax $1234,y
|
||||
isc $1234 ; ef 34 12
|
||||
isc $1234,x ; ff 34 12
|
||||
isc $1234,y ; fb 34 12
|
||||
isc $12 ; e7 12
|
||||
isc ($12,x) ; e3 12
|
||||
isc $12,x ; f7 12
|
||||
isc ($12),y ; f3 12
|
||||
|
||||
anc #$55
|
||||
alr #$55
|
||||
arr #$55
|
||||
axs #$55
|
||||
sax $1234 ; 8f 34 12
|
||||
sax $12 ; 87 12
|
||||
sax ($12,x) ; 83 12
|
||||
sax $12,y ; 97 12
|
||||
|
||||
las $1234,y
|
||||
lax $1234 ; af 34 12
|
||||
lax $1234,y ; bf 34 12
|
||||
lax $12 ; a7 12
|
||||
lax ($12,x) ; a3 12
|
||||
lax ($12),y ; b3 12
|
||||
lax $12,y ; b7 12
|
||||
|
||||
anc #$12 ; 0b 12
|
||||
;anc #$12 ; 2b 12
|
||||
|
||||
arr #$12 ; 6b 12
|
||||
|
||||
alr #$12 ; 4b 12
|
||||
|
||||
axs #$12 ; cb 12
|
||||
|
||||
nop $1234 ; 0c 34 12
|
||||
nop $1234,x ; 1c 34 12
|
||||
nop $12 ; 04 12
|
||||
nop $12,x ; 14 12
|
||||
nop #$12 ; 80 12
|
||||
;nop $1234,x ; 3c 34 12
|
||||
;nop $1234,x ; 5c 34 12
|
||||
;nop $1234,x ; 7c 34 12
|
||||
;nop $1234,x ; dc 34 12
|
||||
;nop $1234,x ; fc 34 12
|
||||
;nop $12 ; 44 12
|
||||
;nop $12 ; 64 12
|
||||
;nop #$12 ; 82 12
|
||||
;nop #$12 ; 89 12
|
||||
;nop #$12 ; c2 12
|
||||
;nop #$12 ; e2 12
|
||||
;nop $12,x ; 34 12
|
||||
;nop $12,x ; 54 12
|
||||
;nop $12,x ; 74 12
|
||||
;nop $12,x ; d4 12
|
||||
;nop $12,x ; f4 12
|
||||
;nop ; 1a
|
||||
;nop ; 3a
|
||||
;nop ; 5a
|
||||
;nop ; 7a
|
||||
;nop ; da
|
||||
|
||||
jam ; 02
|
||||
;jam ; 12
|
||||
;jam ; 22
|
||||
;jam ; 32
|
||||
;jam ; 42
|
||||
;jam ; 52
|
||||
;jam ; 62
|
||||
;jam ; 72
|
||||
;jam ; 92
|
||||
;jam ; b2
|
||||
;jam ; d2
|
||||
;jam ; f2
|
||||
|
||||
;sbc #$12 ; eb 12
|
||||
|
||||
; the so-called "unstable" ones:
|
||||
|
||||
sha ($12),y ; 93 12
|
||||
sha $1234,y ; 9f 34 12
|
||||
|
||||
shx $1234,y ; 9e 34 12
|
||||
shy $1234,x ; 9c 34 12
|
||||
|
||||
tas $1234,y ; 9b 34 12
|
||||
las $1234,y ; bb 34 12
|
||||
|
||||
; the two so-called "highly unstable" ones:
|
||||
|
||||
lax #$12 ; ab 12
|
||||
|
||||
ane #$12 ; 8b 12
|
||||
|
BIN
testcode/assembler/legal.ref
Normal file
BIN
testcode/assembler/legal.ref
Normal file
Binary file not shown.
185
testcode/assembler/legal.s
Normal file
185
testcode/assembler/legal.s
Normal file
@ -0,0 +1,185 @@
|
||||
|
||||
.setcpu "6502"
|
||||
|
||||
adc $1234 ; 6d 34 12
|
||||
adc $1234,x ; 7d 34 12
|
||||
adc $1234,y ; 79 34 12
|
||||
adc $12 ; 65 12
|
||||
adc #$12 ; 69 12
|
||||
adc ($12,x) ; 61 12
|
||||
adc $12,x ; 75 12
|
||||
adc ($12),y ; 71 12
|
||||
|
||||
and $12 ; 25 12
|
||||
and #$12 ; 29 12
|
||||
and $1234 ; 2d 34 12
|
||||
and $1234,x ; 3d 34 12
|
||||
and $1234,y ; 39 34 12
|
||||
and ($12,x) ; 21 12
|
||||
and $12,x ; 35 12
|
||||
and ($12),y ; 31 12
|
||||
|
||||
asl $12 ; 06 12
|
||||
asl $1234 ; 0e 34 12
|
||||
asl $1234,x ; 1e 34 12
|
||||
asl $12,x ; 16 12
|
||||
asl a ; 0a
|
||||
|
||||
bcc *+$14 ; 90 12
|
||||
bcs *+$14 ; b0 12
|
||||
beq *+$14 ; f0 12
|
||||
bmi *+$14 ; 30 12
|
||||
bne *+$14 ; d0 12
|
||||
bpl *+$14 ; 10 12
|
||||
bvc *+$14 ; 50 12
|
||||
bvs *+$14 ; 70 12
|
||||
|
||||
bit $12 ; 24 12
|
||||
bit $1234 ; 2c 34 12
|
||||
|
||||
brk ; 00
|
||||
|
||||
clc ; 18
|
||||
cld ; d8
|
||||
cli ; 58
|
||||
clv ; b8
|
||||
|
||||
cmp $1234 ; cd 34 12
|
||||
cmp $1234,x ; dd 34 12
|
||||
cmp $1234,y ; d9 34 12
|
||||
cmp $12 ; c5 12
|
||||
cmp #$12 ; c9 12
|
||||
cmp ($12,x) ; c1 12
|
||||
cmp $12,x ; d5 12
|
||||
cmp ($12),y ; d1 12
|
||||
|
||||
cpx $1234 ; ec 34 12
|
||||
cpx #$12 ; e0 12
|
||||
cpx $12 ; e4 12
|
||||
|
||||
cpy $1234 ; cc 34 12
|
||||
cpy #$12 ; c0 12
|
||||
cpy $12 ; c4 12
|
||||
|
||||
dec $1234 ; ce 34 12
|
||||
dec $1234,x ; de 34 12
|
||||
dec $12 ; c6 12
|
||||
dec $12,x ; d6 12
|
||||
|
||||
dex ; ca
|
||||
dey ; 88
|
||||
|
||||
eor $1234 ; 4d 34 12
|
||||
eor $1234,x ; 5d 34 12
|
||||
eor $1234,y ; 59 34 12
|
||||
eor $12 ; 45 12
|
||||
eor #$12 ; 49 12
|
||||
eor ($12,x) ; 41 12
|
||||
eor $12,x ; 55 12
|
||||
eor ($12),y ; 51 12
|
||||
|
||||
inc $1234 ; ee 34 12
|
||||
inc $1234,x ; fe 34 12
|
||||
inc $12 ; e6 12
|
||||
inc $12,x ; f6 12
|
||||
|
||||
inx ; e8
|
||||
iny ; c8
|
||||
|
||||
jmp $1234 ; 4c 34 12
|
||||
jmp ($1234) ; 6c 34 12
|
||||
|
||||
jsr $1234 ; 20 34 12
|
||||
|
||||
lda $1234 ; ad 34 12
|
||||
lda $1234,x ; bd 34 12
|
||||
lda $1234,y ; b9 34 12
|
||||
lda $12 ; a5 12
|
||||
lda #$12 ; a9 12
|
||||
lda ($12,x) ; a1 12
|
||||
lda $12,x ; b5 12
|
||||
lda ($12),y ; b1 12
|
||||
|
||||
ldx $1234 ; ae 34 12
|
||||
ldx $1234,y ; be 34 12
|
||||
ldx #$12 ; a2 12
|
||||
ldx $12 ; a6 12
|
||||
ldx $12,y ; b6 12
|
||||
|
||||
ldy $1234 ; ac 34 12
|
||||
ldy $1234,x ; bc 34 12
|
||||
ldy #$12 ; a0 12
|
||||
ldy $12 ; a4 12
|
||||
ldy $12,x ; b4 12
|
||||
|
||||
lsr $1234 ; 4e 34 12
|
||||
lsr $1234,x ; 5e 34 12
|
||||
lsr $12 ; 46 12
|
||||
lsr $12,x ; 56 12
|
||||
lsr a ; 4a
|
||||
|
||||
nop ; ea
|
||||
|
||||
ora $12 ; 05 12
|
||||
ora #$12 ; 09 12
|
||||
ora $1234 ; 0d 34 12
|
||||
ora $1234,x ; 1d 34 12
|
||||
ora $1234,y ; 19 34 12
|
||||
ora ($12,x) ; 01 12
|
||||
ora $12,x ; 15 12
|
||||
ora ($12),y ; 11 12
|
||||
|
||||
pha ; 48
|
||||
php ; 08
|
||||
pla ; 68
|
||||
plp ; 28
|
||||
|
||||
rol $12 ; 26 12
|
||||
rol $1234 ; 2e 34 12
|
||||
rol $1234,x ; 3e 34 12
|
||||
rol $12,x ; 36 12
|
||||
rol a ; 2a
|
||||
ror $1234 ; 6e 34 12
|
||||
ror $1234,x ; 7e 34 12
|
||||
ror $12 ; 66 12
|
||||
ror $12,x ; 76 12
|
||||
ror a ; 6a
|
||||
|
||||
rti ; 40
|
||||
rts ; 60
|
||||
|
||||
sbc $1234 ; ed 34 12
|
||||
sbc $1234,x ; fd 34 12
|
||||
sbc $1234,y ; f9 34 12
|
||||
sbc $12 ; e5 12
|
||||
sbc #$12 ; e9 12
|
||||
sbc ($12,x) ; e1 12
|
||||
sbc $12,x ; f5 12
|
||||
sbc ($12),y ; f1 12
|
||||
|
||||
sec ; 38
|
||||
sed ; f8
|
||||
sei ; 78
|
||||
|
||||
sta $1234 ; 8d 34 12
|
||||
sta $1234,x ; 9d 34 12
|
||||
sta $1234,y ; 99 34 12
|
||||
sta $12 ; 85 12
|
||||
sta ($12,x) ; 81 12
|
||||
sta $12,x ; 95 12
|
||||
sta ($12),y ; 91 12
|
||||
|
||||
stx $1234 ; 8e 34 12
|
||||
stx $12 ; 86 12
|
||||
stx $12,y ; 96 12
|
||||
|
||||
sty $1234 ; 8c 34 12
|
||||
sty $12 ; 84 12
|
||||
sty $12,x ; 94 12
|
||||
|
||||
tax ; aa
|
||||
tay ; a8
|
||||
tsx ; ba
|
||||
txa ; 8a
|
||||
txs ; 9a
|
||||
tya ; 98
|
Loading…
x
Reference in New Issue
Block a user