From a4a9590148fdae2f656b25dd1d7b442969726c28 Mon Sep 17 00:00:00 2001 From: alekseiplusplus Date: Mon, 10 Apr 2023 20:46:43 +1000 Subject: Changed pointer switch case to if else for now --- debug.h | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'debug.h') diff --git a/debug.h b/debug.h index c46f220..887fcbc 100644 --- a/debug.h +++ b/debug.h @@ -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"); } -- cgit v1.2.3