Some skinned network apps from Johnny_B (10.11.06). Also they use 'MENUET01' header instead of 'MENUET00' now

git-svn-id: svn://kolibrios.org@331 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
heavyiron 2007-02-08 09:50:45 +00:00
parent b661da340a
commit 13528c5c97
5 changed files with 411 additions and 503 deletions

View File

@ -6,22 +6,20 @@
;
use32
org 0x0
db 'MENUET00' ; 8 byte id
dd 38 ; required os
dd START ; program start
dd I_END ; program image size
dd 0x100000 ; required amount of memory
; esp = 0x7FFF0
dd 0x00000000 ; reserved=no extended header
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'
START: ; start of execution
START: ; start of execution
; Clear the screen memory
mov eax, ' '
@ -45,21 +43,21 @@ still:
mov [socket_status], eax
cmp eax, ebx
je waitev
je waitev
call draw_window
waitev:
mov eax,23 ; wait here for event
mov eax,23 ; wait here for event
mov ebx,20
int 0x40
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?
@ -106,11 +104,11 @@ handle_data:
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:
@ -139,7 +137,7 @@ state2:
ret
hd001:
cmp bl,13 ; BEGINNING OF LINE
cmp bl,13 ; BEGINNING OF LINE
jne nobol
mov ecx,[pos]
add ecx,1
@ -155,7 +153,7 @@ hd001:
jmp newdata
nobol:
cmp bl,10 ; LINE DOWN
cmp bl,10 ; LINE DOWN
jne nolf
addx1:
add [pos],dword 1
@ -169,7 +167,7 @@ hd001:
jmp cm1
nolf:
cmp bl,8 ; BACKSPACE
cmp bl,8 ; BACKSPACE
jne nobasp
mov eax,[pos]
dec eax
@ -179,7 +177,7 @@ hd001:
jmp newdata
nobasp:
cmp bl,15 ; CHARACTER
cmp bl,15 ; CHARACTER
jbe newdata
mov eax,[pos]
mov [eax+text],bl
@ -189,7 +187,7 @@ hd001:
mov ebx,[scroll+4]
imul ebx,80
cmp eax,ebx
jb noeaxz
jb noeaxz
mov esi,text+80
mov edi,text
mov ecx,ebx
@ -203,20 +201,20 @@ hd001:
ret
red: ; REDRAW WINDOW
red: ; REDRAW WINDOW
call draw_window
jmp still
key: ; KEY
mov eax,2 ; send to modem
key: ; KEY
mov eax,2 ; send to modem
int 0x40
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
@ -246,10 +244,10 @@ hd001:
jmp still
button: ; BUTTON
button: ; BUTTON
mov eax,17
int 0x40
cmp ah,1 ; CLOSE PROGRAM
cmp ah,1 ; CLOSE PROGRAM
jne noclose
mov eax,53
@ -260,7 +258,7 @@ hd001:
mov eax,-1
int 0x40
noclose:
cmp ah, 2 ; Set IP
cmp ah, 2 ; Set IP
jne notip
mov [string_x], dword 78
@ -273,9 +271,9 @@ hd001:
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
@ -293,7 +291,7 @@ hd001:
jmp still
notip:
cmp ah, 3 ; set port
cmp ah, 3 ; set port
jne notport
mov [string_x], dword 215
@ -306,9 +304,9 @@ notip:
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
@ -324,24 +322,24 @@ notip:
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
@ -382,7 +380,7 @@ tm_000:
pop bx
mov al, [echo]
cmp al, 0
je tm_001
je tm_001
push bx
call handle_data
@ -415,17 +413,17 @@ disconnect:
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
int 0x40
pop ecx
cmp eax, 0 ; is this local port in use?
jz getlp ; yes - so try next
mov eax, 53
mov ebx, 9
int 0x40
pop ecx
cmp eax, 0 ; is this local port in use?
jz getlp ; yes - so try next
mov eax,53
mov ebx,5
@ -437,7 +435,7 @@ getlp:
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
int 0x40
mov [socket], eax
@ -461,29 +459,11 @@ draw_window:
mov ebx,1
int 0x40
mov eax,0 ; 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,[wcolor]
add edx,0x02000000
mov esi,0x80557799
mov edi,0x00557799
int 0x40
mov eax,4 ; WINDOW LABEL
mov ebx,8*65536+8
mov ecx,0x00ffffff
mov edx,labelt
mov esi,labellen-labelt
int 0x40
mov eax,8 ; CLOSE BUTTON
mov ebx,(491 + 20 -19)*65536+12
mov ecx,5*65536+12
mov edx,1
mov esi,0x557799
mov edx,0x13000000
mov edi,labelt
int 0x40
; draw status bar
@ -493,14 +473,14 @@ draw_window:
mov edx, 0x00557799
int 0x40
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
mov edx,2
int 0x40
mov eax,4 ; Button text
mov eax,4 ; Button text
mov ebx,6*65536+276
mov ecx,0x00ffffff
mov edx,setipt
@ -508,7 +488,7 @@ draw_window:
int 0x40
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
@ -519,16 +499,16 @@ draw_window:
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
mov esi, 0x00557799
int 0x40
mov eax,4 ; Button text
mov eax,4 ; Button text
mov ebx,178*65536+276
mov ecx,0x00ffffff
mov edx,setportt
@ -536,21 +516,21 @@ draw_window:
int 0x40
mov edx,216*65536+276 ; display port
mov edx,216*65536+276 ; display port
mov esi,0x00ffffff
mov ebx,4*65536
mov eax,47
movzx ecx,word [port]
int 0x40
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
mov edx,4
int 0x40
mov eax,4 ; Button text
mov eax,4 ; Button text
mov ebx,255*65536+276
mov ecx,0x00ffffff
mov edx,cont
@ -558,7 +538,7 @@ draw_window:
int 0x40
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
@ -566,7 +546,7 @@ draw_window:
int 0x40
mov eax,4 ; Button text
mov eax,4 ; Button text
mov ebx,307*65536+276
mov ecx,0x00ffffff
mov edx,dist
@ -574,22 +554,22 @@ draw_window:
int 0x40
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
int 0x40
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
@ -605,7 +585,7 @@ pcon:
mov esi,echoolen-echoot
peo:
mov eax,4 ; Button text
mov eax,4 ; Button text
mov ebx,463*65536+276
mov ecx,0x00ffffff
int 0x40
@ -646,7 +626,7 @@ draw_text:
; erase character
pusha
mov edx, 0 ; bg colour
mov edx, 0 ; bg colour
mov ecx, ebx
add ecx, 26
shl ecx, 16
@ -680,11 +660,11 @@ draw_text:
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
@ -710,11 +690,11 @@ read_string:
int 0x40
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
@ -723,7 +703,7 @@ read_string:
cmp eax,dword 31
jbe f11
cmp eax,dword 95
jb keyok
jb keyok
sub eax,32
keyok:
mov [edi],al
@ -774,42 +754,41 @@ print_text:
; 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
labelt db 'Telnet v0.1'
labellen:
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
labelt 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:

