forked from Osama-Moh/Micro1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chess.asm
86 lines (68 loc) · 969 Bytes
/
chess.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
.model Small
.stack 64
.data
Filename db 'bn2.bin', 0h;
DIRECTORY DB 'D:\ttt',0h
filehandle dw ?
chessData db 625d dup(?);
.code
main PROC far
mov ax , @data ;
mov ds , ax ;
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 ;
mov ah , 4ch ;
int 21h;
hlt
main 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