enumerate CPU's and start AP.

git-svn-id: svn://kolibrios.org@2439 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2012-03-09 08:20:02 +00:00
parent 4832ce7a33
commit 3e6513d51d
11 changed files with 1187 additions and 575 deletions

View File

@ -189,6 +189,7 @@ TASK_BASE equ (OS_BASE+0x0003010)
TASK_DATA equ (OS_BASE+0x0003020) TASK_DATA equ (OS_BASE+0x0003020)
TASK_EVENT equ (OS_BASE+0x0003020) TASK_EVENT equ (OS_BASE+0x0003020)
d_width_calc_area equ (OS_BASE+0x0005000)
mouseunder equ (OS_BASE+0x0006900) mouseunder equ (OS_BASE+0x0006900)
CDDataBuf equ (OS_BASE+0x0007000) CDDataBuf equ (OS_BASE+0x0007000)
FLOPPY_BUFF equ (OS_BASE+0x0008000) FLOPPY_BUFF equ (OS_BASE+0x0008000)

View File

@ -41,7 +41,8 @@ IOAPIC_VER equ 0x1
IOAPIC_ARB equ 0x2 IOAPIC_ARB equ 0x2
IOAPIC_REDTBL equ 0x10 IOAPIC_REDTBL equ 0x10
IPI_INIT equ (0x6 shl 8) IPI_INIT equ (0x5 shl 8)
IPI_START equ (0x6 shl 8)
IPI_LEVEL_ASSERT equ (0x1 shl 14) IPI_LEVEL_ASSERT equ (0x1 shl 14)
SHORTHAND_ALL_EXCL equ (0x3 shl 18) SHORTHAND_ALL_EXCL equ (0x3 shl 18)
@ -72,11 +73,11 @@ APIC_init:
stdcall map_io_mem, [acpi_ioapic_base], 0x20, PG_SW stdcall map_io_mem, [acpi_ioapic_base], 0x20, PG_SW
mov [IOAPIC_base], eax mov [IOAPIC_base], eax
mov eax, IOAPIC_VER mov eax, IOAPIC_VER
call IOAPIC_read call IOAPIC_read
shr eax, 16 shr eax, 16
inc al inc al
movzx eax, al movzx eax, al
cmp al, IRQ_RESERVED cmp al, IRQ_RESERVED
jbe @f jbe @f
@ -129,15 +130,9 @@ APIC_init:
;=========================================================== ;===========================================================
align 4 align 4
LAPIC_init: LAPIC_init:
; Check MSR support
;....
; Get LAPIC base address
;mov ecx, 0x1b
;rdmsr ; it may be replaced to
;and ax, 0xf000 ; mov eax, 0xfee00000
mov [acpi_lapic_base], 0xfee00000 cmp [LAPIC_BASE], 0
; xchg bx, bx jne .done
stdcall map_io_mem, [acpi_lapic_base], 0x1000, PG_SW stdcall map_io_mem, [acpi_lapic_base], 0x1000, PG_SW
mov [LAPIC_BASE], eax mov [LAPIC_BASE], eax
@ -211,32 +206,8 @@ LAPIC_init:
; Start (every 0.01 sec) ; Start (every 0.01 sec)
; mov dword[esi + APIC_LVT_timer], 0x30020; periodic int 0x20 ; mov dword[esi + APIC_LVT_timer], 0x30020; periodic int 0x20
; mov dword[esi + APIC_timer_init], eax ; mov dword[esi + APIC_timer_init], eax
xchg bx, bx
; mov al, 0x0F
; out 0x70, al
; mov al, 0x0A
; out 0x71, al
; mov [OS_BASE+0x469], word (__ap_start_16) shr 4
; mov [OS_BASE+0x469], word 0
mov [esi+APIC_ICRH], dword 0
mov [esi+APIC_ICRL], dword 0xc4500
mov ecx, 1000
@@:
loop @B
mov [esi+APIC_ICRH], dword 0
mov [esi+APIC_ICRL], dword 0xC4600+((0x10000+__ap_start_16) shr 12)
; mov [esi+APIC_ICRL], dword 0xC4612
; mov [esi+APIC_ICRH], dword 0
; mov [esi+APIC_ICRL], dword CMD_IPI_INIT+IPI_LEVEL_ASSERT+16
.done:
ret ret
;=========================================================== ;===========================================================
@ -245,11 +216,11 @@ align 4
IOAPIC_read: IOAPIC_read:
; in : EAX - IOAPIC register ; in : EAX - IOAPIC register
; out: EAX - readed value ; out: EAX - readed value
push esi push esi
mov esi, [IOAPIC_base] mov esi, [IOAPIC_base]
mov [esi], eax mov [esi], eax
mov eax, [esi + 0x10] mov eax, [esi + 0x10]
pop esi pop esi
ret ret
align 4 align 4
@ -257,11 +228,11 @@ IOAPIC_write:
; in : EAX - IOAPIC register ; in : EAX - IOAPIC register
; EBX - value ; EBX - value
; out: none ; out: none
push esi push esi
mov esi, [IOAPIC_base] mov esi, [IOAPIC_base]
mov [esi], eax mov [esi], eax
mov [esi + 0x10], ebx mov [esi + 0x10], ebx
pop esi pop esi
ret ret
;=========================================================== ;===========================================================
; Remap all IRQ to 0x20+ Vectors ; Remap all IRQ to 0x20+ Vectors
@ -287,7 +258,7 @@ PIC_init:
out 0x21, al out 0x21, al
out 0xA1, al out 0xA1, al
call IRQ_mask_all call IRQ_mask_all
; mov dword[irq_type_to_set], IRQ_TYPE_PIC ; mov dword[irq_type_to_set], IRQ_TYPE_PIC
ret ret
@ -306,8 +277,8 @@ PIT_init:
; ----------------------------------------- ; -----------------------------------------
align 4 align 4
unmask_timer: unmask_timer:
cmp [irq_mode], IRQ_APIC cmp [irq_mode], IRQ_APIC
je @f je @f
stdcall enable_irq, 0 stdcall enable_irq, 0
ret ret
@ -326,36 +297,36 @@ unmask_timer:
; ret ; ret
; use LAPIC timer ; use LAPIC timer
mov esi, [LAPIC_BASE] mov esi, [LAPIC_BASE]
mov eax, [esi + APIC_LVT_timer] mov eax, [esi + APIC_LVT_timer]
and eax, 0xfffeffff and eax, 0xfffeffff
mov [esi + APIC_LVT_timer], eax mov [esi + APIC_LVT_timer], eax
ret ret
; ----------------------------------------- ; -----------------------------------------
; Disable all IRQ ; Disable all IRQ
align 4 align 4
IRQ_mask_all: IRQ_mask_all:
cmp [irq_mode], IRQ_APIC cmp [irq_mode], IRQ_APIC
je .APIC je .APIC
mov al, 0xFF mov al, 0xFF
out 0x21, al out 0x21, al
out 0xA1, al out 0xA1, al
mov ecx, 0x1000 mov ecx, 0x1000
ret ret
.APIC: .APIC:
mov ecx, [IRQ_COUNT] mov ecx, [IRQ_COUNT]
mov eax, 0x10 mov eax, 0x10
@@: @@:
mov ebx, eax mov ebx, eax
call IOAPIC_read call IOAPIC_read
or eax, 0x10000; bit 16 or eax, 0x10000; bit 16
xchg eax, ebx xchg eax, ebx
call IOAPIC_write call IOAPIC_write
inc eax inc eax
inc eax inc eax
loop @b loop @b
ret ret
; ----------------------------------------- ; -----------------------------------------
@ -363,19 +334,19 @@ IRQ_mask_all:
; cl - IRQ number ; cl - IRQ number
align 4 align 4
irq_eoi: ; __fastcall irq_eoi: ; __fastcall
cmp [irq_mode], IRQ_APIC cmp [irq_mode], IRQ_APIC
je .APIC je .APIC
cmp cl, 8 cmp cl, 8
mov al, 0x20 mov al, 0x20
jb @f jb @f
out 0xa0, al out 0xa0, al
@@: @@:
out 0x20, al out 0x20, al
ret ret
.APIC: .APIC:
mov eax, [LAPIC_BASE] mov eax, [LAPIC_BASE]
mov dword [eax + APIC_EOI], 0; EOI mov dword [eax + APIC_EOI], 0; EOI
ret ret
@ -383,71 +354,99 @@ irq_eoi: ; __fastcall
; from dll.inc ; from dll.inc
align 4 align 4
proc enable_irq stdcall, irq_line:dword proc enable_irq stdcall, irq_line:dword
mov ebx, [irq_line] mov ebx, [irq_line]
cmp [irq_mode], IRQ_APIC cmp [irq_mode], IRQ_APIC
je .APIC je .APIC
mov edx, 0x21 mov edx, 0x21
cmp ebx, 8 cmp ebx, 8
jb @F jb @F
mov edx, 0xA1 mov edx, 0xA1
sub ebx, 8 sub ebx, 8
@@: @@:
in al, dx in al, dx
btr eax, ebx btr eax, ebx
out dx, al out dx, al
ret ret
.APIC: .APIC:
shl ebx, 1 shl ebx, 1
add ebx, 0x10 add ebx, 0x10
mov eax, ebx mov eax, ebx
call IOAPIC_read call IOAPIC_read
and eax, 0xfffeffff; bit 16 and eax, 0xfffeffff; bit 16
xchg eax, ebx xchg eax, ebx
call IOAPIC_write call IOAPIC_write
ret ret
endp endp
align 4 align 4
pci_irq_fixup: pci_irq_fixup:
push ebp push ebp
mov esi, [acpi_dev_data] mov esi, [acpi_dev_data]
mov ebx, [acpi_dev_size] mov ebx, [acpi_dev_size]
lea edi, [esi+ebx] lea edi, [esi+ebx]
.iterate: .iterate:
cmp esi, edi cmp esi, edi
jae .done jae .done
mov eax, [esi] mov eax, [esi]
cmp eax, -1 cmp eax, -1
je .done je .done
movzx ebx, al movzx ebx, al
movzx ebp, ah movzx ebp, ah
stdcall pci_read32, ebp, ebx, 0 stdcall pci_read32, ebp, ebx, 0
cmp eax, [esi+4] cmp eax, [esi+4]
jne .skip jne .skip
mov eax, [esi+8] mov eax, [esi+8]
stdcall pci_write8, ebp, ebx, 0x3C, eax stdcall pci_write8, ebp, ebx, 0x3C, eax
.skip: .skip:
add esi, 16 add esi, 16
jmp .iterate jmp .iterate
.done: .done:
.fail: .fail:
pop ebp pop ebp
ret ret
align 4
start_ap:
;eax= cpu id
; xchg bx, bx
test eax, eax ;do not start self
jz .exit
cmp eax, [cpu_count]
ja .exit
mov eax, [smpt+eax*4]
shl eax, 24
mov [esi+APIC_ICRH], eax
mov [esi+APIC_ICRL], dword (IPI_INIT+IPI_LEVEL_ASSERT)
mov ecx, 10000
@@:
loop @B
CMD_IPI_START equ (IPI_START+IPI_LEVEL_ASSERT)+((0x10000+__ap_start_16) shr 12)
mov [esi+APIC_ICRH], eax
mov [esi+APIC_ICRL], dword CMD_IPI_START
.exit:
ret

