mirror of
https://github.com/bradgrantham/apple2a.git
synced 2024-11-27 03:49:31 +00:00
Clear to EOL after Enter.
This commit is contained in:
parent
5d453e8f58
commit
fbed276344
3
main.c
3
main.c
@ -113,6 +113,8 @@ static void list_statement() {
|
||||
uint8_t *line = g_program;
|
||||
uint8_t *next_line;
|
||||
|
||||
print_newline();
|
||||
|
||||
while ((next_line = get_next_line(line)) != 0) {
|
||||
print_int(get_line_number(line));
|
||||
print_char(' ');
|
||||
@ -529,6 +531,7 @@ int16_t main(void)
|
||||
}
|
||||
} else if (key == 13) {
|
||||
// Return.
|
||||
clear_to_eol();
|
||||
print_char('\n');
|
||||
|
||||
process_input_buffer();
|
||||
|
16
runtime.c
16
runtime.c
@ -6,6 +6,7 @@
|
||||
#define SCREEN_HEIGHT 24
|
||||
#define SCREEN_WIDTH 40
|
||||
#define SCREEN_STRIDE (3*SCREEN_WIDTH + 8)
|
||||
#define CLEAR_CHAR (' ' | 0x80)
|
||||
|
||||
// Location of cursor in logical screen space.
|
||||
uint16_t g_cursor_x = 0;
|
||||
@ -65,11 +66,22 @@ void move_cursor(int16_t x, int16_t y) {
|
||||
g_cursor_y = y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Blanks out the rest of the line, from the cursor (inclusive) on.
|
||||
* Does not move the cursor.
|
||||
*/
|
||||
void clear_to_eol(void) {
|
||||
uint8_t *pos = cursor_pos();
|
||||
|
||||
hide_cursor();
|
||||
memset(pos, CLEAR_CHAR, SCREEN_WIDTH - g_cursor_x);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the screen with non-reversed spaces.
|
||||
*/
|
||||
void home(void) {
|
||||
memset(TEXT_PAGE1_BASE, ' ' | 0x80, SCREEN_STRIDE*8);
|
||||
memset(TEXT_PAGE1_BASE, CLEAR_CHAR, SCREEN_STRIDE*8);
|
||||
move_cursor(0, 0);
|
||||
}
|
||||
|
||||
@ -90,7 +102,7 @@ static void scroll_up(void) {
|
||||
}
|
||||
|
||||
// This is provided by cc65:
|
||||
memset(previous_line, ' ' | 0x80, SCREEN_WIDTH);
|
||||
memset(previous_line, CLEAR_CHAR, SCREEN_WIDTH);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user