Allow shell to be launched for another file window
This commit is contained in:
parent
7951b1eb27
commit
f1ee23251e
2 changed files with 53 additions and 10 deletions
|
@ -69,5 +69,4 @@ installation option, for your safety.
|
||||||
|
|
||||||
### Nice to have
|
### Nice to have
|
||||||
|
|
||||||
* more file listing windows
|
|
||||||
* ponysay
|
* ponysay
|
||||||
|
|
62
shell.asm
62
shell.asm
|
@ -48,16 +48,11 @@ initialize:
|
||||||
; Has shell been started already?
|
; Has shell been started already?
|
||||||
mov bp, PONYDOS_SEG
|
mov bp, PONYDOS_SEG
|
||||||
mov es, bp
|
mov es, bp
|
||||||
|
xor bp, bp
|
||||||
cmp word [es:GLOBAL_WINDOW_CHAIN_HEAD], 0
|
cmp word [es:GLOBAL_WINDOW_CHAIN_HEAD], 0
|
||||||
je .not_relaunch
|
je .not_relaunch
|
||||||
.relaunch:
|
mov bp, 1
|
||||||
; TODO: Display an alert if trying to re-run shell
|
jmp .skip_desktop
|
||||||
; 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
|
|
||||||
.not_relaunch:
|
.not_relaunch:
|
||||||
|
|
||||||
; Set wallpaper
|
; Set wallpaper
|
||||||
|
@ -75,6 +70,7 @@ initialize:
|
||||||
mov si, windows + WINDOW_ID_ICON*window.size
|
mov si, windows + WINDOW_ID_ICON*window.size
|
||||||
call show_window
|
call show_window
|
||||||
|
|
||||||
|
.skip_desktop:
|
||||||
; Initialize file window but don't show it
|
; 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.width], 40
|
||||||
mov word [windows + WINDOW_ID_FILE_WINDOW*window.size + window.height], 17
|
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.y], 4
|
||||||
mov word [windows + WINDOW_ID_FILE_WINDOW*window.size + window.data], file_window
|
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
|
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
|
; Initialize error dialogs
|
||||||
mov word [windows + WINDOW_ID_OOM_ERROR*window.size + window.width], 13
|
mov word [windows + WINDOW_ID_OOM_ERROR*window.size + window.width], 13
|
||||||
|
@ -146,6 +153,11 @@ process_event:
|
||||||
.not_remove:
|
.not_remove:
|
||||||
|
|
||||||
.end:
|
.end:
|
||||||
|
cmp byte [open_windows], 0
|
||||||
|
jne .windows_open
|
||||||
|
call deallocate_own_memory
|
||||||
|
.windows_open:
|
||||||
|
|
||||||
pop es
|
pop es
|
||||||
pop ds
|
pop ds
|
||||||
pop bp
|
pop bp
|
||||||
|
@ -731,6 +743,8 @@ show_window:
|
||||||
|
|
||||||
call request_redraw
|
call request_redraw
|
||||||
|
|
||||||
|
inc byte [open_windows]
|
||||||
|
|
||||||
.end:
|
.end:
|
||||||
pop ax
|
pop ax
|
||||||
ret
|
ret
|
||||||
|
@ -744,10 +758,12 @@ hide_window:
|
||||||
mov cx, bp
|
mov cx, bp
|
||||||
call unhook_window
|
call unhook_window
|
||||||
|
|
||||||
mov byte [windows + WINDOW_ID_FILE_WINDOW*window.size + window.visible], 0
|
mov byte [si + window.visible], 0
|
||||||
|
|
||||||
call request_redraw
|
call request_redraw
|
||||||
|
|
||||||
|
dec byte [open_windows]
|
||||||
|
|
||||||
pop cx
|
pop cx
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
@ -792,6 +808,7 @@ unhook_window:
|
||||||
; in:
|
; in:
|
||||||
; ax = window ID to raise
|
; ax = window ID to raise
|
||||||
raise_window:
|
raise_window:
|
||||||
|
push ax
|
||||||
push bx
|
push bx
|
||||||
push cx
|
push cx
|
||||||
push si
|
push si
|
||||||
|
@ -819,6 +836,7 @@ raise_window:
|
||||||
pop si
|
pop si
|
||||||
pop cx
|
pop cx
|
||||||
pop bx
|
pop bx
|
||||||
|
pop ax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; ------------------------------------------------------------------
|
; ------------------------------------------------------------------
|
||||||
|
@ -1034,6 +1052,30 @@ copy_dirents:
|
||||||
pop cx
|
pop cx
|
||||||
ret
|
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
|
; String routines
|
||||||
; ------------------------------------------------------------------
|
; ------------------------------------------------------------------
|
||||||
|
@ -1127,6 +1169,8 @@ windows:
|
||||||
times window.size db 0
|
times window.size db 0
|
||||||
times window.size db 0
|
times window.size db 0
|
||||||
|
|
||||||
|
open_windows db 0
|
||||||
|
|
||||||
launch_filename times FS_DIRENT_NAME_SIZE db 0
|
launch_filename times FS_DIRENT_NAME_SIZE db 0
|
||||||
|
|
||||||
section .bss
|
section .bss
|
||||||
|
|
Loading…
Reference in a new issue