Subversion Repositories Kolibri OS

Rev

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

Rev 1355 Rev 1571
1
;
1
;
2
;   DEBUG BOARD for APPLICATIONS and KERNEL DEVELOPMENT
2
;   DEBUG BOARD for APPLICATIONS and KERNEL DEVELOPMENT
3
;
3
;
4
;   See f63
4
;   See f63
5
;
5
;
6
;   Compile with FASM for Menuet
6
;   Compile with FASM for Menuet
7
;
7
;
8
LMARGIN equ (15+5)
8
LMARGIN    equ (15+5)
9
TMARGIN equ (35+5)
9
TMARGIN    equ (35+5)
10
HSPACE  equ 16		
10
HSPACE	   equ 16
11
VSPACE  equ 12
11
VSPACE	   equ 12
12
IPC_BUF equ 160
12
IPC_BUF    equ 160
13
DR_GRID equ 0;1
13
DR_GRID    equ 0;1
-
 
14
WRITE_LOG  equ 1
14
 
15
 
15
FL_KRNL equ 1
16
FL_KRNL equ 1
16
 
17
 
17
include 'lang.inc'
18
include 'lang.inc'
18
 
19
 
19
   use32
20
   use32
20
   org    0x0
21
   org	  0x0
21
   db     'MENUET01'              ; 8 byte id
22
   db	  'MENUET01'		  ; 8 byte id
22
   dd     0x01                    ; header version
23
   dd	  0x01			  ; header version
23
   dd     START                   ; start of code
24
   dd	  START 		  ; start of code
24
   dd     I_END                   ; size of image
25
   dd	  I_END 		  ; size of image
25
   dd     i_end+0x2000                  ; memory for app (4 Kb)
26
   dd	  i_end+0x2000			; memory for app (4 Kb)
26
   dd     i_end+0x2000                  ; esp
27
   dd	  i_end+0x2000			; esp
27
   dd     0x0 , 0x0               ; I_Param , I_Icon
28
   dd	  0x0 , 0x0		  ; I_Param , I_Icon
28
include '..\..\..\MACROS.INC'
29
include '..\..\..\MACROS.INC'
29
include 'debug.inc'
30
include 'debug.inc'
30
purge newline
31
purge newline
31
MAXSTRINGS = 16
32
MAXSTRINGS = 16
32
TMP = 80*(MAXSTRINGS+1)
33
TMP = 80*(MAXSTRINGS+1)
33
 
34
 
34
START:                          ; start of execution
35
START:				; start of execution
35
 
36
 
36
     mcall 60,1,ipcbuff,IPC_BUF+20
37
     mcall 60,1,ipcbuff,IPC_BUF+20
37
     mcall 40,1000111b
38
     mcall 40,1000111b
38
     mov  [ipcbuff+4],8
39
     mov  [ipcbuff+4],8
39
; allow user to see messages written before start
40
; allow user to see messages written before start
40
;     mov  ecx,4096
41
;     mov  ecx,4096
41
;    flush:
42
;    flush:
42
;     mov  eax,63
43
;     mov  eax,63
43
;     mov  ebx,2
44
;     mov  ebx,2
44
;     mcall
45
;     mcall
45
;     loop flush
46
;     loop flush
46
 
47
 
47
     mov  ecx, TMP
48
     mov  ecx, TMP
48
     xor  eax, eax
49
     xor  eax, eax
49
     mov  edi, [targ]
50
     mov  edi, [targ]
50
     rep  stosb
51
     rep  stosb
51
 
52
 
52
     mov  [tmp1],'x'
53
     mov  [tmp1],'x'
53
     mov  [tmp2],'x'
54
     mov  [tmp2],'x'
54
 
55
 
55
     mov  eax,14
56
     mov  eax,14
56
     mcall
57
     mcall
57
     and  eax,0xffff0000
58
     and  eax,0xffff0000
58
     sub  eax,399 shl 16
59
     sub  eax,399 shl 16
59
     add  eax,399
60
     add  eax,399
60
     mov  [xstart],eax
61
     mov  [xstart],eax
61
 
62
 
62
     mov  eax,48
63
     mov  eax,48
63
     mov  ebx,3
64
     mov  ebx,3
64
     mov  ecx,sc
65
     mov  ecx,sc
65
     mov  edx,sizeof.system_colors
66
     mov  edx,sizeof.system_colors
66
     mcall
67
     mcall
-
 
68
  if WRITE_LOG
-
 
69
     mov  esi, filename
-
 
70
     call CreateFile
-
 
71
  end if
67
 
72
 
68
  red:
73
  red:
69
     call draw_window
74
     call draw_window
70
 
75
 
71
still:
76
still:
72
 
77
 
73
    mov  eax,23                 ; wait here for event
78
    mov  eax,23 		; wait here for event
74
    mov  ebx,1
79
    mov  ebx,1
75
    mcall
80
    mcall
76
 
81
 
77
    cmp  eax,1                  ; redraw request ?
82
    cmp  eax,1			; redraw request ?
78
    je   red
83
    je	 red
