Subversion Repositories Kolibri OS

Rev

Rev 1200 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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