Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 485 → Rev 484

/programs/network/airc/trunk/eth.inc
File deleted
/programs/network/airc/trunk/fdo.inc
File deleted
/programs/network/airc/trunk/airc.asm
9,12 → 9,8
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
version equ '0.5'
version equ '0.4'
 
 
;__DEBUG__ equ 1
;__DEBUG_LEVEL__ equ 1
 
use32
 
org 0x0
27,10 → 23,8
dd 0x100000
dd 0,0
 
include "..\..\..\macros.inc"
;include "fdo.inc"
include "eth.inc"
;include "lang.inc"
include "lang.inc"
;include "macros.inc"
 
irc_server_ip db 83,149,74,246 ;server: kolibrios.org
 
45,7 → 39,7
 
mov eax,40
mov ebx,10000111b
mcall
int 0x40
 
mov edi,I_END
mov ecx,60*120
67,10 → 61,10
 
mov eax,5
mov ebx,1
mcall
int 0x40
 
mov eax,11 ; wait here for event
mcall
int 0x40
 
call print_status
 
111,12 → 105,12
button: ; button
 
mov eax,17 ; get id
mcall
int 0x40
 
cmp ah,1 ; close program
jne noclose
mov eax,-1
mcall
int 0x40
noclose:
 
call socket_commands
131,7 → 125,7
mov eax,53
mov ebx,6
mov ecx,[socket]
mcall
int 0x40
 
mov [status],eax
 
146,7 → 140,7
mov ebx,450*65536+30
mov ecx,231*65536+10
mov edx,0xffffff
mcall
int 0x40
 
pop ecx
mov eax,47
153,7 → 147,7
mov ebx,2*65536
mov edx,450*65536+231
mov esi,0x000000
mcall
int 0x40
 
nopr:
 
170,7 → 164,7
cmp ah,22 ; open socket
jnz tst3
mov eax,3
mcall
int 0x40
mov ecx,eax
mov eax,53
mov ebx,5
177,7 → 171,7
mov edx,6667
mov esi,dword [irc_server_ip]
mov edi,1
mcall
int 0x40
mov [socket], eax
ret
tst3:
191,7 → 185,7
mov ecx,[socket]
mov edx,string0l-string0
mov esi,string0
mcall
int 0x40
 
mov eax,53 ;
mov ebx,7
198,7 → 192,7
mov ecx,[socket]
mov edx,[user_real_name]
mov esi,user_real_name+4
mcall
int 0x40
 
mov eax,53 ;
mov ebx,7
205,12 → 199,12
mov ecx,[socket]
mov edx,2
mov esi,line_feed
mcall
int 0x40
 
 
mov eax,5
mov ebx,10
mcall
int 0x40
 
mov eax,53 ; nick
mov ebx,7
217,7 → 211,7
mov ecx,[socket]
mov edx,string1l-string1
mov esi,string1
mcall
int 0x40
 
mov eax,53 ;
mov ebx,7
224,7 → 218,7
mov ecx,[socket]
mov edx,[user_nick]
mov esi,user_nick+4
mcall
int 0x40
 
mov eax,53 ;
mov ebx,7
231,7 → 225,7
mov ecx,[socket]
mov edx,2
mov esi,line_feed
mcall
int 0x40
 
 
ret
246,7 → 240,7
mov eax,53
mov ebx,8
mov ecx,[socket]
mcall
int 0x40
ret
no_24:
 
257,7 → 251,7
main_window_key:
 
mov eax,2
mcall
int 0x40
 
shr eax,8
 
304,7 → 298,7
mov ebx,415*65536+6*13
mov ecx,27*65536+12*10
mov edx,0xffffff
mcall
int 0x40
 
mov eax,4
mov ebx,415*65536+27
313,7 → 307,7
newch:
movzx esi,byte [edx+31]
and esi,0x1f
mcall
int 0x40
add edx,32
add ebx,12
cmp edx,channel_list+32*10
380,7 → 374,7
mov ebx,415*65536+6*13
mov ecx,27*65536+12*10
mov edx,0xffffff
mcall
int 0x40
popa
 
mov eax,4
404,7 → 398,7
mov ecx,[index_list_2]
no_op:
 
mcall
int 0x40
 
inc ebp
cmp ebp,10
515,7 → 509,7
mov eax, 53 ; write channel
mov ebx, 7
mov ecx, [socket]
mcall
int 0x40
 
