From 02033457de86aaf3d198c1702902f06df80ceb0e Mon Sep 17 00:00:00 2001 From: meepingsnesroms Date: Wed, 9 Jan 2019 08:19:35 -0800 Subject: [PATCH] Try to match Palm OS call format exactly Not tested yet --- .gitignore | 2 ++ .../asmSrcs/m68kCallWithBlob.x68 | 21 ++++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 0ab99b8..cb6d6e9 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,8 @@ /tools/palm/muExpansionDriver/muExpDriver /tools/palm/muExpansionDriver/muExpDriver-sections.s /tools/palm/muExpansionDriver/muExpDriver-sections.ld +/tools/palm/muExpansionDriver/asmSrcs/*.L68 +/tools/palm/muExpansionDriver/asmSrcs/*.S68 /tools/desktop/build-BufferGraphViewer-* /tools/desktop/build-MakePalmIcon-* /tools/desktop/export16BitImageProperly/convert \ No newline at end of file diff --git a/tools/palm/muExpansionDriver/asmSrcs/m68kCallWithBlob.x68 b/tools/palm/muExpansionDriver/asmSrcs/m68kCallWithBlob.x68 index 35ad82b..aeb8743 100644 --- a/tools/palm/muExpansionDriver/asmSrcs/m68kCallWithBlob.x68 +++ b/tools/palm/muExpansionDriver/asmSrcs/m68kCallWithBlob.x68 @@ -14,13 +14,17 @@ START: ; first instruction of program pea (6) pea stackBlob pea function + jsr m68kCallWithBlobFunc *uint32_t m68kCallWithBlobFunc(uint32_t functionAddress, uint32_t stackBlob, uint32_t stackBlobSize, uint16_t returnA0); *Extract:vvv - move.l (sp), a3 *function - move.l 4(sp), a1 *stackBlob - move.l 8(sp), d1 *stackBlobSize - move.w 10(sp), d2 *returnA0 +m68kCallWithBlobFunc: + link a6,#0 + movem.l d1-d2/a1-a3,-(sp) + move.l 8(a6), a3 *function + move.l 12(a6), a1 *stackBlob + move.l 16(a6), d1 *stackBlobSize + move.w 20(a6), d2 *returnA0 move.l sp, a2 sub.l d1, a2 copy: @@ -31,11 +35,17 @@ copy: add.l #2, a2 jmp copy done: - jmp (a3) + *update SP with new stack sub.l d1, sp + jmp (a3) + add.l d1, sp + *new stack has been used and removed, SP is safe again + tst.w d2 beq useD0 move.l a0, d0 useD0: + movem.l (sp)+,d1-d2/a1-a3 + unlk a6 rts *Extract:^^^ @@ -55,6 +65,7 @@ stackBlob: END START ; last line of source + *~Font name~Courier New~ *~Font size~10~ *~Tab type~1~