Try to match Palm OS call format exactly

Not tested yet
This commit is contained in:
meepingsnesroms
2019-01-09 08:19:35 -08:00
parent 7e17a5a3e8
commit 02033457de
2 changed files with 18 additions and 5 deletions

2
.gitignore vendored
View File

@@ -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

View File

@@ -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~