Subversion Repositories Kolibri OS

Rev

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

Rev 1710 Rev 1859
Line 56... Line 56...
56
;;
56
;;
57
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
57
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 58... Line 58...
58
 
58
 
Line 59... Line 59...
59
include 'macros.inc'
59
include 'macros.inc'
Line 60... Line 60...
60
 
60
 
Line 61... Line 61...
61
$Revision: 1710 $
61
$Revision: 1859 $
Line 318... Line 318...
318
    mov    word [apm_entry + 4], apm_code_32 - gdts
318
    mov    word [apm_entry + 4], apm_code_32 - gdts
Line 319... Line 319...
319
 
319
 
320
    mov    eax, [BOOT_VAR + 0x9044]    ; version & flags
320
    mov    eax, [BOOT_VAR + 0x9044]    ; version & flags
321
    mov    [apm_vf], eax
321
    mov    [apm_vf], eax
322
; -----------------------------------------
-
 
323
;        movzx eax,byte [BOOT_VAR+0x9010]       ; mouse port
-
 
324
;        mov   [0xF604],byte 1  ;al
322
; -----------------------------------------
325
		mov	al, [BOOT_VAR+0x901F]		; DMA access
323
		mov	al, [BOOT_VAR+0x901F]		; DMA access
326
	mov	[allow_dma_access], al
324
	mov	[allow_dma_access], al
327
	movzx eax, byte [BOOT_VAR+0x9000]	 ; bpp
325
	mov   eax, 32	 			; <<<<<<<<<  bpp
Line 328... Line 326...
328
	mov [ScreenBPP],al
326
	mov [ScreenBPP],al
329
 
327
 
330
	mov [_display.bpp], eax
328
	mov [_display.bpp], eax
Line 334... Line 332...
334
	movzx eax,word [BOOT_VAR+0x900A]  ; X max
332
	movzx eax,word [BOOT_VAR+0x900A]  ; X max
335
	mov [_display.width], eax
333
	mov [_display.width], eax
336
	dec   eax
334
	dec   eax
337
	mov   [Screen_Max_X],eax
335
	mov   [Screen_Max_X],eax
338
	mov   [screen_workarea.right],eax
336
	mov   [screen_workarea.right],eax
-
 
337
	inc	eax
-
 
338
	shr	eax, 2
-
 
339
	mov	[_WinMapWidth], eax             ; 1 tyle = 4 pixels
339
	movzx eax,word [BOOT_VAR+0x900C]  ; Y max
340
	movzx eax,word [BOOT_VAR+0x900C]        ; Y max
340
	mov [_display.height], eax
341
	mov   [_display.height], eax
341
	dec   eax
342
	dec   eax
342
	mov   [Screen_Max_Y],eax
343
	mov   [Screen_Max_Y],eax
343
	mov   [screen_workarea.bottom],eax
344
	mov   [screen_workarea.bottom],eax
344
	movzx eax,word [BOOT_VAR+0x9008]  ; screen mode
345
	movzx eax,word [BOOT_VAR+0x9008]        ; screen mode
345
	mov   [SCR_MODE],eax
346
	mov   [SCR_MODE],eax
346
	mov   eax,[BOOT_VAR+0x9014]	  ; Vesa 1.2 bnk sw add
347
	mov   eax,[BOOT_VAR+0x9014]	        ; Vesa 1.2 bnk sw add
347
	mov   [BANK_SWITCH],eax
348
	mov   [BANK_SWITCH],eax
348
	mov   [BytesPerScanLine],word 640*4	    ; Bytes PerScanLine
-
 
349
	cmp   [SCR_MODE],word 0x13	    ; 320x200
-
 
350
	je    @f
-
 
351
	cmp   [SCR_MODE],word 0x12	    ; VGA 640x480
-
 
352
	je    @f
-
 
353
	movzx eax, word[BOOT_VAR+0x9001]	; for other modes
349
	movzx eax, word[BOOT_VAR+0x9001]        ; for other modes
354
	mov   [BytesPerScanLine],ax
350
	mov   [BytesPerScanLine],ax
355
	mov [_display.pitch], eax
351
	mov   [_display.pitch], eax
356
@@:
352
@@:
357
	mov eax, [_display.width]
353
	mov   eax, [_display.height]
-
 
354
	shr   eax, 1
358
	mul [_display.height]
355
	mul   [_WinMapWidth]
359
	mov [_WinMapSize], eax
356
	mov   [_WinMapSize], eax
Line 360... Line 357...
360
 
357
 
361
	mov	esi, BOOT_VAR+0x9080
358
	mov	esi, BOOT_VAR+0x9080
362
	movzx	ecx, byte [esi-1]
359
	movzx	ecx, byte [esi-1]
Line 498... Line 495...
498
	mov	[graph_data_l+2],ax
495
	mov	[graph_data_l+2],ax
499
	shr	eax,16
496
	shr	eax,16
500
	mov	[graph_data_l+4],al
497
	mov	[graph_data_l+4],al
501
	mov	[graph_data_l+7],ah
498
	mov	[graph_data_l+7],ah
Line 502... Line 499...
502
	
499
	
503
	or      [KERNEL_ALLOC_FLAG], dword PG_NOCACHE
