mirror of
https://github.com/bradgrantham/apple2a.git
synced 2024-05-28 15:41:29 +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 *line = g_program;
|
||||||
uint8_t *next_line;
|
uint8_t *next_line;
|
||||||
|
|
||||||
|
print_newline();
|
||||||
|
|
||||||
while ((next_line = get_next_line(line)) != 0) {
|
while ((next_line = get_next_line(line)) != 0) {
|
||||||
print_int(get_line_number(line));
|
print_int(get_line_number(line));
|
||||||
print_char(' ');
|
print_char(' ');
|
||||||
|
@ -529,6 +531,7 @@ int16_t main(void)
|
||||||
}
|
}
|
||||||
} else if (key == 13) {
|
} else if (key == 13) {
|
||||||
// Return.
|
// Return.
|
||||||
|
clear_to_eol();
|
||||||
print_char('\n');
|
print_char('\n');
|
||||||
|
|
||||||
process_input_buffer();
|
process_input_buffer();
|
||||||
|
|
16
runtime.c
16
runtime.c
|
@ -6,6 +6,7 @@
|
||||||
#define SCREEN_HEIGHT 24
|
#define SCREEN_HEIGHT 24
|
||||||
#define SCREEN_WIDTH 40
|
#define SCREEN_WIDTH 40
|
||||||
#define SCREEN_STRIDE (3*SCREEN_WIDTH + 8)
|
#define SCREEN_STRIDE (3*SCREEN_WIDTH + 8)
|
||||||
|
#define CLEAR_CHAR (' ' | 0x80)
|
||||||
|
|
||||||
// Location of cursor in logical screen space.
|
// Location of cursor in logical screen space.
|
||||||
uint16_t g_cursor_x = 0;
|
uint16_t g_cursor_x = 0;
|
||||||
|
@ -65,11 +66,22 @@ void move_cursor(int16_t x, int16_t y) {
|
||||||
g_cursor_y = 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.
|
* Clear the screen with non-reversed spaces.
|
||||||
*/
|
*/
|
||||||
void home(void) {
|
void home(void) {
|
||||||
memset(TEXT_PAGE1_BASE, ' ' | 0x80, SCREEN_STRIDE*8);
|
memset(TEXT_PAGE1_BASE, CLEAR_CHAR, SCREEN_STRIDE*8);
|
||||||
move_cursor(0, 0);
|
move_cursor(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +102,7 @@ static void scroll_up(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is provided by cc65:
|
// 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