Subversion Repositories Kolibri OS

Rev

Rev 435 | Rev 469 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 435 Rev 465
Line 52... Line 52...
52
;;
52
;;
53
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
53
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 54... Line 54...
54
 
54
 
Line 55... Line 55...
55
include 'macros.inc'
55
include 'macros.inc'
Line 56... Line 56...
56
 
56
 
57
$Revision: 435 $
57
$Revision: 465 $
58
 
58
 
Line 59... Line 59...
59
include "proc32.inc"
59
include "proc32.inc"
-
 
60
include "kglobals.inc"
-
 
61
include "lang.inc"
Line 60... Line -...
60
include "kglobals.inc"
-
 
61
include "lang.inc"
-
 
Line -... Line 62...
-
 
62
 
62
 
63
include "const.inc"
-
 
64
max_processes    equ   255
-
 
65
tss_step         equ   (128+8192) ; tss & i/o - 65535 ports, * 256=557056*4
-
 
66
 
-
 
67
 
Line 63... Line -...
63
include "const.inc"
-
 
64
 
-
 
65
;WinMapAddress      equ     0x460000
-
 
66
;display_data       = 0x460000
-
 
67
 
-
 
68
max_processes      equ   255
-
 
69
 
-
 
Line 70... Line 68...
70
;window_data        equ   0x0000
68
os_stack       equ  (os_data_l-gdts)    ; GDTs
71
;tss_data           equ   0xD20000
69
os_code        equ  (os_code_l-gdts)
72
tss_step           equ   (128+8192) ; tss & i/o - 65535 ports, * 256=557056*4
70
graph_data     equ  (3+graph_data_l-gdts)
73
;draw_data          equ   0xC00000
71
tss0           equ  (tss0_l-gdts)
Line 107... Line 105...
107
 
105
 
108
use16
106
use16
109
                  org   0x0
107
                  org   0x0
Line 110... Line -...
110
                  jmp   start_of_code
-
 
111
 
-
 
112
; mike.dld {
-
 
113
        org $+0x10000
-
 
114
db 0
-
 
115
dd servetable-0x10000
-
 
116
draw_line       dd __sys_draw_line
-
 
117
disable_mouse   dd __sys_disable_mouse
-
 
118
draw_pointer    dd __sys_draw_pointer
-
 
119
;//mike.dld, 2006-08-02 [
-
 
120
;drawbar         dd __sys_drawbar
-
 
121
drawbar         dd __sys_drawbar.forced
-
 
122
;//mike.dld, 2006-08-02 ]
-
 
123
putpixel        dd __sys_putpixel
-
 
124
; } mike.dld
108
                  jmp   start_of_code
125
 
-
 
Line 126... Line 109...
126
version           db    'Kolibri OS  version 0.6.5.0      ',13,10,13,10,0
109
 
127
                  ;dd    endofcode-0x10000
-
 
128
 
110
version db    'Kolibri OS  version 0.6.5.0      ',13,10,13,10,0
129
                  ;db   'Boot02'
-
 
Line 130... Line 111...
130
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
111
 
-
 
112
include "boot/bootstr.inc"     ; language-independent boot messages
131
include "boot/preboot.inc"
113
include "boot/preboot.inc"
132
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-
 
133
 
-
 
134
preboot_lfb       db    0
114
 
135
preboot_bootlog   db    0
115
if lang eq en
-
 
116
include "boot/booteng.inc"     ; english system boot messages
136
 
117
else if lang eq ru
137
 
118
include "boot/bootru.inc"      ; russian system boot messages
-
 
119
include "boot/ru.inc"          ; Russian font
138
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
120
else if lang eq et
-
 
121
include "boot/bootet.inc"      ; estonian system boot messages
Line -... Line 122...
-
 
122
include "boot/et.inc"          ; Estonian font
139
;;                                                                      ;;
123
else
Line 140... Line 124...
140
;;                      16 BIT INCLUDED FILES                           ;;
124
include "boot/bootge.inc"      ; german system boot messages
141
;;                                                                      ;;
125
end if
142
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
126
 
143
 
127
include "boot/bootcode.inc"    ; 16 bit system boot code
144
include "kernel16.inc"
128
include "bus/pci/pci16.inc"
Line 145... Line -...
145
 
-
 
146
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
147
;;                                                                      ;;
-
 
148
;;                  SWITCH TO 32 BIT PROTECTED MODE                     ;;
-
 
149
;;                                                                      ;;
-
 
150
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
151
 
-
 
152
os_data        =  os_data_l-gdts    ; GDTs
-
 
153
os_code        =  os_code_l-gdts
-
 
154
int_code       equ  int_code_l-gdts
-
 
155
int_data       equ  int_data_l-gdts
-
 
Line 156... Line 129...
156
tss0sys        equ  tss0sys_l-gdts
129
 
Line 157... Line 130...
157
graph_data     equ  3+graph_data_l-gdts
130
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 158... Line 131...
158
tss0           equ  tss0_l-gdts
131
;;                                                                      ;;
Line 159... Line 132...
159
app_code       equ  3+app_code_l-gdts
132
;;                  SWITCH TO 32 BIT PROTECTED MODE                     ;;
Line 160... Line 133...
160
app_data       equ  3+app_data_l-gdts
133
;;                                                                      ;;
161
 
134
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
162
 
135
 
163
 
136
 
Line 187... Line 160...
187
   l.7: in      al, 0x64
160
   l.7: in      al, 0x64
188
        test    al, 2
161
        test    al, 2
189
        jnz     l.7
162
        jnz     l.7
190
        mov     al, 0xFF
163
        mov     al, 0xFF
191
        out     0x64, al
164
        out     0x64, al
-
 
165
 
192
        lgdt    [cs:gdts-0x10000]       ; Load GDT
166
        lgdt    [cs:tmp_gdt]            ; Load GDT
193
        mov     eax, cr0                ; Turn on paging // protected mode
167
        mov     eax, cr0                ; protected mode
194
        or      eax, ecx
168
        or      eax, ecx
195
        and     eax, 10011111b *65536*256 + 0xffffff ; caching enabled
169
        and     eax, 10011111b *65536*256 + 0xffffff ; caching enabled
196
        mov     cr0, eax
170
        mov     cr0, eax
197
        jmp     $+2
-
 
198
org $+0x10000
-
 
199
        mov     ax,os_data              ; Selector for os
-
 
200
        mov     ds,ax
-
 
201
        mov     es,ax
-
 
202
        mov     fs,ax
-
 
203
        mov     gs,ax
-
 
204
        mov     ss,ax
-
 
205
        mov     esp,0x3ec00             ; Set stack
-
 
206
        jmp     pword os_code:B32       ; jmp to enable 32 bit mode
171
        jmp     pword os_code:B32       ; jmp to enable 32 bit mode
Line 207... Line -...
207
 
-
 
208
if gdte >= $
172
 
209
error 'GDT overlaps with used code!'
-
 
Line 210... Line 173...
210
end if
173
include "boot/shutdown.inc" ; shutdown or restart
-
 
174
 
Line -... Line 175...
-
 
175
align 8
-
 
176
tmp_gdt:
-
 
177
 
-
 
178
        dw     23
-
 
179
        dd     tmp_gdt+0x10000
211
 
180
        dw     0
-
 
181
 
-
 
182
        dw     0xffff
-
 
183
        dw     0x0000
-
 
184
        db     0x00
-
 
185
        dw     11011111b *256 +10011010b
-
 
186
        db     0x00
-
 
187
 
-
 
188
        dw     0xffff
-
 
189
        dw     0x0000
Line 212... Line -...
212
use32
-
 
213
 
-
 
214
include 'unpacker.inc'
190
        db     0x00
Line 215... Line 191...
215
 
191
        dw     11011111b *256 +10010010b
216
__DEBUG__ fix 1
-
 
217
__DEBUG_LEVEL__ fix 1
-
 
218
include 'fdo.inc'
-
 
219
 
-
 
220
iglobal
-
 
221
  boot_memdetect    db   'Determining amount of memory',0
-
 
222
  boot_fonts        db   'Fonts loaded',0
-
 
223
  boot_tss          db   'Setting TSSs',0
-
 
224
  boot_cpuid        db   'Reading CPUIDs',0
-
 
225
  boot_devices      db   'Detecting devices',0
-
 
226
  boot_timer        db   'Setting timer',0
-
 
227
  boot_irqs         db   'Reprogramming IRQs',0
-
 
228
  boot_setmouse     db   'Setting mouse',0
-
 
229
  boot_windefs      db   'Setting window defaults',0
-
 
230
  boot_bgr          db   'Calculating background',0
-
 
231
  boot_resirqports  db   'Reserving IRQs & ports',0
-
 
232
  boot_setrports    db   'Setting addresses for IRQs',0
-
 
233
  boot_setostask    db   'Setting OS task',0
-
 
234
  boot_allirqs      db   'Unmasking all IRQs',0
-
 
235
  boot_tsc          db   'Reading TSC',0
192
        db     0x00
Line 236... Line 193...
236
  boot_pal_ega      db   'Setting EGA/CGA 320x200 palette',0
193
 
-
 
194
include "data16.inc"
-
 
195
 
-
 
196
use32
-
 
197
org $+0x10000
-
 
198
 
-
 
199
align 4
-
 
200
B32:
-
 
201
           mov   ax,os_stack       ; Selector for os
-
 
202
           mov   ds,ax
-
 
203
           mov   es,ax
-
 
204
           mov   fs,ax
-
 
205
           mov   gs,ax
-
 
206
           mov   ss,ax
-
 
207
           mov   esp,0x3ec00       ; Set stack
237
  boot_pal_vga      db   'Setting VGA 640x480 palette',0
208
 
-
 
209
; CLEAR 0x280000 - HEAP_BASE
238
  boot_mtrr         db   'Setting MTRR',0
210
 
-
 
211
           xor   eax,eax
-
 
212
           mov   edi,0x280000
-
 
213
           mov   ecx,(HEAP_BASE-OS_BASE-0x280000) / 4
Line -... Line 214...
-
 
214
           cld
239
  boot_tasking      db   'All set - press ESC to start',0
215
           rep   stosd
-
 
216
 
240
endg
217
           mov   edi,0x40000
Line 241... Line -...
241
 
-
 
242
iglobal
-
 
243
  boot_y dd 10
-
 
244
endg
-
 
245
 
218
           mov   ecx,(0x90000-0x40000)/4
246
boot_log:
-
 
247
         pushad
-
 
Line -... Line 219...
-
 
219
           rep   stosd
248
 
220
 
-
 
