From 1b09418c60cd48d021f95a8c3f248a33421d776f Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Fri, 22 Jan 2021 20:57:29 -0800 Subject: 7542 - baremetal: support cursor on a grapheme So far we've drawn a space implicitly at the cursor. Now I allow drawing an arbitrary grapheme when drawing the cursor. But the caller has to specify what to draw. (The alternative would be for layer 103 to track every single grapheme on screen along with its color and any other future attributes, just to be able to paint and unpaint the background for a single character.) I've modified existing helpers for drawing multiple graphemes to always clear the final cursor position after they finish drawing. That seems reasonable for terminal-like applications. Applications that need to control the screen in a more random-access manner will need to track the grapheme at the cursor for themselves. --- baremetal/103grapheme.subx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'baremetal/103grapheme.subx') diff --git a/baremetal/103grapheme.subx b/baremetal/103grapheme.subx index 97a44315..b4750989 100644 --- a/baremetal/103grapheme.subx +++ b/baremetal/103grapheme.subx @@ -104,14 +104,16 @@ $cursor-position-on-real-screen:end: 5d/pop-to-ebp c3/return -set-cursor-position-on-real-screen: # x: int, y: int +# Caller is responsible for tracking what was on the screen at this position +# before, and making sure the cursor continues to show the same grapheme. +set-cursor-position-on-real-screen: # x: int, y: int, g: grapheme # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp # . save registers 50/push-eax # - (draw-grapheme-on-real-screen 0x20 *(ebp+8) *(ebp+0xc) 0 7) + (draw-grapheme-on-real-screen *(ebp+0x10) *(ebp+8) *(ebp+0xc) 0 7) # TODO: support fake screen; we currently assume 'screen' is always 0 (real) 8b/-> *(ebp+8) 0/r32/eax 89/<- *Real-screen-cursor-x 0/r32/eax -- cgit 1.4.1-2-gfad0