X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=src%2Fcommon%2Fmemory.h;h=2a15cc9ddf4e80a22b6b84f2473c957bcac9a2a2;hb=9cd867c94aabb48f44658a7a4d6832115c876b74;hp=cbb9eb8656e00254af1f8b1919352f1d5ccb413d;hpb=c7d14532b034286e990bc28c994fa20b23aca95a;p=emu8051.git diff --git a/src/common/memory.h b/src/common/memory.h index cbb9eb8..2a15cc9 100644 --- a/src/common/memory.h +++ b/src/common/memory.h @@ -4,25 +4,13 @@ * Copyright (C) 1999 Jonathan St-André * Copyright (C) 1999 Hugo Villeneuve * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + * This file is released under the GPLv2 */ #ifndef MEMORY_H #define MEMORY_H 1 -#include +#include #define PGM_MEM_MAX_SIZE 65536 /* @@ -43,32 +31,60 @@ enum mem_id_t { MEM_ID_COUNT }; +#define DISPLAY_ERROR_NO 0 +#define DISPLAY_ERROR_YES 1 + +void +mem_init(void); + +int +mem_check_address(enum mem_id_t id, unsigned long address, int display_error); + +void +mem_convert_bit_address(uint8_t bit_address, uint8_t *byte_address, + uint8_t *bit_number); + +uint8_t * +mem_getbuf(enum mem_id_t id, unsigned long address); + void -memory_init(void); +mem_clear(enum mem_id_t id); -u_int8_t * -memory_getbuf(enum mem_id_t id, unsigned long address); +void +mem_write8(enum mem_id_t id, unsigned long address, uint8_t value); + +void +mem_write_direct(unsigned int address, unsigned char value); void -memory_clear(enum mem_id_t id); +mem_write_indirect(unsigned int address, unsigned char value); void -memory_write8(enum mem_id_t id, unsigned long address, u_int8_t value); +mem_write_bit(uint8_t bit_address, uint8_t value); void -memory_sfr_write8(unsigned long address, u_int8_t value); +mem_sfr_write8(unsigned long address, uint8_t value); void -memory_sfr_write_dptr(u_int16_t value); +mem_sfr_write_dptr(uint16_t value); + +uint8_t +mem_read8(enum mem_id_t id, unsigned long address); -u_int8_t -memory_read8(enum mem_id_t id, unsigned long address); +unsigned char +mem_read_direct(unsigned int address); -u_int8_t -memory_sfr_read8(unsigned long address); +unsigned char +mem_read_indirect(unsigned int address); -u_int16_t -memory_sfr_read_dptr(void); +unsigned char +mem_read_bit(uint8_t bit_address); + +uint8_t +mem_sfr_read8(unsigned long address); + +uint16_t +mem_sfr_read_dptr(void); void stack_push8(uint8_t value); @@ -86,6 +102,6 @@ uint16_t pgm_read_addr16(uint16_t base); void -DumpMem(unsigned int address, int size, int memory_id); +mem_dump(unsigned int address, int size, enum mem_id_t id); #endif /* MEMORY_H */