mirror of
https://github.com/cc65/cc65.git
synced 2025-01-14 16:33:00 +00:00
sim65 64-bit cycle count tests
These take ~10 seconds to run locally
This commit is contained in:
parent
aad64063c9
commit
3419cbd348
@ -12,7 +12,7 @@ endif
|
|||||||
|
|
||||||
WORKDIR = ../testwrk/asm
|
WORKDIR = ../testwrk/asm
|
||||||
|
|
||||||
SUBDIRS = cpudetect opcodes listing val err
|
SUBDIRS = cpudetect opcodes listing val err misc
|
||||||
|
|
||||||
.PHONY: all continue mostlyclean clean
|
.PHONY: all continue mostlyclean clean
|
||||||
|
|
||||||
|
70
test/asm/misc/Makefile
Normal file
70
test/asm/misc/Makefile
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
# Makefile for the remaining asm tests that need special care in one way or another
|
||||||
|
|
||||||
|
ifneq ($(shell echo),)
|
||||||
|
CMD_EXE = 1
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef CMD_EXE
|
||||||
|
S = $(subst /,\,/)
|
||||||
|
NOT = - # Hack
|
||||||
|
EXE = .exe
|
||||||
|
NULLDEV = nul:
|
||||||
|
MKDIR = mkdir $(subst /,\,$1)
|
||||||
|
RMDIR = -rmdir /s /q $(subst /,\,$1)
|
||||||
|
else
|
||||||
|
S = /
|
||||||
|
NOT = !
|
||||||
|
EXE =
|
||||||
|
NULLDEV = /dev/null
|
||||||
|
MKDIR = mkdir -p $1
|
||||||
|
RMDIR = $(RM) -r $1
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef QUIET
|
||||||
|
.SILENT:
|
||||||
|
NULLOUT = >$(NULLDEV)
|
||||||
|
NULLERR = 2>$(NULLDEV)
|
||||||
|
endif
|
||||||
|
|
||||||
|
SIM65FLAGS = -x 200000000
|
||||||
|
|
||||||
|
CA65 := $(if $(wildcard ../../../bin/ca65*),..$S..$S..$Sbin$Sca65,ca65)
|
||||||
|
LD65 := $(if $(wildcard ../../../bin/ld65*),..$S..$S..$Sbin$Sld65,ld65)
|
||||||
|
SIM65 := $(if $(wildcard ../../../bin/sim65*),..$S..$S..$Sbin$Ssim65,sim65)
|
||||||
|
|
||||||
|
WORKDIR = ..$S..$S..$Stestwrk$Sasm$Smisc
|
||||||
|
|
||||||
|
.PHONY: all clean
|
||||||
|
|
||||||
|
SOURCES := $(wildcard *.s)
|
||||||
|
TESTS = $(SOURCES:%.s=$(WORKDIR)/%.6502.prg)
|
||||||
|
TESTS += $(SOURCES:%.s=$(WORKDIR)/%.65c02.prg)
|
||||||
|
|
||||||
|
all: $(TESTS)
|
||||||
|
|
||||||
|
$(WORKDIR):
|
||||||
|
$(call MKDIR,$(WORKDIR))
|
||||||
|
|
||||||
|
define PRG_template
|
||||||
|
|
||||||
|
# sim65 ensure 64-bit wait time does not timeout
|
||||||
|
$(WORKDIR)/sim65-timein.$1.prg: sim65-timein.s | $(WORKDIR)
|
||||||
|
$(if $(QUIET),echo misc/sim65-timein.$1.prg)
|
||||||
|
$(CA65) -t sim$1 -o $$(@:.prg=.o) $$< $(NULLERR)
|
||||||
|
$(LD65) -t sim$1 -o $$@ $$(@:.prg=.o) sim$1.lib $(NULLERR)
|
||||||
|
$(SIM65) -x 4400000000 -c $$@ $(NULLOUT) $(NULLERR)
|
||||||
|
|
||||||
|
# sim65 ensure 64-bit wait time does timeout
|
||||||
|
$(WORKDIR)/sim65-timeout.$1.prg: sim65-timeout.s | $(WORKDIR)
|
||||||
|
$(if $(QUIET),echo misc/sim65-timeout.$1.prg)
|
||||||
|
$(CA65) -t sim$1 -o $$(@:.prg=.o) $$< $(NULLERR)
|
||||||
|
$(LD65) -t sim$1 -o $$@ $$(@:.prg=.o) sim$1.lib $(NULLERR)
|
||||||
|
$(NOT) $(SIM65) -x 4400000000 -c $$@ $(NULLOUT) $(NULLERR)
|
||||||
|
|
||||||
|
endef # PRG_template
|
||||||
|
|
||||||
|
$(eval $(call PRG_template,6502))
|
||||||
|
$(eval $(call PRG_template,65c02))
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@$(call RMDIR,$(WORKDIR))
|
55
test/asm/misc/sim65-time-wait.inc
Normal file
55
test/asm/misc/sim65-time-wait.inc
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
; Shared timer for:
|
||||||
|
; sim65-timein.s
|
||||||
|
; sim65-timeout.s
|
||||||
|
|
||||||
|
; wait A * 100,000,000 cycles, plus small amount of overhead
|
||||||
|
wait100m:
|
||||||
|
tay
|
||||||
|
bne :+
|
||||||
|
rts ; return quickly if A=0
|
||||||
|
:
|
||||||
|
jsr wait50331648 ; 50331648
|
||||||
|
jsr wait25165824 ; 75497472
|
||||||
|
jsr wait12582912 ; 88080384
|
||||||
|
jsr wait6291456 ; 94371840
|
||||||
|
jsr wait3145728 ; 97517568
|
||||||
|
jsr wait1572864 ; 99090432
|
||||||
|
jsr wait786432 ; 99876864
|
||||||
|
jsr wait98304 ; 99975168
|
||||||
|
jsr wait24576 ; 99999744
|
||||||
|
jsr wait192 ; 99999936
|
||||||
|
jsr wait48 ; 99999984
|
||||||
|
nop ; 99999986
|
||||||
|
nop ; 99999988
|
||||||
|
php ; 99999991
|
||||||
|
plp ; 99999995
|
||||||
|
dey ; 99999997
|
||||||
|
bne :- ; 100000000
|
||||||
|
rts
|
||||||
|
; Note that this branch could cross a page if poorly aligned,
|
||||||
|
; adding an additional 1 cycle per loop.
|
||||||
|
; This precision is not important for the tests used.
|
||||||
|
|
||||||
|
wait50331648: jsr wait25165824
|
||||||
|
wait25165824: jsr wait12582912
|
||||||
|
wait12582912: jsr wait6291456
|
||||||
|
wait6291456: jsr wait3145728
|
||||||
|
wait3145728: jsr wait1572864
|
||||||
|
wait1572864: jsr wait786432
|
||||||
|
wait786432: jsr wait393216
|
||||||
|
wait393216: jsr wait196608
|
||||||
|
wait196608: jsr wait98304
|
||||||
|
wait98304: jsr wait49152
|
||||||
|
wait49152: jsr wait24576
|
||||||
|
wait24576: jsr wait12288
|
||||||
|
wait12288: jsr wait6144
|
||||||
|
wait6144: jsr wait3072
|
||||||
|
wait3072: jsr wait1536
|
||||||
|
wait1536: jsr wait768
|
||||||
|
wait768: jsr wait384
|
||||||
|
wait384: jsr wait192
|
||||||
|
wait192: jsr wait96
|
||||||
|
wait96: jsr wait48
|
||||||
|
wait48: jsr wait24
|
||||||
|
wait24: jsr wait12
|
||||||
|
wait12: rts
|
17
test/asm/misc/sim65-timein.s
Normal file
17
test/asm/misc/sim65-timein.s
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
; Verifies that sim65 can handle 64-bit timeout counter.
|
||||||
|
; sim65 sim65-timein.prg -x 4400000000
|
||||||
|
|
||||||
|
.export _main
|
||||||
|
.import exit
|
||||||
|
|
||||||
|
_main:
|
||||||
|
; wait ~4,300,000,000 cycles
|
||||||
|
lda #43
|
||||||
|
jsr wait100m
|
||||||
|
; This is a positive test.
|
||||||
|
; If the timeout did not occur, returning 0 reports success.
|
||||||
|
lda #0
|
||||||
|
rts
|
||||||
|
|
||||||
|
; wait100m
|
||||||
|
.include "sim65-time-wait.inc"
|
17
test/asm/misc/sim65-timeout.s
Normal file
17
test/asm/misc/sim65-timeout.s
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
; Verifies that sim65 can handle 64-bit timeout counter.
|
||||||
|
; sim65 sim65-timeout.prg -x 4400000000
|
||||||
|
|
||||||
|
.export _main
|
||||||
|
.import exit
|
||||||
|
|
||||||
|
_main:
|
||||||
|
; wait ~4,500,000,000 cycles
|
||||||
|
lda #45
|
||||||
|
jsr wait100m
|
||||||
|
; This is a negative test.
|
||||||
|
; If the timeout did not occur, returning 0 reports failure.
|
||||||
|
lda #0
|
||||||
|
rts
|
||||||
|
|
||||||
|
; wait100m
|
||||||
|
.include "sim65-time-wait.inc"
|
@ -36,3 +36,9 @@ val:
|
|||||||
Runtime assembly tests using sim65 that should end with an exit code of 0 if
|
Runtime assembly tests using sim65 that should end with an exit code of 0 if
|
||||||
they pass. If they fail the exit code should be either -1, or a number
|
they pass. If they fail the exit code should be either -1, or a number
|
||||||
indicating what part of the test failed.
|
indicating what part of the test failed.
|
||||||
|
|
||||||
|
|
||||||
|
misc:
|
||||||
|
-----
|
||||||
|
|
||||||
|
This is for tests that require special make steps or conditions.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user