Separate entry points for initialization and WM events for programs

This commit is contained in:
Juhani Krekelä 2023-03-20 18:33:27 +02:00
parent f51b9458da
commit ae17e6380f
3 changed files with 44 additions and 41 deletions

View File

@ -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:

View File

@ -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

View File

@ -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