Allow shell to be launched for another file window
This commit is contained in:
parent
7951b1eb27
commit
f1ee23251e
|
@ -69,5 +69,4 @@ installation option, for your safety.
|
|||
|
||||
### Nice to have
|
||||
|
||||
* more file listing windows
|
||||
* ponysay
|
||||
|
|
62
shell.asm
62
shell.asm
|
@ -48,16 +48,11 @@ initialize:
|
|||
; Has shell been started already?
|
||||
mov bp, PONYDOS_SEG
|
||||
mov es, bp
|
||||
xor bp, bp
|
||||
cmp word [es:GLOBAL_WINDOW_CHAIN_HEAD], 0
|
||||
je .not_relaunch
|
||||
.relaunch:
|
||||
; TODO: Display an alert if trying to re-run shell
|
||||
; Clean up memory when exiting
|
||||
mov bx, cs
|
||||
mov cl, 12
|
||||
shr bx, cl
|
||||
mov byte [es:GLOBAL_MEMORY_ALLOCATION_MAP + bx], 0
|
||||
jmp .end
|
||||
mov bp, 1
|
||||
jmp .skip_desktop
|
||||
.not_relaunch:
|
||||
|
||||
; Set wallpaper
|
||||
|
@ -75,6 +70,7 @@ initialize:
|
|||
mov si, windows + WINDOW_ID_ICON*window.size
|
||||
call show_window
|
||||
|
||||
.skip_desktop:
|
||||
; Initialize file window but don't show it
|
||||
mov word [windows + WINDOW_ID_FILE_WINDOW*window.size + window.width], 40
|
||||
mov word [windows + WINDOW_ID_FILE_WINDOW*window.size + window.height], 17
|
||||
|
@ -82,6 +78,17 @@ initialize:
|
|||
mov word [windows + WINDOW_ID_FILE_WINDOW*window.size + window.y], 4
|
||||
mov word [windows + WINDOW_ID_FILE_WINDOW*window.size + window.data], file_window
|
||||
mov byte [windows + WINDOW_ID_FILE_WINDOW*window.size + window.resizable], 1
|
||||
test bp, bp
|
||||
jz .no_file_window_on_start
|
||||
.file_window_on_start:
|
||||
; Offset the window so that it's clearly another window
|
||||
mov word [windows + WINDOW_ID_FILE_WINDOW*window.size + window.x], 7
|
||||
mov word [windows + WINDOW_ID_FILE_WINDOW*window.size + window.y], 3
|
||||
mov ax, cs
|
||||
add ax, WINDOW_ID_FILE_WINDOW
|
||||
mov si, windows + WINDOW_ID_FILE_WINDOW*window.size
|
||||
call show_window
|
||||
.no_file_window_on_start:
|
||||
|
||||
; Initialize error dialogs
|
||||
mov word [windows + WINDOW_ID_OOM_ERROR*window.size + window.width], 13
|
||||
|
@ -146,6 +153,11 @@ process_event:
|
|||
.not_remove:
|
||||
|
||||
.end:
|
||||
cmp byte [open_windows], 0
|
||||
jne .windows_open
|
||||
call deallocate_own_memory
|
||||
.windows_open:
|
||||
|
||||
pop es
|
||||
pop ds
|
||||
pop bp
|
||||
|
@ -731,6 +743,8 @@ show_window:
|
|||
|
||||
call request_redraw
|
||||
|
||||
inc byte [open_windows]
|
||||
|
||||
.end:
|
||||
pop ax
|
||||
ret
|
||||
|
@ -744,10 +758,12 @@ hide_window:
|
|||
mov cx, bp
|
||||
call unhook_window
|
||||
|
||||
mov byte [windows + WINDOW_ID_FILE_WINDOW*window.size + window.visible], 0
|
||||
mov byte [si + window.visible], 0
|
||||
|
||||
call request_redraw
|
||||
|
||||
dec byte [open_windows]
|
||||
|
||||
pop cx
|
||||
ret
|
||||
|
||||
|
@ -792,6 +808,7 @@ unhook_window:
|
|||
; in:
|
||||
; ax = window ID to raise
|
||||
raise_window:
|
||||
push ax
|
||||
push bx
|
||||
push cx
|
||||
push si
|
||||
|
@ -819,6 +836,7 @@ raise_window:
|
|||
pop si
|
||||
pop cx
|
||||
pop bx
|
||||
pop ax
|
||||
ret
|
||||
|
||||
; ------------------------------------------------------------------
|
||||
|
@ -1034,6 +1052,30 @@ copy_dirents:
|
|||
pop cx
|
||||
ret
|
||||
|
||||
; ------------------------------------------------------------------
|
||||
; Memory management
|
||||
; ------------------------------------------------------------------
|
||||
|
||||
deallocate_own_memory:
|
||||
push bx
|
||||
push cx
|
||||
push es
|
||||
|
||||
mov bx, PONYDOS_SEG
|
||||
mov es, bx
|
||||
|
||||
; Segment 0xn000 corresponds to slot n in the allocation table
|
||||
mov bx, cs
|
||||
mov cl, 12
|
||||
shr bx, cl
|
||||
|
||||
mov byte [es:GLOBAL_MEMORY_ALLOCATION_MAP + bx], 0
|
||||
|
||||
pop es
|
||||
pop cx
|
||||
pop bx
|
||||
ret
|
||||
|
||||
; ------------------------------------------------------------------
|
||||
; String routines
|
||||
; ------------------------------------------------------------------
|
||||
|
@ -1127,6 +1169,8 @@ windows:
|
|||
times window.size db 0
|
||||
times window.size db 0
|
||||
|
||||
open_windows db 0
|
||||
|
||||
launch_filename times FS_DIRENT_NAME_SIZE db 0
|
||||
|
||||
section .bss
|
||||
|
|
Loading…
Reference in New Issue