Subversion Repositories Kolibri OS

Compare Revisions

Ignore whitespace Rev 663 → Rev 664

/programs/network/stackcfg/trunk/stackcfg.asm
8,69 → 8,69
 
 
memsize = 100000h
org 0
PARAMS = memsize - 1024
org 0
PARAMS = memsize - 1024
 
use32
 
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd memsize ; memory for app
dd memsize - 1024 ; esp
dd PARAMS , 0x0 ; I_Param , I_Icon
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd memsize ; memory for app
dd memsize - 1024 ; esp
dd PARAMS , 0x0 ; I_Param , I_Icon
 
include 'lang.inc'
include '..\..\..\macros.inc'
include 'macros.inc'
 
START: ; start of execution
START: ; start of execution
 
cmp [PARAMS], dword 'BOOT'
jz boot_set_settings
jz boot_set_settings
 
no_params:
 
red:
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
mcall
 
cmp eax,1 ; redraw request ?
jz red
cmp eax,2 ; key in buffer ?
cmp eax,1 ; redraw request ?
jz red
cmp eax,2 ; key in buffer ?
jnz button
 
key: ; key
key: ; key
; mov al,2 ; just read it and ignore
mcall
jmp still
 
button: ; button
mov al,17 ; get id
button: ; button
mov al,17 ; get id
mcall
 
shr eax,8
 
dec eax ; button id=1 ?
dec eax ; button id=1 ?
jne noclose
or eax,-1 ; close this program
or eax,-1 ; close this program
mcall
noclose:
 
dec eax
je read_stack_setup
dec eax
je read_stack_setup
 
dec eax
dec eax
jne no_apply_stack_setup
call apply_stack_setup
jmp still
 
no_apply_stack_setup:
dec eax ; GET COM PORT
dec eax ; GET COM PORT
dec eax
jne no_read_comport
mov [string_x],272
79,7 → 79,7
call read_string
movzx eax,byte [string]
cmp eax,'A'
jb gcp1
jb gcp1
sub eax,'A'-'9'-1
gcp1:
sub eax,48
87,7 → 87,7
mov ebx,eax
movzx eax,byte [string+1]
cmp eax,'A'
jb gcp2
jb gcp2
sub eax,'A'-'9'-1
gcp2:
sub eax,48
95,7 → 95,7
add ebx,eax
movzx eax,byte [string+2]
cmp eax,'A'
jb gcp3
jb gcp3
sub eax,'A'-'9'-1
gcp3:
sub eax,48
104,7 → 104,7
jmp red
no_read_comport:
 
dec eax ; GET COM IRQ
dec eax ; GET COM IRQ
jne no_read_comirq
mov [string_x],284
mov [string_y],50
112,7 → 112,7
call read_string
movzx eax,byte [string]
cmp eax,'A'
jb gci1
jb gci1
sub eax,'A'-'9'-1
gci1:
sub eax,48
120,7 → 120,7
jmp red
no_read_comirq:
 
dec eax ; GET IP
dec eax ; GET IP
jne no_read_ip
mov [string_x],205
mov [string_y],80
133,9 → 133,9
ip1:
inc esi
cmp [esi],byte '0'
jb ip2
jb ip2
cmp [esi],byte '9'
jg ip2
jg ip2
imul eax,10
movzx ebx,byte [esi]
sub ebx,48
147,8 → 147,8
jbe ip0
jmp red
no_read_ip:
dec eax ; set gateway ip
 
dec eax ; set gateway ip
jne no_set_gateway
 
mov [string_x],205
162,9 → 162,9
gip1:
inc esi
cmp [esi],byte '0'
jb gip2
jb gip2
cmp [esi],byte '9'
jg gip2
jg gip2
imul eax,10
movzx ebx,byte [esi]
sub ebx,48
192,9 → 192,9
sip1:
inc esi
cmp [esi],byte '0'
jb sip2
jb sip2
cmp [esi],byte '9'
jg sip2
jg sip2
imul eax,10
movzx ebx,byte [esi]
sub ebx,48
221,9 → 221,9
dip1:
inc esi
cmp [esi],byte '0'
jb dip2
jb dip2
cmp [esi],byte '9'
jg dip2
jg dip2
imul eax,10
movzx ebx,byte [esi]
sub ebx,48
238,17 → 238,17
no_set_dns:
 
