Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 2433 → Rev 2434

/kernel/branches/Kolibri-acpi/blkdev/cd_drv.inc
170,13 → 170,15
MaxCDWaitTime equ 1000 ;200 ;10 ñåêóíä
uglobal
; Îáëàñòü ïàìÿòè äëÿ ôîðìèðîâàíèÿ ïàêåòíîé êîìàíäû
PacketCommand: rb 12 ;DB 12 DUP (?)
PacketCommand:
rb 12 ;DB 12 DUP (?)
; Îáëàñòü ïàìÿòè äëÿ ïðèåìà äàííûõ îò äèñêîâîäà
;CDDataBuf DB 4096 DUP (0)
; Ðàçìåð ïðèíèìàåìîãî áëîêà äàííûõ â áàéòàõ
;CDBlockSize DW ?
; Àäðåñ ñ÷èòûâàåìîãî ñåêòîðà äàííûõ
CDSectorAddress: DD ?
CDSectorAddress:
DD ?
; Âðåìÿ íà÷àëà î÷åðåäíîé îïåðàöèè ñ äèñêîì
TickCounter_1 DD 0
; Âðåìÿ íà÷àëà îæèäàíèÿ ãîòîâíîñòè óñòðîéñòâà
/kernel/branches/Kolibri-acpi/blkdev/disk.inc
34,17 → 34,17
; device. They are implemented by a driver. Objects with this structure reside
; in a driver.
struct DISKFUNC
.strucsize dd ?
strucsize dd ?
; Size of the structure. This field is intended for possible extensions of
; this structure. If a new function is added to this structure and a driver
; implements an old version, the caller can detect this by checking .strucsize,
; so the driver remains compatible.
.close dd ?
close dd ?
; The pointer to the function which frees all driver-specific resources for
; the disk.
; Optional, may be NULL.
; void close(void* userdata);
.closemedia dd ?
closemedia dd ?
; The pointer to the function which informs the driver that the kernel has
; finished all processing with the current media. If media is removed, the
; driver should decline all requests to that media with DISK_STATUS_NO_MEDIA,
53,17 → 53,17
; function is called.
; Optional, may be NULL (if media is not removable).
; void closemedia(void* userdata);
.querymedia dd ?
querymedia dd ?
; The pointer to the function which determines capabilities of the media.
; int querymedia(void* userdata, DISKMEDIAINFO* info);
; Return value: one of DISK_STATUS_*
.read dd ?
read dd ?
; The pointer to the function which reads data from the device.
; int read(void* userdata, void* buffer, __int64 startsector, int* numsectors);
; input: *numsectors = number of sectors to read
; output: *numsectors = number of sectors which were successfully read
; Return value: one of DISK_STATUS_*
.write dd ?
write dd ?
; The pointer to the function which writes data to the device.
; Optional, may be NULL.
; int write(void* userdata, void* buffer, __int64 startsector, int* numsectors);
70,7 → 70,7
; input: *numsectors = number of sectors to write
; output: *numsectors = number of sectors which were successfully written
; Return value: one of DISK_STATUS_*
.flush dd ?
flush dd ?
; The pointer to the function which flushes the internal device cache.
; Optional, may be NULL.
; int flush(void* userdata);
78,7 → 78,7
; Note that read/write are called by the cache manager, so a driver should not
; create a software cache. This function is implemented for flushing a hardware
; cache, if it exists.
.adjust_cache_size dd ?
adjust_cache_size dd ?
; The pointer to the function which returns the cache size for this device.
; Optional, may be NULL.
; unsigned int adjust_cache_size(unsigned int suggested_size);
89,11 → 89,11
; Objects with this structure are allocated by the kernel as a part of the DISK
; structure and are filled by a driver in the 'querymedia' callback.
struct DISKMEDIAINFO
.Flags dd ?
Flags dd ?
; Combination of DISK_MEDIA_* bits.
.SectorSize dd ?
SectorSize dd ?
; Size of the sector.
.Capacity dq ?
Capacity dq ?
; Size of the media in sectors.
ends
 
101,14 → 101,14
; there are two distinct caches for a disk, one for "system" data,and the other
; for "application" data.
struct DISKCACHE
.Lock MUTEX
mutex MUTEX
; Lock to protect the cache.
; The following fields are inherited from data32.inc:cache_ideX.
.pointer rd 1
.data_size rd 1 ; not use
.data rd 1
.sad_size rd 1
.search_start rd 1
pointer dd ?
data_size dd ? ; unused
data dd ?
sad_size dd ?
search_start dd ?
ends
 
; This structure represents a disk device and its media for the kernel.
116,23 → 116,23
; freed in the 'disk_dereference' function.
struct DISK
; Fields of disk object
.Next dd ?
.Prev dd ?
Next dd ?
Prev dd ?
; All disk devices are linked in one list with these two fields.
; Head of the list is the 'disk_list' variable.
.Functions dd ?
Functions dd ?
; Pointer to the 'DISKFUNC' structure with driver functions.
.Name dd ?
Name dd ?
; Pointer to the string used for accesses through the global filesystem.
.UserData dd ?
UserData dd ?
; This field is passed to all callback functions so a driver can decide which
; physical device is addressed.
.DriverFlags dd ?
DriverFlags dd ?
; Bitfield. Currently only DISK_NO_INSERT_NOTIFICATION bit is defined.
; If it is set, the driver will never issue 'disk_media_changed' notification
; with argument set to true, so the kernel must try to detect media during
; requests from the file system.
.RefCount dd ?
RefCount dd ?
; Count of active references to this structure. One reference is kept during
; the lifetime of the structure between 'disk_add' and 'disk_del'.
; Another reference is taken during any filesystem operation for this disk.
140,13 → 140,13
; The structure is destroyed when the reference count decrements to zero:
; this usually occurs in 'disk_del', but can be delayed to the end of last
; filesystem operation, if one is active.
.MediaLock MUTEX
MediaLock MUTEX
; Lock to protect the MEDIA structure. See the description after
; 'disk_list_mutex' for the locking strategy.
; Fields of media object
.MediaInserted db ?
MediaInserted db ?
; 0 if media is not inserted, nonzero otherwise.
.MediaUsed db ?
MediaUsed db ?
; 0 if media fields are not used, nonzero otherwise. If .MediaRefCount is
; nonzero, this field is nonzero too; however, when .MediaRefCount goes
; to zero, there is some time interval during which media object is still used.
154,7 → 154,7
; The following fields are not valid unless either .MediaInserted is nonzero
; or they are accessed from a code which has obtained the reference when
; .MediaInserted was nonzero.
.MediaRefCount dd ?
MediaRefCount dd ?
; Count of active references to the media object. One reference is kept during
; the lifetime of the media between two calls to 'disk_media_changed'.
; Another reference is taken during any filesystem operation for this media.
161,16 → 161,16
; The callback 'closemedia' is called when the reference count decrements to
; zero: this usually occurs in 'disk_media_changed', but can be delayed to the
; end of the last filesystem operation, if one is active.
.MediaInfo DISKMEDIAINFO
MediaInfo DISKMEDIAINFO
; This field keeps information on the current media.
.NumPartitions dd ?
NumPartitions dd ?
; Number of partitions on this media.
.Partitions dd ?
Partitions dd ?
; Pointer to array of .NumPartitions pointers to PARTITION structures.
.cache_size dd ?
cache_size dd ?
; inherited from cache_ideX_size
.SysCache DISKCACHE
.AppCache DISKCACHE
SysCache DISKCACHE
AppCache DISKCACHE
; Two caches for the disk.
ends
 
178,13 → 178,13
; template, the actual contents after common fields is determined by the
; file system code for this partition.
struct PARTITION
.FirstSector dq ?
FirstSector dq ?
; First sector of the partition.
.Length dq ?
Length dq ?
; Length of the partition in sectors.
.Disk dd ?
Disk dd ?
; Pointer to parent DISK structure.
.FSUserFunctions dd ?
FSUserFunctions dd ?
; Handlers for the sysfunction 70h. This field is a pointer to the following
; array. The first dword is a number of supported subfunctions, other dwords
; point to handlers of corresponding subfunctions.
194,23 → 194,23
 
; This is an external structure, it represents an entry in the partition table.
struct PARTITION_TABLE_ENTRY
.Bootable db ?
Bootable db ?
; 80h = bootable partition, 0 = non-bootable partition, other values = invalid
.FirstHead db ?
.FirstSector db ?
.FirstTrack db ?
FirstHead db ?
FirstSector db ?
FirstTrack db ?
; Coordinates of first sector in CHS.
.Type db ?
Type db ?
; Partition type, one of predefined constants. 0 = empty, several types denote
; extended partition (see process_partition_table_entry), we are not interested
; in other values.
.LastHead db ?
.LastSector db ?
.LastTrack db ?
LastHead db ?
LastSector db ?
LastTrack db ?
; Coordinates of last sector in CHS.
.FirstAbsSector dd ?
FirstAbsSector dd ?
; Coordinate of first sector in LBA.
.Length dd ?
Length dd ?
; Length of the partition in sectors.
ends
 
/kernel/branches/Kolibri-acpi/blkdev/disk_cache.inc
520,9 → 520,9
@@:
; 3. Fill two DISKCACHE structures.
mov [esi+DISK.SysCache.pointer], eax
lea ecx, [esi+DISK.SysCache.Lock]
lea ecx, [esi+DISK.SysCache.mutex]
call mutex_init
lea ecx, [esi+DISK.AppCache.Lock]
lea ecx, [esi+DISK.AppCache.mutex]
call mutex_init
; The following code is inherited from getcache.inc.
mov edx, [esi+DISK.SysCache.pointer]
/kernel/branches/Kolibri-acpi/blkdev/flp_drv.inc
176,7 → 176,8
@@GetByteFromFDC:
inc DX
in AL,DX
@@End_6: pop DX
@@End_6:
pop DX
pop ECX
ret
 
222,7 → 223,8
; Îøèáêà òàéì-àóòà
mov [FDC_Status],FDC_TimeOut
; mov [flp_status],0
@@End_7: popa
@@End_7:
popa
ret
 
;*********************************
456,7 → 458,8
jnz @@Err_1
mov [FDC_Status],FDC_Normal
jmp @@Exit_1
@@Err_1: mov [FDC_Status],FDC_SectorNotFound
@@Err_1:
mov [FDC_Status], FDC_SectorNotFound
; mov [flp_status],0
@@Exit_1:
call save_timer_fdd_motor
555,7 → 558,8
jnz @@Err_2
mov [FDC_Status],FDC_Normal
jmp @@Exit_3
@@Err_2: mov [FDC_Status],FDC_SectorNotFound
@@Err_2:
mov [FDC_Status], FDC_SectorNotFound
@@Exit_3:
call save_timer_fdd_motor
popad
/kernel/branches/Kolibri-acpi/blkdev/hd_drv.inc
891,8 → 891,8
jmp hd_write_error
 
uglobal
int13_regs_in rb v86_regs.size
int13_regs_out rb v86_regs.size
int13_regs_in rb sizeof.v86_regs
int13_regs_out rb sizeof.v86_regs
endg
 
int13_call:
907,7 → 907,7
push ebx ecx esi edi
mov ebx, int13_regs_in
mov edi, ebx
mov ecx, v86_regs.size/4
mov ecx, sizeof.v86_regs/4
xor eax, eax
rep stosd
mov byte [ebx+v86_regs.eax+1], dl
/kernel/branches/Kolibri-acpi/blkdev/rd.inc
1169,7 → 1169,8
add edi, 6
cmp word [edi], ' '
jnz .insert_tilde
@@: dec edi
@@:
dec edi
cmp byte [edi], ' '
jz @b
inc edi
/kernel/branches/Kolibri-acpi/boot/bootcode.inc
712,7 → 712,8
sub word [cursor_pos],size_of_step
jmp .loops
 
.down: cmp ah,0x50;x,0x50E0 ; down
.down:
cmp ah, 0x50;x,0x50E0 ; down
jne .pgup
cmp word[es:si+10],-1
je .loops
719,7 → 720,8
add word [cursor_pos],size_of_step
jmp .loops
 
.pgup: cmp ah,0x49 ; page up
.pgup:
cmp ah, 0x49 ; page up
jne .pgdn
sub si, size_of_step*long_v_table
cmp si, modes_table
736,7 → 738,8
mov word [home_cursor], si
jmp .loops
 
.pgdn: cmp ah,0x51 ; page down
.pgdn:
cmp ah, 0x51 ; page down
jne .enter
mov ax, [end_cursor]
add si, size_of_step*long_v_table
756,7 → 759,8
mov word [home_cursor], si
jmp .loops
 
.enter: cmp al,0x0D;x,0x1C0D ; enter
.enter:
cmp al, 0x0D;x,0x1C0D ; enter
jne .loops
push word [cursor_pos]
pop bp
801,7 → 805,8
popf
jz @f
mov si, off_msg
@@: jmp printplain
@@:
jmp printplain
; novesa and vervesa strings are not used at the moment of executing this code
virtual at novesa
.oldtimer dd ?
850,7 → 855,8
mov cl, 'ã'
jz @f
mov cl, 'ë'
@@: mov [time_str+9], cl
@@:
mov [time_str+9], cl
else if lang eq et
cmp al, 1
ja @f
863,7 → 869,8
mov cl, 's'
ja @f
mov cl, ' '
@@: mov [time_str+9], cl
@@:
mov [time_str+9], cl
end if
add al, '0'
mov [time_str+1], al
/kernel/branches/Kolibri-acpi/boot/bootstr.inc
42,7 → 42,8
store byte ' ' at d80x25_top+cur_line_pos
store dword ' SVN' at d80x25_top+cur_line_pos-4
 
space_msg: line_space
space_msg:
line_space
verstr:
; line_space
; version string
/kernel/branches/Kolibri-acpi/boot/bootvesa.inc
94,7 → 94,8
push edx
call int2str
pop eax
@@: or al,0x30
@@:
or al, 0x30
mov [ds:di],al
inc di
ret
107,7 → 108,8
push edx
call int2strnz
pop eax
@@: or al,0x30
@@:
or al, 0x30
mov [es:di],al
inc di
ret
241,10 → 243,12
mov [es:bx+4],ax ; +4[2] : attributes
 
cmp [s_vesa.ver],'2'
jb .lp1
; jb .lp1
jb @f ; We do not use Vesa 1.2 mode is now
 
or cx,0x4000 ; use LFB
.lp1: mov [es:bx+6],cx ; +6 : mode number
.lp1:
mov [es:bx+6], cx ; +6 : mode number
movzx ax,byte [es:mi.BitsPerPixel]
mov word [es:bx+8],ax ; +8 : bits per pixel
add bx,size_of_step ; size of record
363,7 → 367,8
je .ok_found_mode
cmp word [es:si+8],24
je .ok_found_mode
@@: add si,size_of_step
@@:
add si, size_of_step
cmp word [es:si],-1
jnz .findvbemode
.novbemode:
438,7 → 443,8
 
mov ecx,long_v_table
 
.loop: add ax,size_of_step
.loop:
add ax, size_of_step
cmp ax,word [end_cursor]
jae .next_step
loop .loop
471,13 → 477,16
je .ok
cmp word [es:si+8],24
je .ok
.next: add si,size_of_step
.next:
add si, size_of_step
cmp word [es:si],-1
je .exit
jmp .loops
.ok: xor ax,ax
.ok:
xor ax, ax
ret
.exit: or ax,-1
.exit:
or ax, -1
ret
 
 
520,7 → 529,8
jmp .ok
 
 
.low: sub cx,size_of_step
.low:
sub cx, size_of_step
cmp cx,modes_table
jb .ok
push cx
726,8 → 736,8
je .mode0x12_0x13
 
 
cmp byte [s_vesa.ver],'2'
jb .vesa12
; cmp byte [s_vesa.ver], '2'
; jb .vesa12
 
; VESA 2 and Vesa 3
 
760,23 → 770,21
 
; VESA 1.2 PM BANK SWITCH ADDRESS
 
.vesa12:
 
 
mov ax,0x4f0A
xor bx,bx
int 0x10
xor eax,eax
xor ebx,ebx
mov ax,es
shl eax,4
mov bx,di
add eax,ebx
movzx ebx,word[es:di]
add eax,ebx
push 0x0000
pop es
mov [es:0x9014],eax
;.vesa12:
; mov ax, 0x4f0A
; xor bx, bx
; int 0x10
; xor eax, eax
; xor ebx, ebx
; mov ax, es
; shl eax, 4
; mov bx, di
; add eax, ebx
; movzx ebx, word[es:di]
; add eax, ebx
; push 0x0000
; pop es
; mov [es:0x9014], eax
.exit:
ret
 
/kernel/branches/Kolibri-acpi/boot/preboot.inc
35,7 → 35,8
end if
 
if $>0x200
ERROR: prebooting parameters must fit in first sector!!!
ERROR:
prebooting parameters must fit in first sector!!!
end if
hdsysimage db 'KOLIBRI IMG' ; load from
image_save db 'KOLIBRI IMG' ; save to
/kernel/branches/Kolibri-acpi/bus/pci/pci32.inc
545,7 → 545,8
uglobal
align 4
; VendID (2), DevID (2), Revision = 0 (1), Class Code (3), FNum (1), Bus (1)
pci_emu_dat: times 30*10 db 0
pci_emu_dat:
times 30*10 db 0
endg
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
align 4
579,7 → 580,8
cmp ebp, 2 ; FIND_PCI_DEVICE
jne .not_FIND_PCI_DEVICE
mov ebx, pci_emu_dat
..nxt: cmp [ebx], dx
..nxt:
cmp [ebx], dx
jne ..no
cmp [ebx + 2], cx
jne ..no
588,7 → 590,8
mov bx, [ebx + 4]
xor ah, ah
jmp .return_ab
..no: cmp word[ebx], 0
..no:
cmp word[ebx], 0
je ..dev_not_found
add ebx, 10
jmp ..nxt
601,12 → 604,14
jne .not_FIND_PCI_CLASS_CODE
mov esi, pci_emu_dat
shl ecx, 8
..nxt2: cmp [esi], ecx
..nxt2:
cmp [esi], ecx
jne ..no2
mov bx, [esi]
xor ah, ah
jmp .return_ab
..no2: cmp dword[esi], 0
..no2:
cmp dword[esi], 0
je ..dev_not_found
add esi, 10
jmp ..nxt2
641,7 → 646,8
.not_WRITE_CONFIG:
.unsupported_func:
mov ah, 0x81 ; FUNC_NOT_SUPPORTED
.return:mov dword[esp + 4 ], edi
.return:
mov dword[esp + 4 ], edi
mov dword[esp + 8], esi
.return_abcd:
mov dword[esp + 24], edx
/kernel/branches/Kolibri-acpi/const.inc
146,46 → 146,39
IRQ_PIC equ 0
IRQ_APIC equ 1
 
struc TSS
{
._back rw 2
._esp0 rd 1
._ss0 rw 2
._esp1 rd 1
._ss1 rw 2
._esp2 rd 1
._ss2 rw 2
._cr3 rd 1
._eip rd 1
._eflags rd 1
._eax rd 1
._ecx rd 1
._edx rd 1
._ebx rd 1
._esp rd 1
._ebp rd 1
._esi rd 1
._edi rd 1
._es rw 2
._cs rw 2
._ss rw 2
._ds rw 2
._fs rw 2
._gs rw 2
._ldt rw 2
._trap rw 1
._io rw 1
struct TSS
_back rw 2
_esp0 rd 1
_ss0 rw 2
_esp1 rd 1
_ss1 rw 2
_esp2 rd 1
_ss2 rw 2
_cr3 rd 1
_eip rd 1
_eflags rd 1
_eax rd 1
_ecx rd 1
_edx rd 1
_ebx rd 1
_esp rd 1
_ebp rd 1
_esi rd 1
_edi rd 1
_es rw 2
_cs rw 2
_ss rw 2
_ds rw 2
_fs rw 2
_gs rw 2
_ldt rw 2
_trap rw 1
_io rw 1
rb 24
._io_map_0 rb 4096
._io_map_1 rb 4096
}
_io_map_0 rb 4096
_io_map_1 rb 4096
ends
 
virtual at 0
TSS TSS
end virtual
 
TSS_SIZE equ (128+8192)
 
OS_BASE equ 0x80000000
 
window_data equ (OS_BASE+0x0001000)
217,7 → 210,7
;unused ? store mousepointer
MOUSE_PICTURE equ (OS_BASE+0x000F200)
 
MOUSE_VISIBLE equ (OS_BASE+0x000F204)
;MOUSE_VISIBLE equ (OS_BASE+0x000F204)
WIN_TEMP_XY equ (OS_BASE+0x000F300)
KEY_COUNT equ (OS_BASE+0x000F400)
KEY_BUFF equ (OS_BASE+0x000F401)
402,381 → 395,258
 
EV_INTR equ 1
 
struc THR_DATA
{
struct THR_DATA
rb (8192-512)
.pl0_stack:
.fpu_state rb 512
.tls_page rb 4096
.pdbr rb 4096
}
; pl0_stack
fpu_state rb 512
tls_page rb 4096
pdbr rb 4096
ends
 
THR_DATA_SIZE equ 4096*4
 
virtual at (OS_BASE-THR_DATA_SIZE)
virtual at (OS_BASE-sizeof.THR_DATA)
thr_data THR_DATA
end virtual
 
struc SYS_VARS
{ .bpp dd ?
.scanline dd ?
.vesa_mode dd ?
.x_res dd ?
.y_res dd ?
}
struct SYS_VARS
bpp dd ?
scanline dd ?
vesa_mode dd ?
x_res dd ?
y_res dd ?
ends
 
struc APPOBJ ;common object header
{
.magic dd ? ;
.destroy dd ? ;internal destructor
.fd dd ? ;next object in list
.bk dd ? ;prev object in list
.pid dd ? ;owner id
};
struct APPOBJ ; common object header
magic dd ? ;
destroy dd ? ; internal destructor
fd dd ? ; next object in list
bk dd ? ; prev object in list
pid dd ? ; owner id
ends
 
virtual at 0
APPOBJ APPOBJ
end virtual
 
APP_OBJ_OFFSET equ 48
APP_EV_OFFSET equ 40
 
struc CURSOR
{
;common object header
.magic dd ? ;'CURS'
.destroy dd ? ;internal destructor
.fd dd ? ;next object in list
.bk dd ? ;prev object in list
.pid dd ? ;owner id
struct CURSOR APPOBJ
base dd ? ;allocated memory
hot_x dd ? ;hotspot coords
hot_y dd ?
 
;cursor data
.base dd ? ;allocated memory
.hot_x dd ? ;hotspot coords
.hot_y dd ?
list_next dd ? ;next cursor in cursor list
list_prev dd ? ;prev cursor in cursor list
dev_obj dd ? ;device depended data
ends
 
.list_next dd ? ;next cursor in cursor list
.list_prev dd ? ;prev cursor in cursor list
.dev_obj dd ? ;device depended data
 
.sizeof:
}
virtual at 0
CURSOR CURSOR
end virtual
 
 
struc EVENT
{
.magic dd ? ;'EVNT'
.destroy dd ? ;internal destructor
.fd dd ? ;next object in list
.bk dd ? ;prev object in list
.pid dd ? ;owner id
 
.id dd ? ;event uid
.state dd ? ;internal flags
.code dd ?
struct EVENT APPOBJ
id dd ? ;event uid
state dd ? ;internal flags
code dd ?
rd 5
.size = $ - .magic
.codesize = $ - .code
}
ends
 
virtual at 0
EVENT EVENT
end virtual
 
struct SMEM
bk dd ?
fd dd ? ;+4
base dd ? ;+8
size dd ? ;+12
access dd ? ;+16
refcount dd ? ;+20
name rb 32 ;+24
ends
 
struc SMEM
{
.bk dd ?
.fd dd ? ;+4
.base dd ? ;+8
.size dd ? ;+12
.access dd ? ;+16
.refcount dd ? ;+20
.name rb 32 ;+24
.sizeof:
}
struct SMAP APPOBJ
base dd ? ;mapped base
parent dd ? ;SMEM
ends
 
struc SMAP
{
.magic dd ? ; SMAP
.destroy dd ? ;internal destructor
.fd dd ? ;next object in list
.bk dd ? ;prev object in list
.pid dd ? ;owner id
struct DLLDESCR
bk dd ?
fd dd ? ;+4
data dd ? ;+8
size dd ? ;+12
timestamp dq ?
refcount dd ?
defaultbase dd ?
coff_hdr dd ?
symbols_ptr dd ?
symbols_num dd ?
symbols_lim dd ?
exports dd ? ;export table
name rb 260
ends
 
.base dd ? ;mapped base
.parent dd ? ;SMEM
.sizeof:
}
struct HDLL
fd dd ? ;next object in list
bk dd ? ;prev object in list
pid dd ? ;owner id
 
virtual at 0
SMEM SMEM
end virtual
base dd ? ;mapped base
size dd ? ;mapped size
refcount dd ? ;reference counter for this process and this lib
parent dd ? ;DLLDESCR
ends
 
virtual at 0
SMAP SMAP
end virtual
struct display_t
x dd ?
y dd ?
width dd ?
height dd ?
bpp dd ?
vrefresh dd ?
pitch dd ?
lfb dd ?
 
struc DLLDESCR
{
.bk dd ?
.fd dd ? ;+4
.data dd ? ;+8
.size dd ? ;+12
.timestamp dq ?
.refcount dd ?
.defaultbase dd ?
.coff_hdr dd ?
.symbols_ptr dd ?
.symbols_num dd ?
.symbols_lim dd ?
.exports dd ? ;export table
.name:
.sizeof:
}
modes dd ?
ddev dd ?
connector dd ?
crtc dd ?
 
struc HDLL
{
.fd dd ? ;next object in list
.bk dd ? ;prev object in list
.pid dd ? ;owner id
cr_list.next dd ?
cr_list.prev dd ?
 
.base dd ? ;mapped base
.size dd ? ;mapped size
.refcount dd ? ;reference counter for this process and this lib
.parent dd ? ;DLLDESCR
.sizeof:
}
cursor dd ?
 
virtual at 0
DLLDESCR DLLDESCR
end virtual
init_cursor dd ?
select_cursor dd ?
show_cursor dd ?
move_cursor dd ?
restore_cursor dd ?
mask_seqno dd ?
check_mouse dd ?
check_m_pixel dd ?
ends
 
virtual at 0
HDLL HDLL
end virtual
struct BOOT_DATA
bpp dd ?
scanline dd ?
vesa_mode dd ?
x_res dd ?
y_res dd ?
mouse_port dd ?
bank_switch dd ?
lfb dd ?
vesa_mem dd ?
log dd ?
direct_lfb dd ?
pci_data dd ?
dd ?
vrr dd ?
ide_base dd ?
mem_amount dd ?
pages_count dd ?
pagemap_size dd ?
kernel_max dd ?
kernel_pages dd ?
kernel_tables dd ?
 
struc display_t
{
.x dd ?
.y dd ?
.width dd ?
.height dd ?
.bpp dd ?
.vrefresh dd ?
.pitch dd ?
.lfb dd ?
 
.modes dd ?
.ddev dd ?
.connector dd ?
.crtc dd ?
 
.cr_list.next dd ?
.cr_list.prev dd ?
 
.cursor dd ?
 
.init_cursor dd ?
.select_cursor dd ?
.show_cursor dd ?
.move_cursor dd ?
.restore_cursor dd ?
.disable_mouse dd ?
}
 
virtual at 0
display_t display_t
end virtual
 
struc BOOT_DATA
{ .bpp dd ?
.scanline dd ?
.vesa_mode dd ?
.x_res dd ?
.y_res dd ?
.mouse_port dd ?
.bank_switch dd ?
.lfb dd ?
.vesa_mem dd ?
.log dd ?
.direct_lfb dd ?
.pci_data dd ?
; dd ?
.vrr dd ?
.ide_base dd ?
.mem_amount dd ?
.pages_count dd ?
.pagemap_size dd ?
.kernel_max dd ?
.kernel_pages dd ?
.kernel_tables dd ?
 
.cpu_vendor dd ?
cpu_vendor dd ?
dd ?
dd ?
.cpu_sign dd ?
.cpu_info dd ?
.cpu_caps dd ?
cpu_sign dd ?
cpu_info dd ?
cpu_caps dd ?
dd ?
dd ?
}
ends
 
virtual at 0
BOOT_DATA BOOT_DATA
end virtual
struct LHEAD
next dd ? ;next object in list
prev dd ? ;prev object in list
ends
 
struc MEM_STATE
{ .mutex MUTEX
.smallmap rd 1
.treemap rd 1
.topsize rd 1
.top rd 1
.smallbins rd 4*32
.treebins rd 32
}
struct MUTEX
lhead LHEAD
count dd ?
ends
 
struc PG_DATA
{ .mem_amount dd ?
.vesa_mem dd ?
.pages_count dd ?
.pages_free dd ?
.pages_faults dd ?
.pagemap_size dd ?
.kernel_pages dd ?
.kernel_tables dd ?
.sys_page_dir dd ?
.mutex MUTEX
}
struct MEM_STATE
mutex MUTEX
smallmap dd ?
treemap dd ?
topsize dd ?
top dd ?
smallbins rd 4*32
treebins rd 32
ends
 
;struc LIB
;{ .lib_name rb 16
; .lib_base dd ?
; .lib_start dd ?
; .export dd ?
; .import dd ?
;}
struct PG_DATA
mem_amount dd ?
vesa_mem dd ?
pages_count dd ?
pages_free dd ?
pages_faults dd ?
pagemap_size dd ?
kernel_pages dd ?
kernel_tables dd ?
sys_page_dir dd ?
mutex MUTEX
ends
 
struc SRV
{
.srv_name rb 16 ;ASCIIZ string
.magic dd ? ;+0x10 ;'SRV '
.size dd ? ;+0x14 ;size of structure SRV
.fd dd ? ;+0x18 ;next SRV descriptor
.bk dd ? ;+0x1C ;prev SRV descriptor
.base dd ? ;+0x20 ;service base address
.entry dd ? ;+0x24 ;service START function
.srv_proc dd ? ;+0x28 ;user mode service handler
.srv_proc_ex dd ? ;+0x2C ;kernel mode service handler
.sizeof:
}
struct SRV
srv_name rb 16 ;ASCIIZ string
magic dd ? ;+0x10 ;'SRV '
size dd ? ;+0x14 ;size of structure SRV
fd dd ? ;+0x18 ;next SRV descriptor
bk dd ? ;+0x1C ;prev SRV descriptor
base dd ? ;+0x20 ;service base address
entry dd ? ;+0x24 ;service START function
srv_proc dd ? ;+0x28 ;user mode service handler
srv_proc_ex dd ? ;+0x2C ;kernel mode service handler
ends
 
SRV_FD_OFFSET equ 0x18
 
DRV_ENTRY equ 1
DRV_EXIT equ -1
 
struc COFF_HEADER
{ .machine dw ?
.nSections dw ?
.DataTime dd ?
.pSymTable dd ?
.nSymbols dd ?
.optHeader dw ?
.flags dw ?
};
struct COFF_HEADER
machine dw ?
nSections dw ?
DataTime dd ?
pSymTable dd ?
nSymbols dd ?
optHeader dw ?
flags dw ?
ends
 
struct COFF_SECTION
Name rb 8
VirtualSize dd ?
VirtualAddress dd ?
SizeOfRawData dd ?
PtrRawData dd ?
PtrReloc dd ?
PtrLinenumbers dd ?
NumReloc dw ?
NumLinenum dw ?
Characteristics dd ?
ends
 
struc COFF_SECTION
{ .Name rb 8
.VirtualSize dd ?
.VirtualAddress dd ?
.SizeOfRawData dd ?
.PtrRawData dd ?
.PtrReloc dd ?
.PtrLinenumbers dd ?
.NumReloc dw ?
.NumLinenum dw ?
.Characteristics dd ?
}
COFF_SECTION_SIZE equ 40
struct COFF_RELOC
VirtualAddress dd ?
SymIndex dd ?
Type dw ?
ends
 
struc COFF_RELOC
{ .VirtualAddress dd ?
.SymIndex dd ?
.Type dw ?
}
struct COFF_SYM
Name rb 8
Value dd ?
SectionNumber dw ?
Type dw ?
StorageClass db ?
NumAuxSymbols db ?
ends
 
struc COFF_SYM
{ .Name rb 8
.Value dd ?
.SectionNumber dw ?
.Type dw ?
.StorageClass db ?
.NumAuxSymbols db ?
}
CSYM_SIZE equ 18
struct IOCTL
handle dd ?
io_code dd ?
input dd ?
inp_size dd ?
output dd ?
out_size dd ?
ends
 
struc IOCTL
{ .handle dd ?
.io_code dd ?
.input dd ?
.inp_size dd ?
.output dd ?
.out_size dd ?
}
 
virtual at 0
IOCTL IOCTL
end virtual
 
;virtual at 0
; LIB LIB
;end virtual
 
virtual at 0
SRV SRV
end virtual
 
virtual at 0
CFH COFF_HEADER
end virtual
 
virtual at 0
CFS COFF_SECTION
end virtual
 
virtual at 0
CRELOC COFF_RELOC
end virtual
 
virtual at 0
CSYM COFF_SYM
end virtual
 
struc LHEAD
{
.next dd ? ;next object in list
.prev dd ? ;prev object in list
.sizeof:
}
 
virtual at 0
LHEAD LHEAD
end virtual
 
struc IRQH
{
.list LHEAD
.handler dd ? ;handler roututine
.data dd ? ;user-specific data
.sizeof:
}
 
virtual at 0
IRQH IRQH
end virtual
 
struct IRQH
list LHEAD
handler dd ? ;handler roututine
data dd ? ;user-specific data
ends
/kernel/branches/Kolibri-acpi/core/conf_lib.inc
13,7 → 13,8
$Revision$
 
iglobal
conf_path_sect: db 'path',0
conf_path_sect:
db 'path',0
 
conf_fname db '/sys/sys.conf',0
endg
/kernel/branches/Kolibri-acpi/core/debug.inc
13,7 → 13,8
cmp ebx, 9
ja @f
jmp dword [sys_debug_services_table+ebx*4]
@@: ret
@@:
ret
iglobal
align 4
sys_debug_services_table:
93,7 → 94,8
cmp cl, 5
jnz .ret
mov cl, 2
.2: mov [CURRENT_TASK+eax+TASKDATA.state], cl
.2:
mov [CURRENT_TASK+eax+TASKDATA.state], cl
.ret:
sti
ret
108,9 → 110,12
cmp cl, 2
jnz .ret
mov cl, 5
.2: mov [CURRENT_TASK+eax+TASKDATA.state], cl
.ret: ret
.1: dec ecx
.2:
mov [CURRENT_TASK+eax+TASKDATA.state], cl
.ret:
ret
.1:
dec ecx
jmp .2
 
debug_resume:
122,7 → 127,8
shl eax, 5
jz .ret
call do_resume
.ret: sti
.ret:
sti
ret
 
debug_getcontext:
/kernel/branches/Kolibri-acpi/core/dll.inc
139,7 → 139,7
cmp [edi+SRV.magic], ' SRV'
jne .fail
 
cmp [edi+SRV.size], SRV.sizeof
cmp [edi+SRV.size], sizeof.SRV
jne .fail
 
stdcall [edi+SRV.srv_proc], esi
171,7 → 171,7
cmp [eax+SRV.magic], ' SRV'
jne .fail
 
cmp [eax+SRV.size], SRV.sizeof
cmp [eax+SRV.size], sizeof.SRV
jne .fail
 
stdcall [eax+SRV.srv_proc], ecx
196,7 → 196,7
@@:
mov edx, [srv.fd]
@@:
cmp edx, srv.fd-SRV_FD_OFFSET
cmp edx, srv.fd-SRV.fd
je .not_load
 
stdcall strncmp, edx, [sz_name], 16
226,7 → 226,7
cmp [handler], eax
je .fail
 
mov eax, SRV.sizeof
mov eax, sizeof.SRV
call malloc
test eax, eax
jz .fail
243,9 → 243,9
pop esi
 
mov [eax+SRV.magic], ' SRV'
mov [eax+SRV.size], SRV.sizeof
mov [eax+SRV.size], sizeof.SRV
 
mov ebx, srv.fd-SRV_FD_OFFSET
mov ebx, srv.fd-SRV.fd
mov edx, [ebx+SRV.fd]
mov [eax+SRV.fd], edx
mov [eax+SRV.bk], ebx
514,10 → 514,10
mov edi, [symbols]
mov [retval], 1
.fix:
movzx ebx, [edi+CSYM.SectionNumber]
movzx ebx, [edi+COFF_SYM.SectionNumber]
test ebx, ebx
jnz .internal
mov eax, dword [edi+CSYM.Name]
mov eax, dword [edi+COFF_SYM.Name]
test eax, eax
jnz @F
 
542,7 → 542,7
mov [retval],0
@@:
mov edi, [symbols]
mov [edi+CSYM.Value], eax
mov [edi+COFF_SYM.Value], eax
jmp .next
.internal:
cmp bx, -1
555,10 → 555,10
lea ebx, [ebx+ebx*4]
add ebx, [sec]
 
mov eax, [ebx+CFS.VirtualAddress]
add [edi+CSYM.Value], eax
mov eax, [ebx+COFF_SECTION.VirtualAddress]
add [edi+COFF_SYM.Value], eax
.next:
add edi, CSYM_SIZE
add edi, sizeof.COFF_SYM
mov [symbols], edi
dec [sym_count]
jnz .fix
574,38 → 574,38
endl
 
mov eax, [coff]
movzx ebx, [eax+CFH.nSections]
movzx ebx, [eax+COFF_HEADER.nSections]
mov [n_sec], ebx
lea esi, [eax+20]
.fix_sec:
mov edi, [esi+CFS.PtrReloc]
mov edi, [esi+COFF_SECTION.PtrReloc]
add edi, [coff]
 
movzx ecx, [esi+CFS.NumReloc]
movzx ecx, [esi+COFF_SECTION.NumReloc]
test ecx, ecx
jz .next
.reloc_loop:
mov ebx, [edi+CRELOC.SymIndex]
mov ebx, [edi+COFF_RELOC.SymIndex]
add ebx,ebx
lea ebx,[ebx+ebx*8]
add ebx, [sym]
 
mov edx, [ebx+CSYM.Value]
mov edx, [ebx+COFF_SYM.Value]
 
cmp [edi+CRELOC.Type], 6
cmp [edi+COFF_RELOC.Type], 6
je .dir_32
 
cmp [edi+CRELOC.Type], 20
cmp [edi+COFF_RELOC.Type], 20
jne .next_reloc
.rel_32:
mov eax, [edi+CRELOC.VirtualAddress]
add eax, [esi+CFS.VirtualAddress]
mov eax, [edi+COFF_RELOC.VirtualAddress]
add eax, [esi+COFF_SECTION.VirtualAddress]
sub edx, eax
sub edx, 4
jmp .fix
.dir_32:
mov eax, [edi+CRELOC.VirtualAddress]
add eax, [esi+CFS.VirtualAddress]
mov eax, [edi+COFF_RELOC.VirtualAddress]
add eax, [esi+COFF_SECTION.VirtualAddress]
.fix:
add eax, [delta]
add [eax], edx
614,7 → 614,7
dec ecx
jnz .reloc_loop
.next:
add esi, COFF_SECTION_SIZE
add esi, sizeof.COFF_SECTION
dec [n_sec]
jnz .fix_sec
.exit:
629,23 → 629,23
endl
 
mov eax, [coff]
movzx ebx, [eax+CFH.nSections]
movzx ebx, [eax+COFF_HEADER.nSections]
mov [n_sec], ebx
lea esi, [eax+20]
mov edx, [delta]
.fix_sec:
mov edi, [esi+CFS.PtrReloc]
mov edi, [esi+COFF_SECTION.PtrReloc]
add edi, [coff]
 
movzx ecx, [esi+CFS.NumReloc]
movzx ecx, [esi+COFF_SECTION.NumReloc]
test ecx, ecx
jz .next
.reloc_loop:
cmp [edi+CRELOC.Type], 6
cmp [edi+COFF_RELOC.Type], 6
jne .next_reloc
.dir_32:
mov eax, [edi+CRELOC.VirtualAddress]
add eax, [esi+CFS.VirtualAddress]
mov eax, [edi+COFF_RELOC.VirtualAddress]
add eax, [esi+COFF_SECTION.VirtualAddress]
add [eax+edx], edx
.next_reloc:
add edi, 10
652,7 → 652,7
dec ecx
jnz .reloc_loop
.next:
add esi, COFF_SECTION_SIZE
add esi, sizeof.COFF_SECTION
dec [n_sec]
jnz .fix_sec
.exit:
700,15 → 700,15
 
mov [coff], eax
 
movzx ecx, [eax+CFH.nSections]
movzx ecx, [eax+COFF_HEADER.nSections]
xor ebx, ebx
 
lea edx, [eax+20]
@@:
add ebx, [edx+CFS.SizeOfRawData]
add ebx, [edx+COFF_SECTION.SizeOfRawData]
add ebx, 15
and ebx, not 15
add edx, COFF_SECTION_SIZE
add edx, sizeof.COFF_SECTION
dec ecx
jnz @B
mov [img_size], ebx
728,32 → 728,32
rep stosd
 
mov edx, [coff]
movzx ebx, [edx+CFH.nSections]
movzx ebx, [edx+COFF_HEADER.nSections]
mov edi, [img_base]
lea eax, [edx+20]
@@:
mov [eax+CFS.VirtualAddress], edi
mov esi, [eax+CFS.PtrRawData]
mov [eax+COFF_SECTION.VirtualAddress], edi
mov esi, [eax+COFF_SECTION.PtrRawData]
test esi, esi
jnz .copy
add edi, [eax+CFS.SizeOfRawData]
add edi, [eax+COFF_SECTION.SizeOfRawData]
jmp .next
.copy:
add esi, edx
mov ecx, [eax+CFS.SizeOfRawData]
mov ecx, [eax+COFF_SECTION.SizeOfRawData]
cld
rep movsb
.next:
add edi, 15
and edi, not 15
add eax, COFF_SECTION_SIZE
add eax, sizeof.COFF_SECTION
dec ebx
jnz @B
 
mov ebx, [edx+CFH.pSymTable]
mov ebx, [edx+COFF_HEADER.pSymTable]
add ebx, edx
mov [sym], ebx
mov ecx, [edx+CFH.nSymbols]
mov ecx, [edx+COFF_HEADER.nSymbols]
add ecx,ecx
lea ecx,[ecx+ecx*8] ;ecx*=18 = nSymbols*CSYM_SIZE
add ecx, [sym]
764,7 → 764,7
mov dword [ebx+4], 0
lea eax, [edx+20]
 
stdcall fix_coff_symbols, eax, [sym], [edx+CFH.nSymbols],\
stdcall fix_coff_symbols, eax, [sym], [edx+COFF_HEADER.nSymbols], \
[strings], ebx
test eax, eax
jz .link_fail
772,7 → 772,7
mov ebx, [coff]
stdcall fix_coff_relocs, ebx, [sym], 0
 
stdcall get_coff_sym,[sym],[ebx+CFH.nSymbols],szVersion
stdcall get_coff_sym, [sym], [ebx+COFF_HEADER.nSymbols], szVersion
test eax, eax
jz .link_fail
 
785,7 → 785,7
ja .ver_fail
 
mov ebx, [coff]
stdcall get_coff_sym,[sym],[ebx+CFH.nSymbols],szSTART
stdcall get_coff_sym, [sym], [ebx+COFF_HEADER.nSymbols], szSTART
mov [start], eax
 
stdcall kernel_free, [coff]
851,7 → 851,7
; - if alignment is given and is no more than 4K, use it;
; - if alignment is more than 4K, revert to 4K.
push ecx
mov cl, byte [edx+CFS.Characteristics+2]
mov cl, byte [edx+COFF_SECTION.Characteristics+2]
mov eax, 1
shr cl, 4
dec cl
955,7 → 955,7
xor eax, eax
repnz scasb
not ecx
lea eax, [ecx+DLLDESCR.sizeof]
lea eax, [ecx+sizeof.DLLDESCR]
push ecx
call malloc
pop ecx
979,7 → 979,7
 
; calculate size of loaded DLL
mov edx, [coff]
movzx ecx, [edx+CFH.nSections]
movzx ecx, [edx+COFF_HEADER.nSections]
xor ebx, ebx
 
add edx, 20
988,8 → 988,8
add ebx, eax
not eax
and ebx, eax
add ebx, [edx+CFS.SizeOfRawData]
add edx, COFF_SECTION_SIZE
add ebx, [edx+COFF_SECTION.SizeOfRawData]
add edx, sizeof.COFF_SECTION
dec ecx
jnz @B
; it must be nonzero and not too big
1019,7 → 1019,7
; copy sections and set correct values for VirtualAddress'es in headers
push esi
mov edx, [coff]
movzx ebx, [edx+CFH.nSections]
movzx ebx, [edx+COFF_HEADER.nSections]
mov edi, eax
add edx, 20
cld
1030,11 → 1030,11
not eax
and ecx, eax
and edi, eax
mov [edx+CFS.VirtualAddress], ecx
add ecx, [edx+CFS.SizeOfRawData]
mov esi, [edx+CFS.PtrRawData]
mov [edx+COFF_SECTION.VirtualAddress], ecx
add ecx, [edx+COFF_SECTION.SizeOfRawData]
mov esi, [edx+COFF_SECTION.PtrRawData]
push ecx
mov ecx, [edx+CFS.SizeOfRawData]
mov ecx, [edx+COFF_SECTION.SizeOfRawData]
test esi, esi
jnz .copy
xor eax, eax
1045,7 → 1045,7
rep movsb
.next:
pop ecx
add edx, COFF_SECTION_SIZE
add edx, sizeof.COFF_SECTION
dec ebx
jnz @B
pop esi
1054,21 → 1054,21
; later we will use COFF header, headers for sections and symbol table
; and also relocations table for all sections
mov edx, [coff]
mov ebx, [edx+CFH.pSymTable]
mov ebx, [edx+COFF_HEADER.pSymTable]
mov edi, dword [fileinfo+32]
sub edi, ebx
jc .fail_and_free_data
mov [esi+DLLDESCR.symbols_lim], edi
add ebx, edx
movzx ecx, [edx+CFH.nSections]
movzx ecx, [edx+COFF_HEADER.nSections]
lea ecx, [ecx*5]
lea edi, [edi+ecx*8+20]
add edx, 20
@@:
movzx eax, [edx+CFS.NumReloc]
movzx eax, [edx+COFF_SECTION.NumReloc]
lea eax, [eax*5]
lea edi, [edi+eax*2]
add edx, COFF_SECTION_SIZE
add edx, sizeof.COFF_SECTION
sub ecx, 5
jnz @b
stdcall kernel_alloc, edi
1075,7 → 1075,7
test eax, eax
jz .fail_and_free_data
mov edx, [coff]
movzx ecx, [edx+CFH.nSections]
movzx ecx, [edx+COFF_HEADER.nSections]
lea ecx, [ecx*5]
lea ecx, [ecx*2+5]
mov [esi+DLLDESCR.coff_hdr], eax
1086,7 → 1086,7
pop esi
mov [esi+DLLDESCR.symbols_ptr], edi
push esi
mov ecx, [edx+CFH.nSymbols]
mov ecx, [edx+COFF_HEADER.nSymbols]
mov [esi+DLLDESCR.symbols_num], ecx
mov ecx, [esi+DLLDESCR.symbols_lim]
mov esi, ebx
1094,20 → 1094,20
pop esi
mov ebx, [esi+DLLDESCR.coff_hdr]
push esi
movzx eax, [edx+CFH.nSections]
movzx eax, [edx+COFF_HEADER.nSections]
lea edx, [ebx+20]
@@:
movzx ecx, [edx+CFS.NumReloc]
movzx ecx, [edx+COFF_SECTION.NumReloc]
lea ecx, [ecx*5]
mov esi, [edx+CFS.PtrReloc]
mov [edx+CFS.PtrReloc], edi
sub [edx+CFS.PtrReloc], ebx
mov esi, [edx+COFF_SECTION.PtrReloc]
mov [edx+COFF_SECTION.PtrReloc], edi
sub [edx+COFF_SECTION.PtrReloc], ebx
add esi, [coff]
shr ecx, 1
rep movsd
adc ecx, ecx
rep movsw
add edx, COFF_SECTION_SIZE
add edx, sizeof.COFF_SECTION
dec eax
jnz @b
pop esi
1114,7 → 1114,7
 
; fixup symbols
mov edx, ebx
mov eax, [ebx+CFH.nSymbols]
mov eax, [ebx+COFF_HEADER.nSymbols]
add edx, 20
mov ecx, [esi+DLLDESCR.symbols_num]
lea ecx, [ecx*9]
1128,11 → 1128,11
;
;@@:
 
stdcall get_coff_sym,[esi+DLLDESCR.symbols_ptr],[ebx+CFH.nSymbols],szEXPORTS
stdcall get_coff_sym, [esi+DLLDESCR.symbols_ptr], [ebx+COFF_HEADER.nSymbols], szEXPORTS
test eax, eax
jnz @F
 
stdcall get_coff_sym,[esi+DLLDESCR.symbols_ptr],[ebx+CFH.nSymbols],sz_EXPORTS
stdcall get_coff_sym, [esi+DLLDESCR.symbols_ptr], [ebx+COFF_HEADER.nSymbols], sz_EXPORTS
@@:
mov [esi+DLLDESCR.exports], eax
 
1160,7 → 1160,7
jz .fail_and_dereference
@@:
mov [img_base], eax
mov eax, HDLL.sizeof
mov eax, sizeof.HDLL
call malloc
test eax, eax
jz .fail_and_free_user
1369,11 → 1369,11
push ebp
mov edx, [srv.fd]
.next:
cmp edx, srv.fd-SRV_FD_OFFSET
cmp edx, srv.fd-SRV.fd
je .done
cmp [edx+SRV.magic], ' SRV'
jne .next
cmp [edx+SRV.size], SRV.sizeof
cmp [edx+SRV.size], sizeof.SRV
jne .next
 
mov ebx, [edx+SRV.entry]
/kernel/branches/Kolibri-acpi/core/export.inc
28,7 → 28,8
local name
dd (name-OS_BASE)
common
ordinal: count = 0
ordinal:
count = 0
forward
dw count
count = count+1
/kernel/branches/Kolibri-acpi/core/ext_lib.inc
158,7 → 158,8
 
proc dll.Load, import_table:dword
mov esi,[import_table]
.next_lib: mov edx,[esi]
.next_lib:
mov edx, [esi]
or edx,edx
jz .exit
push esi
168,7 → 169,8
mov al, '/'
stosb
mov esi,sysdir_path
@@: lodsb
@@:
lodsb
stosb
or al,al
jnz @b
179,7 → 181,8
pop esi
push esi
mov esi,[esi+4]
@@: lodsb
@@:
lodsb
stosb
or al,al
jnz @b
195,9 → 198,11
pop esi
add esi,8
jmp .next_lib
.exit: xor eax,eax
.exit:
xor eax, eax
ret
.fail: add esp,4
.fail:
add esp, 4
xor eax,eax
inc eax
ret
208,7 → 213,8
mov esi,[imp]
test esi,esi
jz .done
.next: lodsd
.next:
lodsd
test eax,eax
jz .done
stdcall dll.GetProcAddress,[exp],eax
216,8 → 222,10
jz @f
mov [esi-4],eax
jmp .next
@@: mov dword[esp],0
.done: pop eax
@@:
mov dword[esp], 0
.done:
pop eax
ret
endp
 
234,7 → 242,8
 
proc dll.GetProcAddress, exp:dword,sz_name:dword
mov edx,[exp]
.next: test edx,edx
.next:
test edx, edx
jz .end
stdcall strncmp,[edx],[sz_name], dword -1
test eax,eax
241,8 → 250,10
jz .ok
add edx,8
jmp .next
.ok: mov eax,[edx+4]
.end: ret
.ok:
mov eax, [edx+4]
.end:
ret
endp
 
;-----------------------------------------------------------------------------
276,7 → 287,8
add ecx,-4
cmp ecx,[eax-4]
je .exit
@@: mov eax,ebx
@@:
mov eax, ebx
call mem.Alloc
xchg eax,[esp]
or eax,eax
288,7 → 300,8
cmp ecx,[edi-4]
jbe @f
mov ecx,[edi-4]
@@: add ecx,3
@@:
add ecx, 3
shr ecx,2
cld
rep movsd
/kernel/branches/Kolibri-acpi/core/heap.inc
8,27 → 8,21
$Revision$
 
 
struc MEM_BLOCK
{
.list LHEAD
.next_block dd ? ;+8
.prev_block dd ? ;+4
.base dd ? ;+16
.size dd ? ;+20
.flags dd ? ;+24
.handle dd ? ;+28
.sizeof:
}
struct MEM_BLOCK
list LHEAD
next_block dd ? ;+8
prev_block dd ? ;+4
base dd ? ;+16
size dd ? ;+20
flags dd ? ;+24
handle dd ? ;+28
ends
 
FREE_BLOCK equ 4
USED_BLOCK equ 8
DONT_FREE_BLOCK equ 10h
 
virtual at 0
MEM_BLOCK MEM_BLOCK
end virtual
 
 
block_next equ MEM_BLOCK.next_block
block_prev equ MEM_BLOCK.prev_block
list_fd equ MEM_BLOCK.list.next
146,8 → 140,8
jnz .l1
 
mov edi, HEAP_BASE ;descriptors
mov ebx, HEAP_BASE+MEM_BLOCK.sizeof ;free space
mov ecx, HEAP_BASE+MEM_BLOCK.sizeof*2 ;terminator
mov ebx, HEAP_BASE+sizeof.MEM_BLOCK ;free space
mov ecx, HEAP_BASE+sizeof.MEM_BLOCK*2 ;terminator
 
xor eax, eax
mov [edi+block_next], ebx
155,7 → 149,7
mov [edi+list_fd], eax
mov [edi+list_bk], eax
mov [edi+block_base], HEAP_BASE
mov [edi+block_size], 4096*MEM_BLOCK.sizeof
mov [edi+block_size], 4096*sizeof.MEM_BLOCK
mov [edi+block_flags], USED_BLOCK
 
mov [ecx+block_next], eax
168,11 → 162,11
 
mov [ebx+block_next], ecx
mov [ebx+block_prev], edi
mov [ebx+block_base], HEAP_BASE+4096*MEM_BLOCK.sizeof
mov [ebx+block_base], HEAP_BASE+4096*sizeof.MEM_BLOCK
 
mov ecx, [pg_data.kernel_pages]
shl ecx, 12
sub ecx, HEAP_BASE-OS_BASE+4096*MEM_BLOCK.sizeof
sub ecx, HEAP_BASE-OS_BASE+4096*sizeof.MEM_BLOCK
mov [heap_size], ecx
mov [heap_free], ecx
mov [ebx+block_size], ecx
185,15 → 179,15
list_add ebx, ecx
 
mov ecx, 4096-3-1
mov eax, HEAP_BASE+MEM_BLOCK.sizeof*4
mov eax, HEAP_BASE+sizeof.MEM_BLOCK*4
 
mov [next_memblock], HEAP_BASE+MEM_BLOCK.sizeof*3
mov [next_memblock], HEAP_BASE+sizeof.MEM_BLOCK *3
@@:
mov [eax-MEM_BLOCK.sizeof], eax
add eax, MEM_BLOCK.sizeof
mov [eax-sizeof.MEM_BLOCK], eax
add eax, sizeof.MEM_BLOCK
loop @B
 
mov [eax-MEM_BLOCK.sizeof], dword 0
mov [eax-sizeof.MEM_BLOCK], dword 0
 
mov ecx, heap_mutex
call mutex_init
584,7 → 578,7
 
;;;;;;;;;;;;;; USER ;;;;;;;;;;;;;;;;;
 
HEAP_TOP equ 0x5FC00000
HEAP_TOP equ 0x80000000
 
align 4
proc init_heap
854,6 → 848,71
ret
endp
 
 
align 4
proc user_unmap stdcall, base:dword, offset:dword, size:dword
 
push ebx
 
mov ebx, [base] ; must be valid pointer
test ebx, ebx
jz .error
 
mov edx, [offset] ; check offset
add edx, ebx ; must be below 2Gb app limit
js .error
 
shr ebx, 12 ; chek block attributes
lea ebx, [page_tabs+ebx*4]
mov eax, [ebx-4] ; block attributes
test al, USED_BLOCK
jz .error
test al, DONT_FREE_BLOCK
jnz .error
 
shr edx, 12
lea edx, [page_tabs+edx*4] ; unmap offset
 
mov ecx, [size]
add ecx, 4095
shr ecx, 12 ; unmap size in pages
 
shr eax, 12 ; block size + 1 page
lea ebx, [ebx+eax*4-4] ; block end ptr
lea eax, [edx+ecx*4] ; unmap end ptr
 
cmp eax, ebx ; check for overflow
ja .error
 
mov ebx, [offset]
and ebx, not 4095 ; is it required ?
 
.unmap:
mov eax, [edx] ; get page addres
test al, 1 ; page mapped ?
jz @F
test eax, PG_SHARED ; page shared ?
jnz @F
mov [page_tabs+edx*4], dword 2
; mark page as reserved
invlpg [ebx] ; when we start using
call free_page ; empty c-o-w page instead this ?
@@:
add ebx, 4096
add edx, 4
dec ecx
jnz .unmap
 
pop ebx
or al, 1 ; return non zero on success
ret
.error:
pop ebx
xor eax, eax ; something wrong
ret
endp
 
align 4
user_normalize:
; in: esi=heap_base, edi=heap_top
; out: eax=0 <=> OK
1292,7 → 1351,7
and ecx, -4096
mov [size], ecx
 
mov eax, SMEM.sizeof
mov eax, sizeof.SMEM
call malloc
test eax, eax
mov esi, eax
1354,7 → 1413,7
mov ebx, [CURRENT_TASK]
shl ebx, 5
mov ebx, [CURRENT_TASK+ebx+4]
mov eax, SMAP.sizeof
mov eax, sizeof.SMAP
 
call create_kernel_object
test eax, eax
/kernel/branches/Kolibri-acpi/core/irq.inc
12,9 → 12,9
uglobal
 
align 16
irqh_tab rd LHEAD.sizeof * IRQ_RESERVED / 4
irqh_tab rd sizeof.LHEAD * IRQ_RESERVED / 4
 
irqh_pool rd IRQH.sizeof * IRQ_POOL_SIZE /4
irqh_pool rd sizeof.IRQH * IRQ_POOL_SIZE /4
next_irqh rd 1
 
irq_active_set rd 1
34,14 → 34,14
loop @B
 
mov ecx, IRQ_POOL_SIZE-1
mov eax, irqh_pool+IRQH.sizeof
mov eax, irqh_pool+sizeof.IRQH
mov [next_irqh], irqh_pool
@@:
mov [eax-IRQH.sizeof], eax
add eax, IRQH.sizeof
mov [eax-sizeof.IRQH], eax
add eax, sizeof.IRQH
loop @B
 
mov [eax-IRQH.sizeof], dword 0
mov [eax-sizeof.IRQH], dword 0
ret
 
 
/kernel/branches/Kolibri-acpi/core/memory.inc
166,6 → 166,7
ret
endp
 
align 4
proc map_io_mem stdcall, base:dword, size:dword, flags:dword
 
push ebx
358,7 → 359,9
cmp dword [LFBAddress], -1
jne @f
mov [BOOT_VAR+0x901c],byte 2
stdcall alloc_pages, (0x280000 / 4096)
; max VGA=640*480*4=1228800 bytes
; + 32*640*4=81920 bytes for mouse pointer
stdcall alloc_pages, ((1228800+81920)/4096)
 
push eax
call alloc_page
366,7 → 369,9
pop eax
or eax, PG_UW
mov ebx, LFB_BASE
mov ecx, 0x280000 / 4096
; max VGA=640*480*4=1228800 bytes
; + 32*640*4=81920 bytes for mouse pointer
mov ecx, (1228800+81920)/4096
call commit_pages
mov [LFBAddress], dword LFB_BASE
ret
470,7 → 475,8
pop eax
call free_page
 
.next: add edi, 1
.next:
add edi, 1
cmp edi, esi
jb @B
 
797,7 → 803,8
; and eax, 0xFFFFF000
; stdcall map_page, edi, eax
 
@@: mov edi, [lin_addr]
@@:
mov edi, [lin_addr]
and edi, 0xFFFFF000
mov ecx, [buf_size]
add ecx, 4095
857,7 → 864,8
jz .exit
stdcall map_page,edi,eax,PG_UW
 
@@: mov edi, [lin_addr]
@@:
mov edi, [lin_addr]
and edi, 0xFFFFF000
mov ecx, [buf_size]
add ecx, 4095
988,7 → 996,8
add edx, 4095
and edx, not 4095
 
.touch: mov eax, [ecx]
.touch:
mov eax, [ecx]
add ecx, 0x1000
cmp ecx, edx
jb .touch
1299,6 → 1308,11
@@:
ret
 
.26:
stdcall user_unmap, ecx, edx, esi
mov [esp+32], eax
ret
 
.fail:
xor eax, eax
mov [esp+32], eax
1321,8 → 1335,9
dd f68.21 ; load_driver
dd f68.22 ; shmem_open
dd f68.23 ; shmem_close
dd f68.24
dd f68.25
dd f68.24 ; set exception handler
dd f68.25 ; unmask exception
dd f68.26 ; user_unmap
 
 
align 4
/kernel/branches/Kolibri-acpi/core/peload.inc
285,6 → 285,7
commit_pages, 'CommitPages', \ ; eax, ebx, ecx
\
create_event, 'CreateEvent', \ ; ecx, esi
destroy_event, 'DestroyEvent', \ ;
raise_event, 'RaiseEvent', \ ; eax, ebx, edx, esi
wait_event, 'WaitEvent', \ ; eax, ebx
get_event_ex, 'GetEvent', \ ; edi
293,6 → 294,7
create_ring_buffer, 'CreateRingBuffer', \ ; stdcall
destroy_kernel_object, 'DestroyObject', \
free_kernel_space, 'FreeKernelSpace', \ ; stdcall
free_page, 'FreePage', \ ; eax
kernel_alloc, 'KernelAlloc', \ ; stdcall
kernel_free, 'KernelFree', \ ; stdcall
malloc, 'Kmalloc', \
306,6 → 308,7
\
get_display, 'GetDisplay', \
set_screen, 'SetScreen', \
window._.get_rect, 'GetWindowRect', \ ; gcc fastcall
pci_api_drv, 'PciApi', \
pci_read8, 'PciRead8', \ ; stdcall
pci_read16, 'PciRead16', \ ; stdcall
326,7 → 329,8
get_stack_base, 'GetStackBase', \
delay_hs, 'Delay', \ ; ebx
set_mouse_data, 'SetMouseData', \ ;
set_keyboard_data, 'SetKeyboardData' ; gcc fastcall
set_keyboard_data, 'SetKeyboardData', \ ; gcc fastcall
timer_hs, 'TimerHs' ; stdcall
 
 
 
/kernel/branches/Kolibri-acpi/core/sched.inc
60,7 → 60,8
end if
call find_next_task
jz .return ; the same task -> skip switch
@@: mov byte[DONT_SWITCH], 1
@@:
mov byte[DONT_SWITCH], 1
call do_change_task
.return:
popad
121,7 → 122,8
jb @f
xor bh, bh
mov edi,CURRENT_TASK
@@: inc bh ; ebx += APPDATA.size
@@:
inc bh ; ebx += APPDATA.size
add edi,0x20 ; edi += TASKDATA.size
mov al, [edi+TASKDATA.state]
test al, al
140,7 → 142,8
sub ecx, [ebx+APPDATA.wait_begin]
cmp ecx, [ebx+APPDATA.wait_timeout]
jb .loop
@@: mov [ebx+APPDATA.wait_param], eax ; retval for wait
@@:
mov [ebx+APPDATA.wait_param], eax ; retval for wait
mov [edi+TASKDATA.state], 0
.found:
mov [CURRENT_TASK],bh
214,28 → 217,23
mov reg,eax
} lodsReg dr0, dr1, dr2, dr3, dr7
purge lodsReg
@@: ret
@@:
ret
;end.
 
 
 
struc MUTEX_WAITER
{
.list LHEAD
.task rd 1
.sizeof:
};
struct MUTEX_WAITER
list LHEAD
task dd ?
ends
 
virtual at 0
MUTEX_WAITER MUTEX_WAITER
end virtual
 
;void __fastcall mutex_init(struct mutex *lock)
 
align 4
mutex_init:
mov [ecx+MUTEX.wait.next], ecx
mov [ecx+MUTEX.wait.prev], ecx
mov [ecx+MUTEX.lhead.next], ecx
mov [ecx+MUTEX.lhead.prev], ecx
mov [ecx+MUTEX.count],1
ret
 
251,7 → 249,7
pushfd
cli
 
sub esp, MUTEX_WAITER.sizeof
sub esp, sizeof.MUTEX_WAITER
 
list_add_tail esp, ecx ;esp= new waiter, ecx= list head
 
274,12 → 272,12
 