221
; CLEAR KERNEL UNDEFINED GLOBALS
249
         mov   eax,10*65536
222
           mov   edi, endofcode-OS_BASE
-
 
223
           mov   ecx, (uglobals_size/4)+4
-
 
224
           rep   stosd
-
 
225
 
Line 250... Line 226...
250
         mov   ax,word [boot_y]
226
; SAVE & CLEAR 0-0xffff
251
         add   [boot_y],dword 10
227
 
Line 252... Line -...
252
         mov   ebx,0x80ffffff   ; ASCIIZ string with white color
-
 
253
         mov   ecx,esi
228
           xor esi, esi
254
         mov   edi,1
-
 
255
         call  dtext
-
 
256
 
229
           mov   edi,0x2F0000
257
         mov   [novesachecksum],1000
-
 
258
         call  checkVga_N13
230
           mov   ecx,0x10000 / 4
259
 
-
 
260
         cmp   [preboot_blogesc],byte 1
231
           rep   movsd
261
         je    .bll2
-
 
Line 262... Line 232...
262
 
232
           xor edi, edi
Line -... Line 233...
-
 
233
           mov   ecx,0x10000 / 4
263
         cmp   esi,boot_tasking
234
           rep   stosd
Line 264... Line 235...
264
         jne   .bll2
235
 
265
         ; begin ealex 04.08.05
236
           call test_cpu
266
;         in    al,0x61
237
           bts [cpu_caps-OS_BASE], CAPS_TSC     ;force use rdtsc
Line 267... Line 238...
267
;         and   al,01111111b
238
 
268
;         out   0x61,al
-
 
269
         ; end ealex 04.08.05
-
 
270
.bll1:   in    al,0x60    ; wait for ESC key press
-
 
271
         cmp   al,129
-
 
272
         jne   .bll1
-
 
273
 
-
 
274
.bll2:   popad
-
 
275
 
-
 
276
         ret
-
 
277
 
-
 
278
iglobal
-
 
279
  firstapp   db  '/rd/1/LAUNCHER',0
-
 
280
  vrr_m      db  '/rd/1/VRR_M',0
239
; MEMORY MODEL
281
 
-
 
282
  char  dd 0,0,0
-
 
283
   dd 2560
-
 
284
   dd  0x3F600 - std_application_base_address
-
 
285
   db '/RD/1/FONTS/CHAR.MT',0
-
 
Line -... Line 240...
-
 
240
           call mem_test
-
 
241
           call init_mem
-
 
242
           call init_page_map
Line 286... Line -...
286
  char2 	dd 0,0,0
-
 
287
			dd 2560
-
 
288
			dd  0x3EC00 - std_application_base_address
243
 
289
			db '/RD/1/FONTS/CHAR2.MT',0
-
 
290
 
-
 
Line 291... Line 244...
291
  ;char       db  'FONTS/CHAR.MT',0
244
; ENABLE PAGING
-
 
245
 
-
 
246
           mov eax, sys_pgdir-OS_BASE
-
 
247
           mov cr3, eax
-
 
248
 
-
 
249
           mov eax,cr0
Line 292... Line -...
292
  ;char2      db  'FONTS/CHAR2.MT',0
-
 
293
  bootpath   db  '/KOLIBRI    '
-
 
294
  bootpath2  db  0
-
 
295
;  vmode      db  'drivers/VMODE.MDR',0
250
           or eax,CR0_PG+CR0_WP
296
  vmode 	dd 0,0,0
251
           mov cr0,eax
297
			dd 0x8000
-
 
298
			dd 0x760000 - std_application_base_address
-
 
299
			db '/RD/1/drivers/VMODE.MDR',0
252
 
300
endg
-
 
301
 
253
           lgdt [gdts]
Line 302... Line 254...
302
 
254
           jmp pword os_code:high_code
303
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
255
 
304
;;                                                                      ;;
-
 
305
;;                          32 BIT ENTRY                                ;;
256
__DEBUG__ fix 1
Line 306... Line -...
306
;;                                                                      ;;
-
 
307
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
308
 
-
 
309
align 4
-
 
310
 
-
 
311
B32:
-
 
312
; CLEAR 0x280000-0xF00000
-
 
313
 
-
 
314
        xor   eax,eax
-
 
315
        mov   edi,0x280000
-
 
316
        mov   ecx,(0x100000*0xF-0x280000) / 4
-
 
317
        cld
-
 
318
        rep   stosd
257
__DEBUG_LEVEL__ fix 1
319
; CLEAR 0x80000-0x90000
-
 
320
;       xor   eax,eax
258
include 'init.inc'
321
 
-
 
322
        mov   edi,0x80000
-
 
Line 323... Line 259...
323
        mov   ecx,(0x90000-0x80000)/4
259
 
324
;       cld
260
org OS_BASE+$
325
        rep   stosd
261
 
326
 
262
align 4
-
 
263
high_code:
-
 
264
           mov   ax,os_stack
327
; CLEAR KERNEL UNDEFINED GLOBALS
265
           mov   bx,app_data
-
 
266
           mov   ss,ax
-
 
267
           add esp, OS_BASE
-
 
268
 
-
 
269
           mov   ds,bx
-
 
270
           mov   es,bx
-
 
271
           mov   fs,bx
-
 
272
           mov   gs,bx
-
 
273
 
-
 
274
           mov dword [sys_pgdir], 0
-
 
275
           mov dword [sys_pgdir+4], 0
-
 
276
           mov dword [sys_pgdir+8], 0
-
 
277
 
-
 
278
           mov eax, cr3
-
 
279
           mov cr3, eax           ; flush TLB
-
 
280
 
-
 
281
; SAVE REAL MODE VARIABLES
-
 
282
        mov     ax, [BOOT_VAR + 0x9031]
-
 
283
        mov     [IDEContrRegsBaseAddr], ax
-
 
284
; --------------- APM ---------------------
-
 
285
 
-
 
286
; init selectors
-
 
287
    mov ebx,    [BOOT_VAR+0x9040]              ; offset of APM entry point
328
        mov   edi, endofcode
288
    movzx eax, word [BOOT_VAR+0x9050] ; real-mode segment base address of
329
        mov   ecx, (uglobals_size/4)+4
289
                                      ; protected-mode 32-bit code segment
Line 330... Line 290...
330
        rep   stosd
290
    movzx ecx, word [BOOT_VAR+0x9052] ; real-mode segment base address of
331
 
291
                                      ; protected-mode 16-bit code segment
332
; SAVE & CLEAR 0-0xffff
292
    movzx edx, word [BOOT_VAR+0x9054] ; real-mode segment base address of
333
 
293
                                      ; protected-mode 16-bit data segment
334
        mov   esi,0x0000
294
 
335
        mov   edi,0x2F0000
295
    shl    eax, 4
336
        mov   ecx,0x10000 / 4
296
    mov    [dword apm_code_32 + 2], ax
337
        cld
297
    shr    eax, 16
338
        rep   movsd
298
    mov    [dword apm_code_32 + 4], al
339
        xor   eax,eax
299
 
340
        mov   edi,0
300
    shl    ecx, 4
341
        mov   ecx,0x10000 / 4
301
    mov    [dword apm_code_16 + 2], cx
342
        cld
302
    shr    ecx, 16
343
        rep   stosd
303
    mov    [dword apm_code_16 + 4], cl
344
 
304
 
345
; SAVE REAL MODE VARIABLES
305
    shl    edx, 4
346
        mov     ax, [0x2f0000 + 0x9031]
306
    mov    [dword apm_data_16 + 2], dx
347
        mov     [IDEContrRegsBaseAddr], ax
307
    shr    edx, 16
348
; --------------- APM ---------------------
308
    mov    [dword apm_data_16 + 4], dl
349
    mov    eax, [0x2f0000 + 0x9040]    ; entry point
309
 
350
    mov    dword[apm_entry], eax
310
    mov    dword[apm_entry], ebx
351
    mov    word [apm_entry + 4], apm_code_32 - gdts
311
    mov    word [apm_entry + 4], apm_code_32 - gdts
352
 
312
 
353
    mov    eax, [0x2f0000 + 0x9044]    ; version & flags
313
    mov    eax, [BOOT_VAR + 0x9044]    ; version & flags
354
    mov    [apm_vf], eax
314
    mov    [apm_vf], eax
355
; -----------------------------------------
315
; -----------------------------------------
356
;        movzx eax,byte [0x2f0000+0x9010]  ; mouse port
316
;        movzx eax,byte [BOOT_VAR+0x9010]  ; mouse port
357
;        mov   [0xF604],byte 1  ;al
317
;        mov   [0xF604],byte 1  ;al
358
        mov     al, [0x2F0000+0x901F]   ; DMA writing
318
        mov     al, [BOOT_VAR+0x901F]   ; DMA writing
Line 359... Line 319...
359
        mov     [allow_dma_write], al
319
        mov     [allow_dma_write], al
Line 360... Line -...
360
        mov   al,[0x2f0000+0x9000]        ; bpp
-
 
361
        mov   [ScreenBPP],al
-
 
362
        movzx eax,word [0x2f0000+0x900A]  ; X max
-
 
363
        dec   eax
-
 
364
        mov   [ScreenWidth],eax
-
 
365
        mov   [screen_workarea.right],eax
-
 
366
        movzx eax,word [0x2f0000+0x900C]  ; Y max
-
 
367
        dec   eax
320
        mov   al,[BOOT_VAR+0x9000]        ; bpp
368
        mov   [ScreenHeight],eax
321
        mov   [ScreenBPP],al
369
        mov   [screen_workarea.bottom],eax
-
 
370
        movzx eax,word [0x2f0000+0x9008]  ; screen mode
322
        movzx eax,word [BOOT_VAR+0x900A]  ; X max
Line 371... Line 323...
371
        mov   [SCR_MODE],eax
323
        dec   eax
372
        mov   eax,[0x2f0000+0x9014]       ; Vesa 1.2 bnk sw add
324
        mov   [ScreenWidth],eax
373
        mov   [BANK_SWITCH],eax
325
        mov   [screen_workarea.right],eax
374
        mov   [BytesPerScanLine],word 640*4         ; Bytes PerScanLine
326
        movzx eax,word [BOOT_VAR+0x900C]  ; Y max
375
        cmp   [SCR_MODE],word 0x13          ; 320x200
327
        dec   eax
376
        je    @f
328
        mov   [ScreenHeight],eax
377
        cmp   [SCR_MODE],word 0x12          ; VGA 640x480
329
        mov   [screen_workarea.bottom],eax
378
        je    @f
330
        movzx eax,word [BOOT_VAR+0x9008]  ; screen mode