View File

@ -7,15 +7,14 @@
$Revision$ $Revision$
; // Alver 22.06.2008 // { ;------------------------------------------------------------------------------
align 4 align 4
dtext_asciiz_esi: ; for skins title out dtext_asciiz_esi: ; for skins title out
push eax push eax
xor eax, eax xor eax, eax
inc eax inc eax
jmp dtext.1 jmp dtext.1
; } \\ Alver \\ ;------------------------------------------------------------------------------
align 4 align 4
dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org]) dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
; ebx x & y ; ebx x & y
@ -26,12 +25,11 @@ dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
; B = 1 <=> fill background with color eax ; B = 1 <=> fill background with color eax
; edx start of text ; edx start of text
; edi 1 force ; edi 1 force
; // Alver 22.06.2008 // {
push eax push eax
xor eax, eax xor eax, eax
;--------------------------------------
align 4
.1: .1:
; } \\ Alver \\
pushad pushad
movsx eax, bx ; eax=y movsx eax, bx ; eax=y
sar ebx, 16 ; ebx=x sar ebx, 16 ; ebx=x
@ -39,21 +37,26 @@ dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
cmp esi, 255 cmp esi, 255
jb .loop jb .loop
mov esi, 255 mov esi, 255
;--------------------------------------
align 4
.loop: .loop:
test ecx, ecx test ecx, ecx
js .test_asciiz js .test_asciiz
dec esi dec esi
js .end js .end
jmp @f jmp @f
;--------------------------------------
align 4
.test_asciiz: .test_asciiz:
cmp byte [edx], 0 cmp byte [edx], 0
jz .end jz .end
; // Alver 22.06.2008 // {
cmp byte [esp+28], 1 cmp byte [esp+28], 1
jne @f jne @f
dec esi dec esi
js .end js .end
; } \\ Alver \\ ;--------------------------------------
align 4
@@: @@:
inc edx inc edx
pushad pushad
@ -62,9 +65,13 @@ dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
jnz .font2 jnz .font2
mov esi, 9 mov esi, 9
lea ebp, [FONT_I+8*edx+edx] lea ebp, [FONT_I+8*edx+edx]
;--------------------------------------
align 4
.symloop1: .symloop1:
mov dl, byte [ebp] mov dl, byte [ebp]
or dl, 1 shl 6 or dl, 1 shl 6
;--------------------------------------
align 4
.pixloop1: .pixloop1:
shr dl, 1 shr dl, 1
jz .pixloop1end jz .pixloop1end
@ -72,6 +79,8 @@ dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
call [putpixel] call [putpixel]
jmp .pixloop1cont jmp .pixloop1cont
;--------------------------------------
align 4
.nopix: .nopix:
test ecx, 0x40000000 test ecx, 0x40000000
jz .pixloop1cont jz .pixloop1cont
@ -80,9 +89,13 @@ dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
call [putpixel] call [putpixel]
pop ecx pop ecx
;--------------------------------------
align 4
.pixloop1cont: .pixloop1cont:
inc eax inc eax
jmp .pixloop1 jmp .pixloop1
;--------------------------------------
align 4
.pixloop1end: .pixloop1end:
sub eax, 6 sub eax, 6
inc ebx inc ebx
@ -92,20 +105,28 @@ dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
popad popad
add eax, 6 add eax, 6
jmp .loop jmp .loop
;--------------------------------------
align 4
.font2: .font2:
add edx, edx add edx, edx
lea ebp, [FONT_II+4*edx+edx+1] lea ebp, [FONT_II+4*edx+edx+1]
push 9 push 9
movzx esi, byte [ebp-1] movzx esi, byte [ebp-1]
;--------------------------------------
align 4
.symloop2: .symloop2:
mov dl, byte [ebp] mov dl, byte [ebp]
push esi push esi
;--------------------------------------
align 4
.pixloop2: .pixloop2:
shr dl, 1 shr dl, 1
jnc .nopix2 jnc .nopix2
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
call [putpixel] call [putpixel]
jmp .pixloop2cont jmp .pixloop2cont
;--------------------------------------
align 4
.nopix2: .nopix2:
test ecx, 0x40000000 test ecx, 0x40000000
jz .pixloop2cont jz .pixloop2cont
@ -114,6 +135,8 @@ dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area
call [putpixel] call [putpixel]
pop ecx pop ecx
;--------------------------------------
align 4
.pixloop2cont: .pixloop2cont:
inc eax inc eax
dec esi dec esi
@ -128,7 +151,10 @@ dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org])
add dword [esp+28], esi add dword [esp+28], esi
popad popad
jmp .loop jmp .loop
;--------------------------------------
align 4
.end: .end:
popad popad
pop eax ; << // Alver 22.06.2008 // << pop eax
ret ret
;------------------------------------------------------------------------------

View File