mov [eax+MUTEX_WAITER.list.next], edx
mov [edx+MUTEX_WAITER.list.prev], eax
cmp [ecx+MUTEX.wait.next], ecx
cmp [ecx+MUTEX.lhead.next], ecx
jne @F
 
mov [ecx+MUTEX.count], 0
@@:
add esp, MUTEX_WAITER.sizeof
add esp, sizeof.MUTEX_WAITER
 
popfd
.done:
293,7 → 291,7
pushfd
cli
 
mov eax, [ecx+MUTEX.wait.next]
mov eax, [ecx+MUTEX.lhead.next]
cmp eax, ecx
mov [ecx+MUTEX.count], 1
je @F
/kernel/branches/Kolibri-acpi/core/sys32.inc
20,7 → 20,8
mov esi, sys_int
mov ecx, 0x40
mov eax, (10001110b shl 24) + os_code
@@: movsw ;low word of code-entry
@@:
movsw ;low word of code-entry
stosd ;interrupt gate type : os_code selector
movsw ;high word of code-entry
loop @b
138,13 → 139,15
cmp bl,14 ; #PF
jne @f
call page_fault_handler ; SEE: core/memory.inc
@@: mov esi, [current_slot]
@@:
mov esi, [current_slot]
btr [esi+APPDATA.except_mask], ebx
jnc @f
mov eax,[esi+APPDATA.exc_handler]
test eax, eax
jnz IRetToUserHook
@@: cli
@@:
cli
mov eax, [esi+APPDATA.debugger_slot]
test eax, eax
jnz .debug
165,10 → 168,12
mov dr6, edx
mov edx, dr7
mov cl, not 8
.l1: shl dl,2
.l1:
shl dl, 2
jc @f
and bl, cl
@@: sar cl,1
@@:
sar cl, 1
jc .l1
mov cl, 3 ; debug_message code=debug_exception
.notify:
213,8 → 218,10
jb .l0
cmp bl, 0x0e
jbe .l1
.l0: mov bl, 0x09
.l1: mov eax,[msg_fault_sel+ebx*4 - 0x08*4]
.l0:
mov bl, 0x09
.l1:
mov eax, [msg_fault_sel+ebx*4 - 0x08*4]
DEBUGF 1, "K : %s\n", eax
mov eax, [reg_cs3+4]
mov edi, msg_sel_app
223,7 → 230,8
je @f
mov edi, msg_sel_ker
mov ebx, [reg_esp0+4]
@@: DEBUGF 1, "K : EAX : %x EBX : %x ECX : %x\n", [reg_eax+4], [reg_ebx+4], [reg_ecx+4]
@@:
DEBUGF 1, "K : EAX : %x EBX : %x ECX : %x\n", [reg_eax+4], [reg_ebx+4], [reg_ecx+4]
DEBUGF 1, "K : EDX : %x ESI : %x EDI : %x\n", [reg_edx+4], [reg_esi+4], [reg_edi+4]
DEBUGF 1, "K : EBP : %x EIP : %x ESP : %x\n", [reg_ebp+4], [reg_eip+4], ebx
DEBUGF 1, "K : Flags : %x CS : %x (%s)\n", [reg_eflags+4], eax, edi
/kernel/branches/Kolibri-acpi/core/syscall.inc
194,6 → 194,9
dd syscall_window_settings ; 71-Window settings
dd sys_sendwindowmsg ; 72-Send window message
dd blit_32 ; 73-blitter;
dd undefined_syscall ; 74-reserved for new stack
dd undefined_syscall ; 75-reserved for new stack
dd undefined_syscall ; 76-reserved for new stack
times 255 - ( ($-servetable2) /4 ) dd undefined_syscall
dd sys_end ; -1-end application
 
/kernel/branches/Kolibri-acpi/core/taskman.inc
10,34 → 10,34
 
GREEDY_KERNEL equ 0
 
struc APP_HEADER_00
{ .banner dq ?
.version dd ? ;+8
.start dd ? ;+12
.i_end dd ? ;+16
.mem_size dd ? ;+20
.i_param dd ? ;+24
}
struct APP_HEADER_00_
banner dq ?
version dd ? ;+8
start dd ? ;+12
i_end dd ? ;+16
mem_size dd ? ;+20
i_param dd ? ;+24
ends
 
struc APP_HEADER_01
{ .banner dq ?
.version dd ? ;+8
.start dd ? ;+12
.i_end dd ? ;+16
.mem_size dd ? ;+20
.stack_top dd ? ;+24
.i_param dd ? ;+28
.i_icon dd ? ;+32
}
struct APP_HEADER_01_
banner dq ?
version dd ? ;+8
start dd ? ;+12
i_end dd ? ;+16
mem_size dd ? ;+20
stack_top dd ? ;+24
i_param dd ? ;+28
i_icon dd ? ;+32
ends
 
 
struc APP_PARAMS
{ .app_cmdline ;0x00
.app_path ;0x04
.app_eip ;0x08
.app_esp ;0x0C
.app_mem ;0x10
}
struct APP_PARAMS
app_cmdline dd ? ;0x00
app_path dd ? ;0x04
app_eip dd ? ;0x08
app_esp dd ? ;0x0C
app_mem dd ? ;0x10
ends
 
macro _clear_ op
{ mov ecx, op/4
254,10 → 254,10
align 4
test_app_header:
virtual at eax
APP_HEADER_00 APP_HEADER_00
APP_HEADER_00 APP_HEADER_00_
end virtual
virtual at eax
APP_HEADER_01 APP_HEADER_01
APP_HEADER_01 APP_HEADER_01_
end virtual
 
cmp dword [eax], 'MENU'
/kernel/branches/Kolibri-acpi/core/timers.inc
5,7 → 5,7
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
$Revision: 2122 $
$Revision: 2381 $
 
; Simple implementation of timers. All timers are organized in a double-linked
; list, and the OS loop after every timer tick processes the list.
12,16 → 12,16
 
; This structure describes a timer for the kernel.
struct TIMER
.Next dd ?
.Prev dd ?
Next dd ?
Prev dd ?
; These fields organize a double-linked list of all timers.
.TimerFunc dd ?
TimerFunc dd ?
; Function to be called when the timer is activated.
.UserData dd ?
UserData dd ?
; The value that is passed as is to .TimerFunc.
.Time dd ?
Time dd ?
; Time at which the timer should be activated.
.Interval dd ?
Interval dd ?
; Interval between activations of the timer, in 0.01s.
ends
 
/kernel/branches/Kolibri-acpi/core/v86.inc
12,21 → 12,16
 
DEBUG_SHOW_IO = 0
 
struc V86_machine
{
struct V86_machine
; page directory
.pagedir dd ?
pagedir dd ?
; translation table: V86 address -> flat linear address
.pages dd ?
pages dd ?
; mutex to protect all data from writing by multiple threads at one time
.mutex dd ?
mutex dd ?
; i/o permission map
.iopm dd ?
.size = $
}
virtual at 0
V86_machine V86_machine
end virtual
iopm dd ?
ends
 
; Create V86 machine
; in: nothing
35,7 → 30,7
; destroys: ebx, ecx, edx (due to malloc)
v86_create:
; allocate V86_machine structure
mov eax, V86_machine.size
mov eax, sizeof.V86_machine
call malloc
test eax, eax
jz .fail
245,31 → 240,26
.ret:
ret
 
struc v86_regs
{
struct v86_regs
; don't change the order, it is important
.edi dd ?
.esi dd ?
.ebp dd ?
edi dd ?
esi dd ?
ebp dd ?
dd ? ; ignored
.ebx dd ?
.edx dd ?
.ecx dd ?
.eax dd ?
.eip dd ?
.cs dd ?
.eflags dd ? ; VM flag must be set!
.esp dd ?
.ss dd ?
.es dd ?
.ds dd ?
.fs dd ?
.gs dd ?
.size = $
}
virtual at 0
v86_regs v86_regs
end virtual
ebx dd ?
edx dd ?
ecx dd ?
eax dd ?
eip dd ?
cs dd ?
eflags dd ? ; VM flag must be set!
esp dd ?
ss dd ?
es dd ?
ds dd ?
fs dd ?
gs dd ?
ends
 
; Run V86 machine
; in: ebx -> registers for V86 (two structures: in and out)
319,10 → 309,10
; sti
 
mov eax, esi
sub esp, v86_regs.size
sub esp, sizeof.v86_regs
mov esi, ebx
mov edi, esp
mov ecx, v86_regs.size/4
mov ecx, sizeof.v86_regs/4
rep movsd
 
cmp edx, -1
371,7 → 361,8
jne @f
xor eax, eax
mov dr6, eax
@@: mov eax, [esp+v86_regs.size+10h+18h]
@@:
mov eax, [esp+sizeof.v86_regs+10h+18h]
cmp word [esp+v86_regs.eip], ax
jnz @f
shr eax, 16
443,7 → 434,7
sub eax, 6
add edx, eax
mov eax, edx
mov esi, [esp+4+v86_regs.size+10h+4]
mov esi, [esp+4+sizeof.v86_regs+10h+4]
call v86_get_lin_addr
cmp eax, 0x1000
jae @f
491,7 → 482,7
movzx eax, word [esp+v86_regs.esp]
add edx, eax
mov eax, edx
mov esi, [esp+v86_regs.size+10h+4]
mov esi, [esp+sizeof.v86_regs+10h+4]
call v86_get_lin_addr
cmp eax, 0x1000
jae @f
527,7 → 518,7
movzx eax, ax
add edx, eax
mov eax, edx
mov esi, [esp+v86_regs.size+10h+4]
mov esi, [esp+sizeof.v86_regs+10h+4]
call v86_get_lin_addr
cmp eax, 0x1000
jae @f
559,7 → 550,7
sub eax, 4
add edx, eax
mov eax, edx
mov esi, [esp+v86_regs.size+10h+4]
mov esi, [esp+sizeof.v86_regs+10h+4]
call v86_get_lin_addr
cmp eax, 0x1000
jae @f
590,7 → 581,7
movzx eax, word [esp+v86_regs.esp]
add edx, eax
mov eax, edx
mov esi, [esp+v86_regs.size+10h+4]
mov esi, [esp+sizeof.v86_regs+10h+4]
call v86_get_lin_addr
cmp eax, 0x1000
jae @f
621,7 → 612,7
movzx eax, word [esp+v86_regs.esp]
add edx, eax
mov eax, edx
mov esi, [esp+v86_regs.size+10h+4]
mov esi, [esp+sizeof.v86_regs+10h+4]
call v86_get_lin_addr
cmp eax, 0x1000
jae @f
747,7 → 738,7
shl edx, 4
add edx, [esp+32]
@@:
mov esi, [esp+v86_regs.size+10h+4]
mov esi, [esp+sizeof.v86_regs+10h+4]
mov eax, edx
call v86_get_lin_addr
cmp eax, 0x1000
772,10 → 763,10
xor eax, eax
 
.exit:
mov [esp+v86_regs.size+10h+1Ch], eax
mov [esp+v86_regs.size+10h+18h], ebx
mov [esp+sizeof.v86_regs+10h+1Ch], eax
mov [esp+sizeof.v86_regs+10h+18h], ebx
 
mov edx, [esp+v86_regs.size+10h+14h]
mov edx, [esp+sizeof.v86_regs+10h+14h]
cmp edx, -1
jz @f
dec [v86_irqhooks+edx*8+4]
784,9 → 775,9
@@:
 
mov esi, esp
mov edi, [esi+v86_regs.size+10h+10h]
add edi, v86_regs.size
mov ecx, v86_regs.size/4
mov edi, [esi+sizeof.v86_regs+10h+10h]
add edi, sizeof.v86_regs
mov ecx, sizeof.v86_regs/4
rep movsd
mov esp, esi
 
873,12 → 864,12
jnz .cont
push ecx
mov ecx, [ebx+APPDATA.saved_esp0]
cmp word [ecx-v86_regs.size+v86_regs.esp], 6
cmp word [ecx-sizeof.v86_regs+v86_regs.esp], 6
jb .cont2
movzx edx, word [ecx-v86_regs.size+v86_regs.ss]
movzx edx, word [ecx-sizeof.v86_regs+v86_regs.ss]
shl edx, 4
push eax
movzx eax, word [ecx-v86_regs.size+v86_regs.esp]
movzx eax, word [ecx-sizeof.v86_regs+v86_regs.esp]
sub eax, 6
add edx, eax
mov eax, edx
904,12 → 895,12
iretd
.found:
mov cr3, eax
sub word [esi-v86_regs.size+v86_regs.esp], 6
mov ecx, [esi-v86_regs.size+v86_regs.eip]
sub word [esi-sizeof.v86_regs+v86_regs.esp], 6
mov ecx, [esi-sizeof.v86_regs+v86_regs.eip]
mov word [edx], cx
mov ecx, [esi-v86_regs.size+v86_regs.cs]
mov ecx, [esi-sizeof.v86_regs+v86_regs.cs]
mov word [edx+2], cx
mov ecx, [esi-v86_regs.size+v86_regs.eflags]
mov ecx, [esi-sizeof.v86_regs+v86_regs.eflags]
mov word [edx+4], cx
lea eax, [edi+8]
cmp al, 10h
917,10 → 908,10
add al, 60h
@@:
mov cx, [eax*4]
mov word [esi-v86_regs.size+v86_regs.eip], cx
mov word [esi-sizeof.v86_regs+v86_regs.eip], cx
mov cx, [eax*4+2]
mov word [esi-v86_regs.size+v86_regs.cs], cx
and byte [esi-v86_regs.size+v86_regs.eflags+1], not 3
mov word [esi-sizeof.v86_regs+v86_regs.cs], cx
and byte [esi-sizeof.v86_regs+v86_regs.eflags+1], not 3
call update_counters
lea edi, [ebx + 0x100000000 - SLOT_BASE]
shr edi, 3
/kernel/branches/Kolibri-acpi/data16.inc
12,7 → 12,8
preboot_lfb db 0
preboot_bootlog db 0
boot_drive db 0
bx_from_load: dw 'r1' ; ñòðóêòóðà äëÿ õðàíåíèÿ ïàðàìåòðîâ- îòêóäà ãàøðóçèëèñü, áåðåòñÿ íèæå èç bx ; {SPraid}[13.03.2007]
bx_from_load:
dw 'r1' ; ñòðóêòóðà äëÿ õðàíåíèÿ ïàðàìåòðîâ- îòêóäà ãàøðóçèëèñü, áåðåòñÿ íèæå èç bx ; {SPraid}[13.03.2007]
; a,b,c,d - âèí÷åñòåðû, r - ðàì äèñê
; # äèñêà... ñèìâîë, à íå áàéò. '1', à íå 1
 
/kernel/branches/Kolibri-acpi/data32.inc
156,8 → 156,8
.bk dd dll_list
.fd dd dll_list
 
MAX_DEFAULT_DLL_ADDR = 0x20000000
MIN_DEFAULT_DLL_ADDR = 0x10000000
MAX_DEFAULT_DLL_ADDR = 0x80000000
MIN_DEFAULT_DLL_ADDR = 0x70000000
dll_cur_addr dd MIN_DEFAULT_DLL_ADDR
 
; supported videomodes
170,7 → 170,8
draw_pointer dd __sys_draw_pointer
;//mike.dld, 2006-08-02 [
;drawbar dd __sys_drawbar
drawbar dd __sys_drawbar.forced
;drawbar dd __sys_drawbar.forced
drawbar dd vesa20_drawbar
;//mike.dld, 2006-08-02 ]
putpixel dd __sys_putpixel
; } mike.dld
275,7 → 276,7
dw 11010000b *256 +11110010b
db 0x00
tss0_l:
dw TSS_SIZE-1
dw sizeof.TSS-1
dw tss and 0xFFFF
db (tss shr 16) and 0xFF
db 10001001b
292,8 → 293,10
gdte:
 
align 16
cur_saved_data rb 4096
fpu_data: rb 512
cur_saved_data:
rb 4096
fpu_data:
rb 512
 
mem_block_list rd 64*2
mem_used_list rd 64*2
392,14 → 395,9
 
hd_entries rd 1 ;unused ? 0xfe10
 
;* start code - Mario79
 
mouse_active rd 1
mouse_pause rd 1
MouseTickCounter rd 1
 
;* end code - Mario79
 
img_background rd 1
mem_BACKGROUND rd 1
static_background_data rd 1
/kernel/branches/Kolibri-acpi/detect/dev_hdcd.inc
124,7 → 124,8
ret
@@Error6:
mov [DevErrorCode],6
@@End: ret
@@End:
ret
 
 
iglobal
258,15 → 259,20
mov [DevErrorCode],0
ret
; Çàïèñàòü êîä îøèáêè
@@Err1: mov [DevErrorCode],1
@@Err1:
mov [DevErrorCode], 1
ret
@@Err2: mov [DevErrorCode],2
@@Err2:
mov [DevErrorCode], 2
ret
@@Err3: mov [DevErrorCode],3
@@Err3:
mov [DevErrorCode], 3
ret
@@Err4: mov [DevErrorCode],4
@@Err4:
mov [DevErrorCode], 4
ret
@@Err5: mov [DevErrorCode],5
@@Err5:
mov [DevErrorCode], 5
; Çàâåðøåíèå ðàáîòû ïðîãðàììû
ret
 
373,11 → 379,14
mov [DevErrorCode],0
ret
; Îáðàáîòêà îøèáîê
@@Err1_2: mov [DevErrorCode],1
@@Err1_2:
mov [DevErrorCode], 1
ret
@@Err3_2: mov [DevErrorCode],3
@@Err3_2:
mov [DevErrorCode], 3
ret
@@Err4_2: mov [DevErrorCode],4
@@Err4_2:
mov [DevErrorCode], 4
; Çàïèñàòü êîä îøèáêè
ret
 
/kernel/branches/Kolibri-acpi/detect/getcache.inc
209,4 → 209,4
; mov [cache_ide0_pointer],HD_CACHE
; mov [cache_ide0_system_data],HD_CACHE+65536
; mov [cache_ide0_system_sad_size],1919
popa
popa
/kernel/branches/Kolibri-acpi/docs/sysfuncs.txt
1878,6 → 1878,14
* eax = 40 - function number
* ebx = mask: bit i corresponds to event i+1 (see list of events)
(set bit permits notice on event)
bit 31: active/inactive filter
bit 31 = 0 - inactive window receive mouse events
bit 31 = 1 - inactive window does not receive mouse events
bit 30: cursor position filter
bit 30 = 0 = the window receive mouse events if cursor
outside window
bit 30 = 1 - the window does not receive mouse events if cursor
outside window
Returned value:
* eax = previous value of mask
Remarks:
/kernel/branches/Kolibri-acpi/drivers/fm801.asm
560,7 → 560,8
mov [brg_bus], eax
mov eax, [devfn]
mov [brg_devfn],eax
.no_bridge:pop eax
.no_bridge:
pop eax
 
mov edi, devices
@@:
/kernel/branches/Kolibri-acpi/drivers/imports.inc
59,9 → 59,6
Kfree,\
CreateRingBuffer,\
\
DiskAdd, \
DiskMediaChanged, \
\
GetPid,\
CreateObject,\
DestroyObject,\
/kernel/branches/Kolibri-acpi/drivers/sb16/sb16.asm
344,7 → 344,8
align 4
version dd (5 shl 16) or (API_VERSION and 0xFFFF)
 
sb_base_port: dd 200h ;don't ask me why - see the code&docs
sb_base_port:
dd 200h ;don't ask me why - see the code&docs
 
sound_dma dd sb_dma_num
 
376,8 → 377,10
msgDSPFound db 'DSP found at port 2'
label port_second_digit_num dword at $
db '00h',13,10,'DSP version '
sb_DSP_version: db '0.00 - SB'
sb_DSP_description: db 32,32,32,32,13,10,0
sb_DSP_version:
db '0.00 - SB'
sb_DSP_description:
db 32,32,32,32,13,10,0
;-------------------------------------------------------------------------------
end if
 
/kernel/branches/Kolibri-acpi/drivers/usb/urb.inc
94,22 → 94,22
}
 
 
void usb_fill_control_urb (struct urb *urb,
struct usb_device *dev,
unsigned int pipe,
unsigned char *setup_packet,
void *transfer_buffer,
int buffer_length,
usb_complete_t complete_fn,
void *context)
{
 
urb->dev = dev;
urb->pipe = pipe;
urb->setup_packet = setup_packet;
urb->transfer_buffer = transfer_buffer;
urb->transfer_buffer_length = buffer_length;
urb->complete = complete_fn;
urb->context = context;
}
 
;void usb_fill_control_urb (struct urb *urb,
; struct usb_device *dev,
; unsigned int pipe,
; unsigned char *setup_packet,
; void *transfer_buffer,
; int buffer_length,
; usb_complete_t complete_fn,
; void *context)
;{
;
; urb->dev = dev;
; urb->pipe = pipe;
; urb->setup_packet = setup_packet;
; urb->transfer_buffer = transfer_buffer;
; urb->transfer_buffer_length = buffer_length;
; urb->complete = complete_fn;
; urb->context = context;
;}
;
/kernel/branches/Kolibri-acpi/drivers/vt823x.asm
1053,7 → 1053,7
mov eax, 20000 ; wait 20 ms
call StallExec
 
stdcall codec_valid,
stdcall codec_valid
cmp eax, 0
pop eax
jge .ok
/kernel/branches/Kolibri-acpi/fdo.inc
252,7 → 252,8
debug_func fdo_debug_outstr
debug_beginf
mov eax,1
.l1: dec esi
.l1:
dec esi
js .l2
movzx ebx,byte[edx]
or bl,bl
261,7 → 262,8
call ecx ; sys_msg_board
inc edx
jmp .l1
.l2: ret
.l2:
ret
debug_endf
 
debug_func fdo_debug_outdec
275,20 → 277,24
mov al,'-'
call fdo_debug_outchar
pop eax
@@: push 10
@@:
push 10
pop ecx
push -'0'
.l1: xor edx,edx
.l1:
xor edx, edx
div ecx
push edx
test eax,eax
jnz .l1
.l2: pop eax
.l2:
pop eax
add al,'0'
jz .l3
call fdo_debug_outchar
jmp .l2
.l3: ret
.l3:
ret
debug_endf
 
debug_func fdo_debug_outhex
299,7 → 305,8
add cl,8
shl cl,2
rol eax,cl
.l1: rol eax,4
.l1:
rol eax, 4
push eax
and eax,0x0000000F
mov al,[__fdo_hexdigits+eax]
/kernel/branches/Kolibri-acpi/fs/ext2.inc
51,97 → 51,97
EXT2_read_in_folder dd ? ;сколько файлов "считали"
EXT2_end_block dd ? ;конец очередного блока папки
EXT2_counter_blocks dd ?
EXT2_filename db 256 dup ?
EXT2_parent_name db 256 dup ?
EXT2_filename rb 256
EXT2_parent_name rb 256
EXT2_name_len dd ?
endg
 
struct EXT2_INODE_STRUC
.i_mode dw ?
.i_uid dw ?
.i_size dd ?
.i_atime dd ?
.i_ctime dd ?
.i_mtime dd ?
.i_dtime dd ?
.i_gid dw ?
.i_links_count dw ?
.i_blocks dd ?
.i_flags dd ?
.i_osd1 dd ?
.i_block dd 15 dup ?
.i_generation dd ?
.i_file_acl dd ?
.i_dir_acl dd ?
.i_faddr dd ?
.i_osd2 dd ? ; 1..12
i_mode dw ?
i_uid dw ?
i_size dd ?
i_atime dd ?
i_ctime dd ?
i_mtime dd ?
i_dtime dd ?
i_gid dw ?
i_links_count dw ?
i_blocks dd ?
i_flags dd ?
i_osd1 dd ?
i_block rd 15
i_generation dd ?
i_file_acl dd ?
i_dir_acl dd ?
i_faddr dd ?
i_osd2 dd ? ; 1..12
ends
 
struct EXT2_DIR_STRUC
.inode dd ?
.rec_len dw ?
.name_len db ?
.file_type db ?
.name db ? ; 0..255
inode dd ?
rec_len dw ?
name_len db ?
file_type db ?
name db ? ; 0..255
ends
 
struct EXT2_BLOCK_GROUP_DESC
.block_bitmap dd ?
.inode_bitmap dd ?
.inode_table dd ?
.free_blocks_count dw ?
.free_inodes_count dw ?
.used_dirs_count dw ?
block_bitmap dd ?
inode_bitmap dd ?
inode_table dd ?
free_blocks_count dw ?
free_inodes_count dw ?
used_dirs_count dw ?
ends
 
struct EXT2_SB_STRUC
.inodes_count dd ? ;+0
.blocks_count dd ? ;+4
.r_block_count dd ? ;+8
.free_block_count dd ? ;+12
.free_inodes_count dd ? ;+16
.first_data_block dd ? ;+20
.log_block_size dd ? ;+24
.log_frag_size dd ? ;+28
.blocks_per_group dd ? ;+32
.frags_per_group dd ? ;+36
.inodes_per_group dd ? ;+40
.mtime dd ? ;+44
.wtime dd ? ;+48
.mnt_count dw ? ;+52
.max_mnt_count dw ? ;+54
.magic dw ? ;+56
.state dw ? ;+58
.errors dw ? ;+60
.minor_rev_level dw ? ;+62
.lastcheck dd ? ;+64
.check_intervals dd ? ;+68
.creator_os dd ? ;+72
.rev_level dd ? ;+76
.def_resuid dw ? ;+80
.def_resgid dw ? ;+82
.first_ino dd ? ;+84
.inode_size dw ? ;+88
.block_group_nr dw ? ;+90
.feature_compat dd ? ;+92
.feature_incompat dd ? ;+96
.feature_ro_compat dd ? ;+100
.uuid db 16 dup ? ;+104
.volume_name db 16 dup ? ;+120
.last_mounted db 64 dup ? ;+136
.algo_bitmap dd ? ;+200
.prealloc_blocks db ? ;+204
.preallock_dir_blocks db ? ;+205
inodes_count dd ? ;+0
blocks_count dd ? ;+4
r_block_count dd ? ;+8
free_block_count dd ? ;+12
free_inodes_count dd ? ;+16
first_data_block dd ? ;+20
log_block_size dd ? ;+24
log_frag_size dd ? ;+28
blocks_per_group dd ? ;+32
frags_per_group dd ? ;+36
inodes_per_group dd ? ;+40
mtime dd ? ;+44
wtime dd ? ;+48
mnt_count dw ? ;+52
max_mnt_count dw ? ;+54
magic dw ? ;+56
state dw ? ;+58
errors dw ? ;+60
minor_rev_level dw ? ;+62
lastcheck dd ? ;+64
check_intervals dd ? ;+68
creator_os dd ? ;+72
rev_level dd ? ;+76
def_resuid dw ? ;+80
def_resgid dw ? ;+82
first_ino dd ? ;+84
inode_size dw ? ;+88
block_group_nr dw ? ;+90
feature_compat dd ? ;+92
feature_incompat dd ? ;+96
feature_ro_compat dd ? ;+100
uuid rb 16 ;+104
volume_name rb 16 ;+120
last_mounted rb 64 ;+136
algo_bitmap dd ? ;+200
prealloc_blocks db ? ;+204
preallock_dir_blocks db ? ;+205
dw ? ;+206 alignment
.journal_uuid db 16 dup ? ;+208
.journal_inum dd ? ;+224
.journal_dev dd ? ;+228
.last_orphan dd ? ;+232
.hash_seed dd 4 dup ? ;+236
.def_hash_version db ? ;+252
db 3 dup ? ;+253 reserved
.default_mount_options dd ? ;+256
.first_meta_bg dd ? ;+260
journal_uuid rb 16 ;+208
journal_inum dd ? ;+224
journal_dev dd ? ;+228
last_orphan dd ? ;+232
hash_seed rd 4 ;+236
def_hash_version db ? ;+252
rb 3 ;+253 reserved
default_mount_options dd ? ;+256
first_meta_bg dd ? ;+260
ends
 
ext2_test_superblock:
/kernel/branches/Kolibri-acpi/fs/fat32.inc
94,10 → 94,13
 
uglobal
align 4
fat_cache: times 512 db 0
fat_cache:
times 512 db 0
Sector512: ; label for dev_hdcd.inc
buffer: times 512 db 0
fsinfo_buffer: times 512 db 0
buffer:
times 512 db 0
fsinfo_buffer:
times 512 db 0
endg
 
uglobal
2345,7 → 2348,8
sub dword [esp], 0x200
jae @f
and dword [esp], 0
@@: jmp .write_loop
@@:
jmp .write_loop
 
hd_extend_file.zero_size:
xor eax, eax
2454,7 → 2458,8
cmp [hd_error], 0
jz @f
mov al, 11
@@: stc
@@:
stc
ret
 
;----------------------------------------------------------------
/kernel/branches/Kolibri-acpi/fs/fs.inc
21,12 → 21,14
 
 
iglobal
dir0: db 'HARDDISK '
dir0:
db 'HARDDISK '
db 'RAMDISK '
db 'FLOPPYDISK '
db 0
 
dir1: db 'FIRST '
dir1:
db 'FIRST '
db 'SECOND '
db 'THIRD '
db 'FOURTH '
34,7 → 36,8
 
not_select_IDE db 0
 
hd_address_table: dd 0x1f0,0x00,0x1f0,0x10
hd_address_table:
dd 0x1f0,0x00,0x1f0,0x10
dd 0x170,0x00,0x170,0x10
endg
 
793,5 → 796,6
stc
jmp i4
 
partition_string: dd 0
partition_string:
dd 0
db 32
/kernel/branches/Kolibri-acpi/fs/fs_lfn.inc
1018,9 → 1018,11
stosb
mov ecx,edx
rep movsb ;copy string
.ret: ret
.ret:
ret
 
.error: add esp,8
.error:
add esp, 8
or dword [esp+32],-1 ;error not found zerro at string ->[eax+APPDATA.cur_dir]
ret
.set:
/kernel/branches/Kolibri-acpi/fs/part_set.inc
55,7 → 55,8
fs_dependent_data_end:
file_system_data_size = $ - PARTITION_START
if file_system_data_size > 96
ERROR: sizeof(file system data) too big!
ERROR:
sizeof(file system data) too big!
end if
 
virtual at fs_dependent_data_start
75,7 → 76,8
.cur_index_size dd ?
.cur_index_buf dd ?
if $ > fs_dependent_data_end
ERROR: increase sizeof(fs_dependent_data)!
ERROR:
increase sizeof(fs_dependent_data)!
end if
end virtual
 
99,7 → 101,8
.sb dd ? ; superblock
.groups_count dd ?
if $ > fs_dependent_data_end
ERROR: increase sizeof(fs_dependent_data)!
ERROR:
increase sizeof(fs_dependent_data)!
end if
end virtual
 
/kernel/branches/Kolibri-acpi/gui/button.inc
14,21 → 14,16
 
button.MAX_BUTTONS = 4095
 
struc SYS_BUTTON
{
.pslot dw ?
.id_lo dw ?
.left dw ?
.width dw ?
.top dw ?
.height dw ?
.id_hi dw ?
struct SYS_BUTTON
pslot dw ?
id_lo dw ?
left dw ?
width dw ?
top dw ?
height dw ?
id_hi dw ?
dw ?
.sizeof:
}
virtual at 0
SYS_BUTTON SYS_BUTTON
end virtual
ends
 
align 4
;------------------------------------------------------------------------------
131,7 → 126,8
call button._.incecx2
 
; set button height counter
@@: mov edx, edi
@@:
mov edx, edi
 
.next_line:
call button._.button_dececx
215,18 → 211,18
mov edi, [BTN_ADDR]
mov ebx, [edi]
inc ebx
imul esi, ebx, SYS_BUTTON.sizeof
imul esi, ebx, sizeof.SYS_BUTTON
add esi, edi
xor ecx, ecx
add ecx, -SYS_BUTTON.sizeof
add esi, SYS_BUTTON.sizeof
add ecx, -sizeof.SYS_BUTTON
add esi, sizeof.SYS_BUTTON
 
.next_button:
dec ebx
jz .exit
 
add ecx, SYS_BUTTON.sizeof
add esi, -SYS_BUTTON.sizeof
add ecx, sizeof.SYS_BUTTON
add esi, -sizeof.SYS_BUTTON
 
; does it belong to our process?
mov ax, [CURRENT_TASK]
243,10 → 239,10
; okay, undefine it
push ebx
mov ebx, esi
lea eax, [esi + SYS_BUTTON.sizeof]
lea eax, [esi + sizeof.SYS_BUTTON]
call memmove
dec dword[edi]
add ecx, -SYS_BUTTON.sizeof
add ecx, -sizeof.SYS_BUTTON
pop ebx
jmp .next_button
 