500
;	or      [KERNEL_ALLOC_FLAG], dword PG_NOCACHE
504
	stdcall kernel_alloc, [_WinMapSize]
501
	stdcall kernel_alloc, [_WinMapSize]
505
	mov     [_WinMapAddress], eax
502
	mov     [_WinMapAddress], eax
Line 506... Line 503...
506
	xor     [KERNEL_ALLOC_FLAG], dword PG_NOCACHE
503
;	xor     [KERNEL_ALLOC_FLAG], dword PG_NOCACHE
507
 
504
 
508
	xor  eax,eax
505
	xor  eax,eax
509
	inc  eax
506
	inc  eax
Line 604... Line 601...
604
 
601
 
605
; PRINT AMOUNT OF MEMORY
602
; PRINT AMOUNT OF MEMORY
606
	mov	esi, boot_memdetect
603
	mov	esi, boot_memdetect
Line -... Line 604...
-
 
604
	call	boot_log
-
 
605
 
-
 
606
; <<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>
-
 
607
	mov ebx, img_test_struct
-
 
608
	mov ecx, 3*65536 + 4
-
 
609
	mov edx, 32*65536 + 512
-
 
610
	mov esi, 32
-
 
611
        xor     edi, edi
-
 
612
	mov     ebp, edi
-
 
613
	call sys_putimage_palette.forced
-
 
614
 
607
	call	boot_log
615
;<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>	
608
 
616
 
609
	movzx	ecx, word [boot_y]
617
	movzx	ecx, word [boot_y]
610
	or	ecx, (10+29*6) shl 16 ; "Determining amount of memory"
618
	or	ecx, (10+29*6) shl 16 ; "Determining amount of memory"
611
	sub	ecx, 10
619
	sub	ecx, 10
Line 2239... Line 2247...
2239
draw_background_temp:
2247
draw_background_temp:
2240
;    cmp   [bgrchanged],1 ;0
2248
;    cmp   [bgrchanged],1 ;0
2241
;    je    nosb31
2249
;    je    nosb31
2242
;draw_background_temp:
2250
;draw_background_temp:
2243
;    mov   [bgrchanged],1 ;0
2251
;    mov   [bgrchanged],1 ;0
-
 
2252
 
2244
    mov    [background_defined], 1
2253
    mov    [background_defined], 1
2245
    mov    byte[BACKGROUND_CHANGED], 1
2254
    mov    byte[BACKGROUND_CHANGED], 1
2246
    call  force_redraw_background
2255
    call  force_redraw_background
2247
   nosb31:
2256
   nosb31:
2248
    ret
2257
    ret
Line 2836... Line 2845...
2836
ret
2845
ret
2837
;---------------------------------------------------------------------------------------------
2846
;---------------------------------------------------------------------------------------------
Line 2838... Line 2847...
2838
 
2847
 
-
 
2848
 
Line 2839... Line 2849...
2839
 
2849
; check if pixel is allowed to be drawn
2840
; check if pixel is allowed to be drawn
2850
; -- not in use any more ?
2841
 
2851
 
2842
checkpixel:
2852
;checkpixel:
2843
	push eax edx
2853
;	push eax ebx edx
2844
 
2854
;	shr  ebx, 1
2845
	mov  edx,[Screen_Max_X]     ; screen x size
2855
;	mov  edx, [_WinMapWidth]     ; <<<< 
2846
	inc  edx
2856
;	imul edx, ebx
2847
	imul edx, ebx
2857
;       shr  eax, 2
2848
	add  eax, [_WinMapAddress]
2858
;	add  eax, [_WinMapAddress]
2849
	mov  dl, [eax+edx] ; lea eax, [...]
2859
;	mov  dl,  [eax+edx] 		 
2850
 
2860
;
2851
	xor  ecx, ecx
2861
;	xor  ecx, ecx
2852
	mov  eax, [CURRENT_TASK]
2862
;	mov  eax, [CURRENT_TASK]
2853
	cmp  al, dl
2863
;	cmp  al, dl
2854
	setne cl
2864
;	setne cl
Line 2855... Line 2865...
2855
 
2865
;
2856
	pop  edx eax
2866
;	pop  edx ebx eax
2857
	ret
2867
;	ret
Line 2901... Line 2911...
2901
no_set_bgr_event:
2911
no_set_bgr_event:
2902
    cmp   byte[REDRAW_BACKGROUND], 0		   ; background update ?
2912
    cmp   byte[REDRAW_BACKGROUND], 0		   ; background update ?
2903
    jz	  nobackgr
2913
    jz	  nobackgr
2904
    cmp    [background_defined], 0
2914
    cmp    [background_defined], 0
2905
    jz	  nobackgr
2915
    jz	  nobackgr
2906
;    mov   [draw_data+32 + RECT.left],dword 0
-
 
2907
;    mov   [draw_data+32 + RECT.top],dword 0
-
 
2908
;    mov   eax,[Screen_Max_X]
-
 
2909
;    mov   ebx,[Screen_Max_Y]
-
 
2910
;    mov   [draw_data+32 + RECT.right],eax
-
 
2911
;    mov   [draw_data+32 + RECT.bottom],ebx
-
 
2912
@@:
2916
@@:
2913
    call  drawbackground
2917
    call  drawbackground
2914
    xor   eax, eax
2918
    xor   eax, eax
