When I try to print a value over the uint24_t max value, the function overflows and displays back up again from zero. Is there a way to fix this?
That is a property with computers in general. See the Wikipedia article on it.
You could use sprintf to print the larger number to a string, then use gfx_PrintString instead.

For example, if you want to print a uint64_t:

Code:
#include <inttypes.h>
#include <stdio.h>

void printUInt64(uint64_t num) {
    char str[21]; // 64-bit numbers have at most 20 decimal digits
    sprintf(str, "%" PRIu64, num);
    gfx_PrintString(str);
}
You can also print each digit in the number by continuously dividing by 10.
Now getting error:

Code:
1 warning generated.
[lto opt] obj\lto.bc
fatal error: error in backend: Error while trying to spill UDE from class O24: Cannot scavenge register without an
      emergency spill slot!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: D:\\logan\\Documents\\CEdev\\bin\\ez80-clang.exe -S -mllvm -profile-guided-section-prefix=false -Wall -Wextra -Oz D:/logan/Documents/CEdev/CalcClicker/obj/lto.bc -o D:/logan/Documents/CEdev/CalcClicker/obj/lto.src
1.      Code generation
2.      Running pass 'Function Pass Manager' on module 'D:/logan/Documents/CEdev/CalcClicker/obj/lto.bc'.
3.      Running pass 'Prologue/Epilogue Insertion & Frame Finalization' on function '@Draw'
0x765490E2 (0xE0000046 0x00000000 0x00000000 0x00000000), RaiseException() + 0x62 bytes(s)
0x005F1BA6 (0x00000100 0x00000000 0x00000020 0x00000013)
0x01000000 (0x00000000 0x00000020 0x00000013 0x0000000A)
ez80-clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 15.0.0 (https://github.com/jacobly0/llvm-project 5f8512f22751066573aa48ac848a6d2195838ac3)
Target: ez80
Thread model: posix
InstalledDir: D:\logan\Documents\CEdev\bin
ez80-clang: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.
make: *** [obj/lto.src] Error 1


EDIT: FIXED, HAD TO PASS POINTERS

Double post combined into one post by admin
Got it working, thanks Calc84Maniac! Have a nice day everyone!
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement