notaz.gp2x.de
/
cyclone68000.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
pass jumptable ptr from C
[cyclone68000.git]
/
Main.cpp
diff --git
a/Main.cpp
b/Main.cpp
index
400d3a6
..
7c6b8e3
100644
(file)
--- a/
Main.cpp
+++ b/
Main.cpp
@@
-127,13
+127,6
@@
static void ChangeTASGet(unsigned int i)
}
\r
#endif
\r
\r
}
\r
#endif
\r
\r
-static void LoadCycloneJumpTab(int reg, int tmp)
\r
-{
\r
- ot(" adr r%d,CycloneOT_JT\n", tmp);
\r
- ot(" ldr r%d,[r%d] ;@ CycloneJumpTab-CycloneOT_JT\n", reg, tmp);
\r
- ot(" add r%d,r%d,r%d ;@ =CycloneJumpTab\n", reg, reg, tmp);
\r
-}
\r
-
\r
#if EMULATE_ADDRESS_ERRORS_JUMP || EMULATE_ADDRESS_ERRORS_IO
\r
static void AddressErrorWrapper(char rw, const char *dataprg, int iw)
\r
{
\r
#if EMULATE_ADDRESS_ERRORS_JUMP || EMULATE_ADDRESS_ERRORS_IO
\r
static void AddressErrorWrapper(char rw, const char *dataprg, int iw)
\r
{
\r
@@
-237,14
+230,16
@@
static void PrintFramework()
ot("\n");
\r
ot("\n");
\r
\r
ot("\n");
\r
ot("\n");
\r
\r
- ot("CycloneInit%s\n", ms?"":":");
\r
+ ot("CycloneInit
JT
%s\n", ms?"":":");
\r
#if COMPRESS_JUMPTABLE
\r
ot(";@ decompress jump table\n");
\r
#if COMPRESS_JUMPTABLE
\r
ot(";@ decompress jump table\n");
\r
-
LoadCycloneJumpTab(12, 1
);
\r
+
ot(" mov r12,r0 ;@ jump table\n"
);
\r
ot(" add r0,r12,#0xe000*4 ;@ ctrl code pointer\n");
\r
ot(" ldr r1,[r0,#-4]\n");
\r
ot(" tst r1,r1\n");
\r
ot(" movne pc,lr ;@ already uncompressed\n");
\r
ot(" add r0,r12,#0xe000*4 ;@ ctrl code pointer\n");
\r
ot(" ldr r1,[r0,#-4]\n");
\r
ot(" tst r1,r1\n");
\r
ot(" movne pc,lr ;@ already uncompressed\n");
\r
+ ot(" stmfd sp!,{r7,lr}\n");
\r
+ ot(" mov r7,r12 ;@ jump table\n");
\r
ot(" add r3,r12,#0xa000*4 ;@ handler table pointer, r12=dest\n");
\r
ot("unc_loop%s\n", ms?"":":");
\r
ot(" ldrh r1,[r0],#2\n");
\r
ot(" add r3,r12,#0xa000*4 ;@ handler table pointer, r12=dest\n");
\r
ot("unc_loop%s\n", ms?"":":");
\r
ot(" ldrh r1,[r0],#2\n");
\r
@@
-266,9
+261,8
@@
static void PrintFramework()
ot(" bgt unc_loop_in\n");
\r
ot(" b unc_loop\n");
\r
ot("unc_finish%s\n", ms?"":":");
\r
ot(" bgt unc_loop_in\n");
\r
ot(" b unc_loop\n");
\r
ot("unc_finish%s\n", ms?"":":");
\r
- LoadCycloneJumpTab(12, 1);
\r
ot(" ;@ set a-line and f-line handlers\n");
\r
ot(" ;@ set a-line and f-line handlers\n");
\r
- ot(" add r0,r
12
,#0xa000*4\n");
\r
+ ot(" add r0,r
7
,#0xa000*4\n");
\r
ot(" ldr r1,[r0,#4] ;@ a-line handler\n");
\r
ot(" ldr r3,[r0,#8] ;@ f-line handler\n");
\r
ot(" mov r2,#0x1000\n");
\r
ot(" ldr r1,[r0,#4] ;@ a-line handler\n");
\r
ot(" ldr r3,[r0,#8] ;@ f-line handler\n");
\r
ot(" mov r2,#0x1000\n");
\r
@@
-276,31
+270,29
@@
static void PrintFramework()
ot(" subs r2,r2,#1\n");
\r
ot(" str r1,[r0],#4\n");
\r
ot(" bgt unc_fill3\n");
\r
ot(" subs r2,r2,#1\n");
\r
ot(" str r1,[r0],#4\n");
\r
ot(" bgt unc_fill3\n");
\r
- ot(" add r0,r
12
,#0xf000*4\n");
\r
+ ot(" add r0,r
7
,#0xf000*4\n");
\r
ot(" mov r2,#0x1000\n");
\r
ot("unc_fill4%s\n", ms?"":":");
\r
ot(" subs r2,r2,#1\n");
\r
ot(" str r3,[r0],#4\n");
\r
ot(" bgt unc_fill4\n");
\r
ot(" mov r2,#0x1000\n");
\r
ot("unc_fill4%s\n", ms?"":":");
\r
ot(" subs r2,r2,#1\n");
\r
ot(" str r3,[r0],#4\n");
\r
ot(" bgt unc_fill4\n");
\r
- ot("
bx lr
\n");
\r
+ ot("
ldmfd sp!,{r7,pc}
\n");
\r
ltorg();
\r
#else
\r
ot(";@ fix final jumptable entries\n");
\r
ltorg();
\r
#else
\r
ot(";@ fix final jumptable entries\n");
\r
- LoadCycloneJumpTab(12, 0);
\r
- ot(" add r12,r12,#0x10000*4\n");
\r
- ot(" ldr r0,[r12,#-3*4]\n");
\r
- ot(" str r0,[r12,#-2*4]\n");
\r
- ot(" str r0,[r12,#-1*4]\n");
\r
+ ot(" add r0,r0,#0x10000*4\n");
\r
+ ot(" ldr r1,[r0,#-3*4]\n");
\r
+ ot(" str r1,[r0,#-2*4]\n");
\r
+ ot(" str r1,[r0,#-1*4]\n");
\r
ot(" bx lr\n");
\r
#endif
\r
ot("\n");
\r
\r
// --------------
\r
ot(" bx lr\n");
\r
#endif
\r
ot("\n");
\r
\r
// --------------
\r
- ot("CycloneReset%s\n", ms?"":":");
\r
+ ot("CycloneReset
JT
%s\n", ms?"":":");
\r
ot(" stmfd sp!,{r7,lr}\n");
\r
ot(" stmfd sp!,{r7,lr}\n");
\r
- LoadCycloneJumpTab(12, 1);
\r
ot(" mov r7,r0\n");
\r
ot(" mov r7,r0\n");
\r
- ot(" str r1
2
,[r7,#0x54] ;@ save CycloneJumpTab avoid literal pools\n");
\r
+ ot(" str r1,[r7,#0x54] ;@ save CycloneJumpTab avoid literal pools\n");
\r
ot(" mov r0,#0\n");
\r
ot(" str r0,[r7,#0x58] ;@ state_flags\n");
\r
ot(" str r0,[r7,#0x48] ;@ OSP\n");
\r
ot(" mov r0,#0\n");
\r
ot(" str r0,[r7,#0x58] ;@ state_flags\n");
\r
ot(" str r0,[r7,#0x48] ;@ OSP\n");
\r
@@
-324,11
+316,10
@@
static void PrintFramework()
ot("\n");
\r
\r
// --------------
\r
ot("\n");
\r
\r
// --------------
\r
- ot("CycloneSetRealTAS%s\n", ms?"":":");
\r
+ ot("CycloneSetRealTAS
_JT
%s\n", ms?"":":");
\r
#if (CYCLONE_FOR_GENESIS == 2)
\r
#if (CYCLONE_FOR_GENESIS == 2)
\r
- LoadCycloneJumpTab(12, 1);
\r
ot(" tst r0,r0\n");
\r
ot(" tst r0,r0\n");
\r
- ot(" add r12,r1
2
,#0x4a00*4\n");
\r
+ ot(" add r12,r1,#0x4a00*4\n");
\r
ot(" add r12,r12,#0x00d0*4\n");
\r
ot(" adr r2,CycloneOT_TAS_\n");
\r
ot(" addeq r2,r2,#%lu*4\n", sizeof(tas_ops) / sizeof(tas_ops[0]));
\r
ot(" add r12,r12,#0x00d0*4\n");
\r
ot(" adr r2,CycloneOT_TAS_\n");
\r
ot(" addeq r2,r2,#%lu*4\n", sizeof(tas_ops) / sizeof(tas_ops[0]));
\r
@@
-382,8
+373,6
@@
static void PrintFramework()
\r
// --------------
\r
// offset table to avoid .text relocations (forbidden by Android and iOS)
\r
\r
// --------------
\r
// offset table to avoid .text relocations (forbidden by Android and iOS)
\r
- ot("CycloneOT_JT%s\n", ms?"":":");
\r
- ot(" %s %s-CycloneOT_JT\n", ms?"dcd":".long", "CycloneJumpTab");
\r
#if (CYCLONE_FOR_GENESIS == 2)
\r
ot("CycloneOT_TAS_%s\n", ms?"":":"); // working TAS (no MD bug)
\r
for (size_t i = 0; i < sizeof(tas_ops) / sizeof(tas_ops[0]); i++)
\r
#if (CYCLONE_FOR_GENESIS == 2)
\r
ot("CycloneOT_TAS_%s\n", ms?"":":"); // working TAS (no MD bug)
\r
for (size_t i = 0; i < sizeof(tas_ops) / sizeof(tas_ops[0]); i++)
\r
@@
-1290,8
+1279,8
@@
static int CycloneMake()
for(i=0xf000; i<0x10000; i++) CyJump[i] = -3; // f-line emulation
\r
\r
ot(ms?" area |.text|, code\n":" .text\n .align 4\n\n");
\r
for(i=0xf000; i<0x10000; i++) CyJump[i] = -3; // f-line emulation
\r
\r
ot(ms?" area |.text|, code\n":" .text\n .align 4\n\n");
\r
- ot(" %s CycloneInit\n",globl);
\r
- ot(" %s CycloneReset\n",globl);
\r
+ ot(" %s CycloneInit
JT
\n",globl);
\r
+ ot(" %s CycloneReset
JT
\n",globl);
\r
ot(" %s CycloneRun\n",globl);
\r
ot(" %s CycloneSetSr\n",globl);
\r
ot(" %s CycloneGetSr\n",globl);
\r
ot(" %s CycloneRun\n",globl);
\r
ot(" %s CycloneSetSr\n",globl);
\r
ot(" %s CycloneGetSr\n",globl);
\r
@@
-1300,7
+1289,7
@@
static int CycloneMake()
ot(" %s CycloneUnpack\n",globl);
\r
ot(" %s CycloneVer\n",globl);
\r
#if (CYCLONE_FOR_GENESIS == 2)
\r
ot(" %s CycloneUnpack\n",globl);
\r
ot(" %s CycloneVer\n",globl);
\r
#if (CYCLONE_FOR_GENESIS == 2)
\r
- ot(" %s CycloneSetRealTAS\n",globl);
\r
+ ot(" %s CycloneSetRealTAS
_JT
\n",globl);
\r
ot(" %s CycloneDoInterrupt\n",globl);
\r
ot(" %s CycloneDoTrace\n",globl);
\r
ot(" %s CycloneJumpTab\n",globl);
\r
ot(" %s CycloneDoInterrupt\n",globl);
\r
ot(" %s CycloneDoTrace\n",globl);
\r
ot(" %s CycloneJumpTab\n",globl);
\r