2006-01-03 10:43:31 +01:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;
|
|
|
|
; TERMINAL
|
|
|
|
;
|
|
|
|
; Compile with FASM for Menuet
|
|
|
|
;
|
|
|
|
|
|
|
|
use32
|
2007-10-20 20:12:58 +02:00
|
|
|
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
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
|
|
include 'lang.inc'
|
2007-10-20 20:12:58 +02:00
|
|
|
include 'macros.inc'
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2007-10-20 20:12:58 +02:00
|
|
|
START: ; start of execution
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
; Clear the screen memory
|
|
|
|
mov eax, ' '
|
|
|
|
mov edi,text
|
|
|
|
mov ecx,80*30 /4
|
|
|
|
cld
|
|
|
|
rep stosd
|
|
|
|
|
|
|
|
|
|
|
|
call draw_window
|
|
|
|
|
|
|
|
|
|
|
|
still:
|
|
|
|
; check connection status
|
|
|
|
mov eax,53
|
|
|
|
mov ebx,6
|
|
|
|
mov ecx,[socket]
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
mov ebx, [socket_status]
|
|
|
|
mov [socket_status], eax
|
|
|
|
|
|
|
|
cmp eax, ebx
|
2007-10-20 20:12:58 +02:00
|
|
|
je waitev
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2007-05-10 15:48:35 +02:00
|
|
|
red:
|
2006-01-03 10:43:31 +01:00
|
|
|
call draw_window
|
|
|
|
|
|
|
|
waitev:
|
2007-10-20 20:12:58 +02:00
|
|
|
mov eax,23 ; wait here for event
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ebx,20
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2007-10-20 20:12:58 +02:00
|
|
|
cmp eax,1 ; redraw request ?
|
|
|
|
je red
|
|
|
|
cmp eax,2 ; key in buffer ?
|
|
|
|
je key
|
|
|
|
cmp eax,3 ; button in buffer ?
|
|
|
|
je button
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
; any data from the socket?
|
|
|
|
|
|
|
|
mov eax, 53
|
|
|
|
mov ebx, 2
|
|
|
|
mov ecx, [socket]
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
cmp eax, 0
|
|
|
|
jne read_input
|
|
|
|
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
|
|
|
|
read_input:
|
|
|
|
|
|
|
|
push ecx
|
|
|
|
mov eax, 53
|
|
|
|
mov ebx, 3
|
|
|
|
mov ecx, [socket]
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
pop ecx
|
|
|
|
|
|
|
|
call handle_data
|
|
|
|
|
|
|
|
push ecx
|
|
|
|
mov eax, 53
|
|
|
|
mov ebx, 2
|
|
|
|
mov ecx, [socket]
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
pop ecx
|
|
|
|
cmp eax, 0
|
|
|
|
|
|
|
|
|
|
|
|
jne read_input
|
|
|
|
call draw_text
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
handle_data:
|
|
|
|
; Telnet servers will want to negotiate options about our terminal window
|
|
|
|
; just reject them all.
|
|
|
|
; Telnet options start with the byte 0xff and are 3 bytes long.
|
|
|
|
|
|
|
|
mov al, [telnetstate]
|
|
|
|
cmp al, 0
|
2007-10-20 20:12:58 +02:00
|
|
|
je state0
|
2006-01-03 10:43:31 +01:00
|
|
|
cmp al, 1
|
2007-10-20 20:12:58 +02:00
|
|
|
je state1
|
2006-01-03 10:43:31 +01:00
|
|
|
cmp al, 2
|
2007-10-20 20:12:58 +02:00
|
|
|
je state2
|
2006-01-03 10:43:31 +01:00
|
|
|
jmp hd001
|
|
|
|
|
|
|
|
state0:
|
|
|
|
cmp bl, 255
|
|
|
|
jne hd001
|
|
|
|
mov al, 1
|
|
|
|
mov [telnetstate], al
|
|
|
|
ret
|
|
|
|
|
|
|
|
state1:
|
|
|
|
mov al, 2
|
|
|
|
mov [telnetstate], al
|
|
|
|
ret
|
|
|
|
|
|
|
|
state2:
|
|
|
|
mov al, 0
|
|
|
|
mov [telnetstate], al
|
|
|
|
mov [telnetrep+2], bl
|
|
|
|
|
|
|
|
mov edx, 3
|
|
|
|
mov eax,53
|
|
|
|
mov ebx,7
|
|
|
|
mov ecx,[socket]
|
|
|
|
mov esi, telnetrep
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
ret
|
|
|
|
|
|
|
|
hd001:
|
2007-10-20 20:12:58 +02:00
|
|
|
cmp bl,13 ; BEGINNING OF LINE
|
2006-01-03 10:43:31 +01:00
|
|
|
jne nobol
|
|
|
|
mov ecx,[pos]
|
|
|
|
add ecx,1
|
|
|
|
boll1:
|
|
|
|
sub ecx,1
|
|
|
|
mov eax,ecx
|
|
|
|
xor edx,edx
|
|
|
|
mov ebx,80
|
|
|
|
div ebx
|
|
|
|
cmp edx,0
|
|
|
|
jne boll1
|
|
|
|
mov [pos],ecx
|
|
|
|
jmp newdata
|
|
|
|
nobol:
|
|
|
|
|
2007-10-20 20:12:58 +02:00
|
|
|
cmp bl,10 ; LINE DOWN
|
2006-01-03 10:43:31 +01:00
|
|
|
jne nolf
|
|
|
|
addx1:
|
|
|
|
add [pos],dword 1
|
|
|
|
mov eax,[pos]
|
|
|
|
xor edx,edx
|
|
|
|
mov ecx,80
|
|
|
|
div ecx
|
|
|
|
cmp edx,0
|
|
|
|
jnz addx1
|
|
|
|
mov eax,[pos]
|
|
|
|
jmp cm1
|
|
|
|
nolf:
|
|
|
|
|
2007-10-20 20:12:58 +02:00
|
|
|
cmp bl,8 ; BACKSPACE
|
2006-01-03 10:43:31 +01:00
|
|
|
jne nobasp
|
|
|
|
mov eax,[pos]
|
|
|
|
dec eax
|
|
|
|
mov [pos],eax
|
|
|
|
mov [eax+text],byte 32
|
|
|
|
mov [eax+text+60*80],byte 0
|
|
|
|
jmp newdata
|
|
|
|
nobasp:
|
|
|
|
|
2007-10-20 20:12:58 +02:00
|
|
|
cmp bl,15 ; CHARACTER
|
2006-01-03 10:43:31 +01:00
|
|
|
jbe newdata
|
|
|
|
mov eax,[pos]
|
|
|
|
mov [eax+text],bl
|
|
|
|
mov eax,[pos]
|
|
|
|
add eax,1
|
|
|
|
cm1:
|
|
|
|
mov ebx,[scroll+4]
|
|
|
|
imul ebx,80
|
|
|
|
cmp eax,ebx
|
2007-10-20 20:12:58 +02:00
|
|
|
jb noeaxz
|
2006-01-03 10:43:31 +01:00
|
|
|
mov esi,text+80
|
|
|
|
mov edi,text
|
|
|
|
mov ecx,ebx
|
|
|
|
cld
|
|
|
|
rep movsb
|
|
|
|
mov eax,ebx
|
|
|
|
sub eax,80
|
|
|
|
noeaxz:
|
|
|
|
mov [pos],eax
|
|
|
|
newdata:
|
|
|
|
ret
|
|
|
|
|
2007-10-20 20:12:58 +02:00
|
|
|
key: ; KEY
|
|
|
|
mov eax,2 ; send to modem
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
mov ebx, [socket_status]
|
2007-10-20 20:12:58 +02:00
|
|
|
cmp ebx, 4 ; connection open?
|
|
|
|
jne still ; no, so ignore key
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
shr eax,8
|
2007-10-20 20:12:58 +02:00
|
|
|
cmp eax,178 ; ARROW KEYS
|
2006-01-03 10:43:31 +01:00
|
|
|
jne noaup
|
|
|
|
mov al,'A'
|
|
|
|
call arrow
|
|
|
|
jmp still
|
|
|
|
noaup:
|
|
|
|
cmp eax,177
|
|
|
|
jne noadown
|
|
|
|
mov al,'B'
|
|
|
|
call arrow
|
|
|
|
jmp still
|
|
|
|
noadown:
|
|
|
|
cmp eax,179
|
|
|
|
jne noaright
|
|
|
|
mov al,'C'
|
|
|
|
call arrow
|
|
|
|
jmp still
|
|
|
|
noaright:
|
|
|
|
cmp eax,176
|
|
|
|
jne noaleft
|
|
|
|
mov al,'D'
|
|
|
|
call arrow
|
|
|
|
jmp still
|
|
|
|
noaleft:
|
|
|
|
modem_out:
|
|
|
|
|
|
|
|
call to_modem
|
|
|
|
|
|
|
|
jmp still
|
|
|
|
|
2007-10-20 20:12:58 +02:00
|
|
|
button: ; BUTTON
|
2006-01-03 10:43:31 +01:00
|
|
|
mov eax,17
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2007-10-20 20:12:58 +02:00
|
|
|
cmp ah,1 ; CLOSE PROGRAM
|
2006-01-03 10:43:31 +01:00
|
|
|
jne noclose
|
|
|
|
|
|
|
|
mov eax,53
|
|
|
|
mov ebx,8
|
|
|
|
mov ecx,[socket]
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2007-05-10 15:48:35 +02:00
|
|
|
or eax,-1
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
noclose:
|
2007-10-20 20:12:58 +02:00
|
|
|
cmp ah, 2 ; Set IP
|
2006-01-03 10:43:31 +01:00
|
|
|
jne notip
|
|
|
|
|
|
|
|
mov [string_x], dword 78
|
|
|
|
mov [string_y], dword 276
|
|
|
|
mov [string_length], dword 15
|
|
|
|
call read_string
|
|
|
|
mov esi,string-1
|
|
|
|
mov edi,ip_address
|
|
|
|
xor eax,eax
|
|
|
|
ip1:
|
|
|
|
inc esi
|
|
|
|
cmp [esi],byte '0'
|
2007-10-20 20:12:58 +02:00
|
|
|
jb ip2
|
2006-01-03 10:43:31 +01:00
|
|
|
cmp [esi],byte '9'
|
2007-10-20 20:12:58 +02:00
|
|
|
jg ip2
|
2006-01-03 10:43:31 +01:00
|
|
|
imul eax,10
|
|
|
|
movzx ebx,byte [esi]
|
|
|
|
sub ebx,48
|
|
|
|
add eax,ebx
|
|
|
|
jmp ip1
|
|
|
|
ip2:
|
|
|
|
mov [edi],al
|
|
|
|
xor eax,eax
|
|
|
|
inc edi
|
|
|
|
cmp edi,ip_address+3
|
|
|
|
jbe ip1
|
|
|
|
call draw_window
|
|
|
|
|
|
|
|
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
notip:
|
2007-10-20 20:12:58 +02:00
|
|
|
cmp ah, 3 ; set port
|
2006-01-03 10:43:31 +01:00
|
|
|
jne notport
|
|
|
|
|
|
|
|
mov [string_x], dword 215
|
|
|
|
mov [string_y], dword 276
|
|
|
|
mov [string_length], dword 4
|
|
|
|
call read_string
|
|
|
|
mov esi,string-1
|
|
|
|
mov edi,port
|
|
|
|
xor eax,eax
|
|
|
|
ip11:
|
|
|
|
inc esi
|
|
|
|
cmp [esi],byte '0'
|
2007-10-20 20:12:58 +02:00
|
|
|
jb ip21
|
2006-01-03 10:43:31 +01:00
|
|
|
cmp [esi],byte '9'
|
2007-10-20 20:12:58 +02:00
|
|
|
jg ip21
|
2006-01-03 10:43:31 +01:00
|
|
|
imul eax,10
|
|
|
|
movzx ebx,byte [esi]
|
|
|
|
sub ebx,48
|
|
|
|
add eax,ebx
|
|
|
|
jmp ip11
|
|
|
|
ip21:
|
|
|
|
mov [edi],al
|
|
|
|
inc edi
|
|
|
|
mov [edi],ah
|
|
|
|
call draw_window
|
|
|
|
|
|
|
|
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
notport:
|
2007-10-20 20:12:58 +02:00
|
|
|
cmp ah, 4 ; connect
|
2006-01-03 10:43:31 +01:00
|
|
|
jne notcon
|
|
|
|
|
|
|
|
mov eax, [socket_status]
|
|
|
|
cmp eax, 4
|
2007-10-20 20:12:58 +02:00
|
|
|
je still
|
2006-01-03 10:43:31 +01:00
|
|
|
call connect
|
|
|
|
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
notcon:
|
2007-10-20 20:12:58 +02:00
|
|
|
cmp ah,5 ; disconnect
|
2006-01-03 10:43:31 +01:00
|
|
|
jne notdiscon
|
|
|
|
|
|
|
|
call disconnect
|
|
|
|
jmp still
|
|
|
|
|
2007-10-20 20:12:58 +02:00
|
|
|
notdiscon: ; Echo Toggle
|
2006-01-03 10:43:31 +01:00
|
|
|
cmp ah, 6
|
|
|
|
jne still
|
|
|
|
|
|
|
|
mov al, [echo]
|
|
|
|
not al
|
|
|
|
mov [echo], al
|
|
|
|
|
|
|
|
call draw_window
|
|
|
|
jmp still
|
|
|
|
|
|
|
|
arrow:
|
|
|
|
|
|
|
|
push eax
|
|
|
|
mov al,27
|
|
|
|
call to_modem
|
|
|
|
mov al,'['
|
|
|
|
call to_modem
|
|
|
|
pop eax
|
|
|
|
call to_modem
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
to_modem:
|
|
|
|
pusha
|
|
|
|
push ax
|
|
|
|
mov [tx_buff], al
|
|
|
|
mov edx, 1
|
|
|
|
cmp al, 13
|
|
|
|
jne tm_000
|
|
|
|
mov edx, 2
|
|
|
|
tm_000:
|
|
|
|
mov eax,53
|
|
|
|
mov ebx,7
|
|
|
|
mov ecx,[socket]
|
|
|
|
mov esi, tx_buff
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
pop bx
|
|
|
|
mov al, [echo]
|
|
|
|
cmp al, 0
|
2007-10-20 20:12:58 +02:00
|
|
|
je tm_001
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
push bx
|
|
|
|
call handle_data
|
|
|
|
pop bx
|
|
|
|
|
|
|
|
cmp bl, 13
|
|
|
|
jne tm_002
|
|
|
|
|
|
|
|
mov bl, 10
|
|
|
|
call handle_data
|
|
|
|
|
|
|
|
tm_002:
|
|
|
|
call draw_text
|
|
|
|
|
|
|
|
tm_001:
|
|
|
|
popa
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
disconnect:
|
|
|
|
mov eax,53
|
|
|
|
mov ebx,8
|
|
|
|
mov ecx,[socket]
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
connect:
|
|
|
|
pusha
|
|
|
|
|
2007-10-20 20:12:58 +02:00
|
|
|
mov ecx, 1000 ; local port starting at 1000
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
getlp:
|
2007-10-20 20:12:58 +02:00
|
|
|
inc ecx
|
2006-01-03 10:43:31 +01:00
|
|
|
push ecx
|
2007-10-20 20:12:58 +02:00
|
|
|
mov eax, 53
|
|
|
|
mov ebx, 9
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2007-10-20 20:12:58 +02:00
|
|
|
pop ecx
|
|
|
|
cmp eax, 0 ; is this local port in use?
|
|
|
|
jz getlp ; yes - so try next
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
mov eax,53
|
|
|
|
mov ebx,5
|
|
|
|
mov dl, [ip_address + 3]
|
|
|
|
shl edx, 8
|
|
|
|
mov dl, [ip_address + 2]
|
|
|
|
shl edx, 8
|
|
|
|
mov dl, [ip_address + 1]
|
|
|
|
shl edx, 8
|
|
|
|
mov dl, [ip_address]
|
|
|
|
mov esi, edx
|
2007-10-20 20:12:58 +02:00
|
|
|
movzx edx, word [port] ; telnet port id
|
2006-01-03 10:43:31 +01:00
|
|
|
mov edi,1 ; active open
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
mov [socket], eax
|
|
|
|
|
|
|
|
popa
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; *********************************************
|
|
|
|
; ******* WINDOW DEFINITIONS AND DRAW ********
|
|
|
|
; *********************************************
|
|
|
|
|
|
|
|
|
|
|
|
draw_window:
|
|
|
|
|
|
|
|
pusha
|
|
|
|
|
|
|
|
mov eax,12
|
|
|
|
mov ebx,1
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2007-10-20 20:12:58 +02:00
|
|
|
xor eax,eax ; DRAW WINDOW
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ebx,100*65536+491 + 8 +15
|
|
|
|
mov ecx,100*65536+270 + 20 ; 20 for status bar
|
2007-10-20 20:12:58 +02:00
|
|
|
mov edx,0x14000000
|
2007-05-10 15:48:35 +02:00
|
|
|
mov edi,title
|
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
; draw status bar
|
|
|
|
mov eax, 13
|
|
|
|
mov ebx, 4*65536+484 + 8 +15
|
|
|
|
mov ecx, 270*65536 + 3
|
|
|
|
mov edx, 0x00557799
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2007-10-20 20:12:58 +02:00
|
|
|
mov eax,8 ; BUTTON 2: SET IP
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ebx,4*65536+70
|
|
|
|
mov ecx,273*65536+12
|
|
|
|
mov esi, 0x00557799
|
|
|
|
mov edx,2
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2007-10-20 20:12:58 +02:00
|
|
|
mov eax,4 ; Button text
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ebx,6*65536+276
|
|
|
|
mov ecx,0x00ffffff
|
|
|
|
mov edx,setipt
|
|
|
|
mov esi,setiplen-setipt
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
2007-05-10 15:48:35 +02:00
|
|
|
mov eax,47
|
2007-10-20 20:12:58 +02:00
|
|
|
mov edi,ip_address ; display IP address
|
2006-01-03 10:43:31 +01:00
|
|
|
mov edx,78*65536+276
|
|
|
|
mov esi,0x00ffffff
|
|
|
|
mov ebx,3*65536
|
|
|
|
ipdisplay:
|
|
|
|
movzx ecx,byte [edi]
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
add edx,6*4*65536
|
|
|
|
inc edi
|
|
|
|
cmp edi,ip_address+4
|
2007-10-20 20:12:58 +02:00
|
|
|
jb ipdisplay
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2007-10-20 20:12:58 +02:00
|
|
|
mov eax,8 ; BUTTON 3: SET PORT
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ebx,173*65536+38
|
|
|
|
mov ecx,273*65536+12
|
|
|
|
mov edx,3
|
|
|
|
mov esi, 0x00557799
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2007-10-20 20:12:58 +02:00
|
|
|
mov eax,4 ; Button text
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ebx,178*65536+276
|
|
|
|
mov ecx,0x00ffffff
|
|
|
|
mov edx,setportt
|
|
|
|
mov esi,setportlen-setportt
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
2007-10-20 20:12:58 +02:00
|
|
|
mov edx,216*65536+276 ; display port
|
2006-01-03 10:43:31 +01:00
|
|
|
mov esi,0x00ffffff
|
|
|
|
mov ebx,4*65536
|
|
|
|
mov eax,47
|
|
|
|
movzx ecx,word [port]
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2007-10-20 20:12:58 +02:00
|
|
|
mov eax,8 ; BUTTON 4: Connect
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ebx,250*65536+50
|
|
|
|
mov ecx,273*65536+12
|
|
|
|
mov esi, 0x00557799
|
|
|
|
mov edx,4
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
2007-10-20 20:12:58 +02:00
|
|
|
mov eax,4 ; Button text
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ebx,255*65536+276
|
|
|
|
mov ecx,0x00ffffff
|
|
|
|
mov edx,cont
|
|
|
|
mov esi,conlen-cont
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
2007-10-20 20:12:58 +02:00
|
|
|
mov eax,8 ; BUTTON 5: disconnect
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ebx,303*65536+70
|
|
|
|
mov ecx,273*65536+12
|
|
|
|
mov edx,5
|
|
|
|
mov esi, 0x00557799
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
2007-10-20 20:12:58 +02:00
|
|
|
mov eax,4 ; Button text
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ebx,307*65536+276
|
|
|
|
mov ecx,0x00ffffff
|
|
|
|
mov edx,dist
|
|
|
|
mov esi,dislen-dist
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
2007-10-20 20:12:58 +02:00
|
|
|
mov esi,contlen-contt ; display connected status
|
2006-01-03 10:43:31 +01:00
|
|
|
mov edx, contt
|
|
|
|
mov eax, [socket_status]
|
2007-10-20 20:12:58 +02:00
|
|
|
cmp eax, 4 ; 4 is connected
|
|
|
|
je pcon
|
2006-01-03 10:43:31 +01:00
|
|
|
mov esi,discontlen-discontt
|
|
|
|
mov edx, discontt
|
|
|
|
pcon:
|
|
|
|
|
2007-10-20 20:12:58 +02:00
|
|
|
mov eax,4 ; status text
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ebx,380*65536+276
|
|
|
|
mov ecx,0x00ffffff
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
2007-10-20 20:12:58 +02:00
|
|
|
mov eax,8 ; BUTTON 6: echo
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ebx,460*65536+50
|
|
|
|
mov ecx,273*65536+12
|
|
|
|
mov edx,6
|
|
|
|
mov esi, 0x00557799
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
mov edx,echot
|
|
|
|
mov esi,echolen-echot
|
|
|
|
mov al, [echo]
|
|
|
|
cmp al, 0
|
|
|
|
jne peo
|
|
|
|
mov edx,echoot
|
|
|
|
mov esi,echoolen-echoot
|
|
|
|
|
|
|
|
peo:
|
2007-10-20 20:12:58 +02:00
|
|
|
mov eax,4 ; Button text
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ebx,463*65536+276
|
|
|
|
mov ecx,0x00ffffff
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
|
|
|
|
xor eax,eax
|
|
|
|
mov edi,text+80*30
|
|
|
|
mov ecx,80*30 /4
|
|
|
|
cld
|
|
|
|
rep stosd
|
|
|
|
|
|
|
|
call draw_text
|
|
|
|
|
|
|
|
mov eax,12
|
|
|
|
mov ebx,2
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
popa
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
draw_text:
|
|
|
|
|
|
|
|
pusha
|
|
|
|
|
|
|
|
mov esi,text
|
|
|
|
mov eax,0
|
|
|
|
mov ebx,0
|
|
|
|
newletter:
|
|
|
|
mov cl,[esi]
|
|
|
|
cmp cl,[esi+30*80]
|
|
|
|
jne yesletter
|
|
|
|
jmp noletter
|
|
|
|
yesletter:
|
|
|
|
mov [esi+30*80],cl
|
|
|
|
|
|
|
|
; erase character
|
|
|
|
|
|
|
|
pusha
|
2007-10-20 20:12:58 +02:00
|
|
|
mov edx, 0 ; bg colour
|
2006-01-03 10:43:31 +01:00
|
|
|
mov ecx, ebx
|
|
|
|
add ecx, 26
|
|
|
|
shl ecx, 16
|
|
|
|
mov cx, 9
|
|
|
|
mov ebx, eax
|
|
|
|
add ebx, 6
|
|
|
|
shl ebx, 16
|
|
|
|
mov bx, 6
|
|
|
|
mov eax, 13
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
popa
|
|
|
|
|
|
|
|
; draw character
|
|
|
|
|
|
|
|
pusha
|
|
|
|
mov ecx, 0x00ffffff
|
|
|
|
push bx
|
|
|
|
mov ebx,eax
|
|
|
|
add ebx,6
|
|
|
|
shl ebx,16
|
|
|
|
pop bx
|
|
|
|
add bx,26
|
|
|
|
mov eax,4
|
|
|
|
mov edx,esi
|
|
|
|
mov esi,1
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
popa
|
|
|
|
|
|
|
|
noletter:
|
|
|
|
|
|
|
|
add esi,1
|
|
|
|
add eax,6
|
|
|
|
cmp eax,80*6
|
2007-10-20 20:12:58 +02:00
|
|
|
jb newletter
|
2006-01-03 10:43:31 +01:00
|
|
|
mov eax,0
|
|
|
|
add ebx,10
|
|
|
|
cmp ebx,24*10
|
2007-10-20 20:12:58 +02:00
|
|
|
jb newletter
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
popa
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
read_string:
|
|
|
|
|
|
|
|
mov edi,string
|
|
|
|
mov eax,'_'
|
|
|
|
mov ecx,[string_length]
|
|
|
|
inc ecx
|
|
|
|
cld
|
|
|
|
rep stosb
|
|
|
|
call print_text
|
|
|
|
|
|
|
|
mov edi,string
|
|
|
|
f11:
|
|
|
|
mov eax,10
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
cmp eax,2
|
|
|
|
jne read_done
|
|
|
|
mov eax,2
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
shr eax,8
|
|
|
|
cmp eax,13
|
2007-10-20 20:12:58 +02:00
|
|
|
je read_done
|
2006-01-03 10:43:31 +01:00
|
|
|
cmp eax,8
|
|
|
|
jnz nobsl
|
|
|
|
cmp edi,string
|
2007-10-20 20:12:58 +02:00
|
|
|
jz f11
|
2006-01-03 10:43:31 +01:00
|
|
|
sub edi,1
|
|
|
|
mov [edi],byte '_'
|
|
|
|
call print_text
|
|
|
|
jmp f11
|
|
|
|
nobsl:
|
|
|
|
cmp eax,dword 31
|
|
|
|
jbe f11
|
|
|
|
cmp eax,dword 95
|
2007-10-20 20:12:58 +02:00
|
|
|
jb keyok
|
2006-01-03 10:43:31 +01:00
|
|
|
sub eax,32
|
|
|
|
keyok:
|
|
|
|
mov [edi],al
|
|
|
|
call print_text
|
|
|
|
|
|
|
|
inc edi
|
|
|
|
mov esi,string
|
|
|
|
add esi,[string_length]
|
|
|
|
cmp esi,edi
|
|
|
|
jnz f11
|
|
|
|
|
|
|
|
read_done:
|
|
|
|
|
|
|
|
call print_text
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
print_text:
|
|
|
|
|
|
|
|
pusha
|
|
|
|
|
|
|
|
mov eax,13
|
|
|
|
mov ebx,[string_x]
|
|
|
|
shl ebx,16
|
|
|
|
add ebx,[string_length]
|
|
|
|
imul bx,6
|
|
|
|
mov ecx,[string_y]
|
|
|
|
shl ecx,16
|
|
|
|
mov cx,8
|
|
|
|
mov edx,0x00000000
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
mov eax,4
|
|
|
|
mov ebx,[string_x]
|
|
|
|
shl ebx,16
|
|
|
|
add ebx,[string_y]
|
|
|
|
mov ecx,0x00ffffff
|
|
|
|
mov edx,string
|
|
|
|
mov esi,[string_length]
|
2007-05-10 15:48:35 +02:00
|
|
|
mcall
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
popa
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; DATA AREA
|
|
|
|
|
2007-10-20 20:12:58 +02:00
|
|
|
telnetrep db 0xff,0xfc,0x00
|
|
|
|
telnetstate db 0
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
|
|
string_length dd 16
|
|
|
|
string_x dd 200
|
|
|
|
string_y dd 60
|
|
|
|
|
2007-10-20 20:12:58 +02:00
|
|
|
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: . . .'
|
2006-01-03 10:43:31 +01:00
|
|
|
setiplen:
|
2007-10-20 20:12:58 +02:00
|
|
|
setportt db 'Port:'
|
2006-01-03 10:43:31 +01:00
|
|
|
setportlen:
|
2007-10-20 20:12:58 +02:00
|
|
|
cont db 'Connect'
|
2006-01-03 10:43:31 +01:00
|
|
|
conlen:
|
2007-10-20 20:12:58 +02:00
|
|
|
dist db 'Disconnect'
|
2006-01-03 10:43:31 +01:00
|
|
|
dislen:
|
2007-10-20 20:12:58 +02:00
|
|
|
contt db 'Connected'
|
2006-01-03 10:43:31 +01:00
|
|
|
contlen:
|
2007-10-20 20:12:58 +02:00
|
|
|
discontt db 'Disconnected'
|
2006-01-03 10:43:31 +01:00
|
|
|
discontlen:
|
2007-10-20 20:12:58 +02:00
|
|
|
echot db 'Echo On'
|
2006-01-03 10:43:31 +01:00
|
|
|
echolen:
|
2007-10-20 20:12:58 +02:00
|
|
|
echoot db 'Echo Off'
|
2006-01-03 10:43:31 +01:00
|
|
|
echoolen:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
text:
|
|
|
|
I_END:
|