dec eax
jb no_set_interface
jb no_set_interface
cmp eax,14-11
ja no_set_interface
ja no_set_interface
mov [interface],eax
jmp red
no_set_interface:
 
sub eax,21-11
jb no_ip_sf
jb no_ip_sf
cmp eax,22-21
ja no_ip_sf
ja no_ip_sf
xor eax,1
mov [assigned],eax
jmp red
282,21 → 282,21
mcall
mov dword [dns_ip],eax
 
mov eax,[config] ; unwrap com IRQ
mov eax,[config] ; unwrap com IRQ
shr eax,8
and eax,0xf
mov [com_irq],eax
 
mov eax,[config] ; unwrap com PORT
mov eax,[config] ; unwrap com PORT
shr eax,16
and eax,0xfff
mov [com_add],eax
 
mov eax,[config] ; unwrap IRQ
mov eax,[config] ; unwrap IRQ
and eax,0xf
mov [interface],eax
 
mov eax,[config] ; unwrap com PORT
mov eax,[config] ; unwrap com PORT
shr eax,7
and eax,1
mov [assigned],eax
347,7 → 347,7
string_x dd 200
string_y dd 60
 
string db '________________'
string db '________________'
 
 
read_string:
369,11 → 369,11
mcall
shr eax,8
cmp eax,13
je read_done
je read_done
cmp eax,8
jnz nobsl
cmp edi,string
jz f11
jz f11
sub edi,1
mov [edi],byte '_'
call print_text
382,7 → 382,7
cmp eax,dword 31
jbe f11
cmp eax,dword 95
jb keyok
jb keyok
sub eax,32
keyok:
mov [edi],al
436,20 → 436,20
 
draw_window:
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
mcall
 
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx,100*65536+330 ; [x start] *65536 + [x size]
mov ecx,100*65536+157 ; [y start] *65536 + [y size]
mov edx,0x14ffffff ; color of work area RRGGBB,8->color gl
mov edi,title ; WINDOW LABEL
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx,100*65536+330 ; [x start] *65536 + [x size]
mov ecx,100*65536+157 ; [y start] *65536 + [y size]
mov edx,0x14ffffff ; color of work area RRGGBB,8->color gl
mov edi,title ; WINDOW LABEL
mcall
 
mov eax,8 ; BUTTON : READ SETUP
 
mov eax,8 ; BUTTON : READ SETUP
mov ebx,90*65536+65
mov ecx,127*65536+12
mov edx,2
471,9 → 471,9
add ecx,10*65536
inc edx
cmp edx,11+4
jb interface_select
jb interface_select
 
mov ebx,[interface] ; PRINT SELECTED INTERFACE 'X'
mov ebx,[interface] ; PRINT SELECTED INTERFACE 'X'
imul ebx,10
add ebx,31*65536+39
mov eax,4
482,7 → 482,7
mov esi,1
mcall
 
mov eax,8 ; BUTTONS 21-22 : SERVER / MANUAL IP
mov eax,8 ; BUTTONS 21-22 : SERVER / MANUAL IP
mov ebx,143*65536+8
mov ecx,69*65536+8
mov edx,21
493,7 → 493,7
mov ecx,79*65536+8
mov edx,22
mcall
mov ebx,[assigned] ; PRINT SELECTED SERVER/MANUAL 'X'
mov ebx,[assigned] ; PRINT SELECTED SERVER/MANUAL 'X'
not ebx
and ebx,1
imul ebx,10
504,7 → 504,7
mov esi,1
mcall
 
