/* * solid_helpers.c — small Solid-C compatibility helpers. * * Each function maps to the standard printf/sprintf machinery already * available from SDCC's z80.lib + our overrides. No new syscalls. */ #include #include /* ---- gets — dangerous but Solid-C provides it ---------------------- */ char *gets(char *buf) { int i = 0; int c; for (;;) { c = getchar(); if (c == EOF) { if (i == 0) return 0; break; } if (c == '\n' || c == '\r') break; buf[i++] = (char)c; } buf[i] = 0; return buf; } /* ---- decimal output: use printf %u ---------------------------------- */ void dec8(uint8_t v) { printf("%u", (unsigned)v); } void dec16(uint16_t v) { printf("%u", (unsigned)v); } void dec32(uint32_t v) { printf("%lu", (unsigned long)v); } /* ---- hex output: zero-padded ---------------------------------------- */ void hex8(uint8_t v) { printf("%02X", (unsigned)v); } void hex16(uint16_t v) { printf("%04X", (unsigned)v); } void hex32(uint32_t v) { printf("%08lX", (unsigned long)v); }