for ci
This commit is contained in:
parent
fd19d9b07a
commit
d3eb6088c8
|
@ -2,6 +2,8 @@
|
|||
#include <keyboard.h>
|
||||
#include <stdarg.h>
|
||||
#include <macro.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#define FPS 60
|
||||
|
||||
|
@ -47,6 +49,21 @@ void nvboard_update() {
|
|||
|
||||
void read_event();
|
||||
read_event();
|
||||
|
||||
static char buf[256];
|
||||
static char *p = buf;
|
||||
if (*p == '\0') {
|
||||
if (fgets(buf, sizeof(buf), stdin) == NULL) {
|
||||
buf[0] = '\0';
|
||||
}
|
||||
p = buf;
|
||||
}
|
||||
if (*p != '\0') {
|
||||
void uart_rx_getchar(uint8_t ch);
|
||||
uart_rx_getchar(*p);
|
||||
p ++;
|
||||
}
|
||||
|
||||
update_components(main_renderer);
|
||||
if (need_redraw) {
|
||||
SDL_RenderPresent(main_renderer);
|
||||
|
@ -94,6 +111,10 @@ void nvboard_init(int vga_clk_cycle) {
|
|||
|
||||
extern void vga_set_clk_cycle(int cycle);
|
||||
vga_set_clk_cycle(vga_clk_cycle);
|
||||
|
||||
// make stdin non-blocking
|
||||
int flags = fcntl(STDIN_FILENO, F_GETFL, 0);
|
||||
fcntl(STDIN_FILENO, F_SETFL, flags | O_NONBLOCK);
|
||||
}
|
||||
|
||||
void nvboard_quit(){
|
||||
|
|
|
@ -5,7 +5,7 @@ static SDL_Texture *tfpga_background;
|
|||
|
||||
static SDL_Texture* load_texture(SDL_Renderer *renderer, std::string path) {
|
||||
SDL_Texture *t = IMG_LoadTexture(renderer, (nvboard_home + path).c_str());
|
||||
assert(t != NULL);
|
||||
//assert(t != NULL);
|
||||
return t;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ SDL_Texture* load_pic_texture(SDL_Renderer *renderer, std::string path) {
|
|||
SDL_Texture* surface2texture(SDL_Renderer *renderer, SDL_Surface *s) {
|
||||
assert(s != NULL);
|
||||
SDL_Texture *t = SDL_CreateTextureFromSurface(renderer, s);
|
||||
assert(t != NULL);
|
||||
//assert(t != NULL);
|
||||
SDL_FreeSurface(s);
|
||||
return t;
|
||||
}
|
||||
|
|
|
@ -108,6 +108,7 @@ void Term::feed_ch(uint8_t ch) {
|
|||
if (is_cursor_on_screen()) set_dirty_char(cursor_y - screen_y, cursor_x);
|
||||
int y = cursor_y;
|
||||
assert(y < lines.size());
|
||||
putchar(ch);
|
||||
if (ch == '\n') { newline(); return; }
|
||||
else if (ch == '\r') { _return(); return; }
|
||||
else if (ch == '\b') { backspace(false); return; }
|
||||
|
|
Loading…
Reference in New Issue