diff --git a/ponydos.asm b/ponydos.asm index cf91f31..b3c6bb5 100644 --- a/ponydos.asm +++ b/ponydos.asm @@ -66,8 +66,7 @@ load_shell: call 0:modify_sectors ; TODO: error management? Surely this works... - xor ax, ax ; WM_INITIALIZE - call 0x1000:0 + call 0x1000:3 initialize_screen: ; Disable text cursor @@ -100,7 +99,7 @@ mainloop: push ax ; Call segment ;push word 0 ; Call offset push cs ; Call offset - mov ax, WM_PAINT + xor ax, ax ; WM_PAINT retf .draw_end: diff --git a/ponydos_static.inc b/ponydos_static.inc index 95345e7..034c970 100644 --- a/ponydos_static.inc +++ b/ponydos_static.inc @@ -6,5 +6,4 @@ GLOBAL_DIRENTS equ 0x2000 FS_DIRENT_SIZE equ 32 FS_FILE_MAX_SIZE equ 128 -WM_INITIALIZE equ 0 -WM_PAINT equ 1 +WM_PAINT equ 0 diff --git a/shell.asm b/shell.asm index 9909260..217f98e 100644 --- a/shell.asm +++ b/shell.asm @@ -5,43 +5,16 @@ bits 16 org 0 -process_event: - push ax - push bx - push cx - push dx - push si - push di - push bp - push ds - push es - - mov bp, cs - mov ds, bp - mov es, bp - - cmp ax, WM_INITIALIZE - jne .not_initialize - call initialize - .not_initialize: - - cmp ax, WM_PAINT - jne .not_paint - call paint - .not_paint: - - pop es - pop ds - pop bp - pop di - pop si - pop dx - pop cx - pop bx - pop ax - retf +; 0x0000 +jmp near process_event +; 0x0003 initialize: + push ds + + push cs + pop ds + ; Set wallpaper mov si, wallpaper_name xor dx, dx @@ -81,7 +54,39 @@ initialize: mov dx, 40 call print_ls - ret + pop ds + retf + +process_event: + push ax + push bx + push cx + push dx + push si + push di + push bp + push ds + push es + + mov bp, cs + mov ds, bp + mov es, bp + + cmp ax, WM_PAINT + jne .not_paint + call paint + .not_paint: + + pop es + pop ds + pop bp + pop di + pop si + pop dx + pop cx + pop bx + pop ax + retf paint: mov bp, cs