379
        mov   ax,[0x2f0000+0x9001]        ; for other modes
331
        mov   [SCR_MODE],eax
380
        mov   [BytesPerScanLine],ax
332
        mov   eax,[BOOT_VAR+0x9014]       ; Vesa 1.2 bnk sw add
381
      @@:
333
        mov   [BANK_SWITCH],eax
382
 
334
        mov   [BytesPerScanLine],word 640*4         ; Bytes PerScanLine
383
; GRAPHICS ADDRESSES
335
        cmp   [SCR_MODE],word 0x13          ; 320x200
384
 
336
        je    @f
385
        ;mov     eax,0x100000*8                    ; LFB address
337
        cmp   [SCR_MODE],word 0x12          ; VGA 640x480
386
        ;cmp     [0xfe0c],word 0x13
338
        je    @f
387
        ;je      no_d_lfb
339
        mov   ax,[BOOT_VAR+0x9001]        ; for other modes
388
        ;cmp     [0xfe0c],word 0x12
340
        mov   [BytesPerScanLine],ax
389
        ;je      no_d_lfb
341
@@:
390
        ;cmp     [0x2f0000+0x901e],byte 1
342
 
391
        ;jne     no_d_lfb
343
; GRAPHICS ADDRESSES
392
        mov     byte [0x2f0000+0x901e],0x0
344
 
393
        mov     eax,[0x2f0000+0x9018]
345
        mov     byte [BOOT_VAR+0x901e],0x0
394
      ;no_d_lfb:
346
        mov     eax,[BOOT_VAR+0x9018]
395
        mov     [LFBAddress],eax
347
        mov     [LFBAddress],eax
396
 
348
 
Line 397... Line -...
397
        cmp     [SCR_MODE],word 0100000000000000b
-
 
398
        jge     setvesa20
-
 
399
        cmp     [SCR_MODE],word 0x13
-
 
400
        je      v20ga32
-
 
401
        mov     [PUTPIXEL],dword Vesa12_putpixel24  ; Vesa 1.2
-
 
402
        mov     [0xe024],dword Vesa12_getpixel24
-
 
403
        cmp     [ScreenBPP],byte 24
-
 
404
        jz      ga24
-
 
405
        mov     [PUTPIXEL],dword Vesa12_putpixel32
-
 
406
        mov     [0xe024],dword Vesa12_getpixel32
-
 
407
      ga24:
-
 
408
        jmp     v20ga24
349
        cmp     [SCR_MODE],word 0100000000000000b
409
      setvesa20:
350
        jge     setvesa20
410
        mov     [PUTPIXEL],dword Vesa20_putpixel24  ; Vesa 2.0
351
        cmp     [SCR_MODE],word 0x13
411
        mov     [0xe024],dword Vesa20_getpixel24
352
        je      v20ga32
412
        cmp     [ScreenBPP],byte 24
353
        mov     [PUTPIXEL],dword Vesa12_putpixel24  ; Vesa 1.2
Line 466... Line 407...
466
	;  and the contents of this field, plus 8, are copied into the SS register.
407
	;  and the contents of this field, plus 8, are copied into the SS register.
467
	; Bit 15–0 During the SYSCALL instruction, this field is copied into the CS register
408
	; Bit 15–0 During the SYSCALL instruction, this field is copied into the CS register
468
	;  and the contents of this field, plus 8, are copied into the SS register.
409
	;  and the contents of this field, plus 8, are copied into the SS register.
Line 469... Line 410...
469
 
410
 
470
	; mov	edx, (os_code + 16) * 65536 + os_code
411
	; mov	edx, (os_code + 16) * 65536 + os_code
Line 471... Line 412...
471
           mov edx, 0x1B0013
412
           mov edx, 0x1B0008
472
 
413
 
473
           mov eax, syscall_entry
414
           mov eax, syscall_entry
474
           mov ecx, MSR_AMD_STAR
415
           mov ecx, MSR_AMD_STAR
475
           wrmsr
416
           wrmsr
Line -... Line 417...
-
 
417
.noSYSCALL:
Line -... Line 418...
-
 
418
; -----------------------------------------
-
 
419
 
Line 476... Line -...
476
.noSYSCALL:
-
 
477
; -----------------------------------------
-
 
478
 
420
; LOAD IDT
479
 
421
 
480
 
422
           call build_interrupt_table
Line 481... Line -...
481
; MEMORY MODEL
-
 
482
           call mem_test
423
           lidt [idtreg]
483
           call init_mtrr
-
 
Line -... Line 424...
-
 
424
 
-
 
425
           call init_kernel_heap
-
 
426
           stdcall kernel_alloc, RING0_STACK_SIZE+512
-
 
427
           mov [os_stack_seg], eax
-
 
428
 
-
 
429
           lea esp, [eax+RING0_STACK_SIZE]
-
 
430
 
-
 
431
           mov [tss._ss0], os_stack
-
 
432
           mov [tss._esp0], esp
484
           call init_mem
433
           mov [tss._esp], esp
-
 
434
           mov [tss._cs],os_code
-
 
435
           mov [tss._ss],os_stack
485
           call init_page_map
436
           mov [tss._ds],app_data
486
 
437
           mov [tss._es],app_data
-
 
438
           mov [tss._fs],app_data
-
 
439
           mov [tss._gs],app_data
Line -... Line 440...
-
 
440
           mov [tss._io],128
487
; ENABLE PAGING
441
;Add IO access table - bit array of permitted ports
-
 
442
           mov edi, tss._io_map_0
488
           mov eax, sys_pgdir
443
           xor eax, eax
489
           mov cr3, eax
444
           not eax
Line 490... Line 445...
490
 
445
           mov ecx, 8192/4
491
           mov eax,cr0
446
           rep stosd                 ; access to 4096*8=65536 ports
492
           or eax,CR0_PG
-
 
493
           mov cr0,eax
447
 
Line 494... Line 448...
494
 
448
           mov  ax,tss0
-
 
449
           ltr  ax
-
 
450
 
-
 
451
           mov [LFBSize], 0x800000
495
           call init_kernel_heap
452
           call init_mtrr
496
           stdcall kernel_alloc, RING0_STACK_SIZE+512
453
 
Line 497... Line 454...
497
           mov [os_stack], eax
454
           call init_LFB
498
 
455
           call init_fpu
Line 525... Line 482...
525
 
482
 
526
           add eax, ebx
483
           add eax, ebx
Line 527... Line 484...
527
           mov [ipc_ptab], eax
484
           mov [ipc_ptab], eax
528
 
-
 
529
           call init_events
485
 
530
 
486
           call init_events
531
           mov eax, srv.fd-SRV_FD_OFFSET
487
           mov eax, srv.fd-SRV_FD_OFFSET
Line 532... Line 488...
532
           mov [srv.fd], eax
488
           mov [srv.fd], eax
Line 543... Line 499...
543
        shr     eax,16
499
        shr     eax,16
544
        mov     [graph_data_l+4],al
500
        mov     [graph_data_l+4],al
545
        mov     [graph_data_l+7],ah
501
        mov     [graph_data_l+7],ah
Line 546... Line 502...
546
 
502
 
547
 
-
 
548
; BUILD SCHEDULER
503
 
549
 
-
 
550
        call   build_scheduler ; sys32.inc
-
 
551
 
504
        mov [CURRENT_TASK],dword 1
552
; LOAD IDT
505
        mov [TASK_COUNT],dword 1
Line 553... Line 506...
553
        lidt   [cs:idtreg]
506
        mov [TASK_BASE],dword TASK_DATA
554
        cli
507
        mov [current_slot], SLOT_BASE+256
555
 
508
 
Line 573... Line 526...
573
include 'vmodeld.inc'
526
include 'vmodeld.inc'
574
;!!!!!!!!!!!!!!!!!!!!!!!
527
;!!!!!!!!!!!!!!!!!!!!!!!
Line 575... Line 528...
575
 
528
 
Line 576... Line -...
576
; LOAD FONTS I and II
-
 
577
 
-
 
578
        mov   [CURRENT_TASK],dword 1
-
 
579
        mov   [TASK_COUNT],dword 1
-
 
580
        mov   [TASK_BASE],dword TASK_DATA
-
 
581
 
-
 
582
	pushad
-
 
583
	push	eax
-
 
584
	mov		eax,char  - std_application_base_address
-
 
585
	call	file_system_lfn
-
 
586
	mov		eax,char2  - std_application_base_address
-
 
587
	call	file_system_lfn
-
 
588
	pop	eax
-
 
589
	popad
-
 
590
 
529
; LOAD FONTS I and II
591
 
530
 
592
;        mov   esi,char
531
        mov   esi,char
593
;        xor   ebx,ebx
532
        xor   ebx,ebx
594
;        mov   ecx,2560;26000
533
        mov   ecx,2560
595
;        mov   edx,FONT_I
534
        mov   edx,FONT_I
596
;        call  fs_RamdiskRead
535
        call  fs_RamdiskRead
597
 
536
 
598
;        mov   esi,char2
537
        mov   esi,char2
599
;        xor   ebx,ebx
538
        xor   ebx,ebx
600
;        mov   ecx,2560;26000
539
        mov   ecx,2560;26000
Line 601... Line 540...
601
;        mov   edx,FONT_II
540
        mov   edx,FONT_II
602
;        call  fs_RamdiskRead
541
        call  fs_RamdiskRead
Line 603... Line 542...
603
 
542
 
Line 625... Line 564...
625
        call  rerouteirqs
564
        call  rerouteirqs
Line 626... Line 565...
626
 
565
 
627
        mov    esi,boot_tss
566
        mov    esi,boot_tss
Line -... Line 567...
-
 
567
        call   boot_log
-
 
568
 
-
 
569
; BUILD SCHEDULER
-
 
570
 
628
        call   boot_log
571
        call   build_scheduler ; sys32.inc
629
 
572
 
630
        mov    esi,boot_devices
573
        mov    esi,boot_devices
Line 631... Line 574...
631
        call   boot_log
574
        call   boot_log
Line 632... Line 575...
632
        call   detect_devices
575
        call   detect_devices
633
 
576
 
634
 ; TIMER SET TO 1/100 S
577
; TIMER SET TO 1/100 S
635
 
578
 
Line 677... Line 620...
677
; SET UP OS TASK
620
; SET UP OS TASK
Line 678... Line 621...
678
 
621
 
679
        mov  esi,boot_setostask
622
        mov  esi,boot_setostask
Line 680... Line 623...
680
        call boot_log
623
        call boot_log
681
 
624
 
682
;        mov eax, fpu_data
625
        mov eax, fpu_data
