File tree Expand file tree Collapse file tree 5 files changed +73
-12
lines changed Expand file tree Collapse file tree 5 files changed +73
-12
lines changed Original file line number Diff line number Diff line change @@ -468,15 +468,15 @@ cs_command:
468
468
; Commands supported by bootOS
469
469
;
470
470
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
477
477
db 1 , "#"
478
- dw cs_command
479
- db 0
478
+ . cs : dw cs_command
479
+ db 0
480
480
481
481
int_restart: equ 0x20
482
482
int_input_key: equ 0x21
Original file line number Diff line number Diff line change
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.
1
4
load_file:
2
5
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.
3
10
save_file:
4
11
iret
12
+
13
+ ; Entry: DS:BX = Filename terminated with zero.
14
+ ; Output: None
5
15
delete_file:
6
16
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.
7
21
list_files:
8
- iret
22
+ mov cl , 0x00
23
+ ret
Original file line number Diff line number Diff line change
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.
1
4
load_file:
2
5
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.
3
10
save_file:
4
11
iret
12
+
13
+ ; Entry: DS:BX = Filename terminated with zero.
14
+ ; Output: None
5
15
delete_file:
6
16
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.
7
21
list_files:
8
- iret
22
+ mov cl , 0x00
23
+ ret
Original file line number Diff line number Diff line change 2
2
bits 16
3
3
4
4
current_dir: equ 0xe200
5
+ dir_space: equ 0xe300
5
6
6
7
stage1: mov si , 0x7c00
7
8
mov di , 0xe000
@@ -16,7 +17,7 @@ stage3: mov si, int_table
16
17
xor ax , ax
17
18
stosw
18
19
loop .copy
19
- mov word [ bootOS.ls_command ], ls_command
20
+ mov word [ bootOS.commands + 3 ], ls_command
20
21
mov di , current_dir
21
22
mov cx , 0xfe
22
23
mov al , "/"
@@ -33,8 +34,38 @@ stage3: mov si, int_table
33
34
%include MODULE
34
35
35
36
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
37
46
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
38
69
39
70
int_table:
40
71
dw load_file
You can’t perform that action at this time.
0 commit comments