hexsha
stringlengths
40
40
repo
stringlengths
5
105
path
stringlengths
3
173
license
sequence
language
stringclasses
1 value
identifier
stringlengths
1
438
return_type
stringlengths
1
106
original_string
stringlengths
21
40.7k
original_docstring
stringlengths
18
13.4k
docstring
stringlengths
11
3.24k
docstring_tokens
sequence
code
stringlengths
14
20.4k
code_tokens
sequence
short_docstring
stringlengths
0
4.36k
short_docstring_tokens
sequence
comment
sequence
parameters
list
docstring_params
dict
18b1ccba0139c14f3c94ca9e47ec3891eaf1289a
lofunz/mieme
Reloaded/trunk/src/emu/sound.c
[ "Unlicense" ]
C
sound_get_user_gain_count
int
int sound_get_user_gain_count(running_machine *machine) { // count up the number of speaker inputs int count = 0; for (speaker_device *speaker = speaker_first(*machine); speaker != NULL; speaker = speaker_next(speaker)) count += speaker->inputs(); return count; }
/*------------------------------------------------- sound_get_user_gain_count - return the number of user-controllable gain parameters -------------------------------------------------*/
return the number of user-controllable gain parameters
[ "return", "the", "number", "of", "user", "-", "controllable", "gain", "parameters" ]
int sound_get_user_gain_count(running_machine *machine) { int count = 0; for (speaker_device *speaker = speaker_first(*machine); speaker != NULL; speaker = speaker_next(speaker)) count += speaker->inputs(); return count; }
[ "int", "sound_get_user_gain_count", "(", "running_machine", "*", "machine", ")", "{", "int", "count", "=", "0", ";", "for", "(", "speaker_device", "*", "speaker", "=", "speaker_first", "(", "*", "machine", ")", ";", "speaker", "!=", "NULL", ";", "speaker", "=", "speaker_next", "(", "speaker", ")", ")", "count", "+=", "speaker", "->", "inputs", "(", ")", ";", "return", "count", ";", "}" ]
sound_get_user_gain_count - return the number of user-controllable gain parameters
[ "sound_get_user_gain_count", "-", "return", "the", "number", "of", "user", "-", "controllable", "gain", "parameters" ]
[ "// count up the number of speaker inputs\r" ]
[ { "param": "machine", "type": "running_machine" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
18b1ccba0139c14f3c94ca9e47ec3891eaf1289a
lofunz/mieme
Reloaded/trunk/src/emu/sound.c
[ "Unlicense" ]
C
sound_set_user_gain
void
void sound_set_user_gain(running_machine *machine, int index, float gain) { int inputnum; speaker_device *speaker = index_to_input(machine, index, inputnum); if (speaker != NULL) speaker->set_input_gain(inputnum, gain); }
/*------------------------------------------------- sound_set_user_gain - set the nth user gain value -------------------------------------------------*/
set the nth user gain value
[ "set", "the", "nth", "user", "gain", "value" ]
void sound_set_user_gain(running_machine *machine, int index, float gain) { int inputnum; speaker_device *speaker = index_to_input(machine, index, inputnum); if (speaker != NULL) speaker->set_input_gain(inputnum, gain); }
[ "void", "sound_set_user_gain", "(", "running_machine", "*", "machine", ",", "int", "index", ",", "float", "gain", ")", "{", "int", "inputnum", ";", "speaker_device", "*", "speaker", "=", "index_to_input", "(", "machine", ",", "index", ",", "inputnum", ")", ";", "if", "(", "speaker", "!=", "NULL", ")", "speaker", "->", "set_input_gain", "(", "inputnum", ",", "gain", ")", ";", "}" ]
sound_set_user_gain - set the nth user gain value
[ "sound_set_user_gain", "-", "set", "the", "nth", "user", "gain", "value" ]
[]
[ { "param": "machine", "type": "running_machine" }, { "param": "index", "type": "int" }, { "param": "gain", "type": "float" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "index", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "gain", "type": "float", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
18b1ccba0139c14f3c94ca9e47ec3891eaf1289a
lofunz/mieme
Reloaded/trunk/src/emu/sound.c
[ "Unlicense" ]
C
sound_get_user_gain
float
float sound_get_user_gain(running_machine *machine, int index) { int inputnum; speaker_device *speaker = index_to_input(machine, index, inputnum); return (speaker != NULL) ? speaker->input_gain(inputnum) : 0; }
/*------------------------------------------------- sound_get_user_gain - get the nth user gain value -------------------------------------------------*/
get the nth user gain value
[ "get", "the", "nth", "user", "gain", "value" ]
float sound_get_user_gain(running_machine *machine, int index) { int inputnum; speaker_device *speaker = index_to_input(machine, index, inputnum); return (speaker != NULL) ? speaker->input_gain(inputnum) : 0; }
[ "float", "sound_get_user_gain", "(", "running_machine", "*", "machine", ",", "int", "index", ")", "{", "int", "inputnum", ";", "speaker_device", "*", "speaker", "=", "index_to_input", "(", "machine", ",", "index", ",", "inputnum", ")", ";", "return", "(", "speaker", "!=", "NULL", ")", "?", "speaker", "->", "input_gain", "(", "inputnum", ")", ":", "0", ";", "}" ]
sound_get_user_gain - get the nth user gain value
[ "sound_get_user_gain", "-", "get", "the", "nth", "user", "gain", "value" ]
[]
[ { "param": "machine", "type": "running_machine" }, { "param": "index", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "index", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
18b1ccba0139c14f3c94ca9e47ec3891eaf1289a
lofunz/mieme
Reloaded/trunk/src/emu/sound.c
[ "Unlicense" ]
C
sound_get_default_gain
float
float sound_get_default_gain(running_machine *machine, int index) { int inputnum; speaker_device *speaker = index_to_input(machine, index, inputnum); return (speaker != NULL) ? speaker->input_default_gain(inputnum) : 0; }
/*------------------------------------------------- sound_get_default_gain - return the default gain of the nth user value -------------------------------------------------*/
return the default gain of the nth user value
[ "return", "the", "default", "gain", "of", "the", "nth", "user", "value" ]
float sound_get_default_gain(running_machine *machine, int index) { int inputnum; speaker_device *speaker = index_to_input(machine, index, inputnum); return (speaker != NULL) ? speaker->input_default_gain(inputnum) : 0; }
[ "float", "sound_get_default_gain", "(", "running_machine", "*", "machine", ",", "int", "index", ")", "{", "int", "inputnum", ";", "speaker_device", "*", "speaker", "=", "index_to_input", "(", "machine", ",", "index", ",", "inputnum", ")", ";", "return", "(", "speaker", "!=", "NULL", ")", "?", "speaker", "->", "input_default_gain", "(", "inputnum", ")", ":", "0", ";", "}" ]
sound_get_default_gain - return the default gain of the nth user value
[ "sound_get_default_gain", "-", "return", "the", "default", "gain", "of", "the", "nth", "user", "value" ]
[]
[ { "param": "machine", "type": "running_machine" }, { "param": "index", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "index", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
18b1ccba0139c14f3c94ca9e47ec3891eaf1289a
lofunz/mieme
Reloaded/trunk/src/emu/sound.c
[ "Unlicense" ]
C
sound_get_user_gain_name
char
const char *sound_get_user_gain_name(running_machine *machine, int index) { int inputnum; speaker_device *speaker = index_to_input(machine, index, inputnum); return (speaker != NULL) ? speaker->input_name(inputnum) : 0; }
/*------------------------------------------------- sound_get_user_gain_name - return the name of the nth user value -------------------------------------------------*/
return the name of the nth user value
[ "return", "the", "name", "of", "the", "nth", "user", "value" ]
const char *sound_get_user_gain_name(running_machine *machine, int index) { int inputnum; speaker_device *speaker = index_to_input(machine, index, inputnum); return (speaker != NULL) ? speaker->input_name(inputnum) : 0; }
[ "const", "char", "*", "sound_get_user_gain_name", "(", "running_machine", "*", "machine", ",", "int", "index", ")", "{", "int", "inputnum", ";", "speaker_device", "*", "speaker", "=", "index_to_input", "(", "machine", ",", "index", ",", "inputnum", ")", ";", "return", "(", "speaker", "!=", "NULL", ")", "?", "speaker", "->", "input_name", "(", "inputnum", ")", ":", "0", ";", "}" ]
sound_get_user_gain_name - return the name of the nth user value
[ "sound_get_user_gain_name", "-", "return", "the", "name", "of", "the", "nth", "user", "value" ]
[]
[ { "param": "machine", "type": "running_machine" }, { "param": "index", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "index", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7c99a6aa7669fa6b8ef4c07e135e517a951a5e9b
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/sound/cdda.c
[ "Unlicense" ]
C
cdda_set_cdrom
void
void cdda_set_cdrom(const device_config *device, void *file) { cdda_info *info = get_safe_token(device); info->disc = (cdrom_file *)file; }
/*------------------------------------------------- cdda_set_cdrom - set the CD-ROM file for the given CDDA stream -------------------------------------------------*/
set the CD-ROM file for the given CDDA stream
[ "set", "the", "CD", "-", "ROM", "file", "for", "the", "given", "CDDA", "stream" ]
void cdda_set_cdrom(const device_config *device, void *file) { cdda_info *info = get_safe_token(device); info->disc = (cdrom_file *)file; }
[ "void", "cdda_set_cdrom", "(", "const", "device_config", "*", "device", ",", "void", "*", "file", ")", "{", "cdda_info", "*", "info", "=", "get_safe_token", "(", "device", ")", ";", "info", "->", "disc", "=", "(", "cdrom_file", "*", ")", "file", ";", "}" ]
cdda_set_cdrom - set the CD-ROM file for the given CDDA stream
[ "cdda_set_cdrom", "-", "set", "the", "CD", "-", "ROM", "file", "for", "the", "given", "CDDA", "stream" ]
[]
[ { "param": "device", "type": "device_config" }, { "param": "file", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "device", "type": "device_config", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "file", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7c99a6aa7669fa6b8ef4c07e135e517a951a5e9b
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/sound/cdda.c
[ "Unlicense" ]
C
cdda_from_cdrom
device_config
const device_config *cdda_from_cdrom(running_machine *machine, void *file) { const device_config *device; for (device = sound_first(machine->config); device != NULL; device = sound_next(device)) if (sound_get_type(device) == SOUND_CDDA) { cdda_info *info = get_safe_token(device); if (info->disc == file) return device; } return NULL; }
/*------------------------------------------------- cdda_from_cdrom - find the CDDA stream that references the given CD-ROM file -------------------------------------------------*/
find the CDDA stream that references the given CD-ROM file
[ "find", "the", "CDDA", "stream", "that", "references", "the", "given", "CD", "-", "ROM", "file" ]
const device_config *cdda_from_cdrom(running_machine *machine, void *file) { const device_config *device; for (device = sound_first(machine->config); device != NULL; device = sound_next(device)) if (sound_get_type(device) == SOUND_CDDA) { cdda_info *info = get_safe_token(device); if (info->disc == file) return device; } return NULL; }
[ "const", "device_config", "*", "cdda_from_cdrom", "(", "running_machine", "*", "machine", ",", "void", "*", "file", ")", "{", "const", "device_config", "*", "device", ";", "for", "(", "device", "=", "sound_first", "(", "machine", "->", "config", ")", ";", "device", "!=", "NULL", ";", "device", "=", "sound_next", "(", "device", ")", ")", "if", "(", "sound_get_type", "(", "device", ")", "==", "SOUND_CDDA", ")", "{", "cdda_info", "*", "info", "=", "get_safe_token", "(", "device", ")", ";", "if", "(", "info", "->", "disc", "==", "file", ")", "return", "device", ";", "}", "return", "NULL", ";", "}" ]
cdda_from_cdrom - find the CDDA stream that references the given CD-ROM file
[ "cdda_from_cdrom", "-", "find", "the", "CDDA", "stream", "that", "references", "the", "given", "CD", "-", "ROM", "file" ]
[]
[ { "param": "machine", "type": "running_machine" }, { "param": "file", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "file", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7c99a6aa7669fa6b8ef4c07e135e517a951a5e9b
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/sound/cdda.c
[ "Unlicense" ]
C
cdda_start_audio
void
void cdda_start_audio(const device_config *device, UINT32 startlba, UINT32 numblocks) { cdda_info *info = get_safe_token(device); stream_update(info->stream); info->audio_playing = TRUE; info->audio_pause = FALSE; info->audio_ended_normally = FALSE; info->audio_lba = startlba; info->audio_length = numblocks; }
/*------------------------------------------------- cdda_start_audio - begin playback of a Red Book audio track -------------------------------------------------*/
begin playback of a Red Book audio track
[ "begin", "playback", "of", "a", "Red", "Book", "audio", "track" ]
void cdda_start_audio(const device_config *device, UINT32 startlba, UINT32 numblocks) { cdda_info *info = get_safe_token(device); stream_update(info->stream); info->audio_playing = TRUE; info->audio_pause = FALSE; info->audio_ended_normally = FALSE; info->audio_lba = startlba; info->audio_length = numblocks; }
[ "void", "cdda_start_audio", "(", "const", "device_config", "*", "device", ",", "UINT32", "startlba", ",", "UINT32", "numblocks", ")", "{", "cdda_info", "*", "info", "=", "get_safe_token", "(", "device", ")", ";", "stream_update", "(", "info", "->", "stream", ")", ";", "info", "->", "audio_playing", "=", "TRUE", ";", "info", "->", "audio_pause", "=", "FALSE", ";", "info", "->", "audio_ended_normally", "=", "FALSE", ";", "info", "->", "audio_lba", "=", "startlba", ";", "info", "->", "audio_length", "=", "numblocks", ";", "}" ]
cdda_start_audio - begin playback of a Red Book audio track
[ "cdda_start_audio", "-", "begin", "playback", "of", "a", "Red", "Book", "audio", "track" ]
[]
[ { "param": "device", "type": "device_config" }, { "param": "startlba", "type": "UINT32" }, { "param": "numblocks", "type": "UINT32" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "device", "type": "device_config", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "startlba", "type": "UINT32", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "numblocks", "type": "UINT32", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7c99a6aa7669fa6b8ef4c07e135e517a951a5e9b
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/sound/cdda.c
[ "Unlicense" ]
C
cdda_stop_audio
void
void cdda_stop_audio(const device_config *device) { cdda_info *info = get_safe_token(device); stream_update(info->stream); info->audio_playing = FALSE; info->audio_ended_normally = TRUE; }
/*------------------------------------------------- cdda_stop_audio - stop playback of a Red Book audio track -------------------------------------------------*/
stop playback of a Red Book audio track
[ "stop", "playback", "of", "a", "Red", "Book", "audio", "track" ]
void cdda_stop_audio(const device_config *device) { cdda_info *info = get_safe_token(device); stream_update(info->stream); info->audio_playing = FALSE; info->audio_ended_normally = TRUE; }
[ "void", "cdda_stop_audio", "(", "const", "device_config", "*", "device", ")", "{", "cdda_info", "*", "info", "=", "get_safe_token", "(", "device", ")", ";", "stream_update", "(", "info", "->", "stream", ")", ";", "info", "->", "audio_playing", "=", "FALSE", ";", "info", "->", "audio_ended_normally", "=", "TRUE", ";", "}" ]
cdda_stop_audio - stop playback of a Red Book audio track
[ "cdda_stop_audio", "-", "stop", "playback", "of", "a", "Red", "Book", "audio", "track" ]
[]
[ { "param": "device", "type": "device_config" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "device", "type": "device_config", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7c99a6aa7669fa6b8ef4c07e135e517a951a5e9b
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/sound/cdda.c
[ "Unlicense" ]
C
cdda_pause_audio
void
void cdda_pause_audio(const device_config *device, int pause) { cdda_info *info = get_safe_token(device); stream_update(info->stream); info->audio_pause = pause; }
/*------------------------------------------------- cdda_pause_audio - pause/unpause playback of a Red Book audio track -------------------------------------------------*/
pause/unpause playback of a Red Book audio track
[ "pause", "/", "unpause", "playback", "of", "a", "Red", "Book", "audio", "track" ]
void cdda_pause_audio(const device_config *device, int pause) { cdda_info *info = get_safe_token(device); stream_update(info->stream); info->audio_pause = pause; }
[ "void", "cdda_pause_audio", "(", "const", "device_config", "*", "device", ",", "int", "pause", ")", "{", "cdda_info", "*", "info", "=", "get_safe_token", "(", "device", ")", ";", "stream_update", "(", "info", "->", "stream", ")", ";", "info", "->", "audio_pause", "=", "pause", ";", "}" ]
cdda_pause_audio - pause/unpause playback of a Red Book audio track
[ "cdda_pause_audio", "-", "pause", "/", "unpause", "playback", "of", "a", "Red", "Book", "audio", "track" ]
[]
[ { "param": "device", "type": "device_config" }, { "param": "pause", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "device", "type": "device_config", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pause", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7c99a6aa7669fa6b8ef4c07e135e517a951a5e9b
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/sound/cdda.c
[ "Unlicense" ]
C
cdda_get_audio_lba
UINT32
UINT32 cdda_get_audio_lba(const device_config *device) { cdda_info *info = get_safe_token(device); stream_update(info->stream); return info->audio_lba; }
/*------------------------------------------------- cdda_get_audio_lba - returns the current LBA (physical sector) during Red Book playback -------------------------------------------------*/
returns the current LBA (physical sector) during Red Book playback
[ "returns", "the", "current", "LBA", "(", "physical", "sector", ")", "during", "Red", "Book", "playback" ]
UINT32 cdda_get_audio_lba(const device_config *device) { cdda_info *info = get_safe_token(device); stream_update(info->stream); return info->audio_lba; }
[ "UINT32", "cdda_get_audio_lba", "(", "const", "device_config", "*", "device", ")", "{", "cdda_info", "*", "info", "=", "get_safe_token", "(", "device", ")", ";", "stream_update", "(", "info", "->", "stream", ")", ";", "return", "info", "->", "audio_lba", ";", "}" ]
cdda_get_audio_lba - returns the current LBA (physical sector) during Red Book playback
[ "cdda_get_audio_lba", "-", "returns", "the", "current", "LBA", "(", "physical", "sector", ")", "during", "Red", "Book", "playback" ]
[]
[ { "param": "device", "type": "device_config" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "device", "type": "device_config", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7c99a6aa7669fa6b8ef4c07e135e517a951a5e9b
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/sound/cdda.c
[ "Unlicense" ]
C
cdda_audio_active
int
int cdda_audio_active(const device_config *device) { cdda_info *info = get_safe_token(device); stream_update(info->stream); return info->audio_playing; }
/*------------------------------------------------- cdda_audio_active - returns Red Book audio playback status -------------------------------------------------*/
returns Red Book audio playback status
[ "returns", "Red", "Book", "audio", "playback", "status" ]
int cdda_audio_active(const device_config *device) { cdda_info *info = get_safe_token(device); stream_update(info->stream); return info->audio_playing; }
[ "int", "cdda_audio_active", "(", "const", "device_config", "*", "device", ")", "{", "cdda_info", "*", "info", "=", "get_safe_token", "(", "device", ")", ";", "stream_update", "(", "info", "->", "stream", ")", ";", "return", "info", "->", "audio_playing", ";", "}" ]
cdda_audio_active - returns Red Book audio playback status
[ "cdda_audio_active", "-", "returns", "Red", "Book", "audio", "playback", "status" ]
[]
[ { "param": "device", "type": "device_config" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "device", "type": "device_config", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7c99a6aa7669fa6b8ef4c07e135e517a951a5e9b
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/sound/cdda.c
[ "Unlicense" ]
C
cdda_audio_paused
int
int cdda_audio_paused(const device_config *device) { cdda_info *info = get_safe_token(device); return info->audio_pause; }
/*------------------------------------------------- cdda_audio_paused - returns if Red Book playback is paused -------------------------------------------------*/
returns if Red Book playback is paused
[ "returns", "if", "Red", "Book", "playback", "is", "paused" ]
int cdda_audio_paused(const device_config *device) { cdda_info *info = get_safe_token(device); return info->audio_pause; }
[ "int", "cdda_audio_paused", "(", "const", "device_config", "*", "device", ")", "{", "cdda_info", "*", "info", "=", "get_safe_token", "(", "device", ")", ";", "return", "info", "->", "audio_pause", ";", "}" ]
cdda_audio_paused - returns if Red Book playback is paused
[ "cdda_audio_paused", "-", "returns", "if", "Red", "Book", "playback", "is", "paused" ]
[]
[ { "param": "device", "type": "device_config" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "device", "type": "device_config", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7c99a6aa7669fa6b8ef4c07e135e517a951a5e9b
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/sound/cdda.c
[ "Unlicense" ]
C
cdda_audio_ended
int
int cdda_audio_ended(const device_config *device) { cdda_info *info = get_safe_token(device); return info->audio_ended_normally; }
/*------------------------------------------------- cdda_audio_ended - returns if a Red Book track reached it's natural end -------------------------------------------------*/
returns if a Red Book track reached it's natural end
[ "returns", "if", "a", "Red", "Book", "track", "reached", "it", "'", "s", "natural", "end" ]
int cdda_audio_ended(const device_config *device) { cdda_info *info = get_safe_token(device); return info->audio_ended_normally; }
[ "int", "cdda_audio_ended", "(", "const", "device_config", "*", "device", ")", "{", "cdda_info", "*", "info", "=", "get_safe_token", "(", "device", ")", ";", "return", "info", "->", "audio_ended_normally", ";", "}" ]
cdda_audio_ended - returns if a Red Book track reached it's natural end
[ "cdda_audio_ended", "-", "returns", "if", "a", "Red", "Book", "track", "reached", "it", "'", "s", "natural", "end" ]
[]
[ { "param": "device", "type": "device_config" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "device", "type": "device_config", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
memory_find_address_space
address_space
const address_space *memory_find_address_space(const device_config *device, int spacenum) { memory_private *memdata = device->machine->memory_data; const address_space *space; for (space = memdata->spacelist; space != NULL; space = space->next) if (space->cpu == device && space->spacenum == spacenum) return space; return NULL; }
/*------------------------------------------------- memory_find_address_space - find an address space in our internal list; for faster access use device->space[] after device is started -------------------------------------------------*/
find an address space in our internal list; for faster access use device->space[] after device is started
[ "find", "an", "address", "space", "in", "our", "internal", "list", ";", "for", "faster", "access", "use", "device", "-", ">", "space", "[]", "after", "device", "is", "started" ]
const address_space *memory_find_address_space(const device_config *device, int spacenum) { memory_private *memdata = device->machine->memory_data; const address_space *space; for (space = memdata->spacelist; space != NULL; space = space->next) if (space->cpu == device && space->spacenum == spacenum) return space; return NULL; }
[ "const", "address_space", "*", "memory_find_address_space", "(", "const", "device_config", "*", "device", ",", "int", "spacenum", ")", "{", "memory_private", "*", "memdata", "=", "device", "->", "machine", "->", "memory_data", ";", "const", "address_space", "*", "space", ";", "for", "(", "space", "=", "memdata", "->", "spacelist", ";", "space", "!=", "NULL", ";", "space", "=", "space", "->", "next", ")", "if", "(", "space", "->", "cpu", "==", "device", "&&", "space", "->", "spacenum", "==", "spacenum", ")", "return", "space", ";", "return", "NULL", ";", "}" ]
memory_find_address_space - find an address space in our internal list; for faster access use device->space[] after device is started
[ "memory_find_address_space", "-", "find", "an", "address", "space", "in", "our", "internal", "list", ";", "for", "faster", "access", "use", "device", "-", ">", "space", "[]", "after", "device", "is", "started" ]
[]
[ { "param": "device", "type": "device_config" }, { "param": "spacenum", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "device", "type": "device_config", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "spacenum", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
address_map_alloc
address_map
address_map *address_map_alloc(const device_config *device, const game_driver *driver, int spacenum) { const addrmap_token *internal_map; const addrmap_token *default_map; address_map *map; map = alloc_clear_or_die(address_map); /* append the internal device map (first so it takes priority) */ internal_map = (const addrmap_token *)device_get_info_ptr(device, DEVINFO_PTR_INTERNAL_MEMORY_MAP + spacenum); if (internal_map != NULL) map_detokenize(map, driver, device->tag, internal_map); /* construct the standard map */ if (device->address_map[spacenum] != NULL) map_detokenize(map, driver, device->tag, device->address_map[spacenum]); /* append the default device map (last so it can be overridden) */ default_map = (const addrmap_token *)device_get_info_ptr(device, DEVINFO_PTR_DEFAULT_MEMORY_MAP + spacenum); if (default_map != NULL) map_detokenize(map, driver, device->tag, default_map); return map; }
/*------------------------------------------------- address_map_alloc - build and allocate an address map for a device's address space -------------------------------------------------*/
build and allocate an address map for a device's address space
[ "build", "and", "allocate", "an", "address", "map", "for", "a", "device", "'", "s", "address", "space" ]
address_map *address_map_alloc(const device_config *device, const game_driver *driver, int spacenum) { const addrmap_token *internal_map; const addrmap_token *default_map; address_map *map; map = alloc_clear_or_die(address_map); internal_map = (const addrmap_token *)device_get_info_ptr(device, DEVINFO_PTR_INTERNAL_MEMORY_MAP + spacenum); if (internal_map != NULL) map_detokenize(map, driver, device->tag, internal_map); if (device->address_map[spacenum] != NULL) map_detokenize(map, driver, device->tag, device->address_map[spacenum]); default_map = (const addrmap_token *)device_get_info_ptr(device, DEVINFO_PTR_DEFAULT_MEMORY_MAP + spacenum); if (default_map != NULL) map_detokenize(map, driver, device->tag, default_map); return map; }
[ "address_map", "*", "address_map_alloc", "(", "const", "device_config", "*", "device", ",", "const", "game_driver", "*", "driver", ",", "int", "spacenum", ")", "{", "const", "addrmap_token", "*", "internal_map", ";", "const", "addrmap_token", "*", "default_map", ";", "address_map", "*", "map", ";", "map", "=", "alloc_clear_or_die", "(", "address_map", ")", ";", "internal_map", "=", "(", "const", "addrmap_token", "*", ")", "device_get_info_ptr", "(", "device", ",", "DEVINFO_PTR_INTERNAL_MEMORY_MAP", "+", "spacenum", ")", ";", "if", "(", "internal_map", "!=", "NULL", ")", "map_detokenize", "(", "map", ",", "driver", ",", "device", "->", "tag", ",", "internal_map", ")", ";", "if", "(", "device", "->", "address_map", "[", "spacenum", "]", "!=", "NULL", ")", "map_detokenize", "(", "map", ",", "driver", ",", "device", "->", "tag", ",", "device", "->", "address_map", "[", "spacenum", "]", ")", ";", "default_map", "=", "(", "const", "addrmap_token", "*", ")", "device_get_info_ptr", "(", "device", ",", "DEVINFO_PTR_DEFAULT_MEMORY_MAP", "+", "spacenum", ")", ";", "if", "(", "default_map", "!=", "NULL", ")", "map_detokenize", "(", "map", ",", "driver", ",", "device", "->", "tag", ",", "default_map", ")", ";", "return", "map", ";", "}" ]
address_map_alloc - build and allocate an address map for a device's address space
[ "address_map_alloc", "-", "build", "and", "allocate", "an", "address", "map", "for", "a", "device", "'", "s", "address", "space" ]
[ "/* append the internal device map (first so it takes priority) */", "/* construct the standard map */", "/* append the default device map (last so it can be overridden) */" ]
[ { "param": "device", "type": "device_config" }, { "param": "driver", "type": "game_driver" }, { "param": "spacenum", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "device", "type": "device_config", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "driver", "type": "game_driver", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "spacenum", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
address_map_free
void
void address_map_free(address_map *map) { /* free all entries */ while (map->entrylist != NULL) { address_map_entry *entry = map->entrylist; map->entrylist = entry->next; if (entry->read_devtag_string != NULL) astring_free(entry->read_devtag_string); if (entry->write_devtag_string != NULL) astring_free(entry->write_devtag_string); if (entry->region_string != NULL) astring_free(entry->region_string); free(entry); } /* free the map */ free(map); }
/*------------------------------------------------- address_map_free - release allocated memory for an address map -------------------------------------------------*/
release allocated memory for an address map
[ "release", "allocated", "memory", "for", "an", "address", "map" ]
void address_map_free(address_map *map) { while (map->entrylist != NULL) { address_map_entry *entry = map->entrylist; map->entrylist = entry->next; if (entry->read_devtag_string != NULL) astring_free(entry->read_devtag_string); if (entry->write_devtag_string != NULL) astring_free(entry->write_devtag_string); if (entry->region_string != NULL) astring_free(entry->region_string); free(entry); } free(map); }
[ "void", "address_map_free", "(", "address_map", "*", "map", ")", "{", "while", "(", "map", "->", "entrylist", "!=", "NULL", ")", "{", "address_map_entry", "*", "entry", "=", "map", "->", "entrylist", ";", "map", "->", "entrylist", "=", "entry", "->", "next", ";", "if", "(", "entry", "->", "read_devtag_string", "!=", "NULL", ")", "astring_free", "(", "entry", "->", "read_devtag_string", ")", ";", "if", "(", "entry", "->", "write_devtag_string", "!=", "NULL", ")", "astring_free", "(", "entry", "->", "write_devtag_string", ")", ";", "if", "(", "entry", "->", "region_string", "!=", "NULL", ")", "astring_free", "(", "entry", "->", "region_string", ")", ";", "free", "(", "entry", ")", ";", "}", "free", "(", "map", ")", ";", "}" ]
address_map_free - release allocated memory for an address map
[ "address_map_free", "-", "release", "allocated", "memory", "for", "an", "address", "map" ]
[ "/* free all entries */", "/* free the map */" ]
[ { "param": "map", "type": "address_map" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "map", "type": "address_map", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
memory_set_decrypted_region
void
void memory_set_decrypted_region(const address_space *space, offs_t addrstart, offs_t addrend, void *base) { offs_t bytestart = memory_address_to_byte(space, addrstart); offs_t byteend = memory_address_to_byte_end(space, addrend); int banknum, found = FALSE; /* loop over banks looking for a match */ for (banknum = 0; banknum < STATIC_COUNT; banknum++) { bank_info *bank = &space->machine->memory_data->bankdata[banknum]; /* consider this bank if it is used for reading and matches the address space */ if (bank->used && bank->read && bank_references_space(bank, space)) { /* verify that the region fully covers the decrypted range */ if (bank->bytestart >= bytestart && bank->byteend <= byteend) { /* set the decrypted pointer for the corresponding memory bank */ space->machine->memory_data->bankd_ptr[banknum] = (UINT8 *)base + bank->bytestart - bytestart; found = TRUE; /* if we are executing from here, force an opcode base update */ if (space->direct.entry == banknum) force_opbase_update(space); } /* fatal error if the decrypted region straddles the bank */ else if (bank->bytestart < byteend && bank->byteend > bytestart) fatalerror("memory_set_decrypted_region found straddled region %08X-%08X for device '%s'", bytestart, byteend, space->cpu->tag); } } /* fatal error as well if we didn't find any relevant memory banks */ if (!found) fatalerror("memory_set_decrypted_region unable to find matching region %08X-%08X for device '%s'", bytestart, byteend, space->cpu->tag); }
/*------------------------------------------------- memory_set_decrypted_region - registers an address range as having a decrypted data pointer -------------------------------------------------*/
registers an address range as having a decrypted data pointer
[ "registers", "an", "address", "range", "as", "having", "a", "decrypted", "data", "pointer" ]
void memory_set_decrypted_region(const address_space *space, offs_t addrstart, offs_t addrend, void *base) { offs_t bytestart = memory_address_to_byte(space, addrstart); offs_t byteend = memory_address_to_byte_end(space, addrend); int banknum, found = FALSE; for (banknum = 0; banknum < STATIC_COUNT; banknum++) { bank_info *bank = &space->machine->memory_data->bankdata[banknum]; if (bank->used && bank->read && bank_references_space(bank, space)) { if (bank->bytestart >= bytestart && bank->byteend <= byteend) { space->machine->memory_data->bankd_ptr[banknum] = (UINT8 *)base + bank->bytestart - bytestart; found = TRUE; if (space->direct.entry == banknum) force_opbase_update(space); } else if (bank->bytestart < byteend && bank->byteend > bytestart) fatalerror("memory_set_decrypted_region found straddled region %08X-%08X for device '%s'", bytestart, byteend, space->cpu->tag); } } if (!found) fatalerror("memory_set_decrypted_region unable to find matching region %08X-%08X for device '%s'", bytestart, byteend, space->cpu->tag); }
[ "void", "memory_set_decrypted_region", "(", "const", "address_space", "*", "space", ",", "offs_t", "addrstart", ",", "offs_t", "addrend", ",", "void", "*", "base", ")", "{", "offs_t", "bytestart", "=", "memory_address_to_byte", "(", "space", ",", "addrstart", ")", ";", "offs_t", "byteend", "=", "memory_address_to_byte_end", "(", "space", ",", "addrend", ")", ";", "int", "banknum", ",", "found", "=", "FALSE", ";", "for", "(", "banknum", "=", "0", ";", "banknum", "<", "STATIC_COUNT", ";", "banknum", "++", ")", "{", "bank_info", "*", "bank", "=", "&", "space", "->", "machine", "->", "memory_data", "->", "bankdata", "[", "banknum", "]", ";", "if", "(", "bank", "->", "used", "&&", "bank", "->", "read", "&&", "bank_references_space", "(", "bank", ",", "space", ")", ")", "{", "if", "(", "bank", "->", "bytestart", ">=", "bytestart", "&&", "bank", "->", "byteend", "<=", "byteend", ")", "{", "space", "->", "machine", "->", "memory_data", "->", "bankd_ptr", "[", "banknum", "]", "=", "(", "UINT8", "*", ")", "base", "+", "bank", "->", "bytestart", "-", "bytestart", ";", "found", "=", "TRUE", ";", "if", "(", "space", "->", "direct", ".", "entry", "==", "banknum", ")", "force_opbase_update", "(", "space", ")", ";", "}", "else", "if", "(", "bank", "->", "bytestart", "<", "byteend", "&&", "bank", "->", "byteend", ">", "bytestart", ")", "fatalerror", "(", "\"", "\"", ",", "bytestart", ",", "byteend", ",", "space", "->", "cpu", "->", "tag", ")", ";", "}", "}", "if", "(", "!", "found", ")", "fatalerror", "(", "\"", "\"", ",", "bytestart", ",", "byteend", ",", "space", "->", "cpu", "->", "tag", ")", ";", "}" ]
memory_set_decrypted_region - registers an address range as having a decrypted data pointer
[ "memory_set_decrypted_region", "-", "registers", "an", "address", "range", "as", "having", "a", "decrypted", "data", "pointer" ]
[ "/* loop over banks looking for a match */", "/* consider this bank if it is used for reading and matches the address space */", "/* verify that the region fully covers the decrypted range */", "/* set the decrypted pointer for the corresponding memory bank */", "/* if we are executing from here, force an opcode base update */", "/* fatal error if the decrypted region straddles the bank */", "/* fatal error as well if we didn't find any relevant memory banks */" ]
[ { "param": "space", "type": "address_space" }, { "param": "addrstart", "type": "offs_t" }, { "param": "addrend", "type": "offs_t" }, { "param": "base", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "space", "type": "address_space", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrstart", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrend", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "base", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
memory_set_direct_region
int
int memory_set_direct_region(const address_space *space, offs_t *byteaddress) { memory_private *memdata = space->machine->memory_data; address_space *spacerw = (address_space *)space; UINT8 *base = NULL, *based = NULL; const handler_data *handlers; direct_range *range; offs_t maskedbits; offs_t overrideaddress = *byteaddress; UINT8 entry; /* allow overrides */ if (spacerw->directupdate != NULL) { overrideaddress = (*spacerw->directupdate)(spacerw, overrideaddress, &spacerw->direct); if (overrideaddress == ~0) return TRUE; *byteaddress = overrideaddress; } /* remove the masked bits (we'll put them back later) */ maskedbits = overrideaddress & ~spacerw->bytemask; /* find or allocate a matching range */ range = direct_range_find(spacerw, overrideaddress, &entry); /* keep track of current entry */ spacerw->direct.entry = entry; /* if we don't map to a bank, return FALSE */ if (entry < STATIC_BANK1 || entry >= STATIC_RAM) { /* ensure future updates to land here as well until we get back into a bank */ spacerw->direct.byteend = 0; spacerw->direct.bytestart = 1; if (!spacerw->debugger_access) logerror("Device '%s': warning - attempt to direct-map address %s in %s space\n", space->cpu->tag, core_i64_hex_format(overrideaddress, space->addrchars), space->name); return FALSE; } /* if no decrypted opcodes, point to the same base */ base = memdata->bank_ptr[entry]; based = memdata->bankd_ptr[entry]; if (based == NULL) based = base; /* compute the adjusted base */ handlers = spacerw->read.handlers[entry]; spacerw->direct.bytemask = handlers->bytemask; spacerw->direct.raw = base - (handlers->bytestart & spacerw->direct.bytemask); spacerw->direct.decrypted = based - (handlers->bytestart & spacerw->direct.bytemask); spacerw->direct.bytestart = maskedbits | range->bytestart; spacerw->direct.byteend = maskedbits | range->byteend; return TRUE; }
/*------------------------------------------------- memory_set_direct_region - called by device cores to update the opcode base for the given address -------------------------------------------------*/
called by device cores to update the opcode base for the given address
[ "called", "by", "device", "cores", "to", "update", "the", "opcode", "base", "for", "the", "given", "address" ]
int memory_set_direct_region(const address_space *space, offs_t *byteaddress) { memory_private *memdata = space->machine->memory_data; address_space *spacerw = (address_space *)space; UINT8 *base = NULL, *based = NULL; const handler_data *handlers; direct_range *range; offs_t maskedbits; offs_t overrideaddress = *byteaddress; UINT8 entry; if (spacerw->directupdate != NULL) { overrideaddress = (*spacerw->directupdate)(spacerw, overrideaddress, &spacerw->direct); if (overrideaddress == ~0) return TRUE; *byteaddress = overrideaddress; } maskedbits = overrideaddress & ~spacerw->bytemask; range = direct_range_find(spacerw, overrideaddress, &entry); spacerw->direct.entry = entry; if (entry < STATIC_BANK1 || entry >= STATIC_RAM) { spacerw->direct.byteend = 0; spacerw->direct.bytestart = 1; if (!spacerw->debugger_access) logerror("Device '%s': warning - attempt to direct-map address %s in %s space\n", space->cpu->tag, core_i64_hex_format(overrideaddress, space->addrchars), space->name); return FALSE; } base = memdata->bank_ptr[entry]; based = memdata->bankd_ptr[entry]; if (based == NULL) based = base; handlers = spacerw->read.handlers[entry]; spacerw->direct.bytemask = handlers->bytemask; spacerw->direct.raw = base - (handlers->bytestart & spacerw->direct.bytemask); spacerw->direct.decrypted = based - (handlers->bytestart & spacerw->direct.bytemask); spacerw->direct.bytestart = maskedbits | range->bytestart; spacerw->direct.byteend = maskedbits | range->byteend; return TRUE; }
[ "int", "memory_set_direct_region", "(", "const", "address_space", "*", "space", ",", "offs_t", "*", "byteaddress", ")", "{", "memory_private", "*", "memdata", "=", "space", "->", "machine", "->", "memory_data", ";", "address_space", "*", "spacerw", "=", "(", "address_space", "*", ")", "space", ";", "UINT8", "*", "base", "=", "NULL", ",", "*", "based", "=", "NULL", ";", "const", "handler_data", "*", "handlers", ";", "direct_range", "*", "range", ";", "offs_t", "maskedbits", ";", "offs_t", "overrideaddress", "=", "*", "byteaddress", ";", "UINT8", "entry", ";", "if", "(", "spacerw", "->", "directupdate", "!=", "NULL", ")", "{", "overrideaddress", "=", "(", "*", "spacerw", "->", "directupdate", ")", "(", "spacerw", ",", "overrideaddress", ",", "&", "spacerw", "->", "direct", ")", ";", "if", "(", "overrideaddress", "==", "~", "0", ")", "return", "TRUE", ";", "*", "byteaddress", "=", "overrideaddress", ";", "}", "maskedbits", "=", "overrideaddress", "&", "~", "spacerw", "->", "bytemask", ";", "range", "=", "direct_range_find", "(", "spacerw", ",", "overrideaddress", ",", "&", "entry", ")", ";", "spacerw", "->", "direct", ".", "entry", "=", "entry", ";", "if", "(", "entry", "<", "STATIC_BANK1", "||", "entry", ">=", "STATIC_RAM", ")", "{", "spacerw", "->", "direct", ".", "byteend", "=", "0", ";", "spacerw", "->", "direct", ".", "bytestart", "=", "1", ";", "if", "(", "!", "spacerw", "->", "debugger_access", ")", "logerror", "(", "\"", "\\n", "\"", ",", "space", "->", "cpu", "->", "tag", ",", "core_i64_hex_format", "(", "overrideaddress", ",", "space", "->", "addrchars", ")", ",", "space", "->", "name", ")", ";", "return", "FALSE", ";", "}", "base", "=", "memdata", "->", "bank_ptr", "[", "entry", "]", ";", "based", "=", "memdata", "->", "bankd_ptr", "[", "entry", "]", ";", "if", "(", "based", "==", "NULL", ")", "based", "=", "base", ";", "handlers", "=", "spacerw", "->", "read", ".", "handlers", "[", "entry", "]", ";", "spacerw", "->", "direct", ".", "bytemask", "=", "handlers", "->", "bytemask", ";", "spacerw", "->", "direct", ".", "raw", "=", "base", "-", "(", "handlers", "->", "bytestart", "&", "spacerw", "->", "direct", ".", "bytemask", ")", ";", "spacerw", "->", "direct", ".", "decrypted", "=", "based", "-", "(", "handlers", "->", "bytestart", "&", "spacerw", "->", "direct", ".", "bytemask", ")", ";", "spacerw", "->", "direct", ".", "bytestart", "=", "maskedbits", "|", "range", "->", "bytestart", ";", "spacerw", "->", "direct", ".", "byteend", "=", "maskedbits", "|", "range", "->", "byteend", ";", "return", "TRUE", ";", "}" ]
memory_set_direct_region - called by device cores to update the opcode base for the given address
[ "memory_set_direct_region", "-", "called", "by", "device", "cores", "to", "update", "the", "opcode", "base", "for", "the", "given", "address" ]
[ "/* allow overrides */", "/* remove the masked bits (we'll put them back later) */", "/* find or allocate a matching range */", "/* keep track of current entry */", "/* if we don't map to a bank, return FALSE */", "/* ensure future updates to land here as well until we get back into a bank */", "/* if no decrypted opcodes, point to the same base */", "/* compute the adjusted base */" ]
[ { "param": "space", "type": "address_space" }, { "param": "byteaddress", "type": "offs_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "space", "type": "address_space", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "byteaddress", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
memory_configure_bank
void
void memory_configure_bank(running_machine *machine, int banknum, int startentry, int numentries, void *base, offs_t stride) { memory_private *memdata = machine->memory_data; bank_info *bank = &memdata->bankdata[banknum]; int entrynum; /* validation checks */ if (banknum < STATIC_BANK1 || banknum > MAX_EXPLICIT_BANKS || !bank->used) fatalerror("memory_configure_bank called with invalid bank %d", banknum); if (bank->dynamic) fatalerror("memory_configure_bank called with dynamic bank %d", banknum); if (startentry < 0 || startentry + numentries > MAX_BANK_ENTRIES) fatalerror("memory_configure_bank called with out-of-range entries %d-%d", startentry, startentry + numentries - 1); if (!base) fatalerror("memory_configure_bank called NULL base"); /* fill in the requested bank entries */ for (entrynum = startentry; entrynum < startentry + numentries; entrynum++) bank->entry[entrynum] = (UINT8 *)base + (entrynum - startentry) * stride; /* if we have no bankptr yet, set it to the first entry */ if (memdata->bank_ptr[banknum] == NULL) memdata->bank_ptr[banknum] = (UINT8 *)bank->entry[0]; }
/*------------------------------------------------- memory_configure_bank - configure the addresses for a bank -------------------------------------------------*/
configure the addresses for a bank
[ "configure", "the", "addresses", "for", "a", "bank" ]
void memory_configure_bank(running_machine *machine, int banknum, int startentry, int numentries, void *base, offs_t stride) { memory_private *memdata = machine->memory_data; bank_info *bank = &memdata->bankdata[banknum]; int entrynum; if (banknum < STATIC_BANK1 || banknum > MAX_EXPLICIT_BANKS || !bank->used) fatalerror("memory_configure_bank called with invalid bank %d", banknum); if (bank->dynamic) fatalerror("memory_configure_bank called with dynamic bank %d", banknum); if (startentry < 0 || startentry + numentries > MAX_BANK_ENTRIES) fatalerror("memory_configure_bank called with out-of-range entries %d-%d", startentry, startentry + numentries - 1); if (!base) fatalerror("memory_configure_bank called NULL base"); for (entrynum = startentry; entrynum < startentry + numentries; entrynum++) bank->entry[entrynum] = (UINT8 *)base + (entrynum - startentry) * stride; if (memdata->bank_ptr[banknum] == NULL) memdata->bank_ptr[banknum] = (UINT8 *)bank->entry[0]; }
[ "void", "memory_configure_bank", "(", "running_machine", "*", "machine", ",", "int", "banknum", ",", "int", "startentry", ",", "int", "numentries", ",", "void", "*", "base", ",", "offs_t", "stride", ")", "{", "memory_private", "*", "memdata", "=", "machine", "->", "memory_data", ";", "bank_info", "*", "bank", "=", "&", "memdata", "->", "bankdata", "[", "banknum", "]", ";", "int", "entrynum", ";", "if", "(", "banknum", "<", "STATIC_BANK1", "||", "banknum", ">", "MAX_EXPLICIT_BANKS", "||", "!", "bank", "->", "used", ")", "fatalerror", "(", "\"", "\"", ",", "banknum", ")", ";", "if", "(", "bank", "->", "dynamic", ")", "fatalerror", "(", "\"", "\"", ",", "banknum", ")", ";", "if", "(", "startentry", "<", "0", "||", "startentry", "+", "numentries", ">", "MAX_BANK_ENTRIES", ")", "fatalerror", "(", "\"", "\"", ",", "startentry", ",", "startentry", "+", "numentries", "-", "1", ")", ";", "if", "(", "!", "base", ")", "fatalerror", "(", "\"", "\"", ")", ";", "for", "(", "entrynum", "=", "startentry", ";", "entrynum", "<", "startentry", "+", "numentries", ";", "entrynum", "++", ")", "bank", "->", "entry", "[", "entrynum", "]", "=", "(", "UINT8", "*", ")", "base", "+", "(", "entrynum", "-", "startentry", ")", "*", "stride", ";", "if", "(", "memdata", "->", "bank_ptr", "[", "banknum", "]", "==", "NULL", ")", "memdata", "->", "bank_ptr", "[", "banknum", "]", "=", "(", "UINT8", "*", ")", "bank", "->", "entry", "[", "0", "]", ";", "}" ]
memory_configure_bank - configure the addresses for a bank
[ "memory_configure_bank", "-", "configure", "the", "addresses", "for", "a", "bank" ]
[ "/* validation checks */", "/* fill in the requested bank entries */", "/* if we have no bankptr yet, set it to the first entry */" ]
[ { "param": "machine", "type": "running_machine" }, { "param": "banknum", "type": "int" }, { "param": "startentry", "type": "int" }, { "param": "numentries", "type": "int" }, { "param": "base", "type": "void" }, { "param": "stride", "type": "offs_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "banknum", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "startentry", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "numentries", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "base", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "stride", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
memory_configure_bank_decrypted
void
void memory_configure_bank_decrypted(running_machine *machine, int banknum, int startentry, int numentries, void *base, offs_t stride) { memory_private *memdata = machine->memory_data; bank_info *bank = &memdata->bankdata[banknum]; int entrynum; /* validation checks */ if (banknum < STATIC_BANK1 || banknum > MAX_EXPLICIT_BANKS || !bank->used) fatalerror("memory_configure_bank called with invalid bank %d", banknum); if (bank->dynamic) fatalerror("memory_configure_bank called with dynamic bank %d", banknum); if (startentry < 0 || startentry + numentries > MAX_BANK_ENTRIES) fatalerror("memory_configure_bank called with out-of-range entries %d-%d", startentry, startentry + numentries - 1); if (!base) fatalerror("memory_configure_bank_decrypted called NULL base"); /* fill in the requested bank entries */ for (entrynum = startentry; entrynum < startentry + numentries; entrynum++) bank->entryd[entrynum] = (UINT8 *)base + (entrynum - startentry) * stride; /* if we have no bankptr yet, set it to the first entry */ if (memdata->bankd_ptr[banknum] == NULL) memdata->bankd_ptr[banknum] = (UINT8 *)bank->entryd[0]; }
/*------------------------------------------------- memory_configure_bank_decrypted - configure the decrypted addresses for a bank -------------------------------------------------*/
configure the decrypted addresses for a bank
[ "configure", "the", "decrypted", "addresses", "for", "a", "bank" ]
void memory_configure_bank_decrypted(running_machine *machine, int banknum, int startentry, int numentries, void *base, offs_t stride) { memory_private *memdata = machine->memory_data; bank_info *bank = &memdata->bankdata[banknum]; int entrynum; if (banknum < STATIC_BANK1 || banknum > MAX_EXPLICIT_BANKS || !bank->used) fatalerror("memory_configure_bank called with invalid bank %d", banknum); if (bank->dynamic) fatalerror("memory_configure_bank called with dynamic bank %d", banknum); if (startentry < 0 || startentry + numentries > MAX_BANK_ENTRIES) fatalerror("memory_configure_bank called with out-of-range entries %d-%d", startentry, startentry + numentries - 1); if (!base) fatalerror("memory_configure_bank_decrypted called NULL base"); for (entrynum = startentry; entrynum < startentry + numentries; entrynum++) bank->entryd[entrynum] = (UINT8 *)base + (entrynum - startentry) * stride; if (memdata->bankd_ptr[banknum] == NULL) memdata->bankd_ptr[banknum] = (UINT8 *)bank->entryd[0]; }
[ "void", "memory_configure_bank_decrypted", "(", "running_machine", "*", "machine", ",", "int", "banknum", ",", "int", "startentry", ",", "int", "numentries", ",", "void", "*", "base", ",", "offs_t", "stride", ")", "{", "memory_private", "*", "memdata", "=", "machine", "->", "memory_data", ";", "bank_info", "*", "bank", "=", "&", "memdata", "->", "bankdata", "[", "banknum", "]", ";", "int", "entrynum", ";", "if", "(", "banknum", "<", "STATIC_BANK1", "||", "banknum", ">", "MAX_EXPLICIT_BANKS", "||", "!", "bank", "->", "used", ")", "fatalerror", "(", "\"", "\"", ",", "banknum", ")", ";", "if", "(", "bank", "->", "dynamic", ")", "fatalerror", "(", "\"", "\"", ",", "banknum", ")", ";", "if", "(", "startentry", "<", "0", "||", "startentry", "+", "numentries", ">", "MAX_BANK_ENTRIES", ")", "fatalerror", "(", "\"", "\"", ",", "startentry", ",", "startentry", "+", "numentries", "-", "1", ")", ";", "if", "(", "!", "base", ")", "fatalerror", "(", "\"", "\"", ")", ";", "for", "(", "entrynum", "=", "startentry", ";", "entrynum", "<", "startentry", "+", "numentries", ";", "entrynum", "++", ")", "bank", "->", "entryd", "[", "entrynum", "]", "=", "(", "UINT8", "*", ")", "base", "+", "(", "entrynum", "-", "startentry", ")", "*", "stride", ";", "if", "(", "memdata", "->", "bankd_ptr", "[", "banknum", "]", "==", "NULL", ")", "memdata", "->", "bankd_ptr", "[", "banknum", "]", "=", "(", "UINT8", "*", ")", "bank", "->", "entryd", "[", "0", "]", ";", "}" ]
memory_configure_bank_decrypted - configure the decrypted addresses for a bank
[ "memory_configure_bank_decrypted", "-", "configure", "the", "decrypted", "addresses", "for", "a", "bank" ]
[ "/* validation checks */", "/* fill in the requested bank entries */", "/* if we have no bankptr yet, set it to the first entry */" ]
[ { "param": "machine", "type": "running_machine" }, { "param": "banknum", "type": "int" }, { "param": "startentry", "type": "int" }, { "param": "numentries", "type": "int" }, { "param": "base", "type": "void" }, { "param": "stride", "type": "offs_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "banknum", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "startentry", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "numentries", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "base", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "stride", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
memory_set_bank
void
void memory_set_bank(running_machine *machine, int banknum, int entrynum) { memory_private *memdata = machine->memory_data; bank_info *bank = &memdata->bankdata[banknum]; bank_reference *ref; /* validation checks */ if (banknum < STATIC_BANK1 || banknum > MAX_EXPLICIT_BANKS || !bank->used) fatalerror("memory_set_bank called with invalid bank %d", banknum); if (bank->dynamic) fatalerror("memory_set_bank called with dynamic bank %d", banknum); if (entrynum < 0 || entrynum > MAX_BANK_ENTRIES) fatalerror("memory_set_bank called with out-of-range entry %d", entrynum); if (!bank->entry[entrynum]) fatalerror("memory_set_bank called for bank %d with invalid bank entry %d", banknum, entrynum); /* set the base */ bank->curentry = entrynum; memdata->bank_ptr[banknum] = (UINT8 *)bank->entry[entrynum]; memdata->bankd_ptr[banknum] = (UINT8 *)bank->entryd[entrynum]; /* invalidate all the direct references to any referenced address spaces */ for (ref = bank->reflist; ref != NULL; ref = ref->next) force_opbase_update(ref->space); }
/*------------------------------------------------- memory_set_bank - select one pre-configured entry to be the new bank base -------------------------------------------------*/
select one pre-configured entry to be the new bank base
[ "select", "one", "pre", "-", "configured", "entry", "to", "be", "the", "new", "bank", "base" ]
void memory_set_bank(running_machine *machine, int banknum, int entrynum) { memory_private *memdata = machine->memory_data; bank_info *bank = &memdata->bankdata[banknum]; bank_reference *ref; if (banknum < STATIC_BANK1 || banknum > MAX_EXPLICIT_BANKS || !bank->used) fatalerror("memory_set_bank called with invalid bank %d", banknum); if (bank->dynamic) fatalerror("memory_set_bank called with dynamic bank %d", banknum); if (entrynum < 0 || entrynum > MAX_BANK_ENTRIES) fatalerror("memory_set_bank called with out-of-range entry %d", entrynum); if (!bank->entry[entrynum]) fatalerror("memory_set_bank called for bank %d with invalid bank entry %d", banknum, entrynum); bank->curentry = entrynum; memdata->bank_ptr[banknum] = (UINT8 *)bank->entry[entrynum]; memdata->bankd_ptr[banknum] = (UINT8 *)bank->entryd[entrynum]; for (ref = bank->reflist; ref != NULL; ref = ref->next) force_opbase_update(ref->space); }
[ "void", "memory_set_bank", "(", "running_machine", "*", "machine", ",", "int", "banknum", ",", "int", "entrynum", ")", "{", "memory_private", "*", "memdata", "=", "machine", "->", "memory_data", ";", "bank_info", "*", "bank", "=", "&", "memdata", "->", "bankdata", "[", "banknum", "]", ";", "bank_reference", "*", "ref", ";", "if", "(", "banknum", "<", "STATIC_BANK1", "||", "banknum", ">", "MAX_EXPLICIT_BANKS", "||", "!", "bank", "->", "used", ")", "fatalerror", "(", "\"", "\"", ",", "banknum", ")", ";", "if", "(", "bank", "->", "dynamic", ")", "fatalerror", "(", "\"", "\"", ",", "banknum", ")", ";", "if", "(", "entrynum", "<", "0", "||", "entrynum", ">", "MAX_BANK_ENTRIES", ")", "fatalerror", "(", "\"", "\"", ",", "entrynum", ")", ";", "if", "(", "!", "bank", "->", "entry", "[", "entrynum", "]", ")", "fatalerror", "(", "\"", "\"", ",", "banknum", ",", "entrynum", ")", ";", "bank", "->", "curentry", "=", "entrynum", ";", "memdata", "->", "bank_ptr", "[", "banknum", "]", "=", "(", "UINT8", "*", ")", "bank", "->", "entry", "[", "entrynum", "]", ";", "memdata", "->", "bankd_ptr", "[", "banknum", "]", "=", "(", "UINT8", "*", ")", "bank", "->", "entryd", "[", "entrynum", "]", ";", "for", "(", "ref", "=", "bank", "->", "reflist", ";", "ref", "!=", "NULL", ";", "ref", "=", "ref", "->", "next", ")", "force_opbase_update", "(", "ref", "->", "space", ")", ";", "}" ]
memory_set_bank - select one pre-configured entry to be the new bank base
[ "memory_set_bank", "-", "select", "one", "pre", "-", "configured", "entry", "to", "be", "the", "new", "bank", "base" ]
[ "/* validation checks */", "/* set the base */", "/* invalidate all the direct references to any referenced address spaces */" ]
[ { "param": "machine", "type": "running_machine" }, { "param": "banknum", "type": "int" }, { "param": "entrynum", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "banknum", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "entrynum", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
memory_set_bankptr
void
void memory_set_bankptr(running_machine *machine, int banknum, void *base) { memory_private *memdata = machine->memory_data; bank_info *bank = &memdata->bankdata[banknum]; bank_reference *ref; /* validation checks */ if (banknum < STATIC_BANK1 || banknum > MAX_EXPLICIT_BANKS || !bank->used) fatalerror("memory_set_bankptr called with invalid bank %d", banknum); if (bank->dynamic) fatalerror("memory_set_bankptr called with dynamic bank %d", banknum); if (base == NULL) fatalerror("memory_set_bankptr called NULL base"); if (ALLOW_ONLY_AUTO_MALLOC_BANKS) validate_auto_malloc_memory(base, bank->byteend - bank->bytestart + 1); /* set the base */ memdata->bank_ptr[banknum] = (UINT8 *)base; /* invalidate all the direct references to any referenced address spaces */ for (ref = bank->reflist; ref != NULL; ref = ref->next) force_opbase_update(ref->space); }
/*------------------------------------------------- memory_set_bankptr - set the base of a bank -------------------------------------------------*/
set the base of a bank
[ "set", "the", "base", "of", "a", "bank" ]
void memory_set_bankptr(running_machine *machine, int banknum, void *base) { memory_private *memdata = machine->memory_data; bank_info *bank = &memdata->bankdata[banknum]; bank_reference *ref; if (banknum < STATIC_BANK1 || banknum > MAX_EXPLICIT_BANKS || !bank->used) fatalerror("memory_set_bankptr called with invalid bank %d", banknum); if (bank->dynamic) fatalerror("memory_set_bankptr called with dynamic bank %d", banknum); if (base == NULL) fatalerror("memory_set_bankptr called NULL base"); if (ALLOW_ONLY_AUTO_MALLOC_BANKS) validate_auto_malloc_memory(base, bank->byteend - bank->bytestart + 1); memdata->bank_ptr[banknum] = (UINT8 *)base; for (ref = bank->reflist; ref != NULL; ref = ref->next) force_opbase_update(ref->space); }
[ "void", "memory_set_bankptr", "(", "running_machine", "*", "machine", ",", "int", "banknum", ",", "void", "*", "base", ")", "{", "memory_private", "*", "memdata", "=", "machine", "->", "memory_data", ";", "bank_info", "*", "bank", "=", "&", "memdata", "->", "bankdata", "[", "banknum", "]", ";", "bank_reference", "*", "ref", ";", "if", "(", "banknum", "<", "STATIC_BANK1", "||", "banknum", ">", "MAX_EXPLICIT_BANKS", "||", "!", "bank", "->", "used", ")", "fatalerror", "(", "\"", "\"", ",", "banknum", ")", ";", "if", "(", "bank", "->", "dynamic", ")", "fatalerror", "(", "\"", "\"", ",", "banknum", ")", ";", "if", "(", "base", "==", "NULL", ")", "fatalerror", "(", "\"", "\"", ")", ";", "if", "(", "ALLOW_ONLY_AUTO_MALLOC_BANKS", ")", "validate_auto_malloc_memory", "(", "base", ",", "bank", "->", "byteend", "-", "bank", "->", "bytestart", "+", "1", ")", ";", "memdata", "->", "bank_ptr", "[", "banknum", "]", "=", "(", "UINT8", "*", ")", "base", ";", "for", "(", "ref", "=", "bank", "->", "reflist", ";", "ref", "!=", "NULL", ";", "ref", "=", "ref", "->", "next", ")", "force_opbase_update", "(", "ref", "->", "space", ")", ";", "}" ]
memory_set_bankptr - set the base of a bank
[ "memory_set_bankptr", "-", "set", "the", "base", "of", "a", "bank" ]
[ "/* validation checks */", "/* set the base */", "/* invalidate all the direct references to any referenced address spaces */" ]
[ { "param": "machine", "type": "running_machine" }, { "param": "banknum", "type": "int" }, { "param": "base", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "banknum", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "base", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
memory_find_unused_bank
int
int memory_find_unused_bank(running_machine *machine) { memory_private *memdata = machine->memory_data; int banknum; for (banknum = STATIC_BANK1; banknum <= MAX_EXPLICIT_BANKS; banknum++) if (!memdata->bankdata[banknum].used) return banknum; return -1; }
/*------------------------------------------------- memory_find_unused_bank - return the index of an unused bank -------------------------------------------------*/
return the index of an unused bank
[ "return", "the", "index", "of", "an", "unused", "bank" ]
int memory_find_unused_bank(running_machine *machine) { memory_private *memdata = machine->memory_data; int banknum; for (banknum = STATIC_BANK1; banknum <= MAX_EXPLICIT_BANKS; banknum++) if (!memdata->bankdata[banknum].used) return banknum; return -1; }
[ "int", "memory_find_unused_bank", "(", "running_machine", "*", "machine", ")", "{", "memory_private", "*", "memdata", "=", "machine", "->", "memory_data", ";", "int", "banknum", ";", "for", "(", "banknum", "=", "STATIC_BANK1", ";", "banknum", "<=", "MAX_EXPLICIT_BANKS", ";", "banknum", "++", ")", "if", "(", "!", "memdata", "->", "bankdata", "[", "banknum", "]", ".", "used", ")", "return", "banknum", ";", "return", "-1", ";", "}" ]
memory_find_unused_bank - return the index of an unused bank
[ "memory_find_unused_bank", "-", "return", "the", "index", "of", "an", "unused", "bank" ]
[]
[ { "param": "machine", "type": "running_machine" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
_memory_install_handler
void
void *_memory_install_handler(const address_space *space, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, FPTR rhandler, FPTR whandler, const char *rhandler_name, const char *whandler_name) { address_space *spacerw = (address_space *)space; if (rhandler >= STATIC_COUNT || whandler >= STATIC_COUNT) fatalerror("fatal: can only use static banks with memory_install_handler()"); if (rhandler != 0) space_map_range(spacerw, ROW_READ, spacerw->dbits, 0, addrstart, addrend, addrmask, addrmirror, (genf *)(FPTR)rhandler, spacerw, rhandler_name); if (whandler != 0) space_map_range(spacerw, ROW_WRITE, spacerw->dbits, 0, addrstart, addrend, addrmask, addrmirror, (genf *)(FPTR)whandler, spacerw, whandler_name); mem_dump(space->machine); return space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); }
/*------------------------------------------------- _memory_install_handler - install a new memory handler into the given address space, returning a pointer to the memory backing it, if present -------------------------------------------------*/
install a new memory handler into the given address space, returning a pointer to the memory backing it, if present
[ "install", "a", "new", "memory", "handler", "into", "the", "given", "address", "space", "returning", "a", "pointer", "to", "the", "memory", "backing", "it", "if", "present" ]
void *_memory_install_handler(const address_space *space, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, FPTR rhandler, FPTR whandler, const char *rhandler_name, const char *whandler_name) { address_space *spacerw = (address_space *)space; if (rhandler >= STATIC_COUNT || whandler >= STATIC_COUNT) fatalerror("fatal: can only use static banks with memory_install_handler()"); if (rhandler != 0) space_map_range(spacerw, ROW_READ, spacerw->dbits, 0, addrstart, addrend, addrmask, addrmirror, (genf *)(FPTR)rhandler, spacerw, rhandler_name); if (whandler != 0) space_map_range(spacerw, ROW_WRITE, spacerw->dbits, 0, addrstart, addrend, addrmask, addrmirror, (genf *)(FPTR)whandler, spacerw, whandler_name); mem_dump(space->machine); return space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); }
[ "void", "*", "_memory_install_handler", "(", "const", "address_space", "*", "space", ",", "offs_t", "addrstart", ",", "offs_t", "addrend", ",", "offs_t", "addrmask", ",", "offs_t", "addrmirror", ",", "FPTR", "rhandler", ",", "FPTR", "whandler", ",", "const", "char", "*", "rhandler_name", ",", "const", "char", "*", "whandler_name", ")", "{", "address_space", "*", "spacerw", "=", "(", "address_space", "*", ")", "space", ";", "if", "(", "rhandler", ">=", "STATIC_COUNT", "||", "whandler", ">=", "STATIC_COUNT", ")", "fatalerror", "(", "\"", "\"", ")", ";", "if", "(", "rhandler", "!=", "0", ")", "space_map_range", "(", "spacerw", ",", "ROW_READ", ",", "spacerw", "->", "dbits", ",", "0", ",", "addrstart", ",", "addrend", ",", "addrmask", ",", "addrmirror", ",", "(", "genf", "*", ")", "(", "FPTR", ")", "rhandler", ",", "spacerw", ",", "rhandler_name", ")", ";", "if", "(", "whandler", "!=", "0", ")", "space_map_range", "(", "spacerw", ",", "ROW_WRITE", ",", "spacerw", "->", "dbits", ",", "0", ",", "addrstart", ",", "addrend", ",", "addrmask", ",", "addrmirror", ",", "(", "genf", "*", ")", "(", "FPTR", ")", "whandler", ",", "spacerw", ",", "whandler_name", ")", ";", "mem_dump", "(", "space", "->", "machine", ")", ";", "return", "space_find_backing_memory", "(", "spacerw", ",", "memory_address_to_byte", "(", "spacerw", ",", "addrstart", ")", ")", ";", "}" ]
_memory_install_handler - install a new memory handler into the given address space, returning a pointer to the memory backing it, if present
[ "_memory_install_handler", "-", "install", "a", "new", "memory", "handler", "into", "the", "given", "address", "space", "returning", "a", "pointer", "to", "the", "memory", "backing", "it", "if", "present" ]
[]
[ { "param": "space", "type": "address_space" }, { "param": "addrstart", "type": "offs_t" }, { "param": "addrend", "type": "offs_t" }, { "param": "addrmask", "type": "offs_t" }, { "param": "addrmirror", "type": "offs_t" }, { "param": "rhandler", "type": "FPTR" }, { "param": "whandler", "type": "FPTR" }, { "param": "rhandler_name", "type": "char" }, { "param": "whandler_name", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "space", "type": "address_space", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrstart", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrend", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrmask", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrmirror", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rhandler", "type": "FPTR", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "whandler", "type": "FPTR", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rhandler_name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "whandler_name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
_memory_install_handler8
UINT8
UINT8 *_memory_install_handler8(const address_space *space, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read8_space_func rhandler, write8_space_func whandler, const char *rhandler_name, const char *whandler_name) { address_space *spacerw = (address_space *)space; if (rhandler != NULL) space_map_range(spacerw, ROW_READ, 8, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, spacerw, rhandler_name); if (whandler != NULL) space_map_range(spacerw, ROW_WRITE, 8, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, spacerw, whandler_name); mem_dump(space->machine); return (UINT8 *)space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); }
/*------------------------------------------------- _memory_install_handler8 - same as above but explicitly for 8-bit handlers -------------------------------------------------*/
same as above but explicitly for 8-bit handlers
[ "same", "as", "above", "but", "explicitly", "for", "8", "-", "bit", "handlers" ]
UINT8 *_memory_install_handler8(const address_space *space, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read8_space_func rhandler, write8_space_func whandler, const char *rhandler_name, const char *whandler_name) { address_space *spacerw = (address_space *)space; if (rhandler != NULL) space_map_range(spacerw, ROW_READ, 8, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, spacerw, rhandler_name); if (whandler != NULL) space_map_range(spacerw, ROW_WRITE, 8, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, spacerw, whandler_name); mem_dump(space->machine); return (UINT8 *)space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); }
[ "UINT8", "*", "_memory_install_handler8", "(", "const", "address_space", "*", "space", ",", "offs_t", "addrstart", ",", "offs_t", "addrend", ",", "offs_t", "addrmask", ",", "offs_t", "addrmirror", ",", "read8_space_func", "rhandler", ",", "write8_space_func", "whandler", ",", "const", "char", "*", "rhandler_name", ",", "const", "char", "*", "whandler_name", ")", "{", "address_space", "*", "spacerw", "=", "(", "address_space", "*", ")", "space", ";", "if", "(", "rhandler", "!=", "NULL", ")", "space_map_range", "(", "spacerw", ",", "ROW_READ", ",", "8", ",", "0", ",", "addrstart", ",", "addrend", ",", "addrmask", ",", "addrmirror", ",", "(", "genf", "*", ")", "rhandler", ",", "spacerw", ",", "rhandler_name", ")", ";", "if", "(", "whandler", "!=", "NULL", ")", "space_map_range", "(", "spacerw", ",", "ROW_WRITE", ",", "8", ",", "0", ",", "addrstart", ",", "addrend", ",", "addrmask", ",", "addrmirror", ",", "(", "genf", "*", ")", "whandler", ",", "spacerw", ",", "whandler_name", ")", ";", "mem_dump", "(", "space", "->", "machine", ")", ";", "return", "(", "UINT8", "*", ")", "space_find_backing_memory", "(", "spacerw", ",", "memory_address_to_byte", "(", "spacerw", ",", "addrstart", ")", ")", ";", "}" ]
_memory_install_handler8 - same as above but explicitly for 8-bit handlers
[ "_memory_install_handler8", "-", "same", "as", "above", "but", "explicitly", "for", "8", "-", "bit", "handlers" ]
[]
[ { "param": "space", "type": "address_space" }, { "param": "addrstart", "type": "offs_t" }, { "param": "addrend", "type": "offs_t" }, { "param": "addrmask", "type": "offs_t" }, { "param": "addrmirror", "type": "offs_t" }, { "param": "rhandler", "type": "read8_space_func" }, { "param": "whandler", "type": "write8_space_func" }, { "param": "rhandler_name", "type": "char" }, { "param": "whandler_name", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "space", "type": "address_space", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrstart", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrend", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrmask", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrmirror", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rhandler", "type": "read8_space_func", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "whandler", "type": "write8_space_func", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rhandler_name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "whandler_name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
_memory_install_handler16
UINT16
UINT16 *_memory_install_handler16(const address_space *space, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read16_space_func rhandler, write16_space_func whandler, const char *rhandler_name, const char *whandler_name) { address_space *spacerw = (address_space *)space; if (rhandler != NULL) space_map_range(spacerw, ROW_READ, 16, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, spacerw, rhandler_name); if (whandler != NULL) space_map_range(spacerw, ROW_WRITE, 16, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, spacerw, whandler_name); mem_dump(space->machine); return (UINT16 *)space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); }
/*------------------------------------------------- _memory_install_handler16 - same as above but explicitly for 16-bit handlers -------------------------------------------------*/
same as above but explicitly for 16-bit handlers
[ "same", "as", "above", "but", "explicitly", "for", "16", "-", "bit", "handlers" ]
UINT16 *_memory_install_handler16(const address_space *space, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read16_space_func rhandler, write16_space_func whandler, const char *rhandler_name, const char *whandler_name) { address_space *spacerw = (address_space *)space; if (rhandler != NULL) space_map_range(spacerw, ROW_READ, 16, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, spacerw, rhandler_name); if (whandler != NULL) space_map_range(spacerw, ROW_WRITE, 16, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, spacerw, whandler_name); mem_dump(space->machine); return (UINT16 *)space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); }
[ "UINT16", "*", "_memory_install_handler16", "(", "const", "address_space", "*", "space", ",", "offs_t", "addrstart", ",", "offs_t", "addrend", ",", "offs_t", "addrmask", ",", "offs_t", "addrmirror", ",", "read16_space_func", "rhandler", ",", "write16_space_func", "whandler", ",", "const", "char", "*", "rhandler_name", ",", "const", "char", "*", "whandler_name", ")", "{", "address_space", "*", "spacerw", "=", "(", "address_space", "*", ")", "space", ";", "if", "(", "rhandler", "!=", "NULL", ")", "space_map_range", "(", "spacerw", ",", "ROW_READ", ",", "16", ",", "0", ",", "addrstart", ",", "addrend", ",", "addrmask", ",", "addrmirror", ",", "(", "genf", "*", ")", "rhandler", ",", "spacerw", ",", "rhandler_name", ")", ";", "if", "(", "whandler", "!=", "NULL", ")", "space_map_range", "(", "spacerw", ",", "ROW_WRITE", ",", "16", ",", "0", ",", "addrstart", ",", "addrend", ",", "addrmask", ",", "addrmirror", ",", "(", "genf", "*", ")", "whandler", ",", "spacerw", ",", "whandler_name", ")", ";", "mem_dump", "(", "space", "->", "machine", ")", ";", "return", "(", "UINT16", "*", ")", "space_find_backing_memory", "(", "spacerw", ",", "memory_address_to_byte", "(", "spacerw", ",", "addrstart", ")", ")", ";", "}" ]
_memory_install_handler16 - same as above but explicitly for 16-bit handlers
[ "_memory_install_handler16", "-", "same", "as", "above", "but", "explicitly", "for", "16", "-", "bit", "handlers" ]
[]
[ { "param": "space", "type": "address_space" }, { "param": "addrstart", "type": "offs_t" }, { "param": "addrend", "type": "offs_t" }, { "param": "addrmask", "type": "offs_t" }, { "param": "addrmirror", "type": "offs_t" }, { "param": "rhandler", "type": "read16_space_func" }, { "param": "whandler", "type": "write16_space_func" }, { "param": "rhandler_name", "type": "char" }, { "param": "whandler_name", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "space", "type": "address_space", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrstart", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrend", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrmask", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrmirror", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rhandler", "type": "read16_space_func", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "whandler", "type": "write16_space_func", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rhandler_name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "whandler_name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
_memory_install_handler32
UINT32
UINT32 *_memory_install_handler32(const address_space *space, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read32_space_func rhandler, write32_space_func whandler, const char *rhandler_name, const char *whandler_name) { address_space *spacerw = (address_space *)space; if (rhandler != NULL) space_map_range(spacerw, ROW_READ, 32, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, spacerw, rhandler_name); if (whandler != NULL) space_map_range(spacerw, ROW_WRITE, 32, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, spacerw, whandler_name); mem_dump(space->machine); return (UINT32 *)space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); }
/*------------------------------------------------- _memory_install_handler32 - same as above but explicitly for 32-bit handlers -------------------------------------------------*/
same as above but explicitly for 32-bit handlers
[ "same", "as", "above", "but", "explicitly", "for", "32", "-", "bit", "handlers" ]
UINT32 *_memory_install_handler32(const address_space *space, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read32_space_func rhandler, write32_space_func whandler, const char *rhandler_name, const char *whandler_name) { address_space *spacerw = (address_space *)space; if (rhandler != NULL) space_map_range(spacerw, ROW_READ, 32, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, spacerw, rhandler_name); if (whandler != NULL) space_map_range(spacerw, ROW_WRITE, 32, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, spacerw, whandler_name); mem_dump(space->machine); return (UINT32 *)space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); }
[ "UINT32", "*", "_memory_install_handler32", "(", "const", "address_space", "*", "space", ",", "offs_t", "addrstart", ",", "offs_t", "addrend", ",", "offs_t", "addrmask", ",", "offs_t", "addrmirror", ",", "read32_space_func", "rhandler", ",", "write32_space_func", "whandler", ",", "const", "char", "*", "rhandler_name", ",", "const", "char", "*", "whandler_name", ")", "{", "address_space", "*", "spacerw", "=", "(", "address_space", "*", ")", "space", ";", "if", "(", "rhandler", "!=", "NULL", ")", "space_map_range", "(", "spacerw", ",", "ROW_READ", ",", "32", ",", "0", ",", "addrstart", ",", "addrend", ",", "addrmask", ",", "addrmirror", ",", "(", "genf", "*", ")", "rhandler", ",", "spacerw", ",", "rhandler_name", ")", ";", "if", "(", "whandler", "!=", "NULL", ")", "space_map_range", "(", "spacerw", ",", "ROW_WRITE", ",", "32", ",", "0", ",", "addrstart", ",", "addrend", ",", "addrmask", ",", "addrmirror", ",", "(", "genf", "*", ")", "whandler", ",", "spacerw", ",", "whandler_name", ")", ";", "mem_dump", "(", "space", "->", "machine", ")", ";", "return", "(", "UINT32", "*", ")", "space_find_backing_memory", "(", "spacerw", ",", "memory_address_to_byte", "(", "spacerw", ",", "addrstart", ")", ")", ";", "}" ]
_memory_install_handler32 - same as above but explicitly for 32-bit handlers
[ "_memory_install_handler32", "-", "same", "as", "above", "but", "explicitly", "for", "32", "-", "bit", "handlers" ]
[]
[ { "param": "space", "type": "address_space" }, { "param": "addrstart", "type": "offs_t" }, { "param": "addrend", "type": "offs_t" }, { "param": "addrmask", "type": "offs_t" }, { "param": "addrmirror", "type": "offs_t" }, { "param": "rhandler", "type": "read32_space_func" }, { "param": "whandler", "type": "write32_space_func" }, { "param": "rhandler_name", "type": "char" }, { "param": "whandler_name", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "space", "type": "address_space", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrstart", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrend", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrmask", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrmirror", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rhandler", "type": "read32_space_func", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "whandler", "type": "write32_space_func", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rhandler_name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "whandler_name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
_memory_install_handler64
UINT64
UINT64 *_memory_install_handler64(const address_space *space, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read64_space_func rhandler, write64_space_func whandler, const char *rhandler_name, const char *whandler_name) { address_space *spacerw = (address_space *)space; if (rhandler != NULL) space_map_range(spacerw, ROW_READ, 64, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, spacerw, rhandler_name); if (whandler != NULL) space_map_range(spacerw, ROW_WRITE, 64, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, spacerw, whandler_name); mem_dump(space->machine); return (UINT64 *)space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); }
/*------------------------------------------------- _memory_install_handler64 - same as above but explicitly for 64-bit handlers -------------------------------------------------*/
same as above but explicitly for 64-bit handlers
[ "same", "as", "above", "but", "explicitly", "for", "64", "-", "bit", "handlers" ]
UINT64 *_memory_install_handler64(const address_space *space, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read64_space_func rhandler, write64_space_func whandler, const char *rhandler_name, const char *whandler_name) { address_space *spacerw = (address_space *)space; if (rhandler != NULL) space_map_range(spacerw, ROW_READ, 64, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, spacerw, rhandler_name); if (whandler != NULL) space_map_range(spacerw, ROW_WRITE, 64, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, spacerw, whandler_name); mem_dump(space->machine); return (UINT64 *)space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); }
[ "UINT64", "*", "_memory_install_handler64", "(", "const", "address_space", "*", "space", ",", "offs_t", "addrstart", ",", "offs_t", "addrend", ",", "offs_t", "addrmask", ",", "offs_t", "addrmirror", ",", "read64_space_func", "rhandler", ",", "write64_space_func", "whandler", ",", "const", "char", "*", "rhandler_name", ",", "const", "char", "*", "whandler_name", ")", "{", "address_space", "*", "spacerw", "=", "(", "address_space", "*", ")", "space", ";", "if", "(", "rhandler", "!=", "NULL", ")", "space_map_range", "(", "spacerw", ",", "ROW_READ", ",", "64", ",", "0", ",", "addrstart", ",", "addrend", ",", "addrmask", ",", "addrmirror", ",", "(", "genf", "*", ")", "rhandler", ",", "spacerw", ",", "rhandler_name", ")", ";", "if", "(", "whandler", "!=", "NULL", ")", "space_map_range", "(", "spacerw", ",", "ROW_WRITE", ",", "64", ",", "0", ",", "addrstart", ",", "addrend", ",", "addrmask", ",", "addrmirror", ",", "(", "genf", "*", ")", "whandler", ",", "spacerw", ",", "whandler_name", ")", ";", "mem_dump", "(", "space", "->", "machine", ")", ";", "return", "(", "UINT64", "*", ")", "space_find_backing_memory", "(", "spacerw", ",", "memory_address_to_byte", "(", "spacerw", ",", "addrstart", ")", ")", ";", "}" ]
_memory_install_handler64 - same as above but explicitly for 64-bit handlers
[ "_memory_install_handler64", "-", "same", "as", "above", "but", "explicitly", "for", "64", "-", "bit", "handlers" ]
[]
[ { "param": "space", "type": "address_space" }, { "param": "addrstart", "type": "offs_t" }, { "param": "addrend", "type": "offs_t" }, { "param": "addrmask", "type": "offs_t" }, { "param": "addrmirror", "type": "offs_t" }, { "param": "rhandler", "type": "read64_space_func" }, { "param": "whandler", "type": "write64_space_func" }, { "param": "rhandler_name", "type": "char" }, { "param": "whandler_name", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "space", "type": "address_space", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrstart", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrend", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrmask", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrmirror", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rhandler", "type": "read64_space_func", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "whandler", "type": "write64_space_func", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rhandler_name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "whandler_name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
_memory_install_device_handler
void
void *_memory_install_device_handler(const address_space *space, const device_config *device, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, FPTR rhandler, FPTR whandler, const char *rhandler_name, const char *whandler_name) { address_space *spacerw = (address_space *)space; if (rhandler >= STATIC_COUNT || whandler >= STATIC_COUNT) fatalerror("fatal: can only use static banks with memory_install_device_handler()"); if (rhandler != 0) space_map_range(spacerw, ROW_READ, spacerw->dbits, 0, addrstart, addrend, addrmask, addrmirror, (genf *)(FPTR)rhandler, (void *)device, rhandler_name); if (whandler != 0) space_map_range(spacerw, ROW_WRITE, spacerw->dbits, 0, addrstart, addrend, addrmask, addrmirror, (genf *)(FPTR)whandler, (void *)device, whandler_name); mem_dump(space->machine); return space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); }
/*------------------------------------------------- _memory_install_device_handler - install a new device memory handler into the given address space, returning a pointer to the memory backing it, if present -------------------------------------------------*/
install a new device memory handler into the given address space, returning a pointer to the memory backing it, if present
[ "install", "a", "new", "device", "memory", "handler", "into", "the", "given", "address", "space", "returning", "a", "pointer", "to", "the", "memory", "backing", "it", "if", "present" ]
void *_memory_install_device_handler(const address_space *space, const device_config *device, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, FPTR rhandler, FPTR whandler, const char *rhandler_name, const char *whandler_name) { address_space *spacerw = (address_space *)space; if (rhandler >= STATIC_COUNT || whandler >= STATIC_COUNT) fatalerror("fatal: can only use static banks with memory_install_device_handler()"); if (rhandler != 0) space_map_range(spacerw, ROW_READ, spacerw->dbits, 0, addrstart, addrend, addrmask, addrmirror, (genf *)(FPTR)rhandler, (void *)device, rhandler_name); if (whandler != 0) space_map_range(spacerw, ROW_WRITE, spacerw->dbits, 0, addrstart, addrend, addrmask, addrmirror, (genf *)(FPTR)whandler, (void *)device, whandler_name); mem_dump(space->machine); return space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); }
[ "void", "*", "_memory_install_device_handler", "(", "const", "address_space", "*", "space", ",", "const", "device_config", "*", "device", ",", "offs_t", "addrstart", ",", "offs_t", "addrend", ",", "offs_t", "addrmask", ",", "offs_t", "addrmirror", ",", "FPTR", "rhandler", ",", "FPTR", "whandler", ",", "const", "char", "*", "rhandler_name", ",", "const", "char", "*", "whandler_name", ")", "{", "address_space", "*", "spacerw", "=", "(", "address_space", "*", ")", "space", ";", "if", "(", "rhandler", ">=", "STATIC_COUNT", "||", "whandler", ">=", "STATIC_COUNT", ")", "fatalerror", "(", "\"", "\"", ")", ";", "if", "(", "rhandler", "!=", "0", ")", "space_map_range", "(", "spacerw", ",", "ROW_READ", ",", "spacerw", "->", "dbits", ",", "0", ",", "addrstart", ",", "addrend", ",", "addrmask", ",", "addrmirror", ",", "(", "genf", "*", ")", "(", "FPTR", ")", "rhandler", ",", "(", "void", "*", ")", "device", ",", "rhandler_name", ")", ";", "if", "(", "whandler", "!=", "0", ")", "space_map_range", "(", "spacerw", ",", "ROW_WRITE", ",", "spacerw", "->", "dbits", ",", "0", ",", "addrstart", ",", "addrend", ",", "addrmask", ",", "addrmirror", ",", "(", "genf", "*", ")", "(", "FPTR", ")", "whandler", ",", "(", "void", "*", ")", "device", ",", "whandler_name", ")", ";", "mem_dump", "(", "space", "->", "machine", ")", ";", "return", "space_find_backing_memory", "(", "spacerw", ",", "memory_address_to_byte", "(", "spacerw", ",", "addrstart", ")", ")", ";", "}" ]
_memory_install_device_handler - install a new device memory handler into the given address space, returning a pointer to the memory backing it, if present
[ "_memory_install_device_handler", "-", "install", "a", "new", "device", "memory", "handler", "into", "the", "given", "address", "space", "returning", "a", "pointer", "to", "the", "memory", "backing", "it", "if", "present" ]
[]
[ { "param": "space", "type": "address_space" }, { "param": "device", "type": "device_config" }, { "param": "addrstart", "type": "offs_t" }, { "param": "addrend", "type": "offs_t" }, { "param": "addrmask", "type": "offs_t" }, { "param": "addrmirror", "type": "offs_t" }, { "param": "rhandler", "type": "FPTR" }, { "param": "whandler", "type": "FPTR" }, { "param": "rhandler_name", "type": "char" }, { "param": "whandler_name", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "space", "type": "address_space", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "device", "type": "device_config", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrstart", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrend", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrmask", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrmirror", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rhandler", "type": "FPTR", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "whandler", "type": "FPTR", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rhandler_name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "whandler_name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
_memory_install_device_handler8
UINT8
UINT8 *_memory_install_device_handler8(const address_space *space, const device_config *device, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read8_device_func rhandler, write8_device_func whandler, const char *rhandler_name, const char *whandler_name) { address_space *spacerw = (address_space *)space; if (rhandler != NULL) space_map_range(spacerw, ROW_READ, 8, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, (void *)device, rhandler_name); if (whandler != NULL) space_map_range(spacerw, ROW_WRITE, 8, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name); mem_dump(space->machine); return (UINT8 *)space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); }
/*------------------------------------------------- _memory_install_device_handler8 - same as above but explicitly for 8-bit handlers -------------------------------------------------*/
same as above but explicitly for 8-bit handlers
[ "same", "as", "above", "but", "explicitly", "for", "8", "-", "bit", "handlers" ]
UINT8 *_memory_install_device_handler8(const address_space *space, const device_config *device, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read8_device_func rhandler, write8_device_func whandler, const char *rhandler_name, const char *whandler_name) { address_space *spacerw = (address_space *)space; if (rhandler != NULL) space_map_range(spacerw, ROW_READ, 8, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, (void *)device, rhandler_name); if (whandler != NULL) space_map_range(spacerw, ROW_WRITE, 8, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name); mem_dump(space->machine); return (UINT8 *)space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); }
[ "UINT8", "*", "_memory_install_device_handler8", "(", "const", "address_space", "*", "space", ",", "const", "device_config", "*", "device", ",", "offs_t", "addrstart", ",", "offs_t", "addrend", ",", "offs_t", "addrmask", ",", "offs_t", "addrmirror", ",", "read8_device_func", "rhandler", ",", "write8_device_func", "whandler", ",", "const", "char", "*", "rhandler_name", ",", "const", "char", "*", "whandler_name", ")", "{", "address_space", "*", "spacerw", "=", "(", "address_space", "*", ")", "space", ";", "if", "(", "rhandler", "!=", "NULL", ")", "space_map_range", "(", "spacerw", ",", "ROW_READ", ",", "8", ",", "0", ",", "addrstart", ",", "addrend", ",", "addrmask", ",", "addrmirror", ",", "(", "genf", "*", ")", "rhandler", ",", "(", "void", "*", ")", "device", ",", "rhandler_name", ")", ";", "if", "(", "whandler", "!=", "NULL", ")", "space_map_range", "(", "spacerw", ",", "ROW_WRITE", ",", "8", ",", "0", ",", "addrstart", ",", "addrend", ",", "addrmask", ",", "addrmirror", ",", "(", "genf", "*", ")", "whandler", ",", "(", "void", "*", ")", "device", ",", "whandler_name", ")", ";", "mem_dump", "(", "space", "->", "machine", ")", ";", "return", "(", "UINT8", "*", ")", "space_find_backing_memory", "(", "spacerw", ",", "memory_address_to_byte", "(", "spacerw", ",", "addrstart", ")", ")", ";", "}" ]
_memory_install_device_handler8 - same as above but explicitly for 8-bit handlers
[ "_memory_install_device_handler8", "-", "same", "as", "above", "but", "explicitly", "for", "8", "-", "bit", "handlers" ]
[]
[ { "param": "space", "type": "address_space" }, { "param": "device", "type": "device_config" }, { "param": "addrstart", "type": "offs_t" }, { "param": "addrend", "type": "offs_t" }, { "param": "addrmask", "type": "offs_t" }, { "param": "addrmirror", "type": "offs_t" }, { "param": "rhandler", "type": "read8_device_func" }, { "param": "whandler", "type": "write8_device_func" }, { "param": "rhandler_name", "type": "char" }, { "param": "whandler_name", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "space", "type": "address_space", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "device", "type": "device_config", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrstart", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrend", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrmask", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrmirror", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rhandler", "type": "read8_device_func", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "whandler", "type": "write8_device_func", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rhandler_name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "whandler_name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
_memory_install_device_handler16
UINT16
UINT16 *_memory_install_device_handler16(const address_space *space, const device_config *device, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read16_device_func rhandler, write16_device_func whandler, const char *rhandler_name, const char *whandler_name) { address_space *spacerw = (address_space *)space; if (rhandler != NULL) space_map_range(spacerw, ROW_READ, 16, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, (void *)device, rhandler_name); if (whandler != NULL) space_map_range(spacerw, ROW_WRITE, 16, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name); mem_dump(space->machine); return (UINT16 *)space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); }
/*------------------------------------------------- _memory_install_device_handler16 - same as above but explicitly for 16-bit handlers -------------------------------------------------*/
same as above but explicitly for 16-bit handlers
[ "same", "as", "above", "but", "explicitly", "for", "16", "-", "bit", "handlers" ]
UINT16 *_memory_install_device_handler16(const address_space *space, const device_config *device, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read16_device_func rhandler, write16_device_func whandler, const char *rhandler_name, const char *whandler_name) { address_space *spacerw = (address_space *)space; if (rhandler != NULL) space_map_range(spacerw, ROW_READ, 16, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, (void *)device, rhandler_name); if (whandler != NULL) space_map_range(spacerw, ROW_WRITE, 16, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name); mem_dump(space->machine); return (UINT16 *)space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); }
[ "UINT16", "*", "_memory_install_device_handler16", "(", "const", "address_space", "*", "space", ",", "const", "device_config", "*", "device", ",", "offs_t", "addrstart", ",", "offs_t", "addrend", ",", "offs_t", "addrmask", ",", "offs_t", "addrmirror", ",", "read16_device_func", "rhandler", ",", "write16_device_func", "whandler", ",", "const", "char", "*", "rhandler_name", ",", "const", "char", "*", "whandler_name", ")", "{", "address_space", "*", "spacerw", "=", "(", "address_space", "*", ")", "space", ";", "if", "(", "rhandler", "!=", "NULL", ")", "space_map_range", "(", "spacerw", ",", "ROW_READ", ",", "16", ",", "0", ",", "addrstart", ",", "addrend", ",", "addrmask", ",", "addrmirror", ",", "(", "genf", "*", ")", "rhandler", ",", "(", "void", "*", ")", "device", ",", "rhandler_name", ")", ";", "if", "(", "whandler", "!=", "NULL", ")", "space_map_range", "(", "spacerw", ",", "ROW_WRITE", ",", "16", ",", "0", ",", "addrstart", ",", "addrend", ",", "addrmask", ",", "addrmirror", ",", "(", "genf", "*", ")", "whandler", ",", "(", "void", "*", ")", "device", ",", "whandler_name", ")", ";", "mem_dump", "(", "space", "->", "machine", ")", ";", "return", "(", "UINT16", "*", ")", "space_find_backing_memory", "(", "spacerw", ",", "memory_address_to_byte", "(", "spacerw", ",", "addrstart", ")", ")", ";", "}" ]
_memory_install_device_handler16 - same as above but explicitly for 16-bit handlers
[ "_memory_install_device_handler16", "-", "same", "as", "above", "but", "explicitly", "for", "16", "-", "bit", "handlers" ]
[]
[ { "param": "space", "type": "address_space" }, { "param": "device", "type": "device_config" }, { "param": "addrstart", "type": "offs_t" }, { "param": "addrend", "type": "offs_t" }, { "param": "addrmask", "type": "offs_t" }, { "param": "addrmirror", "type": "offs_t" }, { "param": "rhandler", "type": "read16_device_func" }, { "param": "whandler", "type": "write16_device_func" }, { "param": "rhandler_name", "type": "char" }, { "param": "whandler_name", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "space", "type": "address_space", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "device", "type": "device_config", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrstart", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrend", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrmask", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrmirror", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rhandler", "type": "read16_device_func", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "whandler", "type": "write16_device_func", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rhandler_name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "whandler_name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
_memory_install_device_handler32
UINT32
UINT32 *_memory_install_device_handler32(const address_space *space, const device_config *device, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read32_device_func rhandler, write32_device_func whandler, const char *rhandler_name, const char *whandler_name) { address_space *spacerw = (address_space *)space; if (rhandler != NULL) space_map_range(spacerw, ROW_READ, 32, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, (void *)device, rhandler_name); if (whandler != NULL) space_map_range(spacerw, ROW_WRITE, 32, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name); mem_dump(space->machine); return (UINT32 *)space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); }
/*------------------------------------------------- _memory_install_device_handler32 - same as above but explicitly for 32-bit handlers -------------------------------------------------*/
same as above but explicitly for 32-bit handlers
[ "same", "as", "above", "but", "explicitly", "for", "32", "-", "bit", "handlers" ]
UINT32 *_memory_install_device_handler32(const address_space *space, const device_config *device, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read32_device_func rhandler, write32_device_func whandler, const char *rhandler_name, const char *whandler_name) { address_space *spacerw = (address_space *)space; if (rhandler != NULL) space_map_range(spacerw, ROW_READ, 32, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, (void *)device, rhandler_name); if (whandler != NULL) space_map_range(spacerw, ROW_WRITE, 32, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name); mem_dump(space->machine); return (UINT32 *)space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); }
[ "UINT32", "*", "_memory_install_device_handler32", "(", "const", "address_space", "*", "space", ",", "const", "device_config", "*", "device", ",", "offs_t", "addrstart", ",", "offs_t", "addrend", ",", "offs_t", "addrmask", ",", "offs_t", "addrmirror", ",", "read32_device_func", "rhandler", ",", "write32_device_func", "whandler", ",", "const", "char", "*", "rhandler_name", ",", "const", "char", "*", "whandler_name", ")", "{", "address_space", "*", "spacerw", "=", "(", "address_space", "*", ")", "space", ";", "if", "(", "rhandler", "!=", "NULL", ")", "space_map_range", "(", "spacerw", ",", "ROW_READ", ",", "32", ",", "0", ",", "addrstart", ",", "addrend", ",", "addrmask", ",", "addrmirror", ",", "(", "genf", "*", ")", "rhandler", ",", "(", "void", "*", ")", "device", ",", "rhandler_name", ")", ";", "if", "(", "whandler", "!=", "NULL", ")", "space_map_range", "(", "spacerw", ",", "ROW_WRITE", ",", "32", ",", "0", ",", "addrstart", ",", "addrend", ",", "addrmask", ",", "addrmirror", ",", "(", "genf", "*", ")", "whandler", ",", "(", "void", "*", ")", "device", ",", "whandler_name", ")", ";", "mem_dump", "(", "space", "->", "machine", ")", ";", "return", "(", "UINT32", "*", ")", "space_find_backing_memory", "(", "spacerw", ",", "memory_address_to_byte", "(", "spacerw", ",", "addrstart", ")", ")", ";", "}" ]
_memory_install_device_handler32 - same as above but explicitly for 32-bit handlers
[ "_memory_install_device_handler32", "-", "same", "as", "above", "but", "explicitly", "for", "32", "-", "bit", "handlers" ]
[]
[ { "param": "space", "type": "address_space" }, { "param": "device", "type": "device_config" }, { "param": "addrstart", "type": "offs_t" }, { "param": "addrend", "type": "offs_t" }, { "param": "addrmask", "type": "offs_t" }, { "param": "addrmirror", "type": "offs_t" }, { "param": "rhandler", "type": "read32_device_func" }, { "param": "whandler", "type": "write32_device_func" }, { "param": "rhandler_name", "type": "char" }, { "param": "whandler_name", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "space", "type": "address_space", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "device", "type": "device_config", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrstart", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrend", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrmask", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrmirror", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rhandler", "type": "read32_device_func", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "whandler", "type": "write32_device_func", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rhandler_name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "whandler_name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
_memory_install_device_handler64
UINT64
UINT64 *_memory_install_device_handler64(const address_space *space, const device_config *device, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read64_device_func rhandler, write64_device_func whandler, const char *rhandler_name, const char *whandler_name) { address_space *spacerw = (address_space *)space; if (rhandler != NULL) space_map_range(spacerw, ROW_READ, 64, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, (void *)device, rhandler_name); if (whandler != NULL) space_map_range(spacerw, ROW_WRITE, 64, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name); mem_dump(space->machine); return (UINT64 *)space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); }
/*------------------------------------------------- _memory_install_device_handler64 - same as above but explicitly for 64-bit handlers -------------------------------------------------*/
same as above but explicitly for 64-bit handlers
[ "same", "as", "above", "but", "explicitly", "for", "64", "-", "bit", "handlers" ]
UINT64 *_memory_install_device_handler64(const address_space *space, const device_config *device, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, read64_device_func rhandler, write64_device_func whandler, const char *rhandler_name, const char *whandler_name) { address_space *spacerw = (address_space *)space; if (rhandler != NULL) space_map_range(spacerw, ROW_READ, 64, 0, addrstart, addrend, addrmask, addrmirror, (genf *)rhandler, (void *)device, rhandler_name); if (whandler != NULL) space_map_range(spacerw, ROW_WRITE, 64, 0, addrstart, addrend, addrmask, addrmirror, (genf *)whandler, (void *)device, whandler_name); mem_dump(space->machine); return (UINT64 *)space_find_backing_memory(spacerw, memory_address_to_byte(spacerw, addrstart)); }
[ "UINT64", "*", "_memory_install_device_handler64", "(", "const", "address_space", "*", "space", ",", "const", "device_config", "*", "device", ",", "offs_t", "addrstart", ",", "offs_t", "addrend", ",", "offs_t", "addrmask", ",", "offs_t", "addrmirror", ",", "read64_device_func", "rhandler", ",", "write64_device_func", "whandler", ",", "const", "char", "*", "rhandler_name", ",", "const", "char", "*", "whandler_name", ")", "{", "address_space", "*", "spacerw", "=", "(", "address_space", "*", ")", "space", ";", "if", "(", "rhandler", "!=", "NULL", ")", "space_map_range", "(", "spacerw", ",", "ROW_READ", ",", "64", ",", "0", ",", "addrstart", ",", "addrend", ",", "addrmask", ",", "addrmirror", ",", "(", "genf", "*", ")", "rhandler", ",", "(", "void", "*", ")", "device", ",", "rhandler_name", ")", ";", "if", "(", "whandler", "!=", "NULL", ")", "space_map_range", "(", "spacerw", ",", "ROW_WRITE", ",", "64", ",", "0", ",", "addrstart", ",", "addrend", ",", "addrmask", ",", "addrmirror", ",", "(", "genf", "*", ")", "whandler", ",", "(", "void", "*", ")", "device", ",", "whandler_name", ")", ";", "mem_dump", "(", "space", "->", "machine", ")", ";", "return", "(", "UINT64", "*", ")", "space_find_backing_memory", "(", "spacerw", ",", "memory_address_to_byte", "(", "spacerw", ",", "addrstart", ")", ")", ";", "}" ]
_memory_install_device_handler64 - same as above but explicitly for 64-bit handlers
[ "_memory_install_device_handler64", "-", "same", "as", "above", "but", "explicitly", "for", "64", "-", "bit", "handlers" ]
[]
[ { "param": "space", "type": "address_space" }, { "param": "device", "type": "device_config" }, { "param": "addrstart", "type": "offs_t" }, { "param": "addrend", "type": "offs_t" }, { "param": "addrmask", "type": "offs_t" }, { "param": "addrmirror", "type": "offs_t" }, { "param": "rhandler", "type": "read64_device_func" }, { "param": "whandler", "type": "write64_device_func" }, { "param": "rhandler_name", "type": "char" }, { "param": "whandler_name", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "space", "type": "address_space", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "device", "type": "device_config", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrstart", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrend", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrmask", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrmirror", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rhandler", "type": "read64_device_func", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "whandler", "type": "write64_device_func", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "rhandler_name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "whandler_name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
memory_install_read_port_handler
void
void memory_install_read_port_handler(const address_space *space, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, const char *tag) { const input_port_config *port = input_port_by_tag(space->machine->portconfig, tag); address_space *spacerw = (address_space *)space; genf *handler = NULL; if (port == NULL) fatalerror("Non-existent port referenced: '%s'\n", tag); switch (space->dbits) { case 8: handler = (genf *)input_port_read8; break; case 16: handler = (genf *)input_port_read16; break; case 32: handler = (genf *)input_port_read32; break; case 64: handler = (genf *)input_port_read64; break; } space_map_range(spacerw, ROW_READ, space->dbits, 0, addrstart, addrend, addrmask, addrmirror, handler, (void *)port, tag); }
/*------------------------------------------------- memory_install_read_port_handler - install a new 8-bit input port handler into the given address space -------------------------------------------------*/
install a new 8-bit input port handler into the given address space
[ "install", "a", "new", "8", "-", "bit", "input", "port", "handler", "into", "the", "given", "address", "space" ]
void memory_install_read_port_handler(const address_space *space, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, const char *tag) { const input_port_config *port = input_port_by_tag(space->machine->portconfig, tag); address_space *spacerw = (address_space *)space; genf *handler = NULL; if (port == NULL) fatalerror("Non-existent port referenced: '%s'\n", tag); switch (space->dbits) { case 8: handler = (genf *)input_port_read8; break; case 16: handler = (genf *)input_port_read16; break; case 32: handler = (genf *)input_port_read32; break; case 64: handler = (genf *)input_port_read64; break; } space_map_range(spacerw, ROW_READ, space->dbits, 0, addrstart, addrend, addrmask, addrmirror, handler, (void *)port, tag); }
[ "void", "memory_install_read_port_handler", "(", "const", "address_space", "*", "space", ",", "offs_t", "addrstart", ",", "offs_t", "addrend", ",", "offs_t", "addrmask", ",", "offs_t", "addrmirror", ",", "const", "char", "*", "tag", ")", "{", "const", "input_port_config", "*", "port", "=", "input_port_by_tag", "(", "space", "->", "machine", "->", "portconfig", ",", "tag", ")", ";", "address_space", "*", "spacerw", "=", "(", "address_space", "*", ")", "space", ";", "genf", "*", "handler", "=", "NULL", ";", "if", "(", "port", "==", "NULL", ")", "fatalerror", "(", "\"", "\\n", "\"", ",", "tag", ")", ";", "switch", "(", "space", "->", "dbits", ")", "{", "case", "8", ":", "handler", "=", "(", "genf", "*", ")", "input_port_read8", ";", "break", ";", "case", "16", ":", "handler", "=", "(", "genf", "*", ")", "input_port_read16", ";", "break", ";", "case", "32", ":", "handler", "=", "(", "genf", "*", ")", "input_port_read32", ";", "break", ";", "case", "64", ":", "handler", "=", "(", "genf", "*", ")", "input_port_read64", ";", "break", ";", "}", "space_map_range", "(", "spacerw", ",", "ROW_READ", ",", "space", "->", "dbits", ",", "0", ",", "addrstart", ",", "addrend", ",", "addrmask", ",", "addrmirror", ",", "handler", ",", "(", "void", "*", ")", "port", ",", "tag", ")", ";", "}" ]
memory_install_read_port_handler - install a new 8-bit input port handler into the given address space
[ "memory_install_read_port_handler", "-", "install", "a", "new", "8", "-", "bit", "input", "port", "handler", "into", "the", "given", "address", "space" ]
[]
[ { "param": "space", "type": "address_space" }, { "param": "addrstart", "type": "offs_t" }, { "param": "addrend", "type": "offs_t" }, { "param": "addrmask", "type": "offs_t" }, { "param": "addrmirror", "type": "offs_t" }, { "param": "tag", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "space", "type": "address_space", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrstart", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrend", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrmask", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrmirror", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "tag", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
memory_get_handler_string
char
const char *memory_get_handler_string(const address_space *space, int read0_or_write1, offs_t byteaddress) { const address_table *table = read0_or_write1 ? &space->write : &space->read; UINT8 entry; /* perform the lookup */ byteaddress &= space->bytemask; entry = table->table[LEVEL1_INDEX(byteaddress)]; if (entry >= SUBTABLE_BASE) entry = table->table[LEVEL2_INDEX(entry, byteaddress)]; /* 8-bit case: RAM/ROM */ return handler_to_string(table, entry); }
/*------------------------------------------------- memory_get_handler_string - return a string describing the handler at a particular offset -------------------------------------------------*/
return a string describing the handler at a particular offset
[ "return", "a", "string", "describing", "the", "handler", "at", "a", "particular", "offset" ]
const char *memory_get_handler_string(const address_space *space, int read0_or_write1, offs_t byteaddress) { const address_table *table = read0_or_write1 ? &space->write : &space->read; UINT8 entry; byteaddress &= space->bytemask; entry = table->table[LEVEL1_INDEX(byteaddress)]; if (entry >= SUBTABLE_BASE) entry = table->table[LEVEL2_INDEX(entry, byteaddress)]; return handler_to_string(table, entry); }
[ "const", "char", "*", "memory_get_handler_string", "(", "const", "address_space", "*", "space", ",", "int", "read0_or_write1", ",", "offs_t", "byteaddress", ")", "{", "const", "address_table", "*", "table", "=", "read0_or_write1", "?", "&", "space", "->", "write", ":", "&", "space", "->", "read", ";", "UINT8", "entry", ";", "byteaddress", "&=", "space", "->", "bytemask", ";", "entry", "=", "table", "->", "table", "[", "LEVEL1_INDEX", "(", "byteaddress", ")", "]", ";", "if", "(", "entry", ">=", "SUBTABLE_BASE", ")", "entry", "=", "table", "->", "table", "[", "LEVEL2_INDEX", "(", "entry", ",", "byteaddress", ")", "]", ";", "return", "handler_to_string", "(", "table", ",", "entry", ")", ";", "}" ]
memory_get_handler_string - return a string describing the handler at a particular offset
[ "memory_get_handler_string", "-", "return", "a", "string", "describing", "the", "handler", "at", "a", "particular", "offset" ]
[ "/* perform the lookup */", "/* 8-bit case: RAM/ROM */" ]
[ { "param": "space", "type": "address_space" }, { "param": "read0_or_write1", "type": "int" }, { "param": "byteaddress", "type": "offs_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "space", "type": "address_space", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "read0_or_write1", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "byteaddress", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
memory_dump
void
void memory_dump(running_machine *machine, FILE *file) { memory_private *memdata = machine->memory_data; const address_space *space; /* skip if we can't open the file */ if (!file) return; /* loop over valid address spaces */ for (space = memdata->spacelist; space != NULL; space = space->next) { fprintf(file, "\n\n" "====================================================\n" "Device '%s' %s address space read handler dump\n" "====================================================\n", space->cpu->tag, space->name); dump_map(file, space, &space->read); fprintf(file, "\n\n" "====================================================\n" "Device '%s' %s address space write handler dump\n" "====================================================\n", space->cpu->tag, space->name); dump_map(file, space, &space->read); } }
/*------------------------------------------------- memory_dump - dump the internal memory tables to the given file -------------------------------------------------*/
dump the internal memory tables to the given file
[ "dump", "the", "internal", "memory", "tables", "to", "the", "given", "file" ]
void memory_dump(running_machine *machine, FILE *file) { memory_private *memdata = machine->memory_data; const address_space *space; if (!file) return; for (space = memdata->spacelist; space != NULL; space = space->next) { fprintf(file, "\n\n" "====================================================\n" "Device '%s' %s address space read handler dump\n" "====================================================\n", space->cpu->tag, space->name); dump_map(file, space, &space->read); fprintf(file, "\n\n" "====================================================\n" "Device '%s' %s address space write handler dump\n" "====================================================\n", space->cpu->tag, space->name); dump_map(file, space, &space->read); } }
[ "void", "memory_dump", "(", "running_machine", "*", "machine", ",", "FILE", "*", "file", ")", "{", "memory_private", "*", "memdata", "=", "machine", "->", "memory_data", ";", "const", "address_space", "*", "space", ";", "if", "(", "!", "file", ")", "return", ";", "for", "(", "space", "=", "memdata", "->", "spacelist", ";", "space", "!=", "NULL", ";", "space", "=", "space", "->", "next", ")", "{", "fprintf", "(", "file", ",", "\"", "\\n", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", ",", "space", "->", "cpu", "->", "tag", ",", "space", "->", "name", ")", ";", "dump_map", "(", "file", ",", "space", ",", "&", "space", "->", "read", ")", ";", "fprintf", "(", "file", ",", "\"", "\\n", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", ",", "space", "->", "cpu", "->", "tag", ",", "space", "->", "name", ")", ";", "dump_map", "(", "file", ",", "space", ",", "&", "space", "->", "read", ")", ";", "}", "}" ]
memory_dump - dump the internal memory tables to the given file
[ "memory_dump", "-", "dump", "the", "internal", "memory", "tables", "to", "the", "given", "file" ]
[ "/* skip if we can't open the file */", "/* loop over valid address spaces */" ]
[ { "param": "machine", "type": "running_machine" }, { "param": "file", "type": "FILE" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "file", "type": "FILE", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
memory_init_preflight
void
static void memory_init_preflight(running_machine *machine) { memory_private *memdata = machine->memory_data; address_space *space; /* zap the bank data */ memset(&memdata->bankdata, 0, sizeof(memdata->bankdata)); /* loop over valid address spaces */ for (space = (address_space *)memdata->spacelist; space != NULL; space = (address_space *)space->next) { int regionsize = (space->spacenum == ADDRESS_SPACE_0) ? memory_region_length(space->machine, space->cpu->tag) : 0; address_map_entry *entry; int entrynum; /* allocate the address map */ space->map = address_map_alloc(space->cpu, machine->gamedrv, space->spacenum); /* extract global parameters specified by the map */ space->unmap = (space->map->unmapval == 0) ? 0 : ~0; if (space->map->globalmask != 0) { space->addrmask = space->map->globalmask; space->bytemask = memory_address_to_byte_end(space, space->addrmask); } /* make a pass over the address map, adjusting for the device and getting memory pointers */ for (entry = space->map->entrylist; entry != NULL; entry = entry->next) { /* computed adjusted addresses first */ entry->bytestart = entry->addrstart; entry->byteend = entry->addrend; entry->bytemirror = entry->addrmirror; entry->bytemask = entry->addrmask; adjust_addresses(space, &entry->bytestart, &entry->byteend, &entry->bytemask, &entry->bytemirror); /* if this is a ROM handler without a specified region, attach it to the implicit region */ if (space->spacenum == ADDRESS_SPACE_0 && HANDLER_IS_ROM(entry->read.generic) && entry->region == NULL) { /* make sure it fits within the memory region before doing so, however */ if (entry->byteend < regionsize) { entry->region = space->cpu->tag; entry->rgnoffs = entry->bytestart; } } /* validate adjusted addresses against implicit regions */ if (entry->region != NULL && entry->share == 0 && entry->baseptr == NULL) { UINT8 *base = memory_region(machine, entry->region); offs_t length = memory_region_length(machine, entry->region); /* validate the region */ if (base == NULL) fatalerror("Error: device '%s' %s space memory map entry %X-%X references non-existant region \"%s\"", space->cpu->tag, space->name, entry->addrstart, entry->addrend, entry->region); if (entry->rgnoffs + (entry->byteend - entry->bytestart + 1) > length) fatalerror("Error: device '%s' %s space memory map entry %X-%X extends beyond region \"%s\" size (%X)", space->cpu->tag, space->name, entry->addrstart, entry->addrend, entry->region, length); } /* convert any region-relative entries to their memory pointers */ if (entry->region != NULL) entry->memory = memory_region(machine, entry->region) + entry->rgnoffs; /* assign static banks for explicitly specified entries */ if (HANDLER_IS_BANK(entry->read.generic)) bank_assign_static(HANDLER_TO_BANK(entry->read.generic), space, ROW_READ, entry->bytestart, entry->byteend); if (HANDLER_IS_BANK(entry->write.generic)) bank_assign_static(HANDLER_TO_BANK(entry->write.generic), space, ROW_WRITE, entry->bytestart, entry->byteend); } /* now loop over all the handlers and enforce the address mask */ /* we don't loop over map entries because the mask applies to static handlers as well */ for (entrynum = 0; entrynum < ENTRY_COUNT; entrynum++) { space->read.handlers[entrynum]->bytemask &= space->bytemask; space->write.handlers[entrynum]->bytemask &= space->bytemask; } } }
/*------------------------------------------------- memory_init_preflight - verify the memory structs and track which banks are referenced -------------------------------------------------*/
verify the memory structs and track which banks are referenced
[ "verify", "the", "memory", "structs", "and", "track", "which", "banks", "are", "referenced" ]
static void memory_init_preflight(running_machine *machine) { memory_private *memdata = machine->memory_data; address_space *space; memset(&memdata->bankdata, 0, sizeof(memdata->bankdata)); for (space = (address_space *)memdata->spacelist; space != NULL; space = (address_space *)space->next) { int regionsize = (space->spacenum == ADDRESS_SPACE_0) ? memory_region_length(space->machine, space->cpu->tag) : 0; address_map_entry *entry; int entrynum; space->map = address_map_alloc(space->cpu, machine->gamedrv, space->spacenum); space->unmap = (space->map->unmapval == 0) ? 0 : ~0; if (space->map->globalmask != 0) { space->addrmask = space->map->globalmask; space->bytemask = memory_address_to_byte_end(space, space->addrmask); } for (entry = space->map->entrylist; entry != NULL; entry = entry->next) { entry->bytestart = entry->addrstart; entry->byteend = entry->addrend; entry->bytemirror = entry->addrmirror; entry->bytemask = entry->addrmask; adjust_addresses(space, &entry->bytestart, &entry->byteend, &entry->bytemask, &entry->bytemirror); if (space->spacenum == ADDRESS_SPACE_0 && HANDLER_IS_ROM(entry->read.generic) && entry->region == NULL) { if (entry->byteend < regionsize) { entry->region = space->cpu->tag; entry->rgnoffs = entry->bytestart; } } if (entry->region != NULL && entry->share == 0 && entry->baseptr == NULL) { UINT8 *base = memory_region(machine, entry->region); offs_t length = memory_region_length(machine, entry->region); if (base == NULL) fatalerror("Error: device '%s' %s space memory map entry %X-%X references non-existant region \"%s\"", space->cpu->tag, space->name, entry->addrstart, entry->addrend, entry->region); if (entry->rgnoffs + (entry->byteend - entry->bytestart + 1) > length) fatalerror("Error: device '%s' %s space memory map entry %X-%X extends beyond region \"%s\" size (%X)", space->cpu->tag, space->name, entry->addrstart, entry->addrend, entry->region, length); } if (entry->region != NULL) entry->memory = memory_region(machine, entry->region) + entry->rgnoffs; if (HANDLER_IS_BANK(entry->read.generic)) bank_assign_static(HANDLER_TO_BANK(entry->read.generic), space, ROW_READ, entry->bytestart, entry->byteend); if (HANDLER_IS_BANK(entry->write.generic)) bank_assign_static(HANDLER_TO_BANK(entry->write.generic), space, ROW_WRITE, entry->bytestart, entry->byteend); } for (entrynum = 0; entrynum < ENTRY_COUNT; entrynum++) { space->read.handlers[entrynum]->bytemask &= space->bytemask; space->write.handlers[entrynum]->bytemask &= space->bytemask; } } }
[ "static", "void", "memory_init_preflight", "(", "running_machine", "*", "machine", ")", "{", "memory_private", "*", "memdata", "=", "machine", "->", "memory_data", ";", "address_space", "*", "space", ";", "memset", "(", "&", "memdata", "->", "bankdata", ",", "0", ",", "sizeof", "(", "memdata", "->", "bankdata", ")", ")", ";", "for", "(", "space", "=", "(", "address_space", "*", ")", "memdata", "->", "spacelist", ";", "space", "!=", "NULL", ";", "space", "=", "(", "address_space", "*", ")", "space", "->", "next", ")", "{", "int", "regionsize", "=", "(", "space", "->", "spacenum", "==", "ADDRESS_SPACE_0", ")", "?", "memory_region_length", "(", "space", "->", "machine", ",", "space", "->", "cpu", "->", "tag", ")", ":", "0", ";", "address_map_entry", "*", "entry", ";", "int", "entrynum", ";", "space", "->", "map", "=", "address_map_alloc", "(", "space", "->", "cpu", ",", "machine", "->", "gamedrv", ",", "space", "->", "spacenum", ")", ";", "space", "->", "unmap", "=", "(", "space", "->", "map", "->", "unmapval", "==", "0", ")", "?", "0", ":", "~", "0", ";", "if", "(", "space", "->", "map", "->", "globalmask", "!=", "0", ")", "{", "space", "->", "addrmask", "=", "space", "->", "map", "->", "globalmask", ";", "space", "->", "bytemask", "=", "memory_address_to_byte_end", "(", "space", ",", "space", "->", "addrmask", ")", ";", "}", "for", "(", "entry", "=", "space", "->", "map", "->", "entrylist", ";", "entry", "!=", "NULL", ";", "entry", "=", "entry", "->", "next", ")", "{", "entry", "->", "bytestart", "=", "entry", "->", "addrstart", ";", "entry", "->", "byteend", "=", "entry", "->", "addrend", ";", "entry", "->", "bytemirror", "=", "entry", "->", "addrmirror", ";", "entry", "->", "bytemask", "=", "entry", "->", "addrmask", ";", "adjust_addresses", "(", "space", ",", "&", "entry", "->", "bytestart", ",", "&", "entry", "->", "byteend", ",", "&", "entry", "->", "bytemask", ",", "&", "entry", "->", "bytemirror", ")", ";", "if", "(", "space", "->", "spacenum", "==", "ADDRESS_SPACE_0", "&&", "HANDLER_IS_ROM", "(", "entry", "->", "read", ".", "generic", ")", "&&", "entry", "->", "region", "==", "NULL", ")", "{", "if", "(", "entry", "->", "byteend", "<", "regionsize", ")", "{", "entry", "->", "region", "=", "space", "->", "cpu", "->", "tag", ";", "entry", "->", "rgnoffs", "=", "entry", "->", "bytestart", ";", "}", "}", "if", "(", "entry", "->", "region", "!=", "NULL", "&&", "entry", "->", "share", "==", "0", "&&", "entry", "->", "baseptr", "==", "NULL", ")", "{", "UINT8", "*", "base", "=", "memory_region", "(", "machine", ",", "entry", "->", "region", ")", ";", "offs_t", "length", "=", "memory_region_length", "(", "machine", ",", "entry", "->", "region", ")", ";", "if", "(", "base", "==", "NULL", ")", "fatalerror", "(", "\"", "\\\"", "\\\"", "\"", ",", "space", "->", "cpu", "->", "tag", ",", "space", "->", "name", ",", "entry", "->", "addrstart", ",", "entry", "->", "addrend", ",", "entry", "->", "region", ")", ";", "if", "(", "entry", "->", "rgnoffs", "+", "(", "entry", "->", "byteend", "-", "entry", "->", "bytestart", "+", "1", ")", ">", "length", ")", "fatalerror", "(", "\"", "\\\"", "\\\"", "\"", ",", "space", "->", "cpu", "->", "tag", ",", "space", "->", "name", ",", "entry", "->", "addrstart", ",", "entry", "->", "addrend", ",", "entry", "->", "region", ",", "length", ")", ";", "}", "if", "(", "entry", "->", "region", "!=", "NULL", ")", "entry", "->", "memory", "=", "memory_region", "(", "machine", ",", "entry", "->", "region", ")", "+", "entry", "->", "rgnoffs", ";", "if", "(", "HANDLER_IS_BANK", "(", "entry", "->", "read", ".", "generic", ")", ")", "bank_assign_static", "(", "HANDLER_TO_BANK", "(", "entry", "->", "read", ".", "generic", ")", ",", "space", ",", "ROW_READ", ",", "entry", "->", "bytestart", ",", "entry", "->", "byteend", ")", ";", "if", "(", "HANDLER_IS_BANK", "(", "entry", "->", "write", ".", "generic", ")", ")", "bank_assign_static", "(", "HANDLER_TO_BANK", "(", "entry", "->", "write", ".", "generic", ")", ",", "space", ",", "ROW_WRITE", ",", "entry", "->", "bytestart", ",", "entry", "->", "byteend", ")", ";", "}", "for", "(", "entrynum", "=", "0", ";", "entrynum", "<", "ENTRY_COUNT", ";", "entrynum", "++", ")", "{", "space", "->", "read", ".", "handlers", "[", "entrynum", "]", "->", "bytemask", "&=", "space", "->", "bytemask", ";", "space", "->", "write", ".", "handlers", "[", "entrynum", "]", "->", "bytemask", "&=", "space", "->", "bytemask", ";", "}", "}", "}" ]
memory_init_preflight - verify the memory structs and track which banks are referenced
[ "memory_init_preflight", "-", "verify", "the", "memory", "structs", "and", "track", "which", "banks", "are", "referenced" ]
[ "/* zap the bank data */", "/* loop over valid address spaces */", "/* allocate the address map */", "/* extract global parameters specified by the map */", "/* make a pass over the address map, adjusting for the device and getting memory pointers */", "/* computed adjusted addresses first */", "/* if this is a ROM handler without a specified region, attach it to the implicit region */", "/* make sure it fits within the memory region before doing so, however */", "/* validate adjusted addresses against implicit regions */", "/* validate the region */", "/* convert any region-relative entries to their memory pointers */", "/* assign static banks for explicitly specified entries */", "/* now loop over all the handlers and enforce the address mask */", "/* we don't loop over map entries because the mask applies to static handlers as well */" ]
[ { "param": "machine", "type": "running_machine" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
memory_init_populate
void
static void memory_init_populate(running_machine *machine) { memory_private *memdata = machine->memory_data; address_space *space; /* loop over valid address spaces */ for (space = (address_space *)memdata->spacelist; space != NULL; space = (address_space *)space->next) if (space->map != NULL) { const address_map_entry *last_entry = NULL; /* install the handlers, using the original, unadjusted memory map */ while (last_entry != space->map->entrylist) { const address_map_entry *entry; read_handler rhandler; write_handler whandler; /* find the entry before the last one we processed */ for (entry = space->map->entrylist; entry->next != last_entry; entry = entry->next) ; last_entry = entry; rhandler = entry->read; whandler = entry->write; /* if we have a read port tag, look it up */ if (entry->read_porttag != NULL) { const input_port_config *port = input_port_by_tag(machine->portconfig, entry->read_porttag); int bits = (entry->read_bits == 0) ? space->dbits : entry->read_bits; genf *handler = NULL; if (port == NULL) fatalerror("Non-existent port referenced: '%s'\n", entry->read_porttag); switch (bits) { case 8: handler = (genf *)input_port_read8; break; case 16: handler = (genf *)input_port_read16; break; case 32: handler = (genf *)input_port_read32; break; case 64: handler = (genf *)input_port_read64; break; } space_map_range_private(space, ROW_READ, bits, entry->read_mask, entry->addrstart, entry->addrend, entry->addrmask, entry->addrmirror, handler, (void *)port, entry->read_porttag); } /* install the read handler if present */ if (rhandler.generic != NULL) { int bits = (entry->read_bits == 0) ? space->dbits : entry->read_bits; void *object = space; if (entry->read_devtag != NULL) { object = (void *)device_list_find_by_tag(machine->config->devicelist, entry->read_devtag); if (object == NULL) fatalerror("Unidentified object in memory map: tag=%s\n", entry->read_devtag); } space_map_range_private(space, ROW_READ, bits, entry->read_mask, entry->addrstart, entry->addrend, entry->addrmask, entry->addrmirror, rhandler.generic, object, entry->read_name); } /* install the write handler if present */ if (whandler.generic != NULL) { int bits = (entry->write_bits == 0) ? space->dbits : entry->write_bits; void *object = space; if (entry->write_devtag != NULL) { object = (void *)device_list_find_by_tag(machine->config->devicelist, entry->write_devtag); if (object == NULL) fatalerror("Unidentified object in memory map: tag=%s\n", entry->write_devtag); } space_map_range_private(space, ROW_WRITE, bits, entry->write_mask, entry->addrstart, entry->addrend, entry->addrmask, entry->addrmirror, whandler.generic, object, entry->write_name); } } } }
/*------------------------------------------------- memory_init_populate - populate the memory mapping tables with entries -------------------------------------------------*/
populate the memory mapping tables with entries
[ "populate", "the", "memory", "mapping", "tables", "with", "entries" ]
static void memory_init_populate(running_machine *machine) { memory_private *memdata = machine->memory_data; address_space *space; for (space = (address_space *)memdata->spacelist; space != NULL; space = (address_space *)space->next) if (space->map != NULL) { const address_map_entry *last_entry = NULL; while (last_entry != space->map->entrylist) { const address_map_entry *entry; read_handler rhandler; write_handler whandler; for (entry = space->map->entrylist; entry->next != last_entry; entry = entry->next) ; last_entry = entry; rhandler = entry->read; whandler = entry->write; if (entry->read_porttag != NULL) { const input_port_config *port = input_port_by_tag(machine->portconfig, entry->read_porttag); int bits = (entry->read_bits == 0) ? space->dbits : entry->read_bits; genf *handler = NULL; if (port == NULL) fatalerror("Non-existent port referenced: '%s'\n", entry->read_porttag); switch (bits) { case 8: handler = (genf *)input_port_read8; break; case 16: handler = (genf *)input_port_read16; break; case 32: handler = (genf *)input_port_read32; break; case 64: handler = (genf *)input_port_read64; break; } space_map_range_private(space, ROW_READ, bits, entry->read_mask, entry->addrstart, entry->addrend, entry->addrmask, entry->addrmirror, handler, (void *)port, entry->read_porttag); } if (rhandler.generic != NULL) { int bits = (entry->read_bits == 0) ? space->dbits : entry->read_bits; void *object = space; if (entry->read_devtag != NULL) { object = (void *)device_list_find_by_tag(machine->config->devicelist, entry->read_devtag); if (object == NULL) fatalerror("Unidentified object in memory map: tag=%s\n", entry->read_devtag); } space_map_range_private(space, ROW_READ, bits, entry->read_mask, entry->addrstart, entry->addrend, entry->addrmask, entry->addrmirror, rhandler.generic, object, entry->read_name); } if (whandler.generic != NULL) { int bits = (entry->write_bits == 0) ? space->dbits : entry->write_bits; void *object = space; if (entry->write_devtag != NULL) { object = (void *)device_list_find_by_tag(machine->config->devicelist, entry->write_devtag); if (object == NULL) fatalerror("Unidentified object in memory map: tag=%s\n", entry->write_devtag); } space_map_range_private(space, ROW_WRITE, bits, entry->write_mask, entry->addrstart, entry->addrend, entry->addrmask, entry->addrmirror, whandler.generic, object, entry->write_name); } } } }
[ "static", "void", "memory_init_populate", "(", "running_machine", "*", "machine", ")", "{", "memory_private", "*", "memdata", "=", "machine", "->", "memory_data", ";", "address_space", "*", "space", ";", "for", "(", "space", "=", "(", "address_space", "*", ")", "memdata", "->", "spacelist", ";", "space", "!=", "NULL", ";", "space", "=", "(", "address_space", "*", ")", "space", "->", "next", ")", "if", "(", "space", "->", "map", "!=", "NULL", ")", "{", "const", "address_map_entry", "*", "last_entry", "=", "NULL", ";", "while", "(", "last_entry", "!=", "space", "->", "map", "->", "entrylist", ")", "{", "const", "address_map_entry", "*", "entry", ";", "read_handler", "rhandler", ";", "write_handler", "whandler", ";", "for", "(", "entry", "=", "space", "->", "map", "->", "entrylist", ";", "entry", "->", "next", "!=", "last_entry", ";", "entry", "=", "entry", "->", "next", ")", ";", "last_entry", "=", "entry", ";", "rhandler", "=", "entry", "->", "read", ";", "whandler", "=", "entry", "->", "write", ";", "if", "(", "entry", "->", "read_porttag", "!=", "NULL", ")", "{", "const", "input_port_config", "*", "port", "=", "input_port_by_tag", "(", "machine", "->", "portconfig", ",", "entry", "->", "read_porttag", ")", ";", "int", "bits", "=", "(", "entry", "->", "read_bits", "==", "0", ")", "?", "space", "->", "dbits", ":", "entry", "->", "read_bits", ";", "genf", "*", "handler", "=", "NULL", ";", "if", "(", "port", "==", "NULL", ")", "fatalerror", "(", "\"", "\\n", "\"", ",", "entry", "->", "read_porttag", ")", ";", "switch", "(", "bits", ")", "{", "case", "8", ":", "handler", "=", "(", "genf", "*", ")", "input_port_read8", ";", "break", ";", "case", "16", ":", "handler", "=", "(", "genf", "*", ")", "input_port_read16", ";", "break", ";", "case", "32", ":", "handler", "=", "(", "genf", "*", ")", "input_port_read32", ";", "break", ";", "case", "64", ":", "handler", "=", "(", "genf", "*", ")", "input_port_read64", ";", "break", ";", "}", "space_map_range_private", "(", "space", ",", "ROW_READ", ",", "bits", ",", "entry", "->", "read_mask", ",", "entry", "->", "addrstart", ",", "entry", "->", "addrend", ",", "entry", "->", "addrmask", ",", "entry", "->", "addrmirror", ",", "handler", ",", "(", "void", "*", ")", "port", ",", "entry", "->", "read_porttag", ")", ";", "}", "if", "(", "rhandler", ".", "generic", "!=", "NULL", ")", "{", "int", "bits", "=", "(", "entry", "->", "read_bits", "==", "0", ")", "?", "space", "->", "dbits", ":", "entry", "->", "read_bits", ";", "void", "*", "object", "=", "space", ";", "if", "(", "entry", "->", "read_devtag", "!=", "NULL", ")", "{", "object", "=", "(", "void", "*", ")", "device_list_find_by_tag", "(", "machine", "->", "config", "->", "devicelist", ",", "entry", "->", "read_devtag", ")", ";", "if", "(", "object", "==", "NULL", ")", "fatalerror", "(", "\"", "\\n", "\"", ",", "entry", "->", "read_devtag", ")", ";", "}", "space_map_range_private", "(", "space", ",", "ROW_READ", ",", "bits", ",", "entry", "->", "read_mask", ",", "entry", "->", "addrstart", ",", "entry", "->", "addrend", ",", "entry", "->", "addrmask", ",", "entry", "->", "addrmirror", ",", "rhandler", ".", "generic", ",", "object", ",", "entry", "->", "read_name", ")", ";", "}", "if", "(", "whandler", ".", "generic", "!=", "NULL", ")", "{", "int", "bits", "=", "(", "entry", "->", "write_bits", "==", "0", ")", "?", "space", "->", "dbits", ":", "entry", "->", "write_bits", ";", "void", "*", "object", "=", "space", ";", "if", "(", "entry", "->", "write_devtag", "!=", "NULL", ")", "{", "object", "=", "(", "void", "*", ")", "device_list_find_by_tag", "(", "machine", "->", "config", "->", "devicelist", ",", "entry", "->", "write_devtag", ")", ";", "if", "(", "object", "==", "NULL", ")", "fatalerror", "(", "\"", "\\n", "\"", ",", "entry", "->", "write_devtag", ")", ";", "}", "space_map_range_private", "(", "space", ",", "ROW_WRITE", ",", "bits", ",", "entry", "->", "write_mask", ",", "entry", "->", "addrstart", ",", "entry", "->", "addrend", ",", "entry", "->", "addrmask", ",", "entry", "->", "addrmirror", ",", "whandler", ".", "generic", ",", "object", ",", "entry", "->", "write_name", ")", ";", "}", "}", "}", "}" ]
memory_init_populate - populate the memory mapping tables with entries
[ "memory_init_populate", "-", "populate", "the", "memory", "mapping", "tables", "with", "entries" ]
[ "/* loop over valid address spaces */", "/* install the handlers, using the original, unadjusted memory map */", "/* find the entry before the last one we processed */", "/* if we have a read port tag, look it up */", "/* install the read handler if present */", "/* install the write handler if present */" ]
[ { "param": "machine", "type": "running_machine" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
memory_init_allocate
void
static void memory_init_allocate(running_machine *machine) { memory_private *memdata = machine->memory_data; address_space *space; /* loop over valid address spaces */ for (space = (address_space *)memdata->spacelist; space != NULL; space = (address_space *)space->next) { address_map_entry *unassigned = NULL; address_map_entry *entry; memory_block *prev_memblock_head = memdata->memory_block_list; memory_block *memblock; /* make a first pass over the memory map and track blocks with hardcoded pointers */ /* we do this to make sure they are found by space_find_backing_memory first */ for (entry = space->map->entrylist; entry != NULL; entry = entry->next) if (entry->memory != NULL) block_allocate(space, entry->bytestart, entry->byteend, entry->memory); /* loop over all blocks just allocated and assign pointers from them */ for (memblock = memdata->memory_block_list; memblock != prev_memblock_head; memblock = memblock->next) unassigned = block_assign_intersecting(space, memblock->bytestart, memblock->byteend, memblock->data); /* if we don't have an unassigned pointer yet, try to find one */ if (unassigned == NULL) unassigned = block_assign_intersecting(space, ~0, 0, NULL); /* loop until we've assigned all memory in this space */ while (unassigned != NULL) { offs_t curbytestart, curbyteend; int changed; void *block; /* work in MEMORY_BLOCK_CHUNK-sized chunks */ offs_t curblockstart = unassigned->bytestart / MEMORY_BLOCK_CHUNK; offs_t curblockend = unassigned->byteend / MEMORY_BLOCK_CHUNK; /* loop while we keep finding unassigned blocks in neighboring MEMORY_BLOCK_CHUNK chunks */ do { changed = FALSE; /* scan for unmapped blocks in the adjusted map */ for (entry = space->map->entrylist; entry != NULL; entry = entry->next) if (entry->memory == NULL && entry != unassigned && space_needs_backing_store(space, entry)) { offs_t blockstart, blockend; /* get block start/end blocks for this block */ blockstart = entry->bytestart / MEMORY_BLOCK_CHUNK; blockend = entry->byteend / MEMORY_BLOCK_CHUNK; /* if we intersect or are adjacent, adjust the start/end */ if (blockstart <= curblockend + 1 && blockend >= curblockstart - 1) { if (blockstart < curblockstart) curblockstart = blockstart, changed = TRUE; if (blockend > curblockend) curblockend = blockend, changed = TRUE; } } } while (changed); /* we now have a block to allocate; do it */ curbytestart = curblockstart * MEMORY_BLOCK_CHUNK; curbyteend = curblockend * MEMORY_BLOCK_CHUNK + (MEMORY_BLOCK_CHUNK - 1); block = block_allocate(space, curbytestart, curbyteend, NULL); /* assign memory that intersected the new block */ unassigned = block_assign_intersecting(space, curbytestart, curbyteend, (UINT8 *)block); } } }
/*------------------------------------------------- memory_init_allocate - allocate memory for device address spaces -------------------------------------------------*/
allocate memory for device address spaces
[ "allocate", "memory", "for", "device", "address", "spaces" ]
static void memory_init_allocate(running_machine *machine) { memory_private *memdata = machine->memory_data; address_space *space; for (space = (address_space *)memdata->spacelist; space != NULL; space = (address_space *)space->next) { address_map_entry *unassigned = NULL; address_map_entry *entry; memory_block *prev_memblock_head = memdata->memory_block_list; memory_block *memblock; for (entry = space->map->entrylist; entry != NULL; entry = entry->next) if (entry->memory != NULL) block_allocate(space, entry->bytestart, entry->byteend, entry->memory); for (memblock = memdata->memory_block_list; memblock != prev_memblock_head; memblock = memblock->next) unassigned = block_assign_intersecting(space, memblock->bytestart, memblock->byteend, memblock->data); if (unassigned == NULL) unassigned = block_assign_intersecting(space, ~0, 0, NULL); while (unassigned != NULL) { offs_t curbytestart, curbyteend; int changed; void *block; offs_t curblockstart = unassigned->bytestart / MEMORY_BLOCK_CHUNK; offs_t curblockend = unassigned->byteend / MEMORY_BLOCK_CHUNK; do { changed = FALSE; for (entry = space->map->entrylist; entry != NULL; entry = entry->next) if (entry->memory == NULL && entry != unassigned && space_needs_backing_store(space, entry)) { offs_t blockstart, blockend; blockstart = entry->bytestart / MEMORY_BLOCK_CHUNK; blockend = entry->byteend / MEMORY_BLOCK_CHUNK; if (blockstart <= curblockend + 1 && blockend >= curblockstart - 1) { if (blockstart < curblockstart) curblockstart = blockstart, changed = TRUE; if (blockend > curblockend) curblockend = blockend, changed = TRUE; } } } while (changed); curbytestart = curblockstart * MEMORY_BLOCK_CHUNK; curbyteend = curblockend * MEMORY_BLOCK_CHUNK + (MEMORY_BLOCK_CHUNK - 1); block = block_allocate(space, curbytestart, curbyteend, NULL); unassigned = block_assign_intersecting(space, curbytestart, curbyteend, (UINT8 *)block); } } }
[ "static", "void", "memory_init_allocate", "(", "running_machine", "*", "machine", ")", "{", "memory_private", "*", "memdata", "=", "machine", "->", "memory_data", ";", "address_space", "*", "space", ";", "for", "(", "space", "=", "(", "address_space", "*", ")", "memdata", "->", "spacelist", ";", "space", "!=", "NULL", ";", "space", "=", "(", "address_space", "*", ")", "space", "->", "next", ")", "{", "address_map_entry", "*", "unassigned", "=", "NULL", ";", "address_map_entry", "*", "entry", ";", "memory_block", "*", "prev_memblock_head", "=", "memdata", "->", "memory_block_list", ";", "memory_block", "*", "memblock", ";", "for", "(", "entry", "=", "space", "->", "map", "->", "entrylist", ";", "entry", "!=", "NULL", ";", "entry", "=", "entry", "->", "next", ")", "if", "(", "entry", "->", "memory", "!=", "NULL", ")", "block_allocate", "(", "space", ",", "entry", "->", "bytestart", ",", "entry", "->", "byteend", ",", "entry", "->", "memory", ")", ";", "for", "(", "memblock", "=", "memdata", "->", "memory_block_list", ";", "memblock", "!=", "prev_memblock_head", ";", "memblock", "=", "memblock", "->", "next", ")", "unassigned", "=", "block_assign_intersecting", "(", "space", ",", "memblock", "->", "bytestart", ",", "memblock", "->", "byteend", ",", "memblock", "->", "data", ")", ";", "if", "(", "unassigned", "==", "NULL", ")", "unassigned", "=", "block_assign_intersecting", "(", "space", ",", "~", "0", ",", "0", ",", "NULL", ")", ";", "while", "(", "unassigned", "!=", "NULL", ")", "{", "offs_t", "curbytestart", ",", "curbyteend", ";", "int", "changed", ";", "void", "*", "block", ";", "offs_t", "curblockstart", "=", "unassigned", "->", "bytestart", "/", "MEMORY_BLOCK_CHUNK", ";", "offs_t", "curblockend", "=", "unassigned", "->", "byteend", "/", "MEMORY_BLOCK_CHUNK", ";", "do", "{", "changed", "=", "FALSE", ";", "for", "(", "entry", "=", "space", "->", "map", "->", "entrylist", ";", "entry", "!=", "NULL", ";", "entry", "=", "entry", "->", "next", ")", "if", "(", "entry", "->", "memory", "==", "NULL", "&&", "entry", "!=", "unassigned", "&&", "space_needs_backing_store", "(", "space", ",", "entry", ")", ")", "{", "offs_t", "blockstart", ",", "blockend", ";", "blockstart", "=", "entry", "->", "bytestart", "/", "MEMORY_BLOCK_CHUNK", ";", "blockend", "=", "entry", "->", "byteend", "/", "MEMORY_BLOCK_CHUNK", ";", "if", "(", "blockstart", "<=", "curblockend", "+", "1", "&&", "blockend", ">=", "curblockstart", "-", "1", ")", "{", "if", "(", "blockstart", "<", "curblockstart", ")", "curblockstart", "=", "blockstart", ",", "changed", "=", "TRUE", ";", "if", "(", "blockend", ">", "curblockend", ")", "curblockend", "=", "blockend", ",", "changed", "=", "TRUE", ";", "}", "}", "}", "while", "(", "changed", ")", ";", "curbytestart", "=", "curblockstart", "*", "MEMORY_BLOCK_CHUNK", ";", "curbyteend", "=", "curblockend", "*", "MEMORY_BLOCK_CHUNK", "+", "(", "MEMORY_BLOCK_CHUNK", "-", "1", ")", ";", "block", "=", "block_allocate", "(", "space", ",", "curbytestart", ",", "curbyteend", ",", "NULL", ")", ";", "unassigned", "=", "block_assign_intersecting", "(", "space", ",", "curbytestart", ",", "curbyteend", ",", "(", "UINT8", "*", ")", "block", ")", ";", "}", "}", "}" ]
memory_init_allocate - allocate memory for device address spaces
[ "memory_init_allocate", "-", "allocate", "memory", "for", "device", "address", "spaces" ]
[ "/* loop over valid address spaces */", "/* make a first pass over the memory map and track blocks with hardcoded pointers */", "/* we do this to make sure they are found by space_find_backing_memory first */", "/* loop over all blocks just allocated and assign pointers from them */", "/* if we don't have an unassigned pointer yet, try to find one */", "/* loop until we've assigned all memory in this space */", "/* work in MEMORY_BLOCK_CHUNK-sized chunks */", "/* loop while we keep finding unassigned blocks in neighboring MEMORY_BLOCK_CHUNK chunks */", "/* scan for unmapped blocks in the adjusted map */", "/* get block start/end blocks for this block */", "/* if we intersect or are adjacent, adjust the start/end */", "/* we now have a block to allocate; do it */", "/* assign memory that intersected the new block */" ]
[ { "param": "machine", "type": "running_machine" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
memory_init_locate
void
static void memory_init_locate(running_machine *machine) { memory_private *memdata = machine->memory_data; address_space *space; int banknum; /* loop over valid address spaces */ for (space = (address_space *)memdata->spacelist; space != NULL; space = (address_space *)space->next) { const address_map_entry *entry; /* fill in base/size entries, and handle shared memory */ for (entry = space->map->entrylist; entry != NULL; entry = entry->next) { /* assign base/size values */ if (entry->baseptr != NULL) *entry->baseptr = entry->memory; if (entry->baseptroffs_plus1 != 0) *(void **)((UINT8 *)machine->driver_data + entry->baseptroffs_plus1 - 1) = entry->memory; if (entry->sizeptr != NULL) *entry->sizeptr = entry->byteend - entry->bytestart + 1; if (entry->sizeptroffs_plus1 != 0) *(size_t *)((UINT8 *)machine->driver_data + entry->sizeptroffs_plus1 - 1) = entry->byteend - entry->bytestart + 1; } } /* once this is done, find the starting bases for the banks */ for (banknum = 1; banknum <= MAX_BANKS; banknum++) { bank_info *bank = &memdata->bankdata[banknum]; if (bank->used) { address_map_entry *entry; bank_reference *ref; int foundit = FALSE; /* set the initial bank pointer */ for (ref = bank->reflist; !foundit && ref != NULL; ref = ref->next) for (entry = ref->space->map->entrylist; entry != NULL; entry = entry->next) if (entry->bytestart == bank->bytestart) { memdata->bank_ptr[banknum] = (UINT8 *)entry->memory; foundit = TRUE; VPRINTF(("assigned bank %d pointer to memory from range %08X-%08X [%p]\n", banknum, entry->addrstart, entry->addrend, entry->memory)); break; } /* if the entry was set ahead of time, override the automatically found pointer */ if (!bank->dynamic && bank->curentry != MAX_BANK_ENTRIES) memdata->bank_ptr[banknum] = (UINT8 *)bank->entry[bank->curentry]; } } /* request a callback to fix up the banks when done */ state_save_register_postload(machine, bank_reattach, NULL); }
/*------------------------------------------------- memory_init_locate - find all the requested pointers into the final allocated memory -------------------------------------------------*/
find all the requested pointers into the final allocated memory
[ "find", "all", "the", "requested", "pointers", "into", "the", "final", "allocated", "memory" ]
static void memory_init_locate(running_machine *machine) { memory_private *memdata = machine->memory_data; address_space *space; int banknum; for (space = (address_space *)memdata->spacelist; space != NULL; space = (address_space *)space->next) { const address_map_entry *entry; for (entry = space->map->entrylist; entry != NULL; entry = entry->next) { if (entry->baseptr != NULL) *entry->baseptr = entry->memory; if (entry->baseptroffs_plus1 != 0) *(void **)((UINT8 *)machine->driver_data + entry->baseptroffs_plus1 - 1) = entry->memory; if (entry->sizeptr != NULL) *entry->sizeptr = entry->byteend - entry->bytestart + 1; if (entry->sizeptroffs_plus1 != 0) *(size_t *)((UINT8 *)machine->driver_data + entry->sizeptroffs_plus1 - 1) = entry->byteend - entry->bytestart + 1; } } for (banknum = 1; banknum <= MAX_BANKS; banknum++) { bank_info *bank = &memdata->bankdata[banknum]; if (bank->used) { address_map_entry *entry; bank_reference *ref; int foundit = FALSE; for (ref = bank->reflist; !foundit && ref != NULL; ref = ref->next) for (entry = ref->space->map->entrylist; entry != NULL; entry = entry->next) if (entry->bytestart == bank->bytestart) { memdata->bank_ptr[banknum] = (UINT8 *)entry->memory; foundit = TRUE; VPRINTF(("assigned bank %d pointer to memory from range %08X-%08X [%p]\n", banknum, entry->addrstart, entry->addrend, entry->memory)); break; } if (!bank->dynamic && bank->curentry != MAX_BANK_ENTRIES) memdata->bank_ptr[banknum] = (UINT8 *)bank->entry[bank->curentry]; } } state_save_register_postload(machine, bank_reattach, NULL); }
[ "static", "void", "memory_init_locate", "(", "running_machine", "*", "machine", ")", "{", "memory_private", "*", "memdata", "=", "machine", "->", "memory_data", ";", "address_space", "*", "space", ";", "int", "banknum", ";", "for", "(", "space", "=", "(", "address_space", "*", ")", "memdata", "->", "spacelist", ";", "space", "!=", "NULL", ";", "space", "=", "(", "address_space", "*", ")", "space", "->", "next", ")", "{", "const", "address_map_entry", "*", "entry", ";", "for", "(", "entry", "=", "space", "->", "map", "->", "entrylist", ";", "entry", "!=", "NULL", ";", "entry", "=", "entry", "->", "next", ")", "{", "if", "(", "entry", "->", "baseptr", "!=", "NULL", ")", "*", "entry", "->", "baseptr", "=", "entry", "->", "memory", ";", "if", "(", "entry", "->", "baseptroffs_plus1", "!=", "0", ")", "*", "(", "void", "*", "*", ")", "(", "(", "UINT8", "*", ")", "machine", "->", "driver_data", "+", "entry", "->", "baseptroffs_plus1", "-", "1", ")", "=", "entry", "->", "memory", ";", "if", "(", "entry", "->", "sizeptr", "!=", "NULL", ")", "*", "entry", "->", "sizeptr", "=", "entry", "->", "byteend", "-", "entry", "->", "bytestart", "+", "1", ";", "if", "(", "entry", "->", "sizeptroffs_plus1", "!=", "0", ")", "*", "(", "size_t", "*", ")", "(", "(", "UINT8", "*", ")", "machine", "->", "driver_data", "+", "entry", "->", "sizeptroffs_plus1", "-", "1", ")", "=", "entry", "->", "byteend", "-", "entry", "->", "bytestart", "+", "1", ";", "}", "}", "for", "(", "banknum", "=", "1", ";", "banknum", "<=", "MAX_BANKS", ";", "banknum", "++", ")", "{", "bank_info", "*", "bank", "=", "&", "memdata", "->", "bankdata", "[", "banknum", "]", ";", "if", "(", "bank", "->", "used", ")", "{", "address_map_entry", "*", "entry", ";", "bank_reference", "*", "ref", ";", "int", "foundit", "=", "FALSE", ";", "for", "(", "ref", "=", "bank", "->", "reflist", ";", "!", "foundit", "&&", "ref", "!=", "NULL", ";", "ref", "=", "ref", "->", "next", ")", "for", "(", "entry", "=", "ref", "->", "space", "->", "map", "->", "entrylist", ";", "entry", "!=", "NULL", ";", "entry", "=", "entry", "->", "next", ")", "if", "(", "entry", "->", "bytestart", "==", "bank", "->", "bytestart", ")", "{", "memdata", "->", "bank_ptr", "[", "banknum", "]", "=", "(", "UINT8", "*", ")", "entry", "->", "memory", ";", "foundit", "=", "TRUE", ";", "VPRINTF", "(", "(", "\"", "\\n", "\"", ",", "banknum", ",", "entry", "->", "addrstart", ",", "entry", "->", "addrend", ",", "entry", "->", "memory", ")", ")", ";", "break", ";", "}", "if", "(", "!", "bank", "->", "dynamic", "&&", "bank", "->", "curentry", "!=", "MAX_BANK_ENTRIES", ")", "memdata", "->", "bank_ptr", "[", "banknum", "]", "=", "(", "UINT8", "*", ")", "bank", "->", "entry", "[", "bank", "->", "curentry", "]", ";", "}", "}", "state_save_register_postload", "(", "machine", ",", "bank_reattach", ",", "NULL", ")", ";", "}" ]
memory_init_locate - find all the requested pointers into the final allocated memory
[ "memory_init_locate", "-", "find", "all", "the", "requested", "pointers", "into", "the", "final", "allocated", "memory" ]
[ "/* loop over valid address spaces */", "/* fill in base/size entries, and handle shared memory */", "/* assign base/size values */", "/* once this is done, find the starting bases for the banks */", "/* set the initial bank pointer */", "/* if the entry was set ahead of time, override the automatically found pointer */", "/* request a callback to fix up the banks when done */" ]
[ { "param": "machine", "type": "running_machine" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
space_map_range_private
void
static void space_map_range_private(address_space *space, read_or_write readorwrite, int handlerbits, int handlerunitmask, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, genf *handler, void *object, const char *handler_name) { /* translate ROM to RAM/UNMAP here */ if (HANDLER_IS_ROM(handler)) handler = (readorwrite == ROW_WRITE) ? (genf *)STATIC_UNMAP : (genf *)SMH_RAM; /* assign banks for RAM/ROM areas */ if (HANDLER_IS_RAM(handler)) { memory_private *memdata = space->machine->memory_data; offs_t bytestart = addrstart; offs_t byteend = addrend; offs_t bytemask = addrmask; offs_t bytemirror = addrmirror; /* adjust the incoming addresses (temporarily) */ adjust_addresses(space, &bytestart, &byteend, &bytemask, &bytemirror); /* assign a bank to the adjusted addresses */ handler = (genf *)bank_assign_dynamic(space, readorwrite, bytestart, byteend); if (memdata->bank_ptr[HANDLER_TO_BANK(handler)] == NULL) memdata->bank_ptr[HANDLER_TO_BANK(handler)] = (UINT8 *)space_find_backing_memory(space, bytestart); } /* then do a normal installation */ space_map_range(space, readorwrite, handlerbits, handlerunitmask, addrstart, addrend, addrmask, addrmirror, handler, object, handler_name); }
/*------------------------------------------------- space_map_range_private - wrapper for space_map_range which is used at initialization time and converts RAM/ROM banks to dynamically assigned banks -------------------------------------------------*/
wrapper for space_map_range which is used at initialization time and converts RAM/ROM banks to dynamically assigned banks
[ "wrapper", "for", "space_map_range", "which", "is", "used", "at", "initialization", "time", "and", "converts", "RAM", "/", "ROM", "banks", "to", "dynamically", "assigned", "banks" ]
static void space_map_range_private(address_space *space, read_or_write readorwrite, int handlerbits, int handlerunitmask, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, genf *handler, void *object, const char *handler_name) { if (HANDLER_IS_ROM(handler)) handler = (readorwrite == ROW_WRITE) ? (genf *)STATIC_UNMAP : (genf *)SMH_RAM; if (HANDLER_IS_RAM(handler)) { memory_private *memdata = space->machine->memory_data; offs_t bytestart = addrstart; offs_t byteend = addrend; offs_t bytemask = addrmask; offs_t bytemirror = addrmirror; adjust_addresses(space, &bytestart, &byteend, &bytemask, &bytemirror); handler = (genf *)bank_assign_dynamic(space, readorwrite, bytestart, byteend); if (memdata->bank_ptr[HANDLER_TO_BANK(handler)] == NULL) memdata->bank_ptr[HANDLER_TO_BANK(handler)] = (UINT8 *)space_find_backing_memory(space, bytestart); } space_map_range(space, readorwrite, handlerbits, handlerunitmask, addrstart, addrend, addrmask, addrmirror, handler, object, handler_name); }
[ "static", "void", "space_map_range_private", "(", "address_space", "*", "space", ",", "read_or_write", "readorwrite", ",", "int", "handlerbits", ",", "int", "handlerunitmask", ",", "offs_t", "addrstart", ",", "offs_t", "addrend", ",", "offs_t", "addrmask", ",", "offs_t", "addrmirror", ",", "genf", "*", "handler", ",", "void", "*", "object", ",", "const", "char", "*", "handler_name", ")", "{", "if", "(", "HANDLER_IS_ROM", "(", "handler", ")", ")", "handler", "=", "(", "readorwrite", "==", "ROW_WRITE", ")", "?", "(", "genf", "*", ")", "STATIC_UNMAP", ":", "(", "genf", "*", ")", "SMH_RAM", ";", "if", "(", "HANDLER_IS_RAM", "(", "handler", ")", ")", "{", "memory_private", "*", "memdata", "=", "space", "->", "machine", "->", "memory_data", ";", "offs_t", "bytestart", "=", "addrstart", ";", "offs_t", "byteend", "=", "addrend", ";", "offs_t", "bytemask", "=", "addrmask", ";", "offs_t", "bytemirror", "=", "addrmirror", ";", "adjust_addresses", "(", "space", ",", "&", "bytestart", ",", "&", "byteend", ",", "&", "bytemask", ",", "&", "bytemirror", ")", ";", "handler", "=", "(", "genf", "*", ")", "bank_assign_dynamic", "(", "space", ",", "readorwrite", ",", "bytestart", ",", "byteend", ")", ";", "if", "(", "memdata", "->", "bank_ptr", "[", "HANDLER_TO_BANK", "(", "handler", ")", "]", "==", "NULL", ")", "memdata", "->", "bank_ptr", "[", "HANDLER_TO_BANK", "(", "handler", ")", "]", "=", "(", "UINT8", "*", ")", "space_find_backing_memory", "(", "space", ",", "bytestart", ")", ";", "}", "space_map_range", "(", "space", ",", "readorwrite", ",", "handlerbits", ",", "handlerunitmask", ",", "addrstart", ",", "addrend", ",", "addrmask", ",", "addrmirror", ",", "handler", ",", "object", ",", "handler_name", ")", ";", "}" ]
space_map_range_private - wrapper for space_map_range which is used at initialization time and converts RAM/ROM banks to dynamically assigned banks
[ "space_map_range_private", "-", "wrapper", "for", "space_map_range", "which", "is", "used", "at", "initialization", "time", "and", "converts", "RAM", "/", "ROM", "banks", "to", "dynamically", "assigned", "banks" ]
[ "/* translate ROM to RAM/UNMAP here */", "/* assign banks for RAM/ROM areas */", "/* adjust the incoming addresses (temporarily) */", "/* assign a bank to the adjusted addresses */", "/* then do a normal installation */" ]
[ { "param": "space", "type": "address_space" }, { "param": "readorwrite", "type": "read_or_write" }, { "param": "handlerbits", "type": "int" }, { "param": "handlerunitmask", "type": "int" }, { "param": "addrstart", "type": "offs_t" }, { "param": "addrend", "type": "offs_t" }, { "param": "addrmask", "type": "offs_t" }, { "param": "addrmirror", "type": "offs_t" }, { "param": "handler", "type": "genf" }, { "param": "object", "type": "void" }, { "param": "handler_name", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "space", "type": "address_space", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "readorwrite", "type": "read_or_write", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "handlerbits", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "handlerunitmask", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrstart", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrend", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrmask", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrmirror", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "handler", "type": "genf", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "object", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "handler_name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
space_map_range
void
static void space_map_range(address_space *space, read_or_write readorwrite, int handlerbits, int handlerunitmask, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, genf *handler, void *object, const char *handler_name) { address_table *tabledata = (readorwrite == ROW_WRITE) ? &space->write : &space->read; int reset_write = (space->writelookup == space->write.table); int reset_read = (space->readlookup == space->read.table); offs_t bytestart, byteend, bytemask, bytemirror; UINT8 entry; /* sanity checks */ assert(space != NULL); assert(handlerbits == 8 || handlerbits == 16 || handlerbits == 32 || handlerbits == 64); /* adjust the incoming addresses */ bytestart = addrstart; byteend = addrend; bytemirror = addrmirror; bytemask = addrmask; adjust_addresses(space, &bytestart, &byteend, &bytemask, &bytemirror); /* validity checks */ assert_always(!HANDLER_IS_ROM(handler), "space_map_range called with ROM after initialization"); assert_always(!HANDLER_IS_RAM(handler), "space_map_range called with RAM after initialization"); assert_always(addrstart <= addrend, "space_map_range called with start greater than end"); assert_always(handlerbits <= space->dbits, "space_map_range called with handlers larger than the address space"); assert_always((bytestart & (space->dbits / 8 - 1)) == 0, "space_map_range called with misaligned start address"); assert_always((byteend & (space->dbits / 8 - 1)) == (space->dbits / 8 - 1), "space_map_range called with misaligned end address"); /* if we're installing a new bank, make sure we mark it */ if (HANDLER_IS_BANK(handler)) bank_assign_static(HANDLER_TO_BANK(handler), space, readorwrite, bytestart, byteend); /* get the final handler index */ entry = table_assign_handler(space, tabledata->handlers, object, handler, handler_name, bytestart, byteend, bytemask); /* fix up the handler if a stub is required */ if (handlerbits != space->dbits) table_compute_subhandler(tabledata->handlers, entry, readorwrite, space->dbits, space->endianness, handlerbits, handlerunitmask); /* populate it */ table_populate_range_mirrored(space, tabledata, bytestart, byteend, bytemirror, entry); /* reset read/write pointers if necessary (could have moved due to realloc) */ if (reset_write) space->writelookup = space->write.table; if (reset_read) space->readlookup = space->read.table; /* recompute any direct access on this space if it is a read modification */ if (readorwrite == ROW_READ && entry == space->direct.entry) { space->direct.entry = STATIC_UNMAP; space->direct.bytestart = 1; space->direct.byteend = 0; } }
/*------------------------------------------------- space_map_range - maps a range of addresses to the specified handler within an address space -------------------------------------------------*/
maps a range of addresses to the specified handler within an address space
[ "maps", "a", "range", "of", "addresses", "to", "the", "specified", "handler", "within", "an", "address", "space" ]
static void space_map_range(address_space *space, read_or_write readorwrite, int handlerbits, int handlerunitmask, offs_t addrstart, offs_t addrend, offs_t addrmask, offs_t addrmirror, genf *handler, void *object, const char *handler_name) { address_table *tabledata = (readorwrite == ROW_WRITE) ? &space->write : &space->read; int reset_write = (space->writelookup == space->write.table); int reset_read = (space->readlookup == space->read.table); offs_t bytestart, byteend, bytemask, bytemirror; UINT8 entry; assert(space != NULL); assert(handlerbits == 8 || handlerbits == 16 || handlerbits == 32 || handlerbits == 64); bytestart = addrstart; byteend = addrend; bytemirror = addrmirror; bytemask = addrmask; adjust_addresses(space, &bytestart, &byteend, &bytemask, &bytemirror); assert_always(!HANDLER_IS_ROM(handler), "space_map_range called with ROM after initialization"); assert_always(!HANDLER_IS_RAM(handler), "space_map_range called with RAM after initialization"); assert_always(addrstart <= addrend, "space_map_range called with start greater than end"); assert_always(handlerbits <= space->dbits, "space_map_range called with handlers larger than the address space"); assert_always((bytestart & (space->dbits / 8 - 1)) == 0, "space_map_range called with misaligned start address"); assert_always((byteend & (space->dbits / 8 - 1)) == (space->dbits / 8 - 1), "space_map_range called with misaligned end address"); if (HANDLER_IS_BANK(handler)) bank_assign_static(HANDLER_TO_BANK(handler), space, readorwrite, bytestart, byteend); entry = table_assign_handler(space, tabledata->handlers, object, handler, handler_name, bytestart, byteend, bytemask); if (handlerbits != space->dbits) table_compute_subhandler(tabledata->handlers, entry, readorwrite, space->dbits, space->endianness, handlerbits, handlerunitmask); table_populate_range_mirrored(space, tabledata, bytestart, byteend, bytemirror, entry); if (reset_write) space->writelookup = space->write.table; if (reset_read) space->readlookup = space->read.table; if (readorwrite == ROW_READ && entry == space->direct.entry) { space->direct.entry = STATIC_UNMAP; space->direct.bytestart = 1; space->direct.byteend = 0; } }
[ "static", "void", "space_map_range", "(", "address_space", "*", "space", ",", "read_or_write", "readorwrite", ",", "int", "handlerbits", ",", "int", "handlerunitmask", ",", "offs_t", "addrstart", ",", "offs_t", "addrend", ",", "offs_t", "addrmask", ",", "offs_t", "addrmirror", ",", "genf", "*", "handler", ",", "void", "*", "object", ",", "const", "char", "*", "handler_name", ")", "{", "address_table", "*", "tabledata", "=", "(", "readorwrite", "==", "ROW_WRITE", ")", "?", "&", "space", "->", "write", ":", "&", "space", "->", "read", ";", "int", "reset_write", "=", "(", "space", "->", "writelookup", "==", "space", "->", "write", ".", "table", ")", ";", "int", "reset_read", "=", "(", "space", "->", "readlookup", "==", "space", "->", "read", ".", "table", ")", ";", "offs_t", "bytestart", ",", "byteend", ",", "bytemask", ",", "bytemirror", ";", "UINT8", "entry", ";", "assert", "(", "space", "!=", "NULL", ")", ";", "assert", "(", "handlerbits", "==", "8", "||", "handlerbits", "==", "16", "||", "handlerbits", "==", "32", "||", "handlerbits", "==", "64", ")", ";", "bytestart", "=", "addrstart", ";", "byteend", "=", "addrend", ";", "bytemirror", "=", "addrmirror", ";", "bytemask", "=", "addrmask", ";", "adjust_addresses", "(", "space", ",", "&", "bytestart", ",", "&", "byteend", ",", "&", "bytemask", ",", "&", "bytemirror", ")", ";", "assert_always", "(", "!", "HANDLER_IS_ROM", "(", "handler", ")", ",", "\"", "\"", ")", ";", "assert_always", "(", "!", "HANDLER_IS_RAM", "(", "handler", ")", ",", "\"", "\"", ")", ";", "assert_always", "(", "addrstart", "<=", "addrend", ",", "\"", "\"", ")", ";", "assert_always", "(", "handlerbits", "<=", "space", "->", "dbits", ",", "\"", "\"", ")", ";", "assert_always", "(", "(", "bytestart", "&", "(", "space", "->", "dbits", "/", "8", "-", "1", ")", ")", "==", "0", ",", "\"", "\"", ")", ";", "assert_always", "(", "(", "byteend", "&", "(", "space", "->", "dbits", "/", "8", "-", "1", ")", ")", "==", "(", "space", "->", "dbits", "/", "8", "-", "1", ")", ",", "\"", "\"", ")", ";", "if", "(", "HANDLER_IS_BANK", "(", "handler", ")", ")", "bank_assign_static", "(", "HANDLER_TO_BANK", "(", "handler", ")", ",", "space", ",", "readorwrite", ",", "bytestart", ",", "byteend", ")", ";", "entry", "=", "table_assign_handler", "(", "space", ",", "tabledata", "->", "handlers", ",", "object", ",", "handler", ",", "handler_name", ",", "bytestart", ",", "byteend", ",", "bytemask", ")", ";", "if", "(", "handlerbits", "!=", "space", "->", "dbits", ")", "table_compute_subhandler", "(", "tabledata", "->", "handlers", ",", "entry", ",", "readorwrite", ",", "space", "->", "dbits", ",", "space", "->", "endianness", ",", "handlerbits", ",", "handlerunitmask", ")", ";", "table_populate_range_mirrored", "(", "space", ",", "tabledata", ",", "bytestart", ",", "byteend", ",", "bytemirror", ",", "entry", ")", ";", "if", "(", "reset_write", ")", "space", "->", "writelookup", "=", "space", "->", "write", ".", "table", ";", "if", "(", "reset_read", ")", "space", "->", "readlookup", "=", "space", "->", "read", ".", "table", ";", "if", "(", "readorwrite", "==", "ROW_READ", "&&", "entry", "==", "space", "->", "direct", ".", "entry", ")", "{", "space", "->", "direct", ".", "entry", "=", "STATIC_UNMAP", ";", "space", "->", "direct", ".", "bytestart", "=", "1", ";", "space", "->", "direct", ".", "byteend", "=", "0", ";", "}", "}" ]
space_map_range - maps a range of addresses to the specified handler within an address space
[ "space_map_range", "-", "maps", "a", "range", "of", "addresses", "to", "the", "specified", "handler", "within", "an", "address", "space" ]
[ "/* sanity checks */", "/* adjust the incoming addresses */", "/* validity checks */", "/* if we're installing a new bank, make sure we mark it */", "/* get the final handler index */", "/* fix up the handler if a stub is required */", "/* populate it */", "/* reset read/write pointers if necessary (could have moved due to realloc) */", "/* recompute any direct access on this space if it is a read modification */" ]
[ { "param": "space", "type": "address_space" }, { "param": "readorwrite", "type": "read_or_write" }, { "param": "handlerbits", "type": "int" }, { "param": "handlerunitmask", "type": "int" }, { "param": "addrstart", "type": "offs_t" }, { "param": "addrend", "type": "offs_t" }, { "param": "addrmask", "type": "offs_t" }, { "param": "addrmirror", "type": "offs_t" }, { "param": "handler", "type": "genf" }, { "param": "object", "type": "void" }, { "param": "handler_name", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "space", "type": "address_space", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "readorwrite", "type": "read_or_write", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "handlerbits", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "handlerunitmask", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrstart", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrend", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrmask", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "addrmirror", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "handler", "type": "genf", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "object", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "handler_name", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
space_find_backing_memory
void
static void *space_find_backing_memory(const address_space *space, offs_t byteaddress) { memory_private *memdata = space->machine->memory_data; address_map_entry *entry; memory_block *block; VPRINTF(("space_find_backing_memory('%s',%s,%08X) -> ", space->cpu->tag, space->name, byteaddress)); /* look in the address map first */ for (entry = space->map->entrylist; entry != NULL; entry = entry->next) { offs_t maskoffs = byteaddress & entry->bytemask; if (maskoffs >= entry->bytestart && maskoffs <= entry->byteend) { VPRINTF(("found in entry %08X-%08X [%p]\n", entry->addrstart, entry->addrend, (UINT8 *)entry->memory + (maskoffs - entry->bytestart))); return (UINT8 *)entry->memory + (maskoffs - entry->bytestart); } } /* if not found there, look in the allocated blocks */ for (block = memdata->memory_block_list; block != NULL; block = block->next) if (block->space == space && block->bytestart <= byteaddress && block->byteend > byteaddress) { VPRINTF(("found in allocated memory block %08X-%08X [%p]\n", block->bytestart, block->byteend, block->data + (byteaddress - block->bytestart))); return block->data + byteaddress - block->bytestart; } VPRINTF(("did not find\n")); return NULL; }
/*------------------------------------------------- space_find_backing_memory - return a pointer to the base of RAM associated with the given device and offset -------------------------------------------------*/
return a pointer to the base of RAM associated with the given device and offset
[ "return", "a", "pointer", "to", "the", "base", "of", "RAM", "associated", "with", "the", "given", "device", "and", "offset" ]
static void *space_find_backing_memory(const address_space *space, offs_t byteaddress) { memory_private *memdata = space->machine->memory_data; address_map_entry *entry; memory_block *block; VPRINTF(("space_find_backing_memory('%s',%s,%08X) -> ", space->cpu->tag, space->name, byteaddress)); for (entry = space->map->entrylist; entry != NULL; entry = entry->next) { offs_t maskoffs = byteaddress & entry->bytemask; if (maskoffs >= entry->bytestart && maskoffs <= entry->byteend) { VPRINTF(("found in entry %08X-%08X [%p]\n", entry->addrstart, entry->addrend, (UINT8 *)entry->memory + (maskoffs - entry->bytestart))); return (UINT8 *)entry->memory + (maskoffs - entry->bytestart); } } for (block = memdata->memory_block_list; block != NULL; block = block->next) if (block->space == space && block->bytestart <= byteaddress && block->byteend > byteaddress) { VPRINTF(("found in allocated memory block %08X-%08X [%p]\n", block->bytestart, block->byteend, block->data + (byteaddress - block->bytestart))); return block->data + byteaddress - block->bytestart; } VPRINTF(("did not find\n")); return NULL; }
[ "static", "void", "*", "space_find_backing_memory", "(", "const", "address_space", "*", "space", ",", "offs_t", "byteaddress", ")", "{", "memory_private", "*", "memdata", "=", "space", "->", "machine", "->", "memory_data", ";", "address_map_entry", "*", "entry", ";", "memory_block", "*", "block", ";", "VPRINTF", "(", "(", "\"", "\"", ",", "space", "->", "cpu", "->", "tag", ",", "space", "->", "name", ",", "byteaddress", ")", ")", ";", "for", "(", "entry", "=", "space", "->", "map", "->", "entrylist", ";", "entry", "!=", "NULL", ";", "entry", "=", "entry", "->", "next", ")", "{", "offs_t", "maskoffs", "=", "byteaddress", "&", "entry", "->", "bytemask", ";", "if", "(", "maskoffs", ">=", "entry", "->", "bytestart", "&&", "maskoffs", "<=", "entry", "->", "byteend", ")", "{", "VPRINTF", "(", "(", "\"", "\\n", "\"", ",", "entry", "->", "addrstart", ",", "entry", "->", "addrend", ",", "(", "UINT8", "*", ")", "entry", "->", "memory", "+", "(", "maskoffs", "-", "entry", "->", "bytestart", ")", ")", ")", ";", "return", "(", "UINT8", "*", ")", "entry", "->", "memory", "+", "(", "maskoffs", "-", "entry", "->", "bytestart", ")", ";", "}", "}", "for", "(", "block", "=", "memdata", "->", "memory_block_list", ";", "block", "!=", "NULL", ";", "block", "=", "block", "->", "next", ")", "if", "(", "block", "->", "space", "==", "space", "&&", "block", "->", "bytestart", "<=", "byteaddress", "&&", "block", "->", "byteend", ">", "byteaddress", ")", "{", "VPRINTF", "(", "(", "\"", "\\n", "\"", ",", "block", "->", "bytestart", ",", "block", "->", "byteend", ",", "block", "->", "data", "+", "(", "byteaddress", "-", "block", "->", "bytestart", ")", ")", ")", ";", "return", "block", "->", "data", "+", "byteaddress", "-", "block", "->", "bytestart", ";", "}", "VPRINTF", "(", "(", "\"", "\\n", "\"", ")", ")", ";", "return", "NULL", ";", "}" ]
space_find_backing_memory - return a pointer to the base of RAM associated with the given device and offset
[ "space_find_backing_memory", "-", "return", "a", "pointer", "to", "the", "base", "of", "RAM", "associated", "with", "the", "given", "device", "and", "offset" ]
[ "/* look in the address map first */", "/* if not found there, look in the allocated blocks */" ]
[ { "param": "space", "type": "address_space" }, { "param": "byteaddress", "type": "offs_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "space", "type": "address_space", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "byteaddress", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
space_needs_backing_store
int
static int space_needs_backing_store(const address_space *space, const address_map_entry *entry) { FPTR handler; if (entry->baseptr != NULL || entry->baseptroffs_plus1 != 0) return TRUE; handler = (FPTR)entry->write.generic; if (handler < STATIC_COUNT) { if (handler != STATIC_INVALID && handler != STATIC_ROM && handler != STATIC_NOP && handler != STATIC_UNMAP) return TRUE; } handler = (FPTR)entry->read.generic; if (handler < STATIC_COUNT) { if (handler != STATIC_INVALID && (handler < STATIC_BANK1 || handler > STATIC_BANK1 + MAX_BANKS - 1) && (handler != STATIC_ROM || space->spacenum != ADDRESS_SPACE_0 || entry->addrstart >= memory_region_length(space->machine, space->cpu->tag)) && handler != STATIC_NOP && handler != STATIC_UNMAP) return TRUE; } return FALSE; }
/*------------------------------------------------- space_needs_backing_store - return whether a given memory map entry implies the need of allocating and registering memory -------------------------------------------------*/
return whether a given memory map entry implies the need of allocating and registering memory
[ "return", "whether", "a", "given", "memory", "map", "entry", "implies", "the", "need", "of", "allocating", "and", "registering", "memory" ]
static int space_needs_backing_store(const address_space *space, const address_map_entry *entry) { FPTR handler; if (entry->baseptr != NULL || entry->baseptroffs_plus1 != 0) return TRUE; handler = (FPTR)entry->write.generic; if (handler < STATIC_COUNT) { if (handler != STATIC_INVALID && handler != STATIC_ROM && handler != STATIC_NOP && handler != STATIC_UNMAP) return TRUE; } handler = (FPTR)entry->read.generic; if (handler < STATIC_COUNT) { if (handler != STATIC_INVALID && (handler < STATIC_BANK1 || handler > STATIC_BANK1 + MAX_BANKS - 1) && (handler != STATIC_ROM || space->spacenum != ADDRESS_SPACE_0 || entry->addrstart >= memory_region_length(space->machine, space->cpu->tag)) && handler != STATIC_NOP && handler != STATIC_UNMAP) return TRUE; } return FALSE; }
[ "static", "int", "space_needs_backing_store", "(", "const", "address_space", "*", "space", ",", "const", "address_map_entry", "*", "entry", ")", "{", "FPTR", "handler", ";", "if", "(", "entry", "->", "baseptr", "!=", "NULL", "||", "entry", "->", "baseptroffs_plus1", "!=", "0", ")", "return", "TRUE", ";", "handler", "=", "(", "FPTR", ")", "entry", "->", "write", ".", "generic", ";", "if", "(", "handler", "<", "STATIC_COUNT", ")", "{", "if", "(", "handler", "!=", "STATIC_INVALID", "&&", "handler", "!=", "STATIC_ROM", "&&", "handler", "!=", "STATIC_NOP", "&&", "handler", "!=", "STATIC_UNMAP", ")", "return", "TRUE", ";", "}", "handler", "=", "(", "FPTR", ")", "entry", "->", "read", ".", "generic", ";", "if", "(", "handler", "<", "STATIC_COUNT", ")", "{", "if", "(", "handler", "!=", "STATIC_INVALID", "&&", "(", "handler", "<", "STATIC_BANK1", "||", "handler", ">", "STATIC_BANK1", "+", "MAX_BANKS", "-", "1", ")", "&&", "(", "handler", "!=", "STATIC_ROM", "||", "space", "->", "spacenum", "!=", "ADDRESS_SPACE_0", "||", "entry", "->", "addrstart", ">=", "memory_region_length", "(", "space", "->", "machine", ",", "space", "->", "cpu", "->", "tag", ")", ")", "&&", "handler", "!=", "STATIC_NOP", "&&", "handler", "!=", "STATIC_UNMAP", ")", "return", "TRUE", ";", "}", "return", "FALSE", ";", "}" ]
space_needs_backing_store - return whether a given memory map entry implies the need of allocating and registering memory
[ "space_needs_backing_store", "-", "return", "whether", "a", "given", "memory", "map", "entry", "implies", "the", "need", "of", "allocating", "and", "registering", "memory" ]
[]
[ { "param": "space", "type": "address_space" }, { "param": "entry", "type": "address_map_entry" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "space", "type": "address_space", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "entry", "type": "address_map_entry", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
bank_assign_static
void
static void bank_assign_static(int banknum, const address_space *space, read_or_write readorwrite, offs_t bytestart, offs_t byteend) { bank_info *bank = &space->machine->memory_data->bankdata[banknum]; /* if we're not yet used, fill in the data */ if (!bank->used) { /* if we're allowed to, wire up state saving for the entry */ if (state_save_registration_allowed(space->machine)) state_save_register_item(space->machine, "memory", NULL, banknum, bank->curentry); /* fill in information about the bank */ bank->used = TRUE; bank->dynamic = FALSE; add_bank_reference(bank, space); bank->bytestart = bytestart; bank->byteend = byteend; bank->curentry = MAX_BANK_ENTRIES; } /* update the read/write status of the bank */ if (readorwrite == ROW_READ) bank->read = TRUE; else bank->write = TRUE; }
/*------------------------------------------------- bank_assign_static - assign and tag a static bank -------------------------------------------------*/
assign and tag a static bank
[ "assign", "and", "tag", "a", "static", "bank" ]
static void bank_assign_static(int banknum, const address_space *space, read_or_write readorwrite, offs_t bytestart, offs_t byteend) { bank_info *bank = &space->machine->memory_data->bankdata[banknum]; if (!bank->used) { if (state_save_registration_allowed(space->machine)) state_save_register_item(space->machine, "memory", NULL, banknum, bank->curentry); bank->used = TRUE; bank->dynamic = FALSE; add_bank_reference(bank, space); bank->bytestart = bytestart; bank->byteend = byteend; bank->curentry = MAX_BANK_ENTRIES; } if (readorwrite == ROW_READ) bank->read = TRUE; else bank->write = TRUE; }
[ "static", "void", "bank_assign_static", "(", "int", "banknum", ",", "const", "address_space", "*", "space", ",", "read_or_write", "readorwrite", ",", "offs_t", "bytestart", ",", "offs_t", "byteend", ")", "{", "bank_info", "*", "bank", "=", "&", "space", "->", "machine", "->", "memory_data", "->", "bankdata", "[", "banknum", "]", ";", "if", "(", "!", "bank", "->", "used", ")", "{", "if", "(", "state_save_registration_allowed", "(", "space", "->", "machine", ")", ")", "state_save_register_item", "(", "space", "->", "machine", ",", "\"", "\"", ",", "NULL", ",", "banknum", ",", "bank", "->", "curentry", ")", ";", "bank", "->", "used", "=", "TRUE", ";", "bank", "->", "dynamic", "=", "FALSE", ";", "add_bank_reference", "(", "bank", ",", "space", ")", ";", "bank", "->", "bytestart", "=", "bytestart", ";", "bank", "->", "byteend", "=", "byteend", ";", "bank", "->", "curentry", "=", "MAX_BANK_ENTRIES", ";", "}", "if", "(", "readorwrite", "==", "ROW_READ", ")", "bank", "->", "read", "=", "TRUE", ";", "else", "bank", "->", "write", "=", "TRUE", ";", "}" ]
bank_assign_static - assign and tag a static bank
[ "bank_assign_static", "-", "assign", "and", "tag", "a", "static", "bank" ]
[ "/* if we're not yet used, fill in the data */", "/* if we're allowed to, wire up state saving for the entry */", "/* fill in information about the bank */", "/* update the read/write status of the bank */" ]
[ { "param": "banknum", "type": "int" }, { "param": "space", "type": "address_space" }, { "param": "readorwrite", "type": "read_or_write" }, { "param": "bytestart", "type": "offs_t" }, { "param": "byteend", "type": "offs_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "banknum", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "space", "type": "address_space", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "readorwrite", "type": "read_or_write", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "bytestart", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "byteend", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
bank_assign_dynamic
genf
static genf *bank_assign_dynamic(const address_space *space, read_or_write readorwrite, offs_t bytestart, offs_t byteend) { int banknum; /* loop over banks, searching for an exact match or an empty */ for (banknum = MAX_BANKS; banknum >= 1; banknum--) { bank_info *bank = &space->machine->memory_data->bankdata[banknum]; if (!bank->used || (bank->dynamic && bank_references_space(bank, space) && bank->bytestart == bytestart)) { bank->used = TRUE; bank->dynamic = TRUE; add_bank_reference(bank, space); bank->bytestart = bytestart; bank->byteend = byteend; VPRINTF(("Assigned bank %d to '%s',%s,%08X\n", banknum, space->cpu->tag, space->name, bytestart)); return BANK_TO_HANDLER(banknum); } } /* if we got here, we failed */ fatalerror("Device '%s': ran out of banks for RAM/ROM regions!", space->cpu->tag); return NULL; }
/*------------------------------------------------- bank_assign_dynamic - finds a free or exact matching bank -------------------------------------------------*/
finds a free or exact matching bank
[ "finds", "a", "free", "or", "exact", "matching", "bank" ]
static genf *bank_assign_dynamic(const address_space *space, read_or_write readorwrite, offs_t bytestart, offs_t byteend) { int banknum; for (banknum = MAX_BANKS; banknum >= 1; banknum--) { bank_info *bank = &space->machine->memory_data->bankdata[banknum]; if (!bank->used || (bank->dynamic && bank_references_space(bank, space) && bank->bytestart == bytestart)) { bank->used = TRUE; bank->dynamic = TRUE; add_bank_reference(bank, space); bank->bytestart = bytestart; bank->byteend = byteend; VPRINTF(("Assigned bank %d to '%s',%s,%08X\n", banknum, space->cpu->tag, space->name, bytestart)); return BANK_TO_HANDLER(banknum); } } fatalerror("Device '%s': ran out of banks for RAM/ROM regions!", space->cpu->tag); return NULL; }
[ "static", "genf", "*", "bank_assign_dynamic", "(", "const", "address_space", "*", "space", ",", "read_or_write", "readorwrite", ",", "offs_t", "bytestart", ",", "offs_t", "byteend", ")", "{", "int", "banknum", ";", "for", "(", "banknum", "=", "MAX_BANKS", ";", "banknum", ">=", "1", ";", "banknum", "--", ")", "{", "bank_info", "*", "bank", "=", "&", "space", "->", "machine", "->", "memory_data", "->", "bankdata", "[", "banknum", "]", ";", "if", "(", "!", "bank", "->", "used", "||", "(", "bank", "->", "dynamic", "&&", "bank_references_space", "(", "bank", ",", "space", ")", "&&", "bank", "->", "bytestart", "==", "bytestart", ")", ")", "{", "bank", "->", "used", "=", "TRUE", ";", "bank", "->", "dynamic", "=", "TRUE", ";", "add_bank_reference", "(", "bank", ",", "space", ")", ";", "bank", "->", "bytestart", "=", "bytestart", ";", "bank", "->", "byteend", "=", "byteend", ";", "VPRINTF", "(", "(", "\"", "\\n", "\"", ",", "banknum", ",", "space", "->", "cpu", "->", "tag", ",", "space", "->", "name", ",", "bytestart", ")", ")", ";", "return", "BANK_TO_HANDLER", "(", "banknum", ")", ";", "}", "}", "fatalerror", "(", "\"", "\"", ",", "space", "->", "cpu", "->", "tag", ")", ";", "return", "NULL", ";", "}" ]
bank_assign_dynamic - finds a free or exact matching bank
[ "bank_assign_dynamic", "-", "finds", "a", "free", "or", "exact", "matching", "bank" ]
[ "/* loop over banks, searching for an exact match or an empty */", "/* if we got here, we failed */" ]
[ { "param": "space", "type": "address_space" }, { "param": "readorwrite", "type": "read_or_write" }, { "param": "bytestart", "type": "offs_t" }, { "param": "byteend", "type": "offs_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "space", "type": "address_space", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "readorwrite", "type": "read_or_write", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "bytestart", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "byteend", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
subtable_alloc
UINT8
static UINT8 subtable_alloc(address_table *tabledata) { /* loop */ while (1) { UINT8 subindex; /* find a subtable with a usecount of 0 */ for (subindex = 0; subindex < SUBTABLE_COUNT; subindex++) if (tabledata->subtable[subindex].usecount == 0) { /* if this is past our allocation budget, allocate some more */ if (subindex >= tabledata->subtable_alloc) { tabledata->subtable_alloc += SUBTABLE_ALLOC; tabledata->table = (UINT8 *)realloc(tabledata->table, (1 << LEVEL1_BITS) + (tabledata->subtable_alloc << LEVEL2_BITS)); if (!tabledata->table) fatalerror("error: ran out of memory allocating memory subtable"); } /* bump the usecount and return */ tabledata->subtable[subindex].usecount++; return subindex + SUBTABLE_BASE; } /* merge any subtables we can */ if (!subtable_merge(tabledata)) fatalerror("Ran out of subtables!"); } }
/*------------------------------------------------- subtable_alloc - allocate a fresh subtable and set its usecount to 1 -------------------------------------------------*/
allocate a fresh subtable and set its usecount to 1
[ "allocate", "a", "fresh", "subtable", "and", "set", "its", "usecount", "to", "1" ]
static UINT8 subtable_alloc(address_table *tabledata) { while (1) { UINT8 subindex; for (subindex = 0; subindex < SUBTABLE_COUNT; subindex++) if (tabledata->subtable[subindex].usecount == 0) { if (subindex >= tabledata->subtable_alloc) { tabledata->subtable_alloc += SUBTABLE_ALLOC; tabledata->table = (UINT8 *)realloc(tabledata->table, (1 << LEVEL1_BITS) + (tabledata->subtable_alloc << LEVEL2_BITS)); if (!tabledata->table) fatalerror("error: ran out of memory allocating memory subtable"); } tabledata->subtable[subindex].usecount++; return subindex + SUBTABLE_BASE; } if (!subtable_merge(tabledata)) fatalerror("Ran out of subtables!"); } }
[ "static", "UINT8", "subtable_alloc", "(", "address_table", "*", "tabledata", ")", "{", "while", "(", "1", ")", "{", "UINT8", "subindex", ";", "for", "(", "subindex", "=", "0", ";", "subindex", "<", "SUBTABLE_COUNT", ";", "subindex", "++", ")", "if", "(", "tabledata", "->", "subtable", "[", "subindex", "]", ".", "usecount", "==", "0", ")", "{", "if", "(", "subindex", ">=", "tabledata", "->", "subtable_alloc", ")", "{", "tabledata", "->", "subtable_alloc", "+=", "SUBTABLE_ALLOC", ";", "tabledata", "->", "table", "=", "(", "UINT8", "*", ")", "realloc", "(", "tabledata", "->", "table", ",", "(", "1", "<<", "LEVEL1_BITS", ")", "+", "(", "tabledata", "->", "subtable_alloc", "<<", "LEVEL2_BITS", ")", ")", ";", "if", "(", "!", "tabledata", "->", "table", ")", "fatalerror", "(", "\"", "\"", ")", ";", "}", "tabledata", "->", "subtable", "[", "subindex", "]", ".", "usecount", "++", ";", "return", "subindex", "+", "SUBTABLE_BASE", ";", "}", "if", "(", "!", "subtable_merge", "(", "tabledata", ")", ")", "fatalerror", "(", "\"", "\"", ")", ";", "}", "}" ]
subtable_alloc - allocate a fresh subtable and set its usecount to 1
[ "subtable_alloc", "-", "allocate", "a", "fresh", "subtable", "and", "set", "its", "usecount", "to", "1" ]
[ "/* loop */", "/* find a subtable with a usecount of 0 */", "/* if this is past our allocation budget, allocate some more */", "/* bump the usecount and return */", "/* merge any subtables we can */" ]
[ { "param": "tabledata", "type": "address_table" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "tabledata", "type": "address_table", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
direct_range_find
direct_range
static direct_range *direct_range_find(address_space *space, offs_t byteaddress, UINT8 *entry) { direct_range **rangelistptr; direct_range **rangeptr; direct_range *range; /* determine which entry */ byteaddress &= space->bytemask; *entry = space->read.table[LEVEL1_INDEX(byteaddress)]; if (*entry >= SUBTABLE_BASE) *entry = space->read.table[LEVEL2_INDEX(*entry, byteaddress)]; rangelistptr = &space->direct.rangelist[*entry]; /* scan our table */ for (rangeptr = rangelistptr; *rangeptr != NULL; rangeptr = &(*rangeptr)->next) if (byteaddress >= (*rangeptr)->bytestart && byteaddress <= (*rangeptr)->byteend) { /* found a match; move us to the head of the list if we're not already there */ range = *rangeptr; if (range != *rangelistptr) { *rangeptr = range->next; range->next = *rangelistptr; *rangelistptr = range; } return range; } /* didn't find out; allocate a new one */ range = space->direct.freerangelist; if (range != NULL) space->direct.freerangelist = range->next; else range = alloc_or_die(direct_range); /* fill in the range */ table_derive_range(&space->read, byteaddress, &range->bytestart, &range->byteend); range->next = *rangelistptr; *rangelistptr = range; return range; }
/*------------------------------------------------- direct_range_find - find a byte address in a range -------------------------------------------------*/
find a byte address in a range
[ "find", "a", "byte", "address", "in", "a", "range" ]
static direct_range *direct_range_find(address_space *space, offs_t byteaddress, UINT8 *entry) { direct_range **rangelistptr; direct_range **rangeptr; direct_range *range; byteaddress &= space->bytemask; *entry = space->read.table[LEVEL1_INDEX(byteaddress)]; if (*entry >= SUBTABLE_BASE) *entry = space->read.table[LEVEL2_INDEX(*entry, byteaddress)]; rangelistptr = &space->direct.rangelist[*entry]; for (rangeptr = rangelistptr; *rangeptr != NULL; rangeptr = &(*rangeptr)->next) if (byteaddress >= (*rangeptr)->bytestart && byteaddress <= (*rangeptr)->byteend) { range = *rangeptr; if (range != *rangelistptr) { *rangeptr = range->next; range->next = *rangelistptr; *rangelistptr = range; } return range; } range = space->direct.freerangelist; if (range != NULL) space->direct.freerangelist = range->next; else range = alloc_or_die(direct_range); table_derive_range(&space->read, byteaddress, &range->bytestart, &range->byteend); range->next = *rangelistptr; *rangelistptr = range; return range; }
[ "static", "direct_range", "*", "direct_range_find", "(", "address_space", "*", "space", ",", "offs_t", "byteaddress", ",", "UINT8", "*", "entry", ")", "{", "direct_range", "*", "*", "rangelistptr", ";", "direct_range", "*", "*", "rangeptr", ";", "direct_range", "*", "range", ";", "byteaddress", "&=", "space", "->", "bytemask", ";", "*", "entry", "=", "space", "->", "read", ".", "table", "[", "LEVEL1_INDEX", "(", "byteaddress", ")", "]", ";", "if", "(", "*", "entry", ">=", "SUBTABLE_BASE", ")", "*", "entry", "=", "space", "->", "read", ".", "table", "[", "LEVEL2_INDEX", "(", "*", "entry", ",", "byteaddress", ")", "]", ";", "rangelistptr", "=", "&", "space", "->", "direct", ".", "rangelist", "[", "*", "entry", "]", ";", "for", "(", "rangeptr", "=", "rangelistptr", ";", "*", "rangeptr", "!=", "NULL", ";", "rangeptr", "=", "&", "(", "*", "rangeptr", ")", "->", "next", ")", "if", "(", "byteaddress", ">=", "(", "*", "rangeptr", ")", "->", "bytestart", "&&", "byteaddress", "<=", "(", "*", "rangeptr", ")", "->", "byteend", ")", "{", "range", "=", "*", "rangeptr", ";", "if", "(", "range", "!=", "*", "rangelistptr", ")", "{", "*", "rangeptr", "=", "range", "->", "next", ";", "range", "->", "next", "=", "*", "rangelistptr", ";", "*", "rangelistptr", "=", "range", ";", "}", "return", "range", ";", "}", "range", "=", "space", "->", "direct", ".", "freerangelist", ";", "if", "(", "range", "!=", "NULL", ")", "space", "->", "direct", ".", "freerangelist", "=", "range", "->", "next", ";", "else", "range", "=", "alloc_or_die", "(", "direct_range", ")", ";", "table_derive_range", "(", "&", "space", "->", "read", ",", "byteaddress", ",", "&", "range", "->", "bytestart", ",", "&", "range", "->", "byteend", ")", ";", "range", "->", "next", "=", "*", "rangelistptr", ";", "*", "rangelistptr", "=", "range", ";", "return", "range", ";", "}" ]
direct_range_find - find a byte address in a range
[ "direct_range_find", "-", "find", "a", "byte", "address", "in", "a", "range" ]
[ "/* determine which entry */", "/* scan our table */", "/* found a match; move us to the head of the list if we're not already there */", "/* didn't find out; allocate a new one */", "/* fill in the range */" ]
[ { "param": "space", "type": "address_space" }, { "param": "byteaddress", "type": "offs_t" }, { "param": "entry", "type": "UINT8" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "space", "type": "address_space", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "byteaddress", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "entry", "type": "UINT8", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
block_allocate
void
static void *block_allocate(const address_space *space, offs_t bytestart, offs_t byteend, void *memory) { memory_private *memdata = space->machine->memory_data; int allocatemem = (memory == NULL); memory_block *block; size_t bytestoalloc; const char *region; VPRINTF(("block_allocate('%s',%s,%08X,%08X,%p)\n", space->cpu->tag, space->name, bytestart, byteend, memory)); /* determine how much memory to allocate for this */ bytestoalloc = sizeof(*block); if (allocatemem) bytestoalloc += byteend - bytestart + 1; /* allocate and clear the memory */ block = (memory_block *)alloc_array_clear_or_die(UINT8, bytestoalloc); if (allocatemem) memory = block + 1; /* register for saving, but only if we're not part of a memory region */ for (region = memory_region_next(space->machine, NULL); region != NULL; region = memory_region_next(space->machine, region)) { UINT8 *region_base = memory_region(space->machine, region); UINT32 region_length = memory_region_length(space->machine, region); if (region_base != NULL && region_length != 0 && (UINT8 *)memory >= region_base && ((UINT8 *)memory + (byteend - bytestart + 1)) < region_base + region_length) { VPRINTF(("skipping save of this memory block as it is covered by a memory region\n")); break; } } /* if we didn't find a match, register */ if (region == NULL) { int bytes_per_element = space->dbits/8; char name[256]; sprintf(name, "%08x-%08x", bytestart, byteend); state_save_register_memory(space->machine, "memory", space->cpu->tag, space->spacenum, name, memory, bytes_per_element, (UINT32)(byteend - bytestart + 1) / bytes_per_element); } /* fill in the tracking block */ block->space = space; block->isallocated = allocatemem; block->bytestart = bytestart; block->byteend = byteend; block->data = (UINT8 *)memory; /* attach us to the head of the list */ block->next = memdata->memory_block_list; memdata->memory_block_list = block; return memory; }
/*------------------------------------------------- block_allocate - allocate a single memory block of data -------------------------------------------------*/
allocate a single memory block of data
[ "allocate", "a", "single", "memory", "block", "of", "data" ]
static void *block_allocate(const address_space *space, offs_t bytestart, offs_t byteend, void *memory) { memory_private *memdata = space->machine->memory_data; int allocatemem = (memory == NULL); memory_block *block; size_t bytestoalloc; const char *region; VPRINTF(("block_allocate('%s',%s,%08X,%08X,%p)\n", space->cpu->tag, space->name, bytestart, byteend, memory)); bytestoalloc = sizeof(*block); if (allocatemem) bytestoalloc += byteend - bytestart + 1; block = (memory_block *)alloc_array_clear_or_die(UINT8, bytestoalloc); if (allocatemem) memory = block + 1; for (region = memory_region_next(space->machine, NULL); region != NULL; region = memory_region_next(space->machine, region)) { UINT8 *region_base = memory_region(space->machine, region); UINT32 region_length = memory_region_length(space->machine, region); if (region_base != NULL && region_length != 0 && (UINT8 *)memory >= region_base && ((UINT8 *)memory + (byteend - bytestart + 1)) < region_base + region_length) { VPRINTF(("skipping save of this memory block as it is covered by a memory region\n")); break; } } if (region == NULL) { int bytes_per_element = space->dbits/8; char name[256]; sprintf(name, "%08x-%08x", bytestart, byteend); state_save_register_memory(space->machine, "memory", space->cpu->tag, space->spacenum, name, memory, bytes_per_element, (UINT32)(byteend - bytestart + 1) / bytes_per_element); } block->space = space; block->isallocated = allocatemem; block->bytestart = bytestart; block->byteend = byteend; block->data = (UINT8 *)memory; block->next = memdata->memory_block_list; memdata->memory_block_list = block; return memory; }
[ "static", "void", "*", "block_allocate", "(", "const", "address_space", "*", "space", ",", "offs_t", "bytestart", ",", "offs_t", "byteend", ",", "void", "*", "memory", ")", "{", "memory_private", "*", "memdata", "=", "space", "->", "machine", "->", "memory_data", ";", "int", "allocatemem", "=", "(", "memory", "==", "NULL", ")", ";", "memory_block", "*", "block", ";", "size_t", "bytestoalloc", ";", "const", "char", "*", "region", ";", "VPRINTF", "(", "(", "\"", "\\n", "\"", ",", "space", "->", "cpu", "->", "tag", ",", "space", "->", "name", ",", "bytestart", ",", "byteend", ",", "memory", ")", ")", ";", "bytestoalloc", "=", "sizeof", "(", "*", "block", ")", ";", "if", "(", "allocatemem", ")", "bytestoalloc", "+=", "byteend", "-", "bytestart", "+", "1", ";", "block", "=", "(", "memory_block", "*", ")", "alloc_array_clear_or_die", "(", "UINT8", ",", "bytestoalloc", ")", ";", "if", "(", "allocatemem", ")", "memory", "=", "block", "+", "1", ";", "for", "(", "region", "=", "memory_region_next", "(", "space", "->", "machine", ",", "NULL", ")", ";", "region", "!=", "NULL", ";", "region", "=", "memory_region_next", "(", "space", "->", "machine", ",", "region", ")", ")", "{", "UINT8", "*", "region_base", "=", "memory_region", "(", "space", "->", "machine", ",", "region", ")", ";", "UINT32", "region_length", "=", "memory_region_length", "(", "space", "->", "machine", ",", "region", ")", ";", "if", "(", "region_base", "!=", "NULL", "&&", "region_length", "!=", "0", "&&", "(", "UINT8", "*", ")", "memory", ">=", "region_base", "&&", "(", "(", "UINT8", "*", ")", "memory", "+", "(", "byteend", "-", "bytestart", "+", "1", ")", ")", "<", "region_base", "+", "region_length", ")", "{", "VPRINTF", "(", "(", "\"", "\\n", "\"", ")", ")", ";", "break", ";", "}", "}", "if", "(", "region", "==", "NULL", ")", "{", "int", "bytes_per_element", "=", "space", "->", "dbits", "/", "8", ";", "char", "name", "[", "256", "]", ";", "sprintf", "(", "name", ",", "\"", "\"", ",", "bytestart", ",", "byteend", ")", ";", "state_save_register_memory", "(", "space", "->", "machine", ",", "\"", "\"", ",", "space", "->", "cpu", "->", "tag", ",", "space", "->", "spacenum", ",", "name", ",", "memory", ",", "bytes_per_element", ",", "(", "UINT32", ")", "(", "byteend", "-", "bytestart", "+", "1", ")", "/", "bytes_per_element", ")", ";", "}", "block", "->", "space", "=", "space", ";", "block", "->", "isallocated", "=", "allocatemem", ";", "block", "->", "bytestart", "=", "bytestart", ";", "block", "->", "byteend", "=", "byteend", ";", "block", "->", "data", "=", "(", "UINT8", "*", ")", "memory", ";", "block", "->", "next", "=", "memdata", "->", "memory_block_list", ";", "memdata", "->", "memory_block_list", "=", "block", ";", "return", "memory", ";", "}" ]
block_allocate - allocate a single memory block of data
[ "block_allocate", "-", "allocate", "a", "single", "memory", "block", "of", "data" ]
[ "/* determine how much memory to allocate for this */", "/* allocate and clear the memory */", "/* register for saving, but only if we're not part of a memory region */", "/* if we didn't find a match, register */", "/* fill in the tracking block */", "/* attach us to the head of the list */" ]
[ { "param": "space", "type": "address_space" }, { "param": "bytestart", "type": "offs_t" }, { "param": "byteend", "type": "offs_t" }, { "param": "memory", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "space", "type": "address_space", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "bytestart", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "byteend", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "memory", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
block_assign_intersecting
address_map_entry
static address_map_entry *block_assign_intersecting(address_space *space, offs_t bytestart, offs_t byteend, UINT8 *base) { memory_private *memdata = space->machine->memory_data; address_map_entry *entry, *unassigned = NULL; /* loop over the adjusted map and assign memory to any blocks we can */ for (entry = space->map->entrylist; entry != NULL; entry = entry->next) { /* if we haven't assigned this block yet, do it against the last block */ if (entry->memory == NULL) { /* inherit shared pointers first */ if (entry->share != 0 && memdata->shared_ptr[entry->share] != NULL) { entry->memory = memdata->shared_ptr[entry->share]; VPRINTF(("memory range %08X-%08X -> shared_ptr[%d] [%p]\n", entry->addrstart, entry->addrend, entry->share, entry->memory)); } /* otherwise, look for a match in this block */ else if (entry->bytestart >= bytestart && entry->byteend <= byteend) { entry->memory = base + (entry->bytestart - bytestart); VPRINTF(("memory range %08X-%08X -> found in block from %08X-%08X [%p]\n", entry->addrstart, entry->addrend, bytestart, byteend, entry->memory)); } } /* if we're the first match on a shared pointer, assign it now */ if (entry->memory != NULL && entry->share && memdata->shared_ptr[entry->share] == NULL) memdata->shared_ptr[entry->share] = entry->memory; /* keep track of the first unassigned entry */ if (entry->memory == NULL && unassigned == NULL && space_needs_backing_store(space, entry)) unassigned = entry; } return unassigned; }
/*------------------------------------------------- block_assign_intersecting - find all intersecting blocks and assign their pointers -------------------------------------------------*/
find all intersecting blocks and assign their pointers
[ "find", "all", "intersecting", "blocks", "and", "assign", "their", "pointers" ]
static address_map_entry *block_assign_intersecting(address_space *space, offs_t bytestart, offs_t byteend, UINT8 *base) { memory_private *memdata = space->machine->memory_data; address_map_entry *entry, *unassigned = NULL; for (entry = space->map->entrylist; entry != NULL; entry = entry->next) { if (entry->memory == NULL) { if (entry->share != 0 && memdata->shared_ptr[entry->share] != NULL) { entry->memory = memdata->shared_ptr[entry->share]; VPRINTF(("memory range %08X-%08X -> shared_ptr[%d] [%p]\n", entry->addrstart, entry->addrend, entry->share, entry->memory)); } else if (entry->bytestart >= bytestart && entry->byteend <= byteend) { entry->memory = base + (entry->bytestart - bytestart); VPRINTF(("memory range %08X-%08X -> found in block from %08X-%08X [%p]\n", entry->addrstart, entry->addrend, bytestart, byteend, entry->memory)); } } if (entry->memory != NULL && entry->share && memdata->shared_ptr[entry->share] == NULL) memdata->shared_ptr[entry->share] = entry->memory; if (entry->memory == NULL && unassigned == NULL && space_needs_backing_store(space, entry)) unassigned = entry; } return unassigned; }
[ "static", "address_map_entry", "*", "block_assign_intersecting", "(", "address_space", "*", "space", ",", "offs_t", "bytestart", ",", "offs_t", "byteend", ",", "UINT8", "*", "base", ")", "{", "memory_private", "*", "memdata", "=", "space", "->", "machine", "->", "memory_data", ";", "address_map_entry", "*", "entry", ",", "*", "unassigned", "=", "NULL", ";", "for", "(", "entry", "=", "space", "->", "map", "->", "entrylist", ";", "entry", "!=", "NULL", ";", "entry", "=", "entry", "->", "next", ")", "{", "if", "(", "entry", "->", "memory", "==", "NULL", ")", "{", "if", "(", "entry", "->", "share", "!=", "0", "&&", "memdata", "->", "shared_ptr", "[", "entry", "->", "share", "]", "!=", "NULL", ")", "{", "entry", "->", "memory", "=", "memdata", "->", "shared_ptr", "[", "entry", "->", "share", "]", ";", "VPRINTF", "(", "(", "\"", "\\n", "\"", ",", "entry", "->", "addrstart", ",", "entry", "->", "addrend", ",", "entry", "->", "share", ",", "entry", "->", "memory", ")", ")", ";", "}", "else", "if", "(", "entry", "->", "bytestart", ">=", "bytestart", "&&", "entry", "->", "byteend", "<=", "byteend", ")", "{", "entry", "->", "memory", "=", "base", "+", "(", "entry", "->", "bytestart", "-", "bytestart", ")", ";", "VPRINTF", "(", "(", "\"", "\\n", "\"", ",", "entry", "->", "addrstart", ",", "entry", "->", "addrend", ",", "bytestart", ",", "byteend", ",", "entry", "->", "memory", ")", ")", ";", "}", "}", "if", "(", "entry", "->", "memory", "!=", "NULL", "&&", "entry", "->", "share", "&&", "memdata", "->", "shared_ptr", "[", "entry", "->", "share", "]", "==", "NULL", ")", "memdata", "->", "shared_ptr", "[", "entry", "->", "share", "]", "=", "entry", "->", "memory", ";", "if", "(", "entry", "->", "memory", "==", "NULL", "&&", "unassigned", "==", "NULL", "&&", "space_needs_backing_store", "(", "space", ",", "entry", ")", ")", "unassigned", "=", "entry", ";", "}", "return", "unassigned", ";", "}" ]
block_assign_intersecting - find all intersecting blocks and assign their pointers
[ "block_assign_intersecting", "-", "find", "all", "intersecting", "blocks", "and", "assign", "their", "pointers" ]
[ "/* loop over the adjusted map and assign memory to any blocks we can */", "/* if we haven't assigned this block yet, do it against the last block */", "/* inherit shared pointers first */", "/* otherwise, look for a match in this block */", "/* if we're the first match on a shared pointer, assign it now */", "/* keep track of the first unassigned entry */" ]
[ { "param": "space", "type": "address_space" }, { "param": "bytestart", "type": "offs_t" }, { "param": "byteend", "type": "offs_t" }, { "param": "base", "type": "UINT8" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "space", "type": "address_space", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "bytestart", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "byteend", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "base", "type": "UINT8", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
handler_to_string
char
static const char *handler_to_string(const address_table *table, UINT8 entry) { static const char *const strings[] = { "invalid", "bank 1", "bank 2", "bank 3", "bank 4", "bank 5", "bank 6", "bank 7", "bank 8", "bank 9", "bank 10", "bank 11", "bank 12", "bank 13", "bank 14", "bank 15", "bank 16", "bank 17", "bank 18", "bank 19", "bank 20", "bank 21", "bank 22", "bank 23", "bank 24", "bank 25", "bank 26", "bank 27", "bank 28", "bank 29", "bank 30", "bank 31", "bank 32", "bank 33", "bank 34", "bank 35", "bank 36", "bank 37", "bank 38", "bank 39", "bank 40", "bank 41", "bank 42", "bank 43", "bank 44", "bank 45", "bank 46", "bank 47", "bank 48", "bank 49", "bank 50", "bank 51", "bank 52", "bank 53", "bank 54", "bank 55", "bank 56", "bank 57", "bank 58", "bank 59", "bank 60", "bank 61", "bank 62", "bank 63", "bank 64", "bank 65", "bank 66", "bank 67", "bank 68", "bank 69", "bank 70", "bank 71", "bank 72", "bank 73", "bank 74", "bank 75", "bank 76", "bank 77", "bank 78", "bank 79", "bank 80", "bank 81", "bank 82", "bank 83", "bank 84", "bank 85", "bank 86", "bank 87", "bank 88", "bank 89", "bank 90", "bank 91", "bank 92", "bank 93", "bank 94", "bank 95", "bank 96", "ram[97]", "ram[98]", "ram[99]", "ram[100]", "ram[101]", "ram[102]", "ram[103]", "ram[104]", "ram[105]", "ram[106]", "ram[107]", "ram[108]", "ram[109]", "ram[110]", "ram[111]", "ram[112]", "ram[113]", "ram[114]", "ram[115]", "ram[116]", "ram[117]", "ram[118]", "ram[119]", "ram[120]", "ram[121]", "ram[122]", "ram", "rom", "nop", "unmapped", "watchpoint" }; /* constant strings for lower entries */ if (entry < STATIC_COUNT) return strings[entry]; else return (table->handlers[entry]->name != NULL) ? table->handlers[entry]->name : "???"; }
/*------------------------------------------------- handler_to_string - return friendly string description of a handler -------------------------------------------------*/
return friendly string description of a handler
[ "return", "friendly", "string", "description", "of", "a", "handler" ]
static const char *handler_to_string(const address_table *table, UINT8 entry) { static const char *const strings[] = { "invalid", "bank 1", "bank 2", "bank 3", "bank 4", "bank 5", "bank 6", "bank 7", "bank 8", "bank 9", "bank 10", "bank 11", "bank 12", "bank 13", "bank 14", "bank 15", "bank 16", "bank 17", "bank 18", "bank 19", "bank 20", "bank 21", "bank 22", "bank 23", "bank 24", "bank 25", "bank 26", "bank 27", "bank 28", "bank 29", "bank 30", "bank 31", "bank 32", "bank 33", "bank 34", "bank 35", "bank 36", "bank 37", "bank 38", "bank 39", "bank 40", "bank 41", "bank 42", "bank 43", "bank 44", "bank 45", "bank 46", "bank 47", "bank 48", "bank 49", "bank 50", "bank 51", "bank 52", "bank 53", "bank 54", "bank 55", "bank 56", "bank 57", "bank 58", "bank 59", "bank 60", "bank 61", "bank 62", "bank 63", "bank 64", "bank 65", "bank 66", "bank 67", "bank 68", "bank 69", "bank 70", "bank 71", "bank 72", "bank 73", "bank 74", "bank 75", "bank 76", "bank 77", "bank 78", "bank 79", "bank 80", "bank 81", "bank 82", "bank 83", "bank 84", "bank 85", "bank 86", "bank 87", "bank 88", "bank 89", "bank 90", "bank 91", "bank 92", "bank 93", "bank 94", "bank 95", "bank 96", "ram[97]", "ram[98]", "ram[99]", "ram[100]", "ram[101]", "ram[102]", "ram[103]", "ram[104]", "ram[105]", "ram[106]", "ram[107]", "ram[108]", "ram[109]", "ram[110]", "ram[111]", "ram[112]", "ram[113]", "ram[114]", "ram[115]", "ram[116]", "ram[117]", "ram[118]", "ram[119]", "ram[120]", "ram[121]", "ram[122]", "ram", "rom", "nop", "unmapped", "watchpoint" }; if (entry < STATIC_COUNT) return strings[entry]; else return (table->handlers[entry]->name != NULL) ? table->handlers[entry]->name : "???"; }
[ "static", "const", "char", "*", "handler_to_string", "(", "const", "address_table", "*", "table", ",", "UINT8", "entry", ")", "{", "static", "const", "char", "*", "const", "strings", "[", "]", "=", "{", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", ",", "\"", "\"", "}", ";", "if", "(", "entry", "<", "STATIC_COUNT", ")", "return", "strings", "[", "entry", "]", ";", "else", "return", "(", "table", "->", "handlers", "[", "entry", "]", "->", "name", "!=", "NULL", ")", "?", "table", "->", "handlers", "[", "entry", "]", "->", "name", ":", "\"", "\"", ";", "}" ]
handler_to_string - return friendly string description of a handler
[ "handler_to_string", "-", "return", "friendly", "string", "description", "of", "a", "handler" ]
[ "/* constant strings for lower entries */" ]
[ { "param": "table", "type": "address_table" }, { "param": "entry", "type": "UINT8" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "table", "type": "address_table", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "entry", "type": "UINT8", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4e2ffaf09ead858b5d0797fdedb072bb9526fd7a
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/memory.c
[ "Unlicense" ]
C
dump_map
void
static void dump_map(FILE *file, const address_space *space, const address_table *table) { offs_t byteaddress, bytestart, byteend; /* dump generic information */ fprintf(file, " Address bits = %d\n", space->abits); fprintf(file, " Data bits = %d\n", space->dbits); fprintf(file, " L1 bits = %d\n", LEVEL1_BITS); fprintf(file, " L2 bits = %d\n", LEVEL2_BITS); fprintf(file, " Address mask = %X\n", space->bytemask); fprintf(file, "\n"); /* iterate over addresses */ for (byteaddress = 0; byteaddress <= space->bytemask; byteaddress = byteend + 1) { UINT8 entry = table_derive_range(table, byteaddress, &bytestart, &byteend); fprintf(file, "%08X-%08X = %02X: %s [offset=%08X]\n", bytestart, byteend, entry, handler_to_string(table, entry), table->handlers[entry]->bytestart); } }
/*------------------------------------------------- dump_map - dump the contents of a single address space -------------------------------------------------*/
dump the contents of a single address space
[ "dump", "the", "contents", "of", "a", "single", "address", "space" ]
static void dump_map(FILE *file, const address_space *space, const address_table *table) { offs_t byteaddress, bytestart, byteend; fprintf(file, " Address bits = %d\n", space->abits); fprintf(file, " Data bits = %d\n", space->dbits); fprintf(file, " L1 bits = %d\n", LEVEL1_BITS); fprintf(file, " L2 bits = %d\n", LEVEL2_BITS); fprintf(file, " Address mask = %X\n", space->bytemask); fprintf(file, "\n"); for (byteaddress = 0; byteaddress <= space->bytemask; byteaddress = byteend + 1) { UINT8 entry = table_derive_range(table, byteaddress, &bytestart, &byteend); fprintf(file, "%08X-%08X = %02X: %s [offset=%08X]\n", bytestart, byteend, entry, handler_to_string(table, entry), table->handlers[entry]->bytestart); } }
[ "static", "void", "dump_map", "(", "FILE", "*", "file", ",", "const", "address_space", "*", "space", ",", "const", "address_table", "*", "table", ")", "{", "offs_t", "byteaddress", ",", "bytestart", ",", "byteend", ";", "fprintf", "(", "file", ",", "\"", "\\n", "\"", ",", "space", "->", "abits", ")", ";", "fprintf", "(", "file", ",", "\"", "\\n", "\"", ",", "space", "->", "dbits", ")", ";", "fprintf", "(", "file", ",", "\"", "\\n", "\"", ",", "LEVEL1_BITS", ")", ";", "fprintf", "(", "file", ",", "\"", "\\n", "\"", ",", "LEVEL2_BITS", ")", ";", "fprintf", "(", "file", ",", "\"", "\\n", "\"", ",", "space", "->", "bytemask", ")", ";", "fprintf", "(", "file", ",", "\"", "\\n", "\"", ")", ";", "for", "(", "byteaddress", "=", "0", ";", "byteaddress", "<=", "space", "->", "bytemask", ";", "byteaddress", "=", "byteend", "+", "1", ")", "{", "UINT8", "entry", "=", "table_derive_range", "(", "table", ",", "byteaddress", ",", "&", "bytestart", ",", "&", "byteend", ")", ";", "fprintf", "(", "file", ",", "\"", "\\n", "\"", ",", "bytestart", ",", "byteend", ",", "entry", ",", "handler_to_string", "(", "table", ",", "entry", ")", ",", "table", "->", "handlers", "[", "entry", "]", "->", "bytestart", ")", ";", "}", "}" ]
dump_map - dump the contents of a single address space
[ "dump_map", "-", "dump", "the", "contents", "of", "a", "single", "address", "space" ]
[ "/* dump generic information */", "/* iterate over addresses */" ]
[ { "param": "file", "type": "FILE" }, { "param": "space", "type": "address_space" }, { "param": "table", "type": "address_table" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "file", "type": "FILE", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "space", "type": "address_space", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "table", "type": "address_table", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7ca86454d4ba1417a39f535a7d5cb23a134fcf91
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/cpu/m6502/m6502.c
[ "Unlicense" ]
C
n2a03_irq
void
void n2a03_irq(const device_config *device) { m6502_Regs *cpustate = get_safe_token(device); m6502_take_irq(cpustate); }
/* The N2A03 is integrally tied to its PSG (they're on the same die). Bit 7 of address $4011 (the PSG's DPCM control register), when set, causes an IRQ to be generated. This function allows the IRQ to be called from the PSG core when such an occasion arises. */
The N2A03 is integrally tied to its PSG (they're on the same die). Bit 7 of address $4011 (the PSG's DPCM control register), when set, causes an IRQ to be generated. This function allows the IRQ to be called from the PSG core when such an occasion arises.
[ "The", "N2A03", "is", "integrally", "tied", "to", "its", "PSG", "(", "they", "'", "re", "on", "the", "same", "die", ")", ".", "Bit", "7", "of", "address", "$4011", "(", "the", "PSG", "'", "s", "DPCM", "control", "register", ")", "when", "set", "causes", "an", "IRQ", "to", "be", "generated", ".", "This", "function", "allows", "the", "IRQ", "to", "be", "called", "from", "the", "PSG", "core", "when", "such", "an", "occasion", "arises", "." ]
void n2a03_irq(const device_config *device) { m6502_Regs *cpustate = get_safe_token(device); m6502_take_irq(cpustate); }
[ "void", "n2a03_irq", "(", "const", "device_config", "*", "device", ")", "{", "m6502_Regs", "*", "cpustate", "=", "get_safe_token", "(", "device", ")", ";", "m6502_take_irq", "(", "cpustate", ")", ";", "}" ]
The N2A03 is integrally tied to its PSG (they're on the same die).
[ "The", "N2A03", "is", "integrally", "tied", "to", "its", "PSG", "(", "they", "'", "re", "on", "the", "same", "die", ")", "." ]
[]
[ { "param": "device", "type": "device_config" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "device", "type": "device_config", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b70bc68086a65219ac772a1916ac006ea174c68a
lofunz/mieme
Reloaded/trunk/src/mame/drivers/raiden.c
[ "Unlicense" ]
C
common_decrypt
void
static void common_decrypt(running_machine *machine) { UINT16 *RAM = (UINT16 *)memory_region(machine, "maincpu"); int i; for (i = 0; i < 0x20000; i++) { static const UINT16 xor_table[] = { 0x200e,0x0006,0x000a,0x0002,0x240e,0x000e,0x04c2,0x00c2,0x008c,0x0004,0x0088,0x0000,0x048c,0x000c,0x04c0,0x00c0 }; UINT16 data = RAM[0xc0000/2 + i]; data ^= xor_table[i & 0x0f]; data = BITSWAP16(data, 15,14,10,12,11,13,9,8,3,2,5,4,7,1,6,0); RAM[0xc0000/2 + i] = data; } RAM = (UINT16 *)memory_region(machine, "sub"); for (i = 0; i < 0x20000; i++) { static const UINT16 xor_table[] = { 0x0080,0x0080,0x0244,0x0288,0x0288,0x0288,0x1041,0x1009 }; UINT16 data = RAM[0xc0000/2 + i]; data ^= xor_table[i & 0x07]; data = BITSWAP16(data, 15,14,13,9,11,10,12,8,2,0,5,4,7,3,1,6); RAM[0xc0000/2 + i] = data; } }
/* This is based on code by Niclas Karlsson Mate, who figured out the encryption method! The technique is a combination of a XOR table plus bit-swapping */
This is based on code by Niclas Karlsson Mate, who figured out the encryption method. The technique is a combination of a XOR table plus bit-swapping
[ "This", "is", "based", "on", "code", "by", "Niclas", "Karlsson", "Mate", "who", "figured", "out", "the", "encryption", "method", ".", "The", "technique", "is", "a", "combination", "of", "a", "XOR", "table", "plus", "bit", "-", "swapping" ]
static void common_decrypt(running_machine *machine) { UINT16 *RAM = (UINT16 *)memory_region(machine, "maincpu"); int i; for (i = 0; i < 0x20000; i++) { static const UINT16 xor_table[] = { 0x200e,0x0006,0x000a,0x0002,0x240e,0x000e,0x04c2,0x00c2,0x008c,0x0004,0x0088,0x0000,0x048c,0x000c,0x04c0,0x00c0 }; UINT16 data = RAM[0xc0000/2 + i]; data ^= xor_table[i & 0x0f]; data = BITSWAP16(data, 15,14,10,12,11,13,9,8,3,2,5,4,7,1,6,0); RAM[0xc0000/2 + i] = data; } RAM = (UINT16 *)memory_region(machine, "sub"); for (i = 0; i < 0x20000; i++) { static const UINT16 xor_table[] = { 0x0080,0x0080,0x0244,0x0288,0x0288,0x0288,0x1041,0x1009 }; UINT16 data = RAM[0xc0000/2 + i]; data ^= xor_table[i & 0x07]; data = BITSWAP16(data, 15,14,13,9,11,10,12,8,2,0,5,4,7,3,1,6); RAM[0xc0000/2 + i] = data; } }
[ "static", "void", "common_decrypt", "(", "running_machine", "*", "machine", ")", "{", "UINT16", "*", "RAM", "=", "(", "UINT16", "*", ")", "memory_region", "(", "machine", ",", "\"", "\"", ")", ";", "int", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "0x20000", ";", "i", "++", ")", "{", "static", "const", "UINT16", "xor_table", "[", "]", "=", "{", "0x200e", ",", "0x0006", ",", "0x000a", ",", "0x0002", ",", "0x240e", ",", "0x000e", ",", "0x04c2", ",", "0x00c2", ",", "0x008c", ",", "0x0004", ",", "0x0088", ",", "0x0000", ",", "0x048c", ",", "0x000c", ",", "0x04c0", ",", "0x00c0", "}", ";", "UINT16", "data", "=", "RAM", "[", "0xc0000", "/", "2", "+", "i", "]", ";", "data", "^=", "xor_table", "[", "i", "&", "0x0f", "]", ";", "data", "=", "BITSWAP16", "(", "data", ",", "15", ",", "14", ",", "10", ",", "12", ",", "11", ",", "13", ",", "9", ",", "8", ",", "3", ",", "2", ",", "5", ",", "4", ",", "7", ",", "1", ",", "6", ",", "0", ")", ";", "RAM", "[", "0xc0000", "/", "2", "+", "i", "]", "=", "data", ";", "}", "RAM", "=", "(", "UINT16", "*", ")", "memory_region", "(", "machine", ",", "\"", "\"", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "0x20000", ";", "i", "++", ")", "{", "static", "const", "UINT16", "xor_table", "[", "]", "=", "{", "0x0080", ",", "0x0080", ",", "0x0244", ",", "0x0288", ",", "0x0288", ",", "0x0288", ",", "0x1041", ",", "0x1009", "}", ";", "UINT16", "data", "=", "RAM", "[", "0xc0000", "/", "2", "+", "i", "]", ";", "data", "^=", "xor_table", "[", "i", "&", "0x07", "]", ";", "data", "=", "BITSWAP16", "(", "data", ",", "15", ",", "14", ",", "13", ",", "9", ",", "11", ",", "10", ",", "12", ",", "8", ",", "2", ",", "0", ",", "5", ",", "4", ",", "7", ",", "3", ",", "1", ",", "6", ")", ";", "RAM", "[", "0xc0000", "/", "2", "+", "i", "]", "=", "data", ";", "}", "}" ]
This is based on code by Niclas Karlsson Mate, who figured out the encryption method!
[ "This", "is", "based", "on", "code", "by", "Niclas", "Karlsson", "Mate", "who", "figured", "out", "the", "encryption", "method!" ]
[]
[ { "param": "machine", "type": "running_machine" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4eb8c94b3e4a0efdce2533da8010f6451a379eb1
lofunz/mieme
Reloaded/trunk/src/emu/cpu/drcfe.c
[ "Unlicense" ]
C
drcfe_describe_code
opcode_desc
const opcode_desc *drcfe_describe_code(drcfe_state *drcfe, offs_t startpc) { offs_t minpc = startpc - MIN(drcfe->window_start, startpc); offs_t maxpc = startpc + MIN(drcfe->window_end, 0xffffffff - startpc); pc_stack_entry pcstack[MAX_STACK_DEPTH]; pc_stack_entry *pcstackptr = &pcstack[0]; opcode_desc **tailptr; /* release any descriptions we've accumulated */ release_descriptions(drcfe, drcfe->desc_live_list); drcfe->desc_live_list = NULL; /* add the initial PC to the stack */ pcstackptr->srcpc = 0; pcstackptr->targetpc = startpc; pcstackptr++; /* loop while we still have a stack */ while (pcstackptr != &pcstack[0]) { pc_stack_entry *curstack = --pcstackptr; opcode_desc *curdesc; offs_t curpc; /* if we've already hit this PC, just mark it a branch target and continue */ curdesc = drcfe->desc_array[curstack->targetpc - minpc]; if (curdesc != NULL) { curdesc->flags |= OPFLAG_IS_BRANCH_TARGET; /* if the branch crosses a page boundary, mark the target as needing to revalidate */ if (drcfe->pageshift != 0 && ((curstack->srcpc ^ curdesc->pc) >> drcfe->pageshift) != 0) curdesc->flags |= OPFLAG_VALIDATE_TLB | OPFLAG_CAN_CAUSE_EXCEPTION; /* continue processing */ continue; } /* loop until we exit the block */ for (curpc = curstack->targetpc; curpc >= minpc && curpc < maxpc && drcfe->desc_array[curpc - minpc] == NULL; curpc += drcfe->desc_array[curpc - minpc]->length) { /* allocate a new description and describe this instruction */ drcfe->desc_array[curpc - minpc] = curdesc = describe_one(drcfe, curpc, curdesc); /* first instruction in a sequence is always a branch target */ if (curpc == curstack->targetpc) curdesc->flags |= OPFLAG_IS_BRANCH_TARGET; /* stop if we hit a page fault */ if (curdesc->flags & OPFLAG_COMPILER_PAGE_FAULT) break; /* if we are the first instruction in the whole window, we must validate the TLB */ if (curpc == startpc && drcfe->pageshift != 0) curdesc->flags |= OPFLAG_VALIDATE_TLB | OPFLAG_CAN_CAUSE_EXCEPTION; /* if we are a branch within the block range, add the branch target to our stack */ if ((curdesc->flags & OPFLAG_IS_BRANCH) && curdesc->targetpc >= minpc && curdesc->targetpc < maxpc && pcstackptr < &pcstack[MAX_STACK_DEPTH]) { curdesc->flags |= OPFLAG_INTRABLOCK_BRANCH; pcstackptr->srcpc = curdesc->pc; pcstackptr->targetpc = curdesc->targetpc; pcstackptr++; } /* if we're done, we're done */ if (curdesc->flags & OPFLAG_END_SEQUENCE) break; } } /* now build the list of descriptions in order */ /* first from startpc -> maxpc, then from minpc -> startpc */ tailptr = build_sequence(drcfe, &drcfe->desc_live_list, startpc - minpc, maxpc - minpc, OPFLAG_REDISPATCH); tailptr = build_sequence(drcfe, tailptr, minpc - minpc, startpc - minpc, OPFLAG_RETURN_TO_START); return drcfe->desc_live_list; }
/*------------------------------------------------- drcfe_describe_code - describe a sequence of code that falls within the configured window relative to the specified startpc -------------------------------------------------*/
describe a sequence of code that falls within the configured window relative to the specified startpc
[ "describe", "a", "sequence", "of", "code", "that", "falls", "within", "the", "configured", "window", "relative", "to", "the", "specified", "startpc" ]
const opcode_desc *drcfe_describe_code(drcfe_state *drcfe, offs_t startpc) { offs_t minpc = startpc - MIN(drcfe->window_start, startpc); offs_t maxpc = startpc + MIN(drcfe->window_end, 0xffffffff - startpc); pc_stack_entry pcstack[MAX_STACK_DEPTH]; pc_stack_entry *pcstackptr = &pcstack[0]; opcode_desc **tailptr; release_descriptions(drcfe, drcfe->desc_live_list); drcfe->desc_live_list = NULL; pcstackptr->srcpc = 0; pcstackptr->targetpc = startpc; pcstackptr++; while (pcstackptr != &pcstack[0]) { pc_stack_entry *curstack = --pcstackptr; opcode_desc *curdesc; offs_t curpc; curdesc = drcfe->desc_array[curstack->targetpc - minpc]; if (curdesc != NULL) { curdesc->flags |= OPFLAG_IS_BRANCH_TARGET; if (drcfe->pageshift != 0 && ((curstack->srcpc ^ curdesc->pc) >> drcfe->pageshift) != 0) curdesc->flags |= OPFLAG_VALIDATE_TLB | OPFLAG_CAN_CAUSE_EXCEPTION; continue; } for (curpc = curstack->targetpc; curpc >= minpc && curpc < maxpc && drcfe->desc_array[curpc - minpc] == NULL; curpc += drcfe->desc_array[curpc - minpc]->length) { drcfe->desc_array[curpc - minpc] = curdesc = describe_one(drcfe, curpc, curdesc); if (curpc == curstack->targetpc) curdesc->flags |= OPFLAG_IS_BRANCH_TARGET; if (curdesc->flags & OPFLAG_COMPILER_PAGE_FAULT) break; if (curpc == startpc && drcfe->pageshift != 0) curdesc->flags |= OPFLAG_VALIDATE_TLB | OPFLAG_CAN_CAUSE_EXCEPTION; if ((curdesc->flags & OPFLAG_IS_BRANCH) && curdesc->targetpc >= minpc && curdesc->targetpc < maxpc && pcstackptr < &pcstack[MAX_STACK_DEPTH]) { curdesc->flags |= OPFLAG_INTRABLOCK_BRANCH; pcstackptr->srcpc = curdesc->pc; pcstackptr->targetpc = curdesc->targetpc; pcstackptr++; } if (curdesc->flags & OPFLAG_END_SEQUENCE) break; } } tailptr = build_sequence(drcfe, &drcfe->desc_live_list, startpc - minpc, maxpc - minpc, OPFLAG_REDISPATCH); tailptr = build_sequence(drcfe, tailptr, minpc - minpc, startpc - minpc, OPFLAG_RETURN_TO_START); return drcfe->desc_live_list; }
[ "const", "opcode_desc", "*", "drcfe_describe_code", "(", "drcfe_state", "*", "drcfe", ",", "offs_t", "startpc", ")", "{", "offs_t", "minpc", "=", "startpc", "-", "MIN", "(", "drcfe", "->", "window_start", ",", "startpc", ")", ";", "offs_t", "maxpc", "=", "startpc", "+", "MIN", "(", "drcfe", "->", "window_end", ",", "0xffffffff", "-", "startpc", ")", ";", "pc_stack_entry", "pcstack", "[", "MAX_STACK_DEPTH", "]", ";", "pc_stack_entry", "*", "pcstackptr", "=", "&", "pcstack", "[", "0", "]", ";", "opcode_desc", "*", "*", "tailptr", ";", "release_descriptions", "(", "drcfe", ",", "drcfe", "->", "desc_live_list", ")", ";", "drcfe", "->", "desc_live_list", "=", "NULL", ";", "pcstackptr", "->", "srcpc", "=", "0", ";", "pcstackptr", "->", "targetpc", "=", "startpc", ";", "pcstackptr", "++", ";", "while", "(", "pcstackptr", "!=", "&", "pcstack", "[", "0", "]", ")", "{", "pc_stack_entry", "*", "curstack", "=", "--", "pcstackptr", ";", "opcode_desc", "*", "curdesc", ";", "offs_t", "curpc", ";", "curdesc", "=", "drcfe", "->", "desc_array", "[", "curstack", "->", "targetpc", "-", "minpc", "]", ";", "if", "(", "curdesc", "!=", "NULL", ")", "{", "curdesc", "->", "flags", "|=", "OPFLAG_IS_BRANCH_TARGET", ";", "if", "(", "drcfe", "->", "pageshift", "!=", "0", "&&", "(", "(", "curstack", "->", "srcpc", "^", "curdesc", "->", "pc", ")", ">>", "drcfe", "->", "pageshift", ")", "!=", "0", ")", "curdesc", "->", "flags", "|=", "OPFLAG_VALIDATE_TLB", "|", "OPFLAG_CAN_CAUSE_EXCEPTION", ";", "continue", ";", "}", "for", "(", "curpc", "=", "curstack", "->", "targetpc", ";", "curpc", ">=", "minpc", "&&", "curpc", "<", "maxpc", "&&", "drcfe", "->", "desc_array", "[", "curpc", "-", "minpc", "]", "==", "NULL", ";", "curpc", "+=", "drcfe", "->", "desc_array", "[", "curpc", "-", "minpc", "]", "->", "length", ")", "{", "drcfe", "->", "desc_array", "[", "curpc", "-", "minpc", "]", "=", "curdesc", "=", "describe_one", "(", "drcfe", ",", "curpc", ",", "curdesc", ")", ";", "if", "(", "curpc", "==", "curstack", "->", "targetpc", ")", "curdesc", "->", "flags", "|=", "OPFLAG_IS_BRANCH_TARGET", ";", "if", "(", "curdesc", "->", "flags", "&", "OPFLAG_COMPILER_PAGE_FAULT", ")", "break", ";", "if", "(", "curpc", "==", "startpc", "&&", "drcfe", "->", "pageshift", "!=", "0", ")", "curdesc", "->", "flags", "|=", "OPFLAG_VALIDATE_TLB", "|", "OPFLAG_CAN_CAUSE_EXCEPTION", ";", "if", "(", "(", "curdesc", "->", "flags", "&", "OPFLAG_IS_BRANCH", ")", "&&", "curdesc", "->", "targetpc", ">=", "minpc", "&&", "curdesc", "->", "targetpc", "<", "maxpc", "&&", "pcstackptr", "<", "&", "pcstack", "[", "MAX_STACK_DEPTH", "]", ")", "{", "curdesc", "->", "flags", "|=", "OPFLAG_INTRABLOCK_BRANCH", ";", "pcstackptr", "->", "srcpc", "=", "curdesc", "->", "pc", ";", "pcstackptr", "->", "targetpc", "=", "curdesc", "->", "targetpc", ";", "pcstackptr", "++", ";", "}", "if", "(", "curdesc", "->", "flags", "&", "OPFLAG_END_SEQUENCE", ")", "break", ";", "}", "}", "tailptr", "=", "build_sequence", "(", "drcfe", ",", "&", "drcfe", "->", "desc_live_list", ",", "startpc", "-", "minpc", ",", "maxpc", "-", "minpc", ",", "OPFLAG_REDISPATCH", ")", ";", "tailptr", "=", "build_sequence", "(", "drcfe", ",", "tailptr", ",", "minpc", "-", "minpc", ",", "startpc", "-", "minpc", ",", "OPFLAG_RETURN_TO_START", ")", ";", "return", "drcfe", "->", "desc_live_list", ";", "}" ]
drcfe_describe_code - describe a sequence of code that falls within the configured window relative to the specified startpc
[ "drcfe_describe_code", "-", "describe", "a", "sequence", "of", "code", "that", "falls", "within", "the", "configured", "window", "relative", "to", "the", "specified", "startpc" ]
[ "/* release any descriptions we've accumulated */", "/* add the initial PC to the stack */", "/* loop while we still have a stack */", "/* if we've already hit this PC, just mark it a branch target and continue */", "/* if the branch crosses a page boundary, mark the target as needing to revalidate */", "/* continue processing */", "/* loop until we exit the block */", "/* allocate a new description and describe this instruction */", "/* first instruction in a sequence is always a branch target */", "/* stop if we hit a page fault */", "/* if we are the first instruction in the whole window, we must validate the TLB */", "/* if we are a branch within the block range, add the branch target to our stack */", "/* if we're done, we're done */", "/* now build the list of descriptions in order */", "/* first from startpc -> maxpc, then from minpc -> startpc */" ]
[ { "param": "drcfe", "type": "drcfe_state" }, { "param": "startpc", "type": "offs_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "drcfe", "type": "drcfe_state", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "startpc", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4eb8c94b3e4a0efdce2533da8010f6451a379eb1
lofunz/mieme
Reloaded/trunk/src/emu/cpu/drcfe.c
[ "Unlicense" ]
C
describe_one
opcode_desc
static opcode_desc *describe_one(drcfe_state *drcfe, offs_t curpc, const opcode_desc *prevdesc) { opcode_desc *desc = desc_alloc(drcfe); /* initialize the description */ memset(desc, 0, sizeof(*desc)); desc->pc = curpc; desc->physpc = curpc; desc->targetpc = BRANCH_TARGET_DYNAMIC; /* call the callback to describe an instruction */ if (!(*drcfe->describe)(drcfe->param, desc, prevdesc)) { desc->flags |= OPFLAG_WILL_CAUSE_EXCEPTION | OPFLAG_INVALID_OPCODE; return desc; } /* validate the TLB if we are exactly at the start of a page, or if we cross a page boundary */ if (drcfe->pageshift != 0 && (((curpc - 1) ^ (curpc + desc->length - 1)) >> drcfe->pageshift) != 0) desc->flags |= OPFLAG_VALIDATE_TLB | OPFLAG_CAN_CAUSE_EXCEPTION; /* validate stuff */ assert(desc->length > 0 || (desc->flags & OPFLAG_VIRTUAL_NOOP) != 0); /* if we are a branch with delay slots, recursively walk those */ if (desc->flags & OPFLAG_IS_BRANCH) { opcode_desc **tailptr = &desc->delay; offs_t delaypc = curpc + desc->length; opcode_desc *prev = desc; UINT8 slotnum; /* iterate over slots and describe them */ for (slotnum = 0; slotnum < desc->delayslots; slotnum++) { /* recursively describe the next instruction */ *tailptr = describe_one(drcfe, delaypc, prev); if (*tailptr == NULL) break; /* set the delay slot flag and a pointer back to the original branch */ (*tailptr)->flags |= OPFLAG_IN_DELAY_SLOT; (*tailptr)->branch = desc; (*tailptr)->prev = prev; prev = *tailptr; /* stop if we hit a page fault */ if ((*tailptr)->flags & OPFLAG_COMPILER_PAGE_FAULT) break; /* otherwise, advance */ delaypc += (*tailptr)->length; tailptr = &(*tailptr)->next; } } return desc; }
/*------------------------------------------------- describe_one - describe a single instruction, recursively describing opcodes in delay slots of branches as well -------------------------------------------------*/
describe a single instruction, recursively describing opcodes in delay slots of branches as well
[ "describe", "a", "single", "instruction", "recursively", "describing", "opcodes", "in", "delay", "slots", "of", "branches", "as", "well" ]
static opcode_desc *describe_one(drcfe_state *drcfe, offs_t curpc, const opcode_desc *prevdesc) { opcode_desc *desc = desc_alloc(drcfe); memset(desc, 0, sizeof(*desc)); desc->pc = curpc; desc->physpc = curpc; desc->targetpc = BRANCH_TARGET_DYNAMIC; if (!(*drcfe->describe)(drcfe->param, desc, prevdesc)) { desc->flags |= OPFLAG_WILL_CAUSE_EXCEPTION | OPFLAG_INVALID_OPCODE; return desc; } if (drcfe->pageshift != 0 && (((curpc - 1) ^ (curpc + desc->length - 1)) >> drcfe->pageshift) != 0) desc->flags |= OPFLAG_VALIDATE_TLB | OPFLAG_CAN_CAUSE_EXCEPTION; assert(desc->length > 0 || (desc->flags & OPFLAG_VIRTUAL_NOOP) != 0); if (desc->flags & OPFLAG_IS_BRANCH) { opcode_desc **tailptr = &desc->delay; offs_t delaypc = curpc + desc->length; opcode_desc *prev = desc; UINT8 slotnum; for (slotnum = 0; slotnum < desc->delayslots; slotnum++) { *tailptr = describe_one(drcfe, delaypc, prev); if (*tailptr == NULL) break; (*tailptr)->flags |= OPFLAG_IN_DELAY_SLOT; (*tailptr)->branch = desc; (*tailptr)->prev = prev; prev = *tailptr; if ((*tailptr)->flags & OPFLAG_COMPILER_PAGE_FAULT) break; delaypc += (*tailptr)->length; tailptr = &(*tailptr)->next; } } return desc; }
[ "static", "opcode_desc", "*", "describe_one", "(", "drcfe_state", "*", "drcfe", ",", "offs_t", "curpc", ",", "const", "opcode_desc", "*", "prevdesc", ")", "{", "opcode_desc", "*", "desc", "=", "desc_alloc", "(", "drcfe", ")", ";", "memset", "(", "desc", ",", "0", ",", "sizeof", "(", "*", "desc", ")", ")", ";", "desc", "->", "pc", "=", "curpc", ";", "desc", "->", "physpc", "=", "curpc", ";", "desc", "->", "targetpc", "=", "BRANCH_TARGET_DYNAMIC", ";", "if", "(", "!", "(", "*", "drcfe", "->", "describe", ")", "(", "drcfe", "->", "param", ",", "desc", ",", "prevdesc", ")", ")", "{", "desc", "->", "flags", "|=", "OPFLAG_WILL_CAUSE_EXCEPTION", "|", "OPFLAG_INVALID_OPCODE", ";", "return", "desc", ";", "}", "if", "(", "drcfe", "->", "pageshift", "!=", "0", "&&", "(", "(", "(", "curpc", "-", "1", ")", "^", "(", "curpc", "+", "desc", "->", "length", "-", "1", ")", ")", ">>", "drcfe", "->", "pageshift", ")", "!=", "0", ")", "desc", "->", "flags", "|=", "OPFLAG_VALIDATE_TLB", "|", "OPFLAG_CAN_CAUSE_EXCEPTION", ";", "assert", "(", "desc", "->", "length", ">", "0", "||", "(", "desc", "->", "flags", "&", "OPFLAG_VIRTUAL_NOOP", ")", "!=", "0", ")", ";", "if", "(", "desc", "->", "flags", "&", "OPFLAG_IS_BRANCH", ")", "{", "opcode_desc", "*", "*", "tailptr", "=", "&", "desc", "->", "delay", ";", "offs_t", "delaypc", "=", "curpc", "+", "desc", "->", "length", ";", "opcode_desc", "*", "prev", "=", "desc", ";", "UINT8", "slotnum", ";", "for", "(", "slotnum", "=", "0", ";", "slotnum", "<", "desc", "->", "delayslots", ";", "slotnum", "++", ")", "{", "*", "tailptr", "=", "describe_one", "(", "drcfe", ",", "delaypc", ",", "prev", ")", ";", "if", "(", "*", "tailptr", "==", "NULL", ")", "break", ";", "(", "*", "tailptr", ")", "->", "flags", "|=", "OPFLAG_IN_DELAY_SLOT", ";", "(", "*", "tailptr", ")", "->", "branch", "=", "desc", ";", "(", "*", "tailptr", ")", "->", "prev", "=", "prev", ";", "prev", "=", "*", "tailptr", ";", "if", "(", "(", "*", "tailptr", ")", "->", "flags", "&", "OPFLAG_COMPILER_PAGE_FAULT", ")", "break", ";", "delaypc", "+=", "(", "*", "tailptr", ")", "->", "length", ";", "tailptr", "=", "&", "(", "*", "tailptr", ")", "->", "next", ";", "}", "}", "return", "desc", ";", "}" ]
describe_one - describe a single instruction, recursively describing opcodes in delay slots of branches as well
[ "describe_one", "-", "describe", "a", "single", "instruction", "recursively", "describing", "opcodes", "in", "delay", "slots", "of", "branches", "as", "well" ]
[ "/* initialize the description */", "/* call the callback to describe an instruction */", "/* validate the TLB if we are exactly at the start of a page, or if we cross a page boundary */", "/* validate stuff */", "/* if we are a branch with delay slots, recursively walk those */", "/* iterate over slots and describe them */", "/* recursively describe the next instruction */", "/* set the delay slot flag and a pointer back to the original branch */", "/* stop if we hit a page fault */", "/* otherwise, advance */" ]
[ { "param": "drcfe", "type": "drcfe_state" }, { "param": "curpc", "type": "offs_t" }, { "param": "prevdesc", "type": "opcode_desc" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "drcfe", "type": "drcfe_state", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "curpc", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "prevdesc", "type": "opcode_desc", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4eb8c94b3e4a0efdce2533da8010f6451a379eb1
lofunz/mieme
Reloaded/trunk/src/emu/cpu/drcfe.c
[ "Unlicense" ]
C
accumulate_required_backwards
void
static void accumulate_required_backwards(opcode_desc *desc, UINT32 *reqmask) { /* recursively handle delay slots */ if (desc->delay != NULL) accumulate_required_backwards(desc->delay, reqmask); /* if this is a branch, we have to reset our requests */ if (desc->flags & OPFLAG_IS_BRANCH) reqmask[0] = reqmask[1] = reqmask[2] = reqmask[3] = 0xffffffff; /* determine the required registers */ desc->regreq[0] = desc->regout[0] & reqmask[0]; desc->regreq[1] = desc->regout[1] & reqmask[1]; desc->regreq[2] = desc->regout[2] & reqmask[2]; desc->regreq[3] = desc->regout[3] & reqmask[3]; /* any registers modified by this instruction aren't required upstream until referenced */ reqmask[0] &= ~desc->regout[0]; reqmask[1] &= ~desc->regout[1]; reqmask[2] &= ~desc->regout[2]; reqmask[3] &= ~desc->regout[3]; /* any registers required by this instruction now get marked required */ reqmask[0] |= desc->regin[0]; reqmask[1] |= desc->regin[1]; reqmask[2] |= desc->regin[2]; reqmask[3] |= desc->regin[3]; }
/*------------------------------------------------- accumulate_required_backwards - recursively accumulate live register liveness information walking in a backwards direction -------------------------------------------------*/
recursively accumulate live register liveness information walking in a backwards direction
[ "recursively", "accumulate", "live", "register", "liveness", "information", "walking", "in", "a", "backwards", "direction" ]
static void accumulate_required_backwards(opcode_desc *desc, UINT32 *reqmask) { if (desc->delay != NULL) accumulate_required_backwards(desc->delay, reqmask); if (desc->flags & OPFLAG_IS_BRANCH) reqmask[0] = reqmask[1] = reqmask[2] = reqmask[3] = 0xffffffff; desc->regreq[0] = desc->regout[0] & reqmask[0]; desc->regreq[1] = desc->regout[1] & reqmask[1]; desc->regreq[2] = desc->regout[2] & reqmask[2]; desc->regreq[3] = desc->regout[3] & reqmask[3]; reqmask[0] &= ~desc->regout[0]; reqmask[1] &= ~desc->regout[1]; reqmask[2] &= ~desc->regout[2]; reqmask[3] &= ~desc->regout[3]; reqmask[0] |= desc->regin[0]; reqmask[1] |= desc->regin[1]; reqmask[2] |= desc->regin[2]; reqmask[3] |= desc->regin[3]; }
[ "static", "void", "accumulate_required_backwards", "(", "opcode_desc", "*", "desc", ",", "UINT32", "*", "reqmask", ")", "{", "if", "(", "desc", "->", "delay", "!=", "NULL", ")", "accumulate_required_backwards", "(", "desc", "->", "delay", ",", "reqmask", ")", ";", "if", "(", "desc", "->", "flags", "&", "OPFLAG_IS_BRANCH", ")", "reqmask", "[", "0", "]", "=", "reqmask", "[", "1", "]", "=", "reqmask", "[", "2", "]", "=", "reqmask", "[", "3", "]", "=", "0xffffffff", ";", "desc", "->", "regreq", "[", "0", "]", "=", "desc", "->", "regout", "[", "0", "]", "&", "reqmask", "[", "0", "]", ";", "desc", "->", "regreq", "[", "1", "]", "=", "desc", "->", "regout", "[", "1", "]", "&", "reqmask", "[", "1", "]", ";", "desc", "->", "regreq", "[", "2", "]", "=", "desc", "->", "regout", "[", "2", "]", "&", "reqmask", "[", "2", "]", ";", "desc", "->", "regreq", "[", "3", "]", "=", "desc", "->", "regout", "[", "3", "]", "&", "reqmask", "[", "3", "]", ";", "reqmask", "[", "0", "]", "&=", "~", "desc", "->", "regout", "[", "0", "]", ";", "reqmask", "[", "1", "]", "&=", "~", "desc", "->", "regout", "[", "1", "]", ";", "reqmask", "[", "2", "]", "&=", "~", "desc", "->", "regout", "[", "2", "]", ";", "reqmask", "[", "3", "]", "&=", "~", "desc", "->", "regout", "[", "3", "]", ";", "reqmask", "[", "0", "]", "|=", "desc", "->", "regin", "[", "0", "]", ";", "reqmask", "[", "1", "]", "|=", "desc", "->", "regin", "[", "1", "]", ";", "reqmask", "[", "2", "]", "|=", "desc", "->", "regin", "[", "2", "]", ";", "reqmask", "[", "3", "]", "|=", "desc", "->", "regin", "[", "3", "]", ";", "}" ]
accumulate_required_backwards - recursively accumulate live register liveness information walking in a backwards direction
[ "accumulate_required_backwards", "-", "recursively", "accumulate", "live", "register", "liveness", "information", "walking", "in", "a", "backwards", "direction" ]
[ "/* recursively handle delay slots */", "/* if this is a branch, we have to reset our requests */", "/* determine the required registers */", "/* any registers modified by this instruction aren't required upstream until referenced */", "/* any registers required by this instruction now get marked required */" ]
[ { "param": "desc", "type": "opcode_desc" }, { "param": "reqmask", "type": "UINT32" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "desc", "type": "opcode_desc", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "reqmask", "type": "UINT32", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4eb8c94b3e4a0efdce2533da8010f6451a379eb1
lofunz/mieme
Reloaded/trunk/src/emu/cpu/drcfe.c
[ "Unlicense" ]
C
release_descriptions
void
static void release_descriptions(drcfe_state *drcfe, opcode_desc *desc) { /* loop while we still have valid entries */ while (desc != NULL) { opcode_desc *freeme = desc; /* recursively release delay slots */ if (desc->delay != NULL) release_descriptions(drcfe, desc->delay); desc = desc->next; desc_free(drcfe, freeme); } }
/*------------------------------------------------- release_descriptions - release any descriptions we've allocated back to the free list ------------------------------------------------*/
release any descriptions we've allocated back to the free list
[ "release", "any", "descriptions", "we", "'", "ve", "allocated", "back", "to", "the", "free", "list" ]
static void release_descriptions(drcfe_state *drcfe, opcode_desc *desc) { while (desc != NULL) { opcode_desc *freeme = desc; if (desc->delay != NULL) release_descriptions(drcfe, desc->delay); desc = desc->next; desc_free(drcfe, freeme); } }
[ "static", "void", "release_descriptions", "(", "drcfe_state", "*", "drcfe", ",", "opcode_desc", "*", "desc", ")", "{", "while", "(", "desc", "!=", "NULL", ")", "{", "opcode_desc", "*", "freeme", "=", "desc", ";", "if", "(", "desc", "->", "delay", "!=", "NULL", ")", "release_descriptions", "(", "drcfe", ",", "desc", "->", "delay", ")", ";", "desc", "=", "desc", "->", "next", ";", "desc_free", "(", "drcfe", ",", "freeme", ")", ";", "}", "}" ]
release_descriptions - release any descriptions we've allocated back to the free list
[ "release_descriptions", "-", "release", "any", "descriptions", "we", "'", "ve", "allocated", "back", "to", "the", "free", "list" ]
[ "/* loop while we still have valid entries */", "/* recursively release delay slots */" ]
[ { "param": "drcfe", "type": "drcfe_state" }, { "param": "desc", "type": "opcode_desc" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "drcfe", "type": "drcfe_state", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "desc", "type": "opcode_desc", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c9065561ab242516c718fab880407476ab543c7a
lofunz/mieme
Reloaded/trunk/src/emu/video/generic.c
[ "Unlicense" ]
C
generic_video_init
void
void generic_video_init(running_machine *machine) { generic_video_private *state; state = machine->generic_video_data = auto_alloc_clear(machine, generic_video_private); state_save_register_item(machine, "video", NULL, 0, state->flip_screen_x); state_save_register_item(machine, "video", NULL, 0, state->flip_screen_y); }
/*------------------------------------------------- generic_video_init - initialize globals and register for save states -------------------------------------------------*/
initialize globals and register for save states
[ "initialize", "globals", "and", "register", "for", "save", "states" ]
void generic_video_init(running_machine *machine) { generic_video_private *state; state = machine->generic_video_data = auto_alloc_clear(machine, generic_video_private); state_save_register_item(machine, "video", NULL, 0, state->flip_screen_x); state_save_register_item(machine, "video", NULL, 0, state->flip_screen_y); }
[ "void", "generic_video_init", "(", "running_machine", "*", "machine", ")", "{", "generic_video_private", "*", "state", ";", "state", "=", "machine", "->", "generic_video_data", "=", "auto_alloc_clear", "(", "machine", ",", "generic_video_private", ")", ";", "state_save_register_item", "(", "machine", ",", "\"", "\"", ",", "NULL", ",", "0", ",", "state", "->", "flip_screen_x", ")", ";", "state_save_register_item", "(", "machine", ",", "\"", "\"", ",", "NULL", ",", "0", ",", "state", "->", "flip_screen_y", ")", ";", "}" ]
generic_video_init - initialize globals and register for save states
[ "generic_video_init", "-", "initialize", "globals", "and", "register", "for", "save", "states" ]
[]
[ { "param": "machine", "type": "running_machine" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c9065561ab242516c718fab880407476ab543c7a
lofunz/mieme
Reloaded/trunk/src/emu/video/generic.c
[ "Unlicense" ]
C
flip_screen_set_no_update
void
void flip_screen_set_no_update(running_machine *machine, int on) { /* flip_screen_y is not updated on purpose * this function is for drivers which * where writing to flip_screen_x to * bypass update_flip */ generic_video_private *state = machine->generic_video_data; state->flip_screen_x = on; }
/*------------------------------------------------- flip_screen_set_no_update - set global flip do not call update_flip. -------------------------------------------------*/
set global flip do not call update_flip.
[ "set", "global", "flip", "do", "not", "call", "update_flip", "." ]
void flip_screen_set_no_update(running_machine *machine, int on) { generic_video_private *state = machine->generic_video_data; state->flip_screen_x = on; }
[ "void", "flip_screen_set_no_update", "(", "running_machine", "*", "machine", ",", "int", "on", ")", "{", "generic_video_private", "*", "state", "=", "machine", "->", "generic_video_data", ";", "state", "->", "flip_screen_x", "=", "on", ";", "}" ]
flip_screen_set_no_update - set global flip do not call update_flip.
[ "flip_screen_set_no_update", "-", "set", "global", "flip", "do", "not", "call", "update_flip", "." ]
[ "/* flip_screen_y is not updated on purpose\r\n * this function is for drivers which\r\n * where writing to flip_screen_x to\r\n * bypass update_flip\r\n */" ]
[ { "param": "machine", "type": "running_machine" }, { "param": "on", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "on", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
edd1ccaa92a6ff2c4a10bbe635f6ea2244467360
lofunz/mieme
Reloaded/trunk/src/mame/video/midzeus.c
[ "Unlicense" ]
C
zeus_pointer_w
void
static void zeus_pointer_w(UINT32 which, UINT32 data, int logit) { switch (which & 0xffffff) { case 0x008000: case 0x018000: if (logit) logerror(" -- setptr(objdata)\n"); zeus_objdata = data; break; // case 0x00c040: -- set in model data in invasn case 0x00c040: if (logit) logerror(" -- setptr(palbase)\n"); zeus_palbase = data; break; // case 0x004040: -- set via FIFO command in mk4 (len=02) // case 0x02c0f0: -- set in model data in mk4 (len=0f) // case 0x03c0f0: -- set via FIFO command in mk4 (len=00) // case 0x02c0e7: -- set via FIFO command in mk4 (len=08) // case 0x04c09c: -- set via FIFO command in mk4 (len=08) // case 0x05c0a5: -- set via FIFO command in mk4 (len=21) // case 0x80c0a5: -- set via FIFO command in mk4 (len=3f) // case 0x81c0a5: -- set via FIFO command in mk4 (len=35) // case 0x82c0a5: -- set via FIFO command in mk4 (len=41) // case 0x00c0f0: -- set via FIFO command in invasn (len=0f) // case 0x00c0b0: -- set via FIFO command in invasn (len=3f) -- seems to be the same as c0a5 // case 0x05c0b0: -- set via FIFO command in invasn (len=21) // case 0x00c09c: -- set via FIFO command in invasn (len=06) // case 0x00c0a3: -- set via FIFO command in invasn (len=0a) default: if (logit) logerror(" -- setptr(%06X)\n", which & 0xffffff); break; } if (logit) log_waveram(data); }
/************************************* * * Handle writes to an internal * pointer register * *************************************/
Handle writes to an internal pointer register
[ "Handle", "writes", "to", "an", "internal", "pointer", "register" ]
static void zeus_pointer_w(UINT32 which, UINT32 data, int logit) { switch (which & 0xffffff) { case 0x008000: case 0x018000: if (logit) logerror(" -- setptr(objdata)\n"); zeus_objdata = data; break; case 0x00c040: if (logit) logerror(" -- setptr(palbase)\n"); zeus_palbase = data; break; default: if (logit) logerror(" -- setptr(%06X)\n", which & 0xffffff); break; } if (logit) log_waveram(data); }
[ "static", "void", "zeus_pointer_w", "(", "UINT32", "which", ",", "UINT32", "data", ",", "int", "logit", ")", "{", "switch", "(", "which", "&", "0xffffff", ")", "{", "case", "0x008000", ":", "case", "0x018000", ":", "if", "(", "logit", ")", "logerror", "(", "\"", "\\n", "\"", ")", ";", "zeus_objdata", "=", "data", ";", "break", ";", "case", "0x00c040", ":", "if", "(", "logit", ")", "logerror", "(", "\"", "\\n", "\"", ")", ";", "zeus_palbase", "=", "data", ";", "break", ";", "default", ":", "if", "(", "logit", ")", "logerror", "(", "\"", "\\n", "\"", ",", "which", "&", "0xffffff", ")", ";", "break", ";", "}", "if", "(", "logit", ")", "log_waveram", "(", "data", ")", ";", "}" ]
Handle writes to an internal pointer register
[ "Handle", "writes", "to", "an", "internal", "pointer", "register" ]
[ "// case 0x00c040: -- set in model data in invasn\r", "// case 0x004040: -- set via FIFO command in mk4 (len=02)\r", "// case 0x02c0f0: -- set in model data in mk4 (len=0f)\r", "// case 0x03c0f0: -- set via FIFO command in mk4 (len=00)\r", "// case 0x02c0e7: -- set via FIFO command in mk4 (len=08)\r", "// case 0x04c09c: -- set via FIFO command in mk4 (len=08)\r", "// case 0x05c0a5: -- set via FIFO command in mk4 (len=21)\r", "// case 0x80c0a5: -- set via FIFO command in mk4 (len=3f)\r", "// case 0x81c0a5: -- set via FIFO command in mk4 (len=35)\r", "// case 0x82c0a5: -- set via FIFO command in mk4 (len=41)\r", "// case 0x00c0f0: -- set via FIFO command in invasn (len=0f)\r", "// case 0x00c0b0: -- set via FIFO command in invasn (len=3f) -- seems to be the same as c0a5\r", "// case 0x05c0b0: -- set via FIFO command in invasn (len=21)\r", "// case 0x00c09c: -- set via FIFO command in invasn (len=06)\r", "// case 0x00c0a3: -- set via FIFO command in invasn (len=0a)\r" ]
[ { "param": "which", "type": "UINT32" }, { "param": "data", "type": "UINT32" }, { "param": "logit", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "which", "type": "UINT32", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "data", "type": "UINT32", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "logit", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
edd1ccaa92a6ff2c4a10bbe635f6ea2244467360
lofunz/mieme
Reloaded/trunk/src/mame/video/midzeus.c
[ "Unlicense" ]
C
zeus_register_update
void
static void zeus_register_update(running_machine *machine, offs_t offset) { /* handle the writes; only trigger on low accesses */ switch (offset) { case 0x52: zeusbase[0xb2] = zeusbase[0x52]; break; case 0x60: /* invasn writes here to execute a command (?) */ if (zeusbase[0x60] & 1) { if ((zeusbase[0x80] & 0xffffff) == 0x22FCFF) { // zeusbase[0x00] = color // zeusbase[0x02] = ??? = 0x000C0000 // zeusbase[0x04] = ??? = 0x00000E01 // zeusbase[0x06] = ??? = 0xFFFF0030 // zeusbase[0x08] = vert[0] = (y0 << 16) | x0 // zeusbase[0x0a] = vert[1] = (y1 << 16) | x1 // zeusbase[0x0c] = vert[2] = (y2 << 16) | x2 // zeusbase[0x0e] = vert[3] = (y3 << 16) | x3 // zeusbase[0x18] = ??? = 0xFFFFFFFF // zeusbase[0x1a] = ??? = 0xFFFFFFFF // zeusbase[0x1c] = ??? = 0xFFFFFFFF // zeusbase[0x1e] = ??? = 0xFFFFFFFF // zeusbase[0x20] = ??? = 0x00000000 // zeusbase[0x22] = ??? = 0x00000000 // zeusbase[0x24] = ??? = 0x00000000 // zeusbase[0x26] = ??? = 0x00000000 // zeusbase[0x40] = ??? = 0x00000000 // zeusbase[0x42] = ??? = 0x00000000 // zeusbase[0x44] = ??? = 0x00000000 // zeusbase[0x46] = ??? = 0x00000000 // zeusbase[0x4c] = ??? = 0x00808080 (brightness?) // zeusbase[0x4e] = ??? = 0x00808080 (brightness?) poly_extra_data *extra = (poly_extra_data *)poly_get_extra_data(poly); poly_vertex vert[4]; vert[0].x = (INT16)zeusbase[0x08]; vert[0].y = (INT16)(zeusbase[0x08] >> 16); vert[1].x = (INT16)zeusbase[0x0a]; vert[1].y = (INT16)(zeusbase[0x0a] >> 16); vert[2].x = (INT16)zeusbase[0x0c]; vert[2].y = (INT16)(zeusbase[0x0c] >> 16); vert[3].x = (INT16)zeusbase[0x0e]; vert[3].y = (INT16)(zeusbase[0x0e] >> 16); extra->solidcolor = zeusbase[0x00]; extra->zoffset = 0x7fff; poly_render_quad(poly, NULL, &zeus_cliprect, render_poly_solid_fixedz, 0, &vert[0], &vert[1], &vert[2], &vert[3]); poly_wait(poly, "Normal"); } else logerror("Execute unknown command\n"); } break; case 0x70: zeus_point[0] = zeusbase[0x70] << 16; break; case 0x72: zeus_point[1] = zeusbase[0x72] << 16; break; case 0x74: zeus_point[2] = zeusbase[0x74] << 16; break; case 0x80: /* this bit enables the "FIFO empty" IRQ; since our virtual FIFO is always empty, we simply assert immediately if this is enabled. invasn needs this for proper operations */ if (zeusbase[0x80] & 0x02000000) cputag_set_input_line(machine, "maincpu", 2, ASSERT_LINE); else cputag_set_input_line(machine, "maincpu", 2, CLEAR_LINE); break; case 0x84: /* MK4: Written in tandem with 0xcc */ /* MK4: Writes either 0x80 (and 0x000000 to 0xcc) or 0x00 (and 0x800000 to 0xcc) */ zeus_renderbase = waveram1_ptr_from_expanded_addr(zeusbase[0x84] << 16); break; case 0xb0: case 0xb2: if ((zeusbase[0xb6] >> 16) != 0) { if ((offset == 0xb0 && (zeusbase[0xb6] & 0x02000000) == 0) || (offset == 0xb2 && (zeusbase[0xb6] & 0x02000000) != 0)) { void *dest; if (zeusbase[0xb6] & 0x80000000) dest = waveram1_ptr_from_expanded_addr(zeusbase[0xb4]); else dest = waveram0_ptr_from_expanded_addr(zeusbase[0xb4]); if (zeusbase[0xb6] & 0x00100000) WAVERAM_WRITE16(dest, 0, zeusbase[0xb0]); if (zeusbase[0xb6] & 0x00200000) WAVERAM_WRITE16(dest, 1, zeusbase[0xb0] >> 16); if (zeusbase[0xb6] & 0x00400000) WAVERAM_WRITE16(dest, 2, zeusbase[0xb2]); if (zeusbase[0xb6] & 0x00800000) WAVERAM_WRITE16(dest, 3, zeusbase[0xb2] >> 16); if (zeusbase[0xb6] & 0x00020000) zeusbase[0xb4]++; } } break; case 0xb4: if (zeusbase[0xb6] & 0x00010000) { const UINT32 *src; if (zeusbase[0xb6] & 0x80000000) src = (const UINT32 *)waveram1_ptr_from_expanded_addr(zeusbase[0xb4]); else src = (const UINT32 *)waveram0_ptr_from_expanded_addr(zeusbase[0xb4]); poly_wait(poly, "vram_read"); zeusbase[0xb0] = WAVERAM_READ32(src, 0); zeusbase[0xb2] = WAVERAM_READ32(src, 1); } break; case 0xc0: case 0xc2: case 0xc4: case 0xc6: case 0xc8: case 0xca: machine->primary_screen->update_partial(machine->primary_screen->vpos()); { int vtotal = zeusbase[0xca] >> 16; int htotal = zeusbase[0xc6] >> 16; rectangle visarea; visarea.min_x = zeusbase[0xc6] & 0xffff; visarea.max_x = htotal - 3; visarea.min_y = 0; visarea.max_y = zeusbase[0xc8] & 0xffff; if (htotal > 0 && vtotal > 0 && visarea.min_x < visarea.max_x && visarea.max_y < vtotal) { machine->primary_screen->configure(htotal, vtotal, visarea, HZ_TO_ATTOSECONDS((double)MIDZEUS_VIDEO_CLOCK / 8.0 / (htotal * vtotal))); zeus_cliprect = visarea; zeus_cliprect.max_x -= zeus_cliprect.min_x; zeus_cliprect.min_x = 0; } } break; case 0xcc: machine->primary_screen->update_partial(machine->primary_screen->vpos()); log_fifo = input_code_pressed(machine, KEYCODE_L); break; case 0xe0: zeus_fifo[zeus_fifo_words++] = zeusbase[0xe0]; if (zeus_fifo_process(machine, zeus_fifo, zeus_fifo_words)) zeus_fifo_words = 0; break; } }
/************************************* * * Update state after a register write * *************************************/
Update state after a register write
[ "Update", "state", "after", "a", "register", "write" ]
static void zeus_register_update(running_machine *machine, offs_t offset) { switch (offset) { case 0x52: zeusbase[0xb2] = zeusbase[0x52]; break; case 0x60: if (zeusbase[0x60] & 1) { if ((zeusbase[0x80] & 0xffffff) == 0x22FCFF) { poly_extra_data *extra = (poly_extra_data *)poly_get_extra_data(poly); poly_vertex vert[4]; vert[0].x = (INT16)zeusbase[0x08]; vert[0].y = (INT16)(zeusbase[0x08] >> 16); vert[1].x = (INT16)zeusbase[0x0a]; vert[1].y = (INT16)(zeusbase[0x0a] >> 16); vert[2].x = (INT16)zeusbase[0x0c]; vert[2].y = (INT16)(zeusbase[0x0c] >> 16); vert[3].x = (INT16)zeusbase[0x0e]; vert[3].y = (INT16)(zeusbase[0x0e] >> 16); extra->solidcolor = zeusbase[0x00]; extra->zoffset = 0x7fff; poly_render_quad(poly, NULL, &zeus_cliprect, render_poly_solid_fixedz, 0, &vert[0], &vert[1], &vert[2], &vert[3]); poly_wait(poly, "Normal"); } else logerror("Execute unknown command\n"); } break; case 0x70: zeus_point[0] = zeusbase[0x70] << 16; break; case 0x72: zeus_point[1] = zeusbase[0x72] << 16; break; case 0x74: zeus_point[2] = zeusbase[0x74] << 16; break; case 0x80: if (zeusbase[0x80] & 0x02000000) cputag_set_input_line(machine, "maincpu", 2, ASSERT_LINE); else cputag_set_input_line(machine, "maincpu", 2, CLEAR_LINE); break; case 0x84: zeus_renderbase = waveram1_ptr_from_expanded_addr(zeusbase[0x84] << 16); break; case 0xb0: case 0xb2: if ((zeusbase[0xb6] >> 16) != 0) { if ((offset == 0xb0 && (zeusbase[0xb6] & 0x02000000) == 0) || (offset == 0xb2 && (zeusbase[0xb6] & 0x02000000) != 0)) { void *dest; if (zeusbase[0xb6] & 0x80000000) dest = waveram1_ptr_from_expanded_addr(zeusbase[0xb4]); else dest = waveram0_ptr_from_expanded_addr(zeusbase[0xb4]); if (zeusbase[0xb6] & 0x00100000) WAVERAM_WRITE16(dest, 0, zeusbase[0xb0]); if (zeusbase[0xb6] & 0x00200000) WAVERAM_WRITE16(dest, 1, zeusbase[0xb0] >> 16); if (zeusbase[0xb6] & 0x00400000) WAVERAM_WRITE16(dest, 2, zeusbase[0xb2]); if (zeusbase[0xb6] & 0x00800000) WAVERAM_WRITE16(dest, 3, zeusbase[0xb2] >> 16); if (zeusbase[0xb6] & 0x00020000) zeusbase[0xb4]++; } } break; case 0xb4: if (zeusbase[0xb6] & 0x00010000) { const UINT32 *src; if (zeusbase[0xb6] & 0x80000000) src = (const UINT32 *)waveram1_ptr_from_expanded_addr(zeusbase[0xb4]); else src = (const UINT32 *)waveram0_ptr_from_expanded_addr(zeusbase[0xb4]); poly_wait(poly, "vram_read"); zeusbase[0xb0] = WAVERAM_READ32(src, 0); zeusbase[0xb2] = WAVERAM_READ32(src, 1); } break; case 0xc0: case 0xc2: case 0xc4: case 0xc6: case 0xc8: case 0xca: machine->primary_screen->update_partial(machine->primary_screen->vpos()); { int vtotal = zeusbase[0xca] >> 16; int htotal = zeusbase[0xc6] >> 16; rectangle visarea; visarea.min_x = zeusbase[0xc6] & 0xffff; visarea.max_x = htotal - 3; visarea.min_y = 0; visarea.max_y = zeusbase[0xc8] & 0xffff; if (htotal > 0 && vtotal > 0 && visarea.min_x < visarea.max_x && visarea.max_y < vtotal) { machine->primary_screen->configure(htotal, vtotal, visarea, HZ_TO_ATTOSECONDS((double)MIDZEUS_VIDEO_CLOCK / 8.0 / (htotal * vtotal))); zeus_cliprect = visarea; zeus_cliprect.max_x -= zeus_cliprect.min_x; zeus_cliprect.min_x = 0; } } break; case 0xcc: machine->primary_screen->update_partial(machine->primary_screen->vpos()); log_fifo = input_code_pressed(machine, KEYCODE_L); break; case 0xe0: zeus_fifo[zeus_fifo_words++] = zeusbase[0xe0]; if (zeus_fifo_process(machine, zeus_fifo, zeus_fifo_words)) zeus_fifo_words = 0; break; } }
[ "static", "void", "zeus_register_update", "(", "running_machine", "*", "machine", ",", "offs_t", "offset", ")", "{", "switch", "(", "offset", ")", "{", "case", "0x52", ":", "zeusbase", "[", "0xb2", "]", "=", "zeusbase", "[", "0x52", "]", ";", "break", ";", "case", "0x60", ":", "if", "(", "zeusbase", "[", "0x60", "]", "&", "1", ")", "{", "if", "(", "(", "zeusbase", "[", "0x80", "]", "&", "0xffffff", ")", "==", "0x22FCFF", ")", "{", "poly_extra_data", "*", "extra", "=", "(", "poly_extra_data", "*", ")", "poly_get_extra_data", "(", "poly", ")", ";", "poly_vertex", "vert", "[", "4", "]", ";", "vert", "[", "0", "]", ".", "x", "=", "(", "INT16", ")", "zeusbase", "[", "0x08", "]", ";", "vert", "[", "0", "]", ".", "y", "=", "(", "INT16", ")", "(", "zeusbase", "[", "0x08", "]", ">>", "16", ")", ";", "vert", "[", "1", "]", ".", "x", "=", "(", "INT16", ")", "zeusbase", "[", "0x0a", "]", ";", "vert", "[", "1", "]", ".", "y", "=", "(", "INT16", ")", "(", "zeusbase", "[", "0x0a", "]", ">>", "16", ")", ";", "vert", "[", "2", "]", ".", "x", "=", "(", "INT16", ")", "zeusbase", "[", "0x0c", "]", ";", "vert", "[", "2", "]", ".", "y", "=", "(", "INT16", ")", "(", "zeusbase", "[", "0x0c", "]", ">>", "16", ")", ";", "vert", "[", "3", "]", ".", "x", "=", "(", "INT16", ")", "zeusbase", "[", "0x0e", "]", ";", "vert", "[", "3", "]", ".", "y", "=", "(", "INT16", ")", "(", "zeusbase", "[", "0x0e", "]", ">>", "16", ")", ";", "extra", "->", "solidcolor", "=", "zeusbase", "[", "0x00", "]", ";", "extra", "->", "zoffset", "=", "0x7fff", ";", "poly_render_quad", "(", "poly", ",", "NULL", ",", "&", "zeus_cliprect", ",", "render_poly_solid_fixedz", ",", "0", ",", "&", "vert", "[", "0", "]", ",", "&", "vert", "[", "1", "]", ",", "&", "vert", "[", "2", "]", ",", "&", "vert", "[", "3", "]", ")", ";", "poly_wait", "(", "poly", ",", "\"", "\"", ")", ";", "}", "else", "logerror", "(", "\"", "\\n", "\"", ")", ";", "}", "break", ";", "case", "0x70", ":", "zeus_point", "[", "0", "]", "=", "zeusbase", "[", "0x70", "]", "<<", "16", ";", "break", ";", "case", "0x72", ":", "zeus_point", "[", "1", "]", "=", "zeusbase", "[", "0x72", "]", "<<", "16", ";", "break", ";", "case", "0x74", ":", "zeus_point", "[", "2", "]", "=", "zeusbase", "[", "0x74", "]", "<<", "16", ";", "break", ";", "case", "0x80", ":", "if", "(", "zeusbase", "[", "0x80", "]", "&", "0x02000000", ")", "cputag_set_input_line", "(", "machine", ",", "\"", "\"", ",", "2", ",", "ASSERT_LINE", ")", ";", "else", "cputag_set_input_line", "(", "machine", ",", "\"", "\"", ",", "2", ",", "CLEAR_LINE", ")", ";", "break", ";", "case", "0x84", ":", "zeus_renderbase", "=", "waveram1_ptr_from_expanded_addr", "(", "zeusbase", "[", "0x84", "]", "<<", "16", ")", ";", "break", ";", "case", "0xb0", ":", "case", "0xb2", ":", "if", "(", "(", "zeusbase", "[", "0xb6", "]", ">>", "16", ")", "!=", "0", ")", "{", "if", "(", "(", "offset", "==", "0xb0", "&&", "(", "zeusbase", "[", "0xb6", "]", "&", "0x02000000", ")", "==", "0", ")", "||", "(", "offset", "==", "0xb2", "&&", "(", "zeusbase", "[", "0xb6", "]", "&", "0x02000000", ")", "!=", "0", ")", ")", "{", "void", "*", "dest", ";", "if", "(", "zeusbase", "[", "0xb6", "]", "&", "0x80000000", ")", "dest", "=", "waveram1_ptr_from_expanded_addr", "(", "zeusbase", "[", "0xb4", "]", ")", ";", "else", "dest", "=", "waveram0_ptr_from_expanded_addr", "(", "zeusbase", "[", "0xb4", "]", ")", ";", "if", "(", "zeusbase", "[", "0xb6", "]", "&", "0x00100000", ")", "WAVERAM_WRITE16", "(", "dest", ",", "0", ",", "zeusbase", "[", "0xb0", "]", ")", ";", "if", "(", "zeusbase", "[", "0xb6", "]", "&", "0x00200000", ")", "WAVERAM_WRITE16", "(", "dest", ",", "1", ",", "zeusbase", "[", "0xb0", "]", ">>", "16", ")", ";", "if", "(", "zeusbase", "[", "0xb6", "]", "&", "0x00400000", ")", "WAVERAM_WRITE16", "(", "dest", ",", "2", ",", "zeusbase", "[", "0xb2", "]", ")", ";", "if", "(", "zeusbase", "[", "0xb6", "]", "&", "0x00800000", ")", "WAVERAM_WRITE16", "(", "dest", ",", "3", ",", "zeusbase", "[", "0xb2", "]", ">>", "16", ")", ";", "if", "(", "zeusbase", "[", "0xb6", "]", "&", "0x00020000", ")", "zeusbase", "[", "0xb4", "]", "++", ";", "}", "}", "break", ";", "case", "0xb4", ":", "if", "(", "zeusbase", "[", "0xb6", "]", "&", "0x00010000", ")", "{", "const", "UINT32", "*", "src", ";", "if", "(", "zeusbase", "[", "0xb6", "]", "&", "0x80000000", ")", "src", "=", "(", "const", "UINT32", "*", ")", "waveram1_ptr_from_expanded_addr", "(", "zeusbase", "[", "0xb4", "]", ")", ";", "else", "src", "=", "(", "const", "UINT32", "*", ")", "waveram0_ptr_from_expanded_addr", "(", "zeusbase", "[", "0xb4", "]", ")", ";", "poly_wait", "(", "poly", ",", "\"", "\"", ")", ";", "zeusbase", "[", "0xb0", "]", "=", "WAVERAM_READ32", "(", "src", ",", "0", ")", ";", "zeusbase", "[", "0xb2", "]", "=", "WAVERAM_READ32", "(", "src", ",", "1", ")", ";", "}", "break", ";", "case", "0xc0", ":", "case", "0xc2", ":", "case", "0xc4", ":", "case", "0xc6", ":", "case", "0xc8", ":", "case", "0xca", ":", "machine", "->", "primary_screen", "->", "update_partial", "(", "machine", "->", "primary_screen", "->", "vpos", "(", ")", ")", ";", "{", "int", "vtotal", "=", "zeusbase", "[", "0xca", "]", ">>", "16", ";", "int", "htotal", "=", "zeusbase", "[", "0xc6", "]", ">>", "16", ";", "rectangle", "visarea", ";", "visarea", ".", "min_x", "=", "zeusbase", "[", "0xc6", "]", "&", "0xffff", ";", "visarea", ".", "max_x", "=", "htotal", "-", "3", ";", "visarea", ".", "min_y", "=", "0", ";", "visarea", ".", "max_y", "=", "zeusbase", "[", "0xc8", "]", "&", "0xffff", ";", "if", "(", "htotal", ">", "0", "&&", "vtotal", ">", "0", "&&", "visarea", ".", "min_x", "<", "visarea", ".", "max_x", "&&", "visarea", ".", "max_y", "<", "vtotal", ")", "{", "machine", "->", "primary_screen", "->", "configure", "(", "htotal", ",", "vtotal", ",", "visarea", ",", "HZ_TO_ATTOSECONDS", "(", "(", "double", ")", "MIDZEUS_VIDEO_CLOCK", "/", "8.0", "/", "(", "htotal", "*", "vtotal", ")", ")", ")", ";", "zeus_cliprect", "=", "visarea", ";", "zeus_cliprect", ".", "max_x", "-=", "zeus_cliprect", ".", "min_x", ";", "zeus_cliprect", ".", "min_x", "=", "0", ";", "}", "}", "break", ";", "case", "0xcc", ":", "machine", "->", "primary_screen", "->", "update_partial", "(", "machine", "->", "primary_screen", "->", "vpos", "(", ")", ")", ";", "log_fifo", "=", "input_code_pressed", "(", "machine", ",", "KEYCODE_L", ")", ";", "break", ";", "case", "0xe0", ":", "zeus_fifo", "[", "zeus_fifo_words", "++", "]", "=", "zeusbase", "[", "0xe0", "]", ";", "if", "(", "zeus_fifo_process", "(", "machine", ",", "zeus_fifo", ",", "zeus_fifo_words", ")", ")", "zeus_fifo_words", "=", "0", ";", "break", ";", "}", "}" ]
Update state after a register write
[ "Update", "state", "after", "a", "register", "write" ]
[ "/* handle the writes; only trigger on low accesses */", "/* invasn writes here to execute a command (?) */", "// zeusbase[0x00] = color\r", "// zeusbase[0x02] = ??? = 0x000C0000\r", "// zeusbase[0x04] = ??? = 0x00000E01\r", "// zeusbase[0x06] = ??? = 0xFFFF0030\r", "// zeusbase[0x08] = vert[0] = (y0 << 16) | x0\r", "// zeusbase[0x0a] = vert[1] = (y1 << 16) | x1\r", "// zeusbase[0x0c] = vert[2] = (y2 << 16) | x2\r", "// zeusbase[0x0e] = vert[3] = (y3 << 16) | x3\r", "// zeusbase[0x18] = ??? = 0xFFFFFFFF\r", "// zeusbase[0x1a] = ??? = 0xFFFFFFFF\r", "// zeusbase[0x1c] = ??? = 0xFFFFFFFF\r", "// zeusbase[0x1e] = ??? = 0xFFFFFFFF\r", "// zeusbase[0x20] = ??? = 0x00000000\r", "// zeusbase[0x22] = ??? = 0x00000000\r", "// zeusbase[0x24] = ??? = 0x00000000\r", "// zeusbase[0x26] = ??? = 0x00000000\r", "// zeusbase[0x40] = ??? = 0x00000000\r", "// zeusbase[0x42] = ??? = 0x00000000\r", "// zeusbase[0x44] = ??? = 0x00000000\r", "// zeusbase[0x46] = ??? = 0x00000000\r", "// zeusbase[0x4c] = ??? = 0x00808080 (brightness?)\r", "// zeusbase[0x4e] = ??? = 0x00808080 (brightness?)\r", "/* this bit enables the \"FIFO empty\" IRQ; since our virtual FIFO is always empty,\r\n we simply assert immediately if this is enabled. invasn needs this for proper\r\n operations */", "/* MK4: Written in tandem with 0xcc */", "/* MK4: Writes either 0x80 (and 0x000000 to 0xcc) or 0x00 (and 0x800000 to 0xcc) */" ]
[ { "param": "machine", "type": "running_machine" }, { "param": "offset", "type": "offs_t" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "offset", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c60d7182b3757dedb6208e36827068f3cee2e1f3
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/build/png2bdc.c
[ "Unlicense" ]
C
bitmap_to_chars
int
static int bitmap_to_chars(bitmap_t *bitmap, render_font *font) { int rowstart = 0; int x, y; /* loop over rows */ while (rowstart < bitmap->height) { int rowend, baseline, colstart; int chstart; /* find the top of the row */ for ( ; rowstart < bitmap->height; rowstart++) if (pixel_is_set(bitmap, rowstart, 0)) break; if (rowstart >= bitmap->height) break; /* find the bottom of the row */ for (rowend = rowstart + 1; rowend < bitmap->height; rowend++) if (!pixel_is_set(bitmap, rowend, 0)) { rowend--; break; } /* find the baseline */ for (baseline = rowstart; baseline <= rowend; baseline++) if (pixel_is_set(bitmap, baseline, 1)) break; if (baseline > rowend) { fprintf(stderr, "No baseline found between rows %d-%d\n", rowstart, rowend); break; } /* set or confirm the height */ if (font->height == 0) { font->height = rowend - rowstart + 1; font->yoffs = baseline - rowend; } else { if (font->height != rowend - rowstart + 1) { fprintf(stderr, "Inconsistent font height at rows %d-%d\n", rowstart, rowend); break; } if (font->yoffs != baseline - rowend) { fprintf(stderr, "Inconsistent baseline at rows %d-%d\n", rowstart, rowend); break; } } /* decode the starting character */ chstart = 0; for (x = 0; x < 4; x++) for (y = 0; y < 4; y++) chstart = (chstart << 1) | pixel_is_set(bitmap, rowstart + y, 2 + x); /* print info */ // printf("Row %d-%d, baseline %d, character start %X\n", rowstart, rowend, baseline, chstart); /* scan the column to find characters */ colstart = 0; while (colstart < bitmap->width) { render_font_char *ch = &font->chars[chstart]; int colend; /* find the start of the character */ for ( ; colstart < bitmap->width; colstart++) if (pixel_is_set(bitmap, rowend + 2, colstart)) break; if (colstart >= bitmap->width) break; /* find the end of the character */ for (colend = colstart + 1; colend < bitmap->width; colend++) if (!pixel_is_set(bitmap, rowend + 2, colend)) { colend--; break; } // skip char which code is already registered if (ch->width <= 0) { /* print info */ // printf(" Character %X - width = %d\n", chstart, colend - colstart + 1); /* allocate a bitmap */ ch->bitmap = bitmap_alloc(colend - colstart + 1, font->height, BITMAP_FORMAT_ARGB32); if (ch->bitmap == NULL) { fprintf(stderr, "Error allocating character bitmap (%dx%d)\n", colend - colstart + 1, font->height); continue; } /* plot the character */ for (y = rowstart; y <= rowend; y++) for (x = colstart; x <= colend; x++) *BITMAP_ADDR32(ch->bitmap, y - rowstart, x - colstart) = pixel_is_set(bitmap, y, x) ? 0xffffffff : 0x00000000; /* set the character parameters */ ch->width = colend - colstart + 1; ch->xoffs = 0; ch->yoffs = font->yoffs; ch->bmwidth = ch->bitmap->width; ch->bmheight = ch->bitmap->height; } /* next character */ chstart++; colstart = colend + 1; } /* next row */ rowstart = rowend + 1; } /* return non-zero (TRUE) if we errored */ return (rowstart < bitmap->height); }
/*------------------------------------------------- bitmap_to_chars - convert a bitmap to characters in the given font -------------------------------------------------*/
convert a bitmap to characters in the given font
[ "convert", "a", "bitmap", "to", "characters", "in", "the", "given", "font" ]
static int bitmap_to_chars(bitmap_t *bitmap, render_font *font) { int rowstart = 0; int x, y; while (rowstart < bitmap->height) { int rowend, baseline, colstart; int chstart; for ( ; rowstart < bitmap->height; rowstart++) if (pixel_is_set(bitmap, rowstart, 0)) break; if (rowstart >= bitmap->height) break; for (rowend = rowstart + 1; rowend < bitmap->height; rowend++) if (!pixel_is_set(bitmap, rowend, 0)) { rowend--; break; } for (baseline = rowstart; baseline <= rowend; baseline++) if (pixel_is_set(bitmap, baseline, 1)) break; if (baseline > rowend) { fprintf(stderr, "No baseline found between rows %d-%d\n", rowstart, rowend); break; } if (font->height == 0) { font->height = rowend - rowstart + 1; font->yoffs = baseline - rowend; } else { if (font->height != rowend - rowstart + 1) { fprintf(stderr, "Inconsistent font height at rows %d-%d\n", rowstart, rowend); break; } if (font->yoffs != baseline - rowend) { fprintf(stderr, "Inconsistent baseline at rows %d-%d\n", rowstart, rowend); break; } } chstart = 0; for (x = 0; x < 4; x++) for (y = 0; y < 4; y++) chstart = (chstart << 1) | pixel_is_set(bitmap, rowstart + y, 2 + x); colstart = 0; while (colstart < bitmap->width) { render_font_char *ch = &font->chars[chstart]; int colend; for ( ; colstart < bitmap->width; colstart++) if (pixel_is_set(bitmap, rowend + 2, colstart)) break; if (colstart >= bitmap->width) break; for (colend = colstart + 1; colend < bitmap->width; colend++) if (!pixel_is_set(bitmap, rowend + 2, colend)) { colend--; break; } if (ch->width <= 0) { ch->bitmap = bitmap_alloc(colend - colstart + 1, font->height, BITMAP_FORMAT_ARGB32); if (ch->bitmap == NULL) { fprintf(stderr, "Error allocating character bitmap (%dx%d)\n", colend - colstart + 1, font->height); continue; } for (y = rowstart; y <= rowend; y++) for (x = colstart; x <= colend; x++) *BITMAP_ADDR32(ch->bitmap, y - rowstart, x - colstart) = pixel_is_set(bitmap, y, x) ? 0xffffffff : 0x00000000; ch->width = colend - colstart + 1; ch->xoffs = 0; ch->yoffs = font->yoffs; ch->bmwidth = ch->bitmap->width; ch->bmheight = ch->bitmap->height; } chstart++; colstart = colend + 1; } rowstart = rowend + 1; } return (rowstart < bitmap->height); }
[ "static", "int", "bitmap_to_chars", "(", "bitmap_t", "*", "bitmap", ",", "render_font", "*", "font", ")", "{", "int", "rowstart", "=", "0", ";", "int", "x", ",", "y", ";", "while", "(", "rowstart", "<", "bitmap", "->", "height", ")", "{", "int", "rowend", ",", "baseline", ",", "colstart", ";", "int", "chstart", ";", "for", "(", ";", "rowstart", "<", "bitmap", "->", "height", ";", "rowstart", "++", ")", "if", "(", "pixel_is_set", "(", "bitmap", ",", "rowstart", ",", "0", ")", ")", "break", ";", "if", "(", "rowstart", ">=", "bitmap", "->", "height", ")", "break", ";", "for", "(", "rowend", "=", "rowstart", "+", "1", ";", "rowend", "<", "bitmap", "->", "height", ";", "rowend", "++", ")", "if", "(", "!", "pixel_is_set", "(", "bitmap", ",", "rowend", ",", "0", ")", ")", "{", "rowend", "--", ";", "break", ";", "}", "for", "(", "baseline", "=", "rowstart", ";", "baseline", "<=", "rowend", ";", "baseline", "++", ")", "if", "(", "pixel_is_set", "(", "bitmap", ",", "baseline", ",", "1", ")", ")", "break", ";", "if", "(", "baseline", ">", "rowend", ")", "{", "fprintf", "(", "stderr", ",", "\"", "\\n", "\"", ",", "rowstart", ",", "rowend", ")", ";", "break", ";", "}", "if", "(", "font", "->", "height", "==", "0", ")", "{", "font", "->", "height", "=", "rowend", "-", "rowstart", "+", "1", ";", "font", "->", "yoffs", "=", "baseline", "-", "rowend", ";", "}", "else", "{", "if", "(", "font", "->", "height", "!=", "rowend", "-", "rowstart", "+", "1", ")", "{", "fprintf", "(", "stderr", ",", "\"", "\\n", "\"", ",", "rowstart", ",", "rowend", ")", ";", "break", ";", "}", "if", "(", "font", "->", "yoffs", "!=", "baseline", "-", "rowend", ")", "{", "fprintf", "(", "stderr", ",", "\"", "\\n", "\"", ",", "rowstart", ",", "rowend", ")", ";", "break", ";", "}", "}", "chstart", "=", "0", ";", "for", "(", "x", "=", "0", ";", "x", "<", "4", ";", "x", "++", ")", "for", "(", "y", "=", "0", ";", "y", "<", "4", ";", "y", "++", ")", "chstart", "=", "(", "chstart", "<<", "1", ")", "|", "pixel_is_set", "(", "bitmap", ",", "rowstart", "+", "y", ",", "2", "+", "x", ")", ";", "colstart", "=", "0", ";", "while", "(", "colstart", "<", "bitmap", "->", "width", ")", "{", "render_font_char", "*", "ch", "=", "&", "font", "->", "chars", "[", "chstart", "]", ";", "int", "colend", ";", "for", "(", ";", "colstart", "<", "bitmap", "->", "width", ";", "colstart", "++", ")", "if", "(", "pixel_is_set", "(", "bitmap", ",", "rowend", "+", "2", ",", "colstart", ")", ")", "break", ";", "if", "(", "colstart", ">=", "bitmap", "->", "width", ")", "break", ";", "for", "(", "colend", "=", "colstart", "+", "1", ";", "colend", "<", "bitmap", "->", "width", ";", "colend", "++", ")", "if", "(", "!", "pixel_is_set", "(", "bitmap", ",", "rowend", "+", "2", ",", "colend", ")", ")", "{", "colend", "--", ";", "break", ";", "}", "if", "(", "ch", "->", "width", "<=", "0", ")", "{", "ch", "->", "bitmap", "=", "bitmap_alloc", "(", "colend", "-", "colstart", "+", "1", ",", "font", "->", "height", ",", "BITMAP_FORMAT_ARGB32", ")", ";", "if", "(", "ch", "->", "bitmap", "==", "NULL", ")", "{", "fprintf", "(", "stderr", ",", "\"", "\\n", "\"", ",", "colend", "-", "colstart", "+", "1", ",", "font", "->", "height", ")", ";", "continue", ";", "}", "for", "(", "y", "=", "rowstart", ";", "y", "<=", "rowend", ";", "y", "++", ")", "for", "(", "x", "=", "colstart", ";", "x", "<=", "colend", ";", "x", "++", ")", "*", "BITMAP_ADDR32", "(", "ch", "->", "bitmap", ",", "y", "-", "rowstart", ",", "x", "-", "colstart", ")", "=", "pixel_is_set", "(", "bitmap", ",", "y", ",", "x", ")", "?", "0xffffffff", ":", "0x00000000", ";", "ch", "->", "width", "=", "colend", "-", "colstart", "+", "1", ";", "ch", "->", "xoffs", "=", "0", ";", "ch", "->", "yoffs", "=", "font", "->", "yoffs", ";", "ch", "->", "bmwidth", "=", "ch", "->", "bitmap", "->", "width", ";", "ch", "->", "bmheight", "=", "ch", "->", "bitmap", "->", "height", ";", "}", "chstart", "++", ";", "colstart", "=", "colend", "+", "1", ";", "}", "rowstart", "=", "rowend", "+", "1", ";", "}", "return", "(", "rowstart", "<", "bitmap", "->", "height", ")", ";", "}" ]
bitmap_to_chars - convert a bitmap to characters in the given font
[ "bitmap_to_chars", "-", "convert", "a", "bitmap", "to", "characters", "in", "the", "given", "font" ]
[ "/* loop over rows */", "/* find the top of the row */", "/* find the bottom of the row */", "/* find the baseline */", "/* set or confirm the height */", "/* decode the starting character */", "/* print info */", "// printf(\"Row %d-%d, baseline %d, character start %X\\n\", rowstart, rowend, baseline, chstart);", "/* scan the column to find characters */", "/* find the start of the character */", "/* find the end of the character */", "// skip char which code is already registered", "/* print info */", "// printf(\" Character %X - width = %d\\n\", chstart, colend - colstart + 1);", "/* allocate a bitmap */", "/* plot the character */", "/* set the character parameters */", "/* next character */", "/* next row */", "/* return non-zero (TRUE) if we errored */" ]
[ { "param": "bitmap", "type": "bitmap_t" }, { "param": "font", "type": "render_font" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "bitmap", "type": "bitmap_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "font", "type": "render_font", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b70981d88bb9c6bcf9c787fcdd992a514c7e31b1
lofunz/mieme
Reloaded/trunk/src/mame/drivers/mpu4drvr.c
[ "Unlicense" ]
C
update_mpu68_interrupts
void
static void update_mpu68_interrupts(running_machine *machine) { cputag_set_input_line(machine, "video", 1, m6840_irq_state ? ASSERT_LINE : CLEAR_LINE); cputag_set_input_line(machine, "video", 2, m6850_irq_state ? CLEAR_LINE : ASSERT_LINE); cputag_set_input_line(machine, "video", 3, scn2674_irq_state ? ASSERT_LINE : CLEAR_LINE); }
/* The interrupt system consists of a 74148 priority encoder with the following interrupt priorites. A lower number indicates a lower priority: 7 - Game Card 6 - Game Card 5 - Game Card 4 - Game Card 3 - 2674 AVDC 2 - 6850 ACIA 1 - 6840 PTM 0 - Unused */
The interrupt system consists of a 74148 priority encoder with the following interrupt priorites. A lower number indicates a lower priority.
[ "The", "interrupt", "system", "consists", "of", "a", "74148", "priority", "encoder", "with", "the", "following", "interrupt", "priorites", ".", "A", "lower", "number", "indicates", "a", "lower", "priority", "." ]
static void update_mpu68_interrupts(running_machine *machine) { cputag_set_input_line(machine, "video", 1, m6840_irq_state ? ASSERT_LINE : CLEAR_LINE); cputag_set_input_line(machine, "video", 2, m6850_irq_state ? CLEAR_LINE : ASSERT_LINE); cputag_set_input_line(machine, "video", 3, scn2674_irq_state ? ASSERT_LINE : CLEAR_LINE); }
[ "static", "void", "update_mpu68_interrupts", "(", "running_machine", "*", "machine", ")", "{", "cputag_set_input_line", "(", "machine", ",", "\"", "\"", ",", "1", ",", "m6840_irq_state", "?", "ASSERT_LINE", ":", "CLEAR_LINE", ")", ";", "cputag_set_input_line", "(", "machine", ",", "\"", "\"", ",", "2", ",", "m6850_irq_state", "?", "CLEAR_LINE", ":", "ASSERT_LINE", ")", ";", "cputag_set_input_line", "(", "machine", ",", "\"", "\"", ",", "3", ",", "scn2674_irq_state", "?", "ASSERT_LINE", ":", "CLEAR_LINE", ")", ";", "}" ]
The interrupt system consists of a 74148 priority encoder with the following interrupt priorites.
[ "The", "interrupt", "system", "consists", "of", "a", "74148", "priority", "encoder", "with", "the", "following", "interrupt", "priorites", "." ]
[]
[ { "param": "machine", "type": "running_machine" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
c6644b10d4109b5948358c2b3ec3e37351f475d8
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/mame/machine/mexico86.c
[ "Unlicense" ]
C
mcu_simulate
void
static void mcu_simulate(running_machine *machine) { if (!kikikai_mcu_initialised) { if (mexico86_protection_ram[0x01] == 0x00) { logerror("initialising MCU\n"); mexico86_protection_ram[0x04] = 0xfc; // coin inputs mexico86_protection_ram[0x02] = 0xff; // player 1 mexico86_protection_ram[0x03] = 0xff; // player 2 mexico86_protection_ram[0x1b] = 0xff; // active player mexico86_protection_ram[0x06] = 0xff; // must be FF otherwise PS4 ERROR mexico86_protection_ram[0x07] = 0x03; // must be 03 otherwise PS4 ERROR mexico86_protection_ram[0x00] = 0x00; kikikai_mcu_initialised = 1; } } if (kikikai_mcu_initialised) { int i; static int coin_last; int coin_curr; coin_curr = ~input_port_read(machine, "IN0") & 1; if (coin_curr && !coin_last && mexico86_protection_ram[0x01] < 9) { mexico86_protection_ram[0x01]++; // increase credits counter mexico86_protection_ram[0x0a] = 0x01; // set flag (coin inserted sound is not played otherwise) } coin_last = coin_curr; mexico86_protection_ram[0x04] = 0x3c; // coin inputs mexico86_protection_ram[0x02] = BITSWAP8(input_port_read(machine, "IN1"), 7,6,5,4,2,3,1,0); // player 1 mexico86_protection_ram[0x03] = BITSWAP8(input_port_read(machine, "IN2"), 7,6,5,4,2,3,1,0); // player 2 if (mexico86_protection_ram[0x19] == 0xaa) // player 2 active mexico86_protection_ram[0x1b] = mexico86_protection_ram[0x03]; else mexico86_protection_ram[0x1b] = mexico86_protection_ram[0x02]; for (i = 0; i < 0x10; i += 2) mexico86_protection_ram[i + 0xb1] = mexico86_protection_ram[i + 0xb0]; for (i = 0; i < 0x0a; i++) mexico86_protection_ram[i + 0xc0] = mexico86_protection_ram[i + 0x90] + 1; if (mexico86_protection_ram[0xd1] == 0xff) { if (mexico86_protection_ram[0xd0] > 0 && mexico86_protection_ram[0xd0] < 4) { mexico86_protection_ram[0xd2] = 0x81; mexico86_protection_ram[0xd0] = 0xff; } } if (mexico86_protection_ram[0xe0] > 0 && mexico86_protection_ram[0xe0] < 4) { static const UINT8 answers[3][16] = { { 0x00,0x40,0x48,0x50,0x58,0x60,0x68,0x70,0x78,0x80,0x88,0x00,0x00,0x00,0x00,0x00 }, { 0x00,0x04,0x08,0x0C,0x10,0x14,0x18,0x1C,0x20,0x31,0x2B,0x35,0x00,0x00,0x00,0x00 }, { 0x00,0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12,0x03,0x0A,0x0B,0x14,0x00,0x00,0x00,0x00 }, }; int table = mexico86_protection_ram[0xe0] - 1; for (i = 1; i < 0x10; i++) mexico86_protection_ram[0xe0 + i] = answers[table][i]; mexico86_protection_ram[0xe0] = 0xff; } if (mexico86_protection_ram[0xf0] > 0 && mexico86_protection_ram[0xf0] < 4) { mexico86_protection_ram[0xf1] = 0xb3; mexico86_protection_ram[0xf0] = 0xff; } // The following is missing from Knight Boy // this should be equivalent to the obfuscated kiki_clogic() below { static const UINT8 db[16]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x10,0x18,0x00,0x00,0x00,0x00}; UINT16 sy = mexico86_protection_ram[0xa0] + ((0x18)>>1); UINT16 sx = mexico86_protection_ram[0xa1] + ((0x18)>>1); for (i = 0; i < 0x38; i += 8) { UINT8 hw = db[mexico86_protection_ram[0x20 + i] & 0xf]; if (hw) { UINT16 xdiff = sx - ((UINT16)mexico86_protection_ram[0x20 + i+6] << 8 | mexico86_protection_ram[0x20 + i+7]); if (xdiff < hw) { UINT16 ydiff = sy - ((UINT16)mexico86_protection_ram[0x20 + i+4] << 8 | mexico86_protection_ram[0x20 + i+5]); if (ydiff < hw) mexico86_protection_ram[0xa2] = 1; // we have a collision } } } } } }
/*************************************************************************** KiKi KaiKai MCU simulation This is derived from examination of the bootleg 68705 MCU code, with an addition to fix collision detection which is missing from the bootleg. ***************************************************************************/
KiKi KaiKai MCU simulation This is derived from examination of the bootleg 68705 MCU code, with an addition to fix collision detection which is missing from the bootleg.
[ "KiKi", "KaiKai", "MCU", "simulation", "This", "is", "derived", "from", "examination", "of", "the", "bootleg", "68705", "MCU", "code", "with", "an", "addition", "to", "fix", "collision", "detection", "which", "is", "missing", "from", "the", "bootleg", "." ]
static void mcu_simulate(running_machine *machine) { if (!kikikai_mcu_initialised) { if (mexico86_protection_ram[0x01] == 0x00) { logerror("initialising MCU\n"); mexico86_protection_ram[0x04] = 0xfc; mexico86_protection_ram[0x02] = 0xff; mexico86_protection_ram[0x03] = 0xff; mexico86_protection_ram[0x1b] = 0xff; mexico86_protection_ram[0x06] = 0xff; mexico86_protection_ram[0x07] = 0x03; mexico86_protection_ram[0x00] = 0x00; kikikai_mcu_initialised = 1; } } if (kikikai_mcu_initialised) { int i; static int coin_last; int coin_curr; coin_curr = ~input_port_read(machine, "IN0") & 1; if (coin_curr && !coin_last && mexico86_protection_ram[0x01] < 9) { mexico86_protection_ram[0x01]++; mexico86_protection_ram[0x0a] = 0x01; } coin_last = coin_curr; mexico86_protection_ram[0x04] = 0x3c; mexico86_protection_ram[0x02] = BITSWAP8(input_port_read(machine, "IN1"), 7,6,5,4,2,3,1,0); mexico86_protection_ram[0x03] = BITSWAP8(input_port_read(machine, "IN2"), 7,6,5,4,2,3,1,0); if (mexico86_protection_ram[0x19] == 0xaa) active mexico86_protection_ram[0x1b] = mexico86_protection_ram[0x03]; else mexico86_protection_ram[0x1b] = mexico86_protection_ram[0x02]; for (i = 0; i < 0x10; i += 2) mexico86_protection_ram[i + 0xb1] = mexico86_protection_ram[i + 0xb0]; for (i = 0; i < 0x0a; i++) mexico86_protection_ram[i + 0xc0] = mexico86_protection_ram[i + 0x90] + 1; if (mexico86_protection_ram[0xd1] == 0xff) { if (mexico86_protection_ram[0xd0] > 0 && mexico86_protection_ram[0xd0] < 4) { mexico86_protection_ram[0xd2] = 0x81; mexico86_protection_ram[0xd0] = 0xff; } } if (mexico86_protection_ram[0xe0] > 0 && mexico86_protection_ram[0xe0] < 4) { static const UINT8 answers[3][16] = { { 0x00,0x40,0x48,0x50,0x58,0x60,0x68,0x70,0x78,0x80,0x88,0x00,0x00,0x00,0x00,0x00 }, { 0x00,0x04,0x08,0x0C,0x10,0x14,0x18,0x1C,0x20,0x31,0x2B,0x35,0x00,0x00,0x00,0x00 }, { 0x00,0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12,0x03,0x0A,0x0B,0x14,0x00,0x00,0x00,0x00 }, }; int table = mexico86_protection_ram[0xe0] - 1; for (i = 1; i < 0x10; i++) mexico86_protection_ram[0xe0 + i] = answers[table][i]; mexico86_protection_ram[0xe0] = 0xff; } if (mexico86_protection_ram[0xf0] > 0 && mexico86_protection_ram[0xf0] < 4) { mexico86_protection_ram[0xf1] = 0xb3; mexico86_protection_ram[0xf0] = 0xff; } { static const UINT8 db[16]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x10,0x18,0x00,0x00,0x00,0x00}; UINT16 sy = mexico86_protection_ram[0xa0] + ((0x18)>>1); UINT16 sx = mexico86_protection_ram[0xa1] + ((0x18)>>1); for (i = 0; i < 0x38; i += 8) { UINT8 hw = db[mexico86_protection_ram[0x20 + i] & 0xf]; if (hw) { UINT16 xdiff = sx - ((UINT16)mexico86_protection_ram[0x20 + i+6] << 8 | mexico86_protection_ram[0x20 + i+7]); if (xdiff < hw) { UINT16 ydiff = sy - ((UINT16)mexico86_protection_ram[0x20 + i+4] << 8 | mexico86_protection_ram[0x20 + i+5]); if (ydiff < hw) mexico86_protection_ram[0xa2] = 1; } } } } } }
[ "static", "void", "mcu_simulate", "(", "running_machine", "*", "machine", ")", "{", "if", "(", "!", "kikikai_mcu_initialised", ")", "{", "if", "(", "mexico86_protection_ram", "[", "0x01", "]", "==", "0x00", ")", "{", "logerror", "(", "\"", "\\n", "\"", ")", ";", "mexico86_protection_ram", "[", "0x04", "]", "=", "0xfc", ";", "mexico86_protection_ram", "[", "0x02", "]", "=", "0xff", ";", "mexico86_protection_ram", "[", "0x03", "]", "=", "0xff", ";", "mexico86_protection_ram", "[", "0x1b", "]", "=", "0xff", ";", "mexico86_protection_ram", "[", "0x06", "]", "=", "0xff", ";", "mexico86_protection_ram", "[", "0x07", "]", "=", "0x03", ";", "mexico86_protection_ram", "[", "0x00", "]", "=", "0x00", ";", "kikikai_mcu_initialised", "=", "1", ";", "}", "}", "if", "(", "kikikai_mcu_initialised", ")", "{", "int", "i", ";", "static", "int", "coin_last", ";", "int", "coin_curr", ";", "coin_curr", "=", "~", "input_port_read", "(", "machine", ",", "\"", "\"", ")", "&", "1", ";", "if", "(", "coin_curr", "&&", "!", "coin_last", "&&", "mexico86_protection_ram", "[", "0x01", "]", "<", "9", ")", "{", "mexico86_protection_ram", "[", "0x01", "]", "++", ";", "mexico86_protection_ram", "[", "0x0a", "]", "=", "0x01", ";", "}", "coin_last", "=", "coin_curr", ";", "mexico86_protection_ram", "[", "0x04", "]", "=", "0x3c", ";", "mexico86_protection_ram", "[", "0x02", "]", "=", "BITSWAP8", "(", "input_port_read", "(", "machine", ",", "\"", "\"", ")", ",", "7", ",", "6", ",", "5", ",", "4", ",", "2", ",", "3", ",", "1", ",", "0", ")", ";", "mexico86_protection_ram", "[", "0x03", "]", "=", "BITSWAP8", "(", "input_port_read", "(", "machine", ",", "\"", "\"", ")", ",", "7", ",", "6", ",", "5", ",", "4", ",", "2", ",", "3", ",", "1", ",", "0", ")", ";", "if", "(", "mexico86_protection_ram", "[", "0x19", "]", "==", "0xaa", ")", "mexico86_protection_ram", "[", "0x1b", "]", "=", "mexico86_protection_ram", "[", "0x03", "]", ";", "else", "mexico86_protection_ram", "[", "0x1b", "]", "=", "mexico86_protection_ram", "[", "0x02", "]", ";", "for", "(", "i", "=", "0", ";", "i", "<", "0x10", ";", "i", "+=", "2", ")", "mexico86_protection_ram", "[", "i", "+", "0xb1", "]", "=", "mexico86_protection_ram", "[", "i", "+", "0xb0", "]", ";", "for", "(", "i", "=", "0", ";", "i", "<", "0x0a", ";", "i", "++", ")", "mexico86_protection_ram", "[", "i", "+", "0xc0", "]", "=", "mexico86_protection_ram", "[", "i", "+", "0x90", "]", "+", "1", ";", "if", "(", "mexico86_protection_ram", "[", "0xd1", "]", "==", "0xff", ")", "{", "if", "(", "mexico86_protection_ram", "[", "0xd0", "]", ">", "0", "&&", "mexico86_protection_ram", "[", "0xd0", "]", "<", "4", ")", "{", "mexico86_protection_ram", "[", "0xd2", "]", "=", "0x81", ";", "mexico86_protection_ram", "[", "0xd0", "]", "=", "0xff", ";", "}", "}", "if", "(", "mexico86_protection_ram", "[", "0xe0", "]", ">", "0", "&&", "mexico86_protection_ram", "[", "0xe0", "]", "<", "4", ")", "{", "static", "const", "UINT8", "answers", "[", "3", "]", "[", "16", "]", "=", "{", "{", "0x00", ",", "0x40", ",", "0x48", ",", "0x50", ",", "0x58", ",", "0x60", ",", "0x68", ",", "0x70", ",", "0x78", ",", "0x80", ",", "0x88", ",", "0x00", ",", "0x00", ",", "0x00", ",", "0x00", ",", "0x00", "}", ",", "{", "0x00", ",", "0x04", ",", "0x08", ",", "0x0C", ",", "0x10", ",", "0x14", ",", "0x18", ",", "0x1C", ",", "0x20", ",", "0x31", ",", "0x2B", ",", "0x35", ",", "0x00", ",", "0x00", ",", "0x00", ",", "0x00", "}", ",", "{", "0x00", ",", "0x0C", ",", "0x0D", ",", "0x0E", ",", "0x0F", ",", "0x10", ",", "0x11", ",", "0x12", ",", "0x03", ",", "0x0A", ",", "0x0B", ",", "0x14", ",", "0x00", ",", "0x00", ",", "0x00", ",", "0x00", "}", ",", "}", ";", "int", "table", "=", "mexico86_protection_ram", "[", "0xe0", "]", "-", "1", ";", "for", "(", "i", "=", "1", ";", "i", "<", "0x10", ";", "i", "++", ")", "mexico86_protection_ram", "[", "0xe0", "+", "i", "]", "=", "answers", "[", "table", "]", "[", "i", "]", ";", "mexico86_protection_ram", "[", "0xe0", "]", "=", "0xff", ";", "}", "if", "(", "mexico86_protection_ram", "[", "0xf0", "]", ">", "0", "&&", "mexico86_protection_ram", "[", "0xf0", "]", "<", "4", ")", "{", "mexico86_protection_ram", "[", "0xf1", "]", "=", "0xb3", ";", "mexico86_protection_ram", "[", "0xf0", "]", "=", "0xff", ";", "}", "{", "static", "const", "UINT8", "db", "[", "16", "]", "=", "{", "0x00", ",", "0x00", ",", "0x00", ",", "0x00", ",", "0x00", ",", "0x00", ",", "0x00", ",", "0x00", ",", "0x08", ",", "0x00", ",", "0x10", ",", "0x18", ",", "0x00", ",", "0x00", ",", "0x00", ",", "0x00", "}", ";", "UINT16", "sy", "=", "mexico86_protection_ram", "[", "0xa0", "]", "+", "(", "(", "0x18", ")", ">>", "1", ")", ";", "UINT16", "sx", "=", "mexico86_protection_ram", "[", "0xa1", "]", "+", "(", "(", "0x18", ")", ">>", "1", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "0x38", ";", "i", "+=", "8", ")", "{", "UINT8", "hw", "=", "db", "[", "mexico86_protection_ram", "[", "0x20", "+", "i", "]", "&", "0xf", "]", ";", "if", "(", "hw", ")", "{", "UINT16", "xdiff", "=", "sx", "-", "(", "(", "UINT16", ")", "mexico86_protection_ram", "[", "0x20", "+", "i", "+", "6", "]", "<<", "8", "|", "mexico86_protection_ram", "[", "0x20", "+", "i", "+", "7", "]", ")", ";", "if", "(", "xdiff", "<", "hw", ")", "{", "UINT16", "ydiff", "=", "sy", "-", "(", "(", "UINT16", ")", "mexico86_protection_ram", "[", "0x20", "+", "i", "+", "4", "]", "<<", "8", "|", "mexico86_protection_ram", "[", "0x20", "+", "i", "+", "5", "]", ")", ";", "if", "(", "ydiff", "<", "hw", ")", "mexico86_protection_ram", "[", "0xa2", "]", "=", "1", ";", "}", "}", "}", "}", "}", "}" ]
KiKi KaiKai MCU simulation This is derived from examination of the bootleg 68705 MCU code, with an addition to fix collision detection which is missing from the bootleg.
[ "KiKi", "KaiKai", "MCU", "simulation", "This", "is", "derived", "from", "examination", "of", "the", "bootleg", "68705", "MCU", "code", "with", "an", "addition", "to", "fix", "collision", "detection", "which", "is", "missing", "from", "the", "bootleg", "." ]
[ "// coin inputs", "// player 1", "// player 2", "// active player", "// must be FF otherwise PS4 ERROR", "// must be 03 otherwise PS4 ERROR", "// increase credits counter", "// set flag (coin inserted sound is not played otherwise)", "// coin inputs", "// player 1", "// player 2", "// player 2 active", "// The following is missing from Knight Boy", "// this should be equivalent to the obfuscated kiki_clogic() below", "// we have a collision" ]
[ { "param": "machine", "type": "running_machine" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
debug_view_begin_update
void
void debug_view_begin_update(debug_view *view) { /* bump the level */ view->update_level++; }
/*------------------------------------------------- debug_view_begin_update - bracket a sequence of changes so that only one update occurs -------------------------------------------------*/
bracket a sequence of changes so that only one update occurs
[ "bracket", "a", "sequence", "of", "changes", "so", "that", "only", "one", "update", "occurs" ]
void debug_view_begin_update(debug_view *view) { view->update_level++; }
[ "void", "debug_view_begin_update", "(", "debug_view", "*", "view", ")", "{", "view", "->", "update_level", "++", ";", "}" ]
debug_view_begin_update - bracket a sequence of changes so that only one update occurs
[ "debug_view_begin_update", "-", "bracket", "a", "sequence", "of", "changes", "so", "that", "only", "one", "update", "occurs" ]
[ "/* bump the level */" ]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
debug_view_end_update
void
void debug_view_end_update(debug_view *view) { /* if we hit zero, call the update function */ if (view->update_level == 1) { while (view->update_pending) { int size; /* no longer pending, but flag for the OSD */ view->update_pending = FALSE; view->osd_update_pending = TRUE; /* resize the viewdata if needed */ size = view->visible.x * view->visible.y; if (size > view->viewdata_size) { view->viewdata_size = size; view->viewdata = (debug_view_char *)realloc(view->viewdata, sizeof(view->viewdata[0]) * view->viewdata_size); } /* update the view */ if (view->cb.update != NULL) (*view->cb.update)(view); } } /* decrement the level */ view->update_level--; }
/*------------------------------------------------- debug_view_end_update - bracket a sequence of changes so that only one update occurs -------------------------------------------------*/
bracket a sequence of changes so that only one update occurs
[ "bracket", "a", "sequence", "of", "changes", "so", "that", "only", "one", "update", "occurs" ]
void debug_view_end_update(debug_view *view) { if (view->update_level == 1) { while (view->update_pending) { int size; view->update_pending = FALSE; view->osd_update_pending = TRUE; size = view->visible.x * view->visible.y; if (size > view->viewdata_size) { view->viewdata_size = size; view->viewdata = (debug_view_char *)realloc(view->viewdata, sizeof(view->viewdata[0]) * view->viewdata_size); } if (view->cb.update != NULL) (*view->cb.update)(view); } } view->update_level--; }
[ "void", "debug_view_end_update", "(", "debug_view", "*", "view", ")", "{", "if", "(", "view", "->", "update_level", "==", "1", ")", "{", "while", "(", "view", "->", "update_pending", ")", "{", "int", "size", ";", "view", "->", "update_pending", "=", "FALSE", ";", "view", "->", "osd_update_pending", "=", "TRUE", ";", "size", "=", "view", "->", "visible", ".", "x", "*", "view", "->", "visible", ".", "y", ";", "if", "(", "size", ">", "view", "->", "viewdata_size", ")", "{", "view", "->", "viewdata_size", "=", "size", ";", "view", "->", "viewdata", "=", "(", "debug_view_char", "*", ")", "realloc", "(", "view", "->", "viewdata", ",", "sizeof", "(", "view", "->", "viewdata", "[", "0", "]", ")", "*", "view", "->", "viewdata_size", ")", ";", "}", "if", "(", "view", "->", "cb", ".", "update", "!=", "NULL", ")", "(", "*", "view", "->", "cb", ".", "update", ")", "(", "view", ")", ";", "}", "}", "view", "->", "update_level", "--", ";", "}" ]
debug_view_end_update - bracket a sequence of changes so that only one update occurs
[ "debug_view_end_update", "-", "bracket", "a", "sequence", "of", "changes", "so", "that", "only", "one", "update", "occurs" ]
[ "/* if we hit zero, call the update function */", "/* no longer pending, but flag for the OSD */", "/* resize the viewdata if needed */", "/* update the view */", "/* decrement the level */" ]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
debug_view_flush_updates
void
void debug_view_flush_updates(running_machine *machine) { debugvw_private *global = machine->debugvw_data; debug_view *view; /* skip if we're not ready yet */ if (global == NULL) return; /* loop over each view and force an update */ for (view = global->viewlist; view != NULL; view = view->next) if (view->osd_update_pending) { /* update the owner */ if (view->osdupdate != NULL) (*view->osdupdate)(view, view->osdprivate); view->osd_update_pending = FALSE; } }
/*------------------------------------------------- debug_view_flush_updates - force all updates to notify the OSD -------------------------------------------------*/
force all updates to notify the OSD
[ "force", "all", "updates", "to", "notify", "the", "OSD" ]
void debug_view_flush_updates(running_machine *machine) { debugvw_private *global = machine->debugvw_data; debug_view *view; if (global == NULL) return; for (view = global->viewlist; view != NULL; view = view->next) if (view->osd_update_pending) { if (view->osdupdate != NULL) (*view->osdupdate)(view, view->osdprivate); view->osd_update_pending = FALSE; } }
[ "void", "debug_view_flush_updates", "(", "running_machine", "*", "machine", ")", "{", "debugvw_private", "*", "global", "=", "machine", "->", "debugvw_data", ";", "debug_view", "*", "view", ";", "if", "(", "global", "==", "NULL", ")", "return", ";", "for", "(", "view", "=", "global", "->", "viewlist", ";", "view", "!=", "NULL", ";", "view", "=", "view", "->", "next", ")", "if", "(", "view", "->", "osd_update_pending", ")", "{", "if", "(", "view", "->", "osdupdate", "!=", "NULL", ")", "(", "*", "view", "->", "osdupdate", ")", "(", "view", ",", "view", "->", "osdprivate", ")", ";", "view", "->", "osd_update_pending", "=", "FALSE", ";", "}", "}" ]
debug_view_flush_updates - force all updates to notify the OSD
[ "debug_view_flush_updates", "-", "force", "all", "updates", "to", "notify", "the", "OSD" ]
[ "/* skip if we're not ready yet */", "/* loop over each view and force an update */", "/* update the owner */" ]
[ { "param": "machine", "type": "running_machine" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
debug_view_update_type
void
void debug_view_update_type(running_machine *machine, int type) { debugvw_private *global = machine->debugvw_data; debug_view *view; /* skip if we're not ready yet */ if (global == NULL) return; /* loop over each view and force an update */ for (view = global->viewlist; view != NULL; view = view->next) if (view->type == type) { debug_view_begin_update(view); view->recompute = view->update_pending = TRUE; debug_view_end_update(view); } }
/*------------------------------------------------- debug_view_update_type - force all views of a given type to refresh -------------------------------------------------*/
force all views of a given type to refresh
[ "force", "all", "views", "of", "a", "given", "type", "to", "refresh" ]
void debug_view_update_type(running_machine *machine, int type) { debugvw_private *global = machine->debugvw_data; debug_view *view; if (global == NULL) return; for (view = global->viewlist; view != NULL; view = view->next) if (view->type == type) { debug_view_begin_update(view); view->recompute = view->update_pending = TRUE; debug_view_end_update(view); } }
[ "void", "debug_view_update_type", "(", "running_machine", "*", "machine", ",", "int", "type", ")", "{", "debugvw_private", "*", "global", "=", "machine", "->", "debugvw_data", ";", "debug_view", "*", "view", ";", "if", "(", "global", "==", "NULL", ")", "return", ";", "for", "(", "view", "=", "global", "->", "viewlist", ";", "view", "!=", "NULL", ";", "view", "=", "view", "->", "next", ")", "if", "(", "view", "->", "type", "==", "type", ")", "{", "debug_view_begin_update", "(", "view", ")", ";", "view", "->", "recompute", "=", "view", "->", "update_pending", "=", "TRUE", ";", "debug_view_end_update", "(", "view", ")", ";", "}", "}" ]
debug_view_update_type - force all views of a given type to refresh
[ "debug_view_update_type", "-", "force", "all", "views", "of", "a", "given", "type", "to", "refresh" ]
[ "/* skip if we're not ready yet */", "/* loop over each view and force an update */" ]
[ { "param": "machine", "type": "running_machine" }, { "param": "type", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "type", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
debug_view_type_character
void
void debug_view_type_character(debug_view *view, int character) { /* if the view has a character handler, forward it on */ if (view->cb.handlechar != NULL) (*view->cb.handlechar)(view, character); }
/*------------------------------------------------- debug_view_type_character - type a character into a view -------------------------------------------------*/
type a character into a view
[ "type", "a", "character", "into", "a", "view" ]
void debug_view_type_character(debug_view *view, int character) { if (view->cb.handlechar != NULL) (*view->cb.handlechar)(view, character); }
[ "void", "debug_view_type_character", "(", "debug_view", "*", "view", ",", "int", "character", ")", "{", "if", "(", "view", "->", "cb", ".", "handlechar", "!=", "NULL", ")", "(", "*", "view", "->", "cb", ".", "handlechar", ")", "(", "view", ",", "character", ")", ";", "}" ]
debug_view_type_character - type a character into a view
[ "debug_view_type_character", "-", "type", "a", "character", "into", "a", "view" ]
[ "/* if the view has a character handler, forward it on */" ]
[ { "param": "view", "type": "debug_view" }, { "param": "character", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "character", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
debug_view_get_total_size
debug_view_xy
debug_view_xy debug_view_get_total_size(debug_view *view) { debug_view_begin_update(view); debug_view_end_update(view); return view->total; }
/*------------------------------------------------- debug_view_get_total_size - return the total view size in rows and columns -------------------------------------------------*/
return the total view size in rows and columns
[ "return", "the", "total", "view", "size", "in", "rows", "and", "columns" ]
debug_view_xy debug_view_get_total_size(debug_view *view) { debug_view_begin_update(view); debug_view_end_update(view); return view->total; }
[ "debug_view_xy", "debug_view_get_total_size", "(", "debug_view", "*", "view", ")", "{", "debug_view_begin_update", "(", "view", ")", ";", "debug_view_end_update", "(", "view", ")", ";", "return", "view", "->", "total", ";", "}" ]
debug_view_get_total_size - return the total view size in rows and columns
[ "debug_view_get_total_size", "-", "return", "the", "total", "view", "size", "in", "rows", "and", "columns" ]
[]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
debug_view_get_visible_size
debug_view_xy
debug_view_xy debug_view_get_visible_size(debug_view *view) { debug_view_begin_update(view); debug_view_end_update(view); return view->visible; }
/*------------------------------------------------- debug_view_get_visible_size - return the visible size in rows and columns -------------------------------------------------*/
return the visible size in rows and columns
[ "return", "the", "visible", "size", "in", "rows", "and", "columns" ]
debug_view_xy debug_view_get_visible_size(debug_view *view) { debug_view_begin_update(view); debug_view_end_update(view); return view->visible; }
[ "debug_view_xy", "debug_view_get_visible_size", "(", "debug_view", "*", "view", ")", "{", "debug_view_begin_update", "(", "view", ")", ";", "debug_view_end_update", "(", "view", ")", ";", "return", "view", "->", "visible", ";", "}" ]
debug_view_get_visible_size - return the visible size in rows and columns
[ "debug_view_get_visible_size", "-", "return", "the", "visible", "size", "in", "rows", "and", "columns" ]
[]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
debug_view_get_visible_position
debug_view_xy
debug_view_xy debug_view_get_visible_position(debug_view *view) { debug_view_begin_update(view); debug_view_end_update(view); return view->topleft; }
/*------------------------------------------------- debug_view_get_visible_position - return the top left position of the visible area in rows and columns -------------------------------------------------*/
return the top left position of the visible area in rows and columns
[ "return", "the", "top", "left", "position", "of", "the", "visible", "area", "in", "rows", "and", "columns" ]
debug_view_xy debug_view_get_visible_position(debug_view *view) { debug_view_begin_update(view); debug_view_end_update(view); return view->topleft; }
[ "debug_view_xy", "debug_view_get_visible_position", "(", "debug_view", "*", "view", ")", "{", "debug_view_begin_update", "(", "view", ")", ";", "debug_view_end_update", "(", "view", ")", ";", "return", "view", "->", "topleft", ";", "}" ]
debug_view_get_visible_position - return the top left position of the visible area in rows and columns
[ "debug_view_get_visible_position", "-", "return", "the", "top", "left", "position", "of", "the", "visible", "area", "in", "rows", "and", "columns" ]
[]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
debug_view_set_visible_size
void
void debug_view_set_visible_size(debug_view *view, debug_view_xy size) { if (size.x != view->visible.x || size.y != view->visible.y) { debug_view_begin_update(view); view->visible = size; view->update_pending = TRUE; if (view->cb.notify != NULL) (*view->cb.notify)(view, VIEW_NOTIFY_VISIBLE_CHANGED); debug_view_end_update(view); } }
/*------------------------------------------------- debug_view_set_visible_size - set the visible size in rows and columns -------------------------------------------------*/
set the visible size in rows and columns
[ "set", "the", "visible", "size", "in", "rows", "and", "columns" ]
void debug_view_set_visible_size(debug_view *view, debug_view_xy size) { if (size.x != view->visible.x || size.y != view->visible.y) { debug_view_begin_update(view); view->visible = size; view->update_pending = TRUE; if (view->cb.notify != NULL) (*view->cb.notify)(view, VIEW_NOTIFY_VISIBLE_CHANGED); debug_view_end_update(view); } }
[ "void", "debug_view_set_visible_size", "(", "debug_view", "*", "view", ",", "debug_view_xy", "size", ")", "{", "if", "(", "size", ".", "x", "!=", "view", "->", "visible", ".", "x", "||", "size", ".", "y", "!=", "view", "->", "visible", ".", "y", ")", "{", "debug_view_begin_update", "(", "view", ")", ";", "view", "->", "visible", "=", "size", ";", "view", "->", "update_pending", "=", "TRUE", ";", "if", "(", "view", "->", "cb", ".", "notify", "!=", "NULL", ")", "(", "*", "view", "->", "cb", ".", "notify", ")", "(", "view", ",", "VIEW_NOTIFY_VISIBLE_CHANGED", ")", ";", "debug_view_end_update", "(", "view", ")", ";", "}", "}" ]
debug_view_set_visible_size - set the visible size in rows and columns
[ "debug_view_set_visible_size", "-", "set", "the", "visible", "size", "in", "rows", "and", "columns" ]
[]
[ { "param": "view", "type": "debug_view" }, { "param": "size", "type": "debug_view_xy" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "size", "type": "debug_view_xy", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
debug_view_set_visible_position
void
void debug_view_set_visible_position(debug_view *view, debug_view_xy pos) { if (pos.x != view->topleft.x || pos.y != view->topleft.y) { debug_view_begin_update(view); view->topleft = pos; view->update_pending = TRUE; if (view->cb.notify != NULL) (*view->cb.notify)(view, VIEW_NOTIFY_VISIBLE_CHANGED); debug_view_end_update(view); } }
/*------------------------------------------------- debug_view_set_visible_position - set the top left position of the visible area in rows and columns -------------------------------------------------*/
set the top left position of the visible area in rows and columns
[ "set", "the", "top", "left", "position", "of", "the", "visible", "area", "in", "rows", "and", "columns" ]
void debug_view_set_visible_position(debug_view *view, debug_view_xy pos) { if (pos.x != view->topleft.x || pos.y != view->topleft.y) { debug_view_begin_update(view); view->topleft = pos; view->update_pending = TRUE; if (view->cb.notify != NULL) (*view->cb.notify)(view, VIEW_NOTIFY_VISIBLE_CHANGED); debug_view_end_update(view); } }
[ "void", "debug_view_set_visible_position", "(", "debug_view", "*", "view", ",", "debug_view_xy", "pos", ")", "{", "if", "(", "pos", ".", "x", "!=", "view", "->", "topleft", ".", "x", "||", "pos", ".", "y", "!=", "view", "->", "topleft", ".", "y", ")", "{", "debug_view_begin_update", "(", "view", ")", ";", "view", "->", "topleft", "=", "pos", ";", "view", "->", "update_pending", "=", "TRUE", ";", "if", "(", "view", "->", "cb", ".", "notify", "!=", "NULL", ")", "(", "*", "view", "->", "cb", ".", "notify", ")", "(", "view", ",", "VIEW_NOTIFY_VISIBLE_CHANGED", ")", ";", "debug_view_end_update", "(", "view", ")", ";", "}", "}" ]
debug_view_set_visible_position - set the top left position of the visible area in rows and columns
[ "debug_view_set_visible_position", "-", "set", "the", "top", "left", "position", "of", "the", "visible", "area", "in", "rows", "and", "columns" ]
[]
[ { "param": "view", "type": "debug_view" }, { "param": "pos", "type": "debug_view_xy" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pos", "type": "debug_view_xy", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
debug_view_get_cursor_position
debug_view_xy
debug_view_xy debug_view_get_cursor_position(debug_view *view) { debug_view_begin_update(view); debug_view_end_update(view); return view->cursor; }
/*------------------------------------------------- debug_view_get_cursor_position - return the current cursor position as a row and column -------------------------------------------------*/
return the current cursor position as a row and column
[ "return", "the", "current", "cursor", "position", "as", "a", "row", "and", "column" ]
debug_view_xy debug_view_get_cursor_position(debug_view *view) { debug_view_begin_update(view); debug_view_end_update(view); return view->cursor; }
[ "debug_view_xy", "debug_view_get_cursor_position", "(", "debug_view", "*", "view", ")", "{", "debug_view_begin_update", "(", "view", ")", ";", "debug_view_end_update", "(", "view", ")", ";", "return", "view", "->", "cursor", ";", "}" ]
debug_view_get_cursor_position - return the current cursor position as a row and column
[ "debug_view_get_cursor_position", "-", "return", "the", "current", "cursor", "position", "as", "a", "row", "and", "column" ]
[]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
debug_view_get_cursor_supported
int
int debug_view_get_cursor_supported(debug_view *view) { debug_view_begin_update(view); debug_view_end_update(view); return view->supports_cursor; }
/*------------------------------------------------- debug_view_get_cursor_supported - return TRUE if a cursor is supported for this view type -------------------------------------------------*/
return TRUE if a cursor is supported for this view type
[ "return", "TRUE", "if", "a", "cursor", "is", "supported", "for", "this", "view", "type" ]
int debug_view_get_cursor_supported(debug_view *view) { debug_view_begin_update(view); debug_view_end_update(view); return view->supports_cursor; }
[ "int", "debug_view_get_cursor_supported", "(", "debug_view", "*", "view", ")", "{", "debug_view_begin_update", "(", "view", ")", ";", "debug_view_end_update", "(", "view", ")", ";", "return", "view", "->", "supports_cursor", ";", "}" ]
debug_view_get_cursor_supported - return TRUE if a cursor is supported for this view type
[ "debug_view_get_cursor_supported", "-", "return", "TRUE", "if", "a", "cursor", "is", "supported", "for", "this", "view", "type" ]
[]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
debug_view_get_cursor_visible
int
int debug_view_get_cursor_visible(debug_view *view) { debug_view_begin_update(view); debug_view_end_update(view); return view->cursor_visible; }
/*------------------------------------------------- debug_view_get_cursor_visible - return TRUE if a cursor is currently visible -------------------------------------------------*/
return TRUE if a cursor is currently visible
[ "return", "TRUE", "if", "a", "cursor", "is", "currently", "visible" ]
int debug_view_get_cursor_visible(debug_view *view) { debug_view_begin_update(view); debug_view_end_update(view); return view->cursor_visible; }
[ "int", "debug_view_get_cursor_visible", "(", "debug_view", "*", "view", ")", "{", "debug_view_begin_update", "(", "view", ")", ";", "debug_view_end_update", "(", "view", ")", ";", "return", "view", "->", "cursor_visible", ";", "}" ]
debug_view_get_cursor_visible - return TRUE if a cursor is currently visible
[ "debug_view_get_cursor_visible", "-", "return", "TRUE", "if", "a", "cursor", "is", "currently", "visible" ]
[]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
debug_view_set_cursor_position
void
void debug_view_set_cursor_position(debug_view *view, debug_view_xy pos) { if (pos.x != view->cursor.x || pos.y != view->cursor.y) { debug_view_begin_update(view); view->cursor = pos; view->update_pending = TRUE; if (view->cb.notify != NULL) (*view->cb.notify)(view, VIEW_NOTIFY_CURSOR_CHANGED); debug_view_end_update(view); } }
/*------------------------------------------------- debug_view_set_cursor_position - set the current cursor position as a row and column -------------------------------------------------*/
set the current cursor position as a row and column
[ "set", "the", "current", "cursor", "position", "as", "a", "row", "and", "column" ]
void debug_view_set_cursor_position(debug_view *view, debug_view_xy pos) { if (pos.x != view->cursor.x || pos.y != view->cursor.y) { debug_view_begin_update(view); view->cursor = pos; view->update_pending = TRUE; if (view->cb.notify != NULL) (*view->cb.notify)(view, VIEW_NOTIFY_CURSOR_CHANGED); debug_view_end_update(view); } }
[ "void", "debug_view_set_cursor_position", "(", "debug_view", "*", "view", ",", "debug_view_xy", "pos", ")", "{", "if", "(", "pos", ".", "x", "!=", "view", "->", "cursor", ".", "x", "||", "pos", ".", "y", "!=", "view", "->", "cursor", ".", "y", ")", "{", "debug_view_begin_update", "(", "view", ")", ";", "view", "->", "cursor", "=", "pos", ";", "view", "->", "update_pending", "=", "TRUE", ";", "if", "(", "view", "->", "cb", ".", "notify", "!=", "NULL", ")", "(", "*", "view", "->", "cb", ".", "notify", ")", "(", "view", ",", "VIEW_NOTIFY_CURSOR_CHANGED", ")", ";", "debug_view_end_update", "(", "view", ")", ";", "}", "}" ]
debug_view_set_cursor_position - set the current cursor position as a row and column
[ "debug_view_set_cursor_position", "-", "set", "the", "current", "cursor", "position", "as", "a", "row", "and", "column" ]
[]
[ { "param": "view", "type": "debug_view" }, { "param": "pos", "type": "debug_view_xy" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pos", "type": "debug_view_xy", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
debug_view_set_cursor_visible
void
void debug_view_set_cursor_visible(debug_view *view, int visible) { if (visible != view->cursor_visible) { debug_view_begin_update(view); view->cursor_visible = visible; view->update_pending = TRUE; if (view->cb.notify != NULL) (*view->cb.notify)(view, VIEW_NOTIFY_CURSOR_CHANGED); debug_view_end_update(view); } }
/*------------------------------------------------- debug_view_set_cursor_visible - set the visible state of the cursor -------------------------------------------------*/
set the visible state of the cursor
[ "set", "the", "visible", "state", "of", "the", "cursor" ]
void debug_view_set_cursor_visible(debug_view *view, int visible) { if (visible != view->cursor_visible) { debug_view_begin_update(view); view->cursor_visible = visible; view->update_pending = TRUE; if (view->cb.notify != NULL) (*view->cb.notify)(view, VIEW_NOTIFY_CURSOR_CHANGED); debug_view_end_update(view); } }
[ "void", "debug_view_set_cursor_visible", "(", "debug_view", "*", "view", ",", "int", "visible", ")", "{", "if", "(", "visible", "!=", "view", "->", "cursor_visible", ")", "{", "debug_view_begin_update", "(", "view", ")", ";", "view", "->", "cursor_visible", "=", "visible", ";", "view", "->", "update_pending", "=", "TRUE", ";", "if", "(", "view", "->", "cb", ".", "notify", "!=", "NULL", ")", "(", "*", "view", "->", "cb", ".", "notify", ")", "(", "view", ",", "VIEW_NOTIFY_CURSOR_CHANGED", ")", ";", "debug_view_end_update", "(", "view", ")", ";", "}", "}" ]
debug_view_set_cursor_visible - set the visible state of the cursor
[ "debug_view_set_cursor_visible", "-", "set", "the", "visible", "state", "of", "the", "cursor" ]
[]
[ { "param": "view", "type": "debug_view" }, { "param": "visible", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "visible", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
debug_view_expression_free
void
static void debug_view_expression_free(debug_view_expression *expression) { if (expression->parsed != NULL) expression_free(expression->parsed); if (expression->string != NULL) astring_free(expression->string); }
/*------------------------------------------------- debug_view_expression_free - free data allocated for an expression -------------------------------------------------*/
free data allocated for an expression
[ "free", "data", "allocated", "for", "an", "expression" ]
static void debug_view_expression_free(debug_view_expression *expression) { if (expression->parsed != NULL) expression_free(expression->parsed); if (expression->string != NULL) astring_free(expression->string); }
[ "static", "void", "debug_view_expression_free", "(", "debug_view_expression", "*", "expression", ")", "{", "if", "(", "expression", "->", "parsed", "!=", "NULL", ")", "expression_free", "(", "expression", "->", "parsed", ")", ";", "if", "(", "expression", "->", "string", "!=", "NULL", ")", "astring_free", "(", "expression", "->", "string", ")", ";", "}" ]
debug_view_expression_free - free data allocated for an expression
[ "debug_view_expression_free", "-", "free", "data", "allocated", "for", "an", "expression" ]
[]
[ { "param": "expression", "type": "debug_view_expression" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "expression", "type": "debug_view_expression", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
debug_view_expression_changed_value
int
static int debug_view_expression_changed_value(debug_view *view, debug_view_expression *expression, const device_config *cpu) { int changed = expression->dirty; EXPRERR exprerr; /* if dirty, re-evaluate */ if (expression->dirty) { symbol_table *symtable = (cpu != NULL) ? debug_cpu_get_symtable(cpu) : debug_cpu_get_global_symtable(view->machine); parsed_expression *expr; /* parse the new expression */ exprerr = expression_parse(astring_c(expression->string), symtable, &debug_expression_callbacks, view->machine, &expr); /* if it worked, update the expression */ if (exprerr == EXPRERR_NONE) { if (expression->parsed != NULL) expression_free(expression->parsed); expression->parsed = expr; } } /* if we have a parsed expression, evalute it */ if (expression->parsed != NULL) { UINT64 oldresult = expression->result; /* recompute the value of the expression */ exprerr = expression_execute(expression->parsed, &expression->result); changed |= (expression->result != oldresult); } /* expression no longer dirty by definition */ expression->dirty = FALSE; return changed; }
/*------------------------------------------------- debug_view_expression_changed_value - update an expression and return TRUE if its value has changed -------------------------------------------------*/
update an expression and return TRUE if its value has changed
[ "update", "an", "expression", "and", "return", "TRUE", "if", "its", "value", "has", "changed" ]
static int debug_view_expression_changed_value(debug_view *view, debug_view_expression *expression, const device_config *cpu) { int changed = expression->dirty; EXPRERR exprerr; if (expression->dirty) { symbol_table *symtable = (cpu != NULL) ? debug_cpu_get_symtable(cpu) : debug_cpu_get_global_symtable(view->machine); parsed_expression *expr; exprerr = expression_parse(astring_c(expression->string), symtable, &debug_expression_callbacks, view->machine, &expr); if (exprerr == EXPRERR_NONE) { if (expression->parsed != NULL) expression_free(expression->parsed); expression->parsed = expr; } } if (expression->parsed != NULL) { UINT64 oldresult = expression->result; exprerr = expression_execute(expression->parsed, &expression->result); changed |= (expression->result != oldresult); } expression->dirty = FALSE; return changed; }
[ "static", "int", "debug_view_expression_changed_value", "(", "debug_view", "*", "view", ",", "debug_view_expression", "*", "expression", ",", "const", "device_config", "*", "cpu", ")", "{", "int", "changed", "=", "expression", "->", "dirty", ";", "EXPRERR", "exprerr", ";", "if", "(", "expression", "->", "dirty", ")", "{", "symbol_table", "*", "symtable", "=", "(", "cpu", "!=", "NULL", ")", "?", "debug_cpu_get_symtable", "(", "cpu", ")", ":", "debug_cpu_get_global_symtable", "(", "view", "->", "machine", ")", ";", "parsed_expression", "*", "expr", ";", "exprerr", "=", "expression_parse", "(", "astring_c", "(", "expression", "->", "string", ")", ",", "symtable", ",", "&", "debug_expression_callbacks", ",", "view", "->", "machine", ",", "&", "expr", ")", ";", "if", "(", "exprerr", "==", "EXPRERR_NONE", ")", "{", "if", "(", "expression", "->", "parsed", "!=", "NULL", ")", "expression_free", "(", "expression", "->", "parsed", ")", ";", "expression", "->", "parsed", "=", "expr", ";", "}", "}", "if", "(", "expression", "->", "parsed", "!=", "NULL", ")", "{", "UINT64", "oldresult", "=", "expression", "->", "result", ";", "exprerr", "=", "expression_execute", "(", "expression", "->", "parsed", ",", "&", "expression", "->", "result", ")", ";", "changed", "|=", "(", "expression", "->", "result", "!=", "oldresult", ")", ";", "}", "expression", "->", "dirty", "=", "FALSE", ";", "return", "changed", ";", "}" ]
debug_view_expression_changed_value - update an expression and return TRUE if its value has changed
[ "debug_view_expression_changed_value", "-", "update", "an", "expression", "and", "return", "TRUE", "if", "its", "value", "has", "changed" ]
[ "/* if dirty, re-evaluate */", "/* parse the new expression */", "/* if it worked, update the expression */", "/* if we have a parsed expression, evalute it */", "/* recompute the value of the expression */", "/* expression no longer dirty by definition */" ]
[ { "param": "view", "type": "debug_view" }, { "param": "expression", "type": "debug_view_expression" }, { "param": "cpu", "type": "device_config" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "expression", "type": "debug_view_expression", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cpu", "type": "device_config", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
textbuf_view_alloc
int
static int textbuf_view_alloc(debug_view *view, text_buffer *textbuf) { debug_view_textbuf *textdata; /* allocate memory */ textdata = (debug_view_textbuf *)malloc(sizeof(*textdata)); if (textdata == NULL) return FALSE; memset(textdata, 0, sizeof(*textdata)); /* by default we track live */ textdata->textbuf = textbuf; textdata->at_bottom = TRUE; /* stash the extra data pointer */ view->extra_data = textdata; return TRUE; }
/*------------------------------------------------- textbuf_view_alloc - allocate memory for a text buffer-based view -------------------------------------------------*/
allocate memory for a text buffer-based view
[ "allocate", "memory", "for", "a", "text", "buffer", "-", "based", "view" ]
static int textbuf_view_alloc(debug_view *view, text_buffer *textbuf) { debug_view_textbuf *textdata; textdata = (debug_view_textbuf *)malloc(sizeof(*textdata)); if (textdata == NULL) return FALSE; memset(textdata, 0, sizeof(*textdata)); textdata->textbuf = textbuf; textdata->at_bottom = TRUE; view->extra_data = textdata; return TRUE; }
[ "static", "int", "textbuf_view_alloc", "(", "debug_view", "*", "view", ",", "text_buffer", "*", "textbuf", ")", "{", "debug_view_textbuf", "*", "textdata", ";", "textdata", "=", "(", "debug_view_textbuf", "*", ")", "malloc", "(", "sizeof", "(", "*", "textdata", ")", ")", ";", "if", "(", "textdata", "==", "NULL", ")", "return", "FALSE", ";", "memset", "(", "textdata", ",", "0", ",", "sizeof", "(", "*", "textdata", ")", ")", ";", "textdata", "->", "textbuf", "=", "textbuf", ";", "textdata", "->", "at_bottom", "=", "TRUE", ";", "view", "->", "extra_data", "=", "textdata", ";", "return", "TRUE", ";", "}" ]
textbuf_view_alloc - allocate memory for a text buffer-based view
[ "textbuf_view_alloc", "-", "allocate", "memory", "for", "a", "text", "buffer", "-", "based", "view" ]
[ "/* allocate memory */", "/* by default we track live */", "/* stash the extra data pointer */" ]
[ { "param": "view", "type": "debug_view" }, { "param": "textbuf", "type": "text_buffer" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "textbuf", "type": "text_buffer", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
textbuf_view_free
void
static void textbuf_view_free(debug_view *view) { debug_view_textbuf *textdata = (debug_view_textbuf *)view->extra_data; /* free any memory we callocated */ if (textdata != NULL) free(textdata); view->extra_data = NULL; }
/*------------------------------------------------- textbuf_view_free - free memory for a text buffer-based view -------------------------------------------------*/
free memory for a text buffer-based view
[ "free", "memory", "for", "a", "text", "buffer", "-", "based", "view" ]
static void textbuf_view_free(debug_view *view) { debug_view_textbuf *textdata = (debug_view_textbuf *)view->extra_data; if (textdata != NULL) free(textdata); view->extra_data = NULL; }
[ "static", "void", "textbuf_view_free", "(", "debug_view", "*", "view", ")", "{", "debug_view_textbuf", "*", "textdata", "=", "(", "debug_view_textbuf", "*", ")", "view", "->", "extra_data", ";", "if", "(", "textdata", "!=", "NULL", ")", "free", "(", "textdata", ")", ";", "view", "->", "extra_data", "=", "NULL", ";", "}" ]
textbuf_view_free - free memory for a text buffer-based view
[ "textbuf_view_free", "-", "free", "memory", "for", "a", "text", "buffer", "-", "based", "view" ]
[ "/* free any memory we callocated */" ]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
textbuf_view_update
void
static void textbuf_view_update(debug_view *view) { debug_view_textbuf *textdata = (debug_view_textbuf *)view->extra_data; debug_view_char *dest = view->viewdata; UINT32 curseq = 0, row; /* update the console info */ view->total.x = text_buffer_max_width(textdata->textbuf); view->total.y = text_buffer_num_lines(textdata->textbuf); if (view->total.x < 80) view->total.x = 80; /* determine the starting sequence number */ if (!textdata->at_bottom) { curseq = textdata->topseq; if (!text_buffer_get_seqnum_line(textdata->textbuf, curseq)) textdata->at_bottom = TRUE; } if (textdata->at_bottom) { curseq = text_buffer_line_index_to_seqnum(textdata->textbuf, view->total.y - 1); if (view->total.y < view->visible.y) curseq -= view->total.y - 1; else curseq -= view->visible.y - 1; } view->topleft.y = curseq - text_buffer_line_index_to_seqnum(textdata->textbuf, 0); /* loop over visible rows */ for (row = 0; row < view->visible.y; row++) { const char *line = text_buffer_get_seqnum_line(textdata->textbuf, curseq++); UINT32 col = 0; /* if this visible row is valid, add it to the buffer */ if (line != NULL) { size_t len = strlen(line); UINT32 effcol = view->topleft.x; /* copy data */ while (col < view->visible.x && effcol < len) { dest->byte = line[effcol++]; dest->attrib = DCA_NORMAL; dest++; col++; } } /* fill the rest with blanks */ while (col < view->visible.x) { dest->byte = ' '; dest->attrib = DCA_NORMAL; dest++; col++; } } }
/*------------------------------------------------- textbuf_view_update - update a text buffer- based view -------------------------------------------------*/
update a text buffer based view
[ "update", "a", "text", "buffer", "based", "view" ]
static void textbuf_view_update(debug_view *view) { debug_view_textbuf *textdata = (debug_view_textbuf *)view->extra_data; debug_view_char *dest = view->viewdata; UINT32 curseq = 0, row; view->total.x = text_buffer_max_width(textdata->textbuf); view->total.y = text_buffer_num_lines(textdata->textbuf); if (view->total.x < 80) view->total.x = 80; if (!textdata->at_bottom) { curseq = textdata->topseq; if (!text_buffer_get_seqnum_line(textdata->textbuf, curseq)) textdata->at_bottom = TRUE; } if (textdata->at_bottom) { curseq = text_buffer_line_index_to_seqnum(textdata->textbuf, view->total.y - 1); if (view->total.y < view->visible.y) curseq -= view->total.y - 1; else curseq -= view->visible.y - 1; } view->topleft.y = curseq - text_buffer_line_index_to_seqnum(textdata->textbuf, 0); for (row = 0; row < view->visible.y; row++) { const char *line = text_buffer_get_seqnum_line(textdata->textbuf, curseq++); UINT32 col = 0; if (line != NULL) { size_t len = strlen(line); UINT32 effcol = view->topleft.x; while (col < view->visible.x && effcol < len) { dest->byte = line[effcol++]; dest->attrib = DCA_NORMAL; dest++; col++; } } while (col < view->visible.x) { dest->byte = ' '; dest->attrib = DCA_NORMAL; dest++; col++; } } }
[ "static", "void", "textbuf_view_update", "(", "debug_view", "*", "view", ")", "{", "debug_view_textbuf", "*", "textdata", "=", "(", "debug_view_textbuf", "*", ")", "view", "->", "extra_data", ";", "debug_view_char", "*", "dest", "=", "view", "->", "viewdata", ";", "UINT32", "curseq", "=", "0", ",", "row", ";", "view", "->", "total", ".", "x", "=", "text_buffer_max_width", "(", "textdata", "->", "textbuf", ")", ";", "view", "->", "total", ".", "y", "=", "text_buffer_num_lines", "(", "textdata", "->", "textbuf", ")", ";", "if", "(", "view", "->", "total", ".", "x", "<", "80", ")", "view", "->", "total", ".", "x", "=", "80", ";", "if", "(", "!", "textdata", "->", "at_bottom", ")", "{", "curseq", "=", "textdata", "->", "topseq", ";", "if", "(", "!", "text_buffer_get_seqnum_line", "(", "textdata", "->", "textbuf", ",", "curseq", ")", ")", "textdata", "->", "at_bottom", "=", "TRUE", ";", "}", "if", "(", "textdata", "->", "at_bottom", ")", "{", "curseq", "=", "text_buffer_line_index_to_seqnum", "(", "textdata", "->", "textbuf", ",", "view", "->", "total", ".", "y", "-", "1", ")", ";", "if", "(", "view", "->", "total", ".", "y", "<", "view", "->", "visible", ".", "y", ")", "curseq", "-=", "view", "->", "total", ".", "y", "-", "1", ";", "else", "curseq", "-=", "view", "->", "visible", ".", "y", "-", "1", ";", "}", "view", "->", "topleft", ".", "y", "=", "curseq", "-", "text_buffer_line_index_to_seqnum", "(", "textdata", "->", "textbuf", ",", "0", ")", ";", "for", "(", "row", "=", "0", ";", "row", "<", "view", "->", "visible", ".", "y", ";", "row", "++", ")", "{", "const", "char", "*", "line", "=", "text_buffer_get_seqnum_line", "(", "textdata", "->", "textbuf", ",", "curseq", "++", ")", ";", "UINT32", "col", "=", "0", ";", "if", "(", "line", "!=", "NULL", ")", "{", "size_t", "len", "=", "strlen", "(", "line", ")", ";", "UINT32", "effcol", "=", "view", "->", "topleft", ".", "x", ";", "while", "(", "col", "<", "view", "->", "visible", ".", "x", "&&", "effcol", "<", "len", ")", "{", "dest", "->", "byte", "=", "line", "[", "effcol", "++", "]", ";", "dest", "->", "attrib", "=", "DCA_NORMAL", ";", "dest", "++", ";", "col", "++", ";", "}", "}", "while", "(", "col", "<", "view", "->", "visible", ".", "x", ")", "{", "dest", "->", "byte", "=", "'", "'", ";", "dest", "->", "attrib", "=", "DCA_NORMAL", ";", "dest", "++", ";", "col", "++", ";", "}", "}", "}" ]
textbuf_view_update - update a text buffer based view
[ "textbuf_view_update", "-", "update", "a", "text", "buffer", "based", "view" ]
[ "/* update the console info */", "/* determine the starting sequence number */", "/* loop over visible rows */", "/* if this visible row is valid, add it to the buffer */", "/* copy data */", "/* fill the rest with blanks */" ]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
textbuf_view_notify
void
static void textbuf_view_notify(debug_view *view, view_notification type) { debug_view_textbuf *textdata = (debug_view_textbuf *)view->extra_data; if (type == VIEW_NOTIFY_VISIBLE_CHANGED) { /* if the bottom line is visible, just track the bottom */ textdata->at_bottom = (view->total.y >= view->topleft.y && view->total.y <= view->topleft.y + view->visible.y); /* otherwise, track the seqence number of the top line */ if (!textdata->at_bottom) textdata->topseq = text_buffer_line_index_to_seqnum(textdata->textbuf, view->topleft.y); } }
/*------------------------------------------------- textbuf_view_notify - handle notification of updates to visible area -------------------------------------------------*/
handle notification of updates to visible area
[ "handle", "notification", "of", "updates", "to", "visible", "area" ]
static void textbuf_view_notify(debug_view *view, view_notification type) { debug_view_textbuf *textdata = (debug_view_textbuf *)view->extra_data; if (type == VIEW_NOTIFY_VISIBLE_CHANGED) { textdata->at_bottom = (view->total.y >= view->topleft.y && view->total.y <= view->topleft.y + view->visible.y); if (!textdata->at_bottom) textdata->topseq = text_buffer_line_index_to_seqnum(textdata->textbuf, view->topleft.y); } }
[ "static", "void", "textbuf_view_notify", "(", "debug_view", "*", "view", ",", "view_notification", "type", ")", "{", "debug_view_textbuf", "*", "textdata", "=", "(", "debug_view_textbuf", "*", ")", "view", "->", "extra_data", ";", "if", "(", "type", "==", "VIEW_NOTIFY_VISIBLE_CHANGED", ")", "{", "textdata", "->", "at_bottom", "=", "(", "view", "->", "total", ".", "y", ">=", "view", "->", "topleft", ".", "y", "&&", "view", "->", "total", ".", "y", "<=", "view", "->", "topleft", ".", "y", "+", "view", "->", "visible", ".", "y", ")", ";", "if", "(", "!", "textdata", "->", "at_bottom", ")", "textdata", "->", "topseq", "=", "text_buffer_line_index_to_seqnum", "(", "textdata", "->", "textbuf", ",", "view", "->", "topleft", ".", "y", ")", ";", "}", "}" ]
textbuf_view_notify - handle notification of updates to visible area
[ "textbuf_view_notify", "-", "handle", "notification", "of", "updates", "to", "visible", "area" ]
[ "/* if the bottom line is visible, just track the bottom */", "/* otherwise, track the seqence number of the top line */" ]
[ { "param": "view", "type": "debug_view" }, { "param": "type", "type": "view_notification" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "type", "type": "view_notification", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
registers_view_enumerate_subviews
registers_subview_item
static const registers_subview_item *registers_view_enumerate_subviews(running_machine *machine) { astring *tempstring = astring_alloc(); registers_subview_item *head = NULL; registers_subview_item **tailptr = &head; const device_config *cpu; int curindex = 0; /* iterate over CPUs with program address spaces */ for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu)) { registers_subview_item *subview; /* determine the string and allocate a subview large enough */ astring_printf(tempstring, "CPU '%s' (%s)", cpu->tag, cpu_get_name(cpu)); subview = (registers_subview_item *)auto_alloc_array_clear(machine, UINT8, sizeof(*subview) + astring_len(tempstring)); /* populate the subview */ subview->next = NULL; subview->index = curindex++; subview->device = cpu; strcpy(subview->name, astring_c(tempstring)); /* add to the list */ *tailptr = subview; tailptr = &subview->next; } /* free the temporary string */ astring_free(tempstring); return head; }
/*------------------------------------------------- registers_view_enumerate_subviews - enumerate all possible subviews for a registers view -------------------------------------------------*/
enumerate all possible subviews for a registers view
[ "enumerate", "all", "possible", "subviews", "for", "a", "registers", "view" ]
static const registers_subview_item *registers_view_enumerate_subviews(running_machine *machine) { astring *tempstring = astring_alloc(); registers_subview_item *head = NULL; registers_subview_item **tailptr = &head; const device_config *cpu; int curindex = 0; for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu)) { registers_subview_item *subview; astring_printf(tempstring, "CPU '%s' (%s)", cpu->tag, cpu_get_name(cpu)); subview = (registers_subview_item *)auto_alloc_array_clear(machine, UINT8, sizeof(*subview) + astring_len(tempstring)); subview->next = NULL; subview->index = curindex++; subview->device = cpu; strcpy(subview->name, astring_c(tempstring)); *tailptr = subview; tailptr = &subview->next; } astring_free(tempstring); return head; }
[ "static", "const", "registers_subview_item", "*", "registers_view_enumerate_subviews", "(", "running_machine", "*", "machine", ")", "{", "astring", "*", "tempstring", "=", "astring_alloc", "(", ")", ";", "registers_subview_item", "*", "head", "=", "NULL", ";", "registers_subview_item", "*", "*", "tailptr", "=", "&", "head", ";", "const", "device_config", "*", "cpu", ";", "int", "curindex", "=", "0", ";", "for", "(", "cpu", "=", "machine", "->", "firstcpu", ";", "cpu", "!=", "NULL", ";", "cpu", "=", "cpu_next", "(", "cpu", ")", ")", "{", "registers_subview_item", "*", "subview", ";", "astring_printf", "(", "tempstring", ",", "\"", "\"", ",", "cpu", "->", "tag", ",", "cpu_get_name", "(", "cpu", ")", ")", ";", "subview", "=", "(", "registers_subview_item", "*", ")", "auto_alloc_array_clear", "(", "machine", ",", "UINT8", ",", "sizeof", "(", "*", "subview", ")", "+", "astring_len", "(", "tempstring", ")", ")", ";", "subview", "->", "next", "=", "NULL", ";", "subview", "->", "index", "=", "curindex", "++", ";", "subview", "->", "device", "=", "cpu", ";", "strcpy", "(", "subview", "->", "name", ",", "astring_c", "(", "tempstring", ")", ")", ";", "*", "tailptr", "=", "subview", ";", "tailptr", "=", "&", "subview", "->", "next", ";", "}", "astring_free", "(", "tempstring", ")", ";", "return", "head", ";", "}" ]
registers_view_enumerate_subviews - enumerate all possible subviews for a registers view
[ "registers_view_enumerate_subviews", "-", "enumerate", "all", "possible", "subviews", "for", "a", "registers", "view" ]
[ "/* iterate over CPUs with program address spaces */", "/* determine the string and allocate a subview large enough */", "/* populate the subview */", "/* add to the list */", "/* free the temporary string */" ]
[ { "param": "machine", "type": "running_machine" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
registers_view_alloc
int
static int registers_view_alloc(debug_view *view) { debug_view_registers *regdata; /* fail if no available subviews */ if (view->machine->debugvw_data->registers_subviews == NULL) return FALSE; /* allocate memory */ regdata = (debug_view_registers *)malloc(sizeof(*regdata)); if (regdata == NULL) return FALSE; memset(regdata, 0, sizeof(*regdata)); /* default to the first subview */ regdata->device = view->machine->debugvw_data->registers_subviews->device; /* stash the extra data pointer */ view->extra_data = regdata; return TRUE; }
/*------------------------------------------------- registers_view_alloc - allocate memory for the registers view -------------------------------------------------*/
allocate memory for the registers view
[ "allocate", "memory", "for", "the", "registers", "view" ]
static int registers_view_alloc(debug_view *view) { debug_view_registers *regdata; if (view->machine->debugvw_data->registers_subviews == NULL) return FALSE; regdata = (debug_view_registers *)malloc(sizeof(*regdata)); if (regdata == NULL) return FALSE; memset(regdata, 0, sizeof(*regdata)); regdata->device = view->machine->debugvw_data->registers_subviews->device; view->extra_data = regdata; return TRUE; }
[ "static", "int", "registers_view_alloc", "(", "debug_view", "*", "view", ")", "{", "debug_view_registers", "*", "regdata", ";", "if", "(", "view", "->", "machine", "->", "debugvw_data", "->", "registers_subviews", "==", "NULL", ")", "return", "FALSE", ";", "regdata", "=", "(", "debug_view_registers", "*", ")", "malloc", "(", "sizeof", "(", "*", "regdata", ")", ")", ";", "if", "(", "regdata", "==", "NULL", ")", "return", "FALSE", ";", "memset", "(", "regdata", ",", "0", ",", "sizeof", "(", "*", "regdata", ")", ")", ";", "regdata", "->", "device", "=", "view", "->", "machine", "->", "debugvw_data", "->", "registers_subviews", "->", "device", ";", "view", "->", "extra_data", "=", "regdata", ";", "return", "TRUE", ";", "}" ]
registers_view_alloc - allocate memory for the registers view
[ "registers_view_alloc", "-", "allocate", "memory", "for", "the", "registers", "view" ]
[ "/* fail if no available subviews */", "/* allocate memory */", "/* default to the first subview */", "/* stash the extra data pointer */" ]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
registers_view_free
void
static void registers_view_free(debug_view *view) { debug_view_registers *regdata = (debug_view_registers *)view->extra_data; /* free any memory we callocated */ if (regdata != NULL) free(regdata); view->extra_data = NULL; }
/*------------------------------------------------- registers_view_free - free memory for the registers view -------------------------------------------------*/
free memory for the registers view
[ "free", "memory", "for", "the", "registers", "view" ]
static void registers_view_free(debug_view *view) { debug_view_registers *regdata = (debug_view_registers *)view->extra_data; if (regdata != NULL) free(regdata); view->extra_data = NULL; }
[ "static", "void", "registers_view_free", "(", "debug_view", "*", "view", ")", "{", "debug_view_registers", "*", "regdata", "=", "(", "debug_view_registers", "*", ")", "view", "->", "extra_data", ";", "if", "(", "regdata", "!=", "NULL", ")", "free", "(", "regdata", ")", ";", "view", "->", "extra_data", "=", "NULL", ";", "}" ]
registers_view_free - free memory for the registers view
[ "registers_view_free", "-", "free", "memory", "for", "the", "registers", "view" ]
[ "/* free any memory we callocated */" ]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
registers_view_add_register
void
static void registers_view_add_register(debug_view *view, int regnum, const char *str) { debug_view_registers *regdata = (debug_view_registers *)view->extra_data; int tagstart, taglen, valstart, vallen; const char *colon; colon = strchr(str, ':'); /* if no colon, mark everything as tag */ if (colon == NULL) { tagstart = 0; taglen = (int)strlen(str); valstart = 0; vallen = 0; } /* otherwise, break the string at the colon */ else { tagstart = 0; taglen = colon - str; valstart = (colon + 1) - str; vallen = (int)strlen(colon + 1); } /* now trim spaces */ while (isspace((UINT8)str[tagstart]) && taglen > 0) tagstart++, taglen--; while (isspace((UINT8)str[tagstart + taglen - 1]) && taglen > 0) taglen--; while (isspace((UINT8)str[valstart]) && vallen > 0) valstart++, vallen--; while (isspace((UINT8)str[valstart + vallen - 1]) && vallen > 0) vallen--; if (str[valstart] == '!') valstart++, vallen--; /* note the register number and info */ regdata->reg[view->total.y].lastval = regdata->reg[view->total.y].currval = cpu_get_reg(regdata->device, regnum); regdata->reg[view->total.y].regnum = regnum; regdata->reg[view->total.y].tagstart = tagstart; regdata->reg[view->total.y].taglen = taglen; regdata->reg[view->total.y].valstart = valstart; regdata->reg[view->total.y].vallen = vallen; view->total.y++; /* adjust the divider and total cols, if necessary */ regdata->divider = MAX(regdata->divider, 1 + taglen + 1); view->total.x = MAX(view->total.x, 1 + taglen + 2 + vallen + 1); }
/*------------------------------------------------- registers_view_add_register - adds a register to the registers view -------------------------------------------------*/
adds a register to the registers view
[ "adds", "a", "register", "to", "the", "registers", "view" ]
static void registers_view_add_register(debug_view *view, int regnum, const char *str) { debug_view_registers *regdata = (debug_view_registers *)view->extra_data; int tagstart, taglen, valstart, vallen; const char *colon; colon = strchr(str, ':'); if (colon == NULL) { tagstart = 0; taglen = (int)strlen(str); valstart = 0; vallen = 0; } else { tagstart = 0; taglen = colon - str; valstart = (colon + 1) - str; vallen = (int)strlen(colon + 1); } while (isspace((UINT8)str[tagstart]) && taglen > 0) tagstart++, taglen--; while (isspace((UINT8)str[tagstart + taglen - 1]) && taglen > 0) taglen--; while (isspace((UINT8)str[valstart]) && vallen > 0) valstart++, vallen--; while (isspace((UINT8)str[valstart + vallen - 1]) && vallen > 0) vallen--; if (str[valstart] == '!') valstart++, vallen--; regdata->reg[view->total.y].lastval = regdata->reg[view->total.y].currval = cpu_get_reg(regdata->device, regnum); regdata->reg[view->total.y].regnum = regnum; regdata->reg[view->total.y].tagstart = tagstart; regdata->reg[view->total.y].taglen = taglen; regdata->reg[view->total.y].valstart = valstart; regdata->reg[view->total.y].vallen = vallen; view->total.y++; regdata->divider = MAX(regdata->divider, 1 + taglen + 1); view->total.x = MAX(view->total.x, 1 + taglen + 2 + vallen + 1); }
[ "static", "void", "registers_view_add_register", "(", "debug_view", "*", "view", ",", "int", "regnum", ",", "const", "char", "*", "str", ")", "{", "debug_view_registers", "*", "regdata", "=", "(", "debug_view_registers", "*", ")", "view", "->", "extra_data", ";", "int", "tagstart", ",", "taglen", ",", "valstart", ",", "vallen", ";", "const", "char", "*", "colon", ";", "colon", "=", "strchr", "(", "str", ",", "'", "'", ")", ";", "if", "(", "colon", "==", "NULL", ")", "{", "tagstart", "=", "0", ";", "taglen", "=", "(", "int", ")", "strlen", "(", "str", ")", ";", "valstart", "=", "0", ";", "vallen", "=", "0", ";", "}", "else", "{", "tagstart", "=", "0", ";", "taglen", "=", "colon", "-", "str", ";", "valstart", "=", "(", "colon", "+", "1", ")", "-", "str", ";", "vallen", "=", "(", "int", ")", "strlen", "(", "colon", "+", "1", ")", ";", "}", "while", "(", "isspace", "(", "(", "UINT8", ")", "str", "[", "tagstart", "]", ")", "&&", "taglen", ">", "0", ")", "tagstart", "++", ",", "taglen", "--", ";", "while", "(", "isspace", "(", "(", "UINT8", ")", "str", "[", "tagstart", "+", "taglen", "-", "1", "]", ")", "&&", "taglen", ">", "0", ")", "taglen", "--", ";", "while", "(", "isspace", "(", "(", "UINT8", ")", "str", "[", "valstart", "]", ")", "&&", "vallen", ">", "0", ")", "valstart", "++", ",", "vallen", "--", ";", "while", "(", "isspace", "(", "(", "UINT8", ")", "str", "[", "valstart", "+", "vallen", "-", "1", "]", ")", "&&", "vallen", ">", "0", ")", "vallen", "--", ";", "if", "(", "str", "[", "valstart", "]", "==", "'", "'", ")", "valstart", "++", ",", "vallen", "--", ";", "regdata", "->", "reg", "[", "view", "->", "total", ".", "y", "]", ".", "lastval", "=", "regdata", "->", "reg", "[", "view", "->", "total", ".", "y", "]", ".", "currval", "=", "cpu_get_reg", "(", "regdata", "->", "device", ",", "regnum", ")", ";", "regdata", "->", "reg", "[", "view", "->", "total", ".", "y", "]", ".", "regnum", "=", "regnum", ";", "regdata", "->", "reg", "[", "view", "->", "total", ".", "y", "]", ".", "tagstart", "=", "tagstart", ";", "regdata", "->", "reg", "[", "view", "->", "total", ".", "y", "]", ".", "taglen", "=", "taglen", ";", "regdata", "->", "reg", "[", "view", "->", "total", ".", "y", "]", ".", "valstart", "=", "valstart", ";", "regdata", "->", "reg", "[", "view", "->", "total", ".", "y", "]", ".", "vallen", "=", "vallen", ";", "view", "->", "total", ".", "y", "++", ";", "regdata", "->", "divider", "=", "MAX", "(", "regdata", "->", "divider", ",", "1", "+", "taglen", "+", "1", ")", ";", "view", "->", "total", ".", "x", "=", "MAX", "(", "view", "->", "total", ".", "x", ",", "1", "+", "taglen", "+", "2", "+", "vallen", "+", "1", ")", ";", "}" ]
registers_view_add_register - adds a register to the registers view
[ "registers_view_add_register", "-", "adds", "a", "register", "to", "the", "registers", "view" ]
[ "/* if no colon, mark everything as tag */", "/* otherwise, break the string at the colon */", "/* now trim spaces */", "/* note the register number and info */", "/* adjust the divider and total cols, if necessary */" ]
[ { "param": "view", "type": "debug_view" }, { "param": "regnum", "type": "int" }, { "param": "str", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "regnum", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "str", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
registers_view_update
void
static void registers_view_update(debug_view *view) { const device_config *screen = view->machine->primary_screen; debug_view_registers *regdata = (debug_view_registers *)view->extra_data; debug_view_char *dest = view->viewdata; UINT64 total_cycles; UINT32 row, i; /* if our assumptions changed, revisit them */ if (view->recompute || regdata->device == NULL) registers_view_recompute(view); /* cannot update if no active CPU */ total_cycles = cpu_get_total_cycles(regdata->device); /* loop over visible rows */ for (row = 0; row < view->visible.y; row++) { UINT32 effrow = view->topleft.y + row; UINT32 col = 0; /* if this visible row is valid, add it to the buffer */ if (effrow < view->total.y) { debug_view_register *reg = &regdata->reg[effrow]; UINT32 effcol = view->topleft.x; char temp[256], dummy[100]; UINT8 attrib = DCA_NORMAL; UINT32 len = 0; char *data = dummy; /* get the effective string */ dummy[0] = 0; if (reg->regnum >= MAX_REGS) { reg->lastval = reg->currval; switch (reg->regnum) { case MAX_REGS: reg->tagstart = reg->valstart = reg->vallen = 0; reg->taglen = view->total.x; for (i = 0; i < view->total.x; i++) dummy[i] = '-'; dummy[i] = 0; break; case MAX_REGS + 1: sprintf(dummy, "cycles:%-8d", *cpu_get_icount_ptr(regdata->device)); reg->currval = *cpu_get_icount_ptr(regdata->device); break; case MAX_REGS + 2: if (screen != NULL) sprintf(dummy, "beamx:%3d", video_screen_get_hpos(screen)); break; case MAX_REGS + 3: if (screen != NULL) sprintf(dummy, "beamy:%3d", video_screen_get_vpos(screen)); break; case MAX_REGS + 4: if (screen != NULL) sprintf(dummy, "frame:%-6d", (UINT32)video_screen_get_frame_number(screen)); break; case MAX_REGS + 5: sprintf(dummy, "flags:%s", cpu_get_flags_string(regdata->device)); break; } } else { data = (char *)cpu_get_reg_string(regdata->device, reg->regnum); if (regdata->last_update != total_cycles) reg->lastval = reg->currval; reg->currval = cpu_get_reg(regdata->device, reg->regnum); } /* see if we changed */ if (reg->lastval != reg->currval) attrib = DCA_CHANGED; /* build up a string */ if (reg->taglen < regdata->divider - 1) { memset(&temp[len], ' ', regdata->divider - 1 - reg->taglen); len += regdata->divider - 1 - reg->taglen; } memcpy(&temp[len], &data[reg->tagstart], reg->taglen); len += reg->taglen; temp[len++] = ' '; temp[len++] = ' '; memcpy(&temp[len], &data[reg->valstart], reg->vallen); len += reg->vallen; temp[len++] = ' '; temp[len] = 0; /* copy data */ while (col < view->visible.x && effcol < len) { dest->byte = temp[effcol++]; dest->attrib = attrib | ((effcol <= regdata->divider) ? DCA_ANCILLARY : DCA_NORMAL); dest++; col++; } } /* fill the rest with blanks */ while (col < view->visible.x) { dest->byte = ' '; dest->attrib = DCA_NORMAL; dest++; col++; } } /* remember the last update */ regdata->last_update = total_cycles; }
/*------------------------------------------------- registers_view_update - update the contents of the register view -------------------------------------------------*/
update the contents of the register view
[ "update", "the", "contents", "of", "the", "register", "view" ]
static void registers_view_update(debug_view *view) { const device_config *screen = view->machine->primary_screen; debug_view_registers *regdata = (debug_view_registers *)view->extra_data; debug_view_char *dest = view->viewdata; UINT64 total_cycles; UINT32 row, i; if (view->recompute || regdata->device == NULL) registers_view_recompute(view); total_cycles = cpu_get_total_cycles(regdata->device); for (row = 0; row < view->visible.y; row++) { UINT32 effrow = view->topleft.y + row; UINT32 col = 0; if (effrow < view->total.y) { debug_view_register *reg = &regdata->reg[effrow]; UINT32 effcol = view->topleft.x; char temp[256], dummy[100]; UINT8 attrib = DCA_NORMAL; UINT32 len = 0; char *data = dummy; dummy[0] = 0; if (reg->regnum >= MAX_REGS) { reg->lastval = reg->currval; switch (reg->regnum) { case MAX_REGS: reg->tagstart = reg->valstart = reg->vallen = 0; reg->taglen = view->total.x; for (i = 0; i < view->total.x; i++) dummy[i] = '-'; dummy[i] = 0; break; case MAX_REGS + 1: sprintf(dummy, "cycles:%-8d", *cpu_get_icount_ptr(regdata->device)); reg->currval = *cpu_get_icount_ptr(regdata->device); break; case MAX_REGS + 2: if (screen != NULL) sprintf(dummy, "beamx:%3d", video_screen_get_hpos(screen)); break; case MAX_REGS + 3: if (screen != NULL) sprintf(dummy, "beamy:%3d", video_screen_get_vpos(screen)); break; case MAX_REGS + 4: if (screen != NULL) sprintf(dummy, "frame:%-6d", (UINT32)video_screen_get_frame_number(screen)); break; case MAX_REGS + 5: sprintf(dummy, "flags:%s", cpu_get_flags_string(regdata->device)); break; } } else { data = (char *)cpu_get_reg_string(regdata->device, reg->regnum); if (regdata->last_update != total_cycles) reg->lastval = reg->currval; reg->currval = cpu_get_reg(regdata->device, reg->regnum); } if (reg->lastval != reg->currval) attrib = DCA_CHANGED; if (reg->taglen < regdata->divider - 1) { memset(&temp[len], ' ', regdata->divider - 1 - reg->taglen); len += regdata->divider - 1 - reg->taglen; } memcpy(&temp[len], &data[reg->tagstart], reg->taglen); len += reg->taglen; temp[len++] = ' '; temp[len++] = ' '; memcpy(&temp[len], &data[reg->valstart], reg->vallen); len += reg->vallen; temp[len++] = ' '; temp[len] = 0; while (col < view->visible.x && effcol < len) { dest->byte = temp[effcol++]; dest->attrib = attrib | ((effcol <= regdata->divider) ? DCA_ANCILLARY : DCA_NORMAL); dest++; col++; } } while (col < view->visible.x) { dest->byte = ' '; dest->attrib = DCA_NORMAL; dest++; col++; } } regdata->last_update = total_cycles; }
[ "static", "void", "registers_view_update", "(", "debug_view", "*", "view", ")", "{", "const", "device_config", "*", "screen", "=", "view", "->", "machine", "->", "primary_screen", ";", "debug_view_registers", "*", "regdata", "=", "(", "debug_view_registers", "*", ")", "view", "->", "extra_data", ";", "debug_view_char", "*", "dest", "=", "view", "->", "viewdata", ";", "UINT64", "total_cycles", ";", "UINT32", "row", ",", "i", ";", "if", "(", "view", "->", "recompute", "||", "regdata", "->", "device", "==", "NULL", ")", "registers_view_recompute", "(", "view", ")", ";", "total_cycles", "=", "cpu_get_total_cycles", "(", "regdata", "->", "device", ")", ";", "for", "(", "row", "=", "0", ";", "row", "<", "view", "->", "visible", ".", "y", ";", "row", "++", ")", "{", "UINT32", "effrow", "=", "view", "->", "topleft", ".", "y", "+", "row", ";", "UINT32", "col", "=", "0", ";", "if", "(", "effrow", "<", "view", "->", "total", ".", "y", ")", "{", "debug_view_register", "*", "reg", "=", "&", "regdata", "->", "reg", "[", "effrow", "]", ";", "UINT32", "effcol", "=", "view", "->", "topleft", ".", "x", ";", "char", "temp", "[", "256", "]", ",", "dummy", "[", "100", "]", ";", "UINT8", "attrib", "=", "DCA_NORMAL", ";", "UINT32", "len", "=", "0", ";", "char", "*", "data", "=", "dummy", ";", "dummy", "[", "0", "]", "=", "0", ";", "if", "(", "reg", "->", "regnum", ">=", "MAX_REGS", ")", "{", "reg", "->", "lastval", "=", "reg", "->", "currval", ";", "switch", "(", "reg", "->", "regnum", ")", "{", "case", "MAX_REGS", ":", "reg", "->", "tagstart", "=", "reg", "->", "valstart", "=", "reg", "->", "vallen", "=", "0", ";", "reg", "->", "taglen", "=", "view", "->", "total", ".", "x", ";", "for", "(", "i", "=", "0", ";", "i", "<", "view", "->", "total", ".", "x", ";", "i", "++", ")", "dummy", "[", "i", "]", "=", "'", "'", ";", "dummy", "[", "i", "]", "=", "0", ";", "break", ";", "case", "MAX_REGS", "+", "1", ":", "sprintf", "(", "dummy", ",", "\"", "\"", ",", "*", "cpu_get_icount_ptr", "(", "regdata", "->", "device", ")", ")", ";", "reg", "->", "currval", "=", "*", "cpu_get_icount_ptr", "(", "regdata", "->", "device", ")", ";", "break", ";", "case", "MAX_REGS", "+", "2", ":", "if", "(", "screen", "!=", "NULL", ")", "sprintf", "(", "dummy", ",", "\"", "\"", ",", "video_screen_get_hpos", "(", "screen", ")", ")", ";", "break", ";", "case", "MAX_REGS", "+", "3", ":", "if", "(", "screen", "!=", "NULL", ")", "sprintf", "(", "dummy", ",", "\"", "\"", ",", "video_screen_get_vpos", "(", "screen", ")", ")", ";", "break", ";", "case", "MAX_REGS", "+", "4", ":", "if", "(", "screen", "!=", "NULL", ")", "sprintf", "(", "dummy", ",", "\"", "\"", ",", "(", "UINT32", ")", "video_screen_get_frame_number", "(", "screen", ")", ")", ";", "break", ";", "case", "MAX_REGS", "+", "5", ":", "sprintf", "(", "dummy", ",", "\"", "\"", ",", "cpu_get_flags_string", "(", "regdata", "->", "device", ")", ")", ";", "break", ";", "}", "}", "else", "{", "data", "=", "(", "char", "*", ")", "cpu_get_reg_string", "(", "regdata", "->", "device", ",", "reg", "->", "regnum", ")", ";", "if", "(", "regdata", "->", "last_update", "!=", "total_cycles", ")", "reg", "->", "lastval", "=", "reg", "->", "currval", ";", "reg", "->", "currval", "=", "cpu_get_reg", "(", "regdata", "->", "device", ",", "reg", "->", "regnum", ")", ";", "}", "if", "(", "reg", "->", "lastval", "!=", "reg", "->", "currval", ")", "attrib", "=", "DCA_CHANGED", ";", "if", "(", "reg", "->", "taglen", "<", "regdata", "->", "divider", "-", "1", ")", "{", "memset", "(", "&", "temp", "[", "len", "]", ",", "'", "'", ",", "regdata", "->", "divider", "-", "1", "-", "reg", "->", "taglen", ")", ";", "len", "+=", "regdata", "->", "divider", "-", "1", "-", "reg", "->", "taglen", ";", "}", "memcpy", "(", "&", "temp", "[", "len", "]", ",", "&", "data", "[", "reg", "->", "tagstart", "]", ",", "reg", "->", "taglen", ")", ";", "len", "+=", "reg", "->", "taglen", ";", "temp", "[", "len", "++", "]", "=", "'", "'", ";", "temp", "[", "len", "++", "]", "=", "'", "'", ";", "memcpy", "(", "&", "temp", "[", "len", "]", ",", "&", "data", "[", "reg", "->", "valstart", "]", ",", "reg", "->", "vallen", ")", ";", "len", "+=", "reg", "->", "vallen", ";", "temp", "[", "len", "++", "]", "=", "'", "'", ";", "temp", "[", "len", "]", "=", "0", ";", "while", "(", "col", "<", "view", "->", "visible", ".", "x", "&&", "effcol", "<", "len", ")", "{", "dest", "->", "byte", "=", "temp", "[", "effcol", "++", "]", ";", "dest", "->", "attrib", "=", "attrib", "|", "(", "(", "effcol", "<=", "regdata", "->", "divider", ")", "?", "DCA_ANCILLARY", ":", "DCA_NORMAL", ")", ";", "dest", "++", ";", "col", "++", ";", "}", "}", "while", "(", "col", "<", "view", "->", "visible", ".", "x", ")", "{", "dest", "->", "byte", "=", "'", "'", ";", "dest", "->", "attrib", "=", "DCA_NORMAL", ";", "dest", "++", ";", "col", "++", ";", "}", "}", "regdata", "->", "last_update", "=", "total_cycles", ";", "}" ]
registers_view_update - update the contents of the register view
[ "registers_view_update", "-", "update", "the", "contents", "of", "the", "register", "view" ]
[ "/* if our assumptions changed, revisit them */", "/* cannot update if no active CPU */", "/* loop over visible rows */", "/* if this visible row is valid, add it to the buffer */", "/* get the effective string */", "/* see if we changed */", "/* build up a string */", "/* copy data */", "/* fill the rest with blanks */", "/* remember the last update */" ]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
registers_view_get_subview_list
registers_subview_item
const registers_subview_item *registers_view_get_subview_list(debug_view *view) { assert(view->type == DVT_REGISTERS); return view->machine->debugvw_data->registers_subviews; }
/*------------------------------------------------- registers_view_get_subview_list - return a linked list of subviews -------------------------------------------------*/
return a linked list of subviews
[ "return", "a", "linked", "list", "of", "subviews" ]
const registers_subview_item *registers_view_get_subview_list(debug_view *view) { assert(view->type == DVT_REGISTERS); return view->machine->debugvw_data->registers_subviews; }
[ "const", "registers_subview_item", "*", "registers_view_get_subview_list", "(", "debug_view", "*", "view", ")", "{", "assert", "(", "view", "->", "type", "==", "DVT_REGISTERS", ")", ";", "return", "view", "->", "machine", "->", "debugvw_data", "->", "registers_subviews", ";", "}" ]
registers_view_get_subview_list - return a linked list of subviews
[ "registers_view_get_subview_list", "-", "return", "a", "linked", "list", "of", "subviews" ]
[]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
registers_view_set_subview
void
void registers_view_set_subview(debug_view *view, int index) { const registers_subview_item *subview = registers_view_get_subview_by_index(view->machine->debugvw_data->registers_subviews, index); debug_view_registers *regdata = (debug_view_registers *)view->extra_data; assert(view->type == DVT_REGISTERS); assert(subview != NULL); if (subview == NULL) return; /* handle a change */ if (subview->device != regdata->device) { debug_view_begin_update(view); regdata->device = subview->device; view->recompute = view->update_pending = TRUE; debug_view_end_update(view); } }
/*------------------------------------------------- registers_view_set_subview - select a new subview by index -------------------------------------------------*/
select a new subview by index
[ "select", "a", "new", "subview", "by", "index" ]
void registers_view_set_subview(debug_view *view, int index) { const registers_subview_item *subview = registers_view_get_subview_by_index(view->machine->debugvw_data->registers_subviews, index); debug_view_registers *regdata = (debug_view_registers *)view->extra_data; assert(view->type == DVT_REGISTERS); assert(subview != NULL); if (subview == NULL) return; if (subview->device != regdata->device) { debug_view_begin_update(view); regdata->device = subview->device; view->recompute = view->update_pending = TRUE; debug_view_end_update(view); } }
[ "void", "registers_view_set_subview", "(", "debug_view", "*", "view", ",", "int", "index", ")", "{", "const", "registers_subview_item", "*", "subview", "=", "registers_view_get_subview_by_index", "(", "view", "->", "machine", "->", "debugvw_data", "->", "registers_subviews", ",", "index", ")", ";", "debug_view_registers", "*", "regdata", "=", "(", "debug_view_registers", "*", ")", "view", "->", "extra_data", ";", "assert", "(", "view", "->", "type", "==", "DVT_REGISTERS", ")", ";", "assert", "(", "subview", "!=", "NULL", ")", ";", "if", "(", "subview", "==", "NULL", ")", "return", ";", "if", "(", "subview", "->", "device", "!=", "regdata", "->", "device", ")", "{", "debug_view_begin_update", "(", "view", ")", ";", "regdata", "->", "device", "=", "subview", "->", "device", ";", "view", "->", "recompute", "=", "view", "->", "update_pending", "=", "TRUE", ";", "debug_view_end_update", "(", "view", ")", ";", "}", "}" ]
registers_view_set_subview - select a new subview by index
[ "registers_view_set_subview", "-", "select", "a", "new", "subview", "by", "index" ]
[ "/* handle a change */" ]
[ { "param": "view", "type": "debug_view" }, { "param": "index", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "index", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
disasm_view_enumerate_subviews
disasm_subview_item
static const disasm_subview_item *disasm_view_enumerate_subviews(running_machine *machine) { astring *tempstring = astring_alloc(); disasm_subview_item *head = NULL; disasm_subview_item **tailptr = &head; const device_config *cpu; int curindex = 0; /* iterate over CPUs with program address spaces */ for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu)) { const address_space *space = cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM); if (space != NULL) { disasm_subview_item *subview; /* determine the string and allocate a subview large enough */ astring_printf(tempstring, "CPU '%s' (%s)", cpu->tag, cpu_get_name(cpu)); subview = (disasm_subview_item *)auto_alloc_array_clear(machine, UINT8, sizeof(*subview) + astring_len(tempstring)); /* populate the subview */ subview->next = NULL; subview->index = curindex++; subview->space = space; strcpy(subview->name, astring_c(tempstring)); /* add to the list */ *tailptr = subview; tailptr = &subview->next; } } /* free the temporary string */ astring_free(tempstring); return head; }
/*------------------------------------------------- disasm_view_enumerate_subviews - enumerate all possible subviews for a disassembly view -------------------------------------------------*/
enumerate all possible subviews for a disassembly view
[ "enumerate", "all", "possible", "subviews", "for", "a", "disassembly", "view" ]
static const disasm_subview_item *disasm_view_enumerate_subviews(running_machine *machine) { astring *tempstring = astring_alloc(); disasm_subview_item *head = NULL; disasm_subview_item **tailptr = &head; const device_config *cpu; int curindex = 0; for (cpu = machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu)) { const address_space *space = cpu_get_address_space(cpu, ADDRESS_SPACE_PROGRAM); if (space != NULL) { disasm_subview_item *subview; astring_printf(tempstring, "CPU '%s' (%s)", cpu->tag, cpu_get_name(cpu)); subview = (disasm_subview_item *)auto_alloc_array_clear(machine, UINT8, sizeof(*subview) + astring_len(tempstring)); subview->next = NULL; subview->index = curindex++; subview->space = space; strcpy(subview->name, astring_c(tempstring)); *tailptr = subview; tailptr = &subview->next; } } astring_free(tempstring); return head; }
[ "static", "const", "disasm_subview_item", "*", "disasm_view_enumerate_subviews", "(", "running_machine", "*", "machine", ")", "{", "astring", "*", "tempstring", "=", "astring_alloc", "(", ")", ";", "disasm_subview_item", "*", "head", "=", "NULL", ";", "disasm_subview_item", "*", "*", "tailptr", "=", "&", "head", ";", "const", "device_config", "*", "cpu", ";", "int", "curindex", "=", "0", ";", "for", "(", "cpu", "=", "machine", "->", "firstcpu", ";", "cpu", "!=", "NULL", ";", "cpu", "=", "cpu_next", "(", "cpu", ")", ")", "{", "const", "address_space", "*", "space", "=", "cpu_get_address_space", "(", "cpu", ",", "ADDRESS_SPACE_PROGRAM", ")", ";", "if", "(", "space", "!=", "NULL", ")", "{", "disasm_subview_item", "*", "subview", ";", "astring_printf", "(", "tempstring", ",", "\"", "\"", ",", "cpu", "->", "tag", ",", "cpu_get_name", "(", "cpu", ")", ")", ";", "subview", "=", "(", "disasm_subview_item", "*", ")", "auto_alloc_array_clear", "(", "machine", ",", "UINT8", ",", "sizeof", "(", "*", "subview", ")", "+", "astring_len", "(", "tempstring", ")", ")", ";", "subview", "->", "next", "=", "NULL", ";", "subview", "->", "index", "=", "curindex", "++", ";", "subview", "->", "space", "=", "space", ";", "strcpy", "(", "subview", "->", "name", ",", "astring_c", "(", "tempstring", ")", ")", ";", "*", "tailptr", "=", "subview", ";", "tailptr", "=", "&", "subview", "->", "next", ";", "}", "}", "astring_free", "(", "tempstring", ")", ";", "return", "head", ";", "}" ]
disasm_view_enumerate_subviews - enumerate all possible subviews for a disassembly view
[ "disasm_view_enumerate_subviews", "-", "enumerate", "all", "possible", "subviews", "for", "a", "disassembly", "view" ]
[ "/* iterate over CPUs with program address spaces */", "/* determine the string and allocate a subview large enough */", "/* populate the subview */", "/* add to the list */", "/* free the temporary string */" ]
[ { "param": "machine", "type": "running_machine" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "machine", "type": "running_machine", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
disasm_view_alloc
int
static int disasm_view_alloc(debug_view *view) { debug_view_disasm *dasmdata; int total_comments = 0; const device_config *cpu; /* fail if no available subviews */ if (view->machine->debugvw_data->disasm_subviews == NULL) return FALSE; /* allocate disasm */ dasmdata = (debug_view_disasm *)malloc(sizeof(*dasmdata)); if (dasmdata == NULL) return FALSE; memset(dasmdata, 0, sizeof(*dasmdata)); /* default to the first subview */ dasmdata->space = view->machine->debugvw_data->disasm_subviews->space; /* allocate the expression data */ debug_view_expression_alloc(&dasmdata->expression); /* count the number of comments */ for (cpu = view->machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu)) total_comments += debug_comment_get_count(cpu); /* initialize */ dasmdata->right_column = (total_comments > 0) ? DASM_RIGHTCOL_COMMENTS : DASM_RIGHTCOL_RAW; dasmdata->backwards_steps = 3; dasmdata->dasm_width = DEFAULT_DASM_WIDTH; /* stash the extra data pointer */ view->total.y = DEFAULT_DASM_LINES; view->extra_data = dasmdata; /* we support cursors */ view->supports_cursor = TRUE; return TRUE; }
/*------------------------------------------------- disasm_view_alloc - allocate disasm for the disassembly view -------------------------------------------------*/
allocate disasm for the disassembly view
[ "allocate", "disasm", "for", "the", "disassembly", "view" ]
static int disasm_view_alloc(debug_view *view) { debug_view_disasm *dasmdata; int total_comments = 0; const device_config *cpu; if (view->machine->debugvw_data->disasm_subviews == NULL) return FALSE; dasmdata = (debug_view_disasm *)malloc(sizeof(*dasmdata)); if (dasmdata == NULL) return FALSE; memset(dasmdata, 0, sizeof(*dasmdata)); dasmdata->space = view->machine->debugvw_data->disasm_subviews->space; debug_view_expression_alloc(&dasmdata->expression); for (cpu = view->machine->firstcpu; cpu != NULL; cpu = cpu_next(cpu)) total_comments += debug_comment_get_count(cpu); dasmdata->right_column = (total_comments > 0) ? DASM_RIGHTCOL_COMMENTS : DASM_RIGHTCOL_RAW; dasmdata->backwards_steps = 3; dasmdata->dasm_width = DEFAULT_DASM_WIDTH; view->total.y = DEFAULT_DASM_LINES; view->extra_data = dasmdata; view->supports_cursor = TRUE; return TRUE; }
[ "static", "int", "disasm_view_alloc", "(", "debug_view", "*", "view", ")", "{", "debug_view_disasm", "*", "dasmdata", ";", "int", "total_comments", "=", "0", ";", "const", "device_config", "*", "cpu", ";", "if", "(", "view", "->", "machine", "->", "debugvw_data", "->", "disasm_subviews", "==", "NULL", ")", "return", "FALSE", ";", "dasmdata", "=", "(", "debug_view_disasm", "*", ")", "malloc", "(", "sizeof", "(", "*", "dasmdata", ")", ")", ";", "if", "(", "dasmdata", "==", "NULL", ")", "return", "FALSE", ";", "memset", "(", "dasmdata", ",", "0", ",", "sizeof", "(", "*", "dasmdata", ")", ")", ";", "dasmdata", "->", "space", "=", "view", "->", "machine", "->", "debugvw_data", "->", "disasm_subviews", "->", "space", ";", "debug_view_expression_alloc", "(", "&", "dasmdata", "->", "expression", ")", ";", "for", "(", "cpu", "=", "view", "->", "machine", "->", "firstcpu", ";", "cpu", "!=", "NULL", ";", "cpu", "=", "cpu_next", "(", "cpu", ")", ")", "total_comments", "+=", "debug_comment_get_count", "(", "cpu", ")", ";", "dasmdata", "->", "right_column", "=", "(", "total_comments", ">", "0", ")", "?", "DASM_RIGHTCOL_COMMENTS", ":", "DASM_RIGHTCOL_RAW", ";", "dasmdata", "->", "backwards_steps", "=", "3", ";", "dasmdata", "->", "dasm_width", "=", "DEFAULT_DASM_WIDTH", ";", "view", "->", "total", ".", "y", "=", "DEFAULT_DASM_LINES", ";", "view", "->", "extra_data", "=", "dasmdata", ";", "view", "->", "supports_cursor", "=", "TRUE", ";", "return", "TRUE", ";", "}" ]
disasm_view_alloc - allocate disasm for the disassembly view
[ "disasm_view_alloc", "-", "allocate", "disasm", "for", "the", "disassembly", "view" ]
[ "/* fail if no available subviews */", "/* allocate disasm */", "/* default to the first subview */", "/* allocate the expression data */", "/* count the number of comments */", "/* initialize */", "/* stash the extra data pointer */", "/* we support cursors */" ]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
disasm_view_free
void
static void disasm_view_free(debug_view *view) { debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; /* free any disasm we callocated */ if (dasmdata != NULL) { debug_view_expression_free(&dasmdata->expression); if (dasmdata->byteaddress != NULL) free(dasmdata->byteaddress); if (dasmdata->dasm != NULL) free(dasmdata->dasm); free(dasmdata); } view->extra_data = NULL; }
/*------------------------------------------------- disasm_view_free - free disasm for the disassembly view -------------------------------------------------*/
free disasm for the disassembly view
[ "free", "disasm", "for", "the", "disassembly", "view" ]
static void disasm_view_free(debug_view *view) { debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; if (dasmdata != NULL) { debug_view_expression_free(&dasmdata->expression); if (dasmdata->byteaddress != NULL) free(dasmdata->byteaddress); if (dasmdata->dasm != NULL) free(dasmdata->dasm); free(dasmdata); } view->extra_data = NULL; }
[ "static", "void", "disasm_view_free", "(", "debug_view", "*", "view", ")", "{", "debug_view_disasm", "*", "dasmdata", "=", "(", "debug_view_disasm", "*", ")", "view", "->", "extra_data", ";", "if", "(", "dasmdata", "!=", "NULL", ")", "{", "debug_view_expression_free", "(", "&", "dasmdata", "->", "expression", ")", ";", "if", "(", "dasmdata", "->", "byteaddress", "!=", "NULL", ")", "free", "(", "dasmdata", "->", "byteaddress", ")", ";", "if", "(", "dasmdata", "->", "dasm", "!=", "NULL", ")", "free", "(", "dasmdata", "->", "dasm", ")", ";", "free", "(", "dasmdata", ")", ";", "}", "view", "->", "extra_data", "=", "NULL", ";", "}" ]
disasm_view_free - free disasm for the disassembly view
[ "disasm_view_free", "-", "free", "disasm", "for", "the", "disassembly", "view" ]
[ "/* free any disasm we callocated */" ]
[ { "param": "view", "type": "debug_view" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
disasm_view_notify
void
static void disasm_view_notify(debug_view *view, view_notification type) { if (type == VIEW_NOTIFY_CURSOR_CHANGED) adjust_visible_y_for_cursor(view); }
/*------------------------------------------------- disasm_view_notify - handle notification of updates to cursor changes -------------------------------------------------*/
handle notification of updates to cursor changes
[ "handle", "notification", "of", "updates", "to", "cursor", "changes" ]
static void disasm_view_notify(debug_view *view, view_notification type) { if (type == VIEW_NOTIFY_CURSOR_CHANGED) adjust_visible_y_for_cursor(view); }
[ "static", "void", "disasm_view_notify", "(", "debug_view", "*", "view", ",", "view_notification", "type", ")", "{", "if", "(", "type", "==", "VIEW_NOTIFY_CURSOR_CHANGED", ")", "adjust_visible_y_for_cursor", "(", "view", ")", ";", "}" ]
disasm_view_notify - handle notification of updates to cursor changes
[ "disasm_view_notify", "-", "handle", "notification", "of", "updates", "to", "cursor", "changes" ]
[]
[ { "param": "view", "type": "debug_view" }, { "param": "type", "type": "view_notification" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "type", "type": "view_notification", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
disasm_view_char
void
static void disasm_view_char(debug_view *view, int chval) { debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; debug_view_xy origcursor = view->cursor; UINT8 end_buffer = 3; INT32 temp; switch (chval) { case DCH_UP: if (view->cursor.y > 0) view->cursor.y--; break; case DCH_DOWN: if (view->cursor.y < view->total.y - 1) view->cursor.y++; break; case DCH_PUP: temp = view->cursor.y - (view->visible.y - end_buffer); if (temp < 0) view->cursor.y = 0; else view->cursor.y = temp; break; case DCH_PDOWN: temp = view->cursor.y + (view->visible.y - end_buffer); if (temp > view->total.y - 1) view->cursor.y = view->total.y - 1; else view->cursor.y = temp; break; case DCH_HOME: /* set the active column to the PC */ { offs_t pc = memory_address_to_byte(dasmdata->space, cpu_get_pc(dasmdata->space->cpu)) & dasmdata->space->logbytemask; int curline; /* figure out which row the pc is on */ for (curline = 0; curline < dasmdata->allocated.y; curline++) if (dasmdata->byteaddress[curline] == pc) view->cursor.y = curline; break; } case DCH_CTRLHOME: view->cursor.y = 0; break; case DCH_CTRLEND: view->cursor.y = view->total.y - 1; break; } /* send a cursor changed notification */ if (view->cursor.y != origcursor.y) { debug_view_begin_update(view); disasm_view_notify(view, VIEW_NOTIFY_CURSOR_CHANGED); view->update_pending = TRUE; debug_view_end_update(view); } }
/*------------------------------------------------- disasm_view_char - handle a character typed within the current view -------------------------------------------------*/
handle a character typed within the current view
[ "handle", "a", "character", "typed", "within", "the", "current", "view" ]
static void disasm_view_char(debug_view *view, int chval) { debug_view_disasm *dasmdata = (debug_view_disasm *)view->extra_data; debug_view_xy origcursor = view->cursor; UINT8 end_buffer = 3; INT32 temp; switch (chval) { case DCH_UP: if (view->cursor.y > 0) view->cursor.y--; break; case DCH_DOWN: if (view->cursor.y < view->total.y - 1) view->cursor.y++; break; case DCH_PUP: temp = view->cursor.y - (view->visible.y - end_buffer); if (temp < 0) view->cursor.y = 0; else view->cursor.y = temp; break; case DCH_PDOWN: temp = view->cursor.y + (view->visible.y - end_buffer); if (temp > view->total.y - 1) view->cursor.y = view->total.y - 1; else view->cursor.y = temp; break; case DCH_HOME: { offs_t pc = memory_address_to_byte(dasmdata->space, cpu_get_pc(dasmdata->space->cpu)) & dasmdata->space->logbytemask; int curline; for (curline = 0; curline < dasmdata->allocated.y; curline++) if (dasmdata->byteaddress[curline] == pc) view->cursor.y = curline; break; } case DCH_CTRLHOME: view->cursor.y = 0; break; case DCH_CTRLEND: view->cursor.y = view->total.y - 1; break; } if (view->cursor.y != origcursor.y) { debug_view_begin_update(view); disasm_view_notify(view, VIEW_NOTIFY_CURSOR_CHANGED); view->update_pending = TRUE; debug_view_end_update(view); } }
[ "static", "void", "disasm_view_char", "(", "debug_view", "*", "view", ",", "int", "chval", ")", "{", "debug_view_disasm", "*", "dasmdata", "=", "(", "debug_view_disasm", "*", ")", "view", "->", "extra_data", ";", "debug_view_xy", "origcursor", "=", "view", "->", "cursor", ";", "UINT8", "end_buffer", "=", "3", ";", "INT32", "temp", ";", "switch", "(", "chval", ")", "{", "case", "DCH_UP", ":", "if", "(", "view", "->", "cursor", ".", "y", ">", "0", ")", "view", "->", "cursor", ".", "y", "--", ";", "break", ";", "case", "DCH_DOWN", ":", "if", "(", "view", "->", "cursor", ".", "y", "<", "view", "->", "total", ".", "y", "-", "1", ")", "view", "->", "cursor", ".", "y", "++", ";", "break", ";", "case", "DCH_PUP", ":", "temp", "=", "view", "->", "cursor", ".", "y", "-", "(", "view", "->", "visible", ".", "y", "-", "end_buffer", ")", ";", "if", "(", "temp", "<", "0", ")", "view", "->", "cursor", ".", "y", "=", "0", ";", "else", "view", "->", "cursor", ".", "y", "=", "temp", ";", "break", ";", "case", "DCH_PDOWN", ":", "temp", "=", "view", "->", "cursor", ".", "y", "+", "(", "view", "->", "visible", ".", "y", "-", "end_buffer", ")", ";", "if", "(", "temp", ">", "view", "->", "total", ".", "y", "-", "1", ")", "view", "->", "cursor", ".", "y", "=", "view", "->", "total", ".", "y", "-", "1", ";", "else", "view", "->", "cursor", ".", "y", "=", "temp", ";", "break", ";", "case", "DCH_HOME", ":", "{", "offs_t", "pc", "=", "memory_address_to_byte", "(", "dasmdata", "->", "space", ",", "cpu_get_pc", "(", "dasmdata", "->", "space", "->", "cpu", ")", ")", "&", "dasmdata", "->", "space", "->", "logbytemask", ";", "int", "curline", ";", "for", "(", "curline", "=", "0", ";", "curline", "<", "dasmdata", "->", "allocated", ".", "y", ";", "curline", "++", ")", "if", "(", "dasmdata", "->", "byteaddress", "[", "curline", "]", "==", "pc", ")", "view", "->", "cursor", ".", "y", "=", "curline", ";", "break", ";", "}", "case", "DCH_CTRLHOME", ":", "view", "->", "cursor", ".", "y", "=", "0", ";", "break", ";", "case", "DCH_CTRLEND", ":", "view", "->", "cursor", ".", "y", "=", "view", "->", "total", ".", "y", "-", "1", ";", "break", ";", "}", "if", "(", "view", "->", "cursor", ".", "y", "!=", "origcursor", ".", "y", ")", "{", "debug_view_begin_update", "(", "view", ")", ";", "disasm_view_notify", "(", "view", ",", "VIEW_NOTIFY_CURSOR_CHANGED", ")", ";", "view", "->", "update_pending", "=", "TRUE", ";", "debug_view_end_update", "(", "view", ")", ";", "}", "}" ]
disasm_view_char - handle a character typed within the current view
[ "disasm_view_char", "-", "handle", "a", "character", "typed", "within", "the", "current", "view" ]
[ "/* set the active column to the PC */", "/* figure out which row the pc is on */", "/* send a cursor changed notification */" ]
[ { "param": "view", "type": "debug_view" }, { "param": "chval", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "view", "type": "debug_view", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "chval", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
b237c08010c9db2f9ad05b311391e96b87256068
lofunz/mieme
Reloaded/tags/MAME4droid.Reloaded.1.0.WIP/src/emu/debug/debugvw.c
[ "Unlicense" ]
C
disasm_view_find_pc_backwards
offs_t
static offs_t disasm_view_find_pc_backwards(const address_space *space, offs_t targetpc, int numinstrs) { int minlen = memory_byte_to_address(space, cpu_get_min_opcode_bytes(space->cpu)); int maxlen = memory_byte_to_address(space, cpu_get_max_opcode_bytes(space->cpu)); offs_t targetpcbyte = memory_address_to_byte(space, targetpc) & space->logbytemask; offs_t lastgoodpc = targetpc; offs_t fillpcbyte, curpc; UINT8 opbuf[1024], argbuf[1024]; char dasmbuffer[100]; /* compute the increment */ if (minlen == 0) minlen = 1; if (maxlen == 0) maxlen = 1; /* start off numinstrs back */ curpc = targetpc - minlen * numinstrs; if (curpc > targetpc) curpc = 0; /* loop until we find what we are looking for */ fillpcbyte = targetpcbyte; while (1) { offs_t curpcbyte = memory_address_to_byte(space, curpc) & space->logbytemask; offs_t scanpc; int instcount = 0; int instlen; /* fill the buffer up to the target */ while (curpcbyte < fillpcbyte) { fillpcbyte--; opbuf[1000 + fillpcbyte - targetpcbyte] = debug_read_opcode(space, fillpcbyte, 1, FALSE); argbuf[1000 + fillpcbyte - targetpcbyte] = debug_read_opcode(space, fillpcbyte, 1, TRUE); } /* loop until we get past the target instruction */ for (scanpc = curpc; scanpc < targetpc; scanpc += instlen) { offs_t scanpcbyte = memory_address_to_byte(space, scanpc) & space->logbytemask; offs_t physpcbyte = scanpcbyte; /* get the disassembly, but only if mapped */ instlen = 1; if (debug_cpu_translate(space, TRANSLATE_FETCH, &physpcbyte)) instlen = debug_cpu_disassemble(space->cpu, dasmbuffer, scanpc, &opbuf[1000 + scanpcbyte - targetpcbyte], &argbuf[1000 + scanpcbyte - targetpcbyte]) & DASMFLAG_LENGTHMASK; /* count this one */ instcount++; } /* if we ended up right on targetpc, this is a good candidate */ if (scanpc == targetpc && instcount <= numinstrs) lastgoodpc = curpc; /* we're also done if we go back too far */ if (targetpc - curpc >= numinstrs * maxlen) break; /* and if we hit 0, we're done */ if (curpc == 0) break; /* back up one more and try again */ curpc -= minlen; if (curpc > targetpc) curpc = 0; } return lastgoodpc; }
/*------------------------------------------------- disasm_view_find_pc_backwards - back up the specified numberof instructions from the given PC -------------------------------------------------*/
back up the specified numberof instructions from the given PC
[ "back", "up", "the", "specified", "numberof", "instructions", "from", "the", "given", "PC" ]
static offs_t disasm_view_find_pc_backwards(const address_space *space, offs_t targetpc, int numinstrs) { int minlen = memory_byte_to_address(space, cpu_get_min_opcode_bytes(space->cpu)); int maxlen = memory_byte_to_address(space, cpu_get_max_opcode_bytes(space->cpu)); offs_t targetpcbyte = memory_address_to_byte(space, targetpc) & space->logbytemask; offs_t lastgoodpc = targetpc; offs_t fillpcbyte, curpc; UINT8 opbuf[1024], argbuf[1024]; char dasmbuffer[100]; if (minlen == 0) minlen = 1; if (maxlen == 0) maxlen = 1; curpc = targetpc - minlen * numinstrs; if (curpc > targetpc) curpc = 0; fillpcbyte = targetpcbyte; while (1) { offs_t curpcbyte = memory_address_to_byte(space, curpc) & space->logbytemask; offs_t scanpc; int instcount = 0; int instlen; while (curpcbyte < fillpcbyte) { fillpcbyte--; opbuf[1000 + fillpcbyte - targetpcbyte] = debug_read_opcode(space, fillpcbyte, 1, FALSE); argbuf[1000 + fillpcbyte - targetpcbyte] = debug_read_opcode(space, fillpcbyte, 1, TRUE); } for (scanpc = curpc; scanpc < targetpc; scanpc += instlen) { offs_t scanpcbyte = memory_address_to_byte(space, scanpc) & space->logbytemask; offs_t physpcbyte = scanpcbyte; instlen = 1; if (debug_cpu_translate(space, TRANSLATE_FETCH, &physpcbyte)) instlen = debug_cpu_disassemble(space->cpu, dasmbuffer, scanpc, &opbuf[1000 + scanpcbyte - targetpcbyte], &argbuf[1000 + scanpcbyte - targetpcbyte]) & DASMFLAG_LENGTHMASK; instcount++; } if (scanpc == targetpc && instcount <= numinstrs) lastgoodpc = curpc; if (targetpc - curpc >= numinstrs * maxlen) break; if (curpc == 0) break; curpc -= minlen; if (curpc > targetpc) curpc = 0; } return lastgoodpc; }
[ "static", "offs_t", "disasm_view_find_pc_backwards", "(", "const", "address_space", "*", "space", ",", "offs_t", "targetpc", ",", "int", "numinstrs", ")", "{", "int", "minlen", "=", "memory_byte_to_address", "(", "space", ",", "cpu_get_min_opcode_bytes", "(", "space", "->", "cpu", ")", ")", ";", "int", "maxlen", "=", "memory_byte_to_address", "(", "space", ",", "cpu_get_max_opcode_bytes", "(", "space", "->", "cpu", ")", ")", ";", "offs_t", "targetpcbyte", "=", "memory_address_to_byte", "(", "space", ",", "targetpc", ")", "&", "space", "->", "logbytemask", ";", "offs_t", "lastgoodpc", "=", "targetpc", ";", "offs_t", "fillpcbyte", ",", "curpc", ";", "UINT8", "opbuf", "[", "1024", "]", ",", "argbuf", "[", "1024", "]", ";", "char", "dasmbuffer", "[", "100", "]", ";", "if", "(", "minlen", "==", "0", ")", "minlen", "=", "1", ";", "if", "(", "maxlen", "==", "0", ")", "maxlen", "=", "1", ";", "curpc", "=", "targetpc", "-", "minlen", "*", "numinstrs", ";", "if", "(", "curpc", ">", "targetpc", ")", "curpc", "=", "0", ";", "fillpcbyte", "=", "targetpcbyte", ";", "while", "(", "1", ")", "{", "offs_t", "curpcbyte", "=", "memory_address_to_byte", "(", "space", ",", "curpc", ")", "&", "space", "->", "logbytemask", ";", "offs_t", "scanpc", ";", "int", "instcount", "=", "0", ";", "int", "instlen", ";", "while", "(", "curpcbyte", "<", "fillpcbyte", ")", "{", "fillpcbyte", "--", ";", "opbuf", "[", "1000", "+", "fillpcbyte", "-", "targetpcbyte", "]", "=", "debug_read_opcode", "(", "space", ",", "fillpcbyte", ",", "1", ",", "FALSE", ")", ";", "argbuf", "[", "1000", "+", "fillpcbyte", "-", "targetpcbyte", "]", "=", "debug_read_opcode", "(", "space", ",", "fillpcbyte", ",", "1", ",", "TRUE", ")", ";", "}", "for", "(", "scanpc", "=", "curpc", ";", "scanpc", "<", "targetpc", ";", "scanpc", "+=", "instlen", ")", "{", "offs_t", "scanpcbyte", "=", "memory_address_to_byte", "(", "space", ",", "scanpc", ")", "&", "space", "->", "logbytemask", ";", "offs_t", "physpcbyte", "=", "scanpcbyte", ";", "instlen", "=", "1", ";", "if", "(", "debug_cpu_translate", "(", "space", ",", "TRANSLATE_FETCH", ",", "&", "physpcbyte", ")", ")", "instlen", "=", "debug_cpu_disassemble", "(", "space", "->", "cpu", ",", "dasmbuffer", ",", "scanpc", ",", "&", "opbuf", "[", "1000", "+", "scanpcbyte", "-", "targetpcbyte", "]", ",", "&", "argbuf", "[", "1000", "+", "scanpcbyte", "-", "targetpcbyte", "]", ")", "&", "DASMFLAG_LENGTHMASK", ";", "instcount", "++", ";", "}", "if", "(", "scanpc", "==", "targetpc", "&&", "instcount", "<=", "numinstrs", ")", "lastgoodpc", "=", "curpc", ";", "if", "(", "targetpc", "-", "curpc", ">=", "numinstrs", "*", "maxlen", ")", "break", ";", "if", "(", "curpc", "==", "0", ")", "break", ";", "curpc", "-=", "minlen", ";", "if", "(", "curpc", ">", "targetpc", ")", "curpc", "=", "0", ";", "}", "return", "lastgoodpc", ";", "}" ]
disasm_view_find_pc_backwards - back up the specified numberof instructions from the given PC
[ "disasm_view_find_pc_backwards", "-", "back", "up", "the", "specified", "numberof", "instructions", "from", "the", "given", "PC" ]
[ "/* compute the increment */", "/* start off numinstrs back */", "/* loop until we find what we are looking for */", "/* fill the buffer up to the target */", "/* loop until we get past the target instruction */", "/* get the disassembly, but only if mapped */", "/* count this one */", "/* if we ended up right on targetpc, this is a good candidate */", "/* we're also done if we go back too far */", "/* and if we hit 0, we're done */", "/* back up one more and try again */" ]
[ { "param": "space", "type": "address_space" }, { "param": "targetpc", "type": "offs_t" }, { "param": "numinstrs", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "space", "type": "address_space", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "targetpc", "type": "offs_t", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "numinstrs", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }