Subversion Repositories Kolibri OS

Rev

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

Rev 928 Rev 996
Line 56... Line 56...
56
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
56
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
57
 
57
 
Line 58... Line 58...
58
include 'macros.inc'
58
include 'macros.inc'
Line 59... Line 59...
59
 
59
 
Line 60... Line 60...
60
$Revision: 928 $
60
$Revision: 996 $
Line 61... Line 61...
61
 
61
 
Line 132... Line 132...
132
public _rd_fat_end
132
public _rd_fat_end
133
public _rd_root
133
public _rd_root
134
public _rd_root_end
134
public _rd_root_end
135
 
135
 
Line -... Line 136...
-
 
136
public _current_task
136
public _current_slot
137
public _current_slot
137
public _current_thread
138
public _current_thread
138
public _k_reenter
139
public _k_reenter
Line 139... Line 140...
139
 
140
 
Line 194... Line 195...
194
public scr_mode
195
public scr_mode
195
public LFBAddress
196
public LFBAddress
196
public LFBSize
197
public LFBSize
Line -... Line 198...
-
 
198
 
-
 
199
public _screen_width
-
 
200
public _screen_height
-
 
201
 
-
 
202
public _vesa20_drawbar
Line 197... Line 203...
197
 
203
 
Line 198... Line 204...
198
 
204
 
Line 292... Line 298...
292
 
298
 
Line 293... Line 299...
293
align 4
299
align 4
294
init_apm:
300
init_apm:
295
; init selectors
301
; init selectors
296
    mov ebx,    [BOOT_VAR +0x9040]    ; offset of APM entry point
302
    mov ebx,    [OS_BASE +0x9040]    ; offset of APM entry point
297
    movzx eax, word [BOOT_VAR+0x9050] ; real-mode segment base address of
303
    movzx eax, word [OS_BASE+0x9050] ; real-mode segment base address of
298
				      ; protected-mode 32-bit code segment
304
				      ; protected-mode 32-bit code segment
299
    movzx ecx, word [BOOT_VAR+0x9052] ; real-mode segment base address of
305
    movzx ecx, word [OS_BASE+0x9052] ; real-mode segment base address of
300
				      ; protected-mode 16-bit code segment
306
				      ; protected-mode 16-bit code segment
301
    movzx edx, word [BOOT_VAR+0x9054] ; real-mode segment base address of
307
    movzx edx, word [OS_BASE+0x9054] ; real-mode segment base address of
302
				      ; protected-mode 16-bit data segment
308
				      ; protected-mode 16-bit data segment
Line 303... Line 309...
303
 
309
 
304
    shl    eax, 4
310
    shl    eax, 4
305
    mov    [dword apm_code_32 + 2], ax
311
    mov    [dword apm_code_32 + 2], ax
Line 318... Line 324...
318
 
324
 
Line 319... Line 325...
319
    mov    dword[apm_entry], ebx
325
    mov    dword[apm_entry], ebx
320
    mov    word [apm_entry + 4], apm_code_32 - _gdts
326
    mov    word [apm_entry + 4], apm_code_32 - _gdts
Line 321... Line 327...
321
 
327
 
322
    mov    eax, [BOOT_VAR + 0x9044]    ; version & flags
328
    mov    eax, [OS_BASE + 0x9044]    ; version & flags
323
    mov    [apm_vf], eax
329
    mov    [apm_vf], eax
Line 324... Line 330...
324
    ret
330
    ret
325
 
331
 
Line 330... Line 336...
330
 
336
 
Line 331... Line 337...
331
           call init_apm
337
           call init_apm
Line 332... Line 338...
332
 
338
 
333
; SAVE REAL MODE VARIABLES
339
; SAVE REAL MODE VARIABLES
334
        mov   ax, [BOOT_VAR + 0x9031]
340
        mov   ax, [OS_BASE + 0x9031]
Line 335... Line 341...
335
        mov   [IDEContrRegsBaseAddr], ax
341
        mov   [IDEContrRegsBaseAddr], ax
336
 
342
 
Line 337... Line 343...
337
        mov   al, [BOOT_VAR+0x901F]       ; DMA access
343
        mov   al, [OS_BASE+0x901F]       ; DMA access
338
        mov   [allow_dma_access], al
344
        mov   [allow_dma_access], al
Line 339... Line 345...
339
 
345
 
-
 
346
        movzx eax, byte [OS_BASE+0x9000]    ; bpp
-
 
347
        mov   [ScreenBPP], eax
-
 
348
 
340
        movzx eax, byte [BOOT_VAR+0x9000]    ; bpp
349
        movzx eax,word [OS_BASE+0x900A]  ; X max
