§ Игра
Это очень простая игра, которая всем известна.
§ Код
1 org 100h
2
3
4 mov ax, 0013h
5 int 10h
6 mov ax, cs
7 add ax, 1000h
8 mov ds, ax
9 mov es, ax
10
11
12 mov cx, 16000
13 xor eax, eax
14 rep stosw
15 mov ax, $A000
16 mov es, ax
17
18
19 mov dx, $3C8
20 mov al, 1
21 out dx, al
22 inc dx
23 mov al, $1F
24 out dx, al
25 mov al, $3F
26 out dx, al
27 mov al, $1F
28 out dx, al
29
30
31 xor di, di
32 mov cx, 32000
33@@: add ax, bx
34 mul bx
35 add ax, cx
36 add bx, ax
37 add ax, dx
38 mov dx, ax
39 and ax, 0101h
40 stosw
41 mov ax, dx
42 loop @b
43
44
45.T0: mov di, 1
46 mov si, 1
47
48
49 imul bx, di, 320
50 add bx, si
51
52 mov dx, 198
53.R2: mov cx, 318
54
55
56.R1: xor ax, ax
57 add al, [es:bx-320-1]
58 add al, [es:bx-320+0]
59 add al, [es:bx-320+1]
60 add al, [es:bx -1]
61 add al, [es:bx +1]
62 add al, [es:bx+320-1]
63 add al, [es:bx+320+0]
64 add al, [es:bx+320+1]
65
66
67 cmp [es:bx], byte 1
68 je .C1
69.C0: cmp al, 3
70 je .S1
71 jmp .S0
72.C1: cmp al, 2
73 je .S1
74 cmp al, 3
75 je .S1
76.S0: mov [bx], byte 0
77 jmp .NX
78.S1: mov [bx], byte 1
79.NX: inc bx
80 loop .R1
81 add bx, 2
82 dec dx
83 jne .R2
84
85
86 mov cx, 16000
87 xor si, si
88 xor di, di
89 rep movsd
90 jmp .T0