kolibrios-gitea/programs/network/icq/trunk/dos2win.inc
Kirill Lipatov (Leency) 6e3f4100a5 kolibri icq update
git-svn-id: svn://kolibrios.org@2296 a494cfbc-eb01-0410-851d-a64ba20cac60
2011-10-18 22:58:49 +00:00

122 lines
1.8 KiB
PHP
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;
;
CP866 db '€<>ƒ„…†‡ˆ‰ŠŒ<E280B9>Ž<EFBFBD><C5BD>“”•˜™šœ<E280BA>žŸ ¡¢£¤¥¦§¨©ª«¬­®¯àáâãäåæçèéêëìíîï'
;
; <EFBFBD>¥à¥ª®¤¨à®¢ª  ¨§ cp1251 ¢ cp866
;
; [eax] <-- Null-terminated string
;
win2dos:
pushad
pushf
xor ebx, ebx
xor ecx, ecx
;xor edx, edx
w2d_loop:
mov bl, [eax+ecx]
cmp bl, 0
jz w2d_end
cmp bl, 0A8h ; ð
jz w2d_yo1
cmp bl, 0B8h ; ñ
jz w2d_yo2
cmp bl, 0C0h ; <EFBFBD>ãááª ï ¡ãª¢ 
jnc w2d_rchar
inc ecx
jmp w2d_loop
w2d_yo1:
mov [eax+ecx], byte 0F0h
inc ecx
jmp w2d_loop
w2d_yo2:
mov [eax+ecx], byte 0F1h
inc ecx
jmp w2d_loop
w2d_rchar:
sub bl, 0C0h
mov bl, [CP866+ebx]
mov [eax+ecx], bl
inc ecx
jmp w2d_loop
w2d_end:
popf
popad
ret
CP1251 db 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ'
;
; <EFBFBD>¥à¥ª®¤¨à®¢ª  ¨§ CP866 ¢ CP1251
; [eax] <-- Null termainated string
;
dos2win:
pushf
pushad
xor ebx, ebx
xor ecx, ecx
dec ecx
d2w_loop:
inc ecx
mov bl, [eax+ecx]
cmp bl, 0
jz d2w_end
cmp bl, 80h
jnc d2w_rchar
;inc ecx
jmp d2w_loop
d2w_yo1:
mov byte [eax+ecx], 0A8h
;inc ecx
jmp d2w_loop
d2w_yo2:
mov byte [eax+ecx], 0B8h
;inc ecx
jmp d2w_loop
d2w_rchar:
cmp bl, 0B0h
jnc d2w_rchar2
sub bl, 80h
mov bl, [CP1251+ebx]
mov [eax+ecx], bl
jmp d2w_loop
d2w_rchar2:
cmp bl, 0E0h
jc d2w_loop
cmp bl, 0F0h
jz d2w_yo1
cmp bl, 0F1h
jz d2w_yo2
cmp bl, 0F2h
jnc d2w_loop
add bl, 10h
mov [eax+ecx], bl
jmp d2w_loop
d2w_end:
popad
popf
ret