mirror of
https://github.com/G42makes/mp-s7.git
synced 2025-08-05 16:25:06 +00:00
input working, double chars for now(next thing to figure out), can now quite with ctrl-D
This commit is contained in:
@@ -98,6 +98,7 @@ extern "C" void gc_collect(void) {
|
||||
// Receive single character
|
||||
int mp_hal_stdin_rx_chr(void) {
|
||||
unsigned char c = 0;
|
||||
c = retro::Console::currentInstance->ReadChar();
|
||||
return c;
|
||||
}
|
||||
|
||||
|
@@ -326,6 +326,27 @@ std::string Console::ReadLine()
|
||||
return buffer;
|
||||
}
|
||||
|
||||
char Console::ReadChar()
|
||||
{
|
||||
if(!consolePort)
|
||||
return 0;
|
||||
|
||||
char c;
|
||||
|
||||
c = WaitNextChar();
|
||||
if(!c)
|
||||
{
|
||||
eof = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(c == '\r')
|
||||
c = '\n';
|
||||
|
||||
putch(c);
|
||||
return c;
|
||||
}
|
||||
|
||||
void Console::InvalidateCursor()
|
||||
{
|
||||
if(cursorDrawn)
|
||||
|
@@ -40,6 +40,7 @@ namespace retro
|
||||
|
||||
void write(const char *s, int n);
|
||||
std::string ReadLine();
|
||||
char ReadChar();
|
||||
|
||||
static Console *currentInstance;
|
||||
|
||||
|
Reference in New Issue
Block a user