2915
    xchg  al, [REDRAW_BACKGROUND]
2919
    xchg  al, [REDRAW_BACKGROUND]
2916
    test  al, al				   ; got new update request?
2920
    test  al, al				   ; got new update request?
Line 2948... Line 2952...
2948
 
2952
 
2949
    dec  byte [SYS_SHUTDOWN]
2953
    dec  byte [SYS_SHUTDOWN]
Line 2950... Line 2954...
2950
    je	 system_shutdown
2954
    je	 system_shutdown
2951
 
-
 
2952
noshutdown:
-
 
2953
 
2955
 
2954
 
2956
noshutdown:
2955
    mov   eax,[TASK_COUNT]		    ; termination
2957
    mov   eax,[TASK_COUNT]		    ; termination
Line 2956... Line 2958...
2956
    mov   ebx,TASK_DATA+TASKDATA.state
2958
    mov   ebx,TASK_DATA+TASKDATA.state
Line 2968... Line 2970...
2968
    dec   eax
2970
    dec   eax
2969
    jnz   newct
2971
    jnz   newct
2970
    ret
2972
    ret
Line 2971... Line 2973...
2971
 
2973
 
2972
; redraw screen
-
 
2973
 
-
 
2974
redrawscreen:
-
 
2975
 
2974
; redraw screen
Line -... Line 2975...
-
 
2975
; eax , if process window_data base is eax, do not set flag/limits
2976
; eax , if process window_data base is eax, do not set flag/limits
2976
 
2977
 
2977
redrawscreen:
Line 2978... Line -...
2978
	 pushad
-
 
2979
	 push  eax
-
 
2980
 
-
 
2981
;;;         mov   ebx,2
2978
	 pushad
2982
;;;         call  delay_hs
-
 
2983
 
2979
	 push  eax
Line 2984... Line 2980...
2984
	 ;mov   ecx,0               ; redraw flags for apps
2980
 
2985
	 xor   ecx,ecx
2981
	 xor   ecx,ecx	                ; redraw flags for apps
Line 3032... Line 3028...
3032
 
3028
 
Line 3033... Line 3029...
3033
	bgli:
3029
	bgli:
3034
 
3030
 
3035
	 cmp   dword[esp], 1
-
 
3036
	 jnz   .az
-
 
3037
;         cmp   byte[BACKGROUND_CHANGED], 0
3031
	 cmp   dword[esp], 1
3038
;         jnz   newdw8
3032
	 jnz   .az
3039
	 cmp   byte[REDRAW_BACKGROUND], 0
3033
	 cmp   byte[REDRAW_BACKGROUND], 0
3040
	 jz    .az
3034
	 jz    .az
3041
	 mov   dl, 0
3035
	 mov   dl, 0
Line 3084... Line 3078...
3084
 
3078
 
3085
	 cmp   dword [esp],1
3079
	 cmp   dword [esp],1
3086
	 jne   nobgrd
3080
	 jne   nobgrd
Line -... Line 3081...
-
 
3081
	 inc   byte[REDRAW_BACKGROUND]
3087
	 inc   byte[REDRAW_BACKGROUND]
3082
 
3088
 
3083
 
Line 3089... Line 3084...
3089
       newdw8:
3084
       newdw8:
Line 3104... Line 3099...
3104
	 popad
3099
	 popad
Line 3105... Line 3100...
3105
 
3100
 
Line 3106... Line 3101...
3106
	 ret
3101
	 ret
3107
 
-
 
3108
calculatebackground:   ; background
3102
 
3109
 
3103
calculatebackground:   ; background
3110
	mov   edi, [_WinMapAddress]		   ; set os to use all pixels
3104
	mov   edi, [_WinMapAddress]		   ; set os to use all pixels
3111
	mov   eax,0x01010101
3105
	mov   eax,0x01010101
3112
	mov   ecx, [_WinMapSize]
3106
	mov   ecx, [_WinMapSize]
Line 3120... Line 3114...
3120
 
3114
 
3121
uglobal
3115
uglobal
3122
  imax	  dd 0x0
3116
  imax	  dd 0x0
Line 3123... Line -...
3123
endg
-
 
3124
 
-
 
3125
 
3117
endg
3126
 
-
 
3127
delay_ms:     ; delay in 1/1000 sec
-
 
3128
 
3118
 
3129
 
3119
delay_ms:     ; delay in 1/1000 sec
Line 3130... Line 3120...
3130
	push  eax
3120
	push  eax
3131
	push  ecx
3121
	push  ecx
Line 3152... Line 3142...
3152
	pop   ecx
3142
	pop   ecx
3153
	pop   eax
3143
	pop   eax
Line 3154... Line 3144...
3154
 
3144
 
Line 3155... Line -...
3155
	ret
-
 
3156
 
3145
	ret
3157
 
3146
 
3158
set_app_param:
3147
set_app_param:
3159
	mov	edi, [TASK_BASE]
3148
	mov	edi, [TASK_BASE]
3160
	mov	eax, [edi + TASKDATA.event_mask]
3149
	mov	eax, [edi + TASKDATA.event_mask]
3161
	mov	[edi + TASKDATA.event_mask], ebx
3150
	mov	[edi + TASKDATA.event_mask], ebx
Line 3162... Line -...
3162
	mov	[esp+32], eax
