merge trunk

git-svn-id: svn://kolibrios.org@2010 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2011-07-22 18:08:47 +00:00
parent 49a8960d6e
commit f59df34e17
42 changed files with 2527 additions and 693 deletions

View File

@ -239,10 +239,10 @@ SendPacketDatCommand:
in AL,DX
test AL,80h ;состояние сигнала BSY
jnz @@WaitDevice0
test AL,08h ;состояние сигнала DRQ
jz @@WaitDevice0
test AL,1 ;состояние сигнала ERR
jnz @@Err6
test AL,08h ;состояние сигнала DRQ
jz @@WaitDevice0
; Послать пакетную команду
cli
mov DX,[ATABasePortAddr]
@ -282,10 +282,10 @@ SendPacketDatCommand:
in AL,DX
test AL,80h ;состояние сигнала BSY
jnz @@WaitDevice1
test AL,08h ;состояние сигнала DRQ
jz @@WaitDevice1
test AL,1 ;состояние сигнала ERR
jnz @@Err6_temp
test AL,08h ;состояние сигнала DRQ
jz @@WaitDevice1
; Принять блок данных от контроллера
mov EDI,[CDDataBuf_pointer] ;0x7000 ;CDDataBuf
; Загрузить адрес регистра данных контроллера

View File

@ -49,6 +49,12 @@ hd_read:
; Read through BIOS?
cmp [hdpos], 0x80
jae .bios
; hd_read_{dma,pio} use old ATA with 28 bit for sector number
cmp eax, 0x10000000
jb @f
inc [hd_error]
jmp return_01
@@:
; DMA read is permitted if [allow_dma_access]=1 or 2
cmp [allow_dma_access], 2
ja .nodma
@ -235,6 +241,8 @@ hd_write:
align 4
cache_write_pio:
cmp dword[esi],0x10000000
jae .bad
; call disable_ide_int
call wait_for_hd_idle
@ -295,6 +303,9 @@ cache_write_pio:
pop esi ecx
ret
.bad:
inc [hd_error]
ret
save_hd_wait_timeout:
@ -686,6 +697,9 @@ write_cache_sector:
write_cache_chain:
cmp [hdpos], 0x80
jae bd_write_cache_chain
mov eax,[cache_chain_ptr]
cmp dword[eax],0x10000000
jae .bad
push esi
mov eax, IDE_descriptor_table
mov edx,eax
@ -779,6 +793,9 @@ write_cache_chain:
jnz hd_write_error_dma
pop esi
ret
.bad:
inc [hd_error]
ret
uglobal
IDEContrRegsBaseAddr dw ?
@ -916,7 +933,9 @@ int13_call:
mov [ebx+v86_regs.eflags], 20200h
mov esi, [sys_v86_machine]
mov ecx, 0x502
push fs
call v86_start
pop fs
and [bios_hdpos], 0
pop edi esi ecx ebx
movzx edx, byte [OS_BASE + 512h]

View File

@ -91,6 +91,7 @@ boot_read_floppy:
inc si
cmp si, 10
jb @b
sayerr_badsect:
mov si, badsect
sayerr_plain:
call printplain
@ -145,8 +146,119 @@ FirstDataSector dw 0 ; begin of data
;=========================================================================
include 'bootvesa.inc' ;Include source for boot vesa
if defined extended_primary_loader
include 'parsers.inc'
end if
start_of_code:
if defined extended_primary_loader
; save data from primary loader
mov word [cs:bootcallback], si
mov word [cs:bootcallback+2], ds
push cs
pop ds
mov [bootdevice], ax
mov [bootfs], bx
; set up stack
mov ax, 3000h
mov ss, ax
mov sp, 0EC00h
; try to load configuration file
mov ax, 1
mov di, config_file_struct
call [bootcallback]
cld
push cs
pop es
; bx=0 - ok, bx=1 - part of file loaded, assume this is ok
cmp bx, 1
ja .config_bad
; configuration file was loaded, parse
; if length is too big, use first 0FFFFh bytes
test dx, dx
jz @f
mov ax, 0FFFFh
@@:
; ds:si will be pointer to current data, dx = limit
xchg ax, dx
push 4000h
pop ds
xor si, si
.parse_loop:
; skip spaces
cmp si, dx
jae .parse_done
lodsb
cmp al, ' '
jbe .parse_loop
dec si
; loop over all possible configuration values
mov bx, config_file_variables
.find_variant:
; get length
mov cx, [es:bx]
; zero length = end of list
jecxz .find_newline
; skip over length
inc bx
inc bx
mov di, bx
; skip over string
add bx, cx
; test whether we have at least cx symbols left
mov ax, cx
add ax, si
jc .next_variant1
cmp ax, dx
jae .next_variant1
; save current position
push si
; compare strings
repz cmpsb
jnz .next_variant2
; strings are equal; look for "=" with possible spaces before and after
@@:
cmp si, dx
jae .next_variant2
lodsb
cmp al, ' '
jbe @b
cmp al, '='
jnz .next_variant2
; ok, we found the true variant
; ignore saved position on the stack
pop ax
; call the parser
call word [es:bx]
; line parsed, find next
.find_newline:
cmp si, dx
jae .parse_done
lodsb
cmp al, 13
jz .parse_loop
cmp al, 10
jz .parse_loop
jmp .find_newline
.next_variant2:
; continue to the next variant, restoring current position
pop si
.next_variant1:
; continue to the next variant
; skip over the parser
inc bx
inc bx
jmp .find_variant
.parse_done:
.config_bad:
; set up segment registers
push cs
pop ds
else
cld
; \begin{diamond}[02.12.2005]
; if bootloader sets ax = 'KL', then ds:si points to loader block
@ -175,6 +287,7 @@ no_hd_load:
pop ds
push cs
pop es
end if
; set videomode
mov ax, 3
@ -378,6 +491,7 @@ wait_loop: ; variant 2
apm_end:
_setcursor d80x25_top_num, 0
if ~ defined extended_primary_loader
;CHECK current of code
cmp [cfgmanager.loader_block], -1
jz noloaderblock
@ -387,6 +501,7 @@ apm_end:
jnz sayerr
push 0
pop es
end if
noloaderblock:
; DISPLAY VESA INFORMATION
@ -404,7 +519,9 @@ cfgmanager:
; d) preboot_device = from what boot?
; determine default settings
if ~ defined extended_primary_loader
mov [.bSettingsChanged], 0
end if
;.preboot_gr_end:
mov di, preboot_device
@ -412,6 +529,12 @@ cfgmanager:
; set it to use this preloaded image
cmp byte [di], 0
jnz .preboot_device_inited
if defined extended_primary_loader
inc byte [di]
cmp byte [bootdevice], 'f' ; floppy?
jz .preboot_device_inited
inc byte [di]
else
cmp [.loader_block], -1
jz @f
les bx, [.loader_block]
@ -422,6 +545,7 @@ cfgmanager:
@@:
; otherwise, set [preboot_device] to 1 (default value - boot from floppy)
mov byte [di], 1
end if
.preboot_device_inited:
; following 4 lines set variables to 1 if its current value is 0
cmp byte [di+preboot_dma-preboot_device], 1
@ -466,7 +590,11 @@ cfgmanager:
mov si, preboot_device_msg
call print
mov al, [preboot_device]
if defined extended_primary_loader
and eax, 3
else
and eax, 7
end if
mov si, [preboot_device_msgs+eax*2]
call printplain
.show_remarks:
@ -553,12 +681,18 @@ cfgmanager:
_setcursor 15,0
mov si, bdev
call print
if defined extended_primary_loader
mov bx, '12'
else
mov bx, '14'
end if
call getkey
mov [preboot_device], al
_setcursor 13,0
.d:
if ~ defined extended_primary_loader
mov [.bSettingsChanged], 1
end if
call clear_vmodes_table ;clear vmodes_table
jmp .printcfg
.change_a:
@ -672,10 +806,14 @@ cfgmanager:
virtual at novesa
.oldtimer dd ?
.starttime dd ?
if ~ defined extended_primary_loader
.bSettingsChanged db ?
end if
.timer dd ?
end virtual
if ~ defined extended_primary_loader
.loader_block dd -1
end if
.gettime:
mov ah, 0
int 1Ah
@ -692,7 +830,11 @@ end virtual
pushad
call .gettime
sub eax, [.starttime]
if defined extended_primary_loader
sub ax, [preboot_timeout]
else
sub ax, 18*5
end if
jae .timergo
neg ax
add ax, 18-1
@ -748,6 +890,7 @@ end if
mov si, loading_msg
call print
_setcursor 15,0
if ~ defined extended_primary_loader
cmp [.bSettingsChanged], 0
jz .load
cmp [.loader_block], -1
@ -788,6 +931,7 @@ end if
call printplain
_setcursor 15,0
.load:
end if
; \end{diamond}[02.12.2005]
; ASK GRAPHICS MODE
@ -816,7 +960,7 @@ end if
mov [boot_dev], al
; GET MEMORY MAP
include 'detect/biosmem.inc'
include '../detect/biosmem.inc'
; READ DISKETTE TO MEMORY
@ -967,6 +1111,7 @@ sayerr_floppy:
mov dx, 0x3f2
mov al, 0
out dx, al
sayerr_memmove:
mov si, memmovefailed
jmp sayerr_plain
@@:
@ -1145,6 +1290,40 @@ no_sys_on_floppy:
mov al, 0
out dx, al
if defined extended_primary_loader
cmp [boot_dev], 1
jne no_sys_from_primary
; load kolibri.img using callback from primary loader
and word [movedesc + 24 + 2], 0
mov byte [movedesc + 24 + 4], 10h
; read in blocks of 64K until file is fully loaded
mov ax, 1
.repeat:
mov di, image_file_struct
call [bootcallback]
push cs
pop ds
push cs
pop es
cmp bx, 1
ja sayerr_badsect
push bx
mov si, movedesc
and word [si + 16 + 2], 0
mov byte [si + 16 + 4], 4
mov ah, 87h
mov cx, 8000h
int 15h
pop bx
test ah, ah
jnz sayerr_memmove
inc byte [si + 24 + 4]
test bx, bx
jz no_sys_from_primary
mov ax, 2
jmp .repeat
no_sys_from_primary:
end if
; SET GRAPHICS

View File

@ -40,11 +40,15 @@ vrrmprint db "Apply VRR? (picture frequency greater than 60Hz"
ask_bd db "Add disks visible by BIOS emulated in V86-mode? [1-yes, 2-no]: ",0
if defined extended_primary_loader
bdev db "Load ramdisk from [1-floppy; 2-C:\kolibri.img (FAT32);"
db 13,10,186," "
db "3-use preloaded ram-image from kernel restart;"
db 13,10,186," "
db "4-create blank image]: ",0
else
bdev db "Load ramdisk from [1-floppy; 2-kolibri.img]: ",0
end if
probetext db 13,10,13,10,186," Use standart graphics mode? [1-yes, "
db "2-probe bios (Vesa 3.0)]: ",0
;memokz256 db 13,10,186," RAM 256 Mb",0
@ -88,14 +92,22 @@ off_msg db " off",13,10,0
;readonly_msg db " only for reading",13,10,0
vrrm_msg db " [c] Use VRR:",0
preboot_device_msg db " [d] Floppy image: ",0
if defined extended_primary_loader
preboot_device_msgs dw 0,pdm1,pdm2,0
pdm1 db "real floppy",13,10,0
pdm2 db "C:\kolibri.img (FAT32)",13,10,0
else
preboot_device_msgs dw 0,pdm1,pdm2,pdm3
pdm1 db "real floppy",13,10,0
pdm2 db "C:\kolibri.img (FAT32)",13,10,0
pdm3 db "use already loaded image",13,10,0
pdm4 db "create blank image",13,10,0
end if
loading_msg db "Loading KolibriOS...",0
if ~ defined extended_primary_loader
save_quest db "Remember current settings? [y/n]: ",0
loader_block_error db "Bootloader data invalid, I cannot continue. Stopped.",0
end if
_st db 186,' ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄ¿',13,10,0
_r1 db 186,' ³ 320x200 EGA/CGA 256 colors ³ ³',13,10,0

View File

@ -50,11 +50,15 @@ ask_bd db "Add disks visible by BIOS emulated in V86-mode? [1-yes, 2-no
;mem_model db 13,10,186," Motherboard memory [1-16 Mb / 2-32 Mb / "
; db "3-64Mb / 4-128 Mb / 5-256 Mb] ? ",0
;bootlog db 13,10,186," After bootlog display [1-continue/2-pause] ? ",0
if defined extended_primary_loader
bdev db "Paigalda mäluketas [1-diskett; 2-kolibri.img]: ",0
else
bdev db "Paigalda mäluketas [1-diskett; 2-C:\kolibri.img (FAT32);"
db 13,10,186," "
db "3-kasuta eellaaditud mäluketast kerneli restardist;"
db 13,10,186," "
db "4-loo tühi pilt]: ",0
end if
probetext db 13,10,13,10,186," Kasuta standartset graafika reziimi? [1-jah, "
db "2-leia biosist (Vesa 3.0)]: ",0
;memokz256 db 13,10,186," RAM 256 Mb",0
@ -99,14 +103,22 @@ off_msg db " v
;readonly_msg db " ainult lugemiseks",13,10,0
vrrm_msg db " [c] Kasuta VRR:",0
preboot_device_msg db " [d] Disketi kujutis: ",0
if defined extended_primary_loader
preboot_device_msgs dw 0,pdm1,pdm2,0
pdm1 db "reaalne diskett",13,10,0
pdm2 db "kolibri.img",13,10,0
else
preboot_device_msgs dw 0,pdm1,pdm2,pdm3
pdm1 db "reaalne diskett",13,10,0
pdm2 db "C:\kolibri.img (FAT32)",13,10,0
pdm3 db "kasuta juba laaditud kujutist",13,10,0
pdm4 db "loo tühi pilt",13,10,0
end if
loading_msg db "Laadin KolibriOS...",0
if ~ defined extended_primary_loader
save_quest db "Jäta meelde praegused seaded? [y/n]: ",0
loader_block_error db "Alglaaduri andmed vigased, ei saa jätkata. Peatatud.",0
end if
remark1 db "Default values were selected to match most of configurations, but not all.",0
remark2 db "If you have CRT-monitor, enable VRR in the item [c].",0

View File

@ -55,11 +55,15 @@ ask_bd db "Add disks visible by BIOS emulated in V86-mode? [1-yes, 2-no
;mem_model db 13,10,186," Hauptspeicher [1-16 Mb / 2-32 Mb / "
; db "3-64Mb / 4-128 Mb / 5-256 Mb] ? ",0
;bootlog db 13,10,186," After bootlog display [1-continue/2-pause] ? ",0
if defined extended_primary_loader
bdev db "Lade die Ramdisk von [1-Diskette; 2-kolibri.img]: ",0
else
bdev db "Lade die Ramdisk von [1-Diskette; 2-C:\kolibri.img (FAT32);"
db 13,10,186," "
db "3-benutze ein bereits geladenes Kernel image;"
db 13,10,186," "
db "4-create blank image]: ",0
end if
probetext db 13,10,13,10,186," Nutze Standardgrafikmodi? [1-ja, "
db "2-BIOS Test (Vesa 3.0)]: ",0
;memokz256 db 13,10,186," RAM 256 Mb",0
@ -104,14 +108,22 @@ off_msg db " aus",13,10,0
;readonly_msg db " fur Lesen",13,10,0
vrrm_msg db " [c] Nutze VRR:",0
preboot_device_msg db " [d] Diskettenimage: ",0
if defined extended_primary_loader
preboot_device_msgs dw 0,pdm1,pdm2,0
pdm1 db "Echte Diskette",13,10,0
pdm2 db "kolibri.img",13,10,0
else
preboot_device_msgs dw 0,pdm1,pdm2,pdm3
pdm1 db "Echte Diskette",13,10,0
pdm2 db "C:\kolibri.img (FAT32)",13,10,0
pdm3 db "Nutze bereits geladenes Image",13,10,0
pdm4 db "create blank image",13,10,0
end if
loading_msg db "Lade KolibriOS...",0
if ~ defined extended_primary_loader
save_quest db "Aktuelle Einstellungen speichern? [y/n]: ",0
loader_block_error db "Bootloader Daten ungueltig, Kann nicht fortfahren. Angehalten.",0
end if
remark1 db "Default values were selected to match most of configurations, but not all.",0
remark2 db "If you have CRT-monitor, enable VRR in the item [c].",0

View File

@ -33,11 +33,15 @@ vrrmprint db "
db 186," 1024*768>800*600 ¨ 800*600>640*480) [1-¤ , 2-­¥â]: ",0
;ask_dma db "ˆá¯®«ì§®¢ âì DMA ¤«ï ¤®áâ㯠 ª HDD? [1-¤ , 2-⮫쪮 ç⥭¨¥, 3-­¥â]: ",0
ask_bd db "„®¡ ¢¨âì ¤¨áª¨, ¢¨¤¨¬ë¥ ç¥à¥§ BIOS ¢ ०¨¬¥ V86? [1-¤ , 2-­¥â]: ",0
if defined extended_primary_loader
bdev db "‡ £à㧨âì ®¡à § ¨§ [1-¤¨áª¥â ; 2-kolibri.img ¨§ ¯ ¯ª¨ § £à㧪¨]: ",0
else
bdev db "‡ £à㧨âì ®¡à § ¨§ [1-¤¨áª¥â ; 2-C:\kolibri.img (FAT32);"
db 13,10,186," "
db "3-¨á¯®«ì§®¢ âì 㦥 § £à㦥­­ë© ®¡à §;"
db 13,10,186," "
db "4-ᮧ¤ âì ç¨áâë© ®¡à §]: ",0
end if
prnotfnd db "Žè¨¡ª  - ‚¨¤¥®à¥¦¨¬ ­¥ ­ ©¤¥­.",0
not386 db "Žè¨¡ª  - ’ॡã¥âáï ¯à®æ¥áá®à 386+.",0
fatalsel db "Žè¨¡ª  - ‚ë¡à ­­ë© ¢¨¤¥®à¥¦¨¬ ­¥ ¯®¤¤¥à¦¨¢ ¥âáï.",0
@ -67,14 +71,22 @@ off_msg db "
readonly_msg db " ⮫쪮 ç⥭¨¥",13,10,0
vrrm_msg db " [c] ˆá¯®«ì§®¢ ­¨¥ VRR:",0
preboot_device_msg db " [d] Ž¡à § ¤¨áª¥âë: ",0
if defined extended_primary_loader
preboot_device_msgs dw 0,pdm1,pdm2,0
pdm1 db "­ áâ®ïé ï ¤¨áª¥â ",13,10,0
pdm2 db "kolibri.img ¨§ ¯ ¯ª¨ § £à㧪¨",13,10,0
else
preboot_device_msgs dw 0,pdm1,pdm2,pdm3,pdm4
pdm1 db "­ áâ®ïé ï ¤¨áª¥â ",13,10,0
pdm2 db "C:\kolibri.img (FAT32)",13,10,0
pdm3 db "¨á¯®«ì§®¢ âì 㦥 § £à㦥­­ë© ®¡à §",13,10,0
pdm4 db "ᮧ¤ âì ç¨áâë© ®¡à §",13,10,0
end if
loading_msg db "ˆ¤ñâ § £à㧪  KolibriOS...",0
if ~ defined extended_primary_loader ; saving not supported in this case
save_quest db "‡ ¯®¬­¨âì ⥪ã騥 ­ áâனª¨? [y/n]: ",0
loader_block_error db "Žè¨¡ª  ¢ ¤ ­­ëå ­ ç «ì­®£® § £àã§ç¨ª , ¯à®¤®«¦¥­¨¥ ­¥¢®§¬®¦­®.",0
end if
_st db 186,' ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄ¿ ',13,10,0

