5,19 → 5,18 |
; |
|
include 'lang.inc' |
include '..\..\..\macros.inc' |
include 'macros.inc' |
|
use32 |
|
org 0x0 |
|
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 |
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 |
|
|
START: ; start of execution |
25,12 → 24,11 |
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 |
mcall |
int 0x40 |
|
cmp eax,1 ; redraw request ? |
jz red |
40,14 → 38,19 |
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 |
mcall |
int 0x40 |
jmp still |
|
button: ; button |
mov eax,17 ; get id |
mcall |
int 0x40 |
|
cmp ah,1 ; button id=1 ? |
jnz noclose |
56,10 → 59,10 |
mov eax, 53 |
mov ebx, 1 |
mov ecx, [socketNum] |
mcall |
int 0x40 |
|
mov eax,0xffffffff ; close this program |
mcall |
int 0x40 |
|
noclose: |
cmp ah,3 ; Resolve address? |
243,7 → 246,7 |
mov ecx, 68 ; local port dhcp client |
mov edx, 67 ; remote port - dhcp server |
mov esi, 0xffffffff ; broadcast |
mcall |
int 0x40 |
|
mov [socketNum], eax |
|
262,7 → 265,7 |
mov ecx, [socketNum] |
mov edx, [dhcpMsgLen] |
mov esi, dhcpMsg |
mcall |
int 0x40 |
|
; Setup the DHCP buffer to receive response |
|
276,7 → 279,7 |
|
ctr001: |
mov eax,10 ; wait here for event |
mcall |
int 0x40 |
|
cmp eax,1 ; redraw request ? |
je ctr003 |
290,7 → 293,7 |
mov eax, 53 |
mov ebx, 2 |
mov ecx, [socketNum] |
mcall |
int 0x40 |
|
cmp eax, 0 |
je ctr001 |
300,7 → 303,7 |
mov eax, 53 |
mov ebx, 3 |
mov ecx, [socketNum] |
mcall ; read byte - block (high byte) |
int 0x40 ; read byte - block (high byte) |
|
; Store the data in the response buffer |
mov eax, [dhcpMsgLen] |
310,7 → 313,7 |
mov eax, 53 |
mov ebx, 2 |
mov ecx, [socketNum] |
mcall ; any more data? |
int 0x40 ; any more data? |
|
cmp eax, 0 |
jne ctr002 ; yes, so get it |
362,7 → 365,7 |
mov eax, 53 |
mov ebx, 1 |
mov ecx, [socketNum] |
mcall |
int 0x40 |
|
mov [socketNum], dword 0xFFFF |
|
376,18 → 379,18 |
|
ctr004: ; key |
mov eax,2 ; just read it and ignore |
mcall |
int 0x40 |
jmp ctr001 |
|
ctr005: ; button |
mov eax,17 ; get id |
mcall |
int 0x40 |
|
; close socket |
mov eax, 53 |
mov ebx, 1 |
mov ecx, [socketNum] |
mcall |
int 0x40 |
|
mov [socketNum], dword 0xFFFF |
|
418,7 → 421,7 |
mov eax,47 |
push ecx |
movzx ecx,byte [edi] |
mcall |
int 0x40 |
pop ecx |
add edx,6*4*65536 |
inc edi |
474,7 → 477,7 |
add edx,1*65536+99 |
mov ecx,[esp+20] |
mov esi,0xffffff |
mcall |
int 0x40 |
popa |
sub ecx,4 |
ret |
484,14 → 487,22 |
|
mov eax,12 ; function 12:tell os about windowdraw |
mov ebx,1 ; 1, start of draw |
mcall |
int 0x40 |
; 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,0x13224466 ; color of work area RRGGBB |
mov edi,title ; WINDOW LABEL |
mcall |
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 eax,8 ; Resolve |
mov ebx,20*65536+90 |
498,7 → 509,7 |
mov ecx,127*65536+15 |
mov edx,3 |
mov esi,0x557799 |
mcall |
int 0x40 |
|
; Pass in the IP address in edi |
; row to display in [ya] |
523,13 → 534,14 |
|
; 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: |
mcall |
mov eax,4 |
int 0x40 |
add ebx,16 |
add edx,40 |
cmp [edx],byte 'x' |
538,7 → 550,7 |
|
mov eax,12 ; function 12:tell os about windowdraw |
mov ebx,2 ; 2, end of draw |
mcall |
int 0x40 |
|
ret |
|
562,7 → 574,8 |
dhms db ' d h m s' |
forever db 'Forever ' |
|
title db 'DHCP Client Test',0 |
labelt: db 'DHCP Client Test' |
labellen: |
|
dhcpMsgType: db 0 |
dhcpLease: dd 0 |