-
 
350
        movzx ebx,word [OS_BASE+0x900C]  ; Y max
341
        mov   [ScreenBPP], eax
351
        mov   [_screen_width],  eax
342
 
352
        mov   [_screen_height], ebx
343
        movzx eax,word [BOOT_VAR+0x900A]  ; X max
-
 
344
        dec   eax
-
 
345
        mov   [Screen_Max_X],eax
353
        dec   eax
346
        mov   [screen_workarea.right],eax
354
        dec   ebx
347
        movzx eax,word [BOOT_VAR+0x900C]  ; Y max
355
        mov   [Screen_Max_X],eax
348
        dec   eax
356
        mov   [screen_workarea.right],eax
349
        mov   [Screen_Max_Y],eax
357
        mov   [Screen_Max_Y],ebx
350
        mov   [screen_workarea.bottom],eax
358
        mov   [screen_workarea.bottom],ebx
351
        mov   [BytesPerScanLine], 640*4
359
        mov   [BytesPerScanLine], 640*4
Line 352... Line 360...
352
        cmp   [scr_mode], 0x13      ; 320x200
360
        cmp   [scr_mode], 0x13      ; 320x200
353
        je    @f
361
        je    @f
354
        cmp   [scr_mode], 0x12      ; VGA 640x480
362
        cmp   [scr_mode], 0x12      ; VGA 640x480
355
        je    @f
363
        je    @f
356
 
364
 
357
        movzx   eax, word [BOOT_VAR+0x9001]    ; for other modes
365
        movzx   eax, word [OS_BASE+0x9001]    ; for other modes
358
        mov   [BytesPerScanLine], eax
366
        mov   [BytesPerScanLine], eax
359
@@:
367
@@:
Line 360... Line 368...
360
        mov esi, BOOT_VAR+0x9080
368
        mov esi, OS_BASE+0x9080
Line 361... Line 369...
361
        movzx   ecx, byte [esi-1]
369
        movzx   ecx, byte [esi-1]
Line 362... Line 370...
362
        mov [NumBiosDisks], ecx
370
        mov [NumBiosDisks], ecx
363
        mov edi, BiosDisksData
371
        mov edi, BiosDisksData
364
        rep movsd
372
        rep movsd
365
 
373
 
Line 985... Line 993...
985
        mov   [KEY_COUNT], 0             ; keyboard buffer
993
        mov   [KEY_COUNT], 0             ; keyboard buffer
986
        mov   [BTN_COUNT], 0                 ; button buffer
994
        mov   [BTN_COUNT], 0                 ; button buffer
Line 987... Line 995...
987
 
995
 
988
        push  eax
996
        push  eax
989
        mov   ax,[BOOT_VAR+0x900c]
997
        mov   ax,[OS_BASE+0x900c]
990
        shr   ax,1
998
        shr   ax,1
991
        shl   eax,16
999
        shl   eax,16
992
        mov   ax,[BOOT_VAR+0x900A]
1000
        mov   ax,[OS_BASE+0x900A]
993
        shr   ax,1
1001
        shr   ax,1
994
        mov   dword [MOUSE_X], eax
1002
        mov   dword [MOUSE_X], eax
Line 995... Line 1003...
995
        pop   eax
1003
        pop   eax
Line 1444... Line 1452...
1444
     mov  [pci_access_enabled],ebx
1452
     mov  [pci_access_enabled],ebx
1445
     ret
1453
     ret
1446
   no_set_pci_access:
1454
   no_set_pci_access:
1447
 
1455
 
Line 1448... Line -...
1448
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
 
1449
include 'vmodeint.inc'
-
 
1450
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
 
1451
 
-
 
1452
sys_setup_err:
1456
sys_setup_err:
1453
     mov  [esp+36],dword -1
1457
     mov  [esp+36],dword -1
1454
     ret
1458
     ret
Line 1455... Line 1459...
1455
 
1459
 
Line 1797... Line 1801...
1797
     cmp  ecx,1
1801
     cmp  ecx,1
1798
     jl   exit_for_anyone
1802
     jl   exit_for_anyone
1799
     cmp  ecx,4
1803
     cmp  ecx,4
1800
     jg   exit_for_anyone
1804
     jg   exit_for_anyone
1801
     mov  [BOOT_VAR+0x9030],cl
1805
     mov  [OS_BASE+0x9030],cl
1802
 
1806
 
Line 1803... Line 1807...
1803
     mov  eax,[TASK_COUNT]
1807
     mov  eax,[TASK_COUNT]
1804
     mov  [sys_shutdown], eax
1808
     mov  [sys_shutdown], eax