-
 
3163
	ret
-
 
3164
 
3151
	mov	[esp+32], eax
3165
 
3152
	ret
3166
 
3153
 
3167
delay_hs:     ; delay in 1/100 secs
3154
delay_hs:     ; delay in 1/100 secs
Line 3187... Line 3174...
3187
 
3174
 
Line 3188... Line 3175...
3188
	ret
3175
	ret
3189
 
3176
 
3190
align 16	;very often call this subrutine
-
 
3191
memmove:       ; memory move in bytes
3177
align 16	;very often call this subrutine
3192
 
3178
memmove:       ; memory move in bytes
3193
; eax = from
3179
; eax = from
3194
; ebx = to
3180
; ebx = to
3195
; ecx = no of bytes
3181
; ecx = no of bytes
Line 3217... Line 3203...
3217
    pop  ecx edi esi
3203
    pop  ecx edi esi
3218
  .ret:
3204
  .ret:
3219
    ret
3205
    ret
Line 3220... Line -...
3220
 
-
 
3221
 
-
 
3222
;  Sysfunction 34, read_floppy_file, is obsolete. Use 58 or 70 function instead.
-
 
3223
;align 4
-
 
3224
;
-
 
3225
;read_floppy_file:
-
 
3226
;
-
 
3227
;; as input
-
 
3228
;;
-
 
3229
;; eax pointer to file
-
 
3230
;; ebx file lenght
-
 
3231
;; ecx start 512 byte block number
-
 
3232
;; edx number of blocks to read
-
 
3233
;; esi pointer to return/work area (atleast 20 000 bytes)
-
 
3234
;;
-
 
3235
;;
-
 
3236
;; on return
-
 
3237
;;
-
 
3238
;; eax = 0 command succesful
-
 
3239
;;       1 no fd base and/or partition defined
-
 
3240
;;       2 yet unsupported FS
-
 
3241
;;       3 unknown FS
-
 
3242
;;       4 partition not defined at hd
-
 
3243
;;       5 file not found
-
 
3244
;; ebx = size of file
-
 
3245
;
-
 
3246
;     mov   edi,[TASK_BASE]
-
 
3247
;     add   edi,0x10
-
 
3248
;     add   esi,[edi]
-
 
3249
;     add   eax,[edi]
-
 
3250
;
-
 
3251
;     pushad
-
 
3252
;     mov  edi,esi
-
 
3253
;     add  edi,1024
-
 
3254
;     mov  esi,0x100000+19*512
-
 
3255
;     sub  ecx,1
-
 
3256
;     shl  ecx,9
-
 
3257
;     add  esi,ecx
-
 
3258
;     shl  edx,9
-
 
3259
;     mov  ecx,edx
-
 
3260
;     cld
-
 
3261
;     rep  movsb
-
 
3262
;     popad
-
 
3263
;
-
 
3264
;     mov   [esp+36],eax
-
 
3265
;     mov   [esp+24],ebx
-
 
3266
;     ret
-
 
3267
 
-
 
3268
 
3206
 
Line 3269... Line 3207...
3269
 
3207
 
3270
align 4
3208
align 4
3271
 
3209
 
Line 3292... Line 3230...
3292
     xor   eax, eax
3230
     xor   eax, eax
3293
     ret
3231
     ret
Line 3294... Line 3232...
3294
 
3232
 
3295
 
-
 
3296
reserve_free_irq:
3233
 
3297
 
3234
reserve_free_irq:
3298
     xor   esi, esi
3235
     xor   esi, esi
3299
     inc   esi
3236
     inc   esi
Line 3315... Line 3252...
3315
     mov   [ecx], esi
3252
     mov   [ecx], esi
Line 3316... Line 3253...
3316
 
3253
 
Line 3317... Line 3254...
3317
     jmp   ril1
3254
     jmp   ril1
3318
 
-
 
3319
  reserve_irq:
3255
 
3320
 
3256
  reserve_irq:
Line 3321... Line 3257...
3321
     cmp   dword [ecx], 0
3257
     cmp   dword [ecx], 0
Line 3353... Line 3289...
3353
 
3289
 
Line 3354... Line 3290...
3354
endg
3290
endg
3355
 
3291
 
3356
drawbackground:
-
 
3357
       inc   [mouse_pause]
-
 
3358
       cmp   [SCR_MODE],word 0x12
-
 
3359
       je   dbrv20
-
 
3360
     dbrv12:
-
 
3361
       cmp  [SCR_MODE],word 0100000000000000b
-
 
3362
       jge  dbrv20
-
 
3363
;       cmp  [SCR_MODE],word 0x13
-
 
3364
;       je   dbrv20
-
 
3365
;       call  vesa12_drawbackground
-
 
3366
       dec   [mouse_pause]
-
 
3367
       call   [draw_pointer]
-
 
3368
       ret
3292
drawbackground:
3369
     dbrv20:
3293
       inc   [mouse_pause]
3370
       cmp   [BgrDrawMode],dword 1
3294
;       cmp   [BgrDrawMode],dword 1
3371
       jne   bgrstr
-
 
3372
       call  vesa20_drawbackground_tiled
3295
;       jne   bgrstr
3373
       dec   [mouse_pause]
-
 
3374
       call   [draw_pointer]
-
 
