131,29 → 131,8 |
|
mcall 40, 1 shl 7 ; network event |
|
; eth.set_network_drv 0x00000383 |
|
DEBUGF 1,">Zero-config service:\n" |
|
; eth.status eax ; Read the Stack status |
; test eax,eax ; if eax is zero, no driver was found |
; jnz @f |
; DEBUGF 1,"No Card found!\n" |
; jmp close |
|
; @@: |
; DEBUGF 1,"Detected card: %x\n",eax |
; @@: |
; eth.check_cable eax |
; test al,al |
; jnz @f |
; DEBUGF 1,"Cable disconnected!\n" |
; mcall 5, 500 ; loop until cable is connected (check every 5 sec) |
; jmp @r |
|
; @@: |
; eth.read_mac MAC |
|
mcall 75, 1337 shl 16 + 4 |
|
cmp eax, -1 |
254,6 → 233,7 |
test eax,eax |
jz apipa |
|
;;; todo: skip this bullcrap |
|
mov edi, eax |
mov ecx,BUFFER |
261,12 → 241,14 |
cld |
rep stosb |
|
;; todo: put this in a buffer instead of writing bytes and words! |
|
mov edx,[dhcpMsg] |
|
mov [edx], byte 0x01 ; Boot request |
mov [edx+1], byte 0x01 ; Ethernet |
mov [edx+2], byte 0x06 ; Ethernet h/w len |
mov [edx+4], dword 0x11223344 ; xid |
mov [edx+4], dword 0x11223344 ; xid ;;;;;;; |
mov eax,[currTime] |
mov [edx+8], eax ; secs, our uptime |
mov [edx+10], byte 0x80 ; broadcast flag set |
274,7 → 256,7 |
mov [edx+28],dword eax |
mov ax, word [MAC+4] ; last 2 bytes of MAC |
mov [edx+32],word ax |
mov [edx+236], dword 0x63538263 ; magic number |
mov [edx+236], dword 0x63538263 ; magic cookie |
mov [edx+240], word 0x0135 ; option DHCP msg type |
mov al, [dhcpMsgType] |
mov [edx+240+2], al |
313,7 → 295,6 |
mcall 23, TIMEOUT*10 ; wait for data |
|
read_data: ; we have data - this will be the response |
|
mcall 74, 7, [socketNum], [dhcpMsg], BUFFER ; read data from socket |
|
DEBUGF 1,"->%d bytes received\n", eax |
464,7 → 445,7 |
pr_exit: |
|
; DEBUGF 1,"Sending ARP announce\n" |
; eth.ARP_ANNOUNCE [dhcpClientIP] ; send an ARP announce packet |
;;; |
|
jmp close |
|
572,7 → 553,7 |
sockaddr1: |
|
dw AF_INET4 |
dw 68 shl 8 ; local port |
dw 68 ; local port |
dd 0 ; local IP |
|
rb 10 |
581,7 → 562,7 |
sockaddr2: |
|
dw AF_INET4 |
dw 67 shl 8 ; destination port |
dw 67 ; destination port |
dd -1 ; destination IP |
|
rb 10 |