Subversion Repositories Kolibri OS

Rev

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

Rev 143 Rev 384
Line 8... Line 8...
8
;;
8
;;
9
;;
9
;;
10
;;   Compile with last version FASM
10
;;   Compile with last version FASM
11
;;
11
;;
12
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
12
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
13
include "proc32.inc"
13
include "kglobals.inc"
14
include "kglobals.inc"
14
include "lang.inc"
15
include "lang.inc"
Line -... Line 16...
-
 
16
 
-
 
17
include "const.inc"
15
 
18
 
16
WinMapAddress           equ     0x460000
19
;WinMapAddress      equ     0x460000
Line 17... Line 20...
17
display_data       = 0x460000
20
;display_data       = 0x460000
Line 18... Line 21...
18
 
21
 
19
max_processes      equ   255
22
max_processes      equ   255
20
 
-
 
21
window_data        equ   0x0000
23
 
22
tss_data           equ   0xD20000
24
;window_data        equ   0x0000
23
;tss_step           equ   (128+2048) ; tss & i/o - 16384 ports, * 256=557056
25
;tss_data           equ   0xD20000
24
tss_step           equ   (128+8192) ; tss & i/o - 65535 ports, * 256=557056*4
-
 
Line 25... Line 26...
25
draw_data          equ   0xC00000
26
tss_step           equ   (128+8192) ; tss & i/o - 65535 ports, * 256=557056*4
Line 26... Line 27...
26
sysint_stack_data  equ   0xC03000
27
;draw_data          equ   0xC00000
27
 
28
;sysint_stack_data  equ   0xC03000
28
 
29
 
29
twdw               equ   (0x3000-window_data)
30
;twdw               equ   (0x3000-window_data)
Line 59... Line 60...
59
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
60
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 60... Line 61...
60
 
61
 
61
use16
62
use16
62
                  org   0x0
63
                  org   0x0
-
 
64
                  jmp   start_of_code
63
                  jmp   start_of_code
65
 
64
; mike.dld {
66
; mike.dld {
65
        org $+0x10000
67
        org $+0x10000
66
db 0
68
db 0
67
dd servetable-0x10000
69
dd servetable-0x10000
Line 76... Line 78...
76
drawbackground   dd __sys_drawbackground
78
drawbackground   dd __sys_drawbackground
77
calculatescreen  dd __sys_calculatescreen
79
calculatescreen  dd __sys_calculatescreen
78
setscreen        dd __sys_setscreen
80
setscreen        dd __sys_setscreen
79
; } mike.dld
81
; } mike.dld
Line 80... Line 82...
80
 
82
 
81
version           db    'Kolibri OS  version 0.5.8.1      ',13,10,13,10,0
83
version           db    'Kolibri OS  version 0.6.5.0      ',13,10,13,10,0
Line 82... Line 84...
82
                  ;dd    endofcode-0x10000
84
                  ;dd    endofcode-0x10000
83
 
85
 
84
                  ;db   'Boot02'
86
                  ;db   'Boot02'
Line 116... Line 118...
116
 
118
 
Line 117... Line -...
117
 
-
 
118
 
-
 
119
; CR0 Flags - Protected mode and Paging
-
 
120
 
-
 
121
        mov     ecx,0x00000001
-
 
122
        ;and     ebx,65535
119
 
123
        ;cmp     ebx,00100000000000000b ; lfb -> paging
-
 
124
        ;jb      no_paging
-
 
125
        ;mov     ax,0x0000
-
 
126
        ;mov     es,ax
-
 
127
        ;mov     al,[es:0x901E]
-
 
Line 128... Line 120...
128
        ;cmp     al,1
120
 
Line 129... Line 121...
129
        ;je      no_paging
121
; CR0 Flags - Protected mode and Paging
Line 147... Line 139...
147
   l.6: in      al, 0x64
139
   l.6: in      al, 0x64
148
        test    al, 2
140
        test    al, 2
149
        jnz     l.6
141
        jnz     l.6
150
        mov     al, 0xDF
142
        mov     al, 0xDF
151
        out     0x60, al
143
        out     0x60, al
-
 
144
   l.7: in      al, 0x64
-
 
145
        test    al, 2
-
 
146
        jnz     l.7
-
 
147
        mov     al, 0xFF
-
 
148
        out     0x64, al
152
        lgdt    [cs:gdts-0x10000]       ; Load GDT
149
        lgdt    [cs:gdts-0x10000]       ; Load GDT
153
        mov     eax, cr0                ; Turn on paging // protected mode
150
        mov     eax, cr0                ; Turn on paging // protected mode
154
        or      eax, ecx
151
        or      eax, ecx
155
        and     eax, 10011111b *65536*256 + 0xffffff ; caching enabled
152
        and     eax, 10011111b *65536*256 + 0xffffff ; caching enabled
156
        mov     cr0, eax
153
        mov     cr0, eax
Line 163... Line 160...
163
        mov     gs,ax
160
        mov     gs,ax
164
        mov     ss,ax
161
        mov     ss,ax
165
        mov     esp,0x3ec00             ; Set stack
162
        mov     esp,0x3ec00             ; Set stack
166
        jmp     pword os_code:B32       ; jmp to enable 32 bit mode
163
        jmp     pword os_code:B32       ; jmp to enable 32 bit mode
Line -... Line 164...
-
 
164
 
-
 
165
if gdte >= $
-
 
166
error 'GDT overlaps with used code!'
-
 
167
end if
167
 
168
 
Line -... Line 169...
-
 
169
use32
-
 
170
 
-
 
171
include 'unpacker.inc'
-
 
172
 
-
 
173
__DEBUG__ fix 1
-
 
174
__DEBUG_LEVEL__ fix 1
168
use32
175
include 'fdo.inc'
169
 
176
 
170
iglobal
177
iglobal
171
  boot_memdetect    db   'Determining amount of memory',0
178
  boot_memdetect    db   'Determining amount of memory',0
172
  boot_fonts        db   'Fonts loaded',0
179
  boot_fonts        db   'Fonts loaded',0
Line 223... Line 230...
223
 
230
 
Line 224... Line 231...
224
.bll2:   popad
231
.bll2:   popad
Line 225... Line -...
225
 
-
 
226
         ret
-
 
227
 
-
 
228
uglobal
-
 
229
  cpuid_0    dd  0,0,0,0
-
 
230
  cpuid_1    dd  0,0,0,0
-
 
231
  cpuid_2    dd  0,0,0,0
-
 
232
  cpuid_3    dd  0,0,0,0
232
 
233
endg
233
         ret
234
 
234
 
235
iglobal
235
iglobal
236
  firstapp   db  '/rd/1/LAUNCHER',0
236
  firstapp   db  '/rd/1/LAUNCHER',0
237
  char       db  'CHAR    MT '
237
  char       db  'FONTS/CHAR.MT',0
238
  char2      db  'CHAR2   MT '
238
  char2      db  'FONTS/CHAR2.MT',0
239
  bootpath   db  '/KOLIBRI    '
239
  bootpath   db  '/KOLIBRI    '
240
  bootpath2  db  0
240
  bootpath2  db  0
241
  vmode      db  'VMODE   MDR'
241
  vmode      db  'drivers/VMODE.MDR',0
Line 242... Line 242...
242
  cur_file   db  'ARROW   CUR'
242
  cur_file   db  'ARROW.CUR',0
Line 260... Line 260...
260
        mov   ecx,(0x100000*0xF-0x280000) / 4
260
        mov   ecx,(0x100000*0xF-0x280000) / 4
261
        cld
261
        cld
262
        rep   stosd
262
        rep   stosd
263
; CLEAR 0x80000-0x90000
263
; CLEAR 0x80000-0x90000
264
;       xor   eax,eax
264
;       xor   eax,eax
-
 
265
 
265
        mov   edi,0x80000
266
        mov   edi,0x80000
266
        mov   ecx,(0x90000-0x80000)/4
267
        mov   ecx,(0x90000-0x80000)/4
267
;       cld
268
;       cld
268
        rep   stosd
269
        rep   stosd
Line 284... Line 285...
284
        mov   ecx,0x10000 / 4
285
        mov   ecx,0x10000 / 4
285
        cld
286
        cld
286
        rep   stosd
287
        rep   stosd
Line 287... Line 288...
287
 
288
 
-
 
289
; SAVE REAL MODE VARIABLES
-
 
290
        mov     ax, [0x2f0000 + 0x9031]
288
; SAVE REAL MODE VARIABLES
291
        mov     [IDEContrRegsBaseAddr], ax
289
; --------------- APM ---------------------
292
; --------------- APM ---------------------
290
    mov    eax, [0x2f0000 + 0x9040]    ; entry point
293
    mov    eax, [0x2f0000 + 0x9040]    ; entry point
291
    mov    dword[apm_entry], eax
294
    mov    dword[apm_entry], eax
Line 292... Line 295...
292
    mov    word [apm_entry + 4], apm_code_32 - gdts
295
    mov    word [apm_entry + 4], apm_code_32 - gdts
293
 
296
 
294
    mov    eax, [0x2f0000 + 0x9044]    ; version & flags
297
    mov    eax, [0x2f0000 + 0x9044]    ; version & flags
295
    mov    [apm_vf], eax
298
    mov    [apm_vf], eax
296
; -----------------------------------------
299
; -----------------------------------------
-
 
300
;        movzx eax,byte [0x2f0000+0x9010]  ; mouse port
-
 
301
;        mov   [0xF604],byte 1  ;al
297
;        movzx eax,byte [0x2f0000+0x9010]  ; mouse port
302
        mov     al, [0x2F0000+0x901F]   ; DMA writing
298
;        mov   [0xF604],byte 1  ;al
303
        mov     [allow_dma_write], al
299
        mov   al,[0x2f0000+0x9000]        ; bpp
304
        mov   al,[0x2f0000+0x9000]        ; bpp
300
        mov   [0xFBF1],al
305
        mov   [ScreenBPP],al
301
        movzx eax,word [0x2f0000+0x900A]  ; X max
306
        movzx eax,word [0x2f0000+0x900A]  ; X max
302
;       dec   eax
307
;       dec   eax
303
        mov   [0xfe00],eax
308
        mov   [ScreenWidth],eax
304
        mov   [screen_workarea.right],eax
309
        mov   [screen_workarea.right],eax
305
        movzx eax,word [0x2f0000+0x900C]  ; Y max
310
        movzx eax,word [0x2f0000+0x900C]  ; Y max
306
;       dec   eax
311
;       dec   eax
307
        mov   [0xfe04],eax
312
        mov   [ScreenHeight],eax
308
        mov   [screen_workarea.bottom],eax
313
        mov   [screen_workarea.bottom],eax
309
        movzx eax,word [0x2f0000+0x9008]  ; screen mode
314
        movzx eax,word [0x2f0000+0x9008]  ; screen mode
310
        mov   [0xFE0C],eax
315
        mov   [SCR_MODE],eax
311
        mov   eax,[0x2f0000+0x9014]       ; Vesa 1.2 bnk sw add
316
        mov   eax,[0x2f0000+0x9014]       ; Vesa 1.2 bnk sw add
312
        mov   [0xE030],eax
317
        mov   [BANK_SWITCH],eax
313
        mov   [0xfe08],word 640*4         ; Bytes PerScanLine
318
        mov   [BytesPerScanLine],word 640*4         ; Bytes PerScanLine
314
        cmp   [0xFE0C],word 0x13          ; 320x200
319
        cmp   [SCR_MODE],word 0x13          ; 320x200
315
        je    @f
320
        je    @f
316
        cmp   [0xFE0C],word 0x12          ; VGA 640x480
321
        cmp   [SCR_MODE],word 0x12          ; VGA 640x480
317
        je    @f
322
        je    @f
318
        mov   ax,[0x2f0000+0x9001]        ; for other modes
323
        mov   ax,[0x2f0000+0x9001]        ; for other modes
319
        mov   [0xfe08],ax
324
        mov   [BytesPerScanLine],ax
320
        mov   al,[0x2F0000+0x9034]        ; vesa major version number (ascii)
325
        mov   al,[0x2F0000+0x9034]        ; vesa major version number (ascii)
321
        mov   [0xE034],al
326
        mov   [VESA_VER_MAJOR],al
322
        mov   al,[0x2F0000+0x9035]        ; card vendor (intel=1, s3=2, other=3)
327
        mov   al,[0x2F0000+0x9035]        ; card vendor (intel=1, s3=2, other=3)
Line 323... Line 328...
323
        mov   [0xE035],al
328
        mov   [GFX_CARD_VENDOR],al
Line 324... Line 329...
324
      @@:
329
      @@:
Line 333... Line 338...
333
        ;cmp     [0x2f0000+0x901e],byte 1
338
        ;cmp     [0x2f0000+0x901e],byte 1
334
        ;jne     no_d_lfb
339
        ;jne     no_d_lfb
335
        mov     byte [0x2f0000+0x901e],0x0
340
        mov     byte [0x2f0000+0x901e],0x0
336
        mov     eax,[0x2f0000+0x9018]
341
        mov     eax,[0x2f0000+0x9018]
337
      ;no_d_lfb:
342
      ;no_d_lfb:
338
        mov     [0xfe80],eax
343
        mov     [LFBAddress],eax
Line 339... Line 344...
339
 
344
 
340
        cmp     [0xfe0c],word 0100000000000000b
345
        cmp     [SCR_MODE],word 0100000000000000b
341
        jge     setvesa20
346
        jge     setvesa20
342
        cmp     [0xfe0c],word 0x13
347
        cmp     [SCR_MODE],word 0x13
343
        je      v20ga32
348
        je      v20ga32
344
        mov     [0xe020],dword Vesa12_putpixel24  ; Vesa 1.2
349
        mov     [PUTPIXEL],dword Vesa12_putpixel24  ; Vesa 1.2
345
        mov     [0xe024],dword Vesa12_getpixel24
350
        mov     [0xe024],dword Vesa12_getpixel24
346
        cmp     [0xfbf1],byte 24
351
        cmp     [ScreenBPP],byte 24
347
        jz      ga24
352
        jz      ga24
348
        mov     [0xe020],dword Vesa12_putpixel32
353
        mov     [PUTPIXEL],dword Vesa12_putpixel32
349
        mov     [0xe024],dword Vesa12_getpixel32
354
        mov     [0xe024],dword Vesa12_getpixel32
350
      ga24:
355
      ga24:
351
        jmp     v20ga24
356
        jmp     v20ga24
352
      setvesa20:
357
      setvesa20:
353
        mov     [0xe020],dword Vesa20_putpixel24  ; Vesa 2.0
358
        mov     [PUTPIXEL],dword Vesa20_putpixel24  ; Vesa 2.0
354
        mov     [0xe024],dword Vesa20_getpixel24
359
        mov     [0xe024],dword Vesa20_getpixel24
355
        cmp     [0xfbf1],byte 24
360
        cmp     [ScreenBPP],byte 24
356
        jz      v20ga24
361
        jz      v20ga24
357
      v20ga32:
362
      v20ga32:
358
        mov     [0xe020],dword Vesa20_putpixel32
363
        mov     [PUTPIXEL],dword Vesa20_putpixel32
359
        mov     [0xe024],dword Vesa20_getpixel32
364
        mov     [0xe024],dword Vesa20_getpixel32
360
      v20ga24:
365
      v20ga24:
361
        cmp     [0xfe0c],word 0x12                ; 16 C VGA 640x480
366
        cmp     [SCR_MODE],word 0x12                ; 16 C VGA 640x480
362
        jne     no_mode_0x12
367
        jne     no_mode_0x12
363
        mov     [0xe020],dword VGA_putpixel
368
        mov     [PUTPIXEL],dword VGA_putpixel
364
        mov     [0xe024],dword Vesa20_getpixel32
369
        mov     [0xe024],dword Vesa20_getpixel32
Line -... Line 370...
-
 
370
      no_mode_0x12:
-
 
371
 
-
 
372
           call test_cpu
-
 
373
;           btr [cpu_caps], CAPS_SSE    ;test: dont't use sse code
-
 
374
;           btr [cpu_caps], CAPS_SSE2   ;test: don't use sse2
-
 
375
 
-
 
376
;           btr [cpu_caps], CAPS_FXSR   ;test: disable sse support
-
 
377
                                        ;all sse commands rise #UD exption
-
 
378
;           btr [cpu_caps], CAPS_PSE    ;test: don't use large pages
-
 
379
;           btr [cpu_caps], CAPS_PGE    ;test: don't use global pages
-
 
380
;           btr [cpu_caps], CAPS_MTRR   ;test: don't use MTRR
-
 
381
           bts [cpu_caps], CAPS_TSC     ;force use rdtsc
-
 
382
 
-
 
383
; -------- Fast System Call init ----------
-
 
384
; Intel SYSENTER/SYSEXIT (AMD CPU support it too)
-
 
385
           bt [cpu_caps], CAPS_SEP
-
 
386
           jnc .SEnP   ; SysEnter not Present
-
 
387
           xor edx, edx
-
 
388
           mov ecx, MSR_SYSENTER_CS
-
 
389
           mov eax, os_code
-
 
390
           wrmsr
-
 
391
           mov ecx, MSR_SYSENTER_ESP
-
 
392
           mov eax, sysenter_stack ; Check it
-
 
393
           wrmsr
365
      no_mode_0x12:
394
           mov ecx, MSR_SYSENTER_EIP
-
 
395
           mov eax, sysenter_entry
-
 
396
           wrmsr
-
 
397
.SEnP:
-
 
398
; AMD SYSCALL/SYSRET
-
 
399
           cmp byte[cpu_vendor], 'A'
-
 
400
           jne .noSYSCALL
-
 
401
           mov eax, 0x80000001
-
 
402
           cpuid
-
 
403
           test edx, 0x800  ; bit_11 - SYSCALL/SYSRET support
-
 
404
           jz .noSYSCALL
-
 
405
           mov ecx, MSR_AMD_EFER
-
 
406
           rdmsr
Line 366... Line -...
366
 
-
 
367
; MEMORY MODEL
407
           or eax, 1   ; bit_0 - System Call Extension (SCE)
368
 
408
           wrmsr
369
;        mov     [0xfe84],dword 0x100000*16        ; apps mem base address
409
 
370
;        movzx   ecx,byte [0x2f0000+0x9030]
-
 
