Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 226 → Rev 227

/kernel/trunk/drivers/ati2d.asm
6,10 → 6,47
 
include 'proc32.inc'
 
DEBUG equ 0
DEBUG equ 1
 
VID_ATI equ 0x1002
 
LOAD_FROM_FILE equ 0
LOAD_FROM_MEM equ 1
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
 
struc CURSOR
{ .magic dd ?
.size dd ?
.pid dd ?
.base dd ?
.hot_x dd ?
.hot_y dd ?
}
virtual at 0
CURSOR CURSOR
end virtual
 
CURSOR_SIZE equ 24
 
R8500 equ 0x514C ;R200
R9000 equ 0x4966 ;RV250
R9200 equ 0x5961 ;RV280
117,6 → 154,7
 
public START
public service_proc
public version
 
extrn SysMsgBoardStr
extrn PciApi
125,6 → 163,8
extrn MapPage
extrn RegService
extrn SetHwCursor
extrn HwCursorRestore
extrn HwCursorCreate
extrn LFBAddress
extrn LoadFile
 
137,11 → 177,9
 
proc START stdcall, state:dword
 
mov eax, [state]
cmp eax, 1
je .entry
jmp .exit
.entry:
cmp [state], 1
jne .exit
 
if DEBUG
mov esi, msgInit
call SysMsgBoardStr
151,22 → 189,30
test eax, eax
jz .fail
 
stdcall LoadFile, user_file
test eax, eax
jz @F
mov [user_arrow], eax
@@:
stdcall ati_init_cursor, [user_arrow]
 
call init_ati
test eax, eax
jz .fail
 
xor eax, eax
mov edi, cursors
mov ecx, CURSOR_SIZE*16
cld
rep stosd
 
not eax
mov [cursor_map], eax
mov [cursor_map+4], eax
mov edx, cursor_map
mov [cursor_start], edx
add edx, 4
mov [cursor_end], edx
 
stdcall RegService, sz_ati_srv, service_proc
test eax, eax
jz .fail
mov ebx, SetHwCursor
mov dword [ebx], drvCursorPos ;enable hardware cursor
mov dword [SetHwCursor], drvCursorPos ;enable hardware cursor
mov dword [HwCursorRestore], drv_restore
mov dword [HwCursorCreate], ati_cursor
ret
.fail:
if DEBUG
176,8 → 222,8
 
.exit:
xor eax, eax
mov ebx, SetHwCursor
mov dword [ebx], eax ;force disable hardware cursor
; mov ebx, SetHwCursor
; mov dword [ebx], eax ;force disable hardware cursor
ret
endp
 
240,7 → 286,8
add edi, 4
jmp @B
 
.next: inc [devfn]
.next:
inc [devfn]
cmp [devfn], 256
jb .next_dev
mov eax, [bus]
296,9 → 343,6
or eax, ebx
mov [edi+0x50], eax
 
pushd 0
pushd 0
call drvCursorPos
call drvShowCursor
xor eax, eax
inc eax
307,6 → 351,10
endp
 
align 4
drv_restore:
ret 8
 
align 4
drvShowCursor:
mov edi, [ati_io]
 
316,25 → 364,105
ret
 
align 4
drvCursorPos:
push ebp
mov ebp, esp
proc drvCursorPos stdcall, hcursor:dword, x:dword, y:dword
 
mov eax, 80000000h
wrr CUR_HORZ_VERT_OFF, eax
 
mov eax, [ebp+8]
mov eax, [x]
shl eax, 16
or eax, [ebp+12]
or eax, [y]
or eax, 80000000h
wrr CUR_HORZ_VERT_POSN, eax
 
mov eax, CURSOR_IMAGE_OFFSET
mov esi, [hcursor]
mov eax, [esi+CURSOR.base]
sub eax, LFBAddress
wrr CUR_OFFSET, eax
leave
ret 8
ret
endp
 
align 4
proc ati_init_cursor stdcall, arrow:dword
proc video_alloc
 
pushfd
cli
mov ebx, [cursor_start]
mov ecx, [cursor_end]
.l1:
bsf eax,[ebx];
jnz .found
add ebx,4
cmp ebx, ecx
jb .l1
popfd
xor eax,eax
ret
.found:
btr [ebx], eax
popfd
 
mov [cursor_start],ebx
sub ebx, cursor_map
shl ebx, 3
add eax,ebx
 
