summaryrefslogtreecommitdiff
path: root/luma/src/luma_ldRom.c
diff options
context:
space:
mode:
Diffstat (limited to 'luma/src/luma_ldRom.c')
-rw-r--r--luma/src/luma_ldRom.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/luma/src/luma_ldRom.c b/luma/src/luma_ldRom.c
new file mode 100644
index 0000000..8a93cda
--- /dev/null
+++ b/luma/src/luma_ldRom.c
@@ -0,0 +1,32 @@
+/*
+ Copyright 2021, 2022 Gabriel Jensen
+
+ This file is part of luma.
+
+ luma is free software: you can redistribute it and/or modify it under the
+ terms of the GNU Affero General Public License as published by the Free
+ Software Foundation, either version 3 of the License, or (at your
+ option) any later version.
+
+ luma 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 Affero General Public License
+ along with luma. If not, see <https://www.gnu.org/licenses/>.
+*/
+
+#include "luma.h"
+
+#include <inttypes.h>
+#include <stdio.h>
+
+void luma_ldRom(char const * const restrict _file,luma_byte const _num,luma_ptr const _addr) {
+ (void)_num;
+ luma_log("Loading bank %" PRIX8 " of ROM file \"%s\" into address space at %" PRIX16 "\n",_num,_file,_addr);
+ FILE * file = fopen(_file,"r");
+ void * const buf = luma_mem + _addr;
+ fread(buf,sizeof (luma_byte),0x4000,file);
+ fclose(file);
+}