From f51b9458da99439862e554bdb033f72311d9d1cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juhani=20Krekel=C3=A4?= Date: Mon, 20 Mar 2023 18:17:45 +0200 Subject: [PATCH] Fix redraw handling --- ponydos.asm | 39 +++++++++++++++++++++------------------ shell.asm | 3 +++ 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/ponydos.asm b/ponydos.asm index 9d721fe..cf91f31 100644 --- a/ponydos.asm +++ b/ponydos.asm @@ -75,31 +75,34 @@ initialize_screen: mov ch, 0x20 int 0x10 -draw: ; Set up segments for drawing routines push word 0xb800 pop es - call draw_wallpaper - mov di, mouse_column - call flip_mouse_cursor - - ; Draw windows - push cs ; Return segment - push word mainloop ; Return offset - mov bx, [di - mouse_column + window_chain_head] - mov ax, 0xf000 - and ax, bx - push ax ; Call segment - ;push word 0 ; Call offset - push cs ; Call offset - mov ax, WM_PAINT - retf mainloop: - cmp byte [di - mouse_column + redraw], 0 - jne draw + xor al, al + xchg byte [di - mouse_column + redraw], al + test al, al + jz .draw_end + .draw: + call draw_wallpaper + + call flip_mouse_cursor + + ; Draw windows + push cs ; Return segment + push word .draw_end ; Return offset + mov bx, [di - mouse_column + window_chain_head] + mov ax, 0xf000 + and ax, bx + push ax ; Call segment + ;push word 0 ; Call offset + push cs ; Call offset + mov ax, WM_PAINT + retf + .draw_end: mov bx, [di - mouse_column + mouse_x] shr bx, 1 diff --git a/shell.asm b/shell.asm index e7467f0..9909260 100644 --- a/shell.asm +++ b/shell.asm @@ -65,6 +65,9 @@ initialize: xchg [es:GLOBAL_WINDOW_CHAIN_HEAD], ax mov [next_window2], ax + ; Request repaint + mov byte [es:GLOBAL_REDRAW], 1 + ; Temporary testing mov ax, cs mov es, ax