shl eax,14
add eax, LFBAddress+CURSOR_IMAGE_OFFSET
ret
endp
 
align 4
proc ati_cursor stdcall, hcursor:dword, src:dword, flags:dword
 
stdcall video_alloc
 
mov edi, [hcursor]
mov [edi+CURSOR.base], eax
 
mov esi, [src]
mov ebx, [flags]
cmp bx, LOAD_INDIRECT
je .indirect
 
movzx ecx, word [esi+10]
movzx edx, word [esi+12]
mov [edi+CURSOR.hot_x], ecx
mov [edi+CURSOR.hot_y], edx
 
stdcall ati_init_cursor, eax, esi
mov eax, [hcursor]
.fail:
ret
.indirect:
shr ebx, 16
movzx ecx, bh
movzx edx, bl
mov [eax+CURSOR.hot_x], ecx
mov [eax+CURSOR.hot_y], edx
 
xchg edi, eax
push edi
mov ecx, 64*64
xor eax,eax
rep stosd
 
mov esi, [src]
pop edi
mov ebx, 32
cld
@@:
mov ecx, 32
rep movsd
add edi, 128
dec ebx
jnz @B
mov eax, [hcursor]
ret
endp
 
align 4
proc ati_init_cursor stdcall, dst:dword, src:dword
locals
rBase dd ?
pQuad dd ?
345,12 → 473,13
counter dd ?
endl
 
cld
mov esi, [src]
add esi,[esi+18]
mov eax,esi
 
mov esi, [arrow]
add esi,[esi+18d]
 
mov eax,esi
cmp [esi+BI.biBitCount], 24
je .img_24
.img_4:
add eax, [esi]
mov [pQuad],eax
add eax,64
415,30 → 544,68
mov [rBase],edi
sub [height],1
jnz .l1
jmp .copy
 
mov edi, LFBAddress
add edi, CURSOR_IMAGE_OFFSET
.img_24:
add eax, [esi]
mov [pQuad],eax
add eax, 0xC00
mov [pAnd],eax
mov eax,[esi+BI.biWidth]
mov [width],eax
mov ebx,[esi+BI.biHeight]
shr ebx,1
mov [height],ebx
 
mov edi, pCursor
add edi, 32*31*4
mov [rBase],edi
 
mov esi,[pAnd]
mov ebx, [pQuad]
.row_24:
mov eax, [esi]
bswap eax
mov [counter], 32
@@:
xor edx, edx
shl eax,1
setc dl
dec edx
 
mov ecx, [ebx]
and ecx, 0x00FFFFFF
and ecx, edx
and edx, 0xFF000000
or edx, ecx
mov [edi], edx
add ebx, 3
add edi, 4
dec [counter]
jnz @B
 
add esi, 4
mov edi,[rBase]
sub edi,128
mov [rBase],edi
sub [height],1
jnz .row_24
.copy:
mov edi, [dst]
mov ecx, 64*64
xor eax,eax
rep stosd
 
mov esi, pCursor
mov edi, LFBAddress
add edi, CURSOR_IMAGE_OFFSET
mov edi, [dst]
mov ebx, 32
lc:
cld
@@:
mov ecx, 32
lb:
mov eax, [esi]
mov [edi], eax
add esi, 4
add edi, 4
sub ecx, 1
jnz lb
 
rep movsd
add edi, 128
sub ebx, 1
jnz lc
dec ebx
jnz @B
 
ret
endp
572,7 → 739,6
ret
endp
 
 
align 4
engSetupSolidFill:
push ebp
641,25 → 807,24
dd (R9800XT shl 16)+VID_ATI
dd 0 ;terminator
 
;szKernel db 'KERNEL', 0
sz_ati_srv db 'ATI2D',0
user_file db '/rd/1/user.cur',0
version dd 0x00010001
 
sz_ati_srv db 'HWCURSOR',0
 
msgInit db 'detect hardware...',13,10,0
msgPCI db 'PCI accsess not supported',13,10,0
msgFail db 'device not found',13,10,0
 
user_arrow dd pArrow
 
align 16
pArrow:
file 'arrow.cur'
 
section '.data' data readable writable align 16
 
pCursor db 4096 dup(?)
 
cursors rb CURSOR_SIZE*64
cursor_map rd 2
cursor_start rd 1
cursor_end rd 1
 
