diff options
author | alekseiplusplus <alekseijeaves@protonmail.com> | 2023-04-10 20:46:43 +1000 |
---|---|---|
committer | alekseiplusplus <alekseijeaves@protonmail.com> | 2023-04-10 20:46:43 +1000 |
commit | a4a9590148fdae2f656b25dd1d7b442969726c28 (patch) | |
tree | fe90cef94de50e38a667eb41b0c8bb98a4465c9b /debug.h | |
parent | fbca225d25db812fe7823a8528dff17320cf1c53 (diff) |
Changed pointer switch case to if else for now
Diffstat (limited to 'debug.h')
-rw-r--r-- | debug.h | 24 |
1 files changed, 22 insertions, 2 deletions
@@ -1,11 +1,31 @@ // debug.h // Various functions useful for use during development. -void dPageDump(){ +// Converts a single character to hexadecimal +int dChar2Num (char c) { + // 0x0 - 0x9 + if (c != 0x20 && (c >= 0x30 && c <= 0x39)){ + return (c - 0x30); + } + // 0xA - 0xF + else if (c != 0x20 && (c >= 0x41 && c <= 0x46)){ + return (c - 0x37); + // 0xa - 0xf + }else if (c != 0x20 && (c >= 0x61 && c <= 0x66)){ + return (c - 0x57); + // Invalid + }else{ + return -1; + } +} + +// Dump a particular page in memory. +void dPageDump(short m){ + m *= 0x0100; for(int i = 0; i < 256; i+=16){ printf("\t"); for(int j = 0; j < 16; j+=1){ - printf("%2x ", Memory[(i+j)]); + printf("%2x ", Memory[(m+(i+j))]); } printf("\n"); } |