aboutsummaryrefslogtreecommitdiff
path: root/test/bin/test_file_read.c
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-03-13 20:04:54 +0100
committerlonkaars <loek@pipeframe.xyz>2023-03-13 20:04:54 +0100
commitbec47edeefed4d9a545ad0bfa43d7edee6379b03 (patch)
tree87935cfc33ffe66c296db2f246a2bbc16019cf40 /test/bin/test_file_read.c
parent74ec145c5e44a51789e9117b1ae93dfd7be24d86 (diff)
parent5a747929ed2099755fb03c930ea68c77fda805b3 (diff)
merge `dev` into `ppu`
Diffstat (limited to 'test/bin/test_file_read.c')
-rw-r--r--test/bin/test_file_read.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/bin/test_file_read.c b/test/bin/test_file_read.c
new file mode 100644
index 0000000..df93395
--- /dev/null
+++ b/test/bin/test_file_read.c
@@ -0,0 +1,46 @@
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+
+#define HH_PPU_VRAM_TMM_SPRITE_SIZE 52
+
+
+void printData(uint8_t* in) {
+ for (int i = 0; i < HH_PPU_VRAM_TMM_SPRITE_SIZE; i++)
+ {
+ printf("%02x ",in[i]);
+ }
+ printf("\n");
+}
+
+void hh_ppu_load_tilemap() {
+
+
+ char* filename = "slime.bin";
+ FILE* fp = fopen(filename,"rb");
+ if (!fp){
+ return;//error
+ }
+
+ int sprite_size = (16 * 16);
+ fseek(fp, 0, SEEK_END);
+ int _size = ftell(fp)/sprite_size;
+ rewind(fp);
+ // printf("%i",_size);
+ for (int i = 0; i < _size; i++) {
+ uint8_t data[sprite_size];
+ fread(data,1,sprite_size,fp);
+
+ printData(data);
+ }
+ fclose(fp);
+
+}
+
+
+int main(){
+hh_ppu_load_tilemap();
+ return 0;
+}