fixed bug in init_LFB()

git-svn-id: svn://kolibrios.org@389 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2007-03-05 21:37:28 +00:00
parent 9140ef0cce
commit 3764b8d630
13 changed files with 87 additions and 77 deletions

View File

@ -9,7 +9,7 @@ uglobal
endg
fdc_init: ;start with clean tracks.
mov edi,0xD201
mov edi,OS_BASE+0xD201
mov al,0
mov ecx,160
rep stosb
@ -22,7 +22,7 @@ fdc_filesave: ;ebx: cluster to be saved.
mov bl,18
div bl
mov ah,0
add eax,0xD201
add eax,OS_BASE+0xD201
mov [eax],byte 1 ;This track is now dirty.
popa
ret

View File

@ -25,7 +25,7 @@ hd_read:
push ecx esi edi ; scan cache
mov ecx,cache_max ; entries in cache
mov esi,0x600000+8
mov esi,OS_BASE+0x600000+8
mov edi,1
hdreadcache:
@ -54,7 +54,7 @@ hd_read:
call hd_read_pio
@@:
lea esi,[edi*8+0x600000]
lea esi,[edi*8+OS_BASE+0x600000]
mov [esi],eax ; sector number
mov dword [esi+4],1 ; hd read - mark as same as in hd
@ -62,7 +62,7 @@ hd_read:
mov esi,edi
shl esi,9
add esi,0x600000+65536
add esi,OS_BASE+0x600000+65536
mov edi,ebx
mov ecx,512/4
cld
@ -77,7 +77,7 @@ hd_read_pio:
call wait_for_hd_idle
cmp [hd_error],0
jne hd_read_error
jne hd_read_error
cli
xor eax,eax
@ -115,7 +115,7 @@ hd_read_pio:
cli
push edi
shl edi,9
add edi,0x600000+65536
add edi,OS_BASE+0x600000+65536
mov ecx,256
mov edx,[hdbase]
cld
@ -126,7 +126,7 @@ hd_read_pio:
pop edx eax
ret
disable_ide_int:
disable_ide_int:
; mov edx,[hdbase]
; add edx,0x206
; mov al,2
@ -153,7 +153,7 @@ hd_write:
; check if the cache already has the sector and overwrite it
mov ecx,cache_max
mov esi,0x600000+8
mov esi,OS_BASE+0x600000+8
mov edi,1
hdwritecache:
@ -178,7 +178,7 @@ hd_write:
cmp [hd_error],0
jne hd_write_access_denied
lea esi,[edi*8+0x600000]
lea esi,[edi*8+OS_BASE+0x600000]
mov [esi],eax ; sector number
yes_in_cache_write:
@ -186,7 +186,7 @@ hd_write:
mov dword [esi+4],2 ; write - differs from hd
shl edi,9
add edi,0x600000+65536
add edi,OS_BASE+0x600000+65536
mov esi,ebx
mov ecx,512/4
cld
@ -205,7 +205,7 @@ write_cache:
; write difference ( 2 ) from cache to hd
mov ecx,cache_max
mov esi,0x600000+8
mov esi,OS_BASE+0x600000+8
mov edi,1
write_cache_more:
@ -323,7 +323,7 @@ cache_write_pio:
; cli
mov esi,edi
shl esi,9
add esi,0x600000+65536 ; esi = from memory position
add esi,OS_BASE+0x600000+65536 ; esi = from memory position
mov ecx,256
mov edx,[hdbase]
cld
@ -357,7 +357,7 @@ find_empty_slot:
inside_cache:
cmp dword [edi*8+0x600000+4],2 ; get cache slot info
cmp dword [edi*8+OS_BASE+0x600000+4],2 ; get cache slot info
jb found_slot ; it's empty or read
dec ecx
jnz search_for_empty
@ -378,7 +378,7 @@ align 4
clear_hd_cache:
push eax ecx edi
mov edi,0x600000
mov edi,OS_BASE+0x600000
mov ecx,16384
xor eax,eax
cld
@ -484,7 +484,7 @@ wait_for_hd_idle:
in al,dx
test al,128
jnz wfhil1
@@:
pop edx eax
@ -574,7 +574,7 @@ iglobal
align 4
; note that IDE descriptor table must be 4-byte aligned and do not cross 4K boundary
IDE_descriptor_table:
dd 284000h
dd OS_BASE+284000h
dw 2000h
dw 8000h
@ -607,16 +607,16 @@ hdd_irq14:
out dx, al
call update_counters
mov ebx, [dma_process]
cmp [0x3000], ebx
cmp [CURRENT_TASK], ebx
jz .noswitch
mov [dma_task_switched], 1
mov edi, [dma_slot_ptr]
mov eax, [0x3000]
mov eax, [CURRENT_TASK]
mov [dma_process], eax
mov eax, [0x3010]
mov eax, [TASK_BASE]
mov [dma_slot_ptr], eax
mov [0x3000], ebx
mov [0x3010], edi
mov [CURRENT_TASK], ebx
mov [TASK_BASE], edi
mov byte [0xFFFF], 1
call do_change_task
.noswitch:
@ -638,16 +638,16 @@ hdd_irq15:
out dx, al
call update_counters
mov ebx, [dma_process]
cmp [0x3000], ebx
cmp [CURRENT_TASK], ebx
jz .noswitch
mov [dma_task_switched], 1
mov edi, [dma_slot_ptr]
mov eax, [0x3000]
mov eax, [CURRENT_TASK]
mov [dma_process], eax
mov eax, [0x3010]
mov eax, [TASK_BASE]
mov [dma_slot_ptr], eax
mov [0x3000], ebx
mov [0x3010], edi
mov [CURRENT_TASK], ebx
mov [TASK_BASE], edi
mov byte [0xFFFF], 1
call do_change_task
.noswitch:
@ -668,11 +668,11 @@ hd_read_dma:
mov eax, [esp+4]
sub eax, [dma_cur_sector]
shl eax, 9
add eax, 0x284000
add eax, OS_BASE+0x284000
push ecx esi edi
mov esi, eax
shl edi, 9
add edi, 0x610000
add edi, OS_BASE+0x610000
mov ecx, 512/4
cld
rep movsd
@ -681,9 +681,9 @@ hd_read_dma:
pop eax
ret
.notread:
mov eax, IDE_descriptor_table
mov dword [eax], 0x284000
mov word [eax+4], 0x2000
mov eax, IDE_descriptor_table-OS_BASE
mov dword [eax+OS_BASE], 0x284000
mov word [eax+4+OS_BASE], 0x2000
mov dx, [IDEContrRegsBaseAddr]
cmp [hdbase], 0x1F0
jz @f
@ -734,9 +734,9 @@ hd_read_dma:
@@:
mov al, 9
out dx, al
mov eax, [0x3000]
mov eax, [CURRENT_TASK]
mov [dma_process], eax
mov eax, [0x3010]
mov eax, [TASK_BASE]
mov [dma_slot_ptr], eax
cmp [hdbase], 0x1F0
jnz .ide1
@ -766,7 +766,7 @@ write_cache_chain:
mov eax, IDE_descriptor_table
mov edx, [cache_chain_pos]
shl edx, 9
add edx, 0x610000
add edx, OS_BASE+0x610000
mov [eax], edx
movzx edx, [cache_chain_size]
shl edx, 9
@ -777,7 +777,7 @@ write_cache_sector:
mov eax, IDE_descriptor_table
mov edx, edi
shl edx, 9
add edx, 0x610000
add edx, OS_BASE+0x610000
mov [eax], edx
mov word [eax+4], 0x200
do_write_dma:
@ -832,9 +832,9 @@ do_write_dma:
@@:
mov al, 1
out dx, al
mov eax, [0x3000]
mov eax, [CURRENT_TASK]
mov [dma_process], eax
mov eax, [0x3010]
mov eax, [TASK_BASE]
mov [dma_slot_ptr], eax
cmp [hdbase], 0x1F0
jnz .ide1

