mirror of https://github.com/G42makes/mp-s7.git
input working, double chars for now(next thing to figure out), can now quite with ctrl-D
This commit is contained in:
parent
e05edfb687
commit
1994e4fdb4
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue