kolibri icq update

git-svn-id: svn://kolibrios.org@2296 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2011-10-18 22:58:49 +00:00
parent bd30a3086a
commit 6e3f4100a5
24 changed files with 4898 additions and 860 deletions

View File

@ -0,0 +1,221 @@
include "MACROS.INC"
initipc:
mov eax,9
mov ebx,prc
mov ecx,-1
int 0x40
mov ecx,eax
loop1:
push ecx
mov eax,9
mov ebx,prc
int 0x40
cmp word [prc+10],'CM'
jne no_cmd
cmp byte [prc+12],'D'
jne no_cmd
mov ebx,[prc+30]
mov dword [cmdpid],ebx
mov dword [cmdnumb],ecx
no_cmd:
pop ecx
loop loop1
cmp dword [cmdpid],0
jne no_exit
jmp exit
no_exit:
mov eax,60
mov ebx,2
mov ecx,dword [cmdpid]
mov edx,printf
mov esi,4
int 0x40
call initcmd
waitcmdinit:
mov eax,40
mov ebx,01000000b
int 0x40
mov eax,23
mov ebx,100
int 0x40
cmp eax,7
je cmd_ok
jmp exit
cmd_ok:
cmp byte [ipcb+16],'.'
jne exit
mov eax,18
mov ebx,3
mov ecx,dword [cmdnumb]
int 0x40
ret
pause1:
mov eax,5
mov ebx,1
int 0x40
ret
exit:
mov eax,-1
int 0x40
cls:
mov eax,60
mov ebx,2
mov ecx,dword [cmdpid]
mov edx,ipccls
mov esi,4
int 0x40
call pause1
ret
print:
mov ecx,84
loopprt:
mov edi,stripc
add edi,ecx
mov esi,fill_symbol
movsb
loop loopprt
cld
mov ecx,4
mov edi,stripc
mov esi,printf
rep movsb
cld
mov edx,79
sub edx,eax
mov ecx,79
sub ecx,edx
mov edi,stripc+4
mov esi,ebx
rep movsb
mov eax,60
mov ebx,2
mov ecx,dword [cmdpid]
mov edx,stripc
mov esi,84
int 0x40
call pause1
ret
eol:
mov eax,60
mov ebx,2
mov ecx,dword [cmdpid]
mov edx,ipceol
mov esi,4
int 0x40
call pause1
ret
initcmd:
mov eax,60
mov ebx,2
mov ecx,dword [cmdpid]
mov edx,ipckey
mov esi,4
int 0x40
mov eax,60
mov ebx,1
mov ecx,ipcb
mov edx,28
int 0x40
cld
mov ecx,28
mov edi,ipcb
mov esi,ipcc
rep movsb
ret
getkey:
call initcmd
waitagain:
mov eax,40
mov ebx,01000000b
int 0x40
mov eax,10
int 0x40
cmp eax,7
jne waitagain
mov edi,key
mov esi,ipcb+16
movsb
ret
endipc:
mov eax,60
mov ebx,2
mov ecx,dword [cmdpid]
mov edx,ipcend
mov esi,4
int 0x40
jmp exit
cmdpid dd 0
cmdnumb dd 0
printf db '~ppp'
ipceol db '~lll'
ipcend db '~eee'
ipccls db '~ccc'
ipckey db '~kkk'
key db 0
ipcb:
db 0
db 0,0,0
dd 8
times 20 db 0
ipcc:
db 0
db 0,0,0
dd 8
times 20 db 0
stripc: times 84 db 0
fill_symbol db 0
prc: times 52 db 0

View File

@ -5,7 +5,7 @@ v 0.01
и выводятся отладочные сообщения и выводятся отладочные сообщения
Поддерживается: Поддерживается:
* Локальный контакт-лист, пока жестко зашит в код * Серверный КЛ
* передача/прием сообщений plain-text * передача/прием сообщений plain-text
* Перекодировка CP866<->CP1251 * Перекодировка CP866<->CP1251
* Прием offline сообщений * Прием offline сообщений
@ -13,7 +13,7 @@ v 0.01
/UIN Сообщение /UIN Сообщение
Недоработки: Много :-) Недоработки: Много :-)
* Отключено закрытие сокетов - моя VM (Parallels) наглухо виснет, при * Отключено закрытие сокетов - ядро виснет, при
попытке закрыть сокет попытке закрыть сокет
* Все сообщения от разных юзеров в одном поле вывода * Все сообщения от разных юзеров в одном поле вывода
@ -24,37 +24,14 @@ v 0.01
* editbox иногда ведет себя странно :-) * editbox иногда ведет себя странно :-)
* .......... * ..........
Для изменения уина/пароля надо перекомпилировать программу
- файл ki.asm, переменные UIN и PASS
Для внесения юзеров в КЛ - файл comp.inc, функция loaduin,
перемнные U1, U2, U3 ....
(Скорее всего, потом будет переписано для загрузки из файла)
Т.к. я тестировал программу только под VM, возможно, что ничего и не заработает
Тестирование проводилось с локальным сервером SIQ под Windows, VM Parallels
и с основным сервером аси под Menuet, VM VMware (т.к. в parallels нет поддержки NAT,
а Kolibri не поддерживает сетевую карту в VMware, может, я и ошибаюсь :-))
Выражаю благодарность всем разработчикам OS Kolibri Выражаю благодарность всем разработчикам OS Kolibri
за прекрасные инструменты и документацию, без которой я бы за прекрасные инструменты и документацию, без которой я бы
ничего не написал :-) ничего не написал :-), а также проекту iserverd.khstu.ru,
сервер и описания протоколов которого я использовал.
если у вас есть какие-нибудь предложения, присылайте на lv4evil@yandex.ru
Все пожелания о дальнейшей судьбе проекта (закрыть, например :-))шлите на lv4evil@ya.ru
;Только за кривой код и ужасный английский ногами не бейте :-)

View File

