cscg22-gearboy

CSCG 2022 Challenge 'Gearboy'
git clone https://git.sinitax.com/sinitax/cscg22-gearboy
Log | Files | Refs | sfeed.txt

gprintln.c (419B)


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