3375
       ret
-
 
3376
     bgrstr:
3296
;       call  vesa20_drawbackground_tiled
3377
       call  vesa20_drawbackground_stretch
3297
       call  drawbackground
3378
       dec   [mouse_pause]
3298
       dec   [mouse_pause]
-
 
3299
       call   [draw_pointer]
-
 
3300
       ret
-
 
3301
;     bgrstr:
-
 
3302
;       call  vesa20_drawbackground_stretch
-
 
3303
;       dec   [mouse_pause]
Line -... Line 3304...
-
 
3304
;       call   [draw_pointer]
3379
       call   [draw_pointer]
3305
;       ret
3380
       ret
-
 
3381
 
3306
 
3382
align 4
3307
; ====================================================================
3383
 
3308
align 4
3384
syscall_putimage:			; PutImage
3309
syscall_putimage:			; PutImage = SysFn07
3385
sys_putimage:
3310
sys_putimage:
3386
     test  ecx,0x80008000
3311
     test  ecx,0x80008000		; ecx = { SizeX | SizeY }
3387
     jnz   .exit
3312
     jnz   .exit			; edx = { OrigX | OrigY }
3388
     test  ecx,0x0000FFFF
3313
     test  ecx,0x0000FFFF		; ebx points to the 24bpp-image
3389
     jz    .exit
3314
     jz    .exit
3390
     test  ecx,0xFFFF0000
3315
     test  ecx,0xFFFF0000
3391
     jnz   @f
3316
     jnz   @f
-
 
3317
  .exit:
3392
  .exit:
3318
     ret
3393
     ret
3319
 @@:
3394
 @@:
3320
        push    edi
3395
	mov	edi,[current_slot]
3321
	mov	edi,[current_slot]
-
 
3322
	add	dx,word[edi+APPDATA.wnd_clientbox.top]
3396
	add	dx,word[edi+APPDATA.wnd_clientbox.top]
3323
	rol	edx,16
3397
	rol	edx,16
3324
	add	dx,word[edi+APPDATA.wnd_clientbox.left]
3398
	add	dx,word[edi+APPDATA.wnd_clientbox.left]
3325
        pop     edi
3399
	rol	edx,16
3326
	rol	edx,16
3400
  .forced:
-
 
3401
	push	ebp esi 0
-
 
3402
	mov	ebp, putimage_get24bpp
3327
  .forced:                              ; called from gui/skincode.inc [215]
3403
	mov	esi, putimage_init24bpp
3328
	push	esi
3404
sys_putimage_bpp:
3329
	mov     esi, ecx
3405
;        cmp     [SCR_MODE], word 0x12
3330
        shr     esi, 16                 ; SizeX
3406
;        jz      @f   ;.doit
3331
        lea     esi, [esi*2+esi]        ; 3 bytes per pixel
3407
;        mov     eax, vesa12_putimage
3332
        mov     [img_buf_line_size], esi
3408
;        cmp     [SCR_MODE], word 0100000000000000b
3333
        mov     [img_draw_core_fn], draw_core_24bpp
3409
;        jae     @f
3334
        mov     [img_draw_edge_fn], draw_edge_24bpp
3410
;        cmp     [SCR_MODE], word 0x13
3335
        mov     [img_bytes_per_pix], 3
3411
;        jnz     .doit
-
 
3412
;@@:
3336
        pop     esi
3413
	mov	eax, vesa20_putimage
3337
 
3414
.doit:
3338
sys_putimage_bpp:                       ; only called from sys_putimage_palette
3415
	inc	[mouse_pause]
-
 
3416
	call	eax
3339
	inc	[mouse_pause]
-
 
3340
	call	_putimage		
-
 
3341
	dec	[mouse_pause]
3417
	dec	[mouse_pause]
3342
	jmp	[draw_pointer]
3418
	pop	ebp esi ebp
3343
 
3419
	jmp	[draw_pointer]
3344
 
3420
align 4
3345
align 4
3421
sys_putimage_palette:
3346
sys_putimage_palette:                   ; sysFn 65
3422
; ebx = pointer to image
3347
; ebx = pointer to image
3423
; ecx = [xsize]*65536 + [ysize]
3348
; ecx = [xsize]*65536 + [ysize]
3424
; edx = [xstart]*65536 + [ystart]
3349
; edx = [xstart]*65536 + [ystart]
3425
; esi = number of bits per pixel, must be 8, 24 or 32
3350
; esi = number of bits per pixel, must be 1, 8, 24 or 32
3426
; edi = pointer to palette
3351
; edi = pointer to palette
3427
; ebp = row delta
3352
; ebp = line offset
3428
	mov	eax, [CURRENT_TASK]
3353
	mov	eax, [CURRENT_TASK]
3429
	shl	eax, 8
3354
	shl	eax, 8
3430
	add	dx, word [eax+SLOT_BASE+APPDATA.wnd_clientbox.top]
3355
	add	dx, word [eax+SLOT_BASE+APPDATA.wnd_clientbox.top]
3431
	rol	edx, 16
3356
	rol	edx, 16
3432
	add	dx, word [eax+SLOT_BASE+APPDATA.wnd_clientbox.left]
-
 
3433
	rol	edx, 16
-
 
3434
.forced:
-
 
3435
	cmp	esi, 1