View File

@ -1,27 +1,22 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; TERMINAL
;
; Compile with FASM for Menuet
;
use32
org 0x0
db 'MENUET00' ; 8 byte id
dd 38 ; required os
dd START ; program start
dd I_END ; program image size
dd 0x100000 ; required amount of memory
; esp = 0x7FFF0
dd 0x00000000 ; reserved=no extended header
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'
START: ; start of execution
START: ; start of execution
call draw_window
@ -29,18 +24,18 @@ START: ; start of execution
still:
mov eax,23 ; wait here for event
mov eax,23 ; wait here for event
mov ebx,20
int 0x40
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
cmp eax,16+4
je read_input
je read_input
jmp still
@ -53,13 +48,13 @@ read_input:
int 0x40
pop ecx
cmp bl,27 ; ESCAPE COMMAND
cmp bl,27 ; ESCAPE COMMAND
jne no_esc
call esc_command
jmp newdata
no_esc:
cmp bl,13 ; BEGINNING OF LINE
cmp bl,13 ; BEGINNING OF LINE
jne nobol
mov ecx,[pos]
add ecx,1
@ -75,7 +70,7 @@ read_input:
jmp newdata
nobol:
cmp bl,10 ; LINE DOWN
cmp bl,10 ; LINE DOWN
jne nolf
addx1:
add [pos],dword 1
@ -89,7 +84,7 @@ read_input:
jmp cm1
nolf:
cmp bl,8 ; BACKSPACE
cmp bl,8 ; BACKSPACE
jne nobasp
mov eax,[pos]
dec eax
@ -99,7 +94,7 @@ read_input:
jmp newdata
nobasp:
cmp bl,15 ; CHARACTER
cmp bl,15 ; CHARACTER
jbe newdata
mov eax,[pos]
call draw_data
@ -109,7 +104,7 @@ read_input:
mov ebx,[scroll+4]
imul ebx,80
cmp eax,ebx
jb noeaxz
jb noeaxz
mov esi,text+80
mov edi,text
mov ecx,ebx
@ -128,20 +123,20 @@ read_input:
mov eax,11
int 0x40
cmp eax,16+4
je read_input
je read_input
call draw_text
jmp still
red: ; REDRAW WINDOW
red: ; REDRAW WINDOW
call draw_window
jmp still
key: ; KEY
mov eax,2 ; send to modem
key: ; KEY
mov eax,2 ; send to modem
int 0x40
shr eax,8
cmp eax,178 ; ARROW KEYS
cmp eax,178 ; ARROW KEYS
jne noaup
mov al,'A'
call arrow
@ -172,12 +167,12 @@ read_input:
int 0x40
jmp still
button: ; BUTTON
button: ; BUTTON
mov eax,17
int 0x40
cmp ah,1 ; CLOSE PROGRAM
cmp ah,1 ; CLOSE PROGRAM
jne noclose
mov eax,45 ; FREE IRQ
mov eax,45 ; FREE IRQ
mov ebx,1
mov ecx,4
int 0x40
@ -244,22 +239,22 @@ draw_data:
irqtable:
dd 0x3f8 + 0x01000000 ; read port 0x3f8, byte
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0x3f8 + 0x01000000 ; read port 0x3f8, byte
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
dd 0
@ -274,7 +269,7 @@ set_variables:
mov edx,0x3ff
int 0x40
mov eax,45 ; reserve irq 4
mov eax,45 ; reserve irq 4
mov ebx,0
mov ecx,4
int 0x40
@ -341,27 +336,11 @@ draw_window:
mov ebx,1
int 0x40
mov eax,0 ; DRAW WINDOW
mov eax,0 ; DRAW WINDOW
mov ebx,100*65536+491
mov ecx,100*65536+270
mov edx,[wcolor]
add edx,0x02000000
mov esi,0x80557799
mov edi,0x00557799
int 0x40
mov eax,4 ; WINDOW LABEL
mov ebx,8*65536+8
mov ecx,0x00ffffff
mov edx,labelt
mov esi,labellen-labelt
int 0x40
mov eax,8 ; CLOSE BUTTON
mov ebx,(491-19)*65536+12
mov ecx,5*65536+12
mov edx,1
mov esi,0x557799
mov edx,0x13000000
mov edi,labelt
int 0x40
xor eax,eax
@ -458,11 +437,11 @@ draw_text:
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
@ -503,7 +482,7 @@ esc_command:
call get_numbers
cmp bl,'H' ; SET CURSOR POSITION
cmp bl,'H' ; SET CURSOR POSITION
jne no_cursor_position
cmp [escnumbers],0
jne ncp1
@ -519,7 +498,7 @@ esc_command:
jmp cmd_done
no_cursor_position:
cmp bl,'K' ; ERASE LINE
cmp bl,'K' ; ERASE LINE
jne no_erase_end_of_line
cmp [escnumbers],0
jne no_end_line
@ -536,7 +515,7 @@ esc_command:
jne eeol
jmp cmd_done
no_end_line:
cmp [escnumbers],1 ; BEGINNING OF LINE
cmp [escnumbers],1 ; BEGINNING OF LINE
jne no_beg_line
mov ecx,[pos]
ebol:
@ -554,7 +533,7 @@ esc_command:
no_beg_line:
no_erase_end_of_line:
cmp bl,'J' ; ERASE TO END OF SCREEN
cmp bl,'J' ; ERASE TO END OF SCREEN
jne no_erase_to_end_of_screen
cmp [escnumbers],dword 0
jne no_erase_to_end_of_screen
@ -568,7 +547,7 @@ esc_command:
jmp cmd_done
no_erase_to_end_of_screen:
cmp bl,'r' ; SET SCROLL REGION
cmp bl,'r' ; SET SCROLL REGION
jne no_scroll_region
mov eax,[escnumbers]
dec eax
@ -578,7 +557,7 @@ esc_command:
jmp cmd_done
no_scroll_region:
cmp bl,'A' ; CURSOR UP
cmp bl,'A' ; CURSOR UP
jne no_cursor_up
mov eax,[pos]
sub eax,80
@ -586,7 +565,7 @@ esc_command:
jmp cmd_done
no_cursor_up:
cmp bl,'C' ; CURSOR LEFT
cmp bl,'C' ; CURSOR LEFT
jne no_cursor_left
mov eax,[pos]
mov ebx,[escnumbers]
@ -595,14 +574,14 @@ esc_command:
call cmd_done
no_cursor_left:
cmp bl,'m' ; CHARACTER ATTRIBUTE
cmp bl,'m' ; CHARACTER ATTRIBUTE
jne no_char_attribute
mov eax,[escnumbers]
mov [attribute],eax
jmp cmd_done
no_char_attribute:
cmp bl,'Z' ; TERMINAL TYPE
cmp bl,'Z' ; TERMINAL TYPE
jne no_terminal_type
mov al,27
call to_modem
@ -730,19 +709,18 @@ get_numbers:
; DATA AREA
pos dd 80*10
irc_data dd 0x0
print db 0x0
attribute dd 0
scroll dd 1
dd 24
numtext db ' '
esccmd dd 0,0,0,0,0,0,0,0,0,0,0,0,0
escend db 'ZrhlABCDHfDME=>NmKJgincoyq',0
escnumbers dd 0,0,0,0,0
wcolor dd 0x000000
labelt db 'TERMINAL FOR MODEM IN COM1 0.03'
labellen:
pos dd 80*10
irc_data dd 0x0
print db 0x0
attribute dd 0
scroll dd 1
dd 24
numtext db ' '
esccmd dd 0,0,0,0,0,0,0,0,0,0,0,0,0
escend db 'ZrhlABCDHfDME=>NmKJgincoyq',0
escnumbers dd 0,0,0,0,0
wcolor dd 0x000000
labelt db 'TERMINAL FOR MODEM IN COM1 0.03',0
text:
db ' '