79
    cmp  eax,2                  ; key in buffer ?
84
    cmp  eax,2			; key in buffer ?
80
    je   key
85
    je	 key
81
    cmp  eax,3                  ; button in buffer ?
86
    cmp  eax,3			; button in buffer ?
82
    je   button
87
    je	 button
83
    cmp  eax,7
88
    cmp  eax,7
84
    je   ipc
89
    je	 ipc
85
 
90
 
86
    mov  eax,63
91
    mov  eax,63
87
    mov  ebx,2
92
    mov  ebx,2
88
    mcall
93
    mcall
89
 
94
 
90
    cmp  ebx,1
95
    cmp  ebx,1
91
    jne  still
96
    jne  still
92
		
97
 
93
  new_data:
98
  new_data:
-
 
99
  if WRITE_LOG
-
 
100
     pusha
-
 
101
     mov  [tmp], al
-
 
102
     mov  edx, tmp
-
 
103
     mov  ecx, 1
-
 
104
     mov  esi, filename
-
 
105
  .write_to_logfile:
-
 
106
     call WriteToFile
-
 
107
     cmp  eax, 5
-
 
108
     jne  @f
-
 
109
     mov  esi, filename
-
 
110
     mov  [filepos], 0
-
 
111
     call CreateFile
-
 
112
     jmp  .write_to_logfile
-
 
113
  @@:
-
 
114
     inc  [filepos]
-
 
115
     popa
-
 
116
  end if
-
 
117
 
94
    mov  ebp,[targ]
118
    mov  ebp,[targ]
95
  .no4:
119
  .no4:
96
    cmp  al,13
120
    cmp  al,13
97
    jne  no13
121
    jne  no13
98
    and  dword[ebp-8],0
122
    and  dword[ebp-8],0
99
    jmp  new_check
123
    jmp  new_check
100
   no13:
124
   no13:
101
    cmp  al,10
125
    cmp  al,10
102
    jne  no10
126
    jne  no10
103
    inc  dword[ebp-4]
127
    inc  dword[ebp-4]
104
    cmp  dword[ebp-4],MAXSTRINGS
128
    cmp  dword[ebp-4],MAXSTRINGS
105
    jbe  .noypos
129
    jbe  .noypos
106
    mov  dword[ebp-4],MAXSTRINGS
130
    mov  dword[ebp-4],MAXSTRINGS
107
    lea  esi,[ebp+80]
131
    lea  esi,[ebp+80]
108
    mov  edi,ebp
132
    mov  edi,ebp
109
    mov  ecx,80*(MAXSTRINGS)
133
    mov  ecx,80*(MAXSTRINGS)
110
    cld
134
    cld
111
    rep  movsb
135
    rep  movsb
112
 
136
 
113
    mov  esi,[ebp-4]
137
    mov  esi,[ebp-4]
114
    imul esi,80
138
    imul esi,80
115
    add  esi,[ebp-8]
139
    add  esi,[ebp-8]
116
    add  esi,ebp
140
    add  esi,ebp
117
    mov  ecx,80
141
    mov  ecx,80
118
    xor  al,al
142
    xor  al,al
119
    rep  stosb
143
    rep  stosb
120
  .noypos:
144
  .noypos:
121
    mov  [targ],text2
145
    mov  [targ],text2
122
    and  [krnl_cnt],0
146
    and  [krnl_cnt],0
123
    jmp  new_check
147
    jmp  new_check
124
  no10:
148
  no10:
125
    cmp  ebp,text1
149
    cmp  ebp,text1
126
    je   add2
150
    je	 add2
127
  		mov  ecx,[krnl_cnt]
151
		mov  ecx,[krnl_cnt]
128
		  cmp  al,[krnl_msg+ecx]
152
		  cmp  al,[krnl_msg+ecx]
129
  		jne  .noknl
153
		jne  .noknl
130
		  inc  [krnl_cnt]
154
		  inc  [krnl_cnt]
131
  		cmp  [krnl_cnt],4
155
		cmp  [krnl_cnt],4
132
  		jne  new_check
156
		jne  new_check
133
    mov  [targ],text1
157
    mov  [targ],text1
134
  	.noknl:
158
	.noknl:
135
    mov  ebp,[targ]
159
    mov  ebp,[targ]
136
	   jecxz .add
160
	   jecxz .add
137
    push eax
161
    push eax
138
    mov  esi,krnl_msg
162
    mov  esi,krnl_msg
139
   .l1:
163
   .l1:
140
    lodsb
164
    lodsb
141
    call add_char
165
    call add_char
142
    loop .l1
166
    loop .l1
143
    pop  eax
167
    pop  eax
144
   .add:
168
   .add:
145
    and  [krnl_cnt],0
169
    and  [krnl_cnt],0
146
  add2:
170
  add2:
147
    call add_char
171
    call add_char
148
 
172
 
149
  new_check:
173
  new_check:
150
 
174
 
151
    mov  eax,63
175
    mov  eax,63
152
    mov  ebx,2
176
    mov  ebx,2
153
    mcall
177
    mcall