683
;        mov  dword [SLOT_BASE+APPDATA.fpu_state], eax
626
        mov  dword [SLOT_BASE+APPDATA.fpu_state], eax
Line 684... Line 627...
684
;        mov  dword [SLOT_BASE+APPDATA.fpu_handler], 0
627
        mov  dword [SLOT_BASE+APPDATA.fpu_handler], 0
Line 685... Line 628...
685
;        mov  dword [SLOT_BASE+APPDATA.sse_handler], 0
628
        mov  dword [SLOT_BASE+APPDATA.sse_handler], 0
686
 
629
 
687
        ; name for OS/IDLE process
630
        ; name for OS/IDLE process
688
 
631
 
689
        mov dword [SLOT_BASE+256+APPDATA.app_name],   dword 'OS/I'
632
        mov dword [SLOT_BASE+256+APPDATA.app_name],   dword 'OS/I'
690
        mov dword [SLOT_BASE+256+APPDATA.app_name+4], dword 'DLE '
633
        mov dword [SLOT_BASE+256+APPDATA.app_name+4], dword 'DLE '
-
 
634
        mov edi, [os_stack_seg]
-
 
635
        mov dword [SLOT_BASE+256+APPDATA.pl0_stack], edi
-
 
636
        add edi, 0x2000-512
-
 
637
        mov dword [SLOT_BASE+256+APPDATA.fpu_state], edi
Line 691... Line 638...
691
        mov edi, [os_stack]
638
        mov dword [SLOT_BASE+256+APPDATA.io_map],\
692
        mov dword [SLOT_BASE+256+APPDATA.pl0_stack], edi
639
                  (tss._io_map_0-OS_BASE+PG_MAP)
693
        add edi, RING0_STACK_SIZE
640
        mov dword [SLOT_BASE+256+APPDATA.io_map+4],\
694
        mov dword [SLOT_BASE+256+APPDATA.fpu_state], edi
641
                  (tss._io_map_1-OS_BASE+PG_MAP)
Line 695... Line 642...
695
 
642
 
696
        mov esi, fpu_data
643
        mov esi, fpu_data
697
        mov ecx, 512/4
-
 
698
        cld
-
 
699
        rep movsd
644
        mov ecx, 512/4
Line 700... Line 645...
700
 
645
        cld
701
        mov dword [SLOT_BASE+256+APPDATA.fpu_handler], 0
646
        rep movsd
702
        mov dword [SLOT_BASE+256+APPDATA.sse_handler], 0
647
 
Line 703... Line 648...
703
 
648
        mov dword [SLOT_BASE+256+APPDATA.fpu_handler], 0
-
 
649
        mov dword [SLOT_BASE+256+APPDATA.sse_handler], 0
-
 
650
        mov dword [SLOT_BASE+256+APPDATA.cursor], ebx
-
 
651
 
-
 
652
        mov ebx, SLOT_BASE+256+APP_OBJ_OFFSET
704
        mov ebx, [def_cursor]
653
        mov  dword [SLOT_BASE+256+APPDATA.fd_obj], ebx
705
        mov dword [SLOT_BASE+256+APPDATA.cursor], ebx
654
        mov  dword [SLOT_BASE+256+APPDATA.bk_obj], ebx
706
 
655
 
Line 707... Line -...
707
        mov ebx, SLOT_BASE+256+APP_OBJ_OFFSET
-
 
708
        mov  dword [SLOT_BASE+256+APPDATA.fd_obj], ebx
-
 
709
        mov  dword [SLOT_BASE+256+APPDATA.bk_obj], ebx
-
 
710
 
-
 
711
        ; task list
-
 
712
        mov  [TASK_DATA+TASKDATA.wnd_number], 1 ; on screen number
-
 
713
        mov  [TASK_DATA+TASKDATA.pid], 1        ; process id number
-
 
714
        mov  [TASK_DATA+TASKDATA.mem_start], 0  ; process base address
-
 
715
 
-
 
716
        mov  edi,tss_data+tss_step
-
 
717
        mov ecx, (tss_step)/4
-
 
718
        xor eax, eax
-
 
719
        cld
-
 
720
        rep stosd
-
 
721
 
-
 
722
        mov  edi,tss_data+tss_step
-
 
723
        mov  [edi+TSS._ss0], os_data
-
 
724
        mov  eax,cr3
-
 
725
        mov  [edi+TSS._cr3],eax
-
 
726
        mov  [edi+TSS._eip],osloop
-
 
727
        mov  [edi+TSS._eflags],dword 0x11202 ; sti and resume
-
 
728
        mov eax, [os_stack]
-
 
729
        add eax, RING0_STACK_SIZE
-
 
730
        mov  [edi+TSS._esp], eax
-
 
731
        mov  [edi+TSS._cs],os_code
-
 
732
        mov  [edi+TSS._ss],os_data
656
        ; task list
-
 
657
        mov  [CURRENT_TASK],dword 1
-
 
658
        mov  [TASK_COUNT],dword 1
-
 
659
        mov  [current_slot], SLOT_BASE+256
Line 733... Line -...
733
        mov  [edi+TSS._ds],os_data
-
 
734
        mov  [edi+TSS._es],os_data
660
        mov  [TASK_BASE],dword TASK_DATA
Line 735... Line 661...
735
        mov  [edi+TSS._fs],os_data
661
        mov  [TASK_DATA+TASKDATA.wnd_number], 1 ; on screen number
736
        mov  [edi+TSS._gs],os_data
662
        mov  [TASK_DATA+TASKDATA.pid], 1        ; process id number
737
 
663
        mov  [TASK_DATA+TASKDATA.mem_start], 0  ; process base address
738
        mov  ax,tss0
664
 
Line 789... Line 715...
789
        movsd
715
        movsd
790
        movsd
716
        movsd
791
        movsd
717
        movsd
792
        call    load_skin
718
        call    load_skin
Line -... Line 719...
-
 
719
 
-
 
720
;protect io permission map
-
 
721
 
-
 
722
           mov esi, [default_io_map]
-
 
723
           stdcall map_page,esi,(tss._io_map_0-OS_BASE), PG_MAP
-
 
724
           add esi, 0x1000
-
 
725
           stdcall map_page,esi,(tss._io_map_1-OS_BASE), PG_MAP
-
 
726
 
-
 
727
           stdcall map_page,tss._io_map_0,\
-
 
728
                   (tss._io_map_0-OS_BASE), PG_MAP
-
 
729
           stdcall map_page,tss._io_map_1,\
-
 
730
                   (tss._io_map_1-OS_BASE), PG_MAP
793
 
731
 
794
; LOAD FIRST APPLICATION
-
 
795
        mov   [CURRENT_TASK],dword 1
-
 
796
        mov   [TASK_COUNT],dword 1
732
; LOAD FIRST APPLICATION
797
        cli
733
        cli
798
        cmp   byte [0x2f0000+0x9030],1
734
        cmp   byte [BOOT_VAR+0x9030],1
Line 799... Line 735...
799
        jne   no_load_vrr_m
735
        jne   no_load_vrr_m
800
 
736
 
801
        mov ebp, vrr_m
737
        mov ebp, vrr_m
Line 818... Line 754...
818
        cli
754
        cli
Line 819... Line 755...
819
 
755
 
820
        ;mov   [TASK_COUNT],dword 2
756
        ;mov   [TASK_COUNT],dword 2
Line 821... Line -...
821
        mov   [CURRENT_TASK],dword 1       ; set OS task fisrt
-
 
822
 
757
        mov   [CURRENT_TASK],dword 1       ; set OS task fisrt
823
 
758
 
824
; SET KEYBOARD PARAMETERS
759
; SET KEYBOARD PARAMETERS
Line 825... Line 760...
825
        mov   al, 0xf6         ; reset keyboard, scan enabled
760
        mov   al, 0xf6         ; reset keyboard, scan enabled
Line 852... Line 787...
852
; START MULTITASKING
787
; START MULTITASKING
Line 853... Line 788...
853
 
788
 
854
        mov   esi,boot_tasking
789
        mov   esi,boot_tasking
Line 855... Line 790...
855
        call  boot_log
790
        call  boot_log
Line 856... Line 791...
856
 
791
 
Line 857... Line 792...
857
 ;      mov   [ENABLE_TASKSWITCH],byte 1        ; multitasking enabled
792
;       mov   [ENABLE_TASKSWITCH],byte 1        ; multitasking enabled
858
 
793
 
Line 880... Line 815...
880
 
815
 
881
;        mov    [dma_hdd],1
816
;        mov    [dma_hdd],1
882
        cmp     [IDEContrRegsBaseAddr], 0
817
        cmp     [IDEContrRegsBaseAddr], 0
Line -... Line 818...
-
 
818
        setnz   [dma_hdd]
-
 
819
 
883
        setnz   [dma_hdd]
820
;        stdcall init_uart_service, DRV_ENTRY
-
 
821
 
-
 
822
        sti
-
 
823
        call change_task
-
 
824
 
884
 
825
        jmp osloop
Line 885... Line 826...
885
        sti
826
 
Line -... Line 827...
-
 
827
        jmp   $                      ; wait here for timer to take control
-
 
828
 
-
 
829
        ; Fly :)
-
 
830
 
-
 
831
include 'unpacker.inc'
-
 
832
include 'fdo.inc'
-
 
833
 
-
 
834
align 4
-
 
835
boot_log:
-
 
836
         pushad
-
 
837
 
-
 
838
         mov   eax,10*65536
-
 
839
         mov   ax,word [boot_y]
-
 
840
         add   [boot_y],dword 10
-
 
841
         mov   ebx,0x80ffffff   ; ASCIIZ string with white color
-
 
842
         mov   ecx,esi
-
 
843
         mov   edi,1
-
 
844
         call  dtext
-
 
845
 
-
 
846
         mov   [novesachecksum],1000
-
 
847
         call  checkVga_N13
-
 
848
 
-
 
849
         cmp   [preboot_blogesc+OS_BASE+0x10000],byte 1
-
 
850
         je    .bll2
-
 
851
 
-
 
852
         cmp   esi,boot_tasking
-
 
853
         jne   .bll2
-
 
854
         ; begin ealex 04.08.05
-
 
855
;         in    al,0x61
-
 
856
;         and   al,01111111b
-
 
857
;         out   0x61,al
-
 
858
         ; end ealex 04.08.05
-
 
859
.bll1:   in    al,0x60    ; wait for ESC key press
-
 
860
         cmp   al,129
-
 
861
         jne   .bll1
-
 
862
 
-
 
863
.bll2:   popad
886
        jmp   $                      ; wait here for timer to take control
864
 
