Subversion Repositories Kolibri OS

Compare Revisions

Ignore whitespace Rev 625 → Rev 661

/programs/network/ftps/trunk/FTPS.ASM
20,7 → 20,7
dd 0x7FFF0 ; esp = 0x7FFF0
dd 0, 0 ; no params, no path
 
include '..\..\..\macros.inc'
include 'macros.inc'
; Various states of client connection
USER_NONE equ 0 ; Awaiting a connection
USER_CONNECTED equ 1 ; User just connected, prompt given
66,7 → 66,7
; If the socket closed by remote host, open it again.
cmp eax, 7
je con
 
; If socket closed by Reset, open it again
cmp eax, 11
je con
180,7 → 180,7
xor eax,eax ; DRAW WINDOW
mov ebx,100*65536+491 + 8 +15
mov ecx,100*65536+270 + 20 ; 20 for status bar
mov edx,0x13000000
mov edx,0x14000000
mov edi,labelt
mcall
 
434,17 → 434,17
mcall
pop edx
pop esi
 
cmp eax, 0
je os_exit
; The TCP/IP transmit queue is full; Wait a bit, then retry
 
; The TCP/IP transmit queue is full; Wait a bit, then retry
pusha
mov eax,5
mov ebx,1 ; Delay for up 100ms
mcall
popa
jmp outputStr
jmp outputStr
os_exit:
ret
 
475,13 → 475,13
cmp eax, 0
je ods_exit
 
; The TCP/IP transmit queue is full; Wait a bit, then retry
; The TCP/IP transmit queue is full; Wait a bit, then retry
pusha
mov eax,5
mov ebx,20 ; Delay for upto 200ms
mcall
popa
jmp outputDataStr
jmp outputDataStr
ods_exit:
ret
 
582,9 → 582,9
mov ecx,[CmdSocket]
mcall
ret
 
 
 
;***************************************************************************
; Function
; disconnectData
841,7 → 841,7
; The data connection is already open.
;
; Inputs
; None
; None
;
; Outputs
; None
1002,7 → 1002,7
; file descriptor
;
; Inputs
; None
; None
;
; Outputs
; None
1010,18 → 1010,18
;***************************************************************************
setupFilePath:
mov esi, buff + 4 ; Point to (1 before) first character of file
 
; Skip any trailing spaces or / character
sfp001:
sfp001:
inc esi
cmp [esi], byte ' '
je sfp001
cmp [esi], byte '/'
je sfp001
 
; esi points to start of filename.
 
 
; Copy across the directory path '/'
; into the fileinfoblock
mov edi, filename
1028,7 → 1028,7
mov dword [edi], '/RD/'
mov word [edi+4], '1/'
add edi, 6
 
; Copy across the filename
sfp002:
cld
1035,7 → 1035,7
movsb
cmp [esi], byte 0x0d
jne sfp002
mov [edi], byte 0
mov [edi], byte 0
ret
 
 
1050,7 → 1050,7
; The file to send is named in the buff string
;
; Inputs
; None
; None
;
; Outputs
; None
1065,7 → 1065,7
and dword [ebx+4], 0 ; first block
 
sf002a:
; now read the file..
; now read the file..
mov eax,70
mcall
test eax, eax
1088,10 → 1088,10
add dword [ebx+4], edx
jmp sf002a
 
sf_exit:
sf_exit:
ret
 
 
;***************************************************************************
; Function
; getFile
1101,7 → 1101,7
; The file to receive is named in the buff string
;
; Inputs
; None
; None
;
; Outputs
; None
1109,7 → 1109,7
;***************************************************************************
getFile:
call setupFilePath
 
; init fileblock descriptor, for file write
xor eax, eax
mov [fsize], eax ; Start filelength at 0
1117,7 → 1117,7
inc eax
inc eax
mov [fileinfoblock], eax ; write cmd
 
; Read data from the socket until the socket closes
; loop
; loop
1127,7 → 1127,7
; sleep 100ms
; until socket no longer connected
; write file to ram
 
gf000:
mov eax, 53
mov ebx, 2 ; Get # of bytes in input queue
1135,20 → 1135,20
mcall
test eax, eax
je gf_sleep
 
mov eax, 53
mov ebx, 3 ; Get a byte from socket in bl
mov ecx, [DataSocket]
mcall ; returned data in bl
 
mov esi, text + 0x1300
add esi, dword [fsize]
mov [esi], bl
inc dword [fsize]
 
; dummy, write to screen
;call printChar
;call printChar
 
jmp gf000
 
gf_sleep:
1176,11 → 1176,11
mov ebx,10 ; Delay for up 100ms
mcall
jmp gf000 ; try for more data
 
 
 
 
 
;***************************************************************************
; COMMAND HANDLERS FOLLOW
;
1203,12 → 1203,12
; Only / is valid for the ramdisk
cmp [buff+5], byte 0x0d
jne ccwd_000
 
