forked from Osama-Moh/Micro1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
yarab.asm
122 lines (91 loc) · 1.44 KB
/
yarab.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
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
extern Drawboard:far
public Filename
.model Small
.stack 64
.data
BoardData db 9C40h dup(?);
Filename db 'chess.bin', 0h;
DIRECTORY DB 'D:\Pieces',0h
filehandle dw ?
chessData db 625d dup(?);
.code
main PROC far
mov ax , @data ;
mov ds , ax ;
call Drawboard
;--------------------------input data------------------------------------
mov ax,'bb'
mov Filename,al
mov Filename+1,ah
mov ax,'k.'
mov Filename+2,ah
mov Filename+3,al
mov ax,'bi'
mov Filename+4,ah
mov Filename+5,al
mov ah,'n'
mov Filename+6,ah
mov ah,0
mov Filename+7,ah
;--------------------------------------------------------------
call DrawPiece
mov ah , 4ch ;
int 21h;
hlt
main ENDP
DrawPiece proc far
MOV AH, 3BH
MOV DX, OFFSET DIRECTORY
INT 21H
mov ah,0;
mov al,13h;
int 10h;
call OpenFile;
call ReadData;
LEA bx , chessData
mov cx , 30h ;
mov dx , 0h ;
mov ah ,0ch ;
drawingloop :
mov al ,[Bx] ;
int 10h;
inc cx;
inc bx;
cmp cx , 49h;
JNE drawingloop ;
mov cx , 30H ;
inc dx ;
cmp dx, 19h;
JNE drawingloop;
mov ah , 0h ;
int 16h ;
call closeFile ;
;mov ah , 0h ;
;mov al , 3h ;
;int 10h ;
ret
DrawPiece ENDP
OpenFile proc
mov ah , 3dh ;
mov al ,0h ;
LEA dx,Filename ;
int 21h ;
mov [filehandle], ax;
RET ;
OpenFile ENDP ;
ReadData proc
mov ah , 3fh ;
mov bx , [filehandle];
mov cx , 625d;
LEA dx ,chessData;
int 21h;
;mov ah , 3fh;
RET;
ReadData ENDP;
closeFile proc;
mov ah , 3eh;
mov bx , [filehandle];
int 21h;
RET ;
closeFile ENDP;
End main