-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathplasma.asm
177 lines (153 loc) · 2.78 KB
/
plasma.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
; (C) February 20, 2001 M. Feliks
include sys.inc
.model tiny
.code
.386
org 100h
entrypoint:
call do_startup
call inicjuj_palete
call inicjuj_texture
petla:
call rotacja_palety
call timer_wait
mov ah, 6h
mov dl, 0ffh
int 21h
jz petla
call do_shutdown
rotacja_palety proc
mov dx, 03c7h
xor ax, ax
out dx, al
add dx, 2
mov di, offset paleta
mov cx, 768
cld
rep insb
mov si, 3
mov bl, paleta[si]
mov bh, paleta[si+1]
mov dl, paleta[si+2]
mov si, offset paleta
mov di, si
add si, 6
add di, 3
mov cx, 768-3
cld
rep movsb
mov si, 765
mov paleta[si], bl
mov paleta[si+1], bh
mov paleta[si+2], dl
mov dx, 03c8h
xor ax, ax
out dx, al
inc dx
mov si, offset paleta
mov cx, 768
cld
rep outsb
ret
endp
inicjuj_palete proc
mov dx, 03c8h
xor ax, ax
out dx, al
inc dx
mov cx, 64
kolor1:
xor al, al
out dx, al
out dx, al
mov al, ah
out dx, al
inc ah
mov al, ah
loop kolor1
mov cx, 64
xor ax, ax
kolor2:
xor al, al
out dx, al
mov al, ah
out dx, al
mov al, 63
out dx, al
inc ah
loop kolor2
mov cx, 64
xor ax, ax
kolor3:
mov al, ah
out dx, al
mov al, 63
out dx, al
out dx, al
inc ah
loop kolor3
mov cx, 64
mov al, 63
kolor4:
out dx, al
out dx, al
out dx, al
loop kolor4
ret
endp
; 127 + 63.5 * sin(x * 3 * (3.14 / 180)) + 63.5 * sin(y * 5 * (3.14 / 180))
inicjuj_texture proc
fldpi
mov _fpom16, 180
fidiv _fpom16
fstp st_rad
push es
mov ax, 0a000h
mov es, ax
xor di, di
xor dx, dx
itex_pion:
xor cx, cx
fld st_rad
mov _fpom16, 5
fimul _fpom16
mov _fpom16, dx
fimul _fpom16
fsin
fmul mnoznik
fstp _fpom32
itex_poziom:
fld st_rad
mov _fpom16, 3
fimul _fpom16
mov _fpom16, cx
fimul _fpom16
fsin
fmul mnoznik
fadd _fpom32
mov _fpom16, 127
fiadd _fpom16
fistp _fpom16
mov ax, _fpom16
or al, al
jnz itex_dalej
mov al, 1
itex_dalej:
stosb
inc cx
cmp cx, 320
jne itex_poziom
inc dx
cmp dx, 200
jne itex_pion
pop es
ret
endp
.data
mnoznik dd 63.5
.data?
_fpom32 dd ?
_fpom16 dw ?
st_rad dd ?
paleta db 768 dup(?)
end entrypoint