; OK, show the directory name text
mov esi, chdir
mov edx, chdir_end - chdir
jmp ccwd_001
 
ccwd_000:
; Tell user there is no such directory
mov esi, noFileStr
1292,7 → 1292,7
mcall
pop dword [ebx+16]
pop dword [ebx+12]
 
test eax, eax
jne cmdDele_err
 
1299,15 → 1299,15
mov esi, delokStr
mov edx, delokStr_end - delokStr
call outputStr
 
jmp cmdDele_exit
cmdDele_err:
 
cmdDele_err:
mov esi, noFileStr
mov edx, noFileStr_end - noFileStr
call outputStr
 
 
cmdDele_exit:
ret
 
1340,7 → 1340,7
 
; send directory listing
call sendDir
 
; Close port
call disconnectData
 
1376,7 → 1376,7
 
; send data to remote user
call sendFile
 
; Close port
call disconnectData
 
1418,7 → 1418,7
 
; get data file from remote user
call getFile
 
mov esi, endStr
mov edx, endStr_end - endStr
call outputStr
1612,7 → 1612,7
dirpath db '/sys',0
 
fsize: dd 0
 
state db 0
buffptr dd 0
buff: times 256 db 0 ; Could put this after iend
/programs/network/httpc/trunk/httpc.asm
23,17 → 23,17
DEBUGGING_STATE equ DEBUGGING_DISABLED
 
use32
org 0x0
db 'MENUET01' ; header
dd 0x01 ; header version
dd START ; entry point
dd I_END ; image size
dd 0x100000 ; required memory
dd 0x100000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Path
org 0x0
db 'MENUET01' ; header
dd 0x01 ; header version
dd START ; entry point
dd I_END ; image size
dd 0x100000 ; required memory
dd 0x100000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Path
 
include 'lang.inc'
include '..\..\..\macros.inc'
include 'macros.inc'
;include "DEBUG.INC"
 
URLMAXLEN equ 50 ; maximum length of url string
1392,11 → 1392,11
mov eax,0 ; function 0 : define and draw window
mov ebx,50*65536+550 ; [x start] *65536 + [x size]
mov ecx,50*65536+400 ; [y start] *65536 + [y size]
mov edx,0x13ffffff ; color of work area RRGGBB,8->color gl
mov edx,0x14ffffff ; color of work area RRGGBB,8->color gl
mov edi,title ; WINDOW LABEL
mcall
 
 
mov esi, URLMAXLEN ; URL
mov eax,4 ; function 4 : write text to window
mov ebx,30*65536+38 ; [x start] *65536 + [y start]
/programs/network/https/trunk/https.asm
19,17 → 19,17
 
use32
 
org 0x0
org 0x0
 
db 'MENUET01' ; 8 byte id
dd 0x01 ; required os
dd START ; program start
dd I_END ; program image size
dd 0x400000 ; required amount of memory
dd 0x20000
dd 0,0 ; reserved=no extended header
db 'MENUET01' ; 8 byte id
dd 0x01 ; required os
dd START ; program start
dd I_END ; program image size
dd 0x400000 ; required amount of memory
dd 0x20000
dd 0,0 ; reserved=no extended header
 
include "..\..\..\MACROS.INC"
include "MACROS.INC"
 
; 0x0+ - program image
; 0x1ffff - stack
42,7 → 42,7
dd 0
dd 50000
dd 0x20000
db '/sys/board.htm',0
db '/sys/board.htm',0
 
files:
dd 2
53,7 → 53,7
db '/sys/board.htm',0
 
 
START: ; start of execution
START: ; start of execution
 
mov eax,70
mov ebx,filel
81,7 → 81,7
mov [last_status],-2
call clear_input
red:
call draw_window ; at first, draw the window
call draw_window ; at first, draw the window
 
still:
 
110,26 → 110,26
 
check_events:
 
cmp eax,1 ; redraw request ?
cmp eax,1 ; redraw request ?
jz red
cmp eax,2 ; key in buffer ?
cmp eax,2 ; key in buffer ?
jz key
cmp eax,3 ; button in buffer ?
cmp eax,3 ; button in buffer ?
jz button
 
ret
 
key: ; Keys are not valid at this part of the
mov al,2 ; loop. Just read it and ignore
key: ; Keys are not valid at this part of the
mov al,2 ; loop. Just read it and ignore
mcall
ret
 
button: ; button
button: ; button
 
mov al,17 ; get id
mov al,17 ; get id
mcall
 
