From c2b16e5e27c250b7eab9de0a65ec4da585bff06a Mon Sep 17 00:00:00 2001 From: Astrid Smith Date: Thu, 20 Oct 2011 22:30:28 -0700 Subject: Loader --- loader.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'loader.c') diff --git a/loader.c b/loader.c index b445474..0ad58d4 100644 --- a/loader.c +++ b/loader.c @@ -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; -- cgit v1.2.3