mov esi,send_string
mov edx,[xpos]
526,7 → 520,7
mov eax, 53 ; write message
mov ebx, 7
mov ecx, [socket]
mcall
int 0x40
 
jmp send_done
 
608,41 → 602,33
cmp [send_string+1],dword 'aser'
jne no_set_server
 
; pusha
; mov edi,irc_server_ip
; mov esi,send_string+7
; mov eax,0
; mov edx,[xpos]
; add edx,send_string-1
; newsip:
; cmp [esi],byte '.'
; je sipn
; cmp esi,edx
; jg sipn
; movzx ebx,byte [esi]
; inc esi
; imul eax,10
; sub ebx,48
; add eax,ebx
; jmp newsip
; sipn:
; mov [edi],al
; xor eax,eax
; inc esi
; cmp esi,send_string+30
; jg sipnn
; inc edi
; cmp edi,irc_server_ip+3
; jbe newsip
; sipnn:
; popa
 
pusha
mov eax,send_string
add eax,[xpos]
mov dword[eax],0
resolve send_string+7,dword[irc_server_ip]
;DEBUGF 1,'%u.%u.%u.%u\n',1[irc_server_ip],1[irc_server_ip+1],1[irc_server_ip+2],1[irc_server_ip+3]
mov edi,irc_server_ip
mov esi,send_string+7
mov eax,0
mov edx,[xpos]
add edx,send_string-1
newsip:
cmp [esi],byte '.'
je sipn
cmp esi,edx
jg sipn
movzx ebx,byte [esi]
inc esi
imul eax,10
sub ebx,48
add eax,ebx
jmp newsip
sipn:
mov [edi],al
xor eax,eax
inc esi
cmp esi,send_string+30
jg sipnn
inc edi
cmp edi,irc_server_ip+3
jbe newsip
sipnn:
popa
 
mov ecx,[xpos]
729,7 → 715,7
mov eax, 53 ; write server command
mov ebx, 7
mov ecx, [socket]
mcall
int 0x40
 
send_done:
 
740,12 → 726,12
jne no_quit_server
mov eax,5
mov ebx,200
mcall
int 0x40
 
mov eax, 53 ; close socket
mov ebx, 8
mov ecx, [socket]
mcall
int 0x40
 
mov ecx,[max_windows]
mov edi,I_END
856,11 → 842,11
mov ebx,1
mov ecx,channel_thread
mov edx,[thread_stack]
mcall
int 0x40
 
mov eax,5
mov ebx,10
mcall
int 0x40
 
add [thread_stack],0x4000
add [thread_screen],120*80
878,7 → 864,7
mov ebx,8*65536+6*80
mov ecx,151*65536+13
mov edx,0xffffff
mcall
int 0x40
 
mov eax,4
mov ebx,8*65536+154
885,7 → 871,7
mov ecx,0x000000
mov edx,send_string
mov esi,[xpos]
mcall
int 0x40
 
popa
 
900,7 → 886,7
mov eax,9
mov ebx,0xe0000
mov ecx,-1
mcall
int 0x40
 
mov edx,[blink]
and edx,1
921,7 → 907,7
mov bx,cx
mov ecx,151*65536+163
mov eax,38
mcall
int 0x40
 
popa
 
933,7 → 919,7
mov ebx,8*65536+6*60
mov ecx,151*65536+13
mov edx,0xffffff
mcall
int 0x40
 
popa
 
1086,7 → 1072,7
mov edx,command
mov esi,[cmd]
mov [command+esi-1],word '**'
; mcall
; int 0x40
 
mov eax,53
mov ebx,7
1095,7 → 1081,7
sub edx,2
and edx,255
mov esi,command
mcall
int 0x40
 
mov eax,53
mov ebx,7
1102,7 → 1088,7
mov ecx,[socket]
mov edx,2
mov esi,linef
mcall
int 0x40
 
popa
ret
1669,7 → 1655,6
db $90,$91,$92,$93,$94,$95,$96,$97 , $98,$99,$9A,$9B,$9C,$9D,$9E,$9F ; D
db $A0,$A1,$A2,$A3,$A4,$A5,$A6,$A7 , $A8,$A9,$AA,$AB,$AC,$AD,$AE,$AF ; E
db $E0,$E1,$E2,$E3,$E4,$E5,$E6,$E7 , $E8,$E9,$EA,$EB,$EC,$ED,$EE,$EF ; F
; 0 1 2 3 4 5 6 7 8 9 A B C D E F
 
