Skip to content

Commit

Permalink
Fame CPU Core from UAE4ALL2 ported. Looks very promising. Compatibili…
Browse files Browse the repository at this point in the history
…ty much better
  • Loading branch information
emufreak committed Oct 5, 2014
1 parent dc3822f commit 1dbbc8d
Show file tree
Hide file tree
Showing 18 changed files with 26,744 additions and 19,740 deletions.
58 changes: 26 additions & 32 deletions iUAE.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions iUAE.xcodeproj/project.xcworkspace/xcshareddata/iUAE.xccheckout
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,29 @@
<string>iUAE</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>46C2324D-11F6-442D-BAE0-65142F757BCE</key>
<key>BB077C81096E34247CCFED268F63A8050DE3ACEE</key>
<string>https://github.com/emufreak/iAmiga.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>iUAE.xcodeproj/project.xcworkspace</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>46C2324D-11F6-442D-BAE0-65142F757BCE</key>
<key>BB077C81096E34247CCFED268F63A8050DE3ACEE</key>
<string>../..</string>
</dict>
<key>IDESourceControlProjectURL</key>
<string>https://github.com/emufreak/iAmiga.git</string>
<key>IDESourceControlProjectVersion</key>
<integer>110</integer>
<integer>111</integer>
<key>IDESourceControlProjectWCCIdentifier</key>
<string>46C2324D-11F6-442D-BAE0-65142F757BCE</string>
<string>BB077C81096E34247CCFED268F63A8050DE3ACEE</string>
<key>IDESourceControlProjectWCConfigurations</key>
<array>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>46C2324D-11F6-442D-BAE0-65142F757BCE</string>
<string>BB077C81096E34247CCFED268F63A8050DE3ACEE</string>
<key>IDESourceControlWCCName</key>
<string>iamiga-emufreak</string>
</dict>
Expand Down
1 change: 1 addition & 0 deletions uae4all_gp2x_0.7.2a/src/autoconf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ void REGPARAM2 rtarea_bput (uaecptr addr, uae_u32 value)
}

#ifdef USE_AUTOCONFIG

static int trace_traps = 1;

void REGPARAM2 call_calltrap(int func)
Expand Down
87 changes: 62 additions & 25 deletions uae4all_gp2x_0.7.2a/src/custom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
* Copyright 2000-2002 Toni Wilen
*/


// #define USE_CUSTOM_EXTRA_INLINE
#define USE_IMASK_TABLE
#define UNROLL_LONG_FETCH
Expand Down Expand Up @@ -111,7 +110,7 @@ unsigned long int currcycle, nextevent;
struct ev eventtab[ev_max];

static int vpos;
extern int next_vpos[512];
//extern int next_vpos[512];
static uae_u16 lof;
static int next_lineno;
static int lof_changed = 0;
Expand Down Expand Up @@ -1088,6 +1087,7 @@ static __inline__ void decide_fetch (int hpos)
/* This function is responsible for turning on datafetch if necessary. */
static __inline__ void decide_line (int hpos)
{

if (hpos <= last_decide_line_hpos)
return;
if (fetch_state != fetch_not_started)
Expand Down Expand Up @@ -1878,7 +1878,7 @@ static _INLINE_ void SET_INTERRUPT(void)
else if (new_irqs == 0)
{
M68KCONTEXT.interrupts[0] = 0; // uae4all_go_interrupt = 0;
m68k_irq_update(0);
m68k_irq_update();
}
else
{
Expand All @@ -1888,7 +1888,7 @@ static _INLINE_ void SET_INTERRUPT(void)
end_timeslice = new_level > old_level && new_level > _68k_intmask;

M68KCONTEXT.interrupts[0] = new_irqs;
m68k_irq_update(end_timeslice);
m68k_irq_update();
/*
if (new_level > old_level && new_level > _68k_intmask)
{
Expand Down Expand Up @@ -2089,9 +2089,18 @@ static _INLINE_ void SET_INTERRUPT(void)

static __inline__ void INTENA (uae_u16 v)
{
int intenaset = 0;
int intenasetnew = 0;
#ifdef DEBUG_CUSTOM
dbgf("INTENA 0x%X\n",v);
#endif
int vblankbit = (intena & ( 1 << 5)) >> 5;

if (vblankbit == 1)
{
intenaset = 1;
}

setclr (&intena,v);
/* There's stupid code out there that does
[some INTREQ bits at level 3 are set]
Expand All @@ -2104,6 +2113,18 @@ static __inline__ void INTENA (uae_u16 v)
it needs to happen one insn later, when the new L3 handler has been
installed. */

vblankbit = (intena & ( 1 << 5)) >> 5;

if (vblankbit == 1)
{
intenasetnew = 1;
}

if (intenasetnew != intenaset)
{
printf("VBLANK Intena Changed at: %x from %i to %i\n", m68kcontext.pc, intenaset, intenasetnew);
}

#if !defined(USE_FAME_CORE) && !defined(DEBUG_M68K)
if (v & 0x8000)
#endif
Expand Down Expand Up @@ -2705,6 +2726,7 @@ static _INLINE_ void predict_copper (void)
c_hpos = maxhpos;
} else if (vp > vcmp || hcmp <= c_hpos) {
state = COP_read1;

/* minimum wakeup time */
c_hpos += 2;
} else {
Expand Down Expand Up @@ -2924,7 +2946,8 @@ static _INLINE_ void update_copper (int until_hpos)
at 0/0). This can be seen in the Superfrog copper list.
Things get monstrously complicated if we try to handle this "properly" by
incrementing vpos and setting c_hpos to 0. Especially the various speedup
hacks really assume that vpos remains constant during one line. Hence,
hacks really assume that vpos remains constant during one line.
Hence,
this hack: defer the entire decision until the next line if necessary. */
if (c_hpos >= (maxhpos & ~1))
break;
Expand Down Expand Up @@ -3253,7 +3276,7 @@ static void vsync_handler (void)
if (joy0button!=back_joy0button)
back_joy0button= buttonstate[0]= joy0button;
}
INTREQ (0x8020);

