-
Notifications
You must be signed in to change notification settings - Fork 0
/
addvoter.inc
87 lines (72 loc) · 1.28 KB
/
addvoter.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
TITLE Add Voters Procedure
;by Najeeb Khan
.data
handle2 WORD ?
VotersFile1 BYTE "voters1.txt",0
VoterName BYTE 20 DUP(?)
VoterID BYTE 5 DUP(?)
NL BYTE " ",0dh, 0ah
.code
ADD_VOTER PROC
mov ax,@data
mov ds,ax
mov ah,0 ; set video mode
mov al,Mode_6A ; 800 X 600, 16 colors
int 10h
mWrite<"Enter Name : ">
mReadStr VoterName
call crlf
mWrite<"Enter ID : ">
mReadStr VoterID
call crlf
;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 VotersFile1
int 21h
mov handle2, ax ; file handle
;set file pointer
mov ah, 42h
mov al, 2
mov bx, handle2
mov cx, 0
mov dx, 0
int 21h
;write to file
mov ah, 40h
mov bx, handle2
mov cx, SIZEOF VoterName-1
mov dx, OFFSET VoterName
int 21h
;set file pointer
mov ah, 42h
mov al, 2
mov bx, handle2
mov cx, 0
mov dx, 2
int 21h
mov ah, 40h
mov bx, handle2
mov cx, SIZEOF VoterID-1
mov dx, OFFSET VoterID
int 21h
;set file pointer
mov ah, 42h
mov al, 2
mov bx, handle2
mov cx, 0
mov dx, 2
int 21h
mov ah, 40h
mov bx, handle2
mov cx, SIZEOF NL
mov dx, OFFSET NL
int 21h
;Close the file
mov ah,3Eh ; function: close file
mov bx,handle2 ; input file handle
int 21h ; call MS-DOS
ret
ADD_VOTER endp