1805
     mov  [shutdown_processes],eax
1809
     mov  [shutdown_processes],eax
1806
     and  dword [esp+32], 0
1810
     and  dword [esp+32], 0
Line 2315... Line 2319...
2315
    cmp   eax,1 				 ; SIZE
2319
    cmp   eax,1 				 ; SIZE
2316
    jnz   nogb1
2320
    jnz   nogb1
2317
    mov   eax,[BgrDataWidth]
2321
    mov   eax,[BgrDataWidth]
2318
    shl   eax,16
2322
    shl   eax,16
2319
    mov   ax,[BgrDataHeight]
2323
    mov   ax, word [BgrDataHeight]
2320
    mov   [esp+36],eax
2324
    mov   [esp+36],eax
2321
    ret
2325
    ret
Line 2322... Line 2326...
2322
 
2326
 
Line 2628... Line 2632...
2628
	cmp	ebx, 2
2632
	cmp	ebx, 2
2629
	jnz	srl1
2633
	jnz	srl1
Line 2630... Line 2634...
2630
 
2634
 
2631
	mov	edx, [TASK_BASE]      ; return whole screen draw area for this app
2635
	mov	edx, [TASK_BASE]      ; return whole screen draw area for this app
2632
	add	edx, draw_data - CURRENT_TASK
2636
    sub edx, CURRENT_TASK
2633
	mov	[edx + RECT.left], 0
2637
    mov [edx +draw_data + RECT.left], 0
2634
	mov	[edx + RECT.top], 0
2638
    mov [edx +draw_data+ RECT.top], 0
2635
	mov	eax, [Screen_Max_X]
2639
	mov	eax, [Screen_Max_X]
2636
	mov	[edx + RECT.right], eax
2640
    mov [edx +draw_data+ RECT.right], eax
2637
	mov	eax, [Screen_Max_Y]
2641
	mov	eax, [Screen_Max_Y]
Line 2638... Line 2642...
2638
	mov	[edx + RECT.bottom], eax
2642
    mov [edx +draw_data+ RECT.bottom], eax
2639
 
2643
 
2640
	mov	edi, [TASK_BASE]
-
 
2641
	or	[edi - twdw + WDATA.fl_wdrawn], 1   ; no new position & buttons from app
2644
	mov	edi, [TASK_BASE]
Line 2642... Line 2645...
2642
	call	sys_window_mouse
2645
	or	[edi - twdw + WDATA.fl_wdrawn], 1   ; no new position & buttons from app
2643
	ret
2646
	ret
Line 2670... Line 2673...
2670
    inc   [mouse_pause]
2673
    inc   [mouse_pause]
2671
    call  [disable_mouse]
2674
    call  [disable_mouse]
2672
    call  sys_set_window
2675
    call  sys_set_window
2673
    call  [disable_mouse]
2676
    call  [disable_mouse]
2674
    call  sys_window_mouse
2677
    dec   [mouse_pause]
2675
    dec   [mouse_pause]
-
 
2676
    call   [draw_pointer]
2678
    call   [draw_pointer]
2677
    ret
2679
    ret
2678
  nosyswII:
2680
  nosyswII:
2679
 
2681
 
Line 2908... Line 2910...
2908
    ; check flag (?)
2910
    ; check flag (?)
2909
    test  [edi+WDATA.fl_wdrawn],1
2911
    test  [edi+WDATA.fl_wdrawn],1
2910
    jnz   newd
2912
    jnz   newd
Line 2911... Line -...
2911
 
-
 
2912
    mov   eax,[timer_ticks] ;[0xfdf0]
-
 
2913
    add   eax,100
-
 
2914
    mov   [new_window_starting],eax
-
 
2915
 
2913
 
2916
    movsx eax,bx
2914
    movsx eax,bx
2917
    mov   [edi+WDATA.box.width],eax
2915
    mov   [edi+WDATA.box.width],eax
2918
    movsx eax,cx
2916
    movsx eax,cx
2919
    mov   [edi+WDATA.box.height],eax
2917
    mov   [edi+WDATA.box.height],eax
Line 3098... Line 3096...
3098
	mov   eax,edi		    ; redraw screen at old position
3096
	mov   eax,edi		    ; redraw screen at old position
3099
	xor   esi,esi
3097
	xor   esi,esi
3100
	call  redrawscreen
3098
	call  redrawscreen
Line 3101... Line -...
3101
 
-
 
3102
    mov   [dont_draw_mouse], 0   ; mouse pointer
-
 
3103
    mov   [mouse_background], 0  ; no mouse under
-
 
3104
 
3099
 
Line 3105... Line 3100...
3105
	call  [draw_pointer]