@ -0,0 +1,56 @@
00 00 08 00 07 36 32 31 38 38 39 37 0A 1E 43 18 .....6218897..C.
^^ byte Version number of SSI protocol (currently 0x00)
^^ ^^ word Number of items in this snac
^^ ^^ word Length of the item name
^^ ^^ ^^ ^^ ^^ ^^ ^^ string Item name string
^^ ^^ word Group ID#
^^ ^^ word Item ID#
00 00 00 0A 01 31 00 06 46 75 6E 42 6F 6F 00 09 .....1..FunBoo..
^^ ^^ word Type of item flag (see list bellow)
^^ ^^ word Length of the additional data
^^ ^^ word TLV.Type (TLV #1)
^^ ^^ word TLV.Length
^^ ^^ ^^ ^^ ^^ ^^ TLV.Value
31 37 36 33 33 33 30 37 38 17 B7 2A 18 00 00 00 176333078..*....
09 01 31 00 05 45 2E 53 2E 56 00 07 36 32 31 38 ..1..E.S.V..6218
38 39 38 23 8C 12 A1 00 00 00 09 01 31 00 05 74 898#........1..t
68 6F 72 64 00 07 46 72 69 65 6E 64 73 7F ED 00 hord..Friends...
00 00 01 00 00 00 0A 43 6F 2D 57 6F 72 6B 65 72 .......Co-Worker
73 55 7F 00 00 00 01 00 00 00 07 36 32 31 38 38 sU.........62188
39 35 23 8C 08 80 00 00 00 0D 01 31 00 09 52 65 95#........1..Re
67 72 65 73 73 6F 72 00 07 36 32 35 31 37 32 33 gressor..6251723
23 8C 05 83 00 00 00 0D 01 31 00 05 47 68 6F 73 #........1..Ghos
74 00 66 00 00 00 07 36 32 31 33 39 34 39 23 8C t.f....6213949#.
26 9A 00 00 00 0D 01 31 00 05 6D 69 63 6B 79 00 &......1..micky.
66 00 00 3B B7 4B 7D
0x0000 Buddy record (name: uin for ICQ and screenname for AIM)
0x0001 Group record
0x0002 Permit record ("Allow" list in AIM, and "Visible" list in ICQ)
0x0003 Deny record ("Block" list in AIM, and "Invisible" list in ICQ)
0x0004 Permit/deny settings or/and bitmask of the AIM classes
0x0005 Presence info (if others can see your idle status, etc)
0x0009 Unknown. ICQ2k shortcut bar items ?
0x000E Ignore list record.
0x000F Last update date (name: "LastUpdateDate").
0x0010 Non-ICQ contact (to send SMS). Name: 1#EXT, 2#EXT, etc
0x0013 Item that contain roster import time (name: "Import time")
0x0014 Own icon (avatar) info. Name is an avatar id number as text
[TLV(0x0131), itype 0x00, size XX] - This stores the name that the contact should show up as in the contact list. It should initially be set to the contact's nick name, and can be changed to anything by the client.

Binary file not shown.

View File

@ -1,5 +1,2 @@
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm ki.asm ki @fasm ki.asm ki
@erase lang.inc
@pause

View File

@ -9,48 +9,52 @@
{ {
pushad pushad
mov edx, color ;mov edx, color
; ------------ ; ------------
mov eax, 38 ;mov eax, 38
mov ebx, x1 mov ebx, x1
shl ebx, 16 shl ebx, 16
add ebx, x2 add ebx, x2
mov ecx, y1 mov ecx, y1
shl ecx, 16 shl ecx, 16
add ecx, y1 add ecx, y1
int 40h ;int 40h
mcall 38, ebx, ecx, color
; ------------ ; ------------
mov eax, 38 ;mov eax, 38
mov ebx, x1 mov ebx, x1
shl ebx, 16 shl ebx, 16
add ebx, x2 add ebx, x2
mov ecx, y2 mov ecx, y2
shl ecx, 16 shl ecx, 16
add ecx, y2 add ecx, y2
int 40h ;int 40h
mcall 38, ebx, ecx, color
; | ; |
; | ; |
; | ; |
mov eax, 38 ;mov eax, 38
mov ebx, x1 mov ebx, x1
shl ebx, 16 shl ebx, 16
add ebx, x1 add ebx, x1
mov ecx, y1 mov ecx, y1
shl ecx, 16 shl ecx, 16
add ecx, y2 add ecx, y2
int 40h ;int 40h
mcall 38, ebx, ecx, color
; | ; |
; | ; |
; | ; |
mov eax, 38 ;mov eax, 38
mov ebx, x2 mov ebx, x2
shl ebx, 16 shl ebx, 16
add ebx, x2 add ebx, x2
mov ecx, y1 mov ecx, y1
shl ecx, 16 shl ecx, 16
add ecx, y2 add ecx, y2
int 40h ;int 40h
mcall 38, ebx, ecx, color
popad popad
} }
@ -59,9 +63,9 @@
; ‚뢮¤ ­  íªà ­ ¡ãä¥à  á® áâப ¬¨ ; ‚뢮¤ ­  íªà ­ ¡ãä¥à  á® áâப ¬¨
; ;
scbuff db 512*128 dup 0 scbuff db 80*41 dup 0
; 512 - ¤«¨­  áâப¨ ; 60 - ¤«¨­  áâப¨
; 128 - ª®«¨ç¥á⢮ áâப ; 41 - ª®«¨ç¥á⢮ áâப
; ;
ind db 0 ; ’¥ªã騩 ¨­¤¥ªá ind db 0 ; ’¥ªã騩 ¨­¤¥ªá
; ;
@ -72,7 +76,7 @@ y_s dw 38 ;
; ‚ëá®â  áâப¨ ; ‚ëá®â  áâப¨
SH = 10 SH = 10
xlen dw 512 ; ¤«¨­  áâப¨ xlen dw 80 ; ¤«¨­  áâப¨
;ylen dw 128 ; ª®«¨ç¥á⢮ áâப ;ylen dw 128 ; ª®«¨ç¥á⢮ áâப
ylen dw 40 ylen dw 40
@ -84,11 +88,12 @@ ylen dw 40
; ;
; <EFBFBD> à¨á㥬 ¡¥«ë© ¯àאַ㣮«ì­¨ª ; <EFBFBD> à¨á㥬 ¡¥«ë© ¯àאַ㣮«ì­¨ª
; ;
mov eax, 13 ;mov eax, 13
mov ebx, 15*65536+480 ;mov ebx, 15*65536+480
mov ecx, 31*65536+418 ;mov ecx, 31*65536+418
mov edx, 0FFFFFFh ;mov edx, 0FFFFFFh
int 40h ;int 40h
mcall 13, (15 * 65536 + 480), (31 * 65536 + 418), 0x00FFFFFF
@ -142,9 +147,10 @@ ylen dw 40
xor ecx, ecx xor ecx, ecx
mov ecx, dword [edx+eax] ; <EFBFBD>®á«¥¤­¨¥ 4 <EFBFBD> ©â  á 梥⮬ mov ecx, dword [edx+eax] ; <EFBFBD>®á«¥¤­¨¥ 4 <EFBFBD> ©â  á 梥⮬
or ecx, 0x80000000 ; ‚뢮¤¨âì ASCIIZ or ecx, 0x80000000 ; ‚뢮¤¨âì ASCIIZ
mov eax, 4 ;mov eax, 4
mov esi, -1 ; For Menuet ;mov esi, -1 ; For Menuet
int 40h ;int 40h
mcall 4, ebx, ecx, edx
pop ecx pop ecx
inc ecx inc ecx
jmp pb_loop jmp pb_loop
@ -159,7 +165,7 @@ ylen dw 40
; ;
macro write_debug str macro write_debug str
{ {
local ..string, ..label, ..end, ..loop, ..fin local ..string, ..label, ..end, ..loop, ..fin, ..n_inc
jmp ..label jmp ..label
..string db str, 0 ..string db str, 0
@ -176,6 +182,16 @@ ylen dw 40
imul ebx, eax imul ebx, eax
add ebx, scbuff add ebx, scbuff
;
; —¥à­ë© 梥⠢뢮¤ 
;
mov edx, ebx
lea edx, [edx+eax]
sub edx, 4 ;4 ¡ ©â  á 梥⮬
mov dword [edx], dword 0
xor edx, edx
..loop: ..loop:
mov dl, [..string+ecx] mov dl, [..string+ecx]
cmp dl, 0 cmp dl, 0
@ -189,10 +205,10 @@ ylen dw 40
xor ebx, ebx xor ebx, ebx
mov bl, [ind] mov bl, [ind]
cmp bx, [ylen] cmp bx, [ylen]
jz @f jz ..n_inc
inc bl inc bl
jmp ..fin jmp ..fin
@@: ..n_inc:
xor bl, bl xor bl, bl
..fin: ..fin:
@ -213,19 +229,10 @@ ylen dw 40
..string db str, 0 ..string db str, 0
..label: ..label:
mov eax, 8
mov ebx, x*65536+xlen
mov ecx, y*65536+ylen
mov edx, id
mov esi, 0x4466aa
int 40h
mov eax, 4 mcall 8, (x*65536+xlen), (y*65536+ylen), id, 0x4466aa
mov ebx, (x+5)*65536+y+ylen/2-3
xor ecx, ecx mcall 4, ((x+5)*65536+y+ylen/2-3), 0x80FFFFFF, ..string
or ecx, 0x80FFFFFF
mov edx, ..string
int 40h
popad popad
} }
@ -236,7 +243,7 @@ ylen dw 40
macro data_debug str, rg macro data_debug str, rg
{ {
pushad pushad
local ..string, ..end, ..loop, ..strend, ..fin, ..label local ..string, ..end, ..loop, ..strend, ..fin, ..label, ..n_inc
jmp ..label jmp ..label
..string db str, 20h, 0, 0, 0, 0, 0, 0, 0, 0, 0 ..string db str, 20h, 0, 0, 0, 0, 0, 0, 0, 0, 0
..strend: ..strend:
@ -259,6 +266,15 @@ ylen dw 40
imul ebx, eax imul ebx, eax
add ebx, scbuff add ebx, scbuff
;
; —¥à­ë© 梥⠢뢮¤ 
;
mov edx, ebx
lea edx, [edx+eax]
sub edx, 4 ;4 ¡ ©â  á 梥⮬
mov dword [edx], dword 0
xor edx, edx
..loop: ..loop:
mov dl, [..string+ecx] mov dl, [..string+ecx]
cmp dl, 0 cmp dl, 0
@ -272,10 +288,10 @@ ylen dw 40
xor ebx, ebx xor ebx, ebx
mov bl, [ind] mov bl, [ind]
cmp bx, [ylen] cmp bx, [ylen]
jz @f jz ..n_inc
inc bl inc bl
jmp ..fin jmp ..fin
@@: ..n_inc:
xor bl, bl xor bl, bl
..fin: ..fin:
@ -334,127 +350,6 @@ ylen dw 40
popf popf
ret ret
;
;
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
; ;
@ -464,21 +359,51 @@ CP1251 db '
; ;
writemsg: writemsg:
pushad pushad
xor edi, edi
wm_loop:
xor esi, esi ; …᫨ 1 - ¥áâì ¥é¥ á¨¬¢®«ë ¢ áâப¥
lea eax, [eax+edi]
push ebx push ebx
push eax push eax
xor eax, eax xor eax, eax
xor ebx, ebx xor ebx, ebx
mov bl, [ind] mov bl, [ind]
mov ax, [xlen] mov ax, [xlen]
imul ebx, eax imul ebx, eax
add ebx, scbuff add ebx, scbuff
;
; <EFBFBD> §¡¨¢ ¥¬ áâபã á®®¡é¥­¨ï ­  ­¥áª®«ìª® áâப ¯® xlen-4 (â.ª ¢ ª®­æ¥ ¤¢®©­®¥ á«®¢® - 梥â áâப¨)
;
pop eax pop eax
mov edx, eax mov edx, eax
call strlen call strlen
movzx ecx, [xlen]
cmp eax, ecx
jc @f ;<
movzx edi, [xlen]
lea edi, [edi-4]
mov ecx, eax mov ecx, eax
inc esi
@@:
mov eax, edx mov eax, edx
call strcpy call strcpy
@ -491,20 +416,25 @@ CP1251 db '
mov dword [ebx+eax], ecx ; <EFBFBD>®á«¥¤­¨¥ 4 <EFBFBD> ©â  á 梥⮬ mov dword [ebx+eax], ecx ; <EFBFBD>®á«¥¤­¨¥ 4 <EFBFBD> ©â  á 梥⮬
xor ebx, ebx xor eax, eax
mov bl, [ind] mov al, [ind]
cmp bx, [ylen] cmp ax, [ylen]
jz @f jz @f
inc bl inc al
jmp ..fin jmp ..fin
@@: @@:
xor bl, bl xor al, al
..fin: ..fin:
mov [ind], bl mov [ind], al
mov ebx, ecx ; 梥â
mov eax, edx ; 㪠§ â¥«ì ­  áâபã
cmp esi, 0
jnz wm_loop
call printbuff call printbuff
;call draw_window
popad popad
ret ret
@ -515,7 +445,7 @@ CP1251 db '
; <--EAX <EFBFBD>¥à¥¢®¤ ¨§ 16 ¢ 10 ä®à¬ã ; <--EAX <EFBFBD>¥à¥¢®¤ ¨§ 16 ¢ 10 ä®à¬ã
; -->[ebx] ; -->[ebx] áâப 
; --> eax ¤«¨­  ; --> eax ¤«¨­ 
int2strd: int2strd:
pushf pushf
@ -597,9 +527,9 @@ x_bb dw 550 ;
y_bb dw 30 ; y_bb dw 30 ;
; ;
bb_width dw 100 ; ˜¨à¨­  ª­®¯®ª bb_width dw 100 ; ˜¨à¨­  ª­®¯®ª
bb_height dw 15 ; ¢ëá®â  ª­®¯®ª bb_height dw 12 ; ¢ëá®â  ª­®¯®ª
; ;
bb_dist dw 10 ; <EFBFBD> ááâ®ï­¨¥ ¬¥¦¤ã ª­®¯ª ¬¨ bb_dist dw 6 ; <EFBFBD> ááâ®ï­¨¥ ¬¥¦¤ã ª­®¯ª ¬¨
; ˆ¤¥­â¨ä¨ª â®àë ª­®¯®ª ­ ç¨­ ï á 100 ; ˆ¤¥­â¨ä¨ª â®àë ª­®¯®ª ­ ç¨­ ï á 100
; ;
@ -617,12 +547,23 @@ bb_dist dw 10 ;
bb_loop: bb_loop:
; <EFBFBD>஢¥à塞 ¯¥à¢ë© ¡ ©â 㨭 , ¥á«¨ 0, ª­®¯ªã à¨á®¢ âì ­¥ ­ ¤® ; <EFBFBD>஢¥à塞 ¯¥à¢ë© ¡ ©â 㨭 , ¥á«¨ 0, ª­®¯ªã à¨á®¢ âì ­¥ ­ ¤®
mov ebx, NAME_LEN ;mov ebx, NAME_LEN
;imul ebx, ecx
;mov al, [names+ebx]
;cmp al, 0
;jz bb_end
mov ebx, UIN_LEN
imul ebx, ecx imul ebx, ecx
mov al, [names+ebx] mov al, [uins + ebx]
cmp al, 0 cmp al, 0
jz bb_end jz bb_end
; à¨á㥬 ª­®¯ªã ; à¨á㥬 ª­®¯ªã
; –¢¥â § ¢¨á¨â ®â áâ âãá  UIN ; –¢¥â § ¢¨á¨â ®â áâ âãá  UIN
mov ebx, 4 mov ebx, 4
@ -726,7 +667,7 @@ bb_dist dw 10 ;
; Œ áᨢ á UIN ; Œ áᨢ á UIN
; ;
UIN_LEN = 11 ; „«¨­  UIN_LEN = 11 ; „«¨­ 
UINS = 15 ; Š®«¨ç¥á⢮ UINS = 22 ; Š®«¨ç¥á⢮
; ;
uins db UIN_LEN*UINS dup 0 uins db UIN_LEN*UINS dup 0
; ;
@ -742,12 +683,13 @@ names db NAME_LEN*UINS dup 0
; ;
; ;
U1 db '123456789',0 U1 db '405577261',0
U2 db '123456789',0 U2 db '455395049',0
U3 db '123456789',0 U3 db '488118046',0
; ;
; ‡ £à㧪  ¬ áᨢ  UIN ; ‡ £à㧪  ¬ áᨢ  UIN
; ;
; FIXME ¡ã¤¥â 㤠«¥­ 
loaduin: loaduin:
pushad pushad
mov eax, U1 mov eax, U1
@ -924,3 +866,107 @@ U3 db '123456789',0
popf popf
popad popad
ret ret
;
;
; Žâ« ¤®ç­ ï äã­ªæ¨ï - ¢ë¢®¤¨â ®¡« áâì ¯ ¬ïâ¨
; EAX - 㪠§ â¥«ì ­  ®¡« áâì
; EBX - ª®«¨ç¥á⢮ ¡ ©â
;
print_mem:
push eax
push ebx
push ecx
push edx
push esi
xor ecx, ecx
xor esi, esi
pm_loop:
cmp ecx, ebx
jz pm_exit
mov dl, [eax + ecx]
shr dl, 4 ;‘¤¢¨­ãâì ­  4 à §à鸞 ¢¯à ¢®
cmp dl, 0x0A
jnb pm_chars
or dl, 0x30
jmp pm_write
pm_chars:
add dl, 0x37
pm_write:
mov [membuff + esi], dl
inc esi
;
;
mov dl, [eax + ecx]
and dl, 0x0F
cmp dl, 0x0A
jnb pm_chars2
or dl, 0x30
jmp pm_write2
pm_chars2:
add dl, 0x37
pm_write2:
mov [membuff + esi], dl
inc esi
mov [membuff + esi], 0x20
inc esi
cmp esi, MEMBUFF_SIZE - 2
jb pm_nwrite
;
; ¢ë¢¥á⨠¡ãä¥à
mov [membuff + esi], byte 0
push eax
push ebx
mov eax, membuff
xor ebx, ebx
xor esi, esi
call writemsg
pop ebx
pop eax
pm_nwrite:
inc ecx
jmp pm_loop
pm_exit:
mov [membuff + esi], byte 0
mov eax, membuff
xor ebx, ebx
xor esi, esi
call writemsg
pop esi
pop edx
pop ecx
pop ebx
pop eax
ret

View File

@ -0,0 +1,3 @@
MEMBUFF_SIZE = (16 * 3 + 1)
membuff db MEMBUFF_SIZE dup 0

View File

@ -0,0 +1 @@
__CPU_type fix p5

View File

@ -0,0 +1,137 @@
macro debug_print str
{
local ..string, ..label
jmp ..label
..string db str,0
..label:
pushf
pushad
mov edx,..string
call debug_outstr
popad
popf
}
dps fix debug_print
macro debug_print_dec arg
{
pushf
pushad
if ~arg eq eax
mov eax,arg
end if
call debug_outdec
popad
popf
}
dpd fix debug_print_dec
;---------------------------------
debug_outdec: ;(eax - num, edi-str)
push 10 ;2
pop ecx ;1
push -'0' ;2
.l0:
xor edx,edx ;2
div ecx ;2
push edx ;1
test eax,eax ;2
jnz .l0 ;2
.l1:
pop eax ;1
add al,'0' ;2
call debug_outchar ; stosb
jnz .l1 ;2
ret ;1
;---------------------------------
debug_outchar: ; al - char
pushf
pushad
mov cl,al
mov eax,63
mov ebx,1
int 0x40
popad
popf
ret
debug_outstr:
mov eax,63
mov ebx,1
@@:
mov cl,[edx]
test cl,cl
jz @f
int 40h
inc edx
jmp @b
@@:
ret
_debug_crlf db 13, 10, 0
macro newline
{
pushf
pushad
mov edx, _debug_crlf
call debug_outstr
popad
popf
}
macro print message
{
dps message
newline
}
macro pregs
{
dps "EAX: "
dpd eax
dps " EBX: "
dpd ebx
newline
dps "ECX: "
dpd ecx
dps " EDX: "
dpd edx
newline
}
macro debug_print_hex arg
{
pushf
pushad
if ~arg eq eax
mov eax, arg
end if
call debug_outhex
popad
popf
}
dph fix debug_print_hex
debug_outhex:
; eax - number
mov edx, 8
.new_char:
rol eax, 4
movzx ecx, al
and cl, 0x0f
mov cl, [__hexdigits + ecx]
pushad
mcall 63, 1
popad
dec edx
jnz .new_char
ret
__hexdigits:
db '0123456789ABCDEF'

View File

@ -0,0 +1,597 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ;
; DIALOGS1.INC ;
; ;
; COMPILE WITH FASM for MENUET ;
; ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
menus dd 3 ; number of menus
m_x dd 0x5 ; x start
m_y dd 20 ; y start
m_xs dd 290 ; x size
m_ys dd 14 ; y size
g_stack dd 0xf000 ; thread stack - required
menu:; AB C D E F G
db '*D FILE +Save File +Load File +- +Quit '
db '*B EDIT +Copy +Paste '
db '*B HELP +Setup +About.. '
db '@' ; end mark
; A : Data type '*' -> New menu , '+' -> menu selection
; B : Number of selections in menu (A+)
; C : Menu header text
; D-G : Menu selection text
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; DATA BELOW IS FOR DIALOGS1.INC INTERNALS
menu_action dd '----'
window_on db 0
g_n dd -1
g_x dd 0x0
g_t dd 0x0
g_1 dd 0x0
g_l dd 0x0
closet db 0
table: times 1024 db 0
last_mouse dd 0x0
mo_x dd 0x0
mo_y dd 0x0
check_mouse:
pusha
cmp [window_on],1
je no_open
mov eax,37
mov ebx,2
int 0x40
cmp [window_on],0
jne openw2
cmp eax,0
je no_open
openw2:
waitformouse:
mov eax,23
mov ebx,2
int 0x40
cmp eax,0
jne no_open
mov eax,37
mov ebx,2
int 0x40
cmp eax,0
jne waitformouse
mov eax,37
mov ebx,1
int 0x40
mov esi,eax
shr eax,16
xor edx,edx
mov ebx,50
div ebx
mov edx,eax
cmp edx,[g_n]
je no_open
cmp edx,[menus]
jge no_open
mov eax,esi
and eax,0xffff
mov ebx,[m_y]
cmp eax,ebx
jbe no_open
add ebx,[m_ys]
cmp eax,ebx
jge no_open
cmp [window_on],0
je noww
mov [closet],1
mov ecx,100
waitm:
mov eax,5
mov ebx,1
int 0x40
dec ecx
jz no_open
cmp [window_on],0
jne waitm
noww:
mov eax,edx
jmp cll
no_open:
mov [last_mouse],esi
popa
ret
cll:
mov [window_on],2
mov [g_n],eax
mov [g_x],96
mov [g_t],0
mov [g_1],1
mov eax,9
mov ebx,table
mov ecx,-1
int 0x40
mov eax,[table+34]
mov [mo_x],eax
mov eax,[table+38]
mov [mo_y],eax
mov eax,51
mov ebx,1
mov ecx,alert_entry
mov edx,[g_stack]
int 0x40
mov [esp+28],dword 0 ; clear button entry
mov [menu_action],'MD '
check_gr:
popa
ret
draw_menu:
mov eax,9
mov ebx,table
mov ecx,-1
int 0x40
cmp [table+46],dword 30
jb drmr
mov eax,13 ; white background
mov ebx,[m_x]
shl ebx,16
add ebx,[m_xs]
inc ebx
mov ecx,[m_y]
shl ecx,16
add ecx,[m_ys]
mov edx,0xf0f8ff
int 0x40
mov eax,38 ; egde lines
mov ebx,[m_x]
shl ebx,16
add ebx,[m_x]
add ebx,[m_xs]
mov ecx,[m_y]
shl ecx,16
add ecx,[m_y]
mov edx,0x000000
int 0x40
mov eax,38
mov ecx,[m_y]
add ecx,[m_ys]
shl ecx,16
add ecx,[m_y]
add ecx,[m_ys]
int 0x40
mov esi,menu-1
mov edi,[m_x]
mov ebp,1
new_menu:
inc esi
cmp [esi],byte '*'
jne drmnl1
push esi
mov eax,4
mov ebx,edi
shl ebx,16
add ebx,[m_y]
add ebx,0x00050004
mov ecx,0x000000
mov edx,esi
add edx,3
mov esi,12
int 0x40 ; draw text
pop esi
add esi,2
add edi,50
inc ebp
drmnl1:
cmp [esi],byte '@'
jne new_menu
drmr:
ret
alert_box:
; eax : x size - min 200
; ebx : pointer to ASCIIZ - max 128 character text
; ecx : button 1 id ( OK or YES )
; edx : button 2 id or zero ( NO )
cmp [window_on],0
jne alert_box_return
mov [window_on],1
cmp eax,100
jg size_ok
mov eax,100
size_ok:
mov [g_x],eax
mov [g_t],ebx
mov [g_1],ecx
mov ecx,0
new_search:
cmp [ebx],byte 0
je found_len
inc ebx
inc ecx
cmp ecx,128
jbe new_search
found_len:
mov [g_l],ecx
mov eax,51
mov ebx,1
mov ecx,alert_entry
mov edx,[g_stack]
int 0x40
mov [menu_action],'MA '
alert_box_return:
ret
alert_entry:
call alert_draw_window
alert_still:
mov eax,23 ; wait here for event
mov ebx,1
int 0x40
cmp eax,1 ; redraw request ?
je alert_red
cmp eax,2 ; key in buffer ?
je alert_key
cmp eax,3 ; button in buffer ?
je alert_button
cmp [closet],0
jne ccc
mov eax,9
mov ebx,table
mov ecx,-1
int 0x40
cmp ax,[table+4]
je no_close
ccc:
mov [closet],0
mov [g_n],-1
mov [menu_action],'----'
mov [window_on],0
mov eax,-1
int 0x40
no_close:
jmp alert_still
alert_red: ; redraw
call alert_draw_window
jmp alert_still
alert_key: ; key
mov eax,2 ; just read it and ignore
int 0x40
jmp alert_still
alert_button: ; button
mov eax,17 ; get id
int 0x40
shr eax,8
cmp eax,3
jg no_action1
dec eax
shl eax,2
mov eax,dword [eax+rtext]
mov [menu_action],eax
jmp action_done
no_action1:
sub eax,16
add eax,65
shl eax,8
mov ebx,[g_n]
add ebx,65
add eax,ebx
mov [menu_action],eax
action_done:
mov [closet],0
mov [g_n],-1
mov [window_on],0
mov eax,-1 ; close this program
int 0x40
rtext db 'NO YES OK '
jmp alert_still
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
alert_draw_window:
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
int 0x40
cmp [window_on],2
jne no_win_type_2
mov edx,menu-1
mov ecx,[g_n]
add ecx,1
find_menu:
inc edx
cmp [edx],byte '*'
je menu_loop
jmp find_menu
menu_loop:
loop find_menu
movzx ebp,byte [edx+1]
sub ebp,64
push edx
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx,[g_n]
imul ebx,50
add ebx,[mo_x]
add ebx,[m_x]
shl ebx,16
add ebx,[g_x]
mov ecx,[mo_y]
add ecx,[m_y]
add ecx,[m_ys]
shl ecx,16
mov edx,14
imul edx,ebp
add edx,7
add ecx,edx
mov edx,0x00ffffff ; color of work area RRGGBB,8->color gl
mov esi,0x00ffffff ; color of grab bar RRGGBB,8->color gl
mov edi,0x000000cc ; color of frames RRGGBB
int 0x40
pop edx
mov ebx,5*65536+7 ; draw info text with function 4
mov ecx,0x10000000
mov esi,12
mov ebp,16
no_d_found:
inc edx
cmp [edx],byte '*'
je d_drawed
cmp [edx],byte '@'
je d_drawed
cmp [edx],byte '+'
jne no_d_found
inc edx
pusha ; draw button
mov eax,8
mov ecx,ebx
mov ebx,[g_x]
add ebx,0x0000fffe
shl ecx,16
add ecx,0xfffc0000+14
mov edx,0x40000000
add edx,ebp
mov esi,0
int 0x40
popa
mov eax,4 ; draw text
int 0x40
inc ebp
add ebx,14
jmp no_d_found
d_drawed:
no_win_type_2:
cmp [window_on],1
jne no_win_1
mov eax,14 ; to middle of screen
int 0x40
mov ecx,eax
and ecx,0xffff
shr ecx,1
shr eax,1
mov ebx,[g_x]
shr ebx,1
shl ebx,16
sub eax,ebx
mov ebx,eax
mov eax,0 ; function 0 : define and draw window
mov bx,word [g_x]
sub ecx,80
shl ecx,16
mov cx,110 ; [y start] *65536 + [y size]
mov edx,0x02ffffff ; color of work area RRGGBB,8->color gl
mov esi,0x80d05050 ; color of grab bar RRGGBB,8->color gl
mov edi,0x00d05050 ; color of frames RRGGBB
int 0x40
mov eax,4 ; label
mov ebx,8*65536+8
mov ecx,0x10ddeeff
mov edx,alert_labelt1
mov esi,alert_label1len-alert_labelt1
int 0x40
mov eax,4
mov ebx,10*65536+43
mov ecx,0x10000000
mov edx,[g_t]
mov esi,[g_l]
int 0x40
cmp [g_1],1
jne gadgets_no_1
mov eax,8
mov ebx,[g_x]
sub ebx,100
shr ebx,1
shl ebx,16
add ebx,30*65536+40
mov ecx,75*65536+16
mov edx,3
mov esi,0x446688
int 0x40
mov eax,4
mov ebx,[g_x]
sub ebx,100
shr ebx,1
shl ebx,16
add ebx,31*65536+80
mov ecx,0x10ffffff
mov edx,alert_t2
mov esi,alert_t2len-alert_t2
int 0x40
gadgets_no_1:
cmp [g_1],2
jne gadgets_no_2
mov eax,8
mov ebx,[g_x]
sub ebx,100
shr ebx,1
shl ebx,16
add ebx,0*65536+40
mov ecx,75*65536+16
mov edx,1
mov esi,0x446688
int 0x40
mov eax,8
mov ebx,[g_x]
sub ebx,100
shr ebx,1
shl ebx,16
add ebx,57*65536+40
mov ecx,75*65536+16
mov edx,2
mov esi,0x446688
int 0x40
mov eax,4
mov ebx,[g_x]
sub ebx,100
shr ebx,1
shl ebx,16
add ebx,1*65536+80
mov ecx,0x10ffffff
mov edx,alert_t1
mov esi,alert_t1len-alert_t1
int 0x40
gadgets_no_2:
no_win_1:
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
ret
; DATA AREA
alert_t1:
db ' No Yes'
alert_t1len:
alert_t2:
db ' OK'
alert_t2len:
alert_labelt1:
db 'ALERT'
alert_label1len:

View File

@ -0,0 +1,121 @@
;
;
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

View File

@ -31,9 +31,9 @@ macro use_general_func
mov edx,ed_offset mov edx,ed_offset
add ebx,2 add ebx,2
shl ebx,16 shl ebx,16
mov bx,ed_top add ebx,ed_top
add ebx,4
mov ecx,ed_text_color mov ecx,ed_text_color
add ebx,4
add edx,ed_text add edx,ed_text
mcall mcall
ret ret
@ -47,20 +47,19 @@ ret
.draw_bg: .draw_bg:
mov ebx,ed_left mov ebx,ed_left
add ebx,1 add ebx,1
shl ebx,16
mov bx,ed_width
sub ebx,1
mov edx,ed_color mov edx,ed_color
shl ebx,16
add ebx,ed_width
sub ebx,1
.draw_bg_eax: .draw_bg_eax:
mov ecx,ed_top mov ecx,ed_top
mov eax,13 mov eax,13
add ecx,1 add ecx,1
shl ecx,16 shl ecx,16
mov cx,ed_height add ecx,ed_height
dec ecx dec ecx
mcall mcall
ret ret
;---------------------------------------------------------- ;----------------------------------------------------------
;--- ¯à®æ¥¤ãà  ¯®«ã祭¨ï ª®«¨ç¥á⢠ ᨬ¢®«®¢ ¢ ⥪ã饩 é¨à¨­¥ ª®¬¯®­¥­â  ;--- ¯à®æ¥¤ãà  ¯®«ã祭¨ï ª®«¨ç¥á⢠ ᨬ¢®«®¢ ¢ ⥪ã饩 é¨à¨­¥ ª®¬¯®­¥­â 
;---------------------------------------------------------- ;----------------------------------------------------------
@ -89,7 +88,7 @@ ret
lea ebx,[ebx*2+ebx] lea ebx,[ebx*2+ebx]
shl ebx,1 shl ebx,1
;imul ebx,6 ;imul ebx,6
add bx,ed_left add ebx,ed_left
mov ecx,ed_top mov ecx,ed_top
inc ebx inc ebx
add ecx,2 add ecx,2
@ -100,7 +99,7 @@ ret
shl ecx,16 shl ecx,16
mov cx,bp mov cx,bp
add cx,ed_height-4 add ecx,ed_height-4
mov cl_curs_x,ebx mov cl_curs_x,ebx
mov cl_curs_y,ecx mov cl_curs_y,ecx
@ -123,7 +122,7 @@ ret
mov ecx,ebx mov ecx,ebx
shl ebx,16 shl ebx,16
mov bx,cx mov bx,cx
add bx,ed_width add ebx,ed_width
mov ecx,ed_top mov ecx,ed_top
mov esi,ecx mov esi,ecx
shl ecx,16 shl ecx,16
@ -139,7 +138,7 @@ ret
;--- á«¥¢  --- ;--- á«¥¢  ---
mov cx,si mov cx,si
mov ebp,ebx mov ebp,ebx
sub bx,ed_width sub ebx,ed_width
mcall mcall
;--- á¯à ¢  --- ;--- á¯à ¢  ---
mov ebx,ebp mov ebx,ebp
@ -534,7 +533,7 @@ edit_ex
inc ebx inc ebx
add ebx,ed_left add ebx,ed_left
shl ebx,16 shl ebx,16
mov bx,6 add ebx,6
mov edx,ebp mov edx,ebp
call .draw_bg_eax call .draw_bg_eax
ret ret
@ -627,9 +626,12 @@ macro are_key_shift_press
mov ecx, ed_pos mov ecx, ed_pos
pusha pusha
;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;
;clear input arrea
mov ebp,ed_color mov ebp,ed_color
mov ebx,dword ed_shift_pos mov ebx,dword ed_shift_pos
call .sh_cl_ call .sh_cl_
mov ebp,ed_size
call .clear_bg
;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;
popa popa
call .del_char call .del_char
@ -1076,3 +1078,52 @@ macro debug_func
ret ;¢¥à­ãâìáï ç¥­ì ¨­â¥à¥á­ë© 室 â.ª. ¯®ª  ¢ á⥪¥ åà ­¨âìáï ª®«-¢® ¢ë§®¢®¢ â® á⮫쪮 à § ¬ë ¨ ¡ã¤¥¬ ¢ë§ë¢ âìáï ret ;¢¥à­ãâìáï ç¥­ì ¨­â¥à¥á­ë© 室 â.ª. ¯®ª  ¢ á⥪¥ åà ­¨âìáï ª®«-¢® ¢ë§®¢®¢ â® á⮫쪮 à § ¬ë ¨ ¡ã¤¥¬ ¢ë§ë¢ âìáï
} }
;;;;;;;;;;;;;;;
;For LibGui
;;;;;;;;;;;;;;;
macro srt_ed_libgui
{
ed_width equ [EditBox.ed_width] ;è¨à¨­  ª®¬¯®­¥­â 
ed_left equ [EditBox.ed_left] ;¯®«®¦¥­¨¥ ¯® ®á¨ å
ed_top equ [EditBox.ed_top] ;¯®«®¦¥­¨¥ ¯® ®á¨ ã
ed_color equ [EditBox.ed_color] ;梥â ä®­  ª®¬¯®­¥­â 
shift_color equ [EditBox.shift_color] ;=0x6a9480
ed_focus_border_color equ [EditBox.ed_focus_border_color] ;梥â à ¬ª¨ ª®¬¯®­¥­â 
ed_blur_border_color equ [EditBox.ed_blur_border_color] ;梥⠭¥  ªâ¨¢­®£® ª®¬¯®­¥­â 
ed_text_color equ [EditBox.ed_text_color] ;梥â ⥪áâ 
ed_max equ [EditBox.ed_max] ;ª®«-¢® ᨬ¢®«®¢ ª®â®àë¥ ¬®¦­® ¬ ªá¨¬ «ì­® ¢¢¥áâ¨
ed_text equ [EditBox.ed_text] ;㪠§ â¥«ì ­  ¡ãä¥à
ed_flags equ [EditBox.ed_flags] ;ä« £¨
ed_size equ [EditBox.ed_size] ;ª®«-¢® ᨬ¢®«®¢
ed_pos equ [EditBox.ed_poz] ;¯®§¨æ¨ï ªãàá®à 
ed_offset equ [EditBox.ed_offset] ;ᬥ饭¨¥
cl_curs_x equ [EditBox.cl_curs_x] ;¯à¥¤ë¤ã饥 ª®®à¤¨­ â  ªãàá®à  ¯® å
cl_curs_y equ [EditBox.cl_curs_y] ;¯à¥¤ë¤ã饥 ª®®à¤¨­ â  ªãàá®à  ¯® ã
ed_shift_pos equ [EditBox.ed_shift_pos] ;¯®«®¦¥­¨¥ ªãàá®à 
ed_shift_pos_old equ [EditBox.ed_shift_pos_old] ;áâ à®¥ ¯®«®¦¥­¨¥ ªãàá®à 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Bit mask from editbox
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ed_figure_only= 1000000000000000b ;®¤­¨ ᨬ¢®«ë
ed_always_focus= 100000000000000b
ed_focus= 10b ;䮪ãá ¯à¨«®¦¥­¨ï
ed_shift_on= 1000b ;¥á«¨ ­¥ ãáâ ­®¢«¥­ -§­ ç¨â ¢¯¥à¢ë¥ ­ ¦ â shift,¥á«¨ ¡ë« ãáâ ­®¢«¥­, §­ ç¨â ¬ë 㦥 çâ® - â® ¤¥« «¨ 㤥ন¢ ï shift
ed_shift_on_off=1111111111110111b
ed_shift= 100b ;¢ª«îç ¥âáï ¯à¨ ­ ¦ â¨¨ ­  shift â.¥. ¥á«¨ ­ ¦¨¬ î
ed_shift_off= 1111111111111011b
ed_shift_bac= 10000b ;¡¨â ¤«ï ®ç¨á⪨ ¢ë¤¥«¥­®£® shift â.¥. ¯à¨ ãáâ ­®¢ª¥ £®¢®à¨â çâ® ¥áâì ¢ë¤¥«¥­¨¥
ed_shift_bac_cl=1111111111101111b ;®ç¨á⪠ ¯à¨ 㤠«¥­¨¨ ¢ë¤¥«¥­¨ï
ed_shift_cl= 1111111111100011b
ed_shift_mcl= 1111111111111011b
ed_left_fl= 100000b
ed_right_fl= 1111111111011111b
ed_offset_fl= 1000000b
ed_offset_cl= 1111111110111111b
ed_insert= 10000000b
ed_insert_cl= 1111111101111111b
ed_mouse_on = 100000000b
ed_mous_adn_b= 100011000b
ed_mouse_on_off=1111111011111111b
ed_height=14 ; ¢ëá®â 
}

View File

@ -0,0 +1,64 @@
redicq:
db 0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,128,0,0,128,0,0,128,0,0,0,0,0
db 128,0,0,128,0,0,128
db 0,0,0,0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,128,0,0,179,0,0,179,0,0,179,0,0,128,0,0
db 179,0,0,179,0,0,179,0,0,128
db 0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,128,0,0,230,0,0,202,0,0,179,0,0,128,0,0
db 230,0,0,202,0,0,179,0,0,128
db 0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,128,0,0,128,0
db 0,128,0,0,179,0,0,202,0,0,230,0,0,128,0,0
db 230,0,0,202,0,0,179,0,0,128,0,0,128,0,0,128
db 0,0,0
db 0,0,128,0,0,179,0,0,179,0
db 0,179,0,0,128,0,0,230,0,0,230,0,0,128,0,0
db 230,0,0,230,0,0,128,0,0,179,0,0,179,0,0,179
db 0,0,128
db 0,0,128,0,0,179,0,0,202,0
db 0,202,0,0,230,0,0,128,0,0,230,0,0,128,0,0
db 230,0,0,128,0,0,230,0,0,202,0,0,202,0,0,179
db 0,0,128
db 0,0,128,0,0,179,0,0,230,0
db 0,230,0,0,230,0,0,230,0,0,128,0,255,255,0,0
db 128,0,0,230,0,0,230,0,0,230,0,0,230,0,0,179
db 0,0,128
db 0,0,0,0,0,128,0,0,128,0
db 0,128,0,0,128,0,0,128,0,255,255,0,255,255,0,255
db 255,0,0,128,0,0,128,0,0,128,0,0,128,0,0,128
db 0,0,0,0,0,128,0,0,179,0,0,179,0
db 0,179,0,0,179,0,0,179,0,0,128,0,255,255,0,0
db 128,0,0,179,0,0,179,0,0,179,0,0,179,0,0,179
db 0,0,128
db 0,0,128,0,0,202,0,0,202,0
db 0,202,0,0,202,0,0,128,0,0,179,0,0,128,0,0
db 179,0,0,128,0,0,230,0,0,202,0,0,202,0,0,179
db 0,0,128
db 0,0,128,0,0,230,0,0,230,0
db 0,230,0,0,128,0,0,202,0,0,179,0,0,128,0,0
db 230,0,0,179,0,0,128,0,0,230,0,0,230,0,0,179
db 0,0,128
db 0,0,0,0,0,128,0,0,128,0
db 0,128,0,0,230,0,0,202,0,0,179,0,0,128,0,0
db 230,0,0,202,0,0,179,0,0,128,0,0,128,0,0,128
db 0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,128,0,0,230,0,0,202,0,0,179,0,0,128,0,0
db 230,0,0,202,0,0,179,0,0,128
db 0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,128,0,0,230,0,0,230,0,0,179,0,0,128,0,0
db 230,0,0,230,0,0,179,0,0,128
db 0,0,0
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
db 0,0,0,0,128,0,0,128,0,0,128,0,0,0,0,0
db 128,0,0,128,0,0,128,0,0,0,0,0,0,0,0,0
db 0,0,0

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,9 @@
#
#
#
UIN="123456789"
PASS="PASS"
#
#
ICQIP="64.12.200.89"
#ICQIP="192.168.0.1"

View File

@ -0,0 +1 @@
lang fix ru

View File

@ -0,0 +1,543 @@
@^ fix macro comment {
^@ fix }
; -------------------------
macro library [lname,fname]
{
forward
dd __#lname#_library_table__,__#lname#_library_name__
common
dd 0
forward
align 4
__#lname#_library_name__ db fname,0
}
macro import lname,[name,sname]
{
common
align 4
__#lname#_library_table__:
forward
if used name
name dd __#name#_import_name__
end if
common
dd 0
forward
if used name
align 4
__#name#_import_name__ db sname,0
end if
}
macro export [name,sname]
{
forward
dd __#name#_export_name__,name
common
dd 0
forward
align 4
__#name#_export_name__ db sname,0
}
; -------------------------
macro m2m dest,src {
push src
pop dest
}
macro iglobal {
IGlobals equ IGlobals,
macro __IGlobalBlock { }
macro uglobal {
UGlobals equ UGlobals,
macro __UGlobalBlock { }
endg fix } ; Use endg for ending iglobal and uglobal blocks.
macro IncludeIGlobals{
macro IGlobals dummy,[n] \{ __IGlobalBlock
purge __IGlobalBlock \}
match I, IGlobals \{ I \} }
macro IncludeUGlobals{
macro UGlobals dummy,[n] \{
\common
\local begin, size
begin = $
virtual at $
\forward
__UGlobalBlock
purge __UGlobalBlock
\common
size = $ - begin
end virtual
rb size
\}
match U, UGlobals \{ U \} }
uglobal
endg
iglobal
endg
; new application structure
macro meos_app_start
{
use32
org 0x0
db 'MENUET01'
dd 0x01
dd __start
dd __end
dd __memory
dd __stack
if used __params & ~defined __params
dd __params
else
dd 0x0
end if
dd 0x0
}
MEOS_APP_START fix meos_app_start
macro code
{
__start:
}
CODE fix code
macro data
{
__data:
IncludeIGlobals
}
DATA fix data
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
IncludeUGlobals
}
UDATA fix udata
macro meos_app_end
{
align 32
rb 2048
__stack:
__memory:
}
MEOS_APP_END fix meos_app_end
; macro for defining multiline text data
struc mstr [sstring]
{
forward
local ssize
virtual at 0
db sstring
ssize = $
end virtual
dd ssize
db sstring
common
dd -1
}
; macro for defining multiline text data
struc mls [sstring]
{
forward
local ssize
virtual at 0
db sstring ; mod
ssize = $
end virtual
db ssize
db sstring
common
db -1 ; mod
}
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
name db data
.size = $-name
end if
}
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
forward
if lang eq lng
db data
end if
common
.size = $-name
end if
}
macro szc name,elsz,[data] { ; from MFAR [mike.dld]
common
local s,m
m = 0
if used name
label name
forward
virtual at 0
db data
s = $
end virtual
d#elsz s
if m < s
m = s
end if
db data
common
.size = $-name
.maxl = m
end if
}
macro lszc name,elsz,[lng,data] { ; from MFAR [mike.dld]
common
local s,m,c
m = 0
c = 0
if used name
label name
forward
if lang eq lng
virtual at 0
db data
s = $
end virtual
d#elsz s
if m < s
m = s
end if
db data
c = c+1
end if
common
.size = $-name
.maxl = m
.count = c
end if
}
; easy system call macro
macro mpack dest, hsrc, lsrc
{
if (hsrc eqtype 0) & (lsrc eqtype 0)
mov dest, (hsrc) shl 16 + lsrc
else
if (hsrc eqtype 0) & (~lsrc eqtype 0)
mov dest, (hsrc) shl 16
add dest, lsrc
else
mov dest, hsrc
shl dest, 16
add dest, lsrc
end if
end if
}
macro __mov reg,a,b { ; mike.dld
if (~a eq)&(~b eq)
mpack reg,a,b
else if (~a eq)&(b eq)
mov reg,a
end if
}
include 'config.inc'
;__CPU_type equ p5
SYSENTER_VAR equ 0
macro mcall a,b,c,d,e,f { ; mike.dld, updated by Ghost for Fast System Calls
local ..ret_point
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
if __CPU_type eq p5
int 0x40
else
if __CPU_type eq p6
push ebp
mov ebp, esp
push ..ret_point ; it may be 2 or 5 byte
sysenter
..ret_point:
pop edx
pop ecx
else
if __CPU_type eq k6
push ecx
syscall
pop ecx
else
display 'ERROR : unknown CPU type (set to p5)', 10, 13
__CPU_type equ p5
int 0x40
end if
end if
end if
}
; -------------------------
macro header a,[b] {
common
use32
org 0
db 'MENUET',a
forward
if b eq
dd 0
else
dd b
end if }
macro section name { align 16
label name }
macro func name {
if ~used name
display 'FUNC NOT USED: ',`name,13,10
else
align 4
name:
;diff16 `name,0,name
;pushad
;pushfd
;dps `name
;newline
;mcall 5,1
;popfd
;popad
}
macro endf { end if }
macro diff16 title,l1,l2
{
local s,d
s = l2-l1
display title,': 0x'
repeat 8
d = '0' + s shr ((8-%) shl 2) and $0F
if d > '9'
d = d + 'A'-'9'-1
end if
display d
end repeat
display 13,10
}
macro diff10 title,l1,l2
{
local s,d,z,m
s = l2-l1
z = 0
m = 1000000000
display title,': '
repeat 10
d = '0' + s / m
s = s - (s/m)*m
m = m / 10
if d <> '0'
z = 1
end if
if z <> 0
display d
end if
end repeat
display 13,10
}
; optimize the code for size
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
macro add arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
inc arg1
else
add arg1,arg2
end if
else
add arg1,arg2
end if
}
macro sub arg1,arg2
{
if (arg2 eqtype 0)
if (arg2) = 1
dec arg1
else
sub arg1,arg2
end if
else
sub arg1,arg2
end if
}
macro mov arg1,arg2
{
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0'))
if (arg2) = 0
xor arg1,arg1
else if (arg2) = 1
xor arg1,arg1
inc arg1
else if (arg2) = -1
or arg1,-1
else if (arg2) > -128 & (arg2) < 128
push arg2
pop arg1
else
mov arg1,arg2
end if
else
mov arg1,arg2
end if
}
macro RGB [a] {
common
match (r=,g=,b),a \{
\dd ((r) shl 16) or ((g) shl 8) or (b)
\}
}
struc POINT _t,_dx,_dy {
.x _t _dx
.y _t _dy
}
; structure definition helper
include 'struct.inc'
struct RECT
left dd ?
top dd ?
right dd ?
bottom dd ?
ends
struct BOX
left dd ?
top dd ?
width dd ?
height dd ?
ends
; structures used in MeOS
struct process_information
cpu_usage dd ? ; +0
window_stack_position dw ? ; +4
window_stack_value dw ? ; +6
dw ? ; +8
process_name rb 12 ; +10
memory_start dd ? ; +22
used_memory dd ? ; +26
PID dd ? ; +30
box BOX ; +34
slot_state dw ? ; +50
dw ? ; +52
client_box BOX ; +54
wnd_state db ? ; +70
rb (1024-71)
ends
struct system_colors
frame dd ?
grab dd ?
grab_button dd ?
grab_button_text dd ?
grab_text dd ?
work dd ?
work_button dd ?
work_button_text dd ?
work_text dd ?
work_graph dd ?
ends
struct FILEDATE
Second db ?
Minute db ?
Hour db ?
db ?
Day db ?
Month db ?
Year dw ?
ends
struct FILEINFO
Attributes dd ?
IsUnicode db ?
db 3 dup(?)
DateCreate FILEDATE
DateAccess FILEDATE
DateModify FILEDATE
Size dq ?
ends
; constants
; events
EV_IDLE = 0
EV_TIMER = 0
EV_REDRAW = 1
EV_KEY = 2
EV_BUTTON = 3
EV_EXIT = 4
EV_BACKGROUND = 5
EV_MOUSE = 6
EV_IPC = 7
EV_STACK = 8
; event mask bits for function 40
EVM_REDRAW = 1b
EVM_KEY = 10b
EVM_BUTTON = 100b
EVM_EXIT = 1000b
EVM_BACKGROUND = 10000b
EVM_MOUSE = 100000b
EVM_IPC = 1000000b
EVM_STACK = 10000000b

View File

@ -0,0 +1,696 @@
;
; ‘âàãªâãà  ¤«ï ä㭪樨 70
;
struc sinfo
{
.subfnc_name dd 0
.pos_in_file dd 0
.reserved dd 0
.bytes_to_read dd 0
.pbuffer dd 0
.null db 0
.pname dd 0
}
;
; â ¡«¨æë §­ ç¥­¨©
;
; +----+-------------+-----------------+
; | in | Variable | Variable |
; | de | name | string |
; | x | | |
; | | | |
; +----+-------------+-----------------+
; | | | |
; | | | |
; | 1 | UIN | 'XXXXX..XX',0 |
; | | | |
; +----+-------------+-----------------+
; | | |
;
; § £à㧪  int ¯®ª  ­¥ ॠ«¨§®¢ ­ 
;
; +----+-------------+-----------------+
; | in | Variable | Variable |
; | de | name | int |
; | x | | |
; | | | |
; +----+-------------+-----------------+
; | | | |
; | | | |
; | 1 | BUFFSIZE | XXXXXXXX |
; | | | |
; +----+-------------+-----------------+
; | | |
;
;
TABLE_SIZE equ 16
VNAME_LEN equ 8
VAR_LEN equ 16
;
; Ž¯¨á ­¨¥ â ¡«¨æë §­ ç¥­¨©
virtual at 0
vartable:
.uin db VAR_LEN dup ?
.pass db VAR_LEN dup ?
.icqip db VAR_LEN dup ?
end virtual
;
; Š®¤ë ®è¨¡®ª ä ©«®¢®© á¨á⥬ë
;
FIO_SUCCESS equ 0
FIO_UNSUPPORTED equ 2
FIO_UNKNOWNFS equ 3
FIO_FILENOTFOUND equ 5
FIO_EOF equ 6
FIO_BADPOINTER equ 7
FIO_DISKFULL equ 8
FIO_FATDAMAGED equ 9
FIO_DENIED equ 10
FIO_ERRORDEVICE equ 11
IOBUFF_SIZE equ 128
;
; ¬ ªà®á ¤«ï ¯®¨áª  í«¥¬¥­â  ¢ áâப¥
; ¢®§¢à é ¥â ¢ eax ­®¬¥à í«¥¬¥­â  ¨«¨ -1 ¥á«¨ ­¥ ­ ©¤¥­
macro findchar string, len, char
{
local ..fc_endstr, ..fc_end
push ebx
push ecx
push edi
mov edi, string
mov ecx, len
mov ebx, ecx
cld
mov al, char
repne scasb
jcxz ..fc_endstr
sub ebx, ecx ; <EFBFBD>®¬¥à =
mov eax, ebx
jmp ..fc_end
..fc_endstr:
mov eax, -1
..fc_end:
pop edi
pop ecx
pop ebx
}
;
; Œ ªà®á ¤«ï ¯®¨áª  í«¥¬¥­â  áâப¨, ®â«¨ç î饣®áï ®â
; § ¤ ­­®£®
macro findother string, len, char
{
local ..fc_endstr, ..fc_end
push ebx
push ecx
push edi
mov edi, string
mov ecx, len
mov ebx, ecx
cld
mov al, char
repe scasb ; …᫨ ᨬ¢®« ­¥ char - ¢ë室¨¬
jcxz ..fc_endstr ; áâப  ¨§ char
sub ebx, ecx ; ¢ ebx - ­®¬¥à í«¥¬¥­â  ®â«¨ç­®£® ®â char
mov eax, ebx
jmp ..fc_end
..fc_endstr:
mov eax, -1
..fc_end:
pop edi
pop ecx
pop ebx
}
;
; Œ ªà®á ¤«ï ª®¯¨à®¢ ­¨ï áâப
;
macro mstrcpy from, to, leng
{
push ecx
push esi
push edi
mov ecx, leng
mov esi, from
mov edi, to
cld
rep movsb
pop edi
pop esi
pop ecx
}
;
; ˆ­¨æ¨ «¨§¨àã¥â â ¡«¨æë
;
; inittables:
;
;
; mstrcpy name1, nvtable, VNAME_LEN
; mstrcpy name2, (nvtable + NAME_LEN), VNAME_LEN
; mstrcpy name3, (nvtable + NAME_LEN * 2), VNAME_LEN
;
;
;
; ret
;
; § ¯®«­ï¥â â ¡«¨æë §­ ç¥­¨ï¬¨
; IN eax - ASCIIZ ¨¬ï ä ©« 
; OUT eax - १ã«ìâ â ç⥭¨ï
; ¥á«¨ १ã«ìâ â -1, ä®à¬ â ä ©«  ­¥¯à ¢¨«ì­ë©
;
parseconf:
push edi
push esi
;push eax
push ebx
push ecx
push edx
mov [strnum], dword 0
;
; <EFBFBD>à®ç¨â âì ¯®áâà®ç­® ª®­ä¨£
; ¥á«¨ áâப  ­ ç¨­ ¥âáï á ;, # - ª®¬¬¥­â à¨©
; ”®à¬ â UIN="1234567890"
; PASS="******" ¨ â.¤.
;
; ‘¡à®á ᬥ饭¨ï
mov [shift], dword 0
mov esi, eax
pc_still:
mov edx, esi
mov ecx, IOBUFF_SIZE
mov ebx, iobuff
call getstr
inc [strnum]
push eax
;
;<EFBFBD>஢¥àª  ¯®«ã祭­®© áâப¨
;
movzx eax, byte [iobuff]
test eax, eax
jz pc_next
cmp al, '#'
jz pc_next
cmp al, ';'
jz pc_next
;
; <EFBFBD> ©â¨ ¨¬ï ¯¥à¥¬¥­­®©
;
findother iobuff, ebx, ' '
cmp eax, -1
jz pc_next
mov [stnpos], eax ;­ ç «® ¨¬¥­¨
;
; ­ ©â¨ =
;
mov ecx, ebx ; ˆáª âì ®â ­ ©¤¥­­®£® ᨬ¢®« 
sub ecx, eax ;
mov edi, iobuff
add edi, eax
findchar edi, ecx, '='
cmp eax, -1
jz pc_badformat
mov edi, [stnpos]
add eax, edi ; ¢ eax - ᬥ饭¨¥ ®â ­ ç «  áâப¨
mov [eqpos], eax
mov ecx, ebx
sub ecx, eax
;
; ¯à®¢¥à¨âì "
;
mov dl, [iobuff + eax]
cmp dl, '"'
jnz pc_badformat
;
; ­ ©â¨ § ªà뢠îéãî "
;
mov edi, iobuff
add edi, eax
inc edi
findchar edi, ecx, '"'
cmp eax, -1
jz pc_badformat
inc eax
mov edx, [eqpos]
add eax, edx
mov [edvpos], eax
;
; “áâ ­®¢¨âì §­ ç¥­¨¥
;
; „®¡ ¢¨âì § ¢¥àè î騥 0
mov eax, [stnpos]
dec eax
mov ebx, [eqpos]
mov ecx, ebx
dec ecx ; ª®«¨ç¥á⢮ ᨬ¢®«®¢ ¤® =
inc ebx ; <EFBFBD>யãáâ¨âì "
mov [iobuff + ecx], byte 0
mov edx, [edvpos]
dec edx
mov [iobuff + edx], byte 0
lea eax, [iobuff + eax]
lea ebx, [iobuff + ebx]
call setavar
jmp pc_next
pc_badformat:
pop eax
mov ebx, [strnum]
jmp pc_err
pc_next:
pop eax
cmp eax, FIO_EOF
jz pc_eof
cmp eax, FIO_SUCCESS
jnz pc_err
jmp pc_still
pc_eof:
pc_err:
pop edx
pop ecx
pop ebx
;pop eax
pop esi
pop edi
ret
; <EFBFBD>®¨áª ¢ â ¡«¨æ¥ ¯¥à¥¬¥­­®© ¨ ãáâ ­®¢ª  ¥ñ §­ ç¥­¨ï
; IN eax - ­ §¢ ­¨¥ ¯¥à¥¬¥­­®© 㪠§ â¥«ì ­  ASCIIZ
; IN ebx - §­ ç¥­¨¥ ¯¥à¥¬¥­­®© 㪠§ â¥«ì ­  ASCIIZ
; OUT eax -१ã«ìâ â 0 = OK, -1 = ­¥â ¢ â ¡«¨æ¥ ¯¥à¥¬¥­­ëå
; OUT § ¯®«­ï¥â £«®¡ «ì­ãî â ¡«¨æã
setavar:
;push ebx
push ecx
push edx
push esi
push edi
push ebx
;
; Ž¯à¥¤¥«¨âì ¤«¨­ã áâப¨ - ­ §¢ ­¨¥ ¯¥à¥¬¥­­®©
;
mov edi, eax
push eax
mov ecx, VNAME_LEN
xor eax, eax ;ˆé¥¬ \0
cld
repne scasb
mov eax, VNAME_LEN
sub eax, ecx ; ecx - ®áâ â®ª ¤® ¬ ªá¨¬ «ì­®£® à §¬¥à  áâப¨
mov ebx, eax
pop eax
;
; ˆáª âì ¢ â ¡«¨æ¥ ¯®¤å®¤ï饥 ¨¬ï
;
xor edx, edx ;index
sv_next:
mov ecx, ebx
push eax
mov esi, eax
mov edi, nvtable
mov eax, edx
imul eax, VNAME_LEN ;offset
add edi, eax
pop eax
cld
repe cmpsb
jz sv_match
sv_inc:
inc edx
cmp edx, TABLE_SIZE
jae sv_fail
jmp sv_next
sv_match:
cmp ebx, VNAME_LEN ; ebx - ¤«¨­  ¨á室­®© áâà®çª¨
jz sv_match2
push eax
mov edi, nvtable
mov eax, edx
imul eax, VNAME_LEN ;offset
add edi, eax
pop eax
cmp [edi + ebx], byte 0 ; …᫨ ¨¬ï ¢ â ¡«¨æ¥ ª®à®ç¥ ¬ ªá¨¬ «ì­®£®,
jnz sv_inc ; § ª ­ç¨¢ ¥âáï 0
sv_match2:
pop edi ;
push edi
;
; Ž¯à¥¤¥«ïâì ¤«¨­ã áâப¨ - ¯¥à¥¬¥­­ ï
;
xor eax, eax
mov ecx, VAR_LEN
cld
repne scasb
mov eax, VAR_LEN
sub eax, ecx
mov ecx, eax
mov ebx, eax
;
; Š®¯¨à®¢ âì ¯¥à¥¬¥­­ãî ¢ â ¡«¨æã
;
pop esi
push esi
mov eax, VAR_LEN
imul eax, edx
mov edi, vtable
add edi, eax
cld
rep movsb
;
; …᫨ áâப  ª®à®ç¥ ¯®«ï ¢ â ¡«¨æ¥, § ¯¨á âì ¢ ª®­¥æ 0
;
cmp ebx, VAR_LEN
jz sv_end
mov [edi + ebx], byte 0
sv_end:
xor eax, eax
jmp sv_fin
sv_fail:
mov eax, -1
sv_fin:
pop ebx
pop edi
pop esi
pop edx
pop ecx
;pop ebx
ret
;
; —⥭¨¥ ASCIIZ áâப¨ ¨§ ä ©« 
; IN ebx - 㪠§ â¥«ì ­  ¡ãä¥à
; ecx - à §¬¥à ¡ãä¥à 
; edx - 㪠§ â¥«ì ­  áâப㠨¬ï ä ©« 
; OUT ebx - ¤«¨­  áâப¨
; eax - १ã«ìâ â ç⥭¨ï
getstr:
;push eax
;push ebx
push ecx
push edx
push esi
;xor edx, edx
xor esi, esi
gs_read:
;
; ‡ ¯®«­ï¥¬ áâàãªâãàã
;
mov [finfo.subfnc_name], 0
mov eax, [shift]
mov [finfo.pos_in_file], eax
mov [finfo.bytes_to_read], ecx
mov [finfo.pbuffer], ebx
mov [finfo.pname], edx
push ebx
;
; —¨â¥¬
;
;mov eax, 70
;mov ebx, finfo
;int 40h
mcall 70, finfo
mov ecx, ebx ; ebx ª®«¨ç¥á⢮ ¯à®ç⥭­ëå ¡ ©â
pop ebx
;
; <EFBFBD>஢¥à¨âì १ã«ìâ â ç⥭¨ï - ¥á«¨ ­¥ EOF ¨ 0,
; ¢ë室¨¬
cmp eax, FIO_EOF
jz gs_loop
cmp eax, 0
jz gs_loop
jmp gs_ok
;
; Ž¡à ¡®âª  ¯®«ã祭­®£® ¡«®ª 
;
gs_loop:
mov dl, [ebx + esi]
cmp dl, 0Ah ;cr
jz gs_cr
inc esi
cmp esi, ecx
jnb gs_err
jmp gs_loop
gs_err:
;
; ¡ãä¥à¥ ­¥â ᨬ¢®«  ¯¥à¥­®á  áâப¨, â.¥. áâப  ᫨誮¬ ¤«¨­­ ï
; Žâ¡à á뢠¥¬ ¢á¥ ¤® ¡«¨¦ ©è¥£® ᨬ¢®«  ¯¥à¥­®á  áâப¨
; ¥á«¨ ª®­¥æ ä ©«  - ¢ë室¨¬
cmp eax, FIO_EOF
jz gs_endf
add [shift], ecx
jmp gs_read
gs_endf:
xor ebx, ebx
jmp gs_ok
gs_cr:
;
; ‘¡à®á¨âì १ã«ìâ â ç⥭¨ï
;
xor eax, eax
mov dl, [ebx + esi - 1]
cmp dl, 0Dh ;le
jz gs_le
mov [ebx + esi], byte 0
mov ebx, esi
inc esi
add [shift], esi
jmp gs_ok
gs_le:
mov [ebx + esi - 1], byte 0
mov [ebx + esi], byte 0
lea ebx, [esi - 1]
inc esi
add [shift], esi
gs_ok:
pop esi
pop edx
pop ecx
;pop ebx
;pop eax
ret
;
; ”ã­ªæ¨ï ¤«ï ¢ë¢®¤  § £à㦥­­®© ¨­äë
;
showcfg:
push eax
push ebx
push ecx
push edx
push edi
xor edx, edx ; áç¥â稪
sc_loop:
cmp edx, TABLE_SIZE
jnb sc_end
;
; ‘ª®¯¨à®¢ âì ¢ ¡ãä¥à ¨¬ï ¨ §­ ç¥­¨¥ ¯¥à¥¬¥­­®©
;
mov eax, VNAME_LEN
imul eax, edx
lea eax, [nvtable + eax]
mov cl, [eax]
cmp cl, byte 0
jz sc_next
push eax
call strlen
mov ecx, eax
pop eax
mov ebx, cfgbuff
call strcpy
mov [cfgbuff + ecx], ':'
lea ebx, [cfgbuff + ecx + 1]
mov eax, VAR_LEN
imul eax, edx
lea eax, [vtable + eax]
push eax
call strlen
mov ecx, eax
pop eax
call strcpy
mov [ebx + ecx], byte 0
mov eax, cfgbuff
xor ebx, ebx
call writemsg
sc_next:
inc edx
jmp sc_loop
sc_end:
pop edi
pop edx
pop ecx
pop ebx
pop eax
ret

View File

@ -0,0 +1,100 @@
;
; „ ­­ë¥ ¤«ï parser.inc
;
;
;
; ¨¬ï ä ©« , ª®â®àë© ­ã¦­® ¯ àá¨âì
;
fname db '/sys/ki.cfg',0
;
; â ¡«¨æë §­ ç¥­¨©
;
; +----+-------------+-----------------+
; | in | Variable | Variable |
; | de | name | string |
; | x | | |
; | | | |
; +----+-------------+-----------------+
; | | | |
; | | | |
; | 1 | UIN | 'XXXXX..XX' |
; | | | |
; +----+-------------+-----------------+
; | | |
;
; § £à㧪  int ¯®ª  ­¥ ॠ«¨§®¢ ­ 
;
; +----+-------------+-----------------+
; | in | Variable | Variable |
; | de | name | int |
; | x | | |
; | | | |
; +----+-------------+-----------------+
; | | | |
; | | | |
; | 1 | BUFFSIZE | XXXXXXXX |
; | | | |
; +----+-------------+-----------------+
; | | |
;
;
;nvtable db (TABLE_SIZE * NAME_LEN) dup 0
vtable db (TABLE_SIZE * VAR_LEN) dup 0
finfo sinfo
;
; ‡ ¯®«­¨âì â ¡«¨æã ¨¬¥­ ¯¥à¥¬¥­­ëå
;
nvtable db 'UIN',(VNAME_LEN - 3) dup 0
db 'PASS',(VNAME_LEN - 4) dup 0
db 'ICQIP',(VNAME_LEN - 5) dup 0
db ((TABLE_SIZE - 3) * VNAME_LEN) dup 0
;
; ¤«ï ¨­¨æ¨ «¨§ æ¨¨ â ¡«¨æ
;
;
;
;name1 db 'UIN',(VNAME_LEN - 3) dup 0
;name2 db 'PASS',(VNAME_LEN - 4) dup 0
;name3 db 'ICQIP',(VNAME_LEN - 5) dup 0
;
; <EFBFBD>ãä¥à ¤«ï ¢¢®¤ /¢ë¢®¤ 
;
iobuff db IOBUFF_SIZE dup 0
;
; ‘¬¥é¥­¨¥ ¢ ä ©«¥
;
shift dd 0
;
; <EFBFBD>¥à¥¬¥­­ë¥ ¤«ï åà ­¥­¨ï ­®¬¥à®¢
; ᨬ¢®«®¢ ­ ç «  ¨¬¥­¨ ¯¥à¥¬¥­­®©
; ª®­æ , à ¢­®, ª®­æ  §­ ç¥­¨ï
stnpos dd 0
ednpos dd 0
eqpos dd 0
edvpos dd 0
;
;<EFBFBD>®¬¥à áâப¨ ¤«ï ®¯à¥¤¥«¥­¨ï ®è¨¡®ç­ëå
;
strnum dd 0
;
; <EFBFBD>ãä¥à ¤«ï ¢ë¢®¤  § £à㦥­­®£® ª®­ä¨£ 
;
cfgbuff db (VAR_LEN + VNAME_LEN + 8) dup 0
cfgbuff.len = $ - cfgbuff

View File

@ -0,0 +1,270 @@
; Macroinstructions for defining and calling procedures
macro stdcall proc,[arg] ; directly call STDCALL procedure
{ common
if ~ arg eq
reverse
pushd arg
common
end if
call proc }
macro invoke proc,[arg] ; indirectly call STDCALL procedure
{ common
if ~ arg eq
reverse
pushd arg
common
end if
call [proc] }
macro ccall proc,[arg] ; directly call CDECL procedure
{ common
size@ccall = 0
if ~ arg eq
reverse
pushd arg
size@ccall = size@ccall+4
common
end if
call proc
if size@ccall
add esp,size@ccall
end if }
macro cinvoke proc,[arg] ; indirectly call CDECL procedure
{ common
size@ccall = 0
if ~ arg eq
reverse
pushd arg
size@ccall = size@ccall+4
common
end if
call [proc]
if size@ccall
add esp,size@ccall
end if }
macro proc [args] ; define procedure
{ common
match name params, args>
\{ define@proc name,<params \} }
prologue@proc equ prologuedef
macro prologuedef procname,flag,parmbytes,localbytes,reglist
{ if parmbytes | localbytes
push ebp
mov ebp,esp
if localbytes
sub esp,localbytes
end if
end if
irps reg, reglist \{ push reg \} }
epilogue@proc equ epiloguedef
macro epiloguedef procname,flag,parmbytes,localbytes,reglist
{ irps reg, reglist \{ reverse pop reg \}
if parmbytes | localbytes
leave
end if
if flag and 10000b
retn
else
retn parmbytes
end if }
macro define@proc name,statement
{ local params,flag,regs,parmbytes,localbytes,current
if used name
name:
match =stdcall args, statement \{ params equ args
flag = 11b \}
match =stdcall, statement \{ params equ
flag = 11b \}
match =c args, statement \{ params equ args
flag = 10001b \}
match =c, statement \{ params equ
flag = 10001b \}
match =params, params \{ params equ statement
flag = 0 \}
virtual at ebp+8
match =uses reglist=,args, params \{ regs equ reglist
params equ args \}
match =regs =uses reglist, regs params \{ regs equ reglist
params equ \}
match =regs, regs \{ regs equ \}
match =,args, params \{ defargs@proc args \}
match =args@proc args, args@proc params \{ defargs@proc args \}
parmbytes = $ - (ebp+8)
end virtual
name # % = parmbytes/4
all@vars equ
current = 0
match prologue:reglist, prologue@proc:<regs> \{ prologue name,flag,parmbytes,localbytes,reglist \}
macro locals
\{ virtual at ebp-localbytes+current
macro label def \\{ match . type,def> \\\{ deflocal@proc .,label,<type \\\} \\}
struc db [val] \\{ \common deflocal@proc .,db,val \\}
struc du [val] \\{ \common deflocal@proc .,du,val \\}
struc dw [val] \\{ \common deflocal@proc .,dw,val \\}
struc dp [val] \\{ \common deflocal@proc .,dp,val \\}
struc dd [val] \\{ \common deflocal@proc .,dd,val \\}
struc dt [val] \\{ \common deflocal@proc .,dt,val \\}
struc dq [val] \\{ \common deflocal@proc .,dq,val \\}
struc rb cnt \\{ deflocal@proc .,rb cnt, \\}
struc rw cnt \\{ deflocal@proc .,rw cnt, \\}
struc rp cnt \\{ deflocal@proc .,rp cnt, \\}
struc rd cnt \\{ deflocal@proc .,rd cnt, \\}
struc rt cnt \\{ deflocal@proc .,rt cnt, \\}
struc rq cnt \\{ deflocal@proc .,rq cnt, \\} \}
macro endl
\{ purge label
restruc db,du,dw,dp,dd,dt,dq
restruc rb,rw,rp,rd,rt,rq
current = $-(ebp-localbytes)
end virtual \}
macro ret operand
\{ match any, operand \\{ retn operand \\}
match , operand \\{ match epilogue:reglist, epilogue@proc:<regs>
\\\{ epilogue name,flag,parmbytes,localbytes,reglist \\\} \\} \}
macro finish@proc \{ localbytes = (((current-1) shr 2)+1) shl 2
end if \} }
macro defargs@proc [arg]
{ common
if ~ arg eq
forward
local ..arg,current@arg
match argname:type, arg
\{ current@arg equ argname
label ..arg type
argname equ ..arg
if dqword eq type
dd ?,?,?,?
else if tbyte eq type
dd ?,?,?
else if qword eq type | pword eq type
dd ?,?
else
dd ?
end if \}
match =current@arg,current@arg
\{ current@arg equ arg
arg equ ..arg
..arg dd ? \}
common
args@proc equ current@arg
forward
restore current@arg
common
end if }
macro deflocal@proc name,def,[val]
{ common
match vars, all@vars \{ all@vars equ all@vars, \}
all@vars equ all@vars name
forward
local ..var,..tmp
match =label,def \{ ..tmp equ \}
match tmp,..tmp \{ ..var def val \}
match ,..tmp \{ label ..var val \}
match =?, val \{ ..tmp equ \}
match any =dup (=?), val \{ ..tmp equ \}
match tmp : value, ..tmp : val
\{ tmp: end virtual
initlocal@proc ..var,def value
virtual at tmp\}
common
match first rest, ..var, \{ name equ first \} }
macro initlocal@proc name,def
{ virtual at name
def
size@initlocal = $ - name
end virtual
position@initlocal = 0
while size@initlocal > position@initlocal
virtual at name
def
if size@initlocal - position@initlocal < 2
current@initlocal = 1
load byte@initlocal byte from name+position@initlocal
else if size@initlocal - position@initlocal < 4
current@initlocal = 2
load word@initlocal word from name+position@initlocal
else
current@initlocal = 4
load dword@initlocal dword from name+position@initlocal
end if
end virtual
if current@initlocal = 1
mov byte [name+position@initlocal],byte@initlocal
else if current@initlocal = 2
mov word [name+position@initlocal],word@initlocal
else
mov dword [name+position@initlocal],dword@initlocal
end if
position@initlocal = position@initlocal + current@initlocal
end while }
macro endp
{ purge ret,locals,endl
finish@proc
purge finish@proc
restore regs@proc
match all,args@proc \{ restore all \}
restore args@proc
match all,all@vars \{ restore all \} }
macro local [var]
{ common
locals
forward done@local equ
match varname[count]:vartype, var
\{ match =BYTE, vartype \\{ varname rb count
restore done@local \\}
match =WORD, vartype \\{ varname rw count
restore done@local \\}
match =DWORD, vartype \\{ varname rd count
restore done@local \\}
match =PWORD, vartype \\{ varname rp count
restore done@local \\}
match =QWORD, vartype \\{ varname rq count
restore done@local \\}
match =TBYTE, vartype \\{ varname rt count
restore done@local \\}
match =DQWORD, vartype \\{ label varname dqword
rq count+count
restore done@local \\}
match , done@local \\{ virtual
varname vartype
end virtual
rb count*sizeof.\#vartype
restore done@local \\} \}
match :varname:vartype, done@local:var
\{ match =BYTE, vartype \\{ varname db ?
restore done@local \\}
match =WORD, vartype \\{ varname dw ?
restore done@local \\}
match =DWORD, vartype \\{ varname dd ?
restore done@local \\}
match =PWORD, vartype \\{ varname dp ?
restore done@local \\}
match =QWORD, vartype \\{ varname dq ?
restore done@local \\}
match =TBYTE, vartype \\{ varname dt ?
restore done@local \\}
match =DQWORD, vartype \\{ label varname dqword
dq ?,?
restore done@local \\}
match , done@local \\{ varname vartype
restore done@local \\} \}
match ,done@local
\{ var
restore done@local \}
common
endl }

View File

@ -0,0 +1,413 @@
;
;
; Поддержка контакт листа на сервере
;
;
;
; Заполняет таблицу с UIN
; и опционально таблицы с именем и доп. инфой
;
; Из comp.inc для отладки
;
;
; Массив с UIN
;
;UIN_LEN = 11 ; Длина
;UINS = 15 ; Количество
;
;uins db UIN_LEN*UINS dup 0
;
; массив со статусами
;
;stats dd UINS dup -1
;
; Массив с именами
;
;NAME_LEN = 30
;names db NAME_LEN*UINS dup 0
;
; Достает из item UIN
; eax <- указатель на item
; Пропускает группы
;
ssi_get_uin:
push eax
push ebx
push ecx
push edx
;
; Проверяем ItemID
;
xor ebx, ebx
mov bl, [eax + 1] ; Length of the item name
mov bh, [eax] ;
;push ebx
;mov ebx, 128
;call print_mem
;pop ebx
;; FIXIT Разумнее проверять флаги
;; Если длина строки = 0
;; пропускаем item
;cmp ebx, 0
;jz ssi_get_end
;;
;;data_debug 'Item name len', ebx
;;+смещение до ItemID
;;xor ecx, ecx
;;mov ch, [eax + ebx + 4]
;;mov cl, [eax + ebx + 5] ; Item ID#
;;cmp ecx, 0
;;jz ssi_get_end
;
; Проверяем флаги, обрабатываем только записи UIN
;
xor ecx, ecx
mov ch, [eax + ebx + 6]
mov cl, [eax + ebx + 7]
cmp ecx, 0 ; 0x0000 Buddy record (name: uin for ICQ and screenname for AIM)
jz ssi_uin
; debug
;
lea eax, [eax + ebx + 6]
mov ebx, 2
call print_mem
jmp ssi_get_end
ssi_uin:
;
; Копируем UIN в таблицу
;
mov ecx, ebx ; Длина строки
lea eax, [eax + 2]
mov edx, [uin_ind]
cmp edx, UINS
jnb ssi_get_end ;Нет свободного места в таблице UIN
imul edx, UIN_LEN
mov ebx, uins
lea ebx, [ebx + edx]
call strcpy
inc [uin_ind]
;debug
;mov eax, ebx
;xor ebx, ebx
;call writemsg
;
ssi_get_end:
pop edx
pop ecx
pop ebx
pop eax
ret
;
; eax <- указатель на item
; возвращает в eax указатель на следующий item
;
;
ssi_next_item:
push ebx
push ecx
xor ebx, ebx
mov bl, [eax + 1] ; длина UIN
mov bh, [eax] ;
xor ecx, ecx
mov cl, [eax + ebx + 9] ; Длина дополнительных данных
mov ch, [eax + ebx + 8] ;
add ebx, ecx
add ebx, 10 ;+Длина заголовка
lea eax, [eax + ebx]
pop ecx
pop ebx
ret
;
; eax <- указатель на tlv
; возвращает в eax указатель на след tlv
;
macro get_next_tlv {
push ebx
xor ebx, ebx
mov bl, [eax + 3]
mov bh, [eax + 2]
; + размер заголовка
lea ebx, [ebx + 4]
lea eax, [eax + ebx]
pop ebx
}
;
; Ищет в additional имя и др. сведения
; eax <- указатель на item
;
ssi_get_add:
push eax
push ebx
push ecx
push edx
push esi
;mov ebx, 128
;call print_mem
xor ebx, ebx
mov bl, [eax + 1] ; Length of the item name
mov bh, [eax] ;
;;cmp ebx, 0 ; Если длина имени = 0
;;jz ssi_all_tlv ; Нет смысла обрабатывать
;;+смещение до ItemID
;;xor ecx, ecx
;;mov ch, [eax + ebx + 4]
;;mov cl, [eax + ebx + 5] ; Item ID#
;
;;cmp ecx, 0 ; Группы пока не обрабатываются
;;jz ssi_all_tlv ;
;
; Проверяем флаги, обрабатываем только записи UIN
;
xor ecx, ecx
mov ch, [eax + ebx + 6]
mov cl, [eax + ebx + 7]
cmp ecx, 0 ; 0x0000 Buddy record (name: uin for ICQ and screenname for AIM)
jnz ssi_all_tlv
xor edx, edx
mov dl, [eax + ebx + 9] ;
mov dh, [eax + ebx + 8] ; Length of the additional data
lea eax, [eax + ebx + 10] ; eax указатель на первый tlv
;FIXME : Iservd не присылает additional - пока не могу отладить
;debug
;push ebx
;mov ebx, edx
;data_debug 'length additional data', ebx
;call print_mem
;pop ebx
;
xor esi, esi
ssi_tlv_process:
cmp esi, edx ;
jnb ssi_all_tlv ; additional закончилось
xor ecx, ecx
mov cl, [eax + 3] ;
mov ch, [eax + 2] ; TLV.Length
xor ebx, ebx
mov bl, [eax + 1] ; TLV.Type
mov bh, [eax] ;
cmp bx, 0x0131 ;Имя пользователя
jz ssi_name
cmp bx, 0x0066 ;Ожидаем авторизации
jz ssi_auth_wait
jmp ssi_next_tlv
ssi_auth_wait:
;
;
;
jmp ssi_next_tlv
ssi_name:
;
; Скопировать имя в массив
;
push eax
push ecx
mov ebx, [name_ind]
cmp ebx, UINS
jnb ssi_name_end ;Нет места в таблице
lea eax, [eax + 4] ;Указатель на строку (Прибавляем размер заголовка TLV)
imul ebx, NAME_LEN
lea ebx, [names + ebx]
cmp ecx, NAME_LEN - 1 ; Если имя длиннее поля в таблице
jna @f
mov ecx, NAME_LEN - 1
@@:
call strcpy
;; FIXIT
;; Перекодировка имени
;;
;;mov eax, ebx
;;call win2dos
;
;debug
;push eax
;push ebx
;mov eax, ebx
;xor ebx, ebx
;call writemsg
;pop ebx
;pop eax
;
;
inc [name_ind]
pop ecx
pop eax
ssi_next_tlv:
lea ecx, [ecx + 4] ; Длина данных tlv + длина заголовка
add esi, ecx
get_next_tlv
jmp ssi_tlv_process
ssi_name_end:
pop ecx
pop eax
ssi_all_tlv:
pop esi
pop edx
pop ecx
pop ebx
pop eax
ret
;
;
; Обработка контакт листа, пришедшего от сервера
;
; в eax <- указатель на данные в пакете SNAC(13,06)
ssi_process_data:
push eax
push ebx
push ecx
push edx
;
; Проверить версию протокола
;
xor ebx, ebx
mov bl, [eax]
cmp bl, 0
jnz ssi_bad_prot
;
;в ebx - количество items
mov bl, [eax + 2]
mov bh, [eax + 1]
;
data_debug 'SSI items:', ebx
lea eax, [eax + 3] ; Установить eax на список items
xor ecx, ecx ; Счетчик items
ssi_next_uin:
cmp ecx, ebx
jnb ssi_all_items
call ssi_get_uin
call ssi_get_add
call ssi_next_item
inc ecx
jmp ssi_next_uin
ssi_bad_prot:
write_debug "ERR: SSI protocol version mismatch"
ssi_all_items:
pop edx
pop ecx
pop ebx
pop eax
ret

View File

@ -0,0 +1,5 @@
;
; Èíäåêñ â ìàññèâå UINS
;
uin_ind dd 0
name_ind dd 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 774 B

View File

@ -0,0 +1,180 @@
; Macroinstructions for defining data structures
macro struct name
{ fields@struct equ name
match child parent, name \{ fields@struct equ child,fields@\#parent \}
sub@struct equ
struc db [val] \{ \common fields@struct equ fields@struct,.,db,<val> \}
struc dw [val] \{ \common fields@struct equ fields@struct,.,dw,<val> \}
struc du [val] \{ \common fields@struct equ fields@struct,.,du,<val> \}
struc dd [val] \{ \common fields@struct equ fields@struct,.,dd,<val> \}
struc dp [val] \{ \common fields@struct equ fields@struct,.,dp,<val> \}
struc dq [val] \{ \common fields@struct equ fields@struct,.,dq,<val> \}
struc dt [val] \{ \common fields@struct equ fields@struct,.,dt,<val> \}
struc rb count \{ fields@struct equ fields@struct,.,db,count dup (?) \}
struc rw count \{ fields@struct equ fields@struct,.,dw,count dup (?) \}
struc rd count \{ fields@struct equ fields@struct,.,dd,count dup (?) \}
struc rp count \{ fields@struct equ fields@struct,.,dp,count dup (?) \}
struc rq count \{ fields@struct equ fields@struct,.,dq,count dup (?) \}
struc rt count \{ fields@struct equ fields@struct,.,dt,count dup (?) \}
macro db [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,db,<val> \}
macro dw [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dw,<val> \}
macro du [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,du,<val> \}
macro dd [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dd,<val> \}
macro dp [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dp,<val> \}
macro dq [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dq,<val> \}
macro dt [val] \{ \common \local anonymous
fields@struct equ fields@struct,anonymous,dt,<val> \}
macro rb count \{ \local anonymous
fields@struct equ fields@struct,anonymous,db,count dup (?) \}
macro rw count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dw,count dup (?) \}
macro rd count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dd,count dup (?) \}
macro rp count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dp,count dup (?) \}
macro rq count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dq,count dup (?) \}
macro rt count \{ \local anonymous
fields@struct equ fields@struct,anonymous,dt,count dup (?) \}
macro union \{ fields@struct equ fields@struct,,union,<
sub@struct equ union \}
macro struct \{ fields@struct equ fields@struct,,substruct,<
sub@struct equ substruct \}
virtual at 0 }
macro ends
{ match , sub@struct \{ restruc db,dw,du,dd,dp,dq,dt
restruc rb,rw,rd,rp,rq,rt
purge db,dw,du,dd,dp,dq,dt
purge rb,rw,rd,rp,rq,rt
purge union,struct
match name=,fields,fields@struct \\{ fields@struct equ
make@struct name,fields
fields@\\#name equ fields \\}
end virtual \}
match any, sub@struct \{ fields@struct equ fields@struct> \}
restore sub@struct }
macro make@struct name,[field,type,def]
{ common
if $
display 'Error: definition of ',`name,' contains illegal instructions.',0Dh,0Ah
err
end if
local define
define equ name
forward
local sub
match , field \{ make@substruct type,name,sub def
define equ define,.,sub, \}
match any, field \{ define equ define,.#field,type,<def> \}
common
match fields, define \{ define@struct fields \} }
macro define@struct name,[field,type,def]
{ common
local list
list equ
forward
if ~ field eq .
name#field type def
sizeof.#name#field = $ - name#field
else
rb sizeof.#type
end if
local value
match any, list \{ list equ list, \}
list equ list <value>
common
sizeof.#name = $
restruc name
match values, list \{
struc name value \\{
match any, fields@struct \\\{ fields@struct equ fields@struct,.,name,<values> \\\}
match , fields@struct \\\{ label .
forward
match , value \\\\{ field type def \\\\}
match any, value \\\\{ field type value
if ~ field eq .
rb sizeof.#name#field - ($-field)
end if \\\\}
common \\\} \\} \} }
macro enable@substruct
{ macro make@substruct substruct,parent,name,[field,type,def]
\{ \common
\local define
define equ parent,name
\forward
\local sub
match , field \\{ match any, type \\\{ enable@substruct
make@substruct type,name,sub def
purge make@substruct
define equ define,.,sub, \\\} \\}
match any, field \\{ define equ define,.\#field,type,<def> \\}
\common
match fields, define \\{ define@\#substruct fields \\} \} }
enable@substruct
macro define@union parent,name,[field,type,def]
{ common
virtual at 0
forward
if ~ field eq .
virtual at 0
parent#field type def
sizeof.#parent#field = $ - parent#field
end virtual
if sizeof.#parent#field > $
rb sizeof.#parent#field - $
end if
else if sizeof.#type > $
rb sizeof.#type - $
end if
common
sizeof.#name = $
end virtual
struc name [value] \{ \common
label .\#name
last@union equ
forward
match any, last@union \\{ virtual at .\#name
field type def
end virtual \\}
match , last@union \\{ match , value \\\{ field type def \\\}
match any, value \\\{ field type value \\\} \\}
last@union equ field
common rb sizeof.#name - ($ - .\#name) \} }
macro define@substruct parent,name,[field,type,def]
{ common
virtual at 0
forward
if ~ field eq .
parent#field type def
sizeof.#parent#field = $ - parent#field
else
rb sizeof.#type
end if
local value
common
sizeof.#name = $
end virtual
struc name value \{
label .\#name
forward
match , value \\{ field type def \\}
match any, value \\{ field type value
if ~ field eq .
rb sizeof.#parent#field - ($-field)
end if \\}
common \} }