/kernel/trunk/core/memory.inc |
---|
1282,6 → 1282,7 |
cursor_end rd 1 |
def_cursor rd 1 |
hw_cursor rd 1 |
scr_width rd 1 |
scr_height rd 1 |
/kernel/trunk/core/taskman.inc |
---|
986,7 → 986,6 |
popad |
mov eax, [r_count] |
ret |
endp |
align 4 |
/kernel/trunk/drivers/ati2d.asm |
---|
1,9 → 1,6 |
;alpha version |
format MS COFF |
include 'proc32.inc' |
DEBUG equ 1 |
15,6 → 12,8 |
LOAD_INDIRECT equ 2 |
LOAD_SYSTEM equ 3 |
VIDEO_FREE equ 2 |
struc BITMAPINFOHEADER { |
.biSize dd ? ; DWORD |
.biWidth dd ? ; LONG |
237,9 → 236,14 |
align 4 |
proc service_proc stdcall, ioctl:dword |
; mov edi, [ioctl] |
; mov eax, [edi+io_code] |
mov edi, [ioctl] |
mov ebx, [edi+io_code] |
cmp ebx, VIDEO_FREE |
jne .fail |
mov eax, [edi+input] |
call video_free |
.fail: |
xor eax, eax |
ret |
endp |
365,20 → 369,42 |
align 4 |
proc drvCursorPos stdcall, hcursor:dword, x:dword, y:dword |
pushfd |
cli |
mov eax, 80000000h |
wrr CUR_HORZ_VERT_OFF, eax |
xor eax, eax |
xor edx, edx |
mov esi, [hcursor] |
mov ebx, [x] |
mov ecx, [y] |
mov eax, [x] |
sub ebx, [esi+CURSOR.hot_x] |
jnc @F |
neg ebx |
mov eax, ebx |
shl eax, 16 |
or eax, [y] |
or eax, 80000000h |
wrr CUR_HORZ_VERT_POSN, eax |
xor ebx, ebx |
@@: |
sub ecx, [esi+CURSOR.hot_y] |
jnc @F |
neg ecx |
mov ax, cx |
mov edx, ecx |
xor ecx, ecx |
@@: |
or eax, 0x80000000 |
wrr CUR_HORZ_VERT_OFF, eax |
mov esi, [hcursor] |
mov eax, [esi+CURSOR.base] |
sub eax, LFBAddress |
wrr CUR_OFFSET, eax |
shl ebx, 16 |
mov bx, cx |
or ebx, 0x80000000 |
wrr CUR_HORZ_VERT_POSN, ebx |
shl edx, 8 |
add edx, [esi+CURSOR.base] |
sub edx, LFBAddress |
wrr CUR_OFFSET, edx |
popfd |
ret |
endp |
413,6 → 439,26 |
endp |
align 4 |
video_free: |
pushfd |
cli |
sub eax, LFBAddress+CURSOR_IMAGE_OFFSET |
shr eax, 14 |
mov ebx, cursor_map |
bts [ebx], eax |
shr eax, 3 |
and eax, not 3 |
add eax, ebx |
cmp [cursor_start], eax |
ja @f |
popfd |
ret |
@@: |
mov [cursor_start], eax |
popfd |
ret |
align 4 |
proc ati_cursor stdcall, hcursor:dword, src:dword, flags:dword |
stdcall video_alloc |
438,8 → 484,8 |
shr ebx, 16 |
movzx ecx, bh |
movzx edx, bl |
mov [eax+CURSOR.hot_x], ecx |
mov [eax+CURSOR.hot_y], edx |
mov [edi+CURSOR.hot_x], ecx |
mov [edi+CURSOR.hot_y], edx |
xchg edi, eax |
push edi |
479,6 → 525,64 |
cmp [esi+BI.biBitCount], 24 |
je .img_24 |
cmp [esi+BI.biBitCount], 8 |
je .img_8 |
cmp [esi+BI.biBitCount], 4 |
je .img_4 |
.img_2: |
add eax, [esi] |
mov [pQuad],eax |
add eax,8 |
mov [pBits],eax |
add eax, 128 |
mov [pAnd],eax |
mov eax,[esi+4] |
mov [width],eax |
mov ebx,[esi+8] |
shr ebx,1 |
mov [height],ebx |
mov edi, pCursor |
add edi, 32*31*4 |
mov [rBase],edi |
mov esi,[pQuad] |
.l21: |
mov ebx, [pBits] |
mov ebx, [ebx] |
bswap ebx |
mov eax, [pAnd] |
mov eax, [eax] |
bswap eax |
mov [counter], 32 |
@@: |
xor edx, edx |
shl eax,1 |
setc dl |
dec edx |
xor ecx, ecx |
shl ebx,1 |
setc cl |
mov ecx, [esi+ecx*4] |
and ecx, edx |
and edx, 0xFF000000 |
or edx, ecx |
mov [edi], edx |
add edi, 4 |
dec [counter] |
jnz @B |
add [pBits], 4 |
add [pAnd], 4 |
mov edi,[rBase] |
sub edi,128 |
mov [rBase],edi |
sub [height],1 |
jnz .l21 |
jmp .copy |
.img_4: |
add eax, [esi] |
mov [pQuad],eax |
496,10 → 600,11 |
add edi, 32*31*4 |
mov [rBase],edi |
mov esi,[pAnd] |
mov esi,[pQuad] |
mov ebx, [pBits] |
.l1: |
mov eax, [esi] |
.l4: |
mov eax, [pAnd] |
mov eax, [eax] |
bswap eax |
mov [counter], 16 |
@@: |
508,11 → 613,10 |
setc dl |
dec edx |
mov ecx, [ebx] |
and ecx, 0xF0 |
movzx ecx, byte [ebx] |
and cl, 0xF0 |
shr ecx, 2 |
add ecx, [pQuad] |
mov ecx, [ecx] |
mov ecx, [esi+ecx] |
and ecx, edx |
and edx, 0xFF000000 |
or edx, ecx |
523,11 → 627,9 |
setc dl |
dec edx |
mov ecx, [ebx] |
and ecx, 0x0F |
shl ecx, 2 |
add ecx, [pQuad] |
mov ecx, [ecx] |
movzx ecx, byte [ebx] |
and cl, 0x0F |
mov ecx, [esi+ecx*4] |
and ecx, edx |
and edx, 0xFF000000 |
or edx, ecx |
538,14 → 640,62 |
dec [counter] |
jnz @B |
add esi, 4 |
add [pAnd], 4 |
mov edi,[rBase] |
sub edi,128 |
mov [rBase],edi |
sub [height],1 |
jnz .l1 |
jnz .l4 |
jmp .copy |
.img_8: |
add eax, [esi] |
mov [pQuad],eax |
add eax,1024 |
mov [pBits],eax |
add eax, 1024 |
mov [pAnd],eax |
mov eax,[esi+4] |
mov [width],eax |
mov ebx,[esi+8] |
shr ebx,1 |
mov [height],ebx |
mov edi, pCursor |
add edi, 32*31*4 |
mov [rBase],edi |
mov esi,[pQuad] |
mov ebx, [pBits] |
.l81: |
mov eax, [pAnd] |
mov eax, [eax] |
bswap eax |
mov [counter], 32 |
@@: |
xor edx, edx |
shl eax,1 |
setc dl |
dec edx |
movzx ecx, byte [ebx] |
mov ecx, [esi+ecx*4] |
and ecx, edx |
and edx, 0xFF000000 |
or edx, ecx |
mov [edi], edx |
inc ebx |
add edi, 4 |
dec [counter] |
jnz @B |
add [pAnd], 4 |
mov edi,[rBase] |
sub edi,128 |
mov [rBase],edi |
sub [height],1 |
jnz .l81 |
jmp .copy |
.img_24: |
add eax, [esi] |
mov [pQuad],eax |
606,7 → 756,6 |
add edi, 128 |
dec ebx |
jnz @B |
ret |
endp |
814,8 → 963,10 |
msgInit db 'detect hardware...',13,10,0 |
msgPCI db 'PCI accsess not supported',13,10,0 |
msgFail db 'device not found',13,10,0 |
msg_neg db 'neg ecx',13,10,0 |
buff db 8 dup(0) |
db 13,10, 0 |
section '.data' data readable writable align 16 |
pCursor db 4096 dup(?) |
/kernel/trunk/drivers/sis.asm |
---|
693,6 → 693,11 |
counter dd ? |
endl |
mov edx, CTRL_STAT |
call [ctrl.ctrl_read32] |
test eax, CTRL_ST_CREADY |
jnz .ready |
call reset_codec |
and eax, eax |
jz .err |
710,7 → 715,7 |
call [ctrl.codec_read16] |
and eax, 0x0F |
cmp eax, 0x0F |
jz .ready |
je .ready |
mov eax, 5000 ; wait 5 ms |
call StallExec |
804,8 → 809,11 |
counter dd ? |
endl |
xor eax, eax |
mov edx, GLOB_CTRL |
call [ctrl.ctrl_read32] |
and eax, not 0x08 |
or eax, 0x02 |
mov edx, GLOB_CTRL |
call [ctrl.ctrl_write32] |
if DEBUG |
813,13 → 821,6 |
call SysMsgBoardStr |
end if |
mov eax, 1000000 ; wait 1 s |
call StallExec |
mov eax, 2 |
mov edx, GLOB_CTRL |
call [ctrl.ctrl_write32] |
mov [counter], 10 ; total 10*100 ms = 1s |
.wait: |
mov eax, 100000 ; wait 100 ms |
836,6 → 837,7 |
mov esi, msgCRFail |
call SysMsgBoardStr |
end if |
.fail: |
stc |
ret |
.ok: |
845,9 → 847,6 |
jz .fail |
clc |
ret |
.fail: |
stc |
ret |
endp |
align 4 |
1039,7 → 1038,7 |
rdtsc |
sub eax, ebx |
sbb edx, ecx |
jb @B |
js @B |
pop eax |
pop ebx |
/kernel/trunk/drivers/unisound.asm |
---|
596,7 → 596,6 |
mov [ctrl.lvi_reg], eax |
mov edx, PCM_OUT_LVI_REG |
call [ctrl.ctrl_write8] |
ret |
endp |
637,7 → 636,8 |
add edi, 12 |
jmp @B |
.next: inc [devfn] |
.next: |
inc [devfn] |
cmp [devfn], 256 |
jb .next_dev |
mov eax, [bus] |
821,7 → 821,6 |
mov edx, MC_IN_CR_REG |
call [ctrl.ctrl_write8] |
ret |
endp |
831,6 → 830,11 |
counter dd ? |
endl |
mov edx, CTRL_STAT |
call [ctrl.ctrl_read32] |
test eax, CTRL_ST_CREADY |
jnz .ready |
call reset_codec |
and eax, eax |
jz .err |
1052,7 → 1056,6 |
mov ebx, [ctrl.pci_cmd] |
mov [CTRL_INFO.pci_cmd], ebx |
ret |
endp |
1128,8 → 1131,6 |
xor eax, wax |
inc eax |
ret |
align 4 |
.not_ready: |
xor eax, eax |
ret |
1177,7 → 1178,7 |
rdtsc |
sub eax, ebx |
sbb edx, ecx |
jb @B |
js @B |
pop eax |
pop ebx |
1289,7 → 1290,6 |
proc ctrl_mem_w8 |
add edx, [ctrl.ctrl_mem_base] |
mov [edx], al |
ret |
endp |
/kernel/trunk/kernel.asm |
---|
1730,7 → 1730,7 |
mousefn dd msscreen, mswin, msbutton, msset |
dd app_load_cursor |
dd app_set_cursor |
dd msset ;app_delete_cursor |
dd app_delete_cursor |
readmousepos: |
1789,6 → 1789,10 |
mov [esp+36], eax |
ret |
app_delete_cursor: |
stdcall delete_cursor, ebx |
mov [esp+36], eax |
ret |
is_input: |
1799,7 → 1803,6 |
pop edx |
ret |
is_output: |
push edx |
/kernel/trunk/video/cursors.inc |
---|
3,6 → 3,7 |
LOAD_FROM_MEM equ 1 |
LOAD_INDIRECT equ 2 |
LOAD_SYSTEM equ 3 |
VIDEO_FREE equ 2 |
struc BITMAPINFOHEADER { |
.biSize dd ? ; DWORD |
40,6 → 41,65 |
cmp [esi+BI.biBitCount], 24 |
je .img_24 |
cmp [esi+BI.biBitCount], 8 |
je .img_8 |
cmp [esi+BI.biBitCount], 4 |
je .img_4 |
.img_2: |
add eax, [esi] |
mov [pQuad],eax |
add eax,8 |
mov [pBits],eax |
add eax, 128 |
mov [pAnd],eax |
mov eax,[esi+4] |
mov [width],eax |
mov ebx,[esi+8] |
shr ebx,1 |
mov [height],ebx |
mov edi, [dst] |
add edi, 32*31*4 |
mov [rBase],edi |
mov esi,[pQuad] |
.l21: |
mov ebx, [pBits] |
mov ebx, [ebx] |
bswap ebx |
mov eax, [pAnd] |
mov eax, [eax] |
bswap eax |
mov [counter], 32 |
@@: |
xor edx, edx |
shl eax,1 |
setc dl |
dec edx |
xor ecx, ecx |
shl ebx,1 |
setc cl |
mov ecx, [esi+ecx*4] |
and ecx, edx |
and edx, 0xFF000000 |
or edx, ecx |
mov [edi], edx |
add edi, 4 |
dec [counter] |
jnz @B |
add [pBits], 4 |
add [pAnd], 4 |
mov edi,[rBase] |
sub edi,128 |
mov [rBase],edi |
sub [height],1 |
jnz .l21 |
ret |
.img_4: |
add eax, [esi] |
mov [pQuad],eax |
57,10 → 117,11 |
add edi, 32*31*4 |
mov [rBase],edi |
mov esi,[pAnd] |
mov esi,[pQuad] |
mov ebx, [pBits] |
.l1: |
mov eax, [esi] |
.l4: |
mov eax, [pAnd] |
mov eax, [eax] |
bswap eax |
mov [counter], 16 |
@@: |
69,11 → 130,10 |
setc dl |
dec edx |
mov ecx, [ebx] |
and ecx, 0xF0 |
movzx ecx, byte [ebx] |
and cl, 0xF0 |
shr ecx, 2 |
add ecx, [pQuad] |
mov ecx, [ecx] |
mov ecx, [esi+ecx] |
and ecx, edx |
and edx, 0xFF000000 |
or edx, ecx |
84,11 → 144,9 |
setc dl |
dec edx |
mov ecx, [ebx] |
and ecx, 0x0F |
shl ecx, 2 |
add ecx, [pQuad] |
mov ecx, [ecx] |
movzx ecx, byte [ebx] |
and cl, 0x0F |
mov ecx, [esi+ecx*4] |
and ecx, edx |
and edx, 0xFF000000 |
or edx, ecx |
99,13 → 157,62 |
dec [counter] |
jnz @B |
add esi, 4 |
add [pAnd], 4 |
mov edi,[rBase] |
sub edi,128 |
mov [rBase],edi |
sub [height],1 |
jnz .l1 |
jnz .l4 |
ret |
.img_8: |
add eax, [esi] |
mov [pQuad],eax |
add eax,1024 |
mov [pBits],eax |
add eax, 1024 |
mov [pAnd],eax |
mov eax,[esi+4] |
mov [width],eax |
mov ebx,[esi+8] |
shr ebx,1 |
mov [height],ebx |
mov edi, [dst] |
add edi, 32*31*4 |
mov [rBase],edi |
mov esi,[pQuad] |
mov ebx, [pBits] |
.l81: |
mov eax, [pAnd] |
mov eax, [eax] |
bswap eax |
mov [counter], 32 |
@@: |
xor edx, edx |
shl eax,1 |
setc dl |
dec edx |
movzx ecx, byte [ebx] |
mov ecx, [esi+ecx*4] |
and ecx, edx |
and edx, 0xFF000000 |
or edx, ecx |
mov [edi], edx |
inc ebx |
add edi, 4 |
dec [counter] |
jnz @B |
add [pAnd], 4 |
mov edi,[rBase] |
sub edi,128 |
mov [rBase],edi |
sub [height],1 |
jnz .l81 |
ret |
.img_24: |
add eax, [esi] |
mov [pQuad],eax |
190,6 → 297,34 |
endp |
align 4 |
proc free_cursor |
pushfd |
cli |
xor edx, edx |
mov ecx, CURSOR_SIZE |
sub eax, cursors |
div ecx |
test edx, edx |
jnz .exit |
mov ebx, cursor_map |
bts [ebx], eax |
shr eax, 3 |
and eax, not 3 |
add eax, ebx |
cmp [cursor_start], eax |
ja @f |
.exit: |
popfd |
ret |
@@: |
mov [cursor_start], eax |
popfd |
ret |
endp |
align 4 |
proc set_cursor stdcall, hcursor:dword |
mov eax, [hcursor] |
cmp [eax+CURSOR.magic], 'CURS' |
282,7 → 417,66 |
endp |
align 4 |
proc delete_cursor stdcall, hcursor:dword |
locals |
hsrv dd ? |
io_code dd ? |
input dd ? |
inp_size dd ? |
output dd ? |
out_size dd ? |
endl |
mov esi, [hcursor] |
cmp [esi+CURSOR.magic], 'CURS' |
jne .fail |
cmp [esi+CURSOR.size], CURSOR_SIZE |
jne .fail |
mov ebx, [CURRENT_TASK] |
shl ebx, 5 |
mov ebx, [0x3000+ebx+4] |
cmp ebx, [esi+CURSOR.pid] |
jne .fail |
mov ebx, [CURRENT_TASK] |
shl ebx, 8 |
cmp esi, [ebx+PROC_BASE+APPDATA.cursor] |
jne @F |
mov eax, [def_cursor] |
mov [ebx+PROC_BASE+APPDATA.cursor], eax |
@@: |
mov eax, [hw_cursor] |
test eax, eax |
jz @F |
xor ebx, ebx |
mov ecx, [esi+CURSOR.base] |
mov [hsrv], eax |
mov [io_code], VIDEO_FREE |
mov [input], ecx |
mov [inp_size], 4 |
mov [output], ebx |
mov [out_size], ebx |
lea eax, [hsrv] |
stdcall srv_handler, eax |
jmp .exit |
@@: |
stdcall kernel_free, [esi+CURSOR.base] |
.exit: |
mov eax, [hcursor] |
call free_cursor |
ret |
.fail: |
ret |
endp |
align 4 |
proc init_cursors |
cmp [0xfe0c],word 0x13 |
jbe .fail |
movzx eax, byte [ScreenBPP] |
mov ebx, [SCR_BYTES_PER_LINE] |
cmp eax, 32 |
311,6 → 505,7 |
mov [cursor_end], edx |
stdcall load_driver, drv_hw_mouse |
mov [hw_cursor], eax |
test eax, eax |
jz .sw_mouse |