371
;        dec     ecx
410
	; !!!! It`s dirty hack, fix it !!!
372
;        mov     eax,16*0x100000 ; memory-16
-
 
373
;        shl     eax,cl
-
 
374
;        mov     [0xfe8c],eax      ; memory for use
411
	; Bits of EDX :
375
;        cmp     eax,16*0x100000
-
 
376
;        jne     no16mb
-
 
377
;        mov     [0xfe84],dword 0xD80000 ; !!! 10 !!!
-
 
378
;      no16mb:
-
 
379
 
412
	; Bit 31–16 During the SYSRET instruction, this field is copied into the CS register
Line 380... Line -...
380
; init:
-
 
381
;  1) 0xFE84 - applications base
-
 
382
;  2) 0xFE8C - total amount of memory
-
 
383
 
-
 
384
        xor     edi, edi
-
 
385
  m_GMS_loop:
-
 
386
        add     edi, 0x400000
-
 
387
        mov     eax, dword [edi]
-
 
388
        mov     dword [edi], 'TEST'
-
 
389
        wbinvd
-
 
390
        cmp     dword [edi], 'TEST'
-
 
391
        jne     m_GMS_exit
-
 
392
        cmp     dword [0], 'TEST'
-
 
393
        je      m_GMS_exit
-
 
394
        mov     dword [es:edi], eax
413
	;  and the contents of this field, plus 8, are copied into the SS register.
395
        jmp     m_GMS_loop
-
 
396
  m_GMS_exit:
414
	; Bit 15–0 During the SYSCALL instruction, this field is copied into the CS register
397
        mov     [edi], eax
-
 
398
        ; now edi contains the EXACT amount of memory
-
 
Line 399... Line 415...
399
 
415
	;  and the contents of this field, plus 8, are copied into the SS register.
400
        mov     eax, 0x100000*16
416
 
401
        cmp     edi, eax ;0x100000*16
417
	; mov	edx, (os_code + 16) * 65536 + os_code
402
        jb      $                 ; less than 16 Mb
-
 
403
 
418
           mov edx, 0x1B0013
404
        mov     dword [0xFE84], eax ;0x100000*16
419
 
Line 405... Line -...
405
        cmp     edi, eax ;0x100000*16
-
 
406
        jne     @f
-
 
407
        mov     dword [0xFE84], 0xD80000 ; =0x100000*13.5
-
 
Line -... Line 420...
-
 
420
           mov eax, syscall_entry
408
      @@:
421
           mov ecx, MSR_AMD_STAR
-
 
422
           wrmsr
-
 
423
.noSYSCALL:
-
 
424
; -----------------------------------------
-
 
425
 
-
 
426
 
409
        mov     dword [0xFE8C], edi
427
 
-
 
428
; MEMORY MODEL
-
 
429
           call mem_test
-
 
430
           call init_mtrr
410
 
431
           call init_mem
411
;!!!!!!!!!!!!!!!!!!!!!!!!!!
432
           call init_page_map
412
include 'detect/disks.inc'
433
 
413
;!!!!!!!!!!!!!!!!!!!!!!!!!!
-
 
Line 414... Line 434...
414
 
434
; ENABLE PAGING
415
; CHECK EXTRA REGION
435
           mov eax, sys_pgdir
416
; ENABLE PAGING
436
           mov cr3, eax
-
 
437
 
417
        mov     eax,cr0
438
           mov eax,cr0
418
        or      eax,0x80000000
439
           or eax,CR0_PG
419
        mov     cr0,eax
-
 
420
        jmp     $+2
-
 
-
 
440
           mov cr0,eax
421
        
441
 
422
        call    MEM_Init
442
           call init_kernel_heap
423
;add 0x800000-0xc00000 area
443
           stdcall kernel_alloc, 0x2000
424
        cmp     word [0xfe0c],0x13
444
           mov [os_stack], eax
425
        jle     .less_memory
445
 
426
        mov     eax,0x800000      ;linear address
-
 
427
        mov     ebx,0x400000 shr 12 ;size in pages (4Mb)
-
 
428
        mov     ecx,0x800000        ;physical address
446
           call init_LFB
429
        jmp     .end_first_block
447
           call init_fpu
430
.less_memory:
-
 
431
        mov     eax,0x980000      ;linear address
448
 
-
 
449
           call init_malloc
432
        mov     ebx,0x280000 shr 12 ;size in pages (2.5Mb)
450
 
433
        mov     ecx,0x980000        ;physical address
451
           stdcall alloc_kernel_space, 0x4F000
-
 
452
           mov [ipc_tmp], eax
434
.end_first_block:
453
           mov ebx, 0x1000
435
        call    MEM_Add_Heap        ;nobody can lock mutex yet
454
 
-
 
455
           add eax, 0x40000
436
 
456
           mov [proc_mem_map], eax
437
        call    create_general_page_table
457
 
-
 
458
           add eax, 0x8000
438
;add 0x1000000(0xd80000)-end_of_memory area
459
           mov [proc_mem_pdir], eax
439
        mov     eax,second_base_address
460
 
Line -... Line 461...
-
 
461
           add eax, ebx
-
 
462
           mov [proc_mem_tab], eax
-
 
463
 
-
 
464
           add eax, ebx
-
 
465
           mov [tmp_task_pdir], eax
-
 
466
 
-
 
467
           add eax, ebx
-
 
468
           mov [tmp_task_ptab], eax
440
        mov     ebx,[0xfe8c]
469
 
-
 
470
           add eax, ebx
-
 
471
           mov [ipc_pdir], eax
-
 
472
 
-
 
473
           add eax, ebx
-
 
474
           mov [ipc_ptab], eax
-
 
475
 
-
 
476
           call init_events
Line 441... Line 477...
441
        mov     ecx,[0xfe84]
477
 
442
        sub     ebx,ecx
478
           mov eax, srv.fd-SRV_FD_OFFSET
443
        shr     ebx,12
479
           mov [srv.fd], eax
444
        add     eax,ecx
480
           mov [srv.bk], eax
445
        call    MEM_Add_Heap
481
 
446
;init physical memory manager.
482
           mov edi, irq_tab
Line -... Line 483...
-
 
483
           xor eax, eax
-
 
484
           mov ecx, 16
-
 
485
           rep stosd
-
 
486
 
447
        call    Init_Physical_Memory_Manager        
487
;Set base of graphic segment to linear address of LFB
Line 448... Line 488...
448
        
488
        mov     eax,[LFBAddress]          ; set for gs
449
        mov     dword [0xfe80],0x80000000 ;0x800000
489
        mov     [graph_data_l+2],ax
450
 
490
        shr     eax,16
Line 475... Line 515...
475
 
515
 
Line 476... Line 516...
476
;!!!!!!!!!!!!!!!!!!!!!!!
516
;!!!!!!!!!!!!!!!!!!!!!!!
Line 477... Line 517...
477
 
517
 
478
; LOAD FONTS I and II
518
; LOAD FONTS I and II
479
 
519
 
Line 480... Line 520...
480
        mov   [0x3000],dword 1
520
        mov   [CURRENT_TASK],dword 1
481
        mov   [0x3004],dword 1
-
 
482
        mov   [0x3010],dword 0x3020
521
        mov   [TASK_COUNT],dword 1
483
 
522
        mov   [TASK_BASE],dword TASK_DATA
484
        mov   eax,char
523
 
485
        mov   esi,12
524
        mov   esi,char
Line 486... Line 525...
486
        xor   ebx,ebx
525
        xor   ebx,ebx
487
        mov   ecx,2560;26000
-
 
488
        mov   edx,0x3F600;0x37000
526
        mov   ecx,2560;26000
489
        call  fileread
527
        mov   edx,FONT_I
490
 
528
        call  fs_RamdiskRead
491
        mov   eax,char2
529
 
Line 492... Line 530...
492
        mov   esi,12
530
        mov   esi,char2
493
        xor   ebx,ebx
531
        xor   ebx,ebx
Line 494... Line 532...
494
        mov   ecx,2560;26000
532
        mov   ecx,2560;26000
Line 504... Line 542...
504
 
542
 
505
        movzx   ecx, word [boot_y]
543
        movzx   ecx, word [boot_y]
506
        or      ecx, (10+29*6) shl 16 ; "Determining amount of memory"
544
        or      ecx, (10+29*6) shl 16 ; "Determining amount of memory"
507
        sub     ecx, 10
545
        sub     ecx, 10
508
        mov     edx, 0xFFFFFF
546
        mov     edx, 0xFFFFFF
509
        mov     ebx, [0xFE8C]
547
        mov     ebx, [MEM_AMOUNT]
510
        shr     ebx, 20
548
        shr     ebx, 20
511
        mov     edi, 1
549
        mov     edi, 1
512
        mov     eax, 0x00040000
550
        mov     eax, 0x00040000
513
        call    display_number
-
 
514
 
-
 
515
; CHECK EXTENDED REGION
-
 
516
;        mov     dword [0x80000000],0x12345678
-
 
517
;        cmp     dword [0x80000000],0x12345678
-
 
518
;        jz      extended_region_found
-
 
519
;        mov     esi,boot_ext_region
-
 
520
;        call    boot_log
-
 
521
;        jmp     $
-
 
522
;extended_region_found:
-
 
523
 
-
 
Line 524... Line 551...
524
 
551
        call    display_number_force
Line 525... Line 552...
525
 
552
 
526
; REDIRECT ALL IRQ'S TO INT'S 0x20-0x2f
553
; REDIRECT ALL IRQ'S TO INT'S 0x20-0x2f
Line 536... Line 563...
536
 
563
 
Line 537... Line 564...
537
        call   build_scheduler ; sys32.inc
564
        call   build_scheduler ; sys32.inc
538
 
565
 
539
; LOAD IDT
-
 
540
        lidt   [cs:idtreg]
-
 
541
 
-
 
542
; READ CPUID RESULT
-
 
543
 
-
 
544
        mov     esi,boot_cpuid
-
 
545
        call    boot_log
-
 
546
        pushfd                  ; get current flags
-
 
547
        pop     eax
-
 
548
        mov     ecx,eax
-
 
549
        xor     eax,0x00200000  ; attempt to toggle ID bit
-
 
550
        push    eax
-
 
551
        popfd
-
 
552
        pushfd                  ; get new EFLAGS
-
 
553
        pop     eax
-
 
554
        push    ecx             ; restore original flags
-
 
555
        popfd
-
 
556
        and     eax,0x00200000  ; if we couldn't toggle ID,
-
 
557
        and     ecx,0x00200000  ; then this is i486
-
 
558
        cmp     eax,ecx
-
 
559
        jz      nopentium
-
 
560
        ; It's Pentium or later. Use CPUID
-
 
561
        mov     edi,cpuid_0
-
 
562
        mov     esi,0
-
 
563
      cpuid_new_read:
566
; LOAD IDT
564
        mov     eax,esi
-
 
565
        cpuid
-
 
566
        call    cpuid_save
-
 
567
        add     edi,4*4
-
 
568
        cmp     esi,3
-
 
569
        jge     cpuid_done
-
 
570
        cmp     esi,[cpuid_0]
-
 
571
        jge     cpuid_done
-
 
572
        inc     esi
-
 
573
        jmp     cpuid_new_read
-
 
574
      cpuid_save:
-
 
575
        mov     [edi+00],eax
-
 
576
        mov     [edi+04],ebx
-
 
577
        mov     [edi+8],ecx
-
 
578
        mov     [edi+12],edx
-
 
579
        ret
-
 
580
      cpuid_done:
-
 
581
      nopentium:
-
 
582
 
-
 
583
; CR4 flags - enable fxsave / fxrstore
-
 
584
;
-
 
585
;        finit
-
 
586
;        mov     eax,1
-
 
587
;        cpuid
-
 
588
;        test    edx,1000000h
-
 
589
;        jz      fail_fpu
-
 
590
;        mov     eax,cr4
-
 
591
;        or      eax,200h        ; Enable fxsave/fxstor
-
 
592
;        mov     cr4,eax
-
 
593
;     fail_fpu:
-
 
594
 
-
 
595
;The CPU to this moment should be already in PM,
-
 
596
;and bit MP of the register cr0 should be installed in 1.
-
 
597
finit ;reset of the FPU (finit, instead of fninit)
-
 
598
fsetpm ;enable PM of the FPU
-
 
599
finit ;reset the registers, contents which are still equal RM
-
 
Line 600... Line 567...
600
;Now FPU too in PM
567
        lidt   [cs:idtreg]
601
; DETECT DEVICES
568
        cli
602
 
569
 
Line 615... Line 582...
615
        mov   al,0x2e              ; msb
582
        mov   al,0x2e              ; msb
616
        out   0x40,al
583
        out   0x40,al
Line 617... Line 584...
617
 
584
 
Line 618... Line 585...
618
; SET MOUSE
585
; SET MOUSE
619
 
-
 
620
        mov   eax,cur_file
586
 
621
        mov   esi,12
587
        mov   esi,cur_file
622
        mov   ebx,0
588
        xor   ebx,ebx
623
        mov   ecx,26000
589
        mov   ecx,26000
Line 624... Line 590...
624
        mov   edx,mousepointer
590
        mov   edx,mousepointer
625
        call  fileread
591
        call  fs_RamdiskRead
626
 
592
 
627
        mov   esi,mousepointer+62+32*31*4
593
        mov   esi,mousepointer+62+32*31*4
Line 640... Line 606...
640
 
606
 
641
        mov   esi,boot_setmouse
607
        mov   esi,boot_setmouse
642
        call  boot_log
608
        call  boot_log
Line -... Line 609...
-
 
609
        call  setmouse
-
 
610
 
643
        call  setmouse
611
        mov  [pci_access_enabled],1
Line 644... Line 612...
644
 
612
 
645
; SET PRELIMINARY WINDOW STACK AND POSITIONS
613
; SET PRELIMINARY WINDOW STACK AND POSITIONS
646
 
614
 
Line 668... Line 636...
668
 
636
 
Line 669... Line 637...
669
; SET UP OS TASK
637
; SET UP OS TASK
670
 
638
 
-
 
639
        mov  esi,boot_setostask
-
 
640
        call boot_log
-
 
641
 
-
 
642
        mov eax, fpu_data
-
 
643
        mov  dword [SLOT_BASE+APPDATA.fpu_state], eax
-
 
644
        mov  dword [SLOT_BASE+APPDATA.fpu_handler], 0
671
        mov  esi,boot_setostask
645
        mov  dword [SLOT_BASE+APPDATA.sse_handler], 0
-
 
646
 
672
        call boot_log
647
        ; name for OS/IDLE process
673
        ; name for OS/IDLE process
648
 
674
        mov  dword [0x80000+256+APPDATA.app_name],   dword 'OS/I'
649
        mov dword [SLOT_BASE+256+APPDATA.app_name],   dword 'OS/I'
675
        mov  dword [0x80000+256+APPDATA.app_name+4], dword 'DLE '
650
        mov dword [SLOT_BASE+256+APPDATA.app_name+4], dword 'DLE '
676
        ; task list
651
        mov edi, [os_stack]
677
        mov  [0x3020+TASKDATA.wnd_number], 1 ; on screen number
652
        mov dword [SLOT_BASE+256+APPDATA.pl0_stack], edi
Line 678... Line 653...
678
        mov  [0x3020+TASKDATA.pid], 1        ; process id number
653
        add edi, 0x2000-512
679
        mov  [0x3020+TASKDATA.mem_start], 0  ; process base address
654
        mov dword [SLOT_BASE+256+APPDATA.fpu_state], edi
680
 
655
 
681
;----------------------
656
;----------------------
682
mov eax,[0xfe00]
657
mov eax,[ScreenWidth]
683
mov ebx,[0xfe04]
658
mov ebx,[ScreenHeight]
684
xor ecx,ecx
659
xor ecx,ecx
685
mov [0],ecx
660
mov [0],ecx
686
mov [4],ecx
661
mov [4],ecx
687
mov [8],eax
662
mov [8],eax
688
mov [12],ebx
663
mov [12],ebx
689
mov [256+0],ecx
664
mov [256+0],ecx
690
mov [256+4],ecx
665
mov [256+4],ecx
691
mov [256+8],eax
-
 
692
mov [256+12],ebx
-
 
693
;----------------------
-
 
694
        ; set default flags & stacks
-
 
695
        mov  [l.eflags],dword 0x11202 ; sti and resume
-
 
696
        mov  [l.ss0], os_data
-
 
697
        ; osloop - TSS
-
 
698
        mov  eax,cr3
-
 
699
        mov  [l.cr3],eax
-
 
700
        mov  [l.eip],osloop
-
 
701
        mov  [l.esp],sysint_stack_data + 4096*2 ; uses slot 1 stack
-
 
-
 
666
mov [256+8],eax
-
 
667
mov [256+12],ebx
702
        mov  [l.cs],os_code
668
;----------------------
703
        mov  [l.ss],os_data
-
 
704
        mov  [l.ds],os_data
-
 
705
        mov  [l.es],os_data
-
 
706
        mov  [l.fs],os_data
-
 
707
        mov  [l.gs],os_data
-
 
708
        ; move tss to tss_data+tss_step
669
 
709
        mov  esi,tss_sceleton
670
 
710
        mov  edi,tss_data+tss_step
671
        mov esi, fpu_data
Line -... Line 672...
-
 
672
        mov ecx, 512/4
-
 
673
        cld
-
 
674
        rep movsd
-
 
675
 
-
 
676
        mov dword [SLOT_BASE+256+APPDATA.fpu_handler], 0
-
 
677
        mov dword [SLOT_BASE+256+APPDATA.sse_handler], 0
-
 
678
 
-
 
679
        mov ebx, [def_cursor]
-
 
680
        mov dword [SLOT_BASE+256+APPDATA.cursor], ebx
-
 
681
 
-
 
682
        mov ebx, SLOT_BASE+256+APP_OBJ_OFFSET
-
 
683
        mov  dword [SLOT_BASE+256+APPDATA.fd_obj], ebx
-
 
684
        mov  dword [SLOT_BASE+256+APPDATA.bk_obj], ebx
-
 
685
 
-
 
686
        ; task list
-
 
687
        mov  [TASK_DATA+TASKDATA.wnd_number], 1 ; on screen number
-
 
688
        mov  [TASK_DATA+TASKDATA.pid], 1        ; process id number
-
 
689
        mov  [TASK_DATA+TASKDATA.mem_start], 0  ; process base address
-
 
690
 
-
 
691
        mov  edi,tss_data+tss_step
-
 
692
        mov ecx, (tss_step)/4
-
 
693
        xor eax, eax
-
 
694
        cld
-
 
695
        rep stosd
-
 
696
 
-
 
697
        mov  edi,tss_data+tss_step
-
 
698
        mov  [edi+TSS._ss0], os_data
-
 
699
        mov  eax,cr3
-
 
700
        mov  [edi+TSS._cr3],eax
-
 
701
        mov  [edi+TSS._eip],osloop
-
 
702
        mov  [edi+TSS._eflags],dword 0x11202 ; sti and resume
-
 
703
        mov eax, [os_stack]
-
 
704
        add eax, 0x2000-512
-
 
705
        mov  [edi+TSS._esp], eax
-
 
706
        mov  [edi+TSS._cs],os_code
-
 
707
        mov  [edi+TSS._ss],os_data
-
 
708
        mov  [edi+TSS._ds],os_data
711
        mov  ecx,120/4
709
        mov  [edi+TSS._es],os_data
712
        cld
710
        mov  [edi+TSS._fs],os_data
Line -... Line 711...
-
 
711
        mov  [edi+TSS._gs],os_data
-
 
712
 
Line 713... Line 713...
713
        rep  movsd
713
        mov  ax,tss0
Line 714... Line 714...
714
 
714
        ltr  ax
715
        mov  ax,tss0
715
 
Line 725... Line 725...
725
        mov   esi,250               ; wait 1/4 a second
725
        mov   esi,250               ; wait 1/4 a second
726
        call  delay_ms
726
        call  delay_ms
727
        call  _rdtsc
727
        call  _rdtsc
728
        sub   eax,ecx
728
        sub   eax,ecx
729
        shl   eax,2
729
        shl   eax,2
730
        mov   [0xf600],eax          ; save tsc / sec
730
        mov   [CPU_FREQ],eax          ; save tsc / sec
-
 
731
        mov ebx, 1000000
-
 
732
        div ebx
-
 
733
        mov [stall_mcs], eax
Line 731... Line 734...
731
 
734
 
Line 732... Line 735...
732
; SET VARIABLES
735
; SET VARIABLES
Line 738... Line 741...
738
        call  stack_init
741
        call  stack_init
739
        call  fdc_init
742
        call  fdc_init
Line 740... Line 743...
740
 
743
 
Line 741... Line 744...
741
; PALETTE FOR 320x200 and 640x480 16 col
744
; PALETTE FOR 320x200 and 640x480 16 col
742
 
745
 
743
        cmp   [0xfe0c],word 0x12
746
        cmp   [SCR_MODE],word 0x12
744
        jne   no_pal_vga
747
        jne   no_pal_vga
745
        mov   esi,boot_pal_vga
748
        mov   esi,boot_pal_vga
746
        call  boot_log
749
        call  boot_log
Line 747... Line 750...
747
        call  paletteVGA
750
        call  paletteVGA
748
      no_pal_vga:
751
      no_pal_vga:
749
 
752
 
750
        cmp   [0xfe0c],word 0x13
753
        cmp   [SCR_MODE],word 0x13
751
        jne   no_pal_ega
754
        jne   no_pal_ega
752
        mov   esi,boot_pal_ega
755
        mov   esi,boot_pal_ega
Line 761... Line 764...
761
        movsd
764
        movsd
762
        movsd
765
        movsd
763
        movsd
766
        movsd
764
        call    load_skin
767
        call    load_skin
Line 765... Line -...
765
 
-
 
766
; MTRR'S
-
 
767
 
-
 
768
        call  enable_mtrr
-
 
769
 
-
 
770
 
768
 
771
; LOAD FIRST APPLICATION
769
; LOAD FIRST APPLICATION
772
        mov   [0x3000],dword 1
770
        mov   [CURRENT_TASK],dword 1
773
        mov   [0x3004],dword 1
771
        mov   [TASK_COUNT],dword 1
774
        cli
772
        cli
775
        cmp   byte [0x2f0000+0x9030],1
773
        cmp   byte [0x2f0000+0x9030],1
-
 
774
        jne   no_load_vrr_m
776
        jne   no_load_vrr_m
775
 
777
        mov   ebp,vrr_m
-
 
778
        lea   esi,[ebp+6]       ; skip '/RD/1/'
776
        mov ebp, vrr_m
779
        xor   ebx,ebx                   ; no parameters
777
        xor ebx, ebx
780
        xor   edx,edx                   ; no flags
778
        xor edx, edx
781
        call  fs_RamdiskExecute.flags
779
        call fs_execute
782
        cmp   eax,2                  ; if vrr_m app found (PID=2)
780
        cmp   eax,2                  ; if vrr_m app found (PID=2)
Line 783... Line 781...
783
        je    first_app_found
781
        je    first_app_found
784
 
782
 
785
    no_load_vrr_m:
783
no_load_vrr_m:
786
        mov   ebp,firstapp
-
 
787
        lea   esi,[ebp+6]
784
        mov ebp, firstapp
788
        xor   ebx,ebx                   ; no parameters
785
        xor ebx, ebx
789
        xor   edx,edx                   ; no flags
-
 
790
        call  fs_RamdiskExecute.flags
786
        xor edx, edx
791
 
787
        call fs_execute
792
        cmp   eax,2                  ; continue if a process has been loaded
788
        cmp   eax,2                  ; continue if a process has been loaded
793
        je    first_app_found
789
        je    first_app_found
794
        mov   eax, 0xDEADBEEF        ; otherwise halt
790
        mov   eax, 0xDEADBEEF        ; otherwise halt
795
        hlt
791
        hlt
Line 796... Line 792...
796
      first_app_found:
792
first_app_found:
797
        cli
793
        cli
Line 798... Line 794...
798
 
794
 
799
        ;mov   [0x3004],dword 2
795
        ;mov   [TASK_COUNT],dword 2
800
        mov   [0x3000],dword 1       ; set OS task fisrt
796
        mov   [CURRENT_TASK],dword 1       ; set OS task fisrt
Line 801... Line 797...
801
 
797
 
802
 
798
 
803
; SET KEYBOARD PARAMETERS
799
; SET KEYBOARD PARAMETERS
804
        mov   al, 0xf6         ; reset keyboard, scan enabled
800
        mov   al, 0xf6         ; reset keyboard, scan enabled
805
        call  kb_write
801
        call  kb_write
806
 
802
 
807
        ; wait until 8042 is ready
-
 
Line 808... Line 803...
808
;        xor ecx,ecx
803
        ; wait until 8042 is ready
809
;      @@:
804
        xor ecx,ecx
810
;        in     al,64h
805
      @@:
811
;        and    al,00000010b
806
        in     al,64h
812
;        loopnz @b
807
        and    al,00000010b
813
        call  Wait8042BufferEmpty
808
        loopnz @b
Line 814... Line 809...
814
 
809
 
815
       ; mov   al, 0xED       ; svetodiody - only for testing!
810
       ; mov   al, 0xED       ; svetodiody - only for testing!
816
       ; call  kb_write
811
       ; call  kb_write
817
       ; call  kb_read
812
       ; call  kb_read
818
       ; mov   al, 111b
813
       ; mov   al, 111b
819
       ; call  kb_write
814
       ; call  kb_write
820
       ; call  kb_read
815
       ; call  kb_read
821
 
816
 
822
        mov   al, 0xF3       ; set repeat rate & delay
817
        mov   al, 0xF3       ; set repeat rate & delay
Line 823... Line 818...
823
        call  kb_write
818
        call  kb_write
Line 824... Line 819...
824
        call  kb_read
819
;        call  kb_read
825
        mov   al, 0 ; 30 250 ;00100010b ; 24 500  ;00100100b  ; 20 500
820
        mov   al, 0 ; 30 250 ;00100010b ; 24 500  ;00100100b  ; 20 500
Line 826... Line 821...
826
        call  kb_write
821
        call  kb_write
Line 827... Line 822...
827
        call  kb_read
822
;        call  kb_read
Line 828... Line 823...
828
     ;// mike.dld [
823
     ;// mike.dld [
829
        call  set_lights
824
        call  set_lights
Line 854... Line 849...
854
        out   0x20,al
849
        out   0x20,al
855
        out   0xa0,al
850
        out   0xa0,al
Line 856... Line 851...
856
 
851
 
Line -... Line 852...
-
 
852
        loop  ready_for_irqs         ; flush the queue
-
 
853
 
857
        loop  ready_for_irqs         ; flush the queue
854
        stdcall attach_int_handler, dword 1, irq1
-
 
855
 
-
 
856
;        mov    [dma_hdd],1
Line 858... Line 857...
858
 
857
        cmp     [IDEContrRegsBaseAddr], 0
859
;        mov    [dma_hdd],1
858
        setnz   [dma_hdd]
Line 860... Line 859...
860
 
859
 
Line 868... Line 867...
868
;                    MAIN OS LOOP START                              ;
867
;                    MAIN OS LOOP START                              ;
869
;                                                                    ;
868
;                                                                    ;
870
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
869
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
871
align 32
870
align 32
872
osloop:
871
osloop:
873
 
-
 
874
        call   [draw_pointer]
872
        call   [draw_pointer]
875
        call   checkbuttons
873
        call   checkbuttons
876
        call   checkwindows
874
        call   checkwindows
877
;       call   check_window_move_request
875
;       call   check_window_move_request
878
        call   checkmisc
876
        call   checkmisc
Line 961... Line 959...
961
;                                                                      ;
959
;                                                                      ;
962
;                       KERNEL FUNCTIONS                               ;
960
;                       KERNEL FUNCTIONS                               ;
963
;                                                                      ;
961
;                                                                      ;
964
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
962
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 965... Line -...
965
 
-
 
966
enable_mtrr:
-
 
967
 
-
 
968
        pushad
-
 
969
 
-
 
970
        cmp    [0x2f0000+0x901c],byte 2
-
 
971
        je     no_mtrr
-
 
972
        mov    eax,[0xFE0C]                ; if no LFB then no MTRR
-
 
973
        test   eax,0100000000000000b
-
 
974
        jz     no_mtrr
-
 
975
        mov    edx,[cpuid_1+3*4]           ; edx - MTRR's supported ?
-
 
976
        test   edx,1000000000000b
-
 
977
        jz     no_mtrr
-
 
978
        call   find_empty_mtrr
-
 
979
        cmp    ecx,0
-
 
980
        jz     no_mtrr
-
 
981
        mov    esi,boot_mtrr               ; 'setting mtrr'
-
 
982
        call   boot_log
-
 
983
        mov    edx,0x0                     ; LFB , +8 M , write combine
-
 
984
        mov    eax,[0x2f9018]
-
 
985
        or     eax,1
-
 
986
        wrmsr
-
 
987
        inc    ecx
-
 
988
        mov    edx,0xf
-
 
989
        mov    eax,0xff800800
-
 
990
        wrmsr
-
 
991
        mov    ecx,0x2ff                   ; enable mtrr's
-
 
992
        rdmsr
-
 
993
        or     eax,100000000000b           ; set
-
 
994
        wrmsr
-
 
995
     no_mtrr:
-
 
996
 
-
 
997
        popad
-
 
998
        ret
-
 
999
 
-
 
1000
 
-
 
1001
find_empty_mtrr:  ; 8 pairs checked
-
 
1002
 
-
 
1003
        mov    ecx,0x201-2
-
 
1004
      mtrr_find:
-
 
1005
        add    ecx,2
-
 
1006
        cmp    ecx,0x200+8*2
-
 
1007
        jge    no_free_mtrr
-
 
1008
        rdmsr
-
 
1009
        test   eax,0x0800
-
 
1010
        jnz    mtrr_find
-
 
1011
        dec    ecx
-
 
1012
        ret
-
 
1013
      no_free_mtrr:
-
 
1014
        mov    ecx,0
-
 
1015
        ret
-
 
1016
 
963
 
Line 1017... Line 964...
1017
reserve_irqs_ports:
964
reserve_irqs_ports:
Line 1018... Line 965...
1018
 
965
 
Line 1032... Line 979...
1032
;        shl   eax,2
979
;        shl   eax,2
1033
;        mov   [irq_owner+eax],byte 1
980
;        mov   [irq_owner+eax],byte 1
Line 1034... Line 981...
1034
 
981
 
1035
 
982
 
1036
                                       ; RESERVE PORTS
983
                                       ; RESERVE PORTS
1037
        mov   edi,1                    ; 0x00-0xff
984
        mov   edi,1                    ; 0x00-0x2d
1038
        mov   [0x2d0000],edi
985
        mov   [RESERVED_PORTS],edi
1039
        shl   edi,4
986
        shl   edi,4
-
 
987
        mov   [RESERVED_PORTS+edi+0],dword 1
-
 
988
        mov   [RESERVED_PORTS+edi+4],dword 0x0
-
 
989
        mov   [RESERVED_PORTS+edi+8],dword 0x2d
-
 
990
 
-
 
991
        inc   dword [RESERVED_PORTS]          ; 0x30-0x4d
-
 
992
        mov   edi,[RESERVED_PORTS]
-
 
993
        shl   edi,4
-
 
994
        mov   [RESERVED_PORTS+edi+0],dword 1
-
 
995
        mov   [RESERVED_PORTS+edi+4],dword 0x30
-
 
996
        mov   [RESERVED_PORTS+edi+8],dword 0x4d
-
 
997
 
-
 
998
        inc   dword [RESERVED_PORTS]          ; 0x50-0xdf
-
 
999
        mov   edi,[RESERVED_PORTS]
-
 
1000
        shl   edi,4
-
 
1001
        mov   [RESERVED_PORTS+edi+0],dword 1
-
 
1002
        mov   [RESERVED_PORTS+edi+4],dword 0x50
-
 
1003
        mov   [RESERVED_PORTS+edi+8],dword 0xdf
-
 
1004
 
-
 
1005
        inc   dword [RESERVED_PORTS]          ; 0xe5-0xff
-
 
1006
        mov   edi,[RESERVED_PORTS]
-
 
1007
        shl   edi,4
1040
        mov   [0x2d0000+edi+0],dword 1
1008
        mov   [RESERVED_PORTS+edi+0],dword 1
-
 
1009
        mov   [RESERVED_PORTS+edi+4],dword 0xe5
-
 
1010
        mov   [RESERVED_PORTS+edi+8],dword 0xff
1041
        mov   [0x2d0000+edi+4],dword 0x0
1011
 
1042
        mov   [0x2d0000+edi+8],dword 0xff
1012
 
1043
;        cmp   [0xf604],byte 2          ; com1 mouse -> 0x3f0-0x3ff
1013
;        cmp   [0xf604],byte 2          ; com1 mouse -> 0x3f0-0x3ff
1044
;        jne   ripl1
1014
;        jne   ripl1
1045
;        inc   dword [0x2d0000]
1015
;        inc   dword [0x2d0000]
Line 1086... Line 1056...
1086
set_variables:
1056
set_variables:
Line 1087... Line 1057...
1087
 
1057
 
1088
        mov   ecx,0x100                       ; flush port 0x60
1058
        mov   ecx,0x100                       ; flush port 0x60
1089
.fl60:  in    al,0x60
1059
.fl60:  in    al,0x60
1090
        loop  .fl60
1060
        loop  .fl60
1091
        mov   [0xfcff],byte 0                 ; mouse buffer
1061
        mov   [MOUSE_BUFF_COUNT],byte 0                 ; mouse buffer
1092
        mov   [0xf400],byte 0                 ; keyboard buffer
1062
        mov   [KEY_COUNT],byte 0                 ; keyboard buffer
1093
        mov   [0xf500],byte 0                 ; button buffer
1063
        mov   [BTN_COUNT],byte 0                 ; button buffer
Line 1094... Line 1064...
1094
;        mov   [0xfb0a],dword 100*65536+100    ; mouse x/y
1064
;        mov   [MOUSE_X],dword 100*65536+100    ; mouse x/y
1095
 
1065
 
1096
        push  eax
1066
        push  eax
1097
        mov   ax,[0x2f0000+0x900c]
1067
        mov   ax,[0x2f0000+0x900c]
1098
        shr   ax,1
1068
        shr   ax,1
1099
        shl   eax,16
1069
        shl   eax,16
1100
        mov   ax,[0x2f0000+0x900A]
1070
        mov   ax,[0x2f0000+0x900A]
1101
        shr   ax,1
1071
        shr   ax,1
Line 1102... Line 1072...
1102
        mov   [0xfb0a],eax
1072
        mov   [MOUSE_X],eax
1103
        pop   eax
1073
        pop   eax
1104
 
1074
 
Line 1105... Line 1075...
1105
        mov   byte [SB16_Status],0            ; Minazzi Paolo
1075
        mov   byte [SB16_Status],0            ; Minazzi Paolo
1106
        mov   [display_data-12],dword 1       ; tiled background
1076
        mov   [display_data-12],dword 1       ; tiled background
1107
        mov   [0xfe88],dword 0x2C0000         ; address of button list
1077
        mov   [BTN_ADDR],dword BUTTON_INFO    ; address of button list
Line 1108... Line 1078...
1108
 
1078
 
Line 1109... Line 1079...
1109
     ;!! IP 04.02.2005:
1079
     ;!! IP 04.02.2005:
1110
        mov   [next_usage_update], 100
1080
        mov   [next_usage_update], 100
1111
        mov   byte [0xFFFF], 0 ; change task if possible
1081
        mov   byte [0xFFFF], 0 ; change task if possible
1112
 
1082
 
1113
        ret
1083
        ret
1114
 
1084
 
1115
;* mouse centered - start code- Mario79
1085
;* mouse centered - start code- Mario79
1116
mouse_centered:
1086
mouse_centered:
1117
        push  eax
1087
        push  eax
1118
        mov   eax,[0xFE00]
1088
        mov   eax,[ScreenWidth]
1119
        shr   eax,1
1089
        shr   eax,1
1120
        mov   [0xFB0A],ax
1090
        mov   [MOUSE_X],ax
Line 1121... Line 1091...
1121
        mov   eax,[0xFE04]
1091
        mov   eax,[ScreenHeight]
Line 1130... Line 1100...
1130
sys_outport:
1100
sys_outport:
Line 1131... Line 1101...
1131
 
1101
 
1132
    mov   edi,ebx          ; separate flag for read / write
1102
    mov   edi,ebx          ; separate flag for read / write
Line 1133... Line 1103...
1133
    and   ebx,65535
1103
    and   ebx,65535
1134
 
1104
 
1135
    mov   ecx,[0x2d0000]
1105
    mov   ecx,[RESERVED_PORTS]
1136
    test  ecx,ecx
1106
    test  ecx,ecx
1137
    jne   sopl8
1107
    jne   sopl8
Line 1138... Line 1108...
1138
    mov   [esp+36],dword 1
1108
    mov   [esp+36],dword 1
1139
    ret
1109
    ret
1140
 
1110
 
1141
  sopl8:
1111
  sopl8:
1142
    mov   edx,[0x3010]
1112
    mov   edx,[TASK_BASE]
1143
    mov   edx,[edx+0x4]
1113
    mov   edx,[edx+0x4]
Line 1144... Line 1114...
1144
    and   ebx,65535
1114
    and   ebx,65535
1145
    cld
1115
    cld
1146
  sopl1:
1116
  sopl1:
1147
 
1117
 
1148
    mov   esi,ecx
1118
    mov   esi,ecx
1149
    shl   esi,4
1119
    shl   esi,4
1150
    add   esi,0x2d0000
1120
    add   esi,RESERVED_PORTS
1151
    cmp   edx,[esi+0]
1121
    cmp   edx,[esi+0]
Line 1280... Line 1250...
1280
 
1250
 
1281
     mov  [esp+36],dword 2
1251
     mov  [esp+36],dword 2
Line 1282... Line -...
1282
     ret
-
 
1283
 
-
 
1284
 
-
 
1285
align 4
-
 
1286
 
-
 
1287
sys_wss:
-
 
1288
 
-
 
1289
     cmp  word [wss],word 0
-
 
1290
     jnz  wssl1
-
 
1291
     mov  [esp+36],dword 1
-
 
1292
     ret
-
 
1293
   wssl1:
-
 
1294
 
-
 
1295
     cmp  eax,1    ; set volume - main
-
 
1296
     jnz  wssl2
-
 
1297
     mov  [esp+36],dword 0
-
 
1298
     ret
-
 
1299
   wssl2:
-
 
1300
 
-
 
1301
     cmp  eax,2    ; set volume - cd
-
 
1302
     jnz  wssl3
-
 
1303
     ; L
-
 
1304
     mov  dx,word [wss]
-
 
1305
     add  dx,4
-
 
1306
     mov  al,0x2
-
 
1307
     out  dx,al
-
 
1308
     mov  esi,1
-
 
1309
     call delay_ms
-
 
1310
     mov  eax,ebx
-
 
1311
     inc  edx
-
 
1312
     out  dx,al
-
 
1313
     ; R
-
 
1314
     mov  dx,word [wss]
-
 
1315
     add  dx,4
-
 
1316
     mov  al,0x3
-
 
1317
     out  dx,al
-
 
1318
     mov  esi,1
-
 
1319
     call delay_ms
-
 
1320
     mov  eax,ebx
-
 
1321
     inc  edx
-
 
1322
     out  dx,al
-
 
1323
     mov  [esp+36],dword 0
-
 
1324
     ret
-
 
1325
   wssl3:
-
 
1326
     mov   [esp+36],dword 2
1252
     ret
Line 1327... Line 1253...
1327
     ret
1253
 
1328
 
1254
 
1329
display_number:
1255
display_number:
Line 1337... Line 1263...
1337
;                   eax bits 22-31 = reserved
1263
;                   eax bits 22-31 = reserved
1338
;
1264
;
1339
; ebx = number or pointer
1265
; ebx = number or pointer
1340
; ecx = x shl 16 + y
1266
; ecx = x shl 16 + y
1341
; edx = color
1267
; edx = color
-
 
1268
        xor     edi, edi
-
 
1269
display_number_force:
Line 1342... Line 1270...
1342
 
1270
 
1343
     cmp   eax,0xffff            ; length > 0 ?
1271
     cmp   eax,0xffff            ; length > 0 ?
1344
     jge   cont_displ
1272
     jge   cont_displ
1345
     ret
1273
     ret
Line 1362... Line 1290...
1362
     jne   no_display_desnum
1290
     jne   no_display_desnum
1363
     shr   eax,16
1291
     shr   eax,16
1364
     and   eax,0x3f
1292
     and   eax,0x3f
1365
     push  eax
1293
     push  eax
1366
     mov   edi,esp
1294
     mov   edi,esp
1367
     add   edi,4+64
1295
     add   edi,4+64-1
1368
     mov   ecx,eax
1296
     mov   ecx,eax
1369
     mov   eax,ebx
1297
     mov   eax,ebx
1370
     mov   ebx,10
1298
     mov   ebx,10
1371
   d_desnum:
1299
   d_desnum:
1372
     xor   edx,edx
1300
     xor   edx,edx
Line 1386... Line 1314...
1386
     jne   no_display_hexnum
1314
     jne   no_display_hexnum
1387
     shr   eax,16
1315
     shr   eax,16
1388
     and   eax,0x3f
1316
     and   eax,0x3f
1389
     push  eax
1317
     push  eax
1390
     mov   edi,esp
1318
     mov   edi,esp
1391
     add   edi,4+64
1319
     add   edi,4+64-1
1392
     mov   ecx,eax
1320
     mov   ecx,eax
1393
     mov   eax,ebx
1321
     mov   eax,ebx
1394
     mov   ebx,16
1322
     mov   ebx,16
1395
   d_hexnum:
1323
   d_hexnum:
1396
     xor   edx,edx
1324
     xor   edx,edx
Line 1411... Line 1339...
1411
     jne   no_display_binnum
1339
     jne   no_display_binnum
1412
     shr   eax,16
1340
     shr   eax,16
1413
     and   eax,0x3f
1341
     and   eax,0x3f
1414
     push  eax
1342
     push  eax
1415
     mov   edi,esp
1343
     mov   edi,esp
1416
     add   edi,4+64
1344
     add   edi,4+64-1
1417
     mov   ecx,eax
1345
     mov   ecx,eax
1418
     mov   eax,ebx
1346
     mov   eax,ebx
1419
     mov   ebx,2
1347
     mov   ebx,2
1420
   d_binnum:
1348
   d_binnum:
1421
     xor   edx,edx
1349
     xor   edx,edx
Line 1444... Line 1372...
1444
     ; ebx color
1372
     ; ebx color
1445
     ; ecx start of text
1373
     ; ecx start of text
1446
     ; edx length
1374
     ; edx length
1447
     ; edi 1 force
1375
     ; edi 1 force
Line -... Line 1376...
-
 
1376
 
-
 
1377
;        mov     edi,[CURRENT_TASK]
-
 
1378
;        shl     edi,8
-
 
1379
;        add     ax,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.top]
-
 
1380
;        rol     eax,16
-
 
1381
;        add     ax,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.left]
-
 
1382
;        rol     eax,16
1448
 
1383
 
1449
     mov   edx,eax
1384
     mov   edx,eax
1450
     mov   ecx,65
1385
     mov   ecx,64+4
1451
     sub   ecx,eax
1386
     sub   ecx,eax
1452
     add   ecx,esp
-
 
1453
     add   ecx,4
1387
     add   ecx,esp
1454
     mov   eax,[esp+64+32-8+4]
1388
     mov   eax,[esp+64+32-8+4]
1455
     push  edx                       ; add window start x & y
1389
     push  edx                       ; add window start x & y
1456
     mov   edx,[0x3010]
1390
     mov   edx,[TASK_BASE]
-
 
1391
     mov   ebx,[edx-twdw+WDATA.box.left]
1457
     mov   ebx,[edx-twdw+WDATA.box.left]
1392
     add   ebx, [(edx-CURRENT_TASK)*8+SLOT_BASE+APPDATA.wnd_clientbox.left]
1458
     shl   ebx,16
1393
     shl   ebx,16
-
 
1394
     add   ebx,[edx-twdw+WDATA.box.top]
1459
     add   ebx,[edx-twdw+WDATA.box.top]
1395
     add   ebx, [(edx-CURRENT_TASK)*8+SLOT_BASE+APPDATA.wnd_clientbox.top]
1460
     add   eax,ebx
1396
     add   eax,ebx
1461
     pop   edx
1397
     pop   edx
1462
     mov   ebx,[esp+64+32-12+4]
1398
     mov   ebx,[esp+64+32-12+4]
1463
        and     ebx, not 0x80000000     ; force counted string
1399
        and     ebx, not 0x80000000     ; force counted string
1464
        mov     esi, [esp+64+4+4]
1400
        mov     esi, [esp+64+4+4]
1465
     xor   edi,edi
1401
        mov     edi, [esp+64+4]
Line 1466... Line 1402...
1466
     jmp   dtext
1402
     jmp   dtext
Line 1467... Line 1403...
1467
 
1403
 
Line 1483... Line 1419...
1483
; 1=roland mpu midi base , base io address
1419
; 1=roland mpu midi base , base io address
1484
; 2=keyboard   1, base kaybap 2, shift keymap, 9 country 1eng 2fi 3ger 4rus
1420
; 2=keyboard   1, base kaybap 2, shift keymap, 9 country 1eng 2fi 3ger 4rus
1485
; 3=cd base    1, pri.master 2, pri slave 3 sec master, 4 sec slave
1421
; 3=cd base    1, pri.master 2, pri slave 3 sec master, 4 sec slave
1486
; 4=sb16 base , base io address
1422
; 4=sb16 base , base io address
1487
; 5=system language, 1eng 2fi 3ger 4rus
1423
; 5=system language, 1eng 2fi 3ger 4rus
1488
; 6=wss base , base io address
-
 
1489
; 7=hd base    1, pri.master 2, pri slave 3 sec master, 4 sec slave
1424
; 7=hd base    1, pri.master 2, pri slave 3 sec master, 4 sec slave
1490
; 8=fat32 partition in hd
1425
; 8=fat32 partition in hd
1491
; 9
1426
; 9
1492
; 10 = sound dma channel
1427
; 10 = sound dma channel
1493
; 11 = enable lba read
1428
; 11 = enable lba read
Line 1506... Line 1441...
1506
     mov  word [mididp],bx
1441
     mov  word [mididp],bx
1507
     inc  bx
1442
     inc  bx
1508
     mov  word [midisp],bx
1443
     mov  word [midisp],bx
1509
     ret
1444
     ret
Line -... Line 1445...
-
 
1445
 
1510
 
1446
iglobal
-
 
1447
midi_base dw 0
Line 1511... Line 1448...
1511
midi_base dw 0
1448
endg
Line 1512... Line 1449...
1512
 
1449
 
1513
   nsyse1:
1450
   nsyse1:
1514
 
1451
 
1515
     cmp  eax,2                      ; KEYBOARD
1452
     cmp  eax,2                      ; KEYBOARD
1516
     jnz  nsyse2
1453
     jnz  nsyse2
1517
     cmp  ebx,1
1454
     cmp  ebx,1
1518
     jnz  kbnobase
1455
     jnz  kbnobase
1519
     mov  edi,[0x3010]
1456
     mov  edi,[TASK_BASE]
1520
     add  ecx,[edi+TASKDATA.mem_start]
1457
     add  ecx,[edi+TASKDATA.mem_start]
1521
     mov  eax,ecx
1458
     mov  eax,ecx
1522
     mov  ebx,keymap
1459
     mov  ebx,keymap
1523
     mov  ecx,128
1460
     mov  ecx,128
1524
     call memmove
1461
     call memmove
1525
     ret
1462
     ret
1526
   kbnobase:
1463
   kbnobase:
1527
     cmp  ebx,2
1464
     cmp  ebx,2
1528
     jnz  kbnoshift
1465
     jnz  kbnoshift
1529
     mov  edi,[0x3010]
1466
     mov  edi,[TASK_BASE]
1530
     add  ecx,[edi+TASKDATA.mem_start]
1467
     add  ecx,[edi+TASKDATA.mem_start]
1531
     mov  eax,ecx
1468
     mov  eax,ecx
1532
     mov  ebx,keymap_shift
1469
     mov  ebx,keymap_shift
1533
     mov  ecx,128
1470
     mov  ecx,128
1534
     call memmove
1471
     call memmove
1535
     ret
1472
     ret
1536
   kbnoshift:
1473
   kbnoshift:
1537
     cmp  ebx,3
1474
     cmp  ebx,3
1538
     jne  kbnoalt
1475
     jne  kbnoalt
1539
     mov  edi,[0x3010]
1476
     mov  edi,[TASK_BASE]
1540
     add  ecx,[edi+TASKDATA.mem_start]
1477
     add  ecx,[edi+TASKDATA.mem_start]
1541
     mov  eax,ecx
1478
     mov  eax,ecx
Line 1600... Line 1537...
1600
     jnz  nsyse5
1537
     jnz  nsyse5
1601
     mov  [syslang],ebx
1538
     mov  [syslang],ebx
1602
     ret
1539
     ret
1603
   nsyse5:
1540
   nsyse5:
Line 1604... Line -...
1604
 
-
 
1605
     cmp  eax,6                      ; WSS
-
 
1606
     jnz  nsyse6
-
 
1607
     cmp  ebx,0x100
-
 
1608
     jb   nsyse6
-
 
1609
     mov  [wss],ebx
-
 
1610
     ret
-
 
1611
 
-
 
1612
wss_temp dd 0
-
 
1613
 
-
 
1614
   nsyse6:
-
 
1615
 
1541
 
1616
     cmp  eax,7                      ; HD BASE
1542
     cmp  eax,7                      ; HD BASE
1617
     jne  nsyse7
1543
     jne  nsyse7
1618
     test ebx,ebx
1544
     test ebx,ebx
1619
     jz   nosethd
1545
     jz   nosethd
Line 1646... Line 1572...
1646
     mov  [hdbase],0x170
1572
     mov  [hdbase],0x170
1647
     mov  [hdid],0x10
1573
     mov  [hdid],0x10
1648
     mov  [hdpos],4
1574
     mov  [hdpos],4
1649
;     call set_FAT32_variables
1575
;     call set_FAT32_variables
1650
   noseslhd:
1576
   noseslhd:
1651
     mov   [0xfe10],dword 0
-
 
1652
    call  reserve_hd1
1577
    call  reserve_hd1
-
 
1578
    call  reserve_hd_channel
1653
    call  clear_hd_cache
1579
    call  free_hd_channel
1654
    mov   [hd1_status],0        ; free
1580
    mov   [hd1_status],0        ; free
1655
   nosethd:
1581
   nosethd:
1656
     ret
1582
     ret
Line -... Line 1583...
-
 
1583
 
1657
 
1584
iglobal
-
 
1585
hd_base db 0
Line 1658... Line 1586...
1658
hd_base db 0
1586
endg
Line 1659... Line 1587...
1659
 
1587
 
1660
   nsyse7:
1588
   nsyse7:
1661
 
1589
 
1662
     cmp  eax,8                      ; HD PARTITION
1590
     cmp  eax,8                      ; HD PARTITION
1663
     jne  nsyse8
1591
     jne  nsyse8
-
 
1592
     mov  [fat32part],ebx
1664
     mov  [fat32part],ebx
1593
;     call set_FAT32_variables
1665
;     call set_FAT32_variables
1594
    call  reserve_hd1
1666
    call  reserve_hd1
1595
    call  reserve_hd_channel
1667
    call  clear_hd_cache
1596
    call  free_hd_channel
1668
     pusha
1597
     pusha
1669
     call  choice_necessity_partition_1
1598
     call  choice_necessity_partition_1
Line 1710... Line 1639...
1710
; 1=roland mpu midi base , base io address
1639
; 1=roland mpu midi base , base io address
1711
; 2=keyboard   1, base kaybap 2, shift keymap, 9 country 1eng 2fi 3ger 4rus
1640
; 2=keyboard   1, base kaybap 2, shift keymap, 9 country 1eng 2fi 3ger 4rus
1712
; 3=cd base    1, pri.master 2, pri slave 3 sec master, 4 sec slave
1641
; 3=cd base    1, pri.master 2, pri slave 3 sec master, 4 sec slave
1713
; 4=sb16 base , base io address
1642
; 4=sb16 base , base io address
1714
; 5=system language, 1eng 2fi 3ger 4rus
1643
; 5=system language, 1eng 2fi 3ger 4rus
1715
; 6=wss base
-
 
1716
; 7=hd base    1, pri.master 2, pri slave 3 sec master, 4 sec slave
1644
; 7=hd base    1, pri.master 2, pri slave 3 sec master, 4 sec slave
1717
; 8=fat32 partition in hd
1645
; 8=fat32 partition in hd
1718
; 9=get hs timer tic
1646
; 9=get hs timer tic
Line 1719... Line 1647...
1719
 
1647
 
Line 1726... Line 1654...
1726
 
1654
 
1727
     cmp  eax,2
1655
     cmp  eax,2
1728
     jne  ngsyse2
1656
     jne  ngsyse2
1729
     cmp  ebx,1
1657
     cmp  ebx,1
1730
     jnz  kbnobaseret
1658
     jnz  kbnobaseret
1731
     mov  edi,[0x3010]
1659
     mov  edi,[TASK_BASE]
1732
     add  ecx,[edi+TASKDATA.mem_start]
1660
     add  ecx,[edi+TASKDATA.mem_start]
1733
     mov  ebx,ecx
1661
     mov  ebx,ecx
1734
     mov  eax,keymap
1662
     mov  eax,keymap
1735
     mov  ecx,128
1663
     mov  ecx,128
1736
     call memmove
1664
     call memmove
1737
     ret
1665
     ret
1738
   kbnobaseret:
1666
   kbnobaseret:
1739
     cmp  ebx,2
1667
     cmp  ebx,2
1740
     jnz  kbnoshiftret
1668
     jnz  kbnoshiftret
1741
     mov  edi,[0x3010]
1669
     mov  edi,[TASK_BASE]
1742
     add  ecx,[edi+TASKDATA.mem_start]
1670
     add  ecx,[edi+TASKDATA.mem_start]
1743
     mov  ebx,ecx
1671
     mov  ebx,ecx
1744
     mov  eax,keymap_shift
1672
     mov  eax,keymap_shift
1745
     mov  ecx,128
1673
     mov  ecx,128
1746
     call memmove
1674
     call memmove
1747
     ret
1675
     ret
1748
   kbnoshiftret:
1676
   kbnoshiftret:
1749
     cmp  ebx,3
1677
     cmp  ebx,3
1750
     jne  kbnoaltret
1678
     jne  kbnoaltret
1751
     mov  edi,[0x3010]
1679
     mov  edi,[TASK_BASE]
1752
     add  ecx,[edi+TASKDATA.mem_start]
1680
     add  ecx,[edi+TASKDATA.mem_start]
1753
     mov  ebx,ecx
1681
     mov  ebx,ecx
1754
     mov  eax,keymap_alt
1682
     mov  eax,keymap_alt
1755
     mov  ecx,128
1683
     mov  ecx,128
Line 1781... Line 1709...
1781
     jnz  ngsyse5
1709
     jnz  ngsyse5
1782
     mov  eax,[syslang]
1710
     mov  eax,[syslang]
1783
     mov  [esp+36],eax
1711
     mov  [esp+36],eax
1784
     ret
1712
     ret
1785
   ngsyse5:
1713
   ngsyse5:
1786
     cmp  eax,6
-
 
1787
     jnz  ngsyse6
-
 
1788
     mov  eax,[wss]
-
 
1789
     mov  [esp+36],eax
-
 
1790
     ret
-
 
1791
   ngsyse6:
-
 
1792
     cmp  eax,7
1714
     cmp  eax,7
1793
     jnz  ngsyse7
1715
     jnz  ngsyse7
1794
     movzx eax,[hd_base]
1716
     movzx eax,[hd_base]
1795
     mov  [esp+36],eax
1717
     mov  [esp+36],eax
1796
     ret
1718
     ret
Line 1826... Line 1748...
1826
     ret
1748
     ret
1827
   ngsyse12:
1749
   ngsyse12:
1828
     mov  [esp+36],dword 1
1750
     mov  [esp+36],dword 1
1829
     ret
1751
     ret
Line 1830... Line 1752...
1830
 
1752
 
1831
 
1753
iglobal
-
 
1754
align 4
-
 
1755
mousefn dd msscreen, mswin, msbutton, msset
-
 
1756
        dd app_load_cursor
-
 
1757
        dd app_set_cursor
-
 
1758
        dd app_delete_cursor
Line 1832... Line 1759...
1832
align 4
1759
endg
Line 1833... Line 1760...
1833
 
1760
 
1834
readmousepos:
1761
readmousepos:
1835
 
1762
 
-
 
1763
; eax=0 screen relative
-
 
1764
; eax=1 window relative
-
 
1765
; eax=2 buttons pressed
-
 
1766
; eax=3 set mouse pos   ; reserved
Line 1836... Line 1767...
1836
; eax=0 screen relative
1767
; eax=4 load cursor
1837
; eax=1 window relative
1768
; eax=5 set cursor
-
 
1769
; eax=6 delete cursor   ; reserved
-
 
1770
 
1838
; eax=2 buttons pressed
1771
           cmp eax, 6
1839
 
1772
           ja msset
1840
    test eax,eax
1773
           jmp [mousefn+eax*4]
1841
    jnz  nosr
1774
msscreen:
1842
    mov  eax,[0xfb0a]
1775
           mov  eax,[MOUSE_X]
1843
    shl  eax,16
1776
           shl  eax,16
1844
    mov  ax,[0xfb0c]
-
 
1845
    mov  [esp+36],eax
-
 
1846
    ret
-
 
1847
  nosr:
1777
           mov  ax,[MOUSE_Y]
1848
 
1778
           mov  [esp+36],eax
1849
    cmp  eax,1
1779
           ret
1850
    jnz  nowr
1780
mswin:
1851
    mov  eax,[0xfb0a]
1781
           mov  eax,[MOUSE_X]
1852
    shl  eax,16
1782
           shl  eax,16
1853
    mov  ax,[0xfb0c]
1783
           mov  ax,[MOUSE_Y]
1854
    mov  esi,[0x3010]
1784
           mov  esi,[TASK_BASE]
-
 
1785
           mov  bx, word [esi-twdw+WDATA.box.left]
-
 
1786
           shl  ebx,16
-
 
1787
           mov  bx, word [esi-twdw+WDATA.box.top]
-
 
1788
           sub  eax,ebx
-
 
1789
 
-
 
1790
           mov  edi,[CURRENT_TASK]
-
 
1791
           shl  edi,8
1855
    mov  bx, word [esi-twdw+WDATA.box.left]
1792
           sub  ax,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.top]
1856
    shl  ebx,16
1793
           rol  eax,16
-
 
1794
           sub  ax,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.left]
-
 
1795
           rol  eax,16
-
 
1796
           mov  [esp+36],eax
-
 
1797
           ret
1857
    mov  bx, word [esi-twdw+WDATA.box.top]
1798
msbutton:
-
 
1799
           movzx eax,byte [BTN_DOWN]
Line 1858... Line 1800...
1858
    sub  eax,ebx
1800
           mov  [esp+36],eax
1859
    mov  [esp+36],eax
1801
           ret
1860
    ret
1802
msset:
1861
  nowr:
1803
           ret
-
 
1804
 
1862
 
1805
app_load_cursor:
-
 
1806
           add ebx, new_app_base
Line -... Line 1807...
-
 
1807
           cmp ebx, new_app_base
-
 
1808
           jb msset
-
 
1809
           stdcall load_cursor, ebx, ecx
-
 
1810
           mov [esp+36], eax
-
 
1811
           ret
-
 
1812
 
-
 
1813
app_set_cursor:
-
 
1814
           stdcall set_cursor, ebx
1863
    cmp   eax,2
1815
           mov [esp+36], eax
Line 1864... Line 1816...
1864
    jnz   nomb
1816
           ret
Line 1865... Line 1817...
1865
    movzx eax,byte [0xfb40]
1817
 
Line 1875... Line 1827...
1875
   in   al,dx
1827
   in   al,dx
1876
   and  al,0x80
1828
   and  al,0x80
1877
   pop  edx
1829
   pop  edx
1878
   ret
1830
   ret
Line 1879... Line -...
1879
 
-
 
1880
 
1831
 
Line 1881... Line 1832...
1881
is_output:
1832
is_output:
1882
 
1833
 
1883
   push edx
1834
   push edx
Line 1979... Line 1930...
1979
    ret
1930
    ret
Line 1980... Line 1931...
1980
 
1931
 
Line 1981... Line 1932...
1981
 
1932
 
1982
sys_end:
1933
sys_end:
Line 1983... Line 1934...
1983
 
1934
 
1984
     mov   eax,[0x3010]
1935
     mov   eax,[TASK_BASE]
1985
     mov   [eax+TASKDATA.state], 3  ; terminate this program
1936
     mov   [eax+TASKDATA.state], 3  ; terminate this program
1986
 
1937
 
Line 1987... Line 1938...
1987
    waitterm:            ; wait here for termination
1938
    waitterm:            ; wait here for termination
-
 
1939
     mov   eax,5
1988
     mov   eax,5
1940
     call  delay_hs
1989
     call  delay_hs
1941
     jmp   waitterm
1990
     jmp   waitterm
1942
 
1991
 
1943
iglobal
1992
iglobal
1944
align 4
Line 2009... Line 1961...
2009
        dd      sysfn_getfreemem        ; 16 = get free memory size
1961
        dd      sysfn_getfreemem        ; 16 = get free memory size
2010
        dd      sysfn_getallmem         ; 17 = get total memory size
1962
        dd      sysfn_getallmem         ; 17 = get total memory size
2011
        dd      sysfn_terminate2        ; 18 = terminate thread using PID 
1963
        dd      sysfn_terminate2        ; 18 = terminate thread using PID
2012
                                        ;                 instead of slot
1964
                                        ;                 instead of slot
2013
        dd      sysfn_mouse_acceleration; 19 = set/get mouse acceleration
1965
        dd      sysfn_mouse_acceleration; 19 = set/get mouse acceleration
-
 
1966
        dd      sysfn_meminfo           ; 20 = get extended memory info
2014
sysfn_num = ($ - sys_system_table)/4
1967
sysfn_num = ($ - sys_system_table)/4
2015
endg
1968
endg
Line 2016... Line 1969...
2016
 
1969
 
2017
sys_system:
1970
sys_system:
Line 2023... Line 1976...
2023
        ret
1976
        ret
Line 2024... Line 1977...
2024
 
1977
 
2025
sysfn_shutdown:         ; 18.1 = BOOT
1978
sysfn_shutdown:         ; 18.1 = BOOT
2026
     mov  [0x2f0000+0x9030],byte 0
1979
     mov  [0x2f0000+0x9030],byte 0
-
 
1980
  for_shutdown_parameter:
2027
  for_shutdown_parameter:
1981
 
2028
     mov  eax,[0x3004]
1982
     mov  eax,[TASK_COUNT]
2029
     add  eax,2
1983
     add  eax,2
2030
     mov  [shutdown_processes],eax
1984
     mov  [shutdown_processes],eax
2031
     mov  [0xFF00],al
1985
     mov  [SYS_SHUTDOWN],al
2032
     and  dword [esp+36], 0
1986
     and  dword [esp+36], 0
2033
     ret
1987
     ret
2034
  uglobal
1988
  uglobal
2035
   shutdown_processes: dd 0x0
1989
   shutdown_processes: dd 0x0
Line 2036... Line 1990...
2036
  endg
1990
  endg
2037
 
1991
 
2038
sysfn_terminate:        ; 18.2 = TERMINATE
1992
sysfn_terminate:        ; 18.2 = TERMINATE
2039
     cmp  ebx,2
1993
     cmp  ebx,2
2040
     jb   noprocessterminate
1994
     jb   noprocessterminate
2041
     mov  edx,[0x3004]
1995
     mov  edx,[TASK_COUNT]
2042
     cmp  ebx,edx
1996
     cmp  ebx,edx
2043
     ja   noprocessterminate
1997
     ja   noprocessterminate
2044
     mov  eax,[0x3004]
1998
     mov  eax,[TASK_COUNT]
2045
     shl  ebx,5
1999
     shl  ebx,5
2046
     mov  edx,[ebx+0x3000+TASKDATA.pid]
2000
     mov  edx,[ebx+CURRENT_TASK+TASKDATA.pid]
2047
     add  ebx,0x3000+TASKDATA.state
2001
     add  ebx,CURRENT_TASK+TASKDATA.state
Line 2048... Line 2002...
2048
     cmp  byte [ebx], 9
2002
     cmp  byte [ebx], 9
2049
     jz   noprocessterminate
2003
     jz   noprocessterminate
Line 2087... Line 2041...
2087
    ret
2041
    ret
Line 2088... Line 2042...
2088
 
2042
 
2089
sysfn_activate:         ; 18.3 = ACTIVATE WINDOW
2043
sysfn_activate:         ; 18.3 = ACTIVATE WINDOW
2090
     cmp  ebx,2
2044
     cmp  ebx,2
2091
     jb   .nowindowactivate
2045
     jb   .nowindowactivate
2092
     cmp  ebx,[0x3004]
2046
     cmp  ebx,[TASK_COUNT]
Line 2093... Line 2047...
2093
     ja   .nowindowactivate
2047
     ja   .nowindowactivate
Line 2094... Line 2048...
2094
 
2048
 
2095
     mov   [window_minimize], 2   ; restore window if minimized
2049
     mov   [window_minimize], 2   ; restore window if minimized
2096
 
2050
 
Line 2097... Line 2051...
2097
     movzx esi, word [0xC000 + ebx*2]
2051
     movzx esi, word [WIN_STACK + ebx*2]
2098
     cmp   esi, [0x3004] 
2052
     cmp   esi, [TASK_COUNT]
2099
     je    .nowindowactivate ; already active
2053
     je    .nowindowactivate ; already active
2100
 
2054
 
2101
     mov   edi, ebx
2055
     mov   edi, ebx
2102
     shl   edi, 5
2056
     shl   edi, 5
2103
     add   edi, window_data
2057
     add   edi, window_data
2104
     movzx esi, word [0xC000 + ebx * 2]
2058
     movzx esi, word [WIN_STACK + ebx * 2]
Line 2105... Line 2059...
2105
     lea   esi, [0xC400 + esi * 2]
2059
     lea   esi, [WIN_POS + esi * 2]
2106
     call  waredraw
2060
     call  waredraw
2107
.nowindowactivate:
2061
.nowindowactivate:
2108
     ret
2062
     ret
Line 2109... Line 2063...
2109
 
2063
 
2110
sysfn_getidletime:              ; 18.4 = GET IDLETIME
2064
sysfn_getidletime:              ; 18.4 = GET IDLETIME
2111
     mov  eax,[idleusesec]
2065
     mov  eax,[idleusesec]
2112
     mov  [esp+36], eax
2066
     mov  [esp+36], eax
Line 2113... Line 2067...
2113
     ret
2067
     ret
2114
 
2068
 
2115
sysfn_getcpuclock:              ; 18.5 = GET TSC/SEC
2069
sysfn_getcpuclock:              ; 18.5 = GET TSC/SEC
2116
     mov  eax,[0xf600]
2070
     mov  eax,[CPU_FREQ]
Line 2117... Line 2071...
2117
     mov  [esp+36], eax
2071
     mov  [esp+36], eax
2118
     ret
2072
     ret
2119
 
2073
 
2120
;  SAVE ramdisk to /hd/1/menuet.img
2074
;  SAVE ramdisk to /hd/1/menuet.img
2121
;!!!!!!!!!!!!!!!!!!!!!!!!
2075
;!!!!!!!!!!!!!!!!!!!!!!!!
Line 2122... Line 2076...
2122
   include 'blkdev/rdsave.inc'
2076
   include 'blkdev/rdsave.inc'
2123
;!!!!!!!!!!!!!!!!!!!!!!!!
2077
;!!!!!!!!!!!!!!!!!!!!!!!!
Line 2162... Line 2116...
2162
     mov ecx,10
2116
     mov ecx,10
2163
     cld
2117
     cld
2164
     rep movsb
2118
     rep movsb
2165
     ret
2119
     ret
2166
   for_all_tables:
2120
   for_all_tables:
2167
     mov edi,[0x3010]
2121
     mov edi,[TASK_BASE]
2168
     mov edi,[edi+TASKDATA.mem_start]
2122
     mov edi,[edi+TASKDATA.mem_start]
2169
     add edi,ecx
2123
     add edi,ecx
2170
     mov esi,0x40000
2124
     mov esi,DRIVE_DATA
2171
     ret
2125
     ret
2172
  full_table:
2126
  full_table:
2173
     cmp  ebx,2
2127
     cmp  ebx,2
2174
     jnz  exit_for_anyone
2128
     jnz  exit_for_anyone
2175
     call for_all_tables
2129
     call for_all_tables
Line 2181... Line 2135...
2181
sysfn_lastkey:          ; 18.12 = return 0 (backward compatibility)
2135
sysfn_lastkey:          ; 18.12 = return 0 (backward compatibility)
2182
        and     dword [esp+36], 0
2136
        and     dword [esp+36], 0
2183
        ret
2137
        ret
Line 2184... Line 2138...
2184
 
2138
 
2185
sysfn_getversion:       ; 18.13 = get kernel ID and version
2139
sysfn_getversion:       ; 18.13 = get kernel ID and version
2186
     mov edi,[0x3010]
2140
     mov edi,[TASK_BASE]
2187
     mov edi,[edi+TASKDATA.mem_start]
2141
     mov edi,[edi+TASKDATA.mem_start]
2188
     add edi,ebx
2142
     add edi,ebx
2189
     mov esi,version_inf
2143
     mov esi,version_inf
2190
     mov ecx,version_end-version_inf
2144
     mov ecx,version_end-version_inf
Line 2232... Line 2186...
2232
     mov  [mouse_delay],ecx
2186
     mov  [mouse_delay],ecx
2233
     ret
2187
     ret
2234
 .set_pointer_position:
2188
 .set_pointer_position:
2235
     cmp  ebx,4  ; set mouse pointer position
2189
     cmp  ebx,4  ; set mouse pointer position
2236
     jnz  .end
2190
     jnz  .end
2237
     mov   [0xFB0C],cx    ;y
2191
     mov   [MOUSE_Y],cx    ;y
2238
     ror   ecx,16
2192
     ror   ecx,16
2239
     mov   [0xFB0A],cx    ;x
2193
     mov   [MOUSE_X],cx    ;x
2240
     rol   ecx,16
2194
     rol   ecx,16
2241
 .end:
2195
 .end:
2242
     ret
2196
     ret
Line 2243... Line 2197...
2243
 
2197
 
2244
sysfn_getfreemem:
2198
sysfn_getfreemem:
2245
     mov  eax,[MEM_FreeSpace]
2199
     mov eax, [pg_data.pages_free]
2246
     shl  eax,2
2200
     shl eax, 2
2247
     mov  [esp+36],eax
2201
     mov [esp+36],eax
Line 2248... Line 2202...
2248
     ret
2202
     ret
2249
 
2203
 
2250
sysfn_getallmem:
2204
sysfn_getallmem:
2251
     mov  eax,[0xFE8C]
-
 
2252
     shr  eax,10
-
 
2253
;     mov  eax,[MEM_AllSpace]
2205
     mov  eax,[MEM_AMOUNT]
2254
;     shl  eax,2
2206
     shr eax, 10
Line 2255... Line 2207...
2255
     mov  [esp+36],eax
2207
     mov  [esp+36],eax
2256
     ret
2208
     ret
Line 2263... Line 2215...
2263
sound_flag      db 0
2215
sound_flag      db 0
2264
endg
2216
endg
Line 2265... Line 2217...
2265
 
2217
 
2266
iglobal
2218
iglobal
2267
version_inf:
2219
version_inf:
2268
  db 0,5,8,1  ; version 0.5.8.1
2220
  db 0,6,5,0  ; version 0.6.5.0
2269
  db UID_KOLIBRI
2221
  db UID_KOLIBRI
2270
  db 'Kolibri',0
2222
  db 'Kolibri',0
2271
version_end:
2223
version_end:
Line 2348... Line 2300...
2348
    jbe   nosb2
2300
    jbe   nosb2
2349
    mov   edx,[ebx]
2301
    mov   edx,[ebx]
2350
    and   edx,0xFF000000 ;255*256*256*256
2302
    and   edx,0xFF000000 ;255*256*256*256
2351
    and   ecx,0x00FFFFFF ;255*256*256+255*256+255
2303
    and   ecx,0x00FFFFFF ;255*256*256+255*256+255
2352
    add   edx,ecx
2304
    add   edx,ecx
2353
    mov   [ebx+0x300000],edx
2305
    mov   [ebx+IMG_BACKGROUND],edx
2354
;    mov   [bgrchanged],1
2306
;    mov   [bgrchanged],1
2355
    ret
2307
    ret
2356
  nosb2:
2308
  nosb2:
Line 2357... Line 2309...
2357
 
2309
 
Line 2360... Line 2312...
2360
draw_background_temp:
2312
draw_background_temp:
2361
;    cmp   [bgrchanged],1 ;0
2313
;    cmp   [bgrchanged],1 ;0
2362
;    je    nosb31
2314
;    je    nosb31
2363
;draw_background_temp:
2315
;draw_background_temp:
2364
;    mov   [bgrchanged],1 ;0
2316
;    mov   [bgrchanged],1 ;0
2365
    mov   [0xfff0],byte 1
2317
    mov   [REDRAW_BACKGROUND],byte 1
2366
    mov    [background_defined], 1
2318
    mov    [background_defined], 1
2367
   nosb31:
2319
   nosb31:
2368
    ret
2320
    ret
2369
  nosb3:
2321
  nosb3:
Line 2379... Line 2331...
2379
  nosb4:
2331
  nosb4:
Line 2380... Line 2332...
2380
 
2332
 
2381
    cmp   eax,5                            ; BLOCK MOVE TO BGR
2333
    cmp   eax,5                            ; BLOCK MOVE TO BGR
2382
    jnz   nosb5
2334
    jnz   nosb5
2383
  ; bughere
2335
  ; bughere
2384
    mov   edi, [0x3010]
2336
    mov   edi, [TASK_BASE]
2385
    add   ebx, [edi+TASKDATA.mem_start]
2337
    add   ebx, [edi+TASKDATA.mem_start]
2386
 ;   mov   esi, ebx
2338
 ;   mov   esi, ebx
2387
 ;   mov   edi, ecx
2339
 ;   mov   edi, ecx
2388
    mov   eax, ebx
2340
    mov   eax, ebx
2389
    mov   ebx, ecx
2341
    mov   ebx, ecx
2390
    add   ecx, edx
2342
    add   ecx, edx
2391
    cmp   ecx, 0x160000-16
2343
    cmp   ecx, 0x160000-16
2392
    ja    .fin
2344
    ja    .fin
2393
 ;   add   edi, 0x300000
2345
 ;   add   edi, 0x300000
2394
    add   ebx, 0x300000
2346
    add   ebx, IMG_BACKGROUND
2395
    mov   ecx, edx
2347
    mov   ecx, edx
2396
    cmp   ecx, 0x160000-16
2348
    cmp   ecx, 0x160000-16
2397
    ja    .fin
2349
    ja    .fin
2398
;    mov   [bgrchanged],1
2350
;    mov   [bgrchanged],1
Line 2422... Line 2374...
2422
    cmp   eax,2                                  ; PIXEL
2374
    cmp   eax,2                                  ; PIXEL
2423
    jnz   nogb2
2375
    jnz   nogb2
2424
    mov   edx,0x160000-16
2376
    mov   edx,0x160000-16
2425
    cmp   edx,ebx
2377
    cmp   edx,ebx
2426
    jbe   nogb2
2378
    jbe   nogb2
2427
    mov   eax, [ebx+0x300000]
2379
    mov   eax, [ebx+IMG_BACKGROUND]
2428
    and   eax, 0xFFFFFF
2380
    and   eax, 0xFFFFFF
2429
    mov   [esp+36],eax
2381
    mov   [esp+36],eax
2430
    ret
2382
    ret
2431
  nogb2:
2383
  nogb2:
Line 2441... Line 2393...
2441
align 4
2393
align 4
Line 2442... Line 2394...
2442
 
2394
 
2443
sys_getkey:
2395
sys_getkey:
2444
    mov   [esp+36],dword 1
2396
    mov   [esp+36],dword 1
2445
; test main buffer
2397
; test main buffer
2446
    mov   ebx, [0x3000]                          ; TOP OF WINDOW STACK
2398
    mov   ebx, [CURRENT_TASK]                          ; TOP OF WINDOW STACK
2447
    movzx ecx,word [0xC000 + ebx * 2]
2399
    movzx ecx,word [WIN_STACK + ebx * 2]
2448
    mov   edx,[0x3004]
2400
    mov   edx,[TASK_COUNT]
2449
    cmp   ecx,edx
2401
    cmp   ecx,edx
2450
    jne   .finish
2402
    jne   .finish
2451
    cmp   [0xf400],byte 0
2403
    cmp   [KEY_COUNT],byte 0
2452
    je    .finish
2404
    je    .finish
2453
    movzx eax,byte [0xf401]
2405
    movzx eax,byte [KEY_BUFF]
2454
    shl   eax,8
2406
    shl   eax,8
2455
    push  eax
2407
    push  eax
2456
    dec   byte [0xf400]
2408
    dec   byte [KEY_COUNT]
2457
    and   byte [0xf400],127
2409
    and   byte [KEY_COUNT],127
2458
    movzx ecx,byte [0xf400]
2410
    movzx ecx,byte [KEY_COUNT]
2459
    add   ecx,2
2411
    add   ecx,2
2460
 ;   mov   esi,0xf402
2412
 ;   mov   esi,0xf402
2461
 ;   mov   edi,0xf401
2413
 ;   mov   edi,0xf401
2462
 ;   cld
2414
 ;   cld
2463
 ;  rep   movsb
2415
 ;  rep   movsb
2464
    mov   eax, 0xF402
2416
    mov   eax, KEY_BUFF+1
2465
    mov   ebx, 0xF401
2417
    mov   ebx, KEY_BUFF
2466
    call  memmove
2418
    call  memmove
2467
    pop   eax
2419
    pop   eax
2468
.ret_eax:
2420
.ret_eax:
2469
    mov   [esp+36],eax
2421
    mov   [esp+36],eax
Line 2489... Line 2441...
2489
 
2441
 
Line 2490... Line 2442...
2490
align 4
2442
align 4
Line 2491... Line 2443...
2491
 
2443
 
2492
sys_getbutton:
2444
sys_getbutton:
2493
 
2445
 
2494
    mov   ebx, [0x3000]                         ; TOP OF WINDOW STACK
2446
    mov   ebx, [CURRENT_TASK]                         ; TOP OF WINDOW STACK
2495
    mov   [esp+36],dword 1
2447
    mov   [esp+36],dword 1
2496
    movzx ecx, word [0xC000 + ebx * 2]
2448
    movzx ecx, word [WIN_STACK + ebx * 2]
2497
    mov   edx, [0x3004] ; less than 256 processes
2449
    mov   edx, [TASK_COUNT] ; less than 256 processes
2498
    cmp   ecx,edx
2450
    cmp   ecx,edx
2499
    jne   .exit
2451
    jne   .exit
2500
    movzx eax,byte [0xf500]
2452
    movzx eax,byte [BTN_COUNT]
2501
    test  eax,eax
2453
    test  eax,eax
2502
    jz    .exit
2454
    jz    .exit
2503
    mov   eax,[0xf501]
2455
    mov   eax,[BTN_BUFF]
2504
    shl   eax,8
2456
    shl   eax,8
2505
    mov   [0xf500],byte 0
2457
    mov   [BTN_COUNT],byte 0
Line 2521... Line 2473...
2521
;  +22 dword     start in mem
2473
;  +22 dword     start in mem
2522
;  +26 dword     used mem
2474
;  +26 dword     used mem
2523
;  +30 dword     PID , process idenfification number
2475
;  +30 dword     PID , process idenfification number
2524
;
2476
;
Line 2525... Line 2477...
2525
 
2477
 
2526
    mov  edi,[0x3010]   ; eax = return area
2478
    mov  edi,[TASK_BASE]   ; eax = return area
Line 2527... Line 2479...
2527
    add  eax,[edi + TASKDATA.mem_start]
2479
    add  eax,[edi + TASKDATA.mem_start]
2528
 
2480
 
2529
    cmp  ebx,-1         ; who am I ?
2481
    cmp  ebx,-1         ; who am I ?
2530
    jne  no_who_am_i
2482
    jne  no_who_am_i
Line 2531... Line 2483...
2531
    mov  ebx,[0x3000]
2483
    mov  ebx,[CURRENT_TASK]
2532
  no_who_am_i:
2484
  no_who_am_i:
Line 2541... Line 2493...
2541
    ; return memory usage
2493
    ; return memory usage
Line 2542... Line 2494...
2542
 
2494
 
2543
    xor  edx,edx
2495
    xor  edx,edx
2544
    mov  eax,0x20
2496
    mov  eax,0x20
2545
    mul  ebx
2497
    mul  ebx
2546
    add  eax,0x3000+TASKDATA.cpu_usage
2498
    add  eax,CURRENT_TASK+TASKDATA.cpu_usage
2547
    mov  ebx,eax
2499
    mov  ebx,eax
2548
    pop  eax
2500
    pop  eax
2549
    mov  ecx,[ebx]
2501
    mov  ecx,[ebx]
2550
    mov  [eax],ecx
2502
    mov  [eax],ecx
2551
    pop  ebx
2503
    pop  ebx
2552
    mov  cx, [0xC000 + ebx * 2]
2504
    mov  cx, [WIN_STACK + ebx * 2]
2553
    mov  [eax+4],cx
2505
    mov  [eax+4],cx
2554
    mov  cx, [0xC400 + ebx * 2]
2506
    mov  cx, [WIN_POS + ebx * 2]
2555
    mov  [eax+6],cx
2507
    mov  [eax+6],cx
2556
    push eax
2508
    push eax
2557
    mov  eax,ebx
2509
    mov  eax,ebx
2558
    shl  eax,8
2510
    shl  eax,8
2559
    add  eax,0x80000+APPDATA.app_name
2511
    add  eax,SLOT_BASE+APPDATA.app_name
2560
    pop  ebx
2512
    pop  ebx
2561
    add  ebx,10
2513
    add  ebx,10
2562
    mov  ecx,11
2514
    mov  ecx,11
Line 2568... Line 2520...
2568
    mov    edx,0x100000*16
2520
    mov    edx,0x100000*16
2569
    pop    ecx                                   ; get gdt of tss
2521
    pop    ecx                                   ; get gdt of tss
2570
    cmp    ecx,1
2522
    cmp    ecx,1
2571
    je     os_mem
2523
    je     os_mem
2572
    shl    ecx,8
2524
    shl    ecx,8
2573
    mov    edx,[0x80000+ecx+APPDATA.mem_size] ;0x8c
2525
    mov    edx,[SLOT_BASE+ecx+APPDATA.mem_size] ;0x8c
2574
    mov    eax,std_application_base_address
2526
    mov    eax,std_application_base_address
2575
    ; eax run base -> edx used memory
2527
    ; eax run base -> edx used memory
2576
  os_mem:
2528
  os_mem:
2577
    dec    edx
2529
    dec    edx
2578
    mov    [ebx+12],eax
2530
    mov    [ebx+12],eax
Line 2580... Line 2532...
2580
 
2532
 
Line 2581... Line 2533...
2581
    ; PID (+30)
2533
    ; PID (+30)
2582
 
2534
 
2583
    mov    eax,[esp]
2535
    mov    eax,[esp]
2584
    shl    eax,5
2536
    shl    eax,5
2585
    add    eax,0x3000+TASKDATA.pid
2537
    add    eax,CURRENT_TASK+TASKDATA.pid
Line 2586... Line 2538...
2586
    mov    eax,[eax]
2538
    mov    eax,[eax]
Line 2599... Line 2551...
2599
 
2551
 
Line 2600... Line 2552...
2600
    ; Process state (+50)
2552
    ; Process state (+50)
2601
 
2553
 
2602
    mov    eax,[esp]
2554
    mov    eax,[esp]
2603
    shl    eax,5
2555
    shl    eax,5
2604
    add    eax,0x3000+TASKDATA.state
2556
    add    eax,CURRENT_TASK+TASKDATA.state
Line -... Line 2557...
-
 
2557
    mov    eax,[eax]
-
 
2558
    mov    [ebx+40],ax
-
 
2559
 
-
 
2560
    ; Window client area box
-
 
2561
 
-
 
2562
    mov    esi,[esp]
-
 
2563
    shl    esi,8
-
 
2564
    add    esi,SLOT_BASE+APPDATA.wnd_clientbox
-
 
2565
    lea    edi,[ebx+44]
-
 
2566
    mov    ecx,4
-
 
2567
    rep    movsd
-
 
2568
 
-
 
2569
    ; Window state
-
 
2570
 
-
 
2571
    mov    esi,[esp]
-
 
2572
    shl    esi,5
Line 2605... Line 2573...
2605
    mov    eax,[eax]
2573
    add    esi,window_data + WDATA.box
2606
    mov    [ebx+40],ax
2574
    mov    al,[esi+window_data+WDATA.fl_wstate]
Line 2607... Line 2575...
2607
 
2575
    mov    [edi],al
Line 2608... Line 2576...
2608
 
2576
 
2609
    pop    ebx
2577
    pop    ebx
2610
    pop    eax
2578
    pop    eax
Line 2696... Line 2664...
2696
    cmp  eax,1
2664
    cmp  eax,1
2697
    jne  no_widgets_away
2665
    jne  no_widgets_away
Line 2698... Line 2666...
2698
 
2666
 
Line 2699... Line 2667...
2699
    ; buttons away
2667
    ; buttons away
Line 2700... Line 2668...
2700
 
2668
 
Line 2701... Line 2669...
2701
    mov   ecx,[0x3000]
2669
    mov   ecx,[CURRENT_TASK]
2702
 
2670
 
2703
  sys_newba2:
2671
  sys_newba2:
Line 2704... Line 2672...
2704
 
2672
 
2705
    mov   edi,[0xfe88]
2673
    mov   edi,[BTN_ADDR]
Line 2739... Line 2707...
2739
  no_widgets_away:
2707
  no_widgets_away:
Line 2740... Line 2708...
2740
 
2708
 
2741
    cmp   eax,2
2709
    cmp   eax,2
Line 2742... Line 2710...
2742
    jnz   srl1
2710
    jnz   srl1
2743
 
2711
 
2744
    mov   edx,[0x3010]      ; return whole screen draw area for this app
2712
    mov   edx,[TASK_BASE]      ; return whole screen draw area for this app
2745
    add   edx,draw_data-0x3000
2713
    add   edx,draw_data-CURRENT_TASK
2746
    mov   [edx+RECT.left], 0
2714
    mov   [edx+RECT.left], 0
2747
    mov   [edx+RECT.top], 0
2715
    mov   [edx+RECT.top], 0
2748
    mov   eax,[0xfe00]
2716
    mov   eax,[ScreenWidth]
2749
    mov   [edx+RECT.right],eax
2717
    mov   [edx+RECT.right],eax
Line 2750... Line 2718...
2750
    mov   eax,[0xfe04]
2718
    mov   eax,[ScreenHeight]
2751
    mov   [edx+RECT.bottom],eax
2719
    mov   [edx+RECT.bottom],eax
Line 2752... Line 2720...
2752
 
2720
 
Line 2753... Line 2721...
2753
    mov   edi,[0x3010]
2721
    mov   edi,[TASK_BASE]
Line 2809... Line 2777...
2809
    cmp   edi,3   ; type IV - skinned window
2777
    cmp   edi,3   ; type IV - skinned window
2810
    jne   nosyswIV
2778
    jne   nosyswIV
Line 2811... Line 2779...
2811
 
2779
 
2812
    ; parameter for drawwindow_IV
2780
    ; parameter for drawwindow_IV
2813
    push  0
2781
    push  0
2814
    mov   edi, [0x3004]
2782
    mov   edi, [TASK_COUNT]
2815
    movzx edi, word [0xC400 + edi*2]
2783
    movzx edi, word [WIN_POS + edi*2]
2816
    cmp   edi, [0x3000]
2784
    cmp   edi, [CURRENT_TASK]
2817
    jne   @f
2785
    jne   @f
2818
    inc   dword [esp]
2786
    inc   dword [esp]
Line 2819... Line 2787...
2819
 @@:
2787
 @@:
Line 2835... Line 2803...
2835
draw_window_caption:
2803
draw_window_caption:
2836
        inc     [mouse_pause]
2804
        inc     [mouse_pause]
2837
        call    [disable_mouse]
2805
        call    [disable_mouse]
Line 2838... Line 2806...
2838
 
2806
 
2839
        xor     eax,eax
2807
        xor     eax,eax
2840
        mov     edx,[0x3004]
2808
        mov     edx,[TASK_COUNT]
2841
        movzx   edx,word[0xC400+edx*2]
2809
        movzx   edx,word[WIN_POS+edx*2]
2842
        cmp     edx,[0x3000]
2810
        cmp     edx,[CURRENT_TASK]
2843
        jne     @f
2811
        jne     @f
2844
        inc     eax
2812
        inc     eax
2845
    @@: mov     edx,[0x3000]
2813
    @@: mov     edx,[CURRENT_TASK]
2846
        shl     edx,5
2814
        shl     edx,5
2847
        add     edx,window_data
2815
        add     edx,window_data
2848
        movzx   ebx,[edx+WDATA.fl_wstyle]
2816
        movzx   ebx,[edx+WDATA.fl_wstyle]
2849
        and     bl,0x0F
2817
        and     bl,0x0F
Line 2868... Line 2836...
2868
 
2836
 
Line 2869... Line 2837...
2869
        call    drawwindow_I_caption
2837
        call    drawwindow_I_caption
2870
 
2838
 
2871
;--------------------------------------------------------------
2839
;--------------------------------------------------------------
2872
  .2:   ;jmp     @f
2840
  .2:   ;jmp     @f
2873
        mov     edi,[0x3000]
2841
        mov     edi,[CURRENT_TASK]
2874
        shl     edi,5
2842
        shl     edi,5
2875
        test    [edi+window_data+WDATA.fl_wstyle],WSTYLE_HASCAPTION
2843
        test    [edi+window_data+WDATA.fl_wstyle],WSTYLE_HASCAPTION
2876
        jz      @f
2844
        jz      @f
2877
        mov     ecx,[edi*8+0x80000+APPDATA.wnd_caption]
2845
        mov     ecx,[edi*8+SLOT_BASE+APPDATA.wnd_caption]
2878
        or      ecx,ecx
2846
        or      ecx,ecx
Line 2879... Line 2847...
2879
        jz      @f
2847
        jz      @f
Line 2958... Line 2926...
2958
        jz      @f
2926
        jz      @f
Line 2959... Line 2927...
2959
 
2927
 
2960
        movzx   eax,[ecx+WDATA.fl_wstyle]
2928
        movzx   eax,[ecx+WDATA.fl_wstyle]
2961
        and     eax,0x0F
2929
        and     eax,0x0F
2962
        mov     eax,[eax*8+window_topleft+0]
2930
        mov     eax,[eax*8+window_topleft+0]
2963
        mov     [edi+0x80000+APPDATA.wnd_clientbox.left],eax
2931
        mov     [edi+SLOT_BASE+APPDATA.wnd_clientbox.left],eax
2964
        shl     eax,1
2932
        shl     eax,1
2965
        neg     eax
2933
        neg     eax
2966
        add     eax,[ecx+WDATA.box.width]
2934
        add     eax,[ecx+WDATA.box.width]
Line 2967... Line 2935...
2967
        mov     [edi+0x80000+APPDATA.wnd_clientbox.width],eax
2935
        mov     [edi+SLOT_BASE+APPDATA.wnd_clientbox.width],eax
2968
 
2936
 
2969
        movzx   eax,[ecx+WDATA.fl_wstyle]
2937
        movzx   eax,[ecx+WDATA.fl_wstyle]
2970
        and     eax,0x0F
2938
        and     eax,0x0F
2971
        push    [eax*8+window_topleft+0]
2939
        push    [eax*8+window_topleft+0]
2972
        mov     eax,[eax*8+window_topleft+4]
2940
        mov     eax,[eax*8+window_topleft+4]
2973
        mov     [edi+0x80000+APPDATA.wnd_clientbox.top],eax
2941
        mov     [edi+SLOT_BASE+APPDATA.wnd_clientbox.top],eax
2974
        neg     eax
2942
        neg     eax
2975
        sub     eax,[esp]
2943
        sub     eax,[esp]
2976
        add     eax,[ecx+WDATA.box.height]
2944
        add     eax,[ecx+WDATA.box.height]
Line 2977... Line 2945...
2977
        mov     [edi+0x80000+APPDATA.wnd_clientbox.height],eax
2945
        mov     [edi+SLOT_BASE+APPDATA.wnd_clientbox.height],eax
2978
        add     esp,4
2946
        add     esp,4
2979
 
2947
 
2980
        pop     edi ecx eax
2948
        pop     edi ecx eax
2981
        ret
2949
        ret
2982
    @@:
2950
    @@:
2983
        xor     eax,eax
2951
        xor     eax,eax
2984
        mov     [edi+0x80000+APPDATA.wnd_clientbox.left],eax
2952
        mov     [edi+SLOT_BASE+APPDATA.wnd_clientbox.left],eax
2985
        mov     [edi+0x80000+APPDATA.wnd_clientbox.top],eax
2953
        mov     [edi+SLOT_BASE+APPDATA.wnd_clientbox.top],eax
2986
        mov     eax,[ecx+WDATA.box.width]
2954
        mov     eax,[ecx+WDATA.box.width]
Line 2987... Line 2955...
2987
        mov     [edi+0x80000+APPDATA.wnd_clientbox.width],eax
2955
        mov     [edi+SLOT_BASE+APPDATA.wnd_clientbox.width],eax
2988
        mov     eax,[ecx+WDATA.box.height]
2956
        mov     eax,[ecx+WDATA.box.height]
Line 2989... Line 2957...
2989
        mov     [edi+0x80000+APPDATA.wnd_clientbox.height],eax
2957
        mov     [edi+SLOT_BASE+APPDATA.wnd_clientbox.height],eax
Line 2990... Line 2958...
2990
 
2958
 
2991
        pop     edi ecx eax
2959
        pop     edi ecx eax
2992
        ret
2960
        ret
Line 2993... Line 2961...
2993
 
2961
 
2994
sys_set_window:
2962
sys_set_window:
2995
 
2963
 
2996
    mov   edi,[0x3000]
2964
    mov   edi,[CURRENT_TASK]
Line 2997... Line -...
2997
    shl   edi,5
-
 
2998
    add   edi,window_data
-
 
2999
 
2965
    shl   edi,5
3000
    ; colors
2966
    add   edi,window_data
3001
    mov   [edi+WDATA.cl_workarea],ecx
2967
 
Line 3002... Line 2968...
3002
    mov   [edi+WDATA.cl_titlebar],edx
2968
    ; colors
3003
    mov   [edi+WDATA.cl_frames],esi
2969
    mov   [edi+WDATA.cl_workarea],ecx
3004
 
2970
    mov   [edi+WDATA.cl_titlebar],edx
3005
        call    set_window_clientbox
2971
    mov   [edi+WDATA.cl_frames],esi
Line 3019... Line 2985...
3019
    sar   eax,16
2985
    sar   eax,16
3020
    sar   ebx,16
2986
    sar   ebx,16
3021
    mov   word[edi+WDATA.box.left],ax
2987
    mov   word[edi+WDATA.box.left],ax
3022
    mov   word[edi+WDATA.box.top],bx
2988
    mov   word[edi+WDATA.box.top],bx
Line 3023... Line -...
3023
 
-
 
3024
 
2989
 
Line -... Line 2990...
-
 
2990
    call  check_window_position
Line 3025... Line 2991...
3025
    call  check_window_position
2991
 
3026
 
2992
    call  set_window_clientbox
Line 3027... Line 2993...
3027
 
2993
 
Line 3028... Line 2994...
3028
    push  ecx esi edi               ; save for window fullscreen/resize
2994
    push  ecx esi edi               ; save for window fullscreen/resize
3029
    ;mov   esi,edi
2995
    ;mov   esi,edi
3030
 
2996
 
Line 3031... Line 2997...
3031
        mov     cl,[edi+WDATA.fl_wstyle]
2997
        mov     cl,[edi+WDATA.fl_wstyle]
3032
 
2998
 
3033
    sub   edi,window_data
2999
    sub   edi,window_data
3034
    shl   edi,3
3000
    shl   edi,3
3035
    add   edi,0x80000
3001
    add   edi,SLOT_BASE
3036
 
3002
 
Line 3037... Line 3003...
3037
        and     cl,0x0F
3003
        and     cl,0x0F
3038
        mov     [edi+APPDATA.wnd_caption],0
3004
        mov     [edi+APPDATA.wnd_caption],0
3039
        cmp     cl,3
3005
        cmp     cl,3
3040
        jne     @f
3006
        jne     @f
-
 
3007
        mov     [edi+APPDATA.wnd_caption],esi
3041
        mov     [edi+APPDATA.wnd_caption],esi
3008
    @@: mov     esi,[esp+0]
Line 3042... Line 3009...
3042
    @@: mov     esi,[esp+0]
3009
 
3043
 
3010
    add   edi, APPDATA.saved_box
3044
    add   edi, APPDATA.saved_box
3011
        movsd
Line 3057... Line 3024...
3057
    add   ecx, eax
3024
    add   ecx, eax
3058
    add   edx, ebx
3025
    add   edx, ebx
3059
        call    [calc_clipping_rects]
3026
        call    [calc_clipping_rects]
3060
    pop   edx ecx ebx eax
3027
    pop   edx ecx ebx eax
Line 3061... Line 3028...
3061
 
3028
 
3062
    mov   [0xf400],byte 0           ; empty keyboard buffer
3029
    mov   [KEY_COUNT],byte 0           ; empty keyboard buffer
Line 3063... Line 3030...
3063
    mov   [0xf500],byte 0           ; empty button buffer
3030
    mov   [BTN_COUNT],byte 0           ; empty button buffer
3064
 
3031
 
3065
  newd:
3032
  newd:
Line 3075... Line 3042...
3075
        jnz     .get_window_caption
3042
        jnz     .get_window_caption
Line 3076... Line 3043...
3076
 
3043
 
3077
        ; NOTE: only window owner thread can set its caption,
3044
        ; NOTE: only window owner thread can set its caption,
Line 3078... Line 3045...
3078
        ;       so there's no parameter for PID/TID
3045
        ;       so there's no parameter for PID/TID
3079
 
3046
 
Line 3080... Line 3047...
3080
        mov     edi,[0x3000]
3047
        mov     edi,[CURRENT_TASK]
3081
        shl     edi,5
3048
        shl     edi,5
3082
 
3049
 
-
 
3050
        ; have to check if caption is within application memory limit
-
 
3051
        ; check is trivial, and if application resizes its memory,
3083
        ; have to check if caption is within application memory limit
3052
        ;   caption still can become over bounds
3084
        ; check is trivial, and if application resizes its memory,
3053
; diamond, 31.10.2006: check removed because with new memory manager
3085
        ;   caption still can become over bounds
3054
; there can be valid data after APPDATA.mem_size bound
3086
        mov     ecx,[edi*8+0x80000+APPDATA.mem_size]
3055
;        mov     ecx,[edi*8+SLOT_BASE+APPDATA.mem_size]
Line 3087... Line 3056...
3087
        add     ecx,255 ; max caption length
3056
;        add     ecx,255 ; max caption length
3088
        cmp     ebx,ecx
3057
;        cmp     ebx,ecx
Line 3089... Line 3058...
3089
        ja      .exit_fail
3058
;        ja      .exit_fail
Line 3090... Line 3059...
3090
 
3059
 
Line 3108... Line 3077...
3108
        ret
3077
        ret
Line 3109... Line 3078...
3109
 
3078
 
Line 3110... Line 3079...
3110
 
3079
 
3111
sys_window_move:
3080
sys_window_move:
3112
 
3081
 
Line 3113... Line 3082...
3113
        mov     edi,[0x3000]
3082
        mov     edi,[CURRENT_TASK]
3114
        shl     edi,5
3083
        shl     edi,5
Line 3142... Line 3111...
3142
        je    .no_y_resizing
3111
        je    .no_y_resizing
3143
        mov     [edi + WDATA.box.height], edx
3112
        mov     [edi + WDATA.box.height], edx
3144
      .no_y_resizing:
3113
      .no_y_resizing:
Line 3145... Line 3114...
3145
 
3114
 
-
 
3115
        call  check_window_position
Line 3146... Line 3116...
3146
        call  check_window_position
3116
        call  set_window_clientbox
3147
 
3117
 
3148
        pushad                       ; save for window fullscreen/resize
3118
        pushad                       ; save for window fullscreen/resize
3149
        mov   esi,edi
3119
        mov   esi,edi
3150
        sub   edi,window_data
3120
        sub   edi,window_data
3151
        shr   edi,5
3121
        shr   edi,5
3152
        shl   edi,8
3122
        shl   edi,8
3153
        add   edi, 0x80000 + APPDATA.saved_box
3123
        add   edi, SLOT_BASE + APPDATA.saved_box
3154
        mov   ecx,4
3124
        mov   ecx,4
3155
        cld
3125
        cld
Line 3161... Line 3131...
3161
        mov   ebx, [edi + WDATA.box.top]
3131
        mov   ebx, [edi + WDATA.box.top]
3162
        mov   ecx, [edi + WDATA.box.width]
3132
        mov   ecx, [edi + WDATA.box.width]
3163
        mov   edx, [edi + WDATA.box.height]
3133
        mov   edx, [edi + WDATA.box.height]
3164
        add   ecx, eax
3134
        add   ecx,eax
3165
        add   edx, ebx
3135
        add   edx,ebx
-
 
3136
 
3166
        call  [calculatescreen]
3137
        call  [calculatescreen]
3167
        popad
3138
        popad
Line 3168... Line 3139...
3168
 
3139
 
3169
        pop   edx                   ; calculcate screen at old position
3140
        pop   edx                   ; calculcate screen at old position
Line 3182... Line 3153...
3182
 
3153
 
3183
        mov   eax,edi               ; redraw screen at old position
3154
        mov   eax,edi               ; redraw screen at old position
3184
        xor   esi,esi
3155
        xor   esi,esi
Line 3185... Line 3156...
3185
        call  redrawscreen
3156
        call  redrawscreen
3186
 
3157
 
3187
        mov   [0xfff5],byte 0 ; mouse pointer
3158
        mov   [DONT_DRAW_MOUSE],byte 0 ; mouse pointer
Line 3188... Line 3159...
3188
        mov   [0xfff4],byte 0 ; no mouse under
3159
        mov   [MOUSE_BACKGROUND],byte 0 ; no mouse under
3189
        mov   [0xfb44],byte 0 ; react to mouse up/down
3160
        mov   [MOUSE_DOWN],byte 0 ; react to mouse up/down
3190
 
3161
 
3191
        mov   ecx,10          ; wait 1/10 second
3162
        mov   ecx,10          ; wait 1/10 second
Line 3206... Line 3177...
3206
;    jz    temp_nobackgr
3177
;    jz    temp_nobackgr
3207
;    mov   [0xfff0],byte 2
3178
;    mov   [0xfff0],byte 2
3208
;    call  change_task
3179
;    call  change_task
3209
;    mov   [draw_data+32+0],dword 0
3180
;    mov   [draw_data+32+0],dword 0
3210
;    mov   [draw_data+32+4],dword 0
3181
;    mov   [draw_data+32+4],dword 0
3211
;    mov   eax,[0xfe00]
3182
;    mov   eax,[ScreenWidth
3212
;    mov   ebx,[0xfe04]
3183
;    mov   ebx,[0xfe04]
3213
;    mov   [draw_data+32+8],eax
3184
;    mov   [draw_data+32+8],eax
3214
;    mov   [draw_data+32+12],ebx
3185
;    mov   [draw_data+32+12],ebx
3215
;    call  drawbackground
3186
;    call  drawbackground
3216
;    mov   [0xfff0],byte 0
3187
;    mov   [0xfff0],byte 0
3217
;    mov   [0xfff4],byte 0
3188
;    mov   [MOUSE_BACKGROUND],byte 0
3218
;temp_nobackgr:
3189
;temp_nobackgr:
3219
;    ret
3190
;    ret
Line 3220... Line 3191...
3220
 
3191
 
3221
uglobal
3192
uglobal
Line 3332... Line 3303...
3332
; check if pixel is allowed to be drawn
3303
; check if pixel is allowed to be drawn
Line 3333... Line 3304...
3333
 
3304
 
3334
checkpixel:
3305
checkpixel:
Line 3335... Line 3306...
3335
        push eax edx
3306
        push eax edx
3336
 
3307
 
3337
        mov  edx,[0xfe00]     ; screen x size
3308
        mov  edx,[ScreenWidth]     ; screen x size
3338
        inc  edx
3309
        inc  edx
Line 3339... Line 3310...
3339
        imul edx, ebx
3310
        imul edx, ebx
3340
        mov  dl, [eax+edx+display_data] ; lea eax, [...]
3311
        mov  dl, [eax+edx+display_data] ; lea eax, [...]
3341
 
3312
 
3342
        xor  ecx, ecx
3313
        xor  ecx, ecx
Line 3343... Line 3314...
3343
        mov  eax, [0x3000]
3314
        mov  eax, [CURRENT_TASK]
3344
        cmp  al, dl
3315
        cmp  al, dl
Line 3374... Line 3345...
3374
  nocpustart:
3345
  nocpustart:
3375
    cmp   [mouse_active], 1
3346
    cmp   [mouse_active], 1
3376
    jne   mouse_not_active
3347
    jne   mouse_not_active
3377
    mov   [mouse_active], 0
3348
    mov   [mouse_active], 0
3378
    xor   edi, edi
3349
    xor   edi, edi
3379
    mov   ecx, [0x3004]
3350
    mov   ecx, [TASK_COUNT]
3380
   set_mouse_event:
3351
   set_mouse_event:
3381
    add   edi, 256
3352
    add   edi, 256
3382
    or    [edi+0x80000+APPDATA.event_mask], dword 00100000b
3353
    or    [edi+SLOT_BASE+APPDATA.event_mask], dword 00100000b
3383
    loop  set_mouse_event
3354
    loop  set_mouse_event
3384
  mouse_not_active:
3355
  mouse_not_active:
Line 3385... Line 3356...
3385
 
3356
 
3386
 
3357
 
3387
    cmp   [0xfff0],byte 0               ; background update ?
3358
    cmp   [REDRAW_BACKGROUND],byte 0               ; background update ?
3388
    jz    nobackgr
3359
    jz    nobackgr
3389
    cmp    [background_defined], 0
3360
    cmp    [background_defined], 0
3390
    jz    nobackgr
3361
    jz    nobackgr
3391
    mov   [0xfff0],byte 2
3362
    mov   [REDRAW_BACKGROUND],byte 2
3392
    call  change_task
3363
    call  change_task
3393
    mov   [draw_data+32 + RECT.left],dword 0
3364
	mov   [draw_data+32 + RECT.left],dword 0
3394
    mov   [draw_data+32 + RECT.top],dword 0
3365
	mov   [draw_data+32 + RECT.top],dword 0
3395
    mov   eax,[0xfe00]
3366
    mov   eax,[ScreenWidth]
3396
    mov   ebx,[0xfe04]
3367
    mov   ebx,[ScreenHeight]
3397
    mov   [draw_data+32 + RECT.right],eax
3368
	mov   [draw_data+32 + RECT.right],eax
3398
    mov   [draw_data+32 + RECT.bottom],ebx
3369
	mov   [draw_data+32 + RECT.bottom],ebx
3399
    call  [drawbackground]
3370
    call  [drawbackground]
Line 3400... Line 3371...
3400
    mov   [0xfff0],byte 0
3371
    mov   [REDRAW_BACKGROUND],byte 0
Line 3401... Line 3372...
3401
    mov   [0xfff4],byte 0
3372
    mov   [MOUSE_BACKGROUND],byte 0
Line 3402... Line 3373...
3402
 
3373
 
3403
  nobackgr:
3374
  nobackgr:
Line 3404... Line 3375...
3404
 
3375
 
3405
 
3376
 
Line 3406... Line 3377...
3406
    ; system shutdown request
3377
    ; system shutdown request
3407
 
3378
 
Line 3408... Line 3379...
3408
    cmp  [0xFF00],byte 0
3379
    cmp  [SYS_SHUTDOWN],byte 0
3409
    je   noshutdown
3380
    je   noshutdown
3410
 
3381
 
3411
    mov  edx,[shutdown_processes]
3382
    mov  edx,[shutdown_processes]
3412
    sub  dl,2
3383
    sub  dl,2
3413
 
3384
 
3414
    cmp  [0xff00],dl
3385
    cmp  [SYS_SHUTDOWN],dl
Line 3415... Line 3386...
3415
    jne  no_mark_system_shutdown
3386
    jne  no_mark_system_shutdown
Line 3416... Line 3387...
3416
 
3387
 
Line 3417... Line 3388...
3417
    mov   edx,0x3040
3388
    mov   edx,0x3040
Line 3418... Line 3389...
3418
    movzx ecx,byte [0xff00]
3389
    movzx ecx,byte [SYS_SHUTDOWN]
3419
    add   ecx,5
3390
    add   ecx,5
Line 3420... Line 3391...
3420
  markz:
3391
  markz:
Line 3421... Line 3392...
3421
    mov   [edx+TASKDATA.state],byte 3
3392
    mov   [edx+TASKDATA.state],byte 3
3422
    add   edx,0x20
3393
    add   edx,0x20
3423
    loop  markz
3394
    loop  markz
Line 3424... Line 3395...
3424
 
3395
 
3425
  no_mark_system_shutdown:
3396
  no_mark_system_shutdown:
3426
 
3397
 
Line 3550... Line 3521...
3550
 
3521
 
Line 3551... Line 3522...
3551
       not_this_task:
3522
       not_this_task:
Line 3552... Line 3523...
3552
 
3523
 
3553
         pop   ecx
3524
         pop   ecx
Line 3554... Line 3525...
3554
 
3525
 
3555
         cmp   ecx,[0x3004]
3526
         cmp   ecx,[TASK_COUNT]
Line 3565... Line 3536...
3565
        ; all black
3536
        ; all black
Line 3566... Line 3537...
3566
 
3537
 
3567
        mov   [display_data-8],dword 4      ; size x
3538
        mov   [display_data-8],dword 4      ; size x
Line 3568... Line 3539...
3568
        mov   [display_data-4],dword 2      ; size y
3539
        mov   [display_data-4],dword 2      ; size y
3569
 
3540
 
3570
        mov   edi, 0x300000                 ; set background to black
3541
        mov   edi, IMG_BACKGROUND                 ; set background to black
3571
        xor   eax, eax
3542
        xor   eax, eax
3572
        mov   ecx, 0x0fff00 / 4
3543
        mov   ecx, 0x0fff00 / 4
Line 3573... Line 3544...
3573
        cld
3544
        cld
3574
        rep   stosd
3545
        rep   stosd
3575
 
3546
 
3576
        mov   edi,display_data              ; set os to use all pixels
3547
        mov   edi,display_data              ; set os to use all pixels
Line 3577... Line 3548...
3577
        mov   eax,0x01010101
3548
        mov   eax,0x01010101
Line 3578... Line 3549...
3578
        mov   ecx,0x1fff00 / 4
3549
        mov   ecx,0x15ff00 / 4
Line 3579... Line 3550...
3579
        rep   stosd
3550
        rep   stosd
3580
 
3551
 
Line 3620... Line 3591...
3620
 
3591
 
3621
 
3592
 
Line 3622... Line 3593...
3622
set_app_param:
3593
set_app_param:
3623
        push edi
3594
        push edi
Line 3624... Line 3595...
3624
 
3595
 
3625
        mov  edi,[0x3010]
3596
        mov  edi,[TASK_BASE]
Line 3709... Line 3680...
3709
;;       3 unknown FS
3680
;;       3 unknown FS
3710
;;       4 partition not defined at hd
3681
;;       4 partition not defined at hd
3711
;;       5 file not found
3682
;;       5 file not found
3712
;; ebx = size of file
3683
;; ebx = size of file
3713
;
3684
;
3714
;     mov   edi,[0x3010]
3685
;     mov   edi,[TASK_BASE]
3715
;     add   edi,0x10
3686
;     add   edi,0x10
3716
;     add   esi,[edi]
3687
;     add   esi,[edi]
3717
;     add   eax,[edi]
3688
;     add   eax,[edi]
3718
;
3689
;
3719
;     pushad
3690
;     pushad
Line 3737... Line 3708...
3737
 
3708
 
Line 3738... Line 3709...
3738
align 4
3709
align 4
Line 3739... Line 3710...
3739
 
3710
 
3740
sys_programirq:
3711
sys_programirq:
Line 3741... Line 3712...
3741
 
3712
 
3742
    mov   edi,[0x3010]
3713
    mov   edi,[TASK_BASE]
3743
    add   eax,[edi+TASKDATA.mem_start]
3714
    add   eax,[edi+TASKDATA.mem_start]
3744
 
3715
 
3745
    cmp   ebx,16
3716
    cmp   ebx,16
3746
    jae   .not_owner
3717
    jae   .not_owner
3747
    mov   edi,[0x3010]
3718
    mov   edi,[TASK_BASE]
3748
    mov   edi,[edi+TASKDATA.pid]
3719
    mov   edi,[edi+TASKDATA.pid]
Line 3771... Line 3742...
3771
     jae   .not_owner
3742
     jae   .not_owner
3772
     mov   edx,eax           ; check for correct owner
3743
     mov   edx,eax           ; check for correct owner
3773
     shl   edx,2
3744
     shl   edx,2
3774
     add   edx,irq_owner
3745
     add   edx,irq_owner
3775
     mov   edx,[edx]
3746
     mov   edx,[edx]
3776
     mov   edi,[0x3010]
3747
     mov   edi,[TASK_BASE]
3777
     mov   edi,[edi+TASKDATA.pid]
3748
     mov   edi,[edi+TASKDATA.pid]
3778
     cmp   edx,edi
3749
     cmp   edx,edi
3779
     je    gidril1
3750
     je    gidril1
3780
.not_owner:
3751
.not_owner:
3781
     mov   [esp+32],dword 2     ; ecx=2
3752
     mov   [esp+32],dword 2     ; ecx=2
Line 3783... Line 3754...
3783
 
3754
 
Line 3784... Line 3755...
3784
  gidril1:
3755
  gidril1:
3785
 
3756
 
3786
     mov   ebx,eax
3757
     mov   ebx,eax
3787
     shl   ebx,12
3758
     shl   ebx,12
3788
     add   ebx,0x2e0000
3759
     add   ebx,IRQ_SAVE
3789
     mov   eax,[ebx]
3760
     mov   eax,[ebx]
3790
     mov   ecx,1
3761
     mov   ecx,1
Line 3811... Line 3782...
3811
 
3782
 
Line 3812... Line 3783...
3812
set_io_access_rights:
3783
set_io_access_rights:
Line 3813... Line 3784...
3813
 
3784
 
3814
     pushad
3785
     pushad
3815
 
3786
 
3816
     mov   edi,[0x3000]
3787
     mov   edi,[CURRENT_TASK]
Line 3817... Line 3788...
3817
     imul  edi,tss_step
3788
     imul  edi,tss_step
Line 3843... Line 3814...
3843
 
3814
 
Line 3844... Line 3815...
3844
     popad
3815
     popad
Line 3845... Line -...
3845
 
-
 
3846
     ret
-
 
3847
 
-
 
3848
 
-
 
3849
 
3816
 
Line 3850... Line 3817...
3850
 
3817
     ret
3851
 
3818
 
3852
r_f_port_area:
3819
r_f_port_area:
Line 3862... Line 3829...
3862
 
3829
 
3863
     cmp   ebx,ecx            ; beginning > end ?
3830
     cmp   ebx,ecx            ; beginning > end ?
3864
     ja    rpal1
3831
     ja    rpal1
3865
     cmp   ecx,65536
3832
     cmp   ecx,65536
3866
     jae   rpal1
3833
     jae   rpal1
3867
     mov   esi,[0x2d0000]
3834
     mov   esi,[RESERVED_PORTS]
3868
     test  esi,esi            ; no reserved areas ?
3835
     test  esi,esi            ; no reserved areas ?
3869
     je    rpal2
3836
     je    rpal2
3870
     cmp   esi,255            ; max reserved
3837
     cmp   esi,255            ; max reserved
3871
     jae   rpal1
3838
     jae   rpal1
3872
   rpal3:
3839
   rpal3:
3873
     mov   edi,esi
3840
     mov   edi,esi
3874
     shl   edi,4
3841
     shl   edi,4
3875
     add   edi,0x2d0000
3842
     add   edi,RESERVED_PORTS
3876
     cmp   ebx,[edi+8]
3843
     cmp   ebx,[edi+8]
3877
     ja    rpal4
3844
     ja    rpal4
3878
     cmp   ecx,[edi+4]
3845
     cmp   ecx,[edi+4]
3879
     jae   rpal1
3846
     jae   rpal1
Line 3918... Line 3885...
3918
   no_unmask_io:
3885
   no_unmask_io:
Line 3919... Line 3886...
3919
 
3886
 
3920
     popad                         ; end enable io map
3887
     popad                         ; end enable io map
Line 3921... Line 3888...
3921
     sti
3888
     sti
3922
 
3889
 
3923
     mov   edi,[0x2d0000]
3890
     mov   edi,[RESERVED_PORTS]
3924
     add   edi,1
3891
     add   edi,1
3925
     mov   [0x2d0000],edi
3892
     mov   [RESERVED_PORTS],edi
3926
     shl   edi,4
3893
     shl   edi,4
3927
     add   edi,0x2d0000
3894
     add   edi,RESERVED_PORTS
3928
     mov   esi,[0x3010]
3895
     mov   esi,[TASK_BASE]
3929
     mov   esi,[esi+TASKDATA.pid]
3896
     mov   esi,[esi+TASKDATA.pid]
3930
     mov   [edi],esi
3897
     mov   [edi],esi
Line 3931... Line 3898...
3931
     mov   [edi+4],ebx
3898
     mov   [edi+4],ebx
3932
     mov   [edi+8],ecx
3899
     mov   [edi+8],ecx
Line 3933... Line -...
3933
 
-
 
3934
     xor   eax, eax
-
 
3935
     ret
-
 
3936
 
3900
 
Line 3937... Line 3901...
3937
 
3901
     xor   eax, eax
Line 3938... Line 3902...
3938
 
3902
     ret
3939
 
3903
 
3940
free_port_area:
3904
free_port_area:
3941
 
3905
 
3942
     pushad
3906
     pushad
3943
 
3907
 
3944
     mov   esi,[0x2d0000]     ; no reserved areas ?
3908
     mov   esi,[RESERVED_PORTS]     ; no reserved areas ?
3945
     test  esi,esi
3909
     test  esi,esi
3946
     je    frpal2
3910
     je    frpal2
3947
     mov   edx,[0x3010]
3911
     mov   edx,[TASK_BASE]
3948
     mov   edx,[edx+TASKDATA.pid]
3912
     mov   edx,[edx+TASKDATA.pid]
3949
   frpal3:
3913
   frpal3:
3950
     mov   edi,esi
3914
     mov   edi,esi
3951
     shl   edi,4
3915
     shl   edi,4
Line 3971... Line 3935...
3971
     mov   esi,edi
3935
     mov   esi,edi
3972
     add   esi,16
3936
     add   esi,16
3973
     cld
3937
     cld
3974
     rep   movsb
3938
     rep   movsb
Line 3975... Line 3939...
3975
 
3939
 
Line 3976... Line 3940...
3976
     dec   dword [0x2d0000]
3940
     dec   dword [RESERVED_PORTS]
Line 3977... Line 3941...
3977
 
3941
 
Line 4016... Line 3980...
4016
     test  eax,eax
3980
     test  eax,eax
4017
     jz    reserve_irq
3981
     jz    reserve_irq
Line 4018... Line 3982...
4018
 
3982
 
4019
     lea   edi,[irq_owner+ebx*4]
3983
     lea   edi,[irq_owner+ebx*4]
4020
     mov   edx,[edi]
3984
     mov   edx,[edi]
4021
     mov   eax,[0x3010]
3985
     mov   eax,[TASK_BASE]
4022
     cmp   edx,[eax+TASKDATA.pid]
3986
     cmp   edx,[eax+TASKDATA.pid]
4023
     jne   fril1
3987
     jne   fril1
4024
     dec   ecx
3988
     dec   ecx
4025
     mov   [edi],ecx
3989
     mov   [edi],ecx
Line 4031... Line 3995...
4031
 
3995
 
4032
     lea   edi,[irq_owner+ebx*4]
3996
     lea   edi,[irq_owner+ebx*4]
4033
     cmp   dword [edi], 0
3997
     cmp   dword [edi], 0
Line 4034... Line 3998...
4034
     jnz   ril1
3998
     jnz   ril1
4035
 
3999
 
4036
     mov   edx,[0x3010]
4000
     mov   edx,[TASK_BASE]
4037
     mov   edx,[edx+TASKDATA.pid]
4001
     mov   edx,[edx+TASKDATA.pid]
4038
     mov   [edi],edx
4002
     mov   [edi],edx
4039
     dec   ecx
4003
     dec   ecx
4040
   ril1:
4004
   ril1:
Line 4041... Line -...
4041
     mov   [esp+36],ecx ; return in eax
-
 
4042
     ret
-
 
4043
 
4005
     mov   [esp+36],ecx ; return in eax
4044
 
4006
     ret
4045
 
4007
 
4046
__sys_drawbackground:
4008
__sys_drawbackground:
4047
       inc   [mouse_pause]
4009
       inc   [mouse_pause]
4048
       cmp   [0xfe0c],word 0x12
4010
       cmp   [SCR_MODE],word 0x12
4049
       je   dbrv20
4011
       je   dbrv20
4050
     dbrv12:
4012
     dbrv12:
4051
       cmp  [0xfe0c],word 0100000000000000b
4013
       cmp  [SCR_MODE],word 0100000000000000b
4052
       jge  dbrv20
4014
       jge  dbrv20
4053
       cmp  [0xfe0c],word 0x13
4015
       cmp  [SCR_MODE],word 0x13
4054
       je   dbrv20
4016
       je   dbrv20
4055
       call  vesa12_drawbackground
4017
       call  vesa12_drawbackground
Line 4087... Line 4049...
4087
     test  ecx,0xFFFF0000
4049
     test  ecx,0xFFFF0000
4088
     jnz   @f
4050
     jnz   @f
4089
  .exit:
4051
  .exit:
4090
     ret
4052
     ret
4091
 @@:
4053
 @@:
4092
        mov     edi,[0x3000]
4054
        mov     edi,[CURRENT_TASK]
4093
        shl     edi,8
4055
        shl     edi,8
4094
        add     dx,word[edi+0x80000+APPDATA.wnd_clientbox.top]
4056
        add     dx,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.top]
4095
        rol     edx,16
4057
        rol     edx,16
4096
        add     dx,word[edi+0x80000+APPDATA.wnd_clientbox.left]
4058
        add     dx,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.left]
4097
        rol     edx,16
4059
        rol     edx,16
4098
  .forced:
4060
  .forced:
-
 
4061
        push    ebp esi 0
-
 
4062
        mov     ebp, putimage_get24bpp
-
 
4063
        mov     esi, putimage_init24bpp
-
 
4064
sys_putimage_bpp:
-
 
4065
;        call    [disable_mouse] ; this will be done in xxx_putimage
4099
;        mov     eax, vga_putimage
4066
;        mov     eax, vga_putimage
4100
        cmp     [0xfe0c], word 0x12
4067
        cmp     [SCR_MODE], word 0x12
4101
        jz      @f   ;.doit
4068
        jz      @f   ;.doit
4102
        mov     eax, vesa12_putimage
4069
        mov     eax, vesa12_putimage
4103
        cmp     [0xfe0c], word 0100000000000000b
4070
        cmp     [SCR_MODE], word 0100000000000000b
4104
        jae     @f
4071
        jae     @f
4105
        cmp     [0xfe0c], word 0x13
4072
        cmp     [SCR_MODE], word 0x13
4106
        jnz     .doit
4073
        jnz     .doit
4107
@@:
4074
@@:
4108
        mov     eax, vesa20_putimage
4075
        mov     eax, vesa20_putimage
4109
.doit:
4076
.doit:
4110
        inc     [mouse_pause]
4077
        inc     [mouse_pause]
4111
        call    eax
4078
        call    eax
4112
        dec     [mouse_pause]
4079
        dec     [mouse_pause]
-
 
4080
        pop     ebp esi ebp
4113
        jmp     [draw_pointer]
4081
        jmp     [draw_pointer]
Line -... Line 4082...
-
 
4082
 
-
 
4083
syscall_putimage_palette:
-
 
4084
        lea     edi, [esi+std_application_base_address]
-
 
4085
        mov     esi, edx
-
 
4086
        mov     edx, ecx
-
 
4087
        mov     ecx, ebx
-
 
4088
        lea     ebx, [eax+std_application_base_address]
-
 
4089
sys_putimage_palette:
-
 
4090
; ebx = pointer to image
-
 
4091
; ecx = [xsize]*65536 + [ysize]
-
 
4092
; edx = [xstart]*65536 + [ystart]
-
 
4093
; esi = number of bits per pixel, must be 8, 24 or 32
-
 
4094
; edi = pointer to palette
-
 
4095
; ebp = row delta
-
 
4096
        mov     eax, [CURRENT_TASK]
-
 
4097
        shl     eax, 8
-
 
4098
        add     dx, word [eax+SLOT_BASE+APPDATA.wnd_clientbox.top]
-
 
4099
        rol     edx, 16
-
 
4100
        add     dx, word [eax+SLOT_BASE+APPDATA.wnd_clientbox.left]
-
 
4101
        rol     edx, 16
-
 
4102
.forced:
-
 
4103
        push    ebp esi ebp
-
 
4104
        cmp     esi, 8
-
 
4105
        jnz     @f
-
 
4106
        mov     ebp, putimage_get8bpp
-
 
4107
        mov     esi, putimage_init8bpp
-
 
4108
        jmp     sys_putimage_bpp
-
 
4109
@@:
-
 
4110
        cmp     esi, 24
-
 
4111
        jnz     @f
-
 
4112
        mov     ebp, putimage_get24bpp
-
 
4113
        mov     esi, putimage_init24bpp
-
 
4114
        jmp     sys_putimage_bpp
-
 
4115
@@:
-
 
4116
        cmp     esi, 32
-
 
4117
        jnz     @f
-
 
4118
        mov     ebp, putimage_get32bpp
-
 
4119
        mov     esi, putimage_init32bpp
-
 
4120
        jmp     sys_putimage_bpp
-
 
4121
@@:
-
 
4122
        pop     ebp esi
-
 
4123
        ret
-
 
4124
 
-
 
4125
putimage_init24bpp:
-
 
4126
        lea     eax, [eax*3]
-
 
4127
putimage_init8bpp:
-
 
4128
        ret
-
 
4129
 
-
 
4130
putimage_get24bpp:
-
 
4131
        mov     eax, [esi]
-
 
4132
        add     esi, 3
-
 
4133
        ret     4
-
 
4134
putimage_get8bpp:
-
 
4135
        movzx   eax, byte [esi]
-
 
4136
        push    edx
-
 
4137
        mov     edx, [esp+8]
-
 
4138
        mov     eax, [edx+eax*4]
-
 
4139
        pop     edx
-
 
4140
        inc     esi
-
 
4141
        ret     4
-
 
4142
 
-
 
4143
putimage_init32bpp:
-
 
4144
        shl     eax, 2
-
 
4145
        ret
-
 
4146
putimage_get32bpp:
-
 
4147
        lodsd
-
 
4148
        ret     4
4114
 
4149
 
4115
; eax x beginning
4150
; eax x beginning
4116
; ebx y beginning
4151
; ebx y beginning
4117
; ecx x end
4152
; ecx x end
4118
; edx y end
4153
	; edx y end
Line 4119... Line 4154...
4119
; edi color
4154
; edi color
4120
 
4155
 
4121
__sys_drawbar:
4156
__sys_drawbar:
4122
        mov     esi,[0x3000]
4157
        mov     esi,[CURRENT_TASK]
4123
        shl     esi,8
4158
        shl     esi,8
4124
        add     eax,[esi+0x80000+APPDATA.wnd_clientbox.left]
4159
        add     eax,[esi+SLOT_BASE+APPDATA.wnd_clientbox.left]
4125
        add     ecx,[esi+0x80000+APPDATA.wnd_clientbox.left]
4160
        add     ecx,[esi+SLOT_BASE+APPDATA.wnd_clientbox.left]
4126
        add     ebx,[esi+0x80000+APPDATA.wnd_clientbox.top]
4161
        add     ebx,[esi+SLOT_BASE+APPDATA.wnd_clientbox.top]
4127
        add     edx,[esi+0x80000+APPDATA.wnd_clientbox.top]
4162
        add     edx,[esi+SLOT_BASE+APPDATA.wnd_clientbox.top]
-
 
4163
  .forced:
4128
  .forced:
4164
    inc   [mouse_pause]
4129
    inc   [mouse_pause]
4165
;        call    [disable_mouse]
4130
    cmp   [0xfe0c],word 0x12
4166
    cmp   [SCR_MODE],word 0x12
4131
    je   dbv20
4167
    je   dbv20
4132
   sdbv20:
4168
   sdbv20:
4133
    cmp  [0xfe0c],word 0100000000000000b
4169
    cmp  [SCR_MODE],word 0100000000000000b
4134
    jge  dbv20
4170
    jge  dbv20
4135
    cmp  [0xfe0c],word 0x13
4171
    cmp  [SCR_MODE],word 0x13
4136
    je   dbv20
4172
    je   dbv20
4137
    call vesa12_drawbar
4173
    call vesa12_drawbar
4138
    dec   [mouse_pause]
4174
    dec   [mouse_pause]
Line 4176... Line 4212...
4176
kb_write:
4212
kb_write:
Line 4177... Line 4213...
4177
 
4213
 
Line 4178... Line 4214...
4178
        push    ecx edx
4214
        push    ecx edx
4179
 
4215
 
4180
        mov     dl,al
4216
        mov     dl,al
4181
        mov     ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's
4217
;        mov     ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's
4182
      kw_loop1:
4218
;      kw_loop1:
4183
        in      al,0x64
4219
;        in      al,0x64
4184
        test    al,0x20
4220
;        test    al,0x20
4185
        jz      kw_ok1
4221
;        jz      kw_ok1
4186
        loop    kw_loop1
4222
;        loop    kw_loop1
4187
        mov     ah,1
4223
;        mov     ah,1
4188
        jmp     kw_exit
4224
;        jmp     kw_exit
4189
      kw_ok1:
4225
;      kw_ok1:
4190
        in      al,0x60
4226
        in      al,0x60
4191
        mov     ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's
4227
        mov     ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's
4192
      kw_loop:
4228
      kw_loop:
Line 4255... Line 4291...
4255
 
4291
 
4256
 
4292
 
Line 4257... Line 4293...
4257
setmouse:  ; set mousepicture -pointer
4293
setmouse:  ; set mousepicture -pointer
Line 4258... Line 4294...
4258
           ; ps2 mouse enable
4294
           ; ps2 mouse enable
4259
 
4295
 
4260
     mov     [0xf200],dword mousepointer+62+32*31*4
4296
     mov     [MOUSE_PICTURE],dword mousepointer+62+32*31*4
4261
 
4297
 
Line 4349... Line 4385...
4349
 
4385
 
Line 4350... Line 4386...
4350
     ret
4386
     ret
4351
 
-
 
4352
 
-
 
4353
_rdtsc:
4387
 
4354
 
4388
 
4355
     mov   edx,[cpuid_1+3*4]
4389
_rdtsc:
4356
     test  edx,00010000b
4390
     bt [cpu_caps], CAPS_TSC
4357
     jz    ret_rdtsc
4391
     jnc ret_rdtsc
4358
     rdtsc
4392
     rdtsc
4359
     ret
4393
     ret
4360
   ret_rdtsc:
4394
   ret_rdtsc:
Line 4361... Line -...
4361
     mov   edx,0xffffffff
-
 
4362
     mov   eax,0xffffffff
-
 
4363
     ret
4395
     mov   edx,0xffffffff
Line 4364... Line 4396...
4364
 
4396
     mov   eax,0xffffffff
Line 4365... Line 4397...
4365
 
4397
     ret
Line 4436... Line 4468...
4436
   @@:
4468
   @@:
4437
     popad
4469
     popad
4438
     ret
4470
     ret
Line 4439... Line 4471...
4439
 
4471
 
4440
uglobal
4472
uglobal
4441
  msg_board_data: times 512 db 0
4473
  msg_board_data: times 4096 db 0
4442
  msg_board_count dd 0x0
4474
  msg_board_count dd 0x0
Line 4443... Line 4475...
4443
endg
4475
endg
Line 4452... Line 4484...
4452
     jne  smbl1
4484
     jne  smbl1
Line 4453... Line 4485...
4453
 
4485
 
4454
 
4486
 
4455
     mov  [msg_board_data+ecx],bl
4487
     mov  [msg_board_data+ecx],bl
4456
     inc  ecx
4488
     inc  ecx
4457
     and  ecx, 511
4489
     and  ecx, 4095
4458
     mov  [msg_board_count], ecx
4490
     mov  [msg_board_count], ecx
4459
     mov  [check_idle_semaphore], 5
4491
     mov  [check_idle_semaphore], 5
Line 4489... Line 4521...
4489
   smbl2:
4521
   smbl2:
4490
     ret
4522
     ret
Line 4491... Line -...
4491
 
-
 
4492
 
-
 
4493
 
-
 
4494
sys_trace:
-
 
4495
 
-
 
4496
     test eax, eax                  ; get event data
-
 
4497
     jnz  no_get_sys_events
-
 
4498
 
-
 
4499
     mov  esi,save_syscall_data     ; data
-
 
4500
     mov  edi,[0x3010]
-
 
4501
     mov  edi,[edi+TASKDATA.mem_start]
-
 
4502
     add  edi,ebx
-
 
4503
     cld
-
 
4504
     rep  movsb
-
 
4505
 
-
 
4506
     mov  [esp+24],dword 0
-
 
4507
     mov  eax,[save_syscall_count]  ; count
-
 
4508
     mov  [esp+36],eax
-
 
4509
     ret
-
 
4510
 
-
 
4511
   no_get_sys_events:
-
 
4512
 
-
 
4513
     ret
4523
 
4514
 
4524
 
Line 4515... Line 4525...
4515
 
4525
 
4516
sys_process_def:
4526
sys_process_def:
Line 4517... Line 4527...
4517
        mov     edi, [0x3000]
4527
        mov     edi, [CURRENT_TASK]
4518
 
4528
 
Line 4519... Line 4529...
4519
        dec     eax             ; 1 = set keyboard mode
4529
        dec     eax             ; 1 = set keyboard mode
Line 4520... Line 4530...
4520
     jne   no_set_keyboard_setup
4530
     jne   no_set_keyboard_setup
Line 4521... Line 4531...
4521
 
4531
 
4522
     shl   edi,8
4532
     shl   edi,8
Line 4523... Line 4533...
4523
     mov   [edi+0x80000 + APPDATA.keyboard_mode],bl
4533
     mov   [edi+SLOT_BASE + APPDATA.keyboard_mode],bl
4524
 
4534
 
Line 4525... Line 4535...
4525
     ret
4535
     ret
Line 4526... Line 4536...
4526
 
4536
 
Line 4627... Line 4637...
4627
 
4637
 
4628
no_del_keyboard_hotkey:
4638
no_del_keyboard_hotkey:
Line 4629... Line -...
4629
     ret
-
 
4630
 
-
 
4631
 
-
 
4632
sys_ipc:
-
 
4633
     cmp  eax,1                      ; DEFINE IPC MEMORY
-
 
4634
     jne  no_ipc_def
-
 
4635
     mov  edi,[0x3000]
-
 
4636
     shl  edi,8
-
 
4637
     add  edi,0x80000
-
 
4638
     mov  [edi + APPDATA.ipc_start], ebx
-
 
4639
     mov  [edi + APPDATA.ipc_size], ecx
-
 
4640
     mov  [esp+36],dword 0
-
 
4641
     ret
-
 
4642
   no_ipc_def:
-
 
4643
 
-
 
4644
     cmp  eax,2                      ; SEND IPC MESSAGE
-
 
4645
     jne  no_ipc_send
-
 
4646
     mov  esi,1
-
 
4647
     mov  edi,0x3020
-
 
4648
    ipcs1:
-
 
4649
     cmp  [edi+TASKDATA.pid], ebx
-
 
4650
     je   ipcs2
-
 
4651
     add  edi,0x20
-
 
4652
     inc  esi
-
 
4653
     cmp  esi,[0x3004]
-
 
4654
     jbe  ipcs1
-
 
4655
     mov  [esp+36],dword 4
-
 
4656
     ret
-
 
4657
    ipcs2:
-
 
4658
 
-
 
4659
     cli
-
 
4660
 
-
 
4661
     push esi
-
 
4662
     mov  eax,esi
-
 
4663
     shl  eax,8
-
 
4664
     mov  ebx,[eax+0x80000 + APPDATA.ipc_start]
-
 
4665
     test ebx,ebx                  ; ipc area not defined ?
-
 
4666
     je   ipc_err1
-
 
4667
 
-
 
4668
     add  ebx,[eax+0x80000 + APPDATA.ipc_size]
-
 
4669
     mov  eax,esi
-
 
4670
     shl  eax,5
-
 
4671
     add  ebx,[eax+0x3000 + TASKDATA.mem_start]    ; ebx <- max data position
-
 
4672
 
-
 
4673
     mov  eax,esi                  ; to
-
 
4674
     shl  esi,8
-
 
4675
     add  esi,0x80000
-
 
4676
     mov  edi,[esi+APPDATA.ipc_start]
-
 
4677
     shl  eax,5
-
 
4678
     add  eax,0x3000
-
 
4679
     add  edi,[eax+TASKDATA.mem_start]
-
 
4680
 
-
 
4681
     cmp  [edi],byte 0             ; overrun ?
-
 
4682
     jne  ipc_err2
-
 
4683
 
-
 
4684
     mov  ebp,edi
-
 
4685
     add  edi,[edi+4]
-
 
4686
     add  edi,8
-
 
4687
 
-
 
4688
     mov  esi,ecx                  ; from
-
 
4689
     mov  eax,[0x3010]
-
 
4690
     mov  eax,[eax+TASKDATA.mem_start]
-
 
4691
     add  esi,eax
-
 
4692
 
-
 
4693
     mov  ecx,edx                  ; size
-
 
4694
 
-
 
4695
     mov  eax,edi
-
 
4696
     add  eax,ecx
-
 
4697
     cmp  eax,ebx
-
 
4698
     jg   ipc_err3                 ; not enough room ?
-
 
4699
 
-
 
4700
     push ecx
-
 
4701
 
-
 
4702
     mov  eax,[0x3010]
-
 
4703
     mov  eax,[eax+TASKDATA.pid]
-
 
4704
     mov  [edi-8],eax
-
 
4705
     mov  [edi-4],ecx
-
 
4706
     cld
-
 
4707
     rep  movsb
-
 
4708
 
-
 
4709
     pop  ecx
-
 
4710
     add  ecx,8
-
 
4711
 
-
 
4712
     mov  edi,ebp                  ; increase memory position
-
 
4713
     add  dword [edi+4],ecx
-
 
4714
 
-
 
4715
     mov  edi,[esp]
-
 
4716
     shl  edi,8
-
 
4717
     or   dword [edi+0x80000+APPDATA.event_mask],dword 01000000b ; ipc message
-
 
4718
 
-
 
4719
     cmp  [check_idle_semaphore],dword 20
-
 
4720
     jge  ipc_no_cis
-
 
4721
     mov  [check_idle_semaphore],5
-
 
4722
   ipc_no_cis:
-
 
4723
 
-
 
4724
     xor  eax, eax
-
 
4725
 
-
 
4726
    ipc_err:
-
 
4727
     add  esp,4
-
 
4728
     mov  [esp+36],eax
-
 
4729
     sti
-
 
4730
     ret
-
 
4731
 
-
 
4732
    ipc_err1:
-
 
4733
     add  esp,4
-
 
4734
     mov  [esp+36],dword 1
-
 
4735
     sti
-
 
4736
     ret
-
 
4737
    ipc_err2:
-
 
4738
     add  esp,4
-
 
4739
     mov  [esp+36],dword 2
-
 
4740
     sti
-
 
4741
     ret
-
 
4742
    ipc_err3:
-
 
4743
     add  esp,4
-
 
4744
     mov  [esp+36],dword 3
-
 
4745
     sti
-
 
4746
     ret
-
 
4747
 
-
 
4748
   no_ipc_send:
-
 
4749
 
-
 
4750
     mov  [esp+36],dword -1
-
 
4751
     ret
4639
     ret
Line 4752... Line 4640...
4752
 
4640
 
Line 4753... Line 4641...
4753
 
4641
 
4754
align 4
4642
align 4
4755
 
4643
 
4756
sys_gs:                         ; direct screen access
4644
sys_gs:                         ; direct screen access
4757
 
4645
 
4758
     cmp  eax,1                 ; resolution
4646
     cmp  eax,1                 ; resolution
4759
     jne  no_gs1
4647
     jne  no_gs1
4760
     mov  eax,[0xfe00]
4648
     mov  eax,[ScreenWidth]
4761
     shl  eax,16
4649
     shl  eax,16
Line 4762... Line 4650...
4762
     mov  ax,[0xfe04]
4650
     mov  ax,[ScreenHeight]
4763
     add  eax,0x00010001
4651
     add  eax,0x00010001
4764
     mov  [esp+36],eax
4652
     mov  [esp+36],eax
4765
     ret
4653
     ret
4766
   no_gs1:
4654
   no_gs1:
4767
 
4655
 
Line 4768... Line 4656...
4768
     cmp   eax,2                ; bits per pixel
4656
     cmp   eax,2                ; bits per pixel
4769
     jne   no_gs2
4657
     jne   no_gs2
4770
     movzx eax,byte [0xfbf1]
4658
     movzx eax,byte [ScreenBPP]
4771
     mov   [esp+36],eax
4659
     mov   [esp+36],eax
4772
     ret
4660
     ret
4773
   no_gs2:
4661
   no_gs2:
Line 4774... Line 4662...
4774
 
4662
 
Line 4795... Line 4683...
4795
align 4  ;  system functions
4683
align 4  ;  system functions
Line 4796... Line 4684...
4796
 
4684
 
Line 4797... Line 4685...
4797
syscall_setpixel:                       ; SetPixel
4685
syscall_setpixel:                       ; SetPixel
4798
 
4686
 
4799
 
4687
 
4800
     mov   edx,[0x3010]
4688
     mov   edx,[TASK_BASE]
4801
     add   eax,[edx-twdw+WDATA.box.left]
4689
     add   eax,[edx-twdw+WDATA.box.left]
4802
     add   ebx,[edx-twdw+WDATA.box.top]
4690
     add   ebx,[edx-twdw+WDATA.box.top]
4803
        mov     edi,[0x3000]
4691
        mov     edi,[CURRENT_TASK]
4804
        shl     edi,8
4692
        shl     edi,8
4805
        add     eax,[edi+0x80000+APPDATA.wnd_clientbox.left]
4693
        add     eax,[edi+SLOT_BASE+APPDATA.wnd_clientbox.left]
4806
        add     ebx,[edi+0x80000+APPDATA.wnd_clientbox.top]
4694
        add     ebx,[edi+SLOT_BASE+APPDATA.wnd_clientbox.top]
4807
     xor   edi,edi ; no force
4695
     xor   edi,edi ; no force
Line 4808... Line 4696...
4808
;     mov   edi,1
4696
;     mov   edi,1
Line 4809... Line 4697...
4809
     call  [disable_mouse]
4697
     call  [disable_mouse]
Line 4810... Line 4698...
4810
     jmp   [putpixel]
4698
     jmp   [putpixel]
4811
 
4699
 
4812
align 4
4700
align 4
4813
 
4701
 
4814
syscall_writetext:                      ; WriteText
4702
syscall_writetext:                      ; WriteText
4815
 
4703
 
4816
     mov   edi,[0x3010]
4704
     mov   edi,[TASK_BASE]
4817
     mov   ebp,[edi-twdw+WDATA.box.left]
4705
     mov   ebp,[edi-twdw+WDATA.box.left]
4818
        push    esi
4706
        push    esi
4819
        mov     esi,[0x3000]
4707
        mov     esi,[CURRENT_TASK]
4820
        shl     esi,8
4708
        shl     esi,8
4821
        add     ebp,[esi+0x80000+APPDATA.wnd_clientbox.left]
4709
        add     ebp,[esi+SLOT_BASE+APPDATA.wnd_clientbox.left]
4822
     shl   ebp,16
4710
     shl   ebp,16
4823
     add   ebp,[edi-twdw+WDATA.box.top]
4711
     add   ebp,[edi-twdw+WDATA.box.top]
Line 4831... Line 4719...
4831
align 4
4719
align 4
Line 4832... Line 4720...
4832
 
4720
 
Line 4833... Line 4721...
4833
syscall_openramdiskfile:                ; OpenRamdiskFile
4721
syscall_openramdiskfile:                ; OpenRamdiskFile
4834
 
4722
 
4835
 
4723
 
4836
     mov   edi,[0x3010]
4724
     mov   edi,[TASK_BASE]
4837
     add   edi, TASKDATA.mem_start
4725
     add   edi,TASKDATA.mem_start
4838
     add   eax,[edi]
4726
     add   eax,[edi]
Line 4854... Line 4742...
4854
     je    drectr
4742
     je    drectr
4855
     movzx ecx,ax
4743
     movzx ecx,ax
4856
     sar   eax,16
4744
     sar   eax,16
4857
     movzx edx,bx
4745
     movzx edx,bx
4858
     sar   ebx,16
4746
     sar   ebx,16
4859
        mov     esi,[0x3000]
4747
        mov     esi,[CURRENT_TASK]
4860
        shl     esi,8
4748
        shl     esi,8
4861
        add     eax,[esi+0x80000+APPDATA.wnd_clientbox.left]
4749
        add     eax,[esi+SLOT_BASE+APPDATA.wnd_clientbox.left]
4862
        add     ebx,[esi+0x80000+APPDATA.wnd_clientbox.top]
4750
        add     ebx,[esi+SLOT_BASE+APPDATA.wnd_clientbox.top]
4863
     add   ecx,eax
4751
     add   ecx,eax
4864
     add   edx,ebx
4752
     add   edx,ebx
4865
     jmp   [drawbar]
4753
     jmp   [drawbar]
4866
    drectr:
4754
    drectr:
4867
     ret
4755
     ret
Line 4868... Line 4756...
4868
 
4756
 
Line 4869... Line 4757...
4869
align 4
4757
align 4
Line 4870... Line 4758...
4870
 
4758
 
4871
syscall_getscreensize:                  ; GetScreenSize
4759
syscall_getscreensize:                  ; GetScreenSize
4872
 
4760
 
4873
     movzx eax,word[0xfe00]
-
 
4874
     shl   eax,16
-
 
4875
     mov   ax,[0xfe04]
-
 
4876
     mov   [esp+36],eax
-
 
4877
     ret
-
 
4878
 
-
 
4879
align 4
-
 
4880
 
-
 
4881
syscall_startapp:                       ; StartApp
-
 
4882
     mov   edi,[0x3010]
-
 
4883
     add   edi, TASKDATA.mem_start
-
 
4884
     add   eax,[edi]
-
 
4885
     test  ebx,ebx
-
 
4886
     jz    noapppar
-
 
4887
     add   ebx,[edi]
-
 
4888
   noapppar:
-
 
4889
;     call  start_application_fl
4761
     movzx eax,word[ScreenWidth]
4890
     xor   edx,edx      ; compatibility - flags=0
4762
     shl   eax,16
Line 4891... Line -...
4891
     call   new_start_application_fl
-
 
4892
     mov   [esp+36],eax
4763
     mov   ax,[ScreenHeight]
Line 4893... Line 4764...
4893
     ret
4764
     mov   [esp+36],eax
Line 4894... Line 4765...
4894
 
4765
     ret
4895
 
4766
 
4896
align 4
4767
align 4
Line 4897... Line -...
4897
 
-
 
4898
syscall_cdaudio:                        ; CD
-
 
4899
 
-
 
4900
     call  sys_cd_audio
-
 
4901
     mov   [esp+36],eax
-
 
4902
     ret
-
 
4903
 
-
 
4904
;  ReadHd and StartHdApp functions are obsolete. Use 58 or 70 functions instead.
-
 
4905
;align 4
-
 
4906
;
-
 
4907
;syscall_readhd:                         ; ReadHd
-
 
4908
;
-
 
4909
;     mov   edi,[0x3010]
-
 
4910
;     add   edi,0x10
-
 
4911
;     add   esi,[edi]
-
 
4912
;     add   eax,[edi]
-
 
4913
;     call  read_hd_file
-
 
4914
;     mov   [esp+36],eax
-
 
4915
;     mov   [esp+24],ebx
-
 
4916
;     ret
-
 
4917
 
-
 
4918
;align 4
-
 
4919
;
-
 
4920
;syscall_starthdapp:                     ; StartHdApp
-
 
4921
;
-
 
4922
;     mov   edi,[0x3010]
-
 
4923
;     add   edi,0x10
-
 
4924
;     add   eax,[edi]
-
 
4925
;     add   ecx,[edi]
4768
 
Line 4926... Line 4769...
4926
;     xor   ebp,ebp
4769
syscall_cdaudio:                        ; CD
Line 4927... Line 4770...
4927
;     xor   edx,edx      ; compatibility - flags=0
4770
 
4928
;     call  start_application_hd
4771
     call  sys_cd_audio
4929
;     mov   [esp+36],eax
4772
     mov   [esp+36],eax
4930
;     ret
4773
     ret
4931
 
4774
 
4932
align 4
4775
align 4
Line 4933... Line 4776...
4933
 
4776
 
Line 4934... Line 4777...
4934
syscall_delramdiskfile:                 ; DelRamdiskFile
4777
syscall_delramdiskfile:                 ; DelRamdiskFile
Line 4935... Line 4778...
4935
 
4778
 
4936
     mov   edi,[0x3010]
4779
     mov   edi,[TASK_BASE]
4937
     add   edi, TASKDATA.mem_start
4780
     add   edi,TASKDATA.mem_start
4938
     add   eax,[edi]
4781
     add   eax,[edi]
4939
     call  filedelete
4782
     call  filedelete
4940
     mov   [esp+36],eax
4783
     mov   [esp+36],eax
4941
     ret
4784
     ret
Line 4942... Line 4785...
4942
 
4785
 
Line 4943... Line 4786...
4943
align 4
4786
align 4
4944
 
4787
 
4945
syscall_writeramdiskfile:               ; WriteRamdiskFile
4788
syscall_writeramdiskfile:               ; WriteRamdiskFile
4946
 
4789
 
4947
     mov   edi,[0x3010]
4790
     mov   edi,[TASK_BASE]
4948
     add   edi, TASKDATA.mem_start
4791
     add   edi,TASKDATA.mem_start
4949
     add   eax,[edi]
4792
     add   eax,[edi]
Line 4967... Line 4810...
4967
 
4810
 
Line 4968... Line 4811...
4968
align 4
4811
align 4
Line 4969... Line 4812...
4969
 
4812
 
4970
syscall_readstring:                     ; ReadString
4813
syscall_readstring:                     ; ReadString
4971
 
4814
 
4972
     mov   edi,[0x3010]
4815
     mov   edi,[TASK_BASE]
4973
     add   edi, TASKDATA.mem_start
4816
     add   edi,TASKDATA.mem_start
4974
     add   eax,[edi]
4817
     add   eax,[edi]
Line 4975... Line 4818...
4975
     call  read_string
4818
     call  read_string
Line 4976... Line 4819...
4976
     mov   [esp+36],eax
4819
     mov   [esp+36],eax
Line 4977... Line 4820...
4977
     ret
4820
     ret
4978
 
4821
 
4979
align 4
4822
align 4
4980
 
4823
 
4981
syscall_drawline:                       ; DrawLine
4824
syscall_drawline:                       ; DrawLine
4982
 
4825
 
4983
     mov   edi,[0x3010]
4826
     mov   edi,[TASK_BASE]
4984
     mov   edx, [edi-twdw+WDATA.box.left]
4827
     mov   edx, [edi-twdw+WDATA.box.left]
4985
        mov     esi,[0x3000]
4828
        mov     esi,[CURRENT_TASK]
4986
        shl     esi,8
4829
        shl     esi,8
4987
        add     edx, [esi+0x80000+APPDATA.wnd_clientbox.left]
4830
        add     edx,[esi+SLOT_BASE+APPDATA.wnd_clientbox.left]
4988
     add   ax,dx
4831
     add   ax,dx
4989
     rol   eax,16
4832
     rol   eax,16
4990
     add   ax,dx
4833
     add   ax,dx
4991
     rol   eax,16
4834
     rol   eax,16
4992
     mov   edx, [edi-twdw+WDATA.box.top]
4835
     mov   edx, [edi-twdw+WDATA.box.top]
Line 5063... Line 4906...
5063
 
4906
 
Line 5064... Line 4907...
5064
align 4
4907
align 4
Line 5065... Line 4908...
5065
 
4908
 
5066
read_from_hd:                           ; Read from hd - fn not in use
4909
read_from_hd:                           ; Read from hd - fn not in use
5067
 
4910
 
5068
     mov   edi,[0x3010]
4911
     mov   edi,[TASK_BASE]
5069
     add   edi,TASKDATA.mem_start
4912
     add   edi,TASKDATA.mem_start
5070
     add   eax,[edi]
4913
     add   eax,[edi]
Line 5075... Line 4918...
5075
     mov   [esp+36],eax
4918
     mov   [esp+36],eax
5076
     mov   [esp+24],ebx
4919
     mov   [esp+24],ebx
Line 5077... Line 4920...
5077
 
4920
 
Line 5078... Line -...
5078
     ret
-
 
5079
 
4921
     ret
5080
 
-
 
5081
align 4
-
 
5082
 
-
 
5083
write_to_hd:                            ; Write a file to hd
-
 
5084
 
-
 
5085
     mov   edi,[0x3010]
-
 
5086
     add   edi,TASKDATA.mem_start
-
 
5087
     add   eax,[edi]
-
 
5088
     add   ecx,[edi]
4922
 
5089
     add   edx,[edi]
4923
align 4
Line 5090... Line -...
5090
     call  file_write
-
 
5091
     ret
-
 
5092
 
-
 
5093
;  Sysfunction 57, delete_from_hd, is obsolete. Use 58 or 70 functions instead.
-
 
5094
;align 4
-
 
5095
;
-
 
5096
;delete_from_hd:                         ; Delete a file from hd
-
 
5097
;
-
 
5098
;     mov   edi,[0x3010]
-
 
5099
;     add   edi,0x10
-
 
5100
;     add   eax,[edi]
-
 
5101
;     add   ecx,[edi]
-
 
5102
;     call  file_delete
-
 
5103
;     ret
4924
paleholder:
5104
;
4925
	ret
5105
 
4926
 
5106
; --------------- APM ---------------------
4927
; --------------- APM ---------------------
5107
apm_entry    dp    0
4928
apm_entry    dp    0
Line 5149... Line 4970...
5149
 
4970
 
Line 5150... Line 4971...
5150
;clear_busy_flag_at_caller:
4971
;clear_busy_flag_at_caller:
Line 5151... Line 4972...
5151
 
4972
 
5152
;      push  edi
4973
;      push  edi
5153
 
4974
 
Line 5154... Line 4975...
5154
;      mov   edi,[0x3000]    ; restore processes tss pointer in gdt, busyfl?
4975
;      mov   edi,[CURRENT_TASK]    ; restore processes tss pointer in gdt, busyfl?
Line 5155... Line 4976...
5155
;      imul  edi,8
4976
;      imul  edi,8
Line 5156... Line -...
5156
;      mov   [edi+gdts+ tss0 +5], word 01010000b *256 +11101001b
-
 
5157
 
-
 
5158
;      pop   edi
4977
;      mov   [edi+gdts+ tss0 +5], word 01010000b *256 +11101001b
Line 5159... Line 4978...
5159
 
4978
 
5160
;      ret
4979
;      pop   edi
5161
 
4980
 
Line 5279... Line 5098...
5279
wraw_bacground_select db 0
5098
wraw_bacground_select db 0
5280
  lba_read_enabled    dd   0x0  ; 0 = disabled , 1 = enabled
5099
  lba_read_enabled    dd   0x0  ; 0 = disabled , 1 = enabled
5281
  pci_access_enabled  dd   0x0  ; 0 = disabled , 1 = enabled
5100
  pci_access_enabled  dd   0x0  ; 0 = disabled , 1 = enabled
Line 5282... Line 5101...
5282
 
5101
 
5283
  sb16       dd 0x0
-
 
Line 5284... Line 5102...
5284
  wss        dd 0x0
5102
  sb16       dd 0x0
5285
 
5103
 
-
 
5104
  buttontype         dd 0x0
-
 
5105
  windowtypechanged  dd 0x0
-
 
5106
 
-
 
5107
align 4
-
 
5108
  cpu_caps    dd 4 dup(0)
5286
  buttontype         dd 0x0
5109
  pg_data  PG_DATA
Line 5287... Line 5110...
5287
  windowtypechanged  dd 0x0
5110
  heap_test   dd ?
5288
endg
5111
endg
5289
 
5112
 
5290
iglobal
5113
iglobal
5291
  keyboard   dd 0x1
5114
  keyboard   dd 0x1
Line -... Line 5115...
-
 
5115
  sound_dma  dd 0x1
-
 
5116
  syslang    dd 0x1
-
 
5117
endg
-
 
5118
 
5292
  sound_dma  dd 0x1
5119
if __DEBUG__ eq 1
5293
  syslang    dd 0x1
5120
  include_debug_strings
5294
endg
5121
end if
5295
 
5122
 
5296
IncludeIGlobals
5123
IncludeIGlobals