2005-10-06 19:56:22 +02:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;
|
2007-03-26 14:18:08 +02:00
|
|
|
|
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved.
|
|
|
|
|
;; PROGRAMMING:
|
|
|
|
|
;; Ivan Poddubny
|
|
|
|
|
;; Marat Zakiyanov (Mario79)
|
|
|
|
|
;; VaStaNi
|
|
|
|
|
;; Trans
|
|
|
|
|
;; Mihail Semenyako (mike.dld)
|
|
|
|
|
;; Sergey Kuzmin (Wildwest)
|
|
|
|
|
;; Andrey Halyavin (halyavin)
|
|
|
|
|
;; Mihail Lisovin (Mihasik)
|
|
|
|
|
;; Andrey Ignatiev (andrew_programmer)
|
|
|
|
|
;; NoName
|
|
|
|
|
;; Evgeny Grechnikov (Diamond)
|
|
|
|
|
;; Iliya Mihailov (Ghost)
|
|
|
|
|
;; Sergey Semyonov (Serge)
|
|
|
|
|
;; Johnny_B
|
2005-10-06 19:56:22 +02:00
|
|
|
|
;;
|
2007-03-26 14:18:08 +02:00
|
|
|
|
;; Data in this file was originally part of MenuetOS project which is
|
|
|
|
|
;; distributed under the terms of GNU GPL. It is modified and redistributed as
|
|
|
|
|
;; part of KolibriOS project under the terms of GNU GPL.
|
2005-10-06 19:56:22 +02:00
|
|
|
|
;;
|
2007-03-26 14:18:08 +02:00
|
|
|
|
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa
|
|
|
|
|
;; PROGRAMMING:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
;;
|
2007-03-26 14:18:08 +02:00
|
|
|
|
;; Ville Mikael Turjanmaa, villemt@itu.jyu.fi
|
|
|
|
|
;; - main os coding/design
|
|
|
|
|
;; Jan-Michael Brummer, BUZZ2@gmx.de
|
|
|
|
|
;; Felix Kaiser, info@felix-kaiser.de
|
|
|
|
|
;; Paolo Minazzi, paolo.minazzi@inwind.it
|
|
|
|
|
;; quickcode@mail.ru
|
|
|
|
|
;; Alexey, kgaz@crosswinds.net
|
|
|
|
|
;; Juan M. Caravaca, bitrider@wanadoo.es
|
|
|
|
|
;; kristol@nic.fi
|
|
|
|
|
;; Mike Hibbett, mikeh@oceanfree.net
|
|
|
|
|
;; Lasse Kuusijarvi, kuusijar@lut.fi
|
|
|
|
|
;; Jarek Pelczar, jarekp3@wp.pl
|
|
|
|
|
;;
|
|
|
|
|
;; KolibriOS is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
|
;; WARRANTY. No author or distributor accepts responsibility to anyone for the
|
|
|
|
|
;; consequences of using it or for whether it serves any particular purpose or
|
|
|
|
|
;; works at all, unless he says so in writing. Refer to the GNU General Public
|
|
|
|
|
;; License (the "GPL") for full details.
|
|
|
|
|
;
|
|
|
|
|
;; Everyone is granted permission to copy, modify and redistribute KolibriOS,
|
|
|
|
|
;; but only under the conditions described in the GPL. A copy of this license
|
|
|
|
|
;; is supposed to have been given to you along with KolibriOS so you can know
|
|
|
|
|
;; your rights and responsibilities. It should be in a file named COPYING.
|
|
|
|
|
;; Among other things, the copyright notice and this notice must be preserved
|
|
|
|
|
;; on all copies.
|
2005-10-06 19:56:22 +02:00
|
|
|
|
;;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2007-03-22 02:09:49 +01:00
|
|
|
|
|
|
|
|
|
include 'macros.inc'
|
|
|
|
|
|
2007-03-21 23:58:33 +01:00
|
|
|
|
$Revision$
|
2007-03-22 02:09:49 +01:00
|
|
|
|
|
2006-10-06 08:09:41 +02:00
|
|
|
|
include "proc32.inc"
|
2005-10-14 17:40:15 +02:00
|
|
|
|
include "kglobals.inc"
|
2005-10-06 19:56:22 +02:00
|
|
|
|
include "lang.inc"
|
|
|
|
|
|
2006-10-06 08:09:41 +02:00
|
|
|
|
include "const.inc"
|
2007-04-18 08:37:14 +02:00
|
|
|
|
max_processes equ 255
|
|
|
|
|
tss_step equ (128+8192) ; tss & i/o - 65535 ports, * 256=557056*4
|
2006-10-06 08:09:41 +02:00
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
os_stack equ (os_data_l-gdts) ; GDTs
|
|
|
|
|
os_code equ (os_code_l-gdts)
|
|
|
|
|
graph_data equ (3+graph_data_l-gdts)
|
|
|
|
|
tss0 equ (tss0_l-gdts)
|
|
|
|
|
app_code equ (3+app_code_l-gdts)
|
|
|
|
|
app_data equ (3+app_data_l-gdts)
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;;
|
|
|
|
|
;; Included files:
|
|
|
|
|
;;
|
|
|
|
|
;; Kernel16.inc
|
|
|
|
|
;; - Booteng.inc English text for bootup
|
|
|
|
|
;; - Bootcode.inc Hardware setup
|
|
|
|
|
;; - Pci16.inc PCI functions
|
|
|
|
|
;;
|
|
|
|
|
;; Kernel32.inc
|
|
|
|
|
;; - Sys32.inc Process management
|
|
|
|
|
;; - Shutdown.inc Shutdown and restart
|
|
|
|
|
;; - Fat32.inc Read / write hd
|
|
|
|
|
;; - Vesa12.inc Vesa 1.2 driver
|
|
|
|
|
;; - Vesa20.inc Vesa 2.0 driver
|
|
|
|
|
;; - Vga.inc VGA driver
|
|
|
|
|
;; - Stack.inc Network interface
|
|
|
|
|
;; - Mouse.inc Mouse pointer
|
|
|
|
|
;; - Scincode.inc Window skinning
|
|
|
|
|
;; - Pci32.inc PCI functions
|
|
|
|
|
;;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;; 16 BIT ENTRY FROM BOOTSECTOR ;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
use16
|
2007-03-23 04:11:34 +01:00
|
|
|
|
org 0x0
|
|
|
|
|
jmp start_of_code
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
version db 'Kolibri OS version 0.6.5.0 ',13,10,13,10,0
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
include "boot/bootstr.inc" ; language-independent boot messages
|
|
|
|
|
include "boot/preboot.inc"
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
if lang eq en
|
|
|
|
|
include "boot/booteng.inc" ; english system boot messages
|
|
|
|
|
else if lang eq ru
|
|
|
|
|
include "boot/bootru.inc" ; russian system boot messages
|
|
|
|
|
include "boot/ru.inc" ; Russian font
|
|
|
|
|
else if lang eq et
|
|
|
|
|
include "boot/bootet.inc" ; estonian system boot messages
|
|
|
|
|
include "boot/et.inc" ; Estonian font
|
|
|
|
|
else
|
|
|
|
|
include "boot/bootge.inc" ; german system boot messages
|
|
|
|
|
end if
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
include "boot/bootcode.inc" ; 16 bit system boot code
|
|
|
|
|
include "bus/pci/pci16.inc"
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;; SWITCH TO 32 BIT PROTECTED MODE ;;
|
|
|
|
|
;; ;;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; CR0 Flags - Protected mode and Paging
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov ecx, CR0_PE
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
; Enabling 32 bit protected mode
|
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
sidt [cs:old_ints_h]
|
2007-03-23 04:11:34 +01:00
|
|
|
|
|
|
|
|
|
cli ; disable all irqs
|
|
|
|
|
cld
|
|
|
|
|
mov al,255 ; mask all irqs
|
|
|
|
|
out 0xa1,al
|
|
|
|
|
out 0x21,al
|
|
|
|
|
l.5: in al, 0x64 ; Enable A20
|
|
|
|
|
test al, 2
|
|
|
|
|
jnz l.5
|
|
|
|
|
mov al, 0xD1
|
|
|
|
|
out 0x64, al
|
|
|
|
|
l.6: in al, 0x64
|
|
|
|
|
test al, 2
|
|
|
|
|
jnz l.6
|
|
|
|
|
mov al, 0xDF
|
|
|
|
|
out 0x60, al
|
|
|
|
|
l.7: in al, 0x64
|
|
|
|
|
test al, 2
|
|
|
|
|
jnz l.7
|
|
|
|
|
mov al, 0xFF
|
|
|
|
|
out 0x64, al
|
2007-04-18 08:37:14 +02:00
|
|
|
|
|
|
|
|
|
lgdt [cs:tmp_gdt] ; Load GDT
|
|
|
|
|
mov eax, cr0 ; protected mode
|
2007-03-23 04:11:34 +01:00
|
|
|
|
or eax, ecx
|
|
|
|
|
and eax, 10011111b *65536*256 + 0xffffff ; caching enabled
|
|
|
|
|
mov cr0, eax
|
|
|
|
|
jmp pword os_code:B32 ; jmp to enable 32 bit mode
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
align 8
|
|
|
|
|
tmp_gdt:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
dw 23
|
|
|
|
|
dd tmp_gdt+0x10000
|
|
|
|
|
dw 0
|
2007-02-25 15:20:50 +01:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
dw 0xffff
|
|
|
|
|
dw 0x0000
|
|
|
|
|
db 0x00
|
|
|
|
|
dw 11011111b *256 +10011010b
|
|
|
|
|
db 0x00
|
2006-10-16 14:17:49 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
dw 0xffff
|
|
|
|
|
dw 0x0000
|
|
|
|
|
db 0x00
|
|
|
|
|
dw 11011111b *256 +10010010b
|
|
|
|
|
db 0x00
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
include "data16.inc"
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
use32
|
|
|
|
|
org $+0x10000
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
align 4
|
|
|
|
|
B32:
|
|
|
|
|
mov ax,os_stack ; Selector for os
|
|
|
|
|
mov ds,ax
|
|
|
|
|
mov es,ax
|
|
|
|
|
mov fs,ax
|
|
|
|
|
mov gs,ax
|
|
|
|
|
mov ss,ax
|
|
|
|
|
mov esp,0x3ec00 ; Set stack
|
|
|
|
|
|
|
|
|
|
; CLEAR 0x280000 - HEAP_BASE
|
|
|
|
|
|
|
|
|
|
xor eax,eax
|
|
|
|
|
mov edi,0x280000
|
|
|
|
|
mov ecx,(HEAP_BASE-OS_BASE-0x280000) / 4
|
|
|
|
|
cld
|
|
|
|
|
rep stosd
|
|
|
|
|
|
|
|
|
|
mov edi,0x40000
|
|
|
|
|
mov ecx,(0x90000-0x40000)/4
|
|
|
|
|
rep stosd
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
; CLEAR KERNEL UNDEFINED GLOBALS
|
|
|
|
|
mov edi, endofcode-OS_BASE
|
|
|
|
|
mov ecx, (uglobals_size/4)+4
|
|
|
|
|
rep stosd
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
; SAVE & CLEAR 0-0xffff
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
xor esi, esi
|
|
|
|
|
mov edi,0x2F0000
|
|
|
|
|
mov ecx,0x10000 / 4
|
|
|
|
|
rep movsd
|
|
|
|
|
xor edi, edi
|
|
|
|
|
mov ecx,0x10000 / 4
|
|
|
|
|
rep stosd
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
call test_cpu
|
|
|
|
|
bts [cpu_caps-OS_BASE], CAPS_TSC ;force use rdtsc
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
; MEMORY MODEL
|
|
|
|
|
call mem_test
|
|
|
|
|
call init_mem
|
|
|
|
|
call init_page_map
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
; ENABLE PAGING
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov eax, sys_pgdir-OS_BASE
|
|
|
|
|
mov cr3, eax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov eax,cr0
|
|
|
|
|
or eax,CR0_PG+CR0_WP
|
|
|
|
|
mov cr0,eax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
lgdt [gdts]
|
|
|
|
|
jmp pword os_code:high_code
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-05-20 12:01:18 +02:00
|
|
|
|
align 4
|
|
|
|
|
tmp_page_tabs dd ?
|
2007-05-16 15:43:21 +02:00
|
|
|
|
use16
|
|
|
|
|
org $-0x10000
|
|
|
|
|
include "boot/shutdown.inc" ; shutdown or restart
|
|
|
|
|
org $+0x10000
|
|
|
|
|
use32
|
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
__DEBUG__ fix 1
|
|
|
|
|
__DEBUG_LEVEL__ fix 1
|
|
|
|
|
include 'init.inc'
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
org OS_BASE+$
|
2007-02-28 11:51:05 +01:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
align 4
|
|
|
|
|
high_code:
|
2007-05-23 13:26:19 +02:00
|
|
|
|
mov ax,os_stack
|
|
|
|
|
mov bx,app_data
|
|
|
|
|
mov ss,ax
|
|
|
|
|
add esp, OS_BASE
|
|
|
|
|
|
|
|
|
|
mov ds,bx
|
|
|
|
|
mov es,bx
|
|
|
|
|
mov fs,bx
|
|
|
|
|
mov gs,bx
|
|
|
|
|
|
|
|
|
|
bt [cpu_caps], CAPS_PGE
|
|
|
|
|
jnc @F
|
|
|
|
|
|
|
|
|
|
or dword [sys_pgdir+(OS_BASE shr 20)], PG_GLOBAL
|
|
|
|
|
|
|
|
|
|
mov ebx, cr4
|
|
|
|
|
or ebx, CR4_PGE
|
|
|
|
|
mov cr4, ebx
|
|
|
|
|
@@:
|
|
|
|
|
xor eax, eax
|
|
|
|
|
mov dword [sys_pgdir], eax
|
|
|
|
|
mov dword [sys_pgdir+4], eax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov eax, cr3
|
|
|
|
|
mov cr3, eax ; flush TLB
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
; SAVE REAL MODE VARIABLES
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov ax, [BOOT_VAR + 0x9031]
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov [IDEContrRegsBaseAddr], ax
|
2006-05-06 16:34:30 +02:00
|
|
|
|
; --------------- APM ---------------------
|
2007-04-18 08:37:14 +02:00
|
|
|
|
|
|
|
|
|
; init selectors
|
|
|
|
|
mov ebx, [BOOT_VAR+0x9040] ; offset of APM entry point
|
|
|
|
|
movzx eax, word [BOOT_VAR+0x9050] ; real-mode segment base address of
|
|
|
|
|
; protected-mode 32-bit code segment
|
|
|
|
|
movzx ecx, word [BOOT_VAR+0x9052] ; real-mode segment base address of
|
|
|
|
|
; protected-mode 16-bit code segment
|
|
|
|
|
movzx edx, word [BOOT_VAR+0x9054] ; real-mode segment base address of
|
|
|
|
|
; protected-mode 16-bit data segment
|
|
|
|
|
|
|
|
|
|
shl eax, 4
|
|
|
|
|
mov [dword apm_code_32 + 2], ax
|
|
|
|
|
shr eax, 16
|
|
|
|
|
mov [dword apm_code_32 + 4], al
|
|
|
|
|
|
|
|
|
|
shl ecx, 4
|
|
|
|
|
mov [dword apm_code_16 + 2], cx
|
|
|
|
|
shr ecx, 16
|
|
|
|
|
mov [dword apm_code_16 + 4], cl
|
|
|
|
|
|
|
|
|
|
shl edx, 4
|
|
|
|
|
mov [dword apm_data_16 + 2], dx
|
|
|
|
|
shr edx, 16
|
|
|
|
|
mov [dword apm_data_16 + 4], dl
|
|
|
|
|
|
|
|
|
|
mov dword[apm_entry], ebx
|
2006-05-06 16:34:30 +02:00
|
|
|
|
mov word [apm_entry + 4], apm_code_32 - gdts
|
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov eax, [BOOT_VAR + 0x9044] ; version & flags
|
2006-05-06 16:34:30 +02:00
|
|
|
|
mov [apm_vf], eax
|
|
|
|
|
; -----------------------------------------
|
2007-04-18 08:37:14 +02:00
|
|
|
|
; movzx eax,byte [BOOT_VAR+0x9010] ; mouse port
|
2005-10-06 19:56:22 +02:00
|
|
|
|
; mov [0xF604],byte 1 ;al
|
2007-05-21 15:25:02 +02:00
|
|
|
|
mov al, [BOOT_VAR+0x901F] ; DMA access
|
|
|
|
|
mov [allow_dma_access], al
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov al,[BOOT_VAR+0x9000] ; bpp
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov [ScreenBPP],al
|
2007-04-18 08:37:14 +02:00
|
|
|
|
movzx eax,word [BOOT_VAR+0x900A] ; X max
|
2007-03-23 04:11:34 +01:00
|
|
|
|
dec eax
|
|
|
|
|
mov [ScreenWidth],eax
|
|
|
|
|
mov [screen_workarea.right],eax
|
2007-04-18 08:37:14 +02:00
|
|
|
|
movzx eax,word [BOOT_VAR+0x900C] ; Y max
|
2007-03-23 04:11:34 +01:00
|
|
|
|
dec eax
|
|
|
|
|
mov [ScreenHeight],eax
|
|
|
|
|
mov [screen_workarea.bottom],eax
|
2007-04-18 08:37:14 +02:00
|
|
|
|
movzx eax,word [BOOT_VAR+0x9008] ; screen mode
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov [SCR_MODE],eax
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov eax,[BOOT_VAR+0x9014] ; Vesa 1.2 bnk sw add
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov [BANK_SWITCH],eax
|
|
|
|
|
mov [BytesPerScanLine],word 640*4 ; Bytes PerScanLine
|
|
|
|
|
cmp [SCR_MODE],word 0x13 ; 320x200
|
|
|
|
|
je @f
|
|
|
|
|
cmp [SCR_MODE],word 0x12 ; VGA 640x480
|
|
|
|
|
je @f
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov ax,[BOOT_VAR+0x9001] ; for other modes
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov [BytesPerScanLine],ax
|
2007-04-18 08:37:14 +02:00
|
|
|
|
@@:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
; GRAPHICS ADDRESSES
|
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov byte [BOOT_VAR+0x901e],0x0
|
|
|
|
|
mov eax,[BOOT_VAR+0x9018]
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov [LFBAddress],eax
|
|
|
|
|
|
|
|
|
|
cmp [SCR_MODE],word 0100000000000000b
|
|
|
|
|
jge setvesa20
|
|
|
|
|
cmp [SCR_MODE],word 0x13
|
|
|
|
|
je v20ga32
|
|
|
|
|
mov [PUTPIXEL],dword Vesa12_putpixel24 ; Vesa 1.2
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov [GETPIXEL],dword Vesa12_getpixel24
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp [ScreenBPP],byte 24
|
|
|
|
|
jz ga24
|
|
|
|
|
mov [PUTPIXEL],dword Vesa12_putpixel32
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov [GETPIXEL],dword Vesa12_getpixel32
|
2005-10-06 19:56:22 +02:00
|
|
|
|
ga24:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
jmp v20ga24
|
2005-10-06 19:56:22 +02:00
|
|
|
|
setvesa20:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov [PUTPIXEL],dword Vesa20_putpixel24 ; Vesa 2.0
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov [GETPIXEL],dword Vesa20_getpixel24
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp [ScreenBPP],byte 24
|
|
|
|
|
jz v20ga24
|
2005-10-06 19:56:22 +02:00
|
|
|
|
v20ga32:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov [PUTPIXEL],dword Vesa20_putpixel32
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov [GETPIXEL],dword Vesa20_getpixel32
|
2005-10-06 19:56:22 +02:00
|
|
|
|
v20ga24:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp [SCR_MODE],word 0x12 ; 16 C VGA 640x480
|
|
|
|
|
jne no_mode_0x12
|
|
|
|
|
mov [PUTPIXEL],dword VGA_putpixel
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov [GETPIXEL],dword Vesa20_getpixel32
|
2005-10-06 19:56:22 +02:00
|
|
|
|
no_mode_0x12:
|
|
|
|
|
|
2007-02-25 15:20:50 +01:00
|
|
|
|
; -------- Fast System Call init ----------
|
2007-02-27 12:47:52 +01:00
|
|
|
|
; Intel SYSENTER/SYSEXIT (AMD CPU support it too)
|
2007-03-23 04:11:34 +01:00
|
|
|
|
bt [cpu_caps], CAPS_SEP
|
|
|
|
|
jnc .SEnP ; SysEnter not Present
|
|
|
|
|
xor edx, edx
|
|
|
|
|
mov ecx, MSR_SYSENTER_CS
|
|
|
|
|
mov eax, os_code
|
|
|
|
|
wrmsr
|
|
|
|
|
mov ecx, MSR_SYSENTER_ESP
|
2007-03-28 16:51:04 +02:00
|
|
|
|
; mov eax, sysenter_stack ; Check it
|
|
|
|
|
xor eax, eax
|
2007-03-23 04:11:34 +01:00
|
|
|
|
wrmsr
|
|
|
|
|
mov ecx, MSR_SYSENTER_EIP
|
|
|
|
|
mov eax, sysenter_entry
|
|
|
|
|
wrmsr
|
2007-02-25 15:20:50 +01:00
|
|
|
|
.SEnP:
|
2007-02-27 12:47:52 +01:00
|
|
|
|
; AMD SYSCALL/SYSRET
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp byte[cpu_vendor], 'A'
|
|
|
|
|
jne .noSYSCALL
|
|
|
|
|
mov eax, 0x80000001
|
|
|
|
|
cpuid
|
|
|
|
|
test edx, 0x800 ; bit_11 - SYSCALL/SYSRET support
|
|
|
|
|
jz .noSYSCALL
|
|
|
|
|
mov ecx, MSR_AMD_EFER
|
|
|
|
|
rdmsr
|
|
|
|
|
or eax, 1 ; bit_0 - System Call Extension (SCE)
|
|
|
|
|
wrmsr
|
2007-02-25 15:20:50 +01:00
|
|
|
|
|
|
|
|
|
; !!!! It`s dirty hack, fix it !!!
|
|
|
|
|
; Bits of EDX :
|
|
|
|
|
; Bit 31<33>16 During the SYSRET instruction, this field is copied into the CS register
|
|
|
|
|
; and the contents of this field, plus 8, are copied into the SS register.
|
|
|
|
|
; Bit 15<31>0 During the SYSCALL instruction, this field is copied into the CS register
|
|
|
|
|
; and the contents of this field, plus 8, are copied into the SS register.
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
; mov edx, (os_code + 16) * 65536 + os_code
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov edx, 0x1B0008
|
2007-02-25 15:20:50 +01:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov eax, syscall_entry
|
|
|
|
|
mov ecx, MSR_AMD_STAR
|
|
|
|
|
wrmsr
|
2007-02-25 15:20:50 +01:00
|
|
|
|
.noSYSCALL:
|
|
|
|
|
; -----------------------------------------
|
2006-10-06 08:09:41 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
; LOAD IDT
|
2007-02-27 12:47:52 +01:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
call build_interrupt_table
|
|
|
|
|
lidt [idtreg]
|
2006-10-06 08:09:41 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
call init_kernel_heap
|
|
|
|
|
stdcall kernel_alloc, RING0_STACK_SIZE+512
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov [os_stack_seg], eax
|
|
|
|
|
|
|
|
|
|
lea esp, [eax+RING0_STACK_SIZE]
|
|
|
|
|
|
|
|
|
|
mov [tss._ss0], os_stack
|
|
|
|
|
mov [tss._esp0], esp
|
|
|
|
|
mov [tss._esp], esp
|
|
|
|
|
mov [tss._cs],os_code
|
|
|
|
|
mov [tss._ss],os_stack
|
|
|
|
|
mov [tss._ds],app_data
|
|
|
|
|
mov [tss._es],app_data
|
|
|
|
|
mov [tss._fs],app_data
|
|
|
|
|
mov [tss._gs],app_data
|
|
|
|
|
mov [tss._io],128
|
|
|
|
|
;Add IO access table - bit array of permitted ports
|
|
|
|
|
mov edi, tss._io_map_0
|
|
|
|
|
xor eax, eax
|
|
|
|
|
not eax
|
|
|
|
|
mov ecx, 8192/4
|
|
|
|
|
rep stosd ; access to 4096*8=65536 ports
|
|
|
|
|
|
|
|
|
|
mov ax,tss0
|
|
|
|
|
ltr ax
|
|
|
|
|
|
|
|
|
|
mov [LFBSize], 0x800000
|
2007-03-23 04:11:34 +01:00
|
|
|
|
call init_LFB
|
|
|
|
|
call init_fpu
|
|
|
|
|
call init_malloc
|
2007-01-17 05:43:21 +01:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
stdcall alloc_kernel_space, 0x51000
|
|
|
|
|
mov [default_io_map], eax
|
|
|
|
|
|
|
|
|
|
add eax, 0x2000
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov [ipc_tmp], eax
|
|
|
|
|
mov ebx, 0x1000
|
2006-10-06 08:09:41 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
add eax, 0x40000
|
|
|
|
|
mov [proc_mem_map], eax
|
2006-10-06 08:09:41 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
add eax, 0x8000
|
|
|
|
|
mov [proc_mem_pdir], eax
|
2006-10-06 08:09:41 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
add eax, ebx
|
|
|
|
|
mov [proc_mem_tab], eax
|
2006-10-06 08:09:41 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
add eax, ebx
|
|
|
|
|
mov [tmp_task_pdir], eax
|
2006-10-06 08:09:41 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
add eax, ebx
|
|
|
|
|
mov [tmp_task_ptab], eax
|
2006-10-06 08:09:41 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
add eax, ebx
|
|
|
|
|
mov [ipc_pdir], eax
|
2006-10-06 08:09:41 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
add eax, ebx
|
|
|
|
|
mov [ipc_ptab], eax
|
2006-10-06 08:09:41 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
call init_events
|
|
|
|
|
mov eax, srv.fd-SRV_FD_OFFSET
|
|
|
|
|
mov [srv.fd], eax
|
|
|
|
|
mov [srv.bk], eax
|
2006-10-06 08:09:41 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov edi, irq_tab
|
|
|
|
|
xor eax, eax
|
|
|
|
|
mov ecx, 16
|
|
|
|
|
rep stosd
|
2006-02-01 07:07:36 +01:00
|
|
|
|
|
|
|
|
|
;Set base of graphic segment to linear address of LFB
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov eax,[LFBAddress] ; set for gs
|
|
|
|
|
mov [graph_data_l+2],ax
|
|
|
|
|
shr eax,16
|
|
|
|
|
mov [graph_data_l+4],al
|
|
|
|
|
mov [graph_data_l+7],ah
|
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov [CURRENT_TASK],dword 1
|
|
|
|
|
mov [TASK_COUNT],dword 1
|
|
|
|
|
mov [TASK_BASE],dword TASK_DATA
|
|
|
|
|
mov [current_slot], SLOT_BASE+256
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-24 10:56:03 +02:00
|
|
|
|
; set background
|
|
|
|
|
xor eax,eax
|
|
|
|
|
inc eax
|
|
|
|
|
mov [display_data-12],eax
|
|
|
|
|
mov [display_data-8],eax
|
|
|
|
|
mov [display_data-4],eax
|
|
|
|
|
mov [mem_BACKGROUND],4095
|
|
|
|
|
stdcall kernel_alloc, [mem_BACKGROUND]
|
|
|
|
|
mov [img_background], eax
|
|
|
|
|
|
|
|
|
|
|
2006-12-29 16:42:36 +01:00
|
|
|
|
;!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
include 'detect/disks.inc'
|
|
|
|
|
;!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
|
2007-05-24 13:27:05 +02:00
|
|
|
|
call Parser_params
|
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
; READ RAMDISK IMAGE FROM HD
|
|
|
|
|
|
|
|
|
|
;!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
include 'boot/rdload.inc'
|
|
|
|
|
;!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
; mov [dma_hdd],1
|
|
|
|
|
; CALCULATE FAT CHAIN FOR RAMDISK
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
call calculatefatchain
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
; LOAD VMODE DRIVER
|
|
|
|
|
|
|
|
|
|
;!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
include 'vmodeld.inc'
|
|
|
|
|
;!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
|
2007-05-18 15:41:21 +02:00
|
|
|
|
mov ax,[OS_BASE+0x10000+bx_from_load]
|
2007-05-11 21:38:23 +02:00
|
|
|
|
cmp ax,'r1' ; <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> - <20><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
je no_lib_load
|
|
|
|
|
; LOADING LIBRARES
|
|
|
|
|
stdcall dll.Load,@IMPORT ; SPraid - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD>)
|
2007-05-20 11:04:59 +02:00
|
|
|
|
call load_file_parse_table ; prepare file parse table
|
2007-05-16 15:43:21 +02:00
|
|
|
|
call set_kernel_conf ; configure devices and gui
|
2007-05-20 11:04:59 +02:00
|
|
|
|
mov byte [conf_file_loaded],1
|
2007-05-11 21:38:23 +02:00
|
|
|
|
no_lib_load:
|
2007-03-21 19:36:27 +01:00
|
|
|
|
|
2007-05-11 21:38:23 +02:00
|
|
|
|
; LOAD FONTS I and II
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-05-14 06:27:51 +02:00
|
|
|
|
|
2007-05-16 21:12:34 +02:00
|
|
|
|
; pushad
|
|
|
|
|
; push eax
|
|
|
|
|
; mov eax,char
|
|
|
|
|
; call file_system_lfn
|
|
|
|
|
; mov eax,char2
|
|
|
|
|
; call file_system_lfn
|
|
|
|
|
; pop eax
|
|
|
|
|
; popad
|
|
|
|
|
|
|
|
|
|
stdcall read_file, char, FONT_I, 0, 2560
|
|
|
|
|
stdcall read_file, char2, FONT_II, 0, 2560
|
2007-05-14 06:27:51 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov esi,boot_fonts
|
|
|
|
|
call boot_log
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
; PRINT AMOUNT OF MEMORY
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov esi, boot_memdetect
|
|
|
|
|
call boot_log
|
|
|
|
|
|
|
|
|
|
movzx ecx, word [boot_y]
|
|
|
|
|
or ecx, (10+29*6) shl 16 ; "Determining amount of memory"
|
|
|
|
|
sub ecx, 10
|
|
|
|
|
mov edx, 0xFFFFFF
|
|
|
|
|
mov ebx, [MEM_AMOUNT]
|
|
|
|
|
shr ebx, 20
|
|
|
|
|
mov edi, 1
|
|
|
|
|
mov eax, 0x00040000
|
|
|
|
|
call display_number_force
|
2006-02-01 07:07:36 +01:00
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
; REDIRECT ALL IRQ'S TO INT'S 0x20-0x2f
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov esi,boot_irqs
|
|
|
|
|
call boot_log
|
|
|
|
|
call rerouteirqs
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov esi,boot_tss
|
|
|
|
|
call boot_log
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
; BUILD SCHEDULER
|
|
|
|
|
|
|
|
|
|
call build_scheduler ; sys32.inc
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov esi,boot_devices
|
|
|
|
|
call boot_log
|
|
|
|
|
call detect_devices
|
2007-05-08 13:32:58 +02:00
|
|
|
|
stdcall load_driver, szPS2MDriver
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
; TIMER SET TO 1/100 S
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov esi,boot_timer
|
|
|
|
|
call boot_log
|
|
|
|
|
mov al,0x34 ; set to 100Hz
|
|
|
|
|
out 0x43,al
|
|
|
|
|
mov al,0x9b ; lsb 1193180 / 1193
|
|
|
|
|
out 0x40,al
|
|
|
|
|
mov al,0x2e ; msb
|
|
|
|
|
out 0x40,al
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
; SET MOUSE
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov esi,boot_setmouse
|
|
|
|
|
call boot_log
|
|
|
|
|
call setmouse
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov [pci_access_enabled],1
|
2006-11-27 11:07:51 +01:00
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
; SET PRELIMINARY WINDOW STACK AND POSITIONS
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov esi,boot_windefs
|
|
|
|
|
call boot_log
|
|
|
|
|
call setwindowdefaults
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
; SET BACKGROUND DEFAULTS
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov esi,boot_bgr
|
|
|
|
|
call boot_log
|
|
|
|
|
call calculatebackground
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
; RESERVE SYSTEM IRQ'S JA PORT'S
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov esi,boot_resirqports
|
|
|
|
|
call boot_log
|
|
|
|
|
call reserve_irqs_ports
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
; SET PORTS FOR IRQ HANDLERS
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov esi,boot_setrports
|
|
|
|
|
call boot_log
|
|
|
|
|
call setirqreadports
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
; SET UP OS TASK
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov esi,boot_setostask
|
|
|
|
|
call boot_log
|
|
|
|
|
|
2007-05-16 21:12:34 +02:00
|
|
|
|
xor eax, eax
|
|
|
|
|
mov dword [SLOT_BASE+APPDATA.fpu_state], fpu_data
|
|
|
|
|
mov dword [SLOT_BASE+APPDATA.fpu_handler], eax
|
|
|
|
|
mov dword [SLOT_BASE+APPDATA.sse_handler], eax
|
2007-03-23 04:11:34 +01:00
|
|
|
|
|
|
|
|
|
; name for OS/IDLE process
|
|
|
|
|
|
|
|
|
|
mov dword [SLOT_BASE+256+APPDATA.app_name], dword 'OS/I'
|
|
|
|
|
mov dword [SLOT_BASE+256+APPDATA.app_name+4], dword 'DLE '
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov edi, [os_stack_seg]
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov dword [SLOT_BASE+256+APPDATA.pl0_stack], edi
|
2007-04-18 08:37:14 +02:00
|
|
|
|
add edi, 0x2000-512
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov dword [SLOT_BASE+256+APPDATA.fpu_state], edi
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov dword [SLOT_BASE+256+APPDATA.io_map],\
|
|
|
|
|
(tss._io_map_0-OS_BASE+PG_MAP)
|
|
|
|
|
mov dword [SLOT_BASE+256+APPDATA.io_map+4],\
|
|
|
|
|
(tss._io_map_1-OS_BASE+PG_MAP)
|
2007-03-23 04:11:34 +01:00
|
|
|
|
|
|
|
|
|
mov esi, fpu_data
|
|
|
|
|
mov ecx, 512/4
|
|
|
|
|
cld
|
|
|
|
|
rep movsd
|
|
|
|
|
|
2007-05-16 21:12:34 +02:00
|
|
|
|
mov dword [SLOT_BASE+256+APPDATA.fpu_handler], eax
|
|
|
|
|
mov dword [SLOT_BASE+256+APPDATA.sse_handler], eax
|
2007-03-23 04:11:34 +01:00
|
|
|
|
|
|
|
|
|
mov ebx, SLOT_BASE+256+APP_OBJ_OFFSET
|
|
|
|
|
mov dword [SLOT_BASE+256+APPDATA.fd_obj], ebx
|
|
|
|
|
mov dword [SLOT_BASE+256+APPDATA.bk_obj], ebx
|
|
|
|
|
|
2007-05-24 13:27:05 +02:00
|
|
|
|
mov dword [SLOT_BASE+256+APPDATA.cur_dir], sysdir_path
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
; task list
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov [CURRENT_TASK],dword 1
|
|
|
|
|
mov [TASK_COUNT],dword 1
|
|
|
|
|
mov [current_slot], SLOT_BASE+256
|
|
|
|
|
mov [TASK_BASE],dword TASK_DATA
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov [TASK_DATA+TASKDATA.wnd_number], 1 ; on screen number
|
|
|
|
|
mov [TASK_DATA+TASKDATA.pid], 1 ; process id number
|
|
|
|
|
mov [TASK_DATA+TASKDATA.mem_start], 0 ; process base address
|
|
|
|
|
|
|
|
|
|
call init_cursors
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov eax, [def_cursor]
|
|
|
|
|
mov [SLOT_BASE+APPDATA.cursor],eax
|
|
|
|
|
mov [SLOT_BASE+APPDATA.cursor+256],eax
|
2007-01-19 04:58:46 +01:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
; READ TSC / SECOND
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov esi,boot_tsc
|
|
|
|
|
call boot_log
|
|
|
|
|
call _rdtsc
|
|
|
|
|
mov ecx,eax
|
|
|
|
|
mov esi,250 ; wait 1/4 a second
|
|
|
|
|
call delay_ms
|
|
|
|
|
call _rdtsc
|
|
|
|
|
sub eax,ecx
|
|
|
|
|
shl eax,2
|
|
|
|
|
mov [CPU_FREQ],eax ; save tsc / sec
|
|
|
|
|
mov ebx, 1000000
|
|
|
|
|
div ebx
|
|
|
|
|
mov [stall_mcs], eax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
; SET VARIABLES
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
call set_variables
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
; STACK AND FDC
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
call stack_init
|
|
|
|
|
call fdc_init
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
; PALETTE FOR 320x200 and 640x480 16 col
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp [SCR_MODE],word 0x12
|
|
|
|
|
jne no_pal_vga
|
|
|
|
|
mov esi,boot_pal_vga
|
|
|
|
|
call boot_log
|
|
|
|
|
call paletteVGA
|
2005-10-06 19:56:22 +02:00
|
|
|
|
no_pal_vga:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp [SCR_MODE],word 0x13
|
|
|
|
|
jne no_pal_ega
|
|
|
|
|
mov esi,boot_pal_ega
|
|
|
|
|
call boot_log
|
|
|
|
|
call palette320x200
|
2005-10-06 19:56:22 +02:00
|
|
|
|
no_pal_ega:
|
|
|
|
|
|
|
|
|
|
; LOAD DEFAULT SKIN
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov esi,_skin_file_default
|
|
|
|
|
mov edi,_skin_file
|
|
|
|
|
movsd
|
|
|
|
|
movsd
|
|
|
|
|
movsd
|
|
|
|
|
call load_skin
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
;protect io permission map
|
|
|
|
|
|
|
|
|
|
mov esi, [default_io_map]
|
|
|
|
|
stdcall map_page,esi,(tss._io_map_0-OS_BASE), PG_MAP
|
|
|
|
|
add esi, 0x1000
|
|
|
|
|
stdcall map_page,esi,(tss._io_map_1-OS_BASE), PG_MAP
|
|
|
|
|
|
|
|
|
|
stdcall map_page,tss._io_map_0,\
|
|
|
|
|
(tss._io_map_0-OS_BASE), PG_MAP
|
|
|
|
|
stdcall map_page,tss._io_map_1,\
|
|
|
|
|
(tss._io_map_1-OS_BASE), PG_MAP
|
|
|
|
|
|
2007-05-20 11:04:59 +02:00
|
|
|
|
mov ax,[OS_BASE+0x10000+bx_from_load]
|
|
|
|
|
cmp ax,'r1' ; <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> - <20><> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
je no_st_network
|
|
|
|
|
call set_network_conf
|
|
|
|
|
no_st_network:
|
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
; LOAD FIRST APPLICATION
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cli
|
2007-05-16 21:12:34 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
cmp byte [BOOT_VAR+0x9030],1
|
2007-03-23 04:11:34 +01:00
|
|
|
|
jne no_load_vrr_m
|
|
|
|
|
|
2007-05-24 13:27:05 +02:00
|
|
|
|
mov ebp, vrr_m
|
|
|
|
|
call fs_execute_from_sysdir
|
2007-05-16 21:12:34 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp eax,2 ; if vrr_m app found (PID=2)
|
|
|
|
|
je first_app_found
|
2006-02-01 07:07:36 +01:00
|
|
|
|
|
2006-12-17 07:22:59 +01:00
|
|
|
|
no_load_vrr_m:
|
2007-05-11 21:38:23 +02:00
|
|
|
|
|
2007-05-24 13:27:05 +02:00
|
|
|
|
mov ebp, firstapp
|
|
|
|
|
call fs_execute_from_sysdir
|
2007-05-16 21:12:34 +02:00
|
|
|
|
|
|
|
|
|
cmp eax,2 ; continue if a process has been loaded
|
|
|
|
|
je first_app_found
|
|
|
|
|
|
|
|
|
|
mov eax, 0xDEADBEEF ; otherwise halt
|
|
|
|
|
hlt
|
2007-05-11 21:38:23 +02:00
|
|
|
|
|
2006-12-17 07:22:59 +01:00
|
|
|
|
first_app_found:
|
2007-05-16 21:12:34 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cli
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
;mov [TASK_COUNT],dword 2
|
|
|
|
|
mov [CURRENT_TASK],dword 1 ; set OS task fisrt
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2005-11-07 16:50:30 +01:00
|
|
|
|
; SET KEYBOARD PARAMETERS
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov al, 0xf6 ; reset keyboard, scan enabled
|
|
|
|
|
call kb_write
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
; wait until 8042 is ready
|
|
|
|
|
xor ecx,ecx
|
2007-01-09 12:34:31 +01:00
|
|
|
|
@@:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
in al,64h
|
|
|
|
|
and al,00000010b
|
|
|
|
|
loopnz @b
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
; mov al, 0xED ; svetodiody - only for testing!
|
|
|
|
|
; call kb_write
|
|
|
|
|
; call kb_read
|
|
|
|
|
; mov al, 111b
|
|
|
|
|
; call kb_write
|
|
|
|
|
; call kb_read
|
2006-02-01 07:07:36 +01:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov al, 0xF3 ; set repeat rate & delay
|
|
|
|
|
call kb_write
|
2007-01-09 12:34:31 +01:00
|
|
|
|
; call kb_read
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov al, 0 ; 30 250 ;00100010b ; 24 500 ;00100100b ; 20 500
|
|
|
|
|
call kb_write
|
2007-01-09 12:34:31 +01:00
|
|
|
|
; call kb_read
|
2005-10-06 19:56:22 +02:00
|
|
|
|
;// mike.dld [
|
2007-03-23 04:11:34 +01:00
|
|
|
|
call set_lights
|
2005-10-06 19:56:22 +02:00
|
|
|
|
;// mike.dld ]
|
|
|
|
|
|
2005-11-07 16:50:30 +01:00
|
|
|
|
; START MULTITASKING
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov esi,boot_tasking
|
|
|
|
|
call boot_log
|
2005-11-07 16:50:30 +01:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
; mov [ENABLE_TASKSWITCH],byte 1 ; multitasking enabled
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
; UNMASK ALL IRQ'S
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov esi,boot_allirqs
|
|
|
|
|
call boot_log
|
2006-02-01 07:07:36 +01:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cli ;guarantee forbidance of interrupts.
|
|
|
|
|
mov al,0 ; unmask all irq's
|
|
|
|
|
out 0xA1,al
|
|
|
|
|
out 0x21,al
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov ecx,32
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
ready_for_irqs:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov al,0x20 ; ready for irqs
|
|
|
|
|
out 0x20,al
|
|
|
|
|
out 0xa0,al
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
loop ready_for_irqs ; flush the queue
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
stdcall attach_int_handler, dword 1, irq1
|
2006-10-06 08:09:41 +02:00
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
; mov [dma_hdd],1
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp [IDEContrRegsBaseAddr], 0
|
|
|
|
|
setnz [dma_hdd]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
; stdcall init_uart_service, DRV_ENTRY
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
sti
|
2007-04-18 08:37:14 +02:00
|
|
|
|
call change_task
|
|
|
|
|
|
|
|
|
|
jmp osloop
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
jmp $ ; wait here for timer to take control
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
; Fly :)
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
include 'unpacker.inc'
|
|
|
|
|
include 'fdo.inc'
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
boot_log:
|
|
|
|
|
pushad
|
|
|
|
|
|
|
|
|
|
mov eax,10*65536
|
|
|
|
|
mov ax,word [boot_y]
|
|
|
|
|
add [boot_y],dword 10
|
|
|
|
|
mov ebx,0x80ffffff ; ASCIIZ string with white color
|
|
|
|
|
mov ecx,esi
|
|
|
|
|
mov edi,1
|
|
|
|
|
call dtext
|
|
|
|
|
|
|
|
|
|
mov [novesachecksum],1000
|
|
|
|
|
call checkVga_N13
|
|
|
|
|
|
|
|
|
|
cmp [preboot_blogesc+OS_BASE+0x10000],byte 1
|
|
|
|
|
je .bll2
|
|
|
|
|
|
|
|
|
|
cmp esi,boot_tasking
|
|
|
|
|
jne .bll2
|
|
|
|
|
; begin ealex 04.08.05
|
|
|
|
|
; in al,0x61
|
|
|
|
|
; and al,01111111b
|
|
|
|
|
; out 0x61,al
|
|
|
|
|
; end ealex 04.08.05
|
|
|
|
|
.bll1: in al,0x60 ; wait for ESC key press
|
|
|
|
|
cmp al,129
|
|
|
|
|
jne .bll1
|
|
|
|
|
|
|
|
|
|
.bll2: popad
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
; ;
|
2006-01-06 12:46:26 +01:00
|
|
|
|
; MAIN OS LOOP START ;
|
2005-10-06 19:56:22 +02:00
|
|
|
|
; ;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
align 32
|
|
|
|
|
osloop:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
call [draw_pointer]
|
|
|
|
|
call checkbuttons
|
|
|
|
|
call checkwindows
|
2006-02-18 11:41:47 +01:00
|
|
|
|
; call check_window_move_request
|
2007-03-23 04:11:34 +01:00
|
|
|
|
call checkmisc
|
|
|
|
|
call checkVga_N13
|
|
|
|
|
call stack_handler
|
|
|
|
|
call checkidle
|
|
|
|
|
call check_fdd_motor_status
|
|
|
|
|
jmp osloop
|
2006-01-06 12:46:26 +01:00
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
; ;
|
|
|
|
|
; MAIN OS LOOP END ;
|
|
|
|
|
; ;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
checkidle:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
pushad
|
|
|
|
|
|
|
|
|
|
cmp [check_idle_semaphore],0
|
|
|
|
|
jne no_idle_state
|
|
|
|
|
|
|
|
|
|
call change_task
|
|
|
|
|
mov eax,[idlemem]
|
|
|
|
|
mov ebx,[timer_ticks] ;[0xfdf0]
|
|
|
|
|
cmp eax,ebx
|
|
|
|
|
jnz idle_exit
|
|
|
|
|
call _rdtsc
|
|
|
|
|
mov ecx,eax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
idle_loop:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
hlt
|
|
|
|
|
cmp [check_idle_semaphore],0
|
|
|
|
|
jne idle_loop_exit
|
|
|
|
|
mov eax,[timer_ticks] ;[0xfdf0]
|
|
|
|
|
cmp ebx,eax
|
|
|
|
|
jz idle_loop
|
2005-10-06 19:56:22 +02:00
|
|
|
|
idle_loop_exit:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov [idlemem],eax
|
|
|
|
|
call _rdtsc
|
|
|
|
|
sub eax,ecx
|
|
|
|
|
mov ebx,[idleuse]
|
|
|
|
|
add ebx,eax
|
|
|
|
|
mov [idleuse],ebx
|
2007-03-21 23:58:33 +01:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
popad
|
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
idle_exit:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov ebx,[timer_ticks] ;[0xfdf0]
|
|
|
|
|
mov [idlemem],ebx
|
|
|
|
|
call change_task
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
popad
|
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
no_idle_state:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
dec [check_idle_semaphore]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov ebx,[timer_ticks] ;[0xfdf0]
|
|
|
|
|
mov [idlemem],ebx
|
|
|
|
|
call change_task
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
popad
|
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
uglobal
|
2007-03-23 04:11:34 +01:00
|
|
|
|
idlemem dd 0x0
|
|
|
|
|
idleuse dd 0x0
|
|
|
|
|
idleusesec dd 0x0
|
|
|
|
|
check_idle_semaphore dd 0x0
|
2005-10-06 19:56:22 +02:00
|
|
|
|
endg
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
; ;
|
|
|
|
|
; INCLUDED SYSTEM FILES ;
|
|
|
|
|
; ;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
|
2005-10-14 17:40:15 +02:00
|
|
|
|
include "kernel32.inc"
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
; ;
|
|
|
|
|
; KERNEL FUNCTIONS ;
|
|
|
|
|
; ;
|
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
|
|
reserve_irqs_ports:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
pushad
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov [irq_owner+4*0], 1 ; timer
|
|
|
|
|
mov [irq_owner+4*1], 1 ; keyboard
|
|
|
|
|
mov [irq_owner+4*5], 1 ; sound blaster
|
|
|
|
|
mov [irq_owner+4*6], 1 ; floppy diskette
|
|
|
|
|
mov [irq_owner+4*13], 1 ; math co-pros
|
|
|
|
|
mov [irq_owner+4*14], 1 ; ide I
|
|
|
|
|
mov [irq_owner+4*15], 1 ; ide II
|
|
|
|
|
|
2006-03-11 19:10:47 +01:00
|
|
|
|
; movzx eax,byte [0xf604] ; mouse irq
|
|
|
|
|
; dec eax
|
|
|
|
|
; add eax,mouseirqtable
|
|
|
|
|
; movzx eax,byte [eax]
|
|
|
|
|
; shl eax,2
|
|
|
|
|
; mov [irq_owner+eax],byte 1
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
; RESERVE PORTS
|
|
|
|
|
mov edi,1 ; 0x00-0x2d
|
|
|
|
|
mov [RESERVED_PORTS],edi
|
|
|
|
|
shl edi,4
|
|
|
|
|
mov [RESERVED_PORTS+edi+0],dword 1
|
|
|
|
|
mov [RESERVED_PORTS+edi+4],dword 0x0
|
|
|
|
|
mov [RESERVED_PORTS+edi+8],dword 0x2d
|
|
|
|
|
|
|
|
|
|
inc dword [RESERVED_PORTS] ; 0x30-0x4d
|
|
|
|
|
mov edi,[RESERVED_PORTS]
|
|
|
|
|
shl edi,4
|
|
|
|
|
mov [RESERVED_PORTS+edi+0],dword 1
|
|
|
|
|
mov [RESERVED_PORTS+edi+4],dword 0x30
|
|
|
|
|
mov [RESERVED_PORTS+edi+8],dword 0x4d
|
|
|
|
|
|
|
|
|
|
inc dword [RESERVED_PORTS] ; 0x50-0xdf
|
|
|
|
|
mov edi,[RESERVED_PORTS]
|
|
|
|
|
shl edi,4
|
|
|
|
|
mov [RESERVED_PORTS+edi+0],dword 1
|
|
|
|
|
mov [RESERVED_PORTS+edi+4],dword 0x50
|
|
|
|
|
mov [RESERVED_PORTS+edi+8],dword 0xdf
|
|
|
|
|
|
|
|
|
|
inc dword [RESERVED_PORTS] ; 0xe5-0xff
|
|
|
|
|
mov edi,[RESERVED_PORTS]
|
|
|
|
|
shl edi,4
|
|
|
|
|
mov [RESERVED_PORTS+edi+0],dword 1
|
|
|
|
|
mov [RESERVED_PORTS+edi+4],dword 0xe5
|
|
|
|
|
mov [RESERVED_PORTS+edi+8],dword 0xff
|
2006-12-11 22:48:12 +01:00
|
|
|
|
|
|
|
|
|
|
2006-03-11 19:10:47 +01:00
|
|
|
|
; cmp [0xf604],byte 2 ; com1 mouse -> 0x3f0-0x3ff
|
|
|
|
|
; jne ripl1
|
|
|
|
|
; inc dword [0x2d0000]
|
|
|
|
|
; mov edi,[0x2d0000]
|
|
|
|
|
; shl edi,4
|
|
|
|
|
; mov [0x2d0000+edi+0],dword 1
|
|
|
|
|
; mov [0x2d0000+edi+4],dword 0x3f0
|
|
|
|
|
; mov [0x2d0000+edi+8],dword 0x3ff
|
|
|
|
|
; ripl1:
|
|
|
|
|
; cmp [0xf604],byte 3 ; com2 mouse -> 0x2f0-0x2ff
|
|
|
|
|
; jne ripl2
|
|
|
|
|
; inc dword [0x2d0000]
|
|
|
|
|
; mov edi,[0x2d0000]
|
|
|
|
|
; shl edi,4
|
|
|
|
|
; mov [0x2d0000+edi+0],dword 1
|
|
|
|
|
; mov [0x2d0000+edi+4],dword 0x2f0
|
|
|
|
|
; mov [0x2d0000+edi+8],dword 0x2ff
|
|
|
|
|
; ripl2:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
popad
|
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
iglobal
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mouseirqtable db 12 ; ps2
|
|
|
|
|
db 4 ; com1
|
|
|
|
|
db 3 ; com2
|
2005-10-06 19:56:22 +02:00
|
|
|
|
endg
|
|
|
|
|
|
|
|
|
|
setirqreadports:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov [irq12read+0],dword 0x60 + 0x01000000 ; read port 0x60 , byte
|
|
|
|
|
mov [irq12read+4],dword 0 ; end of port list
|
|
|
|
|
mov [irq04read+0],dword 0x3f8 + 0x01000000 ; read port 0x3f8 , byte
|
|
|
|
|
mov [irq04read+4],dword 0 ; end of port list
|
|
|
|
|
mov [irq03read+0],dword 0x2f8 + 0x01000000 ; read port 0x2f8 , byte
|
|
|
|
|
mov [irq03read+4],dword 0 ; end of port list
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
iglobal
|
|
|
|
|
process_number dd 0x1
|
|
|
|
|
endg
|
|
|
|
|
|
|
|
|
|
set_variables:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov ecx,0x100 ; flush port 0x60
|
|
|
|
|
.fl60: in al,0x60
|
|
|
|
|
loop .fl60
|
|
|
|
|
mov [MOUSE_BUFF_COUNT],byte 0 ; mouse buffer
|
|
|
|
|
mov [KEY_COUNT],byte 0 ; keyboard buffer
|
|
|
|
|
mov [BTN_COUNT],byte 0 ; button buffer
|
2007-03-01 21:32:19 +01:00
|
|
|
|
; mov [MOUSE_X],dword 100*65536+100 ; mouse x/y
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
push eax
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov ax,[BOOT_VAR+0x900c]
|
2007-03-23 04:11:34 +01:00
|
|
|
|
shr ax,1
|
|
|
|
|
shl eax,16
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov ax,[BOOT_VAR+0x900A]
|
2007-03-23 04:11:34 +01:00
|
|
|
|
shr ax,1
|
|
|
|
|
mov [MOUSE_X],eax
|
|
|
|
|
pop eax
|
2006-02-01 07:07:36 +01:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov byte [SB16_Status],0 ; Minazzi Paolo
|
|
|
|
|
mov [display_data-12],dword 1 ; tiled background
|
|
|
|
|
mov [BTN_ADDR],dword BUTTON_INFO ; address of button list
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
;!! IP 04.02.2005:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov [next_usage_update], 100
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov byte [DONT_SWITCH], 0 ; change task if possible
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
;* mouse centered - start code- Mario79
|
|
|
|
|
mouse_centered:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
push eax
|
|
|
|
|
mov eax,[ScreenWidth]
|
|
|
|
|
shr eax,1
|
|
|
|
|
mov [MOUSE_X],ax
|
|
|
|
|
mov eax,[ScreenHeight]
|
|
|
|
|
shr eax,1
|
|
|
|
|
mov [MOUSE_Y],ax
|
|
|
|
|
pop eax
|
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
;* mouse centered - end code- Mario79
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
|
|
|
|
sys_outport:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov edi,ebx ; separate flag for read / write
|
2005-10-06 19:56:22 +02:00
|
|
|
|
and ebx,65535
|
|
|
|
|
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov ecx,[RESERVED_PORTS]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
test ecx,ecx
|
|
|
|
|
jne sopl8
|
|
|
|
|
mov [esp+36],dword 1
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
sopl8:
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edx,[TASK_BASE]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov edx,[edx+0x4]
|
|
|
|
|
and ebx,65535
|
|
|
|
|
cld
|
|
|
|
|
sopl1:
|
|
|
|
|
|
|
|
|
|
mov esi,ecx
|
|
|
|
|
shl esi,4
|
2007-03-01 21:32:19 +01:00
|
|
|
|
add esi,RESERVED_PORTS
|
2005-10-06 19:56:22 +02:00
|
|
|
|
cmp edx,[esi+0]
|
|
|
|
|
jne sopl2
|
|
|
|
|
cmp ebx,[esi+4]
|
2007-03-23 04:11:34 +01:00
|
|
|
|
jb sopl2
|
2005-10-06 19:56:22 +02:00
|
|
|
|
cmp ebx,[esi+8]
|
2007-03-23 04:11:34 +01:00
|
|
|
|
jg sopl2
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jmp sopl3
|
|
|
|
|
|
|
|
|
|
sopl2:
|
|
|
|
|
|
|
|
|
|
dec ecx
|
|
|
|
|
jnz sopl1
|
|
|
|
|
mov [esp+36],dword 1
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
sopl3:
|
|
|
|
|
|
|
|
|
|
test edi,0x80000000 ; read ?
|
|
|
|
|
jnz sopl4
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov dx,bx ; write
|
2005-10-06 19:56:22 +02:00
|
|
|
|
out dx,al
|
|
|
|
|
mov [esp+36],dword 0
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
sopl4:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov dx,bx ; read
|
|
|
|
|
in al,dx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
and eax,0xff
|
|
|
|
|
mov [esp+36],dword 0
|
|
|
|
|
mov [esp+24],eax
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
sys_sb16:
|
|
|
|
|
|
|
|
|
|
cmp word [sb16],word 0
|
|
|
|
|
jnz sb16l1
|
|
|
|
|
mov [esp+36],dword 1
|
|
|
|
|
ret
|
|
|
|
|
sb16l1:
|
|
|
|
|
mov [esp+36],dword 0
|
|
|
|
|
cmp eax,1 ; set volume - main
|
|
|
|
|
jnz sb16l2
|
|
|
|
|
mov dx,word [sb16]
|
|
|
|
|
add dx,4
|
|
|
|
|
mov al,0x22
|
|
|
|
|
out dx,al
|
|
|
|
|
mov esi,1
|
|
|
|
|
call delay_ms
|
|
|
|
|
mov eax,ebx
|
|
|
|
|
inc edx
|
|
|
|
|
out dx,al
|
|
|
|
|
ret
|
|
|
|
|
sb16l2:
|
|
|
|
|
|
|
|
|
|
cmp eax,2 ; set volume - cd
|
|
|
|
|
jnz sb16l3
|
|
|
|
|
mov dx,word [sb16]
|
|
|
|
|
add dx,4
|
|
|
|
|
mov al,0x28
|
|
|
|
|
out dx,al
|
|
|
|
|
mov esi,1
|
|
|
|
|
call delay_ms
|
|
|
|
|
mov eax,ebx
|
|
|
|
|
add edx,1
|
|
|
|
|
out dx,al
|
|
|
|
|
ret
|
|
|
|
|
sb16l3:
|
|
|
|
|
mov [esp+36],dword 2
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
|
|
|
|
sys_sb16II:
|
|
|
|
|
|
|
|
|
|
cmp word [sb16],word 0
|
|
|
|
|
jnz IIsb16l1
|
|
|
|
|
mov [esp+36],dword 1
|
|
|
|
|
ret
|
|
|
|
|
IIsb16l1:
|
|
|
|
|
|
|
|
|
|
cmp eax,1 ; set volume - main
|
|
|
|
|
jnz IIsb16l2
|
|
|
|
|
; L
|
|
|
|
|
mov dx,word [sb16]
|
|
|
|
|
add dx,4
|
|
|
|
|
mov al,0x30
|
|
|
|
|
out dx,al
|
|
|
|
|
mov eax,ebx
|
|
|
|
|
inc edx
|
|
|
|
|
out dx,al
|
|
|
|
|
; R
|
|
|
|
|
mov dx,word [sb16]
|
|
|
|
|
add dx,4
|
|
|
|
|
mov al,0x31
|
|
|
|
|
out dx,al
|
|
|
|
|
mov eax,ebx
|
|
|
|
|
inc edx
|
|
|
|
|
out dx,al
|
|
|
|
|
mov [esp+36],dword 0
|
|
|
|
|
ret
|
|
|
|
|
IIsb16l2:
|
|
|
|
|
|
|
|
|
|
cmp eax,2 ; set volume - cd
|
|
|
|
|
jnz IIsb16l3
|
|
|
|
|
; L
|
|
|
|
|
mov dx,word [sb16]
|
|
|
|
|
add dx,4
|
|
|
|
|
mov al,0x36
|
|
|
|
|
out dx,al
|
|
|
|
|
mov eax,ebx
|
|
|
|
|
inc edx
|
|
|
|
|
out dx,al
|
|
|
|
|
; R
|
|
|
|
|
mov dx,word [sb16]
|
|
|
|
|
add dx,4
|
|
|
|
|
mov al,0x37
|
|
|
|
|
out dx,al
|
|
|
|
|
mov eax,ebx
|
|
|
|
|
inc edx
|
|
|
|
|
out dx,al
|
|
|
|
|
mov [esp+36],dword 0
|
|
|
|
|
ret
|
|
|
|
|
IIsb16l3:
|
|
|
|
|
|
|
|
|
|
mov [esp+36],dword 2
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
display_number:
|
|
|
|
|
|
|
|
|
|
; eax = print type, al=0 -> ebx is number
|
|
|
|
|
; al=1 -> ebx is pointer
|
|
|
|
|
; ah=0 -> display decimal
|
|
|
|
|
; ah=1 -> display hexadecimal
|
|
|
|
|
; ah=2 -> display binary
|
|
|
|
|
; eax bits 16-21 = number of digits to display (0-32)
|
|
|
|
|
; eax bits 22-31 = reserved
|
|
|
|
|
;
|
|
|
|
|
; ebx = number or pointer
|
|
|
|
|
; ecx = x shl 16 + y
|
|
|
|
|
; edx = color
|
2007-03-23 04:11:34 +01:00
|
|
|
|
xor edi, edi
|
2006-11-16 06:47:31 +01:00
|
|
|
|
display_number_force:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp eax,0xffff ; length > 0 ?
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jge cont_displ
|
|
|
|
|
ret
|
|
|
|
|
cont_displ:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp eax,61*0x10000 ; length <= 60 ?
|
2006-05-05 14:40:02 +02:00
|
|
|
|
jb cont_displ2
|
2005-10-06 19:56:22 +02:00
|
|
|
|
ret
|
|
|
|
|
cont_displ2:
|
|
|
|
|
|
|
|
|
|
pushad
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp al,1 ; ecx is a pointer ?
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jne displnl1
|
2006-08-28 15:34:54 +02:00
|
|
|
|
mov ebx,[ebx+std_application_base_address]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
displnl1:
|
|
|
|
|
sub esp,64
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp ah,0 ; DECIMAL
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jne no_display_desnum
|
|
|
|
|
shr eax,16
|
2006-05-05 14:40:02 +02:00
|
|
|
|
and eax,0x3f
|
2005-10-06 19:56:22 +02:00
|
|
|
|
push eax
|
|
|
|
|
mov edi,esp
|
2006-10-25 12:28:41 +02:00
|
|
|
|
add edi,4+64-1
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov ecx,eax
|
|
|
|
|
mov eax,ebx
|
|
|
|
|
mov ebx,10
|
|
|
|
|
d_desnum:
|
|
|
|
|
xor edx,edx
|
|
|
|
|
div ebx
|
|
|
|
|
add dl,48
|
|
|
|
|
mov [edi],dl
|
|
|
|
|
dec edi
|
|
|
|
|
loop d_desnum
|
|
|
|
|
pop eax
|
|
|
|
|
call draw_num_text
|
|
|
|
|
add esp,64
|
|
|
|
|
popad
|
|
|
|
|
ret
|
|
|
|
|
no_display_desnum:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp ah,0x01 ; HEXADECIMAL
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jne no_display_hexnum
|
|
|
|
|
shr eax,16
|
2006-05-05 14:40:02 +02:00
|
|
|
|
and eax,0x3f
|
2005-10-06 19:56:22 +02:00
|
|
|
|
push eax
|
|
|
|
|
mov edi,esp
|
2006-10-25 12:28:41 +02:00
|
|
|
|
add edi,4+64-1
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov ecx,eax
|
|
|
|
|
mov eax,ebx
|
|
|
|
|
mov ebx,16
|
|
|
|
|
d_hexnum:
|
|
|
|
|
xor edx,edx
|
|
|
|
|
div ebx
|
|
|
|
|
add edx,hexletters
|
|
|
|
|
mov dl,[edx]
|
|
|
|
|
mov [edi],dl
|
|
|
|
|
dec edi
|
|
|
|
|
loop d_hexnum
|
|
|
|
|
pop eax
|
|
|
|
|
call draw_num_text
|
|
|
|
|
add esp,64
|
|
|
|
|
popad
|
|
|
|
|
ret
|
|
|
|
|
no_display_hexnum:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp ah,0x02 ; BINARY
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jne no_display_binnum
|
|
|
|
|
shr eax,16
|
2006-05-05 14:40:02 +02:00
|
|
|
|
and eax,0x3f
|
2005-10-06 19:56:22 +02:00
|
|
|
|
push eax
|
|
|
|
|
mov edi,esp
|
2006-10-25 12:28:41 +02:00
|
|
|
|
add edi,4+64-1
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov ecx,eax
|
|
|
|
|
mov eax,ebx
|
|
|
|
|
mov ebx,2
|
|
|
|
|
d_binnum:
|
|
|
|
|
xor edx,edx
|
|
|
|
|
div ebx
|
|
|
|
|
add dl,48
|
|
|
|
|
mov [edi],dl
|
|
|
|
|
dec edi
|
|
|
|
|
loop d_binnum
|
|
|
|
|
pop eax
|
|
|
|
|
call draw_num_text
|
|
|
|
|
add esp,64
|
|
|
|
|
popad
|
|
|
|
|
ret
|
|
|
|
|
no_display_binnum:
|
|
|
|
|
|
|
|
|
|
add esp,64
|
|
|
|
|
popad
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
draw_num_text:
|
|
|
|
|
|
|
|
|
|
; dtext
|
|
|
|
|
;
|
|
|
|
|
; eax x & y
|
|
|
|
|
; ebx color
|
|
|
|
|
; ecx start of text
|
|
|
|
|
; edx length
|
|
|
|
|
; edi 1 force
|
|
|
|
|
|
2007-02-28 09:52:06 +01:00
|
|
|
|
; mov edi,[CURRENT_TASK]
|
2006-09-20 17:01:30 +02:00
|
|
|
|
; shl edi,8
|
2007-02-28 11:51:05 +01:00
|
|
|
|
; add ax,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.top]
|
2006-10-06 08:09:41 +02:00
|
|
|
|
; rol eax,16
|
2007-02-28 11:51:05 +01:00
|
|
|
|
; add ax,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.left]
|
2006-10-06 08:09:41 +02:00
|
|
|
|
; rol eax,16
|
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov edx,eax
|
2006-10-25 12:28:41 +02:00
|
|
|
|
mov ecx,64+4
|
2005-10-06 19:56:22 +02:00
|
|
|
|
sub ecx,eax
|
|
|
|
|
add ecx,esp
|
|
|
|
|
mov eax,[esp+64+32-8+4]
|
2007-03-23 04:11:34 +01:00
|
|
|
|
push edx ; add window start x & y
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edx,[TASK_BASE]
|
2007-04-18 08:37:14 +02:00
|
|
|
|
|
|
|
|
|
mov edi,[CURRENT_TASK]
|
|
|
|
|
shl edi,8
|
|
|
|
|
|
2006-08-06 12:29:45 +02:00
|
|
|
|
mov ebx,[edx-twdw+WDATA.box.left]
|
2007-04-18 08:37:14 +02:00
|
|
|
|
add ebx,[edi+SLOT_BASE+APPDATA.wnd_clientbox.left]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
shl ebx,16
|
2006-08-06 12:29:45 +02:00
|
|
|
|
add ebx,[edx-twdw+WDATA.box.top]
|
2007-04-18 08:37:14 +02:00
|
|
|
|
add ebx,[edi+SLOT_BASE+APPDATA.wnd_clientbox.top]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
add eax,ebx
|
|
|
|
|
pop edx
|
2006-08-28 15:34:54 +02:00
|
|
|
|
mov ebx,[esp+64+32-12+4]
|
2007-03-23 04:11:34 +01:00
|
|
|
|
and ebx, not 0x80000000 ; force counted string
|
|
|
|
|
mov esi, [esp+64+4+4]
|
|
|
|
|
mov edi, [esp+64+4]
|
2006-08-28 15:34:54 +02:00
|
|
|
|
jmp dtext
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
read_string:
|
|
|
|
|
|
|
|
|
|
; eax read_area
|
|
|
|
|
; ebx color of letter
|
|
|
|
|
; ecx color of background
|
|
|
|
|
; edx number of letters to read
|
|
|
|
|
; esi [x start]*65536 + [y_start]
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
|
|
|
|
sys_setup:
|
|
|
|
|
|
|
|
|
|
; 1=roland mpu midi base , base io address
|
|
|
|
|
; 2=keyboard 1, base kaybap 2, shift keymap, 9 country 1eng 2fi 3ger 4rus
|
|
|
|
|
; 3=cd base 1, pri.master 2, pri slave 3 sec master, 4 sec slave
|
|
|
|
|
; 4=sb16 base , base io address
|
|
|
|
|
; 5=system language, 1eng 2fi 3ger 4rus
|
|
|
|
|
; 7=hd base 1, pri.master 2, pri slave 3 sec master, 4 sec slave
|
|
|
|
|
; 8=fat32 partition in hd
|
|
|
|
|
; 9
|
|
|
|
|
; 10 = sound dma channel
|
|
|
|
|
; 11 = enable lba read
|
|
|
|
|
; 12 = enable pci access
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mov [esp+36],dword 0
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp eax,1 ; MIDI
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jnz nsyse1
|
|
|
|
|
cmp ebx,0x100
|
|
|
|
|
jb nsyse1
|
|
|
|
|
mov edx,65535
|
|
|
|
|
cmp edx,ebx
|
|
|
|
|
jb nsyse1
|
|
|
|
|
mov [midi_base],bx
|
|
|
|
|
mov word [mididp],bx
|
|
|
|
|
inc bx
|
|
|
|
|
mov word [midisp],bx
|
|
|
|
|
ret
|
|
|
|
|
|
2007-01-19 16:02:33 +01:00
|
|
|
|
iglobal
|
2005-10-06 19:56:22 +02:00
|
|
|
|
midi_base dw 0
|
2007-01-19 16:02:33 +01:00
|
|
|
|
endg
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
nsyse1:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp eax,2 ; KEYBOARD
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jnz nsyse2
|
|
|
|
|
cmp ebx,1
|
|
|
|
|
jnz kbnobase
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edi,[TASK_BASE]
|
2006-08-06 12:29:45 +02:00
|
|
|
|
add ecx,[edi+TASKDATA.mem_start]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov eax,ecx
|
|
|
|
|
mov ebx,keymap
|
|
|
|
|
mov ecx,128
|
|
|
|
|
call memmove
|
|
|
|
|
ret
|
|
|
|
|
kbnobase:
|
|
|
|
|
cmp ebx,2
|
|
|
|
|
jnz kbnoshift
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edi,[TASK_BASE]
|
2006-08-06 12:29:45 +02:00
|
|
|
|
add ecx,[edi+TASKDATA.mem_start]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov eax,ecx
|
|
|
|
|
mov ebx,keymap_shift
|
|
|
|
|
mov ecx,128
|
|
|
|
|
call memmove
|
|
|
|
|
ret
|
|
|
|
|
kbnoshift:
|
|
|
|
|
cmp ebx,3
|
|
|
|
|
jne kbnoalt
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edi,[TASK_BASE]
|
2006-08-06 12:29:45 +02:00
|
|
|
|
add ecx,[edi+TASKDATA.mem_start]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov eax,ecx
|
|
|
|
|
mov ebx,keymap_alt
|
|
|
|
|
mov ecx,128
|
|
|
|
|
call memmove
|
|
|
|
|
ret
|
|
|
|
|
kbnoalt:
|
|
|
|
|
cmp ebx,9
|
|
|
|
|
jnz kbnocountry
|
|
|
|
|
mov word [keyboard],cx
|
|
|
|
|
ret
|
|
|
|
|
kbnocountry:
|
|
|
|
|
mov [esp+36],dword 1
|
|
|
|
|
ret
|
|
|
|
|
nsyse2:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp eax,3 ; CD
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jnz nsyse3
|
2006-05-05 14:40:02 +02:00
|
|
|
|
test ebx,ebx
|
|
|
|
|
jz nosesl
|
|
|
|
|
cmp ebx, 4
|
|
|
|
|
ja nosesl
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov [cd_base],bl
|
|
|
|
|
cmp ebx,1
|
|
|
|
|
jnz noprma
|
|
|
|
|
mov [cdbase],0x1f0
|
|
|
|
|
mov [cdid],0xa0
|
|
|
|
|
noprma:
|
|
|
|
|
cmp ebx,2
|
|
|
|
|
jnz noprsl
|
|
|
|
|
mov [cdbase],0x1f0
|
|
|
|
|
mov [cdid],0xb0
|
|
|
|
|
noprsl:
|
|
|
|
|
cmp ebx,3
|
|
|
|
|
jnz nosema
|
|
|
|
|
mov [cdbase],0x170
|
|
|
|
|
mov [cdid],0xa0
|
|
|
|
|
nosema:
|
|
|
|
|
cmp ebx,4
|
|
|
|
|
jnz nosesl
|
|
|
|
|
mov [cdbase],0x170
|
|
|
|
|
mov [cdid],0xb0
|
|
|
|
|
nosesl:
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
cd_base db 0
|
|
|
|
|
|
|
|
|
|
nsyse3:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp eax,4 ; SB
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jnz nsyse4
|
|
|
|
|
cmp ebx,0x100
|
|
|
|
|
jb nsyse4
|
|
|
|
|
mov edx,65535
|
|
|
|
|
cmp edx,ebx
|
|
|
|
|
jb nsyse4
|
|
|
|
|
mov word [sb16],bx
|
|
|
|
|
ret
|
|
|
|
|
nsyse4:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp eax,5 ; SYSTEM LANGUAGE
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jnz nsyse5
|
|
|
|
|
mov [syslang],ebx
|
|
|
|
|
ret
|
|
|
|
|
nsyse5:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp eax,7 ; HD BASE
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jne nsyse7
|
2006-05-05 14:40:02 +02:00
|
|
|
|
test ebx,ebx
|
|
|
|
|
jz nosethd
|
|
|
|
|
cmp ebx,4
|
|
|
|
|
ja nosethd
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov [hd_base],bl
|
|
|
|
|
cmp ebx,1
|
|
|
|
|
jnz noprmahd
|
|
|
|
|
mov [hdbase],0x1f0
|
|
|
|
|
mov [hdid],0x0
|
|
|
|
|
mov [hdpos],1
|
|
|
|
|
; call set_FAT32_variables
|
|
|
|
|
noprmahd:
|
|
|
|
|
cmp ebx,2
|
|
|
|
|
jnz noprslhd
|
|
|
|
|
mov [hdbase],0x1f0
|
|
|
|
|
mov [hdid],0x10
|
|
|
|
|
mov [hdpos],2
|
|
|
|
|
; call set_FAT32_variables
|
|
|
|
|
noprslhd:
|
|
|
|
|
cmp ebx,3
|
|
|
|
|
jnz nosemahd
|
|
|
|
|
mov [hdbase],0x170
|
|
|
|
|
mov [hdid],0x0
|
|
|
|
|
mov [hdpos],3
|
|
|
|
|
; call set_FAT32_variables
|
|
|
|
|
nosemahd:
|
|
|
|
|
cmp ebx,4
|
|
|
|
|
jnz noseslhd
|
|
|
|
|
mov [hdbase],0x170
|
|
|
|
|
mov [hdid],0x10
|
|
|
|
|
mov [hdpos],4
|
|
|
|
|
; call set_FAT32_variables
|
|
|
|
|
noseslhd:
|
|
|
|
|
call reserve_hd1
|
2007-02-05 15:20:36 +01:00
|
|
|
|
call reserve_hd_channel
|
|
|
|
|
call free_hd_channel
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov [hd1_status],0 ; free
|
2006-05-05 14:40:02 +02:00
|
|
|
|
nosethd:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
ret
|
|
|
|
|
|
2007-01-19 16:02:33 +01:00
|
|
|
|
iglobal
|
2005-10-06 19:56:22 +02:00
|
|
|
|
hd_base db 0
|
2007-01-19 16:02:33 +01:00
|
|
|
|
endg
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
nsyse7:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp eax,8 ; HD PARTITION
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jne nsyse8
|
|
|
|
|
mov [fat32part],ebx
|
|
|
|
|
; call set_FAT32_variables
|
|
|
|
|
call reserve_hd1
|
2007-02-05 15:20:36 +01:00
|
|
|
|
call reserve_hd_channel
|
|
|
|
|
call free_hd_channel
|
2005-10-06 19:56:22 +02:00
|
|
|
|
pusha
|
|
|
|
|
call choice_necessity_partition_1
|
|
|
|
|
popa
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov [hd1_status],0 ; free
|
2005-10-06 19:56:22 +02:00
|
|
|
|
ret
|
|
|
|
|
nsyse8:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp eax,10 ; SOUND DMA CHANNEL
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jne no_set_sound_dma
|
2006-05-05 14:40:02 +02:00
|
|
|
|
cmp ebx,3
|
|
|
|
|
ja sys_setup_err
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov [sound_dma],ebx
|
|
|
|
|
ret
|
|
|
|
|
no_set_sound_dma:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp eax,11 ; ENABLE LBA READ
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jne no_set_lba_read
|
|
|
|
|
and ebx,1
|
|
|
|
|
mov [lba_read_enabled],ebx
|
|
|
|
|
ret
|
|
|
|
|
no_set_lba_read:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp eax,12 ; ENABLE PCI ACCESS
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jne no_set_pci_access
|
|
|
|
|
and ebx,1
|
|
|
|
|
mov [pci_access_enabled],ebx
|
|
|
|
|
ret
|
|
|
|
|
no_set_pci_access:
|
|
|
|
|
|
|
|
|
|
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
include 'vmodeint.inc'
|
|
|
|
|
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
|
2006-05-05 14:40:02 +02:00
|
|
|
|
sys_setup_err:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov [esp+36],dword -1
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
|
|
|
|
sys_getsetup:
|
|
|
|
|
|
|
|
|
|
; 1=roland mpu midi base , base io address
|
|
|
|
|
; 2=keyboard 1, base kaybap 2, shift keymap, 9 country 1eng 2fi 3ger 4rus
|
|
|
|
|
; 3=cd base 1, pri.master 2, pri slave 3 sec master, 4 sec slave
|
|
|
|
|
; 4=sb16 base , base io address
|
|
|
|
|
; 5=system language, 1eng 2fi 3ger 4rus
|
|
|
|
|
; 7=hd base 1, pri.master 2, pri slave 3 sec master, 4 sec slave
|
|
|
|
|
; 8=fat32 partition in hd
|
|
|
|
|
; 9=get hs timer tic
|
|
|
|
|
|
|
|
|
|
cmp eax,1
|
|
|
|
|
jne ngsyse1
|
|
|
|
|
movzx eax,[midi_base]
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
|
|
|
|
ngsyse1:
|
|
|
|
|
|
|
|
|
|
cmp eax,2
|
|
|
|
|
jne ngsyse2
|
|
|
|
|
cmp ebx,1
|
|
|
|
|
jnz kbnobaseret
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edi,[TASK_BASE]
|
2006-08-06 12:29:45 +02:00
|
|
|
|
add ecx,[edi+TASKDATA.mem_start]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov ebx,ecx
|
|
|
|
|
mov eax,keymap
|
|
|
|
|
mov ecx,128
|
|
|
|
|
call memmove
|
|
|
|
|
ret
|
|
|
|
|
kbnobaseret:
|
|
|
|
|
cmp ebx,2
|
|
|
|
|
jnz kbnoshiftret
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edi,[TASK_BASE]
|
2006-08-06 12:29:45 +02:00
|
|
|
|
add ecx,[edi+TASKDATA.mem_start]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov ebx,ecx
|
|
|
|
|
mov eax,keymap_shift
|
|
|
|
|
mov ecx,128
|
|
|
|
|
call memmove
|
|
|
|
|
ret
|
|
|
|
|
kbnoshiftret:
|
|
|
|
|
cmp ebx,3
|
|
|
|
|
jne kbnoaltret
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edi,[TASK_BASE]
|
2006-08-06 12:29:45 +02:00
|
|
|
|
add ecx,[edi+TASKDATA.mem_start]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov ebx,ecx
|
|
|
|
|
mov eax,keymap_alt
|
|
|
|
|
mov ecx,128
|
|
|
|
|
call memmove
|
|
|
|
|
ret
|
|
|
|
|
kbnoaltret:
|
|
|
|
|
cmp ebx,9
|
|
|
|
|
jnz ngsyse2
|
|
|
|
|
movzx eax,word [keyboard]
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
|
|
|
|
ngsyse2:
|
|
|
|
|
|
|
|
|
|
cmp eax,3
|
|
|
|
|
jnz ngsyse3
|
|
|
|
|
movzx eax,[cd_base]
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
|
|
|
|
ngsyse3:
|
|
|
|
|
|
|
|
|
|
cmp eax,4
|
|
|
|
|
jne ngsyse4
|
|
|
|
|
mov eax,[sb16]
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
|
|
|
|
ngsyse4:
|
|
|
|
|
|
|
|
|
|
cmp eax,5
|
|
|
|
|
jnz ngsyse5
|
|
|
|
|
mov eax,[syslang]
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
|
|
|
|
ngsyse5:
|
|
|
|
|
cmp eax,7
|
|
|
|
|
jnz ngsyse7
|
|
|
|
|
movzx eax,[hd_base]
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
|
|
|
|
ngsyse7:
|
|
|
|
|
cmp eax,8
|
|
|
|
|
jnz ngsyse8
|
|
|
|
|
mov eax,[fat32part]
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
|
|
|
|
ngsyse8:
|
|
|
|
|
cmp eax,9
|
|
|
|
|
jne ngsyse9
|
|
|
|
|
mov eax,[timer_ticks] ;[0xfdf0]
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
|
|
|
|
ngsyse9:
|
|
|
|
|
cmp eax,10
|
|
|
|
|
jnz ngsyse10
|
|
|
|
|
mov eax,[sound_dma]
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
|
|
|
|
ngsyse10:
|
|
|
|
|
cmp eax,11
|
|
|
|
|
jnz ngsyse11
|
|
|
|
|
mov eax,[lba_read_enabled]
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
|
|
|
|
ngsyse11:
|
|
|
|
|
cmp eax,12
|
|
|
|
|
jnz ngsyse12
|
|
|
|
|
mov eax,[pci_access_enabled]
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
|
|
|
|
ngsyse12:
|
|
|
|
|
mov [esp+36],dword 1
|
|
|
|
|
ret
|
|
|
|
|
|
2007-05-08 13:32:58 +02:00
|
|
|
|
get_timer_ticks:
|
|
|
|
|
mov eax,[timer_ticks]
|
|
|
|
|
ret
|
|
|
|
|
|
2007-01-19 16:02:33 +01:00
|
|
|
|
iglobal
|
2005-10-06 19:56:22 +02:00
|
|
|
|
align 4
|
2006-11-27 11:07:51 +01:00
|
|
|
|
mousefn dd msscreen, mswin, msbutton, msset
|
2007-03-23 04:11:34 +01:00
|
|
|
|
dd app_load_cursor
|
|
|
|
|
dd app_set_cursor
|
|
|
|
|
dd app_delete_cursor
|
2007-05-08 13:32:58 +02:00
|
|
|
|
dd msz
|
2007-01-19 16:02:33 +01:00
|
|
|
|
endg
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
readmousepos:
|
|
|
|
|
|
|
|
|
|
; eax=0 screen relative
|
|
|
|
|
; eax=1 window relative
|
|
|
|
|
; eax=2 buttons pressed
|
2006-11-27 11:07:51 +01:00
|
|
|
|
; eax=3 set mouse pos ; reserved
|
|
|
|
|
; eax=4 load cursor
|
|
|
|
|
; eax=5 set cursor
|
|
|
|
|
; eax=6 delete cursor ; reserved
|
2007-05-08 13:32:58 +02:00
|
|
|
|
; eax=7 get mouse_z
|
2006-11-27 11:07:51 +01:00
|
|
|
|
|
2007-05-08 13:32:58 +02:00
|
|
|
|
cmp eax, 7
|
2007-03-23 04:11:34 +01:00
|
|
|
|
ja msset
|
|
|
|
|
jmp [mousefn+eax*4]
|
2006-11-27 11:07:51 +01:00
|
|
|
|
msscreen:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov eax,[MOUSE_X]
|
|
|
|
|
shl eax,16
|
|
|
|
|
mov ax,[MOUSE_Y]
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
2006-11-27 11:07:51 +01:00
|
|
|
|
mswin:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov eax,[MOUSE_X]
|
|
|
|
|
shl eax,16
|
|
|
|
|
mov ax,[MOUSE_Y]
|
|
|
|
|
mov esi,[TASK_BASE]
|
|
|
|
|
mov bx, word [esi-twdw+WDATA.box.left]
|
|
|
|
|
shl ebx,16
|
|
|
|
|
mov bx, word [esi-twdw+WDATA.box.top]
|
|
|
|
|
sub eax,ebx
|
|
|
|
|
|
|
|
|
|
mov edi,[CURRENT_TASK]
|
|
|
|
|
shl edi,8
|
|
|
|
|
sub ax,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.top]
|
|
|
|
|
rol eax,16
|
|
|
|
|
sub ax,word[edi+SLOT_BASE+APPDATA.wnd_clientbox.left]
|
|
|
|
|
rol eax,16
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
2006-11-27 11:07:51 +01:00
|
|
|
|
msbutton:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
movzx eax,byte [BTN_DOWN]
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
2007-05-08 13:32:58 +02:00
|
|
|
|
msz:
|
|
|
|
|
mov edi, [TASK_COUNT]
|
|
|
|
|
movzx edi, word [WIN_POS + edi*2]
|
|
|
|
|
cmp edi, [CURRENT_TASK]
|
|
|
|
|
jne @f
|
|
|
|
|
mov ax,[MOUSE_SCROLL_H]
|
|
|
|
|
shl eax,16
|
|
|
|
|
mov ax,[MOUSE_SCROLL_V]
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
mov [MOUSE_SCROLL_H],word 0
|
|
|
|
|
mov [MOUSE_SCROLL_V],word 0
|
|
|
|
|
ret
|
|
|
|
|
@@:
|
|
|
|
|
mov [esp+36],dword 0
|
|
|
|
|
ret
|
2006-11-27 11:07:51 +01:00
|
|
|
|
msset:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
ret
|
2006-11-27 11:07:51 +01:00
|
|
|
|
|
|
|
|
|
app_load_cursor:
|
2007-04-18 08:37:14 +02:00
|
|
|
|
; add ebx, new_app_base
|
|
|
|
|
cmp ebx, OS_BASE
|
|
|
|
|
jae msset
|
2007-03-23 04:11:34 +01:00
|
|
|
|
stdcall load_cursor, ebx, ecx
|
|
|
|
|
mov [esp+36], eax
|
|
|
|
|
ret
|
2006-11-27 11:07:51 +01:00
|
|
|
|
|
|
|
|
|
app_set_cursor:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
stdcall set_cursor, ebx
|
|
|
|
|
mov [esp+36], eax
|
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2006-12-11 22:48:12 +01:00
|
|
|
|
app_delete_cursor:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
stdcall delete_cursor, ebx
|
|
|
|
|
mov [esp+36], eax
|
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
is_input:
|
|
|
|
|
|
|
|
|
|
push edx
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov dx,word [midisp]
|
|
|
|
|
in al,dx
|
|
|
|
|
and al,0x80
|
|
|
|
|
pop edx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
is_output:
|
|
|
|
|
|
|
|
|
|
push edx
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov dx,word [midisp]
|
|
|
|
|
in al,dx
|
|
|
|
|
and al,0x40
|
|
|
|
|
pop edx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
get_mpu_in:
|
|
|
|
|
|
|
|
|
|
push edx
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov dx,word [mididp]
|
|
|
|
|
in al,dx
|
|
|
|
|
pop edx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
put_mpu_out:
|
|
|
|
|
|
|
|
|
|
push edx
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov dx,word [mididp]
|
|
|
|
|
out dx,al
|
|
|
|
|
pop edx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setuart:
|
|
|
|
|
|
|
|
|
|
su1:
|
|
|
|
|
call is_output
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp al,0
|
|
|
|
|
jnz su1
|
|
|
|
|
mov dx,word [midisp]
|
|
|
|
|
mov al,0xff
|
|
|
|
|
out dx,al
|
2005-10-06 19:56:22 +02:00
|
|
|
|
su2:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov dx,word [midisp]
|
|
|
|
|
mov al,0xff
|
|
|
|
|
out dx,al
|
2005-10-06 19:56:22 +02:00
|
|
|
|
call is_input
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp al,0
|
|
|
|
|
jnz su2
|
2005-10-06 19:56:22 +02:00
|
|
|
|
call get_mpu_in
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp al,0xfe
|
|
|
|
|
jnz su2
|
2005-10-06 19:56:22 +02:00
|
|
|
|
su3:
|
|
|
|
|
call is_output
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp al,0
|
|
|
|
|
jnz su3
|
|
|
|
|
mov dx,word [midisp]
|
|
|
|
|
mov al,0x3f
|
|
|
|
|
out dx,al
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
|
|
|
|
sys_midi:
|
|
|
|
|
|
|
|
|
|
cmp [mididp],0
|
|
|
|
|
jnz sm0
|
|
|
|
|
mov [esp+36],dword 1
|
|
|
|
|
ret
|
|
|
|
|
sm0:
|
|
|
|
|
|
|
|
|
|
cmp eax,1
|
|
|
|
|
mov [esp+36],dword 0
|
|
|
|
|
jnz smn1
|
|
|
|
|
call setuart
|
|
|
|
|
ret
|
|
|
|
|
smn1:
|
|
|
|
|
|
|
|
|
|
cmp eax,2
|
|
|
|
|
jnz smn2
|
|
|
|
|
sm10:
|
|
|
|
|
call get_mpu_in
|
|
|
|
|
call is_output
|
|
|
|
|
test al,al
|
|
|
|
|
jnz sm10
|
|
|
|
|
mov al,bl
|
|
|
|
|
call put_mpu_out
|
|
|
|
|
ret
|
|
|
|
|
smn2:
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
detect_devices:
|
|
|
|
|
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
include 'detect/commouse.inc'
|
2007-05-08 13:32:58 +02:00
|
|
|
|
;include 'detect/ps2mouse.inc'
|
2005-10-06 19:56:22 +02:00
|
|
|
|
;include 'detect/dev_fd.inc'
|
|
|
|
|
;include 'detect/dev_hdcd.inc'
|
|
|
|
|
;include 'detect/sear_par.inc'
|
|
|
|
|
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sys_end:
|
|
|
|
|
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov eax,[TASK_BASE]
|
2006-08-06 12:29:45 +02:00
|
|
|
|
mov [eax+TASKDATA.state], 3 ; terminate this program
|
2006-02-01 07:07:36 +01:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
waitterm: ; wait here for termination
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov eax,5
|
|
|
|
|
call delay_hs
|
|
|
|
|
jmp waitterm
|
|
|
|
|
|
2006-05-05 14:40:02 +02:00
|
|
|
|
iglobal
|
2006-10-08 09:48:38 +02:00
|
|
|
|
align 4
|
2006-05-05 14:40:02 +02:00
|
|
|
|
sys_system_table:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
dd sysfn_shutdown ; 1 = system shutdown
|
|
|
|
|
dd sysfn_terminate ; 2 = terminate thread
|
|
|
|
|
dd sysfn_activate ; 3 = activate window
|
|
|
|
|
dd sysfn_getidletime ; 4 = get idle time
|
|
|
|
|
dd sysfn_getcpuclock ; 5 = get cpu clock
|
|
|
|
|
dd sysfn_saveramdisk ; 6 = save ramdisk
|
|
|
|
|
dd sysfn_getactive ; 7 = get active window
|
|
|
|
|
dd sysfn_sound_flag ; 8 = get/set sound_flag
|
|
|
|
|
dd sysfn_shutdown_param ; 9 = shutdown with parameter
|
|
|
|
|
dd sysfn_minimize ; 10 = minimize window
|
|
|
|
|
dd sysfn_getdiskinfo ; 11 = get disk subsystem info
|
|
|
|
|
dd sysfn_lastkey ; 12 = get last pressed key
|
|
|
|
|
dd sysfn_getversion ; 13 = get kernel version
|
|
|
|
|
dd sysfn_waitretrace ; 14 = wait retrace
|
|
|
|
|
dd sysfn_centermouse ; 15 = center mouse cursor
|
|
|
|
|
dd sysfn_getfreemem ; 16 = get free memory size
|
|
|
|
|
dd sysfn_getallmem ; 17 = get total memory size
|
|
|
|
|
dd sysfn_terminate2 ; 18 = terminate thread using PID
|
|
|
|
|
; instead of slot
|
|
|
|
|
dd sysfn_mouse_acceleration; 19 = set/get mouse acceleration
|
|
|
|
|
dd sysfn_meminfo ; 20 = get extended memory info
|
2006-05-05 14:40:02 +02:00
|
|
|
|
sysfn_num = ($ - sys_system_table)/4
|
|
|
|
|
endg
|
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
sys_system:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
dec eax
|
|
|
|
|
cmp eax, sysfn_num
|
|
|
|
|
jae @f
|
|
|
|
|
jmp dword [sys_system_table + eax*4]
|
2006-05-05 14:40:02 +02:00
|
|
|
|
@@:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
sysfn_shutdown: ; 18.1 = BOOT
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov [BOOT_VAR+0x9030],byte 0
|
2006-02-01 07:07:36 +01:00
|
|
|
|
for_shutdown_parameter:
|
2006-11-20 08:06:00 +01:00
|
|
|
|
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov eax,[TASK_COUNT]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
add eax,2
|
|
|
|
|
mov [shutdown_processes],eax
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov [SYS_SHUTDOWN],al
|
2006-05-05 14:40:02 +02:00
|
|
|
|
and dword [esp+36], 0
|
2005-10-06 19:56:22 +02:00
|
|
|
|
ret
|
|
|
|
|
uglobal
|
|
|
|
|
shutdown_processes: dd 0x0
|
|
|
|
|
endg
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
sysfn_terminate: ; 18.2 = TERMINATE
|
2005-10-06 19:56:22 +02:00
|
|
|
|
cmp ebx,2
|
|
|
|
|
jb noprocessterminate
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edx,[TASK_COUNT]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
cmp ebx,edx
|
2006-05-05 14:40:02 +02:00
|
|
|
|
ja noprocessterminate
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov eax,[TASK_COUNT]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
shl ebx,5
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edx,[ebx+CURRENT_TASK+TASKDATA.pid]
|
|
|
|
|
add ebx,CURRENT_TASK+TASKDATA.state
|
2006-05-05 14:40:02 +02:00
|
|
|
|
cmp byte [ebx], 9
|
|
|
|
|
jz noprocessterminate
|
2006-02-01 07:07:36 +01:00
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
;call MEM_Heap_Lock ;guarantee that process isn't working with heap
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov [ebx],byte 3 ; clear possible i40's
|
2005-10-06 19:56:22 +02:00
|
|
|
|
;call MEM_Heap_UnLock
|
|
|
|
|
|
|
|
|
|
cmp edx,[application_table_status] ; clear app table stat
|
|
|
|
|
jne noatsc
|
|
|
|
|
mov [application_table_status],0
|
|
|
|
|
noatsc:
|
|
|
|
|
noprocessterminate:
|
2006-05-05 14:40:02 +02:00
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2006-06-14 09:42:59 +02:00
|
|
|
|
sysfn_terminate2:
|
|
|
|
|
;lock application_table_status mutex
|
2006-10-06 08:09:41 +02:00
|
|
|
|
.table_status:
|
2006-06-14 09:42:59 +02:00
|
|
|
|
cli
|
|
|
|
|
cmp [application_table_status],0
|
2007-03-23 04:11:34 +01:00
|
|
|
|
je .stf
|
2006-06-14 09:42:59 +02:00
|
|
|
|
sti
|
|
|
|
|
call change_task
|
|
|
|
|
jmp .table_status
|
|
|
|
|
.stf:
|
|
|
|
|
call set_application_table_status
|
|
|
|
|
mov eax,ebx
|
|
|
|
|
call pid_to_slot
|
|
|
|
|
test eax,eax
|
2007-03-23 04:11:34 +01:00
|
|
|
|
jz .not_found
|
2006-06-14 09:42:59 +02:00
|
|
|
|
mov ebx,eax
|
|
|
|
|
cli
|
|
|
|
|
call sysfn_terminate
|
|
|
|
|
mov [application_table_status],0
|
|
|
|
|
sti
|
|
|
|
|
and dword [esp+36],0
|
|
|
|
|
ret
|
|
|
|
|
.not_found:
|
|
|
|
|
mov [application_table_status],0
|
2007-03-23 04:11:34 +01:00
|
|
|
|
or dword [esp+36],-1
|
2006-06-14 09:42:59 +02:00
|
|
|
|
ret
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
sysfn_activate: ; 18.3 = ACTIVATE WINDOW
|
2005-10-06 19:56:22 +02:00
|
|
|
|
cmp ebx,2
|
2006-07-25 12:48:35 +02:00
|
|
|
|
jb .nowindowactivate
|
2007-02-28 09:52:06 +01:00
|
|
|
|
cmp ebx,[TASK_COUNT]
|
2006-07-25 12:48:35 +02:00
|
|
|
|
ja .nowindowactivate
|
|
|
|
|
|
|
|
|
|
mov [window_minimize], 2 ; restore window if minimized
|
|
|
|
|
|
2007-02-28 11:51:05 +01:00
|
|
|
|
movzx esi, word [WIN_STACK + ebx*2]
|
2007-02-28 09:52:06 +01:00
|
|
|
|
cmp esi, [TASK_COUNT]
|
2006-07-25 12:48:35 +02:00
|
|
|
|
je .nowindowactivate ; already active
|
|
|
|
|
|
|
|
|
|
mov edi, ebx
|
|
|
|
|
shl edi, 5
|
|
|
|
|
add edi, window_data
|
2007-02-28 11:51:05 +01:00
|
|
|
|
movzx esi, word [WIN_STACK + ebx * 2]
|
|
|
|
|
lea esi, [WIN_POS + esi * 2]
|
2006-07-25 12:48:35 +02:00
|
|
|
|
call waredraw
|
|
|
|
|
.nowindowactivate:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
ret
|
2006-02-01 07:07:36 +01:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
sysfn_getidletime: ; 18.4 = GET IDLETIME
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov eax,[idleusesec]
|
2006-05-05 14:40:02 +02:00
|
|
|
|
mov [esp+36], eax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
ret
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
sysfn_getcpuclock: ; 18.5 = GET TSC/SEC
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov eax,[CPU_FREQ]
|
2006-05-05 14:40:02 +02:00
|
|
|
|
mov [esp+36], eax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
; SAVE ramdisk to /hd/1/menuet.img
|
|
|
|
|
;!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
include 'blkdev/rdsave.inc'
|
|
|
|
|
;!!!!!!!!!!!!!!!!!!!!!!!!
|
2006-05-05 14:40:02 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
sysfn_getactive: ; 18.7 = get active window
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov eax, [TASK_COUNT]
|
2007-02-28 11:51:05 +01:00
|
|
|
|
movzx eax, word [WIN_POS + eax*2]
|
2006-05-05 14:40:02 +02:00
|
|
|
|
mov [esp+36],eax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
ret
|
2006-05-05 14:40:02 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
sysfn_sound_flag: ; 18.8 = get/set sound_flag
|
2005-10-06 19:56:22 +02:00
|
|
|
|
cmp ebx,1
|
|
|
|
|
jne nogetsoundflag
|
|
|
|
|
movzx eax,byte [sound_flag] ; get sound_flag
|
2006-05-05 14:40:02 +02:00
|
|
|
|
mov [esp+36],eax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
ret
|
|
|
|
|
nogetsoundflag:
|
|
|
|
|
cmp ebx,2
|
|
|
|
|
jnz nosoundflag
|
2006-05-05 14:40:02 +02:00
|
|
|
|
xor byte [sound_flag], 1
|
|
|
|
|
nosoundflag:
|
2006-02-01 07:07:36 +01:00
|
|
|
|
ret
|
2006-05-05 14:40:02 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
sysfn_shutdown_param: ; 18.9 = system shutdown with param
|
2005-10-06 19:56:22 +02:00
|
|
|
|
cmp ebx,1
|
2006-05-05 14:40:02 +02:00
|
|
|
|
jl exit_for_anyone
|
2005-10-06 19:56:22 +02:00
|
|
|
|
cmp ebx,4
|
|
|
|
|
jg exit_for_anyone
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov [BOOT_VAR+0x9030],bl
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jmp for_shutdown_parameter
|
2006-05-05 14:40:02 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
sysfn_minimize: ; 18.10 = minimize window
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov [window_minimize],1
|
|
|
|
|
exit_for_anyone:
|
|
|
|
|
ret
|
2006-05-05 14:40:02 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
sysfn_getdiskinfo: ; 18.11 = get disk info table
|
2005-10-06 19:56:22 +02:00
|
|
|
|
cmp ebx,1
|
|
|
|
|
jnz full_table
|
|
|
|
|
small_table:
|
|
|
|
|
call for_all_tables
|
2006-05-05 14:40:02 +02:00
|
|
|
|
mov ecx,10
|
2005-10-06 19:56:22 +02:00
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
ret
|
|
|
|
|
for_all_tables:
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edi,[TASK_BASE]
|
2006-08-06 12:29:45 +02:00
|
|
|
|
mov edi,[edi+TASKDATA.mem_start]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
add edi,ecx
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov esi,DRIVE_DATA
|
2005-10-06 19:56:22 +02:00
|
|
|
|
ret
|
|
|
|
|
full_table:
|
|
|
|
|
cmp ebx,2
|
|
|
|
|
jnz exit_for_anyone
|
|
|
|
|
call for_all_tables
|
2006-05-05 14:40:02 +02:00
|
|
|
|
mov ecx,16384
|
2005-10-06 19:56:22 +02:00
|
|
|
|
cld
|
|
|
|
|
rep movsd
|
|
|
|
|
ret
|
2006-05-05 14:40:02 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
sysfn_lastkey: ; 18.12 = return 0 (backward compatibility)
|
|
|
|
|
and dword [esp+36], 0
|
|
|
|
|
ret
|
2006-05-05 14:40:02 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
sysfn_getversion: ; 18.13 = get kernel ID and version
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edi,[TASK_BASE]
|
2006-08-06 12:29:45 +02:00
|
|
|
|
mov edi,[edi+TASKDATA.mem_start]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
add edi,ebx
|
|
|
|
|
mov esi,version_inf
|
|
|
|
|
mov ecx,version_end-version_inf
|
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
ret
|
2006-05-05 14:40:02 +02:00
|
|
|
|
|
|
|
|
|
sysfn_waitretrace: ; 18.14 = sys wait retrace
|
2006-02-01 07:07:36 +01:00
|
|
|
|
;wait retrace functions
|
|
|
|
|
sys_wait_retrace:
|
|
|
|
|
mov edx,0x3da
|
|
|
|
|
WaitRetrace_loop:
|
|
|
|
|
in al,dx
|
|
|
|
|
test al,1000b
|
|
|
|
|
jz WaitRetrace_loop
|
|
|
|
|
mov [esp+36],dword 0
|
2005-10-06 19:56:22 +02:00
|
|
|
|
ret
|
2006-05-05 14:40:02 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
sysfn_centermouse: ; 18.15 = mouse centered
|
2005-10-06 19:56:22 +02:00
|
|
|
|
call mouse_centered
|
|
|
|
|
mov [esp+36],dword 0
|
|
|
|
|
ret
|
2006-05-05 14:40:02 +02:00
|
|
|
|
|
2006-08-13 15:02:57 +02:00
|
|
|
|
sysfn_mouse_acceleration: ; 18.19 = set/get mouse features
|
|
|
|
|
cmp ebx,0 ; get mouse speed factor
|
|
|
|
|
jnz .set_mouse_acceleration
|
2006-10-06 08:09:41 +02:00
|
|
|
|
xor eax,eax
|
2006-08-13 15:02:57 +02:00
|
|
|
|
mov ax,[mouse_speed_factor]
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
|
|
|
|
.set_mouse_acceleration:
|
|
|
|
|
cmp ebx,1 ; set mouse speed factor
|
|
|
|
|
jnz .get_mouse_delay
|
|
|
|
|
mov [mouse_speed_factor],cx
|
|
|
|
|
ret
|
|
|
|
|
.get_mouse_delay:
|
|
|
|
|
cmp ebx,2 ; get mouse delay
|
|
|
|
|
jnz .set_mouse_delay
|
|
|
|
|
mov eax,[mouse_delay]
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
|
|
|
|
.set_mouse_delay:
|
|
|
|
|
cmp ebx,3 ; set mouse delay
|
|
|
|
|
jnz .set_pointer_position
|
|
|
|
|
mov [mouse_delay],ecx
|
|
|
|
|
ret
|
|
|
|
|
.set_pointer_position:
|
|
|
|
|
cmp ebx,4 ; set mouse pointer position
|
|
|
|
|
jnz .end
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov [MOUSE_Y],cx ;y
|
2006-08-13 15:02:57 +02:00
|
|
|
|
ror ecx,16
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov [MOUSE_X],cx ;x
|
2006-08-13 15:02:57 +02:00
|
|
|
|
rol ecx,16
|
|
|
|
|
.end:
|
|
|
|
|
ret
|
|
|
|
|
|
2006-05-05 14:40:02 +02:00
|
|
|
|
sysfn_getfreemem:
|
2006-10-08 09:48:38 +02:00
|
|
|
|
mov eax, [pg_data.pages_free]
|
|
|
|
|
shl eax, 2
|
|
|
|
|
mov [esp+36],eax
|
2006-01-03 12:15:05 +01:00
|
|
|
|
ret
|
2006-05-05 14:40:02 +02:00
|
|
|
|
|
|
|
|
|
sysfn_getallmem:
|
2006-10-08 09:48:38 +02:00
|
|
|
|
mov eax,[MEM_AMOUNT]
|
|
|
|
|
shr eax, 10
|
2006-05-05 14:40:02 +02:00
|
|
|
|
mov [esp+36],eax
|
2006-01-03 12:15:05 +01:00
|
|
|
|
ret
|
|
|
|
|
|
2006-02-01 07:07:36 +01:00
|
|
|
|
uglobal
|
|
|
|
|
;// mike.dld, 2006-29-01 [
|
|
|
|
|
screen_workarea RECT
|
|
|
|
|
;// mike.dld, 2006-29-01 ]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
window_minimize db 0
|
2007-03-23 04:11:34 +01:00
|
|
|
|
sound_flag db 0
|
2006-02-01 07:07:36 +01:00
|
|
|
|
endg
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2006-02-01 07:07:36 +01:00
|
|
|
|
iglobal
|
|
|
|
|
version_inf:
|
2007-02-14 17:01:07 +01:00
|
|
|
|
db 0,6,5,0 ; version 0.6.5.0
|
2006-02-01 07:07:36 +01:00
|
|
|
|
db UID_KOLIBRI
|
|
|
|
|
db 'Kolibri',0
|
|
|
|
|
version_end:
|
|
|
|
|
endg
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2006-02-01 07:07:36 +01:00
|
|
|
|
UID_NONE=0
|
2007-03-23 04:11:34 +01:00
|
|
|
|
UID_MENUETOS=1 ;official
|
|
|
|
|
UID_KOLIBRI=2 ;russian
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
sys_cachetodiskette:
|
2005-11-06 21:01:18 +01:00
|
|
|
|
; pushad
|
|
|
|
|
; cmp eax,1
|
|
|
|
|
; jne no_write_all_of_ramdisk
|
|
|
|
|
; call fdc_writeramdisk
|
|
|
|
|
; popad
|
|
|
|
|
; ret
|
|
|
|
|
; no_write_all_of_ramdisk:
|
|
|
|
|
; cmp eax,2
|
|
|
|
|
; jne no_write_part_of_ramdisk
|
|
|
|
|
; call fdc_commitflush
|
|
|
|
|
; popad
|
|
|
|
|
; ret
|
|
|
|
|
; no_write_part_of_ramdisk:
|
|
|
|
|
; cmp eax,3
|
|
|
|
|
; jne no_set_fdc
|
|
|
|
|
; call fdc_set
|
|
|
|
|
; popad
|
|
|
|
|
; ret
|
|
|
|
|
; no_set_fdc:
|
|
|
|
|
; cmp eax,4
|
|
|
|
|
; jne no_get_fdc
|
|
|
|
|
; popad
|
|
|
|
|
; call fdc_get
|
|
|
|
|
; mov [esp+36],ecx
|
|
|
|
|
; ret
|
|
|
|
|
; no_get_fdc:
|
|
|
|
|
; popad
|
|
|
|
|
; ret
|
|
|
|
|
cmp eax,1
|
|
|
|
|
jne no_floppy_a_save
|
|
|
|
|
mov [flp_number],1
|
|
|
|
|
jmp save_image_on_floppy
|
|
|
|
|
no_floppy_a_save:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
cmp eax,2
|
2005-11-06 21:01:18 +01:00
|
|
|
|
jne no_floppy_b_save
|
|
|
|
|
mov [flp_number],2
|
|
|
|
|
save_image_on_floppy:
|
|
|
|
|
call save_image
|
|
|
|
|
mov [esp+36],dword 0
|
|
|
|
|
cmp [FDC_Status],0
|
2007-03-23 04:11:34 +01:00
|
|
|
|
je yes_floppy_save
|
2005-11-06 21:01:18 +01:00
|
|
|
|
no_floppy_b_save:
|
|
|
|
|
mov [esp+36],dword 1
|
|
|
|
|
yes_floppy_save:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
uglobal
|
|
|
|
|
; bgrchanged dd 0x0
|
|
|
|
|
endg
|
|
|
|
|
|
|
|
|
|
sys_background:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp eax,1 ; BACKGROUND SIZE
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jnz nosb1
|
|
|
|
|
cmp ebx,0
|
2007-03-23 04:11:34 +01:00
|
|
|
|
je sbgrr
|
2005-10-06 19:56:22 +02:00
|
|
|
|
cmp ecx,0
|
2007-03-23 04:11:34 +01:00
|
|
|
|
je sbgrr
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov [display_data-8],ebx
|
|
|
|
|
mov [display_data-4],ecx
|
|
|
|
|
; mov [bgrchanged],1
|
2007-04-24 10:56:03 +02:00
|
|
|
|
|
|
|
|
|
pushad
|
|
|
|
|
; return memory for old background
|
|
|
|
|
stdcall kernel_free, [img_background]
|
|
|
|
|
; calculate RAW size
|
|
|
|
|
xor eax,eax
|
|
|
|
|
inc eax
|
|
|
|
|
cmp [display_data-8],eax
|
|
|
|
|
jae @f
|
|
|
|
|
mov [display_data-8],eax
|
|
|
|
|
@@:
|
|
|
|
|
cmp [display_data-4],eax
|
|
|
|
|
jae @f
|
|
|
|
|
mov [display_data-4],eax
|
|
|
|
|
@@:
|
|
|
|
|
mov eax,[display_data-8]
|
|
|
|
|
imul eax,[display_data-4]
|
|
|
|
|
inc eax
|
|
|
|
|
imul eax,3
|
|
|
|
|
mov [mem_BACKGROUND],eax
|
|
|
|
|
; get memory for new background
|
|
|
|
|
stdcall kernel_alloc, [mem_BACKGROUND]
|
|
|
|
|
test eax, eax
|
|
|
|
|
jz .exit_mem
|
|
|
|
|
mov [img_background], eax
|
|
|
|
|
.exit_mem:
|
|
|
|
|
popad
|
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
sbgrr:
|
|
|
|
|
ret
|
2007-04-24 10:56:03 +02:00
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
nosb1:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp eax,2 ; SET PIXEL
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jnz nosb2
|
2007-05-16 21:12:34 +02:00
|
|
|
|
mov edx,[mem_BACKGROUND]
|
|
|
|
|
cmp edx,ebx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jbe nosb2
|
|
|
|
|
mov edx,[ebx]
|
|
|
|
|
and edx,0xFF000000 ;255*256*256*256
|
|
|
|
|
and ecx,0x00FFFFFF ;255*256*256+255*256+255
|
|
|
|
|
add edx,ecx
|
2007-05-08 13:32:58 +02:00
|
|
|
|
;mov [ebx+IMG_BACKGROUND],edx
|
2007-04-24 10:56:03 +02:00
|
|
|
|
push eax
|
|
|
|
|
mov eax,[img_background]
|
|
|
|
|
mov [ebx+eax],edx
|
|
|
|
|
pop eax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
; mov [bgrchanged],1
|
|
|
|
|
ret
|
|
|
|
|
nosb2:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp eax,3 ; DRAW BACKGROUND
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jnz nosb3
|
|
|
|
|
draw_background_temp:
|
|
|
|
|
; cmp [bgrchanged],1 ;0
|
|
|
|
|
; je nosb31
|
|
|
|
|
;draw_background_temp:
|
|
|
|
|
; mov [bgrchanged],1 ;0
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov [REDRAW_BACKGROUND],byte 1
|
2006-05-06 16:34:30 +02:00
|
|
|
|
mov [background_defined], 1
|
2005-10-06 19:56:22 +02:00
|
|
|
|
nosb31:
|
|
|
|
|
ret
|
|
|
|
|
nosb3:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp eax,4 ; TILED / STRETCHED
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jnz nosb4
|
|
|
|
|
cmp ebx,[display_data-12]
|
2007-03-23 04:11:34 +01:00
|
|
|
|
je nosb41
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov [display_data-12],ebx
|
|
|
|
|
; mov [bgrchanged],1
|
|
|
|
|
nosb41:
|
|
|
|
|
ret
|
|
|
|
|
nosb4:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp eax,5 ; BLOCK MOVE TO BGR
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jnz nosb5
|
|
|
|
|
; bughere
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edi, [TASK_BASE]
|
2006-08-06 12:29:45 +02:00
|
|
|
|
add ebx, [edi+TASKDATA.mem_start]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov eax, ebx
|
|
|
|
|
mov ebx, ecx
|
|
|
|
|
add ecx, edx
|
2007-04-24 10:56:03 +02:00
|
|
|
|
add ebx, [img_background] ;IMG_BACKGROUND
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov ecx, edx
|
|
|
|
|
call memmove
|
|
|
|
|
.fin:
|
|
|
|
|
ret
|
|
|
|
|
nosb5:
|
2007-05-08 13:32:58 +02:00
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
ret
|
|
|
|
|
|
2007-05-08 13:32:58 +02:00
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
align 4
|
|
|
|
|
|
|
|
|
|
sys_getbackground:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp eax,1 ; SIZE
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jnz nogb1
|
|
|
|
|
mov eax,[display_data-8]
|
|
|
|
|
shl eax,16
|
|
|
|
|
mov ax,[display_data-4]
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
|
|
|
|
nogb1:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp eax,2 ; PIXEL
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jnz nogb2
|
2007-04-24 10:56:03 +02:00
|
|
|
|
; mov edx,0x160000-16
|
|
|
|
|
; cmp edx,ebx
|
|
|
|
|
; jbe nogb2
|
|
|
|
|
; mov eax, [ebx+IMG_BACKGROUND]
|
|
|
|
|
mov eax,[img_background]
|
|
|
|
|
mov eax,[ebx+eax]
|
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
and eax, 0xFFFFFF
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
|
|
|
|
nogb2:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp eax,4 ; TILED / STRETCHED
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jnz nogb4
|
|
|
|
|
mov eax,[display_data-12]
|
|
|
|
|
nogb4:
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
|
|
|
|
sys_getkey:
|
|
|
|
|
mov [esp+36],dword 1
|
2006-06-30 14:23:15 +02:00
|
|
|
|
; test main buffer
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov ebx, [CURRENT_TASK] ; TOP OF WINDOW STACK
|
2007-02-28 11:51:05 +01:00
|
|
|
|
movzx ecx,word [WIN_STACK + ebx * 2]
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edx,[TASK_COUNT]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
cmp ecx,edx
|
|
|
|
|
jne .finish
|
2007-03-01 21:32:19 +01:00
|
|
|
|
cmp [KEY_COUNT],byte 0
|
2007-03-23 04:11:34 +01:00
|
|
|
|
je .finish
|
2007-03-01 21:32:19 +01:00
|
|
|
|
movzx eax,byte [KEY_BUFF]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
shl eax,8
|
|
|
|
|
push eax
|
2007-03-01 21:32:19 +01:00
|
|
|
|
dec byte [KEY_COUNT]
|
|
|
|
|
and byte [KEY_COUNT],127
|
|
|
|
|
movzx ecx,byte [KEY_COUNT]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
add ecx,2
|
|
|
|
|
; mov esi,0xf402
|
|
|
|
|
; mov edi,0xf401
|
|
|
|
|
; cld
|
|
|
|
|
; rep movsb
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov eax, KEY_BUFF+1
|
|
|
|
|
mov ebx, KEY_BUFF
|
2005-10-06 19:56:22 +02:00
|
|
|
|
call memmove
|
|
|
|
|
pop eax
|
2006-06-30 14:23:15 +02:00
|
|
|
|
.ret_eax:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
2006-06-30 14:23:15 +02:00
|
|
|
|
.finish:
|
|
|
|
|
; test hotkeys buffer
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov ecx, hotkey_buffer
|
2006-06-30 14:23:15 +02:00
|
|
|
|
@@:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp [ecx], ebx
|
|
|
|
|
jz .found
|
|
|
|
|
add ecx, 8
|
|
|
|
|
cmp ecx, hotkey_buffer+120*8
|
|
|
|
|
jb @b
|
|
|
|
|
ret
|
2006-06-30 14:23:15 +02:00
|
|
|
|
.found:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov ax, [ecx+6]
|
|
|
|
|
shl eax, 16
|
|
|
|
|
mov ah, [ecx+4]
|
|
|
|
|
mov al, 2
|
|
|
|
|
and dword [ecx+4], 0
|
|
|
|
|
and dword [ecx], 0
|
|
|
|
|
jmp .ret_eax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
|
|
|
|
sys_getbutton:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov ebx, [CURRENT_TASK] ; TOP OF WINDOW STACK
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov [esp+36],dword 1
|
2007-02-28 11:51:05 +01:00
|
|
|
|
movzx ecx, word [WIN_STACK + ebx * 2]
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edx, [TASK_COUNT] ; less than 256 processes
|
2005-10-06 19:56:22 +02:00
|
|
|
|
cmp ecx,edx
|
|
|
|
|
jne .exit
|
2007-03-01 21:32:19 +01:00
|
|
|
|
movzx eax,byte [BTN_COUNT]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
test eax,eax
|
2007-03-23 04:11:34 +01:00
|
|
|
|
jz .exit
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov eax,[BTN_BUFF]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
shl eax,8
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov [BTN_COUNT],byte 0
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
.exit:
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
|
|
|
|
sys_cpuusage:
|
|
|
|
|
|
|
|
|
|
; RETURN:
|
|
|
|
|
;
|
|
|
|
|
; +00 dword process cpu usage
|
|
|
|
|
; +04 word position in windowing stack
|
|
|
|
|
; +06 word windowing stack value at current position (cpu nro)
|
|
|
|
|
; +10 12 bytes name
|
|
|
|
|
; +22 dword start in mem
|
|
|
|
|
; +26 dword used mem
|
|
|
|
|
; +30 dword PID , process idenfification number
|
|
|
|
|
;
|
|
|
|
|
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edi,[TASK_BASE] ; eax = return area
|
2006-08-06 12:29:45 +02:00
|
|
|
|
add eax,[edi + TASKDATA.mem_start]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp ebx,-1 ; who am I ?
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jne no_who_am_i
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov ebx,[CURRENT_TASK]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
no_who_am_i:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
push eax ; return area
|
|
|
|
|
push ebx ; process number
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
push ebx
|
|
|
|
|
push ebx
|
|
|
|
|
push eax
|
|
|
|
|
|
|
|
|
|
; return memory usage
|
|
|
|
|
|
|
|
|
|
xor edx,edx
|
|
|
|
|
mov eax,0x20
|
|
|
|
|
mul ebx
|
2007-02-28 09:52:06 +01:00
|
|
|
|
add eax,CURRENT_TASK+TASKDATA.cpu_usage
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov ebx,eax
|
|
|
|
|
pop eax
|
|
|
|
|
mov ecx,[ebx]
|
|
|
|
|
mov [eax],ecx
|
|
|
|
|
pop ebx
|
2007-02-28 11:51:05 +01:00
|
|
|
|
mov cx, [WIN_STACK + ebx * 2]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov [eax+4],cx
|
2007-02-28 11:51:05 +01:00
|
|
|
|
mov cx, [WIN_POS + ebx * 2]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov [eax+6],cx
|
|
|
|
|
push eax
|
|
|
|
|
mov eax,ebx
|
|
|
|
|
shl eax,8
|
2007-02-28 11:51:05 +01:00
|
|
|
|
add eax,SLOT_BASE+APPDATA.app_name
|
2005-10-06 19:56:22 +02:00
|
|
|
|
pop ebx
|
|
|
|
|
add ebx,10
|
|
|
|
|
mov ecx,11
|
|
|
|
|
call memmove
|
|
|
|
|
|
|
|
|
|
; memory usage
|
|
|
|
|
|
|
|
|
|
xor eax,eax
|
|
|
|
|
mov edx,0x100000*16
|
2007-03-23 04:11:34 +01:00
|
|
|
|
pop ecx ; get gdt of tss
|
2005-10-06 19:56:22 +02:00
|
|
|
|
cmp ecx,1
|
2007-03-23 04:11:34 +01:00
|
|
|
|
je os_mem
|
2005-10-06 19:56:22 +02:00
|
|
|
|
shl ecx,8
|
2007-02-28 11:51:05 +01:00
|
|
|
|
mov edx,[SLOT_BASE+ecx+APPDATA.mem_size] ;0x8c
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov eax,std_application_base_address
|
|
|
|
|
; eax run base -> edx used memory
|
|
|
|
|
os_mem:
|
|
|
|
|
dec edx
|
|
|
|
|
mov [ebx+12],eax
|
|
|
|
|
mov [ebx+16],edx
|
|
|
|
|
|
|
|
|
|
; PID (+30)
|
|
|
|
|
|
|
|
|
|
mov eax,[esp]
|
|
|
|
|
shl eax,5
|
2007-02-28 09:52:06 +01:00
|
|
|
|
add eax,CURRENT_TASK+TASKDATA.pid
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov eax,[eax]
|
|
|
|
|
mov [ebx+20],eax
|
|
|
|
|
|
|
|
|
|
; window position and size
|
|
|
|
|
|
|
|
|
|
mov esi,[esp]
|
|
|
|
|
shl esi,5
|
2006-08-06 12:29:45 +02:00
|
|
|
|
add esi,window_data + WDATA.box
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov edi,[esp+4]
|
|
|
|
|
add edi,34
|
2006-08-06 12:29:45 +02:00
|
|
|
|
mov ecx,4
|
2005-10-06 19:56:22 +02:00
|
|
|
|
cld
|
2006-08-06 12:29:45 +02:00
|
|
|
|
rep movsd
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
; Process state (+50)
|
|
|
|
|
|
|
|
|
|
mov eax,[esp]
|
|
|
|
|
shl eax,5
|
2007-02-28 09:52:06 +01:00
|
|
|
|
add eax,CURRENT_TASK+TASKDATA.state
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov eax,[eax]
|
|
|
|
|
mov [ebx+40],ax
|
|
|
|
|
|
2006-08-27 19:42:37 +02:00
|
|
|
|
; Window client area box
|
|
|
|
|
|
|
|
|
|
mov esi,[esp]
|
|
|
|
|
shl esi,8
|
2007-02-28 11:51:05 +01:00
|
|
|
|
add esi,SLOT_BASE+APPDATA.wnd_clientbox
|
2006-08-27 19:42:37 +02:00
|
|
|
|
lea edi,[ebx+44]
|
|
|
|
|
mov ecx,4
|
|
|
|
|
rep movsd
|
2006-10-06 08:09:41 +02:00
|
|
|
|
|
|
|
|
|
; Window state
|
|
|
|
|
|
2006-08-27 19:42:37 +02:00
|
|
|
|
mov esi,[esp]
|
|
|
|
|
shl esi,5
|
|
|
|
|
add esi,window_data + WDATA.box
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov al,[esi+WDATA.fl_wstate]
|
2006-10-06 08:09:41 +02:00
|
|
|
|
mov [edi],al
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
pop ebx
|
|
|
|
|
pop eax
|
|
|
|
|
|
|
|
|
|
; return number of processes
|
|
|
|
|
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov eax,[TASK_COUNT]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
sys_clock:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cli
|
2005-10-06 19:56:22 +02:00
|
|
|
|
; Mikhail Lisovin xx Jan 2005
|
2007-03-23 04:11:34 +01:00
|
|
|
|
@@: mov al, 10
|
|
|
|
|
out 0x70, al
|
|
|
|
|
in al, 0x71
|
|
|
|
|
test al, al
|
|
|
|
|
jns @f
|
|
|
|
|
mov esi, 1
|
|
|
|
|
call delay_ms
|
|
|
|
|
jmp @b
|
2005-10-06 19:56:22 +02:00
|
|
|
|
@@:
|
|
|
|
|
; end Lisovin's fix
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
xor al,al ; seconds
|
|
|
|
|
out 0x70,al
|
|
|
|
|
in al,0x71
|
|
|
|
|
movzx ecx,al
|
|
|
|
|
mov al,02 ; minutes
|
|
|
|
|
shl ecx,16
|
|
|
|
|
out 0x70,al
|
|
|
|
|
in al,0x71
|
|
|
|
|
movzx edx,al
|
|
|
|
|
mov al,04 ; hours
|
|
|
|
|
shl edx,8
|
|
|
|
|
out 0x70,al
|
|
|
|
|
in al,0x71
|
|
|
|
|
add ecx,edx
|
|
|
|
|
movzx edx,al
|
|
|
|
|
add ecx,edx
|
|
|
|
|
sti
|
|
|
|
|
mov [esp+36],ecx
|
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
|
|
|
|
sys_date:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cli
|
2006-05-05 14:40:02 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
@@: mov al, 10
|
|
|
|
|
out 0x70, al
|
|
|
|
|
in al, 0x71
|
|
|
|
|
test al, al
|
|
|
|
|
jns @f
|
|
|
|
|
mov esi, 1
|
|
|
|
|
call delay_ms
|
|
|
|
|
jmp @b
|
2006-05-05 14:40:02 +02:00
|
|
|
|
@@:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov ch,0
|
|
|
|
|
mov al,7 ; date
|
|
|
|
|
out 0x70,al
|
|
|
|
|
in al,0x71
|
|
|
|
|
mov cl,al
|
|
|
|
|
mov al,8 ; month
|
|
|
|
|
shl ecx,16
|
|
|
|
|
out 0x70,al
|
|
|
|
|
in al,0x71
|
|
|
|
|
mov ch,al
|
|
|
|
|
mov al,9 ; year
|
|
|
|
|
out 0x70,al
|
|
|
|
|
in al,0x71
|
|
|
|
|
mov cl,al
|
|
|
|
|
sti
|
|
|
|
|
mov [esp+36],ecx
|
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; redraw status
|
|
|
|
|
|
|
|
|
|
sys_redrawstat:
|
|
|
|
|
|
|
|
|
|
cmp eax,1
|
|
|
|
|
jne no_widgets_away
|
|
|
|
|
|
|
|
|
|
; buttons away
|
|
|
|
|
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov ecx,[CURRENT_TASK]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
sys_newba2:
|
|
|
|
|
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov edi,[BTN_ADDR]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
cmp [edi],dword 0 ; empty button list ?
|
2007-03-23 04:11:34 +01:00
|
|
|
|
je end_of_buttons_away
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
movzx ebx,word [edi]
|
|
|
|
|
inc ebx
|
|
|
|
|
|
|
|
|
|
mov eax,edi
|
|
|
|
|
|
|
|
|
|
sys_newba:
|
|
|
|
|
|
|
|
|
|
dec ebx
|
2007-03-23 04:11:34 +01:00
|
|
|
|
jz end_of_buttons_away
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
add eax,0x10
|
|
|
|
|
cmp cx,[eax]
|
|
|
|
|
jnz sys_newba
|
|
|
|
|
|
|
|
|
|
push eax ebx ecx
|
|
|
|
|
mov ecx,ebx
|
|
|
|
|
inc ecx
|
|
|
|
|
shl ecx,4
|
|
|
|
|
mov ebx,eax
|
|
|
|
|
add eax,0x10
|
|
|
|
|
call memmove
|
|
|
|
|
dec dword [edi]
|
|
|
|
|
pop ecx ebx eax
|
|
|
|
|
|
|
|
|
|
jmp sys_newba2
|
|
|
|
|
|
|
|
|
|
end_of_buttons_away:
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
no_widgets_away:
|
|
|
|
|
|
|
|
|
|
cmp eax,2
|
|
|
|
|
jnz srl1
|
|
|
|
|
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edx,[TASK_BASE] ; return whole screen draw area for this app
|
|
|
|
|
add edx,draw_data-CURRENT_TASK
|
2006-08-06 12:29:45 +02:00
|
|
|
|
mov [edx+RECT.left], 0
|
|
|
|
|
mov [edx+RECT.top], 0
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov eax,[ScreenWidth]
|
2006-08-06 12:29:45 +02:00
|
|
|
|
mov [edx+RECT.right],eax
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov eax,[ScreenHeight]
|
2006-08-06 12:29:45 +02:00
|
|
|
|
mov [edx+RECT.bottom],eax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edi,[TASK_BASE]
|
2007-03-23 04:11:34 +01:00
|
|
|
|
or [edi-twdw+WDATA.fl_wdrawn], 1 ; no new position & buttons from app
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
call sys_window_mouse
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
srl1:
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sys_drawwindow:
|
|
|
|
|
|
|
|
|
|
mov edi,ecx
|
|
|
|
|
shr edi,16+8
|
|
|
|
|
and edi,15
|
|
|
|
|
|
|
|
|
|
cmp edi,0 ; type I - original style
|
|
|
|
|
jne nosyswI
|
2006-01-06 12:46:26 +01:00
|
|
|
|
inc [mouse_pause]
|
2006-01-13 19:30:12 +01:00
|
|
|
|
call [disable_mouse]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
call sys_set_window
|
2006-01-13 19:30:12 +01:00
|
|
|
|
call [disable_mouse]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
call drawwindow_I
|
2006-08-03 21:30:32 +02:00
|
|
|
|
;dec [mouse_pause]
|
|
|
|
|
;call [draw_pointer]
|
|
|
|
|
;ret
|
|
|
|
|
jmp draw_window_caption.2
|
2005-10-06 19:56:22 +02:00
|
|
|
|
nosyswI:
|
|
|
|
|
|
|
|
|
|
cmp edi,1 ; type II - only reserve area, no draw
|
|
|
|
|
jne nosyswII
|
2006-01-06 12:46:26 +01:00
|
|
|
|
inc [mouse_pause]
|
2006-01-13 19:30:12 +01:00
|
|
|
|
call [disable_mouse]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
call sys_set_window
|
2006-01-13 19:30:12 +01:00
|
|
|
|
call [disable_mouse]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
call sys_window_mouse
|
2006-01-06 12:46:26 +01:00
|
|
|
|
dec [mouse_pause]
|
2006-01-13 19:30:12 +01:00
|
|
|
|
call [draw_pointer]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
ret
|
|
|
|
|
nosyswII:
|
|
|
|
|
|
|
|
|
|
cmp edi,2 ; type III - new style
|
|
|
|
|
jne nosyswIII
|
2006-01-06 12:46:26 +01:00
|
|
|
|
inc [mouse_pause]
|
2006-01-13 19:30:12 +01:00
|
|
|
|
call [disable_mouse]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
call sys_set_window
|
2006-01-13 19:30:12 +01:00
|
|
|
|
call [disable_mouse]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
call drawwindow_III
|
2006-08-03 21:30:32 +02:00
|
|
|
|
;dec [mouse_pause]
|
|
|
|
|
;call [draw_pointer]
|
|
|
|
|
;ret
|
|
|
|
|
jmp draw_window_caption.2
|
2005-10-06 19:56:22 +02:00
|
|
|
|
nosyswIII:
|
|
|
|
|
|
|
|
|
|
cmp edi,3 ; type IV - skinned window
|
|
|
|
|
jne nosyswIV
|
2006-01-06 12:46:26 +01:00
|
|
|
|
|
2006-07-23 16:47:32 +02:00
|
|
|
|
; parameter for drawwindow_IV
|
2006-01-11 11:18:52 +01:00
|
|
|
|
push 0
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edi, [TASK_COUNT]
|
2007-02-28 11:51:05 +01:00
|
|
|
|
movzx edi, word [WIN_POS + edi*2]
|
2007-02-28 09:52:06 +01:00
|
|
|
|
cmp edi, [CURRENT_TASK]
|
2006-01-06 12:46:26 +01:00
|
|
|
|
jne @f
|
2006-07-23 16:47:32 +02:00
|
|
|
|
inc dword [esp]
|
|
|
|
|
@@:
|
2006-01-06 12:46:26 +01:00
|
|
|
|
|
|
|
|
|
inc [mouse_pause]
|
2006-01-13 19:30:12 +01:00
|
|
|
|
call [disable_mouse]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
call sys_set_window
|
2006-01-13 19:30:12 +01:00
|
|
|
|
call [disable_mouse]
|
|
|
|
|
call drawwindow_IV
|
2006-08-03 21:30:32 +02:00
|
|
|
|
;dec [mouse_pause]
|
|
|
|
|
;call [draw_pointer]
|
|
|
|
|
;ret
|
|
|
|
|
jmp draw_window_caption.2
|
2005-10-06 19:56:22 +02:00
|
|
|
|
nosyswIV:
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
2006-08-03 21:30:32 +02:00
|
|
|
|
draw_window_caption:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
inc [mouse_pause]
|
|
|
|
|
call [disable_mouse]
|
|
|
|
|
|
|
|
|
|
xor eax,eax
|
|
|
|
|
mov edx,[TASK_COUNT]
|
|
|
|
|
movzx edx,word[WIN_POS+edx*2]
|
|
|
|
|
cmp edx,[CURRENT_TASK]
|
|
|
|
|
jne @f
|
|
|
|
|
inc eax
|
|
|
|
|
@@: mov edx,[CURRENT_TASK]
|
|
|
|
|
shl edx,5
|
|
|
|
|
add edx,window_data
|
|
|
|
|
movzx ebx,[edx+WDATA.fl_wstyle]
|
|
|
|
|
and bl,0x0F
|
|
|
|
|
cmp bl,3
|
|
|
|
|
jne .not_style_3
|
|
|
|
|
|
|
|
|
|
push edx
|
|
|
|
|
call drawwindow_IV_caption
|
|
|
|
|
add esp,4
|
|
|
|
|
jmp .2
|
2006-08-03 21:30:32 +02:00
|
|
|
|
|
|
|
|
|
.not_style_3:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp bl,2
|
|
|
|
|
jne .not_style_2
|
2006-08-03 21:30:32 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
call drawwindow_III_caption
|
|
|
|
|
jmp .2
|
2006-08-03 21:30:32 +02:00
|
|
|
|
|
|
|
|
|
.not_style_2:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp bl,0
|
|
|
|
|
jne .2
|
2006-08-03 21:30:32 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
call drawwindow_I_caption
|
2006-08-03 21:30:32 +02:00
|
|
|
|
|
|
|
|
|
;--------------------------------------------------------------
|
2007-03-23 04:11:34 +01:00
|
|
|
|
.2: ;jmp @f
|
|
|
|
|
mov edi,[CURRENT_TASK]
|
|
|
|
|
shl edi,5
|
|
|
|
|
test [edi+window_data+WDATA.fl_wstyle],WSTYLE_HASCAPTION
|
|
|
|
|
jz @f
|
|
|
|
|
mov ecx,[edi*8+SLOT_BASE+APPDATA.wnd_caption]
|
|
|
|
|
or ecx,ecx
|
|
|
|
|
jz @f
|
2007-04-18 08:37:14 +02:00
|
|
|
|
add ecx,[edi+CURRENT_TASK+TASKDATA.mem_start]
|
2007-03-23 04:11:34 +01:00
|
|
|
|
|
|
|
|
|
movzx eax,[edi+window_data+WDATA.fl_wstyle]
|
|
|
|
|
and al,0x0F
|
|
|
|
|
cmp al,3
|
|
|
|
|
jne .not_skinned
|
|
|
|
|
|
|
|
|
|
mov ebp,[edi+window_data+WDATA.box.left-2]
|
|
|
|
|
mov bp,word[edi+window_data+WDATA.box.top]
|
|
|
|
|
movzx eax,word[edi+window_data+WDATA.box.width]
|
|
|
|
|
sub ax,[_skinmargins.left]
|
|
|
|
|
sub ax,[_skinmargins.right]
|
|
|
|
|
cwde
|
|
|
|
|
cdq
|
|
|
|
|
mov ebx,6
|
|
|
|
|
idiv ebx
|
|
|
|
|
or eax,eax
|
|
|
|
|
js @f
|
|
|
|
|
mov edx,eax
|
|
|
|
|
mov eax,dword[_skinmargins.left-2]
|
|
|
|
|
mov ax,word[_skinh]
|
|
|
|
|
sub ax,[_skinmargins.bottom]
|
|
|
|
|
sub ax,[_skinmargins.top]
|
|
|
|
|
sar ax,1
|
|
|
|
|
adc ax,0
|
|
|
|
|
add ax,[_skinmargins.top]
|
|
|
|
|
add ax,-3
|
|
|
|
|
add eax,ebp
|
|
|
|
|
jmp .dodraw
|
2006-08-03 21:30:32 +02:00
|
|
|
|
|
|
|
|
|
.not_skinned:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp al,1
|
|
|
|
|
je @f
|
|
|
|
|
|
|
|
|
|
mov ebp,[edi+window_data+WDATA.box.left-2]
|
|
|
|
|
mov bp,word[edi+window_data+WDATA.box.top]
|
|
|
|
|
movzx eax,word[edi+window_data+WDATA.box.width]
|
|
|
|
|
sub eax,16
|
|
|
|
|
cwde
|
|
|
|
|
cdq
|
|
|
|
|
mov ebx,6
|
|
|
|
|
idiv ebx
|
|
|
|
|
or eax,eax
|
|
|
|
|
js @f
|
|
|
|
|
mov edx,eax
|
|
|
|
|
mov eax,0x00080007
|
|
|
|
|
add eax,ebp
|
2006-08-28 15:34:54 +02:00
|
|
|
|
.dodraw:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov ebx,[common_colours+16];0x00FFFFFF
|
|
|
|
|
or ebx, 0x80000000
|
|
|
|
|
xor edi,edi
|
|
|
|
|
call dtext
|
2006-08-03 21:30:32 +02:00
|
|
|
|
|
|
|
|
|
@@:
|
|
|
|
|
;--------------------------------------------------------------
|
2007-03-23 04:11:34 +01:00
|
|
|
|
dec [mouse_pause]
|
|
|
|
|
call [draw_pointer]
|
|
|
|
|
ret
|
2006-08-03 21:30:32 +02:00
|
|
|
|
|
|
|
|
|
iglobal
|
|
|
|
|
align 4
|
|
|
|
|
window_topleft dd \
|
|
|
|
|
1, 21,\
|
|
|
|
|
0, 0,\
|
|
|
|
|
5, 20,\
|
|
|
|
|
5, ?
|
|
|
|
|
endg
|
|
|
|
|
|
|
|
|
|
set_window_clientbox:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
push eax ecx edi
|
|
|
|
|
|
|
|
|
|
mov eax,[_skinh]
|
|
|
|
|
mov [window_topleft+4*7],eax
|
|
|
|
|
|
|
|
|
|
mov ecx,edi
|
|
|
|
|
sub edi,window_data
|
|
|
|
|
shl edi,3
|
|
|
|
|
test [ecx+WDATA.fl_wstyle],WSTYLE_CLIENTRELATIVE
|
|
|
|
|
jz @f
|
|
|
|
|
|
|
|
|
|
movzx eax,[ecx+WDATA.fl_wstyle]
|
|
|
|
|
and eax,0x0F
|
|
|
|
|
mov eax,[eax*8+window_topleft+0]
|
|
|
|
|
mov [edi+SLOT_BASE+APPDATA.wnd_clientbox.left],eax
|
|
|
|
|
shl eax,1
|
|
|
|
|
neg eax
|
|
|
|
|
add eax,[ecx+WDATA.box.width]
|
|
|
|
|
mov [edi+SLOT_BASE+APPDATA.wnd_clientbox.width],eax
|
|
|
|
|
|
|
|
|
|
movzx eax,[ecx+WDATA.fl_wstyle]
|
|
|
|
|
and eax,0x0F
|
|
|
|
|
push [eax*8+window_topleft+0]
|
|
|
|
|
mov eax,[eax*8+window_topleft+4]
|
|
|
|
|
mov [edi+SLOT_BASE+APPDATA.wnd_clientbox.top],eax
|
|
|
|
|
neg eax
|
|
|
|
|
sub eax,[esp]
|
|
|
|
|
add eax,[ecx+WDATA.box.height]
|
|
|
|
|
mov [edi+SLOT_BASE+APPDATA.wnd_clientbox.height],eax
|
|
|
|
|
add esp,4
|
|
|
|
|
|
|
|
|
|
pop edi ecx eax
|
|
|
|
|
ret
|
2006-08-03 21:30:32 +02:00
|
|
|
|
@@:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
xor eax,eax
|
|
|
|
|
mov [edi+SLOT_BASE+APPDATA.wnd_clientbox.left],eax
|
|
|
|
|
mov [edi+SLOT_BASE+APPDATA.wnd_clientbox.top],eax
|
|
|
|
|
mov eax,[ecx+WDATA.box.width]
|
|
|
|
|
mov [edi+SLOT_BASE+APPDATA.wnd_clientbox.width],eax
|
|
|
|
|
mov eax,[ecx+WDATA.box.height]
|
|
|
|
|
mov [edi+SLOT_BASE+APPDATA.wnd_clientbox.height],eax
|
|
|
|
|
|
|
|
|
|
pop edi ecx eax
|
|
|
|
|
ret
|
2006-08-03 21:30:32 +02:00
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
sys_set_window:
|
|
|
|
|
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edi,[CURRENT_TASK]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
shl edi,5
|
|
|
|
|
add edi,window_data
|
|
|
|
|
|
|
|
|
|
; colors
|
2006-08-03 21:30:32 +02:00
|
|
|
|
mov [edi+WDATA.cl_workarea],ecx
|
|
|
|
|
mov [edi+WDATA.cl_titlebar],edx
|
|
|
|
|
mov [edi+WDATA.cl_frames],esi
|
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
; check flag (?)
|
2006-10-18 13:29:50 +02:00
|
|
|
|
test [edi+WDATA.fl_wdrawn],1
|
|
|
|
|
jnz newd
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
push eax
|
|
|
|
|
mov eax,[timer_ticks] ;[0xfdf0]
|
|
|
|
|
add eax,100
|
|
|
|
|
mov [new_window_starting],eax
|
|
|
|
|
pop eax
|
|
|
|
|
|
2006-08-03 21:30:32 +02:00
|
|
|
|
mov word[edi+WDATA.box.width],ax
|
|
|
|
|
mov word[edi+WDATA.box.height],bx
|
|
|
|
|
sar eax,16
|
|
|
|
|
sar ebx,16
|
|
|
|
|
mov word[edi+WDATA.box.left],ax
|
|
|
|
|
mov word[edi+WDATA.box.top],bx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
call check_window_position
|
|
|
|
|
|
2006-10-06 08:09:41 +02:00
|
|
|
|
call set_window_clientbox
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
push ecx esi edi ; save for window fullscreen/resize
|
2006-08-03 21:30:32 +02:00
|
|
|
|
;mov esi,edi
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov cl,[edi+WDATA.fl_wstyle]
|
2006-08-03 21:30:32 +02:00
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
sub edi,window_data
|
2006-08-03 21:30:32 +02:00
|
|
|
|
shl edi,3
|
2007-02-28 11:51:05 +01:00
|
|
|
|
add edi,SLOT_BASE
|
2006-08-03 21:30:32 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
and cl,0x0F
|
|
|
|
|
mov [edi+APPDATA.wnd_caption],0
|
|
|
|
|
cmp cl,3
|
|
|
|
|
jne @f
|
|
|
|
|
mov [edi+APPDATA.wnd_caption],esi
|
|
|
|
|
@@: mov esi,[esp+0]
|
2006-08-03 21:30:32 +02:00
|
|
|
|
|
2006-08-06 12:29:45 +02:00
|
|
|
|
add edi, APPDATA.saved_box
|
2007-03-23 04:11:34 +01:00
|
|
|
|
movsd
|
|
|
|
|
movsd
|
|
|
|
|
movsd
|
|
|
|
|
movsd
|
2005-10-06 19:56:22 +02:00
|
|
|
|
pop edi esi ecx
|
|
|
|
|
|
|
|
|
|
push eax ebx ecx edx
|
|
|
|
|
;;; mov eax, 1
|
|
|
|
|
;;; call delay_hs
|
2006-08-06 12:29:45 +02:00
|
|
|
|
mov eax, [edi+WDATA.box.left]
|
|
|
|
|
mov ebx, [edi+WDATA.box.top]
|
|
|
|
|
mov ecx, [edi+WDATA.box.width]
|
|
|
|
|
mov edx, [edi+WDATA.box.height]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
add ecx, eax
|
|
|
|
|
add edx, ebx
|
|
|
|
|
call calculatescreen
|
|
|
|
|
pop edx ecx ebx eax
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov [KEY_COUNT],byte 0 ; empty keyboard buffer
|
|
|
|
|
mov [BTN_COUNT],byte 0 ; empty button buffer
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
newd:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov [edi+WDATA.fl_redraw],byte 0 ; no redraw
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov edx,edi
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
2006-08-03 21:30:32 +02:00
|
|
|
|
syscall_windowsettings:
|
|
|
|
|
|
|
|
|
|
.set_window_caption:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
dec eax ; subfunction #1 - set window caption
|
|
|
|
|
jnz .get_window_caption
|
2006-08-03 21:30:32 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
; NOTE: only window owner thread can set its caption,
|
|
|
|
|
; so there's no parameter for PID/TID
|
2006-08-03 21:30:32 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov edi,[CURRENT_TASK]
|
|
|
|
|
shl edi,5
|
2006-08-03 21:30:32 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
; have to check if caption is within application memory limit
|
|
|
|
|
; check is trivial, and if application resizes its memory,
|
|
|
|
|
; caption still can become over bounds
|
2006-10-31 17:11:04 +01:00
|
|
|
|
; diamond, 31.10.2006: check removed because with new memory manager
|
|
|
|
|
; there can be valid data after APPDATA.mem_size bound
|
2007-02-28 11:51:05 +01:00
|
|
|
|
; mov ecx,[edi*8+SLOT_BASE+APPDATA.mem_size]
|
2006-10-31 17:11:04 +01:00
|
|
|
|
; add ecx,255 ; max caption length
|
|
|
|
|
; cmp ebx,ecx
|
|
|
|
|
; ja .exit_fail
|
2006-08-03 21:30:32 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov [edi*8+SLOT_BASE+APPDATA.wnd_caption],ebx
|
|
|
|
|
or [edi+window_data+WDATA.fl_wstyle],WSTYLE_HASCAPTION
|
2006-08-03 21:30:32 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
call draw_window_caption
|
2006-08-03 21:30:32 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
xor eax,eax ; eax = 0 (success)
|
|
|
|
|
ret
|
2006-08-03 21:30:32 +02:00
|
|
|
|
|
|
|
|
|
.get_window_caption:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
dec eax ; subfunction #2 - get window caption
|
|
|
|
|
jnz .exit_fail
|
2006-08-03 21:30:32 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
; not implemented yet
|
2006-08-03 21:30:32 +02:00
|
|
|
|
|
|
|
|
|
.exit_fail:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
xor eax,eax
|
|
|
|
|
inc eax ; eax = 1 (fail)
|
|
|
|
|
ret
|
2006-08-03 21:30:32 +02:00
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
sys_window_move:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov edi,[CURRENT_TASK]
|
|
|
|
|
shl edi,5
|
|
|
|
|
add edi,window_data
|
2006-02-18 11:41:47 +01:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED
|
|
|
|
|
jnz .window_move_return
|
2006-02-18 11:41:47 +01:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
push dword [edi + WDATA.box.left] ; save old coordinates
|
|
|
|
|
push dword [edi + WDATA.box.top]
|
|
|
|
|
push dword [edi + WDATA.box.width]
|
|
|
|
|
push dword [edi + WDATA.box.height]
|
2006-02-18 11:41:47 +01:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp eax,-1 ; set new position and size
|
|
|
|
|
je .no_x_reposition
|
|
|
|
|
mov [edi + WDATA.box.left], eax
|
2006-02-18 11:41:47 +01:00
|
|
|
|
.no_x_reposition:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp ebx,-1
|
|
|
|
|
je .no_y_reposition
|
|
|
|
|
mov [edi + WDATA.box.top], ebx
|
2006-02-18 11:41:47 +01:00
|
|
|
|
.no_y_reposition:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP
|
|
|
|
|
jnz .no_y_resizing
|
2006-02-18 11:41:47 +01:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp ecx,-1
|
|
|
|
|
je .no_x_resizing
|
|
|
|
|
mov [edi + WDATA.box.width], ecx
|
2006-02-18 11:41:47 +01:00
|
|
|
|
.no_x_resizing:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp edx,-1
|
|
|
|
|
je .no_y_resizing
|
|
|
|
|
mov [edi + WDATA.box.height], edx
|
2006-02-18 11:41:47 +01:00
|
|
|
|
.no_y_resizing:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
call check_window_position
|
|
|
|
|
call set_window_clientbox
|
|
|
|
|
|
|
|
|
|
pushad ; save for window fullscreen/resize
|
|
|
|
|
mov esi,edi
|
|
|
|
|
sub edi,window_data
|
|
|
|
|
shr edi,5
|
|
|
|
|
shl edi,8
|
|
|
|
|
add edi, SLOT_BASE + APPDATA.saved_box
|
|
|
|
|
mov ecx,4
|
|
|
|
|
cld
|
|
|
|
|
rep movsd
|
|
|
|
|
popad
|
|
|
|
|
|
|
|
|
|
pushad ; calculcate screen at new position
|
|
|
|
|
mov eax, [edi + WDATA.box.left]
|
|
|
|
|
mov ebx, [edi + WDATA.box.top]
|
|
|
|
|
mov ecx, [edi + WDATA.box.width]
|
|
|
|
|
mov edx, [edi + WDATA.box.height]
|
|
|
|
|
add ecx,eax
|
|
|
|
|
add edx,ebx
|
|
|
|
|
|
|
|
|
|
call calculatescreen
|
|
|
|
|
popad
|
|
|
|
|
|
|
|
|
|
pop edx ; calculcate screen at old position
|
|
|
|
|
pop ecx
|
|
|
|
|
pop ebx
|
|
|
|
|
pop eax
|
|
|
|
|
add ecx,eax
|
|
|
|
|
add edx,ebx
|
|
|
|
|
mov [dlx],eax ; save for drawlimits
|
|
|
|
|
mov [dly],ebx
|
|
|
|
|
mov [dlxe],ecx
|
|
|
|
|
mov [dlye],edx
|
|
|
|
|
call calculatescreen
|
|
|
|
|
|
|
|
|
|
mov [edi + WDATA.fl_redraw], 1 ; flag the process as redraw
|
|
|
|
|
|
|
|
|
|
mov eax,edi ; redraw screen at old position
|
|
|
|
|
xor esi,esi
|
|
|
|
|
call redrawscreen
|
|
|
|
|
|
|
|
|
|
mov [DONT_DRAW_MOUSE],byte 0 ; mouse pointer
|
|
|
|
|
mov [MOUSE_BACKGROUND],byte 0 ; no mouse under
|
|
|
|
|
mov [MOUSE_DOWN],byte 0 ; react to mouse up/down
|
|
|
|
|
|
|
|
|
|
call [draw_pointer]
|
2006-02-18 11:41:47 +01:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov [window_move_pr],0
|
2006-02-18 11:41:47 +01:00
|
|
|
|
|
|
|
|
|
.window_move_return:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
uglobal
|
|
|
|
|
window_move_pr dd 0x0
|
|
|
|
|
window_move_eax dd 0x0
|
|
|
|
|
window_move_ebx dd 0x0
|
|
|
|
|
window_move_ecx dd 0x0
|
|
|
|
|
window_move_edx dd 0x0
|
|
|
|
|
endg
|
|
|
|
|
|
|
|
|
|
;ok - 100% work
|
|
|
|
|
;nt - not tested
|
|
|
|
|
;---------------------------------------------------------------------------------------------
|
|
|
|
|
;eax
|
|
|
|
|
;0 - task switch counter. Ret switch counter in eax. Block. ok.
|
|
|
|
|
;1 - change task. Ret nothing. Block. ok.
|
|
|
|
|
;2 - performance control
|
|
|
|
|
; ebx
|
|
|
|
|
; 0 - enable or disable (inversion) PCE flag on CR4 for rdmpc in user mode.
|
|
|
|
|
; returned new cr4 in eax. Ret cr4 in eax. Block. ok.
|
|
|
|
|
; 1 - is cache enabled. Ret cr0 in eax if enabled else zero in eax. Block. ok.
|
|
|
|
|
; 2 - enable cache. Ret 1 in eax. Ret nothing. Block. ok.
|
|
|
|
|
; 3 - disable cache. Ret 0 in eax. Ret nothing. Block. ok.
|
|
|
|
|
;eax
|
|
|
|
|
;3 - rdmsr. Counter in edx. (edx:eax) [esi:edi, edx] => [edx:esi, ecx]. Ret in ebx:eax. Block. ok.
|
|
|
|
|
;4 - wrmsr. Counter in edx. (edx:eax) [esi:edi, edx] => [edx:esi, ecx]. Ret in ebx:eax. Block. ok.
|
|
|
|
|
;---------------------------------------------------------------------------------------------
|
|
|
|
|
sys_sheduler: ;noname & halyavin
|
|
|
|
|
cmp eax,0
|
|
|
|
|
je shed_counter
|
|
|
|
|
cmp eax,2
|
|
|
|
|
je perf_control
|
|
|
|
|
cmp eax,3
|
|
|
|
|
je rdmsr_instr
|
|
|
|
|
cmp eax,4
|
|
|
|
|
je wrmsr_instr
|
|
|
|
|
cmp eax,1
|
|
|
|
|
jne not_supported
|
|
|
|
|
call change_task ;delay,0
|
|
|
|
|
ret
|
|
|
|
|
shed_counter:
|
|
|
|
|
mov eax,[context_counter]
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
not_supported:
|
|
|
|
|
ret
|
|
|
|
|
perf_control:
|
|
|
|
|
inc eax ;now eax=3
|
|
|
|
|
cmp ebx,eax
|
|
|
|
|
je cache_disable
|
|
|
|
|
dec eax
|
|
|
|
|
cmp ebx,eax
|
|
|
|
|
je cache_enable
|
|
|
|
|
dec eax
|
|
|
|
|
cmp ebx,eax
|
|
|
|
|
je is_cache_enabled
|
|
|
|
|
dec eax
|
|
|
|
|
cmp ebx,eax
|
|
|
|
|
je modify_pce
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
rdmsr_instr:
|
|
|
|
|
;now counter in ecx
|
|
|
|
|
;(edx:eax) esi:edi => edx:esi
|
|
|
|
|
mov eax,esi
|
|
|
|
|
rdmsr
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
mov [esp+24],edx ;ret in ebx?
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
wrmsr_instr:
|
|
|
|
|
;now counter in ecx
|
|
|
|
|
;(edx:eax) esi:edi => edx:esi
|
2007-05-09 18:43:35 +02:00
|
|
|
|
; Fast Call MSR can't be destroy
|
|
|
|
|
; <20><> MSR_AMD_EFER <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20>.<2E>. <20> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD>
|
|
|
|
|
; <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>/<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
cmp ecx, MSR_SYSENTER_CS
|
|
|
|
|
je @f
|
|
|
|
|
cmp ecx, MSR_SYSENTER_ESP
|
|
|
|
|
je @f
|
|
|
|
|
cmp ecx, MSR_SYSENTER_EIP
|
|
|
|
|
je @f
|
|
|
|
|
cmp ecx, MSR_AMD_STAR
|
|
|
|
|
je @f
|
|
|
|
|
|
|
|
|
|
mov eax, esi
|
|
|
|
|
wrmsr
|
|
|
|
|
; mov [esp + 36], eax
|
|
|
|
|
; mov [esp + 24], edx ;ret in ebx?
|
|
|
|
|
@@:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
cache_disable:
|
|
|
|
|
mov eax,cr0
|
|
|
|
|
or eax,01100000000000000000000000000000b
|
|
|
|
|
mov cr0,eax
|
|
|
|
|
wbinvd ;set MESI
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
cache_enable:
|
|
|
|
|
mov eax,cr0
|
|
|
|
|
and eax,10011111111111111111111111111111b
|
|
|
|
|
mov cr0,eax
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
is_cache_enabled:
|
|
|
|
|
mov eax,cr0
|
|
|
|
|
mov ebx,eax
|
|
|
|
|
and eax,01100000000000000000000000000000b
|
|
|
|
|
jz cache_disabled
|
|
|
|
|
mov [esp+36],ebx
|
|
|
|
|
cache_disabled:
|
|
|
|
|
mov dword [esp+36],eax ;0
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
modify_pce:
|
|
|
|
|
mov eax,cr4
|
|
|
|
|
; mov ebx,0
|
|
|
|
|
; or bx,100000000b ;pce
|
|
|
|
|
; xor eax,ebx ;invert pce
|
2005-10-29 21:25:03 +02:00
|
|
|
|
bts eax,8 ;pce=cr4[8]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov cr4,eax
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
|
|
|
|
;---------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; check if pixel is allowed to be drawn
|
|
|
|
|
|
|
|
|
|
checkpixel:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
push eax edx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov edx,[ScreenWidth] ; screen x size
|
|
|
|
|
inc edx
|
|
|
|
|
imul edx, ebx
|
|
|
|
|
mov dl, [eax+edx+display_data] ; lea eax, [...]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
xor ecx, ecx
|
|
|
|
|
mov eax, [CURRENT_TASK]
|
|
|
|
|
cmp al, dl
|
|
|
|
|
setne cl
|
2005-11-07 16:50:30 +01:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
pop edx eax
|
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
iglobal
|
2007-05-24 13:27:05 +02:00
|
|
|
|
cpustring db 'CPU',0
|
2005-10-06 19:56:22 +02:00
|
|
|
|
endg
|
|
|
|
|
|
2006-04-12 15:15:06 +02:00
|
|
|
|
uglobal
|
2007-03-23 04:11:34 +01:00
|
|
|
|
background_defined db 0 ; diamond, 11.04.2006
|
2006-04-12 15:15:06 +02:00
|
|
|
|
endg
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
; check misc
|
|
|
|
|
|
|
|
|
|
checkmisc:
|
|
|
|
|
|
|
|
|
|
cmp [ctrl_alt_del], 1
|
|
|
|
|
jne nocpustart
|
2007-05-16 21:12:34 +02:00
|
|
|
|
|
2007-05-24 13:27:05 +02:00
|
|
|
|
mov ebp, cpustring
|
|
|
|
|
call fs_execute_from_sysdir
|
2007-05-16 21:12:34 +02:00
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov [ctrl_alt_del], 0
|
2007-04-18 08:37:14 +02:00
|
|
|
|
|
|
|
|
|
nocpustart:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
cmp [mouse_active], 1
|
|
|
|
|
jne mouse_not_active
|
|
|
|
|
mov [mouse_active], 0
|
|
|
|
|
xor edi, edi
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov ecx, [TASK_COUNT]
|
|
|
|
|
set_mouse_event:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
add edi, 256
|
2007-04-18 08:37:14 +02:00
|
|
|
|
or [edi+SLOT_BASE+APPDATA.event_mask], dword 100000b
|
2005-10-06 19:56:22 +02:00
|
|
|
|
loop set_mouse_event
|
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mouse_not_active:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp [REDRAW_BACKGROUND],byte 0 ; background update ?
|
|
|
|
|
jz nobackgr
|
2006-05-06 16:34:30 +02:00
|
|
|
|
cmp [background_defined], 0
|
2007-03-23 04:11:34 +01:00
|
|
|
|
jz nobackgr
|
2007-05-02 14:06:10 +02:00
|
|
|
|
; mov [REDRAW_BACKGROUND],byte 2
|
|
|
|
|
; call change_task
|
|
|
|
|
xor edi, edi
|
|
|
|
|
mov ecx, [TASK_COUNT]
|
|
|
|
|
set_bgr_event:
|
|
|
|
|
add edi, 256
|
|
|
|
|
or [edi+SLOT_BASE+APPDATA.event_mask], 16
|
|
|
|
|
loop set_bgr_event
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov [draw_data+32 + RECT.left],dword 0
|
|
|
|
|
mov [draw_data+32 + RECT.top],dword 0
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov eax,[ScreenWidth]
|
|
|
|
|
mov ebx,[ScreenHeight]
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov [draw_data+32 + RECT.right],eax
|
|
|
|
|
mov [draw_data+32 + RECT.bottom],ebx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
call drawbackground
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov [REDRAW_BACKGROUND],byte 0
|
|
|
|
|
mov [MOUSE_BACKGROUND],byte 0
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
nobackgr:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
; system shutdown request
|
|
|
|
|
|
2007-03-01 21:32:19 +01:00
|
|
|
|
cmp [SYS_SHUTDOWN],byte 0
|
2007-03-23 04:11:34 +01:00
|
|
|
|
je noshutdown
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
mov edx,[shutdown_processes]
|
|
|
|
|
sub dl,2
|
|
|
|
|
|
2007-03-01 21:32:19 +01:00
|
|
|
|
cmp [SYS_SHUTDOWN],dl
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jne no_mark_system_shutdown
|
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov edx,OS_BASE+0x3040
|
2007-03-01 21:32:19 +01:00
|
|
|
|
movzx ecx,byte [SYS_SHUTDOWN]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
add ecx,5
|
2007-04-18 08:37:14 +02:00
|
|
|
|
markz:
|
2006-08-06 12:29:45 +02:00
|
|
|
|
mov [edx+TASKDATA.state],byte 3
|
2005-10-06 19:56:22 +02:00
|
|
|
|
add edx,0x20
|
|
|
|
|
loop markz
|
|
|
|
|
|
|
|
|
|
no_mark_system_shutdown:
|
|
|
|
|
|
|
|
|
|
call [disable_mouse]
|
|
|
|
|
|
2007-03-01 21:32:19 +01:00
|
|
|
|
dec byte [SYS_SHUTDOWN]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-01 21:32:19 +01:00
|
|
|
|
cmp [SYS_SHUTDOWN],byte 0
|
2007-03-23 04:11:34 +01:00
|
|
|
|
je system_shutdown
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
noshutdown:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov eax,[TASK_COUNT] ; termination
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov ebx,TASK_DATA+TASKDATA.state
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov esi,1
|
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
newct:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov cl,[ebx]
|
|
|
|
|
cmp cl,byte 3
|
2007-03-23 04:11:34 +01:00
|
|
|
|
jz terminate
|
2005-10-06 19:56:22 +02:00
|
|
|
|
cmp cl,byte 4
|
2007-03-23 04:11:34 +01:00
|
|
|
|
jz terminate
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
add ebx,0x20
|
|
|
|
|
inc esi
|
|
|
|
|
dec eax
|
|
|
|
|
jnz newct
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; redraw screen
|
|
|
|
|
|
|
|
|
|
redrawscreen:
|
|
|
|
|
|
|
|
|
|
; eax , if process window_data base is eax, do not set flag/limits
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
pushad
|
|
|
|
|
push eax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
;;; mov eax,2
|
|
|
|
|
;;; call delay_hs
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
;mov ecx,0 ; redraw flags for apps
|
|
|
|
|
xor ecx,ecx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
newdw2:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
inc ecx
|
|
|
|
|
push ecx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov eax,ecx
|
|
|
|
|
shl eax,5
|
|
|
|
|
add eax,window_data
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp eax,[esp+4]
|
|
|
|
|
je not_this_task
|
|
|
|
|
; check if window in redraw area
|
|
|
|
|
mov edi,eax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp ecx,1 ; limit for background
|
|
|
|
|
jz bgli
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov eax, [edi + WDATA.box.left]
|
|
|
|
|
mov ebx, [edi + WDATA.box.top]
|
|
|
|
|
mov ecx, [edi + WDATA.box.width]
|
|
|
|
|
mov edx, [edi + WDATA.box.height]
|
|
|
|
|
add ecx,eax
|
|
|
|
|
add edx,ebx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov ecx,[dlye] ; ecx = area y end ebx = window y start
|
|
|
|
|
cmp ecx,ebx
|
|
|
|
|
jb ricino
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov ecx,[dlxe] ; ecx = area x end eax = window x start
|
|
|
|
|
cmp ecx,eax
|
|
|
|
|
jb ricino
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov eax, [edi + WDATA.box.left]
|
|
|
|
|
mov ebx, [edi + WDATA.box.top]
|
|
|
|
|
mov ecx, [edi + WDATA.box.width]
|
|
|
|
|
mov edx, [edi + WDATA.box.height]
|
|
|
|
|
add ecx, eax
|
|
|
|
|
add edx, ebx
|
2006-10-06 08:09:41 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov eax,[dly] ; eax = area y start edx = window y end
|
|
|
|
|
cmp edx,eax
|
|
|
|
|
jb ricino
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov eax,[dlx] ; eax = area x start ecx = window x end
|
|
|
|
|
cmp ecx,eax
|
|
|
|
|
jb ricino
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
bgli:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp edi,esi
|
|
|
|
|
jz ricino
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov eax,edi
|
|
|
|
|
add eax,draw_data-window_data
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov ebx,[dlx] ; set limits
|
|
|
|
|
mov [eax + RECT.left], ebx
|
|
|
|
|
mov ebx,[dly]
|
|
|
|
|
mov [eax + RECT.top], ebx
|
|
|
|
|
mov ebx,[dlxe]
|
|
|
|
|
mov [eax + RECT.right], ebx
|
|
|
|
|
mov ebx,[dlye]
|
|
|
|
|
mov [eax + RECT.bottom], ebx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
sub eax,draw_data-window_data
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp ecx,1
|
|
|
|
|
jne nobgrd
|
|
|
|
|
cmp esi,1
|
|
|
|
|
je newdw8
|
|
|
|
|
call drawbackground
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
newdw8:
|
|
|
|
|
nobgrd:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov [eax + WDATA.fl_redraw],byte 1 ; mark as redraw
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
ricino:
|
|
|
|
|
|
|
|
|
|
not_this_task:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
pop ecx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp ecx,[TASK_COUNT]
|
|
|
|
|
jle newdw2
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
pop eax
|
|
|
|
|
popad
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
calculatebackground: ; background
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
; all black
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-24 10:56:03 +02:00
|
|
|
|
mov edi, [img_background] ;IMG_BACKGROUND ; set background to black
|
2007-03-23 04:11:34 +01:00
|
|
|
|
xor eax, eax
|
2007-04-24 10:56:03 +02:00
|
|
|
|
mov ecx, 1023 ;0x0fff00 / 4
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cld
|
|
|
|
|
rep stosd
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov edi,display_data ; set os to use all pixels
|
|
|
|
|
mov eax,0x01010101
|
2007-04-28 14:45:22 +02:00
|
|
|
|
mov ecx,1280*1024 / 4
|
2007-03-23 04:11:34 +01:00
|
|
|
|
rep stosd
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov byte [REDRAW_BACKGROUND], 0 ; do not draw background!
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
uglobal
|
2007-03-23 04:11:34 +01:00
|
|
|
|
imax dd 0x0
|
2005-10-06 19:56:22 +02:00
|
|
|
|
endg
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
delay_ms: ; delay in 1/1000 sec
|
|
|
|
|
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
push eax
|
|
|
|
|
push ecx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov ecx,esi
|
|
|
|
|
; <CPU clock fix by Sergey Kuzmin aka Wildwest>
|
|
|
|
|
imul ecx, 33941
|
|
|
|
|
shr ecx, 9
|
|
|
|
|
; </CPU clock fix>
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
in al,0x61
|
|
|
|
|
and al,0x10
|
|
|
|
|
mov ah,al
|
|
|
|
|
cld
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cnt1: in al,0x61
|
|
|
|
|
and al,0x10
|
|
|
|
|
cmp al,ah
|
|
|
|
|
jz cnt1
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov ah,al
|
|
|
|
|
loop cnt1
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
pop ecx
|
|
|
|
|
pop eax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set_app_param:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
push edi
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov edi,[TASK_BASE]
|
|
|
|
|
mov [edi+TASKDATA.event_mask],eax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
pop edi
|
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
delay_hs: ; delay in 1/100 secs
|
2007-03-23 04:11:34 +01:00
|
|
|
|
push eax
|
|
|
|
|
push ecx
|
|
|
|
|
push edx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov edx,[timer_ticks]
|
|
|
|
|
add edx,eax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
newtic:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov ecx,[timer_ticks]
|
|
|
|
|
cmp edx,ecx
|
|
|
|
|
jbe zerodelay
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
call change_task
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
jmp newtic
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
zerodelay:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
pop edx
|
|
|
|
|
pop ecx
|
|
|
|
|
pop eax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
memmove: ; memory move in bytes
|
|
|
|
|
|
|
|
|
|
; eax = from
|
|
|
|
|
; ebx = to
|
|
|
|
|
; ecx = no of bytes
|
|
|
|
|
test ecx, ecx
|
|
|
|
|
jle .ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
push esi edi ecx
|
|
|
|
|
|
|
|
|
|
mov edi, ebx
|
|
|
|
|
mov esi, eax
|
|
|
|
|
|
|
|
|
|
test ecx, not 11b
|
2007-03-23 04:11:34 +01:00
|
|
|
|
jz @f
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
push ecx
|
|
|
|
|
shr ecx, 2
|
|
|
|
|
rep movsd
|
|
|
|
|
pop ecx
|
|
|
|
|
and ecx, 11b
|
2007-03-23 04:11:34 +01:00
|
|
|
|
jz .finish
|
2005-10-06 19:56:22 +02:00
|
|
|
|
@@:
|
|
|
|
|
rep movsb
|
|
|
|
|
|
|
|
|
|
.finish:
|
|
|
|
|
pop ecx edi esi
|
|
|
|
|
.ret:
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
2006-05-05 14:40:02 +02:00
|
|
|
|
; <diamond> Sysfunction 34, read_floppy_file, is obsolete. Use 58 or 70 function instead.
|
|
|
|
|
;align 4
|
2005-10-06 19:56:22 +02:00
|
|
|
|
;
|
2006-05-05 14:40:02 +02:00
|
|
|
|
;read_floppy_file:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
;
|
2006-05-05 14:40:02 +02:00
|
|
|
|
;; as input
|
|
|
|
|
;;
|
|
|
|
|
;; eax pointer to file
|
|
|
|
|
;; ebx file lenght
|
|
|
|
|
;; ecx start 512 byte block number
|
|
|
|
|
;; edx number of blocks to read
|
|
|
|
|
;; esi pointer to return/work area (atleast 20 000 bytes)
|
|
|
|
|
;;
|
|
|
|
|
;;
|
|
|
|
|
;; on return
|
|
|
|
|
;;
|
|
|
|
|
;; eax = 0 command succesful
|
|
|
|
|
;; 1 no fd base and/or partition defined
|
|
|
|
|
;; 2 yet unsupported FS
|
|
|
|
|
;; 3 unknown FS
|
|
|
|
|
;; 4 partition not defined at hd
|
|
|
|
|
;; 5 file not found
|
|
|
|
|
;; ebx = size of file
|
2005-10-06 19:56:22 +02:00
|
|
|
|
;
|
2007-02-28 09:52:06 +01:00
|
|
|
|
; mov edi,[TASK_BASE]
|
2006-05-05 14:40:02 +02:00
|
|
|
|
; add edi,0x10
|
|
|
|
|
; add esi,[edi]
|
|
|
|
|
; add eax,[edi]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
;
|
2006-05-05 14:40:02 +02:00
|
|
|
|
; pushad
|
|
|
|
|
; mov edi,esi
|
|
|
|
|
; add edi,1024
|
|
|
|
|
; mov esi,0x100000+19*512
|
|
|
|
|
; sub ecx,1
|
|
|
|
|
; shl ecx,9
|
|
|
|
|
; add esi,ecx
|
|
|
|
|
; shl edx,9
|
|
|
|
|
; mov ecx,edx
|
|
|
|
|
; cld
|
|
|
|
|
; rep movsb
|
|
|
|
|
; popad
|
|
|
|
|
;
|
|
|
|
|
; mov [esp+36],eax
|
|
|
|
|
; mov [esp+24],ebx
|
|
|
|
|
; ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
|
|
|
|
sys_programirq:
|
|
|
|
|
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edi,[TASK_BASE]
|
2006-08-06 12:29:45 +02:00
|
|
|
|
add eax,[edi+TASKDATA.mem_start]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2006-05-05 14:40:02 +02:00
|
|
|
|
cmp ebx,16
|
|
|
|
|
jae .not_owner
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edi,[TASK_BASE]
|
2006-08-06 12:29:45 +02:00
|
|
|
|
mov edi,[edi+TASKDATA.pid]
|
2006-05-05 14:40:02 +02:00
|
|
|
|
cmp edi,[irq_owner+ebx*4]
|
2007-03-23 04:11:34 +01:00
|
|
|
|
je spril1
|
2006-05-05 14:40:02 +02:00
|
|
|
|
.not_owner:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov [esp+36],dword 1
|
|
|
|
|
ret
|
|
|
|
|
spril1:
|
|
|
|
|
|
|
|
|
|
mov esi,eax
|
|
|
|
|
shl ebx,6
|
|
|
|
|
add ebx,irq00read
|
|
|
|
|
mov edi,ebx
|
|
|
|
|
mov ecx,16
|
|
|
|
|
cld
|
|
|
|
|
rep movsd
|
|
|
|
|
mov [esp+36],dword 0
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
|
|
|
|
get_irq_data:
|
2006-05-05 14:40:02 +02:00
|
|
|
|
cmp eax,16
|
|
|
|
|
jae .not_owner
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov edx,eax ; check for correct owner
|
2005-10-06 19:56:22 +02:00
|
|
|
|
shl edx,2
|
|
|
|
|
add edx,irq_owner
|
|
|
|
|
mov edx,[edx]
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edi,[TASK_BASE]
|
2006-08-06 12:29:45 +02:00
|
|
|
|
mov edi,[edi+TASKDATA.pid]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
cmp edx,edi
|
|
|
|
|
je gidril1
|
2006-05-05 14:40:02 +02:00
|
|
|
|
.not_owner:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov [esp+32],dword 2 ; ecx=2
|
2005-10-06 19:56:22 +02:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
gidril1:
|
|
|
|
|
|
|
|
|
|
mov ebx,eax
|
|
|
|
|
shl ebx,12
|
2007-03-01 21:32:19 +01:00
|
|
|
|
add ebx,IRQ_SAVE
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov eax,[ebx]
|
|
|
|
|
mov ecx,1
|
|
|
|
|
test eax,eax
|
|
|
|
|
jz gid1
|
|
|
|
|
|
|
|
|
|
dec eax
|
|
|
|
|
mov esi,ebx
|
|
|
|
|
mov [ebx],eax
|
|
|
|
|
movzx ebx,byte [ebx+0x10]
|
|
|
|
|
add esi,0x10
|
|
|
|
|
mov edi,esi
|
|
|
|
|
inc esi
|
|
|
|
|
mov ecx,4000 / 4
|
|
|
|
|
cld
|
|
|
|
|
rep movsd
|
2006-05-05 14:40:02 +02:00
|
|
|
|
; xor ecx,ecx ; as result of 'rep' ecx=0
|
2005-10-06 19:56:22 +02:00
|
|
|
|
gid1:
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
mov [esp+32],ecx
|
|
|
|
|
mov [esp+24],ebx
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set_io_access_rights:
|
|
|
|
|
|
|
|
|
|
pushad
|
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov edi, tss._io_map_0
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
; mov ecx,eax
|
|
|
|
|
; and ecx,7 ; offset in byte
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
; shr eax,3 ; number of byte
|
|
|
|
|
; add edi,eax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
; mov ebx,1
|
|
|
|
|
; shl ebx,cl
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp ebp,0 ; enable access - ebp = 0
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jne siar1
|
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
; not ebx
|
|
|
|
|
; and [edi],byte bl
|
|
|
|
|
btr [edi], eax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
popad
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
siar1:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
bts [edi], eax
|
|
|
|
|
; or [edi],byte bl ; disable access - ebp = 1
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
popad
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
r_f_port_area:
|
|
|
|
|
|
|
|
|
|
test eax, eax
|
|
|
|
|
jnz free_port_area
|
|
|
|
|
; je r_port_area
|
|
|
|
|
; jmp free_port_area
|
|
|
|
|
|
|
|
|
|
; r_port_area:
|
|
|
|
|
|
|
|
|
|
pushad
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp ebx,ecx ; beginning > end ?
|
2006-05-05 14:40:02 +02:00
|
|
|
|
ja rpal1
|
|
|
|
|
cmp ecx,65536
|
|
|
|
|
jae rpal1
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov esi,[RESERVED_PORTS]
|
2007-03-23 04:11:34 +01:00
|
|
|
|
test esi,esi ; no reserved areas ?
|
2005-10-06 19:56:22 +02:00
|
|
|
|
je rpal2
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp esi,255 ; max reserved
|
2006-05-05 14:40:02 +02:00
|
|
|
|
jae rpal1
|
2007-04-18 08:37:14 +02:00
|
|
|
|
rpal3:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov edi,esi
|
|
|
|
|
shl edi,4
|
2007-03-01 21:32:19 +01:00
|
|
|
|
add edi,RESERVED_PORTS
|
2005-10-06 19:56:22 +02:00
|
|
|
|
cmp ebx,[edi+8]
|
2006-05-05 14:40:02 +02:00
|
|
|
|
ja rpal4
|
2005-10-06 19:56:22 +02:00
|
|
|
|
cmp ecx,[edi+4]
|
|
|
|
|
jae rpal1
|
|
|
|
|
; jb rpal4
|
|
|
|
|
; jmp rpal1
|
2007-04-18 08:37:14 +02:00
|
|
|
|
rpal4:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
dec esi
|
|
|
|
|
jnz rpal3
|
|
|
|
|
jmp rpal2
|
|
|
|
|
rpal1:
|
|
|
|
|
popad
|
|
|
|
|
mov eax,1
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
rpal2:
|
|
|
|
|
popad
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; enable port access at port IO map
|
|
|
|
|
cli
|
2007-03-23 04:11:34 +01:00
|
|
|
|
pushad ; start enable io map
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
cmp ecx,65536 ;16384
|
|
|
|
|
jae no_unmask_io ; jge
|
|
|
|
|
|
|
|
|
|
mov eax,ebx
|
|
|
|
|
|
|
|
|
|
new_port_access:
|
|
|
|
|
|
|
|
|
|
pushad
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
xor ebp,ebp ; enable - eax = port
|
2005-10-06 19:56:22 +02:00
|
|
|
|
call set_io_access_rights
|
|
|
|
|
|
|
|
|
|
popad
|
|
|
|
|
|
|
|
|
|
inc eax
|
|
|
|
|
cmp eax,ecx
|
|
|
|
|
jbe new_port_access
|
|
|
|
|
|
|
|
|
|
no_unmask_io:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
popad ; end enable io map
|
2005-10-06 19:56:22 +02:00
|
|
|
|
sti
|
|
|
|
|
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov edi,[RESERVED_PORTS]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
add edi,1
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov [RESERVED_PORTS],edi
|
2005-10-06 19:56:22 +02:00
|
|
|
|
shl edi,4
|
2007-03-01 21:32:19 +01:00
|
|
|
|
add edi,RESERVED_PORTS
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov esi,[TASK_BASE]
|
2006-08-06 12:29:45 +02:00
|
|
|
|
mov esi,[esi+TASKDATA.pid]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov [edi],esi
|
|
|
|
|
mov [edi+4],ebx
|
|
|
|
|
mov [edi+8],ecx
|
|
|
|
|
|
|
|
|
|
xor eax, eax
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
free_port_area:
|
|
|
|
|
|
|
|
|
|
pushad
|
|
|
|
|
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov esi,[RESERVED_PORTS] ; no reserved areas ?
|
2006-05-05 14:40:02 +02:00
|
|
|
|
test esi,esi
|
2005-10-06 19:56:22 +02:00
|
|
|
|
je frpal2
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edx,[TASK_BASE]
|
2006-08-06 12:29:45 +02:00
|
|
|
|
mov edx,[edx+TASKDATA.pid]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
frpal3:
|
|
|
|
|
mov edi,esi
|
|
|
|
|
shl edi,4
|
2007-03-01 21:32:19 +01:00
|
|
|
|
add edi,RESERVED_PORTS
|
2005-10-06 19:56:22 +02:00
|
|
|
|
cmp edx,[edi]
|
|
|
|
|
jne frpal4
|
|
|
|
|
cmp ebx,[edi+4]
|
|
|
|
|
jne frpal4
|
|
|
|
|
cmp ecx,[edi+8]
|
|
|
|
|
jne frpal4
|
|
|
|
|
jmp frpal1
|
|
|
|
|
frpal4:
|
|
|
|
|
dec esi
|
|
|
|
|
jnz frpal3
|
|
|
|
|
frpal2:
|
|
|
|
|
popad
|
|
|
|
|
mov eax,1
|
|
|
|
|
ret
|
|
|
|
|
frpal1:
|
|
|
|
|
mov ecx,256
|
|
|
|
|
sub ecx,esi
|
|
|
|
|
shl ecx,4
|
|
|
|
|
mov esi,edi
|
|
|
|
|
add esi,16
|
|
|
|
|
cld
|
|
|
|
|
rep movsb
|
|
|
|
|
|
2007-03-01 21:32:19 +01:00
|
|
|
|
dec dword [RESERVED_PORTS]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
popad
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; disable port access at port IO map
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
pushad ; start disable io map
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
cmp ecx,65536 ;16384
|
|
|
|
|
jge no_mask_io
|
|
|
|
|
|
|
|
|
|
mov eax,ebx
|
|
|
|
|
|
|
|
|
|
new_port_access_disable:
|
|
|
|
|
|
|
|
|
|
pushad
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov ebp,1 ; disable - eax = port
|
2005-10-06 19:56:22 +02:00
|
|
|
|
call set_io_access_rights
|
|
|
|
|
|
|
|
|
|
popad
|
|
|
|
|
|
|
|
|
|
inc eax
|
|
|
|
|
cmp eax,ecx
|
|
|
|
|
jbe new_port_access_disable
|
|
|
|
|
|
|
|
|
|
no_mask_io:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
popad ; end disable io map
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
xor eax, eax
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reserve_free_irq:
|
|
|
|
|
|
2006-05-05 14:40:02 +02:00
|
|
|
|
mov ecx, 1
|
|
|
|
|
cmp ebx, 16
|
|
|
|
|
jae fril1
|
|
|
|
|
test eax,eax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jz reserve_irq
|
|
|
|
|
|
2006-05-05 14:40:02 +02:00
|
|
|
|
lea edi,[irq_owner+ebx*4]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov edx,[edi]
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov eax,[TASK_BASE]
|
2006-08-06 12:29:45 +02:00
|
|
|
|
cmp edx,[eax+TASKDATA.pid]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jne fril1
|
2006-05-05 14:40:02 +02:00
|
|
|
|
dec ecx
|
|
|
|
|
mov [edi],ecx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
fril1:
|
|
|
|
|
mov [esp+36],ecx ; return in eax
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
reserve_irq:
|
|
|
|
|
|
2006-05-05 14:40:02 +02:00
|
|
|
|
lea edi,[irq_owner+ebx*4]
|
|
|
|
|
cmp dword [edi], 0
|
|
|
|
|
jnz ril1
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edx,[TASK_BASE]
|
2006-08-06 12:29:45 +02:00
|
|
|
|
mov edx,[edx+TASKDATA.pid]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov [edi],edx
|
2006-05-05 14:40:02 +02:00
|
|
|
|
dec ecx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
ril1:
|
|
|
|
|
mov [esp+36],ecx ; return in eax
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
drawbackground:
|
2006-01-06 12:46:26 +01:00
|
|
|
|
inc [mouse_pause]
|
2007-03-01 21:32:19 +01:00
|
|
|
|
cmp [SCR_MODE],word 0x12
|
2006-08-10 20:18:33 +02:00
|
|
|
|
je dbrv20
|
2005-10-06 19:56:22 +02:00
|
|
|
|
dbrv12:
|
2007-03-01 21:32:19 +01:00
|
|
|
|
cmp [SCR_MODE],word 0100000000000000b
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jge dbrv20
|
2007-03-01 21:32:19 +01:00
|
|
|
|
cmp [SCR_MODE],word 0x13
|
2005-10-06 19:56:22 +02:00
|
|
|
|
je dbrv20
|
|
|
|
|
call vesa12_drawbackground
|
2006-01-06 12:46:26 +01:00
|
|
|
|
dec [mouse_pause]
|
2006-01-13 19:30:12 +01:00
|
|
|
|
call [draw_pointer]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
ret
|
|
|
|
|
dbrv20:
|
|
|
|
|
cmp [display_data-12],dword 1
|
|
|
|
|
jne bgrstr
|
|
|
|
|
call vesa20_drawbackground_tiled
|
2006-01-06 12:46:26 +01:00
|
|
|
|
dec [mouse_pause]
|
2006-01-13 19:30:12 +01:00
|
|
|
|
call [draw_pointer]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
ret
|
|
|
|
|
bgrstr:
|
|
|
|
|
call vesa20_drawbackground_stretch
|
2006-01-06 12:46:26 +01:00
|
|
|
|
dec [mouse_pause]
|
2006-01-13 19:30:12 +01:00
|
|
|
|
call [draw_pointer]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
ret
|
|
|
|
|
|
2006-05-05 14:40:02 +02:00
|
|
|
|
align 4
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
syscall_putimage: ; PutImage
|
2006-05-05 14:40:02 +02:00
|
|
|
|
|
|
|
|
|
mov edx,ecx
|
|
|
|
|
mov ecx,ebx
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov ebx, eax
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2006-01-06 12:46:26 +01:00
|
|
|
|
sys_putimage:
|
2006-03-04 13:58:59 +01:00
|
|
|
|
test ecx,0x80008000
|
|
|
|
|
jnz .exit
|
|
|
|
|
test ecx,0x0000FFFF
|
|
|
|
|
jz .exit
|
|
|
|
|
test ecx,0xFFFF0000
|
|
|
|
|
jnz @f
|
|
|
|
|
.exit:
|
|
|
|
|
ret
|
|
|
|
|
@@:
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov edi,[current_slot]
|
|
|
|
|
add dx,word[edi+APPDATA.wnd_clientbox.top]
|
2007-03-23 04:11:34 +01:00
|
|
|
|
rol edx,16
|
2007-04-18 08:37:14 +02:00
|
|
|
|
add dx,word[edi+APPDATA.wnd_clientbox.left]
|
2007-03-23 04:11:34 +01:00
|
|
|
|
rol edx,16
|
2006-08-03 21:30:32 +02:00
|
|
|
|
.forced:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
push ebp esi 0
|
|
|
|
|
mov ebp, putimage_get24bpp
|
|
|
|
|
mov esi, putimage_init24bpp
|
2007-01-19 16:02:33 +01:00
|
|
|
|
sys_putimage_bpp:
|
|
|
|
|
; call [disable_mouse] ; this will be done in xxx_putimage
|
2006-08-10 20:18:33 +02:00
|
|
|
|
; mov eax, vga_putimage
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp [SCR_MODE], word 0x12
|
|
|
|
|
jz @f ;.doit
|
|
|
|
|
mov eax, vesa12_putimage
|
|
|
|
|
cmp [SCR_MODE], word 0100000000000000b
|
|
|
|
|
jae @f
|
|
|
|
|
cmp [SCR_MODE], word 0x13
|
|
|
|
|
jnz .doit
|
2006-05-05 14:40:02 +02:00
|
|
|
|
@@:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov eax, vesa20_putimage
|
2006-05-05 14:40:02 +02:00
|
|
|
|
.doit:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
inc [mouse_pause]
|
|
|
|
|
call eax
|
|
|
|
|
dec [mouse_pause]
|
|
|
|
|
pop ebp esi ebp
|
|
|
|
|
jmp [draw_pointer]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-01-19 16:02:33 +01:00
|
|
|
|
syscall_putimage_palette:
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov edi, esi
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov esi, edx
|
|
|
|
|
mov edx, ecx
|
|
|
|
|
mov ecx, ebx
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov ebx, eax
|
2007-01-19 16:02:33 +01:00
|
|
|
|
sys_putimage_palette:
|
|
|
|
|
; ebx = pointer to image
|
|
|
|
|
; ecx = [xsize]*65536 + [ysize]
|
|
|
|
|
; edx = [xstart]*65536 + [ystart]
|
2007-02-02 16:09:14 +01:00
|
|
|
|
; esi = number of bits per pixel, must be 8, 24 or 32
|
2007-01-19 16:02:33 +01:00
|
|
|
|
; edi = pointer to palette
|
2007-02-02 16:09:14 +01:00
|
|
|
|
; ebp = row delta
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov eax, [CURRENT_TASK]
|
|
|
|
|
shl eax, 8
|
|
|
|
|
add dx, word [eax+SLOT_BASE+APPDATA.wnd_clientbox.top]
|
|
|
|
|
rol edx, 16
|
|
|
|
|
add dx, word [eax+SLOT_BASE+APPDATA.wnd_clientbox.left]
|
|
|
|
|
rol edx, 16
|
2007-01-19 16:02:33 +01:00
|
|
|
|
.forced:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
push ebp esi ebp
|
|
|
|
|
cmp esi, 8
|
|
|
|
|
jnz @f
|
|
|
|
|
mov ebp, putimage_get8bpp
|
|
|
|
|
mov esi, putimage_init8bpp
|
|
|
|
|
jmp sys_putimage_bpp
|
2007-02-02 16:09:14 +01:00
|
|
|
|
@@:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp esi, 24
|
|
|
|
|
jnz @f
|
|
|
|
|
mov ebp, putimage_get24bpp
|
|
|
|
|
mov esi, putimage_init24bpp
|
|
|
|
|
jmp sys_putimage_bpp
|
2007-02-02 16:09:14 +01:00
|
|
|
|
@@:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp esi, 32
|
|
|
|
|
jnz @f
|
|
|
|
|
mov ebp, putimage_get32bpp
|
|
|
|
|
mov esi, putimage_init32bpp
|
|
|
|
|
jmp sys_putimage_bpp
|
2007-02-02 16:09:14 +01:00
|
|
|
|
@@:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
pop ebp esi
|
|
|
|
|
ret
|
2007-01-19 16:02:33 +01:00
|
|
|
|
|
|
|
|
|
putimage_init24bpp:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
lea eax, [eax*3]
|
2007-01-19 16:02:33 +01:00
|
|
|
|
putimage_init8bpp:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
ret
|
2007-01-19 16:02:33 +01:00
|
|
|
|
|
|
|
|
|
putimage_get24bpp:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov eax, [esi]
|
|
|
|
|
add esi, 3
|
|
|
|
|
ret 4
|
2007-01-19 16:02:33 +01:00
|
|
|
|
putimage_get8bpp:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
movzx eax, byte [esi]
|
|
|
|
|
push edx
|
|
|
|
|
mov edx, [esp+8]
|
|
|
|
|
mov eax, [edx+eax*4]
|
|
|
|
|
pop edx
|
|
|
|
|
inc esi
|
|
|
|
|
ret 4
|
2007-01-19 16:02:33 +01:00
|
|
|
|
|
2007-02-02 16:09:14 +01:00
|
|
|
|
putimage_init32bpp:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
shl eax, 2
|
|
|
|
|
ret
|
2007-02-02 16:09:14 +01:00
|
|
|
|
putimage_get32bpp:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
lodsd
|
|
|
|
|
ret 4
|
2007-02-02 16:09:14 +01:00
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
; eax x beginning
|
|
|
|
|
; ebx y beginning
|
|
|
|
|
; ecx x end
|
2007-01-19 16:02:33 +01:00
|
|
|
|
; edx y end
|
2005-10-06 19:56:22 +02:00
|
|
|
|
; edi color
|
|
|
|
|
|
|
|
|
|
__sys_drawbar:
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov esi,[current_slot]
|
|
|
|
|
add eax,[esi+APPDATA.wnd_clientbox.left]
|
|
|
|
|
add ecx,[esi+APPDATA.wnd_clientbox.left]
|
|
|
|
|
add ebx,[esi+APPDATA.wnd_clientbox.top]
|
|
|
|
|
add edx,[esi+APPDATA.wnd_clientbox.top]
|
2006-08-03 21:30:32 +02:00
|
|
|
|
.forced:
|
2006-01-06 12:46:26 +01:00
|
|
|
|
inc [mouse_pause]
|
2007-01-19 16:02:33 +01:00
|
|
|
|
; call [disable_mouse]
|
2007-03-01 21:32:19 +01:00
|
|
|
|
cmp [SCR_MODE],word 0x12
|
2007-03-23 04:11:34 +01:00
|
|
|
|
je dbv20
|
2005-10-06 19:56:22 +02:00
|
|
|
|
sdbv20:
|
2007-03-01 21:32:19 +01:00
|
|
|
|
cmp [SCR_MODE],word 0100000000000000b
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jge dbv20
|
2007-03-01 21:32:19 +01:00
|
|
|
|
cmp [SCR_MODE],word 0x13
|
2007-03-23 04:11:34 +01:00
|
|
|
|
je dbv20
|
2005-10-06 19:56:22 +02:00
|
|
|
|
call vesa12_drawbar
|
2006-01-06 12:46:26 +01:00
|
|
|
|
dec [mouse_pause]
|
2006-01-13 19:30:12 +01:00
|
|
|
|
call [draw_pointer]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
ret
|
|
|
|
|
dbv20:
|
|
|
|
|
call vesa20_drawbar
|
2006-01-06 12:46:26 +01:00
|
|
|
|
dec [mouse_pause]
|
2006-01-13 19:30:12 +01:00
|
|
|
|
call [draw_pointer]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
kb_read:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
push ecx edx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's
|
2005-10-06 19:56:22 +02:00
|
|
|
|
kr_loop:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
in al,0x64
|
|
|
|
|
test al,1
|
|
|
|
|
jnz kr_ready
|
|
|
|
|
loop kr_loop
|
|
|
|
|
mov ah,1
|
|
|
|
|
jmp kr_exit
|
2005-10-06 19:56:22 +02:00
|
|
|
|
kr_ready:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
push ecx
|
|
|
|
|
mov ecx,32
|
2005-10-06 19:56:22 +02:00
|
|
|
|
kr_delay:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
loop kr_delay
|
|
|
|
|
pop ecx
|
|
|
|
|
in al,0x60
|
|
|
|
|
xor ah,ah
|
2005-10-06 19:56:22 +02:00
|
|
|
|
kr_exit:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
pop edx ecx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
kb_write:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
push ecx edx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov dl,al
|
2007-01-09 12:34:31 +01:00
|
|
|
|
; mov ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's
|
|
|
|
|
; kw_loop1:
|
|
|
|
|
; in al,0x64
|
|
|
|
|
; test al,0x20
|
|
|
|
|
; jz kw_ok1
|
|
|
|
|
; loop kw_loop1
|
|
|
|
|
; mov ah,1
|
|
|
|
|
; jmp kw_exit
|
|
|
|
|
; kw_ok1:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
in al,0x60
|
|
|
|
|
mov ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's
|
2005-10-06 19:56:22 +02:00
|
|
|
|
kw_loop:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
in al,0x64
|
|
|
|
|
test al,2
|
|
|
|
|
jz kw_ok
|
|
|
|
|
loop kw_loop
|
|
|
|
|
mov ah,1
|
|
|
|
|
jmp kw_exit
|
2005-10-06 19:56:22 +02:00
|
|
|
|
kw_ok:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov al,dl
|
|
|
|
|
out 0x60,al
|
|
|
|
|
mov ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's
|
2005-10-06 19:56:22 +02:00
|
|
|
|
kw_loop3:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
in al,0x64
|
|
|
|
|
test al,2
|
|
|
|
|
jz kw_ok3
|
|
|
|
|
loop kw_loop3
|
|
|
|
|
mov ah,1
|
|
|
|
|
jmp kw_exit
|
2005-10-06 19:56:22 +02:00
|
|
|
|
kw_ok3:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov ah,8
|
2005-10-06 19:56:22 +02:00
|
|
|
|
kw_loop4:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's
|
2005-10-06 19:56:22 +02:00
|
|
|
|
kw_loop5:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
in al,0x64
|
|
|
|
|
test al,1
|
|
|
|
|
jnz kw_ok4
|
|
|
|
|
loop kw_loop5
|
|
|
|
|
dec ah
|
|
|
|
|
jnz kw_loop4
|
2005-10-06 19:56:22 +02:00
|
|
|
|
kw_ok4:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
xor ah,ah
|
2005-10-06 19:56:22 +02:00
|
|
|
|
kw_exit:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
pop edx ecx
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
kb_cmd:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's
|
2005-10-06 19:56:22 +02:00
|
|
|
|
c_wait:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
in al,0x64
|
|
|
|
|
test al,2
|
|
|
|
|
jz c_send
|
|
|
|
|
loop c_wait
|
|
|
|
|
jmp c_error
|
2005-10-06 19:56:22 +02:00
|
|
|
|
c_send:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov al,bl
|
|
|
|
|
out 0x64,al
|
|
|
|
|
mov ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's
|
2005-10-06 19:56:22 +02:00
|
|
|
|
c_accept:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
in al,0x64
|
|
|
|
|
test al,2
|
|
|
|
|
jz c_ok
|
|
|
|
|
loop c_accept
|
2005-10-06 19:56:22 +02:00
|
|
|
|
c_error:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov ah,1
|
|
|
|
|
jmp c_exit
|
2005-10-06 19:56:22 +02:00
|
|
|
|
c_ok:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
xor ah,ah
|
2005-10-06 19:56:22 +02:00
|
|
|
|
c_exit:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setmouse: ; set mousepicture -pointer
|
2007-03-23 04:11:34 +01:00
|
|
|
|
; ps2 mouse enable
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov [MOUSE_PICTURE],dword mousepointer
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
cli
|
2006-01-06 12:46:26 +01:00
|
|
|
|
; mov bl,0xa8 ; enable mouse cmd
|
|
|
|
|
; call kb_cmd
|
|
|
|
|
; call kb_read ; read status
|
|
|
|
|
; mov bl,0x20 ; get command byte
|
|
|
|
|
; call kb_cmd
|
|
|
|
|
; call kb_read
|
|
|
|
|
; or al,3 ; enable interrupt
|
|
|
|
|
; mov bl,0x60 ; write command
|
|
|
|
|
; push eax
|
|
|
|
|
; call kb_cmd
|
|
|
|
|
; pop eax
|
|
|
|
|
; call kb_write
|
|
|
|
|
; mov bl,0xd4 ; for mouse
|
|
|
|
|
; call kb_cmd
|
|
|
|
|
; mov al,0xf4 ; enable mouse device
|
|
|
|
|
; call kb_write
|
|
|
|
|
; call kb_read ; read status return
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
; com1 mouse enable
|
|
|
|
|
|
|
|
|
|
mov bx,0x3f8 ; combase
|
|
|
|
|
|
|
|
|
|
mov dx,bx
|
|
|
|
|
add dx,3
|
|
|
|
|
mov al,0x80
|
|
|
|
|
out dx,al
|
|
|
|
|
|
|
|
|
|
mov dx,bx
|
|
|
|
|
add dx,1
|
|
|
|
|
mov al,0
|
|
|
|
|
out dx,al
|
|
|
|
|
|
|
|
|
|
mov dx,bx
|
|
|
|
|
add dx,0
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov al,0x30*2 ; 0x30 / 4
|
2005-10-06 19:56:22 +02:00
|
|
|
|
out dx,al
|
|
|
|
|
|
|
|
|
|
mov dx,bx
|
|
|
|
|
add dx,3
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov al,2 ; 3
|
2005-10-06 19:56:22 +02:00
|
|
|
|
out dx,al
|
|
|
|
|
|
|
|
|
|
mov dx,bx
|
|
|
|
|
add dx,4
|
|
|
|
|
mov al,0xb
|
|
|
|
|
out dx,al
|
|
|
|
|
|
|
|
|
|
mov dx,bx
|
|
|
|
|
add dx,1
|
|
|
|
|
mov al,1
|
|
|
|
|
out dx,al
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; com2 mouse enable
|
|
|
|
|
|
|
|
|
|
mov bx,0x2f8 ; combase
|
|
|
|
|
|
|
|
|
|
mov dx,bx
|
|
|
|
|
add dx,3
|
|
|
|
|
mov al,0x80
|
|
|
|
|
out dx,al
|
|
|
|
|
|
|
|
|
|
mov dx,bx
|
|
|
|
|
add dx,1
|
|
|
|
|
mov al,0
|
|
|
|
|
out dx,al
|
|
|
|
|
|
|
|
|
|
mov dx,bx
|
|
|
|
|
add dx,0
|
|
|
|
|
mov al,0x30*2
|
|
|
|
|
out dx,al
|
|
|
|
|
|
|
|
|
|
mov dx,bx
|
|
|
|
|
add dx,3
|
|
|
|
|
mov al,2
|
|
|
|
|
out dx,al
|
|
|
|
|
|
|
|
|
|
mov dx,bx
|
|
|
|
|
add dx,4
|
|
|
|
|
mov al,0xb
|
|
|
|
|
out dx,al
|
|
|
|
|
|
|
|
|
|
mov dx,bx
|
|
|
|
|
add dx,1
|
|
|
|
|
mov al,1
|
|
|
|
|
out dx,al
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_rdtsc:
|
2006-10-06 08:09:41 +02:00
|
|
|
|
bt [cpu_caps], CAPS_TSC
|
|
|
|
|
jnc ret_rdtsc
|
2005-10-06 19:56:22 +02:00
|
|
|
|
rdtsc
|
|
|
|
|
ret
|
|
|
|
|
ret_rdtsc:
|
|
|
|
|
mov edx,0xffffffff
|
|
|
|
|
mov eax,0xffffffff
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
rerouteirqs:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cli
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov al,0x11 ; icw4, edge triggered
|
|
|
|
|
out 0x20,al
|
|
|
|
|
call pic_delay
|
|
|
|
|
out 0xA0,al
|
|
|
|
|
call pic_delay
|
|
|
|
|
|
|
|
|
|
mov al,0x20 ; generate 0x20 +
|
|
|
|
|
out 0x21,al
|
|
|
|
|
call pic_delay
|
|
|
|
|
mov al,0x28 ; generate 0x28 +
|
|
|
|
|
out 0xA1,al
|
|
|
|
|
call pic_delay
|
|
|
|
|
|
|
|
|
|
mov al,0x04 ; slave at irq2
|
|
|
|
|
out 0x21,al
|
|
|
|
|
call pic_delay
|
|
|
|
|
mov al,0x02 ; at irq9
|
|
|
|
|
out 0xA1,al
|
|
|
|
|
call pic_delay
|
|
|
|
|
|
|
|
|
|
mov al,0x01 ; 8086 mode
|
|
|
|
|
out 0x21,al
|
|
|
|
|
call pic_delay
|
|
|
|
|
out 0xA1,al
|
|
|
|
|
call pic_delay
|
|
|
|
|
|
|
|
|
|
mov al,255 ; mask all irq's
|
|
|
|
|
out 0xA1,al
|
|
|
|
|
call pic_delay
|
|
|
|
|
out 0x21,al
|
|
|
|
|
call pic_delay
|
|
|
|
|
|
|
|
|
|
mov ecx,0x1000
|
|
|
|
|
cld
|
|
|
|
|
picl1: call pic_delay
|
|
|
|
|
loop picl1
|
|
|
|
|
|
|
|
|
|
mov al,255 ; mask all irq's
|
|
|
|
|
out 0xA1,al
|
|
|
|
|
call pic_delay
|
|
|
|
|
out 0x21,al
|
|
|
|
|
call pic_delay
|
|
|
|
|
|
|
|
|
|
cli
|
|
|
|
|
|
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pic_delay:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
jmp pdl1
|
|
|
|
|
pdl1: ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sys_msg_board_str:
|
|
|
|
|
|
|
|
|
|
pushad
|
|
|
|
|
@@:
|
|
|
|
|
cmp [esi],byte 0
|
|
|
|
|
je @f
|
|
|
|
|
mov eax,1
|
|
|
|
|
movzx ebx,byte [esi]
|
|
|
|
|
call sys_msg_board
|
|
|
|
|
inc esi
|
|
|
|
|
jmp @b
|
|
|
|
|
@@:
|
|
|
|
|
popad
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
uglobal
|
2007-02-24 23:43:17 +01:00
|
|
|
|
msg_board_data: times 4096 db 0
|
2005-10-06 19:56:22 +02:00
|
|
|
|
msg_board_count dd 0x0
|
|
|
|
|
endg
|
|
|
|
|
|
|
|
|
|
sys_msg_board:
|
|
|
|
|
|
|
|
|
|
; eax=1 : write : bl byte to write
|
|
|
|
|
; eax=2 : read : ebx=0 -> no data, ebx=1 -> data in al
|
|
|
|
|
|
|
|
|
|
mov ecx,[msg_board_count]
|
|
|
|
|
cmp eax, 1
|
|
|
|
|
jne smbl1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mov [msg_board_data+ecx],bl
|
|
|
|
|
inc ecx
|
2007-02-24 23:43:17 +01:00
|
|
|
|
and ecx, 4095
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov [msg_board_count], ecx
|
|
|
|
|
mov [check_idle_semaphore], 5
|
|
|
|
|
ret
|
|
|
|
|
smbl1:
|
|
|
|
|
|
|
|
|
|
cmp eax, 2
|
|
|
|
|
jne smbl2
|
|
|
|
|
test ecx, ecx
|
|
|
|
|
jz smbl21
|
|
|
|
|
; mov edi, msg_board_data
|
|
|
|
|
; mov esi, msg_board_data+1
|
|
|
|
|
; movzx eax, byte [edi]
|
|
|
|
|
mov eax, msg_board_data+1
|
|
|
|
|
mov ebx, msg_board_data
|
|
|
|
|
movzx edx, byte [ebx]
|
|
|
|
|
call memmove
|
|
|
|
|
; push ecx
|
|
|
|
|
; shr ecx, 2
|
|
|
|
|
; cld
|
|
|
|
|
; rep movsd
|
|
|
|
|
; pop ecx
|
|
|
|
|
; and ecx, 3
|
|
|
|
|
; rep movsb
|
|
|
|
|
dec [msg_board_count]
|
|
|
|
|
mov [esp+36], edx ;eax
|
|
|
|
|
mov [esp+24], dword 1
|
|
|
|
|
ret
|
|
|
|
|
smbl21:
|
|
|
|
|
mov [esp+36], ecx
|
|
|
|
|
mov [esp+24], ecx
|
|
|
|
|
|
|
|
|
|
smbl2:
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sys_process_def:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov edi, [CURRENT_TASK]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
dec eax ; 1 = set keyboard mode
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jne no_set_keyboard_setup
|
|
|
|
|
|
|
|
|
|
shl edi,8
|
2007-02-28 11:51:05 +01:00
|
|
|
|
mov [edi+SLOT_BASE + APPDATA.keyboard_mode],bl
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
no_set_keyboard_setup:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
dec eax ; 2 = get keyboard mode
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jne no_get_keyboard_setup
|
|
|
|
|
|
|
|
|
|
shl edi,8
|
2007-02-28 11:51:05 +01:00
|
|
|
|
movzx eax, byte [SLOT_BASE+edi + APPDATA.keyboard_mode]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
no_get_keyboard_setup:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
dec eax ; 3 = get keyboard ctrl, alt, shift
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jne no_get_keyboard_cas
|
|
|
|
|
|
|
|
|
|
; xor eax,eax
|
|
|
|
|
; movzx eax,byte [shift]
|
|
|
|
|
; movzx ebx,byte [ctrl]
|
|
|
|
|
; shl ebx,2
|
|
|
|
|
; add eax,ebx
|
|
|
|
|
; movzx ebx,byte [alt]
|
|
|
|
|
; shl ebx,3
|
|
|
|
|
; add eax,ebx
|
|
|
|
|
|
|
|
|
|
;// mike.dld [
|
|
|
|
|
mov eax, [kb_state]
|
|
|
|
|
;// mike.dld ]
|
|
|
|
|
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
no_get_keyboard_cas:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
dec eax
|
|
|
|
|
jnz no_add_keyboard_hotkey
|
2006-06-30 14:23:15 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov eax, hotkey_list
|
2006-06-30 14:23:15 +02:00
|
|
|
|
@@:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp dword [eax+8], 0
|
|
|
|
|
jz .found_free
|
|
|
|
|
add eax, 16
|
|
|
|
|
cmp eax, hotkey_list+16*256
|
|
|
|
|
jb @b
|
|
|
|
|
mov dword [esp+36], 1
|
|
|
|
|
ret
|
2006-06-30 14:23:15 +02:00
|
|
|
|
.found_free:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov [eax+8], edi
|
|
|
|
|
mov [eax+4], ecx
|
|
|
|
|
movzx ebx, bl
|
|
|
|
|
lea ebx, [hotkey_scancodes+ebx*4]
|
|
|
|
|
mov ecx, [ebx]
|
|
|
|
|
mov [eax], ecx
|
|
|
|
|
mov [ebx], eax
|
|
|
|
|
mov [eax+12], ebx
|
|
|
|
|
jecxz @f
|
|
|
|
|
mov [ecx+12], eax
|
2006-06-30 14:23:15 +02:00
|
|
|
|
@@:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
and dword [esp+36], 0
|
|
|
|
|
ret
|
2006-06-30 14:23:15 +02:00
|
|
|
|
|
|
|
|
|
no_add_keyboard_hotkey:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
dec eax
|
|
|
|
|
jnz no_del_keyboard_hotkey
|
2006-06-30 14:23:15 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
movzx ebx, bl
|
|
|
|
|
lea ebx, [hotkey_scancodes+ebx*4]
|
|
|
|
|
mov eax, [ebx]
|
2006-06-30 14:23:15 +02:00
|
|
|
|
.scan:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
test eax, eax
|
|
|
|
|
jz .notfound
|
|
|
|
|
cmp [eax+8], edi
|
|
|
|
|
jnz .next
|
|
|
|
|
cmp [eax+4], ecx
|
|
|
|
|
jz .found
|
2006-06-30 14:23:15 +02:00
|
|
|
|
.next:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov eax, [eax]
|
|
|
|
|
jmp .scan
|
2006-06-30 14:23:15 +02:00
|
|
|
|
.notfound:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov dword [esp+36], 1
|
|
|
|
|
ret
|
2006-06-30 14:23:15 +02:00
|
|
|
|
.found:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov ecx, [eax]
|
|
|
|
|
jecxz @f
|
|
|
|
|
mov edx, [eax+12]
|
|
|
|
|
mov [ecx+12], edx
|
2006-06-30 14:23:15 +02:00
|
|
|
|
@@:
|
2007-03-23 04:11:34 +01:00
|
|
|
|
mov ecx, [eax+12]
|
|
|
|
|
mov edx, [eax]
|
|
|
|
|
mov [ecx], edx
|
|
|
|
|
xor edx, edx
|
|
|
|
|
mov [eax+4], edx
|
|
|
|
|
mov [eax+8], edx
|
|
|
|
|
mov [eax+12], edx
|
|
|
|
|
mov [eax], edx
|
|
|
|
|
mov [esp+36], edx
|
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2006-06-30 14:23:15 +02:00
|
|
|
|
no_del_keyboard_hotkey:
|
2005-10-06 19:56:22 +02:00
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
sys_gs: ; direct screen access
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp eax,1 ; resolution
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jne no_gs1
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov eax,[ScreenWidth]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
shl eax,16
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov ax,[ScreenHeight]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
add eax,0x00010001
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
|
|
|
|
no_gs1:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp eax,2 ; bits per pixel
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jne no_gs2
|
2007-03-01 21:32:19 +01:00
|
|
|
|
movzx eax,byte [ScreenBPP]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
|
|
|
|
no_gs2:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
cmp eax,3 ; bytes per scanline
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jne no_gs3
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov eax,[BytesPerScanLine]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
|
|
|
|
no_gs3:
|
|
|
|
|
|
|
|
|
|
mov [esp+36],dword -1
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
align 4 ; PCI functions
|
|
|
|
|
|
|
|
|
|
sys_pci:
|
|
|
|
|
|
|
|
|
|
call pci_api
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
align 4 ; system functions
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
syscall_setpixel: ; SetPixel
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edx,[TASK_BASE]
|
2006-08-06 12:29:45 +02:00
|
|
|
|
add eax,[edx-twdw+WDATA.box.left]
|
|
|
|
|
add ebx,[edx-twdw+WDATA.box.top]
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov edi,[current_slot]
|
|
|
|
|
add eax,[edi+APPDATA.wnd_clientbox.left]
|
|
|
|
|
add ebx,[edi+APPDATA.wnd_clientbox.top]
|
2006-08-01 16:09:42 +02:00
|
|
|
|
xor edi,edi ; no force
|
2006-08-03 21:30:32 +02:00
|
|
|
|
; mov edi,1
|
2006-08-01 16:09:42 +02:00
|
|
|
|
call [disable_mouse]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
jmp [putpixel]
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
syscall_writetext: ; WriteText
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov edi,[TASK_BASE]
|
|
|
|
|
mov ebp,[edi-twdw+WDATA.box.left]
|
|
|
|
|
push esi
|
|
|
|
|
mov esi,[current_slot]
|
|
|
|
|
add ebp,[esi+APPDATA.wnd_clientbox.left]
|
|
|
|
|
shl ebp,16
|
|
|
|
|
add ebp,[edi-twdw+WDATA.box.top]
|
|
|
|
|
add bp,word[esi+APPDATA.wnd_clientbox.top]
|
|
|
|
|
pop esi
|
|
|
|
|
add ecx,[edi+TASKDATA.mem_start]
|
|
|
|
|
add eax,ebp
|
|
|
|
|
xor edi,edi
|
|
|
|
|
jmp dtext
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
syscall_openramdiskfile: ; OpenRamdiskFile
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edi,[TASK_BASE]
|
2006-10-06 08:09:41 +02:00
|
|
|
|
add edi,TASKDATA.mem_start
|
2005-10-06 19:56:22 +02:00
|
|
|
|
add eax,[edi]
|
|
|
|
|
add edx,[edi]
|
|
|
|
|
mov esi,12
|
|
|
|
|
call fileread
|
|
|
|
|
mov [esp+36],ebx
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
syscall_drawrect: ; DrawRect
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
mov edi,ecx
|
2006-03-04 12:58:09 +01:00
|
|
|
|
and edi,0x80FFFFFF
|
2005-10-06 19:56:22 +02:00
|
|
|
|
test ax,ax
|
|
|
|
|
je drectr
|
|
|
|
|
test bx,bx
|
|
|
|
|
je drectr
|
|
|
|
|
movzx ecx,ax
|
|
|
|
|
shr eax,16
|
|
|
|
|
movzx edx,bx
|
|
|
|
|
shr ebx,16
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov esi,[current_slot]
|
|
|
|
|
add eax,[esi+APPDATA.wnd_clientbox.left]
|
|
|
|
|
add ebx,[esi+APPDATA.wnd_clientbox.top]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
add ecx,eax
|
|
|
|
|
add edx,ebx
|
|
|
|
|
jmp [drawbar]
|
|
|
|
|
drectr:
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
syscall_getscreensize: ; GetScreenSize
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-03-01 21:32:19 +01:00
|
|
|
|
movzx eax,word[ScreenWidth]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
shl eax,16
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov ax,[ScreenHeight]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
syscall_cdaudio: ; CD
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
call sys_cd_audio
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
syscall_delramdiskfile: ; DelRamdiskFile
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edi,[TASK_BASE]
|
2006-10-06 08:09:41 +02:00
|
|
|
|
add edi,TASKDATA.mem_start
|
2005-10-06 19:56:22 +02:00
|
|
|
|
add eax,[edi]
|
|
|
|
|
call filedelete
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
syscall_writeramdiskfile: ; WriteRamdiskFile
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edi,[TASK_BASE]
|
2006-10-06 08:09:41 +02:00
|
|
|
|
add edi,TASKDATA.mem_start
|
2005-10-06 19:56:22 +02:00
|
|
|
|
add eax,[edi]
|
|
|
|
|
add ebx,[edi]
|
|
|
|
|
call filesave
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
syscall_getpixel: ; GetPixel
|
2007-03-01 21:32:19 +01:00
|
|
|
|
mov ecx,[ScreenWidth]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
inc ecx
|
|
|
|
|
xor edx,edx
|
|
|
|
|
div ecx
|
|
|
|
|
mov ebx,edx
|
|
|
|
|
xchg eax,ebx
|
2007-04-18 08:37:14 +02:00
|
|
|
|
call dword [GETPIXEL]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov [esp+36],ecx
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
syscall_readstring: ; ReadString
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edi,[TASK_BASE]
|
2006-10-06 08:09:41 +02:00
|
|
|
|
add edi,TASKDATA.mem_start
|
2005-10-06 19:56:22 +02:00
|
|
|
|
add eax,[edi]
|
|
|
|
|
call read_string
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
syscall_drawline: ; DrawLine
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edi,[TASK_BASE]
|
2006-08-06 12:29:45 +02:00
|
|
|
|
movzx edx,word[edi-twdw+WDATA.box.left]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
mov ebp,edx
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov esi,[current_slot]
|
|
|
|
|
add ebp,[esi+APPDATA.wnd_clientbox.left]
|
|
|
|
|
add dx,word[esi+APPDATA.wnd_clientbox.left]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
shl edx,16
|
|
|
|
|
add ebp,edx
|
2006-08-06 12:29:45 +02:00
|
|
|
|
movzx edx,word[edi-twdw+WDATA.box.top]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
add eax,ebp
|
|
|
|
|
mov ebp,edx
|
2007-04-18 08:37:14 +02:00
|
|
|
|
add ebp,[esi+APPDATA.wnd_clientbox.top]
|
|
|
|
|
add dx,word[esi+APPDATA.wnd_clientbox.top]
|
2005-10-06 19:56:22 +02:00
|
|
|
|
shl edx,16
|
|
|
|
|
xor edi,edi
|
|
|
|
|
add edx,ebp
|
|
|
|
|
add ebx,edx
|
|
|
|
|
jmp [draw_line]
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
syscall_getirqowner: ; GetIrqOwner
|
2006-05-05 14:40:02 +02:00
|
|
|
|
cmp eax,16
|
|
|
|
|
jae .err
|
2005-10-06 19:56:22 +02:00
|
|
|
|
shl eax,2
|
|
|
|
|
add eax,irq_owner
|
|
|
|
|
mov eax,[eax]
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
2006-05-05 14:40:02 +02:00
|
|
|
|
.err:
|
|
|
|
|
or dword [esp+36], -1
|
|
|
|
|
ret
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
syscall_reserveportarea: ; ReservePortArea and FreePortArea
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
call r_f_port_area
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
syscall_threads: ; CreateThreads
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
call sys_threads
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
|
|
|
|
stack_driver_stat:
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
call app_stack_handler ; Stack status
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
; mov [check_idle_semaphore],5 ; enable these for zero delay
|
|
|
|
|
; call change_task ; between sent packet
|
|
|
|
|
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
socket: ; Socket interface
|
2005-10-06 19:56:22 +02:00
|
|
|
|
call app_socket_handler
|
|
|
|
|
|
|
|
|
|
; mov [check_idle_semaphore],5 ; enable these for zero delay
|
|
|
|
|
; call change_task ; between sent packet
|
|
|
|
|
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
mov [esp+24],ebx
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
user_events: ; User event times
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
mov eax,0x12345678
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
read_from_hd: ; Read from hd - fn not in use
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-02-28 09:52:06 +01:00
|
|
|
|
mov edi,[TASK_BASE]
|
2006-08-06 12:29:45 +02:00
|
|
|
|
add edi,TASKDATA.mem_start
|
2005-10-06 19:56:22 +02:00
|
|
|
|
add eax,[edi]
|
|
|
|
|
add ecx,[edi]
|
|
|
|
|
add edx,[edi]
|
|
|
|
|
call file_read
|
|
|
|
|
|
|
|
|
|
mov [esp+36],eax
|
|
|
|
|
mov [esp+24],ebx
|
|
|
|
|
|
|
|
|
|
ret
|
|
|
|
|
|
2007-02-25 15:20:50 +01:00
|
|
|
|
align 4
|
|
|
|
|
paleholder:
|
|
|
|
|
ret
|
2007-02-27 12:47:52 +01:00
|
|
|
|
|
2006-05-06 16:34:30 +02:00
|
|
|
|
; --------------- APM ---------------------
|
|
|
|
|
apm_entry dp 0
|
2007-03-23 04:11:34 +01:00
|
|
|
|
apm_vf dd 0
|
2006-05-06 16:34:30 +02:00
|
|
|
|
align 4
|
|
|
|
|
sys_apm:
|
|
|
|
|
cmp word [apm_vf], 0 ; Check APM BIOS enable
|
|
|
|
|
jne @f
|
2007-03-23 04:11:34 +01:00
|
|
|
|
or [esp + 56], byte 1 ; error
|
|
|
|
|
mov [esp + 36], dword 8 ; 32-bit protected-mode interface not supported
|
2006-05-06 16:34:30 +02:00
|
|
|
|
ret
|
2006-10-06 08:09:41 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
@@:
|
|
|
|
|
xchg eax, ecx
|
2006-05-06 16:34:30 +02:00
|
|
|
|
xchg ebx, ecx
|
2006-10-06 08:09:41 +02:00
|
|
|
|
|
2006-05-06 16:34:30 +02:00
|
|
|
|
cmp al, 3
|
2007-03-23 04:11:34 +01:00
|
|
|
|
ja @f
|
2006-05-12 14:47:52 +02:00
|
|
|
|
and [esp + 56], byte 0xfe ; emulate func 0..3 as func 0
|
2006-05-06 16:34:30 +02:00
|
|
|
|
mov eax, [apm_vf]
|
|
|
|
|
mov [esp + 36], eax
|
|
|
|
|
shr eax, 16
|
|
|
|
|
mov [esp + 32], eax
|
|
|
|
|
ret
|
2006-05-12 14:47:52 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
@@:
|
|
|
|
|
|
|
|
|
|
mov esi, [master_tab+(OS_BASE shr 20)]
|
|
|
|
|
xchg [master_tab], esi
|
|
|
|
|
push esi
|
|
|
|
|
mov edi, cr3
|
|
|
|
|
mov cr3, edi ;flush TLB
|
|
|
|
|
|
|
|
|
|
call pword [apm_entry] ; call APM BIOS
|
|
|
|
|
|
|
|
|
|
xchg eax, [esp]
|
|
|
|
|
mov [master_tab], eax
|
|
|
|
|
mov eax, cr3
|
|
|
|
|
mov cr3, eax
|
|
|
|
|
pop eax
|
|
|
|
|
|
2006-05-06 16:34:30 +02:00
|
|
|
|
mov [esp + 8 ], edi
|
|
|
|
|
mov [esp + 12], esi
|
|
|
|
|
mov [esp + 24], ebx
|
|
|
|
|
mov [esp + 28], edx
|
|
|
|
|
mov [esp + 32], ecx
|
|
|
|
|
mov [esp + 36], eax
|
|
|
|
|
setc al
|
2006-05-12 14:47:52 +02:00
|
|
|
|
and [esp + 56], byte 0xfe
|
2007-03-23 04:11:34 +01:00
|
|
|
|
or [esp + 56], al
|
2007-04-18 08:37:14 +02:00
|
|
|
|
|
|
|
|
|
|
2006-05-06 16:34:30 +02:00
|
|
|
|
ret
|
|
|
|
|
; -----------------------------------------
|
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
align 4
|
|
|
|
|
|
2007-03-23 04:11:34 +01:00
|
|
|
|
undefined_syscall: ; Undefined system call
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
|
|
|
|
mov [esp+36],dword -1
|
|
|
|
|
ret
|
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
align 4
|
|
|
|
|
system_shutdown: ; shut down the system
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
cmp byte [BOOT_VAR+0x9030], 1
|
|
|
|
|
jne @F
|
|
|
|
|
ret
|
|
|
|
|
@@:
|
|
|
|
|
call stop_all_services
|
|
|
|
|
push 3 ; stop playing cd
|
|
|
|
|
pop eax
|
|
|
|
|
call sys_cd_audio
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
yes_shutdown_param:
|
|
|
|
|
cli
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov eax, kernel_file ; load kernel.mnt to 0x8000:0
|
|
|
|
|
push 12
|
|
|
|
|
pop esi
|
|
|
|
|
xor ebx,ebx
|
|
|
|
|
or ecx,-1
|
|
|
|
|
mov edx, OS_BASE+0x80000
|
|
|
|
|
call fileread
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov esi, restart_kernel_4000+OS_BASE+0x10000 ; move kernel re-starter to 0x4000:0
|
|
|
|
|
mov edi,OS_BASE+0x40000
|
|
|
|
|
mov ecx,1000
|
|
|
|
|
rep movsb
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov esi,OS_BASE+0x2F0000 ; restore 0x0 - 0xffff
|
|
|
|
|
mov edi, OS_BASE
|
|
|
|
|
mov ecx,0x10000/4
|
|
|
|
|
cld
|
|
|
|
|
rep movsd
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
call restorefatchain
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov al, 0xFF
|
|
|
|
|
out 0x21, al
|
|
|
|
|
out 0xA1, al
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov word [OS_BASE+0x467+0],pr_mode_exit
|
|
|
|
|
mov word [OS_BASE+0x467+2],0x1000
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov al,0x0F
|
|
|
|
|
out 0x70,al
|
|
|
|
|
mov al,0x05
|
|
|
|
|
out 0x71,al
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
mov al,0xFE
|
|
|
|
|
out 0x64,al
|
|
|
|
|
hlt
|
2006-10-06 08:09:41 +02:00
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
include "data32.inc"
|
2005-10-06 19:56:22 +02:00
|
|
|
|
|
2007-04-18 08:37:14 +02:00
|
|
|
|
__REV__ = __REV
|
2007-02-25 15:20:50 +01:00
|
|
|
|
|
2005-10-06 19:56:22 +02:00
|
|
|
|
uglobals_size = $ - endofcode
|
2006-02-01 07:07:36 +01:00
|
|
|
|
diff16 "end of kernel code",0,$
|
2007-03-22 02:09:49 +01:00
|
|
|
|
|