From c09b0569fc9760058c1a7f9dec6412d6319580aa Mon Sep 17 00:00:00 2001 From: "Rustem Gimadutdinov (rgimad)" Date: Sun, 23 May 2021 10:00:33 +0000 Subject: [PATCH] chip8: fix window frame + fix two Page fault issues git-svn-id: svn://kolibrios.org@8729 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/emulator/chip8/emu.inc | 6 +++--- programs/emulator/chip8/gui.inc | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/programs/emulator/chip8/emu.inc b/programs/emulator/chip8/emu.inc index b7703b10f7..dbd3e0c45e 100644 --- a/programs/emulator/chip8/emu.inc +++ b/programs/emulator/chip8/emu.inc @@ -103,7 +103,7 @@ proc chip8_emulatecycle stdcall movzx bx, byte [memory + 1 + ecx] or ax, bx mov word [opcode], ax - ; DEBUGF DBG_INFO, "opcode = 0x%x, ax = 0x%x\n", [opcode]:4, ax + DEBUGF DBG_INFO, "opcode = 0x%x, ax = 0x%x\n", [opcode]:4, ax shr ax, 8 and ax, 0x000F @@ -483,8 +483,8 @@ proc chip8_emulatecycle stdcall .sw5_case_A1: ; skip next instruction if key V[X] is NOT pressed movzx ecx, byte [x] - movzx eax, byte [V + ecx] - mov bl, byte [key + eax] + movzx edx, byte [V + ecx] + mov bl, byte [key + edx] mov ax, 4 cmp bl, 1 jne .sw5_case_A1_endcheck diff --git a/programs/emulator/chip8/gui.inc b/programs/emulator/chip8/gui.inc index bc9624b25c..0928768c4f 100644 --- a/programs/emulator/chip8/gui.inc +++ b/programs/emulator/chip8/gui.inc @@ -1,17 +1,19 @@ ; draw main window align 4 proc draw_main_window stdcall + DEBUGF DBG_INFO, "draw_main_window() start\n" mcall 12, 1 ; notify about draw beginning mcall 48, 3, sys_colors, sizeof.system_colors mov edx, [sys_colors.work] ; background color or edx, 0x74000000 ; window type ; DEBUGF DBG_INFO, "mainwindow w, h = %u, %u", GFX_COLS*GFX_PIX_SIZE + 8, GFX_ROWS*GFX_PIX_SIZE + 28 - mcall 0, <50, GFX_COLS*GFX_PIX_SIZE + 8>, <50, GFX_ROWS*GFX_PIX_SIZE + 28>, , , main_window_title ; + mcall 0, <50, GFX_COLS*GFX_PIX_SIZE + 9>, <50, GFX_ROWS*GFX_PIX_SIZE + 28>, , , main_window_title ; stdcall draw_screen mcall 12, 2 ; notify about draw ending + DEBUGF DBG_INFO, "draw_main_window() end\n" ret endp