Move memory read functions to memory.c
[emu8051.git] / src / common / memory.h
index fee41a6..07cf5b3 100644 (file)
@@ -4,19 +4,7 @@
  * Copyright (C) 1999 Jonathan St-AndrĂ©
  * Copyright (C) 1999 Hugo Villeneuve <hugo@hugovil.com>
  *
- * 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
@@ -33,8 +21,8 @@
 #define INT_MEM_MAX_SIZE   256
 #define EXT_MEM_MAX_SIZE 65536
 
-#define PGM_MEM_DEFAULT_SIZE 8192
-#define EXT_MEM_DEFAULT_SIZE 1024
+#define PGM_MEM_DEFAULT_SIZE PGM_MEM_MAX_SIZE
+#define EXT_MEM_DEFAULT_SIZE 256
 
 enum mem_id_t {
        PGM_MEM_ID,
@@ -43,15 +31,38 @@ enum mem_id_t {
        MEM_ID_COUNT
 };
 
+#define DISPLAY_ERROR_NO  0
+#define DISPLAY_ERROR_YES 1
+
 void
 memory_init(void);
 
+int
+memory_check_address(enum mem_id_t id, unsigned long address,
+                    int display_error);
+
+void
+memory_convert_bit_address(uint8_t bit_address, uint8_t *byte_address,
+                          uint8_t *bit_number);
+
+u_int8_t *
+memory_getbuf(enum mem_id_t id, unsigned long address);
+
 void
 memory_clear(enum mem_id_t id);
 
 void
 memory_write8(enum mem_id_t id, unsigned long address, u_int8_t value);
 
+void
+memory_write_direct(unsigned int address, unsigned char value);
+
+void
+memory_write_indirect(unsigned int address, unsigned char value);
+
+void
+memory_write_bit(uint8_t bit_address, uint8_t value);
+
 void
 memory_sfr_write8(unsigned long address, u_int8_t value);
 
@@ -61,6 +72,15 @@ memory_sfr_write_dptr(u_int16_t value);
 u_int8_t
 memory_read8(enum mem_id_t id, unsigned long address);
 
+unsigned char
+memory_read_direct(unsigned int address);
+
+unsigned char
+memory_read_indirect(unsigned int address);
+
+unsigned char
+memory_read_bit(uint8_t bit_address);
+
 u_int8_t
 memory_sfr_read8(unsigned long address);
 
@@ -83,6 +103,6 @@ uint16_t
 pgm_read_addr16(uint16_t base);
 
 void
-DumpMem(char *Address, char *Asize, int memory_id);
+memory_dump(unsigned int address, int size, int memory_id);
 
 #endif /* MEMORY_H */