From fd741e46348227a2b2fa44c8e9b28bca48b5349c Mon Sep 17 00:00:00 2001 From: meepingsnesroms Date: Sun, 1 Jul 2018 13:02:36 -0700 Subject: [PATCH] Fix stack argument order, blob execution still isnt working --- disassemblyNotes.txt | 10 ++++++++++ hwTestSuite/blobs.c | 2 +- hwTestSuite/blobs.h | 2 +- hwTestSuite/tests.c | 4 ++-- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/disassemblyNotes.txt b/disassemblyNotes.txt index cb3ff61..98d7ea8 100644 --- a/disassemblyNotes.txt +++ b/disassemblyNotes.txt @@ -1,3 +1,13 @@ +The first argument to a function is the last pushed on the stack(proof below, the 16 bit int is the last argument and its pushed first) + +ROM:1003026C move.w d0,-(sp) ; Move Data from Source to Destination +ROM:1003026E move.l a4,-(sp) ; Move Data from Source to Destination +ROM:10030270 move.l d7,-(sp) ; Move Data from Source to Destination +ROM:10030272 trap #$F ; Trap sysTrapStrNCopy +ROM:10030272 dc.w $A2CE +Char * StrNCopy(Char *dst, const Char *src, Int16 n)SYS_TRAP(sysTrapStrNCopy); + + HwrIRQ4Handler Interrupt Level 4 Priority(top of the list is checked first): UART 1 and 2(they have the same priority) RTC diff --git a/hwTestSuite/blobs.c b/hwTestSuite/blobs.c index b3be872..5667987 100644 --- a/hwTestSuite/blobs.c +++ b/hwTestSuite/blobs.c @@ -105,4 +105,4 @@ static ALIGN(2) uint8_t HwrADC_PIC_bin[] = { /*static uint32_t HwrADC_PIC_len = 1159;*/ -const void (*customCall_HwrADC)(void* returnData, uint16_t mode) = (const void (*)(void* , uint16_t))HwrADC_PIC_bin; +const void (*customCall_HwrADC)(uint16_t mode, void* returnData) = (const void (*)(uint16_t, void*))HwrADC_PIC_bin; diff --git a/hwTestSuite/blobs.h b/hwTestSuite/blobs.h index 5d50dc6..77ea112 100644 --- a/hwTestSuite/blobs.h +++ b/hwTestSuite/blobs.h @@ -4,6 +4,6 @@ #include #include -const void (*customCall_HwrADC)(void* returnData, uint16_t mode); +const void (*customCall_HwrADC)(uint16_t mode, void* returnData); #endif diff --git a/hwTestSuite/tests.c b/hwTestSuite/tests.c index 307a8d9..d454a64 100644 --- a/hwTestSuite/tests.c +++ b/hwTestSuite/tests.c @@ -436,7 +436,7 @@ var ads7846ReadOsVersion(){ static Boolean firstRun = true; static Boolean referenceMode; uint8_t ads7846Channel; - uint16_t channelData[7]; + uint16_t channelData[14];/*should be 7 but just want to be safe*/ uint16_t y = 0; if(firstRun){ @@ -453,7 +453,7 @@ var ads7846ReadOsVersion(){ exitSubprogram(); } - customCall_HwrADC(channelData, referenceMode); + customCall_HwrADC(referenceMode, channelData); StrPrintF(sharedDataBuffer, "Ref Mode:%s", referenceMode ? "true" : "false"); UG_PutString(0, y, sharedDataBuffer);