提交 7f43e72f 编写于 作者: Z Zihao Yu

device,vga: add macro SHOW_SCREEN

上级 3ad86e97
......@@ -2,6 +2,8 @@
#ifdef HAS_IOE
//#define SHOW_SCREEN
#include "device/map.h"
#include <SDL2/SDL.h>
......@@ -15,7 +17,6 @@
#define SCREEN_W 400
#define SCREEN_SIZE ((SCREEN_H * SCREEN_W) * sizeof(uint32_t))
static SDL_Window *window = NULL;
static SDL_Renderer *renderer = NULL;
static SDL_Texture *texture = NULL;
......@@ -31,11 +32,15 @@ void update_screen() {
static void vga_io_handler(uint32_t offset, int len, bool is_write) {
if (offset == 4 && len == 4 && is_write) {
#ifdef SHOW_SCREEN
update_screen();
#endif
}
}
void init_vga() {
#ifdef SHOW_SCREEN
SDL_Window *window = NULL;
char title[128];
sprintf(title, "%s-NEMU", str(__ISA__));
SDL_Init(SDL_INIT_VIDEO);
......@@ -43,6 +48,7 @@ void init_vga() {
SDL_SetWindowTitle(window, title);
texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888,
SDL_TEXTUREACCESS_STATIC, SCREEN_W, SCREEN_H);
#endif
screensize_port_base = (void *)new_space(8);
screensize_port_base[0] = ((SCREEN_W) << 16) | (SCREEN_H);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册