X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=src%2Fmemory.h;h=9064813d480296c592a8722dafce853c63c1c043;hb=add152ddb851575c885208c12b008887e68b9f48;hp=039fb3f944d56bdfbcf75305c1606193e7039fe9;hpb=4c305c73f8110d03b99cec045b3c5741867fd46b;p=emu8051.git diff --git a/src/memory.h b/src/memory.h index 039fb3f..9064813 100644 --- a/src/memory.h +++ b/src/memory.h @@ -1,26 +1,67 @@ -/* memory.h */ - +/* + * memory.h + * + * 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. + */ #ifndef MEMORY_H #define MEMORY_H 1 - #include +#define PGM_MEM_MAX_SIZE 65536 +/* + * Direct addressing $00 to $7F = IRAM (8051) + * Direct addressing $80 to $FF = SFR (8051) + * Indirect addressing $80 to $FF = IRAM (8052) + */ +#define INT_MEM_MAX_SIZE 256 +#define EXT_MEM_MAX_SIZE 65536 + +#define PGM_MEM_DEFAULT_SIZE 8192 +#define EXT_MEM_DEFAULT_SIZE 1024 -enum { - SFR_MEM_ID, - PGM_MEM_ID, - INT_MEM_ID, - EXT_MEM_ID +enum mem_id_t { + PGM_MEM_ID, + INT_MEM_ID, + EXT_MEM_ID, + MEM_ID_COUNT }; +void +memory_init(void); + +void +memory_clear(enum mem_id_t id); void -memory_write8( int memory_id, unsigned long address, u_int8_t value ); +memory_write8(enum mem_id_t id, unsigned long address, u_int8_t value); + +void +memory_sfr_write8(unsigned long address, u_int8_t value); u_int8_t -memory_read8( int memory_id, unsigned long address ); +memory_read8(enum mem_id_t id, unsigned long address); +u_int8_t +memory_sfr_read8(unsigned long address); + +void +DumpMem(char *Address, char *Asize, int memory_id); #endif /* MEMORY_H */