View File

@ -424,19 +424,22 @@ proc init_LFB
.map_page_tables:
@@:
call alloc_page
stdcall map_page_table, edx, eax
add esi, 0x00400000
add edx, 0x00400000
dec edi
jnz @B
jnz .map_page_tables
mov eax, [LFBAddress]
mov edi, page_tabs + (LFB_BASE shr 10)
or eax, PG_UW
mov ecx, [pg_count]
cld
rep stosd
@@:
stosd
add eax, 0x1000
dec ecx
jnz @B
mov dword [LFBAddress], LFB_BASE
mov eax, cr3 ;flush TLB

View File

@ -7,6 +7,7 @@
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
align 4
idtreg:
dw 8*0x41-1
dd idts+8

View File

@ -12,25 +12,25 @@ FindHDD:
mov [DiskNumber],0
call FindHDD_3
; mov ax,[Sector512+176]
; mov [0x40006],ax
; mov [DRIVE_DATA+6],ax
; mov ax,[Sector512+126]
; mov [0x40008],ax
; mov [DRIVE_DATA+8],ax
; mov ax,[Sector512+128]
; mov [0x40008],ax
; mov [DRIVE_DATA+8],ax
mov [DiskNumber],1
call FindHDD_3
; mov al,[Sector512+176]
; mov [0x40007],al
; mov [DRIVE_DATA+7],al
inc [ChannelNumber]
mov [DiskNumber],0
call FindHDD_3
; mov al,[Sector512+176]
; mov [0x40008],al
; mov [DRIVE_DATA+8],al
mov [DiskNumber],1
call FindHDD_1
; mov al,[Sector512+176]
; mov [0x40009],al
; mov [DRIVE_DATA+9],al
jmp EndFindHDD
FindHDD_1:
@ -41,7 +41,7 @@ FindHDD_1:
ja FindHDD_2
cmp [Sector512+12],word 255
ja FindHDD_2
inc byte [0x40001]
inc byte [DRIVE_DATA+1]
jmp FindHDD_2_2
FindHDD_2:
call DeviceReset
@ -50,14 +50,14 @@ FindHDD_1:
call ReadCD_ID
cmp [DevErrorCode],0
jne FindHDD_2_2
inc byte [0x40001]
inc byte [0x40001]
inc byte [DRIVE_DATA+1]
inc byte [DRIVE_DATA+1]
FindHDD_2_2:
ret
FindHDD_3:
call FindHDD_1
shl byte [0x40001],2
shl byte [DRIVE_DATA+1],2
ret
@ -84,7 +84,7 @@ ReadHDD_ID:
cmp [DevErrorCode],0 ;ïðîâåðèòü êîä îøèáêè
jne @@End ;çàêîí÷èòü, ñîõðàíèâ êîä îøèáêè
mov DX,[ATABasePortAddr]
add DX,7 ;адрес регистра состояния
add DX,7 ;àäðåñ ðåãèñòðà ñîñòîÿíè
mov ecx,0xffff
@@WaitCompleet:
; Ïðîâåðèòü âðåìÿ âûïîëíåíèÿ êîìàíäû
@ -191,15 +191,15 @@ SendCommandToHDD:
; mov eax,[timer_ticks]
; mov [TickCounter_1],eax
@@WaitHDReady:
; Проверить время ожидания
; Ïðîâåðèòü âðåìÿ îæèäàíè
dec ecx
cmp ecx,0
je @@Err1
; mov eax,[timer_ticks]
; sub eax,[TickCounter_1]
; cmp eax,300 ;ожидать 300 тиков
; cmp eax,300 ;îæèäàòü 300 òèêîâ
; ja @@Err1 ;îøèáêà òàéì-àóòà
; Прочитать регистр состояния
; Ïðî÷èòàòü ðåãèñòð ñîñòîÿíè
in AL,DX
; Ïðîâåðèòü ñîñòîÿíèå ñèãíàëà BSY
test AL,80h
@ -255,7 +255,7 @@ SendCommandToHDD:
jmp @@End_2
@@Err5: mov [DevErrorCode],5
; Çàâåðøåíèå ðàáîòû ïðîãðàììû
@@End_2:
@@End_2:
ret
;*************************************************
@ -285,7 +285,7 @@ ReadCD_ID:
add DX,7 ;ïîðò 1õ7h
mov ecx,0xffff
@@WaitCompleet_1:
; Проверить время
; Ïðîâåðèòü âðåì
dec ecx
cmp ecx,0
je @@Error1_1 ;îøèáêà òàéì-àóòà
@ -348,11 +348,11 @@ DeviceReset:
out DX,AL
mov ecx,0x80000
@@WaitHDReady_1:
; Проверить время ожидания
; Ïðîâåðèòü âðåìÿ îæèäàíè
dec ecx
cmp ecx,0
je @@Err1_2 ;îøèáêà òàéì-àóòà
; Прочитать регистр состояния
; Ïðî÷èòàòü ðåãèñòð ñîñòîÿíè
in AL,DX
; Ïðîâåðèòü ñîñòîÿíèå ñèãíàëà BSY
test AL,80h