bus dd ?
devfn dd ?
ati_io dd ?
/kernel/trunk/drivers/infinity.asm
28,6 → 28,7
 
public START
public service_proc
public version
 
extrn AttachIntHandler
extrn SysMsgBoardStr
46,6 → 47,7
extrn ServiceHandler
extrn FpuSave
extrn FpuRestore
extrn SendEvent
 
SND_CREATE_BUFF equ 2
SND_PLAY equ 3
74,11 → 76,9
 
proc START stdcall, state:dword
 
mov eax, [state]
cmp eax, 1
je .entry
jmp .exit
.entry:
cmp [state], 1
jne .exit
 
stdcall GetService, szSound
test eax, eax
jz .fail
401,15 → 401,12
; end if
 
stdcall dev_play, [hSound]
 
xor eax, eax
inc eax
ret
 
.fail:
xor eax, eax
ret
 
endp
 
align 4
430,11 → 427,9
xor eax, eax
inc eax
ret
 
.fail:
xor eax, eax
ret
 
endp
 
align 4
499,8 → 494,8
popf
xor eax, eax
ret
 
.find: btr [esi], eax
.find:
btr [esi], eax
popf
mov ebx, STREAM_SIZE
mul ebx
519,7 → 514,6
jnz .err
 
bts [stream_map], eax
 
ret
.err:
xor eax, eax
538,7 → 532,8
cmp eax, [esi+STR.limit]
jb .next
 
.m1: mov eax,[esi+STR.base]
.m1:
mov eax,[esi+STR.base]
mov [esi+STR.curr_seg], eax
.next:
add edx, 4
738,6 → 733,7
mm_mask dq 0xFF00FF00FF00FF00
 
stream_map dd 0xFFFF ; 16
version dd 0x00010001
 
szInfinity db 'INFINITY',0
szSound db 'SOUND',0
/kernel/trunk/drivers/mixer.asm
111,6 → 111,9
proc update_stream
locals
stream_index dd ?
ev_code dd ? ;EVENT
ev_offs dd ?
rd 4
endl
 
mov [stream_index], 0
176,17 → 179,19
 
ret
@@:
mov [ev_code], 0xFF000001
mov [ev_offs], ecx
mov eax, [ebx+STREAM.notify_task]
call pid_to_slot
 
lea edx, [ev_code]
push ebx
stdcall SendEvent, eax, edx
pop ebx
test eax, eax
jnz @f
jnz .l_end
 
not eax
mov [ebx+STREAM.notify_task], eax ;-1
jmp .l_end
@@:
shl eax, 8
mov [eax+PROC_BASE+32],ecx
or dword [eax+PROC_BASE+0xA8],EVENT_NOTIFY
.l_end:
inc [stream_index]
dec [play_count]
196,14 → 201,13
 
align 4
proc refill stdcall, str:dword
locals
ev_code dd ? ;EVENT
ev_offs dd ?
rd 4
endl
 
; if DEBUG
; mov esi, msgUser
; call [SysMsgBoardStr]
; end if
 
mov ebx, [str]
 
mov ecx, [ebx+STREAM.work_write]
cmp ecx, [ebx+STREAM.work_top]
jbe .m2
245,17 → 249,19
 
ret
@@:
mov [ev_code], 0xFF000001
mov [ev_offs], ecx
mov eax, [ebx+STREAM.notify_task]
call pid_to_slot
 
lea edx, [ev_code]
push ebx
stdcall SendEvent, eax, edx
pop ebx
test eax, eax
jnz @f
jnz @F
not eax
mov [ebx+STREAM.notify_task], eax ;-1
ret
@@:
shl eax, 8
mov [eax+PROC_BASE+32],ecx
or dword [eax+PROC_BASE+0xA8],EVENT_NOTIFY
ret
endp
 
/kernel/trunk/drivers/sceletone.asm
25,6 → 25,7
 
public START
public service_proc
public version
 
extrn AttachIntHandler
extrn SysMsgBoardStr
54,11 → 55,10
 
proc START stdcall, state:dword
 
mov eax, [state]
cmp eax, 1
je .entry
jmp .exit
cmp [state], 1
jne .exit
.entry:
 
if DEBUG
mov esi, msgInit
call SysMsgBoardStr
161,6 → 161,8
devices dd (DEVICE_ID shl 16)+VENDOR_ID
dd 0 ;terminator
 