cmp ah,1 ; close
cmp ah,1 ; close
jnz tst2
mov eax,53
mov ebx,8
146,9 → 146,9
mov eax,53
mov ebx,5
mov ecx,80 ; local port # - http
mov edx,0 ; no remote port specified
mov esi,0 ; no remote ip specified
mov edi,0 ; PASSIVE open
mov edx,0 ; no remote port specified
mov esi,0 ; no remote ip specified
mov edi,0 ; PASSIVE open
mcall
mov [socket], eax
mov [posy],1
160,7 → 160,7
call check_status
ret
tst3:
cmp ah,4 ; button id=4 ?
cmp ah,4 ; button id=4 ?
jnz no4
mov [server_active],0
close_socket:
181,9 → 181,9
mov eax,53
mov ebx,5
mov ecx,80 ; local port # - http
mov edx,0 ; no remote port specified
mov esi,0 ; no remote ip specified
mov edi,0 ; PASSIVE open
mov edx,0 ; no remote port specified
mov esi,0 ; no remote ip specified
mov edi,0 ; PASSIVE open
mcall
mov [socket], eax
no_re_open:
211,8 → 211,8
jmp still
no4:
 
cmp ah,6 ; read directory
je read_string
cmp ah,6 ; read directory
je read_string
 
ret
 
240,9 → 240,9
wait_for_data:
call check_for_incoming_data
cmp [input_text+256+1],dword 'GET '
je data_received
je data_received
cmp [input_text+256+1],dword 'POST'
je data_received
je data_received
mov eax,5
mov ebx,1
mcall
291,7 → 291,7
add [filepos],edx
 
cmp [file_left],0
jg newblock
jg newblock
 
no_http_request:
 
363,7 → 363,7
 
pusha
 
mov eax,53 ; send response and file length
mov eax,53 ; send response and file length
mov ebx,7
mov ecx,[socket]
mov edx,h_len-html_header
370,7 → 370,7
mov esi,html_header
mcall
 
mov eax,53 ; send file type
mov eax,53 ; send file type
mov ebx,7
mov ecx,[socket]
mov edx,[type_len]
380,13 → 380,13
popa
ret
 
fileinfo dd 0
dd 0
dd 0
dd 512
dd 0x100000
getf db '/sys/'
times 50 db 0
fileinfo dd 0
dd 0
dd 0
dd 512
dd 0x100000
getf db '/sys/'
times 50 db 0
wanted_file: times 100 db 0
 
getflen dd 6
395,17 → 395,17
 
pusha
 
mov edx,ecx
mov edx,ecx
 
mov esi,0x20000
add esi,[board_size]
mov edi,esi
add edi,edx
mov ecx,[board_size]
sub ecx,board1-board
inc ecx
mov esi,0x20000
add esi,[board_size]
mov edi,esi
add edi,edx
mov ecx,[board_size]
sub ecx,board1-board
inc ecx
std
rep movsb
rep movsb
cld
 
popa
412,13 → 412,13
ret
 
 
from_i dd 0x0
from_i dd 0x0
from_len dd 0x0
 
message dd 0x0
message_len dd 0x0
 
read_file: ; start of execution
read_file: ; start of execution
 
mov [fileinfo+16],eax
shl ebx, 9
428,7 → 428,7
mov [filename+40*2+6],dword 'UNK '
 
cmp [input_text+256+1],dword 'POST'
je yes_new_message
je yes_new_message
 
cmp [input_text+256+11],dword 'oard' ; server board message
jne no_server_message_2
454,7 → 454,7
newfroms:
inc esi
cmp esi,input_text+256*20
je no_server_message_2
je no_server_message_2
cmp [esi],dword 'from'
jne newfroms
 
464,11 → 464,11
mov edx,0
name_new_len:
cmp [esi+edx],byte 13
je name_found_len
je name_found_len
cmp [esi+edx],byte '&'
je name_found_len
je name_found_len
cmp edx,1000
je name_found_len
je name_found_len
inc edx
jmp name_new_len
 
480,7 → 480,7
newmessages:
inc esi
cmp esi,input_text+256*20
je no_server_message_2
je no_server_message_2
cmp [esi],dword 'sage'
jne newmessages
 
491,11 → 491,11
new_len:
inc edx
cmp [esi+edx],byte ' '
je found_len
je found_len
cmp [esi+edx],byte 13
jbe found_len
cmp edx,input_text+5000
je found_len
je found_len
jmp new_len
found_len:
mov [message_len],edx
552,7 → 552,7
call make_room
 
 
mov esi,board1 ; first part
mov esi,board1 ; first part
mov edi,0x20000
add edi,board1-board
mov ecx,edx
559,7 → 559,7
cld
rep movsb
 
mov esi,[from_i] ; name
mov esi,[from_i] ; name
mov edi,0x20000
add edi,board1-board
add edi,board1e-board1
567,7 → 567,7
cld
rep movsb
 
mov esi,board2 ; middle part
mov esi,board2 ; middle part
mov edi,0x20000
add edi,board1-board + board1e-board1
add edi,[from_len]
575,7 → 575,7
cld
rep movsb
 
