diff --git a/Android/jni/build.sh b/Android/jni/build.sh index 84daea0b..81645b6e 100755 --- a/Android/jni/build.sh +++ b/Android/jni/build.sh @@ -95,6 +95,8 @@ elif test "$(basename $0)" = "testdisplay" ; then ln -s testdisplay.mk Android.mk elif test "$(basename $0)" = "testprefs" ; then ln -s testprefs.mk Android.mk +elif test "$(basename $0)" = "testtrace" ; then + ln -s testtrace.mk Android.mk elif test "$(basename $0)" = "testui" ; then ln -s testui.mk Android.mk elif test "$(basename $0)" = "testvm" ; then diff --git a/Android/jni/testtrace b/Android/jni/testtrace new file mode 120000 index 00000000..c07a74de --- /dev/null +++ b/Android/jni/testtrace @@ -0,0 +1 @@ +build.sh \ No newline at end of file diff --git a/Android/jni/testtrace.mk b/Android/jni/testtrace.mk new file mode 100644 index 00000000..e2b5d706 --- /dev/null +++ b/Android/jni/testtrace.mk @@ -0,0 +1,34 @@ +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +PACKAGE_IDENTIFIER := "org.deadc0de.apple2ix" +PACKAGE_NAME := "apple2ix" +COMMON_SOURCES_MK := $(LOCAL_PATH)/sources.mk +include $(COMMON_SOURCES_MK) + +# ----------------------------------------------------------------------------- +# Android build config + +LOCAL_MODULE := libapple2ix +LOCAL_SRC_FILES := $(APPLE2_SRC_PATH)/test/testcommon.c $(APPLE2_SRC_PATH)/test/testtrace.c +LOCAL_CFLAGS := $(APPLE2_BASE_CFLAGS) -g -DTEST_TRACE=1 -DTESTING=1 -DCPU_TRACING=1 -DDISK_TRACING=1 -DSPEAKER_TRACING=1 -DMB_TRACING=1 -I$(APPLE2_SRC_PATH)/test +LOCAL_LDLIBS := $(APPLE2_BASE_LDLIBS) + +# Add assembly files first ... mostly for the benefit of the ARM assembler ... +ifeq ($(TARGET_ARCH_ABI),x86) + LOCAL_SRC_FILES += $(APPLE2_X86_SRC) + LOCAL_CFLAGS += -DNO_UNDERSCORES=1 +else + LOCAL_SRC_FILES += $(APPLE2_ARM_SRC) +endif + +LOCAL_SRC_FILES += $(APPLE2_MAIN_SRC) $(APPLE2_META_SRC) $(APPLE2_VIDEO_SRC) $(APPLE2_AUDIO_SRC) + +# Build a shared library and let Java/Dalvik drive +include $(BUILD_SHARED_LIBRARY) + +# --OR-- Build an executable so native can drive this show +#include $(BUILD_EXECUTABLE) + +$(call import-module, android/cpufeatures) diff --git a/src/audio/AY8910.c b/src/audio/AY8910.c index e42c94b0..ca94c152 100644 --- a/src/audio/AY8910.c +++ b/src/audio/AY8910.c @@ -52,6 +52,7 @@ # include "audio/mockingboard.h" // For g_uTimer1IrqCount # if TESTING # include "greatest.h" +# undef fprintf // greatest redefines fprintf on Droid! # endif #endif diff --git a/src/audio/mockingboard.c b/src/audio/mockingboard.c index 839baa27..60e3e3bf 100644 --- a/src/audio/mockingboard.c +++ b/src/audio/mockingboard.c @@ -115,7 +115,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # include # endif # if TESTING -# include "greatest.h" +# include "greatest.h" +# undef fprintf // greatest redefines fprintf on Droid! # endif #if defined(FAILED) diff --git a/src/test/testtrace.c b/src/test/testtrace.c index 96895f64..fb9f6387 100644 --- a/src/test/testtrace.c +++ b/src/test/testtrace.c @@ -55,18 +55,37 @@ static void testspeaker_cyclesOverflow(void) { } TEST test_timing_overflow() { + test_setup_boot_disk(BLANK_DSK, /*readonly:*/1); + c_debugger_set_timeout(1); + + ASSERT(!cycles_overflowed); + ASSERT(apple_ii_64k[0][WATCHPOINT_ADDR] != TEST_FINISHED); // force an almost overflow - testing_getCyclesCount = &testspeaker_getCyclesCount; testing_cyclesOverflow = &testspeaker_cyclesOverflow; - ASSERT(!cycles_overflowed); - test_setup_boot_disk(BLANK_DSK, /*readonly:*/1); - BOOT_TO_DOS(); + extern volatile uint8_t emul_reinitialize; + do { + emul_reinitialize = 1; + c_debugger_go(); + + if (cycles_overflowed) { + break; + } + + ASSERT(apple_ii_64k[0][WATCHPOINT_ADDR] != TEST_FINISHED); + } while (1); + ASSERT(cycles_overflowed); + c_debugger_set_timeout(0); + + c_debugger_go(); + ASSERT(apple_ii_64k[0][WATCHPOINT_ADDR] == TEST_FINISHED); + // appears emulator handled cycle count overflow gracefully ... + testing_getCyclesCount = NULL; testing_cyclesOverflow = NULL;