-
 
3436
	jnz	@f
-
 
3437
	push	edi
-
 
3438
	mov	eax, [edi+4]
-
 
3439
	sub	eax, [edi]
-
 
3440
	push	eax
-
 
3441
	push	dword [edi]
3357
	add	dx, word [eax+SLOT_BASE+APPDATA.wnd_clientbox.left]
3442
	push	0ffffff80h
-
 
3443
	mov	edi, esp
-
 
3444
	call	put_mono_image
-
 
3445
	add	esp, 12
-
 
3446
	pop	edi
-
 
3447
	ret
-
 
3448
@@:
-
 
3449
	cmp	esi, 2
-
 
3450
	jnz	@f
3358
	rol	edx, 16
3451
	push	edi
3359
.forced:
3452
	push	0ffffff80h
-
 
3453
	mov	edi, esp
-
 
3454
	call	put_2bit_image
-
 
3455
	pop	eax
-
 
3456
	pop	edi
-
 
3457
	ret
-
 
3458
@@:
-
 
3459
	cmp	esi, 4
-
 
3460
	jnz	@f
3360
        mov     [img_palette], edi
3461
	push	edi
3361
        mov     eax, esi
3462
	push	0ffffff80h
-
 
3463
	mov	edi, esp
-
 
3464
	call	put_4bit_image
-
 
3465
	pop	eax
-
 
3466
	pop	edi
3362
        cmp     eax, 32       ;>32bpp (stupid call)
3467
	ret
-
 
3468
@@:
-
 
3469
	push	ebp esi ebp
3363
        ja      .exit
3470
	cmp	esi, 8
3364
        shr     al, 3         ; 0=1bpp, other lo-pix modes not supported
3471
	jnz	@f
-
 
3472
	mov	ebp, putimage_get8bpp
-
 
3473
	mov	esi, putimage_init8bpp
-
 
3474
	jmp	sys_putimage_bpp
-
 
3475
@@:
3365
        push    esi
3476
	cmp	esi, 15
3366
        mov     [img_bytes_per_pix], eax
3477
	jnz	@f
3367
        mov     esi, [eax*4 + img_core_proc_0]
3478
	mov	ebp, putimage_get15bpp
-
 
3479
	mov	esi, putimage_init15bpp
3368
        mov     [img_draw_core_fn], esi
3480
	jmp	sys_putimage_bpp
-
 
3481
@@:
3369
        mov     esi, [eax*4 + img_edge_proc_0]
3482
	cmp	esi, 16
3370
        mov     [img_draw_edge_fn], esi
3483
	jnz	@f
3371
        mov     esi, ecx
3484
	mov	ebp, putimage_get16bpp
-
 
3485
	mov	esi, putimage_init16bpp
3372
        shr     esi, 16                 ; esi = SizeX
3486
	jmp	sys_putimage_bpp
-
 
3487
@@:
-
 
3488
	cmp	esi, 24
-
 
3489
	jnz	@f
3373
        or      al, al
3490
	mov	ebp, putimage_get24bpp
3374
        jz      .1bpp
3491
	mov	esi, putimage_init24bpp
3375
	imul	esi, eax
3492
	jmp	sys_putimage_bpp
-
 
3493
@@:
-
 
3494
	cmp	esi, 32
3376
        jmp     .done
3495
	jnz	@f
-
 
3496
	mov	ebp, putimage_get32bpp
-
 
3497
	mov	esi, putimage_init32bpp
-
 
3498
	jmp	sys_putimage_bpp
3377
.1bpp:
3499
@@:
-
 
3500
	pop	ebp esi ebp
-
 
3501
	ret
-
 
3502
 
-
 
3503
put_mono_image:
3378
	add	esi, 7
3504
	push	ebp esi ebp
-
 
3505
	mov	ebp, putimage_get1bpp
-
 
3506
	mov	esi, putimage_init1bpp
-
 
3507
	jmp	sys_putimage_bpp
-
 
3508
put_2bit_image:
3379
	shr	esi, 3                  ; 8 pixels per byte
3509
	push	ebp esi ebp
-
 
3510
	mov	ebp, putimage_get2bpp
-
 
3511
	mov	esi, putimage_init2bpp
3380
.done:
3512
	jmp	sys_putimage_bpp
-
 
3513
put_4bit_image:
-
 
3514
	push	ebp esi ebp
3381
        add     esi, ebp                ; + line offset
3515
	mov	ebp, putimage_get4bpp
-
 
3516
	mov	esi, putimage_init4bpp
-
 
3517
	jmp	sys_putimage_bpp
-
 
3518
 
-
 
3519
putimage_init24bpp:
-
 
3520
	lea	eax, [eax*3]
-
 
3521
putimage_init8bpp:
-
 
3522
	ret
-
 
3523
 
-
 
3524
align 16
-
 
3525
putimage_get24bpp:
-
 
3526
	movzx	eax, byte [esi+2]
-
 
3527
	shl	eax, 16
-
 
3528
	mov	ax, [esi]
-
 
3529
	add	esi, 3
-
 
3530
	ret	4
-
 
3531
align 16
-
 
3532
putimage_get8bpp:
-
 
3533
	movzx	eax, byte [esi]
-
 
3534
	push	edx
-
 
3535
	mov	edx, [esp+8]