mov esi,[message] ; message
mov esi,[message] ; message
mov edi,0x20000
add edi,board1-board + board1e-board1 + board2e-board2
add edi,[from_len]
659,7 → 659,7
cld
new_let:
cmp [esi],byte ' '
je no_new_let
je no_new_let
cmp edi,wanted_file+30
jge no_new_let
movsb
672,10 → 672,10
cmp esi,input_text+256+6
jne no_index
mov edi,wanted_file
mov [edi+0],dword 'inde'
mov [edi+4],dword 'x.ht'
mov [edi+8],byte 'm'
mov [edi+9],byte 0
mov [edi+0],dword 'inde'
mov [edi+4],dword 'x.ht'
mov [edi+8],byte 'm'
mov [edi+9],byte 0
add edi,9
 
mov [file_type],htm
686,9 → 686,9
no_index:
 
cmp [edi-3],dword 'htm'+0
je htm_header
je htm_header
cmp [edi-3],dword 'HTM'+0
je htm_header
je htm_header
jmp no_htm_header
htm_header:
mov [file_type],htm
698,9 → 698,9
no_htm_header:
 
cmp [edi-3],dword 'png'+0
je png_header
je png_header
cmp [edi-3],dword 'PNG'+0
je png_header
je png_header
jmp no_png_header
png_header:
mov [file_type],png
710,9 → 710,9
no_png_header:
 
cmp [edi-3],dword 'gif'+0
je gif_header
je gif_header
cmp [edi-3],dword 'GIF'+0
je gif_header
je gif_header
jmp no_gif_header
gif_header:
mov [file_type],gif
722,9 → 722,9
no_gif_header:
 
cmp [edi-3],dword 'jpg'+0
je jpg_header
je jpg_header
cmp [edi-3],dword 'JPG'+0
je jpg_header
je jpg_header
jmp no_jpg_header
jpg_header:
mov [file_type],jpg
734,13 → 734,13
no_jpg_header:
 
cmp [edi-3],dword 'asm'+0
je txt_header
je txt_header
cmp [edi-3],dword 'ASM'+0
je txt_header
je txt_header
cmp [edi-3],dword 'txt'+0
je txt_header
je txt_header
cmp [edi-3],dword 'TXT'+0
je txt_header
je txt_header
jmp no_txt_header
txt_header:
mov [file_type],txt
766,13 → 766,13
cld
rep movsb
 
mov [fileinfo+12],dword 1 ; file exists ?
mov [fileinfo+12],dword 1 ; file exists ?
mov eax,70
mov ebx,fileinfo
mcall
 
cmp eax,0 ; file not found - message
je file_found
cmp eax,0 ; file not found - message
je file_found
mov edi,et
call set_time
mov edi,ed
988,7 → 988,7
mcall
 
cmp eax,[status]
je c_ret
je c_ret
mov [status],eax
add al,48
mov [text+12],al
999,8 → 999,8
ret
 
 
addr dd 0x0
ya dd 0x0
addr dd 0x0
ya dd 0x0
 
filename2: times 100 db 32
 
1028,11 → 1028,11
mcall
shr eax,8
cmp eax,13
je read_done
je read_done
cmp eax,8
jnz nobsl
cmp edi,[addr]
jz f11
jz f11
sub edi,1
mov [edi],byte 32
call print_text
1096,33 → 1096,33
 
draw_window:
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
mcall
 
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx,100*65536+480 ; [x start] *65536 + [x size]
mov ecx,100*65536+215 ; [y start] *65536 + [y size]
mov edx,0x13ffffff ; color of work area RRGGBB
mov edi,title ; WINDOW LABEL
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx,100*65536+480 ; [x start] *65536 + [x size]
mov ecx,100*65536+215 ; [y start] *65536 + [y size]
mov edx,0x14ffffff ; color of work area RRGGBB
mov edi,title ; WINDOW LABEL
mcall
 
mov eax,8 ; function 8 : define and draw button
mov ebx,(40)*65536+20 ; [x start] *65536 + [x size]
mov ecx,59*65536+9 ; [y start] *65536 + [y size]
mov edx,2 ; button id
mov esi,0x66aa66 ; button color RRGGBB
mov eax,8 ; function 8 : define and draw button
mov ebx,(40)*65536+20 ; [x start] *65536 + [x size]
mov ecx,59*65536+9 ; [y start] *65536 + [y size]
mov edx,2 ; button id
mov esi,0x66aa66 ; button color RRGGBB
mcall
 
; function 8 : define and draw button
mov ebx,(40)*65536+20 ; [x start] *65536 + [x size]
; function 8 : define and draw button
mov ebx,(40)*65536+20 ; [x start] *65536 + [x size]
mov ecx,72*65536+9 ; [y start] *65536 + [y size]
mov edx,4 ; button id
mov esi,0xaa6666 ; button color RRGGBB
mov edx,4 ; button id
mov esi,0xaa6666 ; button color RRGGBB
mcall
 
; Enter directory
; Enter directory
mov ebx,(25)*65536+66
mov ecx,135*65536+15
mov edx,6
1143,8 → 1143,8
 
call draw_data
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
mcall
 
ret
1154,7 → 1154,7
 
pusha
 