View File

@ -314,7 +314,11 @@ draw_current_vmode:
cmp word [es:si+6],0x13
je .no_vesa_0x13
if defined extended_primary_loader
mov di,config_file_variables
else
mov di,loader_block_error
end if
movzx eax,word[es:si+0]
mov ecx,10
call int2strnz
@ -327,7 +331,11 @@ draw_current_vmode:
movzx eax,word[es:si+8]
call int2strnz
mov dword[es:di],0x00000d0a
if defined extended_primary_loader
mov si,config_file_variables
else
mov si,loader_block_error
end if
push ds
push es
pop ds
@ -344,9 +352,34 @@ draw_current_vmode:
ret
;-----------------------------------------------------------------------------
check_first_parm:
if defined extended_primary_loader
mov cx, [number_vm]
jcxz .novbemode
mov si, modes_table
.findvbemode:
cmp [es:si+6], cx
jnz @f
cmp word [es:si+8],32
je .ok_found_mode
cmp word [es:si+8],24
je .ok_found_mode
@@: add si,size_of_step
cmp word [es:si],-1
jnz .findvbemode
.novbemode:
mov ax, [x_save]
test ax, ax
jz .zerro
mov bx, [y_save]
mov si, modes_table
call .loops
test ax, ax
jz .ok_found_mode
else
mov si,word [preboot_graph]
test si,si
jnz .no_zero ;if no zero
end if
.zerro:
; mov ax,modes_table
; mov word [cursor_pos],ax
@ -374,6 +407,7 @@ check_first_parm:
jz .ok_found_mode
mov si,modes_table
if ~ defined extended_primary_loader
jmp .ok_found_mode
@ -394,6 +428,7 @@ check_first_parm:
; jb .zerro ;check on correct if bellow
; cmp ax,word [end_cursor]
; ja .zerro ;check on correct if anymore
end if
.ok_found_mode:
mov word [home_cursor],si

View File

@ -0,0 +1,170 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2011. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$Revision: 1962 $
; All parsers are called with ds:si -> value of the variable,
; possibly with spaces before, and dx = limit of config file.
; Three subroutines parse_char, parse_number and parse_bool set CF
; if something has failed, otherwise return the value in al/ax.
parse_timeout:
; timeout is a number not greater than 9
call parse_number
jc .nothing
cmp ax, 9
jbe @f
mov ax, 9
@@:
imul ax, 18
mov [es:preboot_timeout], ax
.nothing:
ret
parse_resolution:
; resolution is <width>*<height>, 'x' can be used instead of '*'
; parse width
call parse_number
jc .nothing
; save width
xchg ax, bx
; test for 'x' or '*'
call parse_char
cmp al, 'x'
jz @f
cmp al, '*'
jnz .nothing
@@:
; parse height
call parse_number
jc .nothing
; write width and height
mov [es:x_save], bx
mov [es:y_save], ax
.nothing:
ret
parse_vbemode:
; vbemode is a number
call parse_number
jc .nothing
mov [es:number_vm], ax
.nothing:
ret
parse_vrr:
; vrr is a boolean setting
call parse_bool
jc .nothing
; convert 0 to 2, 1 to 1
inc ax
xor al, 3
mov [es:preboot_vrrm], al
.nothing:
ret
parse_biosdisks:
; using biosdisks is a boolean setting
call parse_bool
jc .nothing
; convert 0 to 2, 1 to 1
inc ax
xor al, 3
mov [es:preboot_biosdisk], al
.nothing:
ret
parse_imgfrom:
; boot device (1-floppy 2-kolibri.img using primary loader)
call parse_number
jc .nothing
cmp al, 1
jb .nothing
cmp al, 2
ja .nothing
mov [es:preboot_device], al
.nothing:
ret
parse_char:
; skip spaces and return the next character or CF if EOF.
cmp si, dx
jae .eof
lodsb
cmp al, ' '
jbe parse_char
ret
.eof:
stc
ret
parse_number:
; initialize high part of ax to zero
xor ax, ax
; skip spaces
call parse_char
jc .bad
; al should be a digit
sub al, '0'
cmp al, 9
ja .bad
; accumulate the value in cx
xchg cx, ax
@@:
cmp si, dx
jae .eof
lodsb
sub al, '0'
cmp al, 9
ja .end
imul cx, 10
add cx, ax
jmp @b
; if the end is caused by non-digit, unwind the last character
.end:
dec si
.eof:
xchg cx, ax
clc
ret
.bad:
stc
ret
parse_bool:
; skip spaces
call parse_char
jc .bad
; Boolean false can be represented as 0=no=off,
; boolean true can be represented as 1=yes=on.
cmp al, '0'
jz .false
cmp al, '1'
jz .true
mov ah, al
cmp si, dx
jae .bad
lodsb
cmp ax, 'n'*256 + 'o'
jz .false
cmp ax, 'o'*256 + 'f'
jz .false
cmp ax, 'y'*256 + 'e'
jz .true
cmp ax, 'o'*256 + 'n'
jz .true
.bad:
stc
ret
.true:
xor ax, ax
inc ax
ret
.false:
xor ax, ax
ret

View File

@ -30,6 +30,9 @@ preboot_device db 0 ; boot device
;!!!! 0 - autodetect !!!!
preboot_blogesc = 0 ; start immediately after bootlog
preboot_biosdisk db 0 ; use V86 to access disks through BIOS (1-yes, 2-no)
if defined extended_primary_loader
preboot_timeout dw 5*18 ; timeout in 1/18th of second for config settings screen
end if
if $>0x200
ERROR: prebooting parameters must fit in first sector!!!

View File

@ -98,8 +98,10 @@ nbw32:
jmp $
no_apm_off:
if ~ defined extended_primary_loader ; kernel restarting is not supported
dec ax ; 3 = reboot
jnz restart_kernel ; 4 = restart kernel
end if
push 0x40
pop ds
mov word[0x0072],0x1234
@ -150,6 +152,7 @@ APM_PowerOff:
;!!!!!!!!!!!!!!!!!!!!!!!!
ret
if ~ defined extended_primary_loader
restart_kernel:
mov ax,0x0003 ; set text mode for screen
@ -205,5 +208,5 @@ restart_kernel_4000:
mov si, kernel_restart_bootblock
mov ax, 'KL'
jmp 0x1000:0000
end if

View File

@ -194,17 +194,17 @@ obtain_cluster:
mov ax,0e2eh ; ah=0eh (teletype), al='.'
xor bh,bh
int 10h
; convert cluster number to sector number
mov ax,bp ; data cluster to read
sub ax,2
xor bx,bx
mov bl,byte [BPB_SecPerClus+boot_program]
mul bx
add ax,word [data_start+boot_program]
pop bx
writesec:
; convert cluster number to sector number
mov ax,bp ; data cluster to read
sub ax,2
xor dx,dx
mov dl,byte [BPB_SecPerClus+boot_program]
mul dx
add ax,word [data_start+boot_program]
call conv_abs_to_THS ; convert abs sector (AX) to BIOS T:H:S (track:head:sector)
patchhere:
mov ah,2 ; ah=2 (read)
@ -267,7 +267,7 @@ write1st:
push cs
pop ds
mov byte [patchhere+1+boot_program], 3 ; change ah=2 to ah=3
mov ax,[cluster1st+boot_program]
mov bp,[cluster1st+boot_program]
push 1000h
pop es
xor bx,bx

View File

@ -569,9 +569,9 @@ sys_pcibios:
cmp ebp, 1 ; PCI_FUNCTION_ID
jnz .not_PCI_BIOS_PRESENT
mov edx, 'PCI '
mov al, [OS_BASE+0x2F0000 + 0x9020]
mov bx, [OS_BASE+0x2F0000 + 0x9022]
mov cl, [OS_BASE+0x2F0000 + 0x9021]
mov al, [BOOT_VAR + 0x9020]
mov bx, [BOOT_VAR + 0x9022]
mov cl, [BOOT_VAR + 0x9021]
xor ah, ah
jmp .return_abcd

View File

@ -203,6 +203,9 @@ WIN_STACK equ (OS_BASE+0x000C000)
WIN_POS equ (OS_BASE+0x000C400)
FDD_BUFF equ (OS_BASE+0x000D000)
;unused ? only one reference
ENABLE_TASKSWITCH equ (OS_BASE+0x000E000)
PUTPIXEL equ (OS_BASE+0x000E020)
GETPIXEL equ (OS_BASE+0x000E024)
@ -283,6 +286,7 @@ RAMDISK equ (OS_BASE+0x0100000)
RAMDISK_FAT equ (OS_BASE+0x0280000)
FLOPPY_FAT equ (OS_BASE+0x0282000)
CLEAN_ZONE equ 0x284000
IDE_DMA equ 0x284000
BgrAuxTable equ (OS_BASE+0x0298000)
@ -308,7 +312,9 @@ BgrDrawMode equ (OS_BASE+0x033BFF4)
BgrDataWidth equ (OS_BASE+0x033BFF8)
BgrDataHeight equ (OS_BASE+0x033BFFC)
sys_pgmap equ (OS_BASE+0x033C000)
BOOT_VAR equ (OS_BASE+0x0340000)
sys_pgmap equ (OS_BASE+0x0350000)
UPPER_KERNEL_PAGES equ (OS_BASE+0x0400000)

View File

@ -8,7 +8,7 @@
IRQ_RESERVE = 24 ; 16 or 24
iglobal
IRQ_COUNT dd 16
IRQ_COUNT dd 24
endg
uglobal
@ -45,8 +45,8 @@ IOAPIC_REDTBL equ 0x10
APIC_init:
mov dword[APIC], 0
; jmp .no_apic ; NO APIC
bt [cpu_caps], CAPS_APIC
jnc .no_apic
; bt [cpu_caps], CAPS_APIC
; jnc .no_apic
; Check for MP table
;.....
@ -96,6 +96,12 @@ APIC_init:
call LAPIC_init
mov dword[APIC], 0xffffffff
mov al, 0x70
out 0x22, al
mov al, 1
out 0x23, al
; mov dword[irq_type_to_set], IRQ_TYPE_APIC
.no_apic:
ret

View File

@ -17,6 +17,9 @@ PID_KERNEL equ 1 ;os_idle thread
align 4
proc attach_int_handler stdcall, irq:dword, handler:dword, access_rights:dword
pushfd
cli
push ebx
mov ebx, [irq] ;irq num
@ -46,10 +49,12 @@ proc attach_int_handler stdcall, irq:dword, handler:dword, access_rights:dword
stdcall enable_irq, [irq]
pop ebx
mov eax, 1
popfd
ret
.err:
pop ebx
xor eax, eax
popfd
ret
endp
@ -100,7 +105,7 @@ align 4
jmp .main
}
irq_serv_h 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12
irq_serv_h 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15
; I don`t known how to use IRQ_RESERVE
if IRQ_RESERVE > 16
@ -118,6 +123,26 @@ align 16
cmp [v86_irqhooks+eax*8], 0
jnz v86_irq
cmp al, 6
jnz @f
push eax
call [fdc_irq_func]
pop eax
@@:
cmp al, 14
jnz @f
push eax
call [irq14_func]
pop eax
@@:
cmp al, 15
jnz @f
push eax
call [irq15_func]
pop eax
@@:
mov ebx, [irq_tab+eax*4]
test ebx, ebx
jz .exit

View File

@ -75,6 +75,9 @@ iglobal
szSleep db 'Sleep',0
szGetTimerTicks db 'GetTimerTicks',0
szGetDisplay db 'GetDisplay',0
szSetScreen db 'SetScreen',0
szStrncat db 'strncat',0
szStrncpy db 'strncpy',0
szstrncmp db 'strncmp',0
@ -147,6 +150,9 @@ kernel_export:
dd szSleep , delay_ms
dd szGetTimerTicks , get_timer_ticks
dd szGetDisplay , get_display
dd szSetScreen , set_screen
dd szStrncat , strncat
dd szStrncpy , strncpy
dd szstrncmp , strncmp

View File

@ -1426,7 +1426,7 @@ proc set_mtrr stdcall, base:dword,size:dword,mem_type:dword
mov ebx, [size]
dec ebx
mov eax, 0xFFFFFFFF
mov edx, 0x0000000F
mov edx, 0x00000000
sub eax, ebx
sbb edx, 0
or eax, 0x800

View File

@ -322,8 +322,10 @@ __exports:
unmap_pages, 'UnmapPages', \ ; eax, ecx
sys_msg_board_str, 'SysMsgBoardStr', \
get_timer_ticks, 'GetTimerTicks', \
get_stack_base, 'GetStackBase', \
delay_hs, 'Delay', \ ; ebx
set_mouse_data, 'SetMouseData'
set_mouse_data, 'SetMouseData', \ ;
set_keyboard_data, 'SetKeyboardData' ; gcc fastcall

View File

@ -46,11 +46,9 @@ iglobal
else
dd p_irq3, p_irq4 ;??? íåñòûêîâêà
end if
dd irq_serv.irq_5, p_irq6, irq_serv.irq_7
dd irq_serv.irq_5, irq_serv.irq_6, irq_serv.irq_7
dd irq_serv.irq_8, irq_serv.irq_9, irq_serv.irq_10
dd irq_serv.irq_11, irq_serv.irq_12
dd irq13
dd p_irq14,p_irq15
dd irq_serv.irq_11, irq_serv.irq_12, irqD, irq_serv.irq_14, irq_serv.irq_15
; I don`t known how to use IRQ_RESERVE
if IRQ_RESERVE > 16
dd irq_serv.irq_16
@ -208,6 +206,14 @@ unknown_interrupt:
;-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
; bl - error vector
show_error_parameters:
cmp bl, 0x06
jnz .no_ud
push ebx
mov ebx, ud_user_message
mov ebp, notifyapp
call fs_execute_from_sysdir_param
pop ebx
.no_ud:
mov edx,[TASK_BASE] ;not scratched below
DEBUGF 1, "K : Process - forced terminate PID: %x\n", [edx+TASKDATA.pid]
cmp bl, 0x08

View File

@ -193,6 +193,7 @@ iglobal
dd file_system_lfn ; 70-Common file system interface, version 2
dd syscall_window_settings ; 71-Window settings
dd sys_sendwindowmsg ; 72-Send window message
dd blit_32 ; blitter;
times 255 - ( ($-servetable2) /4 ) dd undefined_syscall
dd sys_end ; -1-end application

View File

@ -48,6 +48,7 @@ macro _clear_ op
fs_execute_from_sysdir:
xor ebx, ebx
fs_execute_from_sysdir_param:
xor edx, edx
mov esi, sysdir_path
@ -1166,4 +1167,13 @@ proc set_app_params stdcall,slot:dword, params:dword,\
ret
endp
align 4
get_stack_base:
mov eax,[current_slot]
mov eax,[eax+APPDATA.pl0_stack]
ret
include "debug.inc"

View File

@ -22,10 +22,12 @@ old_ints_h:
dd 0
dw 0
if ~ defined extended_primary_loader ; restart from memory is not supported in extended primary loader cfg
kernel_restart_bootblock:
db 1 ; version
dw 1 ; floppy image is in memory
dd 0 ; cannot save parameters
end if
; table for move to extended memory (int 15h, ah=87h)
align 8
@ -53,3 +55,36 @@ fwmovedesc:
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
db 0x00,0x00,0x0,0x00,0x00,0x00,0x0,0x0
if defined extended_primary_loader
; look in PrimaryLoader.txt for the description
bootdevice dw 0 ; ax from primary loader
bootfs dw 0 ; bx from primary loader
bootcallback dd 0 ; ds:si from primary loader
; data for configuration file loading, look in PrimaryLoader.txt
config_file_struct:
dw 0, 4000h ; load to 4000:0000
dw 16 ; read no more than 16*4K = 64K
db 'config.ini',0
; data for configuration file parsing
macro config_variable string,parser
{
local len
len dw 0
db string
store word $ - len - 2 at len
dw parser
}
config_file_variables:
config_variable 'timeout', parse_timeout
config_variable 'resolution', parse_resolution
config_variable 'vbemode', parse_vbemode
config_variable 'vrr', parse_vrr
config_variable 'biosdisks', parse_biosdisks
config_variable 'imgfrom', parse_imgfrom
dw 0
; data for image file loading, look in PrimaryLoader.txt
image_file_struct:
dw 0, 4000h ; load to 4000:0000
dw 16 ; read no more than 16*4K = 64K
db 'kolibri.img',0
end if

View File

@ -98,6 +98,12 @@ szIMPORTS db 'IMPORTS',0
read_firstapp db '/sys/'
firstapp db 'LAUNCHER',0
notifyapp db '@notify',0
if lang eq ru
ud_user_message db '舘芋<E88898>: 郊祚中丞成<E4B89E>布𩤃 身摵飹芣剁 能格丟嵼<E4B89F>',0
else
ud_user_message db 'Error: unsupported processor instruction',0
end if
char db '/sys/FONTS/CHAR.MT',0
char2 db '/sys/FONTS/CHAR2.MT',0

View File

