diff options
| author | Astrid Smith | 2011-10-20 22:30:28 -0700 |
|---|---|---|
| committer | Astrid Smith | 2011-10-20 22:30:28 -0700 |
| commit | c2b16e5e27c250b7eab9de0a65ec4da585bff06a (patch) | |
| tree | 0ab3d11f6f8f59f60fbbce525e658c309ac5e831 | |
| parent | f7e1599919eeabb8abf6f3402a0626300df5d4e7 (diff) | |
Loader
| -rw-r--r-- | flags.asm | 2 | ||||
| -rw-r--r-- | loader.c | 40 |
2 files changed, 42 insertions, 0 deletions
@@ -283,6 +283,8 @@ lut_ccr: ;; 256-byte LUT for the Parity bit. ;; Keep this last so all storage references require only one ;; extension word. + ;; + ;; This table taken from another z80 emulator lut_parity: dc.b 4,0,0,4,0,4,4,0,0,4,4,0,4,0,0,4 dc.b 0,4,4,0,4,0,0,4,4,0,0,4,0,4,4,0 @@ -78,6 +78,46 @@ void init_load(void) } +/* Loads an image file into the emulator, restoring state. + */ +void load_descriptor(char *folder, char *descriptor) +{ + +} + +/* Load a page into the emulator's data structures. Only stores a + * pointer to it; does not copy due to space constraints. + * + * ROM pages can (and should) be archived, but RAM pages must be + * unarchived. + */ +void load_page(int pageno, WORD *pptr) +{ + /* check the version */ + if (*pptr != IMG_MAGIC) + ER_throw(ER_DATATYPE); + + pptr++; + + /* check the size */ + if (*pptr != 0x4000) + ER_throw(ER_INVALID_BLOCK_STRUCTURE); + + pptr++; + + if (*pptr != (WORD)pageno) + ER_throw(ER_INVALID_LABEL); + + pptr++; + + if (*pptr != (WORD)c_TI83P) + ER_throw(ILLEGAL_TAG_ERROR); + + pptr++; + + pages[pageno] = pptr; +} + void unload(void) { return; |