if (bplcon0 & 4)
Expand Down Expand Up @@ -3331,7 +3354,9 @@ void hsync_handler (void)
#ifdef DEBUG_CUSTOM
dbgf("vpos=%i, maxvpos=%i, lof=%i\n",vpos,maxvpos,lof);
#endif
vpos=next_vpos[vpos];
//printf("Vpos: %d Intreq: %x\n", vpos, intreq);
vpos++;
//vpos=next_vpos[vpos];
if (vpos >= (maxvpos + (lof != 0)))
{
vpos=0;
Expand Down Expand Up @@ -3701,7 +3726,19 @@ static __inline__ uae_u32 REGPARAM2 custom_wget_1 (uaecptr addr)
case 0x018: v = 0; break;
case 0x01A: v = DSKBYTR (current_hpos ()); break;
case 0x01C: v = INTENAR (); break;
case 0x01E: v = INTREQR (); break;
case 0x01E: v = INTREQR ();

if(m68kcontext.pc == 0x31082)
{
int vblank = (intreq & ( 1 << 5 )) >> 5;

if(vblank == 1)
{

}
}
break;

case 0x07C: v = DENISEID (); break;

case 0x180: case 0x182: case 0x184: case 0x186: case 0x188: case 0x18A:
Expand Down Expand Up @@ -3990,8 +4027,8 @@ extern SDLKey vkbd_button4;

uae_u8 *restore_custom (uae_u8 *src)
{
uae_u16 dsklen, dskbytr, dskdatr, u16;
uae_u32 u32;
uae_u16 dsklen, dskbytr, dskdatr, ru16;
//uae_u32 u32;
int dskpt;
int i;

Expand Down Expand Up @@ -4020,19 +4057,19 @@ uae_u8 *restore_custom (uae_u8 *src)
RW; /* 028 REFPTR */
lof = RW; /* 02A VPOSW */
RW; /* 02C VHPOSW */
u16=RW; COPCON(u16); /* 02E COPCON */
ru16=RW; COPCON(ru16); /* 02E COPCON */
RW; /* 030 SERDAT* */
RW; /* 032 SERPER* */
u16=RW; POTGO(u16); /* 034 POTGO */
ru16=RW; POTGO(ru16); /* 034 POTGO */
RW; /* 036 JOYTEST* */
RW; /* 038 STREQU */
RW; /* 03A STRVHBL */
RW; /* 03C STRHOR */
RW; /* 03E STRLONG */
u16=RW; BLTCON0(u16); /* 040 BLTCON0 */
u16=RW; BLTCON1(u16); /* 042 BLTCON1 */
u16=RW; BLTAFWM(u16); /* 044 BLTAFWM */
u16=RW; BLTALWM(u16); /* 046 BLTALWM */
ru16=RW; BLTCON0(ru16); /* 040 BLTCON0 */
ru16=RW; BLTCON1(ru16); /* 042 BLTCON1 */
ru16=RW; BLTAFWM(ru16); /* 044 BLTAFWM */
ru16=RW; BLTALWM(ru16); /* 046 BLTALWM */
bltcpt=RL; // u32=RL; BLTCPTH(u32); /* 048-04B BLTCPT */
bltbpt=RL; // u32=RL; BLTBPTH(u32); /* 04C-04F BLTBPT */
bltapt=RL; // u32=RL; BLTAPTH(u32); /* 050-053 BLTAPT */
Expand All @@ -4041,22 +4078,22 @@ uae_u8 *restore_custom (uae_u8 *src)
RW; /* 05A BLTCON0L */
oldvblts = RW; /* 05C BLTSIZV */
RW; /* 05E BLTSIZH */
u16=RW; BLTCMOD(u16); /* 060 BLTCMOD */
u16=RW; BLTBMOD(u16); /* 062 BLTBMOD */
u16=RW; BLTAMOD(u16); /* 064 BLTAMOD */
u16=RW; BLTDMOD(u16); /* 066 BLTDMOD */
ru16=RW; BLTCMOD(ru16); /* 060 BLTCMOD */
ru16=RW; BLTBMOD(ru16); /* 062 BLTBMOD */
ru16=RW; BLTAMOD(ru16); /* 064 BLTAMOD */
ru16=RW; BLTDMOD(ru16); /* 066 BLTDMOD */
RW; /* 068 ? */
RW; /* 06A ? */
RW; /* 06C ? */
RW; /* 06E ? */
u16=RW; BLTCDAT(u16); /* 070 BLTCDAT */
u16=RW; BLTBDAT(u16); /* 072 BLTBDAT */
u16=RW; BLTADAT(u16); /* 074 BLTADAT */
ru16=RW; BLTCDAT(ru16); /* 070 BLTCDAT */
ru16=RW; BLTBDAT(ru16); /* 072 BLTBDAT */
ru16=RW; BLTADAT(ru16); /* 074 BLTADAT */
RW; /* 076 ? */
RW; /* 078 ? */
RW; /* 07A ? */
RW; /* 07C LISAID */
u16=RW; DSKSYNC(u16); /* 07E DSKSYNC */
ru16=RW; DSKSYNC(ru16); /* 07E DSKSYNC */
cop1lc = RL; /* 080/082 COP1LC */
cop2lc = RL; /* 084/086 COP2LC */
RW; /* 088 ? */
Expand All @@ -4067,7 +4104,7 @@ uae_u8 *restore_custom (uae_u8 *src)
ddfstrt = RW; /* 092 DDFSTRT */
ddfstop = RW; /* 094 DDFSTOP */
dmacon = RW & ~(0x2000|0x4000); /* 096 DMACON */
u16=RW; CLXCON(u16); /* 098 CLXCON */
ru16=RW; CLXCON(ru16); /* 098 CLXCON */
intena = RW; /* 09A INTENA */
intreq = RW; /* 09C INTREQ */
adkcon = RW; /* 09E ADKCON */
Expand Down
7 changes: 4 additions & 3 deletions uae4all_gp2x_0.7.2a/src/disk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1346,7 +1346,7 @@ void DSKLEN (uae_u16 v, int hpos)
return;
{
int dr;
uaecptr pc = _68k_getpc ();
uaecptr pc = m68k_get_pc ();
if ((pc & 0xF80000) != 0xF80000)
return;
for (dr = 0; dr < NUM_DRIVES; dr++) {
Expand Down Expand Up @@ -1606,7 +1606,7 @@ uae_u8 *restore_disk(int num,uae_u8 *src)
else
{
m68k_speed=mfmpos;
check_prefs_changed_cpu();
//check_prefs_changed_cpu();
}

src = (uae_u8 *)(((unsigned)src)+strlen((char *)src) + 1);
Expand Down Expand Up @@ -1639,7 +1639,8 @@ uae_u8 *save_disk(int num,int *len)
save_u8 (0); /* cylinder */
save_u8 (0); /* dskready */
save_u8 (0); /* id mode position */
save_u32 (m68k_speed); /* disk position */
save_u32(0); /* disk position */
//save_u32 (m68k_speed); /* disk position */
save_u32 (0); /* CRC of disk image */
dst[0]=dst[1]=0;
}
Expand Down
2 changes: 1 addition & 1 deletion uae4all_gp2x_0.7.2a/src/drawing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2097,7 +2097,7 @@ void check_all_prefs(void)

check_prefs_changed_audio ();
check_prefs_changed_custom ();
check_prefs_changed_cpu ();
//check_prefs_changed_cpu ();
if (check_prefs_changed_gfx ()) {
init_row_map ();
init_aspect_maps ();
Expand Down
3 changes: 3 additions & 0 deletions uae4all_gp2x_0.7.2a/src/include/custom.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
/* These are the masks that are ORed together in the chipset_mask option.
* If CSMASK_AJA is set, the ECS bits are guaranteed to be set as well. */

//#include "m68k_intrf.h"

#ifndef UAE_CUSTOM_H
#define UAE_CUSTOM_H

Expand Down Expand Up @@ -68,6 +70,7 @@ extern void INTREQ (uae_u16);
extern void INTREQ_0 (uae_u16);
//extern uae_u16 INTREQR (void);
uae_u16 __inline__ INTREQR (void) {

return intreq;
}

Expand Down
Loading

0 comments on commit 1dbbc8d

Please sign in to comment.