Skip to content

Commit 0264242

Browse files
committed
prepare for fat12
1 parent 033cb41 commit 0264242

File tree

5 files changed

+73
-12
lines changed

5 files changed

+73
-12
lines changed

os.asm

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -468,15 +468,15 @@ cs_command:
468468
; Commands supported by bootOS
469469
;
470470
commands:
471-
db 2,"ls"
472-
dw ls_command
473-
db 4,"edit"
474-
dw edit_command
475-
db 2,"rm"
476-
dw rm_command
471+
db 2,"ls"
472+
.ls: dw ls_command
473+
db 4,"edit"
474+
.edit: dw edit_command
475+
db 2,"rm"
476+
.rm: dw rm_command
477477
db 1,"#"
478-
dw cs_command
479-
db 0
478+
.cs: dw cs_command
479+
db 0
480480

481481
int_restart: equ 0x20
482482
int_input_key: equ 0x21

osall.iso

57 Bytes
Binary file not shown.

shared/dummyfs.asm

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
1+
; Entry: DS:BX = Filename terminated with zero.
2+
; ES:DI = Point to source data (512 bytes)
3+
; Output: Carry flag = 0 = Found, 1 = Not found.
14
load_file:
25
iret
6+
7+
; Entry: DS:BX = Filename terminated with zero.
8+
; ES:DI = Point to data target (512 bytes)
9+
; Output: Carry flag = 0 = Successful. 1 = Error.
310
save_file:
411
iret
12+
13+
; Entry: DS:BX = Filename terminated with zero.
14+
; Output: None
515
delete_file:
616
iret
17+
18+
; Entry: ES:DI = Point to data target (seperated by \r)
19+
; DS:BX = Directory name terminated with zero.
20+
; Output: CL = Number of file.
721
list_files:
8-
iret
22+
mov cl, 0x00
23+
ret

shared/fat12.asm

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
1+
; Entry: DS:BX = Filename terminated with zero.
2+
; ES:DI = Point to source data (512 bytes)
3+
; Output: Carry flag = 0 = Found, 1 = Not found.
14
load_file:
25
iret
6+
7+
; Entry: DS:BX = Filename terminated with zero.
8+
; ES:DI = Point to data target (512 bytes)
9+
; Output: Carry flag = 0 = Successful. 1 = Error.
310
save_file:
411
iret
12+
13+
; Entry: DS:BX = Filename terminated with zero.
14+
; Output: None
515
delete_file:
616
iret
17+
18+
; Entry: ES:DI = Point to data target (seperated by \r)
19+
; DS:BX = Directory name terminated with zero.
20+
; Output: CL = Number of file.
721
list_files:
8-
iret
22+
mov cl, 0x00
23+
ret

shared/fsloader.asm

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
bits 16
33

44
current_dir: equ 0xe200
5+
dir_space: equ 0xe300
56

67
stage1: mov si, 0x7c00
78
mov di, 0xe000
@@ -16,7 +17,7 @@ stage3: mov si, int_table
1617
xor ax, ax
1718
stosw
1819
loop .copy
19-
mov word [bootOS.ls_command], ls_command
20+
mov word [bootOS.commands + 3], ls_command
2021
mov di, current_dir
2122
mov cx, 0xfe
2223
mov al, "/"
@@ -33,8 +34,38 @@ stage3: mov si, int_table
3334
%include MODULE
3435

3536
ls_command:
36-
mov si, current_dir
37+
push cs
38+
pop es
39+
mov bx, current_dir
40+
mov di, dir_space
41+
push di
42+
mov cx, 0xff
43+
xor ax, ax
44+
rep stosb
45+
pop di
3746
call list_files
47+
mov ah, 0x0e
48+
mov bx, 0x0007
49+
mov si, dir_space
50+
inc cl
51+
jmp short .1
52+
.loop1: pusha
53+
mov al, 0x0a
54+
int 0x10
55+
mov al, 0x0d
56+
int 0x10
57+
popa
58+
.1: dec cl
59+
cmp cl, 0x00
60+
je .end
61+
.loop2: lodsb
62+
cmp al, 0x00
63+
je .loop1
64+
pusha
65+
int 0x10
66+
popa
67+
jmp .loop2
68+
.end: ret
3869

3970
int_table:
4071
dw load_file

0 commit comments

Comments
 (0)