-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathset and get file attributes.asm
75 lines (45 loc) · 1.42 KB
/
set and get file attributes.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name "attrib"
; set and get file attributes...
; note 1: you need to manually create and copy "test.txt" to:
; c:\emu8086\vdrive\c before running this example.
; note 2: it may look like the file suddenly disappears unless
; you set the settings of file manager to show system and hidden files.
; note 3: file must exist for setting parameters. however reading
; parameters does not require the existance of a file and
; it is usually used to check if file exists or not.
org 100h
jmp start
filename db "c:\test.txt", 0
sOK db "ok! file found. attributes set: system, hidden & read-only. $"
sERR db "file does not exist. (expected i/o error)", 0dh, 0ah
db ' you need to manually create and copy "test.txt" to:', 0dh, 0ah
db ' "c:\emu8086\vdrive\c" before running this example.$ '
; when running in emulator, the real path of this file is:
; c:\emu8086\vdrive\c\test.txt
start:
xor cx, cx
; read attributes:
mov ah, 43h
mov al, 0
mov dx, offset filename
int 21h
jc error
; set new attributes:
mov ah, 43h
mov al, 1
mov cx, 7
mov dx, offset filename
int 21h
jc error
mov dx, offset sOK
mov ah, 9
int 21h
jmp wait_any_key
error:
mov dx, offset sERR
mov ah, 9
int 21h
wait_any_key:
mov ah, 0
int 16h
ret