333,16 → 329,16
 
mov edi, [BTN_ADDR]
mov ecx, [edi]
imul esi, ecx, SYS_BUTTON.sizeof
imul esi, ecx, sizeof.SYS_BUTTON
add esi, edi
inc ecx
add esi, SYS_BUTTON.sizeof
add esi, sizeof.SYS_BUTTON
 
.next_button:
dec ecx
jz .not_found
 
add esi, -SYS_BUTTON.sizeof
add esi, -sizeof.SYS_BUTTON
 
; does it belong to our process?
cmp dx, [esi + SYS_BUTTON.pslot]
380,14 → 376,17
sub cl, 0x20
jnc @f
xor cl, cl
@@: sub ch, 0x20
@@:
sub ch, 0x20
jnc @f
xor ch, ch
@@: rol ecx, 16
@@:
rol ecx, 16
sub cl, 0x20
jnc @f
xor cl, cl
@@: rol ecx, 16
@@:
rol ecx, 16
ret
 
;------------------------------------------------------------------------------
398,14 → 397,17
add cl, 0x20
jnc @f
or cl, -1
@@: add ch, 0x20
@@:
add ch, 0x20
jnc @f
or ch, -1
@@: rol ecx, 16
@@:
rol ecx, 16
add cl, 0x20
jnc @f
or cl, -1
@@: rol ecx, 16
@@:
rol ecx, 16
ret
 
;------------------------------------------------------------------------------
416,14 → 418,17
add cl, 0x14
jnc @f
or cl, -1
@@: add ch, 0x14
@@:
add ch, 0x14
jnc @f
or ch, -1
@@: rol ecx, 16
@@:
rol ecx, 16
add cl, 0x14
jnc @f
or cl, -1
@@: rol ecx, 16
@@:
rol ecx, 16
ret
 
;------------------------------------------------------------------------------
440,17 → 445,21
jg @f
mov al, 2
 
@@: sub cl, al
@@:
sub cl, al
jnc @f
xor cl, cl
@@: sub ch, al
@@:
sub ch, al
jnc @f
xor ch, ch
@@: rol ecx, 16
@@:
rol ecx, 16
sub cl, al
jnc @f
xor cl, cl
@@: rol ecx, 16
@@:
rol ecx, 16
 
pop eax
 
/kernel/branches/Kolibri-acpi/gui/event.inc
25,7 → 25,7
; FreeEvents.fd=event_start è FreeEvents.bk=event_end
align 4
init_events: ;; used from kernel.asm
stdcall kernel_alloc,EV_SPACE*EVENT.size
stdcall kernel_alloc, EV_SPACE*sizeof.EVENT
or eax,eax
jz .fail
; eax - current event, ebx - previos event below
32,15 → 32,17
mov ecx,EV_SPACE ; current - in allocated space
mov ebx,FreeEvents ; previos - íà÷àëî ñïèñêà
push ebx ; îíî æå è êîíåö ïîòîì áóäåò
@@: mov [ebx+EVENT.fd],eax
@@:
mov [ebx+EVENT.fd], eax
mov [eax+EVENT.bk],ebx
mov ebx,eax ; previos <- current
add eax,EVENT.size ; new current
add eax, sizeof.EVENT ; new current
loop @b
pop eax ; âîò îíî êîíöîì è ñòàëî
mov [ebx+EVENT.fd],eax
mov [eax+EVENT.bk],ebx
.fail: ret
.fail:
ret
 
EVENT_WATCHED equ 0x10000000 ;áèò 28
EVENT_SIGNALED equ 0x20000000 ;áèò 29
87,7 → 89,8
call init_events
popad
jz RemoveEventTo.break ; POPF+RET
@@: mov eax,[eax+EVENT.fd]
@@:
mov eax, [eax+EVENT.fd]
mov [eax+EVENT.magic],'EVNT'
mov [eax+EVENT.destroy],destroy_event.internal
mov [eax+EVENT.state],ecx
97,7 → 100,7
or esi,esi
jz RemoveEventTo
lea edi,[eax+EVENT.code]
mov ecx,EVENT.codesize/4
mov ecx, (sizeof.EVENT -EVENT.code)/4
cld
rep movsd
 
115,7 → 118,8
xchg ecx,[eax+EVENT.fd] ; Self.fd=NewRight, ecx=OldRight
mov [ebx+EVENT.fd],ecx ; OldLeft.fd=OldRight
mov [ecx+EVENT.bk],ebx ; OldRight.bk=OldLeft
.break: popfd
.break:
popfd
ret
 
align 4
151,7 → 155,7
or esi,esi
jz @f
lea edi,[ebx+EVENT.code]
mov ecx,EVENT.codesize/4
mov ecx, (sizeof.EVENT -EVENT.code)/4
cld
rep movsd
@@:
213,9 → 217,11
jne @f
cmp [eax+EVENT.id],ebx
je .ret
@@: pop eax
@@:
pop eax
xor eax,eax
.ret: ret
.ret:
ret
 
 
align 4
254,7 → 260,8
mov [eax+TASKDATA.state], 5
call change_task
mov eax,[esi+APPDATA.wait_param]
@@: ret
@@:
ret
 
align 4
wait_event: ;; EXPORT use
292,10 → 299,10
mov edx, get_event_queue ; wait_test
call Wait_events ; timeout ignored
lea esi,[eax+EVENT.code]
mov ecx,EVENT.codesize/4
mov ecx, (sizeof.EVENT-EVENT.code)/4
cld
rep movsd
mov [edi-EVENT.codesize+2],cl ;clear priority field
mov byte[edi-(sizeof.EVENT-EVENT.code)+2], cl;clear priority field
wait_finish:
test byte[eax+EVENT.state+3], MANUAL_RESET shr 24
jnz get_event_queue.ret ; RET
346,7 → 353,8
mov eax,[ebx+APPOBJ.bk] ; âûáèðàåì ñ êîíöà, ïî ïðèíöèïó FIFO
cmp eax,ebx ; empty ???
je get_event_alone.ret0
.ret: ret
.ret:
ret
 
align 4
get_event_alone:
364,8 → 372,10
test byte[eax+EVENT.state+3], EVENT_SIGNALED shr 24
jnz .ret
or byte[eax+EVENT.state+3], EVENT_WATCHED shr 24
.ret0: xor eax,eax ; NO event!!!
.ret: ret
.ret0:
xor eax, eax; NO event!!!
.ret:
ret
 
align 4
sys_sendwindowmsg: ;; f72
393,7 → 403,8
.result:
setae byte[esp+32] ;ñ÷èòàåì, ÷òî èñõîäíî: dword[esp+32]==72
.retf: ;popfd
.ret: ret
.ret:
ret
 
align 4
sys_getevent: ;; f11
430,6 → 441,7
shl edi,5
add edi,CURRENT_TASK ; edi is assumed as [TASK_BASE]
mov ecx,[edi+TASKDATA.event_mask]
and ecx, 0x7FFFFFFF
.loop: ; ïîêà íå èñ÷åðïàåì âñå áèòû ìàñêè
bsr eax,ecx ; íàõîäèì íåíóëåâîé áèò ìàñêè (31 -> 0)
jz .no_events ; èñ÷åðïàëè âñå áèòû ìàñêè, íî íè÷åãî íå íàøëè ???
452,8 → 464,15
 
.FlagAutoReset: ; retvals: BgrRedraw=5, Mouse=6, IPC=7, Stack=8, Debug=9
cmp eax,5 ; Mouse 5+1=6
jne @f
jne .no_mouse_check
push eax
mov eax, [TASK_BASE]
mov eax, [eax + TASKDATA.event_mask]
test eax, 0x80000000 ; bit 31: active/inactive filter f.40
jz @f
pop eax
jmp .no_mouse_check
@@:
; If the window is captured and moved by the user, then no mouse events!!!
mov al,[mouse.active_sys_window.action]
and al,WINDOW_MOVE_AND_RESIZE_FLAGS
460,7 → 479,7
test al,al
pop eax
jnz .loop
@@:
.no_mouse_check:
btr [ebx+APPDATA.event_mask],eax
jnc .loop
.result: ; retval = eax+1
487,8 → 506,10
jne @f ; not Top ???
cmp [KEY_COUNT],al ; al==1
jae .result ; not empty ???
@@: mov edx, hotkey_buffer
@@: cmp [edx],bh ; bh - slot for testing
@@:
mov edx, hotkey_buffer
@@:
cmp [edx], bh ; bh - slot for testing
je .result
add edx,8
cmp edx, hotkey_buffer+120*8
/kernel/branches/Kolibri-acpi/gui/font.inc
33,8 → 33,6
.1:
; } \\ Alver \\
pushad
call [_display.disable_mouse]
 
movsx eax, bx ; eax=y
sar ebx, 16 ; ebx=x
xchg eax, ebx ; eax=x, ebx=y
71,6 → 69,7
shr dl, 1
jz .pixloop1end
jnc .nopix
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
call [putpixel]
jmp .pixloop1cont
.nopix:
78,6 → 77,7
jz .pixloop1cont
push ecx
mov ecx, [esp+4+20h+20h]
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
call [putpixel]
pop ecx
.pixloop1cont:
103,6 → 103,7
.pixloop2:
shr dl, 1
jnc .nopix2
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
call [putpixel]
jmp .pixloop2cont
.nopix2:
110,6 → 111,7
jz .pixloop2cont
push ecx
mov ecx, [esp+12+20h+20h]
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
call [putpixel]
pop ecx
.pixloop2cont:
/kernel/branches/Kolibri-acpi/gui/mouse.inc
72,7 → 72,8
jmp .exit
 
; is there any system button under cursor?
@@: call mouse._.find_sys_button_under_cursor
@@:
call mouse._.find_sys_button_under_cursor
or eax, eax
jz .check_buttons_released
 
119,12 → 120,14
mov eax, [esp + 4]
call .call_left_button_handler
 
@@: test byte[esp], mouse.RIGHT_BUTTON_FLAG
@@:
test byte[esp], mouse.RIGHT_BUTTON_FLAG
jz @f
mov eax, [esp + 4]
call .call_right_button_handler
 
@@: test byte[esp], mouse.MIDDLE_BUTTON_FLAG
@@:
test byte[esp], mouse.MIDDLE_BUTTON_FLAG
jz .check_position
mov eax, [esp + 4]
call .call_middle_button_handler
222,12 → 225,13
call sys_window_maximize_handler
jmp .exit
 
@@: test [edi + WDATA.fl_wstate], WSTATE_MAXIMIZED
@@:
test [edi + WDATA.fl_wstate], WSTATE_MAXIMIZED
jnz .exit
mov [mouse.active_sys_window.pslot], esi
lea eax, [edi + WDATA.box]
mov ebx, mouse.active_sys_window.old_box
mov ecx, BOX.sizeof
mov ecx, sizeof.BOX
call memmove
mov ebx, mouse.active_sys_window.new_box
call memmove
238,15 → 242,18
call .calculate_w_delta
jmp .call_window_handler
 
@@: test dl, mouse.WINDOW_RESIZE_W_FLAG
@@:
test dl, mouse.WINDOW_RESIZE_W_FLAG
jz @f
call .calculate_w_delta
 
@@: test dl, mouse.WINDOW_RESIZE_S_FLAG
@@:
test dl, mouse.WINDOW_RESIZE_S_FLAG
jz @f
call .calculate_s_delta
 
@@: test dl, mouse.WINDOW_RESIZE_E_FLAG
@@:
test dl, mouse.WINDOW_RESIZE_E_FLAG
jz .call_window_handler
call .calculate_e_delta
 
298,7 → 305,7
shl eax, 5
add eax, window_data + WDATA.box
mov ebx, mouse.active_sys_window.old_box
mov ecx, BOX.sizeof
mov ecx, sizeof.BOX
call memmove
 
mov eax, mouse.active_sys_window.old_box
370,7 → 377,7
 
mov eax, mouse.active_sys_window.new_box
mov ebx, mouse.active_sys_window.old_box
mov ecx, BOX.sizeof
mov ecx, sizeof.BOX
call memmove
 
mov dl, [mouse.active_sys_window.action]
389,17 → 396,20
jge @f
xor eax, eax
mov [mouse.active_sys_window.new_box.left], eax
@@: add eax, [mouse.active_sys_window.new_box.width]
@@:
add eax, [mouse.active_sys_window.new_box.width]
cmp eax, [Screen_Max_X]
jl @f
sub eax, [Screen_Max_X]
sub [mouse.active_sys_window.new_box.left], eax
@@: mov eax, [mouse.active_sys_window.new_box.top]
@@:
mov eax, [mouse.active_sys_window.new_box.top]
or eax, eax
jge @f
xor eax, eax
mov [mouse.active_sys_window.new_box.top], eax
@@: add eax, [mouse.active_sys_window.new_box.height]
@@:
add eax, [mouse.active_sys_window.new_box.height]
cmp eax, [Screen_Max_Y]
jle .call_window_handler
sub eax, [Screen_Max_Y]
421,7 → 431,8
jge @f
add [mouse.active_sys_window.new_box.left], eax
mov [mouse.active_sys_window.new_box.width], 127
@@: mov eax, [mouse.active_sys_window.new_box.left]
@@:
mov eax, [mouse.active_sys_window.new_box.left]
or eax, eax
jge .check_resize_s
add [mouse.active_sys_window.new_box.width], eax
449,7 → 460,8
jge @f
mov eax, ecx
mov [mouse.active_sys_window.new_box.height], eax
@@: add eax, [mouse.active_sys_window.new_box.top]
@@:
add eax, [mouse.active_sys_window.new_box.top]
cmp eax, [Screen_Max_Y]
jle .check_resize_e
sub eax, [Screen_Max_Y]
474,7 → 486,8
jge @f
mov eax, 127
mov [mouse.active_sys_window.new_box.width], eax
@@: add eax, [mouse.active_sys_window.new_box.left]
@@:
add eax, [mouse.active_sys_window.new_box.left]
cmp eax, [Screen_Max_X]
jle .call_window_handler
sub eax, [Screen_Max_X]
492,7 → 505,7
push esi
mov esi, mouse.active_sys_window.old_box
mov edi, mouse.active_sys_window.new_box
mov ecx, BOX.sizeof / 4
mov ecx, sizeof.BOX / 4
repe
cmpsd
pop esi
555,16 → 568,16
; check if any process button contains cursor
mov eax, [BTN_ADDR]
mov ecx, [eax]
imul esi, ecx, SYS_BUTTON.sizeof
imul esi, ecx, sizeof.SYS_BUTTON
add esi, eax
inc ecx
add esi, SYS_BUTTON.sizeof
add esi, sizeof.SYS_BUTTON
 
.next_button:
dec ecx
jz .not_found
 
add esi, -SYS_BUTTON.sizeof
add esi, -sizeof.SYS_BUTTON
 
; does it belong to our process?
cmp dx, [esi + SYS_BUTTON.pslot]
/kernel/branches/Kolibri-acpi/gui/skincode.inc
43,43 → 43,43
ret
 
struct SKIN_HEADER
.ident dd ?
.version dd ?
.params dd ?
.buttons dd ?
.bitmaps dd ?
ident dd ?
version dd ?
params dd ?
buttons dd ?
bitmaps dd ?
ends
 
struct SKIN_PARAMS
.skin_height dd ?
.margin.right dw ?
.margin.left dw ?
.margin.bottom dw ?
.margin.top dw ?
.colors.inner dd ?
.colors.outer dd ?
.colors.frame dd ?
.colors_1.inner dd ?
.colors_1.outer dd ?
.colors_1.frame dd ?
.dtp.size dd ?
.dtp.data db 40 dup (?)
skin_height dd ?
margin.right dw ?
margin.left dw ?
margin.bottom dw ?
margin.top dw ?
colors.inner dd ?
colors.outer dd ?
colors.frame dd ?
colors_1.inner dd ?
colors_1.outer dd ?
colors_1.frame dd ?
dtp.size dd ?
dtp.data rb 40
ends
 
struct SKIN_BUTTONS
.type dd ?
.pos:
.left dw ?
.top dw ?
.size:
.width dw ?
.height dw ?
type dd ?
; position
left dw ?
top dw ?
; size
width dw ?
height dw ?
ends
 
struct SKIN_BITMAPS
.kind dw ?
.type dw ?
.data dd ?
kind dw ?
type dw ?
data dd ?
ends
 
load_default_skin:
127,7 → 127,8
 
mov ebx,[ebp+SKIN_HEADER.bitmaps]
add ebx,skin_data
.lp1: cmp dword[ebx],0
.lp1:
cmp dword[ebx], 0
je .end_bitmaps
movzx eax,[ebx+SKIN_BITMAPS.kind]
movzx ecx,[ebx+SKIN_BITMAPS.type]
138,7 → 139,8
or ecx,ecx
jnz @f
mov edx,skin_inactive.left.data
@@: jmp .next_bitmap
@@:
jmp .next_bitmap
.not_left:
dec eax
jnz .not_oper
150,7 → 152,8
or ecx,ecx
jnz @f
mov edx,skin_inactive.oper.data
@@: jmp .next_bitmap
@@:
jmp .next_bitmap
.not_oper:
dec eax
jnz .not_base
160,7 → 163,8
jnz @f
mov eax,[skin_inactive.left.width]
mov edx,skin_inactive.base.data
@@: jmp .next_bitmap
@@:
jmp .next_bitmap
.not_base:
add ebx,8
jmp .lp1
178,7 → 182,8
 
mov ebx,[ebp+SKIN_HEADER.buttons]
add ebx,skin_data
.lp2: cmp dword[ebx],0
.lp2:
cmp dword[ebx], 0
je .end_buttons
mov eax,[ebx+SKIN_BUTTONS.type]
dec eax
213,7 → 218,8
or ebx,ebx
jz @f
call sys_putimage.forced
@@: ret
@@:
ret
 
drawwindow_IV_caption:
 
311,22 → 317,29
; shr esi,1
; and esi,0x007f7f7f
mov esi,[ebp+SKIN_DATA.colors.outer]
or esi, 1 shl 25 ; 0x02000000 used for draw_rectangle without top line
ror ebx, 16
add ebx, [_skinh]
sub bx, 1
rol ebx, 16
call draw_rectangle
mov ecx,3
_dw3l:
add eax,1*65536-1
add ebx,1*65536-1
add ebx, 0*65536-1
test ax,ax
js no_skin_add_button
test bx,bx
js no_skin_add_button
mov esi,[ebp+SKIN_DATA.colors.frame] ;[edi+24]
or esi, 1 shl 25; 0x02000000 used for draw_rectangle without top line
call draw_rectangle
dec ecx
jnz _dw3l
mov esi,[ebp+SKIN_DATA.colors.inner]
or esi, 1 shl 25; 0x02000000 used for draw_rectangle without top line
add eax,1*65536-1
add ebx,1*65536-1
add ebx, 0*65536-1
test ax,ax
js no_skin_add_button
test bx,bx
/kernel/branches/Kolibri-acpi/gui/skindata.inc
17,25 → 17,25
endg
 
struct SKIN_DATA
.colors.inner dd ?
.colors.outer dd ?
.colors.frame dd ?
.left.data dd ?
.left.left dd ?
.left.width dd ?
.oper.data dd ?
.oper.left dd ?
.oper.width dd ?
.base.data dd ?
.base.left dd ?
.base.width dd ?
colors.inner dd ?
colors.outer dd ?
colors.frame dd ?
left.data dd ?
left.left dd ?
left.width dd ?
oper.data dd ?
oper.left dd ?
oper.width dd ?
base.data dd ?
base.left dd ?
base.width dd ?
ends
 
struct SKIN_BUTTON
.left dd ?
.top dd ?
.width dd ?
.height dd ?
left dd ?
top dd ?
width dd ?
height dd ?
ends
 
uglobal
/kernel/branches/Kolibri-acpi/gui/window.inc
43,10 → 43,7
jae .exit
 
push eax
inc [mouse_pause]
call [_display.disable_mouse]
call window._.sys_set_window
call [_display.disable_mouse]
pop eax
 
or al, al
56,16 → 53,17
call drawwindow_I
jmp window._.draw_window_caption.2
 
@@: dec al
@@:
dec al
jnz @f
 
; type II - only reserve area, no draw
call sys_window_mouse
dec [mouse_pause]
call [draw_pointer]
jmp .exit
 
@@: dec al
@@:
dec al
jnz @f
 
; type III - new style
73,7 → 71,8
jmp window._.draw_window_caption.2
 
; type IV & V - skinned window (resizable & not)
@@: mov eax, [TASK_COUNT]
@@:
mov eax, [TASK_COUNT]
movzx eax, word[WIN_POS + eax * 2]
cmp eax, [CURRENT_TASK]
setz al
133,7 → 132,8
cmp ebx, .sizeof.ftable / 4
ja @f
jmp [.ftable + ebx * 4]
@@: ret
@@:
ret
 
 
align 4
210,11 → 210,13
or eax, eax
jge @f
xor eax, eax
@@: mov [screen_workarea.left], eax
@@:
mov [screen_workarea.left], eax
cmp ebx, edi
jle @f
mov ebx, edi
@@: mov [screen_workarea.right], ebx
@@:
mov [screen_workarea.right], ebx
 
.check_horizontal:
mov edi, [Screen_Max_Y]
227,11 → 229,13
or eax, eax
jge @f
xor eax, eax
@@: mov [screen_workarea.top], eax
@@:
mov [screen_workarea.top], eax
cmp ebx, edi
jle @f
mov ebx, edi
@@: mov [screen_workarea.bottom], ebx
@@:
mov [screen_workarea.bottom], ebx
 
.check_if_redraw_needed:
or esi, esi
328,21 → 332,25
cmp ebx, -1
jne @f
mov ebx, [edi + WDATA.box.left]
@@: cmp ecx, -1
@@:
cmp ecx, -1
jne @f
mov ecx, [edi + WDATA.box.top]
@@: cmp edx, -1
@@:
cmp edx, -1
jne @f
mov edx, [edi + WDATA.box.width]
@@: cmp esi, -1
@@:
cmp esi, -1
jne @f
mov esi, [edi + WDATA.box.height]
 
@@: push esi edx ecx ebx
@@:
push esi edx ecx ebx
mov eax, esp
mov bl, [edi + WDATA.fl_wstate]
call window._.set_window_box
add esp, BOX.sizeof
add esp, sizeof.BOX
 
; NOTE: do we really need this? to be reworked
; mov byte[DONT_DRAW_MOUSE], 0 ; mouse pointer
399,7 → 407,8
push eax ecx
xor eax, eax
mov ecx, WIN_STACK
@@: inc eax
@@:
inc eax
add ecx, 2
; process no
mov [ecx + 0x000], ax
466,17 → 475,21
cmp eax, [esp + RECT.left]
jae @f
mov eax, [esp + RECT.left]
@@: cmp ebx, [esp + RECT.top]
@@:
cmp ebx, [esp + RECT.top]
jae @f
mov ebx, [esp + RECT.top]
@@: cmp ecx, [esp + RECT.right]
@@:
cmp ecx, [esp + RECT.right]
jbe @f
mov ecx, [esp + RECT.right]
@@: cmp edx, [esp + RECT.bottom]
@@:
cmp edx, [esp + RECT.bottom]
jbe @f
mov edx, [esp + RECT.bottom]
 
@@: push esi
@@:
push esi
movzx esi, word[WIN_POS + esi * 2]
call window._.set_screen
pop esi
490,6 → 503,7
 
.exit:
pop ebp
inc [_display.mask_seqno]
popfd
pop esi
ret
501,7 → 515,7
;? <description>
;------------------------------------------------------------------------------
mov ecx, [TASK_COUNT]
mov edi, window_data + WDATA.sizeof * 2
mov edi, window_data + sizeof.WDATA * 2
call force_redraw_background
dec ecx
jle .exit
520,7 → 534,8
sub eax, ebx
jle @f
mov [edi + WDATA.box.width], ebx
@@: sub ebx, [edi + WDATA.box.width]
@@:
sub ebx, [edi + WDATA.box.width]
mov [edi + WDATA.box.left], ebx
 
.fix_vertical:
533,7 → 548,8
sub eax, ebx
jle @f
mov [edi + WDATA.box.height], ebx
@@: sub ebx, [edi + WDATA.box.height]
@@:
sub ebx, [edi + WDATA.box.height]
mov [edi + WDATA.box.top], ebx
jmp .fix_client_box
 
554,7 → 570,7
.fix_client_box:
call window._.set_window_clientbox
 
add edi, WDATA.sizeof
add edi, sizeof.WDATA
loop .next_window
 
.exit:
590,6 → 606,9
;> eax = pack[16(left), 16(right)]
;> ebx = pack[16(top), 16(bottom)]
;> esi = color
; ?? RR GG BB ; 0x01000000 negation
; ; 0x02000000 used for draw_rectangle without top line
; ; for example drawwindow_III and drawwindow_IV
;------------------------------------------------------------------------------
push eax ebx ecx edi
 
600,14 → 619,17
 
; set line color
mov ecx, esi
 
; sub esi, 1 shl 25
; draw top border
rol ebx, 16
push ebx
rol ebx, 16
pop bx
test ecx, 1 shl 25
jnz @f
sub ecx, 1 shl 25
call [draw_line]
 
@@:
; draw bottom border
mov ebx, [esp - 2]
pop bx
655,7 → 677,8
cmp ebx, eax
jbe @f
mov ebx, eax
@@: push ebx
@@:
push ebx
 
xor edi, edi
 
674,7 → 697,8
jz @f
sub ecx, 0x00040404
mov [esi + WDATA.cl_titlebar], ecx
@@: and ecx, 0x00ffffff
@@:
and ecx, 0x00ffffff
call [draw_line]
inc edx
cmp edx, [esp]
753,7 → 777,8
cmp ebx, eax
jb @f
mov ebx, eax
@@: push ebx
@@:
push ebx
 
xor edi, edi
 
770,10 → 795,12
test ecx, 0x40000000
jz @f
add ecx, 0x00040404
@@: test ecx, 0x80000000
@@:
test ecx, 0x80000000
jz @f
sub ecx, 0x00040404
@@: mov [esi + WDATA.cl_titlebar], ecx
@@:
mov [esi + WDATA.cl_titlebar], ecx
and ecx, 0x00ffffff
call [draw_line]
inc edx
804,15 → 831,21
mov esi, [edx + WDATA.cl_frames]
shr esi, 1
and esi, 0x007f7f7f
or esi, 1 shl 25; 0x02000000 used for draw_rectangle without top line
ror ebx, 16
add ebx, [_skinh]
sub bx, 1
rol ebx, 16
call draw_rectangle
 
push esi
mov ecx, 3
mov esi, [edx + WDATA.cl_frames]
or esi, 1 shl 25; 0x02000000 used for draw_rectangle without top line
 
.next_frame:
add eax, 1 * 65536 - 1
add ebx, 1 * 65536 - 1
add ebx, 0 * 65536 - 1
call draw_rectangle
dec ecx
jnz .next_frame
819,7 → 852,7
 
pop esi
add eax, 1 * 65536 - 1
add ebx, 1 * 65536 - 1
add ebx, 0 * 65536 - 1
call draw_rectangle
 
; window caption
895,6 → 928,7
mov edi, [TASK_COUNT]
movzx esi, word[WIN_POS + edi * 2]
call window._.set_screen
inc [_display.mask_seqno]
popad
 
; tell application to redraw itself
987,7 → 1021,8
cmp eax, [TASK_COUNT]
jz @f
mov ebp, calculatescreen
@@: mov eax, [edi + WDATA.box.left]
@@:
mov eax, [edi + WDATA.box.left]
mov ebx, [edi + WDATA.box.top]
mov ecx, [edi + WDATA.box.width]
mov edx, [edi + WDATA.box.height]
994,7 → 1029,7
add ecx, eax
add edx, ebx
call ebp
 
inc [_display.mask_seqno]
mov byte[MOUSE_BACKGROUND], 0
 
.exit:
1022,7 → 1057,8
call minimize_window
jmp .exit
 
@@: call restore_minimized_window
@@:
call restore_minimized_window
 
.exit:
ret
1083,10 → 1119,12
mov [ecx + BOX.height], eax
xchg eax, ecx
 
@@: call window._.set_window_box
add esp, BOX.sizeof
@@:
call window._.set_window_box
add esp, sizeof.BOX
 
.exit:
inc [_display.mask_seqno]
ret
 
align 4
1120,11 → 1158,12
.restore_size:
test bl, WSTATE_MAXIMIZED
jnz @f
add esp, -BOX.sizeof
add esp, -sizeof.BOX
lea eax, [edx + APPDATA.saved_box]
jmp .set_box
 
@@: mov eax, [screen_workarea.top]
@@:
mov eax, [screen_workarea.top]
push [screen_workarea.bottom] \
[edi + WDATA.box.width] \
eax \
1134,7 → 1173,7
 
.set_box:
call window._.set_window_box
add esp, BOX.sizeof
add esp, sizeof.BOX
 
ret
 
1232,7 → 1271,8
cmp ecx, edx
jle @f
mov ecx, edx
@@: mov [draw_limits.left], ecx
@@:
mov [draw_limits.left], ecx
mov ecx, [eax + BOX.left]
add ecx, [eax + BOX.width]
add edx, [ebx + BOX.width]
1239,13 → 1279,15
cmp ecx, edx
jae @f
mov ecx, edx
@@: mov [draw_limits.right], ecx
@@:
mov [draw_limits.right], ecx
mov ecx, [eax + BOX.top]
mov edx, [ebx + BOX.top]
cmp ecx, edx
jle @f
mov ecx, edx
@@: mov [draw_limits.top], ecx
@@:
mov [draw_limits.top], ecx
mov ecx, [eax + BOX.top]
add ecx, [eax + BOX.height]
add edx, [ebx + BOX.height]
1252,7 → 1294,8
cmp ecx, edx
jae @f
mov ecx, edx
@@: mov [draw_limits.bottom], ecx
@@:
mov [draw_limits.bottom], ecx
 
; recalculate screen buffer at old position
push ebx
1309,7 → 1352,7
jz .exit
@@:
 
add esp, -BOX.sizeof
add esp, -sizeof.BOX
 
mov ebx, esp
if WDATA.box
1318,7 → 1361,7
mov esi, edi ; optimization for WDATA.box = 0
end if
xchg eax, esi
mov ecx, BOX.sizeof
mov ecx, sizeof.BOX
call memmove
xchg eax, esi
xchg ebx, esi
1330,7 → 1373,7
call window._.set_window_clientbox
call window._.invalidate_screen
 
add esp, BOX.sizeof
add esp, sizeof.BOX
 
mov cl, [esp + 4]
mov ch, cl
1477,7 → 1520,8
 
xor eax, eax
 
@@: mov [edi + APPDATA.wnd_caption], eax
@@:
mov [edi + APPDATA.wnd_caption], eax
 
mov esi, [esp]
add edi, APPDATA.saved_box
1601,7 → 1645,8
jne @f
mov eax, [_skinh]
ret
@@: mov eax, 21
@@:
mov eax, 21
ret
 
align 4
1619,11 → 1664,13
mov eax, [_skinh]
add eax, 3
ret
@@: or al, al
@@:
or al, al
jnz @f
mov eax, 21
ret
@@: mov eax, 21 + 2
@@:
mov eax, 21 + 2
ret
 
align 4
1770,7 → 1817,8
mov eax, esi
mov [ebp], al
; -- end body --
@@: inc ebp
@@:
inc ebp
inc edx
cmp edx, [ff_xsz]
jb .ff_new_x
1787,6 → 1835,7
 
.exit:
popad
inc [_display.mask_seqno]
ret
 
.read_byte:
2005,9 → 2054,6
;------------------------------------------------------------------------------
;? <description>
;------------------------------------------------------------------------------
inc [mouse_pause]
call [_display.disable_mouse]
 
xor eax, eax
mov edx, [TASK_COUNT]
movzx edx, word[WIN_POS + edx * 2]
2014,7 → 2060,8
cmp edx, [CURRENT_TASK]
jne @f
inc eax
@@: mov edx, [CURRENT_TASK]
@@:
mov edx, [CURRENT_TASK]
shl edx, 5
add edx, window_data
movzx ebx, [edx + WDATA.fl_wstyle]
2045,7 → 2092,8
 
call drawwindow_I_caption
 
