1
2
3
4
5
6
7
8
9
10
11
12
13
14 bstruc struc
15 bsize dw ?
16 bfirst dw ?
17 blast dw ?
18 bin dw ?
19 bout dw ?
20 bminor db ?
21 mbuffer dw ?
22 bstruc ends
23
24 def_buf macro bname,bufsize
25 bname bstruc <bufsize>
26 db bufsize dup(?)
27 endm
28
29 init_buf macro bname
30 mov bx, offset bname
31 mov ax, offset bname.mbuffer
32 mov bfirst[bx],ax
33 mov bin[bx],ax
34 mov bout[bx],ax
35 add ax,bname.bsize
36 mov blast[bx],ax
37 endm
38
39 put_buf macro bname,nostop
40 push si
41 push bx
42 mov bx,offset bname
43 mov si, bin[bx]
44 mov byte ptr ds:[si],al
45
46
47
48
49
50 inc si
51 cmp si,blast[bx]
52 nae1 = $
53 jbe short $+(nae2-nae1)
54 mov si,bfirst[bx]
55 nae2 = $
56
57
58 mov ax,1
59 ifb <nostop>
60 cmp si, bout[bx]
61 novf1 = $
62 je $ + (novf2 - novf1)
63 endif
64 mov bin[bx],si
65 xor ax,ax
66 novf2 = $
67 pop bx
68 pop si
69 endm
70
71 get_buf macro bname
72 push si
73 push bx
74 mov bx, offset bname
75 mov si,bout[bx]
76 cmp si,bin[bx]
77 bemp1 = $
78 je $ + (bemp2 - bemp1)
79
80
81
82 mov al,byte ptr ds:[si]
83
84
85
86
87 inc si
88 cmp si,blast[bx]
89 nae3 = $
90 jbe $ + (nae4 - nae3)
91 mov si,bfirst[bx]
92 nae4 = $
93 mov bout[bx],si
94 stc
95 bnemp1 = $
96 jmp $ + (bnemp2 - bnemp1)
97
98
99
100 bemp2 = $
101 clc
102 bnemp2 = $
103 pop bx
104 pop si
105 endm
106
107 len_buf macro bname
108 push bx
109 mov bx,offset bname
110 mov ax,bout[bx]
111 sub ax,bin[bx]
112 lb1 = $
113 ja $ + (lb2-lb1)
114 add ax,bsize[bx]
115 lb2 = $
116 pop bx
117 endm
118
119
120 ^Z