887
 
865
         ret
888
        ; Fly :)
866
 
889
 
867
 
890
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
868
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 988... Line 966...
988
 
966
 
Line 989... Line 967...
989
reserve_irqs_ports:
967
reserve_irqs_ports:
Line 990... Line 968...
990
 
968
 
991
        pushad
969
        pushad
992
 
970
 
993
        mov  [irq_owner+4*0],byte 1    ; timer
971
        mov  [irq_owner+4*0], 1    ; timer
994
        mov  [irq_owner+4*1],byte 1    ; keyboard
972
        mov  [irq_owner+4*1], 1    ; keyboard
995
        mov  [irq_owner+4*5],byte 1    ; sound blaster
973
        mov  [irq_owner+4*5], 1    ; sound blaster
996
        mov  [irq_owner+4*6],byte 1    ; floppy diskette
974
        mov  [irq_owner+4*6], 1    ; floppy diskette
-
 
975
        mov  [irq_owner+4*13], 1   ; math co-pros
997
        mov  [irq_owner+4*13],byte 1   ; math co-pros
976
        mov  [irq_owner+4*14], 1   ; ide I
998
        mov  [irq_owner+4*14],byte 1   ; ide I
977
        mov  [irq_owner+4*15], 1   ; ide II
999
        mov  [irq_owner+4*15],byte 1   ; ide II
978
 
1000
;        movzx eax,byte [0xf604]        ; mouse irq
979
;        movzx eax,byte [0xf604]        ; mouse irq
1001
;        dec   eax
980
;        dec   eax
Line 1087... Line 1066...
1087
        mov   [KEY_COUNT],byte 0                 ; keyboard buffer
1066
        mov   [KEY_COUNT],byte 0                 ; keyboard buffer
1088
        mov   [BTN_COUNT],byte 0                 ; button buffer
1067
        mov   [BTN_COUNT],byte 0                 ; button buffer
1089
;        mov   [MOUSE_X],dword 100*65536+100    ; mouse x/y
1068
;        mov   [MOUSE_X],dword 100*65536+100    ; mouse x/y
Line 1090... Line 1069...
1090
 
1069
 
1091
        push  eax
1070
        push  eax
1092
        mov   ax,[0x2f0000+0x900c]
1071
        mov   ax,[BOOT_VAR+0x900c]
1093
        shr   ax,1
1072
        shr   ax,1
1094
        shl   eax,16
1073
        shl   eax,16
1095
        mov   ax,[0x2f0000+0x900A]
1074
        mov   ax,[BOOT_VAR+0x900A]
1096
        shr   ax,1
1075
        shr   ax,1
1097
        mov   [MOUSE_X],eax
1076
        mov   [MOUSE_X],eax
Line 1098... Line 1077...
1098
        pop   eax
1077
        pop   eax
1099
 
1078
 
1100
        mov   byte [SB16_Status],0            ; Minazzi Paolo
1079
        mov   byte [SB16_Status],0            ; Minazzi Paolo
Line 1101... Line 1080...
1101
        mov   [display_data-12],dword 1       ; tiled background
1080
        mov   [display_data-12],dword 1       ; tiled background
1102
        mov   [BTN_ADDR],dword BUTTON_INFO    ; address of button list
1081
        mov   [BTN_ADDR],dword BUTTON_INFO    ; address of button list
1103
 
1082
 
Line 1104... Line 1083...
1104
     ;!! IP 04.02.2005:
1083
     ;!! IP 04.02.2005:
Line 1105... Line 1084...
1105
        mov   [next_usage_update], 100
1084
        mov   [next_usage_update], 100
1106
        mov   byte [0xFFFF], 0 ; change task if possible
1085
        mov   byte [DONT_SWITCH], 0 ; change task if possible
Line 1411... Line 1390...
1411
     sub   ecx,eax
1390
     sub   ecx,eax
1412
     add   ecx,esp
1391
     add   ecx,esp
1413
     mov   eax,[esp+64+32-8+4]
1392
     mov   eax,[esp+64+32-8+4]
1414
     push  edx                       ; add window start x & y
1393
     push  edx                       ; add window start x & y
1415
     mov   edx,[TASK_BASE]
1394
     mov   edx,[TASK_BASE]
-
 
1395
 
-
 
1396
     mov   edi,[CURRENT_TASK]
-
 
1397
     shl   edi,8
-
 
1398
 
1416
     mov   ebx,[edx-twdw+WDATA.box.left]
1399
     mov   ebx,[edx-twdw+WDATA.box.left]
1417
     add   ebx, [(edx-CURRENT_TASK)*8+SLOT_BASE+APPDATA.wnd_clientbox.left]
1400
     add   ebx,[edi+SLOT_BASE+APPDATA.wnd_clientbox.left]
1418
     shl   ebx,16
1401
     shl   ebx,16
1419
     add   ebx,[edx-twdw+WDATA.box.top]
1402
     add   ebx,[edx-twdw+WDATA.box.top]
1420
     add   ebx, [(edx-CURRENT_TASK)*8+SLOT_BASE+APPDATA.wnd_clientbox.top]
1403
     add   ebx,[edi+SLOT_BASE+APPDATA.wnd_clientbox.top]
1421
     add   eax,ebx
1404
     add   eax,ebx
1422
     pop   edx
1405
     pop   edx
1423
     mov   ebx,[esp+64+32-12+4]
1406
     mov   ebx,[esp+64+32-12+4]
1424
        and     ebx, not 0x80000000     ; force counted string
1407
        and     ebx, not 0x80000000     ; force counted string
1425
        mov     esi, [esp+64+4+4]
1408
        mov     esi, [esp+64+4+4]
Line 1654... Line 1637...
1654
 
1637
 
1655
sys_setup_err:
1638
sys_setup_err:
1656
     mov  [esp+36],dword -1
1639
     mov  [esp+36],dword -1
Line 1657... Line -...
1657
     ret
-
 
1658
 
1640
     ret
Line 1659... Line 1641...
1659
 
1641
 
Line 1660... Line 1642...
1660
align 4
1642
align 4
Line 1826... Line 1808...
1826
           ret
1808
           ret
1827
msset:
1809
msset:
1828
           ret
1810
           ret
Line 1829... Line 1811...
1829
 
1811
 
1830
app_load_cursor:
1812
app_load_cursor:
1831
           add ebx, new_app_base
1813
      ;     add ebx, new_app_base
1832
           cmp ebx, new_app_base
1814
           cmp ebx, OS_BASE
1833
           jb msset
1815
           jae msset
1834
           stdcall load_cursor, ebx, ecx
1816
           stdcall load_cursor, ebx, ecx
1835
           mov [esp+36], eax
1817
           mov [esp+36], eax
Line 1836... Line 1818...
1836
           ret
1818
           ret
Line 1999... Line 1981...
1999
        jmp     dword [sys_system_table + eax*4]
1981
        jmp     dword [sys_system_table + eax*4]
2000
@@:
1982
@@:
2001
        ret
1983
        ret
Line 2002... Line 1984...
2002
 
1984
 
2003
sysfn_shutdown:         ; 18.1 = BOOT
1985
sysfn_shutdown:         ; 18.1 = BOOT
2004
     mov  [0x2f0000+0x9030],byte 0
1986
     mov  [BOOT_VAR+0x9030],byte 0
Line 2005... Line 1987...
2005
  for_shutdown_parameter:
1987
  for_shutdown_parameter:
2006
 
1988
 
2007
     mov  eax,[TASK_COUNT]
1989
     mov  eax,[TASK_COUNT]
Line 2123... Line 2105...
2123
sysfn_shutdown_param:   ; 18.9 = system shutdown with param
2105
sysfn_shutdown_param:   ; 18.9 = system shutdown with param
2124
     cmp  ebx,1
2106
     cmp  ebx,1
2125
     jl   exit_for_anyone
2107
     jl   exit_for_anyone
2126
     cmp  ebx,4
2108
     cmp  ebx,4
2127
     jg   exit_for_anyone
2109
     jg   exit_for_anyone
2128
     mov  [0x2f0000+0x9030],bl
2110
     mov  [BOOT_VAR+0x9030],bl
2129
     jmp  for_shutdown_parameter
2111
     jmp  for_shutdown_parameter
Line 2130... Line 2112...
2130
 
2112
 
2131
sysfn_minimize:         ; 18.10 = minimize window
2113
sysfn_minimize:         ; 18.10 = minimize window
2132
     mov   [window_minimize],1
2114
     mov   [window_minimize],1
Line 2594... Line 2576...
2594
    ; Window state
2576
    ; Window state
Line 2595... Line 2577...
2595
 
2577
 
2596
    mov    esi,[esp]
2578
    mov    esi,[esp]
2597
    shl    esi,5
2579
    shl    esi,5
2598
    add    esi,window_data + WDATA.box
2580
    add    esi,window_data + WDATA.box
2599
    mov    al,[esi+window_data+WDATA.fl_wstate]
2581
    mov    al,[esi+WDATA.fl_wstate]
Line 2600... Line 2582...
2600
    mov    [edi],al
2582
    mov    [edi],al
2601
 
2583
 
Line 2606... Line 2588...
2606
 
2588
 
2607
    mov    eax,[TASK_COUNT]
2589
    mov    eax,[TASK_COUNT]
2608
    mov    [esp+36],eax
2590
    mov    [esp+36],eax
Line 2609... Line -...
2609
    ret
-
 
2610
 
-
 
2611
 
-
 
2612
 
2591
    ret
2613
 
2592
 
2614
align 4
2593
align 4
2615
sys_clock:
2594
sys_clock:
2616
        cli
2595
        cli
Line 2868... Line 2847...
2868
        test    [edi+window_data+WDATA.fl_wstyle],WSTYLE_HASCAPTION
2847
        test    [edi+window_data+WDATA.fl_wstyle],WSTYLE_HASCAPTION
2869
        jz      @f
2848
        jz      @f
2870
        mov     ecx,[edi*8+SLOT_BASE+APPDATA.wnd_caption]
2849
        mov     ecx,[edi*8+SLOT_BASE+APPDATA.wnd_caption]
2871
        or      ecx,ecx
2850
        or      ecx,ecx
2872
        jz      @f
2851
        jz      @f
2873
        add     ecx,[edi+twdw+TASKDATA.mem_start]
2852
        add     ecx,[edi+CURRENT_TASK+TASKDATA.mem_start]
Line 2874... Line 2853...
2874
 
2853
 
2875
        movzx   eax,[edi+window_data+WDATA.fl_wstyle]
2854
        movzx   eax,[edi+window_data+WDATA.fl_wstyle]