mov ebx,25*65536+35 ; draw info text with function 4
mov ebx,25*65536+35 ; draw info text with function 4
mov ecx,0x000000
mov edx,text
mov esi,35
1186,7 → 1186,7
mov [input_text+4],dword 'IVED'
mov [input_text+8],dword ': '
 
mov ebx,255*65536+35 ; draw info text with function 4
mov ebx,255*65536+35 ; draw info text with function 4
mov ecx,0x000000
mov edx,input_text
mov esi,35
1215,7 → 1215,7
 
; DATA AREA
 
status dd 0x0
status dd 0x0
 
text:
db 'TCB status: x '
1296,8 → 1296,8
 
title db appname,version,0
 
socket dd 0x0
server_active db 0x0
socket dd 0x0
server_active db 0x0
 
board:
 
1354,8 → 1354,8
 
board_end:
 
board_size dd 0x0
board_messages dd 0x0
board_size dd 0x0
board_messages dd 0x0
 
input_text:
 
/programs/network/netsendc/trunk/netsendc.asm
1,9 → 1,9
;
; NetSend(Client)
;
;
; €¢â®à: Hex
; ‘ ©â: www.mestack.narod.ru
;
;
; Ž¯¨á ­¨¥:
; à®£à ¬¬  ¤«ï ®¡¬¥­  á®®¡é¥­¨ï¬¨ ¢ á¥â¨.Š«¨¥­â᪠ï ç áâì.
;
10,12 → 10,12
; Compile with FASM for Menuet
; Š®¬¯¨«¨àã¥âáï FASM'®¬ ¤«ï Œ¥­ãí⠎‘
;
 
 
use32
 
org 0x0
 
db 'MENUET01' ; 8 byte id
dd 1 ; header version
dd START ; program start
23,12 → 23,12
dd mem ; required amount of memory
dd mem ; stack pointer
dd 0, 0 ; param, icon
 
include 'lang.inc'
include '..\..\..\macros.inc'
include 'macros.inc'
 
START: ; start of execution
 
mov eax,53 ; open socket
mov ebx,0
mov ecx,0x4000 ; local port
35,14 → 35,14
mov edx,0x5000 ; remote port
mov esi,dword [remote_ip] ; node IP
mcall
 
mov [socketNum], eax
 
red:
red:
call draw_window ; at first, draw the window
 
still:
 
mov eax,10 ; wait here for event
mcall
 
55,11 → 55,11
mov al,2
mcall
jmp still
 
button:
mov al,17
mcall
 
dec ah ; button id=1 ?
jnz noclose
mov eax, 53
76,7 → 76,7
;; SEND CODE TO REMOTE ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
send_xcode:
 
mov eax,53 ; SEND CODE TO REMOTE
87,28 → 87,28
mcall
 
jmp still
 
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
 
draw_window:
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
mcall
 
; 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,0x13ffffff ; color of work area RRGGBB
mov edx,0x14ffffff ; color of work area RRGGBB
mov edi,title ; WINDOW LABEL
mcall
 
 
mov eax,8 ; SEND MESSAGE
mov ebx,50*65536+145
mov ecx,47*65536+13
115,7 → 115,7
mov edx,2
mov esi,0x667788
mcall
 
mov eax,4
mov ebx,25*65536+50 ; draw info text with function 4
mov ecx,0x000000
127,17 → 127,17
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
mcall
 
ret
 
 
; DATA AREA
if lang eq ru
 
if lang eq ru
text:
db ' ®á« âì á®®¡é¥­¨¥ '
db ' '
153,16 → 153,16
db ' Remote address : 192.168.0.2 '
db 'Text and address in end of source '
db 'x' ; <- END MARKER, DONT DELETE
end if
end if
 
title db 'NetSend(Client)',0
 
remote_ip db 192,168,1,2
 
send_data db 'à¨¢¥â,íâ® â¥áâ!Hello,this is a test!'
end_message:
 
 
I_END:
align 4
socketNum dd ?
/programs/network/netsends/trunk/netsends.asm
1,9 → 1,9
;
; NetSend(Server)
;
;
; €¢â®à: Hex
; ‘ ©â: www.mestack.narod.ru
;
;
; Ž¯¨á ­¨¥:
; à®£à ¬¬  ¤«ï ®¡¬¥­  á®®¡é¥­¨ï¬¨ ¢ á¥â¨.‘¥à¢¥à­ ï ç áâì.
;
10,24 → 10,24
; Compile with FASM for Menuet
; Š®¬¯¨«¨àã¥âáï FASM'®¬ ¤«ï Œ¥­ãí⠎‘
;
 
use32
org 0x0
db 'MENUET01' ; header
dd 0x01 ; header version
dd START ; entry point
dd I_END ; image size
dd I_END+0x10000 ; required memory
dd I_END+0x10000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Path
org 0x0
db 'MENUET01' ; header
dd 0x01 ; header version
dd START ; entry point
dd I_END ; image size
dd I_END+0x10000 ; required memory
dd I_END+0x10000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Path
 
