2021-02-21 06:37:44 +00:00
|
|
|
# Experimental Mu shell
|
|
|
|
# A Lisp with indent-sensitivity and infix, no macros. Commas are ignored.
|
|
|
|
|
|
|
|
fn main {
|
|
|
|
var sandbox-storage: sandbox
|
|
|
|
var sandbox/esi: (addr sandbox) <- address sandbox-storage
|
|
|
|
initialize-sandbox sandbox
|
2021-03-22 06:10:55 +00:00
|
|
|
load-sandbox-from-secondary-disk sandbox
|
2021-02-23 07:59:35 +00:00
|
|
|
var width/eax: int <- copy 0
|
|
|
|
var height/ecx: int <- copy 0
|
|
|
|
width, height <- screen-size 0/screen
|
2021-02-21 06:37:44 +00:00
|
|
|
{
|
2021-02-23 07:59:35 +00:00
|
|
|
render-sandbox 0/screen, sandbox, 2/x, 2/y, width, height
|
2021-02-21 06:45:10 +00:00
|
|
|
{
|
|
|
|
var key/eax: byte <- read-key 0/keyboard
|
|
|
|
compare key, 0
|
|
|
|
loop-if-=
|
|
|
|
# no way to quit right now; just reboot
|
2021-02-22 05:27:42 +00:00
|
|
|
edit-sandbox sandbox, key
|
2021-02-21 06:45:10 +00:00
|
|
|
}
|
2021-02-21 06:37:44 +00:00
|
|
|
loop
|
|
|
|
}
|
|
|
|
}
|
2021-03-22 06:10:55 +00:00
|
|
|
|
|
|
|
# Read a null-terminated sequence of keys from secondary disk and load them
|
|
|
|
# into sandbox.
|
|
|
|
fn load-sandbox-from-secondary-disk _self: (addr sandbox) {
|
|
|
|
var self/esi: (addr sandbox) <- copy _self
|
|
|
|
var s-storage: (stream byte 0x200)
|
|
|
|
var s/ebx: (addr stream byte) <- address s-storage
|
|
|
|
load-sector-string-from-primary-bus-secondary-drive 0/lbalo, 0/lbamid, 0/lbahi, s
|
|
|
|
{
|
|
|
|
var done?/eax: boolean <- stream-empty? s
|
|
|
|
compare done?, 0/false
|
|
|
|
break-if-!=
|
|
|
|
var key/eax: byte <- read-byte s
|
|
|
|
compare key, 0/null
|
|
|
|
break-if-=
|
|
|
|
edit-sandbox self, key
|
|
|
|
loop
|
|
|
|
}
|
|
|
|
}
|