-
 
3536
	mov	eax, [edx+eax*4]
-
 
3537
	pop	edx
-
 
3538
	inc	esi
-
 
3539
	ret	4
-
 
3540
 
-
 
3541
putimage_init1bpp:
-
 
3542
	add	eax, ecx
-
 
3543
	push	ecx
-
 
3544
	add	eax, 7
-
 
3545
	add	ecx, 7
-
 
3546
	shr	eax, 3
-
 
3547
	shr	ecx, 3
-
 
3548
	sub	eax, ecx
-
 
3549
	pop	ecx
-
 
3550
	ret
-
 
3551
align 16
-
 
3552
putimage_get1bpp:
-
 
3553
	push	edx
-
 
3554
	mov	edx, [esp+8]
-
 
3555
	mov	al, [edx]
-
 
3556
	add	al, al
-
 
3557
	jnz	@f
-
 
3558
	lodsb
-
 
3559
	adc	al, al
-
 
3560
@@:
-
 
3561
	mov	[edx], al
-
 
3562
	sbb	eax, eax
-
 
3563
	and	eax, [edx+8]
-
 
3564
	add	eax, [edx+4]
-
 
3565
	pop	edx
-
 
3566
	ret	4
-
 
3567
 
-
 
3568
putimage_init2bpp:
-
 
3569
	add	eax, ecx
-
 
3570
	push	ecx
-
 
3571
	add	ecx, 3
-
 
3572
	add	eax, 3
-
 
3573
	shr	ecx, 2
-
 
3574
	shr	eax, 2
-
 
3575
	sub	eax, ecx
-
 
3576
	pop	ecx
-
 
3577
	ret
-
 
3578
align 16
-
 
3579
putimage_get2bpp:
-
 
3580
	push	edx
-
 
3581
	mov	edx, [esp+8]
-
 
3582
	mov	al, [edx]
-
 
3583
	mov	ah, al
-
 
3584
	shr	al, 6
-
 
3585
	shl	ah, 2
-
 
3586
	jnz	.nonewbyte
-
 
3587
	lodsb
-
 
3588
	mov	ah, al
-
 
3589
	shr	al, 6
3382
        mov     [img_buf_line_size], esi
3590
	shl	ah, 2
-
 
3591
	add	ah, 1
-
 
3592
.nonewbyte:
-
 
3593
	mov	[edx], ah
-
 
3594
	mov	edx, [edx+4]
-
 
3595
	movzx	eax, al
-
 
3596
	mov	eax, [edx+eax*4]
-
 
3597
	pop	edx
-
 
3598
	ret	4
-
 
3599
 
-
 
3600
putimage_init4bpp:
-
 
3601
	add	eax, ecx
-
 
3602
	push	ecx
-
 
3603
	add	ecx, 1
-
 
3604
	add	eax, 1
-
 
3605
	shr	ecx, 1
-
 
3606
	shr	eax, 1
3383
        pop     esi
3607
	sub	eax, ecx
-
 
3608
	pop	ecx
-
 
3609
	ret
-
 
3610
align 16
-
 
3611
putimage_get4bpp:
-
 
3612
	push	edx
-
 
3613
	mov	edx, [esp+8]
-
 
3614
	add	byte [edx], 80h
-
 
3615
	jc	@f
-
 
3616
	movzx	eax, byte [edx+1]
-
 
3617
	mov	edx, [edx+4]
-
 
3618
	and	eax, 0x0F
-
 
3619
	mov	eax, [edx+eax*4]
-
 
3620
	pop	edx
-
 
3621
	ret	4
-
 
3622
@@:
-
 
3623
	movzx	eax, byte [esi]
-
 
3624
	add	esi, 1
-
 
3625
	mov	[edx+1], al
-
 
3626
	shr	eax, 4
-
 
3627
	mov	edx, [edx+4]
-
 
Line 3628... Line -...
3628
	mov	eax, [edx+eax*4]
-
 
3629
	pop	edx
-
 
3630
	ret	4
-
 
3631
 
3384
	jmp	_putimage ;<<< sys_putimage_bpp
3632
putimage_init32bpp:
-
 
3633
	shl	eax, 2
-
 
3634
	ret
-
 
3635
align 16
-
 
3636
putimage_get32bpp:
3385
.exit:
3637
	lodsd
3386
        ret
3638
	ret	4
-
 
3639
 
-
 
3640
putimage_init15bpp:
-
 
3641
putimage_init16bpp:
-
 
3642
	add	eax, eax
3387
 
3643
	ret
-
 
3644
align 16
3388
align 4
3645
putimage_get15bpp:
-
 
3646
; 0RRRRRGGGGGBBBBB -> 00000000RRRRR000GGGGG000BBBBB000
-
 
3647
	push	ecx edx
-
 
3648
	movzx	eax, word [esi]
-
 
3649
	add	esi, 2
3389
img_core_proc_0         dd      draw_core_1bpp 
3650
	mov	ecx, eax
-
 
3651
	mov	edx, eax
-
 
3652
	and	eax, 0x1F
-
 
3653
	and	ecx, 0x1F shl 5
-
 
3654
	and	edx, 0x1F shl 10
-
 
3655
	shl	eax, 3
-
 
3656
	shl	ecx, 6
-
 