include 'lang.inc'
include '..\..\..\macros.inc'
include 'macros.inc'
remote_ip db 192,168,0,1
 
 
START: ; start of execution
 
mov eax, 53 ; open receiver socket
mov ebx, 0
mov ecx, 0x5000 ; local port
37,15 → 37,15
mov [socketNum],eax
mov [0],eax ; save for remote code
 
red:
red:
call draw_window ; at first, draw the window
 
still:
 
mov eax,23 ; wait here for event
mov ebx,1
mcall
 
cmp eax,1 ; redraw request ?
jz red
cmp eax,2 ; key in buffer ?
52,24 → 52,24
jz key
cmp eax,3 ; button in buffer ?
jz button
 
mov eax,53 ; data from cluster terminal ?
mov ebx,2
mov ecx,[socketNum]
mcall
 
cmp eax,0
jne data_arrived
 
jmp still
 
key:
mov eax,2
mcall
jmp still
 
button:
 
mov eax,53
mov ebx,1
mov ecx,[socketNum]
76,34 → 76,34
mcall
or eax,-1
mcall
 
 
data_arrived:
 
mov eax,5 ; wait a second for everything to arrive
mov ebx,10
mcall
 
mov edi,I_END
 
get_data:
 
mov eax,53
mov ebx,3
mov ecx,[socketNum]
mcall
 
mov [edi],bl
inc edi
 
mov eax,53
mov ebx,2
mov ecx,[socketNum]
mcall
 
cmp eax,0
jne get_data
 
mov eax,4
mov ebx,10*65536+60
add ebx,[y]
111,35 → 111,35
mov edx,I_END
mov esi,100
mcall
 
add [y],10
 
jmp still
 
y dd 0x10
 
 
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
 
 
draw_window:
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
mcall
 
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx,100*65536+300 ; [x start] *65536 + [x size]
mov ecx,100*65536+330 ; [y start] *65536 + [y size]
mov edx,0x13ffffff ; color of work area RRGGBB
mov edx,0x14ffffff ; color of work area RRGGBB
mov edi,title ; WINDOW LABEL
mcall
 
 
; Re-draw the screen text
cld
mov eax,4
153,18 → 153,18
add edx,40
cmp [edx],byte 'x'
jnz newline
 
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
mcall
 
ret
 
 
; DATA AREA
if lang eq ru
 
if lang eq ru
text:
db '„ ­­ë©  ¤à¥á : 192.168.0.2 '
db 'à®á«ã訢 ¥¬ë© ¯®àâ : 0x5000 '
177,10 → 177,10
db 'Received messages: '
db 'x' ; <- END MARKER, DONT DELETE
end if
 
title db 'NetSend(Server)',0
 
socketNum dd 0x0
 
 
I_END:
/programs/network/popc/trunk/popc.asm
9,7 → 9,7
;; Compile with FASM for Menuet ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
include '..\..\..\macros.inc'
include 'macros.inc'
version equ '0.1'
 
use32
811,7 → 811,7
mov eax,0 ; draw window
mov ebx,5*65536+435
mov ecx,5*65536+232
mov edx,0x13ffffff
mov edx,0x14ffffff
mov edi,labelt
mcall
 
/programs/network/telnet/trunk/telnet.asm
6,20 → 6,20
;
 
use32
org 0x0
db 'MENUET01' ; header
dd 0x01 ; header version
dd START ; entry point
dd I_END ; image size
dd I_END+0x10000 ; required memory
dd I_END+0x10000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Path
org 0x0
db 'MENUET01' ; header
dd 0x01 ; header version
dd START ; entry point
dd I_END ; image size
dd I_END+0x10000 ; required memory
dd I_END+0x10000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Path
 
 
include 'lang.inc'
include '..\..\..\macros.inc'
include 'macros.inc'
 
START: ; start of execution
START: ; start of execution
 
; Clear the screen memory
mov eax, ' '
43,22 → 43,22
mov [socket_status], eax
 
cmp eax, ebx
je waitev
je waitev
 
red:
call draw_window
 
waitev:
mov eax,23 ; wait here for event
mov eax,23 ; wait here for event
mov ebx,20
mcall
 
cmp eax,1 ; redraw request ?
je red
cmp eax,2 ; key in buffer ?
je key
cmp eax,3 ; button in buffer ?
je button
cmp eax,1 ; redraw request ?
je red
cmp eax,2 ; key in buffer ?
je key
cmp eax,3 ; button in buffer ?
je button
 
; any data from the socket?
 
105,11 → 105,11
 
mov al, [telnetstate]
cmp al, 0
je state0
je state0
cmp al, 1
je state1
je state1
cmp al, 2
je state2
je state2
jmp hd001
 
state0:
138,7 → 138,7
ret
 
hd001:
cmp bl,13 ; BEGINNING OF LINE
cmp bl,13 ; BEGINNING OF LINE
jne nobol
mov ecx,[pos]
add ecx,1
154,7 → 154,7
jmp newdata
nobol:
 
