Move wallpaper loading to shell
This commit is contained in:
parent
c4ab75fc54
commit
514cf5441f
6 changed files with 118 additions and 52 deletions
6
Makefile
6
Makefile
|
@ -6,11 +6,15 @@ PYTHON = python3
|
||||||
|
|
||||||
all: ponydos.img
|
all: ponydos.img
|
||||||
|
|
||||||
FS_FILES = bg.bin shell.bin
|
FS_FILES = wallpaper.bin shell.bin
|
||||||
|
|
||||||
ponydos.img: ponydos.bin $(FS_FILES)
|
ponydos.img: ponydos.bin $(FS_FILES)
|
||||||
$(PYTHON) assemble_floppy.py $@ ponydos.bin $(FS_FILES)
|
$(PYTHON) assemble_floppy.py $@ ponydos.bin $(FS_FILES)
|
||||||
|
|
||||||
|
ponydos.bin: ponydos.inc
|
||||||
|
|
||||||
|
shell.bin: ponydos.inc
|
||||||
|
|
||||||
.asm.bin:
|
.asm.bin:
|
||||||
$(NASM) -fbin -o $@ $<
|
$(NASM) -fbin -o $@ $<
|
||||||
|
|
||||||
|
|
39
debug.inc
Normal file
39
debug.inc
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
hexprint16:
|
||||||
|
xchg ah, al
|
||||||
|
call hexprint8
|
||||||
|
xchg ah, al
|
||||||
|
|
||||||
|
hexprint8:
|
||||||
|
push ax
|
||||||
|
push cx
|
||||||
|
mov cl, 4
|
||||||
|
shr al, cl
|
||||||
|
call hexprint4
|
||||||
|
pop cx
|
||||||
|
pop ax
|
||||||
|
|
||||||
|
hexprint4:
|
||||||
|
push ax
|
||||||
|
and al, 0xf
|
||||||
|
cmp al, 10
|
||||||
|
jb .digit09
|
||||||
|
|
||||||
|
add al, 'a' - '0' - 10
|
||||||
|
|
||||||
|
.digit09:
|
||||||
|
add al, '0'
|
||||||
|
mov ah, 0x0e
|
||||||
|
int 0x10
|
||||||
|
pop ax
|
||||||
|
ret
|
||||||
|
|
||||||
|
hang:
|
||||||
|
hlt
|
||||||
|
jmp hang
|
||||||
|
|
||||||
|
wait_key:
|
||||||
|
push ax
|
||||||
|
xor ah, ah
|
||||||
|
int 0x16
|
||||||
|
pop ax
|
||||||
|
ret
|
65
ponydos.asm
65
ponydos.asm
|
@ -1,3 +1,5 @@
|
||||||
|
%include "ponydos.inc"
|
||||||
|
|
||||||
cpu 286
|
cpu 286
|
||||||
bits 16
|
bits 16
|
||||||
|
|
||||||
|
@ -6,13 +8,20 @@ org 0x7c00
|
||||||
COLUMNS equ 80
|
COLUMNS equ 80
|
||||||
ROWS equ 25
|
ROWS equ 25
|
||||||
|
|
||||||
WALLPAPER equ 0x500
|
|
||||||
|
|
||||||
DIRENTS equ 0x2000
|
DIRENTS equ 0x2000
|
||||||
DIRENT_SIZE equ 32
|
DIRENT_SIZE equ 32
|
||||||
FILE_MAX_SIZE equ 128
|
FILE_MAX_SIZE equ 128
|
||||||
|
|
||||||
jmp 0:start
|
jmp 0:start
|
||||||
|
|
||||||
|
; Thunks for application programs to use
|
||||||
|
; 0x7c05
|
||||||
|
call open_file
|
||||||
|
retf
|
||||||
|
; 0x7c09
|
||||||
|
call read_sectors
|
||||||
|
retf
|
||||||
|
|
||||||
start:
|
start:
|
||||||
cld
|
cld
|
||||||
|
|
||||||
|
@ -64,13 +73,6 @@ initialize_mouse:
|
||||||
|
|
||||||
.done:
|
.done:
|
||||||
|
|
||||||
load_wallpaper:
|
|
||||||
mov si, wallpaper_name
|
|
||||||
call open_file
|
|
||||||
mov bx, WALLPAPER
|
|
||||||
call read_sectors
|
|
||||||
; TODO: error management? Surely this works...
|
|
||||||
|
|
||||||
load_shell:
|
load_shell:
|
||||||
push word 0x1000
|
push word 0x1000
|
||||||
pop es
|
pop es
|
||||||
|
@ -78,7 +80,9 @@ load_shell:
|
||||||
call open_file
|
call open_file
|
||||||
xor bx, bx
|
xor bx, bx
|
||||||
call read_sectors
|
call read_sectors
|
||||||
|
; TODO: error management? Surely this works...
|
||||||
|
|
||||||
|
xor ax, ax ; WM_INITIALIZE
|
||||||
call 0x1000:0
|
call 0x1000:0
|
||||||
|
|
||||||
initialize_screen:
|
initialize_screen:
|
||||||
|
@ -124,7 +128,7 @@ mainloop:
|
||||||
draw_wallpaper:
|
draw_wallpaper:
|
||||||
pusha
|
pusha
|
||||||
|
|
||||||
mov si, WALLPAPER
|
mov si, GLOBAL_WALLPAPER
|
||||||
xor di, di
|
xor di, di
|
||||||
mov cx, 80*25
|
mov cx, 80*25
|
||||||
rep movsw
|
rep movsw
|
||||||
|
@ -227,8 +231,7 @@ modify_sector:
|
||||||
; Filesystem
|
; Filesystem
|
||||||
; ------------------------------------------------------------------
|
; ------------------------------------------------------------------
|
||||||
|
|
||||||
wallpaper_name: db 'bg.bin', 0
|
shell_name db 'shell.bin', 0
|
||||||
shell_name: db 'shell.bin', 0
|
|
||||||
|
|
||||||
; in:
|
; in:
|
||||||
; ds:si = file name
|
; ds:si = file name
|
||||||
|
@ -387,44 +390,6 @@ mouse_handler:
|
||||||
popa
|
popa
|
||||||
retf
|
retf
|
||||||
|
|
||||||
; ------------------------------------------------------------------
|
|
||||||
; Debug routines
|
|
||||||
; ------------------------------------------------------------------
|
|
||||||
|
|
||||||
%if 0
|
|
||||||
hexprint16:
|
|
||||||
xchg ah, al
|
|
||||||
call hexprint8
|
|
||||||
xchg ah, al
|
|
||||||
|
|
||||||
hexprint8:
|
|
||||||
push ax
|
|
||||||
push cx
|
|
||||||
shr al, 4
|
|
||||||
call hexprint4
|
|
||||||
pop cx
|
|
||||||
pop ax
|
|
||||||
|
|
||||||
hexprint4:
|
|
||||||
push ax
|
|
||||||
and al, 0xf
|
|
||||||
cmp al, 10
|
|
||||||
jb .digit09
|
|
||||||
|
|
||||||
add al, 'a' - '0' - 10
|
|
||||||
|
|
||||||
.digit09:
|
|
||||||
add al, '0'
|
|
||||||
mov ah, 0x0e
|
|
||||||
int 0x10
|
|
||||||
pop ax
|
|
||||||
ret
|
|
||||||
|
|
||||||
hang:
|
|
||||||
hlt
|
|
||||||
jmp hang
|
|
||||||
%endif
|
|
||||||
|
|
||||||
; ------------------------------------------------------------------
|
; ------------------------------------------------------------------
|
||||||
; Padding and boot sector signature
|
; Padding and boot sector signature
|
||||||
; ------------------------------------------------------------------
|
; ------------------------------------------------------------------
|
||||||
|
|
8
ponydos.inc
Normal file
8
ponydos.inc
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
PONYDOS_SEG equ 0
|
||||||
|
|
||||||
|
SYS_OPEN_FILE equ 0x7c05
|
||||||
|
SYS_READ_SECTORS equ 0x7c09
|
||||||
|
|
||||||
|
GLOBAL_WALLPAPER equ 0x500
|
||||||
|
|
||||||
|
WM_INITIALIZE equ 0
|
52
shell.asm
52
shell.asm
|
@ -1,2 +1,52 @@
|
||||||
|
%include "ponydos.inc"
|
||||||
|
|
||||||
|
cpu 8086
|
||||||
|
bits 16
|
||||||
|
|
||||||
|
|
||||||
org 0
|
org 0
|
||||||
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_INITIALIZE
|
||||||
|
jne .not_initialize
|
||||||
|
call initialize
|
||||||
|
.not_initialize:
|
||||||
|
|
||||||
|
pop es
|
||||||
|
pop ds
|
||||||
|
pop bp
|
||||||
|
pop di
|
||||||
|
pop si
|
||||||
|
pop dx
|
||||||
|
pop cx
|
||||||
|
pop bx
|
||||||
|
pop ax
|
||||||
|
retf
|
||||||
|
|
||||||
|
initialize:
|
||||||
|
; Set wallpaper
|
||||||
|
mov si, wallpaper_name
|
||||||
|
call PONYDOS_SEG:SYS_OPEN_FILE
|
||||||
|
|
||||||
|
mov bp, PONYDOS_SEG
|
||||||
|
mov es, bp
|
||||||
|
mov bx, GLOBAL_WALLPAPER
|
||||||
|
call PONYDOS_SEG:SYS_READ_SECTORS
|
||||||
|
|
||||||
|
ret
|
||||||
|
|
||||||
|
wallpaper_name db 'wallpaper.bin', 0
|
||||||
|
|
Loading…
Reference in a new issue