Subversion Repositories SvarDOS

Rev

Rev 1154 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1154 Rev 1155
1
;
1
;
2
; lists files using first or second FCB provided by COMMAND.COM in PSP
2
; lists files using first or second FCB provided by COMMAND.COM in PSP
3
; Copyright (C) 2022 Mateusz Viste
3
; Copyright (C) 2022 Mateusz Viste
4
;
4
;
5
; to be assembled with NASM.
5
; to be assembled with NASM.
6
;
6
;
7
; lists file entries matching first argument of the program using the default
7
; lists file entries matching first argument of the program using the default
8
; unopened FCB entry in PSP as preset by COMMAND.COM.
8
; unopened FCB entry in PSP as preset by COMMAND.COM.
9
;
9
;
10
; usage: fcbdir file-pattern
10
; usage: fcbdir file-pattern
11
;
11
;
12
; example: fcbdir c:*.txt
12
; example: fcbdir c:*.txt
13
;
13
;
14
 
14
 
15
CPU 8086
15
CPU 8086
16
org 0x100
16
org 0x100
17
 
17
 
-
 
18
; print whatever drive/filename is set at 0x5C (1st unopened FCB in the PSP)
-
 
19
mov dx, PARAM
-
 
20
mov ah, 0x09
-
 
21
int 0x21
-
 
22
 
-
 
23
mov bx, 0x5C
-
 
24
call PRINTDTA
-
 
25
 
18
; FindFirst_FCB applied to PSP:5C (1st unopened FCB)
26
; FindFirst_FCB applied to PSP:5C (1st unopened FCB)
19
mov dx, 0x5C
27
mov dx, 0x5C
20
mov ah, 0x11
28
mov ah, 0x11
21
int 0x21
29
int 0x21
22
 
30
 
23
cmp al, 0
31
cmp al, 0
24
jne GAMEOVER
32
jne GAMEOVER
25
 
33
 
26
NEXT:
34
NEXT:
27
 
35
 
28
; print filename in DTA
36
; print filename in DTA
-
 
37
mov bx, 0x80
29
call PRINTDTA
38
call PRINTDTA
30
 
39
 
31
; FindNext_FCB on PSP until nothing left
40
; FindNext_FCB on PSP until nothing left
32
mov ah, 0x12
41
mov ah, 0x12
33
mov dx, 0x5C
42
mov dx, 0x5C
34
int 0x21
43
int 0x21
35
cmp al, 0
44
cmp al, 0
36
je NEXT
45
je NEXT
37
 
46
 
38
GAMEOVER:
47
GAMEOVER:
39
 
48
 
40
int 0x20
49
int 0x20
41
 
50
 
-
 
51
PARAM:
-
 
52
db "PARAMETER = $";
42
 
53
 
43
 
54
 
44
; ****** print the filename present in the DTA (DTA is assumed at 0x80) ******
55
; ****** print the filename present in the DTA (DTA is at [BX]) ******
45
PRINTDTA:
56
PRINTDTA:
46
; print drive in the DTA
57
; print drive in the DTA
47
mov ah, 0x02
58
mov ah, 0x02
48
mov dl, [0x80]
59
mov dl, [bx]
49
add dl, 'A'
60
add dl, '@'
50
int 0x21
61
int 0x21
51
mov dl, ':'
62
mov dl, ':'
52
int 0x21
63
int 0x21
53
; print filename/extension (in FCB format)
64
; print filename/extension (in FCB format)
54
mov ah, 0x40    ; write to file
65
mov ah, 0x40    ; write to file
55
mov bx, 1       ; output to stdout
-
 
56
mov cx, 11      ; 11 bytes (8+3)
66
mov cx, 11      ; 11 bytes (8+3)
57
mov dx, 0x81    ; filename field at the default DTA location
67
mov dx, bx      ; filename field at the default DTA location
-
 
68
inc dx
-
 
69
mov bx, 1       ; output to stdout
58
int 0x21
70
int 0x21
59
; print a trailing CR/LF
71
; print a trailing CR/LF
60
mov ah, 0x02    ; display character in DL
72
mov ah, 0x02    ; display character in DL
61
mov dl, 0x0D    ; CR
73
mov dl, 0x0D    ; CR
62
int 0x21
74
int 0x21
63
mov dl, 0x0A    ; LF
75
mov dl, 0x0A    ; LF
64
int 0x21
76
int 0x21
65
ret
77
ret
66
 
78