Subversion Repositories Kolibri OS

Rev

Rev 1206 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1200 hidnplayr 1
;
2
; ARPmanager for KolibriOS
3
;
4
; hidnplayr@gmail.com
5
;
6
 
7
use32
8
 
9
    org     0x0
10
 
11
    db	   'MENUET01'	     ; 8 byte id
12
    dd	   0x01 	     ; header version
13
    dd	   START	     ; start of code
14
    dd	   IM_END	     ; size of image
15
    dd	   (I_END+0x100)     ; memory for app
16
    dd	   (I_END+0x100)     ; esp
17
    dd	   I_PARAM , 0x0     ; I_Param , I_Icon
18
 
19
__DEBUG__ equ 1
20
__DEBUG_LEVEL__ equ 1
21
 
22
include '..\macros.inc'
23
include '..\debug-fdo.inc'
24
 
25
START:				       ; start of execution
26
    ; TODO: check Parameters
27
 
28
    DEBUGF 1, 'Hello!\n'
29
 
30
  redraw:
31
 
32
    mcall   12, 1
33
 
34
    mcall   0, 100 shl 16 + 520, 100 shl 16 + 240, 0x34bcbcbc, ,name
35
 
36
    mcall   4, 25 shl 16 + 31, 0x80000000, title
37
 
38
    mcall   12, 2
39
 
40
  draw_stats:
41
 
42
	mov	edx, 50 shl 16 + 50
1206 hidnplayr 43
	mov	[last],0
1200 hidnplayr 44
 
45
    .loop:
46
	mcall	75, 0x06080003, [last],,,ARP_ENTRY
47
	cmp	eax, -1
48
	je	mainloop
49
 
50
 
51
	mcall	4, edx, 0x80000000, str_entry
52
	mov	edx, ebx
53
 
54
	mov	eax, 47
55
	mov	ebx, 0x00030000
56
	mov	esi, 0x40000000
57
	mov	edi, 0x00bcbcbc
58
	xor	ecx, ecx
59
 
60
	mov	cl, byte[ARP_ENTRY.IP+0]
61
	mcall
62
 
63
	mov	cl, byte[ARP_ENTRY.IP+1]
64
	add	edx, 24 shl 16
65
	mcall
66
 
67
	mov	cl, byte[ARP_ENTRY.IP+2]
68
	add	edx, 24 shl 16
69
	mcall
70
 
71
	mov	cl, byte[ARP_ENTRY.IP+3]
72
	add	edx, 24 shl 16
73
	mcall
74
 
75
 
76
	mov	ebx, 0x00020100
77
	mov	cl, byte[ARP_ENTRY.MAC+0]
78
	add	edx, 36 shl 16
79
	mcall
80
 
81
	mov	cl, byte[ARP_ENTRY.MAC+1]
82
	add	edx, 18 shl 16
83
	mcall
84
 
85
	mov	cl, byte[ARP_ENTRY.MAC+2]
86
	add	edx, 18 shl 16
87
	mcall
88
 
89
	mov	cl, byte[ARP_ENTRY.MAC+3]
90
	add	edx, 18 shl 16
91
	mcall
92
 
93
	mov	cl, byte[ARP_ENTRY.MAC+4]
94
	add	edx, 18 shl 16
95
	mcall
96
 
97
	mov	cl, byte[ARP_ENTRY.MAC+5]
98
	add	edx, 18 shl 16
99
	mcall
100
 
101
	mov	ebx, 0x00040000
102
	mov	cx, [ARP_ENTRY.Status]
103
	add	edx, 30 shl 16
104
	mcall
105
 
106
	mov	cx, [ARP_ENTRY.TTL]
107
	add	edx, 60 shl 16
108
	mcall
109
 
110
	add	dx, 20
111
	rol	edx, 16
112
	mov	dx, 50
113
	rol	edx, 16
114
	inc	[last]
115
 
116
	jmp	.loop
117
 
1206 hidnplayr 118
  mainloop:
1200 hidnplayr 119
 
1206 hidnplayr 120
    mcall   23,50		   ; wait for event with timeout    (0,5 s)
121
 
122
    cmp     eax, 1
123
    je	    redraw
124
    cmp     eax, 2
125
    je	    key
126
    cmp     eax, 3
127
    je	    button
128
 
129
    jmp     draw_stats
130
 
131
 
1200 hidnplayr 132
  key:
133
    mcall   2
134
    jmp     mainloop
135
 
136
 
137
  button:			  ; button
138
    mcall   17			  ; get id
139
    cmp     ah, 1
140
    je	    close
141
    jmp     redraw
142
 
143
  close:
144
    mcall   -1
145
 
146
 
147
 
148
; DATA AREA
149
 
150
name	db 'ARP manager',0
151
 
152
title	db '#   IP-address        MAC-address         Status    TTL',0
153
str_entry   db '   .   .   .        -  -  -  -  -                     s',0
154
 
155
last	dd 0
156
 
157
 
158
ARP_ENTRY:
159
       .IP		dd  192 shl 0 + 168 shl 8 + 1 shl 16 + 1 shl 24
160
       .MAC		dp  0xdeadbeef1337
161
       .Status		dw  0x0300
162
       .TTL		dw  37
163
       .size:
164
 
165
include_debug_strings	 ; ALWAYS present in data section
166
 
1541 hidnplayr 167
IM_END:
168
 
1200 hidnplayr 169
I_PARAM rb 1024
170
 
171
I_END:
172