mirror of
https://github.com/bradgrantham/apple2e.git
synced 2024-12-28 08:29:40 +00:00
improve text-only interface
Reposition cursor to top before redraw, so textport updates don't jump Fix keyboard so tty lower-case key is transmitted as correct key code (upper case and let apple2e.cpp handle conversion)
This commit is contained in:
parent
b925142da1
commit
6745843b0c
@ -21,6 +21,7 @@ using namespace std;
|
|||||||
namespace APPLE2Einterface
|
namespace APPLE2Einterface
|
||||||
{
|
{
|
||||||
|
|
||||||
|
bool textport_needs_output[2] = {false, false};
|
||||||
DisplayMode display_mode = TEXT;
|
DisplayMode display_mode = TEXT;
|
||||||
int display_page = 0; // Apple //e page minus 1 (so 0,1 not 1,2)
|
int display_page = 0; // Apple //e page minus 1 (so 0,1 not 1,2)
|
||||||
bool mixed_mode = false;
|
bool mixed_mode = false;
|
||||||
@ -35,8 +36,6 @@ unsigned char textport[2][24][40];
|
|||||||
|
|
||||||
deque<event> event_queue;
|
deque<event> event_queue;
|
||||||
|
|
||||||
bool force_caps_on = true;
|
|
||||||
|
|
||||||
bool event_waiting()
|
bool event_waiting()
|
||||||
{
|
{
|
||||||
return event_queue.size() > 0;
|
return event_queue.size() > 0;
|
||||||
@ -184,6 +183,8 @@ void poll_keyboard()
|
|||||||
} else if(c >= 1 && c<= 26) {
|
} else if(c >= 1 && c<= 26) {
|
||||||
control = true;
|
control = true;
|
||||||
ch = 'A' + c - 1;
|
ch = 'A' + c - 1;
|
||||||
|
} else if(c >= 'a' && c<= 'z') {
|
||||||
|
ch = 'A' + c - 'a';
|
||||||
} else {
|
} else {
|
||||||
ch = c;
|
ch = c;
|
||||||
}
|
}
|
||||||
@ -206,16 +207,21 @@ void iterate()
|
|||||||
{
|
{
|
||||||
apply_writes();
|
apply_writes();
|
||||||
|
|
||||||
printf(".----------------------------------------.\n");
|
if(textport_needs_output[display_page])
|
||||||
for(int row = 0; row < 24; row++) {
|
{
|
||||||
putchar('|');
|
printf("\033[0;0H");
|
||||||
for(int col = 0; col < 40; col++) {
|
printf(".----------------------------------------.\n");
|
||||||
int ch = textport[display_page][row][col] & 0x7F;
|
for(int row = 0; row < 24; row++) {
|
||||||
printf("%c", isprint(ch) ? ch : '?');
|
putchar('|');
|
||||||
|
for(int col = 0; col < 40; col++) {
|
||||||
|
int ch = textport[display_page][row][col] & 0x7F;
|
||||||
|
printf("%c", isprint(ch) ? ch : '?');
|
||||||
|
}
|
||||||
|
puts("|");
|
||||||
}
|
}
|
||||||
puts("|");
|
printf("`----------------------------------------'\n");
|
||||||
|
textport_needs_output[display_page] = false;
|
||||||
}
|
}
|
||||||
printf("`----------------------------------------'\n");
|
|
||||||
|
|
||||||
poll_keyboard();
|
poll_keyboard();
|
||||||
}
|
}
|
||||||
@ -257,6 +263,7 @@ void write2(int addr, unsigned char data)
|
|||||||
if((within_page >= row_offset) && (within_page < row_offset + 40)) {
|
if((within_page >= row_offset) && (within_page < row_offset + 40)) {
|
||||||
int col = within_page - row_offset;
|
int col = within_page - row_offset;
|
||||||
textport[page][row][col] = data;
|
textport[page][row][col] = data;
|
||||||
|
textport_needs_output[page] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user