projects
/
emu8051.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
8bfc530
)
Shorten memory_ functions prefix to mem_ in memory.c
author
Hugo Villeneuve
<hugo@hugovil.com>
Thu, 13 Feb 2014 04:46:44 +0000
(23:46 -0500)
committer
Hugo Villeneuve
<hugo@hugovil.com>
Thu, 13 Feb 2014 05:25:19 +0000
(
00:25
-0500)
13 files changed:
src/cli/menu.c
patch
|
blob
|
history
src/cli/parser.y
patch
|
blob
|
history
src/common/cpu8051.c
patch
|
blob
|
history
src/common/hexfile.c
patch
|
blob
|
history
src/common/memory.c
patch
|
blob
|
history
src/common/memory.h
patch
|
blob
|
history
src/common/opcode2c.pl
patch
|
blob
|
history
src/common/psw.c
patch
|
blob
|
history
src/common/sfr.c
patch
|
blob
|
history
src/common/timers.c
patch
|
blob
|
history
src/gtk/memwin.c
patch
|
blob
|
history
src/gtk/memwin.h
patch
|
blob
|
history
src/gtk/pgmwin.c
patch
|
blob
|
history
diff --git
a/src/cli/menu.c
b/src/cli/menu.c
index
149552b
..
8d4c007
100644
(file)
--- a/
src/cli/menu.c
+++ b/
src/cli/menu.c
@@
-239,14
+239,14
@@
static void
console_dump_sfr_registers_compact(void)
{
int id;
console_dump_sfr_registers_compact(void)
{
int id;
- unsigned char PSW = mem
ory
_read_direct(_PSW_);
+ unsigned char PSW = mem_read_direct(_PSW_);
int bank_sel = (PSW & 0x18);
printf("----------------------------------------------------------------------\n");
printf("| PC | SP | DPTR | ACC | B | PSW: CY AC F0 RS1 RS0 OV - P |\n");
printf("| %.4X | %.2X | %.4X | %.2X | %.2X |", cpu8051.pc,
int bank_sel = (PSW & 0x18);
printf("----------------------------------------------------------------------\n");
printf("| PC | SP | DPTR | ACC | B | PSW: CY AC F0 RS1 RS0 OV - P |\n");
printf("| %.4X | %.2X | %.4X | %.2X | %.2X |", cpu8051.pc,
- mem
ory_read_direct(_SP_), memory
_sfr_read_dptr(),
- mem
ory_read_direct(_ACC_), memory
_read_direct(_B_));
+ mem
_read_direct(_SP_), mem
_sfr_read_dptr(),
+ mem
_read_direct(_ACC_), mem
_read_direct(_B_));
printf(" %d %d %d %d %d %d %d %d |",
(PSW >> 7) & 1, (PSW >> 6) & 1, (PSW >> 5) & 1, (PSW >> 4) & 1,
(PSW >> 3) & 1, (PSW >> 2) & 1, (PSW >> 1) & 1, PSW & 1);
printf(" %d %d %d %d %d %d %d %d |",
(PSW >> 7) & 1, (PSW >> 6) & 1, (PSW >> 5) & 1, (PSW >> 4) & 1,
(PSW >> 3) & 1, (PSW >> 2) & 1, (PSW >> 1) & 1, PSW & 1);
@@
-254,18
+254,18
@@
console_dump_sfr_registers_compact(void)
printf("----------------------------------------------------------------------\n");
printf("| TCON | TMOD | IE | IP | R0 | R1 | R2 | R3 | R4 | R5 | R6 | R7 | |\n");
printf("----------------------------------------------------------------------\n");
printf("| TCON | TMOD | IE | IP | R0 | R1 | R2 | R3 | R4 | R5 | R6 | R7 | |\n");
- printf("| %.2X | %.2X | %.2X | %.2X ", mem
ory
_read_direct(_TCON_),
- mem
ory_read_direct(_TMOD_), memory_read_direct(_IE_), memory
_read_direct(_IP_));
+ printf("| %.2X | %.2X | %.2X | %.2X ", mem_read_direct(_TCON_),
+ mem
_read_direct(_TMOD_), mem_read_direct(_IE_), mem
_read_direct(_IP_));
printf("| %.2X | %.2X | %.2X | %.2X ",
printf("| %.2X | %.2X | %.2X | %.2X ",
- mem
ory
_read_direct(bank_sel + _R0_),
- mem
ory
_read_direct(bank_sel + _R1_),
- mem
ory
_read_direct(bank_sel + _R2_),
- mem
ory
_read_direct(bank_sel + _R3_));
+ mem_read_direct(bank_sel + _R0_),
+ mem_read_direct(bank_sel + _R1_),
+ mem_read_direct(bank_sel + _R2_),
+ mem_read_direct(bank_sel + _R3_));
printf("| %.2X | %.2X | %.2X | %.2X ",
printf("| %.2X | %.2X | %.2X | %.2X ",
- mem
ory
_read_direct(bank_sel + _R4_),
- mem
ory
_read_direct(bank_sel + _R5_),
- mem
ory
_read_direct(bank_sel + _R6_),
- mem
ory
_read_direct(bank_sel + _R7_));
+ mem_read_direct(bank_sel + _R4_),
+ mem_read_direct(bank_sel + _R5_),
+ mem_read_direct(bank_sel + _R6_),
+ mem_read_direct(bank_sel + _R7_));
printf("| |\n");
printf("----------------------------------------------------------------------\n");
printf("| |\n");
printf("----------------------------------------------------------------------\n");
diff --git
a/src/cli/parser.y
b/src/cli/parser.y
index
cd813b6
..
dc42613
100644
(file)
--- a/
src/cli/parser.y
+++ b/
src/cli/parser.y
@@
-129,19
+129,19
@@
dump_mem:
TOK_DE NUMBER NUMBER TOK_ENTER
{
log_debug(" Dump External Data Memory at $%04X, len %d", $2, $3);
TOK_DE NUMBER NUMBER TOK_ENTER
{
log_debug(" Dump External Data Memory at $%04X, len %d", $2, $3);
- mem
ory
_dump($2, $3, EXT_MEM_ID);
+ mem_dump($2, $3, EXT_MEM_ID);
}
|
TOK_DI NUMBER NUMBER TOK_ENTER
{
log_debug(" Dump Internal Data Memory at $%04X, len %d", $2, $3);
}
|
TOK_DI NUMBER NUMBER TOK_ENTER
{
log_debug(" Dump Internal Data Memory at $%04X, len %d", $2, $3);
- mem
ory
_dump($2, $3, INT_MEM_ID);
+ mem_dump($2, $3, INT_MEM_ID);
}
|
TOK_DP NUMBER NUMBER TOK_ENTER
{
log_debug(" Dump Program Memory at $%04X, len %d", $2, $3);
}
|
TOK_DP NUMBER NUMBER TOK_ENTER
{
log_debug(" Dump Program Memory at $%04X, len %d", $2, $3);
- mem
ory
_dump($2, $3, PGM_MEM_ID);
+ mem_dump($2, $3, PGM_MEM_ID);
}
;
}
;
@@
-157,19
+157,19
@@
modify:
TOK_MOD_EXT NUMBER NUMBER TOK_ENTER
{
log_debug(" Modify external memory");
TOK_MOD_EXT NUMBER NUMBER TOK_ENTER
{
log_debug(" Modify external memory");
- mem
ory
_write8(EXT_MEM_ID, $2, $3);
+ mem_write8(EXT_MEM_ID, $2, $3);
}
|
TOK_MOD_INT NUMBER NUMBER TOK_ENTER
{
log_debug(" Modify internal memory");
}
|
TOK_MOD_INT NUMBER NUMBER TOK_ENTER
{
log_debug(" Modify internal memory");
- mem
ory
_write8(INT_MEM_ID, $2, $3);
+ mem_write8(INT_MEM_ID, $2, $3);
}
|
TOK_MOD_PROG NUMBER NUMBER TOK_ENTER
{
log_debug(" Modify program memory");
}
|
TOK_MOD_PROG NUMBER NUMBER TOK_ENTER
{
log_debug(" Modify program memory");
- mem
ory
_write8(PGM_MEM_ID, $2, $3);
+ mem_write8(PGM_MEM_ID, $2, $3);
}
|
TOK_MOD_REG WORD NUMBER TOK_ENTER
}
|
TOK_MOD_REG WORD NUMBER TOK_ENTER
diff --git
a/src/common/cpu8051.c
b/src/common/cpu8051.c
index
5a00709
..
fb387ee
100644
(file)
--- a/
src/common/cpu8051.c
+++ b/
src/common/cpu8051.c
@@
-62,7
+62,7
@@
breakpoint_set(unsigned int address)
{
int rc;
{
int rc;
- rc = mem
ory
_check_address(PGM_MEM_ID, address, DISPLAY_ERROR_YES);
+ rc = mem_check_address(PGM_MEM_ID, address, DISPLAY_ERROR_YES);
if (!rc)
return; /* Error */
if (!rc)
return; /* Error */
@@
-79,7
+79,7
@@
breakpoint_clr(unsigned int address)
int k;
int rc;
int k;
int rc;
- rc = mem
ory
_check_address(PGM_MEM_ID, address, DISPLAY_ERROR_YES);
+ rc = mem_check_address(PGM_MEM_ID, address, DISPLAY_ERROR_YES);
if (!rc)
return; /* Error */
if (!rc)
return; /* Error */
@@
-130,7
+130,7
@@
cpu8051_init(void)
{
int id;
{
int id;
- mem
ory
_init();
+ mem_init();
for (id = 0; id < GP_TIMERS_COUNT; id++)
gp_timer_reset(id);
for (id = 0; id < GP_TIMERS_COUNT; id++)
gp_timer_reset(id);
@@
-150,21
+150,21
@@
cpu8051_reset(void)
cpu8051.active_priority = -1;
/* Clear IRAM and SFR. */
cpu8051.active_priority = -1;
/* Clear IRAM and SFR. */
- mem
ory
_clear(INT_MEM_ID);
+ mem_clear(INT_MEM_ID);
- mem
ory
_sfr_write8(_P0_, 0xFF);
- mem
ory
_sfr_write8(_P1_, 0xFF);
- mem
ory
_sfr_write8(_P2_, 0xFF);
- mem
ory
_sfr_write8(_P3_, 0xFF);
+ mem_sfr_write8(_P0_, 0xFF);
+ mem_sfr_write8(_P1_, 0xFF);
+ mem_sfr_write8(_P2_, 0xFF);
+ mem_sfr_write8(_P3_, 0xFF);
/* The default value of SP (after system reset) is 07 */
/* The default value of SP (after system reset) is 07 */
- mem
ory
_sfr_write8(_SP_, 0x07);
+ mem_sfr_write8(_SP_, 0x07);
}
static int
cpu8051_interrupt_fire(int interrupt_no, int priority)
{
}
static int
cpu8051_interrupt_fire(int interrupt_no, int priority)
{
- if (mem
ory
_read_direct(_IP_) & INTERRUPT_MASK(interrupt_no))
+ if (mem_read_direct(_IP_) & INTERRUPT_MASK(interrupt_no))
return priority;
else
return !priority;
return priority;
else
return !priority;
@@
-173,7
+173,7
@@
cpu8051_interrupt_fire(int interrupt_no, int priority)
static int
cpu8051_interrupt_enabled(int interrupt_no)
{
static int
cpu8051_interrupt_enabled(int interrupt_no)
{
- return (mem
ory
_read_direct(_IE_) & INTERRUPT_MASK(interrupt_no)) ?
+ return (mem_read_direct(_IE_) & INTERRUPT_MASK(interrupt_no)) ?
1 : 0;
}
1 : 0;
}
@@
-192,7
+192,7
@@
cpu8051_check_interrupts(void)
{
int i;
{
int i;
- if ((mem
ory
_read_direct(_IE_) & 0x80) == 0)
+ if ((mem_read_direct(_IE_) & 0x80) == 0)
return;
for (i = INTERRUPT_PRIORITY_HIGH; i >= INTERRUPT_PRIORITY_LOW; i--) {
return;
for (i = INTERRUPT_PRIORITY_HIGH; i >= INTERRUPT_PRIORITY_LOW; i--) {
@@
-200,34
+200,34
@@
cpu8051_check_interrupts(void)
/* Interrupt timer 0 */
if (cpu8051_interrupt_enabled(INTERRUPT_1) &&
cpu8051_interrupt_fire(INTERRUPT_1, i) &&
/* Interrupt timer 0 */
if (cpu8051_interrupt_enabled(INTERRUPT_1) &&
cpu8051_interrupt_fire(INTERRUPT_1, i) &&
- (mem
ory
_read_direct(_TCON_) & 0x20)) {
- mem
ory
_write_direct(
+ (mem_read_direct(_TCON_) & 0x20)) {
+ mem_write_direct(
_TCON_,
_TCON_,
- mem
ory
_read_direct(_TCON_) & 0xDF);
+ mem_read_direct(_TCON_) & 0xDF);
cpu8051_process_interrupt(0x0B, i);
return;
}
/* Interrupt timer 1 */
if (cpu8051_interrupt_enabled(INTERRUPT_3) &&
cpu8051_interrupt_fire(INTERRUPT_3, i) &&
cpu8051_process_interrupt(0x0B, i);
return;
}
/* Interrupt timer 1 */
if (cpu8051_interrupt_enabled(INTERRUPT_3) &&
cpu8051_interrupt_fire(INTERRUPT_3, i) &&
- (mem
ory
_read_direct(_TCON_) & 0x80)) {
- mem
ory
_write_direct(
+ (mem_read_direct(_TCON_) & 0x80)) {
+ mem_write_direct(
_TCON_,
_TCON_,
- mem
ory
_read_direct(_TCON_) & 0x7F);
+ mem_read_direct(_TCON_) & 0x7F);
cpu8051_process_interrupt(0x1B, i);
return;
}
/* Serial Interrupts */
if (cpu8051_interrupt_enabled(INTERRUPT_4) &&
cpu8051_interrupt_fire(INTERRUPT_4, i) &&
cpu8051_process_interrupt(0x1B, i);
return;
}
/* Serial Interrupts */
if (cpu8051_interrupt_enabled(INTERRUPT_4) &&
cpu8051_interrupt_fire(INTERRUPT_4, i) &&
- (mem
ory
_read_direct(_SCON_) & 0x03)) {
+ (mem_read_direct(_SCON_) & 0x03)) {
cpu8051_process_interrupt(0x23, i);
return;
}
/* Interrupt timer 2 */
if (cpu8051_interrupt_enabled(INTERRUPT_5) &&
cpu8051_interrupt_fire(INTERRUPT_5, i) &&
cpu8051_process_interrupt(0x23, i);
return;
}
/* Interrupt timer 2 */
if (cpu8051_interrupt_enabled(INTERRUPT_5) &&
cpu8051_interrupt_fire(INTERRUPT_5, i) &&
- (mem
ory
_read_direct(_T2CON_) & 0x80)) {
+ (mem_read_direct(_T2CON_) & 0x80)) {
cpu8051_process_interrupt(0x2B, i);
return;
}
cpu8051_process_interrupt(0x2B, i);
return;
}
@@
-245,13
+245,13
@@
cpu8051_exec(void)
int insttiming;
/* Basic address check (may fail later if opcode has operands). */
int insttiming;
/* Basic address check (may fail later if opcode has operands). */
- rc = mem
ory
_check_address(PGM_MEM_ID, cpu8051.pc, DISPLAY_ERROR_NO);
+ rc = mem_check_address(PGM_MEM_ID, cpu8051.pc, DISPLAY_ERROR_NO);
if (!rc) {
log_err("Trying to run past program memory limit");
return false; /* Error */
}
if (!rc) {
log_err("Trying to run past program memory limit");
return false; /* Error */
}
- opcode = mem
ory
_read8(PGM_MEM_ID, cpu8051.pc);
+ opcode = mem_read8(PGM_MEM_ID, cpu8051.pc);
cpu8051.pc++;
insttiming = (*opcode_table[opcode])(); /* Function callback. */
cpu8051.pc++;
insttiming = (*opcode_table[opcode])(); /* Function callback. */
@@
-401,7
+401,7
@@
cpu8051_int_mem_bit_info(uint8_t bit_address, char *text)
uint8_t bit_number;
int len;
uint8_t bit_number;
int len;
- mem
ory
_convert_bit_address(bit_address, &byte_address, &bit_number);
+ mem_convert_bit_address(bit_address, &byte_address, &bit_number);
len = cpu8051_sfr_mem_info(byte_address, text);
sprintf(&text[len], ".%X", bit_address);
len = cpu8051_sfr_mem_info(byte_address, text);
sprintf(&text[len], ".%X", bit_address);
@@
-433,7
+433,7
@@
cpu8051_disasm_args(unsigned int address, char *buf)
buf[0] = '\0';
buf[0] = '\0';
- opcode = mem
ory
_read8(PGM_MEM_ID, address);
+ opcode = mem_read8(PGM_MEM_ID, address);
args_table_offset = opcode << 2;
address++;
args_table_offset = opcode << 2;
address++;
@@
-442,10
+442,10
@@
cpu8051_disasm_args(unsigned int address, char *buf)
* are inverted
*/
if (opcode == 0x85) {
* are inverted
*/
if (opcode == 0x85) {
- cpu8051_sfr_mem_info(mem
ory
_read8(PGM_MEM_ID, address + 1),
+ cpu8051_sfr_mem_info(mem_read8(PGM_MEM_ID, address + 1),
str);
len += sprintf(&buf[len], "%s,", str);
str);
len += sprintf(&buf[len], "%s,", str);
- cpu8051_sfr_mem_info(mem
ory
_read8(PGM_MEM_ID, address),
+ cpu8051_sfr_mem_info(mem_read8(PGM_MEM_ID, address),
str);
len += sprintf(&buf[len], "%s", str);
address += 2;
str);
len += sprintf(&buf[len], "%s", str);
address += 2;
@@
-457,20
+457,20
@@
cpu8051_disasm_args(unsigned int address, char *buf)
case ADDR11: {
len += sprintf(&buf[len],
"%.4XH", ((opcode << 3) & 0xF00) +
case ADDR11: {
len += sprintf(&buf[len],
"%.4XH", ((opcode << 3) & 0xF00) +
- (mem
ory
_read8(PGM_MEM_ID, address)));
+ (mem_read8(PGM_MEM_ID, address)));
address++;
break;
}
case ADDR16: {
len += sprintf(
&buf[len], "%.4XH",
address++;
break;
}
case ADDR16: {
len += sprintf(
&buf[len], "%.4XH",
- ((mem
ory
_read8(PGM_MEM_ID, address) << 8) +
- mem
ory
_read8(PGM_MEM_ID, address + 1)));
+ ((mem_read8(PGM_MEM_ID, address) << 8) +
+ mem_read8(PGM_MEM_ID, address + 1)));
address += 2;
break;
}
case DIRECT: {
address += 2;
break;
}
case DIRECT: {
- cpu8051_sfr_mem_info(mem
ory
_read8(PGM_MEM_ID, address),
+ cpu8051_sfr_mem_info(mem_read8(PGM_MEM_ID, address),
str);
len += sprintf(&buf[len], "%s", str);
address++;
str);
len += sprintf(&buf[len], "%s", str);
address++;
@@
-478,10
+478,10
@@
cpu8051_disasm_args(unsigned int address, char *buf)
}
case BITADDR: {
cpu8051_int_mem_bit_info(
}
case BITADDR: {
cpu8051_int_mem_bit_info(
- (mem
ory
_read8(PGM_MEM_ID, address) & 0xF8),
+ (mem_read8(PGM_MEM_ID, address) & 0xF8),
str);
len += sprintf(&buf[len], "%s.%X" , str,
str);
len += sprintf(&buf[len], "%s.%X" , str,
- (mem
ory
_read8(PGM_MEM_ID, address) & 7));
+ (mem_read8(PGM_MEM_ID, address) & 7));
address++;
break;
}
address++;
break;
}
@@
-489,30
+489,30
@@
cpu8051_disasm_args(unsigned int address, char *buf)
address++;
len += sprintf(&buf[len], "%.4XH", (address & 0xFF00) +
(((address & 0xFF) +
address++;
len += sprintf(&buf[len], "%.4XH", (address & 0xFF00) +
(((address & 0xFF) +
- mem
ory
_read8(PGM_MEM_ID,
-
address - 1)) & 0xFF));
+ mem_read8(PGM_MEM_ID,
+ address - 1)) & 0xFF));
break;
}
case DATAIMM: {
len += sprintf(&buf[len], "#%.2XH",
break;
}
case DATAIMM: {
len += sprintf(&buf[len], "#%.2XH",
- mem
ory
_read8(PGM_MEM_ID, address));
+ mem_read8(PGM_MEM_ID, address));
address++;
break;
}
case DATA16: {
len += sprintf(&buf[len], "#%.4XH",
address++;
break;
}
case DATA16: {
len += sprintf(&buf[len], "#%.4XH",
- ((mem
ory
_read8(PGM_MEM_ID,
-
address) << 8) +
- mem
ory
_read8(PGM_MEM_ID, address+1)));
+ ((mem_read8(PGM_MEM_ID,
+ address) << 8) +
+ mem_read8(PGM_MEM_ID, address+1)));
address += 2;
break;
}
case CBITADDR: {
address += 2;
break;
}
case CBITADDR: {
- cpu8051_int_mem_bit_info((mem
ory
_read8(PGM_MEM_ID,
-
address) & 0xF8),
+ cpu8051_int_mem_bit_info((mem_read8(PGM_MEM_ID,
+ address) & 0xF8),
str);
len += sprintf(&buf[len], "/%s.%X", str,
str);
len += sprintf(&buf[len], "/%s.%X", str,
- (mem
ory
_read8(PGM_MEM_ID, address) & 7));
+ (mem_read8(PGM_MEM_ID, address) & 7));
address++;
break;
}
address++;
break;
}
@@
-540,13
+540,13
@@
cpu8051_disasm(unsigned int address, char *text)
/* Display address. */
len += sprintf(text, " %.4X ", address);
/* Display address. */
len += sprintf(text, " %.4X ", address);
- opcode = mem
ory
_read8(PGM_MEM_ID, address);
+ opcode = mem_read8(PGM_MEM_ID, address);
inst_size = instr_size[opcode];
/* Display hex bytes. */
for (i = 0; i < inst_size; i++)
len += sprintf(&text[len], " %.2X",
inst_size = instr_size[opcode];
/* Display hex bytes. */
for (i = 0; i < inst_size; i++)
len += sprintf(&text[len], " %.2X",
- mem
ory
_read8(PGM_MEM_ID, address + i));
+ mem_read8(PGM_MEM_ID, address + i));
/* Padd remaining area with spaces. */
for (; len < 17;)
/* Padd remaining area with spaces. */
for (; len < 17;)
diff --git
a/src/common/hexfile.c
b/src/common/hexfile.c
index
8967cf8
..
9fef693
100644
(file)
--- a/
src/common/hexfile.c
+++ b/
src/common/hexfile.c
@@
-149,9
+149,9
@@
hexfile_load(const char *filename)
if (rec_type == 0) {
for (j = 0; j < rec_len; j++) {
data = asciihex2int_len(&line[i], 2);
if (rec_type == 0) {
for (j = 0; j < rec_len; j++) {
data = asciihex2int_len(&line[i], 2);
- mem
ory
_write8(PGM_MEM_ID,
-
(unsigned int) (load_offset + j),
-
(unsigned char) data);
+ mem_write8(PGM_MEM_ID,
+ (unsigned int) (load_offset + j),
+ (unsigned char) data);
i += 2;
checksum += data;
}
i += 2;
checksum += data;
}
diff --git
a/src/common/memory.c
b/src/common/memory.c
index
ec7542a
..
a75f51d
100644
(file)
--- a/
src/common/memory.c
+++ b/
src/common/memory.c
@@
-30,7
+30,7
@@
extern struct options_t options;
/* Init each 8051 memory sections. */
void
/* Init each 8051 memory sections. */
void
-mem
ory
_init(void)
+mem_init(void)
{
int k;
struct mem_infos_t *m;
{
int k;
struct mem_infos_t *m;
@@
-66,7
+66,7
@@
memory_init(void)
/* Return true if address is valid, false otherwise. */
int
/* Return true if address is valid, false otherwise. */
int
-mem
ory
_check_address(enum mem_id_t id, unsigned long address, int display_error)
+mem_check_address(enum mem_id_t id, unsigned long address, int display_error)
{
if (address >= (unsigned long) mem_infos[id].max_size) {
if (display_error == DISPLAY_ERROR_YES)
{
if (address >= (unsigned long) mem_infos[id].max_size) {
if (display_error == DISPLAY_ERROR_YES)
@@
-79,8
+79,8
@@
memory_check_address(enum mem_id_t id, unsigned long address, int display_error)
}
void
}
void
-mem
ory
_convert_bit_address(uint8_t bit_address, uint8_t *byte_address,
-
uint8_t *bit_number)
+mem_convert_bit_address(uint8_t bit_address, uint8_t *byte_address,
+ uint8_t *bit_number)
{
if (bit_address > 0x7F) {
/* SFR 80-FF */
{
if (bit_address > 0x7F) {
/* SFR 80-FF */
@@
-94,19
+94,19
@@
memory_convert_bit_address(uint8_t bit_address, uint8_t *byte_address,
}
u_int8_t *
}
u_int8_t *
-mem
ory
_getbuf(enum mem_id_t id, unsigned long address)
+mem_getbuf(enum mem_id_t id, unsigned long address)
{
return &mem_infos[id].buf[address];
}
void
{
return &mem_infos[id].buf[address];
}
void
-mem
ory
_clear(enum mem_id_t id)
+mem_clear(enum mem_id_t id)
{
memset(mem_infos[id].buf, 0, mem_infos[id].size);
}
void
{
memset(mem_infos[id].buf, 0, mem_infos[id].size);
}
void
-mem
ory
_write8(enum mem_id_t id, unsigned long address, u_int8_t value)
+mem_write8(enum mem_id_t id, unsigned long address, u_int8_t value)
{
if (address >= (unsigned long) mem_infos[id].max_size) {
log_err("Error writing to memory ID: %d\n"
{
if (address >= (unsigned long) mem_infos[id].max_size) {
log_err("Error writing to memory ID: %d\n"
@@
-120,55
+120,55
@@
memory_write8(enum mem_id_t id, unsigned long address, u_int8_t value)
/* Write with a direct addressing mode at Address the new Value */
void
/* Write with a direct addressing mode at Address the new Value */
void
-mem
ory
_write_direct(unsigned int address, unsigned char value)
+mem_write_direct(unsigned int address, unsigned char value)
{
{
- mem
ory
_write8(INT_MEM_ID, address, value);
+ mem_write8(INT_MEM_ID, address, value);
}
/* Write with an indirect addressing mode at Address the new Value */
void
}
/* Write with an indirect addressing mode at Address the new Value */
void
-mem
ory
_write_indirect(unsigned int address, unsigned char value)
+mem_write_indirect(unsigned int address, unsigned char value)
{
if (address > 0x7F) {
{
if (address > 0x7F) {
- mem
ory
_write8(EXT_MEM_ID, address, value);
+ mem_write8(EXT_MEM_ID, address, value);
return;
}
return;
}
- mem
ory
_write8(INT_MEM_ID, address, value);
+ mem_write8(INT_MEM_ID, address, value);
}
/* Write with a bit addressing mode at BitAddress the new Value */
void
}
/* Write with a bit addressing mode at BitAddress the new Value */
void
-mem
ory
_write_bit(uint8_t bit_address, uint8_t value)
+mem_write_bit(uint8_t bit_address, uint8_t value)
{
uint8_t byte_address;
uint8_t bit_number;
unsigned char byte_val, byte_mask;
{
uint8_t byte_address;
uint8_t bit_number;
unsigned char byte_val, byte_mask;
- mem
ory
_convert_bit_address(bit_address, &byte_address, &bit_number);
+ mem_convert_bit_address(bit_address, &byte_address, &bit_number);
byte_mask = ((1 << bit_number) ^ 0xFF);
byte_mask = ((1 << bit_number) ^ 0xFF);
- byte_val = mem
ory
_read_direct(byte_address) & byte_mask;
+ byte_val = mem_read_direct(byte_address) & byte_mask;
byte_val += value << bit_number;
byte_val += value << bit_number;
- mem
ory
_write_direct(byte_address, byte_val);
+ mem_write_direct(byte_address, byte_val);
}
void
}
void
-mem
ory
_sfr_write8(unsigned long address, u_int8_t value)
+mem_sfr_write8(unsigned long address, u_int8_t value)
{
/* SFR registers are from addresses $80 to $FF. */
{
/* SFR registers are from addresses $80 to $FF. */
- mem
ory
_write8(INT_MEM_ID, address, value);
+ mem_write8(INT_MEM_ID, address, value);
}
void
}
void
-mem
ory
_sfr_write_dptr(u_int16_t value)
+mem_sfr_write_dptr(u_int16_t value)
{
{
- mem
ory
_write8(INT_MEM_ID, _DPTRHIGH_, value >> 8);
- mem
ory
_write8(INT_MEM_ID, _DPTRLOW_, (uint8_t) value);
+ mem_write8(INT_MEM_ID, _DPTRHIGH_, value >> 8);
+ mem_write8(INT_MEM_ID, _DPTRLOW_, (uint8_t) value);
}
u_int8_t
}
u_int8_t
-mem
ory
_read8(enum mem_id_t id, unsigned long address)
+mem_read8(enum mem_id_t id, unsigned long address)
{
if (address >= (unsigned long) mem_infos[id].max_size) {
log_err("Error reading from memory ID: %d\n"
{
if (address >= (unsigned long) mem_infos[id].max_size) {
log_err("Error reading from memory ID: %d\n"
@@
-182,51
+182,51
@@
memory_read8(enum mem_id_t id, unsigned long address)
/* Read with a direct addressing mode at Address */
unsigned char
/* Read with a direct addressing mode at Address */
unsigned char
-mem
ory
_read_direct(unsigned int address)
+mem_read_direct(unsigned int address)
{
if (address > 0xFF)
{
if (address > 0xFF)
- return mem
ory
_read8(EXT_MEM_ID, address);
+ return mem_read8(EXT_MEM_ID, address);
else
else
- return mem
ory
_read8(INT_MEM_ID, address);
+ return mem_read8(INT_MEM_ID, address);
}
/* Read with a indirect addressing mode at Address */
unsigned char
}
/* Read with a indirect addressing mode at Address */
unsigned char
-mem
ory
_read_indirect(unsigned int address)
+mem_read_indirect(unsigned int address)
{
if (address > 0x7F)
{
if (address > 0x7F)
- return mem
ory
_read8(EXT_MEM_ID, address);
+ return mem_read8(EXT_MEM_ID, address);
else
else
- return mem
ory
_read8(INT_MEM_ID, address);
+ return mem_read8(INT_MEM_ID, address);
}
/* Read with a bit addressing mode at bit_address */
unsigned char
}
/* Read with a bit addressing mode at bit_address */
unsigned char
-mem
ory
_read_bit(uint8_t bit_address)
+mem_read_bit(uint8_t bit_address)
{
uint8_t byte_address;
uint8_t bit_number;
unsigned char bit_value;
{
uint8_t byte_address;
uint8_t bit_number;
unsigned char bit_value;
- mem
ory
_convert_bit_address(bit_address, &byte_address, &bit_number);
+ mem_convert_bit_address(bit_address, &byte_address, &bit_number);
- bit_value = (mem
ory
_read_direct(byte_address) >> bit_number);
+ bit_value = (mem_read_direct(byte_address) >> bit_number);
bit_value &= 1;
return bit_value;
}
u_int8_t
bit_value &= 1;
return bit_value;
}
u_int8_t
-mem
ory
_sfr_read8(unsigned long address)
+mem_sfr_read8(unsigned long address)
{
/* SFR registers are from addresses $80 to $FF. */
{
/* SFR registers are from addresses $80 to $FF. */
- return mem
ory
_read8(INT_MEM_ID, address);
+ return mem_read8(INT_MEM_ID, address);
}
u_int16_t
}
u_int16_t
-mem
ory
_sfr_read_dptr(void)
+mem_sfr_read_dptr(void)
{
{
- return (mem
ory
_read8(INT_MEM_ID, _DPTRHIGH_) << 8) +
- mem
ory
_read8(INT_MEM_ID, _DPTRLOW_);
+ return (mem_read8(INT_MEM_ID, _DPTRHIGH_) << 8) +
+ mem_read8(INT_MEM_ID, _DPTRLOW_);
}
void
}
void
@@
-234,10
+234,10
@@
stack_push8(uint8_t value)
{
uint8_t sp;
{
uint8_t sp;
- sp = mem
ory
_read8(INT_MEM_ID, _SP_);
+ sp = mem_read8(INT_MEM_ID, _SP_);
- mem
ory
_write8(INT_MEM_ID, ++sp, value);
- mem
ory
_write8(INT_MEM_ID, _SP_, sp); /* Save new stack pointer */
+ mem_write8(INT_MEM_ID, ++sp, value);
+ mem_write8(INT_MEM_ID, _SP_, sp); /* Save new stack pointer */
}
void
}
void
@@
-245,11
+245,11
@@
stack_push16(uint16_t value)
{
uint8_t sp;
{
uint8_t sp;
- sp = mem
ory
_read8(INT_MEM_ID, _SP_);
+ sp = mem_read8(INT_MEM_ID, _SP_);
- mem
ory
_write8(INT_MEM_ID, ++sp, (uint8_t) value); /* Write LSB */
- mem
ory
_write8(INT_MEM_ID, ++sp, value >> 8); /* Write MSB */
- mem
ory
_write8(INT_MEM_ID, _SP_, sp); /* Save new stack pointer */
+ mem_write8(INT_MEM_ID, ++sp, (uint8_t) value); /* Write LSB */
+ mem_write8(INT_MEM_ID, ++sp, value >> 8); /* Write MSB */
+ mem_write8(INT_MEM_ID, _SP_, sp); /* Save new stack pointer */
}
uint8_t
}
uint8_t
@@
-258,10
+258,10
@@
stack_pop8(void)
uint8_t sp;
uint8_t value;
uint8_t sp;
uint8_t value;
- sp = mem
ory
_read8(INT_MEM_ID, _SP_);
+ sp = mem_read8(INT_MEM_ID, _SP_);
- value = mem
ory
_read8(INT_MEM_ID, sp--);
- mem
ory
_write8(INT_MEM_ID, _SP_, sp); /* Save new stack pointer */
+ value = mem_read8(INT_MEM_ID, sp--);
+ mem_write8(INT_MEM_ID, _SP_, sp); /* Save new stack pointer */
return value;
}
return value;
}
@@
-272,11
+272,11
@@
stack_pop16(void)
uint8_t sp;
uint16_t value;
uint8_t sp;
uint16_t value;
- sp = mem
ory
_read8(INT_MEM_ID, _SP_);
+ sp = mem_read8(INT_MEM_ID, _SP_);
- value = mem
ory
_read8(INT_MEM_ID, sp--) << 8; /* Read MSB */
- value |= mem
ory
_read8(INT_MEM_ID, sp--); /* Read LSB */
- mem
ory
_write8(INT_MEM_ID, _SP_, sp); /* Save new stack pointer */
+ value = mem_read8(INT_MEM_ID, sp--) << 8; /* Read MSB */
+ value |= mem_read8(INT_MEM_ID, sp--); /* Read LSB */
+ mem_write8(INT_MEM_ID, _SP_, sp); /* Save new stack pointer */
return value;
}
return value;
}
@@
-287,15
+287,15
@@
pgm_read_addr16(uint16_t base)
{
uint16_t addr;
{
uint16_t addr;
- addr = mem
ory
_read8(PGM_MEM_ID, base) << 8; /* MSB */
- addr |= mem
ory
_read8(PGM_MEM_ID, base + 1); /* LSB */
+ addr = mem_read8(PGM_MEM_ID, base) << 8; /* MSB */
+ addr |= mem_read8(PGM_MEM_ID, base + 1); /* LSB */
return addr;
}
/* Dump memory */
void
return addr;
}
/* Dump memory */
void
-mem
ory_dump(unsigned int address, int size, int memory_
id)
+mem
_dump(unsigned int address, int size, enum mem_id_t
id)
{
int rc;
int offset, col;
{
int rc;
int offset, col;
@@
-306,11
+306,11
@@
memory_dump(unsigned int address, int size, int memory_id)
}
/* Validate start address. */
}
/* Validate start address. */
- rc = mem
ory_check_address(memory_
id, address, DISPLAY_ERROR_YES);
+ rc = mem
_check_address(
id, address, DISPLAY_ERROR_YES);
if (!rc) {
/* Validate end address. */
if (!rc) {
/* Validate end address. */
- rc = mem
ory_check_address(memory_
id, address + (size - 1),
-
DISPLAY_ERROR_NO);
+ rc = mem
_check_address(
id, address + (size - 1),
+ DISPLAY_ERROR_NO);
if (!rc)
log_err("Trying to read beyond memory limit");
}
if (!rc)
log_err("Trying to read beyond memory limit");
}
@@
-324,8
+324,7
@@
memory_dump(unsigned int address, int size, int memory_id)
printf("%.4X ", address + offset);
for (col = 0; col < 16; col++) {
printf("%.4X ", address + offset);
for (col = 0; col < 16; col++) {
- data[col] = memory_read8(memory_id, address +
- offset + col);
+ data[col] = mem_read8(id, address + offset + col);
printf(" %.2X", (int) data[col]);
}
printf(" ");
printf(" %.2X", (int) data[col]);
}
printf(" ");
diff --git
a/src/common/memory.h
b/src/common/memory.h
index
07cf5b3
..
60395a0
100644
(file)
--- a/
src/common/memory.h
+++ b/
src/common/memory.h
@@
-35,57
+35,56
@@
enum mem_id_t {
#define DISPLAY_ERROR_YES 1
void
#define DISPLAY_ERROR_YES 1
void
-mem
ory
_init(void);
+mem_init(void);
int
int
-memory_check_address(enum mem_id_t id, unsigned long address,
- int display_error);
+mem_check_address(enum mem_id_t id, unsigned long address, int display_error);
void
void
-mem
ory
_convert_bit_address(uint8_t bit_address, uint8_t *byte_address,
-
uint8_t *bit_number);
+mem_convert_bit_address(uint8_t bit_address, uint8_t *byte_address,
+ uint8_t *bit_number);
u_int8_t *
u_int8_t *
-mem
ory
_getbuf(enum mem_id_t id, unsigned long address);
+mem_getbuf(enum mem_id_t id, unsigned long address);
void
void
-mem
ory
_clear(enum mem_id_t id);
+mem_clear(enum mem_id_t id);
void
void
-mem
ory
_write8(enum mem_id_t id, unsigned long address, u_int8_t value);
+mem_write8(enum mem_id_t id, unsigned long address, u_int8_t value);
void
void
-mem
ory
_write_direct(unsigned int address, unsigned char value);
+mem_write_direct(unsigned int address, unsigned char value);
void
void
-mem
ory
_write_indirect(unsigned int address, unsigned char value);
+mem_write_indirect(unsigned int address, unsigned char value);
void
void
-mem
ory
_write_bit(uint8_t bit_address, uint8_t value);
+mem_write_bit(uint8_t bit_address, uint8_t value);
void
void
-mem
ory
_sfr_write8(unsigned long address, u_int8_t value);
+mem_sfr_write8(unsigned long address, u_int8_t value);
void
void
-mem
ory
_sfr_write_dptr(u_int16_t value);
+mem_sfr_write_dptr(u_int16_t value);
u_int8_t
u_int8_t
-mem
ory
_read8(enum mem_id_t id, unsigned long address);
+mem_read8(enum mem_id_t id, unsigned long address);
unsigned char
unsigned char
-mem
ory
_read_direct(unsigned int address);
+mem_read_direct(unsigned int address);
unsigned char
unsigned char
-mem
ory
_read_indirect(unsigned int address);
+mem_read_indirect(unsigned int address);
unsigned char
unsigned char
-mem
ory
_read_bit(uint8_t bit_address);
+mem_read_bit(uint8_t bit_address);
u_int8_t
u_int8_t
-mem
ory
_sfr_read8(unsigned long address);
+mem_sfr_read8(unsigned long address);
u_int16_t
u_int16_t
-mem
ory
_sfr_read_dptr(void);
+mem_sfr_read_dptr(void);
void
stack_push8(uint8_t value);
void
stack_push8(uint8_t value);
@@
-103,6
+102,6
@@
uint16_t
pgm_read_addr16(uint16_t base);
void
pgm_read_addr16(uint16_t base);
void
-mem
ory_dump(unsigned int address, int size, int memory_
id);
+mem
_dump(unsigned int address, int size, enum mem_id_t
id);
#endif /* MEMORY_H */
#endif /* MEMORY_H */
diff --git
a/src/common/opcode2c.pl
b/src/common/opcode2c.pl
index
5268785
..
23800cc
100755
(executable)
--- a/
src/common/opcode2c.pl
+++ b/
src/common/opcode2c.pl
@@
-248,18
+248,18
@@
for ($i = 0 ; $i < 256; $i++) {
if( $i == 0x85 ) {
# Cas particulier pour MOV direct,direct -> src et dest sont inverses dans la memoire
if( $i == 0x85 ) {
# Cas particulier pour MOV direct,direct -> src et dest sont inverses dans la memoire
- print INST_IMP " unsigned char srcaddr = mem
ory
_read8( PGM_MEM_ID, cpu8051.pc++ );\n";
- print INST_IMP " unsigned char source = mem
ory
_read_direct( srcaddr );\n";
- print INST_IMP " unsigned char destaddr = mem
ory
_read8( PGM_MEM_ID, cpu8051.pc++ );\n";
- print INST_IMP " unsigned char destination = mem
ory
_read_direct( destaddr );\n";
+ print INST_IMP " unsigned char srcaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ );\n";
+ print INST_IMP " unsigned char source = mem_read_direct( srcaddr );\n";
+ print INST_IMP " unsigned char destaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ );\n";
+ print INST_IMP " unsigned char destination = mem_read_direct( destaddr );\n";
print INST_IMP " destination = source;\n";
print INST_IMP " destination = source;\n";
- print INST_IMP " mem
ory
_write_direct( destaddr, destination );\n";
+ print INST_IMP " mem_write_direct( destaddr, destination );\n";
}
else {
if ($instargs[$i*4] > 0) {
$op_destination=$instargs[$i*4+1];
if ($op_destination == 0) { # addr11
}
else {
if ($instargs[$i*4] > 0) {
$op_destination=$instargs[$i*4+1];
if ($op_destination == 0) { # addr11
- cfw("unsigned int addr11 = ( ( mem
ory_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + memory
_read8( PGM_MEM_ID, cpu8051.pc );");
+ cfw("unsigned int addr11 = ( ( mem
_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + mem
_read8( PGM_MEM_ID, cpu8051.pc );");
cfw("cpu8051.pc++;");
}
if ($op_destination == 1) { # addr16
cfw("cpu8051.pc++;");
}
if ($op_destination == 1) { # addr16
@@
-267,155
+267,155
@@
for ($i = 0 ; $i < 256; $i++) {
cfw("cpu8051.pc += 2;");
}
if ($op_destination == 2) { # A
cfw("cpu8051.pc += 2;");
}
if ($op_destination == 2) { # A
- cfw("unsigned char destination = mem
ory
_read_direct( _ACC_ );");
+ cfw("unsigned char destination = mem_read_direct( _ACC_ );");
}
if ($op_destination == 3) { # direct
}
if ($op_destination == 3) { # direct
- cfw("unsigned char destaddr = mem
ory
_read8( PGM_MEM_ID, cpu8051.pc++ );");
- cfw("unsigned char destination = mem
ory
_read_direct( destaddr );");
+ cfw("unsigned char destaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ );");
+ cfw("unsigned char destination = mem_read_direct( destaddr );");
}
if ($op_destination == 4) { # @R0
}
if ($op_destination == 4) { # @R0
- cfw("unsigned char destination = mem
ory_read_indirect ( memory
_read_direct( BANKPSW + _R0_ ) );");
+ cfw("unsigned char destination = mem
_read_indirect ( mem
_read_direct( BANKPSW + _R0_ ) );");
}
if ($op_destination == 5) { # @R1
}
if ($op_destination == 5) { # @R1
- cfw("unsigned char destination = mem
ory_read_indirect ( memory
_read_direct( BANKPSW + _R1_ ) );");
+ cfw("unsigned char destination = mem
_read_indirect ( mem
_read_direct( BANKPSW + _R1_ ) );");
}
if ($op_destination == 6) { # R0
}
if ($op_destination == 6) { # R0
- cfw("unsigned char destination = mem
ory
_read_direct( BANKPSW + _R0_ );");
+ cfw("unsigned char destination = mem_read_direct( BANKPSW + _R0_ );");
}
if ($op_destination == 7) { # R1
}
if ($op_destination == 7) { # R1
- cfw("unsigned char destination = mem
ory
_read_direct( BANKPSW + _R1_ );");
+ cfw("unsigned char destination = mem_read_direct( BANKPSW + _R1_ );");
}
if ($op_destination == 8) { # R2
}
if ($op_destination == 8) { # R2
- cfw("unsigned char destination = mem
ory
_read_direct( BANKPSW + _R2_ );");
+ cfw("unsigned char destination = mem_read_direct( BANKPSW + _R2_ );");
}
if ($op_destination == 9) { # R3
}
if ($op_destination == 9) { # R3
- cfw("unsigned char destination = mem
ory
_read_direct( BANKPSW + _R3_ );");
+ cfw("unsigned char destination = mem_read_direct( BANKPSW + _R3_ );");
}
if ($op_destination == 10) { # R4
}
if ($op_destination == 10) { # R4
- cfw("unsigned char destination = mem
ory
_read_direct( BANKPSW + _R4_ );");
+ cfw("unsigned char destination = mem_read_direct( BANKPSW + _R4_ );");
}
if ($op_destination == 11) { # R5
}
if ($op_destination == 11) { # R5
- cfw("unsigned char destination = mem
ory
_read_direct( BANKPSW + _R5_ );");
+ cfw("unsigned char destination = mem_read_direct( BANKPSW + _R5_ );");
}
if ($op_destination == 12) { # R6
}
if ($op_destination == 12) { # R6
- cfw("unsigned char destination = mem
ory
_read_direct( BANKPSW + _R6_ );");
+ cfw("unsigned char destination = mem_read_direct( BANKPSW + _R6_ );");
}
if ($op_destination == 13) { # R7
}
if ($op_destination == 13) { # R7
- cfw("unsigned char destination = mem
ory
_read_direct( BANKPSW + _R7_ );");
+ cfw("unsigned char destination = mem_read_direct( BANKPSW + _R7_ );");
}
if ($op_destination == 14) { # bitaddr
}
if ($op_destination == 14) { # bitaddr
- cfw("unsigned char destination, dstbitaddr = mem
ory
_read8( PGM_MEM_ID, cpu8051.pc++ );");
- cfw("destination = mem
ory
_read_bit( dstbitaddr );");
+ cfw("unsigned char destination, dstbitaddr = mem_read8( PGM_MEM_ID, cpu8051.pc++ );");
+ cfw("destination = mem_read_bit( dstbitaddr );");
}
if ($op_destination == 15) { # reladdr
cfw("cpu8051.pc++;");
}
if ($op_destination == 15) { # reladdr
cfw("cpu8051.pc++;");
- cfw("unsigned int destination = ((char) mem
ory
_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc;");
+ cfw("unsigned int destination = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc;");
}
if ($op_destination == 16) { # #data
}
if ($op_destination == 16) { # #data
- cfw("unsigned char destination = mem
ory
_read8( PGM_MEM_ID, cpu8051.pc++ );");
+ cfw("unsigned char destination = mem_read8( PGM_MEM_ID, cpu8051.pc++ );");
}
if ($op_destination == 17) { # C
cfw("unsigned char destination = psw_read_cy();");
}
if ($op_destination == 18) { # @A+DPTR
}
if ($op_destination == 17) { # C
cfw("unsigned char destination = psw_read_cy();");
}
if ($op_destination == 18) { # @A+DPTR
- cfw("unsigned int destination = mem
ory_read_direct( _ACC_ ) + memory
_sfr_read_dptr();");
+ cfw("unsigned int destination = mem
_read_direct( _ACC_ ) + mem
_sfr_read_dptr();");
}
if ($op_destination == 20) { # AB
}
if ($op_destination == 20) { # AB
- cfw("unsigned char destination = mem
ory
_read_direct( _ACC_ );");
- cfw("unsigned char source = mem
ory
_read_direct( _B_ );");
+ cfw("unsigned char destination = mem_read_direct( _ACC_ );");
+ cfw("unsigned char source = mem_read_direct( _B_ );");
}
if ($op_destination == 21) { # DPTR
}
if ($op_destination == 21) { # DPTR
- cfw("unsigned int destination = mem
ory
_sfr_read_dptr();");
+ cfw("unsigned int destination = mem_sfr_read_dptr();");
}
if ($op_destination == 23) { # /bitaddr
}
if ($op_destination == 23) { # /bitaddr
- cfw("unsigned char destination, dstbitaddr = mem
ory
_read8( PGM_MEM_ID, (cpu8051.pc)++ );");
- cfw("destination = ( mem
ory
_read_bit( dstbitaddr ) ^ 1 );");
+ cfw("unsigned char destination, dstbitaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ );");
+ cfw("destination = ( mem_read_bit( dstbitaddr ) ^ 1 );");
}
if ($op_destination == 24) { # @DPTR
}
if ($op_destination == 24) { # @DPTR
- cfw("unsigned char destination = mem
ory_read_indirect(memory
_sfr_read_dptr());");
+ cfw("unsigned char destination = mem
_read_indirect(mem
_sfr_read_dptr());");
}
}
if ($instargs[$i*4] > 1) {
$op_source=$instargs[$i*4+2];
if ($op_source == 0) { # addr11
}
}
if ($instargs[$i*4] > 1) {
$op_source=$instargs[$i*4+2];
if ($op_source == 0) { # addr11
- cfw("unsigned int addr11 = ( ( mem
ory_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + memory
_read8( PGM_MEM_ID, (cpu8051.pc)++ );");
+ cfw("unsigned int addr11 = ( ( mem
_read8( PGM_MEM_ID, cpu8051.pc - 1 ) << 3 ) & 0xF00 ) + mem
_read8( PGM_MEM_ID, (cpu8051.pc)++ );");
}
if ($op_source == 1) { # addr16
cfw("uint16_t addr16 = pgm_read_addr16(cpu8051.pc);");
cfw("cpu8051.pc += 2;");
}
if ($op_source == 2) { # A
}
if ($op_source == 1) { # addr16
cfw("uint16_t addr16 = pgm_read_addr16(cpu8051.pc);");
cfw("cpu8051.pc += 2;");
}
if ($op_source == 2) { # A
- cfw("unsigned char source = mem
ory
_read_direct( _ACC_ );");
+ cfw("unsigned char source = mem_read_direct( _ACC_ );");
}
if ($op_source == 3) { # direct
}
if ($op_source == 3) { # direct
- cfw("unsigned char srcaddr = mem
ory
_read8( PGM_MEM_ID, (cpu8051.pc)++ );");
- cfw("unsigned char source = mem
ory
_read_direct( srcaddr );");
+ cfw("unsigned char srcaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ );");
+ cfw("unsigned char source = mem_read_direct( srcaddr );");
}
if ($op_source == 4) { # @R0
}
if ($op_source == 4) { # @R0
- cfw("unsigned char source = mem
ory_read_indirect ( memory
_read_direct( BANKPSW + _R0_ ) );");
+ cfw("unsigned char source = mem
_read_indirect ( mem
_read_direct( BANKPSW + _R0_ ) );");
}
if ($op_source == 5) { # @R1
}
if ($op_source == 5) { # @R1
- cfw("unsigned char source = mem
ory_read_indirect ( memory
_read_direct( BANKPSW + _R1_ ) );");
+ cfw("unsigned char source = mem
_read_indirect ( mem
_read_direct( BANKPSW + _R1_ ) );");
}
if ($op_source == 6) { # R0
}
if ($op_source == 6) { # R0
- cfw("unsigned char source = mem
ory
_read_direct( BANKPSW + _R0_ );");
+ cfw("unsigned char source = mem_read_direct( BANKPSW + _R0_ );");
}
if ($op_source == 7) { # R1
}
if ($op_source == 7) { # R1
- cfw("unsigned char source = mem
ory
_read_direct( BANKPSW + _R1_ );");
+ cfw("unsigned char source = mem_read_direct( BANKPSW + _R1_ );");
}
if ($op_source == 8) { # R2
}
if ($op_source == 8) { # R2
- cfw("unsigned char source = mem
ory
_read_direct( BANKPSW + _R2_ );");
+ cfw("unsigned char source = mem_read_direct( BANKPSW + _R2_ );");
}
if ($op_source == 9) { # R3
}
if ($op_source == 9) { # R3
- cfw("unsigned char source = mem
ory
_read_direct( BANKPSW + _R3_ );");
+ cfw("unsigned char source = mem_read_direct( BANKPSW + _R3_ );");
}
if ($op_source == 10) { # R4
}
if ($op_source == 10) { # R4
- cfw("unsigned char source = mem
ory
_read_direct( BANKPSW + _R4_ );");
+ cfw("unsigned char source = mem_read_direct( BANKPSW + _R4_ );");
}
if ($op_source == 11) { # R5
}
if ($op_source == 11) { # R5
- cfw("unsigned char source = mem
ory
_read_direct( BANKPSW + _R5_ );");
+ cfw("unsigned char source = mem_read_direct( BANKPSW + _R5_ );");
}
if ($op_source == 12) { # R6
}
if ($op_source == 12) { # R6
- cfw("unsigned char source = mem
ory
_read_direct( BANKPSW + _R6_ );");
+ cfw("unsigned char source = mem_read_direct( BANKPSW + _R6_ );");
}
if ($op_source == 13) { # R7
}
if ($op_source == 13) { # R7
- cfw("unsigned char source = mem
ory
_read_direct( BANKPSW + _R7_ );");
+ cfw("unsigned char source = mem_read_direct( BANKPSW + _R7_ );");
}
if ($op_source == 14) { # bitaddr
}
if ($op_source == 14) { # bitaddr
- cfw("unsigned char source, srcbitaddr = mem
ory
_read8( PGM_MEM_ID, (cpu8051.pc)++ );");
- cfw("source = mem
ory
_read_bit( srcbitaddr );");
+ cfw("unsigned char source, srcbitaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ );");
+ cfw("source = mem_read_bit( srcbitaddr );");
}
if ($op_source == 15) { # reladdr
cfw("(cpu8051.pc)++;");
}
if ($op_source == 15) { # reladdr
cfw("(cpu8051.pc)++;");
- cfw("unsigned int source = ((char) mem
ory
_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc;");
+ cfw("unsigned int source = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc - 1)) + cpu8051.pc;");
}
if ($op_source == 16) { # #data
}
if ($op_source == 16) { # #data
- cfw("unsigned char source = mem
ory
_read8( PGM_MEM_ID, (cpu8051.pc)++ );");
+ cfw("unsigned char source = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ );");
}
if ($op_source == 17) { # C
cfw("unsigned char source = psw_read_cy();");
}
if ($op_source == 18) { # @A+DPTR
}
if ($op_source == 17) { # C
cfw("unsigned char source = psw_read_cy();");
}
if ($op_source == 18) { # @A+DPTR
- cfw("unsigned char source = mem
ory_read8( PGM_MEM_ID, memory_read_direct( _ACC_ ) + memory
_sfr_read_dptr());");
+ cfw("unsigned char source = mem
_read8( PGM_MEM_ID, mem_read_direct( _ACC_ ) + mem
_sfr_read_dptr());");
}
if ($op_source == 19) { # @A+PC
}
if ($op_source == 19) { # @A+PC
- cfw("unsigned char source = mem
ory_read8( PGM_MEM_ID, memory
_read_direct( _ACC_ ) + ( ++cpu8051.pc ) );");
+ cfw("unsigned char source = mem
_read8( PGM_MEM_ID, mem
_read_direct( _ACC_ ) + ( ++cpu8051.pc ) );");
}
if ($op_source == 21) { # DPTR
}
if ($op_source == 21) { # DPTR
- cfw("unsigned int source = mem
ory
_sfr_read_dptr();");
+ cfw("unsigned int source = mem_sfr_read_dptr();");
}
if ($op_source == 22) { # #data16
cfw("uint16_t source = pgm_read_addr16(cpu8051.pc);");
cfw("cpu8051.pc += 2;");
}
if ($op_source == 23) { # /bitaddr
}
if ($op_source == 22) { # #data16
cfw("uint16_t source = pgm_read_addr16(cpu8051.pc);");
cfw("cpu8051.pc += 2;");
}
if ($op_source == 23) { # /bitaddr
- cfw("unsigned char source, srcbitaddr = mem
ory
_read8( PGM_MEM_ID, (cpu8051.pc)++ );");
- cfw("source = ( mem
ory
_read_bit( srcbitaddr ) ^ 1 );");
+ cfw("unsigned char source, srcbitaddr = mem_read8( PGM_MEM_ID, (cpu8051.pc)++ );");
+ cfw("source = ( mem_read_bit( srcbitaddr ) ^ 1 );");
}
if ($op_source == 24) { # @DPTR
}
if ($op_source == 24) { # @DPTR
- cfw("unsigned char source = mem
ory_read_indirect(memory
_sfr_read_dptr());");
+ cfw("unsigned char source = mem
_read_indirect(mem
_sfr_read_dptr());");
}
}
}
}
@@
-528,7
+528,7
@@
for ($i = 0 ; $i < 256; $i++) {
# JZ
if ($insttype[$i] == 22) {
# JZ
if ($insttype[$i] == 22) {
- cfw("if ( mem
ory
_read_direct( _ACC_ ) == 0 ) { cpu8051.pc = destination; }");
+ cfw("if ( mem_read_direct( _ACC_ ) == 0 ) { cpu8051.pc = destination; }");
}
# XRL
}
# XRL
@@
-538,7
+538,7
@@
for ($i = 0 ; $i < 256; $i++) {
# JNZ
if ($insttype[$i] == 24) {
# JNZ
if ($insttype[$i] == 24) {
- cfw("if ( mem
ory
_read_direct( _ACC_ ) != 0 ) { cpu8051.pc = destination; }");
+ cfw("if ( mem_read_direct( _ACC_ ) != 0 ) { cpu8051.pc = destination; }");
}
# JMP
}
# JMP
@@
-569,8
+569,8
@@
for ($i = 0 ; $i < 256; $i++) {
# If B is zero, the OV flag will be set indicating a
# division-by-zero error
cfw("if (source != 0) {");
# If B is zero, the OV flag will be set indicating a
# division-by-zero error
cfw("if (source != 0) {");
- cfw(" mem
ory
_write_direct(_ACC_, destination/source);");
- cfw(" mem
ory
_write_direct( _B_, destination%source);");
+ cfw(" mem_write_direct(_ACC_, destination/source);");
+ cfw(" mem_write_direct( _B_, destination%source);");
cfw(" psw_clr_ov();");
cfw("} else {");
cfw(" psw_set_ov();");
cfw(" psw_clr_ov();");
cfw("} else {");
cfw(" psw_set_ov();");
@@
-596,9
+596,9
@@
for ($i = 0 ; $i < 256; $i++) {
# A = destination
# B = source
cfw("psw_clr_cy();");
# A = destination
# B = source
cfw("psw_clr_cy();");
- cfw("mem
ory
_write_direct(_ACC_, destination * source);");
- cfw("mem
ory
_write_direct(_B_, (destination * source) / 0x100);");
- cfw("if (mem
ory
_read_direct(_B_) > 0)");
+ cfw("mem_write_direct(_ACC_, destination * source);");
+ cfw("mem_write_direct(_B_, (destination * source) / 0x100);");
+ cfw("if (mem_read_direct(_B_) > 0)");
cfw(" psw_set_ov();");
cfw("else");
cfw(" psw_clr_ov();");
cfw(" psw_set_ov();");
cfw("else");
cfw(" psw_clr_ov();");
@@
-612,7
+612,7
@@
for ($i = 0 ; $i < 256; $i++) {
# CJNE
if ($insttype[$i] == 34) {
# CJNE
if ($insttype[$i] == 34) {
- cfw("unsigned int reladdr = ((char) mem
ory
_read8(PGM_MEM_ID, cpu8051.pc)) + (cpu8051.pc + 1);");
+ cfw("unsigned int reladdr = ((char) mem_read8(PGM_MEM_ID, cpu8051.pc)) + (cpu8051.pc + 1);");
cfw("psw_clr_cy();");
cfw("if ( destination < source ) psw_set_cy();");
cfw("if ( destination != source ) cpu8051.pc = reladdr; else cpu8051.pc++;");
cfw("psw_clr_cy();");
cfw("if ( destination < source ) psw_set_cy();");
cfw("if ( destination != source ) cpu8051.pc = reladdr; else cpu8051.pc++;");
@@
-695,56
+695,56
@@
for ($i = 0 ; $i < 256; $i++) {
cfw("cpu8051.pc = addr16;");
}
if ($op_destination == 2) { # A
cfw("cpu8051.pc = addr16;");
}
if ($op_destination == 2) { # A
- cfw("mem
ory
_write_direct( _ACC_, destination );");
+ cfw("mem_write_direct( _ACC_, destination );");
}
if ($op_destination == 3) { # direct
}
if ($op_destination == 3) { # direct
- cfw("mem
ory
_write_direct( destaddr, destination );");
+ cfw("mem_write_direct( destaddr, destination );");
}
if ($op_destination == 4) { # @R0
}
if ($op_destination == 4) { # @R0
- cfw("mem
ory_write_indirect( memory
_read_direct( BANKPSW + _R0_ ), destination );");
+ cfw("mem
_write_indirect( mem
_read_direct( BANKPSW + _R0_ ), destination );");
}
if ($op_destination == 5) { # @R1
}
if ($op_destination == 5) { # @R1
- cfw("mem
ory_write_indirect( memory
_read_direct( BANKPSW + _R1_ ), destination );");
+ cfw("mem
_write_indirect( mem
_read_direct( BANKPSW + _R1_ ), destination );");
}
if ($op_destination == 6) { # R0
}
if ($op_destination == 6) { # R0
- cfw("mem
ory
_write_direct( BANKPSW + _R0_, destination );");
+ cfw("mem_write_direct( BANKPSW + _R0_, destination );");
}
if ($op_destination == 7) { # R1
}
if ($op_destination == 7) { # R1
- cfw("mem
ory
_write_direct( BANKPSW + _R1_, destination );");
+ cfw("mem_write_direct( BANKPSW + _R1_, destination );");
}
if ($op_destination == 8) { # R2
}
if ($op_destination == 8) { # R2
- cfw("mem
ory
_write_direct( BANKPSW + _R2_, destination );");
+ cfw("mem_write_direct( BANKPSW + _R2_, destination );");
}
if ($op_destination == 9) { # R3
}
if ($op_destination == 9) { # R3
- cfw("mem
ory
_write_direct( BANKPSW + _R3_, destination );");
+ cfw("mem_write_direct( BANKPSW + _R3_, destination );");
}
if ($op_destination == 10) { # R4
}
if ($op_destination == 10) { # R4
- cfw("mem
ory
_write_direct( BANKPSW + _R4_, destination );");
+ cfw("mem_write_direct( BANKPSW + _R4_, destination );");
}
if ($op_destination == 11) { # R5
}
if ($op_destination == 11) { # R5
- cfw("mem
ory
_write_direct( BANKPSW + _R5_, destination );");
+ cfw("mem_write_direct( BANKPSW + _R5_, destination );");
}
if ($op_destination == 12) { # R6
}
if ($op_destination == 12) { # R6
- cfw("mem
ory
_write_direct( BANKPSW + _R6_, destination );");
+ cfw("mem_write_direct( BANKPSW + _R6_, destination );");
}
if ($op_destination == 13) { # R7
}
if ($op_destination == 13) { # R7
- cfw("mem
ory
_write_direct( BANKPSW + _R7_, destination );");
+ cfw("mem_write_direct( BANKPSW + _R7_, destination );");
}
if ($op_destination == 14) { # bitaddr
}
if ($op_destination == 14) { # bitaddr
- cfw("mem
ory
_write_bit( dstbitaddr, destination );");
+ cfw("mem_write_bit( dstbitaddr, destination );");
}
if ($op_destination == 17) { # C
cfw("psw_write_cy(destination);");
}
if ($op_destination == 21) { # DPTR
}
if ($op_destination == 17) { # C
cfw("psw_write_cy(destination);");
}
if ($op_destination == 21) { # DPTR
- cfw("mem
ory
_sfr_write_dptr(destination);");
+ cfw("mem_sfr_write_dptr(destination);");
}
if ($op_destination == 23) { # /bitaddr
}
if ($op_destination == 23) { # /bitaddr
- cfw("mem
ory
_write_bit( dstbitaddr, destination );");
+ cfw("mem_write_bit( dstbitaddr, destination );");
}
if ($op_destination == 24) { # @DPTR
}
if ($op_destination == 24) { # @DPTR
- cfw("mem
ory_write_indirect(memory
_sfr_read_dptr(), destination);");
+ cfw("mem
_write_indirect(mem
_sfr_read_dptr(), destination);");
}
}
}
}
@@
-758,55
+758,55
@@
for ($i = 0 ; $i < 256; $i++) {
cfw("cpu8051.pc = addr16;");
}
if ($op_source == 2) { # A
cfw("cpu8051.pc = addr16;");
}
if ($op_source == 2) { # A
- cfw("mem
ory
_write_direct( _ACC_, source );");
+ cfw("mem_write_direct( _ACC_, source );");
}
if ($op_source == 3) { # direct
}
if ($op_source == 3) { # direct
- cfw("mem
ory
_write_direct( srcaddr, source );");
+ cfw("mem_write_direct( srcaddr, source );");
}
if ($op_source == 4) { # @R0
}
if ($op_source == 4) { # @R0
- cfw("mem
ory_write_indirect( memory
_read_direct( BANKPSW + _R0_ ), source );");
+ cfw("mem
_write_indirect( mem
_read_direct( BANKPSW + _R0_ ), source );");
}
if ($op_source == 5) { # @R1
}
if ($op_source == 5) { # @R1
- cfw("mem
ory_write_indirect( memory
_read_direct( BANKPSW + _R1_ ), source );");
+ cfw("mem
_write_indirect( mem
_read_direct( BANKPSW + _R1_ ), source );");
}
if ($op_source == 6) { # R0
}
if ($op_source == 6) { # R0
- cfw("mem
ory
_write_direct( BANKPSW + _R0_, source );");
+ cfw("mem_write_direct( BANKPSW + _R0_, source );");
}
if ($op_source == 7) { # R1
}
if ($op_source == 7) { # R1
- cfw("mem
ory
_write_direct( BANKPSW + _R1_, source );");
+ cfw("mem_write_direct( BANKPSW + _R1_, source );");
}
if ($op_source == 8) { # R2
}
if ($op_source == 8) { # R2
- cfw("mem
ory
_write_direct( BANKPSW + _R2_, source );");
+ cfw("mem_write_direct( BANKPSW + _R2_, source );");
}
if ($op_source == 9) { # R3
}
if ($op_source == 9) { # R3
- cfw("mem
ory
_write_direct( BANKPSW + _R3_, source );");
+ cfw("mem_write_direct( BANKPSW + _R3_, source );");
}
if ($op_source == 10) { # R4
}
if ($op_source == 10) { # R4
- cfw("mem
ory
_write_direct( BANKPSW + _R4_, source );");
+ cfw("mem_write_direct( BANKPSW + _R4_, source );");
}
if ($op_source == 11) { # R5
}
if ($op_source == 11) { # R5
- cfw("mem
ory
_write_direct( BANKPSW + _R5_, source );");
+ cfw("mem_write_direct( BANKPSW + _R5_, source );");
}
if ($op_source == 12) { # R6
}
if ($op_source == 12) { # R6
- cfw("mem
ory
_write_direct( BANKPSW + _R6_, source );");
+ cfw("mem_write_direct( BANKPSW + _R6_, source );");
}
if ($op_source == 13) { # R7
}
if ($op_source == 13) { # R7
- cfw("mem
ory
_write_direct( BANKPSW + _R7_, source );");
+ cfw("mem_write_direct( BANKPSW + _R7_, source );");
}
if ($op_source == 14) { # bitaddr
}
if ($op_source == 14) { # bitaddr
- cfw("mem
ory
_write_bit( srcbitaddr, source );");
+ cfw("mem_write_bit( srcbitaddr, source );");
}
if ($op_source == 17) { # C
cfw("psw_write_cy(source);");
}
if ($op_source == 21) { # DPTR
}
if ($op_source == 17) { # C
cfw("psw_write_cy(source);");
}
if ($op_source == 21) { # DPTR
- cfw("mem
ory
_sfr_write_dptr(source);");
+ cfw("mem_sfr_write_dptr(source);");
}
if ($op_source == 23) { # /bitaddr
}
if ($op_source == 23) { # /bitaddr
- cfw("mem
ory
_write_bit( srcbitaddr, source );");
+ cfw("mem_write_bit( srcbitaddr, source );");
}
if ($op_source == 24) { # @DPTR
}
if ($op_source == 24) { # @DPTR
- cfw("mem
ory_write_indirect(memory
_sfr_read_dptr(), source);");
+ cfw("mem
_write_indirect(mem
_sfr_read_dptr(), source);");
}
}
}
}
}
}
@@
-824,7
+824,7
@@
print INST_DEF " * instructions_8051.h\n";
write_header(INST_DEF);
print INST_DEF "#ifndef INSTRUCTIONS_8051_H\n";
print INST_DEF "#define INSTRUCTIONS_8051_H 1\n\n\n";
write_header(INST_DEF);
print INST_DEF "#ifndef INSTRUCTIONS_8051_H\n";
print INST_DEF "#define INSTRUCTIONS_8051_H 1\n\n\n";
-print INST_DEF "#define BANKPSW (mem
ory
_read_direct(_PSW_) & 0x18)\n\n";
+print INST_DEF "#define BANKPSW (mem_read_direct(_PSW_) & 0x18)\n\n";
print INST_DEF "typedef int (*OPCODE_FP)(void);\n\n\n";
for( $i=0; $i<256; $i++ ) {
print INST_DEF "int\n";
print INST_DEF "typedef int (*OPCODE_FP)(void);\n\n\n";
for( $i=0; $i<256; $i++ ) {
print INST_DEF "int\n";
diff --git
a/src/common/psw.c
b/src/common/psw.c
index
7ec3911
..
cee09f5
100644
(file)
--- a/
src/common/psw.c
+++ b/
src/common/psw.c
@@
-14,20
+14,20
@@
int
psw_read_bit(int bit)
{
int
psw_read_bit(int bit)
{
- return (mem
ory
_read8(INT_MEM_ID, _PSW_) >> bit) & 0x01;
+ return (mem_read8(INT_MEM_ID, _PSW_) >> bit) & 0x01;
}
void
psw_write_bit(int bit, int val)
{
}
void
psw_write_bit(int bit, int val)
{
- u_int8_t psw = mem
ory
_read8(INT_MEM_ID, _PSW_);
+ u_int8_t psw = mem_read8(INT_MEM_ID, _PSW_);
if (val)
psw |= (1 << bit); /* Set */
else
psw &= ~(1 << bit); /* Clear */
if (val)
psw |= (1 << bit); /* Set */
else
psw &= ~(1 << bit); /* Clear */
- mem
ory
_write8(INT_MEM_ID, _PSW_, psw); /* Save updated value */
+ mem_write8(INT_MEM_ID, _PSW_, psw); /* Save updated value */
}
/* Returns 0 or 1 */
}
/* Returns 0 or 1 */
@@
-114,7
+114,7
@@
void
psw_compute_parity_bit(void)
{
int parity = 0;
psw_compute_parity_bit(void)
{
int parity = 0;
- uint8_t acc = mem
ory
_read8(INT_MEM_ID, _ACC_);
+ uint8_t acc = mem_read8(INT_MEM_ID, _ACC_);
while (acc) {
parity = !parity;
while (acc) {
parity = !parity;
diff --git
a/src/common/sfr.c
b/src/common/sfr.c
index
0e609f9
..
5c78a80
100644
(file)
--- a/
src/common/sfr.c
+++ b/
src/common/sfr.c
@@
-43,22
+43,22
@@
regwin_write_pc(int param, int val)
static unsigned int
regwin_read_timer(int timer_low_addr)
{
static unsigned int
regwin_read_timer(int timer_low_addr)
{
- return (mem
ory
_sfr_read8(timer_low_addr + 2) << 8) |
- mem
ory
_sfr_read8(timer_low_addr);
+ return (mem_sfr_read8(timer_low_addr + 2) << 8) |
+ mem_sfr_read8(timer_low_addr);
}
static void
regwin_write_timer(int timer_low_addr, int val)
{
}
static void
regwin_write_timer(int timer_low_addr, int val)
{
- mem
ory
_sfr_write8(timer_low_addr + 2,
-
(u_int8_t) ((val & 0x0000FFFF) >> 8));
- mem
ory
_sfr_write8(timer_low_addr, (u_int8_t) val);
+ mem_sfr_write8(timer_low_addr + 2,
+ (u_int8_t) ((val & 0x0000FFFF) >> 8));
+ mem_sfr_write8(timer_low_addr, (u_int8_t) val);
}
static u_int8_t
regwin_read_bank_offset(void)
{
}
static u_int8_t
regwin_read_bank_offset(void)
{
- return mem
ory
_sfr_read8(_PSW_) & 0x18;
+ return mem_sfr_read8(_PSW_) & 0x18;
}
static unsigned int
}
static unsigned int
@@
-72,7
+72,7
@@
regwin_read_bank(int dummy)
static void
regwin_write_bank(int param, int bank_number)
{
static void
regwin_write_bank(int param, int bank_number)
{
- u_int8_t psw = mem
ory
_sfr_read8(_PSW_);
+ u_int8_t psw = mem_sfr_read8(_PSW_);
(void) param; /* Remove compiler warning about unused variable. */
(void) param; /* Remove compiler warning about unused variable. */
@@
-81,22
+81,22
@@
regwin_write_bank(int param, int bank_number)
bank_number = 0;
}
bank_number = 0;
}
- mem
ory
_sfr_write8(_PSW_, (psw & ~0x18) | (bank_number << 3));
+ mem_sfr_write8(_PSW_, (psw & ~0x18) | (bank_number << 3));
}
/* Indirect read of R0 - R7 in current bank from internal memory. */
static unsigned int
regwin_read_rx(int offset)
{
}
/* Indirect read of R0 - R7 in current bank from internal memory. */
static unsigned int
regwin_read_rx(int offset)
{
- return mem
ory
_read8(INT_MEM_ID, regwin_read_bank_offset() + offset);
+ return mem_read8(INT_MEM_ID, regwin_read_bank_offset() + offset);
}
/* Indirect write to R0 - R7 in current bank to internal memory. */
static void
regwin_write_rx(int offset, int val)
{
}
/* Indirect write to R0 - R7 in current bank to internal memory. */
static void
regwin_write_rx(int offset, int val)
{
- mem
ory
_write8(INT_MEM_ID, regwin_read_bank_offset() + offset,
-
(u_int8_t) val);
+ mem_write8(INT_MEM_ID, regwin_read_bank_offset() + offset,
+ (u_int8_t) val);
}
/* This array defines how to read value for each register. */
}
/* This array defines how to read value for each register. */
@@
-265,11
+265,11
@@
static unsigned int
regwin_read_generic(int addr, int width)
{
if (width == 2) {
regwin_read_generic(int addr, int width)
{
if (width == 2) {
- return mem
ory
_sfr_read8(addr);
+ return mem_sfr_read8(addr);
} else if (width == 4) {
/* Address is low address. */
} else if (width == 4) {
/* Address is low address. */
- return (mem
ory
_sfr_read8(addr + 1) << 8) |
- mem
ory
_sfr_read8(addr);
+ return (mem_sfr_read8(addr + 1) << 8) |
+ mem_sfr_read8(addr);
} else {
return 0xFFFFFFFF;
}
} else {
return 0xFFFFFFFF;
}
@@
-279,12
+279,11
@@
static void
regwin_write_generic(int addr, int val, int width)
{
if (width == 2) {
regwin_write_generic(int addr, int val, int width)
{
if (width == 2) {
- mem
ory
_sfr_write8(addr, (u_int8_t) val);
+ mem_sfr_write8(addr, (u_int8_t) val);
} else if (width == 4) {
/* Address is low address. */
} else if (width == 4) {
/* Address is low address. */
- memory_sfr_write8(addr + 1,
- (u_int8_t) ((val & 0x0000FFFF) >> 8));
- memory_sfr_write8(addr, (u_int8_t) val);
+ mem_sfr_write8(addr + 1, (u_int8_t) ((val & 0x0000FFFF) >> 8));
+ mem_sfr_write8(addr, (u_int8_t) val);
}
}
}
}
diff --git
a/src/common/timers.c
b/src/common/timers.c
index
53c2fb1
..
89eb42d
100644
(file)
--- a/
src/common/timers.c
+++ b/
src/common/timers.c
@@
-54,16
+54,16
@@
timer_increment_check_overflow(uint8_t counter_address, uint8_t tf_mask)
{
unsigned int tmp;
{
unsigned int tmp;
- tmp = mem
ory
_read_direct(counter_address);
+ tmp = mem_read_direct(counter_address);
tmp++;
tmp &= 0xFF;
if (tmp == 0) {
/* If overflow set TFx */
tmp++;
tmp &= 0xFF;
if (tmp == 0) {
/* If overflow set TFx */
- mem
ory
_write_direct(_TCON_,
-
memory
_read_direct(_TCON_) | tf_mask);
+ mem_write_direct(_TCON_,
+
mem
_read_direct(_TCON_) | tf_mask);
}
}
- mem
ory
_write_direct(counter_address, tmp); /* Save new value. */
+ mem_write_direct(counter_address, tmp); /* Save new value. */
}
static void
}
static void
@@
-72,11
+72,11
@@
timer_with_prescaler(uint8_t tl, uint8_t th, uint8_t tf_mask,
{
unsigned int prescaler;
{
unsigned int prescaler;
- prescaler = mem
ory
_read_direct(tl);
+ prescaler = mem_read_direct(tl);
prescaler++;
prescaler &= (1 << prescaler_width) - 1; /* Keep only required bits */
prescaler++;
prescaler &= (1 << prescaler_width) - 1; /* Keep only required bits */
- mem
ory
_write_direct(tl, prescaler);
+ mem_write_direct(tl, prescaler);
if (prescaler == 0)
timer_increment_check_overflow(th, tf_mask);
if (prescaler == 0)
timer_increment_check_overflow(th, tf_mask);
@@
-99,17
+99,17
@@
process_timer(uint8_t tl, uint8_t th, uint8_t tf_mask, uint8_t TR, uint8_t mode,
break;
case 2:
/* Mode 2, 8-bits counter with Auto-Reload */
break;
case 2:
/* Mode 2, 8-bits counter with Auto-Reload */
- tmp = mem
ory
_read_direct(tl);
+ tmp = mem_read_direct(tl);
tmp++;
tmp &= 0xFF;
if (tmp == 0) {
/* If overflow -> reload and set TF0 */
tmp++;
tmp &= 0xFF;
if (tmp == 0) {
/* If overflow -> reload and set TF0 */
- mem
ory
_write_direct(
+ mem_write_direct(
_TCON_,
_TCON_,
- mem
ory
_read_direct(_TCON_) | tf_mask);
- mem
ory_write_direct(tl, memory
_read_direct(th));
+ mem_read_direct(_TCON_) | tf_mask);
+ mem
_write_direct(tl, mem
_read_direct(th));
} else {
} else {
- mem
ory
_write_direct(tl, tmp);
+ mem_write_direct(tl, tmp);
}
break;
case 3:
}
break;
case 3:
@@
-126,7
+126,7
@@
process_timer(uint8_t tl, uint8_t th, uint8_t tf_mask, uint8_t TR, uint8_t mode,
timer_increment_check_overflow(tl, tf_mask);
/* TH0 uses TR1 et TF1. */
timer_increment_check_overflow(tl, tf_mask);
/* TH0 uses TR1 et TF1. */
- TR = mem
ory
_read_direct(_TCON_) & 0x40;
+ TR = mem_read_direct(_TCON_) & 0x40;
if (TR)
timer_increment_check_overflow(th, 0x80);
if (TR)
timer_increment_check_overflow(th, 0x80);
@@
-145,20
+145,20
@@
timers_check(void)
unsigned int timer_counter;
/* Timer 0 */
unsigned int timer_counter;
/* Timer 0 */
- tr = mem
ory
_read_direct(_TCON_) & 0x10;
- mode = mem
ory
_read_direct(_TMOD_) & 0x03;
- gate = mem
ory
_read_direct(_TMOD_) & 0x08;
- timer_counter = mem
ory
_read_direct(_TMOD_) & 0x04;
+ tr = mem_read_direct(_TCON_) & 0x10;
+ mode = mem_read_direct(_TMOD_) & 0x03;
+ gate = mem_read_direct(_TMOD_) & 0x08;
+ timer_counter = mem_read_direct(_TMOD_) & 0x04;
if ((tr && !gate && !timer_counter) || (mode == 3))
process_timer(_TL0_, _TH0_, 0x20, tr, mode, gate,
timer_counter);
/* Timer 1 */
if ((tr && !gate && !timer_counter) || (mode == 3))
process_timer(_TL0_, _TH0_, 0x20, tr, mode, gate,
timer_counter);
/* Timer 1 */
- tr = mem
ory
_read_direct(_TCON_) & 0x40;
- mode = (mem
ory
_read_direct(_TMOD_) & 0x30) >> 4;
- gate = mem
ory
_read_direct(_TMOD_) & 0x80;
- timer_counter = mem
ory
_read_direct(_TMOD_) & 0x40;
+ tr = mem_read_direct(_TCON_) & 0x40;
+ mode = (mem_read_direct(_TMOD_) & 0x30) >> 4;
+ gate = mem_read_direct(_TMOD_) & 0x80;
+ timer_counter = mem_read_direct(_TMOD_) & 0x40;
if (tr && !gate && !timer_counter)
process_timer(_TL1_, _TH1_, 0x80, tr, mode, gate,
if (tr && !gate && !timer_counter)
process_timer(_TL1_, _TH1_, 0x80, tr, mode, gate,
diff --git
a/src/gtk/memwin.c
b/src/gtk/memwin.c
index
9f8abd2
..
bced9e6
100644
(file)
--- a/
src/gtk/memwin.c
+++ b/
src/gtk/memwin.c
@@
-78,7
+78,7
@@
memwin_cell_edited(GtkCellRendererText *cell, gchar *path_string,
gchar *new_str, gpointer model)
{
guint column;
gchar *new_str, gpointer model)
{
guint column;
-
guin
t memory_id;
+
enum mem_id_
t memory_id;
gpointer columnptr;
gpointer memory_id_ptr;
GtkTreeIter iter;
gpointer columnptr;
gpointer memory_id_ptr;
GtkTreeIter iter;
@@
-107,7
+107,7
@@
memwin_cell_edited(GtkCellRendererText *cell, gchar *path_string,
/* Convert column number (1, 2, 3...) to index (0, 1, 2...) */
address += (column - COL_DATA0);
/* Convert column number (1, 2, 3...) to index (0, 1, 2...) */
address += (column - COL_DATA0);
- old = mem
ory
_read8(memory_id, address);
+ old = mem_read8(memory_id, address);
log_info("Address: $%02X", address);
log_info(" old value: $%02X", old);
log_info("Address: $%02X", address);
log_info(" old value: $%02X", old);
@@
-122,7
+122,7
@@
memwin_cell_edited(GtkCellRendererText *cell, gchar *path_string,
}
/* Store new value in emulator memory. */
}
/* Store new value in emulator memory. */
- mem
ory
_write8(memory_id, address, new);
+ mem_write8(memory_id, address, new);
/* Convert to text. */
int2asciihex(new, str, 2);
/* Convert to text. */
int2asciihex(new, str, 2);
@@
-138,7
+138,7
@@
memwin_cell_edited(GtkCellRendererText *cell, gchar *path_string,
};
static void
};
static void
-memwin_init_columns(GtkWidget *listview,
in
t memory_id)
+memwin_init_columns(GtkWidget *listview,
enum mem_id_
t memory_id)
{
int i;
GtkCellRenderer *renderer;
{
int i;
GtkCellRenderer *renderer;
@@
-196,7
+196,7
@@
memwin_init_columns(GtkWidget *listview, int memory_id)
}
static void
}
static void
-memwin_infos_select(
in
t memory_id)
+memwin_infos_select(
enum mem_id_
t memory_id)
{
if (memory_id == INT_MEM_ID) {
log_debug("memory ID = INTERNAL");
{
if (memory_id == INT_MEM_ID) {
log_debug("memory ID = INTERNAL");
@@
-228,7
+228,7
@@
compute_data_rows(int memory_id)
}
GtkWidget *
}
GtkWidget *
-memwin_init(char *title,
in
t memory_id)
+memwin_init(char *title,
enum mem_id_
t memory_id)
{
GtkWidget *frame;
GtkWidget *scrollwin;
{
GtkWidget *frame;
GtkWidget *scrollwin;
@@
-283,13
+283,13
@@
memwin_init(char *title, int memory_id)
* rows which have been modified.
*/
static int
* rows which have been modified.
*/
static int
-memwin_row_changed(
in
t memory_id, int row, unsigned int address)
+memwin_row_changed(
enum mem_id_
t memory_id, int row, unsigned int address)
{
int row_changed;
u_int32_t crc_new = 0;
u_int8_t *buf8;
{
int row_changed;
u_int32_t crc_new = 0;
u_int8_t *buf8;
- buf8 = mem
ory
_getbuf(memory_id, address);
+ buf8 = mem_getbuf(memory_id, address);
crc_new = crc32(0L, Z_NULL, 0);
crc_new = crc32(crc_new, buf8, cfg->bytes_per_row);
crc_new = crc32(0L, Z_NULL, 0);
crc_new = crc32(crc_new, buf8, cfg->bytes_per_row);
@@
-307,7
+307,7
@@
memwin_row_changed(int memory_id, int row, unsigned int address)
/* Dump internal or external memory. */
void
/* Dump internal or external memory. */
void
-memwin_refresh(
in
t memory_id)
+memwin_refresh(
enum mem_id_
t memory_id)
{
int row;
unsigned int address = 0;
{
int row;
unsigned int address = 0;
@@
-353,7
+353,7
@@
memwin_refresh(int memory_id)
for (col = 0; col < cfg->bytes_per_row; col++) {
u_int8_t data;
for (col = 0; col < cfg->bytes_per_row; col++) {
u_int8_t data;
- data = mem
ory
_read8(memory_id, address + col);
+ data = mem_read8(memory_id, address + col);
/* Display hex data */
int2asciihex(data, str, 2);
/* Display hex data */
int2asciihex(data, str, 2);
diff --git
a/src/gtk/memwin.h
b/src/gtk/memwin.h
index
d8ad7e4
..
b1f4217
100644
(file)
--- a/
src/gtk/memwin.h
+++ b/
src/gtk/memwin.h
@@
-13,9
+13,9
@@
#include <gtk/gtk.h>
GtkWidget *
#include <gtk/gtk.h>
GtkWidget *
-memwin_init(char *title,
in
t memory_id);
+memwin_init(char *title,
enum mem_id_
t memory_id);
void
void
-memwin_refresh(
in
t memory_id);
+memwin_refresh(
enum mem_id_
t memory_id);
#endif /* MEMWIN_H */
#endif /* MEMWIN_H */
diff --git
a/src/gtk/pgmwin.c
b/src/gtk/pgmwin.c
index
2bd00d9
..
6cec8fb
100644
(file)
--- a/
src/gtk/pgmwin.c
+++ b/
src/gtk/pgmwin.c
@@
-261,14
+261,14
@@
pgmwin_refresh(void)
int2asciihex(address, str, 4);
gtk_list_store_set(store, &iter, COL_ADDR, str, -1);
int2asciihex(address, str, 4);
gtk_list_store_set(store, &iter, COL_ADDR, str, -1);
- opcode = mem
ory
_read8(PGM_MEM_ID, address);
+ opcode = mem_read8(PGM_MEM_ID, address);
inst_size = cpu8051_get_instruction_size(opcode);
/* Display instruction hex bytes. */
for (k = 0, col_id = COL_B0; k < 3; k++, col_id++) {
if (k < inst_size)
inst_size = cpu8051_get_instruction_size(opcode);
/* Display instruction hex bytes. */
for (k = 0, col_id = COL_B0; k < 3; k++, col_id++) {
if (k < inst_size)
- int2asciihex(mem
ory
_read8(PGM_MEM_ID,
-
address + k),
+ int2asciihex(mem_read8(PGM_MEM_ID,
+ address + k),
str, 2);
else
str[0] = '\0';
str, 2);
else
str[0] = '\0';