git.y1.nz

gbdk-2020

GameBoy Development Kit
download: https://git.y1.nz/archives/gbdk.tar.gz
README | Files | Log | Refs | LICENSE

gbdk-lib/libc/targets/sm83/gprintln.c

      1 #include <stdint.h>
      2 #include <gb/drawing.h>
      3 
      4 /* Print a long number in any radix */
      5 
      6 extern char *digits;
      7 
      8 void 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 }

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.