2876
        and     al,0x0F
2855
        and     al,0x0F
2877
        cmp     al,3
2856
        cmp     al,3
Line 3341... Line 3320...
3341
        setne cl
3320
        setne cl
Line 3342... Line 3321...
3342
 
3321
 
3343
        pop  edx eax
3322
        pop  edx eax
Line 3344... Line -...
3344
        ret
-
 
3345
 
-
 
3346
uglobal
-
 
3347
  mouse_active  db  0
3323
        ret
3348
endg
3324
 
3349
iglobal
3325
iglobal
Line 3350... Line 3326...
3350
  cpustring db '/RD/1/CPU',0
3326
  cpustring db '/RD/1/CPU',0
Line 3360... Line 3336...
3360
checkmisc:
3336
checkmisc:
Line 3361... Line 3337...
3361
 
3337
 
3362
    cmp   [ctrl_alt_del], 1
3338
    cmp   [ctrl_alt_del], 1
3363
    jne   nocpustart
3339
    jne   nocpustart
3364
    mov   ebp, cpustring
-
 
3365
    call   fs_execute               ; SPraid 8.03.2007
3340
    mov   ebp, cpustring
3366
    ;lea   esi,[ebp+6]
3341
    lea   esi,[ebp+6]
3367
    ;xor   ebx,ebx               ; no parameters
3342
    xor   ebx,ebx               ; no parameters
3368
    ;xor   edx,edx               ; no flags
3343
    xor   edx,edx               ; no flags
3369
    ;call  fs_RamdiskExecute.flags
3344
    call  fs_RamdiskExecute.flags
-
 
3345
    mov   [ctrl_alt_del], 0
3370
    mov   [ctrl_alt_del], 0
3346
 
3371
  nocpustart:
3347
nocpustart:
3372
    cmp   [mouse_active], 1
3348
    cmp   [mouse_active], 1
3373
    jne   mouse_not_active
3349
    jne   mouse_not_active
3374
    mov   [mouse_active], 0
3350
    mov   [mouse_active], 0
3375
    xor   edi, edi
3351
    xor   edi, edi
3376
    mov   ecx, [TASK_COUNT]
3352
    mov   ecx,  [TASK_COUNT]
3377
   set_mouse_event:
3353
set_mouse_event:
3378
    add   edi, 256
3354
    add   edi, 256
3379
    or    [edi+SLOT_BASE+APPDATA.event_mask], dword 00100000b
3355
    or    [edi+SLOT_BASE+APPDATA.event_mask], dword 100000b
3380
    loop  set_mouse_event
-
 
3381
  mouse_not_active:
-
 
Line -... Line 3356...
-
 
3356
    loop  set_mouse_event
3382
 
3357
 
3383
 
3358
mouse_not_active:
3384
    cmp   [REDRAW_BACKGROUND],byte 0               ; background update ?
3359
    cmp   [REDRAW_BACKGROUND],byte 0               ; background update ?
3385
    jz    nobackgr
3360
    jz    nobackgr
3386
    cmp    [background_defined], 0
3361
    cmp    [background_defined], 0
3387
    jz    nobackgr
3362
    jz    nobackgr
3388
    mov   [REDRAW_BACKGROUND],byte 2
3363
    mov   [REDRAW_BACKGROUND],byte 2
3389
    call  change_task
3364
    call  change_task
3390
	mov   [draw_data+32 + RECT.left],dword 0
3365
    mov   [draw_data+32 + RECT.left],dword 0
3391
	mov   [draw_data+32 + RECT.top],dword 0
3366
    mov   [draw_data+32 + RECT.top],dword 0
3392
    mov   eax,[ScreenWidth]
3367
    mov   eax,[ScreenWidth]
3393
    mov   ebx,[ScreenHeight]
3368
    mov   ebx,[ScreenHeight]
3394
	mov   [draw_data+32 + RECT.right],eax
3369
    mov   [draw_data+32 + RECT.right],eax
3395
	mov   [draw_data+32 + RECT.bottom],ebx
3370
    mov   [draw_data+32 + RECT.bottom],ebx
3396
    call  drawbackground
3371
    call  drawbackground
Line 3397... Line 3372...
3397
    mov   [REDRAW_BACKGROUND],byte 0
3372
    mov   [REDRAW_BACKGROUND],byte 0
3398
    mov   [MOUSE_BACKGROUND],byte 0
-
 
Line 3399... Line 3373...
3399
 
3373
    mov   [MOUSE_BACKGROUND],byte 0
Line 3400... Line 3374...
3400
  nobackgr:
3374
 
3401
 
3375
nobackgr:
Line 3409... Line 3383...
3409
    sub  dl,2
3383
    sub  dl,2
Line 3410... Line 3384...
3410
 
3384
 
3411
    cmp  [SYS_SHUTDOWN],dl
3385
    cmp  [SYS_SHUTDOWN],dl
Line 3412... Line 3386...
3412
    jne  no_mark_system_shutdown
3386
    jne  no_mark_system_shutdown
3413
 
3387
 
3414
    mov   edx,0x3040
3388
    mov   edx,OS_BASE+0x3040
3415
    movzx ecx,byte [SYS_SHUTDOWN]
3389
    movzx ecx,byte [SYS_SHUTDOWN]
3416
    add   ecx,5
3390
    add   ecx,5
3417
  markz:
3391
markz:
3418
    mov   [edx+TASKDATA.state],byte 3
3392
    mov   [edx+TASKDATA.state],byte 3
Line 3419... Line 3393...
3419
    add   edx,0x20
3393
    add   edx,0x20
Line 3426... Line 3400...
3426
    dec  byte [SYS_SHUTDOWN]
3400
    dec  byte [SYS_SHUTDOWN]
Line 3427... Line 3401...
3427
 
3401
 
3428
    cmp  [SYS_SHUTDOWN],byte 0
3402
    cmp  [SYS_SHUTDOWN],byte 0
Line 3429... Line 3403...
3429
    je   system_shutdown
3403
    je   system_shutdown
Line 3430... Line 3404...
3430
 
3404
 
3431
  noshutdown:
3405
noshutdown:
3432
 
3406
 
Line 3433... Line 3407...
3433
 
3407
 
3434
    mov   eax,[TASK_COUNT]                  ; termination
3408
    mov   eax,[TASK_COUNT]                  ; termination
3435
    mov   ebx,TASK_DATA+TASKDATA.state
3409
    mov   ebx,TASK_DATA+TASKDATA.state
3436
    mov   esi,1
3410
    mov   esi,1
3437
 
3411
 
3438
  newct:
3412
newct:
Line 3448... Line 3422...
3448
    jnz   newct
3422
    jnz   newct
Line 3449... Line 3423...
3449
 
3423
 
Line 3450... Line -...
3450
    ret
-
 
3451
 
-
 
3452
 
3424
    ret
Line 3453... Line 3425...
3453
 
3425
 
Line 3454... Line 3426...
3454
 
3426
 
Line 3808... Line 3780...
3808
 
3780
 
Line 3809... Line 3781...
3809
set_io_access_rights:
3781
set_io_access_rights:
Line 3810... Line -...
3810
 
-
 
3811
     pushad
3782
 
3812
 
-
 
3813
     mov   edi,[CURRENT_TASK]
-
 
Line 3814... Line 3783...
3814
     imul  edi,tss_step
3783
     pushad
3815
     add   edi,tss_data+128
3784
 
Line 3816... Line 3785...
3816
;     add   edi,128
3785
     mov edi, tss._io_map_0
3817
 
3786
 
Line 3818... Line 3787...
3818
     mov   ecx,eax
3787
;     mov   ecx,eax
3819
     and   ecx,7    ; offset in byte
3788
;     and   ecx,7    ; offset in byte
Line 3820... Line 3789...
3820
 
3789
 
3821
     shr   eax,3    ; number of byte
3790
;     shr   eax,3    ; number of byte
Line 3822... Line 3791...
3822
     add   edi,eax
3791
;     add   edi,eax
3823
 
3792
 
-
 
3793
;     mov   ebx,1
Line 3824... Line 3794...
3824
     mov   ebx,1
3794
;     shl   ebx,cl
Line 3825... Line 3795...
3825
     shl   ebx,cl
3795
 
Line 3826... Line 3796...
3826
 
3796
     cmp   ebp,0                ; enable access - ebp = 0
Line -... Line 3797...
-
 
3797
     jne   siar1
3827
     cmp   ebp,0                ; enable access - ebp = 0
3798
 
Line 3828... Line 3799...
3828
     jne   siar1
3799
;     not   ebx
Line 3829... Line 3800...
3829
 
3800
;     and   [edi],byte bl
Line 3860... Line 3831...
3860
     mov   esi,[RESERVED_PORTS]
3831
     mov   esi,[RESERVED_PORTS]
3861
     test  esi,esi            ; no reserved areas ?
3832
     test  esi,esi            ; no reserved areas ?
3862
     je    rpal2
3833
     je    rpal2
3863
     cmp   esi,255            ; max reserved
3834
     cmp   esi,255            ; max reserved
3864
     jae   rpal1
3835
     jae   rpal1
3865
   rpal3:
3836
 rpal3:
3866
     mov   edi,esi
3837
     mov   edi,esi
3867
     shl   edi,4
3838
     shl   edi,4
3868
     add   edi,RESERVED_PORTS
3839
     add   edi,RESERVED_PORTS
3869
     cmp   ebx,[edi+8]
3840
     cmp   ebx,[edi+8]
3870
     ja    rpal4
3841
     ja    rpal4
3871
     cmp   ecx,[edi+4]
3842
     cmp   ecx,[edi+4]
3872
     jae   rpal1
3843
     jae   rpal1
3873
;     jb    rpal4
3844
;     jb    rpal4
3874
;     jmp   rpal1
3845
;     jmp   rpal1
3875
   rpal4:
3846
 rpal4:
Line 3876... Line 3847...
3876
 
3847
 
3877
     dec   esi
3848
     dec   esi
3878
     jnz   rpal3
3849
     jnz   rpal3
3879
     jmp   rpal2
3850
     jmp   rpal2
Line 4061... Line 4032...
4061
 
4032
 
Line 4062... Line 4033...
4062
syscall_putimage:                       ; PutImage
4033
syscall_putimage:                       ; PutImage
4063
 
4034
 
4064
     mov   edx,ecx
4035
     mov   edx,ecx
Line 4065... Line 4036...
4065
     mov   ecx,ebx
4036
     mov   ecx,ebx
4066
        lea     ebx, [eax+std_application_base_address]
4037
     mov   ebx, eax
4067
 
4038
 