154
 
178
 
155
    cmp  ebx,1
179
    cmp  ebx,1
156
    je   new_data
180
    je	 new_data
157
 
181
 
158
    cmp  [vmode],2
182
    cmp  [vmode],2
159
    je   still
183
    je	 still
160
    call draw_window
184
    call draw_window
161
 
185
 
162
    jmp  still
186
    jmp  still
163
 
187
 
164
  ipc:
188
  ipc:
165
    mov  [vmode],2
189
    mov  [vmode],2
166
    mov  eax,ipcbuff
190
    mov  eax,ipcbuff
167
    mov  esi,[eax+8]
191
    mov  esi,[eax+8]
168
    mov  byte[eax],1
192
    mov  byte[eax],1
169
    push dword[eax+12]
193
    push dword[eax+12]
170
    pop  [dump_len]
194
    pop  [dump_len]
171
    mcall 9,work,-1
195
    mcall 9,work,-1
172
    mov  ecx,eax
196
    mov  ecx,eax
173
   .lp:
197
   .lp:
174
    mcall 9
198
    mcall 9
175
    cmp  [ebx+30],esi
199
    cmp  [ebx+30],esi
176
    je   .ok
200
    je	 .ok
177
    loop .lp
201
    loop .lp
178
    and  [dump_len],0
202
    and  [dump_len],0
179
    jmp  red
203
    jmp  red
180
  .ok:
204
  .ok:
181
    mov  [pid],esi
205
    mov  [pid],esi
182
    lea  esi,[ebx+10]
206
    lea  esi,[ebx+10]
183
    mov  edi,dump_title+10
207
    mov  edi,dump_title+10
184
    mov  ecx,12
208
    mov  ecx,12
185
    rep  movsb
209
    rep  movsb
186
    jmp  red
210
    jmp  red
187
  key:                          ; key
211
  key:				; key
188
    mov  al,2                  ; just read it and ignore
212
    mov  al,2		       ; just read it and ignore
189
    mcall
213
    mcall
190
    cmp  ah,' '
214
    cmp  ah,' '
191
    je   button.no_krnl_flt
215
    je	 button.no_krnl_flt
192
    cmp  [vmode],2
216
    cmp  [vmode],2
193
    jne  still
217
    jne  still
194
    cmp  ah,176 ;left
218
    cmp  ah,176 ;left
195
    jb   still
219
    jb	 still
196
    cmp  ah,179 ;right
220
    cmp  ah,179 ;right
197
    ja  still
221
    ja	still
198
    mov  ecx,[offs]
222
    mov  ecx,[offs]
199
    shr  eax,8
223
    shr  eax,8
200
    sub  eax,176
224
    sub  eax,176
201
    add  ecx,[arrows+eax*4]
225
    add  ecx,[arrows+eax*4]
202
    shl  ecx,12
226
    shl  ecx,12
203
    shr  cx,12
227
    shr  cx,12
204
    jmp  button.check_sel
228
    jmp  button.check_sel
205
  .nol:
229
  .nol:
206
    jmp  still
230
    jmp  still
207
 
231
 
208
arrows dd -1,16,-16,1
232
arrows dd -1,16,-16,1
209
 
233
 
210
  button:                       ; button
234
  button:			; button
211
    mov  al,17                 ; get id
235
    mov  al,17		       ; get id
212
    mcall
236
    mcall
213
 
237
 
214
    cmp  ah,1                   ; button id=1 ?
238
    cmp  ah,1			; button id=1 ?
215
    jne  .noclose
239
    jne  .noclose
216
 
240
 
217
    or   eax,-1                 ; close this program
241
    or	 eax,-1 		; close this program
218
    mcall
242
    mcall
219
  .noclose:
243
  .noclose:
220
   	shr  eax,8
244
	shr  eax,8
221
  		cmp  eax,10
245
		cmp  eax,10
222
  		jb   .nodump
246
		jb   .nodump
223
		  lea  edi,[eax-10]
247
		  lea  edi,[eax-10]
224
  		mcall 37,1
248
		mcall 37,1
225
		  sub  eax,[edi*4+dump_cell_marg]
249
		  sub  eax,[edi*4+dump_cell_marg]
226
  		sub  eax,TMARGIN+VSPACE
250
		sub  eax,TMARGIN+VSPACE
227
  		push eax
251
		push eax
228
    and  eax,0xffff
252
    and  eax,0xffff
229
		  xor  edx,edx
253
		  xor  edx,edx
230
  		div  word[edi*4+dump_cell_size+2]
254
		div  word[edi*4+dump_cell_size+2]
231
		  mov  ecx,eax
255
		  mov  ecx,eax
232
    shl  ecx,16
256
    shl  ecx,16
233
  		xor  edx,edx
257
		xor  edx,edx
234
		  pop  eax
258
		  pop  eax
235
  		shr  eax,16
259
		shr  eax,16
236
  		div  word[edi*4+dump_cell_size]
260
		div  word[edi*4+dump_cell_size]
237
  		mov  cx,ax
261
		mov  cx,ax