View File

@ -8,57 +8,56 @@
;
use32
org 0x0
db 'MENUET00' ; 8 byte id
dd 38 ; required os
dd START ; program start
dd I_END ; program image size
dd 0x100000 ; required amount of memory
dd 0x00000000 ; reserved=no extended header
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'
delay dd 145
delay dd 145
wait_for dd 0x0
START: ; start of execution
START: ; start of execution
mov dword [prompt], p9
mov dword [promptlen], p9len - p9
call draw_window ; at first, draw the window
call draw_window ; at first, draw the window
still:
mov eax,10 ; wait here for event
mov eax,10 ; wait here for event
int 0x40
cmp eax,1 ; redraw request ?
jz red
cmp eax,2 ; key in buffer ?
jz key
cmp eax,3 ; button in buffer ?
jz button
cmp eax,1 ; redraw request ?
jz red
cmp eax,2 ; key in buffer ?
jz key
cmp eax,3 ; button in buffer ?
jz button
jmp still
red: ; redraw
red: ; redraw
call draw_window
jmp still
key: ; Keys are not valid at this part of the
mov eax,2 ; loop. Just read it and ignore
key: ; Keys are not valid at this part of the
mov eax,2 ; loop. Just read it and ignore
int 0x40
jmp still
button: ; button
mov eax,17 ; get id
button: ; button
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
cmp ah,1 ; button id=1 ?
jnz noclose
@ -71,19 +70,19 @@ button: ; button
mov [socketNum], dword 0
mov eax,0xffffffff ; close this program
mov eax,0xffffffff ; close this program
int 0x40
noclose:
cmp ah,2 ; copy file to local machine?
cmp ah,2 ; copy file to local machine?
jnz nocopyl
mov dword [prompt], p5
mov dword [promptlen], p5len - p5
call draw_window ;
call draw_window ;
; Copy File from Remote Host to this machine
call translateData ; Convert Filename & IP address
call translateData ; Convert Filename & IP address
mov edi, tftp_filename + 1
mov [edi], byte 0x01 ; setup tftp msg
call copyFromRemote
@ -94,9 +93,9 @@ nocopyl:
cmp ah,4
jz f1
jz f1
cmp ah,5
jz f2
jz f2
jmp nof12
f1:
@ -122,7 +121,7 @@ nocopyl:
mov eax,10
int 0x40
cmp eax,2
jz fbu
jz fbu
jmp still
fbu:
mov eax,2
@ -131,7 +130,7 @@ nocopyl:
cmp eax,8
jnz nobs
cmp edi,[addr]
jz f11
jz f11
sub edi,1
mov [edi],byte ' '
call print_text
@ -140,7 +139,7 @@ nocopyl:
cmp eax,dword 31
jbe f11
cmp eax,dword 95
jb keyok
jb keyok
sub eax,32
keyok:
mov [edi],al
@ -312,12 +311,12 @@ copyFromRemote:
mov eax, 3
int 0x40
mov ecx, eax
shr ecx, 8 ; Set up the local port # with a random #
shr ecx, 8 ; Set up the local port # with a random #
; open socket
mov eax, 53
mov ebx, 0
mov edx, 69 ; remote port
mov edx, 69 ; remote port
mov esi, [tftp_IP] ; remote IP ( in intenet format )
int 0x40
@ -337,7 +336,7 @@ cfr001:
int 0x40 ; any more data?
cmp eax, 0
jne cfr001 ; yes, so get it
jne cfr001 ; yes, so get it
; Now, request the file
mov eax, 53
@ -349,16 +348,16 @@ cfr001:
cfr002:
mov eax,23 ; wait here for event
mov ebx,1 ; Time out after 10ms
mov eax,23 ; wait here for event
mov ebx,1 ; Time out after 10ms
int 0x40
cmp eax,1 ; redraw request ?
je cfr003
cmp eax,2 ; key in buffer ?
je cfr004
cmp eax,3 ; button in buffer ?
je cfr005
cmp eax,1 ; redraw request ?
je cfr003
cmp eax,2 ; key in buffer ?
je cfr004
cmp eax,3 ; button in buffer ?
je cfr005
; Any data to fetch?
mov eax, 53
@ -377,7 +376,7 @@ cfr002:
je cfr008
mov dword [prompt], p3
mov dword [promptlen], p3len - p3
call draw_window ;
call draw_window ;
cfr008:
; we have data - this will be a tftp frame
@ -441,7 +440,7 @@ cfr007:
wait_more:
mov eax,5 ; wait for correct timer position
; to trigger new play block
; to trigger new play block
mov ebx,1
int 0x40
@ -510,32 +509,32 @@ cfrerr:
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte
int 0x40 ; read byte
mov eax, 53
mov ebx, 2
mov ecx, [socketNum]
int 0x40 ; any more data?
int 0x40 ; any more data?
cmp eax, 0
jne cfrerr ; yes, so get it
jne cfrerr ; yes, so get it
jmp cfr006 ; close socket and close app
jmp cfr006 ; close socket and close app
cfr003: ; redraw request
cfr003: ; redraw request
call draw_window
jmp cfr002
cfr004: ; key pressed
mov eax,2 ; just read it and ignore
cfr004: ; key pressed
mov eax,2 ; just read it and ignore
int 0x40
jmp cfr002
cfr005: ; button
mov eax,17 ; get id
cfr005: ; button
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
cmp ah,1 ; button id=1 ?
jne cfr002 ; If not, ignore.
cfr006:
@ -547,7 +546,7 @@ cfr006:
mov [socketNum], dword 0
mov eax,-1 ; close this program
mov eax,-1 ; close this program
int 0x40
jmp $
@ -563,7 +562,7 @@ cfrexit:
mov dword [prompt], p4
mov dword [promptlen], p4len - p4
call draw_window ;
call draw_window ;
ret
@ -577,36 +576,27 @@ cfrexit:
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
int 0x40
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx,100*65536+230 ; [x start] *65536 + [x size]
mov ecx,100*65536+170 ; [y start] *65536 + [y size]
mov edx,0x03224466 ; color of work area RRGGBB
mov esi,0x00334455 ; color of grab bar RRGGBB,8->color gl
mov edi,0x00ddeeff ; color of frames 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,labelt ; pointer to text beginning
mov esi,labellen-labelt ; text length
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx,100*65536+230 ; [x start] *65536 + [x size]
mov ecx,100*65536+170 ; [y start] *65536 + [y size]
mov edx,0x13224466 ; color of work area RRGGBB
mov edi,labelt
int 0x40
mov eax,8 ; COPY BUTTON
mov eax,8 ; COPY BUTTON
mov ebx,20*65536+190
mov ecx,79*65536+15
mov edx,3
mov esi,0x557799
; int 0x40
mov eax,8 ; DELETE BUTTON
mov eax,8 ; DELETE BUTTON
mov ebx,20*65536+190
mov ecx,111*65536+15
mov edx,2
@ -652,7 +642,7 @@ draw_window:
; Re-draw the screen text
cld
mov ebx,25*65536+35 ; draw info text with function 4
mov ebx,25*65536+35 ; draw info text with function 4
mov ecx,0xffffff
mov edx,text
mov esi,40
@ -665,8 +655,8 @@ draw_window:
jnz newline
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
int 0x40
ret
@ -674,11 +664,11 @@ draw_window:
; DATA AREA
source db 'HEAT8M22.WAV '
source db 'HEAT8M22.WAV '
destination db '192.168.1.24 '
tftp_filename: times 15 + 9 db 0
tftp_filename: times 15 + 9 db 0
tftp_IP: dd 0
tftp_len: dd 0
@ -698,13 +688,10 @@ text:
db ' SERVER -> PLAY FILE '
db ' '
db ' '
db 'x <- END MARKER, DONT DELETE '
db 'x' ; <- END MARKER, DONT DELETE
labelt:
db 'TFTP Wave Player'
labellen:
labelt db 'TFTP Wave Player',0
prompt: dd 0
promptlen: dd 0