4068
sys_putimage:
4039
sys_putimage:
Line 4073... Line 4044...
4073
     test  ecx,0xFFFF0000
4044
     test  ecx,0xFFFF0000
4074
     jnz   @f
4045
     jnz   @f
4075
  .exit:
4046
  .exit:
4076
     ret
4047
     ret
4077
 @@:
4048
 @@:
4078
        mov     edi,[CURRENT_TASK]
4049
        mov     edi,[current_slot]
4079
        shl     edi,8
-
 
4080
        add     dx,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.top]
4050
        add     dx,word[edi+APPDATA.wnd_clientbox.top]
4081
        rol     edx,16
4051
        rol     edx,16
4082
        add     dx,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.left]
4052
        add     dx,word[edi+APPDATA.wnd_clientbox.left]
4083
        rol     edx,16
4053
        rol     edx,16
4084
  .forced:
4054
  .forced:
4085
        push    ebp esi 0
4055
        push    ebp esi 0
4086
        mov     ebp, putimage_get24bpp
4056
        mov     ebp, putimage_get24bpp
4087
        mov     esi, putimage_init24bpp
4057
        mov     esi, putimage_init24bpp
Line 4103... Line 4073...
4103
        dec     [mouse_pause]
4073
        dec     [mouse_pause]
4104
        pop     ebp esi ebp
4074
        pop     ebp esi ebp
4105
        jmp     [draw_pointer]
4075
        jmp     [draw_pointer]
Line 4106... Line 4076...
4106
 
4076
 
4107
syscall_putimage_palette:
4077
syscall_putimage_palette:
4108
        lea     edi, [esi+std_application_base_address]
4078
        mov     edi, esi
4109
        mov     esi, edx
4079
        mov     esi, edx
4110
        mov     edx, ecx
4080
        mov     edx, ecx
4111
        mov     ecx, ebx
4081
        mov     ecx, ebx
4112
        lea     ebx, [eax+std_application_base_address]
4082
        mov     ebx, eax
4113
sys_putimage_palette:
4083
sys_putimage_palette:
4114
; ebx = pointer to image
4084
; ebx = pointer to image
4115
; ecx = [xsize]*65536 + [ysize]
4085
; ecx = [xsize]*65536 + [ysize]
4116
; edx = [xstart]*65536 + [ystart]
4086
; edx = [xstart]*65536 + [ystart]
Line 4176... Line 4146...
4176
; ecx x end
4146
; ecx x end
4177
	; edx y end
4147
	; edx y end
4178
; edi color
4148
; edi color
Line 4179... Line 4149...
4179
 
4149
 
4180
__sys_drawbar:
4150
__sys_drawbar:
4181
        mov     esi,[CURRENT_TASK]
-
 
4182
        shl     esi,8
4151
        mov     esi,[current_slot]
4183
        add     eax,[esi+SLOT_BASE+APPDATA.wnd_clientbox.left]
4152
        add     eax,[esi+APPDATA.wnd_clientbox.left]
4184
        add     ecx,[esi+SLOT_BASE+APPDATA.wnd_clientbox.left]
4153
        add     ecx,[esi+APPDATA.wnd_clientbox.left]
4185
        add     ebx,[esi+SLOT_BASE+APPDATA.wnd_clientbox.top]
4154
        add     ebx,[esi+APPDATA.wnd_clientbox.top]
4186
        add     edx,[esi+SLOT_BASE+APPDATA.wnd_clientbox.top]
4155
        add     edx,[esi+APPDATA.wnd_clientbox.top]
4187
  .forced:
4156
  .forced:
4188
    inc   [mouse_pause]
4157
    inc   [mouse_pause]
4189
;        call    [disable_mouse]
4158
;        call    [disable_mouse]
4190
    cmp   [SCR_MODE],word 0x12
4159
    cmp   [SCR_MODE],word 0x12
Line 4710... Line 4679...
4710
 
4679
 
4711
 
4680
 
4712
     mov   edx,[TASK_BASE]
4681
     mov   edx,[TASK_BASE]
4713
     add   eax,[edx-twdw+WDATA.box.left]
4682
     add   eax,[edx-twdw+WDATA.box.left]
4714
     add   ebx,[edx-twdw+WDATA.box.top]
-
 
4715
        mov     edi,[CURRENT_TASK]
4683
     add   ebx,[edx-twdw+WDATA.box.top]
4716
        shl     edi,8
4684
        mov     edi,[current_slot]
4717
        add     eax,[edi+SLOT_BASE+APPDATA.wnd_clientbox.left]
4685
        add     eax,[edi+APPDATA.wnd_clientbox.left]
4718
        add     ebx,[edi+SLOT_BASE+APPDATA.wnd_clientbox.top]
4686
        add     ebx,[edi+APPDATA.wnd_clientbox.top]
4719
     xor   edi,edi ; no force
4687
     xor   edi,edi ; no force
4720
;     mov   edi,1
4688
;     mov   edi,1
Line 4721... Line 4689...
4721
     call  [disable_mouse]
4689
     call  [disable_mouse]
Line 4722... Line 4690...
4722
     jmp   [putpixel]
4690
     jmp   [putpixel]
Line 4723... Line 4691...
4723
 
4691
 
4724
align 4
4692
align 4
4725
 
4693
 
4726
syscall_writetext:                      ; WriteText
4694
syscall_writetext:                      ; WriteText
4727
 
-
 
4728
     mov   edi,[TASK_BASE]
4695
 
4729
     mov   ebp,[edi-twdw+WDATA.box.left]
4696
        mov   edi,[TASK_BASE]
4730
        push    esi
4697
        mov   ebp,[edi-twdw+WDATA.box.left]
4731
        mov     esi,[CURRENT_TASK]
4698
        push  esi
4732
        shl     esi,8
4699
        mov   esi,[current_slot]
4733
        add     ebp,[esi+SLOT_BASE+APPDATA.wnd_clientbox.left]
4700
        add   ebp,[esi+APPDATA.wnd_clientbox.left]
4734
     shl   ebp,16
4701
        shl   ebp,16
4735
     add   ebp,[edi-twdw+WDATA.box.top]
4702
        add   ebp,[edi-twdw+WDATA.box.top]
4736
        add     bp,word[esi+SLOT_BASE+APPDATA.wnd_clientbox.top]
4703
        add   bp,word[esi+APPDATA.wnd_clientbox.top]
Line 4737... Line 4704...
4737
        pop     esi
4704
        pop   esi
Line 4738... Line 4705...
4738
     add   ecx,[edi+TASKDATA.mem_start]
4705
        add   ecx,[edi+TASKDATA.mem_start]
Line 4766... Line 4733...
4766
     je    drectr
4733
     je    drectr
4767
     movzx ecx,ax
4734
     movzx ecx,ax
4768
     shr   eax,16
4735
     shr   eax,16
4769
     movzx edx,bx
4736
     movzx edx,bx
4770
     shr   ebx,16
4737
     shr   ebx,16
4771
        mov     esi,[CURRENT_TASK]
4738
        mov     esi,[current_slot]
4772
        shl     esi,8
-
 
4773
        add     eax,[esi+SLOT_BASE+APPDATA.wnd_clientbox.left]
4739
        add     eax,[esi+APPDATA.wnd_clientbox.left]
4774
        add     ebx,[esi+SLOT_BASE+APPDATA.wnd_clientbox.top]
4740
        add     ebx,[esi+APPDATA.wnd_clientbox.top]
4775
     add   ecx,eax
4741
     add   ecx,eax
4776
     add   edx,ebx
4742
     add   edx,ebx
4777
     jmp   [drawbar]
4743
     jmp   [drawbar]
4778
    drectr:
4744
    drectr:
4779
     ret
4745
     ret
Line 4826... Line 4792...
4826
     inc   ecx
4792
     inc   ecx
4827
     xor   edx,edx
4793
     xor   edx,edx
4828
     div   ecx
4794
     div   ecx
4829
     mov   ebx,edx
4795
     mov   ebx,edx
4830
     xchg  eax,ebx
4796
     xchg  eax,ebx
4831
     call  dword [0xe024]
4797
     call  dword [GETPIXEL]
4832
     mov   [esp+36],ecx
4798
     mov   [esp+36],ecx
4833
     ret
4799
     ret
Line 4834... Line 4800...
4834
 
4800
 
Line 4848... Line 4814...
4848
syscall_drawline:                       ; DrawLine
4814
syscall_drawline:                       ; DrawLine
Line 4849... Line 4815...
4849
 
4815
 
4850
     mov   edi,[TASK_BASE]
4816
     mov   edi,[TASK_BASE]
4851
     movzx edx,word[edi-twdw+WDATA.box.left]
4817
     movzx edx,word[edi-twdw+WDATA.box.left]
4852
     mov   ebp,edx
4818
     mov   ebp,edx
4853
        mov     esi,[CURRENT_TASK]
-
 
4854
        shl     esi,8
4819
        mov     esi,[current_slot]
4855
        add     ebp,[esi+SLOT_BASE+APPDATA.wnd_clientbox.left]
4820
        add     ebp,[esi+APPDATA.wnd_clientbox.left]
4856
        add     dx,word[esi+SLOT_BASE+APPDATA.wnd_clientbox.left]
4821
        add     dx,word[esi+APPDATA.wnd_clientbox.left]
4857
     shl   edx,16
4822
     shl   edx,16
4858
     add   ebp,edx
4823
     add   ebp,edx
4859
     movzx edx,word[edi-twdw+WDATA.box.top]
4824
     movzx edx,word[edi-twdw+WDATA.box.top]
4860
     add   eax,ebp
4825
     add   eax,ebp
4861
     mov   ebp,edx
4826
     mov   ebp,edx
4862
        add     ebp,[esi+SLOT_BASE+APPDATA.wnd_clientbox.top]
4827
        add     ebp,[esi+APPDATA.wnd_clientbox.top]
4863
        add     dx,word[esi+SLOT_BASE+APPDATA.wnd_clientbox.top]
4828
        add     dx,word[esi+APPDATA.wnd_clientbox.top]
4864
     shl   edx,16
4829
     shl   edx,16
4865
     xor   edi,edi
4830
     xor   edi,edi
4866
     add   edx,ebp
4831
     add   edx,ebp
4867
     add   ebx,edx
4832
     add   ebx,edx
Line 4959... Line 4924...
4959
    jne    @f
4924
    jne    @f
4960
    or    [esp + 56], byte 1    ; error
4925
    or    [esp + 56], byte 1    ; error
4961
    mov    [esp + 36], dword 8    ; 32-bit protected-mode interface not supported
4926
    mov    [esp + 36], dword 8    ; 32-bit protected-mode interface not supported
