Add Terminal

Simon Gellis 2025-12-11 17:58:29 +00:00
parent 8dc4c27d7d
commit 4a7719c7c9
1 changed files with 23 additions and 0 deletions

23
Terminal.md Normal file

@ -0,0 +1,23 @@
Lemur has a built-in terminal for debugging. Games can write arbitrary text to it, by writing one byte at a time to address `0x02000030`. This address does nothing on hardware, but writing messages still takes precious CPU time, so be sure not to leave any log lines around in your final game.
The terminal is available in the menu under Tools > Terminal. You can also pass the flag `--terminal` to the emulator to open it at startup.
Below are some utility methods.
```c
volatile unsigned char* const STDOUT = (unsigned char*) 0x02000030;
int putchar(int ch) {
*STDOUT = ch;
return ch;
}
int puts(const char *str) {
while (*str != 0) {
*STDOUT = *str;
str++;
}
*STDOUT = '\n';
return 0;
}
```