3657
	shl	edx, 9
-
 
3658
	or	eax, ecx
3390
img_core_proc_1         dd      draw_core_8bpp 
3659
	or	eax, edx
-
 
3660
	pop	edx ecx
3391
img_core_proc_2         dd      draw_core_16bpp 
3661
	ret	4
3392
img_core_proc_3         dd      draw_core_24bpp 
3662
 
-
 
3663
align 16
3393
img_core_proc_4         dd      draw_core_32bpp 
3664
putimage_get16bpp:
-
 
3665
; RRRRRGGGGGGBBBBB -> 00000000RRRRR000GGGGGG00BBBBB000
-
 
3666
	push	ecx edx
-
 
3667
	movzx	eax, word [esi]
-
 
3668
	add	esi, 2
3394
 
3669
	mov	ecx, eax
3395
img_edge_proc_0         dd      draw_edge_1bpp 
3670
	mov	edx, eax
-
 
3671
	and	eax, 0x1F
-
 
3672
	and	ecx, 0x3F shl 5
-
 
3673
	and	edx, 0x1F shl 11
-
 
3674
	shl	eax, 3
-
 
3675
	shl	ecx, 5
-
 
3676
	shl	edx, 8
-
 
Line -... Line 3396...
-
 
3396
img_edge_proc_1         dd      draw_edge_8bpp 
3677
	or	eax, ecx
3397
img_edge_proc_2         dd      draw_edge_16bpp 
3678
	or	eax, edx
3398
img_edge_proc_3         dd      draw_edge_24bpp 
3679
	pop	edx ecx
3399
img_edge_proc_4         dd      draw_edge_32bpp 
3680
	ret	4
3400
 
3681
 
3401
; ==================================================
Line 3691... Line 3411...
3691
	add	ecx,[esi+APPDATA.wnd_clientbox.left]
3411
	add	ecx,[esi+APPDATA.wnd_clientbox.left]
3692
	add	ebx,[esi+APPDATA.wnd_clientbox.top]
3412
	add	ebx,[esi+APPDATA.wnd_clientbox.top]
3693
	add	edx,[esi+APPDATA.wnd_clientbox.top]
3413
	add	edx,[esi+APPDATA.wnd_clientbox.top]
3694
  .forced:
3414
  .forced:
3695
    inc   [mouse_pause]
3415
    inc   [mouse_pause]
3696
;        call    [disable_mouse]
-
 
3697
    cmp   [SCR_MODE],word 0x12
-
 
3698
    je	 dbv20
-
 
3699
   sdbv20:
-
 
3700
;    cmp  [SCR_MODE],word 0100000000000000b
-
 
3701
;    jge  dbv20
-
 
3702
;    cmp  [SCR_MODE],word 0x13
-
 
3703
;    je   dbv20
-
 
3704
;    call vesa12_drawbar
-
 
3705
;    dec   [mouse_pause]
-
 
3706
;    call   [draw_pointer]
-
 
3707
;    ret
-
 
3708
  dbv20:
3416
;  dbv20:
3709
    call vesa20_drawbar
3417
    call vesa20_drawbar
3710
    dec   [mouse_pause]
3418
    dec   [mouse_pause]
3711
    call   [draw_pointer]
3419
    jmp   [draw_pointer]
3712
    ret
-
 
3713
 
-
 
Line 3714... Line 3420...
3714
 
3420
 
3715
 
-
 
3716
kb_read:
3421
 
Line 3717... Line 3422...
3717
 
3422
kb_read:
3718
	push	ecx edx
3423
	push	ecx edx
3719
 
3424
 
Line 3743... Line 3448...
3743
kb_write:
3448
kb_write:
Line 3744... Line 3449...
3744
 
3449
 
Line 3745... Line 3450...
3745
	push	ecx edx
3450
	push	ecx edx
3746
 
-
 
3747
	mov	dl,al
-
 
3748
;        mov     ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's
-
 
3749
;      kw_loop1:
-
 
3750
;        in      al,0x64
-
 
3751
;        test    al,0x20
-
 
3752
;        jz      kw_ok1
-
 
3753
;        loop    kw_loop1
-
 
3754
;        mov     ah,1
-
 
3755
;        jmp     kw_exit
3451
 
3756
;      kw_ok1:
3452
	mov	dl,al
3757
	in	al,0x60
3453
	in	al,0x60
3758
	mov	ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's
3454
	mov	ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's
3759
      kw_loop:
3455
      kw_loop:
Line 4489... Line 4185...
4489
	pushad
4185
	pushad
Line 4490... Line 4186...
4490
 
4186
 
Line 4491... Line 4187...
4491
	stdcall kernel_free, [_WinMapAddress]
4187
	stdcall kernel_free, [_WinMapAddress]
-
 
4188
 
-
 
4189
	mov eax, [_display.width]
-
 
4190
	shr eax, 1
4492
 
4191
	shr eax, 1
-
 
4192
	mov [_WinMapWidth], eax
-
 
4193
	mov eax, [_display.height]
4493
	mov eax, [_display.width]
4194
	shr eax, 1
Line 4494... Line 4195...
4494
	mul [_display.height]
4195
	mul [_WinMapWidth]
4495
	mov [_WinMapSize], eax
4196
	mov [_WinMapSize], eax
4496
 
4197