View File

@ -1,60 +1,56 @@
;
; TFTP Client
;
; Compile with FASM for Menuet
;
use32
org 0x0
db 'MENUET00' ; 8 byte id
dd 38 ; required os
dd START ; program start
dd I_END ; program image size
dd 0x100000 ; required amount of memory
dd 0x00000000 ; reserved=no extended header
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'
START: ; start of execution
mov eax,40 ; Report events
mov ebx,10000111b ; Stack 8 + defaults
START: ; start of execution
mov eax,40 ; Report events
mov ebx,10000111b ; Stack 8 + defaults
int 0x40
mov dword [prompt], p1
mov dword [promptlen], p1len - p1
call draw_window ; at first, draw the window
call draw_window ; at first, draw the window
still:
mov eax,10 ; wait here for event
mov eax,10 ; wait here for event
int 0x40
cmp eax,1 ; redraw request ?
jz red
cmp eax,2 ; key in buffer ?
jz key
cmp eax,3 ; button in buffer ?
jz button
cmp eax,1 ; redraw request ?
jz red
cmp eax,2 ; key in buffer ?
jz key
cmp eax,3 ; button in buffer ?
jz button
jmp still
red: ; redraw
red: ; redraw
call draw_window
jmp still
key: ; Keys are not valid at this part of the
mov eax,2 ; loop. Just read it and ignore
key: ; Keys are not valid at this part of the
mov eax,2 ; loop. Just read it and ignore
int 0x40
jmp still
button: ; button
mov eax,17 ; get id
button: ; button
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
cmp ah,1 ; button id=1 ?
jnz noclose
@ -67,19 +63,19 @@ button: ; button
mov [socketNum], dword 0
mov eax,0xffffffff ; close this program
mov eax,0xffffffff ; close this program
int 0x40
noclose:
cmp ah,2 ; copy file to local machine?
cmp ah,2 ; copy file to local machine?
jnz nocopyl
mov dword [prompt], p5
mov dword [promptlen], p5len - p5
call draw_window ;
call draw_window ;
; Copy File from Remote Host to this machine
call translateData ; Convert Filename & IP address
call translateData ; Convert Filename & IP address
mov edi, tftp_filename + 1
mov [edi], byte 0x01 ; setup tftp msg
call copyFromRemote
@ -88,15 +84,15 @@ noclose:
nocopyl:
cmp ah,3 ; Copy file to host?
cmp ah,3 ; Copy file to host?
jnz nocopyh
mov dword [prompt], p5
mov dword [promptlen], p5len - p5
call draw_window ;
call draw_window ;
; Copy File from this machine to Remote Host
call translateData ; Convert Filename & IP address
call translateData ; Convert Filename & IP address
mov edi, tftp_filename + 1
mov [edi], byte 0x02 ; setup tftp msg
call copyToRemote
@ -105,9 +101,9 @@ nocopyl:
nocopyh:
cmp ah,4
jz f1
jz f1
cmp ah,5
jz f2
jz f2
jmp nof12
f1:
@ -133,7 +129,7 @@ nocopyh:
mov eax,10
int 0x40
cmp eax,2
jz fbu
jz fbu
jmp still
fbu:
mov eax,2
@ -142,7 +138,7 @@ nocopyh:
cmp eax,8
jnz nobs
cmp edi,[addr]
jz f11
jz f11
sub edi,1
mov [edi],byte ' '
call print_text
@ -151,7 +147,7 @@ nocopyh:
cmp eax,dword 31
jbe f11
cmp eax,dword 95
jb keyok
jb keyok
sub eax,32
keyok:
mov [edi],al
@ -322,18 +318,18 @@ copyFromRemote:
; Get a random # for the local socket port #
mov eax, 3
int 0x40
int 0x40
mov ecx, eax
shr ecx, 8 ; Set up the local port # with a random #
shr ecx, 8 ; Set up the local port # with a random #
; open socket
mov eax, 53
mov ebx, 0
mov edx, 69 ; remote port
mov edx, 69 ; remote port
mov esi, [tftp_IP] ; remote IP ( in intenet format )
int 0x40
mov [socketNum], eax
mov [socketNum], eax
; make sure there is no data in the socket - there shouldn't be..
@ -341,15 +337,15 @@ cfr001:
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte
int 0x40 ; read byte
mov eax, 53
mov ebx, 2
mov ecx, [socketNum]
int 0x40 ; any more data?
int 0x40 ; any more data?
cmp eax, 0
jne cfr001 ; yes, so get it
jne cfr001 ; yes, so get it
; Now, request the file
mov eax, 53
@ -360,15 +356,15 @@ cfr001:
int 0x40
cfr002:
mov eax,10 ; wait here for event
mov eax,10 ; wait here for event
int 0x40
cmp eax,1 ; redraw request ?
je cfr003
cmp eax,2 ; key in buffer ?
je cfr004
cmp eax,3 ; button in buffer ?
je cfr005
cmp eax,1 ; redraw request ?
je cfr003
cmp eax,2 ; key in buffer ?
je cfr004
cmp eax,3 ; button in buffer ?
je cfr005
; Any data to fetch?
mov eax, 53
@ -387,7 +383,7 @@ cfr002:
je cfr008
mov dword [prompt], p3
mov dword [promptlen], p3len - p3
call draw_window ;
call draw_window ;
cfr008:
; we have data - this will be a tftp frame
@ -396,12 +392,12 @@ cfr008:
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte
int 0x40 ; read byte
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte
int 0x40 ; read byte
pop eax
; bl holds tftp opcode. Can only be 3 (data) or 5 ( error )
@ -415,7 +411,7 @@ cfr008:
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte
int 0x40 ; read byte
mov [blockNumber], bl
@ -486,32 +482,32 @@ cfrerr:
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte
int 0x40 ; read byte
mov eax, 53
mov ebx, 2
mov ecx, [socketNum]
int 0x40 ; any more data?
int 0x40 ; any more data?
cmp eax, 0
jne cfrerr ; yes, so get it
jne cfrerr ; yes, so get it
jmp cfr006 ; close socket and close app
jmp cfr006 ; close socket and close app
cfr003: ; redraw request
cfr003: ; redraw request
call draw_window
jmp cfr002
cfr004: ; key pressed
mov eax,2 ; just read it and ignore
cfr004: ; key pressed
mov eax,2 ; just read it and ignore
int 0x40
jmp cfr002
cfr005: ; button
mov eax,17 ; get id
cfr005: ; button
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
cmp ah,1 ; button id=1 ?
jne cfr002 ; If not, ignore.
cfr006:
@ -523,7 +519,7 @@ cfr006:
mov [socketNum], dword 0
mov eax,-1 ; close this program
mov eax,-1 ; close this program
int 0x40
jmp $
@ -539,7 +535,7 @@ cfrexit:
mov dword [prompt], p4
mov dword [promptlen], p4len - p4
call draw_window ;
call draw_window ;
ret
@ -565,7 +561,7 @@ copyToRemote:
mov dword [prompt], p6
mov dword [promptlen], p6len - p6
call draw_window ;
call draw_window ;
jmp ctr_exit
filefound:
@ -587,18 +583,18 @@ ctr000:
; Get a random # for the local socket port #
mov eax, 3
int 0x40
int 0x40
mov ecx, eax
shr ecx, 8 ; Set up the local port # with a random #
shr ecx, 8 ; Set up the local port # with a random #
; First, open socket
mov eax, 53
mov ebx, 0
mov edx, 69 ; remote port
mov edx, 69 ; remote port
mov esi, [tftp_IP]
int 0x40
mov [socketNum], eax
mov [socketNum], eax
; write to socket ( request write file )
mov eax, 53
@ -614,15 +610,15 @@ ctr000:
; or data from remote
ctr001:
mov eax,10 ; wait here for event
mov eax,10 ; wait here for event
int 0x40
cmp eax,1 ; redraw request ?
je ctr003
cmp eax,2 ; key in buffer ?
je ctr004
cmp eax,3 ; button in buffer ?
je ctr005
cmp eax,1 ; redraw request ?
je ctr003
cmp eax,2 ; key in buffer ?
je ctr004
cmp eax,3 ; button in buffer ?
je ctr005
; Any data in the UDP receive buffer?
@ -641,31 +637,31 @@ ctr001:
mov dword [prompt], p2
mov dword [promptlen], p2len - p2
call draw_window ;
call draw_window ;
; we have data - this will be the ack
ctr002:
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte - opcode
int 0x40 ; read byte - opcode
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte - opcode
int 0x40 ; read byte - opcode
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte - block (high byte)
int 0x40 ; read byte - block (high byte)
mov [blockNumber], bl
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte - block (low byte )
int 0x40 ; read byte - block (low byte )
mov [blockNumber+1], bl
@ -673,13 +669,13 @@ ctr0022:
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte (shouldn't have worked)
int 0x40 ; read byte (shouldn't have worked)
mov eax, 53
mov ebx, 2
mov ecx, [socketNum]
int 0x40 ; any more data?
int 0x40 ; any more data?
cmp eax, 0
jne ctr0022 ; yes, so get it, and dump it
@ -703,7 +699,7 @@ ctr0022:
cmp al, 0
jne ctr008
dec esi
inc byte [esi]
inc byte [esi]
ctr008:
; Move forward through the file
@ -759,20 +755,20 @@ txre:
jmp ctr001
ctr003: ; redraw
ctr003: ; redraw
call draw_window
jmp ctr001
ctr004: ; key
mov eax,2 ; just read it and ignore
ctr004: ; key
mov eax,2 ; just read it and ignore
int 0x40
jmp ctr001
ctr005: ; button
mov eax,17 ; get id
ctr005: ; button
mov eax,17 ; get id
int 0x40
cmp ah,1 ; button id=1 ?
cmp ah,1 ; button id=1 ?
jne ctr001
; close socket
@ -783,7 +779,7 @@ ctr005: ; button
mov [socketNum], dword 0
mov eax,-1 ; close this program
mov eax,-1 ; close this program
int 0x40
jmp $
@ -796,7 +792,7 @@ ctr009:
mov dword [prompt], p4
mov dword [promptlen], p4len - p4
call draw_window ;
call draw_window ;
ctr_exit:
ret
@ -811,36 +807,26 @@ ctr_exit:
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
int 0x40
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx,100*65536+230 ; [x start] *65536 + [x size]
mov ecx,100*65536+170 ; [y start] *65536 + [y size]
mov edx,0x03224466 ; color of work area RRGGBB
mov esi,0x00334455 ; color of grab bar RRGGBB,8->color gl
mov edi,0x00ddeeff ; color of frames RRGGBB
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx,100*65536+230 ; [x start] *65536 + [x size]
mov ecx,100*65536+170 ; [y start] *65536 + [y size]
mov edx,0x13224466 ; color of work area RRGGBB
mov edi,labelt
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,labelt ; pointer to text beginning
mov esi,labellen-labelt ; text length
int 0x40
mov eax,8 ; COPY BUTTON
mov eax,8 ; COPY BUTTON
mov ebx,20*65536+190
mov ecx,79*65536+15
mov edx,2
mov esi,0x557799
int 0x40
mov eax,8 ; DELETE BUTTON
mov eax,8 ; DELETE BUTTON
mov ebx,20*65536+190
mov ecx,111*65536+15
mov edx,3
@ -886,7 +872,7 @@ draw_window:
; Re-draw the screen text
cld
mov ebx,25*65536+35 ; draw info text with function 4
mov ebx,25*65536+35 ; draw info text with function 4
mov ecx,0xffffff
mov edx,text
mov esi,40
@ -899,8 +885,8 @@ draw_window:
jnz newline
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
int 0x40
ret
@ -908,11 +894,11 @@ draw_window:
; DATA AREA
source db 'KERNEL.ASM '
source db 'KERNEL.ASM '
destination db '192.168.1.23 '
tftp_filename: times 15 + 9 db 0
tftp_filename: times 15 + 9 db 0
tftp_IP: dd 0
tftp_len: dd 0
@ -932,13 +918,10 @@ text:
db ' COPY LOCAL -> HOST '
db ' '
db ' '
db 'x <- END MARKER, DONT DELETE '
db 'x' ; <- END MARKER, DONT DELETE
labelt:
db 'TFTP Client'
labellen:
labelt db 'TFTP Client',0
prompt: dd 0
promptlen: dd 0

View File

@ -3,14 +3,15 @@
;B+ System header
use32
org 0x0
db 'MENUET01'
dd 0x01
dd START
dd I_END
dd 0x100000
dd 0x7fff0
dd 0x0,0x0
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
;E:.
include 'lang.inc'
;B+ Definitions
@ -25,7 +26,7 @@ fr_max_lines equ 17
sys_colors equ I_END
text_zone equ sys_colors+4*10
;friend_zone equ text_zone+45*25 ;uncom
;friend_zone+32*fr_max_lines
;friend_zone+32*fr_max_lines
;E:.
START:
@ -143,9 +144,6 @@ noclose:
draw_window:
;B+ Draw window
mov ebx,1
mov eax,12
int 0x40
mov ebx,3
mov ecx,sys_colors
@ -153,29 +151,16 @@ draw_window:
mov eax,48
int 0x40
mov ebx,1
mov eax,12
int 0x40
xor eax,eax ;DRAW WINDOW
mov ebx,150*65536+h_sp
mov ecx,100*65536+v_sp
mov edx,[sys_colors+4*5]
or edx,0x02000000
mov esi,[sys_colors+4*1]
or esi,0x80000000
mov edi,[sys_colors+4*0]
mov eax,0
int 0x40
mov ebx,8*65536+8
mov ecx,[sys_colors+4*4]
or ecx,0x10000000
mov edx,caption
mov esi,caption_end-caption
mov eax,4
int 0x40
mov ebx,(400-19) shl 16 + 12
mov ecx,5 shl 16 + 12
mov edx,1
mov esi,[sys_colors+4*2]
mov eax,8
or edx,0x13000000
mov edi,header
int 0x40
;B+ Friend panel
@ -746,7 +731,7 @@ rep movsb
.no_more:
ret
last_friend_place dd fr_e ;del
last_friend_place dd fr_e ;del
;last_friend_place dd friend_zone ;uncom
find_friend:
@ -1049,29 +1034,25 @@ check_message:
;B+ Test data ;del
friend_zone: ;del
db 1,'First:',0 ;del
db 2,'hahaha',0 ;del
db 3,'second',0 ;del
db 3,'menuetos',0 ;del
db 1,'Treti:',0 ;del
db 2,'fourth',0 ;del
fr_e db 0 ;del
;del
times 200 db 0 ;del
;del
last_friend_line dd 0x6 ;del
;E:. ;del
friend_zone: ;del
db 1,'First:',0 ;del
db 2,'hahaha',0 ;del
db 3,'second',0 ;del
db 3,'menuetos',0 ;del
db 1,'Treti:',0 ;del
db 2,'fourth',0 ;del
fr_e db 0 ;del
;del
times 200 db 0 ;del
;del
last_friend_line dd 0x6 ;del
;B+ Data area
;caption db 'Yahoo Messanger for MenuetOS'
caption db 'Messinger (Yahoo Compatible)'
caption_end:
header db 'Messenger (Yahoo Compatible)',0
;User / Password
login_txt db 'STATUS: SESSION: ___.___.___.___'
;VISIBLE
;HIDDEN
;VISIBLE
;HIDDEN
login_txt_end:
user_txt db 'USER ID ->'
user_txt_end: