Subversion Repositories Kolibri OS

Rev

Rev 7900 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7900 Rev 9066
Line 24... Line 24...
24
	dd 0x01		; header version
24
	dd 0x01		; header version
25
	dd START	; start of code
25
	dd START	; start of code
26
	dd IM_END	; size of image
26
	dd IM_END	; size of image
27
	dd I_END	; memory for app
27
	dd I_END	; memory for app
28
	dd stacktop	; esp
28
	dd stacktop	; esp
29
	dd 0	; I_Param
29
	dd file_name	; I_Param
30
	dd path		; APPLICATION PATH
30
	dd path		; APPLICATION PATH
31
;-----------------------------------------------------------------------------
31
;-----------------------------------------------------------------------------
32
include 'lang.inc'	;language support
32
include 'lang.inc'	;language support
-
 
33
include '../../../KOSfuncs.inc'
33
include '../../../macros.inc'
34
include '../../../macros.inc'
34
include	'../../../develop/libraries/box_lib/load_lib.mac'
35
include	'../../../load_lib.mac'
35
;-----------------------------------------------------------------------------
36
;-----------------------------------------------------------------------------
36
@use_library	; load_lib macro
37
@use_library	; load_lib macro
37
;-----------------------------------------------------------------------------
38
;-----------------------------------------------------------------------------
38
START:
39
START:
39
	mcall	68,11
40
	mcall	SF_SYS_MISC,SSF_HEAP_INIT
40
	mcall	66,1,1
41
	mcall	SF_KEYBOARD,SSF_SET_INPUT_MODE,1
41
;-----------------------------------------------------------------------------
42
;-----------------------------------------------------------------------------
42
load_libraries l_libs_start,end_l_libs
43
load_libraries l_libs_start,end_l_libs
43
;-----------------------------------------------------------------------------
44
;-----------------------------------------------------------------------------
44
;OpenDialog	initialisation
45
;OpenDialog	initialisation
45
	push    dword OpenDialog_data
46
	push    dword OpenDialog_data
Line 47... Line 48...
47
 
48
 
48
	mov	edi,filename_area
49
	mov	edi,filename_area
49
	mov	esi,start_temp_file_name
50
	mov	esi,start_temp_file_name
50
	call	copy_file_name_path
51
	call	copy_file_name_path
51
;-----------------------------------------------------------------------------
52
;-----------------------------------------------------------------------------
52
	mcall	68,12,4096*4 ; 16 Kb - I hope this will be enough for store of data
53
	mcall	SF_SYS_MISC,SSF_MEM_ALLOC,4096*4 ; 16 Kb - I hope this will be enough for store of data
53
	mov	[store_text_area_start],eax
54
	mov	[store_text_area_start],eax
54
;-----------------------------------------------------------------------------
55
;-----------------------------------------------------------------------------
-
 
56
	call draw_window
55
	call draw_window
57
align 4
56
still:
58
still:
57
	mcall	10			; wait here for event
59
	mcall	SF_WAIT_EVENT
58
	dec	eax			; redraw request ?
60
	dec	eax			; redraw request ?
59
	jz	red
61
	jz	red
60
	dec	eax			; key in buffer ?
62
	dec	eax			; key in buffer ?
61
	jz	key
63
	jz	key
62
	dec	eax			; button in buffer ?
64
	dec	eax			; button in buffer ?
63
	jz	button
65
	jz	button
64
	jmp	still
66
	jmp	still
-
 
67
;-----------------------------------------------------------------------------
65
;-----------------------------------------------------------------------------
68
align 4
66
red:					; redraw
69
red:					; redraw
67
	call	get_window_param
70
	call	get_window_param
68
	mov	eax, [Proc_Info.box.left]; store the window coordinates into the Form Structure
71
	mov	eax, [Proc_Info.box.left]; store the window coordinates into the Form Structure
69
	mov	[Form + 2], ax		; x start position
72
	mov	[Form + 2], ax		; x start position
Line 74... Line 77...
74
	mov	eax, [Proc_Info.box.height]	;
77
	mov	eax, [Proc_Info.box.height]	;
75
	mov	[Form + 4] ,ax		; window height
78
	mov	[Form + 4] ,ax		; window height
76
	call	draw_window		; go redraw window now
79
	call	draw_window		; go redraw window now
77
	jmp	still
80
	jmp	still
78
;-----------------------------------------------------------------------------
81
;-----------------------------------------------------------------------------
-
 
82
align 4
79
key:					; key
83
key:					; key
80
	mcall	2			; just read it and ignore
84
	mcall	SF_GET_KEY
81
	cmp	[extended_key],1
85
	cmp	[extended_key],1
82
	je	.extended_key
86
	je	.extended_key
83
	test	al, al
87
	test	al, al
84
	jnz	still
88
	jnz	still
85
	cmp	ah, 0xE0
89
	cmp	ah, 0xE0
Line 98... Line 102...
98
	je	button.exit
102
	je	button.exit
99
	cmp	ah,159
103
	cmp	ah,159
100
	je	call_OpenDialog
104
	je	call_OpenDialog
101
	jmp	still
105
	jmp	still
102
;-----------------------------------------------------------------------------
106
;-----------------------------------------------------------------------------
-
 
107
align 4
103
button: 				; button
108
button: 				; button
104
	mcall	17			; get id
109
	mcall	SF_GET_BUTTON
105
	cmp	ah,2
110
	cmp	ah,2
106
	je	call_OpenDialog
111
	je	call_OpenDialog
107
	cmp	ah, 1			; button id = 1 ?
112
	cmp	ah, 1			; button id = 1 ?
108
	jne	still
113
	jne	still
109
.exit:
114
.exit:
110
	mcall	-1			; close this program
115
	mcall	SF_TERMINATE_PROCESS
111
;-----------------------------------------------------------------------------
116
;-----------------------------------------------------------------------------
112
call_OpenDialog:
117
call_OpenDialog:
113
	mov	[OpenDialog_data.type],1	; Save
118
	mov	[OpenDialog_data.type],1	; Save
Line 114... Line 119...
114
 
119
 
Line 166... Line 171...
166
 
171
 
167
	xor	edi,edi
172
	xor	edi,edi
168
	ret
173
	ret
169
;-----------------------------------------------------------------------------
174
;-----------------------------------------------------------------------------
170
get_window_param:
175
get_window_param:
171
	mcall	9, Proc_Info, -1	; window redraw requested so get
176
	mcall	SF_THREAD_INFO, Proc_Info, -1	; window redraw requested so get
172
					; new window coordinates and size
177
					; new window coordinates and size
173
	ret
178
	ret
-
 
179
;-----------------------------------------------------------------------------
174
;-----------------------------------------------------------------------------
180
align 4
175
draw_window:
181
draw_window:
Line 176... Line 182...
176
	call	prepare_text_area
182
	call	prepare_text_area
177
 
183
 
178
	mov	byte [total], 0
184
	mov	byte [total], 0
179
	mcall	12, 1			; start of draw
185
	mcall	SF_REDRAW, SSF_BEGIN_DRAW
Line 180... Line 186...
180
	; DRAW WINDOW
186
	; DRAW WINDOW
Line 181... Line 187...
181
	mcall	0,dword [Form],dword [Form + 4],0x13ffffff,0x805080d0,title
187
	mcall	SF_CREATE_WINDOW,dword [Form],dword [Form + 4],0x13ffffff,0x805080d0,title
182
 
188
 
183
	call	get_window_param
189
	call	get_window_param
Line 184... Line 190...
184
 
190
 
185
	mov	eax,[Proc_Info+70] ;status of window
191
	mov	eax,[Proc_Info+70] ;status of window
186
	test	eax,100b
192
	test	eax,100b
187
	jne	.end
193
	jne	.end
188
 
194
 
189
	mcall	8,<450,100>,<25,25>,2,0xC0C0C0
195
	mcall	SF_DEFINE_BUTTON,<450,100>,<25,25>,2,0xC0C0C0
190
	shr	ecx,16
196
	shr	ecx,16
191
	mov	bx,cx
197
	mov	bx,cx
192
	add	ebx,13 shl 16+4
198
	add	ebx,13 shl 16+4
193
	mcall	4,,0x80000000,text_save_button
199
	mcall	SF_DRAW_TEXT,,0x80000000,text_save_button
Line 241... Line 247...
241
	add	edx, esi
247
	add	edx, esi
242
	cmp	byte[edx], -1
248
	cmp	byte[edx], -1
243
	jne	@b
249
	jne	@b
244
	; Quantity of devices...
250
	; Quantity of devices...
245
	movzx	ecx, byte [total]	; number to draw
251
	movzx	ecx, byte [total]	; number to draw
246
	mcall	47, 0x00020000,,150 * 65536 + 65, 0x224466
252
	mcall	SF_DRAW_NUMBER, 0x00020000,,150 * 65536 + 65, 0x224466
Line 247... Line 253...
247
 
253
 
248
	mov	ebx,ecx
254
	mov	ebx,ecx
249
	mov	ecx,2
255
	mov	ecx,2
250
	mov	edi,[store_text_area_start]
256
	mov	edi,[store_text_area_start]
Line 262... Line 268...
262
	inc	ah
268
	inc	ah
263
	jo	@f
269
	jo	@f
264
	call	Try_MMIO
270
	call	Try_MMIO
265
@@:
271
@@:
266
.end:
272
.end:
267
	mcall	12, 2			; end of draw
273
	mcall	SF_REDRAW, SSF_END_DRAW
268
	ret
274
	ret
269
;-----------------------------------------------------------------------------
275
;-----------------------------------------------------------------------------
270
store_data:
276
store_data:
271
	mov	eax,[store_text_area_start]
277
	mov	eax,[store_text_area_start]
272
	mov	[fileinfo.return],eax
278
	mov	[fileinfo.return],eax
273
	mov	ebx,[store_text_area_end]
279
	mov	ebx,[store_text_area_end]
274
	sub	ebx,eax
280
	sub	ebx,eax
275
	inc	ebx
281
	inc	ebx
276
	mov	[fileinfo.size],ebx
282
	mov	[fileinfo.size],ebx
277
	mcall	70,fileinfo
283
	mcall	SF_FILE,fileinfo
278
	ret
284
	ret
279
;-----------------------------------------------------------------------------
285
;-----------------------------------------------------------------------------
280
;* Gets the PCI Version and Last Bus
286
;* Gets the PCI Version and Last Bus
281
Get_PCI_Info:
287
Get_PCI_Info:
282
	mcall	62, 0
288
	mcall	SF_PCI, 0
283
	mov	word [PCI_Version], ax
289
	mov	word [PCI_Version], ax
284
	mcall	62, 1
290
	mcall	SF_PCI, 1
285
	mov	byte [PCI_LastBus], al
291
	mov	byte [PCI_LastBus], al
286
	;----------------------------------------------------------
292
	;----------------------------------------------------------
287
	;* Get all devices on PCI Bus
293
	;* Get all devices on PCI Bus
288
	cmp	al, 0xff		; 0xFF means no pci bus found
294
	cmp	al, 0xff		; 0xFF means no pci bus found
289
	jne	Pci_Exists		;
295
	jne	Pci_Exists		;
Line 296... Line 302...
296
Start_Enum:
302
Start_Enum:
297
	mov	bl, 6			; get a dword
303
	mov	bl, 6			; get a dword
298
	mov	bh, byte [V_Bus]	; bus of pci device
304
	mov	bh, byte [V_Bus]	; bus of pci device
299
	mov	ch, byte [V_Dev]	; device number/function
305
	mov	ch, byte [V_Dev]	; device number/function
300
	mov	cl, 0			; offset to device/vendor id
306
	mov	cl, 0			; offset to device/vendor id
301
	mcall	62			; get ID's
307
	mcall	SF_PCI			; get ID's
Line 302... Line 308...
302
 
308
 
303
	cmp	ax, 0			; Vendor ID should not be 0 or 0xFFFF
309
	cmp	ax, 0			; Vendor ID should not be 0 or 0xFFFF
Line 304... Line 310...
304
	je	nextDev 		; check next device if nothing exists here
310
	je	nextDev 		; check next device if nothing exists here
Line 311... Line 317...
311
	mov	word [PCI_Device], ax	;
317
	mov	word [PCI_Device], ax	;
312
	mov	bl, 4			; Read config byte
318
	mov	bl, 4			; Read config byte
313
	mov	bh, byte [V_Bus]	; Bus #
319
	mov	bh, byte [V_Bus]	; Bus #
314
	mov	ch, byte [V_Dev]	; Device # on bus
320
	mov	ch, byte [V_Dev]	; Device # on bus
315
	mov	cl, 0x08		; Register to read (Get Revision)
321
	mov	cl, 0x08		; Register to read (Get Revision)
316
	mcall	62			; Read it
322
	mcall	SF_PCI			; Read it
Line 317... Line 323...
317
 
323
 
318
	mov	byte [PCI_Rev], al	; Save it
324
	mov	byte [PCI_Rev], al	; Save it
319
	mov	cl, 0x0b		; Register to read (Get class)
325
	mov	cl, 0x0b		; Register to read (Get class)
Line 320... Line 326...
320
	mcall	62			; Read it
326
	mcall	SF_PCI			; Read it
321
 
327
 
322
	mov	byte [PCI_Class], al	; Save it
328
	mov	byte [PCI_Class], al	; Save it
323
	mov	cl, 0x0a		; Register to read (Get Subclass)
329
	mov	cl, 0x0a		; Register to read (Get Subclass)
324
	mcall	62			; Read it
330
	mcall	SF_PCI			; Read it
325
	mov	byte [PCI_SubClass], al; Save it
331
	mov	byte [PCI_SubClass], al; Save it
326
; by Mario79 august 2006
332
; by Mario79 august 2006
Line 327... Line 333...
327
	mov	cl, 0x09		; Register to read (Get Interface)
333
	mov	cl, 0x09		; Register to read (Get Interface)
328
	mcall	62			; Read it
334
	mcall	SF_PCI			; Read it
329
 
335
 
330
	mov  [PCI_Interface], al	; Save it
336
	mov  [PCI_Interface], al	; Save it
331
;
337
;
332
; by Ghost april 2007
338
; by Ghost april 2007
Line 333... Line 339...
333
	mov	cl, 0x3c		; Register to read (Get IRQ)
339
	mov	cl, 0x3c		; Register to read (Get IRQ)
334
@@:
340
@@:
335
	mcall	62			; Read it
341
	mcall	SF_PCI			; Read it
336
 
342
 
Line 337... Line 343...
337
	mov	[PCI_IRQ], al		; Save it
343
	mov	[PCI_IRQ], al		; Save it
338
; by CleverMouse juny 2011
344
; by CleverMouse juny 2011
339
	mov	cl, 0x0e
345
	mov	cl, 0x0e
340
	mcall	62
346
	mcall	SF_PCI
Line 373... Line 379...
373
	mov 	cl, [MMIO_allowed]
379
	mov 	cl, [MMIO_allowed]
374
	or	cl,cl
380
	or	cl,cl
375
	jz	no_ummio_here
381
	jz	no_ummio_here
376
	mov 	ch, byte [V_Bus]
382
	mov 	ch, byte [V_Bus]
377
	mov 	cl, byte [V_Dev]
383
	mov 	cl, byte [V_Dev]
378
	mcall	62, 11		; detect uMMIO
384
	mcall	SF_PCI, 11		; detect uMMIO
Line 379... Line 385...
379
 
385
 
380
	and	ax,0x7fff
386
	and	ax,0x7fff
381
	inc 	ax			; -1 returned?
387
	inc 	ax			; -1 returned?
Line 404... Line 410...
404
	add 	bl, '0'
