-
Notifications
You must be signed in to change notification settings - Fork 0
/
linetest.asm
127 lines (113 loc) · 1.89 KB
/
linetest.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
121
122
123
124
125
126
127
.286
.model tiny
.code
org 100h
start:
jmp _s
x dw 150
y dw 70
n dw 60
color db 50
_s:
mov ah,0Fh ;çàïîìíèòü âèäåîðåæèì
int 10h
mov videor,al
mov ax,13h
int 10h;óñòàíîâèëè âèäåîðåæèì 256x320x200
call LineDraw ;ðèñóåì ëèíèþ
mov ah,0 ;æäåì íàæàòèÿ íà êëàâèøó
int 16h
mov ax, word ptr videor ;âîññòàíîâèòü âèäåîðåæèì
int 10h
int 20h ;âûõîä èç ïðîãðàììû
videor db 0,0
LineDraw proc
;ïðåäâàðèòåëüíûå óñòàíîâêè
PUSH 0A000h
POP ES; ïîçèöèîíèðóåì ES íà îáëàñòü âèäåîïàìÿòè
MOV DI,X ; â DI êîîðäèíàòû íà÷àëüíîé òî÷êè ïî X
MOV AX,320; äëèíà ñòðîêè ýêðàíà
MUL Y; óìíîæàåì íà Y
ADD DI,AX; è ñêëàäûâàåì ñ X
;push di
;MOV AL, 1; öâåò ëèíèè
;mov di, 0
; ðèñóåì ãîðèçîíòàëüíóþ ëèíèþ
;MOV CX, 320*200 ; N; äëèíà ëèíèè
;REP STOSB
;pop di
; ðèñóåì ëèíèþ ïî òî÷êàì
mov y, 0
cy:
mov x, 0
cyx:
; push x ; color
; push y
; push x
; jmp p13 ;call pix13 ; color y x ->
;mov bx, 320
;mov ax, y
;mul bx
; mov bx, y
;add ax, x
;mov bx, ax
mov ax, x
mov es:[bx], al
t1:
mov bx, ax ; x !!!!
inc bx
inc bx
cmp bx, 320*200
je stepy
mov x, bx
jmp cyx
stepy:
mov bx, y
inc bx
mov y, bx
cmp bx, 1
je e
jmp cy
e:
ret
push di
MOV AL, 60; öâåò ëèíèè
;Âåðòèêàëüíóþ ëèíèþ îáû÷íî ðèñóþò öèêëîì
MOV CX,N; äëèíà ëèíèè
A1: MOV ES:[DI],AL; ðèñóåì òî÷êó íà ñòðîêå
ADD DI,320; ïåðåõîä íà ñëåäóþùóþ ñòðîêó
LOOP A1
pop di
push di
MOV AL, 70; öâåò ëèíèè
;äèàãîíàëüíóþ ëèíèþ ñ íàêëîíîì âëåâî ìîæíî íàðèñîâàòü öèêëîì
MOV CX,N; äëèíà ëèíèè
A2: MOV ES:[DI],AL; ðèñóåì òî÷êó íà ñòðîêå
ADD DI,319; ïåðåõîä íà ñëåäóþùóþ ñòðîêó
LOOP A2
pop di
MOV AL, 80; öâåò ëèíèè
;äèàãîíàëüíóþ ëèíèþ ñ íàêëîíîì âïðàâî — öèêëîì
MOV CX,N; äëèíà ëèíèè
A3: MOV ES:[DI],AL; ðèñóåì òî÷êó íà ñòðîêå
ADD DI,321; ïåðåõîä íà ñëåäóþùóþ ñòðîêó
LOOP A3
ret
LineDraw endp
; color y x ->
pix13 proc
p13: pop bx
pop ax
mov dx, 320
mul dx
add ax, bx
;mov bx, 0a000h
pop cx
;push es
;mov es, bx
mov bx, ax
mov es:[bx], cl
;pop es
jmp t1
pix13 endp
end start