cp866_table:
db $C0,$C1,$C2,$C3,$C4,$C5,$C6,$C7 , $C8,$C9,$CA,$CB,$CC,$CD,$CE,$CF ; 8
1680,8 → 1665,8
db '?','?','?','?','?','?','?','?' , '?','?','?','?','?','?','?','?' ; D
db $F0,$F1,$F2,$F3,$F4,$F5,$F6,$F7 , $F8,$F9,$FA,$FB,$FC,$FD,$FE,$FF ; E
db $A8,$B8,'?','?','?','?','?','?' , '?','?','?','?','?','?','?','?' ; F
; 0 1 2 3 4 5 6 7 8 9 A B C D E F
 
 
print_character:
 
pusha
1805,7 → 1790,7
mov eax, 53
mov ebx, 2
mov ecx, [socket]
mcall
int 0x40
 
mov ecx,-1
 
1815,7 → 1800,7
mov eax, 53
mov ebx, 3
mov ecx, [socket]
mcall
int 0x40
 
cmp bl,0x80
jb @f
1837,55 → 1822,69
 
mov eax,12
mov ebx,1
mcall
int 0x40
 
mov [old_status],300
 
xor eax,eax ; draw window
mov eax,0 ; draw window
mov ebx,5*65536+499
mov ecx,5*65536+345
mov edx,[wcolor]
add edx,0x13ffffff
mov edi,title
mcall
add edx,0x03ffffff
mov esi,0x80555599
mov edi,0x00ffffff
int 0x40
 
mov eax,4 ; label
mov ebx,9*65536+8
mov ecx,0x10ffffff
mov edx,labelt
mov esi,labellen-labelt
int 0x40
 
mov eax,8 ; button: open socket
mov ebx,43*65536+22
mov ecx,229*65536+10
mov edx,22
mov esi,[main_button]
mcall
int 0x40
 
;mov eax,8 ; button: send userinfo
mov eax,8 ; button: send userinfo
mov ebx,180*65536+22
mov ecx,229*65536+10
mov edx,23
mcall
int 0x40
 
;mov eax,8 ; button: close socket
mov eax,8 ; button: close socket
mov ebx,317*65536+22
mov ecx,229*65536+10
mov edx,24
mcall
int 0x40
 
mov eax,38 ; line
mov ebx,5*65536+494
mov ecx,148*65536+148
mov edx,[main_line]
mcall
int 0x40
add ecx,1*65536+1
; mov edx,0x5555cc
; int 0x40
 
mov eax,38 ; line
mov ebx,5*65536+494
mov ecx,166*65536+166
mcall
int 0x40
add ecx,1*65536+1
; mov edx,0x5555cc
; int 0x40
 
mov eax,38 ; line
mov ebx,410*65536+410
mov ecx,22*65536+148
mcall
int 0x40
add ebx,1*65536+1
; mov edx,0x5555cc
; int 0x40
 
mov ebx,25*65536+183 ; info text
mov ecx,0x000000
1893,7 → 1892,7
mov esi,70
newline:
mov eax,4
mcall
int 0x40
add ebx,12
add edx,70
cmp [edx],byte 'x'
1904,7 → 1903,7
 
mov eax,12
mov ebx,2
mcall
int 0x40
 
popa
 
1917,8 → 1916,8
text:
 
db ' Real name : KolibriOS User - change with eg /areal Jill User '
db ' Nick : KolibriOS User - change with eg /anick Jill '
db ' Server : kolibrios.org - change with eg /aserv irc.by '
db ' Nick : kolibri_user - change with eg /anick Jill '
db ' Server : 83.149.74.246 - change with eg /aserv 192.168.1.24 '
db ' '
db ' 1) Open socket 2) Send userinfo Close socket '
db ' '
1975,7 → 1974,7
mov dword [channel_list+edi],dword ' '
mov byte [channel_list+edi+31],byte 1
mov eax,-1
mcall
int 0x40
no_channel_leave:
 
call check_mouse
1982,7 → 1981,7
 
mov eax,23
mov ebx,1
mcall
int 0x40
 
cmp eax,1
jne no_draw_window
1997,7 → 1996,7
cmp eax,3
jne no_end
mov eax,17
mcall
int 0x40
mov eax,ebp
imul eax,120*80
add eax,I_END
2009,7 → 2008,7
mov [eax],dword ' '
mov [eax+31],byte 1
mov eax,-1
mcall
int 0x40
not_close:
mov [text_start],eax
mov eax,nocl
2048,7 → 2047,7
 