@ -11,7 +11,8 @@ $Revision$
include "skindata.inc" include "skindata.inc"
;skin_data = 0x00778000 ;skin_data = 0x00778000
;------------------------------------------------------------------------------
align 4
read_skin_file: read_skin_file:
stdcall load_file, ebx stdcall load_file, ebx
test eax, eax test eax, eax
@ -21,6 +22,8 @@ read_skin_file:
cmp ebx, 32*1024 cmp ebx, 32*1024
jb @f jb @f
mov ebx, 32*1024 mov ebx, 32*1024
;--------------------------------------
align 4
@@: @@:
lea ecx, [ebx+3] lea ecx, [ebx+3]
shr ecx, 2 shr ecx, 2
@ -32,16 +35,20 @@ read_skin_file:
call parse_skin_data call parse_skin_data
xor eax, eax xor eax, eax
ret ret
;--------------------------------------
align 4
.notfound: .notfound:
xor eax, eax xor eax, eax
inc eax inc eax
ret ret
;--------------------------------------
align 4
.noskin: .noskin:
stdcall kernel_free, eax stdcall kernel_free, eax
push 2 push 2
pop eax pop eax
ret ret
;------------------------------------------------------------------------------
struct SKIN_HEADER struct SKIN_HEADER
ident dd ? ident dd ?
version dd ? version dd ?
@ -81,13 +88,15 @@ struct SKIN_BITMAPS
type dw ? type dw ?
data dd ? data dd ?
ends ends
;------------------------------------------------------------------------------
align 4
load_default_skin: load_default_skin:
mov [_skinh], 22 mov [_skinh], 22
mov ebx, _skin_file_default mov ebx, _skin_file_default
call read_skin_file call read_skin_file
ret ret
;------------------------------------------------------------------------------
align 4
parse_skin_data: parse_skin_data:
mov ebp, skin_data mov ebp, skin_data
cmp [ebp+SKIN_HEADER.ident], 'SKIN' cmp [ebp+SKIN_HEADER.ident], 'SKIN'
@ -127,7 +136,9 @@ parse_skin_data:
mov ebx, [ebp+SKIN_HEADER.bitmaps] mov ebx, [ebp+SKIN_HEADER.bitmaps]
add ebx, skin_data add ebx, skin_data
.lp1: ;--------------------------------------
align 4
.lp1:
cmp dword[ebx], 0 cmp dword[ebx], 0
je .end_bitmaps je .end_bitmaps
movzx eax, [ebx+SKIN_BITMAPS.kind] movzx eax, [ebx+SKIN_BITMAPS.kind]
@ -139,9 +150,13 @@ parse_skin_data:
or ecx, ecx or ecx, ecx
jnz @f jnz @f
mov edx, skin_inactive.left.data mov edx, skin_inactive.left.data
@@: ;--------------------------------------
align 4
@@:
jmp .next_bitmap jmp .next_bitmap
.not_left: ;--------------------------------------
align 4
.not_left:
dec eax dec eax
jnz .not_oper jnz .not_oper
mov esi, [ebx+SKIN_BITMAPS.data] mov esi, [ebx+SKIN_BITMAPS.data]
@ -152,9 +167,13 @@ parse_skin_data:
or ecx, ecx or ecx, ecx
jnz @f jnz @f
mov edx, skin_inactive.oper.data mov edx, skin_inactive.oper.data
@@: ;--------------------------------------
align 4
@@:
jmp .next_bitmap jmp .next_bitmap
.not_oper: ;--------------------------------------
align 4
.not_oper:
dec eax dec eax
jnz .not_base jnz .not_base
mov eax, [skin_active.left.width] mov eax, [skin_active.left.width]
@ -163,12 +182,18 @@ parse_skin_data:
jnz @f jnz @f
mov eax, [skin_inactive.left.width] mov eax, [skin_inactive.left.width]
mov edx, skin_inactive.base.data mov edx, skin_inactive.base.data
@@: ;--------------------------------------
align 4
@@:
jmp .next_bitmap jmp .next_bitmap
.not_base: ;--------------------------------------
align 4
.not_base:
add ebx, 8 add ebx, 8
jmp .lp1 jmp .lp1
.next_bitmap: ;--------------------------------------
align 4
.next_bitmap:
mov ecx, [ebx+SKIN_BITMAPS.data] mov ecx, [ebx+SKIN_BITMAPS.data]
add ecx, skin_data add ecx, skin_data
mov [edx+4], eax mov [edx+4], eax
@ -178,11 +203,14 @@ parse_skin_data:
mov [edx+0], ecx mov [edx+0], ecx
add ebx, 8 add ebx, 8
jmp .lp1 jmp .lp1
.end_bitmaps: ;--------------------------------------
align 4
.end_bitmaps:
mov ebx, [ebp+SKIN_HEADER.buttons] mov ebx, [ebp+SKIN_HEADER.buttons]
add ebx, skin_data add ebx, skin_data
.lp2: ;--------------------------------------
align 4
.lp2:
cmp dword[ebx], 0 cmp dword[ebx], 0
je .end_buttons je .end_buttons
mov eax, [ebx+SKIN_BUTTONS.type] mov eax, [ebx+SKIN_BUTTONS.type]
@ -190,15 +218,21 @@ parse_skin_data:
jnz .not_close jnz .not_close
mov edx, skin_btn_close mov edx, skin_btn_close
jmp .next_button jmp .next_button
.not_close: ;--------------------------------------
align 4
.not_close:
dec eax dec eax
jnz .not_minimize jnz .not_minimize
mov edx, skin_btn_minimize mov edx, skin_btn_minimize
jmp .next_button jmp .next_button
.not_minimize: ;--------------------------------------
align 4
.not_minimize:
add ebx, 12 add ebx, 12
jmp .lp2 jmp .lp2
.next_button: ;--------------------------------------
align 4
.next_button:
movsx eax, [ebx+SKIN_BUTTONS.left] movsx eax, [ebx+SKIN_BUTTONS.left]
mov [edx+SKIN_BUTTON.left], eax mov [edx+SKIN_BUTTON.left], eax
movsx eax, [ebx+SKIN_BUTTONS.top] movsx eax, [ebx+SKIN_BUTTONS.top]
@ -209,26 +243,22 @@ parse_skin_data:
mov [edx+SKIN_BUTTON.height], eax mov [edx+SKIN_BUTTON.height], eax
add ebx, 12 add ebx, 12
jmp .lp2 jmp .lp2
.end_buttons: ;--------------------------------------
align 4
.exit: .end_buttons:
.exit:
ret ret
;------------------------------------------------------------------------------
sys_putimage_with_check: align 4
or ebx, ebx
jz @f
call sys_putimage.forced
@@:
ret
drawwindow_IV_caption: drawwindow_IV_caption:
mov ebp, skin_active mov ebp, skin_active
or al, al or al, al
jnz @f jnz @f
mov ebp, skin_inactive mov ebp, skin_inactive
@@: ;--------------------------------------
align 4
@@:
mov esi, [esp+4] mov esi, [esp+4]
mov eax, [esi+WDATA.box.width] ; window width mov eax, [esi+WDATA.box.width] ; window width
mov edx, [ebp+SKIN_DATA.left.left] mov edx, [ebp+SKIN_DATA.left.left]
@ -238,8 +268,12 @@ drawwindow_IV_caption:
add ecx, [_skinh] add ecx, [_skinh]
mov ebx, [ebp+SKIN_DATA.left.data] mov ebx, [ebp+SKIN_DATA.left.data]
call sys_putimage_with_check or ebx, ebx
jz @f
call sys_putimage.forced
;--------------------------------------
align 4
@@:
mov esi, [esp+4] mov esi, [esp+4]
mov eax, [esi+WDATA.box.width] mov eax, [esi+WDATA.box.width]
sub eax, [ebp+SKIN_DATA.left.width] sub eax, [ebp+SKIN_DATA.left.width]
@ -260,18 +294,28 @@ drawwindow_IV_caption:
mov edx, [ebp+SKIN_DATA.base.left] mov edx, [ebp+SKIN_DATA.base.left]
sub edx, [ebp+SKIN_DATA.base.width] sub edx, [ebp+SKIN_DATA.base.width]
shl edx, 16 shl edx, 16
.baseskinloop: ;--------------------------------------
align 4
.baseskinloop:
shr edx, 16 shr edx, 16
add edx, [ebp+SKIN_DATA.base.width] add edx, [ebp+SKIN_DATA.base.width]
shl edx, 16 shl edx, 16
push eax ebx ecx edx push eax ebx ecx edx
call sys_putimage_with_check
or ebx, ebx
jz @f
call sys_putimage.forced
;--------------------------------------
align 4
@@:
pop edx ecx ebx eax pop edx ecx ebx eax
dec eax dec eax
jnz .baseskinloop jnz .baseskinloop
.non_base: ;--------------------------------------
align 4
.non_base:
mov esi, [esp+4] mov esi, [esp+4]
mov edx, [esi+WDATA.box.width] mov edx, [esi+WDATA.box.width]
@ -283,16 +327,18 @@ drawwindow_IV_caption:
mov ecx, [ebp+SKIN_DATA.oper.width] mov ecx, [ebp+SKIN_DATA.oper.width]
shl ecx, 16 shl ecx, 16
add ecx, [_skinh] add ecx, [_skinh]
call sys_putimage_with_check
or ebx, ebx
jz @f
call sys_putimage.forced
;--------------------------------------
align 4
@@:
ret ret
;------------------------------------------------------------------------------
;//mike.dld, 2006-08-02 ] align 4
drawwindow_IV: drawwindow_IV:
;param1 - aw_yes ;param1 - aw_yes
pusha pusha
push edx push edx
@ -303,8 +349,9 @@ drawwindow_IV:
cmp byte [esp+32+4+4], 0 cmp byte [esp+32+4+4], 0
jne @f jne @f
mov ebp, skin_inactive mov ebp, skin_inactive
@@: ;--------------------------------------
align 4
@@:
mov eax, [edi+WDATA.box.left] mov eax, [edi+WDATA.box.left]
shl eax, 16 shl eax, 16
mov ax, word [edi+WDATA.box.left] mov ax, word [edi+WDATA.box.left]
@ -313,9 +360,6 @@ drawwindow_IV:
shl ebx, 16 shl ebx, 16
mov bx, word [edi+WDATA.box.top] mov bx, word [edi+WDATA.box.top]
add bx, word [edi+WDATA.box.height] add bx, word [edi+WDATA.box.height]
; mov esi,[edi+24]
; shr esi,1
; and esi,0x007f7f7f
mov esi, [ebp+SKIN_DATA.colors.outer] mov esi, [ebp+SKIN_DATA.colors.outer]
or esi, 1 shl 25 ; 0x02000000 used for draw_rectangle without top line or esi, 1 shl 25 ; 0x02000000 used for draw_rectangle without top line
ror ebx, 16 ror ebx, 16
@ -324,7 +368,9 @@ drawwindow_IV:
rol ebx, 16 rol ebx, 16
call draw_rectangle call draw_rectangle
mov ecx, 3 mov ecx, 3
_dw3l: ;--------------------------------------
align 4
_dw3l:
add eax, 1*65536-1 add eax, 1*65536-1
add ebx, 0*65536-1 add ebx, 0*65536-1
test ax, ax test ax, ax
@ -357,13 +403,14 @@ drawwindow_IV:
mov edi, [common_colours+4]; standard grab color mov edi, [common_colours+4]; standard grab color
call [drawbar] call [drawbar]
jmp draw_clientbar jmp draw_clientbar
@@: ;--------------------------------------
align 4
@@:
mov al, [esp+32+4+4] mov al, [esp+32+4+4]
call drawwindow_IV_caption call drawwindow_IV_caption
;--------------------------------------
draw_clientbar: align 4
draw_clientbar:
mov esi, [esp] mov esi, [esp]
mov edx, [esi+WDATA.box.top] ; WORK AREA mov edx, [esi+WDATA.box.top] ; WORK AREA
@ -382,11 +429,11 @@ drawwindow_IV:
test edi, 0x40000000 test edi, 0x40000000
jnz _noinside2 jnz _noinside2
call [drawbar] call [drawbar]
_noinside2: ;--------------------------------------
align 4
_noinside2:
cmp dword[skin_data], 'SKIN' cmp dword[skin_data], 'SKIN'
jne no_skin_add_button jne no_skin_add_button
;* close button ;* close button
mov edi, [BTN_ADDR] mov edi, [BTN_ADDR]
movzx eax, word [edi] movzx eax, word [edi]
@ -411,7 +458,9 @@ drawwindow_IV:
mov ebx, [esp] mov ebx, [esp]
mov ebx, [ebx+WDATA.box.width] mov ebx, [ebx+WDATA.box.width]
inc ebx inc ebx
_bCx_at_right: ;--------------------------------------
align 4
_bCx_at_right:
add ebx, [skin_btn_close.left] add ebx, [skin_btn_close.left]
mov [eax], bx mov [eax], bx
add eax, 2 ; x size add eax, 2 ; x size
@ -425,7 +474,6 @@ drawwindow_IV:
mov ebx, [skin_btn_close.height] mov ebx, [skin_btn_close.height]
dec ebx dec ebx
mov [eax], bx mov [eax], bx
;* minimize button ;* minimize button
mov edi, [BTN_ADDR] mov edi, [BTN_ADDR]
movzx eax, word [edi] movzx eax, word [edi]
@ -450,7 +498,9 @@ drawwindow_IV:
mov ebx, [esp] mov ebx, [esp]
mov ebx, [ebx+WDATA.box.width] mov ebx, [ebx+WDATA.box.width]
inc ebx inc ebx
_bMx_at_right: ;--------------------------------------
align 4
_bMx_at_right:
add ebx, [skin_btn_minimize.left] add ebx, [skin_btn_minimize.left]
mov [eax], bx mov [eax], bx
add eax, 2 ; x size add eax, 2 ; x size
@ -464,10 +514,10 @@ drawwindow_IV:
mov ebx, [skin_btn_minimize.height] mov ebx, [skin_btn_minimize.height]
dec ebx dec ebx
mov [eax], bx mov [eax], bx
;--------------------------------------
no_skin_add_button: align 4
no_skin_add_button:
pop edi pop edi
popa popa
ret 4 ret 4
;------------------------------------------------------------------------------