@ -1,4 +1,4 @@
ˆ…Œ<EFBFBD>… ”“<E2809D>Šˆˆ Ž<><EFBFBD>ˆŽ<CB86><C5BD>Ž‰ ‘ˆ‘’…Œ› Kolibri 0.7.5.0+
ˆ…Œ<EFBFBD>… ”“<E2809D>Šˆˆ Ž<><EFBFBD>ˆŽ<CB86><C5BD>Ž‰ ‘ˆ‘’…Œ› Kolibri 0.7.7.0
<EFBFBD>®¬¥à ä㭪樨 ¯®¬¥é ¥âáï ¢ ॣ¨áâà eax.
‚맮¢ á¨á⥬­®© ä㭪樨 ®áãé¥á⢫ï¥âáï ª®¬ ­¤®© "int 0x40".
@ -354,6 +354,7 @@
* ¡¨â 0 (¬ áª  1): ®ª­® ¬ ªá¨¬¨§¨à®¢ ­®
* ¡¨â 1 (¬ áª  2): ®ª­® ¬¨­¨¬¨§¨à®¢ ­® ¢ ¯ ­¥«ì § ¤ ç
* ¡¨â 2 (¬ áª  4): ®ª­® á¢ñà­ãâ® ¢ § £®«®¢®ª
* +71 = +0x47: dword: ¬ áª  ᮡë⨩
‡ ¬¥ç ­¨ï:
* ‘«®âë ­ã¬¥àãîâáï á 1.
* ‚®§¢à é ¥¬®¥ §­ ç¥­¨¥ ­¥ ¥áâì ®¡é¥¥ ç¨á«® ¯®â®ª®¢, ¯®áª®«ìªã
@ -383,7 +384,7 @@
ᮡá⢥­­® à ¡®âã, ¨ ¢à¥¬¥­¨ ¯à®áâ®ï ¢ ®¦¨¤ ­¨¨ ¯à¥à뢠­¨ï
(ª®â®à®¥ ¬®¦­® ¯®«ãç¨âì ¢ë§®¢®¬ ¯®¤ä㭪樨 4 ä㭪樨 18).
* <20> ç¨­ ï á® á«®â  2, à §¬¥é îâáï ®¡ëç­ë¥ ¯à¨«®¦¥­¨ï.
* Ž¡ëç­ë¥ ¯à¨«®¦¥­¨ï à §¬¥é îâáï ¢ ¯ ¬ï⨠¯®  ¤à¥áã 0x0
* Ž¡ëç­ë¥ ¯à¨«®¦¥­¨ï à §¬¥é îâáï ¢ ¯ ¬ï⨠¯®  ¤à¥áã 0
(ª®­áâ ­â  ï¤à  std_application_base_address).
<20> «®¦¥­¨ï ­¥ ¯à®¨á室¨â, ¯®áª®«ìªã ã ª ¦¤®£® ¯à®æ¥áá  á¢®ï
â ¡«¨æ  áâà ­¨æ.
@ -847,12 +848,12 @@
* äã­ªæ¨ï ­¥ ¢®§¢à é ¥â §­ ç¥­¨ï
‘âàãªâãà  ¡ãä¥à :
db a,b,c,d ¤«ï ¢¥àᨨ a.b.c.d
db UID_xxx: ®¤­® ¨§ UID_NONE=0, UID_MENUET=1, UID_KOLIBRI=2
db 0: § à¥§¥à¢¨à®¢ ­®
dd REV - ­®¬¥à svn-ॢ¨§¨¨ ï¤à 
„«ï ï¤à  Kolibri 0.7.1.0:
db 0,7,1,0
db 2
dd 638
„«ï ï¤à  Kolibri 0.7.7.0+:
db 0,7,7,0
db 0
dd 1675
======================================================================
====================== ”ã­ªæ¨ï 18, ¯®¤äã­ªæ¨ï 14 =====================
@ -1677,62 +1678,14 @@ dd 638
* ecx = 㪠§ â¥«ì ­  ¡ãä¥à
* edx = à §¬¥à ¡ãä¥à 
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = - 1 ®é¨¡ª , ¯ ¯ª  ⥪ã饣® ¯®â®ª  ¨¬¥¥â ¤«¨­­ã ¡®«¥¥ 祬 4096 ᨬ¢®«®¢.
* eax = ¤«¨­  ¨¬¥­¨ ⥪ã饩 ¯ ¯ª¨ (¢ª«îç ï § ¢¥àè î騩 0)
‡ ¬¥ç ­¨ï:
* …᫨ à §¬¥à  ¡ãä¥à  ­¥¤®áâ â®ç­® ¤«ï ª®¯¨à®¢ ­¨ï ¢á¥£® ¨¬¥­¨,
ª®¯¨àãîâáï ⮫쪮 ¯¥à¢ë¥ (edx-1) ¡ ©â
¨ ¢ ª®­æ¥ áâ ¢¨âáï § ¢¥àè î騩 0.
======================================================================
================ ”ã­ªæ¨ï 32 - 㤠«¨âì ä ©« á à ¬¤¨áª . ===============
======================================================================
<EFBFBD> à ¬¥âàë:
* eax = 32 - ­®¬¥à ä㭪樨
* ebx = 㪠§ â¥«ì ­  ¨¬ï ä ©« 
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = 0 - ãᯥ譮; ¨­ ç¥ ª®¤ ®è¨¡ª¨ ä ©«®¢®© á¨á⥬ë
‡ ¬¥ç ­¨ï:
* <20>â  äã­ªæ¨ï ãáâ à¥« ; äã­ªæ¨ï 58 ¯®§¢®«ï¥â ¢ë¯®«­ïâì
⥠¦¥ ¤¥©á⢨ï á à áè¨à¥­­ë¬¨ ¢®§¬®¦­®áâﬨ.
* ’¥ªãé ï ॠ«¨§ æ¨ï ¢®§¢à é ¥â ⮫쪮 §­ ç¥­¨ï 0(ãᯥå) ¨
5(ä ©« ­¥ ­ ©¤¥­).
* ˆ¬ï ä ©«  ¤®«¦­® ¡ëâì «¨¡® ¢ ä®à¬ â¥ 8+3 ᨬ¢®«®¢ (¯¥à¢ë¥
8 ᨬ¢®«®¢ - ᮡá⢥­­® ¨¬ï, ¯®á«¥¤­¨¥ 3 - à áè¨à¥­¨¥,
ª®à®âª¨¥ ¨¬¥­  ¨ à áè¨à¥­¨ï ¤®¯®«­ïîâáï ¯à®¡¥« ¬¨),
«¨¡® ¢ ä®à¬ â¥ 8.3 ᨬ¢®«®¢ "FILE.EXT"/"FILE.EX "
(¨¬ï ­¥ ¡®«¥¥ 8 ᨬ¢®«®¢, â®çª , à áè¨à¥­¨¥ 3 ᨬ¢®« ,
¤®¯®«­¥­­®¥ ¯à¨ ­¥®¡å®¤¨¬®á⨠¯à®¡¥« ¬¨).
ˆ¬ï ä ©«  ¤®«¦­® ¡ëâì § ¯¨á ­® § £« ¢­ë¬¨ ¡ãª¢ ¬¨.
‡ ¢¥àè î騩 ᨬ¢®« á ª®¤®¬ 0 ­¥ ­ã¦¥­ (­¥ ASCIIZ-áâப ).
* <20>â  äã­ªæ¨ï ­¥ ¯®¤¤¥à¦¨¢ ¥â ¯ ¯®ª ­  à ¬¤¨áª¥.
======================================================================
=============== ”ã­ªæ¨ï 33 - § ¯¨á âì ä ©« ­  à ¬¤¨áª. ===============
======================================================================
<EFBFBD> à ¬¥âàë:
* eax = 33 - ­®¬¥à ä㭪樨
* ebx = 㪠§ â¥«ì ­  ¨¬ï ä ©« 
* ecx = 㪠§ â¥«ì ­  ¤ ­­ë¥ ¤«ï § ¯¨á¨
* edx = ç¨á«® ¡ ©â ¤«ï § ¯¨á¨
* á«¥¤ã¥â ãáâ ­ ¢«¨¢ âì esi=0
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = 0 - ãᯥ譮, ¨­ ç¥ ª®¤ ®è¨¡ª¨ ä ©«®¢®© á¨á⥬ë
‡ ¬¥ç ­¨ï:
* <20>â  äã­ªæ¨ï ãáâ à¥« ; äã­ªæ¨ï 70 ¯®§¢®«ï¥â ¢ë¯®«­ïâì
⥠¦¥ ¤¥©á⢨ï á à áè¨à¥­­ë¬¨ ¢®§¬®¦­®áâﬨ.
* …᫨ 㪠§ âì ­¥­ã«¥¢®¥ §­ ç¥­¨¥ ¢ esi ¨ ­  à ¬¤¨áª¥ 㦥 ¥áâì
㪠§ ­­ë© ä ©«, â® ¡ã¤¥â ᮧ¤ ­ ¥éñ ®¤¨­ ä ©« á ⥬ ¦¥ ¨¬¥­¥¬.
* ¯à®â¨¢­®¬ á«ãç ¥ ä ©« ¯¥à¥§ ¯¨á뢠¥âáï.
* ˆ¬ï ä ©«  ¤®«¦­® ¡ëâì «¨¡® ¢ ä®à¬ â¥ 8+3 ᨬ¢®«®¢
(¯¥à¢ë¥ 8 ᨬ¢®«®¢ - ᮡá⢥­­® ¨¬ï, ¯®á«¥¤­¨¥ 3 - à áè¨à¥­¨¥,
ª®à®âª¨¥ ¨¬¥­  ¨ à áè¨à¥­¨ï ¤®¯®«­ïîâáï ¯à®¡¥« ¬¨),
«¨¡® ¢ ä®à¬ â¥ 8.3 ᨬ¢®«®¢ "FILE.EXT"/"FILE.EX "
(¨¬ï ­¥ ¡®«¥¥ 8 ᨬ¢®«®¢, â®çª , à áè¨à¥­¨¥ 3 ᨬ¢®« ,
¤®¯®«­¥­­®¥ ¯à¨ ­¥®¡å®¤¨¬®á⨠¯à®¡¥« ¬¨).
ˆ¬ï ä ©«  ¤®«¦­® ¡ëâì § ¯¨á ­® § £« ¢­ë¬¨ ¡ãª¢ ¬¨.
‡ ¢¥àè î騩 ᨬ¢®« á ª®¤®¬ 0 ­¥ ­ã¦¥­ (­¥ ASCIIZ-áâப ).
* <20>â  äã­ªæ¨ï ­¥ ¯®¤¤¥à¦¨¢ ¥â ¯ ¯®ª ­  à ¬¤¨áª¥.
ª®¯¨àãîâáï ⮫쪮 ¯¥à¢ë¥ (edx-1) ¡ ©â ¨ ¢ ª®­æ¥ áâ ¢¨âáï
§ ¢¥àè î騩 0.
* <20>® 㬮«ç ­¨î, ⥪ãé ï ¯ ¯ª  ¤«ï ¯®â®ª  - "/rd/1".
* <20>ਠᮧ¤ ­¨¨ ¯à®æ¥áá /¯®â®ª  ⥪ãé ï ¯ ¯ª  ­ á«¥¤ã¥âáï ®â
த¨â¥«ï.
======================================================================
============ ”ã­ªæ¨ï 35 - ¯à®ç¨â âì 梥â â®çª¨ ­  íªà ­¥. ============
@ -1858,7 +1811,7 @@ dd 638
------------------ <20>®¤äã­ªæ¨ï 7 - ¤ ­­ë¥ ¯à®ªàã⪨ -------------------
<EFBFBD> à ¬¥âàë:
* eax = 37 - ­®¬¥à ä㭪樨
* ebx = 6 - ­®¬¥à ¯®¤ä㭪樨
* ebx = 7 - ­®¬¥à ¯®¤ä㭪樨
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = [horizontal offset]*65536 + [vertical offset]
‡ ¬¥ç ­¨ï:
@ -2219,11 +2172,11 @@ dword-
‡ ¬¥ç ­¨ï:
* ‘âàãªâãà  â ¡«¨æë 梥⮢ ®¯¨á ­  ¢ áâ ­¤ àâ­®¬ ¢ª«îç ¥¬®¬ ä ©«¥
macros.inc ¯®¤ ­ §¢ ­¨¥¬ system_colors; ­ ¯à¨¬¥à, ¬®¦­® ¯¨á âì:
sc system_colors ; ®¡ê¥­¨¥ ¯¥à¥¬¥­­®©
... ; £¤¥-â® ­ ¤® ¢ë§¢ âì
; ®¯¨á뢠¥¬ãî äã­ªæ¨î á ecx=sc
mov ecx, [sc.work_button_text] ; ç¨â ¥¬ 梥â ⥪áâ 
; ­  ª­®¯ª¥ ¢ à ¡®ç¥© ®¡« áâ¨
sc system_colors ; ®¡ê¥­¨¥ ¯¥à¥¬¥­­®©
... ; £¤¥-â® ­ ¤® ¢ë§¢ âì
; ®¯¨á뢠¥¬ãî äã­ªæ¨î á ecx=sc
mov ecx, [sc.work_button_text] ; ç¨â ¥¬ 梥â ⥪áâ 
; ­  ª­®¯ª¥ ¢ à ¡®ç¥© ®¡« áâ¨
* ˆá¯®«ì§®¢ ­¨¥/­¥¨á¯®«ì§®¢ ­¨¥ íâ¨å 梥⮢ - ¤¥«® ¨áª«îç¨â¥«ì­®
á ¬®© ¯à®£à ¬¬ë. „«ï ¨á¯®«ì§®¢ ­¨ï ­ã¦­® ¯à®áâ® ¯à¨ ¢ë§®¢¥ ä㭪権
à¨á®¢ ­¨ï 㪠§ë¢ âì 梥â, ¢§ïâë© ¨§ í⮩ â ¡«¨æë.
@ -3125,10 +3078,10 @@ IPC
<EFBFBD>ணࠬ¬¥ ¤®áâã¯­ë ¤ ­­ë¥ £à ä¨ç¥áª®£® íªà ­  (®¡« áâì ¯ ¬ïâ¨, ª®â®à ï
ᮡá⢥­­® ¨ ®â®¡à ¦ ¥â ᮤ¥à¦¨¬®¥ íªà ­ ) ­ ¯àï¬ãî ¡¥§ ¢ë§®¢®¢
á¨á⥬­ëå ä㭪権 ç¥à¥§ ᥫ¥ªâ®à gs:
mov eax, [gs:0]
mov eax, [gs:0]
¯®¬¥áâ¨â ¢ eax ¯¥à¢ë© dword ¡ãä¥à , ᮤ¥à¦ é¨© ¨­ä®à¬ æ¨î ® 梥â¥
«¥¢®© ¢¥àå­¥© â®çª¨ (¨, ¢®§¬®¦­®, æ¢¥â  ­¥áª®«ìª¨å á«¥¤ãîé¨å).
mov [gs:0], eax
mov [gs:0], eax
¯à¨ à ¡®â¥ ¢ ०¨¬ å VESA c LFB
ãáâ ­®¢¨â 梥⠫¥¢®© ¢¥àå­¥© â®çª¨
(¨ ¢®§¬®¦­®, æ¢¥â  ­¥áª®«ìª¨å á«¥¤ãîé¨å).
@ -3289,63 +3242,6 @@ IPC
¢å®¤¨â, ­ ¯à¨¬¥à, ¢ ¨§¢¥áâ­ë© Interrupt List by Ralf Brown;
ᯨ᮪ ¢â®àëå ¤®«¦¥­ ¡ëâì 㪠§ ­ ¢ ¤®ªã¬¥­â æ¨¨ ¯® ãáâனáâ¢ã.
======================================================================
====================== ”ã­ªæ¨ï 62, ¯®¤äã­ªæ¨ï 11 =====================
== ˆ­¨æ¨ «¨§¨à®¢ âì ¯®«ì§®¢ â¥«ì᪨© / á ®â®¡à ¦¥­¨¥¬ ­  ¯ ¬ïâì ==
======================================================================
<EFBFBD> à ¬¥âàë:
* eax = 62 - ­®¬¥à ä㭪樨
* bl = 11 - ­®¬¥à ¯®¤ä㭪樨
* cx =  ¤à¥á PCI-ãáâனá⢠
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = -1 - ¤®áâ㯠ª PCI § ¯à¥éñ­;
* eax = -2 - ¤®áâ㯠ª MMIO-¡«®ª ¬ ãáâனá⢠ ­¥ à §à¥èñ­;
* eax = -3 - ®è¨¡ª   ««®ª æ¨¨ ¯®«ì§®¢ â¥«ì᪮© ¤¨­. ¯ ¬ïâ¨; ¨­ ç¥
* eax = à §¬¥à ¤®áâ㯭®© ¤¨­ ¬¨ç¥áª®© ¯ ¬ïâ¨.
‡ ¬¥ç ­¨ï:
* <20>।¢ à¨â¥«ì­® ¤®«¦¥­ ¡ëâì à §à¥èñ­ ­¨§ª®ã஢­¥¢ë© ¤®áâ㯠ª PCI
¤«ï ¯à¨«®¦¥­¨© ¯®¤ä㭪樥© 12 ä㭪樨 21.
*  ¤à¥á PCI-ãáâனá⢠ ¤®«¦¥­ ᮢ¯ ¤ âì á á¨á⥬­®© ¯¥à¥¬¥­­®©
mmio_pci_addr
======================================================================
====================== ”ã­ªæ¨ï 62, ¯®¤äã­ªæ¨ï 12 =====================
== ‚뤥«¨âì ¤¨ ¯ §®­ «¨­¥©­ëå  ¤à¥á®¢ ¤«ï ¯®«ì§®¢ â¥«ì᪮£® MMIO ==
======================================================================
<EFBFBD> à ¬¥âàë:
* eax = 62 - ­®¬¥à ä㭪樨
* bl = 12 - ­®¬¥à ¯®¤ä㭪樨
* bh = ­®¬¥à BAR-ॣ¨áâà  ¢ ª®­ä¨£ãà æ¨®­­®© §®­¥ PCI
* ecx = à §¬¥à MMIO-¡«®ª  (¢ ¡ ©â å)
* edx = ᬥ饭¨¥ ®â­®á¨â¥«ì­® ­ ç «  MMIO-¡«®ª  (¢ 4K-áâà ­¨æ å!)
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = -1 - ¤®áâ㯠ª PCI § ¯à¥éñ­;
* eax = -2 - ­¥¢¥à­ë© ­®¬¥à BAR-ॣ¨áâà ;
* eax = -3 - BAR ­¥ ᮤ¥à¦¨â  ¤à¥á  IO;
* eax = -4 - BAR  ¤à¥áã¥â ¯®àâë IO;
* eax = -5 - ®è¨¡ª   ««®ª æ¨¨; ¨­ ç¥
* eax = ­ ç «ì­ë©  ¤à¥á MMIO ¢  ¤à¥á­®¬ ¯à®áâà ­á⢥ ¯à¨«®¦¥­¨ï.
‡ ¬¥ç ­¨ï:
* <20>।¢ à¨â¥«ì­® ¤®«¦¥­ ¡ëâì à §à¥èñ­ ­¨§ª®ã஢­¥¢ë© ¤®áâ㯠ª PCI
¤«ï ¯à¨«®¦¥­¨© ¯®¤ä㭪樥© 12 ä㭪樨 21.
* €¤à¥á PCI-ãáâனá⢠ § ¤ ¥âáï á¨á⥬­®© ¯¥à¥¬¥­­®© mmio_pci_addr.
* <20>।®áâ ¢«¥­­ë© ¤¨ ¯ §®­ «¨­¥©­ëå  ¤à¥á®¢ ¤®«¦¥­ ®á¢®¡®¦¤ âìáï
¯®á।á⢮¬ ¢ë§®¢  ä㭪樨 62:13
======================================================================
====================== ”ã­ªæ¨ï 62, ¯®¤äã­ªæ¨ï 13 =====================
== Žá¢®¡®¤¨âì ¤¨ ¯ §®­ «¨­¥©­ëå  ¤à¥á®¢ ¯®«ì§®¢ â¥«ì᪮£® MMIO ==
======================================================================
<EFBFBD> à ¬¥âàë:
* eax = 62 - ­®¬¥à ä㭪樨
* bl = 12 - ­®¬¥à ¯®¤ä㭪樨
* ecx = ­ ç «ì­ë©  ¤à¥á ®á¢®¡®¦¤ ¥¬®£® MMIO-¡«®ª  ¢  ¤à¥á­®¬
¯à®áâà ­á⢥ ¯à¨«®¦¥­¨ï
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = 1 - ¡«®ª ãᯥ譮 ®á¢®¡®¦¤¥­;
‡ ¬¥ç ­¨ï:
* <20>।¢ à¨â¥«ì­® ¯à¨«®¦¥­¨î ¤®«¦¥­ ¡ëâì ¢ë¤¥«¥­ uMMIO-¡«®ª (fn62:12)
======================================================================
================ ”ã­ªæ¨ï 63 - à ¡®â  á ¤®áª®© ®â« ¤ª¨. ===============
======================================================================
@ -3459,7 +3355,6 @@ IPC
======================================================================
<EFBFBD>¥¦¨¬ ¢¢®¤  ¢«¨ï¥â ­  १ã«ìâ âë ç⥭¨ï ª« ¢¨è ä㭪樥© 2.
<EFBFBD>ਠ§ £à㧪¥ ¯à®£à ¬¬ë ¤«ï ­¥ñ ãáâ ­ ¢«¨¢ ¥âáï ASCII-०¨¬ ¢¢®¤ .
…᫨ ¢ë§ë¢ ¥âáï ­¥áãé¥áâ¢ãîé ï ¯®¤äã­ªæ¨ï ¢®§¢à é ¥âáï ¢ eax=-1.
-------- <20>®¤äã­ªæ¨ï 1 - ãáâ ­®¢¨âì ०¨¬ ¢¢®¤  á ª« ¢¨ âãàë. ---------
<EFBFBD> à ¬¥âàë:
@ -3702,25 +3597,20 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
¨«¨ ¯®¤ä㭪樥© 20.
======================================================================
==================== ”ã­ªæ¨ï 68, ¯®¤äã­ªæ¨ï 14 =======================
===== Ž¦¨¤ âì ¯®«ã祭¨ï ᨣ­ « , ®â ¤àã£¨å ¯à¨«®¦¥­¨©/¤à ©¢¥à®¢. =====
====================== ”ã­ªæ¨ï 68, ¯®¤äã­ªæ¨ï 14 =====================
====== Ž¦¨¤ âì ¯®«ã祭¨ï ᨣ­ «  ®â ¤àã£¨å ¯à¨«®¦¥­¨©/¤à ©¢¥à®¢. =====
======================================================================
<EFBFBD> à ¬¥âàë:
* eax = 68 - ­®¬¥à ä㭪樨
* ebx = 14 - ­®¬¥à ¯®¤ä㭪樨
* ecx = 㪠§ â¥«ì ­  ¡ãä¥à ¤«ï ¨­ä®à¬ æ¨¨ (24 ¡ ©â )
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax à §àãè ¥âáï
* ¡ãä¥à, ­  ª®â®àë© ãª §ë¢ ¥â ecx, ᮤ¥à¦¨â á«¥¤ãîéãî ¨­ä®à¬ æ¨î:
* +0: dword: ¨¤¥­â¨ä¨ª â®à ¯®á«¥¤ãîé¨å ¤ ­­ëå ᨣ­ « 
* +4: ¤ ­­ë¥ ¯à¨­ï⮣® ᨣ­ «  (20 ¡ ©â), ä®à¬ â ª®â®àëå
®¯à¥¤¥«ï¥âáï ¯¥à¢ë¬ dword-®¬
======================================================================
== ”ã­ªæ¨ï 68, ¯®¤äã­ªæ¨ï 15 - ãáâ ­®¢¨âì ®¡à ¡®â稪 ¨áª«î祭¨© FPU. =
======================================================================
“¤ «¥­  (¢ ⥪ã饩 ॠ«¨§ æ¨¨ ¯à®áâ® ¢®§¢à é ¥â 0)
ˆá¯®«ì§®¢ âì ¯®¤ä㭪樨 24, 25
======================================================================
=========== ”ã­ªæ¨ï 68, ¯®¤äã­ªæ¨ï 16 - § £à㧨âì ¤à ©¢¥à. ===========
======================================================================
@ -3759,12 +3649,6 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
®¯à¥¤¥«ïîâáï ¤à ©¢¥à®¬.
* <20>।¢ à¨â¥«ì­® ¤®«¦¥­ ¡ëâì ¯®«ã祭 åí­¤« ¤à ©¢¥à  ¯®¤ä㭪樥© 16.
======================================================================
== ”ã­ªæ¨ï 68, ¯®¤äã­ªæ¨ï 18 - ãáâ ­®¢¨âì ®¡à ¡®â稪 ¨áª«î祭¨© SSE. =
======================================================================
“¤ «¥­  (¢ ⥪ã饩 ॠ«¨§ æ¨¨ ¯à®áâ® ¢®§¢à é ¥â 0)
ˆá¯®«ì§®¢ âì ¯®¤ä㭪樨 24, 25
======================================================================
============= ”ã­ªæ¨ï 68, ¯®¤äã­ªæ¨ï 19 - § £à㧨âì DLL. =============
======================================================================
@ -3860,7 +3744,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
®¡« á⨠¯ ¬ïâ¨.
======================================================================
==== ”ã­ªæ¨ï 68, ¯®¤äã­ªæ¨ï 24 - ãáâ ­®¢¨âì ®¡à ¡®â稪 ¨áª«î祭¨© ===
==== ”ã­ªæ¨ï 68, ¯®¤äã­ªæ¨ï 24 - ãáâ ­®¢¨âì ®¡à ¡®â稪 ¨áª«î祭¨©. ===
======================================================================
<EFBFBD> à ¬¥âàë:
* eax = 68 - ­®¬¥à ä㭪樨
@ -3871,26 +3755,26 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
* eax =  ¤à¥á áâ à®£® ®¡à ¡®â稪  ¨áª«î祭¨© (0, ¥á«¨ ­¥ ãáâ ­®¢«¥­)
* ebx = ¬ áª  áâ à®£® ®¡à ¡®â稪  ¨áª«î祭¨©
‡ ¬¥ç ­¨ï:
* <20>®¬¥à ¡¨â  ¢ ¬ áª¥ ¨áª«î祭¨© ᮮ⢥âáâ¢ãîâ ­®¬¥à㠨᪫î祭¨ï ¯®
ᯥæ¨ä¨ª æ¨¨ ­  ¯à®æ¥áá®à (Intel-PC). ’ ª ­ ¯à¨¬¥à, ¨áª«î祭¨ï FPU
¨¬¥îâ ­®¬¥à 16 (#MF),   SSE - 19 (#XF).
* <20>®¬¥à ¡¨â  ¢ ¬ áª¥ ¨áª«î祭¨© ᮮ⢥âáâ¢ã¥â ­®¬¥à㠨᪫î祭¨ï ¯®
ᯥæ¨ä¨ª æ¨¨ ­  ¯à®æ¥áá®à (Intel-PC). ’ ª, ­ ¯à¨¬¥à, ¨áª«î祭¨ï
FPU ¨¬¥îâ ­®¬¥à 16 (#MF),   SSE - 19 (#XF).
* ¤ ­­®© ॠ«¨§ æ¨¨ ¨£­®à¨àã¥âáï § ¯à®á ­  ¯¥à¥å¢ â ¨áª«î祭¨ï 7
- á¨á⥬  ®¡à ¡ â뢠¥â #NM á ¬®áâ®ï⥫쭮.
* <20>®«ì§®¢ â¥«ì᪨© ®¡à ¡®â稪 ¯®«ã砥⠭®¬¥à ¨áª«î祭¨ï ¯ à ¬¥â஬
¢ á⥪¥. <20>®í⮬㠯ࠢ¨«ì­ë© ¢ë室 ¨§ ®¡à ¡®â稪 : RET 4. ‚®§¢à â
¯à¨ í⮬ ¯à®¨§¢®¤¨âáï ­  ª®¬ ­¤ã, ¢ë§¢ ¢èãî ¨áª«î祭¨¥.
* <20>ਠ¯¥à¥¤ ç¥ ã¯à ¢«¥­¨ï ®¡à ¡®â稪㠨᪫î祭¨©, á¡à á뢠¥âáï
* <20>ਠ¯¥à¥¤ ç¥ ã¯à ¢«¥­¨ï ®¡à ¡®â稪㠨᪫î祭¨© á¡à á뢠¥âáï
ᮮ⢥âáâ¢ãî騩 ¡¨â ¢ ¬ áª¥ ¨áª«î祭¨©. ‚®§­¨ª­®¢¥­¨¥ í⮣® ¦¥
¨áª«î祭¨ï ¢ ¯®á«¥¤á⢨¨ - ¯à¨¢¥¤¥â ª default-®¡à ¡®âª¥ â ª®¢®£®.
€ ¨¬¥­­®: ª § ¢¥à襭¨î à ¡®âë ¯à¨«®¦¥­¨ï, ¨«¨ ¯à¨®áâ ­®¢ª¥ á
­®â¨ä¨ª æ¨¥© ®â« ¦¨¢ î饬㠯ਫ®¦¥­¨î.
* <20>®á«¥ § ¢¥à襭¨ï ªà¨â¨ç¥áª¨å ¤¥©á⢨© ¢ ®¡à ¡®â稪¥ ¯®«ì§®¢ â¥«ï,
¨áª«î祭¨ï ¢¯®á«¥¤á⢨¨ ¯à¨¢¥¤ñâ ª 㬮«ç «ì­®© ®¡à ¡®âª¥ â ª®¢®£®.
€ ¨¬¥­­®: ª § ¢¥à襭¨î à ¡®âë ¯à¨«®¦¥­¨ï ¢ ®âáãâá⢨¨ ®â« ¤ç¨ª ,
¯à¨®áâ ­®¢ª  á 㢥¤®¬«¥­¨¥¬ ®â« ¦¨¢ î饣® ¯à¨«®¦¥­¨ï ¨­ ç¥.
* <20>®á«¥ § ¢¥à襭¨ï ªà¨â¨ç¥áª¨å ¤¥©á⢨© ¢ ®¡à ¡®â稪¥ ¯®«ì§®¢ â¥«ï
¢®ááâ ­®¢«¥­¨¥ ¡¨â  ¬ áª¨ ¤ ­­®£® ¨áª«î祭¨ï ¬®¦­® ᤥ« âì
¯®¤ä㭪樥© 25. ‘¡à®á ä« £®¢ ¨áª«î祭¨© ¢ ¬®¤ã«ïå FPU ¨ XMM -
â ª¦¥ ¢®§« £ ¥âáï ­  ®¡à ¡®â稪 ¯®«ì§®¢ â¥«ï.
¯®¤ä㭪樥© 25. ‘¡à®á ä« £®¢ ¨áª«î祭¨© ¢ ¬®¤ã«ïå FPU ¨ XMM â ª¦¥
¢®§« £ ¥âáï ­  ®¡à ¡®â稪 ¯®«ì§®¢ â¥«ï.
======================================================================
= ”ã­ªæ¨ï 68, ¯®¤äã­ªæ¨ï 25 - ¨§¬¥­¥­¨¥ á®áâ®ï­¨ï  ªâ¨¢­®á⨠ᨣ­ «  =
= ”ã­ªæ¨ï 68, ¯®¤äã­ªæ¨ï 25 - ¨§¬¥­¨âì á®áâ®ï­¨¥  ªâ¨¢­®á⨠ᨣ­ « . =
======================================================================
<EFBFBD> à ¬¥âàë:
* eax = 68 - ­®¬¥à ä㭪樨
@ -3898,10 +3782,11 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
* ecx = ­®¬¥à ᨣ­ « 
* edx = §­ ç¥­¨¥ ãáâ ­ ¢«¨¢ ¥¬®©  ªâ¨¢­®á⨠(0/1)
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = áâ à®¥ §­ ç¥­¨¥  ªâ¨¢­®á⨠ᨣ­ «  (0/1)
* eax = -1 - § ¤ ­ ­¥¢¥à­ë© ­®¬¥à ᨣ­ « 
* ¨­ ç¥ eax = áâ à®¥ §­ ç¥­¨¥  ªâ¨¢­®á⨠ᨣ­ «  (0/1)
‡ ¬¥ç ­¨ï:
* ⥪ã饩 ॠ«¨§ æ¨¨ ¨§¬¥­ï¥âáï ⮫쪮 ¬ áª  ¯®«ì§®¢ â¥«ì᪮£®
®¡à ¡®â稪  ¨áª«î祭¨©, ãáâ ­®¢«¥­­®£® ¯®¤ä㭪樥© 24. <20>ਠí⮬,
®¡à ¡®â稪  ¨áª«î祭¨©, ãáâ ­®¢«¥­­®£® ¯®¤ä㭪樥© 24. <20>ਠí⮬
­®¬¥à ᨣ­ «  ᮮ⢥âáâ¢ã¥â ­®¬¥à㠨᪫î祭¨ï.
======================================================================
@ -3971,7 +3856,7 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
¨ ¯à¨ ¯®áâ㯫¥­¨¨ ­®¢®£® á®®¡é¥­¨ï á¨á⥬  ¡ã¤¥â ¦¤ âì.
„«ï ᨭåà®­¨§ æ¨¨ ®¡à ¬«ï©â¥ ¢áî à ¡®âã á ¡ãä¥à®¬ ®¯¥à æ¨ï¬¨
¡«®ª¨à®¢ª¨/à §¡«®ª¨à®¢ª¨
neg [bufsize]
neg [bufsize]
* „ ­­ë¥ ¢ ¡ãä¥à¥ âà ªâãîâáï ª ª ¬ áᨢ í«¥¬¥­â®¢ ¯¥à¥¬¥­­®© ¤«¨­ë -
á®®¡é¥­¨©. ”®à¬ â á®®¡é¥­¨ï 㪠§ ­ ¢ ®¡é¥¬ ®¯¨á ­¨¨.
@ -4204,6 +4089,10 @@ Architecture Software Developer's Manual, Volume 3, Appendix B);
* '/hd0/2/menuet/pics/tanzania.bmp',0
* '/hd0/1/Program files/NameOfProgram/SomeFile.SomeExtension',0
* '/sys/MySuperApp.ini',0
’ ª¦¥ äã­ªæ¨ï ¯®¤¤¥à¦¨¢ ¥â ®â­®á¨â¥«ì­ë¥ ¨¬¥­ . …᫨ ¯ãâì ­ ç¨­ ¥âáï
­¥ á '/', â® ®­ áç¨â ¥âáï ®â­®á¨â¥«ì­® ⥪ã饩 ¯ ¯ª¨. <20>®«ãç¨âì ¨«¨
ãáâ ­®¢¨âì ⥪ãéãî ¯ ¯ªã ¬®¦­® á ¯®¬®éìî á¨áä㭪樨 30.
„®áâã¯­ë¥ ¯®¤ä㭪樨:
* ¯®¤äã­ªæ¨ï 0 - ç⥭¨¥ ä ©« 
* ¯®¤äã­ªæ¨ï 1 - ç⥭¨¥ ¯ ¯ª¨

View File

@ -1,4 +1,4 @@
SYSTEM FUNCTIONS of OS Kolibri 0.7.5.0
SYSTEM FUNCTIONS of OS Kolibri 0.7.7.0
Number of the function is located in the register eax.
The call of the system function is executed by "int 0x40" command.
@ -347,6 +347,7 @@ Returned value:
* bit 0 (mask 1): window is maximized
* bit 1 (mask 2): window is minimized to panel
* bit 2 (mask 4): window is rolled up
* +71 = +0x47: dword: event mask
Remarks:
* Slots are numbered starting from 1.
* Returned value is not a total number of threads, because there
@ -376,8 +377,8 @@ Remarks:
and idle time in waiting for interrupt (which can be got by call
to subfunction 4 of function 18).
* Beginning from slot 2, the normal applications are placed.
* Applications are placed in memory at the address 0x0
(kernel constant 'std_application_base_address').
* The normal applications are placed in memory at the address
0 (kernel constant 'std_application_base_address').
There is no intersection, as each process has its own page table.
* At creation of the thread it is assigned the slot
in the system table and identifier (Process/Thread IDentifier =
@ -844,12 +845,12 @@ Returned value:
* function does not return value
Structure of the buffer:
db a,b,c,d for version a.b.c.d
db UID_xxx: one of UID_NONE=0, UID_MENUET=1, UID_KOLIBRI=2
db 0: reserved
dd REV - kernel SVN revision number
For Kolibri 0.7.1.0 kernel:
db 0,7,0,0
db 2
dd 638
For Kolibri 0.7.7.0+ kernel:
db 0,7,7,0
db 0
dd 1675
======================================================================
======= Function 18, subfunction 14 - wait for screen retrace. =======
@ -1658,56 +1659,9 @@ Returned value:
Remarks:
* If the buffer is too small to hold all data, only first (edx-1)
bytes are copied and than terminating 0 is inserted.
======================================================================
=============== Function 32 - delete file from ramdisk. ==============
======================================================================
Parameters:
* eax = 32 - function number
* ebx = pointer to the filename
Returned value:
* eax = 0 - success; otherwise file system error code
Remarks:
* This function is obsolete; function 58 allows to fulfill
the same operations with the extended possibilities.
* The current implementation returns only values 0(success) and
5(file not found).
* The filename must be either in the format 8+3 characters
(first 8 characters - name itself, last 3 - extension,
the short names and extensions are supplemented with spaces),
or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
(name no more than 8 characters, dot, extension 3 characters
supplemented if necessary by spaces).
The filename must be written with capital letters. The terminating
character with code 0 is not necessary (not ASCIIZ-string).
* This function does not support folders on the ramdisk.
======================================================================
================ Function 33 - write file to ramdisk. ================
======================================================================
Parameters:
* eax = 33 - function number
* ebx = pointer to the filename
* ecx = pointer to data for writing
* edx = number of bytes for writing
* should be set esi=0
Returned value:
* eax = 0 - success, otherwise file system error code
Remarks:
* This function is obsolete; function 70 allows to fulfil
the same operations with extended possibilities.
* If esi contains non-zero value and selected file already exists,
one more file with the same name will be created.
* Otherwise file will be overwritten.
* The filename must be either in the format 8+3 characters
(first 8 characters - name itself, last 3 - extension,
the short names and extensions are supplemented with spaces),
or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
(name no more than 8 characters, dot, extension 3 characters
supplemented if necessary by spaces).
The filename must be written with capital letters. The terminating
character with code 0 is not necessary (not ASCIIZ-string).
* This function does not support folders on the ramdisk.
* By default, current folder for the thread is "/rd/1".
* At process/thread creation the current folder will be inherited
from the parent.
======================================================================
======= Function 35 - read the color of a pixel on the screen. =======
@ -2193,11 +2147,11 @@ Remarks:
* Structure of the color table is described in the standard
include file 'macros.inc' as 'system_colors'; for example,
it is possible to write:
sc system_colors ; variable declaration
... ; somewhere one must call
; this function with ecx=sc
mov ecx, [sc.work_button_text] ; read text color on
; buttin in working area
sc system_colors ; variable declaration
... ; somewhere one must call
; this function with ecx=sc
mov ecx, [sc.work_button_text] ; read text color on
; buttin in working area
* A program itself desides to use or not to use color table.
For usage program must simply at calls to drawing functions select
color taken from the table.
@ -3098,11 +3052,11 @@ Remarks:
The data of the graphics screen (the memory area which displays
screen contents) are accessible to a program directly, without
any system calls, through the selector gs:
mov eax, [gs:0]
mov eax, [gs:0]
places in eax the first dword of the buffer, which contains
information on color of the left upper point (and, possibly, colors
of several following).
mov [gs:0], eax
mov [gs:0], eax
by work in VESA modes with LFB sets color of the left upper point
(and, possibly, colors of several following).
To interpret the data of graphics screen program needs to know
@ -3260,59 +3214,6 @@ Remarks:
Ralf Brown; registers of the second type must be listed
in the device documentation.
======================================================================
===================== Function 62, subfunction 11 ====================
== Initialize user-accessible MMIO channel ==
======================================================================
Parameters:
* eax = 62 - function
* bl = 11 - subfunction
* cx = PCI-address (bbbbbbbb dddddfff)
Returns:
* eax = -1 - PCI access not granted;
* eax = -2 - no user MMIO access to this PCI address;
* eax = -3 - memory allocation error; otherwise
* eax = available user heap size.
Remarks:
* Low-level PCI access must be allowed (fn21:12)
* PCI-address should correspond the system var [mmio_pci_addr]
======================================================================
===================== Function 62, subfunction 12 ====================
== Request user-accessible MMIO address space ==
======================================================================
Parameters:
* eax = 62 - function
* bl = 12 - subfunction
* bh = BAR number in PCI configuration space
* ecx = MMIO-block size needed (bytes)
* edx = MMIO-offset (number of whole 4Kb-pages!)
Returns:
* eax = -1 - user PCI access denied;
* eax = -2 - invalid BAR number;
* eax = -3 - BAR contains no valid IO addres;
* eax = -4 - BAR addresses IO ports;
* eax = -5 - dynamic allocation error; otherwise
* eax = MMIO start address (in application's linear space).
Remarks:
* Low-level PCI access must be allowed (fn21:12)
* The system var [mmio_pci_addr] sets the actual PCI-address
* The granted MMIO addresses should be released after use (fn62:13)
======================================================================
===================== Function 62, subfunction 13 ====================
== Release a block of user MMIO addresses ==
======================================================================
<EFBFBD> à ¬¥âàë:
* eax = 62 - function
* bl = 12 - subfunction
* ecx = MMIO start address (in application's linear space).
Returns:
* eax = 1 if the block is successfully released;
* eax = 0 in case of reallocation error;
Remarks:
* A valid uMMIO block should exist at this address (fn62:12)
======================================================================
============== Function 63 - work with the debug board. ==============
======================================================================
@ -3421,7 +3322,6 @@ Remarks:
======================================================================
The input mode influences results of reading keys by function 2.
When a program loads, ASCII input mode is set for it.
If subfunction is not support then eax=-1.
-------------- Subfunction 1 - set keyboard input mode. --------------
Parameters:
@ -3670,7 +3570,7 @@ Remarks:
======================================================================
===================== Function 68, subfunction 14 ====================
====== Waiting delivering of signal from another program/driver ======
============ Wait for signal from another program/driver. ============
======================================================================
Parameters:
* eax = 68 - function number
@ -3678,15 +3578,9 @@ Parameters:
* ecx = pointer to the buffer for information (24 bytes)
Returned value:
* buffer pointed to by ecx contains the following information:
* +0: dword: identifier for underlying data of signal
* +4: data of signal (20 bytes), format of which is defining by
first dword
======================================================================
====== Function 68, subfunction 15 - set FPU exception handler. ======
======================================================================
Deleted (in current implementation only 0 is returned).
Using subfunctions 24, 25 is true.
* +0: dword: identifier for following data of signal
* +4: dword: data of signal (20 bytes), format of which is defined
by the first dword
======================================================================
============= Function 68, subfunction 16 - load driver. =============
@ -3720,22 +3614,12 @@ Parameters:
* +16 = +0x10: dword: pointer to output data
* +20 = +0x14: dword: size of output data
Returned value:
* eax = error code
0 - successful call
-1 - any error.
-2, -3, -4, etc. reserved for kernel error codes
1, 2, 3, etc driver specific error codes
* eax = determined by driver
Remarks:
* Function codes and the structure of input/output data
are defined by driver.
* Previously one must obtain driver handle by subfunction 16.
======================================================================
====== Function 68, subfunction 18 - set SSE exception handler. ======
======================================================================
Deleted (in current implementation only 0 is returned).
Using subfunctions 24, 25 is true.
======================================================================
=============== Function 68, subfunction 19 - load DLL. ==============
======================================================================
@ -3775,36 +3659,92 @@ Remarks:
the new and old sizes.
======================================================================
====== Function 68, subfunction 24 - set new exceptions handler ======
======== Function 68, subfunction 22 - open named memory area. =======
======================================================================
Parameters:
* eax = 68 - function number
* ebx = 22 - subfunction number
* ecx = area name. Maximum of 31 characters with terminating zero
* edx = area size in bytes for SHM_CREATE and SHM_OPEN_ALWAYS
* esi = flags for open and access:
* SHM_OPEN = 0x00 - open existing memory area. If an area
with such name does not exist, the function
will return error code 5.
* SHM_OPEN_ALWAYS = 0x04 - open existing or create new
memory area.
* SHM_CREATE = 0x08 - create new memory area. If an area
with such name already exists, the function
will return error code 10.
* SHM_READ = 0x00 - only read access
* SHM_WRITE = 0x01 - read and write access
Returned value:
* eax = pointer to memory area, 0 if error has occured
* if new area is created (SHM_CREATE or SHM_OPEN_ALWAYS):
edx = 0 - success, otherwise - error code
* if existing area is opened (SHM_OPEN or SHM_OPEN_ALWAYS):
edx = error code (if eax=0) or area size in bytes
Error codes:
* E_NOTFOUND = 5
* E_ACCESS = 10
* E_NOMEM = 30
* E_PARAM = 33
Remarks:
* Before this call one must initialize process heap by call to
subfunction 11.
* If a new area is created, access flags set maximal rights
for other processes. An attempt from other process to open
with denied rights will fail with error code E_ACCESS.
* The process which has created an area always has write access.
======================================================================
======= Function 68, subfunction 23 - close named memory area. =======
======================================================================
Parameters:
* eax = 68 - function number
* ebx = 23 - subfunction number
* ecx = area name. Maximum of 31 characters with terminating zero
Returned value:
* eax destroyed
Remarks:
* A memory area is physically freed (with deleting all data and
freeing physical memory), when all threads which have opened
this area will close it.
* When thread is terminating, all opened by it areas are closed.
======================================================================
======== Function 68, subfunction 24 - set exception handler. ========
======================================================================
Parameters:
* eax = 68 - function number
* ebx = 24 - subfunction number
* ecx = address of the new exception handler
* edx = the mask of processing exceptions
* edx = the mask of handled exceptions
Returned value:
* eax = address of the old exception handler (0, if it was not set)
* ebx = the old mask of exception handler
* ebx = the old mask of handled exceptions
Remarks:
* Bit number in mask of exceptions is correspond to exception number
by CPU-specification (Intel-PC). For example, FPU-exception have
number 16 (#MF), and SSE-exception - 19 (#XF)
* The current implementation ignore the inquiry for hook of 7
exception - system process #NM by one's own.
* User handler get exception number in stack parameter. So, correct
exit from handler is: RET 4. Return from handler is to the same
instruction, that was cause the exception
* When control is transfering to user handler, corresponding bit in
exception mask is clearing. Rising this exception in consequence
- reduce to default-handling. Exactly: terminating the application,
or suspending with debug-notify to owner.
* After completion of critical operations in user handler, it may be
rising corresponding bit in exception mask by using subfunction 25
Clearing exceptions flags in FPU and/or XMM modules - is
responsibility of user handler too.
* Bit number in mask of exceptions corresponds to exception number
in CPU-specification (Intel-PC). For example, FPU exceptions have
number 16 (#MF), and SSE exceptions - 19 (#XF).
* The current implementation ignores the inquiry for hook of 7
exception - the system handles #NM by its own.
* The exception handler is called with exception number as first
(and only) stack parameter. So, correct exit from the handler is
RET 4. It returns to the instruction, that caused the exception,
for faults, and to the next instruction for traps (see
classification of exceptions in CPU specification).
* When user handler receives control, the corresponding bit in
the exception mask is cleared. Raising this exception
in consequence leads to default handling, that is,
terminating the application in absence of debugger or
suspend with notification of debugger otherwise.
* After user handler completes critical operations, it can set
the corresponding bit in the exception mask with subfunction 25.
Also user handler is responsible for clearing exceptions flags in
FPU and/or SSE.
======================================================================
==== Function 68, subfunction 25 - change state of signal activity ===
====== Function 68, subfunction 25 - set FPU exception handler. ======
======================================================================
Parameters:
* eax = 68 - function number
@ -3812,14 +3752,15 @@ Parameters:
* ecx = signal number
* edx = value of activity (0/1)
Returned value:
* eax = value of old activity for this signal (0/1)
* eax = -1 - invalid signal number
* otherwise eax = old value of activity for this signal (0/1)
Remarks:
* In current implementation, it is changed only exception mask for
user exception handler, wich was previously set by subfunction 24.
At that, number of signal correspond to exception number.
* In current implementation only mask for user excepton handler,
which has been previously set by subfunction 24,
is changed. Signal number corresponds to exception number.
======================================================================
====================== Fucntion 69 - debugging. ======================
====================== Function 69 - debugging. ======================
======================================================================
A process can load other process as debugged by set of corresponding
bit by call to subfunction 7 of function 70.
@ -3882,7 +3823,7 @@ Remarks:
and at arrival of new message the system will wait.
For synchronization frame all work with the buffer by operations
lock/unlock
neg [bufsize]
neg [bufsize]
* Data in the buffer are considered as array of items with variable
length - messages. Format of a message is explained in
general description.
@ -4111,6 +4052,10 @@ Examples:
* '/hd0/2/menuet/pics/tanzania.bmp',0
* '/hd0/1/Program files/NameOfProgram/SomeFile.SomeExtension',0
* '/sys/MySuperApp.ini',0
Also function supports relative names. If the path begins not
with '/', it is considered relative to a current folder. To get or
set a current folder, use the function 30.
Available subfunctions:
* subfunction 0 - read file
* subfunction 1 - read folder

View File

@ -90,4 +90,6 @@ kernel_export \
strchr,\
strrchr,\
\
LFBAddress
LFBAddress,\
GetDisplay,\
SetScreen

View File

@ -55,6 +55,7 @@ MANUAL_DESTROY equ 0x80000000
DEV_PLAY equ 1
DEV_STOP equ 2
DEV_CALLBACK equ 3
DEV_GET_POS equ 9
struc IOCTL
{ .handle dd ?
@ -159,14 +160,65 @@ inp_size equ IOCTL.inp_size
output equ IOCTL.output
out_size equ IOCTL.out_size
align 4
srv_calls dd service_proc.srv_getversion ; 0
dd service_proc.snd_create_buff ; 1
dd service_proc.snd_destroy_buff ; 2
dd service_proc.snd_setformat ; 3
dd service_proc.snd_getformat ; 4
dd service_proc.snd_reset ; 5
dd service_proc.snd_setpos ; 6
dd service_proc.snd_getpos ; 7
dd service_proc.snd_setbuff ; 8
dd service_proc.snd_out ; 9
dd service_proc.snd_play ; 10
dd service_proc.snd_stop ; 11
dd service_proc.snd_setvolume ; 12
dd service_proc.snd_getvolume ; 13
dd service_proc.snd_setpan ; 14
dd service_proc.snd_getpan ; 15
dd service_proc.snd_getbuffsize ; 16
dd service_proc.snd_getfreespace ; 17
dd service_proc.snd_settimebase ; 18
dd service_proc.snd_gettimestamp ; 19
srv_calls_end:
proc service_proc stdcall, ioctl:dword
mov edi, [ioctl]
mov eax, [edi+io_code]
cmp eax, SRV_GETVERSION
jne @F
cmp eax, (srv_calls_end-srv_calls)/4
ja .fail
cmp eax, SND_DESTROY_BUFF
jb @F
; cmp [edi+inp_size], 4
; jb .fali
mov ebx, [edi+input]
mov edx, [ebx]
cmp [edx+STREAM.magic], 'WAVE'
jne .fail
cmp [edx+STREAM.size], STREAM.sizeof
jne .fail
@@:
jmp [srv_calls+eax*4]
.fail:
mov eax, -1
ret
align 4
.srv_getversion:
mov eax, [edi+output]
cmp [edi+out_size], 4
jne .fail
@ -174,9 +226,9 @@ proc service_proc stdcall, ioctl:dword
mov [eax], dword API_VERSION
xor eax, eax
ret
@@:
cmp eax, SND_CREATE_BUFF
jne @F
align 4
.snd_create_buff:
mov ebx, [edi+input]
stdcall CreateBuffer,[ebx],[ebx+4]
mov edi, [ioctl]
@ -184,121 +236,105 @@ proc service_proc stdcall, ioctl:dword
mov ecx, [ecx]
mov [ecx], ebx
ret
@@:
mov ebx, [edi+input]
mov edx, [ebx]
cmp [edx+STREAM.magic], 'WAVE'
jne .fail
cmp [edx+STREAM.size], STREAM_SIZE
jne .fail
cmp eax, SND_DESTROY_BUFF
jne @F
align 4
.snd_destroy_buff:
mov eax, edx
call DestroyBuffer ;edx= stream
call DestroyBuffer
ret
@@:
cmp eax, SND_SETFORMAT
jne @F
stdcall SetFormat,edx,[ebx+4]
ret
@@:
cmp eax, SND_GETFORMAT
jne @F
align 4
.snd_setformat:
stdcall SetFormat, edx,[ebx+4]
ret
align 4
.snd_getformat:
movzx eax, word [edx+STREAM.format]
mov ecx, [edi+output]
mov ecx, [ecx]
mov [ecx], eax
xor eax, eax
ret
@@:
cmp eax, SND_RESET
jne @F
align 4
.snd_reset:
stdcall ResetBuffer,edx,[ebx+4]
ret
@@:
cmp eax, SND_SETPOS
jne @F
align 4
.snd_setpos:
stdcall SetBufferPos,edx,[ebx+4]
ret
@@:
cmp eax, SND_GETPOS
jne @F
align 4
.snd_getpos:
stdcall GetBufferPos, edx
mov edi, [ioctl]
mov ecx, [edi+output]
mov ecx, [ecx]
mov [ecx], ebx
ret
@@:
cmp eax, SND_SETBUFF
jne @F
align 4
.snd_setbuff:
mov eax, [ebx+4]
stdcall set_buffer, edx,eax,[ebx+8],[ebx+12]
ret
@@:
cmp eax, SND_SETVOLUME
jne @F
align 4
.snd_out:
mov eax, [ebx+4]
stdcall wave_out, edx,eax,[ebx+8]
ret
align 4
.snd_play:
stdcall play_buffer, edx,[ebx+4]
ret
align 4
.snd_stop:
stdcall stop_buffer, edx
ret
align 4
.snd_setvolume:
stdcall SetBufferVol,edx,[ebx+4],[ebx+8]
ret
@@:
cmp eax, SND_GETVOLUME
jne @F
align 4
.snd_getvolume:
mov eax, [edi+output]
mov ecx, [eax]
mov eax, [eax+4]
stdcall GetBufferVol,edx,ecx,eax
ret
@@:
cmp eax, SND_SETPAN
jne @F
align 4
.snd_setpan:
stdcall SetBufferPan,edx,[ebx+4]
ret
@@:
cmp eax, SND_GETPAN
jne @F
align 4
.snd_getpan:
mov eax, [edx+STREAM.pan]
mov ebx, [edi+output]
mov ebx, [ebx]
mov [ebx], eax
xor eax, eax
ret
@@:
cmp eax, SND_OUT
jne @F
mov eax, [ebx+4]
stdcall wave_out, edx,eax,[ebx+8]
ret
@@:
cmp eax, SND_PLAY
jne @F
stdcall play_buffer, edx,[ebx+4]
ret
@@:
cmp eax, SND_STOP
jne @F
stdcall stop_buffer, edx
ret
@@:
cmp eax, SND_GETBUFFSIZE
jne @F
align 4
.snd_getbuffsize:
mov eax, [edx+STREAM.in_size]
mov ecx, [edi+output]
mov ecx, [ecx]
mov [ecx], eax
xor eax, eax
ret
@@:
cmp eax, SND_GETFREESPACE
jne @F
align 4
.snd_getfreespace:
test [edx+STREAM.format], PCM_OUT
jz .fail
@ -307,12 +343,73 @@ proc service_proc stdcall, ioctl:dword
mov [ecx], ebx
xor eax, eax
ret
align 4
.snd_settimebase:
cmp [edi+inp_size], 12
jne .fail
mov eax, [ebx]
mov ebx, [ebx+4]
mov dword [edx+STREAM.time_base], eax
mov dword [edx+STREAM.time_base+4], ebx
xor eax, eax
ret
.snd_gettimestamp:
cmp [edi+out_size], 8
jne .fail
pushfd
cli
xor ebx, ebx
push 48
push ebx ; local storage
cmp [edx+STREAM.flags], SND_STOP
je @F
mov eax, esp
push edx
push edi
push 4 ;.out_size
push eax ;.output
push ebx ;.inp_size
push ebx ;.input
push DEV_GET_POS ;.code
push dword [hSound] ;.handle
mov eax, esp
stdcall ServiceHandler, eax
add esp, 6*4
pop edi
pop edx
test eax, eax
jz @F
mov dword [esp], 0 ; clear offset
@@:
.fail:
or eax, -1
mov edi, [edi+output]
emms
fild qword [edx+STREAM.time_stamp]
fiadd dword [esp] ; primary buffer offset
fidiv dword [esp+4] ; total_samples / frequency
fadd qword [edx+STREAM.time_base]
fstp qword [edi]
add esp, 8
popfd
xor eax, eax
ret
endp
restore handle
restore io_code
restore input
@ -352,7 +449,7 @@ proc CreateBuffer stdcall, format:dword, size:dword
call GetPid
mov ebx, eax
mov eax, STREAM_SIZE
mov eax, STREAM.sizeof
call CreateObject
test eax, eax
@ -412,7 +509,6 @@ proc CreateBuffer stdcall, format:dword, size:dword
mov [edi+STREAM.in_base], eax
mov [edi+STREAM.in_size], ecx
add eax, 128
; sub ecx, 128
mov [edi+STREAM.in_wp], eax
mov [edi+STREAM.in_rp], eax
mov [edi+STREAM.in_count], 0
@ -443,13 +539,22 @@ proc CreateBuffer stdcall, format:dword, size:dword
stdcall AllocKernelSpace, dword 128*1024
mov edi, [str]
xor ebx, ebx
mov [edi+STREAM.out_base], eax
mov [edi+STREAM.out_wp], eax
mov [edi+STREAM.out_rp], eax
mov [edi+STREAM.out_count], 0
mov [edi+STREAM.out_count], ebx
add eax, 64*1024
mov [edi+STREAM.out_top], eax
mov dword [edi+STREAM.time_base], ebx
mov dword [edi+STREAM.time_base+4], ebx
mov dword [edi+STREAM.time_stamp], ebx
mov dword [edi+STREAM.time_stamp+4], ebx
mov dword [edi+STREAM.last_ts], ebx
stdcall AllocPages, dword 64/4
mov edi, [str]
mov ebx, [edi+STREAM.out_base]
@ -488,7 +593,7 @@ proc CreateBuffer stdcall, format:dword, size:dword
mov [ebx+STREAM.magic], 'WAVE'
mov [ebx+STREAM.destroy], DestroyBuffer.destroy
mov [ebx+STREAM.size], STREAM_SIZE
mov [ebx+STREAM.size], STREAM.sizeof
mov [ebx+STREAM.flags], SND_STOP
pushf
@ -857,6 +962,26 @@ proc SetBufferVol stdcall, str:dword,l_vol:dword,r_vol:dword
ret
endp
proc minw stdcall, arg1:dword, arg2:dword
mov ax, word [arg1]
cmp ax, word [arg2]
jle @f
mov eax, [arg2]
@@:
ret
endp
proc maxw stdcall, arg1:dword, arg2:dword
mov ax, word [arg1]
cmp ax, word [arg2]
jge @f
mov eax, [arg2]
@@:
ret
endp
proc set_vol_param stdcall, l_vol:dword,r_vol:dword,pan:dword
locals
_600 dd ?
@ -870,31 +995,34 @@ proc set_vol_param stdcall, l_vol:dword,r_vol:dword,pan:dword
lea ebx, [state]
fnsave [ebx]
movq mm0, qword [l_vol]
pminsw mm0, qword [vol_max]
pmaxsw mm0, qword [vol_min]
movq qword [l_vol], mm0
movq qword [edx+STREAM.l_vol], mm0
stdcall minw, [l_vol], [vol_max]
stdcall maxw, eax, [vol_min]
mov [l_vol], eax
mov [edx+STREAM.l_vol], eax
stdcall minw, [r_vol], [vol_max+4]
stdcall maxw, eax, [vol_min+4]
mov [r_vol], eax
mov [edx+STREAM.r_vol], eax
movd mm1,[pan]
pminsw mm1, qword [pan_max]
pmaxsw mm1, qword [vol_min]
movd [edx+STREAM.pan], mm1
stdcall minw, [pan], [pan_max]
stdcall maxw, eax, [vol_min]
mov [edx+STREAM.pan], eax
cmp word [edx+STREAM.pan], 0
jl @F
jl @f
psubsw mm0,mm1
pminsw mm0, qword [vol_max]
pmaxsw mm0, qword [vol_min]
movd [l_vol],mm0
mov ebx, [l_vol]
sub ebx, eax
stdcall minw, ebx, [vol_max]
stdcall maxw, eax, [vol_min]
mov [l_vol], eax
jmp .calc_amp
@@:
punpckhdq mm0,mm0
paddsw mm0,mm1
pminsw mm0, qword [vol_max]
pmaxsw mm0, qword [vol_min]
movd [r_vol], mm0
mov ebx, [r_vol]
add ebx, [pan]
stdcall minw, ebx, [vol_max+4]
stdcall maxw, eax, [vol_min+4]
mov [r_vol], eax
.calc_amp:
emms
fild word [l_vol]
@ -935,6 +1063,7 @@ proc set_vol_param stdcall, l_vol:dword,r_vol:dword,pan:dword
ret 0
endp
align 4
proc GetBufferVol stdcall, str:dword,p_lvol:dword,p_rvol:dword
@ -1039,7 +1168,7 @@ do_mix_list:
cmp [ebx+STREAM.magic], 'WAVE'
jne .next
cmp [ebx+STREAM.size], STREAM_SIZE
cmp [ebx+STREAM.size], STREAM.sizeof
jne .next
cmp [ebx+STREAM.flags], SND_PLAY;
@ -1108,7 +1237,7 @@ prepare_playlist:
cmp [edi+STREAM.magic], 'WAVE'
jne .next
cmp [edi+STREAM.size], STREAM_SIZE
cmp [edi+STREAM.size], STREAM.sizeof
jne .next
cmp [edi+STREAM.flags], SND_PLAY;

View File

@ -91,6 +91,8 @@ SND_SETPAN equ 14
SND_GETPAN equ 15
SND_GETBUFFSIZE equ 16
SND_GETFREESPACE equ 17
SND_SETTIMEBASE equ 18
SND_GETTIMESTAMP equ 19
struc STREAM
{
@ -113,6 +115,23 @@ struc STREAM
.out_count dd ?
.out_top dd ? ;16*4
.in_base dd ?
.in_size dd ?
.in_wp dd ?
.in_rp dd ?
.in_count dd ?
.in_free dd ?
.in_top dd ?
align 8
.time_base dq ?
.time_stamp dq ?
.last_ts dd ?
.notify_event dd ?
.notify_id dd ?
.r_size dd ?
.r_dt dd ?
.r_silence dd ?
@ -125,19 +144,9 @@ struc STREAM
.l_amp_f dd ? ;float point left
.r_amp_f dd ? ;float point right
.in_base dd ?
.in_size dd ?
.in_wp dd ?
.in_rp dd ?
.in_count dd ?
.in_free dd ?
.in_top dd ?
.notify_event dd ?
.notify_id dd ?
.sizeof:
}
STREAM_SIZE equ 36*4
FD_OFFSET equ 24
virtual at 0

View File

@ -29,7 +29,7 @@ proc new_mix stdcall, output:dword
and eax, -16 ;must be 16b aligned
call FpuSave
call update_stream
call update_streams
.mix:
lea eax, [mix_list]
call do_mix_list
@ -87,7 +87,7 @@ end if
endp
align 4
proc update_stream
proc update_streams
locals
stream_index dd ?
event rd 6
@ -98,6 +98,10 @@ proc update_stream
mov edx, [stream_index]
mov esi, [play_list+edx*4]
add dword [esi+STREAM.time_stamp], 4096
adc dword [esi+STREAM.time_stamp+4], 0
mov dword [esi+STREAM.last_ts], 0
mov eax, [esi+STREAM.out_rp]
cmp eax, [esi+STREAM.out_top]
jb @f

View File

@ -7,7 +7,7 @@
format MS COFF
include 'config.inc'
include 'CONFIG.INC'
;structs----------------------------------------------------------
struc IOCTL
@ -33,7 +33,7 @@ include '..\imports.inc'
section '.flat' code readable align 16
include 'sb16.inc'
include 'SB16.INC'
;-------------------------------------------------------------------------------
proc START stdcall, state:dword

View File

@ -16,10 +16,6 @@ API_VERSION equ 0 ;debug
include 'proc32.inc'
include 'imports.inc'
OS_BASE equ 0;
new_app_base equ 0x60400000
PROC_BASE equ OS_BASE+0x0080000
struc IOCTL
{ .handle dd ?
.io_code dd ?

View File

@ -138,6 +138,7 @@ DEV_NOTIFY equ 5
DEV_SET_MASTERVOL equ 6
DEV_GET_MASTERVOL equ 7
DEV_GET_INFO equ 8
DEV_GET_POS equ 9
struc AC_CNTRL ;AC controller base class
{ .bus dd ?
@ -333,46 +334,7 @@ proc START stdcall, state:dword
mov esi, msgDone
call SysMsgBoardStr
if IRQ_REMAP
pushf
cli
mov ebx, [ctrl.int_line]
in al, 0xA1
mov ah, al
in al, 0x21
test ebx, ebx
jz .skip
bts ax, bx ;mask old line
.skip
bts ax, IRQ_LINE ;mask new ine
out 0x21, al
mov al, ah
out 0xA1, al
;remap IRQ
stdcall PciWrite8, 0, 0xF8, 0x61, IRQ_LINE
mov dx, 0x4d0 ;8259 ELCR1
in al, dx
bts ax, IRQ_LINE
out dx, al ;set level-triggered mode
mov [ctrl.int_line], IRQ_LINE
popf
mov esi, msgRemap
call SysMsgBoardStr
end if
mov eax, VALID_IRQ
mov ebx, [ctrl.int_line]
mov esi, msgInvIRQ
bt eax, ebx
jnc .fail_msg
mov eax, ATTCH_IRQ
mov esi, msgAttchIRQ
bt eax, ebx
jnc .fail_msg
stdcall AttachIntHandler, ebx, ac97_irq, dword 0
stdcall AttachIntHandler, 17, ac97_irq, dword 0
.reg:
stdcall RegService, sz_sound_srv, service_proc
ret
@ -453,6 +415,21 @@ proc service_proc stdcall, ioctl:dword
mov ebx, [edi+output]
stdcall get_master_vol, ebx
ret
@@:
cmp eax, DEV_GET_POS
jne @F
mov ebx, 8192
mov edx, 0x18
xor eax, eax
call [ctrl.ctrl_read16]
sub ebx, eax
shr ebx, 1
mov edx, [edi+output]
mov [edx], ebx
xor eax, eax
ret
;@@:
; cmp eax, DEV_GET_INFO
; jne @F
@ -480,6 +457,22 @@ proc ac97_irq
call SysMsgBoardStr
end if
mov edx, CTRL_STAT
call [ctrl.ctrl_read32]
push eax
test eax, 0x40
jnz .do_intr
test eax, eax
jz .done
mov edx, CTRL_STAT
call [ctrl.ctrl_write32]
jmp .done
.do_intr:
mov edx, PCM_OUT_CR_REG
mov al, 0x10; 0x10
call [ctrl.ctrl_write8]
@ -512,18 +505,22 @@ proc ac97_irq
and eax, 31
mov ebx, dword [buff_list+eax*4]
cmp [ctrl.user_callback], 0
je @f
cmp [ctrl.user_callback], 0
je .done
stdcall [ctrl.user_callback], ebx
@@:
stdcall [ctrl.user_callback], ebx
.done:
pop eax
and eax, 0x40
mov edx, CTRL_STAT
call [ctrl.ctrl_write32]
ret
.skip:
mov edx, PCM_OUT_CR_REG
mov ax, 0x11 ;0x1D
call [ctrl.ctrl_write8]
ret
jmp .done
endp
align 4
@ -776,6 +773,8 @@ end if
and eax, 0xFF
mov [ctrl.cfg_reg], eax
mov [ctrl.user_callback], 0
call [ctrl.ctrl_setup]
xor eax, eax
inc eax

View File

@ -67,9 +67,11 @@ free_cd_channel:
jne .IDE_Channel_2
.IDE_Channel_1:
mov [IDE_Channel_1],0
sti
ret
.IDE_Channel_2:
mov [IDE_Channel_2],0
sti
ret
uglobal

View File

@ -94,12 +94,34 @@ hotkey_do_test:
pop eax
ret
align 4
set_keyboard_data:
movzx eax,word[TASK_COUNT] ; top window process
movzx eax,word[WIN_POS+eax*2]
shl eax,8
mov al,[SLOT_BASE+eax+APPDATA.keyboard_mode]
mov [keyboard_mode],al
mov eax, ecx
push ebx
push esi
push edi
push ebp
call send_scancode
pop ebp
pop edi
pop esi
pop ebx
ret
align 4
irq1:
; save_ring3_context
; mov ax, os_data
; mov ds, ax
; mov es, ax
movzx eax,word[TASK_COUNT] ; top window process
movzx eax,word[WIN_POS+eax*2]
@ -108,6 +130,9 @@ irq1:
mov [keyboard_mode],al
in al,0x60
send_scancode:
mov [keyboard_data],al
; ch = scancode
@ -310,11 +335,6 @@ irq1:
.exit.irq1:
mov [check_idle_semaphore],5
; mov al,0x20 ; ready for next irq
; out 0x20,al
; restore_ring3_context
; iret
ret
set_lights:

View File

@ -292,21 +292,20 @@ __sys_disable_mouse:
add ecx,eax
add ecx, [_WinMapAddress]
mov eax, [CURRENT_TASK]
movzx ebx, byte [ecx]
cmp eax,ebx
cmp al, [ecx]
je yes_mouse_disable
movzx ebx, byte [ecx+16]
cmp eax,ebx
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
movzx ebx, byte [ecx]
cmp eax,ebx
cmp al, [ecx]
je yes_mouse_disable
movzx ebx, byte [ecx+16]
cmp eax,ebx
cmp al, [ecx+16]
je yes_mouse_disable
jmp no_mouse_disable
yes_mouse_disable:

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Copyright (C) KolibriOS team 2004-2010. All rights reserved.
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved.
;; PROGRAMMING:
;; Ivan Poddubny
;; Marat Zakiyanov (Mario79)
@ -19,6 +19,17 @@
;; SPraid (simba)
;; Hidnplayr
;; Alexey Teplov (<Lrz>)
;; Rus
;; Nable
;; shurf
;; Alver
;; Maxis
;; Galkov
;; CleverMouse
;; tsdima
;; turbanoff
;; Asper
;; art_zh
;;
;; Data in this file was originally part of MenuetOS project which is
;; distributed under the terms of GNU GPL. It is modified and redistributed as
@ -220,8 +231,8 @@ B32:
; CLEAR 0x280000 - HEAP_BASE
xor eax,eax
mov edi,0x280000
mov ecx,(HEAP_BASE-OS_BASE-0x280000) / 4
mov edi,CLEAN_ZONE
mov ecx,(HEAP_BASE-OS_BASE-CLEAN_ZONE) / 4
cld
rep stosd
@ -237,7 +248,7 @@ B32:
; SAVE & CLEAR 0-0xffff
xor esi, esi
mov edi,0x2F0000
mov edi,(BOOT_VAR-OS_BASE)
mov ecx,0x10000 / 4
rep movsd
mov edi,0x1000
@ -605,6 +616,8 @@ high_code:
; Enable timer IRQ (IRQ0) and hard drives IRQs (IRQ14, IRQ15)
; they are used: when partitions are scanned, hd_read relies on timer
call unmask_timer
stdcall enable_irq, 12
stdcall enable_irq, 1
stdcall enable_irq, 14
stdcall enable_irq, 15
@ -621,11 +634,14 @@ include 'detect/disks.inc'
call Parser_params
if ~ defined extended_primary_loader
; ramdisk image should be loaded by extended primary loader if it exists
; READ RAMDISK IMAGE FROM HD
;!!!!!!!!!!!!!!!!!!!!!!!
include 'boot/rdload.inc'
;!!!!!!!!!!!!!!!!!!!!!!!
end if
; mov [dma_hdd],1
; CALCULATE FAT CHAIN FOR RAMDISK
@ -780,6 +796,9 @@ end if
mov [CPU_FREQ],eax ; save tsc / sec
; mov ebx, 1000000
; div ebx
; ¢®®¡é¥-â® ¯à®¨§¢®¤¨â¥«ì­®áâì ¢ ¤ ­­®¬ ª®­ªà¥â­®¬ ¬¥áâ¥
; ᮢ¥à襭­® ­¥ªà¨â¨ç­ , ­® çâ®¡ë § âª­ãâì «î¡¨â¥«¥©
; ®¯â¨¬¨§¨àãîé¨å ª®¬¯¨«ïâ®à®¢ Ÿ‚“...
mov edx, 2251799814
mul edx
shr edx, 19
@ -960,7 +979,7 @@ if defined debug_com_base
end if
;-=-=-=-=-=-=- START MULTITASKING -=-=-=-=-=-=-=-=-
; START MULTITASKING
; A 'All set - press ESC to start' messages if need
if preboot_blogesc
@ -2775,6 +2794,10 @@ sys_cpuusage:
mov al, [ecx+window_data+WDATA.fl_wstate]
stosb
; Event mask (+71)
mov EAX, dword [ECX+CURRENT_TASK+TASKDATA.event_mask]
stosd
pop esi
pop edi
@ -5051,6 +5074,7 @@ system_shutdown: ; shut down the system
yes_shutdown_param:
cli
if ~ defined extended_primary_loader
mov eax, kernel_file ; load kernel.mnt to 0x7000:0
push 12
pop esi
@ -5063,8 +5087,9 @@ yes_shutdown_param:
mov edi,OS_BASE+0x40000
mov ecx,1000
rep movsb
end if
mov esi,OS_BASE+0x2F0000 ; restore 0x0 - 0xffff
mov esi, BOOT_VAR ; restore 0x0 - 0xffff
mov edi, OS_BASE
mov ecx,0x10000/4
cld

View File

@ -144,7 +144,7 @@ struc APPDATA
.ev_count_ dd ? ;unused ;+20
.exc_handler dd ? ;+24
.except_mask dd ? ;+28
.pl0_stack dd ? ;unused ;+32
.pl0_stack dd ? ;+32
.heap_base dd ? ;+36
.heap_top dd ? ;+40
.cursor dd ? ;+44
@ -250,6 +250,7 @@ include "sound/playnote.inc" ; player Note for Speaker PC
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
include "video/cursors.inc" ; cursors functions

View File

@ -0,0 +1,813 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; R6040 driver for KolibriOS ;;
;; ;;
;; based on R6040.c from linux ;;
;; ;;
;; Written by Asper (asper.85@mail.ru) ;;
;; and hidnplayr (hidnplayr@gmail.com) ;;
;; ;;
;; GNU GENERAL PUBLIC LICENSE ;;
;; Version 2, June 1991 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;********************************************************************
; Interface
; r6040_reset
; r6040_probe
; r6040_poll
; r6040_transmit
;
; These functions are referenced in ethernet.inc
;
;********************************************************************
;; A few user-configurable values.
TX_RING_SIZE equ 4
RX_RING_SIZE equ 4
; ethernet address length
ETH_ALEN equ 6
ETH_HLEN equ (2 * ETH_ALEN + 2)
ETH_ZLEN equ 60 ; 60 + 4bytes auto payload for
; mininmum 64bytes frame length
; system timer frequency
HZ equ 1000
; max time out delay time
W_MAX_TIMEOUT equ 0x0FFF
;; Size of the in-memory receive ring.
RX_BUF_LEN_IDX equ 3 ;; 0==8K, 1==16K, 2==32K, 3==64K
RX_BUF_LEN equ (8192 << RX_BUF_LEN_IDX)
;-; Size of the Tx bounce buffers -- must be at least (dev->mtu+14+4).
;-TX_BUF_SIZE equ 1536
;-RX_BUF_SIZE equ 1536
;; PCI Tuning Parameters
; Threshold is bytes transferred to chip before transmission starts.
TX_FIFO_THRESH equ 256 ;; In bytes, rounded down to 32 byte units.
;; The following settings are log_2(bytes)-4: 0 == 16 bytes .. 6==1024.
RX_FIFO_THRESH equ 4 ;; Rx buffer level before first PCI xfer.
RX_DMA_BURST equ 4 ;; Maximum PCI burst, '4' is 256 bytes
TX_DMA_BURST equ 4
;; Operational parameters that usually are not changed.
PHY1_ADDR equ 1 ;For MAC1
PHY2_ADDR equ 3 ;For MAC2
PHY_MODE equ 0x3100 ;PHY CHIP Register 0
PHY_CAP equ 0x01E1 ;PHY CHIP Register 4
;; Time in jiffies before concluding the transmitter is hung.
TX_TIMEOUT equ ((6000*HZ)/1000)
R6040_IO_SIZE equ 256 ; RDC MAC I/O Size
MAX_MAC equ 2 ; MAX RDC MAC
;**************************************************************************
; RDC R6040 Register Definitions
;**************************************************************************
MCR0 equ 0x00 ;Control register 0
MCR1 equ 0x01 ;Control register 1
MAC_RST equ 0x0001 ;Reset the MAC
MBCR equ 0x08 ;Bus control
MT_ICR equ 0x0C ;TX interrupt control
MR_ICR equ 0x10 ;RX interrupt control
MTPR equ 0x14 ;TX poll command register
MR_BSR equ 0x18 ;RX buffer size
MR_DCR equ 0x1A ;RX descriptor control
MLSR equ 0x1C ;Last status
MMDIO equ 0x20 ;MDIO control register
MDIO_WRITE equ 0x4000 ;MDIO write
MDIO_READ equ 0x2000 ;MDIO read
MMRD equ 0x24 ;MDIO read data register
MMWD equ 0x28 ;MDIO write data register
MTD_SA0 equ 0x2C ;TX descriptor start address 0
MTD_SA1 equ 0x30 ;TX descriptor start address 1
MRD_SA0 equ 0x34 ;RX descriptor start address 0
MRD_SA1 equ 0x38 ;RX descriptor start address 1
MISR equ 0x3C ;Status register
MIER equ 0x40 ;INT enable register
MSK_INT equ 0x0000 ;Mask off interrupts
RX_FINISH equ 0x0001 ;RX finished
RX_NO_DESC equ 0x0002 ;No RX descriptor available
RX_FIFO_FULL equ 0x0004 ;RX FIFO full
RX_EARLY equ 0x0008 ;RX early
TX_FINISH equ 0x0010 ;TX finished
TX_EARLY equ 0x0080 ;TX early
EVENT_OVRFL equ 0x0100 ;Event counter overflow
LINK_CHANGED equ 0x0200 ;PHY link changed
ME_CISR equ 0x44 ;Event counter INT status
ME_CIER equ 0x48 ;Event counter INT enable
MR_CNT equ 0x50 ;Successfully received packet counter
ME_CNT0 equ 0x52 ;Event counter 0
ME_CNT1 equ 0x54 ;Event counter 1
ME_CNT2 equ 0x56 ;Event counter 2
ME_CNT3 equ 0x58 ;Event counter 3
MT_CNT equ 0x5A ;Successfully transmit packet counter
ME_CNT4 equ 0x5C ;Event counter 4
MP_CNT equ 0x5E ;Pause frame counter register
MAR0 equ 0x60 ;Hash table 0
MAR1 equ 0x62 ;Hash table 1
MAR2 equ 0x64 ;Hash table 2
MAR3 equ 0x66 ;Hash table 3
MID_0L equ 0x68 ;Multicast address MID0 Low
MID_0M equ 0x6A ;Multicast address MID0 Medium
MID_0H equ 0x6C ;Multicast address MID0 High
MID_1L equ 0x70 ;MID1 Low
MID_1M equ 0x72 ;MID1 Medium
MID_1H equ 0x74 ;MID1 High
MID_2L equ 0x78 ;MID2 Low
MID_2M equ 0x7A ;MID2 Medium
MID_2H equ 0x7C ;MID2 High
MID_3L equ 0x80 ;MID3 Low
MID_3M equ 0x82 ;MID3 Medium
MID_3H equ 0x84 ;MID3 High
PHY_CC equ 0x88 ;PHY status change configuration register
PHY_ST equ 0x8A ;PHY status register
MAC_SM equ 0xAC ;MAC status machine
MAC_ID equ 0xBE ;Identifier register
MAX_BUF_SIZE equ 0x600 ;1536
MBCR_DEFAULT equ 0x012A ;MAC Bus Control Register
MCAST_MAX equ 3 ;Max number multicast addresses to filter
;Descriptor status
DSC_OWNER_MAC equ 0x8000 ;MAC is the owner of this descriptor
DSC_RX_OK equ 0x4000 ;RX was successfull
DSC_RX_ERR equ 0x0800 ;RX PHY error
DSC_RX_ERR_DRI equ 0x0400 ;RX dribble packet
DSC_RX_ERR_BUF equ 0x0200 ;RX length exceeds buffer size
DSC_RX_ERR_LONG equ 0x0100 ;RX length > maximum packet length
DSC_RX_ERR_RUNT equ 0x0080 ;RX packet length < 64 byte
DSC_RX_ERR_CRC equ 0x0040 ;RX CRC error
DSC_RX_BCAST equ 0x0020 ;RX broadcast (no error)
DSC_RX_MCAST equ 0x0010 ;RX multicast (no error)
DSC_RX_MCH_HIT equ 0x0008 ;RX multicast hit in hash table (no error)
DSC_RX_MIDH_HIT equ 0x0004 ;RX MID table hit (no error)
DSC_RX_IDX_MID_MASK equ 3 ;RX mask for the index of matched MIDx
;PHY settings
ICPLUS_PHY_ID equ 0x0243
RX_INTS equ RX_FIFO_FULL or RX_NO_DESC or RX_FINISH
TX_INTS equ TX_FINISH
INT_MASK equ RX_INTS or TX_INTS
r6040_txb equ (eth_data_start)
r6040_rxb equ ((r6040_txb+(MAX_BUF_SIZE*TX_RING_SIZE)+32) and 0xfffffff0)
r6040_tx_ring equ ((r6040_rxb+(MAX_BUF_SIZE*RX_RING_SIZE)+32) and 0xfffffff0)
r6040_rx_ring equ ((r6040_tx_ring+(r6040_x_head.sizeof*TX_RING_SIZE)+32) and 0xfffffff0)
virtual at ((r6040_rx_ring+(r6040_x_head.sizeof*RX_RING_SIZE)+32) and 0xfffffff0)
r6040_private:
.rx_ring dd ?
.tx_ring dd ?
.cur_rx dw ?
.cur_tx dw ?
.phy_addr dw ?
.phy_mode dw ?
.mcr0 dw ?
.mcr1 dw ?
.switch_sig dw ?
end virtual
virtual at 0
r6040_x_head:
.status dw ? ;0-1
.len dw ? ;2-3
.buf dd ? ;4-7
.ndesc dd ? ;8-B
.rev1 dd ? ;C-F
.vbufp dd ? ;10-13
.vndescp dd ? ;14-17
.skb_ptr dd ? ;18-1B
.rev2 dd ? ;1C-1F
.sizeof:
end virtual
; Read a word data from PHY Chip
proc r6040_phy_read stdcall, phy_addr:dword, reg:dword
push ecx edx
mov eax, [phy_addr]
shl eax, 8
add eax, [reg]
add eax, MDIO_READ
mov edx, [io_addr]
add edx, MMDIO
out dx, ax
;Wait for the read bit to be cleared.
mov ecx, 2048 ;limit
xor eax, eax
.read:
in ax, dx
test ax, MDIO_READ
jz @f
dec ecx
test ecx, ecx
jnz .read
@@:
mov edx, [io_addr]
add edx, MMRD
in ax, dx
and eax, 0xFFFF
pop edx ecx
ret
endp
; Write a word data to PHY Chip
proc r6040_phy_write stdcall, phy_addr:dword, reg:dword, val:dword
push eax ecx edx
mov eax, [val]
mov edx, [io_addr]
add edx, MMWD
out dx, ax
;Write the command to the MDIO bus
mov eax, [phy_addr]
shl eax, 8
add eax, [reg]
add eax, MDIO_WRITE
mov edx, [io_addr]
add edx, MMDIO
out dx, ax
;Wait for the write bit to be cleared.
mov ecx, 2048 ;limit
xor eax, eax
.write:
in ax, dx
test ax, MDIO_WRITE
jz @f
dec ecx
test ecx, ecx
jnz .write
@@:
pop edx ecx eax
ret
endp
macro r6040_mdio_write reg, val {
stdcall r6040_phy_read, [io_addr], [r6040_private.phy_addr], reg
}
macro r6040_mdio_write reg, val {
stdcall r6040_phy_write, [io_addr], [r6040_private.phy_addr], reg, val
}
proc r6040_init_ring_desc stdcall, desc_ring:dword, size:dword
push eax ecx esi
mov ecx, [size]
test ecx, ecx
jz .out
mov esi, [desc_ring]
mov eax, esi
.next_desc:
add eax, r6040_x_head.sizeof - OS_BASE
mov [esi+r6040_x_head.ndesc], eax
add eax, OS_BASE
mov [esi+r6040_x_head.vndescp], eax
mov esi, eax
dec ecx
jnz .next_desc
sub esi, r6040_x_head.sizeof
mov eax, [desc_ring]
mov [esi+r6040_x_head.vndescp], eax
sub eax, OS_BASE
mov [esi+r6040_x_head.ndesc], eax
.out:
pop esi ecx eax
ret
endp
r6040_init_rxbufs:
stdcall r6040_init_ring_desc, r6040_rx_ring, RX_RING_SIZE
; Allocate skbs for the rx descriptors
mov esi, r6040_rx_ring
mov ebx, r6040_rxb
mov ecx, RX_RING_SIZE
mov eax, r6040_rx_ring
.next_desc:
mov [esi+r6040_x_head.skb_ptr], ebx
mov [esi+r6040_x_head.buf], ebx
sub [esi+r6040_x_head.buf], OS_BASE
mov [esi+r6040_x_head.status], DSC_OWNER_MAC
mov eax, [esi+r6040_x_head.vndescp]
mov esi, eax
add ebx, MAX_BUF_SIZE
dec ecx
jnz .next_desc
xor eax, eax
.out:
ret
r6040_probe:
DEBUGF 1, "Probing r6040\n"
call adjust_pci_device
; If PHY status change register is still set to zero
; it means the bootloader didn't initialize it
mov edx, [io_addr]
add edx, PHY_CC
in ax, dx
test ax, ax
jnz @f
mov eax, 0x9F07
out dx, ax
@@:
; Set MAC address
mov ecx, 3
mov edi, node_addr
mov edx, [io_addr]
add edx, MID_0L
.mac:
in ax, dx
stosw
add edx, 2
dec ecx
jnz .mac
; Some bootloaders/BIOSes do not initialize
; MAC address, warn about that
and eax, 0xFF
or eax, [node_addr]
test eax, eax
jnz @f
DEBUGF 1, "K : MAC address not initialized\n" ;, generating random"
;Asper: Add here generate function call!
; Temporary workaround: init by constant adress
mov dword [node_addr], 0x00006000
mov word [node_addr+4], 0x0001
@@:
; Init RDC private data
mov [r6040_private.mcr0], 0x1002
;mov [r6040_private.phy_addr], 1 ; Asper: Only one network card is supported now.
mov [r6040_private.switch_sig], 0
; Check the vendor ID on the PHY, if 0xFFFF assume none attached
stdcall r6040_phy_read, 1, 2
cmp ax, 0xFFFF
jne @f
DEBUGF 1, "K : Failed to detect an attached PHY\n" ;, generating random"
mov eax, -1
ret
@@:
; Set MAC address
call r6040_mac_address
; Initialize and alloc RX/TX buffers
stdcall r6040_init_ring_desc, r6040_tx_ring, TX_RING_SIZE
call r6040_init_rxbufs ;r6040_alloc_rxbufs
test eax, eax
jnz .out
; Read the PHY ID
mov [r6040_private.phy_mode], 0x8000
stdcall r6040_phy_read, 0, 2
mov [r6040_private.switch_sig], ax
cmp ax, ICPLUS_PHY_ID
jne @f
stdcall r6040_phy_write, 29, 31, 0x175C ; Enable registers
jmp .phy_readen
@@:
; PHY Mode Check
movzx eax, [r6040_private.phy_addr]
stdcall r6040_phy_write, eax, 4, PHY_CAP
stdcall r6040_phy_write, eax, 0, PHY_MODE
; if PHY_MODE = 0x3100
call r6040_phy_mode_chk
mov [r6040_private.phy_mode], ax
jmp .phy_readen
; end if
; if not (PHY_MODE and 0x0100)
mov [r6040_private.phy_mode], 0
; end if
.phy_readen:
; Set duplex mode
mov ax, [r6040_private.phy_mode]
or [r6040_private.mcr0], ax
; improve performance (by RDC guys)
stdcall r6040_phy_read, 30, 17
or ax, 0x4000
stdcall r6040_phy_write, 30, 17, eax
stdcall r6040_phy_read, 30, 17
xor ax, -1
or ax, 0x2000
xor ax, -1
stdcall r6040_phy_write, 30, 17, eax
stdcall r6040_phy_write, 0, 19, 0x0000
stdcall r6040_phy_write, 0, 30, 0x01F0
; Initialize all Mac registers
call r6040_reset
xor eax, eax
.out:
ret
align 4
r6040_reset:
DEBUGF 1, "Resetting r6040\n"
push eax ecx edx
; Mask off Interrupt
mov eax, MSK_INT
mov edx, [io_addr]
add edx, MIER
out dx, ax
;Reset RDC MAC
mov eax, MAC_RST
mov edx, [io_addr]
add edx, MCR1
out dx, ax
mov ecx, 2048 ;limit
.read:
in ax, dx
test ax, 0x1
jnz @f
dec ecx
test ecx, ecx
jnz .read
@@:
;Reset internal state machine
mov ax, 2
mov edx, [io_addr]
add edx, MAC_SM
out dx, ax
xor ax, ax
out dx, ax
mov esi, 5
call delay_ms
;MAC Bus Control Register
mov ax, MBCR_DEFAULT
mov edx, [io_addr]
add edx, MBCR
out dx, ax
;Buffer Size Register
mov ax, MAX_BUF_SIZE
mov edx, [io_addr]
add edx, MR_BSR
out dx, ax
;Write TX ring start address
mov eax, r6040_tx_ring - OS_BASE ;Asper: Maybe we can just write dword? Hidnplayr: better use word, as described in datasheet.
mov edx, [io_addr]
add edx, MTD_SA0
out dx, ax
shr eax, 16
add edx, MTD_SA1 - MTD_SA0
out dx, ax
;Write RX ring start address
mov eax, r6040_rx_ring - OS_BASE ;Asper: Maybe we can just write dword?
mov edx, [io_addr]
add edx, MRD_SA0
out dx, ax
shr eax, 16
add edx, MRD_SA1 - MRD_SA0
out dx, ax
;Set interrupt waiting time and packet numbers
xor ax, ax
mov edx, [io_addr]
add edx, MT_ICR
out dx, ax
;Asper: ~ Disable ints ;Enable interrupts
;mov ax, MSK_INT ;INT_MASK ;Asper ~
;mov edx, [io_addr]
;add edx, MIER
;out dx, ax
;Enable TX and RX
mov ax, [r6040_private.mcr0]
or ax, 0x0002
mov edx, [io_addr]
out dx, ax
;Let TX poll the descriptors
;we may got called by r6040_tx_timeout which has left
;some unset tx buffers
xor ax, ax
inc ax
mov edx, [io_addr]
add edx, MTPR
out dx, ax
pop edx ecx eax
DEBUGF 1, "reset ok!\n"
; Indicate that we have successfully reset the card
mov eax, [pci_data]
mov [eth_status], eax
ret
proc r6040_tx_timeout
push eax edx
;...
inc [stats.tx_errors]
;Reset MAC and re-init all registers
call r6040_init_mac_regs
pop edx eax
ret
endp
proc r6040_get_stats
push eax edx
mov edx, [io_addr]
add edx, ME_CNT1
in al, dx
add [stats.rx_crc_errors], al
mov edx, [io_addr]
add edx, ME_CNT0
in al, dx
add [stats.multicast], al
pop edx eax
ret
endp
;...
proc r6040_phy_mode_chk
push ebx
;PHY Link Status Check
movzx eax, [r6040_private.phy_addr]
stdcall r6040_phy_read, eax, 1
test eax, 0x4
jnz @f
mov eax, 0x8000 ;Link Failed, full duplex
@@:
;PHY Chip Auto-Negotiation Status
movzx eax, [r6040_private.phy_addr]
stdcall r6040_phy_read, eax, 1
test eax, 0x0020
jz .force_mode
;Auto Negotuiation Mode
movzx eax, [r6040_private.phy_addr]
stdcall r6040_phy_read, eax, 5
mov ebx, eax
movzx eax, [r6040_private.phy_addr]
stdcall r6040_phy_read, eax, 4
and eax, ebx
test eax, 0x140
jz .ret_0
jmp .ret_0x8000
.force_mode:
;Force Mode
movzx eax, [r6040_private.phy_addr]
stdcall r6040_phy_read, eax, 0
test eax, 0x100
jz .ret_0
.ret_0x8000:
mov eax, 0x8000
pop ebx
ret
.ret_0:
xor eax, eax
pop ebx
ret
endp
;***************************************************************************
; Function
; r6040_rx
; Description
; polls card to see if there is a packet waiting
;
; Currently only supports one descriptor per packet, if packet is fragmented
; between multiple descriptors you will lose part of the packet
;***************************************************************************
r6040_poll:
push ebx ecx esi edi
xor eax, eax
mov [eth_rx_data_len], ax
movzx eax, [r6040_private.cur_rx]
mov ebx, eax
shl ebx, 5
mov cx, [ebx+r6040_rx_ring+r6040_x_head.status] ; Read the descriptor status
test cx, DSC_OWNER_MAC
jnz .out
test cx, DSC_RX_ERR ; Global error status set
jz .no_dsc_rx_err
;...
jmp .out
.no_dsc_rx_err:
; Packet successfully received
movzx ecx, [ebx+r6040_rx_ring+r6040_x_head.len]
and ecx, 0xFFF
sub ecx, 4 ; Do not count the CRC
mov [eth_rx_data_len], cx
mov esi, [ebx+r6040_rx_ring+r6040_x_head.skb_ptr]
push ecx
shr ecx, 2
mov edi, Ether_buffer
cld
rep movsd
pop ecx
and ecx, 3
rep movsb
or [ebx+r6040_rx_ring+r6040_x_head.status], DSC_OWNER_MAC
inc [r6040_private.cur_rx]
and [r6040_private.cur_rx], RX_RING_SIZE-1
xor eax, eax
.out:
pop edi esi ecx ebx
ret
;***************************************************************************
; Function
; r6040_transmit
; Description
; Transmits a packet of data via the ethernet card
; Pointer to 48 bit destination address in edi
; Type of packet in bx
; size of packet in ecx
; pointer to packet data in esi
;
;***************************************************************************
r6040_transmit:
cmp ecx, MAX_BUF_SIZE
jg .out ; packet is too long
push edi esi ebx ecx
movzx eax, [r6040_private.cur_tx]
shl eax, 5
; DEBUGF 1,"R6040: TX buffer status: 0x%x, eax=%u\n", [eax + r6040_tx_ring + r6040_x_head.status]:4, eax
test [r6040_tx_ring + eax + r6040_x_head.status], 0x8000 ; check if buffer is available
jz .l3
push ecx esi
mov ecx, [timer_ticks]
add ecx, 100
.l2:
test [r6040_tx_ring + eax + r6040_x_head.status], 0x8000
jz .l5
cmp ecx, [timer_ticks]
jb .l4
mov esi, 10
call delay_ms
jmp .l2
.l4:
pop esi ecx
DEBUGF 1,"R6040: Send timeout\n"
jmp .out
.l5:
pop esi ecx
.l3:
push eax
mov esi, edi
; point to the current tx buffer
movzx edi, [r6040_private.cur_tx]
imul edi, MAX_BUF_SIZE
add edi, r6040_txb
lea eax, [edi - OS_BASE] ; real buffer address in eax
; copy destination address
movsd
movsw
; copy source address
mov esi, node_addr
movsd
movsw
; copy packet type
mov [edi], bx
add edi, 2
mov esi, [esp+8+4]
mov ecx, [esp+4]
; copy the packet data
push ecx
shr ecx,2
rep movsd
pop ecx
and ecx,3
rep movsb
pop edi
mov ecx, [esp]
add ecx, ETH_HLEN
cmp cx, ETH_ZLEN
jae @f
mov cx, ETH_ZLEN
@@:
mov [r6040_tx_ring + edi + r6040_x_head.len], cx
mov [r6040_tx_ring + edi + r6040_x_head.buf], eax
mov [r6040_tx_ring + edi + r6040_x_head.status], 0x8000
; Trigger the MAC to check the TX descriptor
mov ax, 0x01
mov edx, [io_addr]
add edx, MTPR
out dx, ax
inc [r6040_private.cur_tx]
and [r6040_private.cur_tx], TX_RING_SIZE-1
xor eax, eax
pop ecx ebx esi edi
.out:
ret
r6040_mac_address:
push eax ecx edx esi edi
; MAC operation register
mov ax, 1
mov edx, [io_addr]
add edx, MCR1
out dx, ax
; Reset MAC
mov ax, 2
mov edx, [io_addr]
add edx, MAC_SM
out dx, ax
; Reset internal state machine
xor ax, ax
out dx, ax
mov esi, 5
call delay_ms
; Restore MAC Address
mov ecx, 3
mov edi, node_addr
mov edx, [io_addr]
add edx, MID_0L
.mac:
in ax, dx
stosw
add edx, 2
dec ecx
jnz .mac
pop edi esi edx ecx eax
ret

View File

@ -323,14 +323,14 @@ rtl8139_reset:
out dx, al
; 32k Rxbuffer, unlimited dma burst, no wrapping, no rx threshold
; accept broadcast packets, accept physical match packets
mov ax, RTL8139_RX_CONFIG
mov eax, RTL8139_RX_CONFIG
add edx, RTL8139_REG_RXCONFIG - RTL8139_REG_COMMAND
out dx, ax
out dx, eax
; 1024 bytes DMA burst, total retries = 16 + 8 * 16 = 144
mov ax, (RTL8139_TX_MXDMA shl RTL8139_BIT_TX_MXDMA) \
mov eax, (RTL8139_TX_MXDMA shl RTL8139_BIT_TX_MXDMA) \
or (RTL8139_TXRR shl RTL8139_BIT_TXRR)
add edx, RTL8139_REG_TXCONFIG - RTL8139_REG_RXCONFIG
out dx, ax
out dx, eax
; enable auto negotiation
add edx, RTL8139_REG_BMCR - RTL8139_REG_TXCONFIG
in ax, dx

View File

@ -49,7 +49,7 @@ struc ETH_FRAME
.SrcMAC dp ? ;source MAC-address [6 bytes]
.Type dw ? ;type of the upper-layer protocol [2 bytes]
.Data db ? ;data [46-1500 bytes]
}
}
virtual at Ether_buffer
ETH_FRAME ETH_FRAME
@ -103,6 +103,7 @@ include "drivers/sis900.inc"
include "drivers/pcnet32.inc"
include "drivers/rtl8169.inc"
include "drivers/forcedeth.inc"
include "drivers/r6040.inc"
; PCICards
; ========
@ -128,25 +129,25 @@ dd 0x24498086, 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 ; tested by hidnplayr: works ok
dd 0x813810ec, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable
dd 0x12111113, rtl8139_probe, rtl8139_reset, rtl8139_poll, rtl8139_transmit, rtl8139_cable ; tested by hidnplayr: works ok
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
@ -188,58 +189,54 @@ dd 0x656410b7, e3c59x_probe, e3c59x_reset, e3c59x_poll, e3c59x_transmit, 0
dd 0x450010b7, e3c59x_probe, e3c59x_reset, e3c59x_poll, e3c59x_transmit, 0
dd 0x09001039, SIS900_probe, SIS900_reset, SIS900_poll, SIS900_transmit, 0
dd 0x70161039, SIS900_probe, SIS900_reset, SIS900_poll, SIS900_transmit, 0
dd 0x20001022, pcnet32_probe, pcnet32_reset, pcnet32_poll, pcnet32_xmit, 0
dd 0x26251022, pcnet32_probe, pcnet32_reset, pcnet32_poll, pcnet32_xmit, 0
dd 0x20011022, pcnet32_probe, pcnet32_reset, pcnet32_poll, pcnet32_xmit, 0
;dd 0x08031516, mtd80x_probe, mtd80x_reset, mtd80x_poll, mtd80x_transmit, mtd80x_cable
dd 0x006610de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; nVidia Corporation nForce2 Ethernet Controller
dd 0x01c310de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x00D610de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x008610de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x008c10de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x00e610de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x00df10de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x005610de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x005710de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x003710de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x003810de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x026810de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x026910de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x037210de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x037310de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x03e510de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x03e610de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x03ee10de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x03ef10de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x045010de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x045110de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x045210de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x045310de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x054c10de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x054d10de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x054e10de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x054f10de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x07dc10de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x07dd10de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x07de10de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x07df10de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x076010de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; MCP77 Ethernet Controller
dd 0x076110de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x076210de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x076310de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x0ab010de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x0ab110de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x0ab210de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x0ab310de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x0d7d10de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
; following cards are untested
dd 0x70161039, SIS900_probe, SIS900_reset, SIS900_poll, SIS900_transmit, 0
;dd 0x08001516, mtd80x_probe, mtd80x_reset, mtd80x_poll, mtd80x_transmit, mtd80x_cable
;dd 0x08911516, mtd80x_probe, mtd80x_reset, mtd80x_poll, mtd80x_transmit, mtd80x_cable
dd 0x006610de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; nVidia Corporation nForce2 Ethernet Controller
dd 0x01c310de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x00D610de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x008610de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x008c10de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x00e610de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x00df10de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x005610de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x005710de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x003710de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x003810de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x026810de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x026910de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x037210de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x037310de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x03e510de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x03e610de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x03ee10de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x03ef10de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x045010de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x045110de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x045210de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x045310de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x054c10de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x054d10de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x054e10de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x054f10de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x07dc10de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x07dd10de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x07de10de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x07df10de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x076010de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; MCP77 Ethernet Controller
dd 0x076110de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x076210de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x076310de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x0ab010de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x0ab110de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x0ab210de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x0ab310de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x0d7d10de, forcedeth_probe, forcedeth_reset, forcedeth_poll, forcedeth_transmit, forcedeth_cable ; not tested
dd 0x604017F3, r6040_probe, r6040_reset, r6040_poll, r6040_transmit, 0
rb PCICARDS_ENTRY_SIZE ; end of list marker, do not remove
endg

View File

@ -0,0 +1,444 @@
struc BLITTER
{
.dc.xmin rd 1 ; 0
.dc.ymin rd 1 ; 4
.dc.xmax rd 1 ; 8
.dc.ymax rd 1 ; 12
.sc:
.sc.xmin rd 1 ; 16
.sc.ymin rd 1 ; 20
.sc.xmax rd 1 ; 24
.sc.ymax rd 1 ; 28
.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:
push ebx
mov ebx, 8
cmp edx, [eax]
jl .L2
xor ebx, ebx
cmp edx, [eax+8]
setg bl
sal ebx, 2
.L2:
cmp ecx, [eax+4]
jge .L3
or ebx, 1
jmp .L4
.L3:
cmp ecx, [eax+12]
jle .L4
or ebx, 2
.L4:
mov eax, ebx
pop ebx
ret
align 4
block_clip:
push ebp
push edi
push esi
push ebx
sub esp, 4
mov ebx, eax
mov [esp], edx
mov ebp, ecx
mov ecx, [ecx]
mov edx, [edx]
call __L1OutCode
mov esi, eax
mov edx, [esp+28]
mov ecx, [edx]
.L21:
mov eax, [esp+24]
mov edx, [eax]
mov eax, ebx
call __L1OutCode
mov edi, eax
.L20:
mov eax, edi
and eax, esi
jne .L9
cmp esi, edi
je .L9
test esi, esi
jne .L10
test edi, 1
je .L11
mov eax, [ebx+4]
jmp .L25
.L11:
test edi, 2
je .L13
mov eax, [ebx+12]
.L25:
mov edx, [esp+28]
jmp .L22
.L13:
test edi, 4
je .L14
mov eax, [ebx+8]
jmp .L26
.L14:
and edi, 8
je .L12
mov eax, [ebx]
.L26:
mov edx, [esp+24]
.L22:
mov [edx], eax
.L12:
mov eax, [esp+28]
mov ecx, [eax]
jmp .L21
.L10:
test esi, 1
je .L16
mov eax, [ebx+4]
jmp .L23
.L16:
test esi, 2
je .L18
mov eax, [ebx+12]
.L23:
mov [ebp+0], eax
jmp .L17
.L18:
test esi, 4
je .L19
mov eax, [ebx+8]
jmp .L24
.L19:
and esi, 8
je .L17
mov eax, [ebx]
.L24:
mov edx, [esp]
mov [edx], eax
.L17:
mov ecx, [ebp+0]
mov eax, [esp]
mov edx, [eax]
mov eax, ebx
call __L1OutCode
mov esi, eax
jmp .L20
.L9:
add esp, 4
pop ebx
pop esi
pop edi
pop ebp
ret
align 4
blit_clip:
.sx0 equ 36
.sy0 equ 32
.sx1 equ 28
.sy1 equ 24
.dx0 equ 20
.dy0 equ 16
.dx1 equ 12
.dy1 equ 8
push edi
push esi
push ebx
sub esp, 40
mov ebx, ecx
mov edx, [ecx+BLITTER.src_x]
mov [esp+.sx0], edx
mov eax, [ecx+BLITTER.src_y]
mov [esp+.sy0], eax
add edx, [ecx+BLITTER.w]
dec edx
mov [esp+.sx1], edx
add eax, [ecx+BLITTER.h]
dec eax
mov [esp+.sy1], eax
lea ecx, [esp+.sy0]
lea edx, [esp+.sx0]
lea eax, [ebx+BLITTER.sc]
lea esi, [esp+.sy1]
mov [esp+4], esi
lea esi, [esp+.sx1]
mov [esp], esi
call block_clip
mov esi, 1
test eax, eax
jne .L28
mov edi, [esp+.sx0]
mov edx, [ebx+BLITTER.dst_x]
add edx, edi
sub edx, [ebx+BLITTER.src_x]
mov [esp+.dx0], edx
mov ecx, [esp+.sy0]
mov eax, [ebx+BLITTER.dst_y]
add eax, ecx
sub eax, [ebx+BLITTER.src_y]
mov [esp+.dy0], eax
sub edx, edi
add edx, [esp+.sx1]
mov [esp+.dx1], edx
sub eax, ecx
add eax, [esp+.sy1]
mov [esp+.dy1], eax
lea ecx, [esp+.dy0]
lea edx, [esp+.dx0]
lea eax, [esp+.dy1]
mov [esp+4], eax
lea eax, [esp+.dx1]
mov [esp], eax
mov eax, ebx
call block_clip
test eax, eax
jne .L28
mov edx, [esp+.dx0]
mov eax, [esp+.dx1]
inc eax
sub eax, edx
mov [ebx+BLITTER.w], eax
mov eax, [esp+.dy0]
mov ecx, [esp+.dy1]
inc ecx
sub ecx, eax
mov [ebx+BLITTER.h], ecx
mov ecx, [ebx+BLITTER.src_x]
add ecx, edx
sub ecx, [ebx+BLITTER.dst_x]
mov [ebx+BLITTER.src_x], ecx
mov ecx, [ebx+BLITTER.src_y]
add ecx, eax
sub ecx, [ebx+BLITTER.dst_y]
mov [ebx+BLITTER.src_y], ecx
mov [ebx+BLITTER.dst_x], edx
mov [ebx+BLITTER.dst_y], eax
xor esi, esi
.L28:
mov eax, esi
add esp, 40
pop ebx
pop esi
pop edi
purge .sx0
purge .sy0
purge .sx1
purge .sy1
purge .dx0
purge .dy0
purge .dx1
purge .dy1
ret
align 4
blit_32:
push ebp
push edi
push esi
push ebx
sub esp, 72
mov eax, [TASK_BASE]
mov ebx, [eax-twdw + WDATA.box.width]
mov edx, [eax-twdw + WDATA.box.height]
xor eax, eax
mov [esp+BLITTER.dc.xmin], eax
mov [esp+BLITTER.dc.ymin], eax
mov [esp+BLITTER.dc.xmax], ebx
mov [esp+BLITTER.dc.ymax], edx
mov [esp+BLITTER.sc.xmin], eax
mov [esp+BLITTER.sc.ymin], eax
mov eax, [ecx+24]
dec eax
mov [esp+BLITTER.sc.xmax], eax
mov eax, [ecx+28]
dec eax
mov [esp+BLITTER.sc.ymax], eax
mov eax, [ecx]
mov [esp+BLITTER.dst_x], eax
mov eax, [ecx+4]
mov [esp+BLITTER.dst_y], eax
mov eax, [ecx+16]
mov [esp+BLITTER.src_x], eax
mov eax, [ecx+20]
mov [esp+BLITTER.src_y], eax
mov eax, [ecx+8]
mov [esp+BLITTER.w], eax
mov eax, [ecx+12]
mov [esp+BLITTER.h], eax
mov eax, [ecx+32]
mov [esp+56], eax
mov eax, [ecx+36]
mov [esp+60], eax
mov ecx, esp
call blit_clip
test eax, eax
jne .L57
inc [mouse_pause]
call [_display.disable_mouse]
mov eax, [TASK_BASE]
mov ebx, [esp+BLITTER.dst_x]
mov ebp, [esp+BLITTER.dst_y]
add ebx, [eax-twdw + WDATA.box.left]
add ebp, [eax-twdw + WDATA.box.top]
mov edi, ebp
imul edi, [_display.pitch]
imul ebp, [_display.width]
add ebp, ebx
add ebp, [_WinMapAddress]
mov eax, [esp+BLITTER.src_y]
imul eax, [esp+BLITTER.stride]
mov esi, [esp+BLITTER.src_x]
lea esi, [eax+esi*4]
add esi, [esp+BLITTER.bitmap]
mov ecx, [esp+BLITTER.h]
mov edx, [esp+BLITTER.w]
test ecx, ecx ;FIXME check clipping
jz .L57
test edx, edx
jz .L57
cmp [_display.bpp], 32
jne .core_24
lea edi, [edi+ebx*4]
mov ebx, [CURRENT_TASK]
align 4
.outer32:
xor ecx, ecx
align 4
.inner32:
cmp [ebp+ecx], bl
jne @F
mov eax, [esi+ecx*4]
mov [LFB_BASE+edi+ecx*4], eax
@@:
inc ecx
dec edx
jnz .inner32
add esi, [esp+BLITTER.stride]
add edi, [_display.pitch]
add ebp, [_display.width]
mov edx, [esp+BLITTER.w]
dec [esp+BLITTER.h]
jnz .outer32
.done:
dec [mouse_pause]
call [draw_pointer]
.L57:
add esp, 72
pop ebx
pop esi
pop edi
pop ebp
ret
.core_24:
lea ebx, [ebx+ebx*2]
lea edi, [LFB_BASE+edi+ebx]
mov ebx, [CURRENT_TASK]
align 4
.outer24:
mov [esp+64], edi
xor ecx, ecx
align 4
.inner24:
cmp [ebp+ecx], bl
jne @F
mov eax, [esi+ecx*4]
lea edi, [edi+ecx*2]
mov [edi+ecx], ax
shr eax, 16
mov [edi+ecx+2], al
@@:
mov edi, [esp+64]
inc ecx
dec edx
jnz .inner24
add esi, [esp+BLITTER.stride]
add edi, [_display.pitch]
add ebp, [_display.width]
mov edx, [esp+BLITTER.w]
dec [esp+BLITTER.h]
jnz .outer24
jmp .done