This commit is contained in:
Kartik K. Agaram 2015-02-10 17:51:57 -08:00
parent 49b6493a99
commit 5b67108713
2 changed files with 37 additions and 4 deletions

33
mu.arc
View File

@ -2582,6 +2582,39 @@
(cursor-on-host-to-next-line)
)
(init-fn cursor-down
(default-space:space-address <- new space:literal 30:literal)
(x:terminal-address <- next-input)
(height:integer-address <- get-address x:terminal-address/deref num-rows:offset)
{ begin
(break-unless x:terminal-address)
(row:integer-address <- get-address x:terminal-address/deref cursor-row:offset)
{ begin
(bottom?:boolean <- lesser-or-equal row:integer-address/deref height:integer-address/deref)
(break-if bottom?:boolean)
(row:integer-address/deref <- add row:integer-address/deref 1:literal)
}
(reply)
}
(cursor-down-on-host)
)
(init-fn cursor-up
(default-space:space-address <- new space:literal 30:literal)
(x:terminal-address <- next-input)
{ begin
(break-unless x:terminal-address)
(row:integer-address <- get-address x:terminal-address/deref cursor-row:offset)
{ begin
(top?:boolean <- lesser-or-equal row:integer-address/deref 0:literal)
(break-if top?:boolean)
(row:integer-address/deref <- subtract row:integer-address/deref 1:literal)
}
(reply)
}
(cursor-up-on-host)
)
(init-fn print-character
(default-space:space-address <- new space:literal 30:literal)
(x:terminal-address <- next-input)

View File

@ -248,7 +248,7 @@ schedule: done with routine")
(at-top?:boolean <- lesser-or-equal cursor-row:integer 0:literal)
(break-if at-top?:boolean)
(cursor-row:integer <- subtract cursor-row:integer 1:literal)
(cursor-up-on-host)
(cursor-up nil:literal/keyboard)
(jump next-key:offset) ; loop
}
{ begin
@ -257,7 +257,7 @@ schedule: done with routine")
(at-bottom?:boolean <- greater-or-equal cursor-row:integer len:integer)
(break-if at-bottom?:boolean)
(cursor-row:integer <- add cursor-row:integer 1:literal)
(cursor-down-on-host)
(cursor-down nil:literal/keyboard)
(jump next-key:offset) ; loop
}
; enter: expand current row
@ -269,14 +269,14 @@ schedule: done with routine")
(jump next-key:offset) ; loop
}
; debugging: print cursor-row
($print cursor-row:integer)
;? ($print cursor-row:integer) ;? 1
(loop)
}
; move cursor to bottom before exiting
{ begin
(at-bottom?:boolean <- greater-or-equal cursor-row:integer len:integer)
(break-if at-bottom?:boolean)
(cursor-down-on-host)
(cursor-down nil:literal/terminal)
(cursor-row:integer <- add cursor-row:integer 1:literal)
(loop)
}