Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 109 → Rev 485

/programs/network/dhcp/trunk/macros.inc
File deleted
\ No newline at end of file
Property changes:
Deleted: svn:eol-style
-native
\ No newline at end of property
/programs/network/dhcp/trunk/build_en.bat
1,4 → 1,5
@erase lang.inc
@echo lang fix en >lang.inc
@fasm dhcp.asm dhcp
@erase lang.inc
@pause
/programs/network/dhcp/trunk/build_ru.bat
1,4 → 1,5
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm dhcp.asm dhcp
@erase lang.inc
@pause
/programs/network/dhcp/trunk/dhcp.asm
5,18 → 5,19
;
 
include 'lang.inc'
include 'macros.inc'
include '..\..\..\macros.inc'
 
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
db 'MENUET01' ; 8 byte id
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd I_END+0x8000 ; memory for app
dd I_END+0x8000 ; esp
dd 0x0 , 0x0 ; I_Param , I_Icon
 
 
START: ; start of execution
24,11 → 25,12
mov ebx,10000111b ; Stack 8 + defaults
int 0x40
 
red: ; redraw
call draw_window ; at first, draw the window
 
still:
mov eax,10 ; wait here for event
int 0x40
mcall
 
cmp eax,1 ; redraw request ?
jz red
38,19 → 40,14
jz button
 
jmp still
 
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
int 0x40
mcall
jmp still
 
button: ; button
mov eax,17 ; get id
int 0x40
mcall
 
cmp ah,1 ; button id=1 ?
jnz noclose
59,10 → 56,10
mov eax, 53
mov ebx, 1
mov ecx, [socketNum]
int 0x40
mcall
 
mov eax,0xffffffff ; close this program
int 0x40
mcall
 
noclose:
cmp ah,3 ; Resolve address?
246,7 → 243,7
mov ecx, 68 ; local port dhcp client
mov edx, 67 ; remote port - dhcp server
mov esi, 0xffffffff ; broadcast
int 0x40
mcall
 
mov [socketNum], eax
 
265,7 → 262,7
mov ecx, [socketNum]
mov edx, [dhcpMsgLen]
mov esi, dhcpMsg
int 0x40
mcall
 
; Setup the DHCP buffer to receive response
 
279,7 → 276,7
 
ctr001:
mov eax,10 ; wait here for event
int 0x40
mcall
 
cmp eax,1 ; redraw request ?
je ctr003
293,7 → 290,7
mov eax, 53
mov ebx, 2
mov ecx, [socketNum]
int 0x40
mcall
 
cmp eax, 0
je ctr001
303,7 → 300,7
mov eax, 53
mov ebx, 3
mov ecx, [socketNum]
int 0x40 ; read byte - block (high byte)
mcall ; read byte - block (high byte)
 
; Store the data in the response buffer
mov eax, [dhcpMsgLen]
313,7 → 310,7
mov eax, 53
mov ebx, 2
mov ecx, [socketNum]
int 0x40 ; any more data?
mcall ; any more data?
 
cmp eax, 0
jne ctr002 ; yes, so get it
365,7 → 362,7
mov eax, 53
mov ebx, 1
mov ecx, [socketNum]
int 0x40
mcall
 
mov [socketNum], dword 0xFFFF
 
379,18 → 376,18
 
ctr004: ; key
mov eax,2 ; just read it and ignore
int 0x40
mcall
jmp ctr001
 
ctr005: ; button
mov eax,17 ; get id
int 0x40
mcall
 
; close socket
mov eax, 53
mov ebx, 1
mov ecx, [socketNum]
int 0x40
mcall
 
mov [socketNum], dword 0xFFFF
 
421,7 → 418,7
mov eax,47
push ecx
movzx ecx,byte [edi]
int 0x40
mcall
pop ecx
add edx,6*4*65536
inc edi
477,7 → 474,7
add edx,1*65536+99
mov ecx,[esp+20]
mov esi,0xffffff
int 0x40
mcall
popa
sub ecx,4
ret
487,22 → 484,14
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,1 ; 1, start of draw
int 0x40
mcall
; DRAW WINDOW
mov eax,0 ; function 0 : define and draw window
mov ebx,100*65536+300 ; [x start] *65536 + [x size]
mov ecx,100*65536+156 ; [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
int 0x40
mov edx,0x13224466 ; color of work area RRGGBB
mov edi,title ; WINDOW LABEL
mcall
 
mov eax,8 ; Resolve
mov ebx,20*65536+90
509,7 → 498,7
mov ecx,127*65536+15
mov edx,3
mov esi,0x557799
int 0x40
mcall
 
; Pass in the IP address in edi
; row to display in [ya]
534,14 → 523,13
 
; Re-draw the screen text
cld
mov eax,4
mov ebx,25*65536+35 ; draw info text with function 4
mov ecx,0xffffff
mov edx,text
mov esi,40
 
newline:
mov eax,4
int 0x40
mcall
add ebx,16
add edx,40
cmp [edx],byte 'x'
550,7 → 538,7
 
mov eax,12 ; function 12:tell os about windowdraw
mov ebx,2 ; 2, end of draw
int 0x40
mcall
 
ret
 
574,8 → 562,7
dhms db ' d h m s'
forever db 'Forever '
 
labelt: db 'DHCP Client Test'
labellen:
title db 'DHCP Client Test',0
 
dhcpMsgType: db 0
dhcpLease: dd 0