File diff suppressed because it is too large Load Diff

View File

@ -432,6 +432,11 @@ proc test_cpu
ret ret
endp endp
iglobal
align 4
acpi_lapic_base dd 0xfee00000 ; default local apic base
endg
uglobal uglobal
align 4 align 4
acpi_rsdp rd 1 acpi_rsdp rd 1
@ -443,8 +448,10 @@ acpi_dev_size rd 1
acpi_rsdt_base rd 1 acpi_rsdt_base rd 1
acpi_madt_base rd 1 acpi_madt_base rd 1
acpi_lapic_base rd 1
acpi_ioapic_base rd 1 acpi_ioapic_base rd 1
cpu_count rd 1
smpt rd 16
endg endg
ACPI_HI_RSDP_WINDOW_START equ 0x000E0000 ACPI_HI_RSDP_WINDOW_START equ 0x000E0000
@ -493,6 +500,7 @@ rsdt_find: ;ecx= rsdt edx= SIG
lea ebx, [ecx+36] lea ebx, [ecx+36]
mov esi, [ecx+4] mov esi, [ecx+4]
add esi, ecx add esi, ecx
align 4
.next: .next:
mov eax, [ebx] mov eax, [ebx]
cmp [eax], edx cmp [eax], edx
@ -513,9 +521,16 @@ rsdt_find: ;ecx= rsdt edx= SIG
pop ebx pop ebx
ret ret
align 4
madt_find:
ret
align 4 align 4
check_acpi: check_acpi:
call acpi_locate call acpi_locate
@ -529,26 +544,53 @@ check_acpi:
test eax, eax test eax, eax
jz .done jz .done
xchg bx, bx
mov [acpi_madt_base-OS_BASE], eax mov [acpi_madt_base-OS_BASE], eax
mov ecx, [eax+36] mov ecx, [eax+36]
mov [acpi_lapic_base-OS_BASE], ecx mov [acpi_lapic_base-OS_BASE], ecx
mov edi, smpt-OS_BASE
mov ebx, [ecx+0x20]
shr ebx, 24 ; read APIC ID
mov [edi], ebx ; bootstrap always first
inc [cpu_count]
add edi, 4
lea edx, [eax+44] lea edx, [eax+44]
mov ecx, [eax+4] mov ecx, [eax+4]
add ecx, eax add ecx, eax
.check: .check:
mov eax, [edx] mov eax, [edx]
cmp al, 1 cmp al, 0
je .ioapic jne .io_apic
shr eax, 24 ; get APIC ID
cmp eax, ebx ; skip self
je .next
test [edx+4], byte 1 ; is enabled ?
jz .next
cmp [cpu_count-OS_BASE], 16
jae .next
stosd ; store APIC ID
inc [cpu_count-OS_BASE]
.next: .next:
mov eax, [edx]
movzx eax, ah movzx eax, ah
add edx, eax add edx, eax
cmp edx, ecx cmp edx, ecx
jb .check jb .check
.done: .done:
ret ret
.ioapic:
.io_apic:
cmp al, 1
jne .next
mov eax, [edx+4] mov eax, [edx+4]
mov [acpi_ioapic_base-OS_BASE], eax mov [acpi_ioapic_base-OS_BASE], eax
ret jmp .next

View File

@ -342,18 +342,24 @@ ap_entry:
or ebx, CR4_PGE or ebx, CR4_PGE
mov cr4, ebx mov cr4, ebx
@@: @@:
mov esi, [LAPIC_BASE]
xor ebp, ebp
.1: .1:
mov ebx, LFB_BASE mov ebx, [esi+0x20] ;apic_id
mov edx, 128 shr ebx, 24
shl ebx, 6+2
add ebx, LFB_BASE
mov edx, 32
.2: .2:
mov ecx, 128 mov ecx, 32
mov edi, ebx mov edi, ebx
mov eax, [_display.width] mov eax, [_display.width]
lea ebx, [ebx+eax*4] lea ebx, [ebx+eax*4]
mov eax, 0xFF808080 mov eax, ebp
rep stosd rep stosd
dec edx dec edx
jnz .2 jnz .2
dec ebp
jmp .1 jmp .1
hlt hlt
@ -466,6 +472,8 @@ high_code:
mul [_display.height] mul [_display.height]
mov [_WinMapSize], eax mov [_WinMapSize], eax
call calculate_fast_getting_offset_for_WinMapAddress
mov esi, BOOT_VAR+0x9080 mov esi, BOOT_VAR+0x9080
movzx ecx, byte [esi-1] movzx ecx, byte [esi-1]
mov [NumBiosDisks], ecx mov [NumBiosDisks], ecx
@ -483,14 +491,7 @@ high_code:
cmp [SCR_MODE], word 0x13 ; EGA 320*200 256 colors cmp [SCR_MODE], word 0x13 ; EGA 320*200 256 colors
je v20ga32 je v20ga32
jmp v20ga24 jmp v20ga24
; mov [PUTPIXEL], dword Vesa12_putpixel24 ; Vesa 1.2
; mov [GETPIXEL], dword Vesa12_getpixel24
; cmp [ScreenBPP], byte 24
; jz ga24
; mov [PUTPIXEL], dword Vesa12_putpixel32
; mov [GETPIXEL], dword Vesa12_getpixel32
; ga24:
; jmp v20ga24
setvesa20: setvesa20:
mov [PUTPIXEL], dword Vesa20_putpixel24 ; Vesa 2.0 mov [PUTPIXEL], dword Vesa20_putpixel24 ; Vesa 2.0
mov [GETPIXEL], dword Vesa20_getpixel24 mov [GETPIXEL], dword Vesa20_getpixel24
@ -685,6 +686,9 @@ no_mode_0x12:
call LAPIC_init call LAPIC_init
mov eax, 1
call start_ap
; Enable timer IRQ (IRQ0) and hard drives IRQs (IRQ14, IRQ15) ; Enable timer IRQ (IRQ0) and hard drives IRQs (IRQ14, IRQ15)
; they are used: when partitions are scanned, hd_read relies on timer ; they are used: when partitions are scanned, hd_read relies on timer
call unmask_timer call unmask_timer
@ -1992,21 +1996,7 @@ sys_end:
; restore default cursor before killing ; restore default cursor before killing
pusha pusha
mov ecx, [current_slot] mov ecx, [current_slot]
mov eax, [def_cursor] call restore_default_cursor_before_killing
mov [ecx+APPDATA.cursor], eax
movzx eax, word [MOUSE_Y]
movzx ebx, word [MOUSE_X]
mov ecx, [Screen_Max_X]
inc ecx
mul ecx
add eax, [_WinMapAddress]
movzx edx, byte [ebx+eax]
shl edx, 8
mov esi, [edx+SLOT_BASE+APPDATA.cursor]
push esi
call [_display.select_cursor]
mov [current_cursor], esi
popa popa
@@: @@:
;-------------------------------------- ;--------------------------------------
@ -2025,7 +2015,25 @@ sys_end:
mov ebx, 100 mov ebx, 100
call delay_hs call delay_hs
jmp waitterm jmp waitterm
;------------------------------------------------------------------------------
restore_default_cursor_before_killing:
mov eax, [def_cursor]
mov [ecx+APPDATA.cursor], eax
movzx eax, word [MOUSE_Y]
movzx ebx, word [MOUSE_X]
mov ecx, [Screen_Max_X]
inc ecx
mul ecx
add eax, [_WinMapAddress]
movzx edx, byte [ebx+eax]
shl edx, 8
mov esi, [edx+SLOT_BASE+APPDATA.cursor]
push esi
call [_display.select_cursor]
mov [current_cursor], esi
ret
;------------------------------------------------------------------------------
iglobal iglobal
align 4 align 4
sys_system_table: sys_system_table:
@ -2101,21 +2109,8 @@ sysfn_terminate: ; 18.2 = TERMINATE
pusha pusha
mov ecx, [esp+32] mov ecx, [esp+32]
shl ecx, 8 shl ecx, 8
mov eax, [def_cursor] add ecx, SLOT_BASE
mov [ecx+SLOT_BASE+APPDATA.cursor], eax call restore_default_cursor_before_killing
movzx eax, word [MOUSE_Y]
movzx ebx, word [MOUSE_X]
mov ecx, [Screen_Max_X]
inc ecx
mul ecx
add eax, [_WinMapAddress]
movzx edx, byte [ebx+eax]
shl edx, 8
mov esi, [edx+SLOT_BASE+APPDATA.cursor]
push esi
call [_display.select_cursor]
mov [current_cursor], esi
popa popa
@@: @@:
add esp, 4 add esp, 4
@ -4875,7 +4870,22 @@ read_from_hd: ; Read from hd - fn not in use
paleholder: paleholder:
ret ret
;------------------------------------------------------------------------------
align 4
calculate_fast_getting_offset_for_WinMapAddress:
; calculate data area for fast getting offset to _WinMapAddress
mov eax, [_display.width]
mov ecx, [_display.height]
inc ecx
mov edi, d_width_calc_area
cld
@@:
stosd
add eax, [_display.width]
dec ecx
jnz @r
ret
;------------------------------------------------------------------------------
align 4 align 4
set_screen: set_screen:
cmp eax, [Screen_Max_X] cmp eax, [Screen_Max_X]
@ -4912,6 +4922,8 @@ set_screen:
test eax, eax test eax, eax
jz .epic_fail jz .epic_fail
call calculate_fast_getting_offset_for_WinMapAddress
popad popad
call repos_windows call repos_windows

View File

@ -62,7 +62,7 @@
; 3c dword cpu usage in cpu timer tics ; 3c dword cpu usage in cpu timer tics
; ;
; ;
; 5000 -> 68FF free (6k6) ; 5000 -> 68FF display width fast calc area (6k6)
; 6900 -> 6EFF saved picture under mouse pointer (1k5) ; 6900 -> 6EFF saved picture under mouse pointer (1k5)
; ;
; 6F00 -> 6FFF free (256) ; 6F00 -> 6FFF free (256)

View File

@ -1000,6 +1000,19 @@ align 4
mov [_display.check_mouse], check_mouse_area_for_putpixel_new mov [_display.check_mouse], check_mouse_area_for_putpixel_new
mov [_display.check_m_pixel], check_mouse_area_for_getpixel_new mov [_display.check_m_pixel], check_mouse_area_for_getpixel_new
cmp [PUTPIXEL], dword VGA_putpixel
je @f
cmp [ScreenBPP], byte 32
je .32
mov [PUTPIXEL], dword Vesa20_putpixel24_new
jmp @f
;--------------------------------------
align 4
.32:
mov [PUTPIXEL], dword Vesa20_putpixel32_new
;--------------------------------------
align 4
@@:
stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM
mov [def_cursor], eax mov [def_cursor], eax
ret ret

View File

@ -243,13 +243,15 @@ align 4
mov ebx, [CURRENT_TASK] mov ebx, [CURRENT_TASK]
cmp byte [ScreenBPP], 32 cmp byte [ScreenBPP], 32
je put_image_end_32 je put_image_end_32
;put_image_end_24: ;--------------------------------------
put_image_end_24:
mov edi, [putimg.real_sy] mov edi, [putimg.real_sy]
cmp [_display.select_cursor], 0
jne put_image_end_24_new
;-------------------------------------- ;--------------------------------------
align 4 align 4
.new_line: .new_line:
mov ecx, [putimg.real_sx] mov ecx, [putimg.real_sx]
; push ebp edx
;-------------------------------------- ;--------------------------------------
align 4 align 4
.new_x: .new_x:
@ -268,7 +270,7 @@ align 4
sub ecx, edi sub ecx, edi
; check mouse area for putpixel ; check mouse area for putpixel
call [_display.check_mouse] call check_mouse_area_for_putpixel
pop ecx pop ecx
; store to real LFB ; store to real LFB
mov [LFB_BASE+edx], ax mov [LFB_BASE+edx], ax
@ -277,16 +279,15 @@ align 4
;-------------------------------------- ;--------------------------------------
align 4 align 4
.skip: .skip:
; add esi, 3 ;[putimg.source_bpp]
add edx, 3 add edx, 3
inc ebp inc ebp
dec ecx dec ecx
jnz .new_x jnz .new_x
; pop edx ebp
add esi, [putimg.line_increment] add esi, [putimg.line_increment]
add edx, [putimg.screen_newline];[BytesPerScanLine] add edx, [putimg.screen_newline];[BytesPerScanLine]
add ebp, [putimg.winmap_newline];[Screen_Max_X] add ebp, [putimg.winmap_newline];[Screen_Max_X]
; inc ebp
cmp [putimg.ebp], putimage_get1bpp cmp [putimg.ebp], putimage_get1bpp
jz .correct jz .correct
cmp [putimg.ebp], putimage_get2bpp cmp [putimg.ebp], putimage_get2bpp
@ -309,15 +310,93 @@ align 4
add esp, putimg.stack_data add esp, putimg.stack_data
popad popad
ret ret
;------------------------------------------------------------------------------ ;--------------------------------------
align 4 align 4
put_image_end_32: put_image_end_24_new:
mov edi, [putimg.real_sy] ;--------------------------------------
align 4
.new_line:
mov ecx, [putimg.real_sx]
;--------------------------------------
align 4
.new_x:
push [putimg.edi]
mov eax, [putimg.ebp+4]
call eax
cmp [ebp], bl
jne .skip
;--------------------------------------
push ecx
mov ecx, [putimg.real_sy_and_abs_cy + 4]
sub ecx, edi
;--------------------------------------
; check for Y
cmp cx, [Y_UNDER_subtraction_CUR_hot_y]
jb .no_mouse_area
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
jae .no_mouse_area
rol ecx, 16
add ecx, [putimg.real_sx_and_abs_cx + 4]
sub ecx, [esp]
;--------------------------------------
; check for X
cmp cx, [X_UNDER_subtraction_CUR_hot_x]
jb .no_mouse_area
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
jae .no_mouse_area
;--------------------------------------
; check mouse area for putpixel
call check_mouse_area_for_putpixel_new.1
;--------------------------------------
align 4
.no_mouse_area:
pop ecx
; store to real LFB
mov [LFB_BASE+edx], ax
shr eax, 16
mov [LFB_BASE+edx+2], al
;--------------------------------------
align 4
.skip:
add edx, 3
inc ebp
dec ecx
jnz .new_x
add esi, [putimg.line_increment]
add edx, [putimg.screen_newline];[BytesPerScanLine]
add ebp, [putimg.winmap_newline];[Screen_Max_X]
cmp [putimg.ebp], putimage_get1bpp
jz .correct
cmp [putimg.ebp], putimage_get2bpp
jz .correct
cmp [putimg.ebp], putimage_get4bpp
jnz @f
;--------------------------------------
align 4
.correct:
mov eax, [putimg.edi]
mov byte [eax], 80h
;--------------------------------------
align 4
@@:
dec edi
jnz .new_line
jmp put_image_end_24.finish
;------------------------------------------------------------------------------
align 4
put_image_end_32:
mov edi, [putimg.real_sy]
cmp [_display.select_cursor], 0
jne put_image_end_32_new
;-------------------------------------- ;--------------------------------------
align 4 align 4
.new_line: .new_line:
mov ecx, [putimg.real_sx] mov ecx, [putimg.real_sx]
; push ebp edx
;-------------------------------------- ;--------------------------------------
align 4 align 4
.new_x: .new_x:
@ -336,23 +415,22 @@ align 4
sub ecx, edi sub ecx, edi
; check mouse area for putpixel ; check mouse area for putpixel
call [_display.check_mouse] call check_mouse_area_for_putpixel
pop ecx pop ecx
; store to real LFB ; store to real LFB
mov [LFB_BASE+edx], eax mov [LFB_BASE+edx], eax
;-------------------------------------- ;--------------------------------------
align 4 align 4
.skip: .skip:
; add esi, [putimg.source_bpp]
add edx, 4 add edx, 4
inc ebp inc ebp
dec ecx dec ecx
jnz .new_x jnz .new_x
; pop edx ebp
add esi, [putimg.line_increment] add esi, [putimg.line_increment]
add edx, [putimg.screen_newline];[BytesPerScanLine] add edx, [putimg.screen_newline];[BytesPerScanLine]
add ebp, [putimg.winmap_newline];[Screen_Max_X] add ebp, [putimg.winmap_newline];[Screen_Max_X]
; inc ebp
cmp [putimg.ebp], putimage_get1bpp cmp [putimg.ebp], putimage_get1bpp
jz .correct jz .correct
cmp [putimg.ebp], putimage_get2bpp cmp [putimg.ebp], putimage_get2bpp
@ -374,9 +452,89 @@ align 4
.finish: .finish:
add esp, putimg.stack_data add esp, putimg.stack_data
popad popad
cmp [SCR_MODE], dword 0x12
jne @f
call VGA__putimage call VGA__putimage
;--------------------------------------
align 4
@@:
mov [EGA_counter], 1 mov [EGA_counter], 1
ret ret
;--------------------------------------
align 4
put_image_end_32_new:
;--------------------------------------
align 4
.new_line:
mov ecx, [putimg.real_sx]
;--------------------------------------
align 4
.new_x:
push [putimg.edi]
mov eax, [putimg.ebp+4]
call eax
cmp [ebp], bl
jne .skip
;--------------------------------------
push ecx
mov ecx, [putimg.real_sy_and_abs_cy + 4]
sub ecx, edi
;--------------------------------------
; check for Y
cmp cx, [Y_UNDER_subtraction_CUR_hot_y]
jb .no_mouse_area
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
jae .no_mouse_area
rol ecx, 16
add ecx, [putimg.real_sx_and_abs_cx + 4]
sub ecx, [esp]
;--------------------------------------
; check for X
cmp cx, [X_UNDER_subtraction_CUR_hot_x]
jb .no_mouse_area
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
jae .no_mouse_area
;--------------------------------------
; check mouse area for putpixel
call check_mouse_area_for_putpixel_new.1
;--------------------------------------
align 4
.no_mouse_area:
pop ecx
; store to real LFB
mov [LFB_BASE+edx], eax
;--------------------------------------
align 4
.skip:
add edx, 4
inc ebp
dec ecx
jnz .new_x
add esi, [putimg.line_increment]
add edx, [putimg.screen_newline];[BytesPerScanLine]
add ebp, [putimg.winmap_newline];[Screen_Max_X]
cmp [putimg.ebp], putimage_get1bpp
jz .correct
cmp [putimg.ebp], putimage_get2bpp
jz .correct
cmp [putimg.ebp], putimage_get4bpp
jnz @f
;--------------------------------------
align 4
.correct:
mov eax, [putimg.edi]
mov byte [eax], 80h
;--------------------------------------
align 4
@@:
dec edi
jnz .new_line
jmp put_image_end_32.finish
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
align 4 align 4
__sys_putpixel: __sys_putpixel:
@ -398,14 +556,10 @@ __sys_putpixel:
jnz .forced jnz .forced
; not forced: ; not forced:
mov edx, [d_width_calc_area + ebx*4]
push eax add edx, [_WinMapAddress]
mov edx, [_display.width]; screen x size
imul edx, ebx
add eax, [_WinMapAddress]
movzx edx, byte [eax+edx] movzx edx, byte [eax+edx]
cmp edx, [CURRENT_TASK] cmp edx, [CURRENT_TASK]
pop eax
jne .exit jne .exit
;-------------------------------------- ;--------------------------------------
align 4 align 4
@ -447,7 +601,7 @@ Vesa20_putpixel24:
; check mouse area for putpixel ; check mouse area for putpixel
test eax, 0x04000000 test eax, 0x04000000
jnz @f jnz @f
call [_display.check_mouse] call check_mouse_area_for_putpixel
;-------------------------------------- ;--------------------------------------
align 4 align 4
@@: @@:
@ -455,7 +609,48 @@ align 4
mov [LFB_BASE+ebx+edi], ax mov [LFB_BASE+ebx+edi], ax
shr eax, 16 shr eax, 16
mov [LFB_BASE+ebx+edi+2], al mov [LFB_BASE+ebx+edi+2], al
ret
;-----------------------------------------------------------------------------
align 4
Vesa20_putpixel24_new:
; eax = x
; ebx = y
mov ecx, eax
shl ecx, 16
mov cx, bx
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
lea edi, [eax+eax*2]; edi = x*3
mov eax, [esp+32-8+4]
;-------------------------------------- ;--------------------------------------
; check mouse area for putpixel
test eax, 0x04000000
jnz @f
;--------------------------------------
; check for Y
cmp cx, [Y_UNDER_subtraction_CUR_hot_y]
jb @f
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
jae @f
rol ecx, 16
;--------------------------------------
; check for X
cmp cx, [X_UNDER_subtraction_CUR_hot_x]
jb @f
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
jae @f
call check_mouse_area_for_putpixel_new.1
;--------------------------------------
align 4
@@:
; store to real LFB
mov [LFB_BASE+ebx+edi], ax
shr eax, 16
mov [LFB_BASE+ebx+edi+2], al
ret ret
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
align 4 align 4
@ -473,14 +668,54 @@ Vesa20_putpixel32:
; check mouse area for putpixel ; check mouse area for putpixel
test eax, 0x04000000 test eax, 0x04000000
jnz @f jnz @f
call [_display.check_mouse] call check_mouse_area_for_putpixel
;-------------------------------------- ;--------------------------------------
align 4 align 4
@@: @@:
and eax, 0xffffff and eax, 0xffffff
; store to real LFB ; store to real LFB
mov [LFB_BASE+edi], eax mov [LFB_BASE+edi], eax
ret
;-----------------------------------------------------------------------------
align 4
Vesa20_putpixel32_new:
; eax = x
; ebx = y
mov ecx, eax
shl ecx, 16
mov cx, bx
imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
lea edi, [ebx+eax*4]; edi = x*4+(y*y multiplier)
mov eax, [esp+32-8+4]; eax = color
;-------------------------------------- ;--------------------------------------
; check mouse area for putpixel
test eax, 0x04000000
jnz @f
;--------------------------------------
; check for Y
cmp cx, [Y_UNDER_subtraction_CUR_hot_y]
jb @f
cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh]
jae @f
rol ecx, 16
;--------------------------------------
; check for X
cmp cx, [X_UNDER_subtraction_CUR_hot_x]
jb @f
cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh]
jae @f
call check_mouse_area_for_putpixel_new.1
;--------------------------------------
align 4
@@:
and eax, 0xffffff
; store to real LFB
mov [LFB_BASE+edi], eax
ret ret
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
align 4 align 4
@ -1055,7 +1290,12 @@ align 4
.end: .end:
add esp, drbar.stack_data add esp, drbar.stack_data
popad popad
cmp [SCR_MODE], dword 0x12
jne @f
call VGA_draw_bar call VGA_draw_bar
;--------------------------------------
align 4
@@:
xor eax, eax xor eax, eax
mov [EGA_counter], 1 mov [EGA_counter], 1
ret ret
@ -1238,7 +1478,12 @@ dp4:
jbe dp2 jbe dp2
popad popad
mov [EGA_counter], 1 mov [EGA_counter], 1
cmp [SCR_MODE], dword 0x12
jne @f
call VGA_drawbackground call VGA_drawbackground
;--------------------------------------
align 4
@@:
ret ret
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
align 4 align 4
@ -1445,7 +1690,12 @@ sdpdone:
add esp, 44 add esp, 44
popad popad
mov [EGA_counter], 1 mov [EGA_counter], 1
cmp [SCR_MODE], dword 0x12
jne @f
call VGA_drawbackground call VGA_drawbackground
;--------------------------------------
align 4
@@:
ret ret
uglobal uglobal