238
  .check_sel:
262
  .check_sel:
239
  		mov  eax,ecx
263
		mov  eax,ecx
240
    shl  ax,12
264
    shl  ax,12
241
    shr  eax,12
265
    shr  eax,12
242
    inc  eax
266
    inc  eax
243
    cmp  eax,[dump_len]
267
    cmp  eax,[dump_len]
244
    ja   still;.nosel
268
    ja	 still;.nosel
245
    mov  dword[sel_byte],ecx
269
    mov  dword[sel_byte],ecx
246
    dec  eax
270
    dec  eax
247
    mov  [offs],eax
271
    mov  [offs],eax
248
    jmp  red
272
    jmp  red
249
 
273
 
250
  .nodump:
274
  .nodump:
251
    cmp  eax,2
275
    cmp  eax,2
252
    jne  .no_krnl_flt
276
    jne  .no_krnl_flt
253
    xor  [flag],FL_KRNL
277
    xor  [flag],FL_KRNL
254
    jmp  still
278
    jmp  still
255
  .no_krnl_flt:
279
  .no_krnl_flt:
256
    mov  [ipcbuff+4],8
280
    mov  [ipcbuff+4],8
257
    and  byte[ipcbuff],0
281
    and  byte[ipcbuff],0
258
    inc  [vmode]
282
    inc  [vmode]
259
    cmp  [vmode],3
283
    cmp  [vmode],3
260
    jb   .vmok
284
    jb	 .vmok
261
    and  [vmode],0
285
    and  [vmode],0
262
  .vmok:
286
  .vmok:
263
    jmp  red
287
    jmp  red
264
 
288
 
265
add_char:
289
add_char:
266
    push esi
290
    push esi
267
    mov  esi,[ebp-4]
291
    mov  esi,[ebp-4]
268
    imul esi,80
292
    imul esi,80
269
    add  esi,[ebp-8]
293
    add  esi,[ebp-8]
270
    mov  [ebp+esi],al
294
    mov  [ebp+esi],al
271
    inc  dword[ebp-8]
295
    inc  dword[ebp-8]
272
    cmp  dword[ebp-8],80
296
    cmp  dword[ebp-8],80
273
    jb   .ok
297
    jb	 .ok
274
    mov  dword[ebp-8],79
298
    mov  dword[ebp-8],79
275
  .ok:
299
  .ok:
276
    pop  esi
300
    pop  esi
277
    ret
301
    ret
278
 
302
 
279
;   *********************************************
303
;   *********************************************
280
;   *******  WINDOW DEFINITIONS AND DRAW ********
304
;   *******  WINDOW DEFINITIONS AND DRAW ********
281
;   *********************************************
305
;   *********************************************
282
 
306
 
283
 
307
 
284
draw_window:
308
draw_window:
285
 
309
 
286
    mov  eax,12                    ; function 12:tell os about windowdraw
310
    mov  eax,12 		   ; function 12:tell os about windowdraw
287
    mov  ebx,1                     ; 1, start of draw
311
    mov  ebx,1			   ; 1, start of draw
288
    mcall
312
    mcall
289
 
313
 
290
                                   ; DRAW WINDOW
314
				   ; DRAW WINDOW
291
    xor  eax,eax                     ; function 0 : define and draw window
315
    xor  eax,eax		     ; function 0 : define and draw window
292
;   mov  ebx,50*65536+400          ; [x start] *65536 + [x size]
316
;   mov  ebx,50*65536+400          ; [x start] *65536 + [x size]
293
    mov  ebx,[xstart]
317
    mov  ebx,[xstart]
294
    mov  ecx,MAXSTRINGS*10+45      ; [y start] *65536 + [y size]
318
    mov  ecx,MAXSTRINGS*10+45	   ; [y start] *65536 + [y size]
295
    mov  edx,[sc.work]             ; color of work area RRGGBB,8->color gl
319
    mov  edx,[sc.work]		   ; color of work area RRGGBB,8->color gl
296
    or   edx,0x13000000
320
    or	 edx,0x13000000
297
    mov  edi,title                ; WINDOW LABEL
321
    mov  edi,title		  ; WINDOW LABEL
298
    mcall
322
    mcall
299
    
323
 
300
    mov  ecx,4
324
    mov  ecx,4
301
    mov  esi,[sc.work]
325
    mov  esi,[sc.work]
302
    mov  ebx,296 shl 16+5*6
326
    mov  ebx,296 shl 16+5*6
303
    mov  edx,3;+1 shl 30
327
    mov  edx,3;+1 shl 30
304
    mcall 8,,<5,12>
328
    mcall 8,,<5,12>
305
    mov  edx,[vmode]
329
    mov  edx,[vmode]
306
    lea  edx,[edx*4+duk]
330
    lea  edx,[edx*4+duk]
307
    mcall 4,<300,8>,,,4
331
    mcall 4,<300,8>,,,4
308
 
332
 
309
    cmp  [vmode],2
333
    cmp  [vmode],2
310
    je   no_mdbg
334
    je	 no_mdbg