cmp bl,10 ; LINE DOWN
cmp bl,10 ; LINE DOWN
jne nolf
addx1:
add [pos],dword 1
168,7 → 168,7
jmp cm1
nolf:
 
cmp bl,8 ; BACKSPACE
cmp bl,8 ; BACKSPACE
jne nobasp
mov eax,[pos]
dec eax
178,7 → 178,7
jmp newdata
nobasp:
 
cmp bl,15 ; CHARACTER
cmp bl,15 ; CHARACTER
jbe newdata
mov eax,[pos]
mov [eax+text],bl
188,7 → 188,7
mov ebx,[scroll+4]
imul ebx,80
cmp eax,ebx
jb noeaxz
jb noeaxz
mov esi,text+80
mov edi,text
mov ecx,ebx
201,16 → 201,16
newdata:
ret
 
key: ; KEY
mov eax,2 ; send to modem
key: ; KEY
mov eax,2 ; send to modem
mcall
 
mov ebx, [socket_status]
cmp ebx, 4 ; connection open?
jne still ; no, so ignore key
cmp ebx, 4 ; connection open?
jne still ; no, so ignore key
 
shr eax,8
cmp eax,178 ; ARROW KEYS
cmp eax,178 ; ARROW KEYS
jne noaup
mov al,'A'
call arrow
240,10 → 240,10
 
jmp still
 
button: ; BUTTON
button: ; BUTTON
mov eax,17
mcall
cmp ah,1 ; CLOSE PROGRAM
cmp ah,1 ; CLOSE PROGRAM
jne noclose
 
mov eax,53
254,7 → 254,7
or eax,-1
mcall
noclose:
cmp ah, 2 ; Set IP
cmp ah, 2 ; Set IP
jne notip
 
mov [string_x], dword 78
267,9 → 267,9
ip1:
inc esi
cmp [esi],byte '0'
jb ip2
jb ip2
cmp [esi],byte '9'
jg ip2
jg ip2
imul eax,10
movzx ebx,byte [esi]
sub ebx,48
287,7 → 287,7
jmp still
 
notip:
cmp ah, 3 ; set port
cmp ah, 3 ; set port
jne notport
 
mov [string_x], dword 215
300,9 → 300,9
ip11:
inc esi
cmp [esi],byte '0'
jb ip21
jb ip21
cmp [esi],byte '9'
jg ip21
jg ip21
imul eax,10
movzx ebx,byte [esi]
sub ebx,48
318,24 → 318,24
jmp still
 
notport:
cmp ah, 4 ; connect
cmp ah, 4 ; connect
jne notcon
 
mov eax, [socket_status]
cmp eax, 4
je still
je still
call connect
 
jmp still
 
notcon:
cmp ah,5 ; disconnect
cmp ah,5 ; disconnect
jne notdiscon
 
call disconnect
jmp still
 
notdiscon: ; Echo Toggle
notdiscon: ; Echo Toggle
cmp ah, 6
jne still
 
376,7 → 376,7
pop bx
mov al, [echo]
cmp al, 0
je tm_001
je tm_001
 
push bx
call handle_data
409,17 → 409,17
connect:
pusha
 
mov ecx, 1000 ; local port starting at 1000
mov ecx, 1000 ; local port starting at 1000
 
getlp:
inc ecx
inc ecx
push ecx
mov eax, 53
mov ebx, 9
mov eax, 53
mov ebx, 9
mcall
pop ecx
cmp eax, 0 ; is this local port in use?
jz getlp ; yes - so try next
pop ecx
cmp eax, 0 ; is this local port in use?
jz getlp ; yes - so try next
 
mov eax,53
mov ebx,5
431,7 → 431,7
shl edx, 8
mov dl, [ip_address]
mov esi, edx
movzx edx, word [port] ; telnet port id
movzx edx, word [port] ; telnet port id
mov edi,1 ; active open
mcall
mov [socket], eax
455,10 → 455,10
mov ebx,1
mcall
 
xor eax,eax ; DRAW WINDOW
xor eax,eax ; DRAW WINDOW
mov ebx,100*65536+491 + 8 +15
mov ecx,100*65536+270 + 20 ; 20 for status bar
mov edx,0x13000000
mov edx,0x14000000
mov edi,title
mcall
 
469,7 → 469,7
mov edx, 0x00557799
mcall
 
mov eax,8 ; BUTTON 2: SET IP
mov eax,8 ; BUTTON 2: SET IP
mov ebx,4*65536+70
mov ecx,273*65536+12
mov esi, 0x00557799
476,7 → 476,7
mov edx,2
mcall
 
mov eax,4 ; Button text
mov eax,4 ; Button text
mov ebx,6*65536+276
mov ecx,0x00ffffff
mov edx,setipt
485,7 → 485,7
 
 
mov eax,47
mov edi,ip_address ; display IP address
mov edi,ip_address ; display IP address
mov edx,78*65536+276
mov esi,0x00ffffff
mov ebx,3*65536
495,9 → 495,9
add edx,6*4*65536
inc edi
cmp edi,ip_address+4
jb ipdisplay
jb ipdisplay
 
