-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLaba1.pas
108 lines (96 loc) · 1.28 KB
/
Laba1.pas
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
{$G+}
const
slovo: string = 'Hello world!';
var
x, y: integer;
begin
asm
mov y, 12
mov x, 33
mov ax, 3
int 10h
push $b800
pop es
lea si, slovo
mov cl, [si]
add cl, cl
jmp @print
@clear:
add bx,bx
mov di,bx
xor ax, ax
mov cx, 80
rep stosw
@print:
mov ax, y
mov cl, 80
mul cl
mov bx, ax
add ax, x
shl ax, 1
mov di, ax
mov ah, $1f
lea si, slovo
mov cl, [si]
xor ch, ch
inc si
mov dx, x
@p:
lodsb
cmp dx, 80
jne @normalPrint
sub di, 160
@normalPrint:
stosw
inc dx
loop @p
@readKey:
xor ah, ah
int 16h
cmp ah, 48h
je @up
cmp ah, 50h
je @down
cmp ah, 4bh
je @left
cmp ah, 4dh
je @right
cmp ah, 01h
je @exit
jmp @readKey
@up:
cmp y, 0
jne @upNormal
mov y, 24
jmp @clear
@upNormal:
dec y
jmp @clear
@down:
cmp y, 24
jne @downNormal
mov y, 0
jmp @clear
@downNormal:
inc y
jmp @clear
@left:
cmp x, 0
jne @leftNormal
mov x, 79
jmp @clear
@leftNormal:
dec x
jmp @clear
@right:
mov ax, 80
cmp x, ax
jne @rightNormal
mov x, 0
jmp @clear
@rightNormal:
inc x
jmp @clear
@exit:
end;
end.