Kde jsem lhal? Nechápu kde jsi to vzal - co ten link jako dokazuje? Ano používám GDC (GNU D Compiler) - a? Kde jsi vzal proboha Linux? Nesnáším Linux. Když už, mám Unix - UnixWare. Ale stejně raději pracuji s DOSem...
Tak třeba takto vykresluji v ASM:
DrawPixel:
mov edi, [Screen.PhysBasePointer]
movzx eax, word [Screen.Width]
mov ebx, [esi + 8]
xor edx, edx
mul ebx
add eax, [esi + 4]
movzx ebx, byte [Screen.Depth]
shr ebx, 3
mul ebx
mov ebx, [esi]
mov [edi + eax], ebx
ret
ClearScreen:
mov [.y], ebx
mov [.color], edx
xor edx, edx
mov [.x], edx
mov [.y], edx
mov esi, .params
.clearLine:
call DrawPixel
inc dword [.x]
mov ebx, [Screen.Width]
cmp [.x], ebx
jne .clearLine
inc dword [.y]
mov ebx, [.y]
cmp ebx, [Screen.Height]
jne .clearLine
ret
.params:
.color dd 0
.x dd 0
.y dd 0
DrawImage:
cmp word [BMP.ID], "BM"
je DrawBMP
ret
DrawBMP:
cmp word [BMP.Depth], 24
je DrawBMP24
cmp word [BMP.Depth], 32
je DrawBMP32
ret
DrawBMP24:
pushad
mov [.X], eax
mov [.Y], ebx
mov [.x], eax
mov [.y], ebx
xor edx, edx
mov ebx, 4
mov eax, [BMP.Width]
div ebx
mov [.align], edx
mov esi, BMP
add esi, [BMP.Offset]
mov [.pointer], esi
mov ebx, [BMP.Height]
add [.y], ebx
.drawLine:
mov esi, [.pointer]
mov al, [esi]
mov [.color], al
mov al, [esi + 1]
mov [.color + 1], al
mov al, [esi + 2]
mov [.color + 2], al
add dword [.pointer], 3
mov esi, .params
call DrawPixel
inc dword [.x]
mov ebx, [BMP.Width]
add ebx, [.X]
cmp [.x], ebx
jne .drawLine
mov ebx, [.X]
mov [.x], ebx
dec dword [.y]
mov ebx, [.pointer]
add ebx, [.align]
mov [.pointer], ebx
mov ebx, [.Y]
cmp [.y], ebx
jne .drawLine
popad
ret
.X dd 0
.Y dd 0
.align dd 0
.pointer dd 0
.params:
.color dd 0
.x dd 0
.y dd 0
DrawBMP32:
pushad
mov [.X], eax
mov [.Y], ebx
mov [.x], eax
mov [.y], ebx
mov esi, BMP
add esi, [BMP.Offset]
mov [.pointer], esi
mov ebx, [BMP.Height]
add [.y], ebx
.drawLine:
mov esi, [.pointer]
mov eax, [esi]
mov [.color], eax
add dword [.pointer], 4
mov esi, .params
call DrawPixel
inc dword [.x]
mov ebx, [BMP.Width]
add ebx, [.X]
cmp [.x], ebx
jne .drawLine
mov ebx, [.X]
mov [.x], ebx
dec dword [.y]
mov ebx, [.Y]
cmp [.y], ebx
jne .drawLine
popad
ret
.X dd 0
.Y dd 0
.pointer dd 0
.params:
.color dd 0
.x dd 0
.y dd 0
DrawPartOfImage:
cmp word [BMP.ID], "BM"
je DrawPartOfBMP
ret
DrawPartOfBMP:
cmp word [BMP.Depth], 24
je DrawPartOfBMP24
cmp word [BMP.Depth], 32
je DrawPartOfBMP32
ret
DrawPartOfBMP24:
pushad
mov eax, [esi]
mov ebx, [esi + 4]
mov ecx, [esi + 8]
mov edx, [esi + 12]
mov [.X], eax
mov [.Y], ebx
mov [.x], eax
mov [.y], ebx
add [.y], edx
mov [.width], ecx
xor edx, edx
mov ebx, 4
mov eax, [BMP.Width]
div ebx
mov [.align], edx
mov eax, [BMP.Width]
sub eax, ecx
add [.align], eax
add [.align], eax
add [.align], eax
mov ebx, [esi + 16] ; X clip position
add ebx, [esi + 16]
add ebx, [esi + 16]
mov eax, [.width] ; Y clip position
add eax, [.width]
add eax, [.width]
add eax, [.align]
mov ecx, [esi + 20]
mul ecx
mov esi, BMP
add esi, [BMP.Offset]
add esi, eax
add esi, ebx
mov [.pointer], esi
.drawLine:
mov esi, [.pointer]
mov al, [esi]
mov [.color], al
mov al, [esi + 1]
mov [.color + 1], al
mov al, [esi + 2]
mov [.color + 2], al
add dword [.pointer], 3
mov esi, .params
call DrawPixel
inc dword [.x]
mov ebx, [.width]
add ebx, [.X]
cmp [.x], ebx
jne .drawLine
mov ebx, [.X]
mov [.x], ebx
dec dword [.y]
mov ebx, [.pointer]
add ebx, [.align]
mov [.pointer], ebx
mov ebx, [.Y]
cmp [.y], ebx
jne .drawLine
popad
ret
.X dd 0
.Y dd 0
.align dd 0
.pointer dd 0
.width dd 0
.params:
.color dd 0
.x dd 0
.y dd 0
DrawPartOfBMP32:
pushad
mov eax, [esi]
mov ebx, [esi + 4]
mov ecx, [esi + 8]
mov edx, [esi + 12]
mov [.X], eax
mov [.Y], ebx
mov [.x], eax
mov [.y], ebx
add [.y], edx
mov [.width], ecx
mov eax, [BMP.Width]
sub eax, ecx
add [.align], eax
add [.align], eax
add [.align], eax
add [.align], eax
mov ebx, [esi + 16] ; X clip position
add ebx, [esi + 16]
add ebx, [esi + 16]
add ebx, [esi + 16]
mov eax, [BMP.Width] ; Y clip position
add eax, [BMP.Width]
add eax, [BMP.Width]
add eax, [BMP.Width]
mov ecx, [esi + 20]
mul ecx
mov esi, BMP
add esi, [BMP.Offset]
add esi, eax
add esi, ebx
mov [.pointer], esi
.drawLine:
mov esi, [.pointer]
mov eax, [esi]
mov [.color], eax
add dword [.pointer], 4
mov esi, .params
call DrawPixel
inc dword [.x]
mov ebx, [.width]
add ebx, [.X]
cmp [.x], ebx
jne .drawLine
mov ebx, [.X]
mov [.x], ebx
dec dword [.y]
mov ebx, [.pointer]
add ebx, [.align]
mov [.pointer], ebx
mov ebx, [.Y]
cmp [.y], ebx
jne .drawLine
popad
ret
.X dd 0
.Y dd 0
.align dd 0
.pointer dd 0
.width dd 0
.params:
.color dd 0
.x dd 0
.y dd 0
Zde initializuji Vesu:
InitializeVESA:
in al, 0x92
or al, 2
out 0x92, al
mov bx, 0x4118
mov ax, 0x4F01
mov di, Screen
mov cx, bx
int 0x10
mov ax, 0x4F02
int 0x10
cli
lgdt [.GDTR]
mov eax, cr0
or al, 1
mov cr0, eax
; CR0: PG|----RESERVED----|NE|ET|TS|EM|MP|PE
; PE Bit 0. The Protected Environment flag. This flag puts the system into protected mode when set.
; MP Bit 1. The Monitor Coprocessor flag. This flag controls the operation of the "WAIT" instruction.
; EM Bit 2. The Emulate flag. When this flag is set, coprocessor instructions will generate an exception.
; TS Bit 3. The Task Switched flag. This flag is set automatically when the processor switches to a new task.
; ET Bit 4. The Extension Type flag. ET (also called "R") tells us which type of coprocessor is installed. If ET = 0, an 80287 is installed. if ET = 1, an 80387 is installed.
; NE Bit 5. New exceptions. If this flag is clear, FPU exceptions arrive as interrupts. If set, as exceptions.
; PG Bit 31. The Paging flag. When this flag is set, memory paging is enabled. We will talk more about that in a second.
mov ax, 0x8
mov ds, ax
mov es, ax
mov ss, ax
jmp 0x10:Kernel
.GDT dq 0, 0xCF92000000FFFF, 0xCF98000000FFFF
; Selector 0x00 cannot be used | 0x10 will be our code | 0x08 will be our data
.GDTR:
dw 0x1F
dd .GDT
Onu komerční praxi jsem měl v Lusorion Creatives. Dále pak mám certifikát za účast na projektu Net BSD. Chceš abych ti napsal program v Lispu, Ruby,...? Nemám problém - v ničem jsem nelhal - naopak raději jsem napsal jen výtah - aby to nevypadalo moc neuvěřitelně. Programuji každý den 90% volného času. Jestli chceš rozeberu ti všechny opcode instrukce instrukční sady Intel (Pentium), AMD a několika mikroprocesorů. Popíši ti detailně CIL, cokoliv. Popíši ti všechny IO porty ve sběrnici všechny specifické adresy RAM - cokoliv... (Prvních 256 byte je IVT 16 bits real-time režimu, pak tam je CMOS baterie - pointery na karty nastavení a pak tam je výstup kontroly všech zařízení. Co dál - mám popsat vyšší paměť, řádek A20, IQR,...? Nemám problém - udělám ti OS ve strojovém kódu v Bless a to pro zmíněná CPU v real-time i chráněném režimu.) Chceš stroják? CD máš int 16 - do vektoru v IVT. ED - máš skok do vektoru 32 - od offsetu v IBP... (Popsané v prvním quad wordu GDC - Global Descriptor Table.) Tak kde jsem kruci lhal? Vysolím ti tu BIOS jako nic - musím snad?