.2: mov edi, [CURRENT_TASK]
.2:
mov edi, [CURRENT_TASK]
shl edi, 5
test [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION
jz .exit
2117,7 → 2165,6
call dtext_asciiz_esi
 
.exit:
dec [mouse_pause]
call [draw_pointer]
ret
 
2150,4 → 2197,29
;------------------------------------------------------------------------------
push eax ebx esi
xor esi,esi
jmp window._.draw_negative_box.1
jmp window._.draw_negative_box.1
 
 
;------------------------------------------------------------------------------
window._.get_rect: ;/////////////////////////////////////////////////////
;------------------------------------------------------------------------------
;? <description> void __fastcall get_window_rect(struct RECT* rc);
;------------------------------------------------------------------------------
;> ecx = pointer to RECT
;------------------------------------------------------------------------------
mov eax, [TASK_BASE]
 
mov edx, [eax-twdw + WDATA.box.left]
mov [ecx+RECT.left], edx
 
add edx, [eax-twdw + WDATA.box.width]
mov [ecx+RECT.right], edx
 
mov edx, [eax-twdw + WDATA.box.top]
mov [ecx+RECT.top], edx
 
add edx, [eax-twdw + WDATA.box.height]
mov [ecx+RECT.bottom], edx
 
ret
 
/kernel/branches/Kolibri-acpi/hid/mousedrv.inc
22,35 → 22,32
; FCFF com1/ps2 buffer count starting from FC00
 
uglobal
;--------------------------------------
align 4
mousecount dd 0x0
mousedata dd 0x0
Y_UNDER_subtraction_CUR_hot_y:
dd 0
X_UNDER_subtraction_CUR_hot_x:
dd 0
Y_UNDER_sub_CUR_hot_y_add_curh:
dd 0
X_UNDER_sub_CUR_hot_x_add_curh:
dd 0
endg
 
iglobal
;--------------------------------------
align 4
mouse_delay dd 10
mouse_speed_factor: dd 3
mouse_speed_factor:
dd 3
mouse_timer_ticks dd 0
endg
 
;include 'm_com.inc'
 
 
;test_mario79:
; push esi
; push eax
; mov [write_error_to],process_test_m79+43
; movzx eax,al ;[DevErrorCode]
; call writehex
; mov esi,process_test_m79
; call sys_msg_board_str
; pop eax
; pop esi
; ret
;process_test_m79 db 'K : Process - test Mario79 error 00000000',13,10,0
 
;-----------------------------------------------------------------------------
align 4
draw_mouse_under:
; return old picture
 
cmp [_display.restore_cursor], 0
je @F
 
60,10 → 57,13
stdcall [_display.restore_cursor], eax, ebx
popad
ret
;--------------------------------------
align 4
@@:
pushad
xor ecx,ecx
xor edx,edx
;--------------------------------------
align 4
mres:
movzx eax,word [X_UNDER]
83,6 → 83,7
pop ebx
pop eax
mov edi, 1 ;force
or ecx, 0x04000000 ; don't save to mouseunder area
call [putpixel]
pop edx
pop ecx
95,9 → 96,9
jnz mres
popad
ret
 
;-----------------------------------------------------------------------------
align 4
save_draw_mouse:
 
cmp [_display.move_cursor], 0
je .no_hw_cursor
pushad
123,17 → 124,22
push esi
call [_display.select_cursor]
mov [current_cursor], esi
;--------------------------------------
align 4
.draw:
stdcall [_display.move_cursor], esi
popad
ret
.fail:
mov ecx, [def_cursor]
mov [edx+SLOT_BASE+APPDATA.cursor], ecx
stdcall [_display.move_cursor], ecx ; stdcall: [esp]=ebx,eax
popad
ret
 
;--------------------------------------
;align 4
;.fail:
; mov ecx, [def_cursor]
; mov [edx+SLOT_BASE+APPDATA.cursor], ecx
; stdcall [_display.move_cursor], ecx ; stdcall: [esp]=ebx,eax
; popad
; ret
;--------------------------------------
align 4
.no_hw_cursor:
pushad
; save & draw
143,6 → 149,7
push ebx
mov ecx,0
mov edx,0
;--------------------------------------
align 4
drm:
push eax
154,6 → 161,7
add eax,ecx ; save picture under mouse
add ebx,edx
push ecx
or ecx, 0x04000000 ; don't load to mouseunder area
call getpixel
mov [COLOR_TEMP],ecx
pop ecx
163,6 → 171,7
add eax,ecx
add eax,mouseunder
mov ebx,[COLOR_TEMP]
and ebx, 0xffffff
mov [eax],ebx
pop ecx
mov edi,edx ; y cycle
177,6 → 186,7
push ecx
mov ecx, [COLOR_TEMP]
call combine_colors
and ecx, 0xffffff
mov [MOUSE_COLOR_MEM], ecx
pop ecx
pop edx
187,7 → 197,8
add ebx,edx ; and y coord+cycle
push ecx
mov ecx, [MOUSE_COLOR_MEM]
mov edi, 1
mov edi, 1 ; force
or ecx, 0x04000000 ; don't save to mouseunder area
call [putpixel]
pop ecx
mov ebx,[esp+0] ; pure y coord again
202,8 → 213,8
add esp,8
popad
ret
 
 
;-----------------------------------------------------------------------------
align 4
combine_colors:
; in
; ecx - color ( 00 RR GG BB )
271,107 → 282,133
pop ebx
pop eax
ret
;-----------------------------------------------------------------------------
align 4
check_mouse_area_for_getpixel:
; in:
; eax = x
; ebx = y
; out:
; ecx = new color
push eax ebx
; check for Y
xor ecx, ecx
mov cx, [Y_UNDER] ; [MOUSE_Y]
 
 
__sys_disable_mouse:
cmp dword [MOUSE_VISIBLE],dword 0
je @f
ret
@@:
pushad
cmp [CURRENT_TASK],dword 1
je disable_m
mov edx,[CURRENT_TASK]
shl edx,5
add edx,window_data
movzx eax, word [MOUSE_X]
movzx ebx, word [MOUSE_Y]
mov ecx,[Screen_Max_X]
inc ecx
imul ecx,ebx
add ecx,eax
add ecx, [_WinMapAddress]
mov eax, [CURRENT_TASK]
cmp al, [ecx]
je yes_mouse_disable
cmp al, [ecx+16]
je yes_mouse_disable
add ebx, 10
cmp ebx, [Screen_Max_Y]
jae no_mouse_disable
mov ebx,[Screen_Max_X]
inc ebx
imul ebx,10
add ecx,ebx
cmp al, [ecx]
je yes_mouse_disable
cmp al, [ecx+16]
je yes_mouse_disable
jmp no_mouse_disable
yes_mouse_disable:
mov edx,[CURRENT_TASK]
shl edx,5
add edx,window_data
movzx eax, word [MOUSE_X]
movzx ebx, word [MOUSE_Y]
mov ecx,[edx+0] ; mouse inside the area ?
add eax,10
cmp ebx, ecx
jb .no_mouse_area
add ecx, 23 ; mouse cursor Y size
cmp ebx, ecx
ja .no_mouse_area
; offset Y
sub bx, [Y_UNDER] ;[MOUSE_Y]
;--------------------------------------
; check for X
xor ecx, ecx
mov cx, [X_UNDER] ;[MOUSE_X]
cmp eax,ecx
jb no_mouse_disable
sub eax,10
add ecx,[edx+8]
jb .no_mouse_area
add ecx, 15 ; mouse cursor X size
cmp eax,ecx
jg no_mouse_disable
mov ecx,[edx+4]
add ebx,14
cmp ebx,ecx
jb no_mouse_disable
sub ebx,14
add ecx,[edx+12]
cmp ebx,ecx
jg no_mouse_disable
disable_m:
cmp dword [MOUSE_VISIBLE],dword 0
jne no_mouse_disable
pushf
cli
call draw_mouse_under
popf
mov [MOUSE_VISIBLE],dword 1
no_mouse_disable:
popad
ja .no_mouse_area
; offset X
sub ax, [X_UNDER] ;[MOUSE_X]
;--------------------------------------
; eax = offset x
; ebx = offset y
shl ebx, 6 ;y
shl eax, 2 ;x
add eax, ebx
add eax, mouseunder
mov ecx, [eax]
and ecx, 0xffffff
or ecx, 0xff000000
pop ebx eax
ret
;--------------------------------------
align 4
.no_mouse_area:
xor ecx, ecx
pop ebx eax
ret
;-----------------------------------------------------------------------------
align 4
check_mouse_area_for_putpixel:
; in:
; ecx = x shl 16 + y
; eax = color
; out:
; eax = new color
push eax
; check for Y
mov ax, [Y_UNDER] ; [MOUSE_Y]
cmp cx, ax
jb .no_mouse_area
add ax, 23 ; mouse cursor Y size
cmp cx, ax
ja .no_mouse_area
; offset Y
sub cx, [Y_UNDER] ;[MOUSE_Y]
mov ax, cx
shl eax, 16
;--------------------------------------
; check for X
mov ax, [X_UNDER] ;[MOUSE_X]
shr ecx, 16
cmp cx, ax
jb .no_mouse_area
add ax, 15 ; mouse cursor X size
cmp cx, ax
ja .no_mouse_area
; offset X
sub cx, [X_UNDER] ;[MOUSE_X]
mov ax, cx
;--------------------------------------
; eax = (offset y) shl 16 + (offset x)
 
__sys_draw_pointer:
cmp [mouse_pause],0
je @f
pop ecx
 
push eax ebx
 
mov ebx, eax
shr ebx, 16 ;y
and eax, 0xffff ;x
 
shl ebx, 6
shl eax, 2
add eax, ebx
add eax, mouseunder
and ecx, 0xFFFFFF
mov [eax], ecx
 
pop ebx eax
 
push esi edi
rol eax, 16
movzx edi, ax ; y cycle
shl edi, 4 ; *16 bytes per row
shr eax, 16
add edi, eax ; x cycle
lea edi, [edi*3]
add edi, [MOUSE_PICTURE] ; we have our str address
mov esi, edi
add esi, 16*24*3
call combine_colors
pop edi esi
;--------------------------------------
align 4
.end:
mov eax, ecx
ret
@@:
push eax
mov eax,[timer_ticks]
sub eax,[MouseTickCounter]
cmp eax,1
ja @f
;--------------------------------------
align 4
.no_mouse_area:
pop eax
ret
@@:
mov eax,[timer_ticks]
mov [MouseTickCounter],eax
pop eax
;-----------------------------------------------------------------------------
align 4
__sys_draw_pointer:
pushad
cmp dword [MOUSE_VISIBLE],dword 0 ; mouse visible ?
je chms00
mov [MOUSE_VISIBLE], dword 0
movzx ebx,word [MOUSE_Y]
movzx eax,word [MOUSE_X]
pushfd
cli
call save_draw_mouse
popfd
nodmu2:
popad
ret
chms00:
movzx ecx,word [X_UNDER]
movzx edx,word [Y_UNDER]
movzx ebx,word [MOUSE_Y]
379,18 → 416,44
cmp eax,ecx
jne redrawmouse
cmp ebx,edx
jne redrawmouse
jmp nodmp
je nodmp
;--------------------------------------
align 4
redrawmouse:
pushfd
cli
call draw_mouse_under
call save_draw_mouse
 
mov eax, [_display.select_cursor]
test eax, eax
jz @f
 
xor eax, eax
mov esi, [current_cursor]
 
mov ax, [Y_UNDER]
sub eax, [esi+CURSOR.hot_y]
mov [Y_UNDER_subtraction_CUR_hot_y], eax
add eax, [cur.h]
mov [Y_UNDER_sub_CUR_hot_y_add_curh], eax
 
mov ax, [X_UNDER]
sub eax, [esi+CURSOR.hot_x]
mov [X_UNDER_subtraction_CUR_hot_x], eax
add eax, [cur.w]
mov [X_UNDER_sub_CUR_hot_x_add_curh], eax
;--------------------------------------
align 4
@@:
popfd
;--------------------------------------
align 4
nodmp:
popad
ret
 
;-----------------------------------------------------------------------------
align 4
proc set_mouse_data stdcall, BtnState:dword, XMoving:dword, YMoving:dword, VScroll:dword, HScroll:dword
 
mov eax,[BtnState]
403,11 → 466,14
jge @@M1
mov eax,0
jmp @@M2
;--------------------------------------
align 4
@@M1:
cmp ax,[Screen_Max_X] ;ScreenLength
jl @@M2
mov ax,[Screen_Max_X] ;ScreenLength-1
 
;--------------------------------------
align 4
@@M2:
mov [MOUSE_X],ax ;[XCoordinate]
 
420,11 → 486,14
jge @@M3
mov ax,0
jmp @@M4
;--------------------------------------
align 4
@@M3:
cmp ax,[Screen_Max_Y] ;ScreenHeigth
jl @@M4
mov ax,[Screen_Max_Y] ;ScreenHeigth-1
 
;--------------------------------------
align 4
@@M4:
mov [MOUSE_Y],ax ;[YCoordinate]
 
439,7 → 508,8
mov [mouse_timer_ticks],eax
ret
endp
 
;-----------------------------------------------------------------------------
align 4
mouse_acceleration:
push eax
mov eax,[timer_ticks]
450,6 → 520,8
;push edx
imul eax,[mouse_speed_factor]
;pop edx
;--------------------------------------
align 4
@@:
ret
 
;-----------------------------------------------------------------------------
/kernel/branches/Kolibri-acpi/init.inc
288,7 → 288,8
mov esi, edi
xor eax, eax
cld ; paranoia
@@: lodsb
@@:
lodsb
add ah, al
loop @b
jnz .pcibios_nxt2 ; control summ must be zero
/kernel/branches/Kolibri-acpi/kernel.asm
67,6 → 67,7
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
include 'macros.inc'
include 'struct.inc'
 
$Revision$
 
171,17 → 172,20
mov al,255 ; mask all irqs
out 0xa1,al
out 0x21,al
l.5: in al, 0x64 ; Enable A20
l.5:
in al, 0x64 ; Enable A20
test al, 2
jnz l.5
mov al, 0xD1
out 0x64, al
l.6: in al, 0x64
l.6:
in al, 0x64
test al, 2
jnz l.6
mov al, 0xDF
out 0x60, al
l.7: in al, 0x64
l.7:
in al, 0x64
test al, 2
jnz l.7
mov al, 0xFF
370,7 → 374,6
 
mov [_display.bpp], eax
mov [_display.vrefresh], 60
mov [_display.disable_mouse], __sys_disable_mouse
 
movzx eax,word [BOOT_VAR+0x900A] ; X max
mov [_display.width], eax
384,8 → 387,8
mov [screen_workarea.bottom],eax
movzx eax,word [BOOT_VAR+0x9008] ; screen mode
mov [SCR_MODE],eax
mov eax,[BOOT_VAR+0x9014] ; Vesa 1.2 bnk sw add
mov [BANK_SWITCH],eax
; mov eax, [BOOT_VAR+0x9014] ; Vesa 1.2 bnk sw add
; mov [BANK_SWITCH], eax
mov [BytesPerScanLine],word 640*4 ; Bytes PerScanLine
cmp [SCR_MODE],word 0x13 ; 320x200
je @f
413,16 → 416,17
 
cmp [SCR_MODE],word 0100000000000000b
jge setvesa20
cmp [SCR_MODE],word 0x13
cmp [SCR_MODE], word 0x13 ; EGA 320*200 256 colors
je v20ga32
mov [PUTPIXEL],dword Vesa12_putpixel24 ; Vesa 1.2
mov [GETPIXEL],dword Vesa12_getpixel24
cmp [ScreenBPP],byte 24
jz ga24
mov [PUTPIXEL],dword Vesa12_putpixel32
mov [GETPIXEL],dword Vesa12_getpixel32
ga24:
jmp v20ga24
; mov [PUTPIXEL], dword Vesa12_putpixel24 ; Vesa 1.2
; mov [GETPIXEL], dword Vesa12_getpixel24
; cmp [ScreenBPP], byte 24
; jz ga24
; mov [PUTPIXEL], dword Vesa12_putpixel32
; mov [GETPIXEL], dword Vesa12_getpixel32
; ga24:
; jmp v20ga24
setvesa20:
mov [PUTPIXEL],dword Vesa20_putpixel24 ; Vesa 2.0
mov [GETPIXEL],dword Vesa20_getpixel24
431,6 → 435,7
v20ga32:
mov [PUTPIXEL],dword Vesa20_putpixel32
mov [GETPIXEL],dword Vesa20_getpixel32
jmp no_mode_0x12
v20ga24:
cmp [SCR_MODE],word 0x12 ; 16 C VGA 640x480
jne no_mode_0x12
562,7 → 567,7
mov [unpack.p], eax
 
call init_events
mov eax, srv.fd-SRV_FD_OFFSET
mov eax, srv.fd-SRV.fd
mov [srv.fd], eax
mov [srv.bk], eax
 
665,6 → 670,10
stdcall read_file, char, FONT_I, 0, 2304
stdcall read_file, char2, FONT_II, 0, 2560
 
mov [MOUSE_PICTURE], dword mousepointer
mov [_display.check_mouse], check_mouse_area_for_putpixel
mov [_display.check_m_pixel], check_mouse_area_for_getpixel
 
mov esi,boot_fonts
call boot_log
 
861,9 → 870,6
call set_network_conf
no_st_network:
 
xchg bx, bx
stdcall load_driver, ahci_driver
 
; LOAD FIRST APPLICATION
cli
 
985,7 → 991,8
if preboot_blogesc
mov esi, boot_tasking
call boot_log
.bll1: in al, 0x60 ; wait for ESC key press
.bll1:
in al, 0x60 ; wait for ESC key press
cmp al, 129
jne .bll1
end if
1005,8 → 1012,6
include 'unpacker.inc'
include 'fdo.inc'
 
ahci_driver db 'AHCI',0
 
align 4
boot_log:
pushad
1915,7 → 1920,30
ret
 
sys_end:
;--------------------------------------
cmp [_display.select_cursor], 0
je @f
; restore default cursor before killing
pusha
mov ecx, [current_slot]
mov eax, [def_cursor]
mov [ecx+APPDATA.cursor], eax
 
movzx eax, word [MOUSE_Y]
movzx ebx, word [MOUSE_X]
mov ecx, [Screen_Max_X]
inc ecx
mul ecx
add eax, [_WinMapAddress]
movzx edx, byte [ebx+eax]
shl edx, 8
mov esi, [edx+SLOT_BASE+APPDATA.cursor]
push esi
call [_display.select_cursor]
mov [current_cursor], esi
popa
@@:
;--------------------------------------
mov ecx, [current_slot]
mov eax, [ecx+APPDATA.tls_base]
test eax, eax
1983,7 → 2011,8
exit_for_anyone:
ret
uglobal
shutdown_processes: dd 0x0
shutdown_processes:
dd 0x0
endg
;------------------------------------------------------------------------------
sysfn_terminate: ; 18.2 = TERMINATE
1993,12 → 2022,38
cmp ecx,edx
ja noprocessterminate
mov eax,[TASK_COUNT]
push ecx
shl ecx,5
mov edx,[ecx+CURRENT_TASK+TASKDATA.pid]
add ecx,CURRENT_TASK+TASKDATA.state
cmp byte [ecx], 9
jz noprocessterminate
;--------------------------------------
cmp [_display.select_cursor], 0
je @f
; restore default cursor before killing
pusha
mov ecx, [esp+32]
shl ecx, 8
mov eax, [def_cursor]
mov [ecx+SLOT_BASE+APPDATA.cursor], eax
 
movzx eax, word [MOUSE_Y]
movzx ebx, word [MOUSE_X]
mov ecx, [Screen_Max_X]
inc ecx
mul ecx
add eax, [_WinMapAddress]
movzx edx, byte [ebx+eax]
shl edx, 8
mov esi, [edx+SLOT_BASE+APPDATA.cursor]
push esi
call [_display.select_cursor]
mov [current_cursor], esi
popa
@@:
add esp, 4
;--------------------------------------
;call MEM_Heap_Lock ;guarantee that process isn't working with heap
mov [ecx],byte 3 ; clear possible i40's
;call MEM_Heap_UnLock
2784,7 → 2839,8
sys_clock:
cli
; Mikhail Lisovin xx Jan 2005
@@: mov al, 10
@@:
mov al, 10
out 0x70, al
in al, 0x71
test al, al
2821,7 → 2877,8
sys_date:
 
cli
@@: mov al, 10
@@:
mov al, 10
out 0x70, al
in al, 0x71
test al, al
3074,13 → 3131,52
cmp [mouse_active], 1
jne mouse_not_active
mov [mouse_active], 0
 
xor edi, edi
mov ebx, CURRENT_TASK
 
mov ecx, [TASK_COUNT]
set_mouse_event:
movzx eax, word [WIN_POS + ecx*2] ; active window
shl eax, 8
push eax
 
movzx eax, word [MOUSE_X]
movzx edx, word [MOUSE_Y]
 
align 4
.set_mouse_event:
add edi, 256
or [edi+SLOT_BASE+APPDATA.event_mask], dword 100000b
loop set_mouse_event
add ebx, 32
test [ebx+TASKDATA.event_mask], 0x80000000
jz .pos_filter
 
cmp edi, [esp] ; skip if filtration active
jne .skip
 
.pos_filter:
test [ebx+TASKDATA.event_mask], 0x40000000
jz .set
 
mov esi, [ebx-twdw+WDATA.box.left]
cmp eax, esi
jb .skip
add esi, [ebx-twdw+WDATA.box.width]
cmp eax, esi
ja .skip
 
mov esi, [ebx-twdw+WDATA.box.top]
cmp edx, esi
jb .skip
add esi, [ebx-twdw+WDATA.box.height]
cmp edx, esi
ja .skip
.set:
or [edi+SLOT_BASE+APPDATA.event_mask], 100000b
.skip:
loop .set_mouse_event
 
pop eax
 
mouse_not_active:
cmp byte[BACKGROUND_CHANGED], 0
jz no_set_bgr_event
3137,8 → 3233,6
 
no_mark_system_shutdown:
 
call [_display.disable_mouse]
 
dec byte [SYS_SHUTDOWN]
je system_shutdown
 
3334,7 → 3428,8
mov ah,al
cld
 
cnt1: in al,0x61
cnt1:
in al, 0x61
and al,0x10
cmp al,ah
jz cnt1
3347,12 → 3442,15
 
ret
 
 
align 4
set_app_param:
mov edi, [TASK_BASE]
mov eax, [edi + TASKDATA.event_mask]
mov [edi + TASKDATA.event_mask], ebx
mov [esp+32], eax
mov eax, ebx
btr eax, 3 ; move MOUSE_FILTRATION
mov ebx, [current_slot] ; bit into event_filter
setc byte [ebx+APPDATA.event_filter]
xchg eax, [edi + TASKDATA.event_mask] ; set new event mask
mov [esp+32], eax ; return old mask value
ret
 
 
3631,37 → 3729,23
; popad ; end disable io map
xor eax, eax
ret
 
 
;-----------------------------------------------------------------------------
align 4
drawbackground:
inc [mouse_pause]
cmp [SCR_MODE],word 0x12
je dbrv20
dbrv12:
cmp [SCR_MODE],word 0100000000000000b
jge dbrv20
cmp [SCR_MODE],word 0x13
je dbrv20
call vesa12_drawbackground
dec [mouse_pause]
call [draw_pointer]
ret
dbrv20:
cmp [BgrDrawMode],dword 1
jne bgrstr
call vesa20_drawbackground_tiled
dec [mouse_pause]
call [draw_pointer]
ret
;--------------------------------------
align 4
bgrstr:
call vesa20_drawbackground_stretch
dec [mouse_pause]
call [draw_pointer]
ret
 
;-----------------------------------------------------------------------------
align 4
 
syscall_putimage: ; PutImage
sys_putimage:
test ecx,0x80008000
3670,8 → 3754,12
jz .exit
test ecx,0xFFFF0000
jnz @f
;--------------------------------------
align 4
.exit:
ret
;--------------------------------------
align 4
@@:
mov edi,[current_slot]
add dx,word[edi+APPDATA.wnd_clientbox.top]
3678,28 → 3766,20
rol edx,16
add dx,word[edi+APPDATA.wnd_clientbox.left]
rol edx,16
;--------------------------------------
align 4
.forced:
push ebp esi 0
mov ebp, putimage_get24bpp
mov esi, putimage_init24bpp
;--------------------------------------
align 4
sys_putimage_bpp:
; call [disable_mouse] ; this will be done in xxx_putimage
; mov eax, vga_putimage
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
@@:
mov eax, vesa20_putimage
.doit:
inc [mouse_pause]
call eax
dec [mouse_pause]
call vesa20_putimage
pop ebp esi ebp
jmp [draw_pointer]
ret
; jmp [draw_pointer]
;-----------------------------------------------------------------------------
align 4
sys_putimage_palette:
; ebx = pointer to image
3714,6 → 3794,8
rol edx, 16
add dx, word [eax+SLOT_BASE+APPDATA.wnd_clientbox.left]
rol edx, 16
;--------------------------------------
align 4
.forced:
cmp esi, 1
jnz @f
3728,6 → 3810,8
add esp, 12
pop edi
ret
;--------------------------------------
align 4
@@:
cmp esi, 2
jnz @f
3738,6 → 3822,8
pop eax
pop edi
ret
;--------------------------------------
align 4
@@:
cmp esi, 4
jnz @f
3748,6 → 3834,8
pop eax
pop edi
ret
;--------------------------------------
align 4
@@:
push ebp esi ebp
cmp esi, 8
3755,6 → 3843,8
mov ebp, putimage_get8bpp
mov esi, putimage_init8bpp
jmp sys_putimage_bpp
;--------------------------------------
align 4
@@:
cmp esi, 15
jnz @f
3761,6 → 3851,8
mov ebp, putimage_get15bpp
mov esi, putimage_init15bpp
jmp sys_putimage_bpp
;--------------------------------------
align 4
@@:
cmp esi, 16
jnz @f
3767,6 → 3859,8
mov ebp, putimage_get16bpp
mov esi, putimage_init16bpp
jmp sys_putimage_bpp
;--------------------------------------
align 4
@@:
cmp esi, 24
jnz @f
3773,6 → 3867,8
mov ebp, putimage_get24bpp
mov esi, putimage_init24bpp
jmp sys_putimage_bpp
;--------------------------------------
align 4
@@:
cmp esi, 32
jnz @f
3779,31 → 3875,39
mov ebp, putimage_get32bpp
mov esi, putimage_init32bpp
jmp sys_putimage_bpp
;--------------------------------------
align 4
@@:
pop ebp esi ebp
ret
 
;-----------------------------------------------------------------------------
align 4
put_mono_image:
push ebp esi ebp
mov ebp, putimage_get1bpp
mov esi, putimage_init1bpp
jmp sys_putimage_bpp
;-----------------------------------------------------------------------------
align 4
put_2bit_image:
push ebp esi ebp
mov ebp, putimage_get2bpp
mov esi, putimage_init2bpp
jmp sys_putimage_bpp
;-----------------------------------------------------------------------------
align 4
put_4bit_image:
push ebp esi ebp
mov ebp, putimage_get4bpp
mov esi, putimage_init4bpp
jmp sys_putimage_bpp
 
;-----------------------------------------------------------------------------
align 4
putimage_init24bpp:
lea eax, [eax*3]
putimage_init8bpp:
ret
 
;-----------------------------------------------------------------------------
align 16
putimage_get24bpp:
movzx eax, byte [esi+2]
3811,6 → 3915,7
mov ax, [esi]
add esi, 3
ret 4
;-----------------------------------------------------------------------------
align 16
putimage_get8bpp:
movzx eax, byte [esi]
3820,7 → 3925,8
pop edx
inc esi
ret 4
 
;-----------------------------------------------------------------------------
align 4
putimage_init1bpp:
add eax, ecx
push ecx
3831,6 → 3937,7
sub eax, ecx
pop ecx
ret
;-----------------------------------------------------------------------------
align 16
putimage_get1bpp:
push edx
3847,7 → 3954,8
add eax, [edx+4]
pop edx
ret 4
 
;-----------------------------------------------------------------------------
align 4
putimage_init2bpp:
add eax, ecx
push ecx
3858,6 → 3966,7
sub eax, ecx
pop ecx
ret
;-----------------------------------------------------------------------------
align 16
putimage_get2bpp:
push edx
3879,7 → 3988,8
mov eax, [edx+eax*4]
pop edx
ret 4
 
;-----------------------------------------------------------------------------
align 4
putimage_init4bpp:
add eax, ecx
push ecx
3890,6 → 4000,7
sub eax, ecx
pop ecx
ret
;-----------------------------------------------------------------------------
align 16
putimage_get4bpp:
push edx
3911,19 → 4022,23
mov eax, [edx+eax*4]
pop edx
ret 4
 
;-----------------------------------------------------------------------------
align 4
putimage_init32bpp:
shl eax, 2
ret
;-----------------------------------------------------------------------------
align 16
putimage_get32bpp:
lodsd
ret 4
 
;-----------------------------------------------------------------------------
align 4
putimage_init15bpp:
putimage_init16bpp:
add eax, eax
ret
;-----------------------------------------------------------------------------
align 16
putimage_get15bpp:
; 0RRRRRGGGGGBBBBB -> 00000000RRRRR000GGGGG000BBBBB000
3942,7 → 4057,7
or eax, edx
pop edx ecx
ret 4
 
;-----------------------------------------------------------------------------
align 16
putimage_get16bpp:
; RRRRRGGGGGGBBBBB -> 00000000RRRRR000GGGGGG00BBBBB000
3961,41 → 4076,27
or eax, edx
pop edx ecx
ret 4
 
;-----------------------------------------------------------------------------
;align 4
; eax x beginning
; ebx y beginning
; ecx x end
; edx y end
; edi color
 
__sys_drawbar:
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]
.forced:
inc [mouse_pause]
; call [disable_mouse]
cmp [SCR_MODE],word 0x12
je dbv20
sdbv20:
cmp [SCR_MODE],word 0100000000000000b
jge dbv20
cmp [SCR_MODE],word 0x13
je dbv20
call vesa12_drawbar
dec [mouse_pause]
call [draw_pointer]
ret
dbv20:
call vesa20_drawbar
dec [mouse_pause]
call [draw_pointer]
ret
 
 
 
;__sys_drawbar:
; 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]
;--------------------------------------
;align 4
;.forced:
; call vesa20_drawbar
; call [draw_pointer]
; ret
;-----------------------------------------------------------------------------
align 4
kb_read:
 
push ecx edx
4021,8 → 4122,8
pop edx ecx
 
ret
 
 
;-----------------------------------------------------------------------------
align 4
kb_write:
 
push ecx edx
4075,8 → 4176,8
pop edx ecx
 
ret
 
 
;-----------------------------------------------------------------------------
align 4
kb_cmd:
 
mov ecx,0x1ffff ; last 0xffff, new value in view of fast CPU's
4107,7 → 4208,7
setmouse: ; set mousepicture -pointer
; ps2 mouse enable
 
mov [MOUSE_PICTURE],dword mousepointer
; mov [MOUSE_PICTURE], dword mousepointer
 
cli
 
4183,7 → 4284,8
ret
 
uglobal
msg_board_data: times 4096 db 0
msg_board_data:
times 4096 db 0
msg_board_count dd 0x0
endg
 
4411,8 → 4513,7
add eax, [edi+APPDATA.wnd_clientbox.left]
add ebx, [edi+APPDATA.wnd_clientbox.top]
xor edi, edi ; no force
; mov edi, 1
call [_display.disable_mouse]
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
jmp [putpixel]
 
align 4
4552,6 → 4653,7
div ecx
mov ebx, edx
xchg eax, ebx
and ecx, 0xFBFFFFFF ;negate 0x04000000 use mouseunder area
call dword [GETPIXEL] ; eax - x, ebx - y
mov [esp + 32], ecx
ret
4564,20 → 4666,6
;ecx = [size x]*65536 + [size y]
;edx = [start x]*65536 + [start y]
pushad
inc [mouse_pause]
; Check of use of the hardware cursor.
cmp [_display.disable_mouse],__sys_disable_mouse
jne @f
; Since the test for the coordinates of the mouse should not be used,
; then use the call [disable_mouse] is not possible!
cmp dword [MOUSE_VISIBLE],dword 0
jne @f
pushf
cli
call draw_mouse_under
popf
mov [MOUSE_VISIBLE],dword 1
@@:
mov edi,ebx
mov eax,edx
shr eax,16
4614,6 → 4702,7
push eax ebx ecx
add eax,ecx
 
and ecx, 0xFBFFFFFF ;negate 0x04000000 use mouseunder area
call dword [GETPIXEL] ; eax - x, ebx - y
 
mov [ebp],cx
4628,12 → 4717,6
dec ebx
dec edx
jnz .start_y
dec [mouse_pause]
; Check of use of the hardware cursor.
cmp [_display.disable_mouse],__sys_disable_mouse
jne @f
call [draw_pointer]
@@:
popad
ret
 
/kernel/branches/Kolibri-acpi/kernel32.inc
15,70 → 15,32
 
$Revision$
 
