diff --git a/src/framebuffer.asm b/src/framebuffer.asm index 5204798..377ba9a 100644 --- a/src/framebuffer.asm +++ b/src/framebuffer.asm @@ -1,4 +1,4 @@ -;; x, y, brightness +;; x, y, r, g, b putpixel: push ebp mov ebp, esp @@ -28,12 +28,34 @@ putpixel: add edi, eax - ; Brightness - mov eax, [ebp + 16] ; Poke videomemory - cld - rep stosb + xor eax, eax + mov ebx, [ebp+16] + mov cl, [mbootinfo.fb_rpos] + shl ebx, cl + or eax, ebx + + mov ebx, [ebp+20] + mov cl, [mbootinfo.fb_gpos] + shl ebx, cl + or eax, ebx + + mov ebx, [ebp+24] + mov cl, [mbootinfo.fb_bpos] + shl ebx, cl + or eax, ebx + + cmp [mbootinfo.fb_bpp], 32 + jne .bpp24 + stosd + jmp .done +.bpp24: + stosb + shr eax, 8 + stosb + shr eax, 8 + stosb .done: pop edi pop ecx diff --git a/src/start32.asm b/src/start32.asm index 1aa15fc..1e3121f 100644 --- a/src/start32.asm +++ b/src/start32.asm @@ -13,7 +13,7 @@ MB_CHECKSUM equ -(MB_HEADER_MAGIC + MB_HEADER_FLAGS) VWIDTH equ 640 VHEIGHT equ 480 -VDEPTH equ 24 +VDEPTH equ 32 multiboot: dd MB_HEADER_MAGIC @@ -194,12 +194,11 @@ add esp, 4 add esp, 36 ;Clean reserved uitoa return string from stack ; Draw a test pixel to bottom right corner - mov eax, 0xff - mov ebx, 767 - mov ecx, 1023 push 0xff - push 479 - push 639 + push 0xff + push 0xff + push VHEIGHT-1 + push VWIDTH-1 call putpixel add esp, 3*4 @@ -210,13 +209,17 @@ rOSkalogodraw: mov ecx, 0 ;x .loop: lodsb - push eax - push ebx - push ecx + push eax ;b + push eax ;g + push eax ;r + push ebx ;y + push ecx ;x call putpixel pop ecx pop ebx pop eax + pop eax + pop eax inc ecx cmp byte cl, [roskalogo.w]