mirror of
https://github.com/cc65/cc65.git
synced 2024-12-28 06:30:16 +00:00
overwrite segment tests
asm/listing linker CFG support asm and asm/listing test documentation
This commit is contained in:
parent
8b818aac67
commit
4732e937ad
20
test/asm/listing/200-overwrite.cfg
Normal file
20
test/asm/listing/200-overwrite.cfg
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
A: start = 0, size = 8, file = %O, fill = yes, fillval = $33;
|
||||||
|
B: start = 8, size = 8, file = %O, fill = yes, fillval = $44;
|
||||||
|
C: start = 0, size = 8, file = %O, fill = yes, fillval = $55;
|
||||||
|
D: start = 8, size = 8, file = %O, fill = no, fillval = $66;
|
||||||
|
}
|
||||||
|
SEGMENTS
|
||||||
|
{
|
||||||
|
A: load = A, type = ro;
|
||||||
|
B: load = B, type = ro;
|
||||||
|
C0: load = C, type = ro;
|
||||||
|
C1: load = C, type = ro, start = 5;
|
||||||
|
D: load = D, type = ro;
|
||||||
|
|
||||||
|
AO: load = A, type = overwrite, start = 4;
|
||||||
|
BO: load = B, type = overwrite, start = 8+5;
|
||||||
|
CO: load = C, type = overwrite, start = 2;
|
||||||
|
DO: load = D, type = overwrite, start = 8+4;
|
||||||
|
}
|
29
test/asm/listing/200-overwrite.s
Normal file
29
test/asm/listing/200-overwrite.s
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
; verification of overwrite segment feature
|
||||||
|
; See: https://github.com/cc65/cc65/issues/1366
|
||||||
|
|
||||||
|
; A: full memory area which is overwritten to the end
|
||||||
|
.segment "A"
|
||||||
|
.byte 0,1,2,3,4,5,6,7
|
||||||
|
.segment "AO"
|
||||||
|
.byte $24,$25,$26,$27
|
||||||
|
|
||||||
|
; B: incomplete memory area overwritten in the fill area
|
||||||
|
.segment "B"
|
||||||
|
.byte 0,1,2
|
||||||
|
.segment "BO"
|
||||||
|
.byte $25,$26
|
||||||
|
|
||||||
|
; C: memory area with gap overwritten across the gap
|
||||||
|
.segment "C0"
|
||||||
|
.byte 0,1,2
|
||||||
|
.segment "C1"
|
||||||
|
.byte 5,6,7
|
||||||
|
.segment "CO"
|
||||||
|
.byte $22,$23,$24,$25
|
||||||
|
|
||||||
|
; D: incomplete memory area without fill,
|
||||||
|
; but overwrite extends past existing segments
|
||||||
|
.segment "D"
|
||||||
|
.byte 0,1,2
|
||||||
|
.segment "DO"
|
||||||
|
.byte $24,$25
|
12
test/asm/listing/201-overwrite-overflow.cfg
Normal file
12
test/asm/listing/201-overwrite-overflow.cfg
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
A: start = 0, size = 8, file = %O, fill = yes, fillval = $33;
|
||||||
|
B: start = 8, size = 8, file = %O, fill = yes, fillval = $44;
|
||||||
|
}
|
||||||
|
SEGMENTS
|
||||||
|
{
|
||||||
|
A: load = A, type = ro;
|
||||||
|
B: load = B, type = ro;
|
||||||
|
AO: load = A, type = overwrite, start = 6;
|
||||||
|
BO: load = B, type = overwrite, start = 8+6;
|
||||||
|
}
|
13
test/asm/listing/201-overwrite-overflow.s
Normal file
13
test/asm/listing/201-overwrite-overflow.s
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
; verification of overwrite segment overflow cases
|
||||||
|
|
||||||
|
; error: overflow past end of A memory area
|
||||||
|
.segment "A"
|
||||||
|
.byte 0,1,2,3
|
||||||
|
.segment "AO"
|
||||||
|
.byte $26,$27,$28
|
||||||
|
|
||||||
|
; error: overflow past end of B memory area
|
||||||
|
.segment "B"
|
||||||
|
.byte 0,1,2,3
|
||||||
|
.segment "BO"
|
||||||
|
.byte $26,$27,$28
|
@ -58,12 +58,20 @@ $(WORKDIR)/$1.bin: $1.s $(ISEQUAL)
|
|||||||
ifeq ($(wildcard control/$1.err),)
|
ifeq ($(wildcard control/$1.err),)
|
||||||
$(CA65) -t none -o $$(@:.bin=.o) $$< > $$(@:.bin=.err) 2> $$(@:.bin=.err2)
|
$(CA65) -t none -o $$(@:.bin=.o) $$< > $$(@:.bin=.err) 2> $$(@:.bin=.err2)
|
||||||
ifeq ($(wildcard control/$1.no-ld65),)
|
ifeq ($(wildcard control/$1.no-ld65),)
|
||||||
|
ifeq ($(wildcard $1.cfg),)
|
||||||
$(LD65) -t none -o $$@ $$(@:.bin=.o) none.lib > $$(@:.bin=.ld65-err) 2> $$(@:.bin=.ld65-err2)
|
$(LD65) -t none -o $$@ $$(@:.bin=.o) none.lib > $$(@:.bin=.ld65-err) 2> $$(@:.bin=.ld65-err2)
|
||||||
|
else
|
||||||
|
$(LD65) -C $$(<:.s=.cfg) -o $$@ $$(@:.bin=.o) none.lib > $$(@:.bin=.ld65-err) 2> $$(@:.bin=.ld65-err2)
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
$(CA65) -t none -o $$(@:.bin=.o) $$< > $$(@:.bin=.err) 2> $$(@:.bin=.err2) || $(TRUE)
|
$(CA65) -t none -o $$(@:.bin=.o) $$< > $$(@:.bin=.err) 2> $$(@:.bin=.err2) || $(TRUE)
|
||||||
ifeq ($(wildcard control/$1.no-ld65),)
|
ifeq ($(wildcard control/$1.no-ld65),)
|
||||||
|
ifeq ($(wildcard $1.cfg),)
|
||||||
$(LD65) -t none -o $$@ $$(@:.bin=.o) none.lib > $$(@:.bin=.ld65-err) 2> $$(@:.bin=.ld65-err2) || $(TRUE)
|
$(LD65) -t none -o $$@ $$(@:.bin=.o) none.lib > $$(@:.bin=.ld65-err) 2> $$(@:.bin=.ld65-err2) || $(TRUE)
|
||||||
|
else
|
||||||
|
$(LD65) -C $$(<:.s=.cfg) -o $$@ $$(@:.bin=.o) none.lib > $$(@:.bin=.ld65-err) 2> $$(@:.bin=.ld65-err2) || $(TRUE)
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -117,12 +125,20 @@ endif
|
|||||||
ifeq ($(wildcard control/$1.err),)
|
ifeq ($(wildcard control/$1.err),)
|
||||||
$(CA65) -t none -l $$(@:.bin=.list-lst) -o $$(@:.bin=.list-o) $$< > $$(@:.bin=.list-err) 2> $$(@:.bin=.list-err2)
|
$(CA65) -t none -l $$(@:.bin=.list-lst) -o $$(@:.bin=.list-o) $$< > $$(@:.bin=.list-err) 2> $$(@:.bin=.list-err2)
|
||||||
ifeq ($(wildcard control/$1.no-ld65),)
|
ifeq ($(wildcard control/$1.no-ld65),)
|
||||||
|
ifeq ($(wildcard $1.cfg),)
|
||||||
$(LD65) -t none -o $$(@:.bin=.list-bin) $$(@:.bin=.list-o) none.lib > $$(@:.bin=.list-ld65-err) 2> $$(@:.bin=.list-ld65-err2)
|
$(LD65) -t none -o $$(@:.bin=.list-bin) $$(@:.bin=.list-o) none.lib > $$(@:.bin=.list-ld65-err) 2> $$(@:.bin=.list-ld65-err2)
|
||||||
|
else
|
||||||
|
$(LD65) -C $$(<:.s=.cfg) -o $$(@:.bin=.list-bin) $$(@:.bin=.list-o) none.lib > $$(@:.bin=.list-ld65-err) 2> $$(@:.bin=.list-ld65-err2)
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
$(CA65) -t none -l $$(@:.bin=.list-lst) -o $$(@:.bin=.list-o) $$< > $$(@:.bin=.list-err) 2> $$(@:.bin=.list-err2) || $(TRUE)
|
$(CA65) -t none -l $$(@:.bin=.list-lst) -o $$(@:.bin=.list-o) $$< > $$(@:.bin=.list-err) 2> $$(@:.bin=.list-err2) || $(TRUE)
|
||||||
ifeq ($(wildcard control/$1.no-ld65),)
|
ifeq ($(wildcard control/$1.no-ld65),)
|
||||||
|
ifeq ($(wildcard $1.cfg),)
|
||||||
$(LD65) -t none -o $$(@:.bin=.list-bin) $$(@:.bin=.list-o) none.lib > $$(@:.bin=.list-ld65-err) 2> $$(@:.bin=.list-ld65-err2) || $(TRUE)
|
$(LD65) -t none -o $$(@:.bin=.list-bin) $$(@:.bin=.list-o) none.lib > $$(@:.bin=.list-ld65-err) 2> $$(@:.bin=.list-ld65-err2) || $(TRUE)
|
||||||
|
else
|
||||||
|
$(LD65) -C $$(<:.s=.cfg) -o $$(@:.bin=.list-bin) $$(@:.bin=.list-o) none.lib > $$(@:.bin=.list-ld65-err) 2> $$(@:.bin=.list-ld65-err2) || $(TRUE)
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
0
test/asm/listing/control/201-overwrite-overflow.err
Normal file
0
test/asm/listing/control/201-overwrite-overflow.err
Normal file
@ -4,6 +4,8 @@ Overall test:
|
|||||||
These testcases can be used to test different aspects of the assembler.
|
These testcases can be used to test different aspects of the assembler.
|
||||||
The name of a test is everything in the form <test>.s.
|
The name of a test is everything in the form <test>.s.
|
||||||
|
|
||||||
|
If a custom linker configuration is needed, also include <test>.cfg.
|
||||||
|
|
||||||
The following reference files can be added:
|
The following reference files can be added:
|
||||||
|
|
||||||
- ref/<test>.bin-ref:
|
- ref/<test>.bin-ref:
|
||||||
|
BIN
test/asm/listing/ref/200-overwrite.bin-ref
Normal file
BIN
test/asm/listing/ref/200-overwrite.bin-ref
Normal file
Binary file not shown.
3
test/asm/listing/ref/201-overwrite-overflow.ld65err2-ref
Normal file
3
test/asm/listing/ref/201-overwrite-overflow.ld65err2-ref
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
ld65: Warning: 201-overwrite-overflow.cfg:3: Segment 'AO' overflows memory area 'A' by 1 byte
|
||||||
|
ld65: Warning: 201-overwrite-overflow.cfg:4: Segment 'BO' overflows memory area 'B' by 1 byte
|
||||||
|
ld65: Error: Cannot generate most of the files due to memory area overflows
|
@ -1,32 +1,38 @@
|
|||||||
Assembler Testcases
|
Assembler Testcases
|
||||||
===================
|
===================
|
||||||
|
|
||||||
Opcode Tests:
|
cpudetect
|
||||||
-------------
|
---------
|
||||||
|
|
||||||
these go into opcodes/. Refer to opcodes/readme.txt
|
Tests the --cpu command line option of ca65/ld65.
|
||||||
|
Refer to cpudetect/readme.txt
|
||||||
|
|
||||||
|
|
||||||
CPU Detect Tests
|
opcodes
|
||||||
----------------
|
-------
|
||||||
|
|
||||||
these go into cpudetect/. Refer to cpudetect/readme.txt
|
Test of assembler opcodes for each CPU.
|
||||||
|
Refer to opcodes/readme.txt
|
||||||
|
|
||||||
|
|
||||||
Overall tests:
|
|
||||||
--------------
|
|
||||||
|
|
||||||
These go into listing/. Refer to listing/readme.txt
|
|
||||||
|
|
||||||
val:
|
|
||||||
----
|
|
||||||
|
|
||||||
Works very much like the /val directory used to test the compiler - individual
|
|
||||||
tests are run in the simulator and should exit with an exit code of 0 when they
|
|
||||||
pass, or either -1 or a number indicating what part of the test failed on error.
|
|
||||||
|
|
||||||
err:
|
err:
|
||||||
----
|
----
|
||||||
|
|
||||||
Works very much like the /err directory used to test the compiler - individual
|
Used to test assembler errors. These tests MUST NOT assemble without error.
|
||||||
tests are assembled and MUST NOT assemble without error.
|
|
||||||
|
|
||||||
|
listing:
|
||||||
|
--------
|
||||||
|
|
||||||
|
This is the most versatile assembler test form, allowing control customizations,
|
||||||
|
reference tests for binary output, stdout and error text ouput, error tests,
|
||||||
|
listings, custom linker configuration, etc. as needed.
|
||||||
|
Refer to listing/readme.txt
|
||||||
|
|
||||||
|
|
||||||
|
val:
|
||||||
|
----
|
||||||
|
|
||||||
|
Runtime assembly tests using sim65 that should exit with an exit code of 0 when
|
||||||
|
the pass, or either -1 or a number indicating what part of the test failed on
|
||||||
|
error.
|
||||||
|
Loading…
Reference in New Issue
Block a user