6803 - RPN: typing a single word now works
This commit is contained in:
parent
a83cde9663
commit
abfd0bad29
|
@ -35,10 +35,7 @@ fn render-loop _self: (addr environment) {
|
|||
break-if-=
|
||||
process self, key
|
||||
var max-depth/eax: int <- compute-max-depth self
|
||||
print-string-to-real-screen "ZZ: "
|
||||
print-int32-decimal-to-real-screen max-depth
|
||||
print-string-to-real-screen "\n"
|
||||
#? render self, max-depth
|
||||
render self, max-depth
|
||||
loop
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +112,6 @@ fn render _env: (addr environment), max-depth: int {
|
|||
compare curr-word, 0
|
||||
break-if-=
|
||||
move-cursor screen, 3, curr-col
|
||||
print-word screen, curr-word
|
||||
curr-col <- render-stack screen, first-word, curr-word, max-depth, curr-col, cursor-word, cursor-col-a
|
||||
var next-word-ah/edx: (addr handle word) <- get curr-word, next
|
||||
curr-word <- lookup *next-word-ah
|
||||
|
@ -142,20 +138,8 @@ fn compute-max-depth _env: (addr environment) -> result/eax: int {
|
|||
# cursor-word
|
||||
var cursor-word-ah/esi: (addr handle word) <- get env, cursor-word
|
||||
var cursor-word/eax: (addr word) <- lookup *cursor-word-ah
|
||||
{
|
||||
var foo/eax: int <- copy cursor-word
|
||||
print-string-to-real-screen "cursor-word: "
|
||||
print-int32-hex-to-real-screen foo
|
||||
print-string-to-real-screen "\n"
|
||||
}
|
||||
# curr-word
|
||||
var curr-word/eax: (addr word) <- first-word cursor-word
|
||||
{
|
||||
var foo/eax: int <- copy curr-word
|
||||
print-string-to-real-screen "curr-word: "
|
||||
print-int32-hex-to-real-screen foo
|
||||
print-string-to-real-screen "\n"
|
||||
}
|
||||
# first-word
|
||||
var first-word: (addr word)
|
||||
copy-to first-word, curr-word
|
||||
|
@ -164,12 +148,6 @@ fn compute-max-depth _env: (addr environment) -> result/eax: int {
|
|||
{
|
||||
compare curr-word, 0
|
||||
break-if-=
|
||||
{
|
||||
var a/eax: int <- copy first-word
|
||||
print-string-to-real-screen "outside max-stack-depth: "
|
||||
print-int32-hex-to-real-screen a
|
||||
print-string-to-real-screen "\n"
|
||||
}
|
||||
var curr-max-depth/edi: int <- max-stack-depth first-word, curr-word
|
||||
compare curr-max-depth, out
|
||||
{
|
||||
|
@ -180,7 +158,5 @@ fn compute-max-depth _env: (addr environment) -> result/eax: int {
|
|||
curr-word <- lookup *next-word-ah
|
||||
loop
|
||||
}
|
||||
print-int32-decimal-to-real-screen out
|
||||
print-string-to-real-screen "\n"
|
||||
result <- copy out
|
||||
}
|
||||
|
|
|
@ -51,11 +51,7 @@ fn simplify in: (addr stream byte), out: (addr int-stack) {
|
|||
# Copy of 'simplify' that just tracks the maximum stack depth needed
|
||||
# Doesn't actually need to simulate the stack, since every word has a predictable effect.
|
||||
fn max-stack-depth first-word: (addr word), final-word: (addr word) -> result/edi: int {
|
||||
var a/eax: int <- copy first-word
|
||||
print-string-to-real-screen "inside max-stack-depth: "
|
||||
print-int32-hex-to-real-screen a
|
||||
print-string-to-real-screen "\n"
|
||||
var curr-word/esi: (addr word) <- copy first-word
|
||||
var curr-word/eax: (addr word) <- copy first-word
|
||||
var curr-depth/ecx: int <- copy 0
|
||||
result <- copy 0
|
||||
$max-stack-depth:word-loop: {
|
||||
|
@ -89,6 +85,13 @@ fn max-stack-depth first-word: (addr word), final-word: (addr word) -> result/ed
|
|||
break-if-<=
|
||||
result <- copy curr-depth
|
||||
}
|
||||
# if curr-word == final-word break
|
||||
compare curr-word, final-word
|
||||
break-if-=
|
||||
# curr-word = curr-word->next
|
||||
var next-word-ah/edx: (addr handle word) <- get curr-word, next
|
||||
curr-word <- lookup *next-word-ah
|
||||
#
|
||||
loop
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user