id
int64 15.5k
16.3M
| file_name
stringlengths 3
43
| file_path
stringlengths 22
137
| content
stringlengths 21
332k
| size
int64 21
332k
| language
stringclasses 1
value | extension
stringclasses 2
values | total_lines
int64 4
7.88k
| avg_line_length
float64 1.1
84.2
| max_line_length
int64 2
3.13k
| alphanum_fraction
float64 0.16
1
| repo_name
stringlengths 9
45
| repo_stars
int64 2
10.4k
| repo_forks
int64 0
1.2k
| repo_open_issues
int64 0
220
| repo_license
stringclasses 6
values | repo_extraction_date
stringlengths 39
40
| exact_duplicates_stackv2
bool 2
classes | exact_duplicates_stackv1
bool 2
classes | exact_duplicates_redpajama
bool 2
classes | exact_duplicates_githubcode
bool 1
class | near_duplicates_stackv2
bool 2
classes | near_duplicates_stackv1
bool 2
classes | near_duplicates_redpajama
bool 2
classes | near_duplicates_githubcode
bool 1
class |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
15,458 | out.input008.c | DoctorWkt_acwj/44_Fold_Optimisation/tests/out.input008.c | 1
2
3
4
5
6
7
8
9
10
| 21 | C | .c | 10 | 1.1 | 2 | 1 | DoctorWkt/acwj | 10,392 | 1,007 | 26 | GPL-3.0 | 9/7/2024, 9:40:14 AM (Europe/Amsterdam) | true | false | false | true | true | false | false | false |
39,850 | input.h | universal-ctags_ctags/Units/parser-cxx.r/bug639644.cpp.d/input.h | /*
Date: Sun, 17 Nov 2002 04:57:43 -0800
Subject: [ ctags-Bugs-639644 ] anonymous namespaces in headers
Bugs item #639644, was opened at 2002-11-17 13:57
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=106556&aid=639644&group_id=6556
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Matthias S. Benkmann (mbenkmann)
Assigned to: Nobody/Anonymous (nobody)
Summary: anonymous namespaces in headers
Initial Comment:
--------------------temp3.h----------------
*/
namespace
{
int foo;
}
/*
---------------------------------------------
> ctags -f - temp3.h
foo temp3.h /^ int foo;$/;" m namespace:
That last field should be "namespace:<anonymous>"
and the kind field should be variable, not member.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=106556&aid=639644&group_id=6556
*/
| 977 | C | .h | 31 | 30.064516 | 81 | 0.639957 | universal-ctags/ctags | 6,474 | 620 | 220 | GPL-2.0 | 9/7/2024, 9:40:14 AM (Europe/Amsterdam) | false | true | false | true | false | true | false | false |
116,469 | daemonise.c | WiringPi_WiringPi/wiringPiD/daemonise.c | /*
* daemonise.c:
* Fairly generic "Turn the current process into a daemon" code.
*
* Copyright (c) 2016-2017 Gordon Henderson.
*********************************************************************************
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <syslog.h>
#include <signal.h>
#include <sys/stat.h>
#include "daemonise.h"
void daemonise (const char *pidFile)
{
pid_t pid ;
int i ;
FILE *fd ;
syslog (LOG_DAEMON | LOG_INFO, "Becoming daemon") ;
// Fork from the parent
if ((pid = fork ()) < 0)
{
syslog (LOG_DAEMON | LOG_ALERT, "Fork no. 1 failed: %m") ;
exit (EXIT_FAILURE) ;
}
if (pid > 0) // Parent - terminate
exit (EXIT_SUCCESS) ;
// Now running on the child - become session leader
if (setsid() < 0)
{
syslog (LOG_DAEMON | LOG_ALERT, "setsid failed: %m") ;
exit (EXIT_FAILURE) ;
}
// Ignore a few signals
signal (SIGCHLD, SIG_IGN) ;
signal (SIGHUP, SIG_IGN) ;
// Fork again
if ((pid = fork ()) < 0)
{
syslog (LOG_DAEMON | LOG_ALERT, "Fork no. 2 failed: %m") ;
exit (EXIT_FAILURE) ;
}
if (pid > 0) // parent - terminate
exit (EXIT_SUCCESS) ;
// Tidying up - reset umask, change to / and close all files
umask (0) ;
chdir ("/") ;
for (i = 0 ; i < sysconf (_SC_OPEN_MAX) ; ++i)
close (i) ;
// Write PID into /var/run
if (pidFile != NULL)
{
if ((fd = fopen (pidFile, "w")) == NULL)
{
syslog (LOG_DAEMON | LOG_ALERT, "Unable to write PID file: %m") ;
exit (EXIT_FAILURE) ;
}
fprintf (fd, "%d\n", getpid ()) ;
fclose (fd) ;
}
}
| 1,607 | C | .c | 62 | 22.66129 | 82 | 0.569836 | WiringPi/WiringPi | 2,627 | 1,197 | 20 | LGPL-3.0 | 9/7/2024, 9:40:14 AM (Europe/Amsterdam) | false | true | false | true | false | true | false | false |
261,207 | helpers.c | HVML_PurC/Source/Executables/purc/util/helpers.c | /*
* helpers.c - Implementation of useful helpers.
*
* Copyright (C) 2023 FMSoft <https://www.fmsoft.cn>
*
* Author: Vincent Wei <https://github.com/VincentWei>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "helpers.h"
| 925 | C | .c | 20 | 44.25 | 75 | 0.770764 | HVML/PurC | 1,057 | 54 | 13 | LGPL-3.0 | 9/7/2024, 9:40:15 AM (Europe/Amsterdam) | true | false | false | true | true | false | false | false |
297,749 | g_sphere.c | kondrak_vkQuake2/rogue/g_sphere.c | // g_sphere.c
// pmack
// april 1998
// defender - actively finds and shoots at enemies
// hunter - waits until < 25% health and vore ball tracks person who hurt you
// vengeance - kills person who killed you.
#include "g_local.h"
#define DEFENDER_LIFESPAN 30
#define HUNTER_LIFESPAN 30
#define VENGEANCE_LIFESPAN 30
#define MINIMUM_FLY_TIME 15
//#define MINIMUM_FLY_TIME 30
// FIXME - do we need to be calling ED_NewString at all?
extern char *ED_NewString (char *string);
void LookAtKiller (edict_t *self, edict_t *inflictor, edict_t *attacker);
void defender_think (edict_t *self);
void hunter_think (edict_t *self);
void vengeance_think (edict_t *self);
void vengeance_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf);
void hunter_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf);
// *************************
// General Sphere Code
// *************************
// =================
// =================
void sphere_think_explode (edict_t *self)
{
if(self->owner && self->owner->client && !(self->spawnflags & SPHERE_DOPPLEGANGER))
{
self->owner->client->owned_sphere = NULL;
}
BecomeExplosion1 (self);
}
// =================
// sphere_explode
// =================
void sphere_explode (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
{
// if(self->owner && self->owner->client)
// gi.cprintf(self->owner, PRINT_HIGH, "Sphere timed out\n");
// gi.dprintf("player died, blowing up\n");
sphere_think_explode (self);
}
// =================
// sphere_if_idle_die - if the sphere is not currently attacking, blow up.
// =================
void sphere_if_idle_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
{
if(!self->enemy)
{
// gi.dprintf("player died, blowing up\n");
sphere_think_explode(self);
}
}
// *************************
// Sphere Movement
// *************************
// =================
// =================
void sphere_fly (edict_t *self)
{
vec3_t dest;
vec3_t dir;
if(level.time >= self->wait)
{
// gi.dprintf("fly: timed out\n");
sphere_think_explode(self);
return;
}
VectorCopy (self->owner->s.origin, dest);
dest[2] = self->owner->absmax[2] + 4;
if(level.time == (float)(int)level.time)
{
if(!visible(self, self->owner))
{
VectorCopy(dest, self->s.origin);
gi.linkentity(self);
return;
}
}
VectorSubtract (dest, self->s.origin, dir);
VectorScale (dir, 5, self->velocity);
}
// =================
// =================
void sphere_chase (edict_t *self, int stupidChase)
{
vec3_t dest;
vec3_t dir;
float dist;
if(level.time >= self->wait || (self->enemy && self->enemy->health < 1))
{
sphere_think_explode(self);
return;
}
VectorCopy (self->enemy->s.origin, dest);
if(self->enemy->client)
dest[2] += self->enemy->viewheight;
if(visible(self, self->enemy) || stupidChase)
{
// if moving, hunter sphere uses active sound
if(!stupidChase)
self->s.sound = gi.soundindex ("spheres/h_active.wav");
VectorSubtract (dest, self->s.origin, dir);
VectorNormalize (dir);
vectoangles2(dir, self->s.angles);
VectorScale (dir, 500, self->velocity);
VectorCopy(dest, self->monsterinfo.saved_goal);
}
else if (VectorCompare (self->monsterinfo.saved_goal, vec3_origin))
{
VectorSubtract(self->enemy->s.origin, self->s.origin, dir);
dist = VectorNormalize(dir);
vectoangles2(dir, self->s.angles);
// if lurking, hunter sphere uses lurking sound
self->s.sound = gi.soundindex ("spheres/h_lurk.wav");
VectorClear (self->velocity);
}
else
{
VectorSubtract(self->monsterinfo.saved_goal, self->s.origin, dir);
dist = VectorNormalize(dir);
if(dist > 1)
{
vectoangles2(dir, self->s.angles);
if(dist > 500)
VectorScale(dir, 500, self->velocity);
else if (dist < 20)
VectorScale(dir, (dist / FRAMETIME), self->velocity);
else
VectorScale(dir, dist, self->velocity);
// if moving, hunter sphere uses active sound
if(!stupidChase)
self->s.sound = gi.soundindex ("spheres/h_active.wav");
}
else
{
VectorSubtract(self->enemy->s.origin, self->s.origin, dir);
dist = VectorNormalize(dir);
vectoangles2(dir, self->s.angles);
// if not moving, hunter sphere uses lurk sound
if(!stupidChase)
self->s.sound = gi.soundindex ("spheres/h_lurk.wav");
VectorClear(self->velocity);
}
}
}
// *************************
// Attack related stuff
// *************************
// =================
// =================
void sphere_fire (edict_t *self, edict_t *enemy)
{
vec3_t dest;
vec3_t dir;
if(level.time >= self->wait || !enemy)
{
sphere_think_explode(self);
return;
}
VectorCopy (enemy->s.origin, dest);
self->s.effects |= EF_ROCKET;
VectorSubtract (dest, self->s.origin, dir);
VectorNormalize (dir);
vectoangles2 ( dir, self->s.angles );
VectorScale (dir, 1000, self->velocity);
self->touch = vengeance_touch;
self->think = sphere_think_explode;
self->nextthink = self->wait;
}
// =================
// =================
void sphere_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf, int mod)
{
if(self->spawnflags & SPHERE_DOPPLEGANGER)
{
if (other == self->teammaster)
return;
self->takedamage = DAMAGE_NO;
self->owner = self->teammaster;
self->teammaster = NULL;
}
else
{
if (other == self->owner)
return;
// PMM - don't blow up on bodies
if (!strcmp(other->classname, "bodyque"))
return;
}
if (surf && (surf->flags & SURF_SKY))
{
G_FreeEdict (self);
return;
}
if (other->takedamage)
{
T_Damage (other, self, self->owner, self->velocity, self->s.origin, plane->normal,
10000, 1, DAMAGE_DESTROY_ARMOR, mod);
}
else
{
T_RadiusDamage (self, self->owner, 512, self->owner, 256, mod);
}
sphere_think_explode (self);
}
// =================
// =================
void vengeance_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf)
{
if(self->spawnflags & SPHERE_DOPPLEGANGER)
sphere_touch (self, other, plane, surf, MOD_DOPPLE_VENGEANCE);
else
sphere_touch (self, other, plane, surf, MOD_VENGEANCE_SPHERE);
}
// =================
// =================
void hunter_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf)
{
edict_t *owner;
// don't blow up if you hit the world.... sheesh.
if(other==world)
return;
if(self->owner)
{
// if owner is flying with us, make sure they stop too.
owner=self->owner;
if(owner->flags & FL_SAM_RAIMI)
{
VectorClear(owner->velocity);
owner->movetype = MOVETYPE_NONE;
gi.linkentity(owner);
}
}
if(self->spawnflags & SPHERE_DOPPLEGANGER)
sphere_touch (self, other, plane, surf, MOD_DOPPLE_HUNTER);
else
sphere_touch (self, other, plane, surf, MOD_HUNTER_SPHERE);
}
// =================
// =================
void defender_shoot (edict_t *self, edict_t *enemy)
{
vec3_t dir;
vec3_t start;
if(!(enemy->inuse) || enemy->health <= 0)
return;
if(enemy == self->owner)
return;
VectorSubtract (enemy->s.origin, self->s.origin, dir);
VectorNormalize (dir);
if(self->monsterinfo.attack_finished > level.time)
return;
if(!visible(self, self->enemy))
return;
VectorCopy(self->s.origin, start);
start[2] += 2;
fire_blaster2 (self->owner, start, dir, 10, 1000, EF_BLASTER, 0);
self->monsterinfo.attack_finished = level.time + 0.4;
}
// *************************
// Activation Related Stuff
// *************************
// =================
// =================
void body_gib (edict_t *self)
{
int n;
gi.sound (self, CHAN_BODY, gi.soundindex ("misc/udeath.wav"), 1, ATTN_NORM, 0);
for (n= 0; n < 4; n++)
ThrowGib (self, "models/objects/gibs/sm_meat/tris.md2", 50, GIB_ORGANIC);
ThrowGib (self, "models/objects/gibs/skull/tris.md2", 50, GIB_ORGANIC);
}
// =================
// =================
void hunter_pain (edict_t *self, edict_t *other, float kick, int damage)
{
edict_t *owner;
float dist;
vec3_t dir;
if(self->enemy)
return;
owner = self->owner;
if(!(self->spawnflags & SPHERE_DOPPLEGANGER))
{
if(owner && (owner->health > 0))
return;
//PMM
if(other == owner)
{
// if ((g_showlogic) && (g_showlogic->value))
// gi.dprintf ("hunter: won't get mad at my owner!\n");
return;
}
//pmm
}
else
{
// if fired by a doppleganger, set it to 10 second timeout
self->wait = level.time + MINIMUM_FLY_TIME;
}
if((self->wait - level.time) < MINIMUM_FLY_TIME)
self->wait = level.time + MINIMUM_FLY_TIME;
self->s.effects |= EF_BLASTER | EF_TRACKER;
self->touch = hunter_touch;
self->enemy = other;
// if(g_showlogic && g_showlogic->value)
// gi.dprintf("hunter_pain: mad at %s\n", other->classname);
// if we're not owned by a player, no sam raimi
// if we're spawned by a doppleganger, no sam raimi
if((self->spawnflags & SPHERE_DOPPLEGANGER) || !(owner && owner->client))
return;
// sam raimi cam is disabled if FORCE_RESPAWN is set.
// sam raimi cam is also disabled if huntercam->value is 0.
if(!((int)dmflags->value & DF_FORCE_RESPAWN) && (huntercam && (huntercam->value)))
{
VectorSubtract(other->s.origin, self->s.origin, dir);
dist=VectorLength(dir);
if(owner && (dist >= 192))
{
// detach owner from body and send him flying
owner->movetype = MOVETYPE_FLYMISSILE;
// gib like we just died, even though we didn't, really.
body_gib(owner);
// move the sphere to the owner's current viewpoint.
// we know it's a valid spot (or will be momentarily)
VectorCopy(owner->s.origin, self->s.origin);
self->s.origin[2] += owner->viewheight;
// move the player's origin to the sphere's new origin
VectorCopy(self->s.origin, owner->s.origin);
VectorCopy(self->s.angles, owner->s.angles);
VectorCopy(self->s.angles, owner->client->v_angle);
VectorClear(owner->mins);
VectorClear(owner->maxs);
VectorSet(owner->mins, -5, -5, -5);
VectorSet(owner->maxs, 5, 5, 5);
owner->client->ps.fov = 140;
owner->s.modelindex = 0;
owner->s.modelindex2 = 0;
owner->viewheight = 8;
owner->solid = SOLID_NOT;
owner->flags |= FL_SAM_RAIMI;
gi.linkentity(owner);
// PMM - set bounding box so we don't clip out of world
// VectorSet(self->mins, -5, -5, -5);
// VectorSet(self->maxs, 5, 5, 5);
self->solid = SOLID_BBOX;
gi.linkentity (self);
}
// else
// gi.dprintf("too close for sam raimi cam\n");
}
}
// =================
// =================
void defender_pain (edict_t *self, edict_t *other, float kick, int damage)
{
//PMM
if(other == self->owner)
{
// if ((g_showlogic) && (g_showlogic->value))
// gi.dprintf ("defender: won't get mad at my owner!\n");
return;
}
//pmm
self->enemy = other;
}
// =================
// =================
void vengeance_pain (edict_t *self, edict_t *other, float kick, int damage)
{
if(self->enemy)
return;
if(!(self->spawnflags & SPHERE_DOPPLEGANGER))
{
if(self->owner->health >= 25)
return;
//PMM
if(other == self->owner)
{
// if ((g_showlogic) && (g_showlogic->value))
// gi.dprintf ("vengeance: won't get mad at my owner!\n");
return;
}
//pmm
}
else
{
self->wait = level.time + MINIMUM_FLY_TIME;
}
if((self->wait - level.time) < MINIMUM_FLY_TIME)
self->wait = level.time + MINIMUM_FLY_TIME;
self->s.effects |= EF_ROCKET;
self->touch = vengeance_touch;
self->enemy = other;
}
// *************************
// Think Functions
// *************************
// ===================
// ===================
void defender_think (edict_t *self)
{
if(!self->owner)
{
// gi.dprintf("think: no owner\n");
G_FreeEdict(self);
return;
}
// if we've exited the level, just remove ourselves.
if (level.intermissiontime)
{
sphere_think_explode(self);
return;
}
if(self->owner->health <=0)
{
sphere_think_explode(self);
return;
}
// if(level.time - self->timestamp > 1)
// {
// gi.sound (self, CHAN_VOICE, gi.soundindex ("powerup/dsphere.wav"), 0.6, ATTN_NORM, 0);
// self->timestamp = level.time;
// }
self->s.frame++;
if(self->s.frame>19)
self->s.frame = 0;
if(self->enemy)
{
if(self->enemy->health > 0)
{
// gi.dprintf( "shooting at %s\n", self->enemy->classname);
defender_shoot (self, self->enemy);
}
else
self->enemy = NULL;
}
// else
// {
// self->ideal_yaw+=3;
// M_ChangeYaw (self);
// }
sphere_fly (self);
if(self->inuse)
self->nextthink = level.time + 0.1;
}
// =================
// =================
void hunter_think (edict_t *self)
{
edict_t *owner;
vec3_t dir, ang;
// if we've exited the level, just remove ourselves.
if (level.intermissiontime)
{
sphere_think_explode(self);
return;
}
owner = self->owner;
if(!owner && !(self->spawnflags & SPHERE_DOPPLEGANGER))
{
// gi.dprintf("think: no owner\n");
G_FreeEdict(self);
return;
}
if(owner)
self->ideal_yaw = owner->s.angles[YAW];
else if(self->enemy) // fired by doppleganger
{
VectorSubtract(self->enemy->s.origin, self->s.origin, dir);
vectoangles2(dir, ang);
self->ideal_yaw = ang[YAW];
}
M_ChangeYaw(self);
// if(level.time - self->timestamp > 1)
// {
// gi.sound (self, CHAN_VOICE, gi.soundindex ("powerup/hsphere.wav"), 0.5, ATTN_NORM, 0);
// self->timestamp = level.time;
// }
if(self->enemy)
{
sphere_chase (self, 0);
// deal with sam raimi cam
if(owner && (owner->flags & FL_SAM_RAIMI))
{
if(self->inuse)
{
owner->movetype = MOVETYPE_FLYMISSILE;
// VectorCopy(self->s.angles, owner->s.angles);
// VectorCopy(self->s.angles, owner->client->v_angle);
LookAtKiller (owner, self, self->enemy);
// owner->viewheight = 22;
// owner->client->v_angle[YAW]+=5;
// owner is flying with us, move him too
owner->movetype = MOVETYPE_FLYMISSILE;
owner->viewheight = self->s.origin[2] - owner->s.origin[2];
// VectorCopy(self->s.angles, owner->s.angles);
// VectorCopy(self->s.angles, owner->client->v_angle);
VectorCopy(self->s.origin, owner->s.origin);
VectorCopy(self->velocity, owner->velocity);
VectorClear(owner->mins);
VectorClear(owner->maxs);
gi.linkentity(owner);
}
else // sphere timed out
{
VectorClear(owner->velocity);
owner->movetype = MOVETYPE_NONE;
gi.linkentity(owner);
}
}
}
else
{
// self->ideal_yaw+=3;
// M_ChangeYaw (self);
sphere_fly (self);
}
if(self->inuse)
self->nextthink = level.time + 0.1;
}
// =================
// =================
void vengeance_think (edict_t *self)
{
// if we've exited the level, just remove ourselves.
if (level.intermissiontime)
{
sphere_think_explode(self);
return;
}
if(!(self->owner) && !(self->spawnflags & SPHERE_DOPPLEGANGER))
{
// gi.dprintf("think: no owner\n");
G_FreeEdict(self);
return;
}
// if(level.time - self->timestamp > 1)
// {
// gi.sound (self, CHAN_VOICE, gi.soundindex ("powerup/vsphere.wav"), 0.5, ATTN_NORM, 0);
// self->timestamp = level.time;
// }
if(self->enemy)
{
// sphere_fire (self, self->owner->enemy);
sphere_chase (self, 1);
}
else
sphere_fly (self);
if(self->inuse)
self->nextthink = level.time + 0.1;
}
// *************************
// Spawning / Creation
// *************************
// monsterinfo_t
// =================
// =================
edict_t *Sphere_Spawn (edict_t *owner, int spawnflags)
{
edict_t *sphere;
sphere = G_Spawn();
VectorCopy(owner->s.origin, sphere->s.origin);
sphere->s.origin[2] = owner->absmax[2];
sphere->s.angles[YAW] = owner->s.angles[YAW];
sphere->solid = SOLID_BBOX;
sphere->clipmask = MASK_SHOT;
sphere->s.renderfx = RF_FULLBRIGHT | RF_IR_VISIBLE;
sphere->movetype = MOVETYPE_FLYMISSILE;
if(spawnflags & SPHERE_DOPPLEGANGER)
sphere->teammaster = owner->teammaster;
else
sphere->owner = owner;
sphere->classname = "sphere";
sphere->yaw_speed = 40;
sphere->monsterinfo.attack_finished = 0;
sphere->spawnflags = spawnflags; // need this for the HUD to recognize sphere
//PMM
sphere->takedamage = DAMAGE_NO;
switch(spawnflags & SPHERE_TYPE)
{
case SPHERE_DEFENDER:
sphere->s.modelindex = gi.modelindex("models/items/defender/tris.md2");
// PMM - this doesn't work, causes problems with other stuff
// sphere->s.modelindex2 = gi.modelindex("models/items/shell/tris.md2") | 0x80;
sphere->s.modelindex2 = gi.modelindex("models/items/shell/tris.md2");
sphere->s.sound = gi.soundindex ("spheres/d_idle.wav");
sphere->pain = defender_pain;
sphere->wait = level.time + DEFENDER_LIFESPAN;
sphere->die = sphere_explode;
sphere->think = defender_think;
break;
case SPHERE_HUNTER:
sphere->s.modelindex = gi.modelindex("models/items/hunter/tris.md2");
sphere->s.sound = gi.soundindex ("spheres/h_idle.wav");
sphere->wait = level.time + HUNTER_LIFESPAN;
sphere->pain = hunter_pain;
sphere->die = sphere_if_idle_die;
sphere->think = hunter_think;
break;
case SPHERE_VENGEANCE:
sphere->s.modelindex = gi.modelindex("models/items/vengnce/tris.md2");
sphere->s.sound = gi.soundindex ("spheres/v_idle.wav");
sphere->wait = level.time + VENGEANCE_LIFESPAN;
sphere->pain = vengeance_pain;
sphere->die = sphere_if_idle_die;
sphere->think = vengeance_think;
VectorSet (sphere->avelocity, 30, 30, 0);
break;
default:
gi.dprintf("Tried to create an invalid sphere\n");
G_FreeEdict(sphere);
return NULL;
}
sphere->nextthink = level.time + 0.1;
gi.linkentity (sphere);
return sphere;
}
// =================
// Own_Sphere - attach the sphere to the client so we can
// directly access it later
// =================
void Own_Sphere (edict_t *self, edict_t *sphere)
{
if(!sphere)
return;
// ownership only for players
if(self->client)
{
// if they don't have one
if(!(self->client->owned_sphere))
{
self->client->owned_sphere = sphere;
}
// they already have one, take care of the old one
else
{
if(self->client->owned_sphere->inuse)
{
G_FreeEdict(self->client->owned_sphere);
self->client->owned_sphere = sphere;
}
else
{
self->client->owned_sphere = sphere;
}
}
}
}
// =================
// =================
void Defender_Launch (edict_t *self)
{
edict_t *sphere;
sphere = Sphere_Spawn (self, SPHERE_DEFENDER);
Own_Sphere (self, sphere);
}
// =================
// =================
void Hunter_Launch (edict_t *self)
{
edict_t *sphere;
sphere = Sphere_Spawn (self, SPHERE_HUNTER);
Own_Sphere (self, sphere);
}
// =================
// =================
void Vengeance_Launch (edict_t *self)
{
edict_t *sphere;
sphere = Sphere_Spawn (self, SPHERE_VENGEANCE);
Own_Sphere (self, sphere);
}
| 18,537 | C | .c | 675 | 24.98963 | 104 | 0.635749 | kondrak/vkQuake2 | 897 | 91 | 1 | GPL-2.0 | 9/7/2024, 9:40:22 AM (Europe/Amsterdam) | false | false | false | true | true | false | false | false |
297,772 | g_newtarg.c | kondrak_vkQuake2/rogue/g_newtarg.c | #include "g_local.h"
//==========================================================
/*QUAKED target_steam (1 0 0) (-8 -8 -8) (8 8 8)
Creates a steam effect (particles w/ velocity in a line).
speed = velocity of particles (default 50)
count = number of particles (default 32)
sounds = color of particles (default 8 for steam)
the color range is from this color to this color + 6
wait = seconds to run before stopping (overrides default
value derived from func_timer)
best way to use this is to tie it to a func_timer that "pokes"
it every second (or however long you set the wait time, above)
note that the width of the base is proportional to the speed
good colors to use:
6-9 - varying whites (darker to brighter)
224 - sparks
176 - blue water
80 - brown water
208 - slime
232 - blood
*/
void use_target_steam (edict_t *self, edict_t *other, edict_t *activator)
{
// FIXME - this needs to be a global
static int nextid;
vec3_t point;
if (nextid > 20000)
nextid = nextid %20000;
nextid++;
// automagically set wait from func_timer unless they set it already, or
// default to 1000 if not called by a func_timer (eek!)
if (!self->wait)
if (other)
self->wait = other->wait * 1000;
else
self->wait = 1000;
if (self->enemy)
{
VectorMA (self->enemy->absmin, 0.5, self->enemy->size, point);
VectorSubtract (point, self->s.origin, self->movedir);
VectorNormalize (self->movedir);
}
VectorMA (self->s.origin, self->plat2flags*0.5, self->movedir, point);
if (self->wait > 100)
{
gi.WriteByte (svc_temp_entity);
gi.WriteByte (TE_STEAM);
gi.WriteShort (nextid);
gi.WriteByte (self->count);
gi.WritePosition (self->s.origin);
gi.WriteDir (self->movedir);
gi.WriteByte (self->sounds&0xff);
gi.WriteShort ( (short int)(self->plat2flags) );
gi.WriteLong ( (int)(self->wait) );
gi.multicast (self->s.origin, MULTICAST_PVS);
}
else
{
gi.WriteByte (svc_temp_entity);
gi.WriteByte (TE_STEAM);
gi.WriteShort ((short int)-1);
gi.WriteByte (self->count);
gi.WritePosition (self->s.origin);
gi.WriteDir (self->movedir);
gi.WriteByte (self->sounds&0xff);
gi.WriteShort ( (short int)(self->plat2flags) );
gi.multicast (self->s.origin, MULTICAST_PVS);
}
}
void target_steam_start (edict_t *self)
{
edict_t *ent;
self->use = use_target_steam;
if (self->target)
{
ent = G_Find (NULL, FOFS(targetname), self->target);
if (!ent)
gi.dprintf ("%s at %s: %s is a bad target\n", self->classname, vtos(self->s.origin), self->target);
self->enemy = ent;
}
else
{
G_SetMovedir (self->s.angles, self->movedir);
}
if (!self->count)
self->count = 32;
if (!self->plat2flags)
self->plat2flags = 75;
if (!self->sounds)
self->sounds = 8;
if (self->wait)
self->wait *= 1000; // we want it in milliseconds, not seconds
// paranoia is good
self->sounds &= 0xff;
self->count &= 0xff;
self->svflags = SVF_NOCLIENT;
gi.linkentity (self);
}
void SP_target_steam (edict_t *self)
{
self->plat2flags = self->speed;
if (self->target)
{
self->think = target_steam_start;
self->nextthink = level.time + 1;
}
else
target_steam_start (self);
}
//==========================================================
// target_anger
//==========================================================
void target_anger_use (edict_t *self, edict_t *other, edict_t *activator)
{
edict_t *target;
edict_t *t;
t = NULL;
target = G_Find (t, FOFS(targetname), self->killtarget);
if (target && self->target)
{
// Make whatever a "good guy" so the monster will try to kill it!
target->monsterinfo.aiflags |= AI_GOOD_GUY;
target->svflags |= SVF_MONSTER;
target->health = 300;
t = NULL;
while ((t = G_Find (t, FOFS(targetname), self->target)))
{
if (t == self)
{
gi.dprintf ("WARNING: entity used itself.\n");
}
else
{
if (t->use)
{
if (t->health < 0)
{
// if ((g_showlogic) && (g_showlogic->value))
// gi.dprintf ("target_anger with dead monster!\n");
return;
}
t->enemy = target;
t->monsterinfo.aiflags |= AI_TARGET_ANGER;
FoundTarget (t);
}
}
if (!self->inuse)
{
gi.dprintf("entity was removed while using targets\n");
return;
}
}
}
}
/*QUAKED target_anger (1 0 0) (-8 -8 -8) (8 8 8)
This trigger will cause an entity to be angry at another entity when a player touches it. Target the
entity you want to anger, and killtarget the entity you want it to be angry at.
target - entity to piss off
killtarget - entity to be pissed off at
*/
void SP_target_anger (edict_t *self)
{
if (!self->target)
{
gi.dprintf("target_anger without target!\n");
G_FreeEdict (self);
return;
}
if (!self->killtarget)
{
gi.dprintf("target_anger without killtarget!\n");
G_FreeEdict (self);
return;
}
self->use = target_anger_use;
self->svflags = SVF_NOCLIENT;
}
// ================
// target_spawn
// ================
/*
extern edict_t *CreateMonster(vec3_t origin, vec3_t angles, char *classname);
void target_spawn_use (edict_t *self, edict_t *other, edict_t *activator)
{
edict_t *newEnt;
newEnt = CreateMonster (self->s.origin, self->s.angles, "monster_infantry");
if(newEnt)
newEnt->enemy = other;
}
*/
/*Q U AKED target_spawn (1 0 0) (-32 -32 -24) (32 32 72)
*/
/*
void SP_target_spawn (edict_t *self)
{
self->use = target_spawn_use;
self->svflags = SVF_NOCLIENT;
}
*/
// ***********************************
// target_killplayers
// ***********************************
void target_killplayers_use (edict_t *self, edict_t *other, edict_t *activator)
{
int i;
edict_t *ent, *player;
// kill the players
for (i=0 ; i<game.maxclients ; i++)
{
player = &g_edicts[1+i];
if (!player->inuse)
continue;
// nail it
T_Damage (player, self, self, vec3_origin, self->s.origin, vec3_origin, 100000, 0, DAMAGE_NO_PROTECTION, MOD_TELEFRAG);
}
// kill any visible monsters
for (ent = g_edicts; ent < &g_edicts[globals.num_edicts] ; ent++)
{
if (!ent->inuse)
continue;
if (ent->health < 1)
continue;
if (!ent->takedamage)
continue;
for(i=0;i<game.maxclients ; i++)
{
player = &g_edicts[1+i];
if(!player->inuse)
continue;
if(visible(player, ent))
{
T_Damage (ent, self, self, vec3_origin, ent->s.origin, vec3_origin,
ent->health, 0, DAMAGE_NO_PROTECTION, MOD_TELEFRAG);
break;
}
}
}
}
/*QUAKED target_killplayers (1 0 0) (-8 -8 -8) (8 8 8)
When triggered, this will kill all the players on the map.
*/
void SP_target_killplayers (edict_t *self)
{
self->use = target_killplayers_use;
self->svflags = SVF_NOCLIENT;
}
/*QUAKED target_blacklight (1 0 1) (-16 -16 -24) (16 16 24)
Pulsing black light with sphere in the center
*/
void blacklight_think (edict_t *self)
{
self->s.angles[0] = rand()%360;
self->s.angles[1] = rand()%360;
self->s.angles[2] = rand()%360;
self->nextthink = level.time + 0.1;
}
void SP_target_blacklight(edict_t *ent)
{
if (deathmatch->value)
{ // auto-remove for deathmatch
G_FreeEdict (ent);
return;
}
VectorClear (ent->mins);
VectorClear (ent->maxs);
ent->s.effects |= (EF_TRACKERTRAIL|EF_TRACKER);
ent->think = blacklight_think;
ent->s.modelindex = gi.modelindex ("models/items/spawngro2/tris.md2");
ent->s.frame = 1;
ent->nextthink = level.time + 0.1;
gi.linkentity (ent);
}
/*QUAKED target_orb (1 0 1) (-16 -16 -24) (16 16 24)
Translucent pulsing orb with speckles
*/
void orb_think (edict_t *self)
{
self->s.angles[0] = rand()%360;
self->s.angles[1] = rand()%360;
self->s.angles[2] = rand()%360;
// self->s.effects |= (EF_TRACKERTRAIL|EF_DOUBLE);
self->nextthink = level.time + 0.1;
}
void SP_target_orb(edict_t *ent)
{
if (deathmatch->value)
{ // auto-remove for deathmatch
G_FreeEdict (ent);
return;
}
VectorClear (ent->mins);
VectorClear (ent->maxs);
// ent->s.effects |= EF_TRACKERTRAIL;
ent->think = orb_think;
ent->nextthink = level.time + 0.1;
ent->s.modelindex = gi.modelindex ("models/items/spawngro2/tris.md2");
ent->s.frame = 2;
ent->s.effects |= EF_SPHERETRANS;
gi.linkentity (ent);
}
| 8,094 | C | .c | 300 | 24.396667 | 121 | 0.648656 | kondrak/vkQuake2 | 897 | 91 | 1 | GPL-2.0 | 9/7/2024, 9:40:22 AM (Europe/Amsterdam) | false | false | false | true | true | false | false | false |
490,461 | fifo_map.h | autobleem_AutoBleem/libs/nlohmann/fifo_map.h | /*
The code is licensed under the MIT License <http://opensource.org/licenses/MIT>:
Copyright (c) 2015-2017 Niels Lohmann.
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#ifndef NLOHMANN_FIFO_MAP_HPP
#define NLOHMANN_FIFO_MAP_HPP
#include <algorithm>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <memory>
#include <unordered_map>
#include <utility>
#include <vector>
/*!
@brief namespace for Niels Lohmann
@see https://github.com/nlohmann
*/
namespace nlohmann
{
template<class Key>
class fifo_map_compare
{
public:
/// constructor given a pointer to a key storage
fifo_map_compare(
std::unordered_map<Key, std::size_t>* keys,
std::size_t timestamp = 1)
:
m_timestamp(timestamp),
m_keys(keys)
{}
/*!
This function compares two keys with respect to the order in which they
were added to the container. For this, the mapping keys is used.
*/
bool operator()(const Key& lhs, const Key& rhs) const
{
// look up timestamps for both keys
const auto timestamp_lhs = m_keys->find(lhs);
const auto timestamp_rhs = m_keys->find(rhs);
if (timestamp_lhs == m_keys->end())
{
// timestamp for lhs not found - cannot be smaller than for rhs
return false;
}
if (timestamp_rhs == m_keys->end())
{
// timestamp for rhs not found - timestamp for lhs is smaller
return true;
}
// compare timestamps
return timestamp_lhs->second < timestamp_rhs->second;
}
void add_key(const Key& key)
{
m_keys->insert({key, m_timestamp++});
}
void remove_key(const Key& key)
{
m_keys->erase(key);
}
private:
/// helper to access m_timestamp from fifo_map copy ctor,
/// must have same number of template args as fifo_map
template <
class MapKey,
class MapT,
class MapCompare,
class MapAllocator
> friend class fifo_map;
private:
/// the next valid insertion timestamp
std::size_t m_timestamp = 1;
/// pointer to a mapping from keys to insertion timestamps
std::unordered_map<Key, std::size_t>* m_keys = nullptr;
};
template <
class Key,
class T,
class Compare = fifo_map_compare<Key>,
class Allocator = std::allocator<std::pair<const Key, T>>
> class fifo_map
{
public:
using key_type = Key;
using mapped_type = T;
using value_type = std::pair<const Key, T>;
using size_type = std::size_t;
using difference_type = std::ptrdiff_t;
using key_compare = Compare;
using allocator_type = Allocator;
using reference = value_type&;
using const_reference = const value_type&;
using pointer = typename std::allocator_traits<Allocator>::pointer;
using const_pointer = typename std::allocator_traits<Allocator>::const_pointer;
using internal_map_type = std::map<Key, T, Compare, Allocator>;
using iterator = typename internal_map_type::iterator;
using const_iterator = typename internal_map_type::const_iterator;
using reverse_iterator = typename internal_map_type::reverse_iterator;
using const_reverse_iterator = typename internal_map_type::const_reverse_iterator;
public:
/// default constructor
fifo_map() : m_keys(), m_compare(&m_keys), m_map(m_compare) {}
/// copy constructor
fifo_map(const fifo_map &f) : m_keys(f.m_keys), m_compare(&m_keys, f.m_compare.m_timestamp), m_map(f.m_map.begin(), f.m_map.end(), m_compare) {}
/// constructor for a range of elements
template<class InputIterator>
fifo_map(InputIterator first, InputIterator last)
: m_keys(), m_compare(&m_keys), m_map(m_compare)
{
for (auto it = first; it != last; ++it)
{
insert(*it);
}
}
/// constructor for a list of elements
fifo_map(std::initializer_list<value_type> init) : fifo_map()
{
for (auto x : init)
{
insert(x);
}
}
/*
* Element access
*/
/// access specified element with bounds checking
T& at(const Key& key)
{
return m_map.at(key);
}
/// access specified element with bounds checking
const T& at(const Key& key) const
{
return m_map.at(key);
}
/// access specified element
T& operator[](const Key& key)
{
m_compare.add_key(key);
return m_map[key];
}
/// access specified element
T& operator[](Key&& key)
{
m_compare.add_key(key);
return m_map[key];
}
/*
* Iterators
*/
/// returns an iterator to the beginning
iterator begin() noexcept
{
return m_map.begin();
}
/// returns an iterator to the end
iterator end() noexcept
{
return m_map.end();
}
/// returns an iterator to the beginning
const_iterator begin() const noexcept
{
return m_map.begin();
}
/// returns an iterator to the end
const_iterator end() const noexcept
{
return m_map.end();
}
/// returns an iterator to the beginning
const_iterator cbegin() const noexcept
{
return m_map.cbegin();
}
/// returns an iterator to the end
const_iterator cend() const noexcept
{
return m_map.cend();
}
/// returns a reverse iterator to the beginning
reverse_iterator rbegin() noexcept
{
return m_map.rbegin();
}
/// returns a reverse iterator to the end
reverse_iterator rend() noexcept
{
return m_map.rend();
}
/// returns a reverse iterator to the beginning
const_reverse_iterator rbegin() const noexcept
{
return m_map.rbegin();
}
/// returns a reverse iterator to the end
const_reverse_iterator rend() const noexcept
{
return m_map.rend();
}
/// returns a reverse iterator to the beginning
const_reverse_iterator crbegin() const noexcept
{
return m_map.crbegin();
}
/// returns a reverse iterator to the end
const_reverse_iterator crend() const noexcept
{
return m_map.crend();
}
/*
* Capacity
*/
/// checks whether the container is empty
bool empty() const noexcept
{
return m_map.empty();
}
/// returns the number of elements
size_type size() const noexcept
{
return m_map.size();
}
/// returns the maximum possible number of elements
size_type max_size() const noexcept
{
return m_map.max_size();
}
/*
* Modifiers
*/
/// clears the contents
void clear() noexcept
{
m_map.clear();
m_keys.clear();
}
/// insert value
std::pair<iterator, bool> insert(const value_type& value)
{
m_compare.add_key(value.first);
return m_map.insert(value);
}
/// insert value
template<class P>
std::pair<iterator, bool> insert( P&& value )
{
m_compare.add_key(value.first);
return m_map.insert(value);
}
/// insert value with hint
iterator insert(const_iterator hint, const value_type& value)
{
m_compare.add_key(value.first);
return m_map.insert(hint, value);
}
/// insert value with hint
iterator insert(const_iterator hint, value_type&& value)
{
m_compare.add_key(value.first);
return m_map.insert(hint, value);
}
/// insert value range
template<class InputIt>
void insert(InputIt first, InputIt last)
{
for (const_iterator it = first; it != last; ++it)
{
m_compare.add_key(it->first);
}
m_map.insert(first, last);
}
/// insert value list
void insert(std::initializer_list<value_type> ilist)
{
for (auto value : ilist)
{
m_compare.add_key(value.first);
}
m_map.insert(ilist);
}
/// constructs element in-place
template<class... Args>
std::pair<iterator, bool> emplace(Args&& ... args)
{
typename fifo_map::value_type value(std::forward<Args>(args)...);
m_compare.add_key(value.first);
return m_map.emplace(std::move(value));
}
/// constructs element in-place with hint
template<class... Args>
iterator emplace_hint(const_iterator hint, Args&& ... args)
{
typename fifo_map::value_type value(std::forward<Args>(args)...);
m_compare.add_key(value.first);
return m_map.emplace_hint(hint, std::move(value));
}
/// remove element at position
iterator erase(const_iterator pos)
{
m_compare.remove_key(pos->first);
return m_map.erase(pos);
}
/// remove elements in range
iterator erase(const_iterator first, const_iterator last)
{
for (const_iterator it = first; it != last; ++it)
{
m_compare.remove_key(it->first);
}
return m_map.erase(first, last);
}
/// remove elements with key
size_type erase(const key_type& key)
{
size_type res = m_map.erase(key);
if (res > 0)
{
m_compare.remove_key(key);
}
return res;
}
/// swaps the contents
void swap(fifo_map& other)
{
std::swap(m_map, other.m_map);
std::swap(m_compare, other.m_compare);
std::swap(m_keys, other.m_keys);
}
/*
* Lookup
*/
/// returns the number of elements matching specific key
size_type count(const Key& key) const
{
return m_map.count(key);
}
/// finds element with specific key
iterator find(const Key& key)
{
return m_map.find(key);
}
/// finds element with specific key
const_iterator find(const Key& key) const
{
return m_map.find(key);
}
/// returns range of elements matching a specific key
std::pair<iterator, iterator> equal_range(const Key& key)
{
return m_map.equal_range(key);
}
/// returns range of elements matching a specific key
std::pair<const_iterator, const_iterator> equal_range(const Key& key) const
{
return m_map.equal_range(key);
}
/// returns an iterator to the first element not less than the given key
iterator lower_bound(const Key& key)
{
return m_map.lower_bound(key);
}
/// returns an iterator to the first element not less than the given key
const_iterator lower_bound(const Key& key) const
{
return m_map.lower_bound(key);
}
/// returns an iterator to the first element greater than the given key
iterator upper_bound(const Key& key)
{
return m_map.upper_bound(key);
}
/// returns an iterator to the first element greater than the given key
const_iterator upper_bound(const Key& key) const
{
return m_map.upper_bound(key);
}
/*
* Observers
*/
/// returns the function that compares keys
key_compare key_comp() const
{
return m_compare;
}
/*
* Non-member functions
*/
friend bool operator==(const fifo_map& lhs, const fifo_map& rhs)
{
return lhs.m_map == rhs.m_map;
}
friend bool operator!=(const fifo_map& lhs, const fifo_map& rhs)
{
return lhs.m_map != rhs.m_map;
}
friend bool operator<(const fifo_map& lhs, const fifo_map& rhs)
{
return lhs.m_map < rhs.m_map;
}
friend bool operator<=(const fifo_map& lhs, const fifo_map& rhs)
{
return lhs.m_map <= rhs.m_map;
}
friend bool operator>(const fifo_map& lhs, const fifo_map& rhs)
{
return lhs.m_map > rhs.m_map;
}
friend bool operator>=(const fifo_map& lhs, const fifo_map& rhs)
{
return lhs.m_map >= rhs.m_map;
}
private:
/// the keys
std::unordered_map<Key, std::size_t> m_keys;
/// the comparison object
Compare m_compare;
/// the internal data structure
internal_map_type m_map;
};
}
// specialization of std::swap
namespace std
{
template <class Key, class T, class Compare, class Allocator>
inline void swap(nlohmann::fifo_map<Key, T, Compare, Allocator>& m1,
nlohmann::fifo_map<Key, T, Compare, Allocator>& m2)
{
m1.swap(m2);
}
}
#endif | 15,056 | C | .h | 451 | 23.81153 | 152 | 0.559132 | autobleem/AutoBleem | 499 | 72 | 111 | GPL-3.0 | 9/7/2024, 9:41:26 AM (Europe/Amsterdam) | false | false | true | true | false | true | false | false |
806,991 | demo2.c | DIVGAMES_DIV-Games-Studio/dll/demo2.c | #include <math.h>
#include <stdio.h>
#define GLOBALS
#include "div.h"
// Importante: Para cada funci¢n se debe indicar el retval(int), y hacer
// siempre un getparm() por cada par metro de llamada (el retval() es
// imprescindible incluso si la funci¢n no necesita devolver un valor).
void addsqrt() { // Funci¢n tonta, que devuelve la raiz cuadrada de una suma
int a=getparm();
int b=getparm();
int c=sqrt(a+b);
retval(c);
}
void __export divlibrary(LIBRARY_PARAMS) {
COM_export("ADDSQRT",addsqrt,2); // Se indica el nombre que tendr la funci¢n
// en el lenguaje, el puntero a la misma y
// el n£mero de par metros que tiene.
}
void __export divmain(COMMON_PARAMS) {
GLOBAL_IMPORT();
}
| 778 | C | .c | 21 | 31.761905 | 79 | 0.654206 | DIVGAMES/DIV-Games-Studio | 235 | 30 | 16 | GPL-3.0 | 9/7/2024, 9:42:46 AM (Europe/Amsterdam) | false | false | false | true | false | false | false | false |
807,000 | demo1.c | DIVGAMES_DIV-Games-Studio/dll/demo1.c | #include <stdio.h>
#define GLOBALS
#include "div.h"
// Los posibles puntos de ruptura se ven en DIV.H (Buscar Entry-Points)
void post_process_buffer(void) {
// Ejemplo de un punto de ruptura, DIV llamar a esta funci¢n para que
// pueda operar sobre el buffer de v¡deo antes de cada volcado.
}
void __export divmain(COMMON_PARAMS)
{
AutoLoad();
GLOBAL_IMPORT();
DIV_export("post_process_buffer",post_process_buffer);
}
void __export divend(COMMON_PARAMS){}
| 475 | C | .c | 15 | 29.466667 | 72 | 0.743363 | DIVGAMES/DIV-Games-Studio | 235 | 30 | 16 | GPL-3.0 | 9/7/2024, 9:42:46 AM (Europe/Amsterdam) | false | false | false | true | false | false | false | false |
1,201,388 | 175.c | libretro_libretro-fceumm/src/boards/175.c | /* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "mapinc.h"
static uint8 reg, delay, mirr;
static SFORMAT StateRegs[] =
{
{ ®, 1, "REG" },
{ &mirr, 1, "MIRR" },
{ 0 }
};
static void Sync(void) {
setchr8(reg);
if (!delay) {
setprg16(0x8000, reg);
setprg8(0xC000, reg << 1);
}
setprg8(0xE000, (reg << 1) + 1);
setmirror(((mirr & 4) >> 2) ^ 1);
}
static DECLFW(M175Write1) {
mirr = V;
delay = 1;
Sync();
}
static DECLFW(M175Write2) {
reg = V & 0x0F;
delay = 1;
Sync();
}
static DECLFR(M175Read) {
if (A == 0xFFFC) {
delay = 0;
Sync();
}
return CartBR(A);
}
static void M175Power(void) {
reg = mirr = delay = 0;
SetReadHandler(0x8000, 0xFFFF, M175Read);
SetWriteHandler(0x8000, 0x8000, M175Write1);
SetWriteHandler(0xA000, 0xA000, M175Write2);
Sync();
}
static void StateRestore(int version) {
Sync();
}
void Mapper175_Init(CartInfo *info) {
info->Power = M175Power;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
| 1,769 | C | .c | 68 | 24.088235 | 81 | 0.712426 | libretro/libretro-fceumm | 125 | 113 | 40 | GPL-2.0 | 9/7/2024, 9:44:01 AM (Europe/Amsterdam) | true | true | false | true | true | true | false | false |
1,201,406 | 183.c | libretro_libretro-fceumm/src/boards/183.c | /* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2005 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Gimmick Bootleg (VRC4 mapper)
*/
#include "mapinc.h"
static uint8 prg[4], chr[8], mirr;
static uint8 IRQCount;
static uint8 IRQPre;
static uint8 IRQa;
static SFORMAT StateRegs[] =
{
{ prg, 4, "PRG" },
{ chr, 8, "CHR" },
{ &mirr, 1, "MIRR" },
{ &IRQCount, 1, "IRQC" },
{ &IRQPre, 1, "IRQP" },
{ &IRQa, 1, "IRQA" },
{ 0 }
};
static void SyncPrg(void) {
setprg8(0x6000, prg[3]);
setprg8(0x8000, prg[0]);
setprg8(0xA000, prg[1]);
setprg8(0xC000, prg[2]);
setprg8(0xE000, ~0);
}
static void SyncMirr(void) {
switch (mirr) {
case 0: setmirror(MI_V); break;
case 1: setmirror(MI_H); break;
case 2: setmirror(MI_0); break;
case 3: setmirror(MI_1); break;
}
}
static void SyncChr(void) {
int i;
for (i = 0; i < 8; i++)
setchr1(i << 10, chr[i]);
}
static void StateRestore(int version) {
SyncPrg();
SyncChr();
SyncMirr();
}
static DECLFW(M183Write) {
if ((A & 0xF800) == 0x6800) {
prg[3] = A & 0x3F;
SyncPrg();
} else if (((A & 0xF80C) >= 0xB000) && ((A & 0xF80C) <= 0xE00C)) {
int index = (((A >> 11) - 6) | (A >> 3)) & 7;
chr[index] = (chr[index] & (0xF0 >> (A & 4))) | ((V & 0x0F) << (A & 4));
SyncChr();
} else switch (A & 0xF80C) {
case 0x8800: prg[0] = V; SyncPrg(); break;
case 0xA800: prg[1] = V; SyncPrg(); break;
case 0xA000: prg[2] = V; SyncPrg(); break;
case 0x9800: mirr = V & 3; SyncMirr(); break;
case 0xF000: IRQCount = ((IRQCount & 0xF0) | (V & 0xF)); break;
case 0xF004: IRQCount = ((IRQCount & 0x0F) | ((V & 0xF) << 4)); break;
case 0xF008: IRQa = V; if (!V) IRQPre = 0; X6502_IRQEnd(FCEU_IQEXT); break;
case 0xF00C: IRQPre = 16; break;
}
}
static void M183IRQCounter(void) {
if (IRQa) {
IRQCount++;
if ((IRQCount - IRQPre) == 238)
X6502_IRQBegin(FCEU_IQEXT);
}
}
static void M183Power(void) {
IRQPre = IRQCount = IRQa = 0;
SetReadHandler(0x6000, 0xFFFF, CartBR);
SetWriteHandler(0x6000, 0xFFFF, M183Write);
SyncPrg();
SyncChr();
}
void Mapper183_Init(CartInfo *info) {
info->Power = M183Power;
GameHBIRQHook = M183IRQCounter;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
| 2,922 | C | .c | 100 | 27.17 | 81 | 0.667022 | libretro/libretro-fceumm | 125 | 113 | 40 | GPL-2.0 | 9/7/2024, 9:44:01 AM (Europe/Amsterdam) | true | true | false | true | true | true | false | false |
1,201,409 | 151.c | libretro_libretro-fceumm/src/boards/151.c | /* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2012 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "mapinc.h"
static uint8 regs[8];
static SFORMAT StateRegs[] =
{
{ regs, 8, "REGS" },
{ 0 }
};
static void Sync(void) {
setprg8(0x8000, regs[0]);
setprg8(0xA000, regs[2]);
setprg8(0xC000, regs[4]);
setprg8(0xE000, ~0);
setchr4(0x0000, regs[6]);
setchr4(0x1000, regs[7]);
}
static DECLFW(M151Write) {
regs[(A >> 12) & 7] = V;
Sync();
}
static void M151Power(void) {
Sync();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xFFFF, M151Write);
}
static void StateRestore(int version) {
Sync();
}
void Mapper151_Init(CartInfo *info) {
info->Power = M151Power;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
| 1,503 | C | .c | 51 | 27.627451 | 81 | 0.734765 | libretro/libretro-fceumm | 125 | 113 | 40 | GPL-2.0 | 9/7/2024, 9:44:01 AM (Europe/Amsterdam) | false | true | false | true | false | true | false | false |
1,201,412 | 228.c | libretro_libretro-fceumm/src/boards/228.c | /* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2012 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "mapinc.h"
static uint8 mram[4], vreg;
static uint16 areg;
static SFORMAT StateRegs[] =
{
{ mram, 4, "MRAM" },
{ &areg, 2, "AREG" },
{ &vreg, 1, "VREG" },
{ 0 }
};
static void Sync(void) {
uint32 prgl, prgh, page = (areg >> 7) & 0x3F;
if ((page & 0x30) == 0x30)
page -= 0x10;
prgl = prgh = (page << 1) + (((areg >> 6) & 1) & ((areg >> 5) & 1));
prgh += ((areg >> 5) & 1) ^ 1;
setmirror(((areg >> 13) & 1) ^ 1);
setprg16(0x8000, prgl);
setprg16(0xc000, prgh);
setchr8(((vreg & 0x3) | ((areg & 0xF) << 2)));
}
static DECLFW(M228RamWrite) {
mram[A & 3] = V & 0x0F;
}
static DECLFR(M228RamRead) {
return mram[A & 3];
}
static DECLFW(M228Write) {
areg = A;
vreg = V;
Sync();
}
static void M228Reset(void) {
areg = 0x8000;
vreg = 0;
memset(mram, 0, sizeof(mram));
Sync();
}
static void M228Power(void) {
M228Reset();
SetReadHandler(0x5000, 0x5FFF, M228RamRead);
SetWriteHandler(0x5000, 0x5FFF, M228RamWrite);
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xFFFF, M228Write);
}
static void StateRestore(int version) {
Sync();
}
void Mapper228_Init(CartInfo *info) {
info->Reset = M228Reset;
info->Power = M228Power;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
| 2,079 | C | .c | 73 | 26.616438 | 81 | 0.696088 | libretro/libretro-fceumm | 125 | 113 | 40 | GPL-2.0 | 9/7/2024, 9:44:01 AM (Europe/Amsterdam) | true | true | false | true | true | true | false | false |
1,201,415 | t-262.c | libretro_libretro-fceumm/src/boards/t-262.c | /* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2006 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "mapinc.h"
static uint8 bank, base, lock, mirr, mode;
static SFORMAT StateRegs[] =
{
{ &bank, 1, "BANK" },
{ &base, 1, "BASE" },
{ &lock, 1, "LOCK" },
{ &mirr, 1, "MIRR" },
{ &mode, 1, "MODE" },
{ 0 }
};
static void Sync(void) {
setchr8(0);
setprg16(0x8000, base | bank);
setprg16(0xC000, base | (mode ? bank : 7));
setmirror(mirr);
}
static DECLFW(BMCT262Write) {
if (!lock) {
base = ((A & 0x60) >> 2) | ((A & 0x100) >> 3);
mode = A & 0x80;
mirr = ((A & 2) >> 1) ^ 1;
lock = (A & 0x2000) >> 13;
}
bank = V & 7;
Sync();
}
static void BMCT262Power(void) {
lock = bank = base = mode = 0;
Sync();
SetWriteHandler(0x8000, 0xFFFF, BMCT262Write);
SetReadHandler(0x8000, 0xFFFF, CartBR);
}
static void BMCT262Reset(void) {
lock = bank = base = mode = 0;
Sync();
}
static void BMCT262Restore(int version) {
Sync();
}
void BMCT262_Init(CartInfo *info) {
info->Power = BMCT262Power;
info->Reset = BMCT262Reset;
GameStateRestore = BMCT262Restore;
AddExState(&StateRegs, ~0, 0, 0);
}
| 1,851 | C | .c | 65 | 26.569231 | 81 | 0.690101 | libretro/libretro-fceumm | 125 | 113 | 40 | GPL-2.0 | 9/7/2024, 9:44:01 AM (Europe/Amsterdam) | false | true | false | true | false | true | false | false |
1,201,430 | 244.c | libretro_libretro-fceumm/src/boards/244.c | /* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2012 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "mapinc.h"
static uint8 preg, creg;
static SFORMAT StateRegs[] =
{
{ &preg, 1, "PREG" },
{ &creg, 1, "CREG" },
{ 0 }
};
static uint8 prg_perm[4][4] = {
{ 0, 1, 2, 3, },
{ 3, 2, 1, 0, },
{ 0, 2, 1, 3, },
{ 3, 1, 2, 0, },
};
static uint8 chr_perm[8][8] = {
{ 0, 1, 2, 3, 4, 5, 6, 7, },
{ 0, 2, 1, 3, 4, 6, 5, 7, },
{ 0, 1, 4, 5, 2, 3, 6, 7, },
{ 0, 4, 1, 5, 2, 6, 3, 7, },
{ 0, 4, 2, 6, 1, 5, 3, 7, },
{ 0, 2, 4, 6, 1, 3, 5, 7, },
{ 7, 6, 5, 4, 3, 2, 1, 0, },
{ 7, 6, 5, 4, 3, 2, 1, 0, },
};
static void Sync(void) {
setprg32(0x8000, preg);
setchr8(creg);
}
static DECLFW(M244Write) {
if (V & 8)
creg = chr_perm[(V >> 4) & 7][V & 7];
else
preg = prg_perm[(V >> 4) & 3][V & 3];
Sync();
}
static void M244Power(void) {
preg = creg = 0;
Sync();
SetWriteHandler(0x8000, 0xFFFF, M244Write);
SetReadHandler(0x8000, 0xFFFF, CartBR);
}
static void StateRestore(int version) {
Sync();
}
void Mapper244_Init(CartInfo *info) {
info->Power = M244Power;
AddExState(&StateRegs, ~0, 0, 0);
GameStateRestore = StateRestore;
}
| 1,887 | C | .c | 68 | 25.882353 | 81 | 0.639779 | libretro/libretro-fceumm | 125 | 113 | 40 | GPL-2.0 | 9/7/2024, 9:44:01 AM (Europe/Amsterdam) | false | true | false | true | false | true | false | false |
1,201,437 | karaoke.c | libretro_libretro-fceumm/src/boards/karaoke.c | /* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "mapinc.h"
extern uint32 ROM_size;
static uint8 latche;
static void Sync(void) {
if (latche) {
if (latche & 0x10)
setprg16(0x8000, (latche & 7));
else
setprg16(0x8000, (latche & 7) | 8);
} else
setprg16(0x8000, 7 + (ROM_size >> 4));
}
static DECLFW(M188Write) {
latche = V;
Sync();
}
static DECLFR(ExtDev) {
return(3);
}
static void Power(void) {
latche = 0;
Sync();
setchr8(0);
setprg16(0xc000, 0x7);
SetReadHandler(0x6000, 0x7FFF, ExtDev);
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xFFFF, M188Write);
}
static void StateRestore(int version) {
Sync();
}
void Mapper188_Init(CartInfo *info) {
info->Power = Power;
GameStateRestore = StateRestore;
AddExState(&latche, 1, 0, "LATC");
}
| 1,583 | C | .c | 55 | 26.8 | 81 | 0.736842 | libretro/libretro-fceumm | 125 | 113 | 40 | GPL-2.0 | 9/7/2024, 9:44:01 AM (Europe/Amsterdam) | true | true | false | true | true | true | false | false |
1,201,462 | 234.c | libretro_libretro-fceumm/src/boards/234.c | /* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2012 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "mapinc.h"
static uint8 bank, preg;
static SFORMAT StateRegs[] =
{
{ &bank, 1, "BANK" },
{ &preg, 1, "PREG" },
{ 0 }
};
static void Sync(void) {
if (bank & 0x40) {
setprg32(0x8000, (bank & 0xE) | (preg & 1));
setchr8(((bank & 0xE) << 2) | ((preg >> 4) & 7));
} else {
setprg32(0x8000, bank & 0xF);
setchr8(((bank & 0xF) << 2) | ((preg >> 4) & 3));
}
setmirror((bank >> 7) ^ 1);
}
DECLFR(M234ReadBank) {
uint8 r = CartBR(A);
if (!bank) {
bank = r;
Sync();
}
return r;
}
DECLFR(M234ReadPreg) {
uint8 r = CartBR(A);
preg = r;
Sync();
return r;
}
static void M234Reset(void) {
bank = preg = 0;
Sync();
}
static void M234Power(void) {
M234Reset();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetReadHandler(0xFF80, 0xFF9F, M234ReadBank);
SetReadHandler(0xFFE8, 0xFFF7, M234ReadPreg);
}
static void StateRestore(int version) {
Sync();
}
void Mapper234_Init(CartInfo *info) {
info->Power = M234Power;
info->Reset = M234Reset;
AddExState(&StateRegs, ~0, 0, 0);
GameStateRestore = StateRestore;
}
| 1,869 | C | .c | 70 | 24.771429 | 81 | 0.699441 | libretro/libretro-fceumm | 125 | 113 | 40 | GPL-2.0 | 9/7/2024, 9:44:01 AM (Europe/Amsterdam) | true | true | false | true | true | true | false | false |
1,201,467 | 41.c | libretro_libretro-fceumm/src/boards/41.c | /* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2012 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "mapinc.h"
static uint8 mainreg, chrreg, mirror;
static SFORMAT StateRegs[] =
{
{ &mainreg, 1, "MREG" },
{ &chrreg, 1, "CREG" },
{ &mirror, 1, "MIRR" },
{ 0 }
};
static void Sync(void) {
setprg32(0x8000, mainreg & 7);
setchr8(chrreg);
setmirror(mirror);
}
static DECLFW(M41Write0) {
mainreg = A & 0xFF;
mirror = ((A >> 5) & 1) ^ 1;
chrreg = (chrreg & 3) | ((A >> 1) & 0xC);
Sync();
}
static DECLFW(M41Write1) {
if (mainreg & 0x4) {
chrreg = (chrreg & 0xC) | (A & 3);
Sync();
}
}
static void M41Power(void) {
mainreg = chrreg = 0;
Sync();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x6000, 0x67FF, M41Write0);
SetWriteHandler(0x8000, 0xFFFF, M41Write1);
}
static void StateRestore(int version) {
Sync();
}
void Mapper41_Init(CartInfo *info) {
info->Power = M41Power;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
| 1,721 | C | .c | 60 | 26.8 | 81 | 0.713075 | libretro/libretro-fceumm | 125 | 113 | 40 | GPL-2.0 | 9/7/2024, 9:44:01 AM (Europe/Amsterdam) | false | false | false | true | false | false | false | false |
1,201,469 | novel.c | libretro_libretro-fceumm/src/boards/novel.c | /* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2002 Xodnizel
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "mapinc.h"
static uint8 latch;
static void DoNovel(void) {
setprg32(0x8000, latch & 3);
setchr8(latch & 7);
}
static DECLFW(NovelWrite) {
latch = A & 0xFF;
DoNovel();
}
static void NovelReset(void) {
SetWriteHandler(0x8000, 0xFFFF, NovelWrite);
SetReadHandler(0x8000, 0xFFFF, CartBR);
setprg32(0x8000, 0);
setchr8(0);
}
static void NovelRestore(int version) {
DoNovel();
}
void Novel_Init(CartInfo *info) {
AddExState(&latch, 1, 0, "L1");
info->Power = NovelReset;
GameStateRestore = NovelRestore;
}
| 1,359 | C | .c | 43 | 29.744186 | 81 | 0.753247 | libretro/libretro-fceumm | 125 | 113 | 40 | GPL-2.0 | 9/7/2024, 9:44:01 AM (Europe/Amsterdam) | true | false | false | true | true | false | false | false |
1,201,499 | dream.c | libretro_libretro-fceumm/src/boards/dream.c | /* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2005 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "mapinc.h"
static uint8 latche;
static void Sync(void) {
setprg16(0x8000, latche);
setprg16(0xC000, 8);
}
static DECLFW(DREAMWrite) {
latche = V & 7;
Sync();
}
static void DREAMPower(void) {
latche = 0;
Sync();
setchr8(0);
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x5020, 0x5020, DREAMWrite);
}
static void Restore(int version) {
Sync();
}
void DreamTech01_Init(CartInfo *info) {
GameStateRestore = Restore;
info->Power = DREAMPower;
AddExState(&latche, 1, 0, "LATC");
}
| 1,344 | C | .c | 44 | 28.681818 | 81 | 0.750967 | libretro/libretro-fceumm | 125 | 113 | 40 | GPL-2.0 | 9/7/2024, 9:44:01 AM (Europe/Amsterdam) | false | false | false | true | false | false | false | false |
1,201,500 | 46.c | libretro_libretro-fceumm/src/boards/46.c | /* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2012 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "mapinc.h"
static uint8 reg0, reg1;
static SFORMAT StateRegs[] =
{
{ ®0, 1, "REG0" },
{ ®1, 1, "REG1" },
{ 0 }
};
static void Sync(void) {
setprg32(0x8000, (reg1 & 1) + ((reg0 & 0xF) << 1));
setchr8(((reg1 >> 4) & 7) + ((reg0 & 0xF0) >> 1));
}
static DECLFW(M46Write0) {
reg0 = V;
Sync();
}
static DECLFW(M46Write1) {
reg1 = V;
Sync();
}
static void M46Power(void) {
reg0 = reg1 = 0;
Sync();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x6000, 0x7FFF, M46Write0);
SetWriteHandler(0x8000, 0xFFFF, M46Write1);
}
static void M46Reset(void) {
reg0 = reg1 = 0;
Sync();
}
static void StateRestore(int version) {
Sync();
}
void Mapper46_Init(CartInfo *info) {
info->Power = M46Power;
info->Reset = M46Reset;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
| 1,657 | C | .c | 59 | 26.254237 | 81 | 0.716625 | libretro/libretro-fceumm | 125 | 113 | 40 | GPL-2.0 | 9/7/2024, 9:44:01 AM (Europe/Amsterdam) | false | true | false | true | false | true | false | false |
1,201,518 | 230.c | libretro_libretro-fceumm/src/boards/230.c | /* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2005 CaH4e3
* Copyright (C) 2009 qeed
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* 22 + Contra Reset based custom mapper...
*
*/
#include "mapinc.h"
static uint8 latche, reset;
static SFORMAT StateRegs[] =
{
{ &reset, 1, "RST" },
{ &latche, 1, "LATC" },
{ 0 }
};
static void Sync(void) {
if (reset) {
setprg16(0x8000, latche & 7);
setprg16(0xC000, 7);
setmirror(MI_V);
} else {
uint32 bank = (latche & 0x1F) + 8;
if (latche & 0x20) {
setprg16(0x8000, bank);
setprg16(0xC000, bank);
} else
setprg32(0x8000, bank >> 1);
setmirror((latche >> 6) & 1);
}
setchr8(0);
}
static DECLFW(M230Write) {
latche = V;
Sync();
}
static void M230Reset(void) {
reset ^= 1;
Sync();
}
static void M230Power(void) {
latche = reset = 0;
Sync();
SetWriteHandler(0x8000, 0xFFFF, M230Write);
SetReadHandler(0x8000, 0xFFFF, CartBR);
}
static void StateRestore(int version) {
Sync();
}
void Mapper230_Init(CartInfo *info) {
info->Power = M230Power;
info->Reset = M230Reset;
AddExState(&StateRegs, ~0, 0, 0);
GameStateRestore = StateRestore;
}
| 1,845 | C | .c | 70 | 24.314286 | 81 | 0.712507 | libretro/libretro-fceumm | 125 | 113 | 40 | GPL-2.0 | 9/7/2024, 9:44:01 AM (Europe/Amsterdam) | true | true | false | true | true | true | false | false |
1,201,550 | bs-5.c | libretro_libretro-fceumm/src/boards/bs-5.c | /* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2007 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "mapinc.h"
static uint8 reg_prg[4];
static uint8 reg_chr[4];
static uint8 dip_switch;
static SFORMAT StateRegs[] =
{
{ reg_prg, 4, "PREG" },
{ reg_chr, 4, "CREG" },
{ 0 }
};
static void Sync(void) {
setprg8(0x8000, reg_prg[0]);
setprg8(0xa000, reg_prg[1]);
setprg8(0xc000, reg_prg[2]);
setprg8(0xe000, reg_prg[3]);
setchr2(0x0000, reg_chr[0]);
setchr2(0x0800, reg_chr[1]);
setchr2(0x1000, reg_chr[2]);
setchr2(0x1800, reg_chr[3]);
setmirror(MI_V);
}
static DECLFW(MBS5Write) {
int bank_sel = (A & 0xC00) >> 10;
switch (A & 0xF000) {
case 0x8000:
reg_chr[bank_sel] = A & 0x1F;
break;
case 0xA000:
if (A & (1 << (dip_switch + 4)))
reg_prg[bank_sel] = A & 0x0F;
break;
}
Sync();
}
static void MBS5Reset(void) {
dip_switch++;
dip_switch &= 3;
reg_prg[0] = reg_prg[1] = reg_prg[2] = reg_prg[3] = ~0;
Sync();
}
static void MBS5Power(void) {
dip_switch = 0;
reg_prg[0] = reg_prg[1] = reg_prg[2] = reg_prg[3] = ~0;
Sync();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xFFFF, MBS5Write);
}
static void StateRestore(int version) {
Sync();
}
void BMCBS5_Init(CartInfo *info) {
info->Power = MBS5Power;
info->Reset = MBS5Reset;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
| 2,095 | C | .c | 75 | 26 | 81 | 0.702636 | libretro/libretro-fceumm | 125 | 113 | 40 | GPL-2.0 | 9/7/2024, 9:44:01 AM (Europe/Amsterdam) | false | true | false | true | false | true | false | false |
1,201,562 | 62.c | libretro_libretro-fceumm/src/boards/62.c | /* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2012 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "mapinc.h"
static uint8 bank;
static uint16 mode;
static SFORMAT StateRegs[] =
{
{ &bank, 1, "BANK" },
{ &mode, 2, "MODE" },
{ 0 }
};
static void Sync(void) {
setchr8(((mode & 0x1F) << 2) | (bank & 0x03));
if (mode & 0x20) {
setprg16(0x8000, (mode & 0x40) | ((mode >> 8) & 0x3F));
setprg16(0xc000, (mode & 0x40) | ((mode >> 8) & 0x3F));
} else
setprg32(0x8000, ((mode & 0x40) | ((mode >> 8) & 0x3F)) >> 1);
setmirror(((mode >> 7) & 1) ^ 1);
}
static DECLFW(M62Write) {
mode = A & 0x3FFF;
bank = V & 3;
Sync();
}
static void M62Power(void) {
bank = mode = 0;
Sync();
SetWriteHandler(0x8000, 0xFFFF, M62Write);
SetReadHandler(0x8000, 0xFFFF, CartBR);
}
static void M62Reset(void) {
bank = mode = 0;
Sync();
}
static void StateRestore(int version) {
Sync();
}
void Mapper62_Init(CartInfo *info) {
info->Power = M62Power;
info->Reset = M62Reset;
AddExState(&StateRegs, ~0, 0, 0);
GameStateRestore = StateRestore;
}
| 1,784 | C | .c | 61 | 27.377049 | 81 | 0.695627 | libretro/libretro-fceumm | 125 | 113 | 40 | GPL-2.0 | 9/7/2024, 9:44:01 AM (Europe/Amsterdam) | false | true | false | true | false | true | false | false |
1,201,582 | subor.c | libretro_libretro-fceumm/src/boards/subor.c | /* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2005 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "mapinc.h"
static uint8 is167, regs[4];
static SFORMAT StateRegs[] =
{
{ regs, 4, "DREG" },
{ 0 }
};
static void Sync(void) {
int base, bank;
base = ((regs[0] ^ regs[1]) & 0x10) << 1;
bank = (regs[2] ^ regs[3]) & 0x1f;
if (regs[1] & 0x08) {
bank &= 0xFE;
if (is167) {
setprg16(0x8000, base + bank + 1);
setprg16(0xC000, base + bank + 0);
} else {
setprg16(0x8000, base + bank + 0);
setprg16(0xC000, base + bank + 1);
}
} else {
if (regs[1] & 0x04) {
setprg16(0x8000, 0x1F);
setprg16(0xC000, base + bank);
} else {
setprg16(0x8000, base + bank);
if (is167)
setprg16(0xC000, 0x20);
else
setprg16(0xC000, 0x07);
}
}
setchr8(0);
}
static DECLFW(M166Write) {
regs[(A >> 13) & 0x03] = V;
Sync();
}
static void M166Power(void) {
regs[0] = regs[1] = regs[2] = regs[3] = 0;
Sync();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xFFFF, M166Write);
}
static void StateRestore(int version) {
Sync();
}
void Mapper166_Init(CartInfo *info) {
is167 = 0;
info->Power = M166Power;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
void Mapper167_Init(CartInfo *info) {
is167 = 1;
info->Power = M166Power;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
| 2,116 | C | .c | 78 | 24.833333 | 81 | 0.690828 | libretro/libretro-fceumm | 125 | 113 | 40 | GPL-2.0 | 9/7/2024, 9:44:01 AM (Europe/Amsterdam) | false | true | false | true | false | true | false | false |
1,201,584 | 170.c | libretro_libretro-fceumm/src/boards/170.c | /* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2011 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "mapinc.h"
static uint8 reg;
static SFORMAT StateRegs[] =
{
{ ®, 1, "REGS" },
{ 0 }
};
static void Sync(void) {
setprg16(0x8000, 0);
setprg16(0xc000, ~0);
setchr8(0);
}
static DECLFW(M170ProtW) {
reg = V << 1 & 0x80;
}
static DECLFR(M170ProtR) {
return reg | (X.DB & 0x7F);
}
static void M170Power(void) {
Sync();
SetWriteHandler(0x6502, 0x6502, M170ProtW);
SetWriteHandler(0x7000, 0x7000, M170ProtW);
SetReadHandler(0x7001, 0x7001, M170ProtR);
SetReadHandler(0x7777, 0x7777, M170ProtR);
SetReadHandler(0x8000, 0xFFFF, CartBR);
}
static void StateRestore(int version) {
Sync();
}
void Mapper170_Init(CartInfo *info) {
info->Power = M170Power;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
| 1,579 | C | .c | 53 | 27.962264 | 81 | 0.74555 | libretro/libretro-fceumm | 125 | 113 | 40 | GPL-2.0 | 9/7/2024, 9:44:01 AM (Europe/Amsterdam) | true | true | false | true | true | true | false | false |
1,201,596 | 51.c | libretro_libretro-fceumm/src/boards/51.c | /* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2012 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "mapinc.h"
static uint8 bank, mode;
static SFORMAT StateRegs[] =
{
{ &bank, 1, "BANK" },
{ &mode, 1, "MODE" },
{ 0 }
};
static void Sync(void) {
if (mode & 2) {
setprg8(0x6000, ((bank & 7) << 2) | 0x23);
setprg16(0x8000, (bank << 1) | 0);
setprg16(0xC000, (bank << 1) | 1);
} else {
setprg8(0x6000, ((bank & 4) << 2) | 0x2F);
setprg16(0x8000, (bank << 1) | (mode >> 4));
setprg16(0xC000, ((bank & 0xC) << 1) | 7);
}
if (mode == 0x12)
setmirror(MI_H);
else
setmirror(MI_V);
setchr8(0);
}
static DECLFW(M51WriteMode) {
mode = V & 0x12;
Sync();
}
static DECLFW(M51WriteBank) {
bank = V & 0x0F;
if (A & 0x4000)
mode = (mode & 2) | (V & 0x10);
Sync();
}
static void M51Power(void) {
bank = 0;
mode = 2;
Sync();
SetWriteHandler(0x6000, 0x7FFF, M51WriteMode);
SetWriteHandler(0x8000, 0xFFFF, M51WriteBank);
SetReadHandler(0x6000, 0xFFFF, CartBR);
}
static void M51Reset(void) {
bank = 0;
mode = 2;
Sync();
}
static void StateRestore(int version) {
Sync();
}
void Mapper51_Init(CartInfo *info) {
info->Power = M51Power;
info->Reset = M51Reset;
AddExState(&StateRegs, ~0, 0, 0);
GameStateRestore = StateRestore;
}
| 1,998 | C | .c | 75 | 24.666667 | 81 | 0.691745 | libretro/libretro-fceumm | 125 | 113 | 40 | GPL-2.0 | 9/7/2024, 9:44:01 AM (Europe/Amsterdam) | false | true | false | true | false | true | false | false |
1,201,600 | 33.c | libretro_libretro-fceumm/src/boards/33.c | /* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2012 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "mapinc.h"
static uint8 is48;
static uint8 regs[8], mirr;
static uint8 IRQa;
static int16 IRQCount, IRQLatch;
static SFORMAT StateRegs[] =
{
{ regs, 8, "PREG" },
{ &mirr, 1, "MIRR" },
{ &IRQa, 1, "IRQA" },
{ &IRQCount, 2, "IRQC" },
{ &IRQLatch, 2, "IRQL" },
{ 0 }
};
static void Sync(void) {
setmirror(mirr);
setprg8(0x8000, regs[0]);
setprg8(0xA000, regs[1]);
setprg8(0xC000, ~1);
setprg8(0xE000, ~0);
setchr2(0x0000, regs[2]);
setchr2(0x0800, regs[3]);
setchr1(0x1000, regs[4]);
setchr1(0x1400, regs[5]);
setchr1(0x1800, regs[6]);
setchr1(0x1C00, regs[7]);
}
static DECLFW(M33Write) {
A &= 0xF003;
switch (A) {
case 0x8000: regs[0] = V & 0x3F; if (!is48) mirr = ((V >> 6) & 1) ^ 1; Sync(); break;
case 0x8001: regs[1] = V & 0x3F; Sync(); break;
case 0x8002: regs[2] = V; Sync(); break;
case 0x8003: regs[3] = V; Sync(); break;
case 0xA000: regs[4] = V; Sync(); break;
case 0xA001: regs[5] = V; Sync(); break;
case 0xA002: regs[6] = V; Sync(); break;
case 0xA003: regs[7] = V; Sync(); break;
}
}
static DECLFW(M48Write) {
switch (A & 0xF003) {
case 0xC000: IRQLatch = V; break;
case 0xC001: IRQCount = IRQLatch; break;
case 0xC003: IRQa = 0; X6502_IRQEnd(FCEU_IQEXT); break;
case 0xC002: IRQa = 1; break;
case 0xE000: mirr = ((V >> 6) & 1) ^ 1; Sync(); break;
}
}
static void M33Power(void) {
Sync();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xFFFF, M33Write);
}
static void M48Power(void) {
Sync();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xBFFF, M33Write);
SetWriteHandler(0xC000, 0xFFFF, M48Write);
}
static void M48IRQ(void) {
if (IRQa) {
IRQCount++;
if (IRQCount == 0x100) {
X6502_IRQBegin(FCEU_IQEXT);
IRQa = 0;
}
}
}
static void StateRestore(int version) {
Sync();
}
void Mapper33_Init(CartInfo *info) {
is48 = 0;
info->Power = M33Power;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
void Mapper48_Init(CartInfo *info) {
is48 = 1;
info->Power = M48Power;
GameHBIRQHook = M48IRQ;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
| 2,943 | C | .c | 104 | 26.365385 | 86 | 0.696391 | libretro/libretro-fceumm | 125 | 113 | 40 | GPL-2.0 | 9/7/2024, 9:44:01 AM (Europe/Amsterdam) | true | true | false | true | true | true | false | false |
1,201,610 | vrc7p.c | libretro_libretro-fceumm/src/boards/vrc7p.c | /* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2009 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* YOKO Mortal Kombat V Pro, VRC7 pirate clone
*/
#include "mapinc.h"
static uint8 prg[3], chr[8], mirr;
static uint8 IRQLatch, IRQa, IRQd;
static int32 IRQCount, CycleCount;
static SFORMAT StateRegs[] =
{
{ prg, 3, "PRG" },
{ chr, 8, "CHR" },
{ &mirr, 1, "MIRR" },
{ &IRQa, 1, "IRQA" },
{ &IRQd, 1, "IRQD" },
{ &IRQLatch, 1, "IRQL" },
{ &IRQCount, 4, "IRQC" },
{ &CycleCount, 4, "CYCC" },
{ 0 }
};
static void Sync(void) {
uint8 i;
setprg8(0x8000, prg[0]);
setprg8(0xa000, prg[1]);
setprg8(0xc000, prg[2]);
setprg8(0xe000, ~0);
for (i = 0; i < 8; i++)
setchr1(i << 10, chr[i]);
switch (mirr & 3) {
case 0: setmirror(MI_V); break;
case 1: setmirror(MI_H); break;
case 2: setmirror(MI_0); break;
case 3: setmirror(MI_1); break;
}
}
static DECLFW(UNLVRC7Write) {
switch (A & 0xF008) {
case 0x8000: prg[0] = V; Sync(); break;
case 0x8008: prg[1] = V; Sync(); break;
case 0x9000: prg[2] = V; Sync(); break;
case 0xa000: chr[0] = V; Sync(); break;
case 0xa008: chr[1] = V; Sync(); break;
case 0xb000: chr[2] = V; Sync(); break;
case 0xb008: chr[3] = V; Sync(); break;
case 0xc000: chr[4] = V; Sync(); break;
case 0xc008: chr[5] = V; Sync(); break;
case 0xd000: chr[6] = V; Sync(); break;
case 0xd008: chr[7] = V; Sync(); break;
case 0xe000: mirr = V; Sync(); break;
case 0xe008: IRQLatch = V; X6502_IRQEnd(FCEU_IQEXT); break;
case 0xf000:
IRQa = V & 2;
IRQd = V & 1;
if (V & 2)
IRQCount = IRQLatch;
CycleCount = 0;
X6502_IRQEnd(FCEU_IQEXT);
break;
case 0xf008:
if (IRQd)
IRQa = 1;
else
IRQa = 0;
X6502_IRQEnd(FCEU_IQEXT);
break;
}
}
static void UNLVRC7Power(void) {
Sync();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xFFFF, UNLVRC7Write);
}
static void UNLVRC7IRQHook(int a) {
if (IRQa) {
CycleCount += a * 3;
while (CycleCount >= 341) {
CycleCount -= 341;
IRQCount++;
if (IRQCount == 248) {
IRQCount = IRQLatch;
X6502_IRQBegin(FCEU_IQEXT);
}
}
}
}
static void StateRestore(int version) {
Sync();
}
void UNLVRC7_Init(CartInfo *info) {
info->Power = UNLVRC7Power;
MapIRQHook = UNLVRC7IRQHook;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
| 3,021 | C | .c | 111 | 25.009009 | 81 | 0.673906 | libretro/libretro-fceumm | 125 | 113 | 40 | GPL-2.0 | 9/7/2024, 9:44:01 AM (Europe/Amsterdam) | true | true | false | true | true | true | false | false |
1,201,622 | vrc1.c | libretro_libretro-fceumm/src/boards/vrc1.c | /* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2012 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* VRC-1
*
*/
#include "mapinc.h"
static uint8 preg[3], creg[2], mode;
static SFORMAT StateRegs[] =
{
{ &mode, 1, "MODE" },
{ creg, 2, "CREG" },
{ preg, 3, "PREG" },
{ 0 }
};
static void Sync(void) {
setprg8(0x8000, preg[0]);
setprg8(0xA000, preg[1]);
setprg8(0xC000, preg[2]);
setprg8(0xE000, ~0);
setchr4(0x0000, creg[0] | ((mode & 2) << 3));
setchr4(0x1000, creg[1] | ((mode & 4) << 2));
setmirror((mode & 1) ^ 1);
}
static DECLFW(M75Write) {
switch (A & 0xF000) {
case 0x8000: preg[0] = V; Sync(); break;
case 0x9000: mode = V; Sync(); break;
case 0xA000: preg[1] = V; Sync(); break;
case 0xC000: preg[2] = V; Sync(); break;
case 0xE000: creg[0] = V & 0xF; Sync(); break;
case 0xF000: creg[1] = V & 0xF; Sync(); break;
}
}
static void M75Power(void) {
Sync();
SetWriteHandler(0x8000, 0xFFFF, M75Write);
SetReadHandler(0x8000, 0xFFFF, CartBR);
}
static void StateRestore(int version) {
Sync();
}
void Mapper75_Init(CartInfo *info) {
info->Power = M75Power;
AddExState(&StateRegs, ~0, 0, 0);
GameStateRestore = StateRestore;
}
| 1,892 | C | .c | 63 | 28.174603 | 81 | 0.696487 | libretro/libretro-fceumm | 125 | 113 | 40 | GPL-2.0 | 9/7/2024, 9:44:01 AM (Europe/Amsterdam) | true | true | false | true | true | true | false | false |
1,201,624 | 88.c | libretro_libretro-fceumm/src/boards/88.c | /* FCE Ultra - NES/Famicom Emulator
*
* Copyright notice for this file:
* Copyright (C) 2005 CaH4e3
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "mapinc.h"
static uint8 reg[8];
static uint8 mirror, cmd, is154;
static SFORMAT StateRegs[] =
{
{ &cmd, 1, "CMD" },
{ &mirror, 1, "MIRR" },
{ reg, 8, "REGS" },
{ 0 }
};
static void Sync(void) {
setchr2(0x0000, reg[0] >> 1);
setchr2(0x0800, reg[1] >> 1);
setchr1(0x1000, reg[2] | 0x40);
setchr1(0x1400, reg[3] | 0x40);
setchr1(0x1800, reg[4] | 0x40);
setchr1(0x1C00, reg[5] | 0x40);
setprg8(0x8000, reg[6]);
setprg8(0xA000, reg[7]);
setprg8(0xC000, ~1);
setprg8(0xE000, ~0);
}
static void MSync(void) {
if (is154) setmirror(MI_0 + (mirror & 1));
}
static DECLFW(M88Write) {
switch (A & 0x8001) {
case 0x8000: cmd = V & 7; mirror = V >> 6; MSync(); break;
case 0x8001: reg[cmd] = V; Sync(); break;
}
}
static void M88Power(void) {
reg[0] = reg[1] = reg[2] = reg[3] = reg[4] = reg[5] = reg[6] = reg[7] = 0;
Sync();
MSync();
SetReadHandler(0x8000, 0xFFFF, CartBR);
SetWriteHandler(0x8000, 0xFFFF, M88Write);
}
static void StateRestore(int version) {
Sync();
MSync();
}
void Mapper88_Init(CartInfo *info) {
is154 = 0;
info->Power = M88Power;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
void Mapper154_Init(CartInfo *info) {
is154 = 1;
info->Power = M88Power;
GameStateRestore = StateRestore;
AddExState(&StateRegs, ~0, 0, 0);
}
| 2,130 | C | .c | 73 | 27.328767 | 81 | 0.698583 | libretro/libretro-fceumm | 125 | 113 | 40 | GPL-2.0 | 9/7/2024, 9:44:01 AM (Europe/Amsterdam) | false | true | false | true | false | true | false | false |
1,292,859 | blittable.c | libretro_libretro-uae/sources/src/blittable.c | #include "sysconfig.h"
#include "sysdeps.h"
#include "options.h"
#include "custom.h"
#include "memory.h"
#include "blitter.h"
#include "blitfunc.h"
blitter_func * const blitfunc_dofast[256] = {
blitdofast_0, 0, 0, 0, 0, 0, 0, 0,
0, 0, blitdofast_a, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, blitdofast_2a, 0, 0, 0, 0, 0,
blitdofast_30, 0, 0, 0, 0, 0, 0, 0,
0, 0, blitdofast_3a, 0, blitdofast_3c, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, blitdofast_4a, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, blitdofast_6a, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, blitdofast_8a, 0, blitdofast_8c, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, blitdofast_9a, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
blitdofast_a8, 0, blitdofast_aa, 0, 0, 0, 0, 0,
0, blitdofast_b1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, blitdofast_ca, 0, blitdofast_cc, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
blitdofast_d8, 0, 0, 0, 0, 0, 0, 0,
0, 0, blitdofast_e2, 0, 0, 0, 0, 0,
0, 0, blitdofast_ea, 0, 0, 0, 0, 0,
blitdofast_f0, 0, 0, 0, 0, 0, 0, 0,
0, 0, blitdofast_fa, 0, blitdofast_fc, 0, 0, 0
};
blitter_func * const blitfunc_dofast_desc[256] = {
blitdofast_desc_0, 0, 0, 0, 0, 0, 0, 0,
0, 0, blitdofast_desc_a, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, blitdofast_desc_2a, 0, 0, 0, 0, 0,
blitdofast_desc_30, 0, 0, 0, 0, 0, 0, 0,
0, 0, blitdofast_desc_3a, 0, blitdofast_desc_3c, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, blitdofast_desc_4a, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, blitdofast_desc_6a, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, blitdofast_desc_8a, 0, blitdofast_desc_8c, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, blitdofast_desc_9a, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
blitdofast_desc_a8, 0, blitdofast_desc_aa, 0, 0, 0, 0, 0,
0, blitdofast_desc_b1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, blitdofast_desc_ca, 0, blitdofast_desc_cc, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
blitdofast_desc_d8, 0, 0, 0, 0, 0, 0, 0,
0, 0, blitdofast_desc_e2, 0, 0, 0, 0, 0,
0, 0, blitdofast_desc_ea, 0, 0, 0, 0, 0,
blitdofast_desc_f0, 0, 0, 0, 0, 0, 0, 0,
0, 0, blitdofast_desc_fa, 0, blitdofast_desc_fc, 0, 0, 0
};
| 2,560 | C | .c | 75 | 31.253333 | 59 | 0.506247 | libretro/libretro-uae | 112 | 60 | 28 | GPL-2.0 | 9/7/2024, 9:44:01 AM (Europe/Amsterdam) | false | false | false | true | true | false | false | false |
1,292,891 | def_icons.c | libretro_libretro-uae/sources/src/def_icons.c | unsigned char def_drawer[] = {
0xe3, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x19,
0x00, 0x05, 0x00, 0x03, 0x00, 0x01, 0x10, 0x12, 0x15, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00,
0x00, 0x00, 0x10, 0x25, 0xa6, 0xc8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32,
0x00, 0x32, 0x01, 0x90, 0x00, 0x64, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x02, 0x7f,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x5a, 0x00, 0x28, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x18, 0x00, 0x01,
0x00, 0x06, 0xfc, 0x4c, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xf0, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xf0, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x39, 0xff, 0xff, 0xff, 0xff, 0xff,
0xfe, 0x70, 0x39, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x70, 0x39, 0xff, 0xff, 0xff, 0xff, 0xff,
0xfe, 0x70, 0x39, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x70, 0x39, 0xff, 0xff, 0x9f, 0xe7, 0xff,
0xfe, 0x70, 0x39, 0xff, 0xff, 0x9f, 0xe7, 0xff, 0xfe, 0x70, 0x39, 0xff, 0xff, 0x80, 0x07, 0xff,
0xfe, 0x70, 0x39, 0xff, 0xff, 0x80, 0x07, 0xff, 0xfe, 0x70, 0x39, 0xff, 0xff, 0xff, 0xff, 0xff,
0xfe, 0x70, 0x39, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x70, 0x39, 0xff, 0xff, 0xff, 0xff, 0xff,
0xfe, 0x70, 0x39, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x70, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x70, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xf0, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
unsigned int def_drawer_len = 352;
unsigned char def_tool[] = {
0xe3, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x17,
0x00, 0x04, 0x00, 0x01, 0x00, 0x01, 0x10, 0x12, 0xdc, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x33, 0x00, 0x16, 0x00, 0x02, 0x00, 0x06, 0xe8, 0xf8, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff,
0x80, 0x00, 0x3c, 0x0f, 0xf0, 0x00, 0x1f, 0xff, 0x80, 0x00, 0x3d, 0xf7, 0xcf, 0xff, 0xe3, 0xff,
0x80, 0x00, 0x3d, 0xf8, 0x3f, 0xff, 0xfc, 0x7f, 0x80, 0x00, 0x3d, 0xff, 0xff, 0xff, 0xff, 0x9f,
0x80, 0x00, 0x3d, 0xff, 0xff, 0xff, 0xff, 0xef, 0x80, 0x00, 0x3d, 0xff, 0xff, 0xff, 0xff, 0xf7,
0x80, 0x00, 0x3d, 0xf8, 0x3f, 0xff, 0xe0, 0x07, 0x80, 0x00, 0x3d, 0xf7, 0xdf, 0xff, 0xdf, 0xff,
0x80, 0x00, 0x3c, 0x0f, 0xe7, 0xff, 0x3f, 0xff, 0x80, 0x00, 0x3f, 0xff, 0xf9, 0xfc, 0xff, 0xff,
0x80, 0x00, 0x3f, 0xff, 0xfd, 0xfd, 0xff, 0xff, 0x80, 0x00, 0x3f, 0xff, 0xfd, 0xfd, 0xff, 0xff,
0x80, 0x00, 0x3f, 0xff, 0xfd, 0xfd, 0xff, 0xff, 0x80, 0x00, 0x3f, 0xff, 0xfc, 0x01, 0xff, 0xff,
0x80, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff,
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00
};
unsigned int def_tool_len = 450;
unsigned char def_project[] = {
0xe3, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x00, 0x15,
0x00, 0x04, 0x00, 0x01, 0x00, 0x01, 0x10, 0x14, 0x47, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x31, 0x00, 0x14, 0x00, 0x01, 0x00, 0x03, 0x61, 0x34, 0x01, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff,
0x80, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x80, 0x00, 0x3d, 0xff, 0xff, 0xff, 0xfe, 0xbf,
0x80, 0x00, 0x3d, 0xff, 0xff, 0xff, 0xfe, 0xdf, 0x80, 0x00, 0x3d, 0xff, 0xff, 0xff, 0xfe, 0xef,
0x80, 0x00, 0x3d, 0xff, 0xff, 0xff, 0xfe, 0x07, 0x80, 0x00, 0x3d, 0xff, 0xff, 0xff, 0xff, 0xf7,
0x80, 0x00, 0x3d, 0xff, 0xff, 0xff, 0xff, 0xf7, 0x80, 0x00, 0x3d, 0xff, 0xff, 0xff, 0xff, 0xf7,
0x80, 0x00, 0x3d, 0xff, 0xff, 0xff, 0xff, 0xf7, 0x80, 0x00, 0x3d, 0xff, 0xff, 0xff, 0xff, 0xf7,
0x80, 0x00, 0x3d, 0xff, 0xff, 0xff, 0xff, 0xf7, 0x80, 0x00, 0x3d, 0xff, 0xff, 0xff, 0xff, 0xf7,
0x80, 0x00, 0x3d, 0xff, 0xff, 0xff, 0xff, 0xf7, 0x80, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x07,
0x80, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff,
0x80, 0x00
};
unsigned int def_project_len = 258;
| 6,629 | C | .c | 77 | 84.220779 | 96 | 0.66855 | libretro/libretro-uae | 112 | 60 | 28 | GPL-2.0 | 9/7/2024, 9:44:01 AM (Europe/Amsterdam) | false | false | false | true | false | false | false | false |
1,292,915 | gencpu_mini.c | libretro_libretro-uae/sources/src/gencpu_mini.c | /*
* UAE - The Un*x Amiga Emulator
*
* MC68000 emulation generator
*
* This is a fairly stupid program that generates a lot of case labels that
* can be #included in a switch statement.
* As an alternative, it can generate functions that handle specific
* MC68000 instructions, plus a prototype header file and a function pointer
* array to look up the function for an opcode.
* Error checking is bad, an illegal table68k file will cause the program to
* call abort().
* The generated code is sometimes sub-optimal, an optimizing compiler should
* take care of this.
*
* The source for the insn timings is Markt & Technik's Amiga Magazin 8/1992.
*
* Copyright 1995, 1996, 1997, 1998, 1999, 2000 Bernd Schmidt
*/
#include "sysconfig.h"
#include "sysdeps.h"
#include <ctype.h>
#include "readcpu.h"
#define BOOL_TYPE "int"
static FILE *headerfile;
static FILE *stblfile;
static int using_prefetch;
static int using_exception_3;
static int cpu_level;
/* For the current opcode, the next lower level that will have different code.
* Initialized to -1 for each opcode. If it remains unchanged, indicates we
* are done with that opcode. */
static int next_cpu_level;
static int *opcode_map;
static int *opcode_next_clev;
static int *opcode_last_postfix;
static unsigned long *counts;
static void read_counts (void)
{
FILE *file;
unsigned long opcode, count, total;
char name[20];
int nr = 0;
memset (counts, 0, 65536 * sizeof *counts);
file = fopen ("frequent.68k", "r");
if (file) {
fscanf (file, "Total: %lu\n", &total);
while (fscanf (file, "%lx: %lu %s\n", &opcode, &count, name) == 3) {
opcode_next_clev[nr] = 5;
opcode_last_postfix[nr] = -1;
opcode_map[nr++] = opcode;
counts[opcode] = count;
}
fclose (file);
}
if (nr == nr_cpuop_funcs)
return;
for (opcode = 0; opcode < 0x10000; opcode++) {
if (table68k[opcode].handler == -1 && table68k[opcode].mnemo != i_ILLG
&& counts[opcode] == 0)
{
opcode_next_clev[nr] = 5;
opcode_last_postfix[nr] = -1;
opcode_map[nr++] = opcode;
counts[opcode] = count;
}
}
if (nr != nr_cpuop_funcs)
abort ();
}
static char endlabelstr[80];
static int endlabelno = 0;
static int need_endlabel;
static int n_braces = 0;
static int m68k_pc_offset = 0;
static void start_brace (void)
{
n_braces++;
printf ("{");
}
static void close_brace (void)
{
assert (n_braces > 0);
n_braces--;
printf ("}");
}
static void finish_braces (void)
{
while (n_braces > 0)
close_brace ();
}
static void pop_braces (int to)
{
while (n_braces > to)
close_brace ();
}
static int bit_size (int size)
{
switch (size) {
case sz_byte: return 8;
case sz_word: return 16;
case sz_long: return 32;
default: abort ();
}
return 0;
}
static const char *bit_mask (int size)
{
switch (size) {
case sz_byte: return "0xff";
case sz_word: return "0xffff";
case sz_long: return "0xffffffff";
default: abort ();
}
return 0;
}
static const char *gen_nextilong (void)
{
static char buffer[80];
int r = m68k_pc_offset;
m68k_pc_offset += 4;
sprintf (buffer, "xget_ilong (%d)", r);
return buffer;
}
static const char *gen_nextiword (void)
{
static char buffer[80];
int r = m68k_pc_offset;
m68k_pc_offset += 2;
sprintf (buffer, "xget_iword (%d)", r);
return buffer;
}
static const char *gen_nextibyte (void)
{
static char buffer[80];
int r = m68k_pc_offset;
m68k_pc_offset += 2;
sprintf (buffer, "xget_ibyte (%d)", r);
return buffer;
}
static void sync_m68k_pc (void)
{
if (m68k_pc_offset == 0)
return;
printf ("xm68k_incpc(%d);\n", m68k_pc_offset);
m68k_pc_offset = 0;
}
/* getv == 1: fetch data; getv != 0: check for odd address. If movem != 0,
* the calling routine handles Apdi and Aipi modes.
* gb-- movem == 2 means the same thing but for a MOVE16 instruction */
static void genamode (amodes mode, char *reg, wordsizes size, char *name, int getv, int movem)
{
start_brace ();
switch (mode) {
case Dreg:
if (movem)
abort ();
if (getv == 1)
switch (size) {
case sz_byte:
#if defined(AMIGA) && !defined(WARPUP)
/* sam: I don't know why gcc.2.7.2.1 produces a code worse */
/* if it is not done like that: */
printf ("\tuae_s8 %s = ((uae_u8*)&m68k_dreg (regs, %s))[3];\n", name, reg);
#else
printf ("\tuae_s8 %s = xm68k_dreg (%s);\n", name, reg);
#endif
break;
case sz_word:
#if defined(AMIGA) && !defined(WARPUP)
printf ("\tuae_s16 %s = ((uae_s16*)&m68k_dreg (regs, %s))[1];\n", name, reg);
#else
printf ("\tuae_s16 %s = xm68k_dreg (%s);\n", name, reg);
#endif
break;
case sz_long:
printf ("\tuae_s32 %s = xm68k_dreg (%s);\n", name, reg);
break;
default:
abort ();
}
return;
case Areg:
if (movem)
abort ();
if (getv == 1)
switch (size) {
case sz_word:
printf ("\tuae_s16 %s = xm68k_areg (%s);\n", name, reg);
break;
case sz_long:
printf ("\tuae_s32 %s = xm68k_areg (%s);\n", name, reg);
break;
default:
abort ();
}
return;
case Aind:
printf ("\tuaecptr %sa = xm68k_areg (%s);\n", name, reg);
break;
case Aipi:
printf ("\tuaecptr %sa = xm68k_areg (%s);\n", name, reg);
break;
case Apdi:
switch (size) {
case sz_byte:
if (movem)
printf ("\tuaecptr %sa = xm68k_areg (%s);\n", name, reg);
else
printf ("\tuaecptr %sa = xm68k_areg (%s) - xareg_byteinc[%s];\n", name, reg, reg);
break;
case sz_word:
printf ("\tuaecptr %sa = xm68k_areg (%s) - %d;\n", name, reg, movem ? 0 : 2);
break;
case sz_long:
printf ("\tuaecptr %sa = xm68k_areg (%s) - %d;\n", name, reg, movem ? 0 : 4);
break;
default:
abort ();
}
break;
case Ad16:
printf ("\tuaecptr %sa = xm68k_areg (%s) + (uae_s32)(uae_s16)%s;\n", name, reg, gen_nextiword ());
break;
case Ad8r:
if (cpu_level > 1) {
if (next_cpu_level < 1)
next_cpu_level = 1;
sync_m68k_pc ();
start_brace ();
/* This would ordinarily be done in gen_nextiword, which we bypass. */
printf ("\tuaecptr %sa = xget_disp_ea_020 (xm68k_areg (%s), xnext_iword ());\n", name, reg);
} else
printf ("\tuaecptr %sa = xget_disp_ea_000 (xm68k_areg (%s), %s);\n", name, reg, gen_nextiword ());
break;
case PC16:
printf ("\tuaecptr %sa = xm68k_getpc () + %d;\n", name, m68k_pc_offset);
printf ("\t%sa += (uae_s32)(uae_s16)%s;\n", name, gen_nextiword ());
break;
case PC8r:
if (cpu_level > 1) {
if (next_cpu_level < 1)
next_cpu_level = 1;
sync_m68k_pc ();
start_brace ();
/* This would ordinarily be done in gen_nextiword, which we bypass. */
printf ("\tuaecptr tmppc = xm68k_getpc ();\n");
printf ("\tuaecptr %sa = xget_disp_ea_020(tmppc, xnext_iword ());\n", name);
} else {
printf ("\tuaecptr tmppc = xm68k_getpc () + %d;\n", m68k_pc_offset);
printf ("\tuaecptr %sa = xget_disp_ea_000 (tmppc, %s);\n", name, gen_nextiword ());
}
break;
case absw:
printf ("\tuaecptr %sa = (uae_s32)(uae_s16)%s;\n", name, gen_nextiword ());
break;
case absl:
printf ("\tuaecptr %sa = %s;\n", name, gen_nextilong ());
break;
case imm:
if (getv != 1)
abort ();
switch (size) {
case sz_byte:
printf ("\tuae_s8 %s = %s;\n", name, gen_nextibyte ());
break;
case sz_word:
printf ("\tuae_s16 %s = %s;\n", name, gen_nextiword ());
break;
case sz_long:
printf ("\tuae_s32 %s = %s;\n", name, gen_nextilong ());
break;
default:
abort ();
}
return;
case imm0:
if (getv != 1)
abort ();
printf ("\tuae_s8 %s = %s;\n", name, gen_nextibyte ());
return;
case imm1:
if (getv != 1)
abort ();
printf ("\tuae_s16 %s = %s;\n", name, gen_nextiword ());
return;
case imm2:
if (getv != 1)
abort ();
printf ("\tuae_s32 %s = %s;\n", name, gen_nextilong ());
return;
case immi:
if (getv != 1)
abort ();
printf ("\tuae_u32 %s = %s;\n", name, reg);
return;
default:
abort ();
}
if (getv == 1) {
start_brace ();
switch (size) {
case sz_byte: printf ("\tuae_s8 %s = xget_byte (%sa);\n", name, name); break;
case sz_word: printf ("\tuae_s16 %s = xget_word (%sa);\n", name, name); break;
case sz_long: printf ("\tuae_s32 %s = xget_long (%sa);\n", name, name); break;
default: abort ();
}
}
/* We now might have to fix up the register for pre-dec or post-inc
* addressing modes. */
if (!movem)
switch (mode) {
case Aipi:
switch (size) {
case sz_byte:
printf ("\txm68k_areg (%s) += xareg_byteinc[%s];\n", reg, reg);
break;
case sz_word:
printf ("\txm68k_areg (%s) += 2;\n", reg);
break;
case sz_long:
printf ("\txm68k_areg (%s) += 4;\n", reg);
break;
default:
abort ();
}
break;
case Apdi:
printf ("\txm68k_areg (%s) = %sa;\n", reg, name);
break;
default:
break;
}
}
static void genastore (char *from, amodes mode, char *reg, wordsizes size, char *to)
{
switch (mode) {
case Dreg:
switch (size) {
case sz_byte:
printf ("\txm68k_dreg (%s) = (xm68k_dreg (%s) & ~0xff) | ((%s) & 0xff);\n", reg, reg, from);
break;
case sz_word:
printf ("\txm68k_dreg (%s) = (xm68k_dreg (%s) & ~0xffff) | ((%s) & 0xffff);\n", reg, reg, from);
break;
case sz_long:
printf ("\txm68k_dreg (%s) = (%s);\n", reg, from);
break;
default:
abort ();
}
break;
case Areg:
switch (size) {
case sz_word:
printf ("\txm68k_areg (%s) = (uae_s32)(uae_s16)(%s);\n", reg, from);
break;
case sz_long:
printf ("\txm68k_areg (%s) = (%s);\n", reg, from);
break;
default:
abort ();
}
break;
case Aind:
case Aipi:
case Apdi:
case Ad16:
case Ad8r:
case absw:
case absl:
case PC16:
case PC8r:
if (using_prefetch)
sync_m68k_pc ();
switch (size) {
case sz_byte:
printf ("\txput_byte (%sa,%s);\n", to, from);
break;
case sz_word:
if (cpu_level < 2 && (mode == PC16 || mode == PC8r))
abort ();
printf ("\txput_word (%sa,%s);\n", to, from);
break;
case sz_long:
if (cpu_level < 2 && (mode == PC16 || mode == PC8r))
abort ();
printf ("\txput_long (%sa,%s);\n", to, from);
break;
default:
abort ();
}
break;
case imm:
case imm0:
case imm1:
case imm2:
case immi:
abort ();
break;
default:
abort ();
}
}
static void genmovemel (uae_u16 opcode)
{
char getcode[100];
int size = table68k[opcode].size == sz_long ? 4 : 2;
if (table68k[opcode].size == sz_long) {
strcpy (getcode, "xget_long (srca)");
} else {
strcpy (getcode, "(uae_s32)(uae_s16)xget_word (srca)");
}
printf ("\tuae_u16 mask = %s;\n", gen_nextiword ());
printf ("\tunsigned int dmask = mask & 0xff, amask = (mask >> 8) & 0xff;\n");
genamode (table68k[opcode].dmode, "dstreg", table68k[opcode].size, "src", 2, 1);
start_brace ();
printf ("\twhile (dmask) { xm68k_dreg (xmovem_index1[dmask]) = %s; srca += %d; dmask = xmovem_next[dmask]; }\n",
getcode, size);
printf ("\twhile (amask) { xm68k_areg (xmovem_index1[amask]) = %s; srca += %d; amask = xmovem_next[amask]; }\n",
getcode, size);
if (table68k[opcode].dmode == Aipi)
printf ("\txm68k_areg (dstreg) = srca;\n");
}
static void genmovemle (uae_u16 opcode)
{
char putcode[100];
int size = table68k[opcode].size == sz_long ? 4 : 2;
if (table68k[opcode].size == sz_long) {
strcpy (putcode, "xput_long (srca,");
} else {
strcpy (putcode, "xput_word (srca,");
}
printf ("\tuae_u16 mask = %s;\n", gen_nextiword ());
genamode (table68k[opcode].dmode, "dstreg", table68k[opcode].size, "src", 2, 1);
if (using_prefetch)
sync_m68k_pc ();
start_brace ();
if (table68k[opcode].dmode == Apdi) {
printf ("\tuae_u16 amask = mask & 0xff, dmask = (mask >> 8) & 0xff;\n");
printf ("\twhile (amask) { srca -= %d; %s xm68k_areg (xmovem_index2[amask])); amask = xmovem_next[amask]; }\n",
size, putcode);
printf ("\twhile (dmask) { srca -= %d; %s xm68k_dreg (xmovem_index2[dmask])); dmask = xmovem_next[dmask]; }\n",
size, putcode);
printf ("\txm68k_areg (dstreg) = srca;\n");
} else {
printf ("\tuae_u16 dmask = mask & 0xff, amask = (mask >> 8) & 0xff;\n");
printf ("\twhile (dmask) { %s xm68k_dreg (xmovem_index1[dmask])); srca += %d; dmask = xmovem_next[dmask]; }\n",
putcode, size);
printf ("\twhile (amask) { %s xm68k_areg (xmovem_index1[amask])); srca += %d; amask = xmovem_next[amask]; }\n",
putcode, size);
}
}
static void duplicate_carry (void)
{
printf ("\tXCOPY_CARRY;\n");
}
typedef enum
{
flag_logical_noclobber, flag_logical, flag_add, flag_sub, flag_cmp, flag_addx, flag_subx, flag_zn,
flag_av, flag_sv
}
flagtypes;
static void genflags_normal (flagtypes type, wordsizes size, char *value, char *src, char *dst)
{
char vstr[100], sstr[100], dstr[100];
char usstr[100], udstr[100];
char unsstr[100], undstr[100];
switch (size) {
case sz_byte:
strcpy (vstr, "((uae_s8)(");
strcpy (usstr, "((uae_u8)(");
break;
case sz_word:
strcpy (vstr, "((uae_s16)(");
strcpy (usstr, "((uae_u16)(");
break;
case sz_long:
strcpy (vstr, "((uae_s32)(");
strcpy (usstr, "((uae_u32)(");
break;
default:
abort ();
}
strcpy (unsstr, usstr);
strcpy (sstr, vstr);
strcpy (dstr, vstr);
strcat (vstr, value);
strcat (vstr, "))");
strcat (dstr, dst);
strcat (dstr, "))");
strcat (sstr, src);
strcat (sstr, "))");
strcpy (udstr, usstr);
strcat (udstr, dst);
strcat (udstr, "))");
strcat (usstr, src);
strcat (usstr, "))");
strcpy (undstr, unsstr);
strcat (unsstr, "-");
strcat (undstr, "~");
strcat (undstr, dst);
strcat (undstr, "))");
strcat (unsstr, src);
strcat (unsstr, "))");
switch (type) {
case flag_logical_noclobber:
case flag_logical:
case flag_zn:
case flag_av:
case flag_sv:
case flag_addx:
case flag_subx:
break;
case flag_add:
start_brace ();
printf ("uae_u32 %s = %s + %s;\n", value, dstr, sstr);
break;
case flag_sub:
case flag_cmp:
start_brace ();
printf ("uae_u32 %s = %s - %s;\n", value, dstr, sstr);
break;
}
switch (type) {
case flag_logical_noclobber:
case flag_logical:
case flag_zn:
break;
case flag_add:
case flag_sub:
case flag_addx:
case flag_subx:
case flag_cmp:
case flag_av:
case flag_sv:
start_brace ();
printf ("\t" BOOL_TYPE " flgs = %s < 0;\n", sstr);
printf ("\t" BOOL_TYPE " flgo = %s < 0;\n", dstr);
printf ("\t" BOOL_TYPE " flgn = %s < 0;\n", vstr);
break;
}
switch (type) {
case flag_logical:
printf ("\tXCLEAR_CZNV;\n");
printf ("\tXSET_ZFLG (%s == 0);\n", vstr);
printf ("\tXSET_NFLG (%s < 0);\n", vstr);
break;
case flag_logical_noclobber:
printf ("\tXSET_ZFLG (%s == 0);\n", vstr);
printf ("\tXSET_NFLG (%s < 0);\n", vstr);
break;
case flag_av:
printf ("\tXSET_VFLG ((flgs ^ flgn) & (flgo ^ flgn));\n");
break;
case flag_sv:
printf ("\tXSET_VFLG ((flgs ^ flgo) & (flgn ^ flgo));\n");
break;
case flag_zn:
printf ("\tXSET_ZFLG (XGET_ZFLG & (%s == 0));\n", vstr);
printf ("\tXSET_NFLG (%s < 0);\n", vstr);
break;
case flag_add:
printf ("\tXSET_ZFLG (%s == 0);\n", vstr);
printf ("\tXSET_VFLG ((flgs ^ flgn) & (flgo ^ flgn));\n");
printf ("\tXSET_CFLG (%s < %s);\n", undstr, usstr);
duplicate_carry ();
printf ("\tXSET_NFLG (flgn != 0);\n");
break;
case flag_sub:
printf ("\tXSET_ZFLG (%s == 0);\n", vstr);
printf ("\tXSET_VFLG ((flgs ^ flgo) & (flgn ^ flgo));\n");
printf ("\tXSET_CFLG (%s > %s);\n", usstr, udstr);
duplicate_carry ();
printf ("\tXSET_NFLG (flgn != 0);\n");
break;
case flag_addx:
printf ("\tXSET_VFLG ((flgs ^ flgn) & (flgo ^ flgn));\n"); /* minterm SON: 0x42 */
printf ("\tXSET_CFLG (flgs ^ ((flgs ^ flgo) & (flgo ^ flgn)));\n"); /* minterm SON: 0xD4 */
duplicate_carry ();
break;
case flag_subx:
printf ("\tXSET_VFLG ((flgs ^ flgo) & (flgo ^ flgn));\n"); /* minterm SON: 0x24 */
printf ("\tXSET_CFLG (flgs ^ ((flgs ^ flgn) & (flgo ^ flgn)));\n"); /* minterm SON: 0xB2 */
duplicate_carry ();
break;
case flag_cmp:
printf ("\tXSET_ZFLG (%s == 0);\n", vstr);
printf ("\tXSET_VFLG ((flgs != flgo) && (flgn != flgo));\n");
printf ("\tXSET_CFLG (%s > %s);\n", usstr, udstr);
printf ("\tXSET_NFLG (flgn != 0);\n");
break;
}
}
static void genflags (flagtypes type, wordsizes size, char *value, char *src, char *dst)
{
/* Temporarily deleted 68k/ARM flag optimizations. I'd prefer to have
them in the appropriate m68k.h files and use just one copy of this
code here. The API can be changed if necessary. */
#ifdef OPTIMIZED_FLAGS
switch (type) {
case flag_add:
case flag_sub:
start_brace ();
printf ("\tuae_u32 %s;\n", value);
break;
default:
break;
}
/* At least some of those casts are fairly important! */
switch (type) {
case flag_logical_noclobber:
printf ("\t{uae_u32 oldcznv = GET_CZNV & ~(FLAGVAL_Z | FLAGVAL_N);\n");
if (strcmp (value, "0") == 0) {
printf ("\tSET_CZNV (olcznv | FLAGVAL_Z);\n");
} else {
switch (size) {
case sz_byte: printf ("\toptflag_testb ((uae_s8)(%s));\n", value); break;
case sz_word: printf ("\toptflag_testw ((uae_s16)(%s));\n", value); break;
case sz_long: printf ("\toptflag_testl ((uae_s32)(%s));\n", value); break;
}
printf ("\tIOR_CZNV (oldcznv);\n");
}
printf ("\t}\n");
return;
case flag_logical:
if (strcmp (value, "0") == 0) {
printf ("\tSET_CZNV (FLAGVAL_Z);\n");
} else {
switch (size) {
case sz_byte: printf ("\toptflag_testb ((uae_s8)(%s));\n", value); break;
case sz_word: printf ("\toptflag_testw ((uae_s16)(%s));\n", value); break;
case sz_long: printf ("\toptflag_testl ((uae_s32)(%s));\n", value); break;
}
}
return;
case flag_add:
switch (size) {
case sz_byte: printf ("\toptflag_addb (%s, (uae_s8)(%s), (uae_s8)(%s));\n", value, src, dst); break;
case sz_word: printf ("\toptflag_addw (%s, (uae_s16)(%s), (uae_s16)(%s));\n", value, src, dst); break;
case sz_long: printf ("\toptflag_addl (%s, (uae_s32)(%s), (uae_s32)(%s));\n", value, src, dst); break;
}
return;
case flag_sub:
switch (size) {
case sz_byte: printf ("\toptflag_subb (%s, (uae_s8)(%s), (uae_s8)(%s));\n", value, src, dst); break;
case sz_word: printf ("\toptflag_subw (%s, (uae_s16)(%s), (uae_s16)(%s));\n", value, src, dst); break;
case sz_long: printf ("\toptflag_subl (%s, (uae_s32)(%s), (uae_s32)(%s));\n", value, src, dst); break;
}
return;
case flag_cmp:
switch (size) {
case sz_byte: printf ("\toptflag_cmpb ((uae_s8)(%s), (uae_s8)(%s));\n", src, dst); break;
case sz_word: printf ("\toptflag_cmpw ((uae_s16)(%s), (uae_s16)(%s));\n", src, dst); break;
case sz_long: printf ("\toptflag_cmpl ((uae_s32)(%s), (uae_s32)(%s));\n", src, dst); break;
}
return;
default:
break;
}
#endif
genflags_normal (type, size, value, src, dst);
}
static void force_range_for_rox (const char *var, wordsizes size)
{
/* Could do a modulo operation here... which one is faster? */
switch (size) {
case sz_long:
printf ("\tif (%s >= 33) %s -= 33;\n", var, var);
break;
case sz_word:
printf ("\tif (%s >= 34) %s -= 34;\n", var, var);
printf ("\tif (%s >= 17) %s -= 17;\n", var, var);
break;
case sz_byte:
printf ("\tif (%s >= 36) %s -= 36;\n", var, var);
printf ("\tif (%s >= 18) %s -= 18;\n", var, var);
printf ("\tif (%s >= 9) %s -= 9;\n", var, var);
break;
}
}
static const char *cmask (wordsizes size)
{
switch (size) {
case sz_byte: return "0x80";
case sz_word: return "0x8000";
case sz_long: return "0x80000000";
default: abort ();
}
}
static int source_is_imm1_8 (struct instr *i)
{
return i->stype == 3;
}
static void gen_opcode (unsigned long int opcode)
{
struct instr *curi = table68k + opcode;
switch (curi->plev) {
case 0: /* not privileged */
break;
case 1: /* unprivileged only on 68000 */
if (cpu_level == 0)
break;
if (next_cpu_level < 0)
next_cpu_level = 0;
/* fall through */
case 2:
case 3:
return;
}
m68k_pc_offset = 2;
start_brace ();
switch (curi->mnemo) {
case i_OR:
case i_AND:
case i_EOR:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
printf ("\tsrc %c= dst;\n", curi->mnemo == i_OR ? '|' : curi->mnemo == i_AND ? '&' : '^');
genflags (flag_logical, curi->size, "src", "", "");
genastore ("src", curi->dmode, "dstreg", curi->size, "dst");
break;
case i_SUB:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
start_brace ();
genflags (flag_sub, curi->size, "newv", "src", "dst");
genastore ("newv", curi->dmode, "dstreg", curi->size, "dst");
break;
case i_SUBA:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
genamode (curi->dmode, "dstreg", sz_long, "dst", 1, 0);
start_brace ();
printf ("\tuae_u32 newv = dst - src;\n");
genastore ("newv", curi->dmode, "dstreg", sz_long, "dst");
break;
case i_SUBX:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
start_brace ();
printf ("\tuae_u32 newv = dst - src - (XGET_XFLG ? 1 : 0);\n");
genflags (flag_subx, curi->size, "newv", "src", "dst");
genflags (flag_zn, curi->size, "newv", "", "");
genastore ("newv", curi->dmode, "dstreg", curi->size, "dst");
break;
case i_SBCD:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
start_brace ();
printf ("\tuae_u16 newv_lo = (dst & 0xF) - (src & 0xF) - (XGET_XFLG ? 1 : 0);\n");
printf ("\tuae_u16 newv_hi = (dst & 0xF0) - (src & 0xF0);\n");
printf ("\tuae_u16 newv, tmp_newv;\n");
printf ("\tint bcd = 0;\n");
printf ("\tnewv = tmp_newv = newv_hi + newv_lo;\n");
printf ("\tif (newv_lo & 0xF0) { newv -= 6; bcd = 6; };\n");
printf ("\tif ((((dst & 0xFF) - (src & 0xFF) - (XGET_XFLG ? 1 : 0)) & 0x100) > 0xFF) { newv -= 0x60; }\n");
printf ("\tXSET_CFLG ((((dst & 0xFF) - (src & 0xFF) - bcd - (XGET_XFLG ? 1 : 0)) & 0x300) > 0xFF);\n");
duplicate_carry ();
genflags (flag_zn, curi->size, "newv", "", "");
printf ("\tXSET_VFLG ((tmp_newv & 0x80) != 0 && (newv & 0x80) == 0);\n");
genastore ("newv", curi->dmode, "dstreg", curi->size, "dst");
break;
case i_ADD:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
start_brace ();
genflags (flag_add, curi->size, "newv", "src", "dst");
genastore ("newv", curi->dmode, "dstreg", curi->size, "dst");
break;
case i_ADDA:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
genamode (curi->dmode, "dstreg", sz_long, "dst", 1, 0);
start_brace ();
printf ("\tuae_u32 newv = dst + src;\n");
genastore ("newv", curi->dmode, "dstreg", sz_long, "dst");
break;
case i_ADDX:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
start_brace ();
printf ("\tuae_u32 newv = dst + src + (XGET_XFLG ? 1 : 0);\n");
genflags (flag_addx, curi->size, "newv", "src", "dst");
genflags (flag_zn, curi->size, "newv", "", "");
genastore ("newv", curi->dmode, "dstreg", curi->size, "dst");
break;
case i_ABCD:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
start_brace ();
printf ("\tuae_u16 newv_lo = (src & 0xF) + (dst & 0xF) + (XGET_XFLG ? 1 : 0);\n");
printf ("\tuae_u16 newv_hi = (src & 0xF0) + (dst & 0xF0);\n");
printf ("\tuae_u16 newv, tmp_newv;\n");
printf ("\tint cflg;\n");
printf ("\tnewv = tmp_newv = newv_hi + newv_lo;");
printf ("\tif (newv_lo > 9) { newv += 6; }\n");
printf ("\tcflg = (newv & 0x3F0) > 0x90;\n");
printf ("\tif (cflg) newv += 0x60;\n");
printf ("\tXSET_CFLG (cflg);\n");
duplicate_carry ();
genflags (flag_zn, curi->size, "newv", "", "");
printf ("\tXSET_VFLG ((tmp_newv & 0x80) == 0 && (newv & 0x80) != 0);\n");
genastore ("newv", curi->dmode, "dstreg", curi->size, "dst");
break;
case i_NEG:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
start_brace ();
genflags (flag_sub, curi->size, "dst", "src", "0");
genastore ("dst", curi->smode, "srcreg", curi->size, "src");
break;
case i_NEGX:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
start_brace ();
printf ("\tuae_u32 newv = 0 - src - (XGET_XFLG ? 1 : 0);\n");
genflags (flag_subx, curi->size, "newv", "src", "0");
genflags (flag_zn, curi->size, "newv", "", "");
genastore ("newv", curi->smode, "srcreg", curi->size, "src");
break;
case i_NBCD:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
start_brace ();
printf ("\tuae_u16 newv_lo = - (src & 0xF) - (XGET_XFLG ? 1 : 0);\n");
printf ("\tuae_u16 newv_hi = - (src & 0xF0);\n");
printf ("\tuae_u16 newv;\n");
printf ("\tint cflg;\n");
printf ("\tif (newv_lo > 9) { newv_lo -= 6; }\n");
printf ("\tnewv = newv_hi + newv_lo;");
printf ("\tcflg = (newv & 0x1F0) > 0x90;\n");
printf ("\tif (cflg) newv -= 0x60;\n");
printf ("\tXSET_CFLG (cflg);\n");
duplicate_carry();
genflags (flag_zn, curi->size, "newv", "", "");
genastore ("newv", curi->smode, "srcreg", curi->size, "src");
break;
case i_CLR:
genamode (curi->smode, "srcreg", curi->size, "src", 2, 0);
genflags (flag_logical, curi->size, "0", "", "");
genastore ("0", curi->smode, "srcreg", curi->size, "src");
break;
case i_NOT:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
start_brace ();
printf ("\tuae_u32 dst = ~src;\n");
genflags (flag_logical, curi->size, "dst", "", "");
genastore ("dst", curi->smode, "srcreg", curi->size, "src");
break;
case i_TST:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
genflags (flag_logical, curi->size, "src", "", "");
break;
case i_BTST:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
if (curi->size == sz_byte)
printf ("\tsrc &= 7;\n");
else
printf ("\tsrc &= 31;\n");
printf ("\tXSET_ZFLG (1 ^ ((dst >> src) & 1));\n");
break;
case i_BCHG:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
if (curi->size == sz_byte)
printf ("\tsrc &= 7;\n");
else
printf ("\tsrc &= 31;\n");
printf ("\tdst ^= (1 << src);\n");
printf ("\tXSET_ZFLG (((uae_u32)dst & (1 << src)) >> src);\n");
genastore ("dst", curi->dmode, "dstreg", curi->size, "dst");
break;
case i_BCLR:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
if (curi->size == sz_byte)
printf ("\tsrc &= 7;\n");
else
printf ("\tsrc &= 31;\n");
printf ("\tXSET_ZFLG (1 ^ ((dst >> src) & 1));\n");
printf ("\tdst &= ~(1 << src);\n");
genastore ("dst", curi->dmode, "dstreg", curi->size, "dst");
break;
case i_BSET:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
if (curi->size == sz_byte)
printf ("\tsrc &= 7;\n");
else
printf ("\tsrc &= 31;\n");
printf ("\tXSET_ZFLG (1 ^ ((dst >> src) & 1));\n");
printf ("\tdst |= (1 << src);\n");
genastore ("dst", curi->dmode, "dstreg", curi->size, "dst");
break;
case i_CMPM:
case i_CMP:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
start_brace ();
genflags (flag_cmp, curi->size, "newv", "src", "dst");
break;
case i_CMPA:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
genamode (curi->dmode, "dstreg", sz_long, "dst", 1, 0);
start_brace ();
genflags (flag_cmp, sz_long, "newv", "src", "dst");
break;
/* The next two are coded a little unconventional, but they are doing
* weird things... */
case i_MVPRM:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
printf ("\tuaecptr memp = xm68k_areg (dstreg) + (uae_s32)(uae_s16)%s;\n", gen_nextiword ());
if (curi->size == sz_word) {
printf ("\txput_byte (memp, src >> 8); xput_byte (memp + 2, src);\n");
} else {
printf ("\txput_byte (memp, src >> 24); xput_byte (memp + 2, src >> 16);\n");
printf ("\txput_byte (memp + 4, src >> 8); xput_byte (memp + 6, src);\n");
}
break;
case i_MVPMR:
printf ("\tuaecptr memp = xm68k_areg (srcreg) + (uae_s32)(uae_s16)%s;\n", gen_nextiword ());
genamode (curi->dmode, "dstreg", curi->size, "dst", 2, 0);
if (curi->size == sz_word) {
printf ("\tuae_u16 val = (xget_byte (memp) << 8) + xget_byte (memp + 2);\n");
} else {
printf ("\tuae_u32 val = (xget_byte (memp) << 24) + (xget_byte (memp + 2) << 16)\n");
printf (" + (xget_byte (memp + 4) << 8) + xget_byte (memp + 6);\n");
}
genastore ("val", curi->dmode, "dstreg", curi->size, "dst");
break;
case i_MOVE:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 2, 0);
genflags (flag_logical, curi->size, "src", "", "");
genastore ("src", curi->dmode, "dstreg", curi->size, "dst");
break;
case i_MOVEA:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 2, 0);
if (curi->size == sz_word) {
printf ("\tuae_u32 val = (uae_s32)(uae_s16)src;\n");
} else {
printf ("\tuae_u32 val = src;\n");
}
genastore ("val", curi->dmode, "dstreg", sz_long, "dst");
break;
case i_SWAP:
genamode (curi->smode, "srcreg", sz_long, "src", 1, 0);
start_brace ();
printf ("\tuae_u32 dst = ((src >> 16)&0xFFFF) | ((src&0xFFFF)<<16);\n");
genflags (flag_logical, sz_long, "dst", "", "");
genastore ("dst", curi->smode, "srcreg", sz_long, "src");
break;
case i_EXG:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 1, 0);
genastore ("dst", curi->smode, "srcreg", curi->size, "src");
genastore ("src", curi->dmode, "dstreg", curi->size, "dst");
break;
case i_EXT:
genamode (curi->smode, "srcreg", sz_long, "src", 1, 0);
start_brace ();
switch (curi->size) {
case sz_byte: printf ("\tuae_u32 dst = (uae_s32)(uae_s8)src;\n"); break;
case sz_word: printf ("\tuae_u16 dst = (uae_s16)(uae_s8)src;\n"); break;
case sz_long: printf ("\tuae_u32 dst = (uae_s32)(uae_s16)src;\n"); break;
default: abort ();
}
genflags (flag_logical,
curi->size == sz_word ? sz_word : sz_long, "dst", "", "");
genastore ("dst", curi->smode, "srcreg",
curi->size == sz_word ? sz_word : sz_long, "src");
break;
case i_MVMEL:
genmovemel (opcode);
break;
case i_MVMLE:
genmovemle (opcode);
break;
case i_NOP:
break;
case i_LINK:
genamode (Apdi, "7", sz_long, "old", 2, 0);
genamode (curi->smode, "srcreg", sz_long, "src", 1, 0);
genastore ("src", Apdi, "7", sz_long, "old");
genastore ("xm68k_areg (7)", curi->smode, "srcreg", sz_long, "src");
genamode (curi->dmode, "dstreg", curi->size, "offs", 1, 0);
printf ("\txm68k_areg (7) += offs;\n");
break;
case i_UNLK:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
printf ("\txm68k_areg (7) = src;\n");
genamode (Aipi, "7", sz_long, "old", 1, 0);
genastore ("old", curi->smode, "srcreg", curi->size, "src");
break;
case i_RTS:
printf ("\txm68k_setpc (xget_long (xm68k_areg (7)));\n");
printf ("\txm68k_areg (7) += 4;\n");
m68k_pc_offset = 0;
break;
case i_JSR:
genamode (curi->smode, "srcreg", curi->size, "src", 0, 0);
printf ("\txm68k_areg (7) -= 4;\n");
printf ("\txput_long (xm68k_areg (7), xm68k_getpc () + %d);\n", m68k_pc_offset);
printf ("\txm68k_setpc (srca);\n");
m68k_pc_offset = 0;
break;
case i_JMP:
genamode (curi->smode, "srcreg", curi->size, "src", 0, 0);
printf ("\txm68k_setpc (srca);\n");
m68k_pc_offset = 0;
break;
case i_BSR:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
printf ("\tuae_s32 s = (uae_s32)src + 2;\n");
printf ("\txm68k_areg (7) -= 4;\n");
printf ("\txput_long (xm68k_areg (7), xm68k_getpc () + %d);\n", m68k_pc_offset);
printf ("\txm68k_incpc(s);\n");
m68k_pc_offset = 0;
break;
case i_Bcc:
if (curi->size == sz_long) {
if (next_cpu_level < 1)
next_cpu_level = 1;
}
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
printf ("\tif (!xcctrue(%d)) goto didnt_jump;\n", curi->cc);
printf ("\txm68k_incpc ((uae_s32)src + 2);\n");
printf ("\treturn;\n");
printf ("didnt_jump:;\n");
need_endlabel = 1;
break;
case i_LEA:
genamode (curi->smode, "srcreg", curi->size, "src", 0, 0);
genamode (curi->dmode, "dstreg", curi->size, "dst", 2, 0);
genastore ("srca", curi->dmode, "dstreg", curi->size, "dst");
break;
case i_PEA:
genamode (curi->smode, "srcreg", curi->size, "src", 0, 0);
genamode (Apdi, "7", sz_long, "dst", 2, 0);
genastore ("srca", Apdi, "7", sz_long, "dst");
break;
case i_DBcc:
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0);
genamode (curi->dmode, "dstreg", curi->size, "offs", 1, 0);
printf ("\tif (!xcctrue(%d)) {\n", curi->cc);
genastore ("(src-1)", curi->smode, "srcreg", curi->size, "src");
printf ("\t\tif (src) {\n");
printf ("\t\t\txm68k_incpc((uae_s32)offs + 2);\n");
printf ("\t\t}\n");
printf ("\t}\n");
need_endlabel = 1;
break;
case i_Scc:
genamode (curi->smode, "srcreg", curi->size, "src", 2, 0);
start_brace ();
printf ("\tint val = xcctrue(%d) ? 0xff : 0;\n", curi->cc);
genastore ("val", curi->smode, "srcreg", curi->size, "src");
break;
case i_DIVU:
printf ("\tuaecptr oldpc = xm68k_getpc ();\n");
genamode (curi->smode, "srcreg", sz_word, "src", 1, 0);
genamode (curi->dmode, "dstreg", sz_long, "dst", 1, 0);
sync_m68k_pc ();
start_brace ();
/* Clear V flag when dividing by zero - Alcatraz Odyssey demo depends
* on this (actually, it's doing a DIVS). */
printf ("\tuae_u32 newv = (uae_u32)dst / (uae_u32)(uae_u16)src;\n");
printf ("\tuae_u32 rem = (uae_u32)dst %% (uae_u32)(uae_u16)src;\n");
/* The N flag appears to be set each time there is an overflow.
* Weird. */
printf ("\tif (newv > 0xffff) { XSET_VFLG (1); XSET_NFLG (1); XSET_CFLG (0); } else\n\t{\n");
genflags (flag_logical, sz_word, "newv", "", "");
printf ("\tnewv = (newv & 0xffff) | ((uae_u32)rem << 16);\n");
genastore ("newv", curi->dmode, "dstreg", sz_long, "dst");
printf ("\t}\n");
need_endlabel = 1;
break;
case i_DIVS:
printf ("\tuaecptr oldpc = xm68k_getpc ();\n");
genamode (curi->smode, "srcreg", sz_word, "src", 1, 0);
genamode (curi->dmode, "dstreg", sz_long, "dst", 1, 0);
sync_m68k_pc ();
start_brace ();
printf ("\tuae_s32 newv = (uae_s32)dst / (uae_s32)(uae_s16)src;\n");
printf ("\tuae_u16 rem = (uae_s32)dst %% (uae_s32)(uae_s16)src;\n");
printf ("\tif ((newv & 0xffff8000) != 0 && (newv & 0xffff8000) != 0xffff8000) { XSET_VFLG (1); XSET_NFLG (1); XSET_CFLG (0); } else\n\t{\n");
printf ("\tif (((uae_s16)rem < 0) != ((uae_s32)dst < 0)) rem = -rem;\n");
genflags (flag_logical, sz_word, "newv", "", "");
printf ("\tnewv = (newv & 0xffff) | ((uae_u32)rem << 16);\n");
genastore ("newv", curi->dmode, "dstreg", sz_long, "dst");
printf ("\t}\n");
need_endlabel = 1;
break;
case i_MULU:
genamode (curi->smode, "srcreg", sz_word, "src", 1, 0);
genamode (curi->dmode, "dstreg", sz_word, "dst", 1, 0);
start_brace ();
printf ("\tuae_u32 newv = (uae_u32)(uae_u16)dst * (uae_u32)(uae_u16)src;\n");
genflags (flag_logical, sz_long, "newv", "", "");
genastore ("newv", curi->dmode, "dstreg", sz_long, "dst");
break;
case i_MULS:
genamode (curi->smode, "srcreg", sz_word, "src", 1, 0);
genamode (curi->dmode, "dstreg", sz_word, "dst", 1, 0);
start_brace ();
printf ("\tuae_u32 newv = (uae_s32)(uae_s16)dst * (uae_s32)(uae_s16)src;\n");
genflags (flag_logical, sz_long, "newv", "", "");
genastore ("newv", curi->dmode, "dstreg", sz_long, "dst");
break;
case i_ASR:
genamode (curi->smode, "srcreg", curi->size, "cnt", 1, 0);
genamode (curi->dmode, "dstreg", curi->size, "data", 1, 0);
start_brace ();
switch (curi->size) {
case sz_byte: printf ("\tuae_u32 val = (uae_u8)data;\n"); break;
case sz_word: printf ("\tuae_u32 val = (uae_u16)data;\n"); break;
case sz_long: printf ("\tuae_u32 val = data;\n"); break;
default: abort ();
}
printf ("\tuae_u32 sign = (%s & val) >> %d;\n", cmask (curi->size), bit_size (curi->size) - 1);
printf ("\tcnt &= 63;\n");
printf ("\tXCLEAR_CZNV;\n");
printf ("\tif (cnt >= %d) {\n", bit_size (curi->size));
printf ("\t\tval = %s & (uae_u32)-sign;\n", bit_mask (curi->size));
printf ("\t\tXSET_CFLG (sign);\n");
duplicate_carry ();
if (source_is_imm1_8 (curi))
printf ("\t} else {\n");
else
printf ("\t} else if (cnt > 0) {\n");
printf ("\t\tval >>= cnt - 1;\n");
printf ("\t\tXSET_CFLG (val & 1);\n");
duplicate_carry ();
printf ("\t\tval >>= 1;\n");
printf ("\t\tval |= (%s << (%d - cnt)) & (uae_u32)-sign;\n",
bit_mask (curi->size),
bit_size (curi->size));
printf ("\t\tval &= %s;\n", bit_mask (curi->size));
printf ("\t}\n");
genflags (flag_logical_noclobber, curi->size, "val", "", "");
genastore ("val", curi->dmode, "dstreg", curi->size, "data");
break;
case i_ASL:
genamode (curi->smode, "srcreg", curi->size, "cnt", 1, 0);
genamode (curi->dmode, "dstreg", curi->size, "data", 1, 0);
start_brace ();
switch (curi->size) {
case sz_byte: printf ("\tuae_u32 val = (uae_u8)data;\n"); break;
case sz_word: printf ("\tuae_u32 val = (uae_u16)data;\n"); break;
case sz_long: printf ("\tuae_u32 val = data;\n"); break;
default: abort ();
}
printf ("\tcnt &= 63;\n");
printf ("\tXCLEAR_CZNV;\n");
printf ("\tif (cnt >= %d) {\n", bit_size (curi->size));
printf ("\t\tXSET_VFLG (val != 0);\n");
printf ("\t\tXSET_CFLG (cnt == %d ? val & 1 : 0);\n",
bit_size (curi->size));
duplicate_carry ();
printf ("\t\tval = 0;\n");
if (source_is_imm1_8 (curi))
printf ("\t} else {\n");
else
printf ("\t} else if (cnt > 0) {\n");
printf ("\t\tuae_u32 mask = (%s << (%d - cnt)) & %s;\n",
bit_mask (curi->size),
bit_size (curi->size) - 1,
bit_mask (curi->size));
printf ("\t\tXSET_VFLG ((val & mask) != mask && (val & mask) != 0);\n");
printf ("\t\tval <<= cnt - 1;\n");
printf ("\t\tXSET_CFLG ((val & %s) >> %d);\n", cmask (curi->size), bit_size (curi->size) - 1);
duplicate_carry ();
printf ("\t\tval <<= 1;\n");
printf ("\t\tval &= %s;\n", bit_mask (curi->size));
printf ("\t}\n");
genflags (flag_logical_noclobber, curi->size, "val", "", "");
genastore ("val", curi->dmode, "dstreg", curi->size, "data");
break;
case i_LSR:
genamode (curi->smode, "srcreg", curi->size, "cnt", 1, 0);
genamode (curi->dmode, "dstreg", curi->size, "data", 1, 0);
start_brace ();
switch (curi->size) {
case sz_byte: printf ("\tuae_u32 val = (uae_u8)data;\n"); break;
case sz_word: printf ("\tuae_u32 val = (uae_u16)data;\n"); break;
case sz_long: printf ("\tuae_u32 val = data;\n"); break;
default: abort ();
}
printf ("\tcnt &= 63;\n");
printf ("\tXCLEAR_CZNV;\n");
printf ("\tif (cnt >= %d) {\n", bit_size (curi->size));
printf ("\t\tXSET_CFLG ((cnt == %d) & (val >> %d));\n",
bit_size (curi->size), bit_size (curi->size) - 1);
duplicate_carry ();
printf ("\t\tval = 0;\n");
if (source_is_imm1_8 (curi))
printf ("\t} else {\n");
else
printf ("\t} else if (cnt > 0) {\n");
printf ("\t\tval >>= cnt - 1;\n");
printf ("\t\tXSET_CFLG (val & 1);\n");
duplicate_carry ();
printf ("\t\tval >>= 1;\n");
printf ("\t}\n");
genflags (flag_logical_noclobber, curi->size, "val", "", "");
genastore ("val", curi->dmode, "dstreg", curi->size, "data");
break;
case i_LSL:
genamode (curi->smode, "srcreg", curi->size, "cnt", 1, 0);
genamode (curi->dmode, "dstreg", curi->size, "data", 1, 0);
start_brace ();
switch (curi->size) {
case sz_byte: printf ("\tuae_u32 val = (uae_u8)data;\n"); break;
case sz_word: printf ("\tuae_u32 val = (uae_u16)data;\n"); break;
case sz_long: printf ("\tuae_u32 val = data;\n"); break;
default: abort ();
}
printf ("\tcnt &= 63;\n");
printf ("\tXCLEAR_CZNV;\n");
printf ("\tif (cnt >= %d) {\n", bit_size (curi->size));
printf ("\t\tXSET_CFLG (cnt == %d ? val & 1 : 0);\n",
bit_size (curi->size));
duplicate_carry ();
printf ("\t\tval = 0;\n");
if (source_is_imm1_8 (curi))
printf ("\t} else {\n");
else
printf ("\t} else if (cnt > 0) {\n");
printf ("\t\tval <<= (cnt - 1);\n");
printf ("\t\tXSET_CFLG ((val & %s) >> %d);\n", cmask (curi->size), bit_size (curi->size) - 1);
duplicate_carry ();
printf ("\t\tval <<= 1;\n");
printf ("\tval &= %s;\n", bit_mask (curi->size));
printf ("\t}\n");
genflags (flag_logical_noclobber, curi->size, "val", "", "");
genastore ("val", curi->dmode, "dstreg", curi->size, "data");
break;
case i_ROL:
genamode (curi->smode, "srcreg", curi->size, "cnt", 1, 0);
genamode (curi->dmode, "dstreg", curi->size, "data", 1, 0);
start_brace ();
switch (curi->size) {
case sz_byte: printf ("\tuae_u32 val = (uae_u8)data;\n"); break;
case sz_word: printf ("\tuae_u32 val = (uae_u16)data;\n"); break;
case sz_long: printf ("\tuae_u32 val = data;\n"); break;
default: abort ();
}
printf ("\tcnt &= 63;\n");
printf ("\tXCLEAR_CZNV;\n");
if (source_is_imm1_8 (curi))
printf ("{");
else
printf ("\tif (cnt > 0) {\n");
printf ("\tuae_u32 loval;\n");
printf ("\tcnt &= %d;\n", bit_size (curi->size) - 1);
printf ("\tloval = val >> (%d - cnt);\n", bit_size (curi->size));
printf ("\tval <<= cnt;\n");
printf ("\tval |= loval;\n");
printf ("\tval &= %s;\n", bit_mask (curi->size));
printf ("\tXSET_CFLG (val & 1);\n");
printf ("}\n");
genflags (flag_logical_noclobber, curi->size, "val", "", "");
genastore ("val", curi->dmode, "dstreg", curi->size, "data");
break;
case i_ROR:
genamode (curi->smode, "srcreg", curi->size, "cnt", 1, 0);
genamode (curi->dmode, "dstreg", curi->size, "data", 1, 0);
start_brace ();
switch (curi->size) {
case sz_byte: printf ("\tuae_u32 val = (uae_u8)data;\n"); break;
case sz_word: printf ("\tuae_u32 val = (uae_u16)data;\n"); break;
case sz_long: printf ("\tuae_u32 val = data;\n"); break;
default: abort ();
}
printf ("\tcnt &= 63;\n");
printf ("\tXCLEAR_CZNV;\n");
if (source_is_imm1_8 (curi))
printf ("{");
else
printf ("\tif (cnt > 0) {");
printf ("\tuae_u32 hival;\n");
printf ("\tcnt &= %d;\n", bit_size (curi->size) - 1);
printf ("\thival = val << (%d - cnt);\n", bit_size (curi->size));
printf ("\tval >>= cnt;\n");
printf ("\tval |= hival;\n");
printf ("\tval &= %s;\n", bit_mask (curi->size));
printf ("\tXSET_CFLG ((val & %s) >> %d);\n", cmask (curi->size), bit_size (curi->size) - 1);
printf ("\t}\n");
genflags (flag_logical_noclobber, curi->size, "val", "", "");
genastore ("val", curi->dmode, "dstreg", curi->size, "data");
break;
case i_ROXL:
genamode (curi->smode, "srcreg", curi->size, "cnt", 1, 0);
genamode (curi->dmode, "dstreg", curi->size, "data", 1, 0);
start_brace ();
switch (curi->size) {
case sz_byte: printf ("\tuae_u32 val = (uae_u8)data;\n"); break;
case sz_word: printf ("\tuae_u32 val = (uae_u16)data;\n"); break;
case sz_long: printf ("\tuae_u32 val = data;\n"); break;
default: abort ();
}
printf ("\tcnt &= 63;\n");
printf ("\tXCLEAR_CZNV;\n");
if (source_is_imm1_8 (curi))
printf ("{");
else {
force_range_for_rox ("cnt", curi->size);
printf ("\tif (cnt > 0) {\n");
}
printf ("\tcnt--;\n");
printf ("\t{\n\tuae_u32 carry;\n");
printf ("\tuae_u32 loval = val >> (%d - cnt);\n", bit_size (curi->size) - 1);
printf ("\tcarry = loval & 1;\n");
printf ("\tval = (((val << 1) | XGET_XFLG) << cnt) | (loval >> 1);\n");
printf ("\tXSET_XFLG (carry);\n");
printf ("\tval &= %s;\n", bit_mask (curi->size));
printf ("\t} }\n");
printf ("\tXSET_CFLG (XGET_XFLG);\n");
genflags (flag_logical_noclobber, curi->size, "val", "", "");
genastore ("val", curi->dmode, "dstreg", curi->size, "data");
break;
case i_ROXR:
genamode (curi->smode, "srcreg", curi->size, "cnt", 1, 0);
genamode (curi->dmode, "dstreg", curi->size, "data", 1, 0);
start_brace ();
switch (curi->size) {
case sz_byte: printf ("\tuae_u32 val = (uae_u8)data;\n"); break;
case sz_word: printf ("\tuae_u32 val = (uae_u16)data;\n"); break;
case sz_long: printf ("\tuae_u32 val = data;\n"); break;
default: abort ();
}
printf ("\tcnt &= 63;\n");
printf ("\tXCLEAR_CZNV;\n");
if (source_is_imm1_8 (curi))
printf ("{");
else {
force_range_for_rox ("cnt", curi->size);
printf ("\tif (cnt > 0) {\n");
}
printf ("\tcnt--;\n");
printf ("\t{\n\tuae_u32 carry;\n");
printf ("\tuae_u32 hival = (val << 1) | XGET_XFLG;\n");
printf ("\thival <<= (%d - cnt);\n", bit_size (curi->size) - 1);
printf ("\tval >>= cnt;\n");
printf ("\tcarry = val & 1;\n");
printf ("\tval >>= 1;\n");
printf ("\tval |= hival;\n");
printf ("\tXSET_XFLG (carry);\n");
printf ("\tval &= %s;\n", bit_mask (curi->size));
printf ("\t} }\n");
printf ("\tXSET_CFLG (XGET_XFLG);\n");
genflags (flag_logical_noclobber, curi->size, "val", "", "");
genastore ("val", curi->dmode, "dstreg", curi->size, "data");
break;
case i_ASRW:
genamode (curi->smode, "srcreg", curi->size, "data", 1, 0);
start_brace ();
switch (curi->size) {
case sz_byte: printf ("\tuae_u32 val = (uae_u8)data;\n"); break;
case sz_word: printf ("\tuae_u32 val = (uae_u16)data;\n"); break;
case sz_long: printf ("\tuae_u32 val = data;\n"); break;
default: abort ();
}
printf ("\tuae_u32 sign = %s & val;\n", cmask (curi->size));
printf ("\tuae_u32 cflg = val & 1;\n");
printf ("\tval = (val >> 1) | sign;\n");
genflags (flag_logical, curi->size, "val", "", "");
printf ("\tXSET_CFLG (cflg);\n");
duplicate_carry ();
genastore ("val", curi->smode, "srcreg", curi->size, "data");
break;
case i_ASLW:
genamode (curi->smode, "srcreg", curi->size, "data", 1, 0);
start_brace ();
switch (curi->size) {
case sz_byte: printf ("\tuae_u32 val = (uae_u8)data;\n"); break;
case sz_word: printf ("\tuae_u32 val = (uae_u16)data;\n"); break;
case sz_long: printf ("\tuae_u32 val = data;\n"); break;
default: abort ();
}
printf ("\tuae_u32 sign = %s & val;\n", cmask (curi->size));
printf ("\tuae_u32 sign2;\n");
printf ("\tval <<= 1;\n");
genflags (flag_logical, curi->size, "val", "", "");
printf ("\tsign2 = %s & val;\n", cmask (curi->size));
printf ("\tXSET_CFLG (sign != 0);\n");
duplicate_carry ();
printf ("\tXSET_VFLG (XGET_VFLG | (sign2 != sign));\n");
genastore ("val", curi->smode, "srcreg", curi->size, "data");
break;
case i_LSRW:
genamode (curi->smode, "srcreg", curi->size, "data", 1, 0);
start_brace ();
switch (curi->size) {
case sz_byte: printf ("\tuae_u32 val = (uae_u8)data;\n"); break;
case sz_word: printf ("\tuae_u32 val = (uae_u16)data;\n"); break;
case sz_long: printf ("\tuae_u32 val = data;\n"); break;
default: abort ();
}
printf ("\tuae_u32 carry = val & 1;\n");
printf ("\tval >>= 1;\n");
genflags (flag_logical, curi->size, "val", "", "");
printf ("XSET_CFLG (carry);\n");
duplicate_carry ();
genastore ("val", curi->smode, "srcreg", curi->size, "data");
break;
case i_LSLW:
genamode (curi->smode, "srcreg", curi->size, "data", 1, 0);
start_brace ();
switch (curi->size) {
case sz_byte: printf ("\tuae_u8 val = data;\n"); break;
case sz_word: printf ("\tuae_u16 val = data;\n"); break;
case sz_long: printf ("\tuae_u32 val = data;\n"); break;
default: abort ();
}
printf ("\tuae_u32 carry = val & %s;\n", cmask (curi->size));
printf ("\tval <<= 1;\n");
genflags (flag_logical, curi->size, "val", "", "");
printf ("XSET_CFLG (carry >> %d);\n", bit_size (curi->size) - 1);
duplicate_carry ();
genastore ("val", curi->smode, "srcreg", curi->size, "data");
break;
case i_ROLW:
genamode (curi->smode, "srcreg", curi->size, "data", 1, 0);
start_brace ();
switch (curi->size) {
case sz_byte: printf ("\tuae_u8 val = data;\n"); break;
case sz_word: printf ("\tuae_u16 val = data;\n"); break;
case sz_long: printf ("\tuae_u32 val = data;\n"); break;
default: abort ();
}
printf ("\tuae_u32 carry = val & %s;\n", cmask (curi->size));
printf ("\tval <<= 1;\n");
printf ("\tif (carry) val |= 1;\n");
genflags (flag_logical, curi->size, "val", "", "");
printf ("XSET_CFLG (carry >> %d);\n", bit_size (curi->size) - 1);
genastore ("val", curi->smode, "srcreg", curi->size, "data");
break;
case i_RORW:
genamode (curi->smode, "srcreg", curi->size, "data", 1, 0);
start_brace ();
switch (curi->size) {
case sz_byte: printf ("\tuae_u8 val = data;\n"); break;
case sz_word: printf ("\tuae_u16 val = data;\n"); break;
case sz_long: printf ("\tuae_u32 val = data;\n"); break;
default: abort ();
}
printf ("\tuae_u32 carry = val & 1;\n");
printf ("\tval >>= 1;\n");
printf ("\tif (carry) val |= %s;\n", cmask (curi->size));
genflags (flag_logical, curi->size, "val", "", "");
printf ("XSET_CFLG (carry);\n");
genastore ("val", curi->smode, "srcreg", curi->size, "data");
break;
case i_ROXLW:
genamode (curi->smode, "srcreg", curi->size, "data", 1, 0);
start_brace ();
switch (curi->size) {
case sz_byte: printf ("\tuae_u8 val = data;\n"); break;
case sz_word: printf ("\tuae_u16 val = data;\n"); break;
case sz_long: printf ("\tuae_u32 val = data;\n"); break;
default: abort ();
}
printf ("\tuae_u32 carry = val & %s;\n", cmask (curi->size));
printf ("\tval <<= 1;\n");
printf ("\tif (XGET_XFLG) val |= 1;\n");
genflags (flag_logical, curi->size, "val", "", "");
printf ("XSET_CFLG (carry >> %d);\n", bit_size (curi->size) - 1);
duplicate_carry ();
genastore ("val", curi->smode, "srcreg", curi->size, "data");
break;
case i_ROXRW:
genamode (curi->smode, "srcreg", curi->size, "data", 1, 0);
start_brace ();
switch (curi->size) {
case sz_byte: printf ("\tuae_u8 val = data;\n"); break;
case sz_word: printf ("\tuae_u16 val = data;\n"); break;
case sz_long: printf ("\tuae_u32 val = data;\n"); break;
default: abort ();
}
printf ("\tuae_u32 carry = val & 1;\n");
printf ("\tval >>= 1;\n");
printf ("\tif (XGET_XFLG) val |= %s;\n", cmask (curi->size));
genflags (flag_logical, curi->size, "val", "", "");
printf ("XSET_CFLG (carry);\n");
duplicate_carry ();
genastore ("val", curi->smode, "srcreg", curi->size, "data");
break;
default:
m68k_pc_offset = 0;
break;
}
finish_braces ();
sync_m68k_pc ();
}
static int postfix;
static void generate_one_opcode (int rp)
{
int i;
uae_u16 smsk, dmsk;
long int opcode = opcode_map[rp];
if (table68k[opcode].mnemo == i_ILLG
|| table68k[opcode].clev > cpu_level)
return;
for (i = 0; lookuptab[i].name[0]; i++) {
if (table68k[opcode].mnemo == lookuptab[i].mnemo)
break;
}
if (table68k[opcode].handler != -1)
return;
if (opcode_next_clev[rp] != cpu_level) {
fprintf (stblfile, "{ xop_%lx_%d, %ld }, /* %s */\n", opcode, opcode_last_postfix[rp],
opcode, lookuptab[i].name);
return;
}
fprintf (stblfile, "{ xop_%lx_%d, %ld }, /* %s */\n", opcode, postfix, opcode, lookuptab[i].name);
fprintf (headerfile, "extern xcpuop_func xop_%lx_%d;\n", opcode, postfix);
printf ("void xop_%lx_%d(uae_u32 opcode) /* %s */\n{\n", opcode, postfix, lookuptab[i].name);
switch (table68k[opcode].stype) {
case 0: smsk = 7; break;
case 1: smsk = 255; break;
case 2: smsk = 15; break;
case 3: smsk = 7; break;
case 4: smsk = 7; break;
case 5: smsk = 63; break;
case 7: smsk = 3; break;
default: abort ();
}
dmsk = 7;
next_cpu_level = -1;
if (table68k[opcode].suse
&& table68k[opcode].smode != imm && table68k[opcode].smode != imm0
&& table68k[opcode].smode != imm1 && table68k[opcode].smode != imm2
&& table68k[opcode].smode != absw && table68k[opcode].smode != absl
&& table68k[opcode].smode != PC8r && table68k[opcode].smode != PC16)
{
if (table68k[opcode].spos == -1) {
if (((int) table68k[opcode].sreg) >= 128)
printf ("\tuae_u32 srcreg = (uae_s32)(uae_s8)%d;\n", (int) table68k[opcode].sreg);
else
printf ("\tuae_u32 srcreg = %d;\n", (int) table68k[opcode].sreg);
} else {
char source[100];
int pos = table68k[opcode].spos;
if (pos)
sprintf (source, "((opcode >> %d) & %d)", pos, smsk);
else
sprintf (source, "(opcode & %d)", smsk);
if (table68k[opcode].stype == 3)
printf ("\tuae_u32 srcreg = ximm8_table[%s];\n", source);
else if (table68k[opcode].stype == 1)
printf ("\tuae_u32 srcreg = (uae_s32)(uae_s8)%s;\n", source);
else
printf ("\tuae_u32 srcreg = %s;\n", source);
}
}
if (table68k[opcode].duse
/* Yes, the dmode can be imm, in case of LINK or DBcc */
&& table68k[opcode].dmode != imm && table68k[opcode].dmode != imm0
&& table68k[opcode].dmode != imm1 && table68k[opcode].dmode != imm2
&& table68k[opcode].dmode != absw && table68k[opcode].dmode != absl)
{
if (table68k[opcode].dpos == -1) {
if (((int) table68k[opcode].dreg) >= 128)
printf ("\tuae_u32 dstreg = (uae_s32)(uae_s8)%d;\n", (int) table68k[opcode].dreg);
else
printf ("\tuae_u32 dstreg = %d;\n", (int) table68k[opcode].dreg);
} else {
int pos = table68k[opcode].dpos;
#if 0
/* Check that we can do the little endian optimization safely. */
if (pos < 8 && (dmsk >> (8 - pos)) != 0)
abort ();
#endif
if (pos)
printf ("\tuae_u32 dstreg = (opcode >> %d) & %d;\n",
pos, dmsk);
else
printf ("\tuae_u32 dstreg = opcode & %d;\n", dmsk);
}
}
need_endlabel = 0;
endlabelno++;
sprintf (endlabelstr, "endlabel%d", endlabelno);
gen_opcode (opcode);
if (need_endlabel)
printf ("%s: ;\n", endlabelstr);
printf ("}\n");
opcode_next_clev[rp] = next_cpu_level;
opcode_last_postfix[rp] = postfix;
}
static void generate_func (void)
{
int i, j, rp;
using_prefetch = 0;
using_exception_3 = 0;
for (i = 0; i <= 0; i++) {
cpu_level = 5;
postfix = i;
fprintf (stblfile, "struct xcputbl xop_smalltbl_%d[] = {\n", postfix);
rp = 0;
for(j=1;j<=8;++j) {
int k = (j*nr_cpuop_funcs)/8;
for (; rp < k; rp++)
generate_one_opcode (rp);
}
fprintf (stblfile, "{ 0, 0 }};\n");
}
}
static void generate_includes (FILE * f)
{
fprintf (f, "#include \"cpu_small.h\"\n");
fprintf (f, "#include \"cputbl_small.h\"\n");
}
int main (int argc, char **argv)
{
read_table68k ();
do_merges ();
opcode_map = (int *) xmalloc (sizeof (int) * nr_cpuop_funcs);
opcode_last_postfix = (int *) xmalloc (sizeof (int) * nr_cpuop_funcs);
opcode_next_clev = (int *) xmalloc (sizeof (int) * nr_cpuop_funcs);
counts = (unsigned long *) xmalloc (65536 * sizeof (unsigned long));
read_counts ();
/* It would be a lot nicer to put all in one file (we'd also get rid of
* cputbl.h that way), but cpuopti can't cope. That could be fixed, but
* I don't dare to touch the 68k version. */
headerfile = fopen ("cputbl_small.h", "wb");
stblfile = fopen ("cpustbl_small.c", "wb");
generate_includes (stblfile);
freopen ("cpuemu_small.c", "wb", stdout);
generate_includes (stdout);
generate_func ();
free (table68k);
return 0;
}
| 55,396 | C | .c | 1,633 | 30.778934 | 142 | 0.58875 | libretro/libretro-uae | 112 | 60 | 28 | GPL-2.0 | 9/7/2024, 9:44:01 AM (Europe/Amsterdam) | false | false | false | true | true | false | false | false |
End of preview. Expand
in Dataset Viewer.
README.md exists but content is empty.
- Downloads last month
- 21