-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTXT.INC
96 lines (77 loc) · 2.21 KB
/
TXT.INC
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
; TXT Unit for file lister <C> 1992 Created by Dàrk Shàde
CODE
LoadTXT PROC
xor di, di ; Destination is at es:0
push si
push bx
push cx
call TellFile
pop cx
pop bx
pop si
jmp ReadData
LoopScr: mov al, fs:[si]
cmp al, 7 ; Skip the nagging beep!
jb WriteChar
cmp al, 11
je WriteChar
cmp al, 12
je WriteChar
cmp al, 13
ja WriteChar
cmp al, 10
jne Not10 ; We've found <lf>
call NewLine
cmp BYTE PTR fs:[si + 1], 13
jne CheckLn ; It's actually <lf/cr> "… la Unix"
inc si
dec cx
jz ReadData
jmp CheckLn
Not10: cmp al, 13
jne Not13 ; We've found <cr>
call NewLine
cmp BYTE PTR fs:[si + 1], 10
jne CheckLn ; Actually <cr/lf> "… la DOS"
inc si
dec cx
jz ReadData
jmp CheckLn
Not13: cmp al, 08
jne CheckNxt
or di, di
jz CheckNxt
dec si
jmp CheckNxt
WriteChar: mov es:[di], ax
CheckNxt: add di, 2
CheckLn: inc si
cmp di, ScrEnd
jne NotFull
push si
push bx
push cx
call ShowMore
call TellFile
pop cx
pop bx
pop si
mov ah, 07h
NotFull: dec cx
jz ReadData
jmp LoopScr
NewLine: push cx
call FixupDI
pop cx
ret
ReadData: mov cx, 16384
call ReadFile
or ax, ax
jz PCheckNext ; There's no more to read =(
mov cx, ax ; cx = Length
xor si, si
mov ah, 07 ; ah = Color
jmp LoopScr
PCheckNext:call FixupDI
ret
LoadTXT ENDP