mirror of
https://github.com/G42makes/mp-s7.git
synced 2024-06-23 15:29:29 +00:00
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
|
// Receive single character
|
||||||
int mp_hal_stdin_rx_chr(void) {
|
int mp_hal_stdin_rx_chr(void) {
|
||||||
unsigned char c = 0;
|
unsigned char c = 0;
|
||||||
|
c = retro::Console::currentInstance->ReadChar();
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -326,6 +326,27 @@ std::string Console::ReadLine()
|
||||||
return buffer;
|
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()
|
void Console::InvalidateCursor()
|
||||||
{
|
{
|
||||||
if(cursorDrawn)
|
if(cursorDrawn)
|
||||||
|
|
|
@ -40,6 +40,7 @@ namespace retro
|
||||||
|
|
||||||
void write(const char *s, int n);
|
void write(const char *s, int n);
|
||||||
std::string ReadLine();
|
std::string ReadLine();
|
||||||
|
char ReadChar();
|
||||||
|
|
||||||
static Console *currentInstance;
|
static Console *currentInstance;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user