version dd 0x00010001
 
my_service db 'MY_SERVICE',0 ;max 16 chars include zero
 
msgInit db 'detect hardware...',13,10,0
/kernel/trunk/drivers/sis.asm
249,6 → 249,7
 
public START
public service_proc
public version
 
extrn AttachIntHandler
extrn SysMsgBoardStr
267,11 → 268,9
 
proc START stdcall, state:dword
 
mov eax, [state]
cmp eax, 1
je .entry
jmp .stop
.entry:
cmp [state], 1
jne .stop
 
if DEBUG
mov esi, msgInit
call SysMsgBoardStr
323,7 → 322,6
 
mov esi, msgOk
call SysMsgBoardStr
 
ret
.fail:
if DEBUG
334,10 → 332,7
ret
.stop:
call stop
mov ax, 0x1c
mov edx, PCM_OUT_SR_REG
call [ctrl.ctrl_write16]
mov [ctrl.user_callback], 0
xor eax, eax
ret
endp
 
483,25 → 478,18
@@:
mov [edi], eax
mov [edi+4], ebx
 
mov [edi+32], eax
mov [edi+4+32], ebx
 
mov [edi+64], eax
mov [edi+4+64], ebx
 
mov [edi+96], eax
mov [edi+4+96], ebx
 
mov [edi+128], eax
mov [edi+4+128], ebx
 
mov [edi+160], eax
mov [edi+4+160], ebx
 
mov [edi+192], eax
mov [edi+4+192], ebx
 
mov [edi+224], eax
mov [edi+4+224], ebx
 
574,7 → 562,6
jz .next
cmp eax, -1
je .next
 
mov edi, devices
@@:
mov ebx, [edi]
586,7 → 573,8
add edi, 12
jmp @B
 
.next: inc [devfn]
.next:
inc [devfn]
cmp [devfn], 256
jb .next_dev
mov eax, [bus]
615,7 → 603,6
 
mov esi, [edi+8]
mov [ctrl.ctrl_setup], esi
 
ret
.err:
xor eax, eax
697,8 → 684,6
 
mov edx, MC_IN_CR_REG
call [ctrl.ctrl_write8]
 
 
ret
endp
 
799,7 → 784,6
mov esi, msgWRFail
call SysMsgBoardStr
end if
 
stc
ret
.ok:
887,13 → 871,12
align 4
proc stop
mov edx, PCM_OUT_CR_REG
mov ax, 0x14
mov ax, 0x0
call [ctrl.ctrl_write8]
 
mov eax, 16
mov [ctrl.lvi_reg], eax
mov edx, PCM_OUT_LVI_REG
call [ctrl.ctrl_write8]
mov ax, 0x1c
mov edx, PCM_OUT_SR_REG
call [ctrl.ctrl_write16]
ret
endp
 
1131,6 → 1114,8
devices dd (CTRL_SIS shl 16)+VID_SIS,msg_AC, set_SIS
dd 0
 
version dd 0x00010001
 
msg_AC db '7012 AC97 controller',13,10, 0
msg_SIS db 'Silicon Integrated Systems',13,10, 0
 
/kernel/trunk/drivers/unisound.asm
275,6 → 275,7
 
public START
public service_proc
public version
 
extrn AttachIntHandler
extrn SysMsgBoardStr
293,10 → 294,8
 
proc START stdcall, state:dword
 
mov eax, [state]
cmp eax, 1
cmp [state], 1
jne .stop
.entry:
 
if DEBUG
mov esi, msgInit
376,6 → 375,7
ret
.stop:
call stop
xor eax, eax
ret
endp
 
1011,14 → 1011,9
align 4
proc stop
mov edx, PCM_OUT_CR_REG
mov ax, 0x14
mov ax, 0x0
call [ctrl.ctrl_write8]
 
mov eax, 16
mov [ctrl.lvi_reg], eax
mov edx, PCM_OUT_LVI_REG
call [ctrl.ctrl_write8]
 
mov ax, 0x1c
mov edx, PCM_OUT_SR_REG
call [ctrl.ctrl_write16]
1336,6 → 1331,8
 
dd 0 ;terminator
 
version dd 0x00010001
 
msg_ICH db 'Intel ICH', 13,10, 0
msg_ICH0 db 'Intel ICH0', 13,10, 0
msg_ICH2 db 'Intel ICH2', 13,10, 0