struct POINT
x dd ?
y dd ?
ends
 
;struc db [a] { common . db a
; if ~used .
; display 'not used db: ',`.,13,10
; end if }
;struc dw [a] { common . dw a
; if ~used .
; display 'not used dw: ',`.,13,10
; end if }
;struc dd [a] { common . dd a
; if ~used .
; display 'not used dd: ',`.,13,10
; end if }
;struc dp [a] { common . dp a
; if ~used .
; display 'not used dp: ',`.,13,10
; end if }
;struc dq [a] { common . dq a
; if ~used .
; display 'not used dq: ',`.,13,10
; end if }
;struc dt [a] { common . dt a
; if ~used .
; display 'not used dt: ',`.,13,10
; end if }
struct RECT
left dd ?
top dd ?
right dd ?
bottom dd ?
ends
 
struc POINT {
.x dd ?
.y dd ?
.sizeof:
}
virtual at 0
POINT POINT
end virtual
struct BOX
left dd ?
top dd ?
width dd ?
height dd ?
ends
 
struc RECT {
.left dd ?
.top dd ?
.right dd ?
.bottom dd ?
.sizeof:
}
virtual at 0
RECT RECT
end virtual
struct DISPMODE
width dw ?
height dw ?
bpp dw ?
freq dw ?
ends
 
struc BOX {
.left dd ?
.top dd ?
.width dd ?
.height dd ?
.sizeof:
}
virtual at 0
BOX BOX
end virtual
 
struc DISPMODE {
.width rw 1
.height rw 1
.bpp rw 1
.freq rw 1
}
 
; constants definition
WSTATE_NORMAL = 00000000b
WSTATE_MAXIMIZED = 00000001b
91,24 → 53,20
WSTYLE_HASCAPTION = 00010000b
WSTYLE_CLIENTRELATIVE = 00100000b
 
struc TASKDATA
{
.event_mask dd ?
.pid dd ?
struct TASKDATA
event_mask dd ?
pid dd ?
dw ?
.state db ?
state db ?
db ?
dw ?
.wnd_number db ?
wnd_number db ?
db ?
.mem_start dd ?
.counter_sum dd ?
.counter_add dd ?
.cpu_usage dd ?
}
virtual at 0
TASKDATA TASKDATA
end virtual
mem_start dd ?
counter_sum dd ?
counter_add dd ?
cpu_usage dd ?
ends
 
TSTATE_RUNNING = 0
TSTATE_RUN_SUSPENDED = 1
119,92 → 77,78
TSTATE_FREE = 9
 
; structures definition
struc WDATA {
.box BOX
.cl_workarea dd ?
.cl_titlebar dd ?
.cl_frames dd ?
.reserved db ?
.fl_wstate db ?
.fl_wdrawn db ?
.fl_redraw db ?
.sizeof:
}
virtual at 0
WDATA WDATA
end virtual
struct WDATA
box BOX
cl_workarea dd ?
cl_titlebar dd ?
cl_frames dd ?
reserved db ?
fl_wstate db ?
fl_wdrawn db ?
fl_redraw db ?
ends
 
label WDATA.fl_wstyle byte at WDATA.cl_workarea + 3
 
struc APPDATA
{
.app_name db 11 dup(?)
db 5 dup(?)
struct DBG_REGS
dr0 dd ?
dr1 dd ?
dr2 dd ?
dr3 dd ?
dr7 dd ?
ends
 
.fpu_state dd ? ;+16
.ev_count_ dd ? ;unused ;+20
.exc_handler dd ? ;+24
.except_mask dd ? ;+28
.pl0_stack dd ? ;+32
.heap_base dd ? ;+36
.heap_top dd ? ;+40
.cursor dd ? ;+44
.fd_ev dd ? ;+48
.bk_ev dd ? ;+52
.fd_obj dd ? ;+56
.bk_obj dd ? ;+60
.saved_esp dd ? ;+64
.io_map rd 2 ;+68
.dbg_state dd ? ;+76
.cur_dir dd ? ;+80
.wait_timeout dd ? ;+84
.saved_esp0 dd ? ;+88
.wait_begin dd ? ;+92 +++
.wait_test dd ? ;+96 +++
.wait_param dd ? ;+100 +++
.tls_base dd ? ;+104
.dlls_list_ptr dd ? ;+108
db 16 dup(?) ;+112
struct APPDATA
app_name rb 11
rb 5
 
.wnd_shape dd ? ;+128
.wnd_shape_scale dd ? ;+132
fpu_state dd ? ;+16
ev_count_ dd ? ;unused ;+20
exc_handler dd ? ;+24
except_mask dd ? ;+28
pl0_stack dd ? ;+32
heap_base dd ? ;+36
heap_top dd ? ;+40
cursor dd ? ;+44
fd_ev dd ? ;+48
bk_ev dd ? ;+52
fd_obj dd ? ;+56
bk_obj dd ? ;+60
saved_esp dd ? ;+64
io_map rd 2 ;+68
dbg_state dd ? ;+76
cur_dir dd ? ;+80
wait_timeout dd ? ;+84
saved_esp0 dd ? ;+88
wait_begin dd ? ;+92 +++
wait_test dd ? ;+96 +++
wait_param dd ? ;+100 +++
tls_base dd ? ;+104
dlls_list_ptr dd ? ;+108
event_filter dd ? ;+112
rb 12 ;+116
 
wnd_shape dd ? ;+128
wnd_shape_scale dd ? ;+132
dd ? ;+136
.mem_size dd ? ;+140
.saved_box BOX
.ipc_start dd ?
.ipc_size dd ?
.event_mask dd ?
.debugger_slot dd ?
mem_size dd ? ;+140
saved_box BOX
ipc_start dd ?
ipc_size dd ?
event_mask dd ?
debugger_slot dd ?
dd ?
.keyboard_mode db ?
db 3 dup(?)
.dir_table dd ?
.dbg_event_mem dd ?
.dbg_regs:
.dbg_regs.dr0 dd ?
.dbg_regs.dr1 dd ?
.dbg_regs.dr2 dd ?
.dbg_regs.dr3 dd ?
.dbg_regs.dr7 dd ?
.wnd_caption dd ?
.wnd_clientbox BOX
}
virtual at 0
APPDATA APPDATA
end virtual
keyboard_mode db ?
rb 3
dir_table dd ?
dbg_event_mem dd ?
dbg_regs DBG_REGS
wnd_caption dd ?
wnd_clientbox BOX
 
;// mike.dld, 2006-29-01 ]
ends
 
struc MUTEX
{
.wait LHEAD
.count rd 1
}
 
virtual at 0
MUTEX MUTEX
end virtual
 
 
; Core functions
include "core/sync.inc" ; macros for synhronization objects
include "core/sys32.inc" ; process management
251,7 → 195,7
 
; display
 