311
    mov  ebx,15*65536+33           ; draw info text with function 4
335
    mov  ebx,15*65536+33	   ; draw info text with function 4
312
    mov  ecx,[sc.work_text]
336
    mov  ecx,[sc.work_text]
313
    mov  edx,text1
337
    mov  edx,text1
314
    cmp  [vmode],0
338
    cmp  [vmode],0
315
    je   .kern
339
    je	 .kern
316
    mov  edx,text2
340
    mov  edx,text2
317
  .kern:
341
  .kern:
318
    mov  esi,80
342
    mov  esi,80
319
    mov  eax,4
343
    mov  eax,4
320
  newline:
344
  newline:
321
    mcall
345
    mcall
322
    add  ebx,10
346
    add  ebx,10
323
    add  edx,80
347
    add  edx,80
324
    cmp  [edx],byte 'x'
348
    cmp  [edx],byte 'x'
325
    jne  newline
349
    jne  newline
326
    jmp  enddraw
350
    jmp  enddraw
327
  no_mdbg:
351
  no_mdbg:
328
  if DUMP_TEST eq 1
352
  if DUMP_TEST eq 1
329
    mov  esi,0
353
    mov  esi,0
330
    mov  [dump_len],100;IPC_BUF
354
    mov  [dump_len],100;IPC_BUF
331
  else
355
  else
332
    mov  esi,ipcbuff+16
356
    mov  esi,ipcbuff+16
333
  end if
357
  end if
334
    mov  ecx,[dump_len]
358
    mov  ecx,[dump_len]
335
    call dump_btn
359
    call dump_btn
336
  		call draw_dump
360
		call draw_dump
337
		enddraw:
361
		enddraw:
338
    mov  eax,12                    ; function 12:tell os about windowdraw
362
    mov  eax,12 		   ; function 12:tell os about windowdraw
339
    mov  ebx,2                     ; 2, end of draw
363
    mov  ebx,2			   ; 2, end of draw
340
    mcall
364
    mcall
341
 
365
 
342
    ret
366
    ret
343
 
367
 
344
if DR_GRID eq 1
368
if DR_GRID eq 1
345
draw_grid:
369
draw_grid:
346
  mov  ecx,11
370
  mov  ecx,11
347
  mov  edi,(TMARGIN+VSPACE)shl 16+TMARGIN+VSPACE
371
  mov  edi,(TMARGIN+VSPACE)shl 16+TMARGIN+VSPACE
348
 .l1:
372
 .l1:
349
  push ecx
373
  push ecx
350
  mov  ebx,LMARGIN shl 16+LMARGIN+16*HSPACE
374
  mov  ebx,LMARGIN shl 16+LMARGIN+16*HSPACE
351
  mcall 38,,edi,0
375
  mcall 38,,edi,0
352
  add  edi,VSPACE shl 16+VSPACE
376
  add  edi,VSPACE shl 16+VSPACE
353
  pop  ecx
377
  pop  ecx
354
  loop .l1
378
  loop .l1
355
  mov  ecx,17
379
  mov  ecx,17
356
  mov  edi,(TMARGIN+VSPACE)shl 16+TMARGIN+VSPACE*10
380
  mov  edi,(TMARGIN+VSPACE)shl 16+TMARGIN+VSPACE*10
357
  mov  ebx,LMARGIN shl 16+LMARGIN
381
  mov  ebx,LMARGIN shl 16+LMARGIN
358
 .l2:
382
 .l2:
359
  push ecx
383
  push ecx
360
  mcall 38,,edi,0
384
  mcall 38,,edi,0
361
  add  ebx,HSPACE shl 16+HSPACE
385
  add  ebx,HSPACE shl 16+HSPACE
362
  pop  ecx
386
  pop  ecx
363
  loop .l2
387
  loop .l2
364
  ret
388
  ret
365
end if
389
end if
366
 
390
 
367
draw_numbers:
391
draw_numbers:
368
  mcall 4,(LMARGIN+2) shl 16+180,0,numb,numb_len-numb
392
  mcall 4,(LMARGIN+2) shl 16+180,0,numb,numb_len-numb
369
  mov  eax,dword[sel_byte]
393
  mov  eax,dword[sel_byte]
370
  shl  ax,12
394
  shl  ax,12
371
  shr  eax,12
395
  shr  eax,12
372
  mov  edi,eax
396
  mov  edi,eax
373
if ~ DUMP_TEST eq 1
397
if ~ DUMP_TEST eq 1
374
  add  edi,ipcbuff+16
398
  add  edi,ipcbuff+16
375
end if
399
end if
376
  mov  edx,(LMARGIN+2+6*6)shl 16+180
400
  mov  edx,(LMARGIN+2+6*6)shl 16+180
377
  mov  ebx,0x30000
401
  mov  ebx,0x30000
378
  movzx ecx,byte[edi]
402
  movzx ecx,byte[edi]
379
  mcall 47,,,,0x4e00e7
403
  mcall 47,,,,0x4e00e7
380
  add  ebx,0x20000
404
  add  ebx,0x20000
