-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmemoryfile.h
More file actions
32 lines (25 loc) · 824 Bytes
/
Copy pathmemoryfile.h
File metadata and controls
32 lines (25 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
* memoryfile.h
*
* Created on: Nov 23, 2019
* Author: cburke
*/
#ifndef MEMORYFILE_H_
#define MEMORYFILE_H_
typedef struct MemoryFile {
unsigned abs_base; // Absolute base address of module (or 0x0000)
unsigned char *storage;
unsigned char *end; // Last byte of storage
int length;
} MemoryFile;
// Initialize a memory file
void mf_init(MemoryFile* file, int fileSize, char *id);
void mf_set_base(MemoryFile* file, unsigned base);
int mf_get_byte(MemoryFile* file, int offset);
int mf_get_word(MemoryFile* file, int offset);
long mf_get_dword(MemoryFile* file, int offset);
int mf_get_abs_word(MemoryFile* file, int address);
int mf_get_abs_byte(MemoryFile* file, int address);
long mf_get_abs_dword(MemoryFile* file, int address);
int mf_checksum(MemoryFile* file);
#endif /* MEMORYFILE_H_ */