gprintn.c (406B)
1#include <stdint.h> 2#include <gb/drawing.h> 3 4/* Print a number in any radix */ 5 6extern char *digits; 7 8void gprintn(int8_t number, int8_t radix, int8_t signed_value) NONBANKED 9{ 10 uint8_t i; 11 12 if(number < 0 && signed_value) { 13 wrtchr('-'); 14 number = -number; 15 } 16 if((i = (uint8_t)number / (uint8_t)radix) != 0) 17 gprintn(i, radix, UNSIGNED); 18 wrtchr(digits[(uint8_t)number % (uint8_t)radix]); 19}