7537 - baremetal: start of cursor support

This commit is contained in:
Kartik Agaram 2021-01-19 22:17:05 -08:00
parent 6ce43fce4f
commit 7363c6dfd3
3 changed files with 10 additions and 7 deletions

View File

@ -5,7 +5,7 @@
== code
draw-grapheme-on-real-screen: # g: grapheme, x: int, y: int, color: int
draw-grapheme-on-real-screen: # g: grapheme, x: int, y: int, color: int, background-color: int
# . prologue
55/push-ebp
89/<- %ebp 4/r32/esp
@ -45,14 +45,14 @@ draw-grapheme-on-real-screen: # g: grapheme, x: int, y: int, color: int
7c/jump-if-< break/disp8
# shift LSB from row-bitmap into carry flag (CF)
c1 5/subop/shift-right-logical %ebx 1/imm8
# if LSB, draw a pixel
# if LSB, draw a pixel in the given color
{
73/jump-if-not-CF break/disp8
(pixel-on-real-screen %eax %edx *(ebp+0x14))
eb/jump $draw-grapheme-on-real-screen:continue/disp8
}
# otherwise draw a black pixel
(pixel-on-real-screen %eax %edx 0)
# otherwise use the background color
(pixel-on-real-screen %eax %edx *(ebp+0x18))
$draw-grapheme-on-real-screen:continue:
# --x
48/decrement-eax

View File

@ -1,6 +1,6 @@
# screen
sig pixel-on-real-screen x: int, y: int, color: int
sig draw-grapheme-on-real-screen g: grapheme, x: int, y: int, color: int
sig draw-grapheme-on-real-screen g: grapheme, x: int, y: int, color: int, background-color: int
sig cursor-position-on-real-screen -> _/eax: int, _/ecx: int
sig set-cursor-position-on-real-screen x: int, y: int

View File

@ -1,4 +1,5 @@
# Screen primitives for character-oriented output.
# Testable primitives for writing text to screen.
# (Mu doesn't yet have testable primitives for graphics.)
#
# Unlike the top-level, this text mode has no scrolling.
@ -61,11 +62,13 @@ fn screen-size screen: (addr screen) -> _/eax: int, _/ecx: int {
return width, height
}
# testable screen primitive
# background color isn't configurable yet
fn draw-grapheme screen: (addr screen), g: grapheme, x: int, y: int, color: int {
{
compare screen, 0
break-if-!=
draw-grapheme-on-real-screen g, x, y, color
draw-grapheme-on-real-screen g, x, y, color, 0
return
}
# fake screen