Compare commits

...

2 Commits

Author SHA1 Message Date
Jarkko Toivanen a3a4156211
Framebuffer supports colour now 2024-01-26 18:29:07 +02:00
Jarkko Toivanen bbd80c4f78
Cleaning up 2024-01-26 18:23:51 +02:00
2 changed files with 39 additions and 47 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]
shld ebx, ebx, cl
or eax, ebx
mov ebx, [ebp+20]
mov cl, [mbootinfo.fb_gpos]
shld ebx, ebx, cl
or eax, ebx
mov ebx, [ebp+24]
mov cl, [mbootinfo.fb_bpos]
shld ebx, 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]
@ -229,39 +232,6 @@ rOSkalogodraw:
jmp hang
xor eax, eax
xor ebx, ebx
xor ecx, ecx
cloop:
push eax ;col
push ebx ;y
push ecx ;x
call putpixel
pop ecx
pop ebx
pop eax
inc ecx
cmp ecx, VWIDTH
jle cloop
xor ecx, ecx
inc ebx
cmp ebx, VHEIGHT
jle cloop
xor ebx, ebx
add eax, 5
cmp ax, 255
jle cloop
xor eax, eax
jmp cloop
jmp hang
hang:
push .msg