-
Notifications
You must be signed in to change notification settings - Fork 0
/
VV.inc
214 lines (178 loc) · 4.77 KB
/
VV.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
TITLE Procedure for Checking of Voted Voters
;By Najeeb Khan
.data
InID BYTE "0000",0
flag BYTE 0
ReadSize1 BYTE 5 DUP(?)
handle1 WORD ?
EndOfFile BYTE "0000",0
File1 BYTE "VotedVoters.txt",0
File2 BYTE "VotedVoters.txt",0
handle3 WORD ?
.code
Validate_Voter PROC
mov ax,@data
mov ds,ax
mov flag, 0
;Open existing file
mov ax, 716Ch ; Extended Open/Create
mov bx, 2 ; read-write-both
mov cx, 0 ; normal attribute
mov dx, 1 ; open existing file
mov si, OFFSET File1
int 21h
mov handle1, ax ; file handle
;set file pointer
mov ah, 42h
mov al, 0
mov bx, handle1
mov cx, 0
mov dx, 0
int 21h
;Read the input file
Read:
mov ah, 3Fh ; read file or device
mov bx, handle ; file handle
mov cx, 4 ; max bytes to read
mov dx, OFFSET ReadSize ; buffer pointer
int 21h
; jc quit ; quit if error
invoke str_compare, ADDR EndOfFile, ADDR ReadSize1
jz quit1
invoke str_compare, ADDR InID, ADDR ReadSize1
jz Voted
loop Read
Voted:
mov flag, 1
quit1:
; Close the file
mov ah, 3Eh ; function: close file
mov bx, handle1 ; input file handle
int 21h ; call MS-DOS
ret
Validate_Voter endp
;---------------------------------------------------------
jmp_to_startpoling proc
mov ax,@data
mov ds,ax
; Switch to a graphics mode
mov ah,0 ; set video mode
mov al,Mode_6A ; 800 X 600, 16 colors
int 10h
mov dl, 16
mov dh, 7
call gotoxy
mWrite<"|QUIT|">
; Draw the X-axis
mov cx,0; X-coord of start of line
mov dx,30 ; Y-coord of start of line
mov ax,640 ; length of line
mov bl,lightcyan ; line color (see IRVINE16.inc)
call DrawHorizLine ; draw the line now
mov dl,5
mov dh,13
call gotoxy
mwrite <" Enter Your Name ">
; Draw the X-axis
mov cx,300; X-coord of start of line
mov dx,200 ; Y-coord of start of line
mov ax,200 ; length of line
mov bl,white ; line color (see IRVINE16.inc)
call DrawHorizLine ; draw the line now
mov cx,300; X-coord of start of line
mov dx,230 ; Y-coord of start of line
mov ax,200 ; length of line
mov bl,white ; line color (see IRVINE16.inc)
call DrawHorizLine ; draw the line now
; Draw the Y-axis
mov cx,300; X-coord of start of line
mov dx,200 ; Y-coord of start of line
mov ax,30 ; length of line
mov bl,yellow ; line color
call DrawVerticalLine ; draw the line now
mov cx,500; X-coord of start of line
mov dx,200 ; Y-coord of start of line
mov ax,30 ; length of line
mov bl,yellow ; line color
call DrawVerticalLine ; draw the line now
mov dl,5
mov dh,19
call gotoxy
mwrite <" Enter Your CINC ">
; Draw the X-axis
mov cx,300; X-coord of start of line
mov dx,300 ; Y-coord of start of line
mov ax,200 ; length of line
mov bl,white ; line color (see IRVINE16.inc)
call DrawHorizLine ; draw the line now
mov cx,300; X-coord of start of line
mov dx,330 ; Y-coord of start of line
mov ax,200 ; length of line
mov bl,white ; line color (see IRVINE16.inc)
call DrawHorizLine ; draw the line now
; Draw the Y-axis
mov cx,300; X-coord of start of line
mov dx,300 ; Y-coord of start of line
mov ax,30 ; length of line
mov bl,yellow ; line color
call DrawVerticalLine ; draw the line now
mov cx,500; X-coord of start of line
mov dx,300 ; Y-coord of start of line
mov ax,30 ; length of line
mov bl,yellow ; line color
call DrawVerticalLine ; draw the line now
mov dl,40
mov dh,13
call gotoxy
mov si,offset InID
call input_keyboard
mov dl,40
mov dh,19
call gotoxy
mov si,offset InID
call input_keyboard
call waitmsg
call Validate_Voter
.IF (flag == 1)
mov dl, 5
mov dh, 25
call gotoxy
mWrite<"Sorry! You have Already Voted, You Cannot Vote : ">
call waitmsg
call jmp_to_startpoling
.ENDIF
mWrite<"You Can Now Vote..">
call vote_cast
ret
jmp_to_startpoling endp
VoterVoted PROC
mov ax,@data
mov ds,ax
;Open existing file
mov ax, 716Ch ; Extended Open/Create
mov bx, 2 ; read-write-both
mov cx, 0 ; normal attribute
mov dx, 1 ; open existing file
mov si, OFFSET File2
int 21h
mov handle3, ax ; file handle
;set file pointer
mov ah, 42h
mov al, 1
mov bx, handle3
mov cx, 0
mov dx, -4
int 21h
;write to file
mov ah, 40h
mov bx, handle3
mov cx, SIZEOF InID
mov dx, OFFSET InID
int 21h
; Close the file
mov ah,3Eh ; function: close file
mov bx,handle1 ; input file handle
int 21h ; call MS-DOS
call jmp_to_startpoling
ret
VoterVoted endp