Subversion Repositories SvarDOS

Rev

Go to most recent revision | Details | 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
 
18
; FindFirst_FCB applied to PSP:5C (1st unopened FCB)
19
mov dx, 0x5C
20
mov ah, 0x11
21
int 0x21
22
 
23
cmp al, 0
24
jne GAMEOVER
25
 
26
NEXT:
27
 
28
; print filename in DTA
29
call PRINTDTA
30
 
31
; FindNext_FCB on PSP until nothing left
32
mov ah, 0x12
33
mov dx, 0x5C
34
int 0x21
35
cmp al, 0
36
je NEXT
37
 
38
GAMEOVER:
39
 
40
int 0x20
41
 
42
 
43
 
44
; ****** print the filename present in the DTA (DTA is assumed at 0x80) ******
45
PRINTDTA:
46
; print drive in the DTA
47
mov ah, 0x02
48
mov dl, [0x80]
49
add dl, 'A'
50
int 0x21
51
mov dl, ':'
52
int 0x21
53
; print filename/extension (in FCB format)
54
mov ah, 0x40    ; write to file
55
mov bx, 1       ; output to stdout
56
mov cx, 11      ; 11 bytes (8+3)
57
mov dx, 0x81    ; filename field at the default DTA location
58
int 0x21
59
; print a trailing CR/LF
60
mov ah, 0x02    ; display character in DL
61
mov dl, 0x0D    ; CR
62
int 0x21
63
mov dl, 0x0A    ; LF
64
int 0x21
65
ret