X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=src%2Fmemory.h;h=c8761e9f0028ddf0423173dcd40fbbb270584ba5;hb=82819ebb72819f4a39c5a9aa95fbb2cef22d510f;hp=9b8fa047069a861bc1ecf4fd83bd837d2f5c9576;hpb=fc4dd8fa3aab94a5f63c097ed9809c75560abd7d;p=emu8051.git diff --git a/src/memory.h b/src/memory.h index 9b8fa04..c8761e9 100644 --- a/src/memory.h +++ b/src/memory.h @@ -22,23 +22,64 @@ #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(enum mem_id_t id, unsigned long address, u_int8_t value); + +void +memory_sfr_write8(unsigned long address, u_int8_t value); void -memory_write8( int memory_id, unsigned long address, u_int8_t value ); +memory_sfr_write_dptr(u_int16_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); + +u_int16_t +memory_sfr_read_dptr(void); + +void +stack_push8(uint8_t value); + +void +stack_push16(uint16_t value); + +uint8_t +stack_pop8(void); + +uint16_t +stack_pop16(void); + +void +DumpMem(char *Address, char *Asize, int memory_id); #endif /* MEMORY_H */