Code: Select all
--- D:/kolibrios/XMPP2/1.ASM di mei 5 20:40:10 2015
+++ D:/kolibrios/XMPP/1.ASM di aug 25 19:08:16 2015
@@ -6,2 +6,13 @@ dd 1, START, I_END, mem, mem, 0, 0
-; Current directory address string pointer
-dd cur_dir_path
+
+
+; Socket buffer size
+SNDBUFFER = 4096
+RCVBUFFER = 4096
+
+; Network consts
+STATUS_DISCONNECTED = 0
+STATUS_RESOLVING = 1
+STATUS_CONNECTING = 2
+STATUS_CONNECTED = 3
+
+
@@ -13,2 +23,0 @@ include 'box_lib.mac'
-include 'load_lib.mac'
- @use_library ;use load lib macros
@@ -31,12 +39,0 @@ include 'debug.asm'
-; Socket buffer size
-SNDBUFFER equ 4096
-RCVBUFFER equ 4096
-
-; Network consts
-STATUS_DISCONNECTED = 0
-STATUS_RESOLVING = 1
-STATUS_CONNECTING = 2
-STATUS_CONNECTED = 3
-
-
-
@@ -45 +42 @@ include 'debug.asm'
-; CODE BLOCK
+; CODE BLOCK
@@ -49,0 +47,4 @@ START:
+ ; Initialize heap
+ mcall 68, 11
+
+ ; Load libraries
@@ -51,5 +52,2 @@ START:
- ; universal load library/librarys
- sys_load_library library_name, cur_dir_path, library_path, system_path, err_message_found_lib, head_f_l, edit_box_import, err_message_import, head_f_i
- ;if return code =-1 then exit, else nornary work
- cmp eax,-1
- jz close_progr
+ test eax, eax
+ jnz close_progr
@@ -57 +55,3 @@ START:
- mcall 40,0x27
+ mcall 40, EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE
+
+login_win_redraw:
@@ -72,12 +72,6 @@ wait_login:
- ; Check login box
- push dword login_box
- call [edit_box_mouse]
- ; Check password box
- push dword pass_box
- call [edit_box_mouse]
- ; Check server box
- push dword serv_box
- call [edit_box_mouse]
- ; Check DEBUG BOX
- push dword dbg_box
- call [edit_box_mouse]
+
+ invoke edit_box_mouse, login_box
+ invoke edit_box_mouse, pass_box
+ invoke edit_box_mouse, serv_box
+ invoke edit_box_mouse, dbg_box
+
@@ -85 +79,2 @@ wait_login:
- call network_event
+ call network_event ; ???
+
@@ -119,5 +113,0 @@ login_btn_action:
-; Redraw action
-login_win_redraw:
- call login_win_draw
- jmp wait_login
-
@@ -126 +116 @@ login_key:
- ; Recieve pressed key into eax
+ ; Receive pressed key into eax
@@ -129,11 +119,4 @@ login_key:
- push dword login_box
- call [edit_box_key]
- ; Add value into passbox if it was editbox key
- push dword pass_box
- call [edit_box_key]
- ; Add value into servbox if it was editbox key
- push dword serv_box
- call [edit_box_key]
- ; DEBUG
- push dword dbg_box
- call [edit_box_key]
+ invoke edit_box_key, login_box
+ invoke edit_box_key, pass_box
+ invoke edit_box_key, serv_box
+ invoke edit_box_key, dbg_box
@@ -145 +128 @@ login_submit:
- construct_stream x_stream,login_text,serv_text
+ construct_stream x_stream, login_text, serv_text
@@ -147,2 +130,3 @@ login_submit:
- stdcall strcpy,xc_xml_start,snd_buffer
- createXmlOpen xc_stream,xc_stream,edi
+ stdcall strcpy, xc_xml_start, snd_buffer
+ createXmlOpen xc_stream, xc_stream, edi
+
@@ -151,2 +135,2 @@ dns_res:
- stdcall resolve_dns,x_stream.to
- test eax,eax ; Test for error
+ stdcall resolve_dns, x_stream.to
+ test eax, eax ; Test for error
@@ -156 +140 @@ dns_res:
- stdcall convert_IP_dec,ebx ; If no error - get decimal IP
+ stdcall convert_IP_dec, ebx ; If no error - get decimal IP
@@ -159 +143 @@ dns_res:
- call open_socket
+ call open_socket
@@ -161 +145 @@ send_login:
- stdcall strlen,snd_buffer
+ stdcall strlen, snd_buffer
@@ -189 +173 @@ network_event:
- call socket_recieve
+ call socket_receive
@@ -193 +177 @@ network_event:
-socket_recieve:
+socket_receive:
@@ -196,7 +180,7 @@ network_event:
-; push 0
-; push xc_starttls_ns
-; push xc_ns
-; createXmlOpen xc_starttls,'',snd_buffer
-; createXmlClose xc_starttls,'',eax
-; stdcall strlen,snd_buffer
-; mov [msg_len],ecx
+; push 0
+; push xc_starttls_ns
+; push xc_ns
+; createXmlOpen xc_starttls,'',snd_buffer
+; createXmlClose xc_starttls,'',eax
+; stdcall strlen,snd_buffer
+; mov [msg_len],ecx
@@ -204 +188 @@ network_event:
-; mcall send,[socketnum],snd_buffer,[msg_len],0
+; mcall send,[socketnum],snd_buffer,[msg_len],0
@@ -209,6 +193,6 @@ network_event:
-; construct_stream x_stream,login_text,serv_text
-; pushStreamStruc x_stream
-; stdcall strcpy,xc_xml_start,snd_buffer
-; createXmlOpen xc_stream,xc_stream,edi
-; stdcall strlen,snd_buffer
-; mov [msg_len],ecx
+; construct_stream x_stream,login_text,serv_text
+; pushStreamStruc x_stream
+; stdcall strcpy,xc_xml_start,snd_buffer
+; createXmlOpen xc_stream,xc_stream,edi
+; stdcall strlen,snd_buffer
+; mov [msg_len],ecx
@@ -216 +200 @@ network_event:
-; mcall send,[socketnum],snd_buffer,[msg_len],0
+; mcall send,[socketnum],snd_buffer,[msg_len],0
@@ -250 +234 @@ close_progr:
-; DATA BLOCK
+; DATA BLOCK
@@ -253 +236,0 @@ close_progr:
-x_stream xmpp_stream
@@ -255,3 +238 @@ close_progr:
-; Path where additional box_lib library is stored
-system_path db '/rd/1/lib/box_lib.obj', 0
-library_name db 'box_lib.obj'
+; Initialised data
@@ -259,39 +239,0 @@ close_progr:
-; Sys colours table
-sys_colours:
- w_frames dd ?
- w_grab dd ?
- w_grab_button dd ?
- w_grab_button_text dd ?
- w_grab_text dd ?
- w_work dd ?
- w_work_button dd ?
- w_work_button_text dd ?
- w_work_text dd ?
- w_work_graph dd ?
-
-; Function import pointer
-edit_box_import:
- edit_box_draw dd aEdit_box_draw
- edit_box_key dd aEdit_box_key
- edit_box_mouse dd aEdit_box_mouse
- version_ed dd aVersion_ed
- dd 0
- dd 0
- aEdit_box_draw db 'edit_box',0
- aEdit_box_key db 'edit_box_key',0
- aEdit_box_mouse db 'edit_box_mouse',0
- aVersion_ed db 'version_ed',0
-
-; Current dir path string buffer
-cur_dir_path rb 4096
-; Library dir path string buffer
-library_path rb 4096
-
-; Common error messages if library can't be imported or loaded
-err_message_found_lib db 'Sorry I cannot load library box_lib.obj',0
-head_f_i:
-head_f_l db 'System error',0
-err_message_import db 'Error on load import library box_lib.obj',0
-
-
-
@@ -302,5 +243,0 @@ test_auth db '\0test\0test',0
-
-
-;<<<<<<<<<<<<<<<<<<<<<<<<
-; NETWORK
-;<<<<<<<<<<<<<<<<<<<<<<<<
@@ -313,3 +250,2 @@ sockaddr1:
-ip_ptr dd ?
-socketnum dd ?
-status dd STATUS_DISCONNECTED
+status dd STATUS_DISCONNECTED
+msg_len dd 0
@@ -317 +252,0 @@ sockaddr1:
-
@@ -321 +256,3 @@ align 4
-library network, 'network.obj'
+library network, 'network.obj',\
+ box_lib, 'box_lib.obj'
+
@@ -325 +262 @@ import network, \
- inet_ntoa, 'inet_ntoa'
+ inet_ntoa, 'inet_ntoa'
@@ -326,0 +264,4 @@ import network, \
+import box_lib, \
+ edit_box_draw, 'edit_box',\
+ edit_box_mouse, 'edit_box_mouse',\
+ edit_box_key, 'edit_box_key'
@@ -327,0 +269 @@ import network, \
+
@@ -330,2 +272,12 @@ I_END:
-; Recieve buffer
-msg_len dd 0
+
+; Uninitialised data:
+
+ip_ptr dd ?
+socketnum dd ?
+
+x_stream xmpp_stream
+
+; Sys colours table
+sys_colours system_colors
+
+; Receive buffer