From d6d28b8c94b2611407a711899c05eeba86e0be80 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 8 Apr 2021 22:19:24 -0700 Subject: shell: create space to display globals --- shell/global.mu | 4 ++++ shell/main.mu | 6 ++---- shell/sandbox.mu | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) (limited to 'shell') diff --git a/shell/global.mu b/shell/global.mu index c87198ee..32142633 100644 --- a/shell/global.mu +++ b/shell/global.mu @@ -22,6 +22,10 @@ fn initialize-globals _self: (addr global-table) { append-primitive self, "cons" } +fn render-globals screen: (addr screen), _self: (addr global-table), xmin: int, ymin: int, xmax: int, ymax: int { + clear-rect screen, xmin, ymin, xmax, ymax, 0x12/bg=grey +} + fn append-primitive _self: (addr global-table), name: (addr array byte) { var self/esi: (addr global-table) <- copy _self var final-index-addr/ecx: (addr int) <- get self, final-index diff --git a/shell/main.mu b/shell/main.mu index 29c815dc..04f64011 100644 --- a/shell/main.mu +++ b/shell/main.mu @@ -9,11 +9,9 @@ fn main screen: (addr screen), keyboard: (addr keyboard), data-disk: (addr disk) var sandbox/esi: (addr sandbox) <- address sandbox-storage initialize-sandbox sandbox load-sandbox data-disk, sandbox - var width/eax: int <- copy 0 - var height/ecx: int <- copy 0 - width, height <- screen-size screen { - render-sandbox screen, sandbox, 2/x, 2/y, width, height + render-globals screen, globals, 0/x, 0/y, 0x40/xmax, 0x30/screen-height + render-sandbox screen, sandbox, 0x40/x, 0/y, 0x80/screen-width, 0x30/screen-height { var key/eax: byte <- read-key keyboard compare key, 0 diff --git a/shell/sandbox.mu b/shell/sandbox.mu index 2b612a13..06bf3656 100644 --- a/shell/sandbox.mu +++ b/shell/sandbox.mu @@ -39,7 +39,7 @@ fn allocate-sandbox-with _out: (addr handle sandbox), s: (addr array byte) { ## fn render-sandbox screen: (addr screen), _self: (addr sandbox), xmin: int, ymin: int, xmax: int, ymax: int { - clear-screen screen + clear-rect screen, xmin, ymin, xmax, ymax, 0/bg=black var self/esi: (addr sandbox) <- copy _self # data var data-ah/eax: (addr handle gap-buffer) <- get self, data -- cgit 1.4.1-2-gfad0