mov eax,47 ; COM ADDRESS
mov eax,47 ; COM ADDRESS
mov ebx,3*65536+1*256
mov ecx,[com_add]
mov edx,272*65536+40
529,7 → 529,7
add edx,6*4*65536
inc edi
cmp edi,ip_address+4
jb ipdisplay
jb ipdisplay
 
mov edi,gateway_ip
mov edx,205*65536+90
542,7 → 542,7
add edx,6*4*65536
inc edi
cmp edi,gateway_ip+4
jb gipdisplay
jb gipdisplay
 
mov edi,subnet_mask
mov edx,205*65536+100
555,7 → 555,7
add edx,6*4*65536
inc edi
cmp edi,subnet_mask+4
jb sipdisplay
jb sipdisplay
 
mov edi,dns_ip
mov edx,205*65536+110
568,10 → 568,10
add edx,6*4*65536
inc edi
cmp edi,dns_ip+4
jb dipdisplay
jb dipdisplay
 
 
mov eax,8 ; BUTTON 5 : SET PORT
mov eax,8 ; BUTTON 5 : SET PORT
mov ebx,299*65536+8
mov ecx,39*65536+8
mov edx,5
602,7 → 602,7
inc edx
mcall
 
mov ebx,31*65536+40 ; draw info text with function 4
mov ebx,31*65536+40 ; draw info text with function 4
mov edx,text
mov esi,49
mov eax,4
619,8 → 619,8
cmp [edx],byte 'x'
jne 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
mcall
 
ret
634,18 → 634,18
mcall
mov [config],eax
 
shr eax,8 ; unwrap com IRQ
shr eax,8 ; unwrap com IRQ
and eax,0xf
mov [com_irq],eax
 
mov eax,[config] ; unwrap com PORT
mov eax,[config] ; unwrap com PORT
shr eax,16
and eax,0xfff
mov [com_add],eax
 
call apply_stack_setup
mov eax,-1 ; close this program
 
mov eax,-1 ; close this program
mcall
 
;******************************************************************************
653,7 → 653,23
 
; DATA AREA
 
if lang eq ru
title db ' áâனª  á¥â¥¢®£® á⥪ ',0
text:
db ' ¥ ªâ¨¢­ë© Œ®¤¥¬ ­  Com-¯®àâã: 0x < '
db ' Slip à¥à뢠­¨¥ ¬®¤¥¬ : 0x < '
db ' PPP '
db ' „à ©¢¥à ¯ ª¥â®¢ IP server ­ §­ ç¥­­ë© '
db ' ”¨ªá. . . . < '
db ' ˜«î§: . . . < '
db ' ®¤á¥âì: . . . < '
db ' DNS IP: . . . < '
db ' '
db 'w —¨â âì à¨¬¥­¨âì '
 
else
title db 'Stack configuration',0
text:
db ' Not active Modem Com Port: 0x < '
db ' Slip Modem Com Irq: 0x < '
db ' PPP '
664,27 → 680,26
db ' DNS IP: . . . < '
db ' '
db 'w READ APPLY '
end if
 
xx: db 'x' ;<- END MARKER, DONT DELETE
 
button_color dd 0x2254b9
 
title db 'STACK CONFIGURATION',0
 
 
;ENTER YOUR SETTINGS HERE:
 
ip_address db 010,005,004,175
gateway_ip db 010,005,000,001
subnet_mask db 255,255,000,000
dns_ip db 213,184,238,006
ip_address db 010,005,004,175
gateway_ip db 010,005,000,001
subnet_mask db 255,255,000,000
dns_ip db 213,184,238,006
 
 
com_irq dd 0 ; irq for slip/ppp
com_add dd 0 ; com port address for slip/ppp
interface dd 3 ; not active,slip,ppp,packet driver
assigned dd 0 ; get ip from server
com_irq dd 0 ; irq for slip/ppp
com_add dd 0 ; com port address for slip/ppp
interface dd 3 ; not active,slip,ppp,packet driver
assigned dd 0 ; get ip from server
 
config dd 0
config dd 0
 
I_END: