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 use32
org 0x0
org 0x0 db 'MENUET01' ; header
dd 0x01 ; header version
db 'MENUET00' ; 8 byte id dd START ; entry point
dd 38 ; required os dd I_END ; image size
dd START ; program start dd I_END+0x10000 ; required memory
dd I_END ; program image size dd I_END+0x10000 ; esp
dd 0x100000 ; required amount of memory dd 0x0 , 0x0 ; I_Param , I_Path
; esp = 0x7FFF0
dd 0x00000000 ; reserved=no extended header
include 'lang.inc' include 'lang.inc'
include 'macros.inc' include 'macros.inc'
START: ; start of execution START: ; start of execution
; Clear the screen memory ; Clear the screen memory
mov eax, ' ' mov eax, ' '
@ -45,21 +43,21 @@ still:
mov [socket_status], eax mov [socket_status], eax
cmp eax, ebx cmp eax, ebx
je waitev je waitev
call draw_window call draw_window
waitev: waitev:
mov eax,23 ; wait here for event mov eax,23 ; wait here for event
mov ebx,20 mov ebx,20
int 0x40 int 0x40
cmp eax,1 ; redraw request ? cmp eax,1 ; redraw request ?
je red je red
cmp eax,2 ; key in buffer ? cmp eax,2 ; key in buffer ?
je key je key
cmp eax,3 ; button in buffer ? cmp eax,3 ; button in buffer ?
je button je button
; any data from the socket? ; any data from the socket?
@ -106,11 +104,11 @@ handle_data:
mov al, [telnetstate] mov al, [telnetstate]
cmp al, 0 cmp al, 0
je state0 je state0
cmp al, 1 cmp al, 1
je state1 je state1
cmp al, 2 cmp al, 2
je state2 je state2
jmp hd001 jmp hd001
state0: state0:
@ -139,7 +137,7 @@ state2:
ret ret
hd001: hd001:
cmp bl,13 ; BEGINNING OF LINE cmp bl,13 ; BEGINNING OF LINE
jne nobol jne nobol
mov ecx,[pos] mov ecx,[pos]
add ecx,1 add ecx,1
@ -155,7 +153,7 @@ hd001:
jmp newdata jmp newdata
nobol: nobol:
cmp bl,10 ; LINE DOWN cmp bl,10 ; LINE DOWN
jne nolf jne nolf
addx1: addx1:
add [pos],dword 1 add [pos],dword 1
@ -169,7 +167,7 @@ hd001:
jmp cm1 jmp cm1
nolf: nolf:
cmp bl,8 ; BACKSPACE cmp bl,8 ; BACKSPACE
jne nobasp jne nobasp
mov eax,[pos] mov eax,[pos]
dec eax dec eax
@ -179,7 +177,7 @@ hd001:
jmp newdata jmp newdata
nobasp: nobasp:
cmp bl,15 ; CHARACTER cmp bl,15 ; CHARACTER
jbe newdata jbe newdata
mov eax,[pos] mov eax,[pos]
mov [eax+text],bl mov [eax+text],bl
@ -189,7 +187,7 @@ hd001:
mov ebx,[scroll+4] mov ebx,[scroll+4]
imul ebx,80 imul ebx,80
cmp eax,ebx cmp eax,ebx
jb noeaxz jb noeaxz
mov esi,text+80 mov esi,text+80
mov edi,text mov edi,text
mov ecx,ebx mov ecx,ebx
@ -203,20 +201,20 @@ hd001:
ret ret
red: ; REDRAW WINDOW red: ; REDRAW WINDOW
call draw_window call draw_window
jmp still jmp still
key: ; KEY key: ; KEY
mov eax,2 ; send to modem mov eax,2 ; send to modem
int 0x40 int 0x40
mov ebx, [socket_status] mov ebx, [socket_status]
cmp ebx, 4 ; connection open? cmp ebx, 4 ; connection open?
jne still ; no, so ignore key jne still ; no, so ignore key
shr eax,8 shr eax,8
cmp eax,178 ; ARROW KEYS cmp eax,178 ; ARROW KEYS
jne noaup jne noaup
mov al,'A' mov al,'A'
call arrow call arrow
@ -246,10 +244,10 @@ hd001:
jmp still jmp still
button: ; BUTTON button: ; BUTTON
mov eax,17 mov eax,17
int 0x40 int 0x40
cmp ah,1 ; CLOSE PROGRAM cmp ah,1 ; CLOSE PROGRAM
jne noclose jne noclose
mov eax,53 mov eax,53
@ -260,7 +258,7 @@ hd001:
mov eax,-1 mov eax,-1
int 0x40 int 0x40
noclose: noclose:
cmp ah, 2 ; Set IP cmp ah, 2 ; Set IP
jne notip jne notip
mov [string_x], dword 78 mov [string_x], dword 78
@ -273,9 +271,9 @@ hd001:
ip1: ip1:
inc esi inc esi
cmp [esi],byte '0' cmp [esi],byte '0'
jb ip2 jb ip2
cmp [esi],byte '9' cmp [esi],byte '9'
jg ip2 jg ip2
imul eax,10 imul eax,10
movzx ebx,byte [esi] movzx ebx,byte [esi]
sub ebx,48 sub ebx,48
@ -293,7 +291,7 @@ hd001:
jmp still jmp still
notip: notip:
cmp ah, 3 ; set port cmp ah, 3 ; set port
jne notport jne notport
mov [string_x], dword 215 mov [string_x], dword 215
@ -306,9 +304,9 @@ notip:
ip11: ip11:
inc esi inc esi
cmp [esi],byte '0' cmp [esi],byte '0'
jb ip21 jb ip21
cmp [esi],byte '9' cmp [esi],byte '9'
jg ip21 jg ip21
imul eax,10 imul eax,10
movzx ebx,byte [esi] movzx ebx,byte [esi]
sub ebx,48 sub ebx,48
@ -324,24 +322,24 @@ notip:
jmp still jmp still
notport: notport:
cmp ah, 4 ; connect cmp ah, 4 ; connect
jne notcon jne notcon
mov eax, [socket_status] mov eax, [socket_status]
cmp eax, 4 cmp eax, 4
je still je still
call connect call connect
jmp still jmp still
notcon: notcon:
cmp ah,5 ; disconnect cmp ah,5 ; disconnect
jne notdiscon jne notdiscon
call disconnect call disconnect
jmp still jmp still
notdiscon: ; Echo Toggle notdiscon: ; Echo Toggle
cmp ah, 6 cmp ah, 6
jne still jne still
@ -382,7 +380,7 @@ tm_000:
pop bx pop bx
mov al, [echo] mov al, [echo]
cmp al, 0 cmp al, 0
je tm_001 je tm_001
push bx push bx
call handle_data call handle_data
@ -415,17 +413,17 @@ disconnect:
connect: connect:
pusha pusha
mov ecx, 1000 ; local port starting at 1000 mov ecx, 1000 ; local port starting at 1000
getlp: getlp:
inc ecx inc ecx
push ecx push ecx
mov eax, 53 mov eax, 53
mov ebx, 9 mov ebx, 9
int 0x40 int 0x40
pop ecx pop ecx
cmp eax, 0 ; is this local port in use? cmp eax, 0 ; is this local port in use?
jz getlp ; yes - so try next jz getlp ; yes - so try next
mov eax,53 mov eax,53
mov ebx,5 mov ebx,5
@ -437,7 +435,7 @@ getlp:
shl edx, 8 shl edx, 8
mov dl, [ip_address] mov dl, [ip_address]
mov esi, edx mov esi, edx
movzx edx, word [port] ; telnet port id movzx edx, word [port] ; telnet port id
mov edi,1 ; active open mov edi,1 ; active open
int 0x40 int 0x40
mov [socket], eax mov [socket], eax
@ -461,29 +459,11 @@ draw_window:
mov ebx,1 mov ebx,1
int 0x40 int 0x40
mov eax,0 ; DRAW WINDOW xor eax,eax ; DRAW WINDOW
mov ebx,100*65536+491 + 8 +15 mov ebx,100*65536+491 + 8 +15
mov ecx,100*65536+270 + 20 ; 20 for status bar mov ecx,100*65536+270 + 20 ; 20 for status bar
mov edx,[wcolor] mov edx,0x13000000
add edx,0x02000000 mov edi,labelt
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
int 0x40 int 0x40
; draw status bar ; draw status bar
@ -493,14 +473,14 @@ draw_window:
mov edx, 0x00557799 mov edx, 0x00557799
int 0x40 int 0x40
mov eax,8 ; BUTTON 2: SET IP mov eax,8 ; BUTTON 2: SET IP
mov ebx,4*65536+70 mov ebx,4*65536+70
mov ecx,273*65536+12 mov ecx,273*65536+12
mov esi, 0x00557799 mov esi, 0x00557799
mov edx,2 mov edx,2
int 0x40 int 0x40
mov eax,4 ; Button text mov eax,4 ; Button text
mov ebx,6*65536+276 mov ebx,6*65536+276
mov ecx,0x00ffffff mov ecx,0x00ffffff
mov edx,setipt mov edx,setipt
@ -508,7 +488,7 @@ draw_window:
int 0x40 int 0x40
mov edi,ip_address ; display IP address mov edi,ip_address ; display IP address
mov edx,78*65536+276 mov edx,78*65536+276
mov esi,0x00ffffff mov esi,0x00ffffff
mov ebx,3*65536 mov ebx,3*65536
@ -519,16 +499,16 @@ draw_window:
add edx,6*4*65536 add edx,6*4*65536
inc edi inc edi
cmp edi,ip_address+4 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 ebx,173*65536+38
mov ecx,273*65536+12 mov ecx,273*65536+12
mov edx,3 mov edx,3
mov esi, 0x00557799 mov esi, 0x00557799
int 0x40 int 0x40
mov eax,4 ; Button text mov eax,4 ; Button text
mov ebx,178*65536+276 mov ebx,178*65536+276
mov ecx,0x00ffffff mov ecx,0x00ffffff
mov edx,setportt mov edx,setportt
@ -536,21 +516,21 @@ draw_window:
int 0x40 int 0x40
mov edx,216*65536+276 ; display port mov edx,216*65536+276 ; display port
mov esi,0x00ffffff mov esi,0x00ffffff
mov ebx,4*65536 mov ebx,4*65536
mov eax,47 mov eax,47
movzx ecx,word [port] movzx ecx,word [port]
int 0x40 int 0x40
mov eax,8 ; BUTTON 4: Connect mov eax,8 ; BUTTON 4: Connect
mov ebx,250*65536+50 mov ebx,250*65536+50
mov ecx,273*65536+12 mov ecx,273*65536+12
mov esi, 0x00557799 mov esi, 0x00557799
mov edx,4 mov edx,4
int 0x40 int 0x40
mov eax,4 ; Button text mov eax,4 ; Button text
mov ebx,255*65536+276 mov ebx,255*65536+276
mov ecx,0x00ffffff mov ecx,0x00ffffff
mov edx,cont mov edx,cont
@ -558,7 +538,7 @@ draw_window:
int 0x40 int 0x40
mov eax,8 ; BUTTON 5: disconnect mov eax,8 ; BUTTON 5: disconnect
mov ebx,303*65536+70 mov ebx,303*65536+70
mov ecx,273*65536+12 mov ecx,273*65536+12
mov edx,5 mov edx,5
@ -566,7 +546,7 @@ draw_window:
int 0x40 int 0x40
mov eax,4 ; Button text mov eax,4 ; Button text
mov ebx,307*65536+276 mov ebx,307*65536+276
mov ecx,0x00ffffff mov ecx,0x00ffffff
mov edx,dist mov edx,dist
@ -574,22 +554,22 @@ draw_window:
int 0x40 int 0x40
mov esi,contlen-contt ; display connected status mov esi,contlen-contt ; display connected status
mov edx, contt mov edx, contt
mov eax, [socket_status] mov eax, [socket_status]
cmp eax, 4 ; 4 is connected cmp eax, 4 ; 4 is connected
je pcon je pcon
mov esi,discontlen-discontt mov esi,discontlen-discontt
mov edx, discontt mov edx, discontt
pcon: pcon:
mov eax,4 ; status text mov eax,4 ; status text
mov ebx,380*65536+276 mov ebx,380*65536+276
mov ecx,0x00ffffff mov ecx,0x00ffffff
int 0x40 int 0x40
mov eax,8 ; BUTTON 6: echo mov eax,8 ; BUTTON 6: echo
mov ebx,460*65536+50 mov ebx,460*65536+50
mov ecx,273*65536+12 mov ecx,273*65536+12
mov edx,6 mov edx,6
@ -605,7 +585,7 @@ pcon:
mov esi,echoolen-echoot mov esi,echoolen-echoot
peo: peo:
mov eax,4 ; Button text mov eax,4 ; Button text
mov ebx,463*65536+276 mov ebx,463*65536+276
mov ecx,0x00ffffff mov ecx,0x00ffffff
int 0x40 int 0x40
@ -646,7 +626,7 @@ draw_text:
; erase character ; erase character
pusha pusha
mov edx, 0 ; bg colour mov edx, 0 ; bg colour
mov ecx, ebx mov ecx, ebx
add ecx, 26 add ecx, 26
shl ecx, 16 shl ecx, 16
@ -680,11 +660,11 @@ draw_text:
add esi,1 add esi,1
add eax,6 add eax,6
cmp eax,80*6 cmp eax,80*6
jb newletter jb newletter
mov eax,0 mov eax,0
add ebx,10 add ebx,10
cmp ebx,24*10 cmp ebx,24*10
jb newletter jb newletter
popa popa
ret ret
@ -710,11 +690,11 @@ read_string:
int 0x40 int 0x40
shr eax,8 shr eax,8
cmp eax,13 cmp eax,13
je read_done je read_done
cmp eax,8 cmp eax,8
jnz nobsl jnz nobsl
cmp edi,string cmp edi,string
jz f11 jz f11
sub edi,1 sub edi,1
mov [edi],byte '_' mov [edi],byte '_'
call print_text call print_text
@ -723,7 +703,7 @@ read_string:
cmp eax,dword 31 cmp eax,dword 31
jbe f11 jbe f11
cmp eax,dword 95 cmp eax,dword 95
jb keyok jb keyok
sub eax,32 sub eax,32
keyok: keyok:
mov [edi],al mov [edi],al
@ -774,42 +754,41 @@ print_text:
; DATA AREA ; DATA AREA
telnetrep db 0xff,0xfc,0x00 telnetrep db 0xff,0xfc,0x00
telnetstate db 0 telnetstate db 0
string_length dd 16 string_length dd 16
string_x dd 200 string_x dd 200
string_y dd 60 string_y dd 60
string db '________________' string db '________________'
tx_buff db 0, 10 tx_buff db 0, 10
ip_address db 001,002,003,004 ip_address db 001,002,003,004
port db 0,0 port db 0,0
echo db 0 echo db 0
socket dd 0x0 socket dd 0x0
socket_status dd 0x0 socket_status dd 0x0
pos dd 80 * 1 pos dd 80 * 1
scroll dd 1 scroll dd 1
dd 24 dd 24
wcolor dd 0x000000 wcolor dd 0x000000
labelt db 'Telnet v0.1' labelt db 'Telnet v0.1',0
labellen: setipt db 'IP Address: . . .'
setipt db 'IP Address: . . .'
setiplen: setiplen:
setportt db 'Port:' setportt db 'Port:'
setportlen: setportlen:
cont db 'Connect' cont db 'Connect'
conlen: conlen:
dist db 'Disconnect' dist db 'Disconnect'
dislen: dislen:
contt db 'Connected' contt db 'Connected'
contlen: contlen:
discontt db 'Disconnected' discontt db 'Disconnected'
discontlen: discontlen:
echot db 'Echo On' echot db 'Echo On'
echolen: echolen:
echoot db 'Echo Off' echoot db 'Echo Off'
echoolen: echoolen:

View File

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

View File

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

View File

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

View File

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