2023-09-06 19:58:40 +03:00
|
|
|
;; x, y, brightness
|
2023-08-02 20:16:43 +03:00
|
|
|
putpixel:
|
|
|
|
push ebp
|
|
|
|
mov ebp, esp
|
|
|
|
|
|
|
|
push eax
|
|
|
|
push ebx
|
|
|
|
push ecx
|
|
|
|
push edi
|
|
|
|
|
2023-09-08 12:02:02 +03:00
|
|
|
; check pixel is in screen
|
|
|
|
mov ebx, [ebp+12] ;y
|
|
|
|
cmp ebx, [mbootinfo.fb_height]
|
|
|
|
jge .done
|
|
|
|
mov ecx, [ebp+8] ;x
|
|
|
|
cmp ecx, [mbootinfo.fb_width]
|
|
|
|
jge .done
|
|
|
|
|
2023-08-02 20:16:43 +03:00
|
|
|
; Destination
|
|
|
|
mov edi, [mbootinfo.fb_addr]
|
|
|
|
mov eax, [mbootinfo.fb_pitch]
|
2023-09-08 12:02:02 +03:00
|
|
|
mul dword ebx ;y
|
2023-08-02 20:16:43 +03:00
|
|
|
add edi, eax
|
|
|
|
|
2023-09-08 12:02:02 +03:00
|
|
|
mov eax, ecx ;x
|
|
|
|
movzx ecx, byte [mbootinfo.fb_bytespp]
|
|
|
|
mul ecx
|
2023-08-02 20:16:43 +03:00
|
|
|
add edi, eax
|
|
|
|
|
|
|
|
|
2023-09-06 19:58:40 +03:00
|
|
|
; Brightness
|
|
|
|
mov eax, [ebp + 16]
|
|
|
|
|
|
|
|
; Poke videomemory
|
2023-09-08 12:02:02 +03:00
|
|
|
cld
|
|
|
|
rep stosb
|
2023-08-02 20:16:43 +03:00
|
|
|
.done:
|
|
|
|
pop edi
|
|
|
|
pop ecx
|
|
|
|
pop ebx
|
|
|
|
pop eax
|
|
|
|
|
|
|
|
pop ebp
|
|
|
|
ret
|