mov eax,8 ; BUTTON 3: SET PORT
mov eax,8 ; BUTTON 3: SET PORT
mov ebx,173*65536+38
mov ecx,273*65536+12
mov edx,3
504,7 → 504,7
mov esi, 0x00557799
mcall
 
mov eax,4 ; Button text
mov eax,4 ; Button text
mov ebx,178*65536+276
mov ecx,0x00ffffff
mov edx,setportt
512,7 → 512,7
mcall
 
 
mov edx,216*65536+276 ; display port
mov edx,216*65536+276 ; display port
mov esi,0x00ffffff
mov ebx,4*65536
mov eax,47
519,7 → 519,7
movzx ecx,word [port]
mcall
 
mov eax,8 ; BUTTON 4: Connect
mov eax,8 ; BUTTON 4: Connect
mov ebx,250*65536+50
mov ecx,273*65536+12
mov esi, 0x00557799
526,7 → 526,7
mov edx,4
mcall
 
mov eax,4 ; Button text
mov eax,4 ; Button text
mov ebx,255*65536+276
mov ecx,0x00ffffff
mov edx,cont
534,7 → 534,7
mcall
 
 
mov eax,8 ; BUTTON 5: disconnect
mov eax,8 ; BUTTON 5: disconnect
mov ebx,303*65536+70
mov ecx,273*65536+12
mov edx,5
542,7 → 542,7
mcall
 
 
mov eax,4 ; Button text
mov eax,4 ; Button text
mov ebx,307*65536+276
mov ecx,0x00ffffff
mov edx,dist
550,22 → 550,22
mcall
 
 
mov esi,contlen-contt ; display connected status
mov esi,contlen-contt ; display connected status
mov edx, contt
mov eax, [socket_status]
cmp eax, 4 ; 4 is connected
je pcon
cmp eax, 4 ; 4 is connected
je pcon
mov esi,discontlen-discontt
mov edx, discontt
pcon:
 
mov eax,4 ; status text
mov eax,4 ; status text
mov ebx,380*65536+276
mov ecx,0x00ffffff
mcall
 
 
mov eax,8 ; BUTTON 6: echo
mov eax,8 ; BUTTON 6: echo
mov ebx,460*65536+50
mov ecx,273*65536+12
mov edx,6
581,7 → 581,7
mov esi,echoolen-echoot
 
peo:
mov eax,4 ; Button text
mov eax,4 ; Button text
mov ebx,463*65536+276
mov ecx,0x00ffffff
mcall
622,7 → 622,7
; erase character
 
pusha
mov edx, 0 ; bg colour
mov edx, 0 ; bg colour
mov ecx, ebx
add ecx, 26
shl ecx, 16
656,11 → 656,11
add esi,1
add eax,6
cmp eax,80*6
jb newletter
jb newletter
mov eax,0
add ebx,10
cmp ebx,24*10
jb newletter
jb newletter
 
popa
ret
686,11 → 686,11
mcall
shr eax,8
cmp eax,13
je read_done
je read_done
cmp eax,8
jnz nobsl
cmp edi,string
jz f11
jz f11
sub edi,1
mov [edi],byte '_'
call print_text
699,7 → 699,7
cmp eax,dword 31
jbe f11
cmp eax,dword 95
jb keyok
jb keyok
sub eax,32
keyok:
mov [edi],al
750,41 → 750,41
 
; DATA AREA
 
telnetrep db 0xff,0xfc,0x00
telnetstate db 0
telnetrep db 0xff,0xfc,0x00
telnetstate db 0
 
string_length dd 16
string_x dd 200
string_y dd 60
 
string db '________________'
string db '________________'
 
tx_buff db 0, 10
ip_address db 001,002,003,004
port db 0,0
echo db 0
socket dd 0x0
socket_status dd 0x0
pos dd 80 * 1
scroll dd 1
dd 24
wcolor dd 0x000000
title db 'Telnet v0.1',0
setipt db 'IP Address: . . .'
tx_buff db 0, 10
ip_address db 001,002,003,004
port db 0,0
echo db 0
socket dd 0x0
socket_status dd 0x0
pos dd 80 * 1
scroll dd 1
dd 24
wcolor dd 0x000000
title db 'Telnet v0.1',0
setipt db 'IP Address: . . .'
setiplen:
setportt db 'Port:'
setportt db 'Port:'
setportlen:
cont db 'Connect'
cont db 'Connect'
conlen:
dist db 'Disconnect'
dist db 'Disconnect'
dislen:
contt db 'Connected'
contt db 'Connected'
contlen:
discontt db 'Disconnected'
discontt db 'Disconnected'
discontlen:
echot db 'Echo On'
echot db 'Echo On'
echolen:
echoot db 'Echo Off'
echoot db 'Echo Off'
echoolen: