Subversion Repositories SvarDOS

Rev

Rev 1154 | Details | Compare with Previous | Last modification | View Log | RSS feed

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