PicoMemResetCDdecode: @r3
+ tst r3, #4
+ bxeq lr @ we should not be called in 2M mode
ldr r1, =m_s68k_write8_table
ldr r3, =m_s68k_decode_write_table
and r2, r0, #0x18
.endm
-@ r0=prt1, r1=ptr2
+@ r0=prt1, r1=ptr2; unaligned ptr MUST be r0
.macro m_read32_gen
tst r0, #2
ldrneh r0, [r1, r0]!
.endm
-@ r0=prt1, r1=data, r2=ptr2
+@ r0=prt1, r1=data, r2=ptr2; unaligned ptr MUST be r0
.macro m_write32_gen
tst r0, #2
mov r1, r1, ror #16
.long m_m68k_read8_r0d
m_m68k_read8_r00:
add r1, r1, #0x110000
- ldr r0, [r1, #30]
+ ldr r0, [r1, #0x30]
and r0, r0, #0x04000000 @ we need irq2 mask state
mov r0, r0, lsr #19
bx lr
movge r0, #0
bxge lr
@ I have seen the range 0x0e-0x2f accessed quite frequently with long i/o, so here is some code for that
- ldr r0, =(Pico+0x22200)
+ mov r0, r1
+ ldr r1, =(Pico+0x22200)
mov r2, #0xff
- ldr r0, [r0]
+ ldr r1, [r1]
orr r2, r2, r2, lsl #16
- add r0, r0, #0x110000
+ add r1, r1, #0x110000
m_read32_gen
and r1, r2, r0 @ data is big-endian read as little, have to byteswap
and r0, r2, r0, lsr #8
}
-static void gfx_do(void)
+static void gfx_do(unsigned int func, unsigned short *stamp_base, unsigned int H_Dot)
{
unsigned int eax, ebx, ecx, edx, esi, edi, pixel;
- unsigned int XD, Buffer_Adr, H_Dot;
- unsigned int func = rot_comp.Function;
- unsigned short *stamp_base;
+ unsigned int XD, Buffer_Adr;
int DYXS;
XD = rot_comp.Reg_60 & 7;
Buffer_Adr = ((rot_comp.Reg_5E & 0xfff8) + rot_comp.YD) << 2;
- stamp_base = (unsigned short *) (Pico_mcd->word_ram2M + rot_comp.Stamp_Map_Adr);
- H_Dot = rot_comp.Reg_62 & 0x1ff;
ecx = *(unsigned int *)(Pico_mcd->word_ram2M + rot_comp.Vector_Adr);
edx = ecx >> 16;
ecx = (ecx & 0xffff) << 8;
{
if (func & 4) // 16x16 screen
{
- eax = (ecx >> (11+5)) & 0x007f;
- ebx = (edx >> (11-2)) & 0x3f80;
+ ebx = ((ecx >> (11+5)) & 0x007f) |
+ ((edx >> (11-2)) & 0x3f80);
}
else // 1x1 screen
{
- eax = (ecx >> (11+5)) & 0x07;
- ebx = (edx >> (11+2)) & 0x38;
+ ebx = ((ecx >> (11+5)) & 0x07) |
+ ((edx >> (11+2)) & 0x38);
}
}
else // mode 16x16 dot
{
if (func & 4) // 16x16 screen
{
- eax = (ecx >> (11+4)) & 0x00ff;
- ebx = (edx >> (11-4)) & 0xff00;
+ ebx = ((ecx >> (11+4)) & 0x00ff) |
+ ((edx >> (11-4)) & 0xff00);
}
else // 1x1 screen
{
- eax = (ecx >> (11+4)) & 0x0f;
- ebx = (edx >> (11+0)) & 0xf0;
+ ebx = ((ecx >> (11+4)) & 0x0f) |
+ ((edx >> (11+0)) & 0xf0);
}
}
- ebx += eax;
// MAKE_IMAGE_PIXEL
if (!(func & 1)) // NOT TILED
}
}
- // esi = rot_comp.Stamp_Map_Adr;
- edi = stamp_base[ebx] | (stamp_base[ebx+1] << 16);
- esi = edi;
- edi >>= (11+1);
- esi = (esi & 0x7ff) << 7;
+ edi = stamp_base[ebx];// | (stamp_base[ebx+1] << 16);
+ esi = (edi & 0x7ff) << 7;
if (!esi) { pixel = 0; goto Pixel_Out; }
+ edi >>= (11+1);
edi &= (0x1c>>1);
eax = ecx;
ebx = edx;
// end while
-//nothing_to_draw:
+// nothing_to_draw:
rot_comp.YD++;
// rot_comp.V_Dot--; // will be done by caller
}
void gfx_cd_update(void)
{
- unsigned char *V_Dot = (unsigned char *) &rot_comp.Reg_64;
+ int V_Dot = rot_comp.Reg_64 & 0xff;
int jobs;
dprintf("gfx_cd_update, Reg_64 = %04x", rot_comp.Reg_64);
- if (!*V_Dot)
+ if (!V_Dot)
{
gfx_completed();
return;
rot_comp.Float_Part &= 0xffff;
rot_comp.Float_Part += rot_comp.Draw_Speed;
- while (jobs--)
+ if (PicoOpt & 0x1000) // scale/rot enabled
{
- if (PicoOpt & 0x1000)
- gfx_do(); // jmp [Jmp_Adr]:
+ unsigned int func = rot_comp.Function;
+ unsigned int H_Dot = rot_comp.Reg_62 & 0x1ff;
+ unsigned short *stamp_base = (unsigned short *) (Pico_mcd->word_ram2M + rot_comp.Stamp_Map_Adr);
- (*V_Dot)--; // dec byte [V_Dot]
+ while (jobs--)
+ {
+ gfx_do(func, stamp_base, H_Dot); // jmp [Jmp_Adr]:
- if (!*V_Dot)
+ V_Dot--; // dec byte [V_Dot]
+ if (V_Dot == 0)
+ {
+ // GFX_Completed:
+ gfx_completed();
+ return;
+ }
+ }
+ }
+ else
+ {
+ if (jobs >= V_Dot)
{
- // GFX_Completed:
gfx_completed();
return;
}
+ V_Dot -= jobs;
}
+
+ rot_comp.Reg_64 = V_Dot;
}
static short sndBuffer[2*44100/50];\r
static char noticeMsg[64]; // notice msg to draw\r
static struct timeval noticeMsgTime = { 0, 0 }; // when started showing\r
-static int reset_timing, osd_fps_x;\r
+static int osd_fps_x;\r
static int combo_keys = 0, combo_acts = 0; // keys and actions which need button combos\r
static int gp2x_old_gamma = 100;\r
static unsigned char *movie_data = NULL;\r
static int movie_size = 0;\r
unsigned char *framebuff = 0; // temporary buffer for alt renderer\r
int state_slot = 0;\r
+int reset_timing = 0;\r
\r
/*\r
// tmp\r
continue;\r
}\r
updateKeys();\r
- SkipFrame(tval.tv_usec < lim_time+target_frametime); frames_done++;\r
+ SkipFrame(tval.tv_usec < lim_time+target_frametime*2); frames_done++;\r
continue;\r
}\r
\r