View File

@ -13,7 +13,8 @@
$Revision$ $Revision$
;------------------------------------------------------------------------------
align 4
paletteVGA: paletteVGA:
;16 colour palette ;16 colour palette
@ -24,9 +25,9 @@ paletteVGA:
mov ecx, 16 mov ecx, 16
mov dx, 0x3c9 mov dx, 0x3c9
xor eax, eax xor eax, eax
;--------------------------------------
palvganew: align 4
palvganew:
mov al, 0 mov al, 0
test ah, 4 test ah, 4
jz palvgalbl1 jz palvgalbl1
@ -34,7 +35,9 @@ paletteVGA:
test ah, 8 test ah, 8
jz palvgalbl1 jz palvgalbl1
add al, 32 add al, 32
palvgalbl1: ;--------------------------------------
align 4
palvgalbl1:
out dx, al; red 0,31 or 63 out dx, al; red 0,31 or 63
mov al, 0 mov al, 0
test ah, 2 test ah, 2
@ -43,7 +46,9 @@ paletteVGA:
test ah, 8 test ah, 8
jz palvgalbl2 jz palvgalbl2
add al, 32 add al, 32
palvgalbl2: ;--------------------------------------
align 4
palvgalbl2:
out dx, al; blue 0,31 or 63 out dx, al; blue 0,31 or 63
mov al, 0 mov al, 0
test ah, 1 test ah, 1
@ -52,7 +57,9 @@ paletteVGA:
test ah, 8 test ah, 8
jz palvgalbl3 jz palvgalbl3
add al, 32 add al, 32
palvgalbl3: ;--------------------------------------
align 4
palvgalbl3:
out dx, al; green 0,31 or 63 out dx, al; green 0,31 or 63
add ah, 1 add ah, 1
loop palvganew loop palvganew
@ -60,59 +67,76 @@ paletteVGA:
; mov ax, 0005h ; mov ax, 0005h
; out dx, ax ; out dx, ax
ret ret
;------------------------------------------------------------------------------
align 4
palette320x200: palette320x200:
mov edx, 0x3c8 mov edx, 0x3c8
xor eax, eax xor eax, eax
out dx, al out dx, al
mov ecx, 256 mov ecx, 256
mov edx, 0x3c9 mov edx, 0x3c9
xor eax, eax xor eax, eax
;--------------------------------------
palnew: align 4
palnew:
mov al, 0 mov al, 0
test ah, 64 test ah, 64
jz pallbl1 jz pallbl1
add al, 21 add al, 21
pallbl1: ;--------------------------------------
align 4
pallbl1:
test ah, 128 test ah, 128
jz pallbl2 jz pallbl2
add al, 42 add al, 42
pallbl2: ;--------------------------------------
align 4
pallbl2:
out dx, al out dx, al
mov al, 0 mov al, 0
test ah, 8 test ah, 8
jz pallbl3 jz pallbl3
add al, 8 add al, 8
pallbl3: ;--------------------------------------
align 4
pallbl3:
test ah, 16 test ah, 16
jz pallbl4 jz pallbl4
add al, 15 add al, 15
pallbl4: ;--------------------------------------
align 4
pallbl4:
test ah, 32 test ah, 32
jz pallbl5 jz pallbl5
add al, 40 add al, 40
pallbl5: ;--------------------------------------
align 4
pallbl5:
out dx, al out dx, al
mov al, 0 mov al, 0
test ah, 1 test ah, 1
jz pallbl6 jz pallbl6
add al, 8 add al, 8
pallbl6: ;--------------------------------------
align 4
pallbl6:
test ah, 2 test ah, 2
jz pallbl7 jz pallbl7
add al, 15 add al, 15
pallbl7: ;--------------------------------------
align 4
pallbl7:
test ah, 4 test ah, 4
jz pallbl8 jz pallbl8
add al, 40 add al, 40
pallbl8: ;--------------------------------------
align 4
pallbl8:
out dx, al out dx, al
add ah, 1 add ah, 1
loop palnew loop palnew
ret ret
;------------------------------------------------------------------------------
align 4 align 4
uglobal uglobal
novesachecksum dd 0x0 novesachecksum dd 0x0
@ -123,13 +147,12 @@ uglobal
temp: temp:
.cx dd 0 .cx dd 0
endg endg
;------------------------------------------------------------------------------
align 4 align 4
checkVga_N13: checkVga_N13:
cmp [SCR_MODE], dword 0x13 cmp [SCR_MODE], dword 0x13
jne @f jne @f
; cnvl:
pushad pushad
cmp [EGA_counter], 1 cmp [EGA_counter], 1
je novesal je novesal
@ -137,21 +160,28 @@ checkVga_N13:
cmp ecx, [novesachecksum] cmp ecx, [novesachecksum]
jne novesal jne novesal
popad popad
@@: ;--------------------------------------
align 4
@@:
ret ret
;--------------------------------------
novesal: align 4
novesal:
mov [novesachecksum], ecx mov [novesachecksum], ecx
mov ecx, 0 mov ecx, 0
movzx eax, word [MOUSE_Y] movzx eax, word [MOUSE_Y]
cmp eax, 100 cmp eax, 100
jge m13l3 jge m13l3
mov eax, 100 mov eax, 100
m13l3: ;--------------------------------------
align 4
m13l3:
cmp eax, 480-100 cmp eax, 480-100
jbe m13l4 jbe m13l4
mov eax, 480-100 mov eax, 480-100
m13l4: ;--------------------------------------
align 4
m13l4:
sub eax, 100 sub eax, 100
imul eax, 640*4 imul eax, 640*4
add ecx, eax add ecx, eax
@ -159,11 +189,15 @@ checkVga_N13:
cmp eax, 160 cmp eax, 160
jge m13l1 jge m13l1
mov eax, 160 mov eax, 160
m13l1: ;--------------------------------------
align 4
m13l1:
cmp eax, 640-160 cmp eax, 640-160
jbe m13l2 jbe m13l2
mov eax, 640-160 mov eax, 640-160
m13l2: ;--------------------------------------
align 4
m13l2:
sub eax, 160 sub eax, 160
shl eax, 2 shl eax, 2
add ecx, eax add ecx, eax
@ -173,7 +207,9 @@ checkVga_N13:
mov edx, 200 mov edx, 200
mov ecx, 320 mov ecx, 320
cld cld
m13pix: ;--------------------------------------
align 4
m13pix:
lodsd lodsd
test eax, eax test eax, eax
jz .save_pixel jz .save_pixel
@ -188,7 +224,9 @@ checkVga_N13:
and ebx, (128+64)*256*256; red and ebx, (128+64)*256*256; red
shr ebx, 8+8 shr ebx, 8+8
add eax, ebx add eax, ebx
.save_pixel: ;--------------------------------------
align 4
.save_pixel:
stosb stosb
loop m13pix loop m13pix
mov ecx, 320 mov ecx, 320
@ -198,17 +236,18 @@ checkVga_N13:
mov [EGA_counter], 0 mov [EGA_counter], 0
popad popad
ret ret
;------------------------------------------------------------------------------
align 4
VGA_drawbackground: VGA_drawbackground:
; draw all ; draw all
cmp [SCR_MODE], dword 0x12
jne .end
pushad pushad
mov esi, [LFBAddress] mov esi, [LFBAddress]
mov edi, VGABasePtr mov edi, VGABasePtr
mov ebx, 640/32; 640*480/(8*4) mov ebx, 640/32; 640*480/(8*4)
mov edx, 480 mov edx, 480
@@: ;--------------------------------------
align 4
@@:
push ebx edx esi edi push ebx edx esi edi
shl edx, 9 shl edx, 9
lea edx, [edx+edx*4] lea edx, [edx+edx*4]
@ -221,9 +260,9 @@ VGA_drawbackground:
jnz @r jnz @r
call VGA_draw_long_line_1 call VGA_draw_long_line_1
popad popad
.end:
ret ret
;------------------------------------------------------------------------------
align 4
VGA_draw_long_line: VGA_draw_long_line:
mov dx, 3ceh mov dx, 3ceh
mov ax, 0ff08h mov ax, 0ff08h
@ -231,7 +270,9 @@ VGA_draw_long_line:
out dx, ax out dx, ax
mov ax, 0005h mov ax, 0005h
out dx, ax out dx, ax
m12pix: ;--------------------------------------
align 4
m12pix:
call VGA_draw_32_pixels call VGA_draw_32_pixels
dec ebx dec ebx
jnz m12pix jnz m12pix
@ -246,7 +287,8 @@ VGA_draw_long_line:
out dx, al out dx, al
sti sti
ret ret
;------------------------------------------------------------------------------
align 4
VGA_draw_32_pixels: VGA_draw_32_pixels:
xor eax, eax xor eax, eax
mov ebp, VGA_8_pixels mov ebp, VGA_8_pixels
@ -255,9 +297,13 @@ VGA_draw_32_pixels:
mov [ebp+8], eax mov [ebp+8], eax
mov [ebp+12], eax mov [ebp+12], eax
mov ch, 4 mov ch, 4
.main_loop: ;--------------------------------------
align 4
.main_loop:
mov cl, 8 mov cl, 8
.convert_pixels_to_VGA: ;--------------------------------------
align 4
.convert_pixels_to_VGA:
lodsd ; eax = 24bit colour lodsd ; eax = 24bit colour
test eax, eax test eax, eax
jz .end jz .end
@ -273,14 +319,18 @@ VGA_draw_32_pixels:
cmp al, 170 cmp al, 170
jbe .p13green jbe .p13green
or [ebp+12], ch or [ebp+12], ch
.p13green: ;--------------------------------------
align 4
.p13green:
cmp ah, 85 cmp ah, 85
jbe .p13red jbe .p13red
or [ebp+4], ch or [ebp+4], ch
cmp ah, 170 cmp ah, 170
jbe .p13red jbe .p13red
or [ebp+12], ch or [ebp+12], ch
.p13red: ;--------------------------------------
align 4
.p13red:
shr eax, 8 shr eax, 8
cmp ah, 85 cmp ah, 85
jbe .p13cont jbe .p13cont
@ -288,11 +338,15 @@ VGA_draw_32_pixels:
cmp ah, 170 cmp ah, 170
jbe .p13cont jbe .p13cont
or [ebp+12], ch or [ebp+12], ch
.p13cont: ;--------------------------------------
align 4
.p13cont:
ror eax, 8 ror eax, 8
mov ch, ah mov ch, ah
inc cl inc cl
.end: ;--------------------------------------
align 4
.end:
dec cl dec cl
jnz .convert_pixels_to_VGA jnz .convert_pixels_to_VGA
inc ebp inc ebp
@ -303,7 +357,9 @@ VGA_draw_32_pixels:
mov esi, ebp mov esi, ebp
mov dx, 3c4h mov dx, 3c4h
mov ah, 1h mov ah, 1h
@@: ;--------------------------------------
align 4
@@:
mov al, 02h mov al, 02h
out dx, ax out dx, ax
xchg ax, bp xchg ax, bp
@ -316,12 +372,25 @@ VGA_draw_32_pixels:
add edi, 4 add edi, 4
pop esi pop esi
ret ret
;------------------------------------------------------------------------------
align 4
VGA_putpixel: VGA_putpixel:
; eax = x ; eax = x
; ebx = y ; ebx = y
mov ecx, eax mov ecx, eax
mov eax, [esp+32-8+4] ; color mov eax, [esp+32-8+4] ; color
;--------------------------------------
push ecx
shl ecx, 16
mov cx, bx
; check mouse area for putpixel
test eax, 0x04000000
jnz @f
call [_display.check_mouse]
;--------------------------------------
align 4
@@:
pop ecx
shl ebx, 9 shl ebx, 9
lea ebx, [ebx+ebx*4] ; óìíîæåíèå íà 5 lea ebx, [ebx+ebx*4] ; óìíîæåíèå íà 5
lea edx, [ebx+ecx*4] ; + x*BytesPerPixel (Vesa2.0 32) lea edx, [ebx+ecx*4] ; + x*BytesPerPixel (Vesa2.0 32)
@ -343,6 +412,8 @@ VGA_putpixel:
cmp al, 170 cmp al, 170
jbe .p13green jbe .p13green
or dl, 0x08 or dl, 0x08
;--------------------------------------
align 4
.p13green: .p13green:
cmp ah, 85 cmp ah, 85
jbe .p13red jbe .p13red
@ -350,6 +421,8 @@ VGA_putpixel:
cmp ah, 170 cmp ah, 170
jbe .p13red jbe .p13red
or dl, 0x08 or dl, 0x08
;--------------------------------------
align 4
.p13red: .p13red:
shr eax, 8 shr eax, 8
cmp ah, 85 cmp ah, 85
@ -358,6 +431,8 @@ VGA_putpixel:
cmp ah, 170 cmp ah, 170
jbe .p13cont jbe .p13cont
or dl, 0x08 or dl, 0x08
;--------------------------------------
align 4
.p13cont: .p13cont:
ror edx, 8 ror edx, 8
inc cl inc cl
@ -371,14 +446,12 @@ VGA_putpixel:
rol edx, 8 rol edx, 8
mov [edi], dl mov [edi], dl
popfd popfd
;.end:
ret ret
;------------------------------------------------------------------------------
align 4
VGA__putimage: VGA__putimage:
; ecx = size [x|y] ; ecx = size [x|y]
; edx = coordinates [x|y] ; edx = coordinates [x|y]
cmp [SCR_MODE], dword 0x12
jne @f
pushad pushad
rol edx, 16 rol edx, 16
movzx eax, dx movzx eax, dx
@ -389,16 +462,14 @@ VGA__putimage:
movzx ecx, cx movzx ecx, cx
call VGA_draw_bar_1 call VGA_draw_bar_1
popad popad
@@:
ret ret
;------------------------------------------------------------------------------
align 4
VGA_draw_bar: VGA_draw_bar:
; eax cx ; eax cx
; ebx cy ; ebx cy
; ecx xe ; ecx xe
; edx ye ; edx ye
cmp [SCR_MODE], dword 0x12
jne @f
pushad pushad
sub ecx, eax sub ecx, eax
sub edx, ebx sub edx, ebx
@ -408,9 +479,9 @@ VGA_draw_bar:
and edx, 0xffff and edx, 0xffff
call VGA_draw_bar_1 call VGA_draw_bar_1
popad popad
@@:
ret ret
;------------------------------------------------------------------------------
align 4
VGA_draw_bar_1: VGA_draw_bar_1:
mov [temp.cx], eax mov [temp.cx], eax
mov eax, [TASK_BASE] mov eax, [TASK_BASE]
@ -429,13 +500,16 @@ VGA_draw_bar_1:
mov ebx, ecx mov ebx, ecx
shr ebx, 5 shr ebx, 5
inc ebx inc ebx
;--------------------------------------
align 4
.main_loop: .main_loop:
call VGA_draw_long_line_1 call VGA_draw_long_line_1
dec edx dec edx
jnz .main_loop jnz .main_loop
call VGA_draw_long_line_1 call VGA_draw_long_line_1
ret ret
;------------------------------------------------------------------------------
align 4
VGA_draw_long_line_1: VGA_draw_long_line_1:
push ebx edx esi edi push ebx edx esi edi
shl edx, 9 shl edx, 9
@ -446,5 +520,4 @@ VGA_draw_long_line_1:
call VGA_draw_long_line call VGA_draw_long_line
pop edi esi edx ebx pop edi esi edx ebx
ret ret
;------------------------------------------------------------------------------