Rev 321 | Rev 485 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 321 | Rev 474 | ||
---|---|---|---|
Line 8... | Line 8... | ||
8 | .col dq ? |
8 | .col dq ? |
9 | .encoding db ? |
9 | .encoding db ? |
10 | .bEofReached db ? |
10 | .bEofReached db ? |
11 | .flags db ? ; & 1: hex mode |
11 | .flags db ? ; & 1: hex mode |
12 | ; & 2: unwrap |
12 | ; & 2: unwrap |
- | 13 | ; & 4: big-endian unicode |
|
13 | rb 1 |
14 | rb 1 |
14 | .filename rb 1024 |
15 | .filename rb 1024 |
15 | .buf rb 16384 |
16 | .buf rb 16384 |
16 | .size = $ |
17 | .size = $ |
17 | end virtual |
18 | end virtual |
Line 22... | Line 23... | ||
22 | test byte [ecx], 10h |
23 | test byte [ecx], 10h |
23 | jz .file |
24 | jz .file |
24 | ret |
25 | ret |
25 | .file: |
26 | .file: |
26 | lea esi, [ebp + panel1_dir - panel1_data] |
27 | lea esi, [ebp + panel1_dir - panel1_data] |
- | 28 | push ecx |
|
27 | mov eax, viewer_data.size |
29 | mov ecx, viewer_data.size |
28 | mov edx, viewer_vtable |
30 | mov edx, viewer_vtable |
29 | call new_screen |
31 | call new_screen |
- | 32 | pop ecx |
|
30 | test eax, eax |
33 | test eax, eax |
31 | jnz @f |
34 | jnz @f |
32 | ret |
35 | ret |
33 | @@: |
36 | @@: |
34 | mov [ebp+viewer_data.encoding], encodings.cp866 |
37 | mov [ebp+viewer_data.encoding], encodings.cp866 |
Line 126... | Line 129... | ||
126 | mov ebx, readinfo |
129 | mov ebx, readinfo |
127 | test eax, eax |
130 | test eax, eax |
128 | jz .attr_retry |
131 | jz .attr_retry |
129 | jmp delete_active_screen |
132 | jmp delete_active_screen |
130 | .readok: |
133 | .readok: |
- | 134 | cmp ebx, 2 |
|
- | 135 | jb .nounicode |
|
- | 136 | cmp word [ebp+viewer_data.buf], 0xFEFF |
|
- | 137 | jz @f |
|
- | 138 | cmp word [ebp+viewer_data.buf], 0xFFFE |
|
- | 139 | jnz .nounicode |
|
- | 140 | or byte [ebp+viewer_data.flags], 4 |
|
- | 141 | @@: |
|
- | 142 | mov [ebp+viewer_data.encoding], encodings.unicode |
|
- | 143 | .nounicode: |
|
131 | call viewer_set_keybar |
144 | call viewer_set_keybar |
132 | call viewer_draw_text |
145 | call viewer_draw_text |
133 | ret |
146 | ret |
Line 134... | Line 147... | ||
134 | 147 | ||
135 | viewer_get_next_char: |
148 | viewer_get_next_char: |
- | 149 | pusha |
|
- | 150 | cmp [ebp+viewer_data.encoding], encodings.unicode |
|
- | 151 | jnz @f |
|
- | 152 | cmp [bForHex], 0 |
|
- | 153 | jnz @f |
|
- | 154 | cmp dword [ebp+viewer_data.buf_start], 0 |
|
- | 155 | jnz @f |
|
- | 156 | cmp dword [ebp+viewer_data.buf_start+4], 0 |
|
- | 157 | jnz @f |
|
- | 158 | lea eax, [ebp+viewer_data.buf] |
|
- | 159 | cmp eax, [ebp+viewer_data.buf_pos] |
|
- | 160 | jnz @f |
|
- | 161 | cmp word [eax], 0xFFFE |
|
- | 162 | jz .skip |
|
- | 163 | cmp word [eax], 0xFEFF |
|
- | 164 | jnz @f |
|
- | 165 | .skip: |
|
- | 166 | add [ebp+viewer_data.buf_pos], 2 |
|
136 | pusha |
167 | @@: |
137 | mov eax, [ebp+viewer_data.buf_pos] |
168 | mov eax, [ebp+viewer_data.buf_pos] |
138 | lea ecx, [ebp+viewer_data.buf] |
169 | lea ecx, [ebp+viewer_data.buf] |
139 | add ecx, [ebp+viewer_data.buf_size] |
170 | add ecx, [ebp+viewer_data.buf_size] |
140 | cmp eax, ecx |
171 | cmp eax, ecx |
Line 182... | Line 213... | ||
182 | .err: |
213 | .err: |
183 | stc |
214 | stc |
184 | popa |
215 | popa |
185 | ret |
216 | ret |
186 | .buffered: |
217 | .buffered: |
- | 218 | cmp [ebp+viewer_data.encoding], encodings.unicode |
|
- | 219 | jz .unicode |
|
187 | mov al, [eax] |
220 | mov al, [eax] |
188 | .done: |
221 | .done: |
189 | mov [esp+28], al |
222 | mov [esp+28], al |
190 | inc [ebp+viewer_data.buf_pos] |
223 | inc [ebp+viewer_data.buf_pos] |
191 | clc |
224 | clc |
192 | popa |
225 | popa |
193 | ret |
226 | ret |
Line -... | Line 227... | ||
- | 227 | ||
- | 228 | .unicode: |
|
- | 229 | inc [ebp+viewer_data.buf_pos] |
|
- | 230 | cmp [bForHex], 0 |
|
- | 231 | jnz @f |
|
- | 232 | call read_unicode_char |
|
- | 233 | jmp .done |
|
- | 234 | @@: |
|
- | 235 | mov ax, [eax] |
|
- | 236 | mov [esp+29], ah |
|
- | 237 | jmp .done |
|
194 | 238 | ||
195 | viewer_get_prev_char: |
239 | viewer_get_prev_char: |
196 | pusha |
240 | pusha |
197 | lea ecx, [ebp+viewer_data.buf] |
241 | lea ecx, [ebp+viewer_data.buf] |
198 | cmp [ebp+viewer_data.buf_pos], ecx |
242 | cmp [ebp+viewer_data.buf_pos], ecx |
Line 215... | Line 259... | ||
215 | call viewer_seek |
259 | call viewer_seek |
216 | add [ebp+viewer_data.buf_pos], 8192 |
260 | add [ebp+viewer_data.buf_pos], 8192 |
217 | .buffered: |
261 | .buffered: |
218 | mov eax, [ebp+viewer_data.buf_pos] |
262 | mov eax, [ebp+viewer_data.buf_pos] |
219 | dec eax |
263 | dec eax |
- | 264 | cmp [ebp+viewer_data.encoding], encodings.unicode |
|
- | 265 | jz .unicode |
|
220 | mov [ebp+viewer_data.buf_pos], eax |
266 | mov [ebp+viewer_data.buf_pos], eax |
221 | mov al, [eax] |
267 | mov al, [eax] |
222 | mov [esp+28], al |
268 | mov [esp+28], al |
- | 269 | .done: |
|
223 | clc |
270 | clc |
224 | .ret: |
271 | .ret: |
225 | popa |
272 | popa |
226 | ret |
273 | ret |
Line -... | Line 274... | ||
- | 274 | ||
- | 275 | .unicode: |
|
- | 276 | dec eax |
|
- | 277 | mov [ebp+viewer_data.buf_pos], eax |
|
- | 278 | call read_unicode_char |
|
- | 279 | jmp .done |
|
- | 280 | ||
- | 281 | read_unicode_char: |
|
- | 282 | mov ax, [eax] |
|
- | 283 | uni2ansi_char: |
|
- | 284 | test [ebp+viewer_data.flags], 4 |
|
- | 285 | jz @f |
|
- | 286 | xchg al, ah |
|
- | 287 | @@: |
|
- | 288 | cmp ax, 0x80 |
|
- | 289 | jb .ret |
|
- | 290 | cmp ax, 0x401 |
|
- | 291 | jz .yo1 |
|
- | 292 | cmp ax, 0x451 |
|
- | 293 | jz .yo2 |
|
- | 294 | cmp ax, 0x410 |
|
- | 295 | jb .unk |
|
- | 296 | cmp ax, 0x440 |
|
- | 297 | jb .rus1 |
|
- | 298 | cmp ax, 0x450 |
|
- | 299 | jb .rus2 |
|
- | 300 | .unk: |
|
- | 301 | mov al, ' ' |
|
- | 302 | .ret: |
|
- | 303 | ret |
|
- | 304 | .yo1: |
|
- | 305 | mov al, 'ð' |
|
- | 306 | ret |
|
- | 307 | .yo2: |
|
- | 308 | mov al, 'ñ' |
|
- | 309 | ret |
|
- | 310 | .rus1: |
|
- | 311 | ; 0x410-0x43F -> 0x80-0xAF |
|
- | 312 | add al, 0x70 |
|
- | 313 | ret |
|
- | 314 | .rus2: |
|
- | 315 | ; 0x440-0x44F -> 0xE0-0xEF |
|
- | 316 | add al, 0xA0 |
|
- | 317 | ret |
|
227 | 318 | ||
228 | fld_uint64: |
319 | fld_uint64: |
229 | fild qword [eax] |
320 | fild qword [eax] |
230 | test byte [eax+7], 80h |
321 | test byte [eax+7], 80h |
231 | jz .ret |
322 | jz .ret |
Line 506... | Line 597... | ||
506 | jz .3 |
597 | jz .3 |
507 | .4: |
598 | .4: |
508 | test al, al |
599 | test al, al |
509 | jns @f |
600 | jns @f |
510 | movzx esi, [ebp+viewer_data.encoding] |
601 | movzx esi, [ebp+viewer_data.encoding] |
- | 602 | cmp esi, encodings.unicode |
|
- | 603 | jz @f |
|
511 | shl esi, 7 |
604 | shl esi, 7 |
512 | movzx eax, al |
605 | movzx eax, al |
513 | mov al, [encodings.tables-80h+esi+eax] |
606 | mov al, [encodings.tables-80h+esi+eax] |
514 | @@: |
607 | @@: |
515 | cmp al, 9 |
608 | cmp al, 9 |
Line 607... | Line 700... | ||
607 | push edi |
700 | push edi |
608 | mov ecx, [cur_width] |
701 | mov ecx, [cur_width] |
609 | rep stosw |
702 | rep stosw |
610 | mov ebx, edi |
703 | mov ebx, edi |
611 | pop edi |
704 | pop edi |
- | 705 | mov [bForHex], 1 |
|
612 | call viewer_get_next_char |
706 | call viewer_get_next_char |
- | 707 | mov [bForHex], 0 |
|
613 | jc .hexdone |
708 | jc .hexdone |
614 | push eax |
709 | push eax |
615 | push edi |
710 | push edi |
616 | add edi, 36*2 |
711 | add edi, 36*2 |
617 | mov al, 0xB3 |
712 | mov al, 0xB3 |
- | 713 | mov ah, [view_normal_color] |
|
618 | call .safechar |
714 | call .safechar |
619 | pop edi |
715 | pop edi |
620 | mov eax, dword [ebp+viewer_data.cur_pos] |
716 | mov eax, dword [ebp+viewer_data.cur_pos] |
621 | mov edx, dword [ebp+viewer_data.cur_pos+4] |
717 | mov edx, dword [ebp+viewer_data.cur_pos+4] |
622 | push esi |
718 | push esi |
Line 653... | Line 749... | ||
653 | stosw |
749 | stosw |
654 | xor ecx, ecx |
750 | xor ecx, ecx |
655 | pop eax |
751 | pop eax |
656 | jmp @f |
752 | jmp @f |
657 | .hexchar: |
753 | .hexchar: |
- | 754 | mov [bForHex], 1 |
|
658 | call viewer_get_next_char |
755 | call viewer_get_next_char |
- | 756 | mov [bForHex], 0 |
|
659 | jc .hexdone |
757 | jc .hexdone |
660 | @@: |
758 | @@: |
- | 759 | cmp [ebp+viewer_data.encoding], encodings.unicode |
|
- | 760 | jz .hexchar_unicode |
|
661 | push eax |
761 | push eax |
662 | shr al, 4 |
762 | shr al, 4 |
663 | call .hex_digit |
763 | call .hex_digit |
664 | pop eax |
764 | pop eax |
665 | push eax |
765 | push eax |
Line 696... | Line 796... | ||
696 | mov al, ' ' |
796 | mov al, ' ' |
697 | call .safechar |
797 | call .safechar |
698 | @@: |
798 | @@: |
699 | cmp ecx, 16 |
799 | cmp ecx, 16 |
700 | jnz .hexchar |
800 | jnz .hexchar |
- | 801 | jmp .hexchar_nextline |
|
- | 802 | .hexchar_unicode: |
|
- | 803 | push eax |
|
- | 804 | shr eax, 12 |
|
- | 805 | call .hex_digit |
|
- | 806 | pop eax |
|
- | 807 | push eax |
|
- | 808 | shr eax, 8 |
|
- | 809 | and al, 0xF |
|
- | 810 | call .hex_digit |
|
- | 811 | pop eax |
|
- | 812 | push eax |
|
- | 813 | shr al, 4 |
|
- | 814 | call .hex_digit |
|
- | 815 | pop eax |
|
- | 816 | push eax |
|
- | 817 | and al, 0xF |
|
- | 818 | call .hex_digit |
|
- | 819 | mov al, ' ' |
|
- | 820 | mov ah, [view_normal_color] |
|
- | 821 | call .safechar |
|
- | 822 | pop eax |
|
- | 823 | push edi |
|
- | 824 | add edi, 38*2 |
|
- | 825 | push ecx |
|
- | 826 | shl ecx, 3 |
|
- | 827 | sub edi, ecx |
|
- | 828 | pop ecx |
|
- | 829 | cmp ecx, 4 |
|
- | 830 | jb @f |
|
- | 831 | sub edi, 4 |
|
- | 832 | @@: |
|
- | 833 | call uni2ansi_char |
|
- | 834 | mov ah, [view_normal_color] |
|
- | 835 | call .safechar |
|
- | 836 | pop edi |
|
- | 837 | inc ecx |
|
- | 838 | cmp ecx, 4 |
|
- | 839 | jnz @f |
|
- | 840 | mov al, 0xB3 |
|
- | 841 | call .safechar |
|
- | 842 | mov al, ' ' |
|
- | 843 | call .safechar |
|
- | 844 | @@: |
|
- | 845 | cmp ecx, 8 |
|
- | 846 | jnz .hexchar |
|
- | 847 | .hexchar_nextline: |
|
701 | mov edi, ebx |
848 | mov edi, ebx |
702 | add esi, 3 |
849 | add esi, 3 |
703 | mov edx, esi |
850 | mov edx, esi |
704 | cmp esi, [cur_height] |
851 | cmp esi, [cur_height] |
705 | jae .done2 |
852 | jae .done2 |
Line 930... | Line 1077... | ||
930 | ret |
1077 | ret |
Line 931... | Line 1078... | ||
931 | 1078 | ||
932 | viewer_next_newline: |
1079 | viewer_next_newline: |
933 | test [ebp+viewer_data.flags], 1 |
1080 | test [ebp+viewer_data.flags], 1 |
934 | jz .nohex |
1081 | jz .nohex |
935 | push 10h |
1082 | push 8 |
- | 1083 | pop ecx |
|
- | 1084 | cmp [ebp+viewer_data.encoding], encodings.unicode |
|
- | 1085 | jz @f |
|
936 | pop ecx |
1086 | add ecx, ecx |
937 | @@: |
1087 | @@: |
938 | call viewer_get_next_char |
1088 | call viewer_get_next_char |
939 | jc @f |
1089 | jc @f |
940 | loop @b |
1090 | loop @b |
Line 976... | Line 1126... | ||
976 | jc .ret |
1126 | jc .ret |
977 | xor cl, al |
1127 | xor cl, al |
978 | cmp cl, 0xD xor 0xA |
1128 | cmp cl, 0xD xor 0xA |
979 | jz .2 |
1129 | jz .2 |
980 | dec [ebp+viewer_data.buf_pos] |
1130 | dec [ebp+viewer_data.buf_pos] |
- | 1131 | cmp [ebp+viewer_data.encoding], encodings.unicode |
|
- | 1132 | jnz .2 |
|
- | 1133 | dec [ebp+viewer_data.buf_pos] |
|
981 | .2: |
1134 | .2: |
982 | .ret: |
1135 | .ret: |
983 | call viewer_set_curpos |
1136 | call viewer_set_curpos |
984 | ret |
1137 | ret |
Line 985... | Line 1138... | ||
985 | 1138 | ||
986 | viewer_prev_newline: |
1139 | viewer_prev_newline: |
987 | test [ebp+viewer_data.flags], 1 |
1140 | test [ebp+viewer_data.flags], 1 |
988 | jz .nohex |
1141 | jz .nohex |
989 | push 10h |
1142 | push 8 |
- | 1143 | pop ecx |
|
- | 1144 | cmp [ebp+viewer_data.encoding], encodings.unicode |
|
- | 1145 | jz @f |
|
990 | pop ecx |
1146 | add ecx, ecx |
991 | @@: |
1147 | @@: |
992 | call viewer_get_prev_char |
1148 | call viewer_get_prev_char |
993 | jc @f |
1149 | jc @f |
994 | loop @b |
1150 | loop @b |
Line 1094... | Line 1250... | ||
1094 | mov dword [eax+6], 'Wrap' |
1250 | mov dword [eax+6], 'Wrap' |
1095 | mov word [eax+6+4], ' ' |
1251 | mov word [eax+6+4], ' ' |
1096 | @@: |
1252 | @@: |
1097 | end if |
1253 | end if |
1098 | movzx esi, [ebp+viewer_data.encoding] |
1254 | movzx esi, [ebp+viewer_data.encoding] |
- | 1255 | dec esi |
|
- | 1256 | jz @f |
|
- | 1257 | push 1 |
|
1099 | xor esi, 1 |
1258 | pop esi |
- | 1259 | @@: |
|
1100 | lea esi, [encodings.names+esi*8] |
1260 | lea esi, [encodings.names+esi*8] |
1101 | lea edi, [eax+keybar_cp-keybar_viewer] |
1261 | lea edi, [eax+keybar_cp-keybar_viewer] |
1102 | movsd |
1262 | movsd |
1103 | movsw |
1263 | movsw |
1104 | jmp draw_keybar |
1264 | jmp draw_keybar |
Line 1152... | Line 1312... | ||
1152 | call viewer_draw_text |
1312 | call viewer_draw_text |
1153 | .ret: |
1313 | .ret: |
1154 | ret |
1314 | ret |
1155 | .f8: |
1315 | .f8: |
1156 | movzx esi, [ebp+viewer_data.encoding] |
1316 | movzx esi, [ebp+viewer_data.encoding] |
1157 | xor [ebp+viewer_data.encoding], 1 |
1317 | dec [ebp+viewer_data.encoding] |
1158 | call viewer_set_keybar |
1318 | jz .done_redraw_keybar |
- | 1319 | mov [ebp+viewer_data.encoding], 1 |
|
1159 | jmp .done_redraw |
1320 | jmp .done_redraw_keybar |
1160 | .f2: |
1321 | .f2: |
1161 | xor [ebp+viewer_data.flags], 2 |
1322 | xor [ebp+viewer_data.flags], 2 |
- | 1323 | .done_redraw_keybar: |
|
1162 | call viewer_set_keybar |
1324 | call viewer_set_keybar |
1163 | jmp .done_redraw |
1325 | jmp .done_redraw |
1164 | .f4: |
1326 | .f4: |
1165 | xor [ebp+viewer_data.flags], 1 |
1327 | xor [ebp+viewer_data.flags], 1 |
1166 | pushf |
1328 | pushf |
1167 | call viewer_set_keybar |
1329 | call viewer_set_keybar |
1168 | popf |
1330 | popf |
1169 | jnz .tohex |
1331 | jnz .tohex |
- | 1332 | push 1 |
|
- | 1333 | pop eax |
|
- | 1334 | cmp [ebp+viewer_data.encoding], encodings.unicode |
|
- | 1335 | jnz @f |
|
- | 1336 | add eax, eax |
|
- | 1337 | @@: |
|
1170 | add dword [ebp+viewer_data.cur_pos], 1 |
1338 | add dword [ebp+viewer_data.cur_pos], eax |
1171 | adc dword [ebp+viewer_data.cur_pos+4], 0 |
1339 | adc dword [ebp+viewer_data.cur_pos+4], 0 |
1172 | call viewer_seek_to_current |
1340 | call viewer_seek_to_current |
1173 | call viewer_prev_newline |
1341 | call viewer_prev_newline |
1174 | jmp .done_redraw |
1342 | jmp .done_redraw |
1175 | .tohex: |
1343 | .tohex: |
Line 1247... | Line 1415... | ||
1247 | xor edx, edx |
1415 | xor edx, edx |
1248 | @@: |
1416 | @@: |
1249 | mov dword [ebp+viewer_data.col], eax |
1417 | mov dword [ebp+viewer_data.col], eax |
1250 | mov dword [ebp+viewer_data.col+4], edx |
1418 | mov dword [ebp+viewer_data.col+4], edx |
1251 | jmp .done_redraw |
1419 | jmp .done_redraw |
- | 1420 | .shift_f8: |
|
- | 1421 | mov ecx, encodings.menu.1 |
|
- | 1422 | mov al, [ebp+viewer_data.encoding] |
|
- | 1423 | @@: |
|
- | 1424 | cmp byte [ecx-1], al |
|
- | 1425 | jz @f |
|
- | 1426 | mov ecx, [ecx] |
|
- | 1427 | jmp @b |
|
- | 1428 | @@: |
|
- | 1429 | push 1 |
|
- | 1430 | push aTables |
|
- | 1431 | push ecx |
|
- | 1432 | call menu |
|
- | 1433 | cmp eax, -1 |
|
- | 1434 | jz .ret |
|
- | 1435 | mov al, [eax-1] |
|
- | 1436 | mov [ebp+viewer_data.encoding], al |
|
- | 1437 | cmp al, encodings.unicode |
|
- | 1438 | jnz .done_redraw_keybar |
|
- | 1439 | add dword [ebp+viewer_data.cur_pos], 1 |
|
- | 1440 | adc dword [ebp+viewer_data.cur_pos+4], 0 |
|
- | 1441 | and dword [ebp+viewer_data.cur_pos], not 1 |
|
- | 1442 | jmp .done_redraw_keybar |
|
Line 1252... | Line 1443... | ||
1252 | 1443 | ||
1253 | viewer_getname: |
1444 | viewer_getname: |
1254 | if lang eq ru |
1445 | if lang eq ru |
1255 | mov eax, 'à®á' |
1446 | mov eax, 'à®á' |