Moar optimizations. Atm at 23% real speed.

This commit is contained in:
Jeroen Domburg 2017-05-30 15:17:58 +08:00
parent 42e97a4658
commit 075820bd49
7 changed files with 47 additions and 11 deletions

View File

@ -98,8 +98,9 @@ void adns900_get_dxdybtn(int *x, int *y, int *btn) {
sx|=adnsRead(0x4)<<8;
sy=adnsRead(0x5);
sy|=adnsRead(0x6)<<8;
// printf("Mouse: %d %d\n", sx, sy);
ets_delay_us(100);
*btn=gpio_get_level(ADNS_MISO)?0:1;
// printf("Mouse: %d %d %d\n", sx, sy, *btn);
*x=sx;
*y=sy;
*btn=gpio_get_level(ADNS_MISO)?0:1;
}

View File

@ -168,7 +168,7 @@ static void initLcd() {
printf("Display inited.\n");
}
void IRAM_ATTR displayTask(void *arg) {
void displayTask(void *arg) {
uint8_t *img=malloc((LINESPERBUF*320*2)+1);
assert(img);
calcLut();

View File

@ -7,7 +7,20 @@ COMPONENT_SRCDIRS := . musashi
MUSASHI_GEN_SRC := musashi/m68kops_pre.c musashi/m68kopac.c musashi/m68kopdm.c musashi/m68kopnz.c
MUSASHI_GEN_OBJ := $(MUSASHI_GEN_SRC:%.c=%.o)
COMPONENT_OBJS := $(MUSASHI_GEN_OBJ) musashi/m68kcpu.o emu.o iwm.o via.o rtc.o ncr.o scc.o mouse.o
COMPONENT_OBJS := musashi/m68kops_pre.o musashi/m68kopac.o musashi/m68kopdm-iram.o musashi/m68kopnz.o musashi/m68kcpu.o emu.o iwm.o via.o rtc.o ncr.o scc.o mouse.o
#nothing in iram: 16%
#ac nz in iram: 19%
#dm nz in iram: 19%
#ac dm in iram: 23%
#dm in iram: 23%
#-O3:
#nothing: 13%
#dm in iram: 23%
#ac in iram: 19%
#nz in iram: 14%
#dm/ac ac/nz: ng
CFLAGS += -Wno-error=implicit-function-declaration
@ -17,6 +30,24 @@ CFLAGS += -Wno-error=implicit-function-declaration
COMPONENT_EXTRA_CLEAN := $(addprefix $(COMPONENT_PATH)/musashi/,$(MUSASHI_GEN_SRC) m68kmake)
#musashi/m68kops_pre.o: CFLAGS += -O3
#musashi/m68kopac.o: CFLAGS += -O3
#musashi/m68kopdm.o: CFLAGS += -O3
#musashi/m68kopnz.o: CFLAGS += -O3
define makeiram
$(1): $(2)
$$(summary) OBJCOPY $(2)
$$(OBJCOPY) --rename-section .text=.iram1 --rename-section .literal=.iram1 $(2) $(1)
$(2): $(COMPONENT_PATH)/$(2:%.o=%.c)
$$(summary) CC $$@
$$(CC) $$(CFLAGS:-ffunction-sections=) $$(CPPFLAGS) -O3 $$(addprefix -I ,$$(COMPONENT_INCLUDES)) $$(addprefix -I ,$$(COMPONENT_EXTRA_INCLUDES)) -c $$< -o $$@
endef
$(foreach obj, $(MUSASHI_GEN_OBJ) musashi/m68kcpu.o, $(eval $(call makeiram, $(obj:%.o=%-iram.o), $(obj))))
#Using wildcard magic here because otherwise Make will invoke this multiple times.
#$(COMPONENT_PATH)/musashi/
$(COMPONENT_PATH)/musashi/m68kop%.c: $(COMPONENT_PATH)/musashi/m68kmake

View File

@ -166,7 +166,7 @@ void m68k_instruction();
/* If ON, the enulation core will use 64-bit integers to speed up some
* operations.
*/
#define M68K_USE_64_BIT OPT_OFF
#define M68K_USE_64_BIT OPT_ON
/* Set to your compiler's static inline keyword to enable it, or

View File

@ -116,7 +116,8 @@ typedef void (*m68ki_instruction_jump_call)(void);
extern const m68ki_instruction_jump_call m68ki_instruction_jump_table[];
//extern void (*m68ki_instruction_jump_table)(void); /* opcode handler jump table */
extern const unsigned char m68ki_cycles[3][0x10000];
//extern const unsigned char m68ki_cycles[1][0x10000];
extern const unsigned char m68ki_cycles[1][0x10000];
/* ======================================================================== */
@ -183,8 +184,9 @@ int main(int argc, char **argv) {
}
printf("};\n\n");
printf("const unsigned char m68ki_cycles[%d][0x10000]={\n", NUM_CPU_TYPES);
for (int x=0; x<NUM_CPU_TYPES; x++) {
printf("const unsigned char m68ki_cycles[%d][0x10000]={\n", 1);//NUM_CPU_TYPES);
// for (int x=0; x<NUM_CPU_TYPES; x++) {
for (int x=0; x<1; x++) {
printf("\t{");
for (int y=0; y<0x10000; y++) {
if ((y&15)==0) printf("\n\t\t");

View File

@ -2007,8 +2007,9 @@ int main(int argc, char **argv) {
}
printf("};\n\n");
printf("const unsigned char m68ki_cycles[%d][0x10000]={\n", NUM_CPU_TYPES);
for (int x=0; x<NUM_CPU_TYPES; x++) {
printf("const unsigned char m68ki_cycles[%d][0x10000]={\n", 1);//NUM_CPU_TYPES);
// for (int x=0; x<NUM_CPU_TYPES; x++) {
for (int x=0; x<1; x++) {
printf("\t{");
for (int y=0; y<0x10000; y++) {
if ((y&15)==0) printf("\n\t\t");

View File

@ -1975,7 +1975,8 @@ typedef void (*m68ki_instruction_jump_call)(void);
extern const m68ki_instruction_jump_call m68ki_instruction_jump_table[];
//extern void (*m68ki_instruction_jump_table)(void); /* opcode handler jump table */
extern const unsigned char m68ki_cycles[3][0x10000];
//extern const unsigned char m68ki_cycles[1][0x10000];
extern const unsigned char m68ki_cycles[1][0x10000];
/* ======================================================================== */