mov eax,37
mov ebx,1
mcall
int 0x40
 
mov ebx,eax
shr eax,16
2074,7 → 2073,7
call print_user_list
mov eax,5
mov ebx,8
mcall
int 0x40
jmp no_mouse
no_plus:
 
2089,7 → 2088,7
call print_user_list
mov eax,5
mov ebx,8
mcall
int 0x40
 
no_minus:
 
2105,7 → 2104,7
thread_key:
 
mov eax,2
mcall
int 0x40
 
shr eax,8
 
2140,7 → 2139,7
wait_for_sending:
mov eax,5
mov ebx,1
mcall
int 0x40
cmp [send_to_server],1
je wait_for_sending
call draw_channel_text
2173,7 → 2172,7
mov bx,word [rxs]
imul bx,6
mov edx,0xffffff
mcall
int 0x40
popa
push ecx
mov eax,4
2192,7 → 2191,7
jne no_blue
mov ecx,0x0000ff
no_blue:
mcall
int 0x40
add edx,[rxs]
add ebx,10
pop ecx
2211,7 → 2210,7
 
mov eax,12
mov ebx,1
mcall
int 0x40
 
mov ebx,ebp ; draw window
shl ebx,16+4
2232,7 → 2231,7
mov esi,0x80555599
mov edi,0x00ffffff
 
mcall
int 0x40
 
mov eax,ebp ; label
add eax,48
2253,30 → 2252,30
mov ebx,9*65536+8
mov ecx,0x00ffffff
mov edx,labelc
mcall
int 0x40
 
mov eax,38 ; line
mov ebx,5*65536+494
mov ecx,148*65536+148
mov edx,[channel_line_sun]
mcall
int 0x40
add ecx,1*65536+1
mov edx,[channel_line_shadow]
mcall
int 0x40
 
 
;mov eax,38 ; line
mov eax,38 ; line
mov ebx,410*65536+410
mov ecx,22*65536+148
mov edx,[channel_line_sun]
mcall
int 0x40
add ebx,1*65536+1
mov edx,[channel_line_shadow]
mcall
int 0x40
 
mov eax,12
mov ebx,2
mcall
int 0x40
 
popa
 
2283,6 → 2282,7
ret
 
 
 
; DATA AREA
 
socket dd 0x0
2376,13 → 2376,9
wcolor dd 0x000000
 
labelc db 'AIRC - WINDOW X: #xxx '
title db 'IRC client ',version,0
labelt db 'IRC client ',version
labellen:
 
;include_debug_strings ; ALWAYS present in data section
 
dnsMsg: rb 512 ; buffer used by DNS client
 
 
;;
;; Channel data at I_END
;;
/programs/network/airc/trunk/macros.inc
0,0 → 1,266
; 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:
}
DATA fix data
 
macro udata
{
if used __params & ~defined __params
__params:
db 0
__end:
rb 255
else
__end:
end if
__udata:
}
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
}
 
 
; strings
macro sz name,[data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if used name
db data
end if
common
if used name
.size = $-name
end if
}
 
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
common
if used name
label name
end if
forward
if (used name)&(lang eq lng)
db data
end if
common
if used name
.size = $-name
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
}
 
macro mcall a,b,c,d,e,f { ; mike.dld
__mov eax,a
__mov ebx,b
__mov ecx,c
__mov edx,d
__mov esi,e
__mov edi,f
int 0x40
}
 
 
 
 
 
 
; 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)
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 struct name
{
virtual at 0
name name
sizeof.#name = $ - name
end virtual
}
 
; structures used in MeOS
struc process_information
{
.cpu_usage dd ? ; +0
.window_stack_position dw ? ; +4
.window_stack_value dw ? ; +6
.not_used1 dw ? ; +8
.process_name rb 12 ; +10
.memory_start dd ? ; +22
.used_memory dd ? ; +26
.PID dd ? ; +30
.x_start dd ? ; +34
.y_start dd ? ; +38
.x_size dd ? ; +42
.y_size dd ? ; +46
.slot_state dw ? ; +50
rb (1024-52)
}
struct process_information
 
struc 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 ?
}
struct system_colors
 
 
; 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
Property changes:
Added: svn:eol-style
+native
\ No newline at end of property