381
  add  edx,(6*10)shl 16
405
  add  edx,(6*10)shl 16
382
  movzx ecx,word[edi]
406
  movzx ecx,word[edi]
383
  mcall
407
  mcall
384
  add  ebx,0x50000
408
  add  ebx,0x50000
385
  add  edx,(6*13)shl 16
409
  add  edx,(6*13)shl 16
386
  mov  ecx,[edi]
410
  mov  ecx,[edi]
387
  mcall
411
  mcall
388
  mov  ebx,0x80100
412
  mov  ebx,0x80100
389
  add  edx,(6*19)shl 16
413
  add  edx,(6*19)shl 16
390
  mcall
414
  mcall
391
.ex:
415
.ex:
392
  ret
416
  ret
393
 
417
 
394
draw_dump:
418
draw_dump:
395
; esi - data ptr, ecx - length
419
; esi - data ptr, ecx - length
396
  jecxz draw_numbers.ex
420
  jecxz draw_numbers.ex
397
  pusha
421
  pusha
398
  call draw_numbers
422
  call draw_numbers
399
  mcall 4,(LMARGIN+2) shl 16+27,0,dump_title,dump_t_len-dump_title
423
  mcall 4,(LMARGIN+2) shl 16+27,0,dump_title,dump_t_len-dump_title
400
  mcall 47,0x30101,ipcbuff+8,(LMARGIN+2+6*29)shl 16+27
424
  mcall 47,0x30101,ipcbuff+8,(LMARGIN+2+6*29)shl 16+27
401
  add   edx,(6*27) shl 16
425
  add	edx,(6*27) shl 16
402
  mov   ecx,offs
426
  mov	ecx,offs
403
  mcall
427
  mcall
404
  sub   edx,(5*6)shl 16
428
  sub	edx,(5*6)shl 16
405
  mcall ,0x30001
429
  mcall ,0x30001
406
  mov  ecx,16
430
  mov  ecx,16
407
  mov  edi,HSPACE shl 16
431
  mov  edi,HSPACE shl 16
408
  mov  ebx,(LMARGIN+5)shl 16+42
432
  mov  ebx,(LMARGIN+5)shl 16+42
409
  call draw_marks
433
  call draw_marks
410
  mov  ecx,[esp+24]
434
  mov  ecx,[esp+24]
411
  dec  ecx
435
  dec  ecx
412
  shr  ecx,4
436
  shr  ecx,4
413
  inc  ecx
437
  inc  ecx
414
  mov  ebx,(LMARGIN-10)shl 16+TMARGIN+2+VSPACE
438
  mov  ebx,(LMARGIN-10)shl 16+TMARGIN+2+VSPACE
415
  mov  edi,VSPACE
439
  mov  edi,VSPACE
416
  call draw_marks
440
  call draw_marks
417
  popa
441
  popa
418
		mov  edx,TMARGIN+2
442
		mov  edx,TMARGIN+2
419
		mov  edi,ecx
443
		mov  edi,ecx
420
	.lp:	
444
	.lp:
421
		add  edx,(LMARGIN+2) shl 16+VSPACE
445
		add  edx,(LMARGIN+2) shl 16+VSPACE
422
		mov  ecx,16
446
		mov  ecx,16
423
		cmp  edi,ecx
447
		cmp  edi,ecx
424
		jae  .less
448
		jae  .less
425
		mov  ecx,edi
449
		mov  ecx,edi
426
	.less:	
450
	.less:
427
		sub  edi,ecx
451
		sub  edi,ecx
428
		push esi ecx
452
		push esi ecx
429
		mov  ebx,0x20100
453
		mov  ebx,0x20100
430
	.lp1:	
454
	.lp1:
431
		push ecx esi
455
		push ecx esi
432
		movzx ecx,byte[esi]
456
		movzx ecx,byte[esi]
433
		mcall 47,,,,0
457
		mcall 47,,,,0
434
		add  edx,HSPACE shl 16
458
		add  edx,HSPACE shl 16
435
		pop  esi ecx
459
		pop  esi ecx
436
		inc  esi
460
		inc  esi
437
		loop .lp1
461
		loop .lp1
438
		pusha
462
		pusha
439
		mov  ebx,edx
463
		mov  ebx,edx
440
		and  ebx,0xffff
464
		and  ebx,0xffff
441
		add  ebx,(LMARGIN+16*HSPACE+15)shl 16
465
		add  ebx,(LMARGIN+16*HSPACE+15)shl 16
442
		mov  edx,[esp+36]
466
		mov  edx,[esp+36]
443
		mov  esi,[esp+32]
467
		mov  esi,[esp+32]
444
		mcall 4,,0
468
		mcall 4,,0
445
		popa
469
		popa
446
		add  esp,8
470
		add  esp,8
447
		and  edx,0xffff
471
		and  edx,0xffff
448
		test edi,edi
472
		test edi,edi
449
		jnz  .lp
473
		jnz  .lp
450
.ex:
474
.ex:
451
		ret
475
		ret
452
 
476
 
