network/icq: sources uploaded to SVN

git-svn-id: svn://kolibrios.org@1832 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Yogev Ezra 2011-02-02 09:52:07 +00:00
parent 36e43113ac
commit fc9a00e362
11 changed files with 6681 additions and 0 deletions

View File

@ -0,0 +1,160 @@
; constants
FLAP_HEAD_SIZE = 6
SNAC_HEAD_SIZE = 10
;AUTH_MESSAGE = 0008h
;USER_ADDED_MESS = 000Ch
;AUTH_REQ_MESS = 0006h
;URL_MESS = 0004h
;WEB_MESS = 000dh
;EMAIL_MESS = 000eh
;MASS_MESS_MASK = 8000h
;MRURL_MESS = 8004h
;NORM_MESS = 0001h
;MRNORM_MESS = 8001h
;CONTACT_MESS = 0013h
;MRCONTACT_MESS = 8013h
;
;
;
;CAP_PRECAP = "\x09\x46\x13"
;CAP_PRERTF = "\x97\xb1\x27"
;CAP_POSCAP = "\x4c\x7f\x11\xd1\x82\x22\x44\x45\x53\x54\x00\x00"
;CAP_POSRTF = "\x24\x3c\x43\x34\xad\x22\xd6\xab\xf7\x3f\x14\x92"
;
;Fingerprinting Capabilities
;
;CAP_M2001 = "\x2e\x7a\x64" "\x75" "\xfa\xdf\x4d\xc8\x88\x6f\xea\x35\x95\xfd\xb6\xdf"
;CAP_M2001_2 = "\xa0\xe9\x3f" "\x37" "\x4f\xe9\xd3\x11\xbc\xd2\x00\x04\xac\x96\xdd\x96"
;CAP_M2002 = "\x10\xcf\x40" "\xd1" "\x4f\xe9\xd3\x11\xbc\xd2\x00\x04\xac\x96\xdd\x96"
;CAP_MLITE = "\x56\x3f\xc8" "\x09" "\x0b\x6f\x41\xbd\x9f\x79\x42\x26\x09\xdf\xa2\xf3"
;CAP_SIMICQ = "\x97\xb1\x27" "\x51" "\x24\x3c\x43\x34\xad\x22\xd6\xab\xf7\x3f\x14\x48"
;CAP_MICQ = "mICQ \xa9 R.K. \x00\x00\x00\x00"
;CAP_TRILL_NORM = "\x97\xb1\x27" "\x51" "\x24\x3c\x43\x34\xad\x22\xd6\xab\xf7\x3f\x14\x09"
;CAP_TRILL_CRYPT= "\xf2\xe7\xc7" "\xf4" "\xfe\xad\x4d\xfb\xb2\x35\x36\x79\x8b\xdf\x00\x00"
;CAP_LICQ = "\x09\x49\x13"
;
;DC Packet Types
;
;PEER_INIT = 0ffh
;PEER_INITACK = 01h
;PEER_MSG = 02h
;PEER_INIT2 = 03h
;PEER_FILE_INIT = 00h
;PEER_FILE_INIT_ACK = 01h
;PEER_FILE_START = 02h
;PEER_FILE_START_ACK = 03h
;PEER_FILE_STOP = 04h
;PEER_FILE_SPEED = 05h
;PEER_FILE_DATA = 06h
ICQ_PORT = 5190
;
; FLAP transport
;
FLAP_ID = 02ah
struc FLAP_head
{
.bId db FLAP_ID ;id byte
.bCh db ? ;channel
.wSn dw ? ;seq number
.wDs dw ? ;data size
}
;
; Channels ID
;
NEW_CONNECTION = 01h
SNAC_DATA = 02h
FLAP_ERROR = 03h
CLOSE_CONNECTION = 04h
KEEP_ALIVE = 05h
;
; SNAC
;
struc SNAC_head
{
.wFid dw ?; Family id
.wSid dw ?; subtype id
.wDf dw ?; SNAC flags
.dRi dd ?; SNAC Request id
}
;
;
; Familes/SNACs list
;
GENERIC_SN = 0001h
LOCATION_SN = 0002h
BUDDY_LIST_SN = 0003h
ICBM_SN = 0004h
PRIVACY_SN = 0009h
BUDDY_ICONS_SN = 0010h
SSI_SN = 0013h
AUTH_REG_SN = 0017h
;
; TLV
;
struc TLV_head
{
.wTn dw ?; TLV type number
.wLv dw ?; TLV length value
}
;
; userinfo block
;
struc UI_head
{
.bUinLength db 0 ; UIN/screenname length
.bUin db 11 dup 0 ; string
.wWl dw 0 ; Warning level
.dUserClass dd 0
.dCreateTime dd 0
.dSignonTime dd 0
.wIdleTime dw 0
.dCreationTime dd 0
.dUserStatus dd 0
.dIpAddress dd 0
.dOnlineTime dd 0
}
;
;Roasting array
;
ROASTING_ARRAY db 0F3h, 026h, 081h, 0C4h, 039h, 086h, 0DBh, 092h, 071h, 0A3h, 0B9h, 0E6h, 053h, 07Ah, 095h, 07Ch
;
; Status flags
;
;
STATUS_WEBAWARE = 0x0001 ;Status webaware flag
STATUS_SHOWIP = 0x0002 ;Status show ip flag
STATUS_BIRTHDAY = 0x0008 ;User birthday flag
STATUS_WEBFRONT = 0x0020 ;User active webfront flag
STATUS_DCDISABLED = 0x0100 ;Direct connection not supported
STATUS_DCAUTH = 0x1000 ;Direct connection upon authorization
STATUS_DCCONT = 0x2000 ;DC only with contact users
;
; Status
;
STATUS_ONLINE = 0x0000 ;Status is online
STATUS_AWAY = 0x0001 ;Status is away
STATUS_DND = 0x0002 ;Status is no not disturb (DND)
STATUS_NA = 0x0004 ;Status is not available (N/A)
STATUS_OCCUPIED = 0x0010 ;Status is occupied (BISY)
STATUS_FREE4CHAT = 0x0020 ;Status is free for chat
STATUS_INVISIBLE = 0x0100 ;Status is invisible