410
	add 	bl, '0'
405
	mov 	[PCIWin + 133], bl	; uMMIO function
411
	mov 	[PCIWin + 133], bl	; uMMIO function
Line 406... Line 412...
406
 
412
 
407
no_ummio_here:
413
no_ummio_here:
408
	movzx	ecx,word [PCI_Vendor]	; Pointer to number to be written
414
	movzx	ecx,word [PCI_Vendor]	; Pointer to number to be written
Line 409... Line 415...
409
	mcall	47, 0x00040100		; Write Vendor ID
415
	mcall	SF_DRAW_NUMBER, 0x00040100		; Write Vendor ID
Line 410... Line 416...
410
 
416
 
411
	call	store_4_digits
417
	call	store_4_digits
Line 505... Line 511...
505
	cmp	ax, cx
511
	cmp	ax, cx
506
	jne	.fn
512
	jne	.fn
Line 507... Line 513...
507
 
513
 
508
.find:
514
.find:
509
	mov	edx, [edx - 4]
515
	mov	edx, [edx - 4]
Line 510... Line 516...
510
	mcall	4,, 0x80000000		; lets print the vendor Name
516
	mcall	SF_DRAW_TEXT,, 0x80000000		; lets print the vendor Name
511
 
517
 
512
	mov	[store_text_size],42
518
	mov	[store_text_size],42
513
	call	store_text
519
	call	store_text
Line 545... Line 551...
545
 
551
 
546
	mov	edx, [Classes + esi * 8 - 4]
552
	mov	edx, [Classes + esi * 8 - 4]
547
@@:
553
@@:
548
	and	ebx, 0x0000FFFF 	; clear X position
554
	and	ebx, 0x0000FFFF 	; clear X position
549
	or	ebx, 0x24E0000		; set X position to 590 pixels
555
	or	ebx, 0x24E0000		; set X position to 590 pixels
Line 550... Line 556...
550
	mcall	4,, 0x80000000,, 32	; draw the text
556
	mcall	SF_DRAW_TEXT,, 0x80000000,, 32	; draw the text
551
 
557
 
552
	mov	[store_text_size],0
558
	mov	[store_text_size],0
Line 566... Line 572...
566
	xor	ebx, ebx
572
	xor	ebx, ebx
567
	mov	edx, ebx
573
	mov	edx, ebx
568
	mov	bh, [MMIO_BAR]
574
	mov	bh, [MMIO_BAR]
569
	or	bx, 12			; function 12
575
	or	bx, 12			; function 12
570
	mov	ecx, 4096		; =1 page to map
576
	mov	ecx, 4096		; =1 page to map
571
	mcall	62
577
	mcall	SF_PCI
Line 572... Line 578...
572
 
578
 
573
	mov	[MMIO_Map], eax 	; store MMIO lin.addr.
579
	mov	[MMIO_Map], eax 	; store MMIO lin.addr.
574
	mov	ecx, 0x80990022 	; print color : red
580
	mov	ecx, 0x80990022 	; print color : red
575
	add	bh, '0'
581
	add	bh, '0'
576
	cmp	eax, -3
582
	cmp	eax, -3
Line 577... Line 583...
577
	jne	@f
583
	jne	@f
578
 
584
 
579
	mov	[bar_um+3], bh
585
	mov	[bar_um+3], bh
580
	mov	ebx, [gr_pos]
586
	mov	ebx, [gr_pos]
Line 581... Line 587...
581
	mov	edx, bar_um
587
	mov	edx, bar_um
582
	mcall	4
588
	mcall	SF_DRAW_TEXT
583
 
589
 
584
	jmp	mmio_next_bar
590
	jmp	mmio_next_bar
585
@@:
591
@@:
586
	cmp	eax, -4
592
	cmp	eax, -4
587
	jne	@f
593
	jne	@f
588
	mov	[bar_io+3], bh
594
	mov	[bar_io+3], bh
Line 589... Line 595...
589
	mov	ebx, [gr_pos]
595
	mov	ebx, [gr_pos]
