diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-04-10 18:32:27 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-04-10 18:32:27 -0700 |
commit | 17f77da27d807ca4489a92a23506c88fb60bd89e (patch) | |
tree | 29c8648550f539d943bb32e72db8f7c5a6896c5f /shell | |
parent | 30018fd687400b57bc219a682bc4e1f32d66dcf1 (diff) | |
download | mu-17f77da27d807ca4489a92a23506c88fb60bd89e.tar.gz |
shell: fake screens
I just realized Mu has a pretty big weakness: writes to null pointers don't error out. Perhaps writes to address 0 do, but address 1 and so on don't? I need a slightly more sophisticated page table.
Diffstat (limited to 'shell')
-rw-r--r-- | shell/cell.mu | 2 | ||||
-rw-r--r-- | shell/print.mu | 12 |
2 files changed, 14 insertions, 0 deletions
diff --git a/shell/cell.mu b/shell/cell.mu index 11a16821..b2b302e6 100644 --- a/shell/cell.mu +++ b/shell/cell.mu @@ -121,6 +121,8 @@ fn allocate-screen _out: (addr handle cell) { var out/eax: (addr handle cell) <- copy _out allocate out var out-addr/eax: (addr cell) <- lookup *out + var dest-ah/ecx: (addr handle screen) <- get out-addr, screen-data + allocate dest-ah var type/ecx: (addr int) <- get out-addr, type copy-to *type, 5/screen } diff --git a/shell/print.mu b/shell/print.mu index 3dec6cff..307b9ffd 100644 --- a/shell/print.mu +++ b/shell/print.mu @@ -47,6 +47,18 @@ fn print-cell _in: (addr handle cell), out: (addr stream byte), trace: (addr tra trace-higher trace return } + compare *in-type, 5/primitive + { + break-if-!= + write out, "[screen " + var screen-ah/eax: (addr handle screen) <- get in-addr, screen-data + var screen/eax: (addr screen) <- lookup *screen-ah + var screen-addr/eax: int <- copy screen + write-int32-decimal out, screen-addr + write out, "]" + trace-higher trace + return + } } # debug helper |