View File

@ -0,0 +1,275 @@
; SEE YOU File FAQ.txt and HISTORY. Good Like!
;;;;;;;;;;;;;;;;;;
include 'editbox.mac' ;¬ ªà®á ª®â®àë© ¤®«¦¥­ ®¡«¥£ç¨âì ¦¨§­ì :) ᯥ樠«ì­® ¤«ï editbox
;;;;;;;;;;;;;;;;;;
macro use_edit_box procinfo,scr_h,scr_w
{
edit_box:
ed_width equ [edi] ;è¨à¨­  ª®¬¯®­¥­â 
ed_left equ [edi+4] ;¯®«®¦¥­¨¥ ¯® ®á¨ å
ed_top equ [edi+8] ;¯®«®¦¥­¨¥ ¯® ®á¨ ã
ed_color equ [edi+12] ;梥â ä®­  ª®¬¯®­¥­â 
shift_color equ [edi+16] ;=0x6a9480
ed_focus_border_color equ [edi+20] ;梥â à ¬ª¨ ª®¬¯®­¥­â 
ed_blur_border_color equ [edi+24] ;梥⠭¥  ªâ¨¢­®£® ª®¬¯®­¥­â 
ed_text_color equ [edi+28] ;梥â ⥪áâ 
ed_max equ [edi+32] ;ª®«-¢® ᨬ¢®«®¢ ª®â®àë¥ ¬®¦­® ¬ ªá¨¬ «ì­® ¢¢¥áâ¨
ed_text equ [edi+36] ;㪠§ â¥«ì ­  ¡ãä¥à
ed_flags equ [edi+40] ;ä« £¨
ed_size equ [edi+42] ;ª®«-¢® ᨬ¢®«®¢
ed_pos equ [edi+46] ;¯®§¨æ¨ï ªãàá®à 
ed_offset equ [edi+50] ;ᬥ饭¨¥
cl_curs_x equ [edi+54] ;¯à¥¤ë¤ã饥 ª®®à¤¨­ â  ªãàá®à  ¯® å
cl_curs_y equ [edi+58] ;¯à¥¤ë¤ã饥 ª®®à¤¨­ â  ªãàá®à  ¯® ã
ed_shift_pos equ [edi+62] ;¯®«®¦¥­¨¥ ªãàá®à 
ed_shift_pos_old equ [edi+66] ;áâ à®¥ ¯®«®¦¥­¨¥ ªãàá®à 
;==========================================================
;=== ¯à®æ¥¤ãà  ¯à®à¨á®¢ª¨ =================================
;==========================================================
.draw:
pusha
;--- à¨á㥬 à ¬ªã ---
call .draw_border ; ”ã­ªæ¨ï áâ ¡¨«ì­ 
.draw_bg_cursor_text:
;--- ¨§¬¥­ï¥¬ ᬥ饭¨¥, ¥á«¨ ­ ¤® ---
call .check_offset ;¢ëç¨á«¥­¨¥ ¯®§¨æ¨¨ ªãàá®à  áâ ¡¨«ì­ 
;--- à¨á㥬 ¢­ãâ७­îî ®¡« áâì ---
call .draw_bg ;­ à¨á®¢ âì ¯àאַ㣮«ì­¨ª à ¡®ç¥© ®¡« áâ¨
;---- à¨á㥬 ¢ë¤¥«¥­¨¥, ¯® shift ¥á«¨ ¥áâì
call .draw_shift
.draw_cursor_text:
;--- à¨á㥬 ªãàá®à ---
;--- ¬®¦¥â ¥£® ­¥ ­ ¤® à¨á®¢ âì ----
test word ed_flags,ed_focus
je @f
call .draw_cursor
@@:
call .draw_text
;;;;;;;;;;;;;;;;;;;;;;;;;;
;Ž¡é¨© ¢ë室 ¨§ editbox ¤«ï ¢á¥å ä㭪権 ¨ ¯®áâ ®¡à ¡®â稪®¢
;;;;;;;;;;;;;;;;;;;;;;;;;;
.editbox_exit:
edit_ex
;==========================================================
;=== ®¡à ¡®âª  ª« ¢¨ âãàë =================================
;==========================================================
.key:
pusha
test word ed_flags,ed_focus ; ¥á«¨ ­¥ ¢ 䮪ãá¥, ¢ë室¨¬
je .editbox_exit
;<3B>஢¥àª  ­ ¦ â shift ?
call .check_shift
;----------------------------------------------------------
;--- ¯à®¢¥à塞, çâ® ­ ¦ â® --------------------------------
;----------------------------------------------------------
use_key_process backspase,delete,left,right,home,end,insert
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;‡ £«ã誠 ­  ®¡à ¡®âªã ª« ¢¨è ¢¢¥àå ¨ ¢­¨§ â.¥. ¯à¨ ®¡­ à㦥­¨¨ íâ¨å ª®¤®¢ ¯à®¨á室¨â ¢ë室 ¨§ ®¡à ¡®â稪 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
use_key_no_process up,down,esc
;--- ­ ¦ â  ¤àã£ ï ª« ¢¨è  ---
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;<3B>஢¥àª  ãáâ ­®¢«¥­ «¨ ä« £ ¯à¨ ª®â®à®¬ ­ã¦­® ¢ë¢®¤¨âì ⮫쪮 æ¨äàë ¢ ­ã¦­®¬ ¡®ªá¥ ¥á«¨ â ª®©­¥®¡å®¤¨¬®á⨠­¥â ­ã¦­® § ª®¬¥­â¨à®¢ âì ¬ ªà®á
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
use_key_figures_only
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;¯à®¢¥àª  ­  shift ¡ë« «¨ ­ ¦ â
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
are_key_shift_press
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ¯à®¢¥à塞, ­ å®¤¨âáï «¨ ªãàá®à ¢ ª®­æ¥ + ¤ «ì­¥©è ï ®¡à ¡®âª 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
are_key_cur_end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Ž¡à ¡®âª  ª« ¢¨è insert,delete.backspase,home,end,left,right
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
use_work_key
;==========================================================
;=== ®¡à ¡®âª  ¬ëè¨ =======================================
;==========================================================
.mouse:
pusha
;debug
;----------------------------------------------------------
;--- ¯®«ãç ¥¬ á®áâ®ï­¨¥ ª­®¯®ª ¬ëè¨ -----------------------
;----------------------------------------------------------
mcall 37,2
;----------------------------------------------------------
;--- ¯à®¢¥à塞 á®áâ®ï­¨¥ ----------------------------------
;----------------------------------------------------------
test eax,1
jnz .mouse_left_button
and word ed_flags,ed_mouse_on_off
xor ebx,ebx
mov dword [mouse_flag],ebx
jmp .editbox_exit
.mouse_left_button:
;----------------------------------------------------------
;--- ¡«®ª¨à®¢ª  ®â 䮪ãá¨à®¢ª¨ ¢ ¤àã£¨å ¡®ªá å ¯à¨ ¯®¯ ¤ ­¨¨ ­  ­¨å ªãàá®à 
;----------------------------------------------------------
mov eax,dword [mouse_flag]
test eax,eax
jz @f
cmp eax,edi
je @f
jmp ._blur
;----------------------------------------------------------
;--- ¯®«ãç ¥¬ ª®®à¤¨­ âë ¬ëè¨ ®â­®á¨â¥«ì­® 0 â.¥ ¢á¥© ®¡« á⨠íªà ­ 
;----------------------------------------------------------
@@: mcall 37,0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;”ã­ªæ¨ï ®¡à ¡®âª¨ ¬ë誨 ¯®«ã祭¨¥ ª®®à¤¨­ â ¨ ¯à®¢¥àª  ¨å + ¢ë¤¥«¥­¨ï
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
use_work_mause scr_h,scr_w
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Ž¡é¨¥ ä㭪樨 ®¡à ¡®âª¨
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
use_general_func
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;”㭪樨 ¤«ï à ¡®âë á key
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
use_key_func
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;”㭪樨 ¤«ï à ¡®âë á mouse
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
use_mouse_func scr_w
}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;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 ; ¢ëá®â 
macro draw_edit_boxes start,_end,use_f9,procinfo
{
if use_f9 eq
else
mcall 9,procinfo,-1
end if
mov edi,start
mov ecx,((_end-start)/ed_struc_size)
@@:
call edit_box.draw
add edi,ed_struc_size
loop @b
}
macro mouse_edit_boxes start,_end
{
mov edi,start
mov ecx,((_end-start)/ed_struc_size)
@@:
call edit_box.mouse
add edi,ed_struc_size
loop @b
}
macro key_edit_boxes start,end
{
mov edi,start
mov ecx,((end-start)/ed_struc_size)
@@:
call edit_box.key
add edi,ed_struc_size
loop @b
}
ed_struc_size=70
struc edit_box width,left,top,color,shift_color,focus_border_color,\
blur_border_color,text_color,max,text,flags,size,pos
{
.width dd width
.left dd left
.top dd top
.color dd color
.shift_color dd shift_color
.focus_border_color dd focus_border_color
.blur_border_color dd blur_border_color
.text_color dd text_color
.max dd max
.text dd text
.flags dw flags+0
.size dd size+0
.pos dd pos+0
.offset dd 0
.cl_curs_x dd 0
.cl_curs_y dd 0
.shift dd 0
.shift_old dd 0
}
macro edit_boxes_set_sys_color start,end,color_table
{
mov edi,start
mov ecx,((end-start)/ed_struc_size)
mov esi,color_table
@@:
mov eax,[esi+36]
mov ebx,[esi+20]
mov ed_focus_border_color,eax
shr bh,1
shr bl,1
shr ah,1
shr al,1
add ah,bh
add al,bl
ror eax,16
ror ebx,16
shr bl,1
shr al,1
add al,bl
ror eax,16
mov ed_blur_border_color,eax
add edi,ed_struc_size
loop @b
}
macro draw_edit_box ed_ptr,use_f9,procinfo
{
if use_f9 eq
else
mcall 9,procinfo,-1
end if
mov edi,ed_ptr
call edit_box.draw
}
macro mouse_edit_box ed_ptr
{
mov edi,ed_ptr
call edit_box.mouse
}
macro key_edit_box ed_ptr
{
mov edi,ed_ptr
call edit_box.key
}
macro default_box ed_ptr
{
pusha
; xor eax,eax
; mov ed_shift_pos,eax
; mov ed_shift_pos_old,eax
and word ed_flags,ed_shift_cl
; mov ed_offset,eax
popa
}