453
draw_marks:
477
draw_marks:
454
; ebx -xy, edi-addition, ecx -cycles
478
; ebx -xy, edi-addition, ecx -cycles
455
		pusha
479
		pusha
456
  mov  edx,__hexdigits
480
  mov  edx,__hexdigits
457
  mov  eax,4
481
  mov  eax,4
458
  mov  esi,1
482
  mov  esi,1
459
.tt:
483
.tt:
460
  push ecx
484
  push ecx
461
  mcall ,,0xffffff
485
  mcall ,,0xffffff
462
  add  ebx,edi
486
  add  ebx,edi
463
  inc  edx
487
  inc  edx
464
  pop  ecx
488
  pop  ecx
465
  loop .tt
489
  loop .tt
466
  popa
490
  popa
467
  ret
491
  ret
468
 
492
 
469
dump_btn: ; ecx-length
493
dump_btn: ; ecx-length
470
  jecxz draw_dump.ex
494
  jecxz draw_dump.ex
471
		pusha
495
		pusha
472
		test ecx,0xffff
496
		test ecx,0xffff
473
		je   .even
497
		je   .even
474
		add  ecx,16
498
		add  ecx,16
475
	.even:	
499
	.even:
476
		shr  ecx,4
500
		shr  ecx,4
477
		imul ecx,VSPACE
501
		imul ecx,VSPACE
478
		add  ecx,(TMARGIN+VSPACE)shl 16-5
502
		add  ecx,(TMARGIN+VSPACE)shl 16-5
479
		mcall 8,LMARGIN shl 16+16*HSPACE-5,,10+3 shl 29,[sc.work]
503
		mcall 8,LMARGIN shl 16+16*HSPACE-5,,10+3 shl 29,[sc.work]
480
		inc  edx
504
		inc  edx
481
		mcall ,(LMARGIN+16*HSPACE+15)shl 16+6*16
505
		mcall ,(LMARGIN+16*HSPACE+15)shl 16+6*16
482
		mov  edx,0xff0000
506
		mov  edx,0xff0000
483
		mov  esi,dump_cell_size
507
		mov  esi,dump_cell_size
484
		xor  eax,eax
508
		xor  eax,eax
485
		movzx ebx,[sel_byte]
509
		movzx ebx,[sel_byte]
486
		lodsw
510
		lodsw
487
		imul bx,ax
511
		imul bx,ax
488
		shl  ebx,16
512
		shl  ebx,16
489
		lea  ebx,[ebx+eax+LMARGIN shl 16]
513
		lea  ebx,[ebx+eax+LMARGIN shl 16]
490
		movzx ecx,[sel_byte+2]
514
		movzx ecx,[sel_byte+2]
491
		lodsw
515
		lodsw
492
		imul cx,ax
516
		imul cx,ax
493
		shl  ecx,16
517
		shl  ecx,16
494
		lea  ecx,[ecx+eax+(TMARGIN+VSPACE) shl 16]
518
		lea  ecx,[ecx+eax+(TMARGIN+VSPACE) shl 16]
495
		mcall 13
519
		mcall 13
496
		movzx ebx,[sel_byte]
520
		movzx ebx,[sel_byte]
497
		lodsw
521
		lodsw
498
		imul bx,ax
522
		imul bx,ax
499
		shl  ebx,16
523
		shl  ebx,16
500
		lea  ebx,[ebx+eax+(LMARGIN+16*HSPACE+15)shl 16]
524
		lea  ebx,[ebx+eax+(LMARGIN+16*HSPACE+15)shl 16]
501
  mcall 13
525
  mcall 13
502
		popa
526
		popa
503
.ex:
527
.ex:
504
		ret		
528
		ret
-
 
529
 
-
 
530
 
-
 
531
if WRITE_LOG
-
 
532
;********************************************
-
 
533
;*  input:  esi = pointer to the file name  *
-
 
534
;********************************************
-
 
535
 
-
 
536
CreateFile:
-
 
537
    pusha
-
 
538
    mov      dword [InfoStructure],    2   ; create file
-
 
539
    mov      dword [InfoStructure+4],  0   ; reserved
-
 
540
    mov      dword [InfoStructure+8],  0   ; reserved
-
 
541
    mov      dword [InfoStructure+12], 0   ; 0 bytes to write (just create)
-
 
542
    mov      dword [InfoStructure+16], 0   ; NULL data pointer (no data)
-
 
543
    mov      dword [InfoStructure+20], 0   ; reserved
-
 
544
    mov      dword [InfoStructure+21], esi ; pointer to the file name
-
 
545
    mcall    70, InfoStructure
-
 
546
    clc
-
 
547
    test     eax, eax
-
 
548
    jz	     .out
-
 
549
    stc
-
 
550
  .out:
-
 
551
    popa
-
 
552
    ret
-
 
553
 
-
 
554
;********************************************
-
 
555
;*  input:  esi = pointer to the file name  *
-
 
556
;*          edx = pointer to data buffer    *
-
 
557
;*          ecx = data length               *
-
 
558
;********************************************
-
 
559
 