include "video/vesa12.inc" ; Vesa 1.2 functions
;include "video/vesa12.inc" ; Vesa 1.2 functions
include "video/vesa20.inc" ; Vesa 2.0 functions
include "video/blitter.inc" ;
include "video/vga.inc" ; VGA 16 color functions
/kernel/branches/Kolibri-acpi/macros.inc
12,31 → 12,6
$Revision$
 
 
; structure definition helper
macro struct name, [arg]
{
common
name@struct equ name
struc name arg {
}
 
macro declare_sizeof xname,value
{ sizeof.#xname = value }
 
macro struct_helper name
{
match xname,name
\{
virtual at 0
xname xname
declare_sizeof xname, $ - xname
name equ sizeof.#xname
end virtual
\}
}
 
ends fix } struct_helper name@struct
 
;// mike.dld, 2006-29-01 [
 
; macros definition
/kernel/branches/Kolibri-acpi/network/eth_drv/arp.inc
67,7 → 67,8
endg
 
iglobal
NumARP: dd ARP_TABLE_ENTRIES
NumARP:
dd ARP_TABLE_ENTRIES
ARPTable_ptr dd ARPTable ;pointer to ARPTable
endg
 
/kernel/branches/Kolibri-acpi/network/eth_drv/drivers/3c59x.inc
344,42 → 344,68
e3c59x_upd_buff = e3c59x_dpd_buff+(E3C59X_DPD_SIZE*E3C59X_NUM_TX_DESC)
 
uglobal
e3c59x_curr_upd: dd 0
e3c59x_prev_dpd: dd 0
e3c59x_prev_tx_frame: dd 0
e3c59x_transmit_function: dd 0
e3c59x_receive_function: dd 0
e3c59x_curr_upd:
dd 0
e3c59x_prev_dpd:
dd 0
e3c59x_prev_tx_frame:
dd 0
e3c59x_transmit_function:
dd 0
e3c59x_receive_function:
dd 0
endg
 
iglobal
e3c59x_ver_id: db 17
e3c59x_ver_id:
db 17
endg
 
uglobal
e3c59x_full_bus_master: db 0
e3c59x_has_hwcksm: db 0
e3c59x_preamble: db 0
e3c59x_dn_list_ptr_cleared: db 0
e3c59x_self_directed_packet: rb 6
e3c59x_full_bus_master:
db 0
e3c59x_has_hwcksm:
db 0
e3c59x_preamble:
db 0
e3c59x_dn_list_ptr_cleared:
db 0
e3c59x_self_directed_packet:
rb 6
endg
 
if defined E3C59X_DEBUG
e3c59x_hw_type_str: db "Detected hardware type : ", 0
e3c59x_device_str: db "Device ID : 0x"
e3c59x_device_id_str: db "ffff", 13, 10, 0
e3c59x_vendor_str: db "Vendor ID : 0x"
e3c59x_vendor_id_str: db "ffff", 13, 10, 0
e3c59x_io_info_str: db "IO address : 0x"
e3c59x_io_addr_str: db "ffff", 13, 10, 0
e3c59x_mac_info_str: db "MAC address : "
e3c59x_mac_addr_str: db "ff:ff:ff:ff:ff:ff", 13, 10, 0
e3c59x_boomerang_str: db " (boomerang)", 13, 10, 0
e3c59x_vortex_str: db " (vortex)", 13, 10, 0
e3c59x_link_type_str: db "Established link type : ", 0
e3c59x_new_line_str: db 13, 10, 0
e3c59x_link_type: dd 0
e3c59x_hw_type_str:
db "Detected hardware type : ", 0
e3c59x_device_str:
db "Device ID : 0x"
e3c59x_device_id_str:
db "ffff", 13, 10, 0
e3c59x_vendor_str:
db "Vendor ID : 0x"
e3c59x_vendor_id_str:
db "ffff", 13, 10, 0
e3c59x_io_info_str:
db "IO address : 0x"
e3c59x_io_addr_str:
db "ffff", 13, 10, 0
e3c59x_mac_info_str:
db "MAC address : "
e3c59x_mac_addr_str:
db "ff:ff:ff:ff:ff:ff", 13, 10, 0
e3c59x_boomerang_str:
db " (boomerang)", 13, 10, 0
e3c59x_vortex_str:
db " (vortex)", 13, 10, 0
e3c59x_link_type_str:
db "Established link type : ", 0
e3c59x_new_line_str:
db 13, 10, 0
e3c59x_link_type:
dd 0
 
e3c59x_charset: db '0123456789abcdef'
e3c59x_charset:
db '0123456789abcdef'
 
strtbl e3c59x_link_str, \
"No valid link type detected", \
/kernel/branches/Kolibri-acpi/network/eth_drv/drivers/forcedeth.inc
819,7 → 819,8
jz @f
and eax, PCI_BASE_ADDRESS_IO_MASK
jmp .next
@@: push eax
@@:
push eax
and eax, PCI_BASE_ADDRESS_MEM_TYPE_MASK
cmp eax, PCI_BASE_ADDRESS_MEM_TYPE_64
jne .not64
878,7 → 879,8
jz @f
and eax, PCI_BASE_ADDRESS_IO_MASK
jmp .next2
@@: and eax, PCI_BASE_ADDRESS_MEM_MASK
@@:
and eax, PCI_BASE_ADDRESS_MEM_MASK
.next2:
; Find the lowest bit set
mov ecx, eax
913,7 → 915,8
je .ver1
mov dword [forcedeth_desc_ver], DESC_VER_2
jmp @f
.ver1: mov dword [forcedeth_desc_ver], DESC_VER_1
.ver1:
mov dword [forcedeth_desc_ver], DESC_VER_1
@@:
; read the mac address
; map memory
981,7 → 984,8
jne @f
or dword [forcedeth_txflags], NV_TX_LASTPACKET1
jmp .end_switch
@@: or dword [forcedeth_txflags], NV_TX2_LASTPACKET1
@@:
or dword [forcedeth_txflags], NV_TX2_LASTPACKET1
jmp .end_switch
 
.next_0x0086:
/kernel/branches/Kolibri-acpi/network/eth_drv/drivers/i8255x.inc
50,39 → 50,61
 
 
uglobal
eeprom_data: times 16 dd 0
eeprom_data:
times 16 dd 0
 
align 4
 
lstats:
tx_good_frames: dd 0
tx_coll16_errs: dd 0
tx_late_colls: dd 0
tx_underruns: dd 0
tx_lost_carrier: dd 0
tx_deferred: dd 0
tx_one_colls: dd 0
tx_multi_colls: dd 0
tx_total_colls: dd 0
rx_good_frames: dd 0
rx_crc_errs: dd 0
rx_align_errs: dd 0
rx_resource_errs: dd 0
rx_overrun_errs: dd 0
rx_colls_errs: dd 0
rx_runt_errs: dd 0
done_marker: dd 0
tx_good_frames:
dd 0
tx_coll16_errs:
dd 0
tx_late_colls:
dd 0
tx_underruns:
dd 0
tx_lost_carrier:
dd 0
tx_deferred:
dd 0
tx_one_colls:
dd 0
tx_multi_colls:
dd 0
tx_total_colls:
dd 0
rx_good_frames:
dd 0
rx_crc_errs:
dd 0
rx_align_errs:
dd 0
rx_resource_errs:
dd 0
rx_overrun_errs:
dd 0
rx_colls_errs:
dd 0
rx_runt_errs:
dd 0
done_marker:
dd 0
 
align 4
 
confcmd:
confcmd_status: dw 0
confcmd_command: dw 0
confcmd_link: dd 0
confcmd_status:
dw 0
confcmd_command:
dw 0
confcmd_link:
dd 0
endg
 
iglobal
confcmd_data: db 22, 0x08, 0, 0, 0, 0x80, 0x32, 0x03, 1
confcmd_data:
db 22, 0x08, 0, 0, 0, 0x80, 0x32, 0x03, 1
db 0, 0x2e, 0, 0x60, 0, 0xf2, 0x48, 0, 0x40, 0xf2
db 0x80, 0x3f, 0x05
endg
91,22 → 113,34
align 4
 
txfd:
txfd_status: dw 0
txfd_command: dw 0
txfd_link: dd 0
txfd_tx_desc_addr: dd 0
txfd_count: dd 0
txfd_tx_buf_addr0: dd 0
txfd_tx_buf_size0: dd 0
txfd_tx_buf_addr1: dd 0
txfd_tx_buf_size1: dd 0
txfd_status:
dw 0
txfd_command:
dw 0
txfd_link:
dd 0
txfd_tx_desc_addr:
dd 0
txfd_count:
dd 0
txfd_tx_buf_addr0:
dd 0
txfd_tx_buf_size0:
dd 0
txfd_tx_buf_addr1:
dd 0
txfd_tx_buf_size1:
dd 0
 
align 4
 
hdr:
hdr_dst_addr: times 6 db 0
hdr_src_addr: times 6 db 0
hdr_type: dw 0
hdr_dst_addr:
times 6 db 0
hdr_src_addr:
times 6 db 0
hdr_type:
dw 0
endg
 
 
757,4 → 791,4
mov edx, [io_addr]
in ax, dx
 
ret
ret
/kernel/branches/Kolibri-acpi/network/eth_drv/drivers/rtl8029.inc
143,29 → 143,46
ISA_MAX_ADDR equ 0x400
 
uglobal
eth_flags: db 0
eth_vendor: db 0
eth_nic_base: dw 0
eth_asic_base: dw 0
eth_memsize: db 0
eth_rx_start: db 0
eth_tx_start: db 0
eth_bmem: dd 0
eth_rmem: dd 0
romdata: db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
eth_flags:
db 0
eth_vendor:
db 0
eth_nic_base:
dw 0
eth_asic_base:
dw 0
eth_memsize:
db 0
eth_rx_start:
db 0
eth_tx_start:
db 0
eth_bmem:
dd 0
eth_rmem:
dd 0
romdata:
db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
endg
 
iglobal
test_data: db 'NE*000 memory',0
test_buffer: db ' ',0
test_data:
db 'NE*000 memory',0
test_buffer:
db ' ',0
endg
 
uglobal
eth_type: dw 0
pkthdr: db 0,0,0,0 ; status, next, (short) len
pktoff: dw 0
eth_rx_data_ptr: dd 0
eth_tmp_len: dw 0
eth_type:
dw 0
pkthdr:
db 0,0,0,0 ; status, next, (short) len
pktoff:
dw 0
eth_rx_data_ptr:
dd 0
eth_tmp_len:
dw 0
endg
 
 
/kernel/branches/Kolibri-acpi/network/eth_drv/drivers/rtl8139.inc
183,18 → 183,21
 
uglobal
align 4
rtl8139_rx_buff_offset: dd 0
rtl8139_rx_buff_offset:
dd 0
curr_tx_desc dd 0
endg
 
iglobal
hw_ver_array: db VER_RTL8139, VER_RTL8139A, VER_RTL8139B, VER_RTL8139C
hw_ver_array:
db VER_RTL8139, VER_RTL8139A, VER_RTL8139B, VER_RTL8139C
db VER_RTL8100, VER_RTL8139D, VER_RTL8139CP, VER_RTL8101
HW_VER_ARRAY_SIZE = $-hw_ver_array
endg
 
uglobal
hw_ver_id: db 0
hw_ver_id:
db 0
endg
 
;***************************************************************************
/kernel/branches/Kolibri-acpi/network/eth_drv/drivers/rtl8169.inc
550,7 → 550,8
jz @f
and eax,PCI_BASE_ADDRESS_IO_MASK
jmp .exit
@@: push eax
@@:
push eax
and eax,PCI_BASE_ADDRESS_MEM_TYPE_MASK
cmp eax,PCI_BASE_ADDRESS_MEM_TYPE_64
jne .not64
583,7 → 584,8
 
; Check that the chip has finished the reset
mov ecx,1000
@@: RTL_R8 RTL8169_REG_ChipCmd
@@:
RTL_R8 RTL8169_REG_ChipCmd
test al,RTL8169_CMD_Reset
jz @f
stdcall udelay,10
594,7 → 596,8
and eax,0x7c800000
; DEBUGF 1,"K : rtl8169_init_board: TxConfig & 0x7c800000 = 0x%x\n",eax
mov esi,mac_info-8
@@: add esi,8
@@:
add esi, 8
mov ecx,eax
and ecx,[esi]
cmp ecx,[esi]
609,7 → 612,8
jnz @f
mov [rtl8169_tpc.pcfg],PCFG_METHOD_1
jmp .pconf
@@: dec al
@@:
dec al
jnz .pconf
mov [rtl8169_tpc.pcfg],PCFG_METHOD_2
.pconf:
617,7 → 621,8
; identify chip attached to board
mov ecx,10
mov eax,[rtl8169_tpc.mcfg]
@@: dec ecx
@@:
dec ecx
js @f
cmp eax,[rtl_chip_info+ecx*8]
jne @b
661,7 → 666,8
je @f
cmp [rtl8169_tpc.mcfg],MCFG_METHOD_03
jne .not_2_or_3
@@: stdcall RTL8169_WRITE_GMII_REG,0x1F,0x0001
@@:
stdcall RTL8169_WRITE_GMII_REG, 0x1F, 0x0001
stdcall RTL8169_WRITE_GMII_REG,0x15,0x1000
stdcall RTL8169_WRITE_GMII_REG,0x18,0x65C7
stdcall RTL8169_WRITE_GMII_REG,0x04,0x0000
727,7 → 733,8
 
mov ecx,2000
; Check if the RTL8169 has completed writing to the specified MII register
@@: RTL_R32 RTL8169_REG_PHYAR
@@:
RTL_R32 RTL8169_REG_PHYAR
test eax,0x80000000
jz .exit
stdcall udelay,1 ;;;100
749,7 → 756,8
 
mov ecx,2000
; Check if the RTL8169 has completed retrieving data from the specified MII register
@@: RTL_R32 RTL8169_REG_PHYAR
@@:
RTL_R32 RTL8169_REG_PHYAR
test eax,0x80000000
jnz .exit
stdcall udelay,1 ;;;100
802,7 → 810,8
mov edi,rtl8169_tpc.Tx_skbuff
mov eax,rtl8169_txb
mov ecx,NUM_TX_DESC
@@: stosd
@@:
stosd
inc eax ; add eax,RX_BUF_SIZE ???
loop @b
 
818,7 → 827,8
mov edi,[rtl8169_tpc.RxDescArray]
mov eax,rtl8169_rxb
mov ecx,NUM_RX_DESC
@@: mov [esi],eax
@@:
mov [esi], eax
mov [edi+rtl8169_RxDesc.buf_addr],eax
sub [edi+rtl8169_RxDesc.buf_addr],OS_BASE ; shurf 28.09.2008
mov [edi+rtl8169_RxDesc.status],RTL8169_DSB_OWNbit or RX_BUF_SIZE
840,7 → 850,8
RTL_W8 RTL8169_REG_ChipCmd,RTL8169_CMD_Reset
; Check that the chip has finished the reset
mov ecx,1000
@@: RTL_R8 RTL8169_REG_ChipCmd
@@:
RTL_R8 RTL8169_REG_ChipCmd
and al,RTL8169_CMD_Reset
jz @f
stdcall udelay,10
872,7 → 883,8
; DEBUGF 1,"K : Set MAC Reg C+CR Offset 0xE0: bit-3 and bit-14\n"
jmp .set
@@:;DEBUGF 1,"K : Set MAC Reg C+CR Offset 0xE0: bit-3\n"
.set: RTL_W16 RTL8169_REG_CPlusCmd,ax
.set:
RTL_W16 RTL8169_REG_CPlusCmd,ax
 
; RTL_W16 0xE2,0x1517
; RTL_W16 0xE2,0x152a
929,7 → 941,8
add edx,RTL8169_REG_MAC0
xor ebx,ebx
; Get MAC address. FIXME: read EEPROM
@@: RTL_R8 dx
@@:
RTL_R8 dx
mov [node_addr+ebx],al
inc edx
inc ebx
969,7 → 982,8
stdcall udelay,100
mov ecx,10000
; wait for auto-negotiation process
@@: dec ecx
@@:
dec ecx
jz @f
stdcall RTL8169_READ_GMII_REG,RTL8169_PHY_STAT_REG
stdcall udelay,100
1081,12 → 1095,14
and ecx,0x0FFF
xor al,al
add edi,ecx
@@: cmp ecx,ETH_ZLEN
@@:
cmp ecx, ETH_ZLEN
jae @f
stosb
inc ecx
jmp @b
@@: pop eax
@@:
pop eax
 
mov ebx,eax
mov eax,sizeof.rtl8169_TxDesc
1100,11 → 1116,13
cmp eax,ETH_ZLEN
jae @f
mov eax,ETH_ZLEN
@@: or eax,RTL8169_DSB_OWNbit or RTL8169_DSB_FSbit or RTL8169_DSB_LSbit
@@:
or eax, RTL8169_DSB_OWNbit or RTL8169_DSB_FSbit or RTL8169_DSB_LSbit
cmp [rtl8169_tpc.cur_tx],NUM_TX_DESC - 1
jne @f
or eax,RTL8169_DSB_EORbit
@@: mov [ebx + rtl8169_TxDesc.status],eax
@@:
mov [ebx + rtl8169_TxDesc.status], eax
 
RTL_W8 RTL8169_REG_TxPoll,0x40 ; set polling bit
 
1114,7 → 1132,8
;!!! to = currticks() + TX_TIMEOUT;
;!!! while ((tpc->TxDescArray[entry].status & OWNbit) && (currticks() < to)); /* wait */
mov ecx,TX_TIMEOUT / 10
@@: test [ebx + rtl8169_TxDesc.status],RTL8169_DSB_OWNbit
@@:
test [ebx + rtl8169_TxDesc.status], RTL8169_DSB_OWNbit
jnz @f
stdcall udelay,10
loop @b
1195,7 → 1214,8
cmp [rtl8169_tpc.cur_rx],NUM_RX_DESC - 1
jne @f
or eax,RTL8169_DSB_EORbit
@@: mov [ebx + rtl8169_RxDesc.status],eax
@@:
mov [ebx + rtl8169_RxDesc.status], eax
 
mov [ebx + rtl8169_RxDesc.buf_addr],edx
sub [ebx + rtl8169_RxDesc.buf_addr],OS_BASE ; shurf 28.09.2008
/kernel/branches/Kolibri-acpi/network/eth_drv/drivers/sis900.inc
80,8 → 80,10
 
uglobal
align 4
txd: times (3 * NUM_TX_DESC) dd 0
rxd: times (3 * NUM_RX_DESC) dd 0
txd:
times (3 * NUM_TX_DESC) dd 0
rxd:
times (3 * NUM_RX_DESC) dd 0
endg
 
txb equ eth_data_start
218,7 → 220,8
SIS900_EEDONE equ 0x00000200
SIS900_EEGNT equ 0x00000100
;General Varibles
SIS900_pci_revision: db 0
SIS900_pci_revision:
db 0
SIS900_Status dd 0x03000000
sis900_specific_table:
; dd SIS630A_900_REV,Get_Mac_SIS630A_900_REV,0
230,9 → 233,12
dd SIS900_960_REV,SIS960_get_mac_addr,0
dd SIS900B_900_REV,SIS900_get_mac_addr,0
dd 0,0,0,0 ; end of list
sis900_get_mac_func: dd 0
sis900_special_func: dd 0
sis900_table_entries: db 8
sis900_get_mac_func:
dd 0
sis900_special_func:
dd 0
sis900_table_entries:
db 8
 
;***************************************************************************
; Function
567,7 → 573,8
;* 0x00600000 = 128 bytes
;* 0x00700000 = 256 bytes
;***************************************************************************
SIS900_mc_filter: times 16 dw 0
SIS900_mc_filter:
times 16 dw 0
SIS900_set_rx_mode:
mov ebp,[io_addr]
;**************update Multicast Hash Table in Receive Filter
1081,7 → 1088,8
 
SIS900_Char_String db '0','1','2','3','4','5','6','7','8','9'
db 'A','B','C','D','E','F'
Mac_str_build: times 20 db 0
Mac_str_build:
times 20 db 0
Create_Mac_String:
pusha
xor ecx, ecx
/kernel/branches/Kolibri-acpi/network/eth_drv/ethernet.inc
126,28 → 126,29
dd 0x12298086, I8255x_probe, I8255x_reset, I8255x_poll, I8255x_transmit, 0
dd 0x10308086, I8255x_probe, I8255x_reset, I8255x_poll, I8255x_transmit, 0
dd 0x24498086, I8255x_probe, I8255x_reset, I8255x_poll, I8255x_transmit, 0
dd 0x10688086, I8255x_probe, I8255x_reset, I8255x_poll, I8255x_transmit, 0
 
dd 0x802910ec, rtl8029_probe, rtl8029_reset, rtl8029_poll, rtl8029_transmit, 0
 
;dd 0x813910ec, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
;dd 0x813810ec, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
;dd 0x12111113, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
;dd 0x13601500, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
;dd 0x13604033, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
;dd 0x13001186, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
;dd 0x13401186, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
;dd 0xab0613d1, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
;dd 0xa1171259, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
;dd 0xa11e1259, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
;dd 0xab0614ea, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
;dd 0xab0714ea, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
;dd 0x123411db, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
;dd 0x91301432, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
;dd 0x101202ac, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
;dd 0x0106018a, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
;dd 0x1211126c, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
;dd 0x81391743, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
;dd 0x8139021b, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
dd 0x813910ec, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
dd 0x813810ec, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
dd 0x12111113, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
dd 0x13601500, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
dd 0x13604033, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
dd 0x13001186, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
dd 0x13401186, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
dd 0xab0613d1, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
dd 0xa1171259, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
dd 0xa11e1259, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
dd 0xab0614ea, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
dd 0xab0714ea, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
dd 0x123411db, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
dd 0x91301432, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
dd 0x101202ac, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
dd 0x0106018a, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
dd 0x1211126c, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
dd 0x81391743, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
dd 0x8139021b, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
 
dd 0x816810ec, rtl8169_probe, rtl8169_reset, rtl8169_poll, rtl8169_transmit, 0
dd 0x816910ec, rtl8169_probe, rtl8169_reset, rtl8169_poll, rtl8169_transmit, 0
243,31 → 244,49
 
uglobal
;Net-stack's interface's settings
node_addr: db 0,0,0,0,0,0
gateway_ip: dd 0
dns_ip: dd 0
node_addr:
db 0,0,0,0,0,0
gateway_ip:
dd 0
dns_ip:
dd 0
 
eth_rx_data_len: dw 0
eth_status: dd 0
io_addr: dd 0
hdrtype: db 0
vendor_device: dd 0
pci_data: dd 0
pci_dev: dd 0
pci_bus: dd 0
eth_rx_data_len:
dw 0
eth_status:
dd 0
io_addr:
dd 0
hdrtype:
db 0
vendor_device:
dd 0
pci_data:
dd 0
pci_dev:
dd 0
pci_bus:
dd 0
 
; These will hold pointers to the selected driver functions
drvr_probe: dd 0
drvr_reset: dd 0
drvr_poll: dd 0
drvr_transmit: dd 0
drvr_cable: dd 0
drvr_probe:
dd 0
drvr_reset:
dd 0
drvr_poll:
dd 0
drvr_transmit:
dd 0
drvr_cable:
dd 0
 
endg
 
iglobal
broadcast_add: db 0xff,0xff,0xff,0xff,0xff,0xff
subnet_mask: dd 0x00ffffff ; 255.255.255.0
broadcast_add:
db 0xff,0xff,0xff,0xff,0xff,0xff
subnet_mask:
dd 0x00ffffff ; 255.255.255.0
endg
 
include "arp.inc" ;arp-protocol functions
/kernel/branches/Kolibri-acpi/network/eth_drv/pci.inc
348,4 → 348,4
mov [io_addr], eax
 
sb_exit2:
ret
ret
/kernel/branches/Kolibri-acpi/network/socket.inc
31,31 → 31,31
 
; socket data structure
struct SOCKET
.PrevPtr dd ? ; pointer to previous socket in list
.NextPtr dd ? ; pointer to next socket in list
.Number dd ? ; socket number (unique within single process)
.PID dd ? ; application process id
.LocalIP dd ? ; local IP address
.LocalPort dw ? ; local port
.RemoteIP dd ? ; remote IP address
.RemotePort dw ? ; remote port
.OrigRemoteIP dd ? ; original remote IP address (used to reset to LISTEN state)
.OrigRemotePort dw ? ; original remote port (used to reset to LISTEN state)
.rxDataCount dd ? ; rx data count
.TCBState dd ? ; TCB state
.TCBTimer dd ? ; TCB timer (seconds)
.ISS dd ? ; initial send sequence
.IRS dd ? ; initial receive sequence
.SND_UNA dd ? ; sequence number of unack'ed sent packets
.SND_NXT dd ? ; bext send sequence number to use
.SND_WND dd ? ; send window
.RCV_NXT dd ? ; next receive sequence number to use
.RCV_WND dd ? ; receive window
.SEG_LEN dd ? ; segment length
.SEG_WND dd ? ; segment window
.wndsizeTimer dd ? ; window size timer
.lock MUTEX ; lock mutex
.rxData dd ? ; receive data buffer here
PrevPtr dd ? ; pointer to previous socket in list
NextPtr dd ? ; pointer to next socket in list
Number dd ? ; socket number (unique within single process)
PID dd ? ; application process id
LocalIP dd ? ; local IP address
LocalPort dw ? ; local port
RemoteIP dd ? ; remote IP address
RemotePort dw ? ; remote port
OrigRemoteIP dd ? ; original remote IP address (used to reset to LISTEN state)
OrigRemotePort dw ? ; original remote port (used to reset to LISTEN state)
rxDataCount dd ? ; rx data count
TCBState dd ? ; TCB state
TCBTimer dd ? ; TCB timer (seconds)
ISS dd ? ; initial send sequence
IRS dd ? ; initial receive sequence
SND_UNA dd ? ; sequence number of unack'ed sent packets
SND_NXT dd ? ; bext send sequence number to use
SND_WND dd ? ; send window
RCV_NXT dd ? ; next receive sequence number to use
RCV_WND dd ? ; receive window
SEG_LEN dd ? ; segment length
SEG_WND dd ? ; segment window
wndsizeTimer dd ? ; window size timer
mutex MUTEX ; lock mutex
rxData dd ? ; receive data buffer here
ends
 
; TCP opening modes
100,7 → 100,7
pop eax
 
mov ebx, eax
lea ecx, [eax+SOCKET.lock]
lea ecx, [eax+SOCKET.mutex]
call mutex_init
mov eax, ebx
 
473,7 → 473,8
cmp esi, SOCKET_PASSIVE
je @f
mov ebx, TCB_SYN_SENT
@@: mov [eax + SOCKET.TCBState], ebx ; Indicate the state of the TCB
@@:
mov [eax + SOCKET.TCBState], ebx ; Indicate the state of the TCB
 
cmp ebx, TCB_LISTEN
je .exit
570,7 → 571,8
add esi, 8
jmp .next_resendq
 
@@: mov dword[esi + 4], 0
@@:
mov dword[esi + 4], 0
inc ecx
add esi, 8
jmp .next_resendq
709,7 → 711,7
jz .error
 
mov ebx, eax
lea ecx, [eax + SOCKET.lock]
lea ecx, [eax + SOCKET.mutex]
call mutex_lock
 
mov eax, [ebx + SOCKET.rxDataCount] ; get count of bytes
732,7 → 734,7
and ecx, 3
rep movsb
 
lea ecx, [ebx + SOCKET.lock]
lea ecx, [ebx + SOCKET.mutex]
mov ebx, eax
call mutex_unlock
mov eax, ebx
739,7 → 741,7
ret
 
.error_release:
lea ecx, [ebx + SOCKET.lock]
lea ecx, [ebx + SOCKET.mutex]
call mutex_unlock
.error:
xor ebx, ebx
767,7 → 769,7
mov ebx, eax
 
push ecx edx
lea ecx, [eax + SOCKET.lock]
lea ecx, [eax + SOCKET.mutex]
call mutex_lock
pop edx ecx
 
800,7 → 802,7
rep movsb ; copy remaining bytes
 
.exit:
lea ecx, [ebx + SOCKET.lock]
lea ecx, [ebx + SOCKET.mutex]
mov ebx,eax
call mutex_unlock
mov eax,ebx
814,7 → 816,7
xor esi, esi
mov [ebx + SOCKET.rxDataCount], esi ; store new count (zero)
call .start_copy
lea ecx, [ebx + SOCKET.lock]
lea ecx, [ebx + SOCKET.mutex]
mov ebx,eax
call mutex_unlock
mov eax,ebx
961,7 → 963,8
jnz @f
mov ax, 0xffff
 
@@: xchg al, ah
@@:
xchg al, ah
mov [edx + 20 + UDP_PACKET.Checksum], ax
 
; Fill in the IP header checksum
1079,7 → 1082,8
add esi, 8
jmp .next_resendq
 
@@: push ebx
@@:
push ebx
 
; OK, we have a buffer descriptor ptr in esi.
; resend entry # in ecx
1098,7 → 1102,8
; Now get buffer location, and copy buffer across. argh! more copying,,
mov edi, resendBuffer - IPBUFFSIZE
 
@@: add edi, IPBUFFSIZE
@@:
add edi, IPBUFFSIZE
loop @b
 
; we have dest buffer location in edi
/kernel/branches/Kolibri-acpi/network/stack.inc
36,10 → 36,14
uglobal
StackCounters:
dumped_rx_count dd 0
arp_tx_count: dd 0
arp_rx_count: dd 0
ip_rx_count: dd 0
ip_tx_count: dd 0
arp_tx_count:
dd 0
arp_rx_count:
dd 0
ip_rx_count:
dd 0
ip_tx_count:
dd 0
endg
 
; socket buffers
/kernel/branches/Kolibri-acpi/network/tcp.inc
669,7 → 669,8
add esi, 8
jmp .next_resendq
 
@@: mov dword[esi + 4], 0
@@:
mov dword[esi + 4], 0
inc ecx
add esi, 8
jmp .next_resendq
911,7 → 912,8
add esi, 8
jmp .next_resendq
 
@@: mov dword[esi + 4], 0
@@:
mov dword[esi + 4], 0
inc ecx
add esi, 8
jmp .next_resendq
965,7 → 967,7
.data:
push ecx
push ecx edx
lea ecx, [ebx+SOCKET.lock]
lea ecx, [ebx+SOCKET.mutex]
call mutex_lock
pop edx ecx
 
987,7 → 989,7
cld
rep movsb ; copy the data across
 
lea ecx,[ebx + SOCKET.lock]
lea ecx, [ebx + SOCKET.mutex]
call mutex_unlock
 
; flag an event to the application
1033,7 → 1035,7
.overflow:
; no place in buffer
; so simply restore stack and exit
lea ecx, [ebx + SOCKET.lock]
lea ecx, [ebx + SOCKET.mutex]
call mutex_unlock
pop eax ecx
ret
1052,12 → 1054,14
mov [ebx + SOCKET.TCBState], TCB_FIN_WAIT_2
jmp .exit
 
@@: mov [ebx + SOCKET.TCBState], TCB_CLOSING
@@:
mov [ebx + SOCKET.TCBState], TCB_CLOSING
cmp al, TH_FIN
je @f
mov [ebx + SOCKET.TCBState], TCB_TIMED_WAIT
 
@@: lea esi, [ebx + SOCKET.RCV_NXT]
@@:
lea esi, [ebx + SOCKET.RCV_NXT]
call inc_inet_esi
 
; Send an ACK
/kernel/branches/Kolibri-acpi/sec_loader/trunk/boot/after_win/kordldr.win.asm
47,7 → 47,8
mov si, load_question + 100h - 600h
call out_string
; mov si, answer + 100h - 0600h ; already is
xxy: mov ah, 0
xxy:
mov ah, 0
int 16h
or al, 20h
mov [si], al
904,7 → 905,8
 
rootcache_size dw ? ; must be immediately before foldcache_clus
if $-dat >= 0x80
warning: unoptimal data displacement!
warning:
unoptimal data displacement!
end if
foldcache_clus rd 7
foldcache_mark rw 7
912,7 → 914,8
fat_filename rb 11
 
if $ > 2000h
error: file is too big
error:
file is too big
end if
 
; for NT/2k/XP, file must be 16 sectors = 0x2000 bytes long
/kernel/branches/Kolibri-acpi/sec_loader/trunk/boot/fat1x/kordldr.f1x.asm
663,5 → 663,6
foldcache_size rw 7
filename rb 11
if $ > 0x8200
error: table overwritten
error:
table overwritten
end if
/kernel/branches/Kolibri-acpi/sec_loader/trunk/boot/mkfloppy.inc
82,9 → 82,10
 
macro stof id, name
{
id#_base: file name
id#_base:
file name
id#_size=$-id#_base
reset id
}
 
defdir fix macro
defdir fix macro
/kernel/branches/Kolibri-acpi/sec_loader/trunk/kolibri_ldm/bootstr.inc
35,7 → 35,8
; store byte ' ' at d80x25_top+cur_line_pos
; store dword ' SVN' at d80x25_top+cur_line_pos-4
 
space_msg: line_space
space_msg:
line_space
;verstr:
; line_space
; version string
/kernel/branches/Kolibri-acpi/sec_loader/trunk/kolibri_ldm/bootvesa.inc
93,7 → 93,8
push edx
call int2str
pop eax
@@: or al,0x30
@@:
or al, 0x30
mov [ds:di],al
inc di
ret
106,7 → 107,8
push edx
call int2strnz
pop eax
@@: or al,0x30
@@:
or al, 0x30
mov [es:di],al
inc di
ret
243,7 → 245,8
jb .lp1
 
or cx,0x4000 ; use LFB
.lp1: mov [es:bx+6],cx ; +6 : mode number
.lp1:
mov [es:bx+6], cx ; +6 : mode number
movzx ax,byte [es:mi.BitsPerPixel]
mov word [es:bx+8],ax ; +8 : bits per pixel
add bx,size_of_step ; size of record
402,7 → 405,8
 
mov ecx,long_v_table
 
.loop: add ax,size_of_step
.loop:
add ax, size_of_step
cmp ax,word [end_cursor]
jae .next_step
loop .loop
435,13 → 439,16
je .ok
cmp word [es:si+8],24
je .ok
.next: add si,size_of_step
.next:
add si, size_of_step
cmp word [es:si],-1
je .exit
jmp .loops
.ok: xor ax,ax
.ok:
xor ax, ax
ret
.exit: or ax,-1
.exit:
or ax, -1
ret
 
 
484,7 → 491,8
jmp .ok
 
 
.low: sub cx,size_of_step
.low:
sub cx, size_of_step
cmp cx,modes_table
jb .ok
push cx
/kernel/branches/Kolibri-acpi/sec_loader/trunk/kolibri_ldm/kolibri_ldm.asm
455,7 → 455,8
sub word [cursor_pos],size_of_step
jmp .loops
 
.down: cmp ah,0x50;x,0x50E0 ; down
.down:
cmp ah, 0x50;x,0x50E0 ; down
jne .pgup
cmp word[es:si+10],-1
je .loops
462,7 → 463,8
add word [cursor_pos],size_of_step
jmp .loops
 
.pgup: cmp ah,0x49 ; page up
.pgup:
cmp ah, 0x49 ; page up
jne .pgdn
sub si, size_of_step*long_v_table
cmp si, modes_table
479,7 → 481,8
mov word [home_cursor], si
jmp .loops
 
.pgdn: cmp ah,0x51 ; page down
.pgdn:
cmp ah, 0x51 ; page down
jne .enter
mov ax, [end_cursor]
add si, size_of_step*long_v_table
499,7 → 502,8
mov word [home_cursor], si
jmp .loops
 
.enter: cmp al,0x0D;x,0x1C0D ; enter
.enter:
cmp al, 0x0D;x,0x1C0D ; enter
jne .loops
push word [cursor_pos]
pop bp
535,7 → 539,8
popf
jz @f
mov si, off_msg
@@: jmp printplain
@@:
jmp printplain
; novesa and vervesa strings are not used at the moment of executing this code
virtual at novesa
.oldtimer dd ?
576,7 → 581,8
mov cl, 'ã'
jz @f
mov cl, 'ë'
@@: mov [time_str+9], cl
@@:
mov [time_str+9], cl
else if lang eq et
cmp al, 1
ja @f
589,7 → 595,8
mov cl, 's'
ja @f
mov cl, ' '
@@: mov [time_str+9], cl
@@:
mov [time_str+9], cl
end if
add al, '0'
mov [time_str+1], al
/kernel/branches/Kolibri-acpi/sec_loader/trunk/parse_any.inc
219,7 → 219,8
mov point_default,ax
jmp .show_active_cursor
 
@@: call find_next_sect
@@:
call find_next_sect
jmp .show_all_scr
 
.pgup:
624,7 → 625,8
push di
xor ax,ax
 
@@: mov cx,38
@@:
mov cx, 38
push di
rep stosw
pop di
637,7 → 639,8
dec bx
jnz @b
 
@@: pop di
@@:
pop di
;enter in mess
.show_mess_prev_eq:
lodsb
/kernel/branches/Kolibri-acpi/sec_loader/trunk/parse_def_sect.inc
135,7 → 135,8
mov word [es:di-4],ax
mov word [es:di-2],16 ;êîë-âî áëîêîâ ïî 4 êá =64 êá ò.å. áîëüøå íå ñ÷èòàåì
;;;;;; ïîèñê êîíöà ñòðî÷êè
@@: mov al,byte [es:di]
@@:
mov al, byte [es:di]
cmp al,' '
jz .found_end_str
cmp al,0xa
280,7 → 281,8
;;;;;;;;;;;;;;;;;;;;;;;;;;
xor bx,bx
mov cx,5
@@: mov al,byte [es:di]
@@:
mov al, byte [es:di]
cmp al,'0'
jb .CS
cmp al,'9'
494,9 → 496,11
test ax,ax
jnz @f ;îøèáêà åñëè ñþäà ïðûãíóëè âñå òàêè ...
 
.RS1: mov word [fat12_buffer.BPB_BytsPerSec],512
.RS1:
mov word [fat12_buffer.BPB_BytsPerSec], 512
;;;;;;;;;;ñêàæåì ÷òî ïî äåôîëòó áóäåì þçàòü çíà÷åíèå...
@@: mov word [fat12_buffer.BPB_BytsPerSec],ax ;òóò âñå îê
@@:
mov word [fat12_buffer.BPB_BytsPerSec], ax;òóò âñå îê
 
;BPB_SecPerClus êîë-âî ñåêòîðîâ â êëàñòåðå
use_RamdiskCluster ;âîçðàùàåìîå çíà÷åíèå â al
758,7 → 762,8
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
xor bx,bx
mov cx,4
@@: movzx ax,byte [es:di]
@@:
movzx ax, byte [es:di]
cmp al,'0'
jb .end_RamdiskSector
cmp al,'9'
852,7 → 857,8
inc cx
dec di
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@: movzx ax,byte [es:di]
@@:
movzx ax, byte [es:di]
cmp al,'0'
jb .end_RamdiskCluster
cmp al,'9'
955,7 → 961,8
mov word [es:di-4],ax
mov word [es:di-2],16 ;êîë-âî áëîêîâ ïî 4 êá =64 êá ò.å. áîëüøå íå ñ÷èòàåì
;;;;;; ïîèñê êîíöà ñòðî÷êè
@@: mov al,byte [es:di]
@@:
mov al, byte [es:di]
cmp al,' '
jz .found_end_str
cmp al,0xa
1089,7 → 1096,8
;ñîõðàíèëè ïåâûå 2 word
 
;
@@: mov al,byte [es:di]
@@:
mov al, byte [es:di]
cmp al,',' ; ò.å. èùåì ðàçäåëèòåëü
jz .found_end_str
inc di
1430,7 → 1438,8
mov si,shot_name_fat
mov cx,11
;çàïèøåì â ñòðóêòóðó èìÿ
@@: lodsb
@@:
lodsb
stosb
loop @b
 
1489,7 → 1498,8
;ìû îáðàáîòàåì çàïèñü äëÿ ôàò ïîëíîñòüþ, â íå çàâèñèìîñòè îò ïðåäåëà áóôåðà ãäå âîçìîæíà ÷àñòü ôàéëà.
mov ebx,save_file_size ;ðàçìåð ôàéëà â áàéòàõ
@@: sub ebx,eax
@@:
sub ebx, eax
cmp ebx,eax
jbe .eof_file
 
1510,7 → 1520,8
add cx,ax
jmp @b
 
.step2: and cx,0x0FFF
.step2:
and cx, 0x0FFF
mov word[es:si],cx
inc si
add cx,ax
1524,10 → 1535,12
mov word[es:si],cx
jmp .end
 
.step3: and cx,0x0FFF
.step3:
and cx, 0x0FFF
mov word[es:si],cx
 
.end: inc point_next_fat_str
.end:
inc point_next_fat_str
 
pop di
;DIR_FileSize 32-áèòíûé DWORD ñîäåðæèò ðàçìåð ôàéëà â áàéòàõ.
1549,7 → 1562,8
mov cx,11
 
;çàïèøåì â ñòðóêòóðó èìÿ
@@: mov al,byte [es:di]
@@:
mov al, byte [es:di]
inc di
mov byte [ds:si],al
inc si
1776,7 → 1790,8
lea si,[check_name_fat_msg_y]
call printplain
lea si,[alarm_msg]
@@: call printplain
@@:
call printplain
popad
end if
 
1883,23 → 1898,28
jbe .st2_l
xor al,0x20 ;ñäåëàåì çàãëàâíûå áóêâû
.st2_l: mov byte [si],al
.st2_l:
mov byte [si], al
inc di
inc si
; dec cx
; jnz @b
loop @b
.st5: xor ax,ax
.st5:
xor ax, ax
jmp @f
 
;;;;;;;;ôàéë çàêîí÷èëñÿ, è íóæíî âíåñòè â êîíåö ïðîáåëû
.st4_s: mov al,' '
.st4: mov byte [si],al
.st4_s:
mov al, ' '
.st4:
mov byte [si], al
inc si
loop .st4
jmp .st5
 
.error: or ax,-1
.error:
or ax, -1
@@:
 
if DEBUG
1909,7 → 1929,8
test ax,ax
jz @f
mov si,convertion_file_name_msg_n
@@: call printplain
@@:
call printplain
 
mov si,shot_name_fat
mov byte [si+12],0
1971,7 → 1992,8
 
mov dl,0x10
 
@@: cmp eax,0x00010000
@@:
cmp eax, 0x00010000
jb @f
 
sub eax,0x00010000
1979,7 → 2001,8
jmp @b
 
 
@@: mov byte [si+8*3+3],dl ;êóäà ïèñàòü
@@:
mov byte [si+8*3+3], dl ;êóäà ïèñàòü
mov word [si+8*3+2],ax
 
mov ecx,save_file_size ;ðàçìåð ôàéëà â áàéòàõ.
2000,13 → 2023,15
;/óçíàåì ðàçìåð êëàñòåðà
pop eax ;restore size of claster
push ecx
@@: inc data_offset
@@:
inc data_offset
 
cmp eax,ecx
jae @f
sub ecx,eax
jmp @b
@@: pop ecx
@@:
pop ecx
 
 
 
2014,7 → 2039,8
test ecx,0x1
jz .st1
inc ecx
.st1: shr ecx,1 ; ïðåîáðàçîâàòü çíà÷åíèå äëÿ 0x87 function
.st1:
shr ecx, 1 ; ïðåîáðàçîâàòü çíà÷åíèå äëÿ 0x87 function
 
;ïåðåíåñåì áëîê çà 1 ìá
push es
2068,7 → 2094,8
test ecx,0x1
jz .st1
inc ecx
.st1: shr ecx,1
.st1:
shr ecx, 1
 
push es
push ds
/kernel/branches/Kolibri-acpi/sec_loader/trunk/parse_loader.inc
130,7 → 130,8
mov bx,cx
mov dx,di
 
@@: mov al,byte [es:di]
@@:
mov al, byte [es:di]
inc di
dec cx
test cx,cx
291,7 → 292,8
push cx
xor bx,bx
mov cx,2
@@: mov al,byte [es:di]
@@:
mov al, byte [es:di]
cmp al,'0'
jb .end_get_val_t
cmp al,'9'
317,7 → 319,8
mov word [value_timeout],default_timeout_value
mov si,set_default_timeout_val
call printplain
@@: pop cx
@@:
pop cx
jmp .get_next_str
 
;///////here end block loader
/kernel/branches/Kolibri-acpi/sec_loader/trunk/sl_proc.inc
48,7 → 48,8
push edx
call decode
pop eax
@@: or al,0x30
@@:
or al, 0x30
mov [ds:di],al
inc di
ret
146,7 → 147,8
.not_space:
cmp al,';'
jz .first_com
.exit: ret
.exit:
ret
;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
show_name_section:
226,8 → 228,9
jz @f
cmp al,"'"
jnz .end_sh_name_sec
@@: lodsb
@@:
lodsb
@@:
stosw
lodsb
cmp al,'"'
473,7 → 476,8
push dx
call .decode
pop ax
@@: or al,0x30
@@:
or al, 0x30
push ax
mov ah,9
stosw
/kernel/branches/Kolibri-acpi/unpacker.inc
219,7 → 219,8
cmp bl, 10
jb @f
mov al, 6
@@: sub bl, al
@@:
sub bl, al
jmp .main_loop
.1:
lea eax, [.IsRep*4 + ebx*4]
/kernel/branches/Kolibri-acpi/video/blitter.inc
1,36 → 1,27
 
struct BLITTER_BLOCK
xmin dd ?
ymin dd ?
xmax dd ?
ymax dd ?
ends
 
 
struc BLITTER
{
.dc.xmin rd 1 ; 0
.dc.ymin rd 1 ; 4
.dc.xmax rd 1 ; 8
.dc.ymax rd 1 ; 12
struct BLITTER
dc BLITTER_BLOCK
sc BLITTER_BLOCK
dst_x dd ? ; 32
dst_y dd ? ; 36
src_x dd ? ; 40
src_y dd ? ; 44
w dd ? ; 48
h dd ? ; 52
 
.sc:
.sc.xmin rd 1 ; 16
.sc.ymin rd 1 ; 20
.sc.xmax rd 1 ; 24
.sc.ymax rd 1 ; 28
bitmap dd ? ; 56
stride dd ? ; 60
ends
 
.dst_x rd 1 ; 32
.dst_y rd 1 ; 36
.src_x rd 1 ; 40
.src_y rd 1 ; 44
.w rd 1 ; 48
.h rd 1 ; 52
 
.bitmap rd 1 ; 56
.stride rd 1 ; 60
 
}
 
virtual at 0
BLITTER BLITTER
end virtual
 
 
align 4
 
__L1OutCode:
333,9 → 324,6
test eax, eax
jne .L57
 
inc [mouse_pause]
call [_display.disable_mouse]
 
mov eax, [TASK_BASE]
 
mov ebx, [esp+BLITTER.dst_x]
342,6 → 330,13
mov ebp, [esp+BLITTER.dst_y]
add ebx, [eax-twdw + WDATA.box.left]
add ebp, [eax-twdw + WDATA.box.top]
 
mov ecx, ebx
add ecx, [esp+BLITTER.w]
shl ecx, 16
mov cx, bp
add ecx, [esp+BLITTER.h]
 
mov edi, ebp
 
imul edi, [_display.pitch]
355,6 → 350,7
lea esi, [eax+esi*4]
add esi, [esp+BLITTER.bitmap]
 
mov eax, ecx
mov ecx, [esp+BLITTER.h]
mov edx, [esp+BLITTER.w]
 
370,7 → 366,6
lea edi, [edi+ebx*4]
 
mov ebx, [CURRENT_TASK]
 
align 4
.outer32:
xor ecx, ecx
379,9 → 374,26
.inner32:
cmp [ebp+ecx], bl
jne @F
;--------------------------------------
push eax
mov eax, [esi+ecx*4]
 
mov eax, [esi+ecx*4]
push ecx
 
mov ecx, [esp+4]
ror ecx, 16
sub ecx, edx
rol ecx, 16
sub ecx, [esp+BLITTER.h + 8]
 
; check mouse area for putpixel
call [_display.check_mouse]
pop ecx
; store to real LFB
mov [LFB_BASE+edi+ecx*4], eax
pop eax
;--------------------------------------
align 4
@@:
inc ecx
dec edx
396,7 → 408,6
jnz .outer32
 
.done:
dec [mouse_pause]
call [draw_pointer]
.L57:
add esp, 72
420,13 → 431,31
.inner24:
cmp [ebp+ecx], bl
jne @F
 
;--------------------------------------
push eax
mov eax, [esi+ecx*4]
 
lea edi, [edi+ecx*2]
 
push ecx
 
mov ecx, [esp+4]
ror ecx, 16
sub ecx, edx
rol ecx, 16
sub ecx, [esp+BLITTER.h + 8]
 
; check mouse area for putpixel
call [_display.check_mouse]
pop ecx
 
mov [edi+ecx], ax
shr eax, 16
mov [edi+ecx+2], al
 
pop eax
;--------------------------------------
align 4
@@:
mov edi, [esp+64]
inc ecx
/kernel/branches/Kolibri-acpi/video/cursors.inc
13,24 → 13,20
LOAD_INDIRECT equ 2
LOAD_SYSTEM equ 3
 
struc BITMAPINFOHEADER {
.biSize dd ? ; DWORD
.biWidth dd ? ; LONG
.biHeight dd ? ; LONG
.biPlanes dw ? ; WORD
.biBitCount dw ? ; WORD
.biCompression dd ? ; DWORD
.biSizeImage dd ? ; DWORD
.biXPelsPerMeter dd ? ; LONG
.biYPelsPerMeter dd ? ; LONG
.biClrUsed dd ? ; DWORD
.biClrImportant dd ? ; DWORD
}
 
virtual at 0
BI BITMAPINFOHEADER
end virtual
 
struct BITMAPINFOHEADER
Size dd ?
Width dd ?
Height dd ?
Planes dw ?
BitCount dw ?
Compression dd ?
SizeImage dd ?
XPelsPerMeter dd ?
YPelsPerMeter dd ?
ClrUsed dd ?
ClrImportant dd ?
ends
;------------------------------------------------------------------------------
align 4
proc init_cursor stdcall, dst:dword, src:dword
locals
47,13 → 43,14
add esi,[esi+18]
mov eax,esi
 
cmp [esi+BI.biBitCount], 24
cmp [esi+BITMAPINFOHEADER.BitCount], 24
je .img_24
cmp [esi+BI.biBitCount], 8
cmp [esi+BITMAPINFOHEADER.BitCount], 8
je .img_8
cmp [esi+BI.biBitCount], 4
cmp [esi+BITMAPINFOHEADER.BitCount], 4
je .img_4
 
;--------------------------------------
align 4
.img_2:
add eax, [esi]
mov [pQuad],eax
72,6 → 69,8
mov [rBase],edi
 
mov esi,[pQuad]
;--------------------------------------
align 4
.l21:
mov ebx, [pBits]
mov ebx, [ebx]
80,6 → 79,8
mov eax, [eax]
bswap eax
mov [counter], 32
;--------------------------------------
align 4
@@:
xor edx, edx
shl eax,1
107,7 → 108,8
sub [height],1
jnz .l21
ret
 
;--------------------------------------
align 4
.img_4:
add eax, [esi]
mov [pQuad],eax
127,11 → 129,15
 
mov esi,[pQuad]
mov ebx, [pBits]
;--------------------------------------
align 4
.l4:
mov eax, [pAnd]
mov eax, [eax]
bswap eax
mov [counter], 16
;--------------------------------------
align 4
@@:
xor edx, edx
shl eax,1
172,6 → 178,8
sub [height],1
jnz .l4
ret
;--------------------------------------
align 4
.img_8:
add eax, [esi]
mov [pQuad],eax
191,11 → 199,15
 
mov esi,[pQuad]
mov ebx, [pBits]
;--------------------------------------
align 4
.l81:
mov eax, [pAnd]
mov eax, [eax]
bswap eax
mov [counter], 32
;--------------------------------------
align 4
@@:
xor edx, edx
shl eax,1
221,14 → 233,16
sub [height],1
jnz .l81
ret
;--------------------------------------
align 4
.img_24:
add eax, [esi]
mov [pQuad],eax
add eax, 0xC00
mov [pAnd],eax
mov eax,[esi+BI.biWidth]
mov eax, [esi+BITMAPINFOHEADER.Width]
mov [width],eax
mov ebx,[esi+BI.biHeight]
mov ebx, [esi+BITMAPINFOHEADER.Height]
shr ebx,1
mov [height],ebx
 
238,10 → 252,14
 
mov esi,[pAnd]
mov ebx, [pQuad]
;--------------------------------------
align 4
.row_24:
mov eax, [esi]
bswap eax
mov [counter], 32
;--------------------------------------
align 4
@@:
xor edx, edx
shl eax,1
267,7 → 285,7
jnz .row_24
ret
endp
 
;------------------------------------------------------------------------------
align 4
proc set_cursor stdcall, hcursor:dword
mov eax, [hcursor]
278,6 → 296,8
mov ebx, [current_slot]
xchg eax, [ebx+APPDATA.cursor]
ret
;--------------------------------------
align 4
.fail:
mov eax, [def_cursor]
mov ebx, [current_slot]
284,7 → 304,8
xchg eax, [ebx+APPDATA.cursor]
ret
endp
 
;------------------------------------------------------------------------------
align 4
; param
; eax= pid
; ebx= src
300,7 → 321,7
push ebx
 
mov ebx, eax
mov eax, CURSOR.sizeof
mov eax, sizeof.CURSOR
call create_kernel_object
test eax, eax
jz .fail
332,22 → 353,18
 
stdcall init_cursor, eax, esi
 
mov eax, [.hcursor]
lea eax, [eax+CURSOR.list_next]
mov ecx, [.hcursor]
lea ecx, [ecx+CURSOR.list_next]
lea edx, [_display.cr_list.next]
 
pushfd
cli
mov ecx, [edx]
 
mov [eax], ecx
mov [eax+4], edx
 
mov [ecx+4], eax
mov [edx], eax
list_add ecx, edx ;list_add_tail(new, head)
popfd
 
mov eax, [.hcursor]
;--------------------------------------
align 4
.check_hw:
cmp [_display.init_cursor], 0
je .fail
357,9 → 374,13
add esp, 4
 
mov eax, [.hcursor]
;--------------------------------------
align 4
.fail:
add esp, 12
ret
;--------------------------------------
align 4
.indirect:
shr ebx, 16
movzx ecx, bh
372,7 → 393,7
cld
rep movsd
jmp .check_hw
 
;------------------------------------------------------------------------------
align 4
proc load_cursor stdcall, src:dword, flags:dword
locals
391,6 → 412,8
test eax, eax
jz .fail
mov [src], eax
;--------------------------------------
align 4
@@:
push ebx
push esi
407,16 → 430,22
cmp word [flags], LOAD_FROM_FILE
jne .exit
stdcall kernel_free, [src]
;--------------------------------------
align 4
.exit:
pop edi
pop esi
pop ebx
;--------------------------------------
align 4
.fail:
mov eax, [handle]
;--------------------------------------
align 4
.fail2:
ret
endp
 
;------------------------------------------------------------------------------
align 4
proc delete_cursor stdcall, hcursor:dword
locals
443,32 → 472,43
jne @F
mov eax, [def_cursor]
mov [ebx+APPDATA.cursor], eax
;--------------------------------------
align 4
@@:
mov eax, [hcursor]
call [eax+APPOBJ.destroy]
;--------------------------------------
align 4
.fail:
ret
endp
 
;------------------------------------------------------------------------------
align 4
; param
; eax= cursor
 
align 4
destroy_cursor:
 
push eax
stdcall kernel_free, [eax+CURSOR.base]
 
mov eax, [esp]
lea eax, [eax+CURSOR.list_next]
 
pushfd
cli
list_del eax
popfd
 
pop eax
 
call destroy_kernel_object
ret
 
;------------------------------------------------------------------------------
align 4
select_cursor:
mov eax, [esp+4]
mov [_display.cursor], eax
ret 4
 
;------------------------------------------------------------------------------
align 4
proc restore_24 stdcall, x:dword, y:dword
 
486,6 → 526,8
mov ecx, [cur.w]
lea ecx, [ecx+ecx*2]
push ecx
;--------------------------------------
align 4
@@:
mov edi, ebx
add ebx, [BytesPerScanLine]
498,11 → 540,13
pop ecx
pop edi
pop esi
;--------------------------------------
align 4
.ret:
pop ebx
ret
endp
 
;------------------------------------------------------------------------------
align 4
proc restore_32 stdcall, x:dword, y:dword
 
517,6 → 561,8
push edi
 
mov esi, cur_saved_data
;--------------------------------------
align 4
@@:
mov edi, ebx
add ebx, [BytesPerScanLine]
527,12 → 573,14
jnz @B
 
pop edi
;--------------------------------------
align 4
.ret:
pop esi
pop ebx
ret
endp
 
;------------------------------------------------------------------------------
align 4
proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword
locals
578,10 → 626,14
cmp ebx, [Screen_Max_X]
jbe @F
mov ebx, [Screen_Max_X]
;--------------------------------------
align 4
@@:
cmp edi, [Screen_Max_Y]
jbe @F
mov edi, [Screen_Max_Y]
;--------------------------------------
align 4
@@:
mov [cur.right], ebx
mov [cur.bottom], edi
597,6 → 649,8
 
mov eax, edi
mov edi, cur_saved_data
;--------------------------------------
align 4
@@:
mov esi, edx
add edx, [BytesPerScanLine]
615,6 → 669,8
mov esi, [hcursor]
mov esi, [esi+CURSOR.base]
lea edx, [esi+eax*4]
;--------------------------------------
align 4
.row:
mov ecx, [cur.w]
mov esi, edx
621,6 → 677,8
mov edi, ebx
add edx, 32*4
add ebx, [BytesPerScanLine]
;--------------------------------------
align 4
.pix:
lodsd
test eax, 0xFF000000
628,6 → 686,8
mov [edi], ax
shr eax, 16
mov [edi+2],al
;--------------------------------------
align 4
@@:
add edi, 3
dec ecx
637,8 → 697,7
jnz .row
ret
endp
 
 
;------------------------------------------------------------------------------
align 4
proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword
locals
682,10 → 741,14
cmp ebx, [Screen_Max_X]
jbe @F
mov ebx, [Screen_Max_X]
;--------------------------------------
align 4
@@:
cmp edi, [Screen_Max_Y]
jbe @F
mov edi, [Screen_Max_Y]
;--------------------------------------
align 4
@@:
mov [cur.right], ebx
mov [cur.bottom], edi
701,6 → 764,8
 
mov eax, edi
mov edi, cur_saved_data
;--------------------------------------
align 4
@@:
mov esi, edx
add edx, [BytesPerScanLine]
718,6 → 783,8
mov esi, [hcursor]
mov esi, [esi+CURSOR.base]
lea edx, [esi+eax*4]
;--------------------------------------
align 4
.row:
mov ecx, [cur.w]
mov esi, edx
724,11 → 791,15
mov edi, ebx
add edx, 32*4
add ebx, [BytesPerScanLine]
;--------------------------------------
align 4
.pix:
lodsd
test eax, 0xFF000000
jz @F
mov [edi], eax
;--------------------------------------
align 4
@@:
add edi, 4
dec ecx
738,16 → 809,158
jnz .row
ret
endp
;------------------------------------------------------------------------------
align 4
check_mouse_area_for_getpixel_new:
; in:
; eax = x
; ebx = y
; out:
; ecx = new color
;--------------------------------------
; check for Y
cmp bx, [Y_UNDER_subtraction_CUR_hot_y]
jb .no_mouse_area
 
cmp bx, [Y_UNDER_sub_CUR_hot_y_add_curh]
jae .no_mouse_area
;--------------------------------------
; check for X
cmp ax, [X_UNDER_subtraction_CUR_hot_x]
jb .no_mouse_area
 
cmp ax, [X_UNDER_sub_CUR_hot_x_add_curh]
jae .no_mouse_area
;--------------------------------------
push eax ebx
; offset X
mov ecx, [X_UNDER_subtraction_CUR_hot_x]
sub eax, ecx ; x1
; offset Y
mov ecx, [Y_UNDER_subtraction_CUR_hot_y]
sub ebx, ecx ; y1
;--------------------------------------
; ebx = offset y
; eax = offset x
imul ebx, [cur.w] ;y
add eax, ebx
mov ebx, eax
shl eax, 2
cmp [ScreenBPP], byte 32
je @f
sub eax, ebx
;--------------------------------------
align 4
@@:
add eax, cur_saved_data
mov ecx, [eax]
and ecx, 0xffffff
add ecx, 0xff000000
pop ebx eax
ret
;--------------------------------------
align 4
.no_mouse_area:
xor ecx, ecx
ret
;-----------------------------------------------------------------------------
align 4
check_mouse_area_for_putpixel_new:
; in:
; ecx = x shl 16 + y
; eax = color
; out:
; eax = new color
;--------------------------------------
; check for Y
cmp cx, [Y_UNDER_subtraction_CUR_hot_y]
jb .no_mouse_area
 
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
jae .no_mouse_area
 
rol ecx, 16
;--------------------------------------
; check for X
cmp cx, [X_UNDER_subtraction_CUR_hot_x]
jb .no_mouse_area
 
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
jae .no_mouse_area
;--------------------------------------
align 4
.1:
push eax
; offset X
mov ax, [X_UNDER_subtraction_CUR_hot_x]
sub cx, ax ; x1
ror ecx, 16
; offset Y
mov ax, [Y_UNDER_subtraction_CUR_hot_y]
sub cx, ax ; y1
;--------------------------------------
; ecx = (offset x) shl 16 + (offset y)
push ebx
mov ebx, ecx
shr ebx, 16 ; x
and ecx, 0xffff ; y
; ecx = offset y
; ebx = offset x
mov eax, [esp + 4]
 
push ebx ecx
imul ecx, [cur.w] ;y
add ecx, ebx
mov ebx, ecx
shl ecx, 2
cmp [ScreenBPP], byte 24
je .24
and eax, 0xFFFFFF
mov [ecx + cur_saved_data], eax ;store new color to
jmp @f
;--------------------------------------
align 4
.24:
sub ecx, ebx
mov [ecx + cur_saved_data], ax ;store new color to
shr eax, 16
mov [ecx + cur_saved_data + 2], al ;store new color to
;--------------------------------------
align 4
@@:
pop ecx ebx
 
shl ecx, 5
add ecx, ebx
 
mov eax, [current_cursor]
mov eax, [eax+CURSOR.base]
lea eax, [eax+ecx*4]
mov eax, [eax]
 
pop ebx
 
test eax, 0xFF000000
jz @f
 
pop ecx
ret
;--------------------------------------
align 4
@@:
pop eax
;--------------------------------------
align 4
.no_mouse_area:
ret
;------------------------------------------------------------------------------
align 4
get_display:
mov eax, _display
ret
 
;------------------------------------------------------------------------------
align 4
init_display:
 
xor eax, eax
mov edi, _display
 
766,6 → 979,7
 
test word [SCR_MODE], 0x4000
jz .fail
; jmp .fail
 
mov ebx, restore_32
mov ecx, move_cursor_32
777,30 → 991,28
mov ecx, move_cursor_24
cmp eax, 24
jne .fail
;--------------------------------------
align 4
@@:
mov [_display.select_cursor], select_cursor
mov [_display.move_cursor], ecx
mov [_display.restore_cursor], ebx
mov [_display.check_mouse], check_mouse_area_for_putpixel_new
mov [_display.check_m_pixel], check_mouse_area_for_getpixel_new
 
stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM
mov [def_cursor], eax
ret
;--------------------------------------
align 4
.fail:
xor eax, eax
mov [_display.select_cursor], eax
mov [_display.move_cursor], eax
ret
 
 
 
 
 
 
 
 
 
 
;------------------------------------------------------------------------------
align 4
def_arrow:
file 'arrow.cur'
;------------------------------------------------------------------------------
 
/kernel/branches/Kolibri-acpi/video/vesa20.inc
31,7 → 31,7
 
 
 
;*************************************************
;-----------------------------------------------------------------------------
; getpixel
;
; in:
40,32 → 40,57
;
; ret:
; ecx = 00 RR GG BB
 
;-----------------------------------------------------------------------------
align 4
getpixel:
push eax ebx edx edi
call dword [GETPIXEL]
pop edi edx ebx eax
ret
 
;-----------------------------------------------------------------------------
align 4
Vesa20_getpixel24:
; eax = x
; ebx = y
;--------------------------------------
; check mouse area for putpixel
test ecx, 0x04000000 ; don't load to mouseunder area
jnz .no_mouseunder
call [_display.check_m_pixel]
test ecx, ecx ;0xff000000
jnz @f
.no_mouseunder:
;--------------------------------------
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
lea edi, [eax+eax*2] ; edi = x*3
add edi, ebx ; edi = x*3+(y*y multiplier)
mov ecx, [LFB_BASE+edi]
;--------------------------------------
align 4
@@:
and ecx, 0xffffff
ret
 
;-----------------------------------------------------------------------------
align 4
Vesa20_getpixel32:
;--------------------------------------
; check mouse area for putpixel
test ecx, 0x04000000 ; don't load to mouseunder area
jnz .no_mouseunder
call [_display.check_m_pixel]
test ecx, ecx ;0xff000000
jnz @f
.no_mouseunder:
;--------------------------------------
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier)
mov ecx, [LFB_BASE+edi]
;--------------------------------------
align 4
@@:
and ecx, 0xffffff
ret
 