4962
    ret
4927
    ret
Line -... Line 4928...
-
 
4928
 
4963
 
4929
@@:
4964
@@:    xchg    eax, ecx
4930
    xchg    eax, ecx
Line 4965... Line 4931...
4965
    xchg    ebx, ecx
4931
    xchg    ebx, ecx
4966
 
4932
 
4967
    cmp    al, 3
4933
    cmp    al, 3
Line 4971... Line 4937...
4971
    mov    [esp + 36], eax
4937
    mov    [esp + 36], eax
4972
    shr    eax, 16
4938
    shr    eax, 16
4973
    mov    [esp + 32], eax
4939
    mov    [esp + 32], eax
4974
    ret
4940
    ret
Line -... Line 4941...
-
 
4941
 
-
 
4942
@@:
-
 
4943
 
-
 
4944
    mov esi, [master_tab+(OS_BASE shr 20)]
-
 
4945
    xchg [master_tab], esi
-
 
4946
    push esi
-
 
4947
    mov edi, cr3
-
 
4948
    mov cr3, edi                 ;flush TLB
4975
 
4949
 
-
 
4950
    call    pword [apm_entry]    ; call APM BIOS
-
 
4951
 
-
 
4952
    xchg eax, [esp]
-
 
4953
    mov [master_tab], eax
-
 
4954
    mov eax, cr3
-
 
4955
    mov cr3, eax
-
 
4956
    pop eax
4976
@@:    call    pword [apm_entry]    ; call APM BIOS
4957
 
4977
    mov    [esp + 8 ], edi
4958
    mov    [esp + 8 ], edi
4978
    mov    [esp + 12], esi
4959
    mov    [esp + 12], esi
4979
    mov    [esp + 24], ebx
4960
    mov    [esp + 24], ebx
4980
    mov    [esp + 28], edx
4961
    mov    [esp + 28], edx
4981
    mov    [esp + 32], ecx
4962
    mov    [esp + 32], ecx
4982
    mov    [esp + 36], eax
4963
    mov    [esp + 36], eax
4983
    setc    al
4964
    setc    al
4984
    and    [esp + 56], byte 0xfe
4965
    and    [esp + 56], byte 0xfe
-
 
4966
    or    [esp + 56], al
-
 
4967
 
4985
    or    [esp + 56], al
4968
 
4986
    ret
4969
    ret
Line 4987... Line 4970...
4987
; -----------------------------------------
4970
; -----------------------------------------
Line 4988... Line 4971...
4988
 
4971
 
Line 4989... Line 4972...
4989
align 4
4972
align 4
4990
 
4973
 
Line -... Line 4974...
-
 
4974
undefined_syscall:                      ; Undefined system call
-
 
4975
 
Line 4991... Line -...
4991
undefined_syscall:                      ; Undefined system call
-
 
4992
 
-
 
4993
     mov   [esp+36],dword -1
-
 
4994
     ret
-
 
4995
 
-
 
4996
 
-
 
4997
;clear_busy_flag_at_caller:
4976
     mov   [esp+36],dword -1
4998
 
-
 
4999
;      push  edi
4977
     ret
5000
 
-
 
5001
;      mov   edi,[CURRENT_TASK]    ; restore processes tss pointer in gdt, busyfl?
4978
 
5002
;      imul  edi,8
-
 
5003
;      mov   [edi+gdts+ tss0 +5], word 01010000b *256 +11101001b
-
 
5004
 
-
 
5005
;      pop   edi
4979
align 4
5006
 
-
 
5007
;      ret
-
 
5008
 
4980
system_shutdown:          ; shut down the system
5009
 
4981
 
5010
keymap:
-
 
5011
 
4982
           cmp byte [BOOT_VAR+0x9030], 1
5012
     db   '6',27
-
 
5013
     db   '1234567890-=',8,9
-
 
5014
     db   'qwertyuiop[]',13
-
 
5015
     db   '~asdfghjkl;',39,96,0,'\zxcvbnm,./',0,'45 '
4983
           jne @F
5016
     db   '@234567890123',180,178,184,'6',176,'7'
-
 
5017
     db   179,'8',181,177,183,185,182
4984
           ret
5018
     db   'AB
4985
@@:
5019
     db   'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-
 
5020
     db   'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
4986
           call stop_all_services
5021
     db   'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-
 
5022
 
-
 
5023
 
-
 
5024
keymap_shift:
-
 
5025
 
-
 
5026
     db   '6',27
-
 
5027
     db   '!@#$%^&*()_+',8,9
-
 
5028
     db   'QWERTYUIOP{}',13
-
 
5029
     db   '~ASDFGHJKL:"~',0,'|ZXCVBNM<>?',0,'45 '
-
 
5030
     db   '@234567890123',180,178,184,'6',176,'7'
-
 
5031
     db   179,'8',181,177,183,185,182
4987
           push 3                ; stop playing cd
5032
     db   'AB>D',255,'FGHIJKLMNOPQRSTUVWXYZ'
4988
           pop  eax
5033
     db   'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-
 
5034
     db   'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
4989
           call sys_cd_audio
5035
     db   'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
4990
 
5036
 
4991
yes_shutdown_param:
5037
 
-
 
5038
keymap_alt:
4992
           cli
5039
 
4993
 
5040
     db   ' ',27
-
 
5041
     db   ' @ $  {[]}\ ',8,9
-
 
5042
     db   '            ',13
-
 
5043
     db   '             ',0,'           ',0,'4',0,' '
4994
           mov  eax, kernel_file ; load kernel.mnt to 0x8000:0
5044
     db   '             ',180,178,184,'6',176,'7'
4995
           push 12
5045
     db   179,'8',181,177,183,185,182
-
 
-
 
4996
           pop  esi
5046
     db   'ABCD',255,'FGHIJKLMNOPQRSTUVWXYZ'
4997
           xor  ebx,ebx
5047
     db   'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
4998
           or   ecx,-1
5048
     db   'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
4999
           mov  edx, OS_BASE+0x80000
5049
     db   'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
5000
           call fileread
5050
 
-
 
5051
 
-
 
5052
; device irq owners
-
 
5053
uglobal
-
 
5054
irq_owner:       ; process id
-
 
5055
 
-
 
5056
     dd   0x0
-
 
5057
     dd   0x0
-
 
5058
     dd   0x0
-
 
5059
     dd   0x0
-
 
5060
     dd   0x0
-
 
5061
     dd   0x0
5001
 
5062
     dd   0x0
5002
           mov  esi, restart_kernel_4000+OS_BASE+0x10000 ; move kernel re-starter to 0x4000:0
5063
     dd   0x0
5003
           mov  edi,OS_BASE+0x40000
5064
     dd   0x0
5004
           mov  ecx,1000
5065
     dd   0x0
5005
           rep  movsb
5066
     dd   0x0
-
 
5067
     dd   0x0
-
 
5068
     dd   0x0
5006
 
5069
     dd   0x0
5007
           mov  esi,OS_BASE+0x2F0000    ; restore 0x0 - 0xffff
5070
     dd   0x0
-
 
5071
     dd   0x0
-
 
5072
endg
-
 
5073
 
-
 
5074
 
-
 
5075
; on irq read ports
-
 
5076
uglobal
-
 
5077
  irq00read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5078
  irq01read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5079
  irq02read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5080
  irq03read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5081
  irq04read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5082
  irq05read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5083
  irq06read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5084
  irq07read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5085
  irq08read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5086
  irq09read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5087
  irq10read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5088
  irq11read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5089
  irq12read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5090
  irq13read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5091
  irq14read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5092
  irq15read  dd  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-
 
5093
endg
-
 
5094
 
5008
           mov  edi, OS_BASE
5095
; status
-
 
5096
uglobal
-
 
5097
  hd1_status                  dd 0x0  ; 0 - free : other - pid
-
 
5098
  application_table_status    dd 0x0  ; 0 - free : other - pid
5009
           mov  ecx,0x10000/4
5099
endg
-
 
5100
 
5010
           cld
5101
; device addresses
5011
           rep movsd
5102
uglobal
5012
 
5103
  mididp     dd 0x0
5013
           call restorefatchain
5104
  midisp     dd 0x0
-
 
5105
 
5014
 
5106
  cdbase     dd 0x0
-
 
5107
  cdid       dd 0x0
5015
           mov al, 0xFF
5108
 
5016
           out 0x21, al
5109
  hdbase              dd   0x0  ; for boot 0x1f0
-
 
5110
  hdid                dd   0x0
5017
           out 0xA1, al
5111
  hdpos               dd   0x0  ; for boot 0x1
5018
 
5112
  fat32part           dd   0x0  ; for boot 0x1
-
 
5113
 
-
 
5114
  ;part2_ld            dd   0x0
-
 
5115
 
-
 
5116
;* start code - Mario79
5019
           mov  word [OS_BASE+0x467+0],pr_mode_exit
5117
mouse_pause         dd   0
5020
           mov  word [OS_BASE+0x467+2],0x1000
5118
MouseTickCounter    dd   0
5021
 
5119
ps2_mouse_detected  db   0
5022
           mov  al,0x0F
5120
com1_mouse_detected db   0
-
 
5121
com2_mouse_detected db   0
-
 
5122
;* end code - Mario79
5023
           out  0x70,al
Line 5123... Line -...
5123
 
-
 
5124
wraw_bacground_select db 0
-
 
Line 5125... Line -...
5125
  lba_read_enabled    dd   0x0  ; 0 = disabled , 1 = enabled
-
 
5126
  pci_access_enabled  dd   0x0  ; 0 = disabled , 1 = enabled
-
 
5127
 
5024
           mov  al,0x05
5128
  sb16       dd 0x0
-
 
5129
 
-
 
5130
  buttontype         dd 0x0
-
 
Line 5131... Line -...
5131
  windowtypechanged  dd 0x0
-
 
5132
 
-
 
5133
align 4
-
 
5134
  cpu_caps    dd 4 dup(0)
-
 
5135
  pg_data  PG_DATA
-
 
5136
  heap_test   dd ?
-
 
5137
  hd_entries  rd 1     ;unused ? 0xfe10
5025
           out  0x71,al
5138
endg
-
 
5139
 
-
 
Line 5140... Line -...
5140
iglobal
-
 
5141
  keyboard   dd 0x1
-
 
5142
  sound_dma  dd 0x1
-
 
5143
  syslang    dd 0x1
5026
 
5144
endg
5027
           mov  al,0xFE
Line 5145... Line -...
5145
 
-
 
5146
if __DEBUG__ eq 1
-
 
5147
  include_debug_strings
-