update sim beeper
This commit is contained in:
parent
2b3647cbb1
commit
3a37bc7d68
|
@ -30,14 +30,14 @@ void init_screen() {
|
||||||
SDL_TEXTUREACCESS_STREAMING, SCREEN_WIDTH,
|
SDL_TEXTUREACCESS_STREAMING, SCREEN_WIDTH,
|
||||||
SCREEN_HEIGHT);
|
SCREEN_HEIGHT);
|
||||||
}
|
}
|
||||||
|
bool is_beeping;
|
||||||
void draw_screen(const svLogicVecVal *vram) {
|
void draw_screen(const svLogicVecVal *vram) {
|
||||||
uint32_t *screen = (uint32_t *)malloc(SCREEN_WIDTH * SCREEN_HEIGHT * 32);
|
uint32_t *screen = (uint32_t *)malloc(SCREEN_WIDTH * SCREEN_HEIGHT * 32);
|
||||||
for (int i = 0; i < 1024; i++) {
|
for (int i = 0; i < 1024; i++) {
|
||||||
uint8_t line_byte = (uint8_t)vram[i].aval;
|
uint8_t line_byte = (uint8_t)vram[i].aval;
|
||||||
for (int j = 0; j < 8; j++) {
|
for (int j = 0; j < 8; j++) {
|
||||||
uint8_t pixel_val = (line_byte >> (7 - j)) & 1;
|
uint8_t pixel_val = (line_byte >> (7 - j)) & 1;
|
||||||
screen[(i * 8) + j] = pixel_val == 1 ? 0xFFFFFFFF : 0x00000000;
|
screen[(i * 8) + j] = pixel_val == 1 ? 0xFFFFFFFF : (is_beeping ? 0xFF000000 : 0x00000000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SDL_UpdateTexture(texture, NULL, screen, sizeof(screen[0]) * SCREEN_WIDTH);
|
SDL_UpdateTexture(texture, NULL, screen, sizeof(screen[0]) * SCREEN_WIDTH);
|
||||||
|
@ -215,10 +215,7 @@ int main(int argc, char **argv) {
|
||||||
dut->eval();
|
dut->eval();
|
||||||
|
|
||||||
|
|
||||||
if (dut->beep == 1)
|
is_beeping = dut->beep == 1;
|
||||||
SDL_SetTextureColorMod(texture, 255, 0, 0);
|
|
||||||
else
|
|
||||||
SDL_SetTextureColorMod(texture, 255, 255, 255);
|
|
||||||
|
|
||||||
if (SDL_QuitRequested()) {
|
if (SDL_QuitRequested()) {
|
||||||
std::cout << "INF_EMU: Received Quit from SDL. Goodbye!" << '\n';
|
std::cout << "INF_EMU: Received Quit from SDL. Goodbye!" << '\n';
|
||||||
|
|
Loading…
Reference in a new issue