3100
	call  [draw_pointer]
Line 3106... Line 3101...
3106
 
3101
 
Line 3432... Line 3427...
3432
	 cmp   al,2
3427
	 cmp   al,2
3433
	 jz    newdw8
3428
	 jz    newdw8
3434
	 test  al,al
3429
	 test  al,al
3435
	 jz    .az
3430
	 jz    .az
3436
	 lea   eax,[edi+draw_data-window_data]
3431
     lea   eax,[edi+draw_data+(0x100000000-OS_BASE)]
3437
	 mov   ebx,[dlx]
3432
	 mov   ebx,[dlx]
3438
	 cmp   ebx,[eax+RECT.left]
3433
	 cmp   ebx,[eax+RECT.left]
3439
	 jae   @f
3434
	 jae   @f
3440
	 mov   [eax+RECT.left],ebx
3435
	 mov   [eax+RECT.left],ebx
3441
	@@:
3436
@@:
3442
	 mov   ebx,[dly]
3437
	 mov   ebx,[dly]
Line 3457... Line 3452...
3457
	 jmp   newdw8
3452
	 jmp   newdw8
3458
	.az:
3453
.az:
3459
 
3454
 
Line 3460... Line 3455...
3460
	 mov   eax,edi
3455
	 mov   eax,edi
3461
	 add   eax,draw_data-window_data
3456
     add   eax, draw_data+(0x100000000-OS_BASE)
Line 3462... Line 3457...
3462
 
3457
 
3463
	 mov   ebx,[dlx]	  ; set limits
3458
	 mov   ebx,[dlx]	  ; set limits
3464
	 mov   [eax + RECT.left], ebx
3459
	 mov   [eax + RECT.left], ebx
3465
	 mov   ebx,[dly]
3460
	 mov   ebx,[dly]
3466
	 mov   [eax + RECT.top], ebx
3461
	 mov   [eax + RECT.top], ebx
3467
	 mov   ebx,[dlxe]
3462
	 mov   ebx,[dlxe]
3468
	 mov   [eax + RECT.right], ebx
3463
	 mov   [eax + RECT.right], ebx
3469
	 mov   ebx,[dlye]
3464
	 mov   ebx,[dlye]
Line 3470... Line 3465...
3470
	 mov   [eax + RECT.bottom], ebx
3465
	 mov   [eax + RECT.bottom], ebx
Line 3471... Line 3466...
3471
 
3466
 
3472
	 sub   eax,draw_data-window_data
3467
     sub   eax,draw_data+(0x100000000-OS_BASE)
3473
 
3468
 
Line 5092... Line 5087...
5092
 
5087
 
Line 5093... Line 5088...
5093
align 4
5088
align 4
5094
system_shutdown:	  ; shut down the system
5089
system_shutdown:	  ; shut down the system
Line 5095... Line 5090...
5095
 
5090
 
5096
	   cmp byte [BOOT_VAR+0x9030], 1
5091
       cmp byte [OS_BASE+0x9030], 1
5097
	   jne @F
5092
	   jne @F
5098
	   ret
5093
	   ret
5099
@@:
5094
@@:
5100
	   call stop_all_services
5095
	   call stop_all_services
Line 5105... Line 5100...
5105
yes_shutdown_param:
5100
yes_shutdown_param:
Line 5106... Line 5101...
5106
 
5101
 
Line 5107... Line 5102...
5107
	   cli
5102
	   cli
5108
 
5103
 
Line 5109... Line 5104...
5109
           cmp byte [BOOT_VAR+0x9030], 3
5104
           cmp byte [OS_BASE+0x9030], 3
5110
           je _sys_reboot
5105
           je _sys_reboot
Line 5111... Line 5106...
5111
 
5106
 
5112
           cmp byte [BOOT_VAR+0x9030], 4
5107
           cmp byte [OS_BASE+0x9030], 4
5113
           je _sys_restart
5108
           je _sys_restart
Line 5146... Line 5141...
5146
 
5141
 
Line 5147... Line 5142...
5147
           call restorefatchain
5142
           call restorefatchain
Line 5148... Line 5143...
5148
 
5143
 
5149
           cld
-
 
5150
           mov  esi, BOOT_VAR    ; restore 0x0 - 0xffff
-
 
5151
           mov  edi, OS_BASE
-
 
5152
           mov  ecx,0x10000/4
-
 
Line 5153... Line 5144...
5153
           rep movsd
5144
           cld
5154
 
5145
 
Line 5155... Line 5146...
5155
         ;  mov eax, [_copy_pg_balloc]
5146
         ;  mov eax, [_copy_pg_balloc]