-
 
560
WriteToFile:
-
 
561
    push     ebx
-
 
562
    mov      dword [InfoStructure],    3   ; write to file
-
 
563
    mov      eax,  [filepos]
-
 
564
    mov      dword [InfoStructure+4],  eax ; lower position addr
-
 
565
    mov      dword [InfoStructure+8],  0   ; upper position addr (0 for FAT)
-
 
566
    mov      dword [InfoStructure+12], ecx ; number of bytes to write
-
 
567
    mov      dword [InfoStructure+16], edx ; pointer to data buffer
-
 
568
    mov      dword [InfoStructure+20], 0   ; reserved
-
 
569
    mov      dword [InfoStructure+21], esi ; pointer to the file name
-
 
570
    mcall    70, InfoStructure
-
 
571
    clc
-
 
572
    test     eax, eax
-
 
573
    jz	     .out
-
 
574
    stc
-
 
575
  .out:
-
 
576
    pop      ebx
-
 
577
    ret
-
 
578
 
-
 
579
 
-
 
580
InfoStructure:
-
 
581
		     dd      0x0     ; subfunction number
-
 
582
		     dd      0x0     ; position in the file in bytes
-
 
583
		     dd      0x0     ; upper part of the position address
-
 
584
		     dd      0x0     ; number of     bytes to read
-
 
585
		     dd      0x0     ; pointer to the buffer to write data
-
 
586
		     db      0
-
 
587
		     dd      0	     ; pointer to the filename
-
 
588
 
-
 
589
filepos  dd 0
-
 
590
filename db '/sys/boardlog.txt',0
-
 
591
tmp	 db 0
-
 
592
end if
-
 
593
 
-
 
594
 
-
 
595
 
505
 
596
 
506
krnl_msg db 'K : '
597
krnl_msg db 'K : '
507
duk db 'KernUserDump'
598
duk db 'KernUserDump'
508
numb db 'Byte:     Word:       Dword:               Hex:'
599
numb db 'Byte:     Word:       Dword:               Hex:'
509
numb_len:
600
numb_len:
510
dump_title db 'Dump from              (pid=    h)         Offset:     (   h)'
601
dump_title db 'Dump from              (pid=    h)         Offset:     (   h)'
511
dump_t_len:
602
dump_t_len:
512
 
603
 
513
; DATA AREA
604
; DATA AREA
514
 
605
 
515
dump_cell_marg dd LMARGIN shl 16,(LMARGIN+16*HSPACE+15)shl 16
606
dump_cell_marg dd LMARGIN shl 16,(LMARGIN+16*HSPACE+15)shl 16
516
dump_cell_size dw HSPACE,VSPACE,6,VSPACE
607
dump_cell_size dw HSPACE,VSPACE,6,VSPACE
517
; 11,11 > 0,-1
608
; 11,11 > 0,-1
518
; 5,11  > 0,-1
609
; 5,11  > 0,-1
519
if lang eq ru
610
if lang eq ru
520
   title    db   '„®áª  ®â« ¤ª¨ ¨ á®®¡é¥­¨©',0
611
   title    db	 '„®áª  ®â« ¤ª¨ ¨ á®®¡é¥­¨©',0
521
else if lang eq en
612
else if lang eq en
522
   title    db   'General debug & message board',0
613
   title    db	 'General debug & message board',0
523
else
614
else
524
   title    db   'Allgemeines debug- & nachrichtenboard',0
615
   title    db	 'Allgemeines debug- & nachrichtenboard',0
525
end if
616
end if
526
   krnl_cnt dd 0
617
   krnl_cnt dd 0
527
   vmode dd 0
618
   vmode dd 1
528
   targ  dd text2
619
   targ  dd text2
529
I_END:
620
I_END:
530
     offs dd ?
621
     offs dd ?
531
     flag rb 1
622
     flag rb 1
532
     ipcbuff rb IPC_BUF+20
623
     ipcbuff rb IPC_BUF+20
533
     rd 2
624
     rd 2
534
;     x1pos  dd ?
625
;     x1pos  dd ?
535
;     y1pos  dd ?
626
;     y1pos  dd ?
536
     text1 rb 80*(MAXSTRINGS+1)
627
     text1 rb 80*(MAXSTRINGS+1)
537
     tmp1  db ?
628
     tmp1  db ?
538
     rd 2
629
     rd 2
539
;     x2pos  dd ?
630
;     x2pos  dd ?
540
;     y2pos  dd ?
631
;     y2pos  dd ?
541
     text2 rb 80*(MAXSTRINGS+1)
632
     text2 rb 80*(MAXSTRINGS+1)
542
     tmp2  db ?
633
     tmp2  db ?
543
     work rb 4096
634
     work rb 4096
544
     sel_byte  dw ?,?
635
     sel_byte  dw ?,?
545
     pid  dd ?
636
     pid  dd ?
546
     xstart dd ?
637
     xstart dd ?
547
     dump_len dd ?
638
     dump_len dd ?
548
     sc system_colors
639
     sc system_colors
549
i_end:
640
i_end: