Framebuffer supports colour now

This commit is contained in:
Jarkko Toivanen 2024-01-26 18:29:07 +02:00
parent bbd80c4f78
commit bcf49f4fef
Signed by: jt
GPG key ID: 9151B109B73ECAD5
2 changed files with 39 additions and 14 deletions

View file

@ -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

View file

@ -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]