View File

@ -389,8 +389,8 @@ choice_necessity_partition:
choice_necessity_partition_1:
mov ecx,[hdpos]
xor eax,eax
mov [0xfe10], eax ; entries in hd cache
mov edx,0x40002
mov [hd_entries], eax ; entries in hd cache
mov edx,DRIVE_DATA+2
search_partition_array:
mov bl,[edx]
movzx ebx,bl
@ -402,7 +402,7 @@ choice_necessity_partition_1:
dec eax
xor edx,edx
imul eax,100
add eax,0x4000a
add eax,DRIVE_DATA+0xa
mov [transfer_adress],eax
call partition_data_transfer_1
ret

View File

@ -427,7 +427,7 @@ fs_OnHd:
mov [hdpos], eax
cmp ecx, 0x100
jae .nf
cmp cl, [0x40001+eax]
cmp cl, [DRIVE_DATA+eax]
jbe @f
.nf:
call free_hd_channel
@ -503,7 +503,7 @@ fs_OnCd:
jae .nf
push ecx ebx
mov cl,al
mov bl,[0x40001]
mov bl,[DRIVE_DATA+1]
shr bl,cl
test bl,2
pop ebx ecx

View File

@ -516,7 +516,7 @@ display_settings:
repos_windows:
mov ecx,[TASK_COUNT]
mov edi,0x20*2
mov edi, OS_BASE+0x20*2
mov byte[REDRAW_BACKGROUND],1
dec ecx
jge @f
@ -537,6 +537,7 @@ repos_windows:
neg eax
mov [edi+WDATA.box.height],eax
.lp1:
call set_window_clientbox
add edi,0x20
loop @b