View File

@ -0,0 +1,60 @@
v 0.01
Версия тестовая, поэтому много недоработок
и выводятся отладочные сообщения
Поддерживается:
* Локальный контакт-лист, пока жестко зашит в код
* передача/прием сообщений plain-text
* Перекодировка CP866<->CP1251
* Прием offline сообщений
* Отправка сообщения пользователю не в контакт-листе
/UIN Сообщение
Недоработки: Много :-)
* Отключено закрытие сокетов - моя VM (Parallels) наглухо виснет, при
попытке закрыть сокет
* Все сообщения от разных юзеров в одном поле вывода
* Нельзя сменить статус
* Нельзя отключится, опять же из-за закрытия сокетов
* Не поддерживается UTF-8 и RTF сообщения
* Из информации о юзере доступен только ник
* 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
за прекрасные инструменты и документацию, без которой я бы
ничего не написал :-)
Все пожелания о дальнейшей судьбе проекта (закрыть, например :-))шлите на lv4evil@ya.ru
;Только за кривой код и ужасный английский ногами не бейте :-)

View File

@ -0,0 +1,2 @@
@fasm ki.asm ki

View File

@ -0,0 +1,926 @@
;
; ­ à¨á®¢ âì ¯àאַ㣮«ì­¨ª
; x1,y1 ---------|
; | |
; | |
; |-------------x2,y2
;
macro rect x1, y1, x2, y2, color
{
pushad
mov edx, color
; ------------
mov eax, 38
mov ebx, x1
shl ebx, 16
add ebx, x2
mov ecx, y1
shl ecx, 16
add ecx, y1
int 40h
; ------------
mov eax, 38
mov ebx, x1
shl ebx, 16
add ebx, x2
mov ecx, y2
shl ecx, 16
add ecx, y2
int 40h
; |
; |
; |
mov eax, 38
mov ebx, x1
shl ebx, 16
add ebx, x1
mov ecx, y1
shl ecx, 16
add ecx, y2
int 40h
; |
; |
; |
mov eax, 38
mov ebx, x2
shl ebx, 16
add ebx, x2
mov ecx, y1
shl ecx, 16
add ecx, y2
int 40h
popad
}
;
; ‚뢮¤ ­  íªà ­ ¡ãä¥à  á® áâப ¬¨
;
scbuff db 512*128 dup 0
; 512 - ¤«¨­  áâப¨
; 128 - ª®«¨ç¥á⢮ áâப
;
ind db 0 ; ’¥ªã騩 ¨­¤¥ªá
;
;
x_s dw 15 ; Š®®à¤¨­ âë «¥¢®£® ¢¥àå­¥£® 㣫  FIXIT
y_s dw 38 ;
; ‚ëá®â  áâப¨
SH = 10
xlen dw 512 ; ¤«¨­  áâப¨
;ylen dw 128 ; ª®«¨ç¥á⢮ áâப
ylen dw 40
;<EFBFBD>®á«¥¤­¨¥ 4 ¡ ©â  ¢ áâப¥ ®¡®§­ ç îâ 梥â
printbuff:
pushad
;
; <EFBFBD> à¨á㥬 ¡¥«ë© ¯àאַ㣮«ì­¨ª
;
mov eax, 13
mov ebx, 15*65536+480
mov ecx, 31*65536+418
mov edx, 0FFFFFFh
int 40h
xor ecx, ecx ; ‘ç¥â稪
;xor eax, eax
xor ebx, ebx
;xor edx, edx
pb_loop:
xor edx, edx
xor eax, eax
mov dl, [ind] ; ˆ­¤¥ªá
mov ax, [ylen]
;mul edx
cmp ecx, eax
ja pr_end
;
;
add edx, ecx ;<EFBFBD>ਡ ¢¨¬ áç¥â稪
xor eax, eax
mov ax, [ylen]
cmp edx, eax ;ˆ­¤¥ªá ¬¥­ìè¥ ª®«¨ç¥á⢠ áâப
jna @f ;<=
sub edx, eax ;…᫨ ¡®«ìè¥, áç¨â ¥¬ á ­ ç « 
dec edx
@@:
;
mov bx, [x_s] ; Š®®à¤¨­ â  X
shl ebx, 16 ;
push ecx
mov eax, SH ; ‚ëç¨á«ï¥¬ ¬¥á⮯®«®¦¥­¨¥ áâப¨
imul eax, ecx ;
;mov ecx, eax
;xor eax, eax
;mov ax , [x_s]
xor ecx, ecx
mov cx, [y_s]
add ecx, eax
add ebx, ecx ; Š®®à¤¨­ â  Y
;
xor eax, eax
mov ax, [xlen] ;¤«¨­  áâப¨
imul edx, eax ;“¬­®¦ ¥¬ áç¥â稪 ­  ¤«¨­ã áâப¨, ¯®«ãç ¥¬ ᬥ饭¨¥ ®â­®á¨â¥«ì­® ­ ç «  ¡ãä¥à 
;mov edx, eax
add edx, scbuff
xor eax, eax
mov ax, [xlen]
sub eax, 4
xor ecx, ecx
mov ecx, dword [edx+eax] ; <EFBFBD>®á«¥¤­¨¥ 4 <EFBFBD> ©â  á 梥⮬
or ecx, 0x80000000 ; ‚뢮¤¨âì ASCIIZ
mov eax, 4
mov esi, -1 ; For Menuet
int 40h
pop ecx
inc ecx
jmp pb_loop
pr_end:
popad
ret
;
; Žâ« ¤®ç­ë¥ á®®¡é¥­¨ï
;
macro write_debug str
{
local ..string, ..label, ..end, ..loop, ..fin
jmp ..label
..string db str, 0
..label:
pushad
xor eax, eax
xor ebx, ebx
xor ecx, ecx
xor edx, edx
mov bl, [ind]
mov ax, [xlen]
imul ebx, eax
add ebx, scbuff
..loop:
mov dl, [..string+ecx]
cmp dl, 0
jz ..end
mov [ebx+ecx], dl
inc ecx
jmp ..loop
..end:
mov [ebx+ecx], dl
xor ebx, ebx
mov bl, [ind]
cmp bx, [ylen]
jz @f
inc bl
jmp ..fin
@@:
xor bl, bl
..fin:
mov [ind], bl
call printbuff
;call draw_window
popad
}
;
; Š­®¯ª 
;
macro draw_button x, y, xlen, ylen, id, str
{
pushad
local ..string, ..label
jmp ..label
..string db str, 0
..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
mov ebx, (x+5)*65536+y+ylen/2-3
xor ecx, ecx
or ecx, 0x80FFFFFF
mov edx, ..string
int 40h
popad
}
;
; Žâ« ¤®ç­ë© ¢ë¢®¤ ¤ ­­ëå
;
macro data_debug str, rg
{
pushad
local ..string, ..end, ..loop, ..strend, ..fin, ..label
jmp ..label
..string db str, 20h, 0, 0, 0, 0, 0, 0, 0, 0, 0
..strend:
..label:
;xor eax, eax
;xor ebx, ebx
xor ecx, ecx
xor edx, edx
mov eax, rg
lea ebx, [..strend-9]
call int2str
xor eax, eax
xor ebx, ebx
mov bl, [ind]
mov ax, [xlen]
imul ebx, eax
add ebx, scbuff
..loop:
mov dl, [..string+ecx]
cmp dl, 0
jz ..end
mov [ebx+ecx], dl
inc ecx
jmp ..loop
..end:
mov [ebx+ecx], dl
xor ebx, ebx
mov bl, [ind]
cmp bx, [ylen]
jz @f
inc bl
jmp ..fin
@@:
xor bl, bl
..fin:
mov [ind], bl
call printbuff
;call draw_window
popad
}
; <--EAX
; -->[ebx]
;
int2str:
pushf
;push ebx
push ecx
push edx
push esi
;xor ebx, ebx
xor ecx, ecx
i_loop:
mov edx, eax
push ecx
shl ecx, 2
mov esi, 28
sub esi, ecx
mov ecx, esi
shr edx, cl
pop ecx
and dl, 0fh ;Žâ¤¥«¨âì ¬« ¤è¨¥ 4 ¡¨â 
cmp dl, 0Ah ;<EFBFBD>㪢 
jnc @f
or dl, 0x30
jmp i_n1
@@:
sub dl, 9
or dl, 0x40
i_n1:
mov [ebx+ecx], dl
inc ecx
cmp ecx, 8
jnz i_loop
pop esi
pop edx
pop ecx
;pop ebx
popf
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
;
; „«ï ¢ë¢®¤  á®®¡é¥­¨©
; [eax] <-- null-terminated string
; ebx <-- color
;
writemsg:
pushad
push ebx
push eax
xor eax, eax
xor ebx, ebx
mov bl, [ind]
mov ax, [xlen]
imul ebx, eax
add ebx, scbuff
pop eax
mov edx, eax
call strlen
mov ecx, eax
mov eax, edx
call strcpy
mov [ebx+ecx], byte 0x00
xor eax, eax
mov ax, [xlen]
sub eax, 4
pop ecx
mov dword [ebx+eax], ecx ; <EFBFBD>®á«¥¤­¨¥ 4 <EFBFBD> ©â  á 梥⮬
xor ebx, ebx
mov bl, [ind]
cmp bx, [ylen]
jz @f
inc bl
jmp ..fin
@@:
xor bl, bl
..fin:
mov [ind], bl
call printbuff
;call draw_window
popad
ret
;
;
; <--EAX <EFBFBD>¥à¥¢®¤ ¨§ 16 ¢ 10 ä®à¬ã
; -->[ebx]
; --> eax ¤«¨­ 
int2strd:
pushf
;push ebx
push ecx
push edx
push esi
;push edi
;xor ebx, ebx
xor ecx, ecx
mov esi, 10
id_loop:
xor edx, edx
div esi
and dl, 0fh ;Žâ¤¥«¨âì ¬« ¤è¨¥ 4 ¡¨â 
or dl, 0x30
mov [ebx+ecx], dl
cmp eax, 10
inc ecx
jnc id_loop
and al, 0fh ;Žâ¤¥«¨âì ¬« ¤è¨¥ 4 ¡¨â 
or al, 0x30
mov [ebx+ecx], al
;mov [ebx+ecx+1], byte 0
inc ecx
mov eax, ecx
; ¯¥à¥¢¥à­ãâì ¯®«ã祭­ãî áâபã
;
;xor edx, edx
;mov esi, 2
;div esi
shr eax, 1
xor edx, edx
id_loop2:
cmp eax, 0
jz id_end
mov dl, [ebx+eax-1]
lea esi, [ebx+ecx]
sub esi, eax
mov dh, [esi]
mov [ebx+eax-1], dh
mov [esi], dl
dec eax
jmp id_loop2
id_end:
mov eax, ecx
;pop edi
pop esi
pop edx
pop ecx
;pop ebx
popf
ret
;
;
;
x_bb dw 550 ; Š®®à¤¨­ âë «¥¢®£® ¢¥àå­¥£® 㣫 
y_bb dw 30 ;
;
bb_width dw 100 ; ˜¨à¨­  ª­®¯®ª
bb_height dw 15 ; ¢ëá®â  ª­®¯®ª
;
bb_dist dw 10 ; <EFBFBD> ááâ®ï­¨¥ ¬¥¦¤ã ª­®¯ª ¬¨
; ˆ¤¥­â¨ä¨ª â®àë ª­®¯®ª ­ ç¨­ ï á 100
;
; „«ï Š‹
;
;
buttonbox:
pushad
pushf
xor ecx, ecx
xor eax, eax
xor ebx, ebx
bb_loop:
; <EFBFBD>஢¥à塞 ¯¥à¢ë© ¡ ©â 㨭 , ¥á«¨ 0, ª­®¯ªã à¨á®¢ âì ­¥ ­ ¤®
mov ebx, NAME_LEN
imul ebx, ecx
mov al, [names+ebx]
cmp al, 0
jz bb_end
; à¨á㥬 ª­®¯ªã
; –¢¥â § ¢¨á¨â ®â áâ âãá  UIN
mov ebx, 4
imul ebx, ecx
mov eax, [stats+ebx] ; áâ à襬 á«®¢¥ ¤®¯®«­¨â¥«ì­ë© áâ âãá
cmp ax, -1
jz bb_offline
cmp ax, 1
jz bb_away
cmp ax, 2
jz bb_dnd
cmp ax, 4
jz bb_na
cmp ax, 10h
jz bb_bisy
cmp ax, 20h
jz bb_free4chat
cmp ax, 100h
jz bb_invis
; Online
mov esi, 0x4466AA
jmp bb_dr
bb_offline:
mov esi, 0xBEBEBE
jmp bb_dr
bb_away:
mov esi, 0x14dcc3
jmp bb_dr
bb_dnd:
mov esi, 0x14dcc3
jmp bb_dr
bb_na:
mov esi, 0x14dcc3
jmp bb_dr
bb_bisy:
mov esi, 0x14dcc3
jmp bb_dr
bb_free4chat:
mov esi, 0x2233FF
jmp bb_dr
bb_invis:
mov esi, 0xD0D0D0
bb_dr:
mov bx, [x_bb]
shl ebx, 16
mov bx, [bb_width]
;push ecx
mov edx, ecx
lea edx, [edx+100] ; ID
mov edi, ecx
mov cx, [y_bb]
movzx eax, [bb_height]
add ax, [bb_dist]
imul eax, edi
add ecx, eax
shl ecx, 16
mov cx, [bb_height]
mov eax, 8
int 40h
;
; <EFBFBD> ¤¯¨áì ­  ª­®¯ª¥
;
add ebx, 50000h ; ‘¬¥é¥­¨¥ ®â «¥¢®£® ªà ï
shr ecx, 16
movzx eax, [bb_height]
shr eax, 1 ; /2
sub eax, 3 ; ᬥ饭¨¥ ¢¢¥àå ®â 業âà 
add ecx, eax ; + ¯®«®¢¨­  à §¬¥à  ª­®¯ª¨
mov bx, cx
mov ecx, 0x80FFFFFF ; –¢¥â
mov edx, names
mov esi, NAME_LEN
imul esi, edi
add edx, esi
;mov esi, -1
mov eax, 4
int 40h
mov ecx, edi
inc ecx
cmp ecx, UINS
ja bb_end
jmp bb_loop
bb_end:
popf
popad
ret
;
; Œ áᨢ á 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
;
;
U1 db '123456789',0
U2 db '123456789',0
U3 db '123456789',0
;
; ‡ £à㧪  ¬ áᨢ  UIN
;
loaduin:
pushad
mov eax, U1
mov ebx, uins
mov ecx, 9
call strcpy
mov ebx, names
call strcpy
mov eax, U2
mov ebx, uins+UIN_LEN
mov ecx, 9
call strcpy
mov ebx, names+NAME_LEN
call strcpy
mov eax, U3
mov ebx, uins+UIN_LEN*2
mov ecx, 9
call strcpy
mov ebx, names+NAME_LEN*2
call strcpy
popad
ret
;
; ”ã­ªæ¨ï ¤«ï § £à㧪¨ Š‹ ­¨ª ¬¨ ¨ áâ âãá ¬¨
; eax <-- <EFBFBD>®¬¥à 㨭  ¯® ¯®à浪㠢 ¬ áᨢ¥ uins, ­ ç¨­ ï á 0
; [ebx] <-- 㪠§ â¥«ì ­  null-terminated áâபã á ­®¢ë¬ ¨¬¥­¥¬
; ecx <-- <EFBFBD>®¢ë© áâ âãá
;
loadbb:
pushad
pushf
;
; <EFBFBD>஢¥à塞 ­®¬¥à
;
cmp eax, UINS
jnc loadbb_end ;>=
;
; “¤ «ï¥¬ ª­®¯ªã
;
push ecx
push ebx
push eax
lea edx, [eax+100]
or edx, 0x80000000
mov eax, 8
int 40h
;
; ‘®å࠭塞 ­®¢ë© áâ âãá ¢ ¬ áᨢ¥ áâ âãᮢ
;
pop eax
mov edx, 4 ; DWORD
imul edx, eax
mov [stats+edx], ecx
;
; ‘®å࠭塞 ­®¢®¥ ¨¬ï
;
mov edi, eax ; edi <-- Uin number
pop eax ; <-- offset of string
mov ebx, eax
call strlen
mov ecx, eax ; Len
mov eax, ebx ;Source
mov edx, NAME_LEN
imul edx, edi
lea ebx, [names+edx] ; Dest
call strcpy
mov [names+edx+ecx], byte 0
xchg edi, eax ; eax - áç¥â¨ª, edi - 㪠§ â¥«ì ­  áâபã
pop ecx
push edi
; à¨á㥬 ª­®¯ªã
; –¢¥â § ¢¨á¨â ®â áâ âãá  UIN
cmp cx, -1
jz l_offline
cmp cx, 1
jz l_away
cmp cx, 2
jz l_dnd
cmp cx, 4
jz l_na
cmp cx, 10h
jz l_bisy
cmp cx, 20h
jz l_free4chat
cmp cx, 100h
jz l_invis
; Online
mov esi, 0x4466AA
jmp l_dr
l_offline:
mov esi, 0xBEBEBE
jmp l_dr
l_away:
mov esi, 0x14dcc3
jmp l_dr
l_dnd:
mov esi, 0x14dcc3
jmp l_dr
l_na:
mov esi, 0x14dcc3
jmp l_dr
l_bisy:
mov esi, 0x14dcc3
jmp l_dr
l_free4chat:
mov esi, 0x2233FF
jmp l_dr
l_invis:
mov esi, 0xD0D0D0
l_dr:
mov bx, [x_bb]
shl ebx, 16
mov bx, [bb_width]
;push ecx
mov edx, eax
lea edx, [edx+100] ; ID
mov edi, eax
mov cx, [y_bb]
movzx eax, [bb_height]
add ax, [bb_dist]
imul eax, edi
add ecx, eax
shl ecx, 16
mov cx, [bb_height]
mov eax, 8
int 40h
;
; <EFBFBD> ¤¯¨áì ­  ª­®¯ª¥
;
add ebx, 50000h ; ‘¬¥é¥­¨¥ ®â «¥¢®£® ªà ï
shr ecx, 16
movzx eax, [bb_height]
shr eax, 1 ; /2
sub eax, 3 ; ᬥ饭¨¥ ¢¢¥àå ®â 業âà 
add ecx, eax ; + ¯®«®¢¨­  à §¬¥à  ª­®¯ª¨
mov bx, cx
mov ecx, 0x80FFFFFF ; –¢¥â
pop edx
mov esi, -1
mov eax, 4
int 40h
loadbb_end:
popf
popad
ret

View File

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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -0,0 +1,502 @@
@^ fix macro comment {
^@ fix }
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,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 \} }