kolibrios-gitea/programs/network/netsendc/trunk/netsendc.asm

181 lines
4.5 KiB
NASM
Raw Normal View History

;
; NetSend(Client)
;
; <20><><EFBFBD><EFBFBD><EFBFBD>: Hex
; <20><><EFBFBD><EFBFBD>: www.mestack.narod.ru
;
; <20><><EFBFBD><EFBFBD><E1A0AD>:
; <20>ணࠬ<E0AEA3><E0A0AC> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><><EFBFBD><20> <20><><EFBFBD><EFBFBD>.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>.
;
; Compile with FASM for Menuet
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> FASM'<27><> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>
;
use32
org 0x0
db 'MENUET01' ; 8 byte id
dd 1 ; header version
dd START ; program start
dd I_END ; program image size
dd mem ; required amount of memory
dd mem ; stack pointer
dd 0, 0 ; param, icon
include 'lang.inc'
include 'macros.inc'
START: ; start of execution
mov eax,53 ; open socket
mov ebx,0
mov ecx,0x4000 ; local port
mov edx,0x5000 ; remote port
mov esi,dword [remote_ip] ; node IP
int 0x40
mov [socketNum], eax
red:
call draw_window ; at first, draw the window
still:
mov eax,10 ; wait here for event
int 0x40
dec eax
jz red
dec eax
jnz button
key:
mov al,2
int 0x40
jmp still
button:
mov al,17
int 0x40
dec ah ; button id=1 ?
jnz noclose
mov eax, 53
mov ebx, 1
mov ecx, [socketNum]
int 0x40
mov eax,-1
int 0x40
noclose:
; it was not close button, so it must be send code button
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; SEND CODE TO REMOTE ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
send_xcode:
mov eax,53 ; SEND CODE TO REMOTE
mov ebx,4
mov ecx,[socketNum]
mov edx,end_message-send_data
mov esi,send_data
int 0x40
jmp still
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
draw_window:
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
int 0x40
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx,100*65536+250 ; [x start] *65536 + [x size]
mov ecx,60*65536+150 ; [y start] *65536 + [y size]
mov edx,0x03ffffff ; color of work area RRGGBB
int 0x40
; WINDOW LABEL
mov eax,4 ; function 4 : write text to window
mov ebx,8*65536+8 ; [x start] *65536 + [y start]
mov ecx,0x00ffffff ; color of text RRGGBB
mov edx,labeltext ; pointer to text beginning
mov esi,lte-labeltext ; text length
int 0x40
mov eax,8 ; SEND MESSAGE
mov ebx,50*65536+145
mov ecx,47*65536+13
mov edx,2
mov esi,0x667788
int 0x40
mov ebx,25*65536+50 ; draw info text with function 4
mov ecx,0x000000
mov edx,text
mov esi,40
newline:
mov eax,4
int 0x40
add ebx,16
add edx,esi
cmp [edx],byte 'x'
jnz newline
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
ret
; DATA AREA
if lang eq ru
text:
db ' <20><><EFBFBD><E1ABA0><><EFBFBD><E9A5AD> '
db ' '
db ' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> : 192.168.0.1 '
db ' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> : 192.168.0.2 '
db '<27><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><E5AEA4><EFBFBD><EFBFBD> '
db 'x' ; <- END MARKER, DONT DELETE
else
text:
db ' Send message '
db ' '
db ' Local address : 192.168.0.1 '
db ' Remote address : 192.168.0.2 '
db 'Text and address in end of source '
db 'x' ; <- END MARKER, DONT DELETE
end if
labeltext: db 'NetSend(Client)' ;
lte:
remote_ip db 192,168,1,2
send_data db '<27><EFBFBD><E0A8A2>,<2C><><EFBFBD> <20><><EFBFBD><EFBFBD>!Hello,this is a test!'
end_message:
I_END:
align 4
socketNum dd ?
rb 32 ; this is for stack
mem: