Rev 133 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 133 | Rev 384 | ||
---|---|---|---|
Line 15... | Line 15... | ||
15 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
15 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 16... | Line 16... | ||
16 | 16 | ||
17 | ; If you're planning to write your own video driver I suggest |
17 | ; If you're planning to write your own video driver I suggest |
Line 18... | Line 18... | ||
18 | ; you replace the VESA12.INC file and see those instructions. |
18 | ; you replace the VESA12.INC file and see those instructions. |
19 | 19 | ||
20 | ScreenWidth equ 0xfe00 |
20 | ;ScreenWidth equ 0xfe00 |
21 | ScreenHeight equ 0xfe04 |
21 | ;ScreenHeight equ 0xfe04 |
22 | BytesPerScanLine equ 0xfe08 |
22 | ;BytesPerScanLine equ 0xfe08 |
23 | LFBAddress equ 0xfe80 |
23 | ;LFBAddress equ 0xfe80 |
Line 24... | Line 24... | ||
24 | ScreenBPP equ 0xfbf1 |
24 | ;ScreenBPP equ 0xfbf1 |
25 | WinMapAddress equ 0x460000 |
25 | ;WinMapAddress equ 0x460000 |
Line 74... | Line 74... | ||
74 | .image_cy dd ? |
74 | .image_cy dd ? |
75 | .pti dd ? |
75 | .pti dd ? |
76 | .abs_cx dd ? |
76 | .abs_cx dd ? |
77 | .abs_cy dd ? |
77 | .abs_cy dd ? |
78 | .line_increment dd ? |
78 | .line_increment dd ? |
79 | .source_bpp dd ? |
- | |
80 | .winmap_newline dd ? |
79 | .winmap_newline dd ? |
81 | .screen_newline dd ? |
80 | .screen_newline dd ? |
82 | .stack_data = 4*13 |
81 | .stack_data = 4*12 |
- | 82 | .edi dd ? |
|
- | 83 | .esi dd ? |
|
- | 84 | .ebp dd ? |
|
- | 85 | .esp dd ? |
|
- | 86 | .ebx dd ? |
|
- | 87 | .edx dd ? |
|
- | 88 | .ecx dd ? |
|
- | 89 | .eax dd ? |
|
- | 90 | .ret_addr dd ? |
|
- | 91 | .arg_0 dd ? |
|
83 | end virtual |
92 | end virtual |
Line 84... | Line 93... | ||
84 | 93 | ||
85 | align 4 |
94 | align 16 |
86 | ; ebx = pointer |
95 | ; ebx = pointer |
87 | ; ecx = size [x|y] |
96 | ; ecx = size [x|y] |
- | 97 | ; edx = coordinates [x|y] |
|
- | 98 | ; ebp = pointer to 'get' function |
|
- | 99 | ; esi = pointer to 'init' function |
|
88 | ; edx = coordinates [x|y] |
100 | ; edi = parameter for 'get' function |
89 | vesa20_putimage: |
101 | vesa20_putimage: |
90 | pushad |
102 | pushad |
Line 91... | Line 103... | ||
91 | call [disable_mouse] |
103 | call [disable_mouse] |
Line 92... | Line -... | ||
92 | - | ||
93 | sub esp, putimg.stack_data |
- | |
94 | - | ||
95 | mov [putimg.source_bpp], 3 |
- | |
96 | ; test ebx, 0x80000000 |
- | |
97 | ; jz @f |
- | |
98 | ; inc [putimg.source_bpp] |
- | |
99 | ; @@: |
104 | |
100 | ; and ebx, 0x7FFFFFFF |
105 | sub esp, putimg.stack_data |
Line 101... | Line 106... | ||
101 | 106 | ||
102 | ; save pointer to image |
107 | ; save pointer to image |
Line 115... | Line 120... | ||
115 | shr eax, 16 |
120 | shr eax, 16 |
116 | mov [putimg.image_cx], eax |
121 | mov [putimg.image_cx], eax |
117 | mov [putimg.image_cy], edx |
122 | mov [putimg.image_cy], edx |
Line 118... | Line 123... | ||
118 | 123 | ||
119 | ; calculate absolute (i.e. screen) coordinates |
124 | ; calculate absolute (i.e. screen) coordinates |
120 | mov eax, [0x3010] |
125 | mov eax, [TASK_BASE] |
121 | mov ebx, [eax-twdw + WDATA.box.left] |
126 | mov ebx, [eax-twdw + WDATA.box.left] |
122 | add ebx, [putimg.image_cx] |
127 | add ebx, [putimg.image_cx] |
123 | mov [putimg.abs_cx], ebx |
128 | mov [putimg.abs_cx], ebx |
124 | mov ebx, [eax-twdw + WDATA.box.top] |
129 | mov ebx, [eax-twdw + WDATA.box.top] |
Line 162... | Line 167... | ||
162 | 167 | ||
163 | ; line increment |
168 | ; line increment |
164 | mov eax, [putimg.image_sx] |
169 | mov eax, [putimg.image_sx] |
165 | sub eax, [putimg.real_sx] |
170 | sub eax, [putimg.real_sx] |
166 | ;; imul eax, [putimg.source_bpp] |
171 | ;; imul eax, [putimg.source_bpp] |
- | 172 | ; lea eax, [eax + eax * 2] |
|
- | 173 | call esi |
|
167 | lea eax, [eax + eax * 2] |
174 | add eax, [putimg.arg_0] |
Line 168... | Line 175... | ||
168 | mov [putimg.line_increment], eax |
175 | mov [putimg.line_increment], eax |
169 | 176 | ||
170 | ; winmap new line increment |
177 | ; winmap new line increment |
Line 181... | Line 188... | ||
181 | imul ecx, ebx |
188 | imul ecx, ebx |
182 | sub eax, ecx |
189 | sub eax, ecx |
183 | mov [putimg.screen_newline], eax |
190 | mov [putimg.screen_newline], eax |
Line 184... | Line 191... | ||
184 | 191 | ||
185 | ; pointer to image |
192 | ; pointer to image |
Line 186... | Line 193... | ||
186 | mov ecx, [putimg.pti] |
193 | mov esi, [putimg.pti] |
187 | 194 | ||
188 | ; pointer to screen |
195 | ; pointer to screen |
189 | mov edx, [putimg.abs_cy] |
196 | mov edx, [putimg.abs_cy] |
Line 202... | Line 209... | ||
202 | add eax, [putimg.abs_cx] |
209 | add eax, [putimg.abs_cx] |
203 | add eax, WinMapAddress |
210 | add eax, WinMapAddress |
204 | xchg eax, ebp |
211 | xchg eax, ebp |
Line 205... | Line 212... | ||
205 | 212 | ||
206 | ; get process number |
213 | ; get process number |
Line 207... | Line 214... | ||
207 | mov ebx, [0x3000] |
214 | mov ebx, [CURRENT_TASK] |
208 | 215 | ||
Line 209... | Line 216... | ||
209 | cmp byte [ScreenBPP], 32 |
216 | cmp byte [ScreenBPP], 32 |
210 | je put_image_end_32 |
217 | je put_image_end_32 |
211 | 218 | ||
212 | ;put_image_end_24: |
219 | ;put_image_end_24: |
213 | mov edi, [putimg.real_sy] |
220 | mov edi, [putimg.real_sy] |
Line 214... | Line 221... | ||
214 | align 4 |
221 | align 4 |
215 | .new_line: |
222 | .new_line: |
216 | mov esi, [putimg.real_sx] |
223 | mov ecx, [putimg.real_sx] |
Line -... | Line 224... | ||
- | 224 | ||
- | 225 | ; push ebp edx |
|
- | 226 | align 4 |
|
217 | 227 | .new_x: |
|
218 | ; push ebp edx |
228 | |
219 | align 4 |
229 | push [putimg.edi] |
220 | .new_x: |
230 | mov eax, [putimg.ebp+4] |
221 | 231 | call eax |
|
222 | cmp [ebp], bl |
232 | cmp [ebp], bl |
223 | jne .skip |
233 | jne .skip |
Line 224... | Line 234... | ||
224 | mov eax, [ecx] ; ecx = RRBBGGRR |
234 | ; mov eax, [esi] ; eax = RRBBGGRR |
225 | mov [edx], ax |
235 | mov [edx], ax |
226 | shr eax, 16 |
236 | shr eax, 16 |
Line 227... | Line 237... | ||
227 | mov [edx+2], al |
237 | mov [edx+2], al |
228 | .skip: |
238 | .skip: |
229 | 239 | ||
Line 230... | Line 240... | ||
230 | add ecx, 3 ;[putimg.source_bpp] |
240 | ; add esi, 3 ;[putimg.source_bpp] |
231 | add edx, 3 |
241 | add edx, 3 |
232 | inc ebp |
242 | inc ebp |
233 | 243 | ||
Line 234... | Line 244... | ||
234 | dec esi |
244 | dec ecx |
Line 249... | Line 259... | ||
249 | 259 | ||
250 | put_image_end_32: |
260 | put_image_end_32: |
251 | mov edi, [putimg.real_sy] |
261 | mov edi, [putimg.real_sy] |
252 | align 4 |
262 | align 4 |
253 | .new_line: |
263 | .new_line: |
Line 254... | Line 264... | ||
254 | mov esi, [putimg.real_sx] |
264 | mov ecx, [putimg.real_sx] |
255 | 265 | ||
256 | ; push ebp edx |
266 | ; push ebp edx |
Line -... | Line 267... | ||
- | 267 | align 4 |
|
- | 268 | .new_x: |
|
- | 269 | ||
257 | align 4 |
270 | push [putimg.edi] |
258 | .new_x: |
271 | mov eax, [putimg.ebp+4] |
259 | 272 | call eax |
|
260 | cmp [ebp], bl |
273 | cmp [ebp], bl |
261 | jne .skip |
274 | jne .skip |
Line 262... | Line 275... | ||
262 | mov eax, [ecx] ; ecx = RRBBGGRR |
275 | ; mov eax, [esi] ; ecx = RRBBGGRR |
263 | mov [edx], eax |
276 | mov [edx], eax |
264 | .skip: |
277 | .skip: |
Line 265... | Line 278... | ||
265 | 278 | ||
266 | add ecx, [putimg.source_bpp] |
279 | ; add esi, [putimg.source_bpp] |
267 | add edx, 4 |
280 | add edx, 4 |
Line 268... | Line 281... | ||
268 | inc ebp |
281 | inc ebp |
269 | 282 | ||
270 | dec esi |
283 | dec ecx |
271 | jnz .new_x |
284 | jnz .new_x |
Line 272... | Line 285... | ||
272 | ; pop edx ebp |
285 | ; pop edx ebp |
Line 313... | Line 326... | ||
313 | jb .exit |
326 | jb .exit |
314 | .ok: |
327 | .ok: |
315 | ; check if negation |
328 | ; check if negation |
316 | test ecx,0x01000000 |
329 | test ecx,0x01000000 |
317 | jz .noneg |
330 | jz .noneg |
318 | call __sys_getpixel |
331 | call getpixel |
319 | not ecx |
332 | not ecx |
320 | mov [esp+32-8],ecx |
333 | mov [esp+32-8],ecx |
321 | .noneg: |
334 | .noneg: |
322 | ; OK to set pixel |
335 | ; OK to set pixel |
323 | call dword [0xe020] ; call the real put_pixel function |
336 | call dword [PUTPIXEL] ; call the real put_pixel function |
324 | .exit: |
337 | .exit: |
325 | popad |
338 | popad |
Line 326... | Line 339... | ||
326 | 339 | ||
Line 604... | Line 617... | ||
604 | mov [drbar.bar_sx], ecx |
617 | mov [drbar.bar_sx], ecx |
Line 605... | Line 618... | ||
605 | 618 | ||
606 | mov [drbar.bar_cx], eax |
619 | mov [drbar.bar_cx], eax |
Line 607... | Line 620... | ||
607 | mov [drbar.bar_cy], ebx |
620 | mov [drbar.bar_cy], ebx |
608 | 621 | ||
609 | mov edi, [0x3010] |
622 | mov edi, [TASK_BASE] |
610 | add eax, [edi-twdw + WDATA.box.left] ; win_cx |
623 | add eax, [edi-twdw + WDATA.box.left] ; win_cx |
611 | add ebx, [edi-twdw + WDATA.box.top] ; win_cy |
624 | add ebx, [edi-twdw + WDATA.box.top] ; win_cy |
Line 686... | Line 699... | ||
686 | add eax, [drbar.abs_cx] |
699 | add eax, [drbar.abs_cx] |
687 | add eax, WinMapAddress |
700 | add eax, WinMapAddress |
688 | xchg eax, ebp |
701 | xchg eax, ebp |
Line 689... | Line 702... | ||
689 | 702 | ||
690 | ; get process number |
703 | ; get process number |
Line 691... | Line 704... | ||
691 | mov ebx, [0x3000] |
704 | mov ebx, [CURRENT_TASK] |
692 | 705 | ||
693 | cmp byte [ScreenBPP], 24 |
706 | cmp byte [ScreenBPP], 24 |
694 | jne draw_bar_end_32 |
707 | jne draw_bar_end_32 |
Line 915... | Line 928... | ||
915 | mov eax,edx ; eax:=Rem |
928 | mov eax,edx ; eax:=Rem |
916 | xor edx,edx ; |
929 | xor edx,edx ; |
917 | mov ebx,[esp+8] ; ebx:=B*3 |
930 | mov ebx,[esp+8] ; ebx:=B*3 |
918 | mul ebx ; |
931 | mul ebx ; |
919 | add esi,eax ; |
932 | add esi,eax ; |
920 | mov eax,[esi+0x300000] |
933 | mov eax,[esi+IMG_BACKGROUND] |
921 | and eax,0xffffff |
934 | and eax,0xffffff |
Line 922... | Line 935... | ||
922 | 935 | ||
923 | xchg edi, ebp |
936 | xchg edi, ebp |
924 | stosw |
937 | stosw |
Line 1031... | Line 1044... | ||
1031 | 1044 | ||
Line 1032... | Line 1045... | ||
1032 | call calculate_edi |
1045 | call calculate_edi |
1033 | - | ||
1034 | 1046 | ||
1035 | sdp3: ; MAIN LOOP |
1047 | |
1036 | - | ||
1037 | cmp [edi+WinMapAddress],byte 1 ; ptrBuffer^<>byte(1) |
1048 | sdp3: ; MAIN LOOP |
1038 | jne snbgp |
1049 | cmp [edi+WinMapAddress],byte 1 ; ptrBuffer^<>byte(1) |
1039 | - | ||
1040 | push eax |
1050 | jne snbgp |
1041 | push ebx |
1051 | push eax |
1042 | 1052 | push ebx |
|
1043 | mov eax,dword [WinMapAddress-8] |
1053 | mov eax,dword [WinMapAddress-8] |
1044 | imul eax, [esp+4] ;4 |
1054 | imul eax, [esp+4] ;4 |
- | 1055 | xor edx,edx |
|
1045 | xor edx,edx |
1056 | mov ebx,[ScreenWidth] |
1046 | mov ebx,[ScreenWidth] |
1057 | div ebx |
1047 | div ebx |
1058 | mov cx,dx |
1048 | lea esi,[eax+eax*2] |
1059 | lea esi,[eax+eax*2] |
1049 | mov eax,dword [WinMapAddress-4] |
1060 | mov eax,dword [WinMapAddress-4] |
1050 | imul eax, [esp+0] ;0 |
1061 | imul eax, [esp+0] ;0 |
- | 1062 | xor edx,edx |
|
- | 1063 | mov ebx,[ScreenHeight] |
|
1051 | xor edx,edx |
1064 | div ebx |
1052 | mov ebx,[ScreenHeight] |
1065 | shl ecx,16 |
- | 1066 | mov cx,dx |
|
- | 1067 | imul eax, [esp+8] ;8 |
|
- | 1068 | add esi,eax |
|
- | 1069 | mov eax,[esi+IMG_BACKGROUND] |
|
- | 1070 | push eax |
|
- | 1071 | ror ecx,16 |
|
- | 1072 | xor eax,eax |
|
- | 1073 | mov ax,cx |
|
- | 1074 | shl eax,1 ; óìíîæåíèå íà 2 |
|
- | 1075 | lea eax,[eax+eax*4] ; óìíîæåíèå íà 5 |
|
- | 1076 | xor edx,edx |
|
- | 1077 | mov ebx,[ScreenWidth] |
|
- | 1078 | div ebx |
|
- | 1079 | cmp eax,5 |
|
- | 1080 | pop eax |
|
1053 | div ebx |
1081 | jb @f |
- | 1082 | mov ebx,[esi+IMG_BACKGROUND+3] |
|
- | 1083 | call overlapping_of_points |
|
- | 1084 | @@: |
|
- | 1085 | push eax |
|
- | 1086 | ror ecx,16 |
|
- | 1087 | xor eax,eax |
|
- | 1088 | mov ax,cx |
|
1054 | imul eax, [esp+8] ;8 |
1089 | shl eax,1 ; óìíîæåíèå íà 2 |
- | 1090 | lea eax,[eax+eax*4] ; óìíîæåíèå íà |
|
- | 1091 | xor edx,edx |
|
- | 1092 | mov ebx,[ScreenHeight] |
|
- | 1093 | div ebx |
|
- | 1094 | cmp eax,5 |
|
- | 1095 | pop eax |
|
- | 1096 | jb @f |
|
- | 1097 | mov ebx,[display_data-8] |
|
- | 1098 | shl ebx,1 |
|
- | 1099 | add ebx,[display_data-8] |
|
- | 1100 | add ebx,IMG_BACKGROUND |
|
- | 1101 | add ebx,esi |
|
1055 | add esi,eax |
1102 | mov ebx,[ebx] |
1056 | - | ||
1057 | mov eax,[esi+0x300000] |
1103 | call overlapping_of_points |
1058 | and eax,0xffffff |
1104 | @@: |
1059 | 1105 | and eax,0xffffff |
|
1060 | xchg edi, ebp |
1106 | xchg edi, ebp |
1061 | stosw |
1107 | stosw |
1062 | shr eax,16 |
1108 | shr eax,16 |
1063 | stosb |
1109 | stosb |
1064 | xchg ebp, edi ; ebp+=3 |
1110 | xchg ebp, edi ; ebp+=3 |
1065 | cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size |
1111 | cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size |
1066 | jz @f |
- | |
1067 | inc ebp ; +1 |
1112 | jz @f |
1068 | @@: |
1113 | inc ebp ; +1 |
1069 | - | ||
1070 | pop ebx |
1114 | @@: |
Line -... | Line 1115... | ||
- | 1115 | pop ebx |
|
- | 1116 | pop eax |
|
- | 1117 | jmp shook1 |
|
- | 1118 | ||
- | 1119 | overlapping_of_points: |
|
- | 1120 | push ecx edi |
|
- | 1121 | mov ecx,eax |
|
- | 1122 | mov edx,ebx |
|
- | 1123 | xor eax,eax |
|
- | 1124 | mov al,cl |
|
- | 1125 | xor ebx,ebx |
|
- | 1126 | mov bl,dl |
|
- | 1127 | add eax,ebx |
|
- | 1128 | rcr eax,1 |
|
- | 1129 | xor edi,edi |
|
- | 1130 | mov di,ax |
|
- | 1131 | xor eax,eax |
|
- | 1132 | mov al,ch |
|
- | 1133 | xor ebx,ebx |
|
- | 1134 | mov bl,dh |
|
- | 1135 | add eax,ebx |
|
- | 1136 | rcr eax,1 |
|
- | 1137 | ror edi,8 |
|
- | 1138 | add edi,eax |
|
- | 1139 | ror ecx,8 |
|
- | 1140 | ror edx,8 |
|
- | 1141 | xor eax,eax |
|
- | 1142 | mov al,ch |
|
- | 1143 | xor ebx,ebx |
|
- | 1144 | mov bl,dh |
|
- | 1145 | add eax,ebx |
|
- | 1146 | rcr eax,1 |
|
- | 1147 | ror edi,8 |
|
- | 1148 | add eax,edi |
|
1071 | pop eax |
1149 | ror eax,16 |
1072 | 1150 | pop edi ecx |
|
1073 | jmp shook1 |
1151 | ret |
1074 | 1152 | ||
1075 | snbgp: |
1153 | snbgp: |