;*************************************************
 
;-----------------------------------------------------------------------------
virtual at esp
putimg:
.real_sx dd ?
80,7 → 105,9
.line_increment dd ?
.winmap_newline dd ?
.screen_newline dd ?
.stack_data = 4*12
.real_sx_and_abs_cx dd ?
.real_sy_and_abs_cy dd ?
.stack_data = 4*14
.edi dd ?
.esi dd ?
.ebp dd ?
92,7 → 119,7
.ret_addr dd ?
.arg_0 dd ?
end virtual
 
;-----------------------------------------------------------------------------
align 16
; ebx = pointer
; ecx = size [x|y]
100,10 → 127,8
; ebp = pointer to 'get' function
; esi = pointer to 'init' function
; edi = parameter for 'get' function
 
vesa20_putimage:
pushad
call [_display.disable_mouse]
sub esp, putimg.stack_data
; save pointer to image
mov [putimg.pti], ebx
138,10 → 163,14
add esp, putimg.stack_data
popad
ret
;--------------------------------------
align 4
@@:
cmp ebx, [putimg.image_sx]
jbe .end_x
mov ebx, [putimg.image_sx]
;--------------------------------------
align 4
.end_x:
mov [putimg.real_sx], ebx
; init real_sy
154,10 → 183,14
add esp, putimg.stack_data
popad
ret
;--------------------------------------
align 4
@@:
cmp ebx, [putimg.image_sy]
jbe .end_y
mov ebx, [putimg.image_sy]
;--------------------------------------
align 4
.end_y:
mov [putimg.real_sy], ebx
; line increment
198,6 → 231,14
add eax, [putimg.abs_cx]
add eax, [_WinMapAddress]
xchg eax, ebp
;--------------------------------------
mov ecx, [putimg.real_sx]
add ecx, [putimg.abs_cx]
mov [putimg.real_sx_and_abs_cx], ecx
mov ecx, [putimg.real_sy]
add ecx, [putimg.abs_cy]
mov [putimg.real_sy_and_abs_cy], ecx
;--------------------------------------
; get process number
mov ebx, [CURRENT_TASK]
cmp byte [ScreenBPP], 32
204,10 → 245,12
je put_image_end_32
;put_image_end_24:
mov edi, [putimg.real_sy]
;--------------------------------------
align 4
.new_line:
mov ecx, [putimg.real_sx]
; push ebp edx
;--------------------------------------
align 4
.new_x:
push [putimg.edi]
215,10 → 258,24
call eax
cmp [ebp], bl
jne .skip
; mov eax, [esi] ; eax = RRBBGGRR
;--------------------------------------
push ecx
 
neg ecx
add ecx, [putimg.real_sx_and_abs_cx + 4]
shl ecx, 16
add ecx, [putimg.real_sy_and_abs_cy + 4]
sub ecx, edi
 
; check mouse area for putpixel
call [_display.check_mouse]
pop ecx
; store to real LFB
mov [LFB_BASE+edx], ax
shr eax, 16
mov [LFB_BASE+edx+2], al
;--------------------------------------
align 4
.skip:
; add esi, 3 ;[putimg.source_bpp]
add edx, 3
236,23 → 293,32
jz .correct
cmp [putimg.ebp], putimage_get4bpp
jnz @f
;--------------------------------------
align 4
.correct:
mov eax, [putimg.edi]
mov byte [eax], 80h
;--------------------------------------
align 4
@@:
dec edi
jnz .new_line
;--------------------------------------
align 4
.finish:
add esp, putimg.stack_data
popad
ret
 
;------------------------------------------------------------------------------
align 4
put_image_end_32:
mov edi, [putimg.real_sy]
;--------------------------------------
align 4
.new_line:
mov ecx, [putimg.real_sx]
; push ebp edx
;--------------------------------------
align 4
.new_x:
push [putimg.edi]
260,8 → 326,22
call eax
cmp [ebp], bl
jne .skip
; mov eax, [esi] ; ecx = RRBBGGRR
;--------------------------------------
push ecx
 
neg ecx
add ecx, [putimg.real_sx_and_abs_cx + 4]
shl ecx, 16
add ecx, [putimg.real_sy_and_abs_cy + 4]
sub ecx, edi
 
; check mouse area for putpixel
call [_display.check_mouse]
pop ecx
; store to real LFB
mov [LFB_BASE+edx], eax
;--------------------------------------
align 4
.skip:
; add esi, [putimg.source_bpp]
add edx, 4
279,12 → 359,18
jz .correct
cmp [putimg.ebp], putimage_get4bpp
jnz @f
;--------------------------------------
align 4
.correct:
mov eax, [putimg.edi]
mov byte [eax], 80h
;--------------------------------------
align 4
@@:
dec edi
jnz .new_line
;--------------------------------------
align 4
.finish:
add esp, putimg.stack_data
popad
291,9 → 377,7
call VGA__putimage
mov [EGA_counter],1
ret
 
 
;*************************************************
;------------------------------------------------------------------------------
align 4
__sys_putpixel:
 
300,6 → 384,8
; eax = x coordinate
; ebx = y coordinate
; ecx = ?? RR GG BB ; 0x01000000 negation
; 0x02000000 used for draw_rectangle without top line
; for example drawwindow_III and drawwindow_IV
; edi = 0x00000001 force
 
;;; mov [novesachecksum], dword 0
321,47 → 407,83
cmp edx, [CURRENT_TASK]
pop eax
jne .exit
 
;--------------------------------------
align 4
.forced:
; check if negation
test ecx,0x01000000
jz .noneg
 
call getpixel
not ecx
 
rol ecx, 8
mov cl, [esp+32-8+3]
ror ecx, 8
mov [esp+32-8],ecx
;--------------------------------------
align 4
.noneg:
; OK to set pixel
call dword [PUTPIXEL] ; call the real put_pixel function
;--------------------------------------
align 4
.exit:
popad
ret
 
;-----------------------------------------------------------------------------
align 4
Vesa20_putpixel24:
; eax = x
; ebx = y
mov ecx, eax
shl ecx, 16
mov cx, bx
 
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
lea edi, [eax+eax*2] ; edi = x*3
mov eax, [esp+32-8+4]
;--------------------------------------
; check mouse area for putpixel
test eax, 0x04000000
jnz @f
call [_display.check_mouse]
;--------------------------------------
align 4
@@:
; store to real LFB
mov [LFB_BASE+ebx+edi], ax
shr eax, 16
mov [LFB_BASE+ebx+edi+2], al
;--------------------------------------
ret
 
 
;-----------------------------------------------------------------------------
align 4
Vesa20_putpixel32:
; eax = x
; ebx = y
mov ecx, eax
shl ecx, 16
mov cx, bx
 
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
lea edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier)
mov eax, [esp+32-8+4] ; eax = color
;--------------------------------------
; check mouse area for putpixel
test eax, 0x04000000
jnz @f
call [_display.check_mouse]
;--------------------------------------
align 4
@@:
and eax, 0xffffff
; store to real LFB
mov [LFB_BASE+edi], eax
;--------------------------------------
ret
 
;*************************************************
 
;align 4
;-----------------------------------------------------------------------------
align 4
calculate_edi:
mov edi, ebx
imul edi, [Screen_Max_X]
368,16 → 490,11
add edi, ebx
add edi, eax
ret
 
;*************************************************
 
;-----------------------------------------------------------------------------
; DRAWLINE
 
;-----------------------------------------------------------------------------
align 4
__sys_draw_line:
; inc [mouse_pause]
call [_display.disable_mouse]
 
; draw a line
; eax = HIWORD = x1
; LOWORD = x2
414,8 → 531,12
call vline
push edx ; necessary to rightly restore stack frame at .exit
jmp .exit
;--------------------------------------
align 4
.x2lx1:
neg esi ; get esi absolute value
;--------------------------------------
align 4
.no_vline:
; checking y-axis...
sub ebp, ebx ; ebp = y2-y1
425,9 → 546,12
mov edx, [dl_x2] ; else (if y1=y2)
call hline
jmp .exit
 
;--------------------------------------
align 4
.y2ly1:
neg ebp ; get ebp absolute value
;--------------------------------------
align 4
.no_hline:
cmp ebp, esi
jle .x_rules ; |y2-y1| < |x2-x1| ?
440,16 → 564,29
mov edx, [dl_y2]
mov [dl_y2], ebx
mov [dl_y1], edx
;--------------------------------------
align 4
.no_reverse1:
mov eax, [dl_dx]
cdq ; extend eax sing to edx
shl eax, 16 ; using 16bit fix-point maths
idiv ebp ; eax = ((x2-x1)*65536)/(y2-y1)
;--------------------------------------
; correction for the remainder of the division
shl edx, 1
cmp ebp, edx
jb @f
inc eax
;--------------------------------------
align 4
@@:
;--------------------------------------
mov edx, ebp ; edx = counter (number of pixels to draw)
mov ebp, 1 *65536 ; <<16 ; ebp = dy = 1.0
mov esi, eax ; esi = dx
jmp .y_rules
 
;--------------------------------------
align 4
.x_rules:
cmp [dl_x2], eax ; make sure x1 is at the begining
jge .no_reverse2
460,6 → 597,8
mov edx, [dl_y2]
mov [dl_y2], ebx
mov [dl_y1], edx
;--------------------------------------
align 4
.no_reverse2:
xor edx, edx
mov eax, [dl_dy]
466,19 → 605,51
cdq ; extend eax sing to edx
shl eax, 16 ; using 16bit fix-point maths
idiv esi ; eax = ((y2-y1)*65536)/(x2-x1)
;--------------------------------------
; correction for the remainder of the division
shl edx, 1
cmp esi, edx
jb @f
inc eax
;--------------------------------------
align 4
@@:
;--------------------------------------
mov edx, esi ; edx = counter (number of pixels to draw)
mov esi, 1 *65536 ;<< 16 ; esi = dx = 1.0
mov ebp, eax ; ebp = dy
;--------------------------------------
align 4
.y_rules:
mov eax, [dl_x1]
mov ebx, [dl_y1]
shl eax, 16
shl ebx, 16
;-----------------------------------------------------------------------------
align 4
.draw:
push eax ebx
;--------------------------------------
; correction for the remainder of the division
test ah, 0x80
jz @f
add eax, 1 shl 16
;--------------------------------------
align 4
@@:
;--------------------------------------
shr eax, 16
;--------------------------------------
; correction for the remainder of the division
test bh, 0x80
jz @f
add ebx, 1 shl 16
;--------------------------------------
align 4
@@:
;--------------------------------------
shr ebx, 16
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
call [putpixel]
pop ebx eax
add ebx, ebp ; y = y+dy
488,15 → 659,17
; force last drawn pixel to be at (x2,y2)
mov eax, [dl_x2]
mov ebx, [dl_y2]
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
call [putpixel]
;--------------------------------------
align 4
.exit:
add esp, 6*4
popa
; dec [mouse_pause]
call [draw_pointer]
; call [draw_pointer]
ret
 
 
;------------------------------------------------------------------------------
align 4
hline:
; draw an horizontal line
; eax = x1
508,8 → 681,10
cmp edx, eax ; make sure x2 is above x1
jge @f
xchg eax, edx
;--------------------------------------
align 4
@@:
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
call [putpixel]
inc eax
cmp eax, edx
516,8 → 691,8
jle @b
pop edx eax
ret
 
 
;------------------------------------------------------------------------------
align 4
vline:
; draw a vertical line
; eax = x
529,8 → 704,10
cmp edx, ebx ; make sure y2 is above y1
jge @f
xchg ebx, edx
;--------------------------------------
align 4
@@:
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
call [putpixel]
inc ebx
cmp ebx, edx
537,11 → 714,8
jle @b
pop edx ebx
ret
 
 
;*************************************************
 
 
;------------------------------------------------------------------------------
align 4
virtual at esp
drbar:
.bar_sx dd ?
555,9 → 729,11
.color dd ?
.line_inc_scr dd ?
.line_inc_map dd ?
.stack_data = 4*11
.real_sx_and_abs_cx dd ?
.real_sy_and_abs_cy dd ?
.stack_data = 4*13
end virtual
 
;--------------------------------------
align 4
; eax cx
; ebx cy
566,7 → 742,6
; edi color
vesa20_drawbar:
pushad
call [_display.disable_mouse]
sub esp, drbar.stack_data
mov [drbar.color], edi
sub edx, ebx
590,6 → 765,8
; \end{diamond}[20.08.2006]
sub ebx, [drbar.bar_cx]
ja @f
;--------------------------------------
align 4
.exit: ;// mike.dld, 2005-01-29
add esp, drbar.stack_data
popad
596,10 → 773,14
xor eax, eax
inc eax
ret
;--------------------------------------
align 4
@@:
cmp ebx, [drbar.bar_sx]
jbe .end_x
mov ebx, [drbar.bar_sx]
;--------------------------------------
align 4
.end_x:
mov [drbar.real_sx], ebx
; real_sy = MIN(wnd_sy-bar_cy, bar_sy);
614,10 → 795,14
xor eax, eax
inc eax
ret
;--------------------------------------
align 4
@@:
cmp ebx, [drbar.bar_sy]
jbe .end_y
mov ebx, [drbar.bar_sy]
;--------------------------------------
align 4
.end_y:
mov [drbar.real_sy], ebx
; line_inc_map
648,10 → 833,22
add eax, [drbar.abs_cx]
add eax, [_WinMapAddress]
xchg eax, ebp
;--------------------------------------
mov ebx, [drbar.real_sx]
add ebx, [drbar.abs_cx]
mov [drbar.real_sx_and_abs_cx], ebx
mov ebx, [drbar.real_sy]
add ebx, [drbar.abs_cy]
mov [drbar.real_sy_and_abs_cy], ebx
 
add edx, LFB_BASE
;--------------------------------------
; get process number
mov ebx, [CURRENT_TASK]
cmp byte [ScreenBPP], 24
jne draw_bar_end_32
;--------------------------------------
align 4
draw_bar_end_24:
mov eax, [drbar.color] ;; BBGGRR00
mov bh, al ;; bh = BB
664,16 → 861,37
; esi - counter
; edi - counter
mov esi, [drbar.real_sy]
cmp [_display.select_cursor], 0
jne draw_bar_end_24_new
;--------------------------------------
align 4
.new_y:
mov edi, [drbar.real_sx]
;--------------------------------------
align 4
.new_x:
cmp byte [ebp], bl
jne .skip
;--------------------------------------
push eax
 
mov [LFB_BASE+edx], bh
mov [LFB_BASE+edx + 1], ax
mov ecx, [drbar.real_sx_and_abs_cx + 4]
sub ecx, edi
shl ecx, 16
add ecx, [drbar.real_sy_and_abs_cy + 4]
sub ecx, esi
 
shl eax, 8
mov al, bh
; check mouse area for putpixel
call check_mouse_area_for_putpixel
; store to real LFB
mov [edx], ax
shr eax, 16
mov [edx + 2], al
pop eax
;--------------------------------------
align 4
.skip:
; add pixel
add edx, 3
689,27 → 907,128
test bh, bh
jz @f
dec bh
;--------------------------------------
align 4
@@:
; </Ivan 15.10.04>
dec esi
jnz .new_y
;--------------------------------------
align 4
.end:
add esp, drbar.stack_data
popad
xor eax, eax
ret
;--------------------------------------
align 4
draw_bar_end_24_new:
;--------------------------------------
align 4
.new_y:
mov edi, [drbar.real_sx]
;--------------------------------------
align 4
.new_x:
cmp byte [ebp], bl
jne .skip
;--------------------------------------
mov ecx, [drbar.real_sy_and_abs_cy]
sub ecx, esi
;--------------------------------------
; check for Y
cmp cx, [Y_UNDER_subtraction_CUR_hot_y]
jb .no_mouse_area
 
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
jae .no_mouse_area
 
rol ecx, 16
add ecx, [drbar.real_sx_and_abs_cx]
sub ecx, edi
;--------------------------------------
; check for X
cmp cx, [X_UNDER_subtraction_CUR_hot_x]
jb .no_mouse_area
 
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
jae .no_mouse_area
;--------------------------------------
; check mouse area for putpixel
push eax
 
shl eax, 8
mov al, bh
 
call check_mouse_area_for_putpixel_new.1
; store to real LFB
mov [edx], ax
shr eax, 16
mov [edx + 2], al
pop eax
jmp .skip
; store to real LFB
;--------------------------------------
align 4
.no_mouse_area:
mov [edx], bh
mov [edx + 1], ax
;--------------------------------------
align 4
.skip:
; add pixel
add edx, 3
inc ebp
dec edi
jnz .new_x
; add line
add edx, [drbar.line_inc_scr]
add ebp, [drbar.line_inc_map]
; <Ivan 15.10.04> drawing gradient bars
test eax, 0x00800000
jz @f
test bh, bh
jz @f
dec bh
;--------------------------------------
align 4
@@:
; </Ivan 15.10.04>
dec esi
jnz .new_y
jmp draw_bar_end_24.end
;--------------------------------------
align 4
draw_bar_end_32:
mov eax, [drbar.color] ;; BBGGRR00
mov esi, [drbar.real_sy]
cmp [_display.select_cursor], 0
jne draw_bar_end_32_new
;--------------------------------------
align 4
.new_y:
mov edi, [drbar.real_sx]
;--------------------------------------
align 4
.new_x:
cmp byte [ebp], bl
jne .skip
;--------------------------------------
push eax
 
mov [LFB_BASE+edx], eax
mov ecx, [drbar.real_sx_and_abs_cx + 4]
sub ecx, edi
shl ecx, 16
add ecx, [drbar.real_sy_and_abs_cy + 4]
sub ecx, esi
 
; check mouse area for putpixel
call check_mouse_area_for_putpixel
; store to real LFB
mov [edx], eax
pop eax
;--------------------------------------
align 4
.skip:
; add pixel
add edx, 4
725,10 → 1044,15
test al, al
jz @f
dec al
;--------------------------------------
align 4
@@:
; </Ivan 15.10.04>
dec esi
jnz .new_y
;--------------------------------------
align 4
.end:
add esp, drbar.stack_data
popad
call VGA_draw_bar
735,13 → 1059,83
xor eax, eax
mov [EGA_counter],1
ret
;--------------------------------------
align 4
draw_bar_end_32_new:
;--------------------------------------
align 4
.new_y:
mov edi, [drbar.real_sx]
;--------------------------------------
align 4
.new_x:
cmp byte [ebp], bl
jne .skip
;--------------------------------------
mov ecx, [drbar.real_sy_and_abs_cy]
sub ecx, esi
;--------------------------------------
; check for Y
cmp cx, [Y_UNDER_subtraction_CUR_hot_y]
jb .no_mouse_area
 
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
jae .no_mouse_area
 
rol ecx, 16
add ecx, [drbar.real_sx_and_abs_cx]
sub ecx, edi
;--------------------------------------
; check for X
cmp cx, [X_UNDER_subtraction_CUR_hot_x]
jb .no_mouse_area
 
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
jae .no_mouse_area
;--------------------------------------
; check mouse area for putpixel
push eax
call check_mouse_area_for_putpixel_new.1
mov [edx], eax
pop eax
jmp .skip
; store to real LFB
;--------------------------------------
align 4
.no_mouse_area:
mov [edx], eax
;--------------------------------------
align 4
.skip:
; add pixel
add edx, 4
inc ebp
dec edi
jnz .new_x
; add line
add edx, [drbar.line_inc_scr]
add ebp, [drbar.line_inc_map]
; <Ivan 15.10.04> drawing gradient bars
test eax, 0x80000000
jz @f
test al, al
jz @f
dec al
;--------------------------------------
align 4
@@:
; </Ivan 15.10.04>
dec esi
jnz .new_y
jmp draw_bar_end_32.end
;------------------------------------------------------------------------------
align 4
vesa20_drawbackground_tiled:
call [_display.disable_mouse]
pushad
; External loop for all y from start to end
mov ebx, [draw_data+32+RECT.top] ; y start
;--------------------------------------
align 4
dp2:
mov ebp, [draw_data+32+RECT.left] ; x start
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
755,6 → 1149,8
cmp [ScreenBPP], byte 24 ; 24 or 32 bpp ? - x size
jz @f
add ebp, eax
;--------------------------------------
align 4
@@:
add ebp, LFB_BASE
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
788,16 → 1184,35
; edx = 1
; esi -> bgr memory, edi -> output
; ebp = offset in WinMapAddress
;--------------------------------------
align 4
dp3:
cmp [ebp], dl
jnz nbgp
movsb
movsb
movsb
jmp @f
;--------------------------------------
push eax ecx
 
mov ecx, eax
shl ecx, 16
add ecx, ebx
 
mov eax, [esi]
and eax, 0xffffff
; check mouse area for putpixel
call [_display.check_mouse]
; store to real LFB
mov [edi], ax
shr eax, 16
mov [edi+2], al
 
pop ecx eax
;--------------------------------------
align 4
nbgp:
add esi, 3
add edi, 3
;--------------------------------------
align 4
@@:
cmp [ScreenBPP], byte 25 ; 24 or 32 bpp?
sbb edi, -1 ; +1 for 32 bpp
814,6 → 1229,8
sub esi, ecx
sub esi, ecx
jmp dp3
;--------------------------------------
align 4
dp4:
; next scan line
inc ebx
823,12 → 1240,9
mov [EGA_counter], 1
call VGA_drawbackground
ret
 
; ----------
 
 
;------------------------------------------------------------------------------
align 4
vesa20_drawbackground_stretch:
call [_display.disable_mouse]
pushad
; Helper variables
; calculate 2^32*(BgrDataWidth-1) mod (ScreenWidth-1)
863,6 → 1277,8
cmp [ScreenBPP], byte 24 ; 24 or 32 bpp ? - x size
jz @f
add ebp, eax
;--------------------------------------
align 4
@@:
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
call calculate_edi
893,6 → 1309,8
push edx
push esi
; 3) Smooth horizontal
;--------------------------------------
align 4
bgr_resmooth0:
mov ecx, [esp+8]
mov edx, [esp+4]
900,6 → 1318,8
push edi
mov edi, bgr_cur_line
call smooth_line
;--------------------------------------
align 4
bgr_resmooth1:
mov eax, [esp+16+4]
inc eax
913,8 → 1333,12
add esi, [BgrDataWidth]
mov edi, bgr_next_line
call smooth_line
;--------------------------------------
align 4
bgr.no2nd:
pop edi
;--------------------------------------
align 4
sdp3:
xor esi, esi
mov ecx, [esp+12]
930,6 → 1354,8
; precalculated constants:
; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
;--------------------------------------
align 4
sdp3a:
mov eax, [_WinMapAddress]
cmp [ebp+eax], byte 1
939,12 → 1365,22
jz .novert
mov ebx, [bgr_next_line+esi]
call [overlapping_of_points_ptr]
;--------------------------------------
align 4
.novert:
 
push ecx
mov ecx, [esp+20+4] ;x
shl ecx, 16
add ecx, [esp+24+4] ;y
; check mouse area for putpixel
call [_display.check_mouse]
; store to real LFB
mov [LFB_BASE+edi], ax
shr eax, 16
 
mov [LFB_BASE+edi+2], al
pop ecx
;--------------------------------------
align 4
snbgp:
cmp [ScreenBPP], byte 25
sbb edi, -4
955,6 → 1391,8
add esi, 4
cmp eax, [draw_data+32+RECT.right]
jbe sdp3a
;--------------------------------------
align 4
sdp4:
; next y
mov ebx, [esp+24]
973,6 → 1411,8
cmp [ScreenBPP], byte 24
jz @f
sub edi, eax
;--------------------------------------
align 4
@@:
add edi, [BytesPerScanLine]
; restore ecx,edx; advance esi to next background line
999,6 → 1439,8
inc ecx
rep movsd
jmp bgr_resmooth1
;--------------------------------------
align 4
sdpdone:
add esp, 44
popad
1007,11 → 1449,14
ret
 
uglobal
;--------------------------------------
align 4
bgr_cur_line rd 1920 ; maximum width of screen
bgr_next_line rd 1920
;--------------------------------------
endg
 
;--------------------------------------
align 4
smooth_line:
mov al, [esi+2]
shl eax, 16
1021,6 → 1466,8
mov ebx, [esi+2]
shr ebx, 8
call [overlapping_of_points_ptr]
;--------------------------------------
align 4
@@:
stosd
mov eax, [esp+20+8]
1035,11 → 1482,13
lea eax, [eax*3]
sub esi, eax
jmp smooth_line
;--------------------------------------
align 4
@@:
mov eax, [draw_data+32+RECT.left]
mov [esp+20+8], eax
ret
 
;------------------------------------------------------------------------------
align 16
overlapping_of_points:
if 0
1104,18 → 1553,25
end if
 
iglobal
;--------------------------------------
align 4
overlapping_of_points_ptr dd overlapping_of_points
;--------------------------------------
endg
 
;------------------------------------------------------------------------------
align 4
init_background:
mov edi, BgrAuxTable
xor edx, edx
;--------------------------------------
align 4
.loop2:
mov eax, edx
shl eax, 8
neg eax
mov ecx, 0x200
;--------------------------------------
align 4
.loop1:
mov byte [edi], ah
inc edi
1126,9 → 1582,11
test byte [cpu_caps+(CAPS_MMX/8)], 1 shl (CAPS_MMX mod 8)
jz @f
mov [overlapping_of_points_ptr], overlapping_of_points_mmx
;--------------------------------------
align 4
@@:
ret
 
;------------------------------------------------------------------------------
align 16
overlapping_of_points_mmx:
movd mm0, eax
1148,3 → 1606,4
paddb mm4, mm1
movd eax, mm4
ret
;------------------------------------------------------------------------------