View File

@ -100,6 +100,7 @@ save_draw_mouse:
mov ecx, [ScreenWidth]
inc ecx
mul ecx
movzx edx, byte [display_data+ebx+eax]
shl edx, 8
mov ecx, [edx+SLOT_BASE+APPDATA.cursor]
@ -320,9 +321,10 @@ yes_mouse_disable:
disable_m:
cmp dword [MOUSE_VISIBLE],dword 0
jne no_mouse_disable
pushf
cli
call draw_mouse_under
sti
popf
mov [MOUSE_VISIBLE],dword 1
no_mouse_disable:
popad
@ -350,9 +352,10 @@ __sys_draw_pointer:
mov [MOUSE_VISIBLE], dword 0
movzx ebx,word [MOUSE_Y]
movzx eax,word [MOUSE_X]
pushfd
cli
call save_draw_mouse
sti
popfd
nodmu2:
popad
ret
@ -367,10 +370,11 @@ chms00:
jne redrawmouse
jmp nodmp
redrawmouse:
pushfd
cli
call draw_mouse_under
call save_draw_mouse
sti
popfd
nodmp:
popad
ret

View File

@ -5061,6 +5061,7 @@ align 4
cpu_caps dd 4 dup(0)
pg_data PG_DATA
heap_test dd ?
hd_entries rd 1 ;unused ? 0xfe10
endg
iglobal

View File

@ -18,7 +18,7 @@ SB16_play_music equ 0xc0000001
DMAPage equ 0x2A
Rate equ 44100
SB16Buffer equ 0x2A0000
SB16_Status equ SB16Buffer+65536
;SB16_Status equ SB16Buffer+65536
iglobal
sound_data_format dd 0x1

View File

@ -38,7 +38,7 @@
getpixel:
push eax ebx edx edi
call dword [0xe024]
call dword [GETPIXEL]
pop edi edx ebx eax
ret

View File

@ -1,6 +1,6 @@
;
; Load of videomode driver in memory
;
;
; (driver is located at 0x760000-0x768000 - 32kb) // if this area not occuped anything
;
; Author: Trans
@ -13,11 +13,11 @@
; LOAD VIDEOMODE DRIVER
; If vmode.mdr file not found
or eax,-1 ; Driver ID = -1 (not present in system)
mov [0x760000],eax ;
mov [0x760100],byte 0xC3 ; Instruction RETN - driver loop
mov [OS_BASE+0x760000],eax ;
mov [OS_BASE+0x760100],byte 0xC3 ; Instruction RETN - driver loop
mov esi, vmode
xor ebx, ebx
mov ecx, 0x8000 ; size of memory area for driver
mov edx, 0x760000 ; Memory position of driver
call fs_RamdiskRead
mov edx, OS_BASE+0x760000 ; Memory position of driver
call fs_RamdiskRead