590
	mov	edx, bar_io
596
	mov	edx, bar_io
591
	mcall	4
597
	mcall	SF_DRAW_TEXT
592
 
598
 
593
	jmp	mmio_next_bar
599
	jmp	mmio_next_bar
594
@@:
600
@@:
595
	cmp	bh, '6' 	; expansion ROM ?
601
	cmp	bh, '6' 	; expansion ROM ?
596
	je	@f
602
	je	@f
Line 597... Line 603...
597
	mov	[bar_ram+3], bh
603
	mov	[bar_ram+3], bh
598
	mov	ebx, [gr_pos]
604
	mov	ebx, [gr_pos]
599
	mov	edx, bar_ram
605
	mov	edx, bar_ram
600
	mcall	4
606
	mcall	SF_DRAW_TEXT
601
 
607
 
602
	jmp	mmio_dump
608
	jmp	mmio_dump
Line 603... Line 609...
603
;-----------------------------------------------------------------------------
609
;-----------------------------------------------------------------------------
604
@@:
610
@@:
605
	mov	ebx, [gr_pos]
611
	mov	ebx, [gr_pos]
606
	mov	edx, bar_rom
612
	mov	edx, bar_rom
607
	mcall	4
613
	mcall	SF_DRAW_TEXT
608
 
614
 
609
mmio_dump:
615
mmio_dump:
Line 610... Line 616...
610
	mov	edx, [MMIO_Map]
616
	mov	edx, [MMIO_Map]
611
	mov	esi, 64
617
	mov	esi, 64
Line 612... Line 618...
612
	mov	ecx, 0x099		; dump color : blue
618
	mov	ecx, 0x099		; dump color : blue
613
	add	ebx, 10
619
	add	ebx, 10
614
	mov	[gr_pos], ebx
620
	mov	[gr_pos], ebx
615
	mcall	4
621
	mcall	SF_DRAW_TEXT
Line 668... Line 674...
668
	ret
674
	ret
669
;-----------------------------------------------------------------------------
675
;-----------------------------------------------------------------------------
670
store_NA:
676
store_NA:
671
	pusha
677
	pusha
672
	mov	ebx,edx
678
	mov	ebx,edx
673
	mcall	4,,0x80000000,text_NA
679
	mcall	SF_DRAW_TEXT,,0x80000000,text_NA
674
	mov	edi,[store_text_area_end]
680
	mov	edi,[store_text_area_end]
675
	mov	ax,[edx]
681
	mov	ax,[edx]
676
	mov	[edi+1],ax
682
	mov	[edi+1],ax
677
	add	[store_text_area_end],dword 5
683
	add	[store_text_area_end],dword 5
678
	popa
684
	popa
Line 779... Line 785...
779
text_NA:
785
text_NA:
780
	db '--',0
786
	db '--',0
781
;---------------------------------------------------------------------
787
;---------------------------------------------------------------------
782
system_dir_ProcLib	db '/sys/lib/proc_lib.obj',0
788
system_dir_ProcLib	db '/sys/lib/proc_lib.obj',0
Line 783... Line -...
783
 
-
 
784
err_message_found_lib2	db 'proc_lib.obj - Not found!',0
-
 
785
 
-
 
786
err_message_import2	db 'proc_lib.obj - Wrong import!',0
-
 
787
 
-
 
788
head_f_i:
-
 
789
head_f_l	db 'error',0
789
 
790
;---------------------------------------------------------------------
790
;---------------------------------------------------------------------
Line 791... Line 791...
791
l_libs_start:
791
l_libs_start:
792
 
-
 
Line 793... Line 792...
793
library02  l_libs system_dir_ProcLib+9, path, library_path, system_dir_ProcLib, \
792
 
794
err_message_found_lib2, head_f_l, ProcLib_import, err_message_import2, head_f_i
793
library02  l_libs system_dir_ProcLib+9, library_path, system_dir_ProcLib, ProcLib_import
795
 
794
 
796
end_l_libs:
795
end_l_libs: