forked from Osama-Moh/Micro1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Draw.asm
77 lines (56 loc) · 1014 Bytes
/
Draw.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
.MODEL LARGE
.STACK 64
.DATA
boardWidth equ 200d
boardHeight equ 200d
FILENAME DB 'Grey.bin', 0
FILEHANDLE DW ?
IMAGEDATA DB boardWidth*boardHeight DUP(0)
.CODE
MAIN PROC FAR
MOV AX, @DATA
MOV DS, AX
CALL OpenFile
CALL ReadData
MOV AH, 0H
MOV AL, 13H
INT 10H
MOV CX, 0H
MOV DX, 0H
MOV AH, 0CH
MOV BX, OFFSET IMAGEDATA
DRAWROW: MOV AL, [BX]
INT 10H
INC CX
INC BX
CMP CX, boardWidth
JNZ DRAWROW
MOV CX, 0H
INC DX
CMP DX, boardHeight
JNZ DRAWROW
CALL CloseFile
MAIN ENDP
OpenFile PROC
MOV AH, 3DH
MOV AL, 0 ; READ ONLY
LEA DX, FILENAME
INT 21H
MOV [FILEHANDLE], AX
RET
OpenFile ENDP
ReadData PROC
MOV AH, 3FH
MOV BX, [FILEHANDLE]
MOV CX, boardWidth*boardHeight
LEA DX, IMAGEDATA
INT 21H
RET
ReadData ENDP
CloseFile PROC
MOV AH, 3EH
MOV BX, [FILEHANDLE]
INT 21H
RET
CloseFile ENDP
END MAIN