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: putpixel:
push ebp push ebp
mov ebp, esp mov ebp, esp
@ -28,12 +28,34 @@ putpixel:
add edi, eax add edi, eax
; Brightness
mov eax, [ebp + 16]
; Poke videomemory ; Poke videomemory
cld xor eax, eax
rep stosb 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: .done:
pop edi pop edi
pop ecx pop ecx

View file

@ -13,7 +13,7 @@ MB_CHECKSUM equ -(MB_HEADER_MAGIC + MB_HEADER_FLAGS)
VWIDTH equ 640 VWIDTH equ 640
VHEIGHT equ 480 VHEIGHT equ 480
VDEPTH equ 24 VDEPTH equ 32
multiboot: multiboot:
dd MB_HEADER_MAGIC dd MB_HEADER_MAGIC
@ -194,12 +194,11 @@ add esp, 4
add esp, 36 ;Clean reserved uitoa return string from stack add esp, 36 ;Clean reserved uitoa return string from stack
; Draw a test pixel to bottom right corner ; Draw a test pixel to bottom right corner
mov eax, 0xff
mov ebx, 767
mov ecx, 1023
push 0xff push 0xff
push 479 push 0xff
push 639 push 0xff
push VHEIGHT-1
push VWIDTH-1
call putpixel call putpixel
add esp, 3*4 add esp, 3*4
@ -210,13 +209,17 @@ rOSkalogodraw:
mov ecx, 0 ;x mov ecx, 0 ;x
.loop: .loop:
lodsb lodsb
push eax push eax ;b
push ebx push eax ;g
push ecx push eax ;r
push ebx ;y
push ecx ;x
call putpixel call putpixel
pop ecx pop ecx
pop ebx pop ebx
pop eax pop eax
pop eax
pop eax
inc ecx inc ecx
cmp byte cl, [roskalogo.w] cmp byte cl, [roskalogo.w]