6699 - start building out fake screen
We now have all existing apps and prototypes going through the dependency-injected wrapper, even though it doesn't actually implement the fake screen yet.
This commit is contained in:
parent
59a2e363f5
commit
6b343a82f2
|
@ -14,7 +14,7 @@ enable-screen-grid-mode:
|
|||
(write 2 Esc)
|
||||
(write 2 "[?1049h")
|
||||
#
|
||||
(clear-screen)
|
||||
(clear-real-screen)
|
||||
$enable-screen-grid-mode:end:
|
||||
# . epilogue
|
||||
89/<- %esp 5/r32/ebp
|
||||
|
@ -34,7 +34,7 @@ $enable-screen-type-mode:end:
|
|||
5d/pop-to-ebp
|
||||
c3/return
|
||||
|
||||
screen-size: # -> nrows/eax: int, ncols/ecx: int
|
||||
real-screen-size: # -> nrows/eax: int, ncols/ecx: int
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
89/<- %ebp 4/r32/esp
|
||||
|
@ -59,7 +59,7 @@ screen-size: # -> nrows/eax: int, ncols/ecx: int
|
|||
81 4/subop/and %eax 0xffff/imm32
|
||||
8b/-> *esi 1/r32/ecx
|
||||
c1/shift 5/subop/logical-right %ecx 0x10/imm8
|
||||
$screen-size:end:
|
||||
$real-screen-size:end:
|
||||
# . reclaim locals
|
||||
81 0/subop/add %esp 0x40/imm32
|
||||
# . restore registers
|
||||
|
@ -72,7 +72,7 @@ $screen-size:end:
|
|||
5d/pop-to-ebp
|
||||
c3/return
|
||||
|
||||
clear-screen:
|
||||
clear-real-screen:
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
89/<- %ebp 4/r32/esp
|
||||
|
@ -81,14 +81,14 @@ clear-screen:
|
|||
(write 2 "[H")
|
||||
(write 2 Esc)
|
||||
(write 2 "[2J")
|
||||
$clear-screen:end:
|
||||
$clear-real-screen:end:
|
||||
# . epilogue
|
||||
89/<- %esp 5/r32/ebp
|
||||
5d/pop-to-ebp
|
||||
c3/return
|
||||
|
||||
# row and col count from the top-left as (1, 1)
|
||||
move-cursor-on-screen: # row: int, column: int
|
||||
move-cursor-on-real-screen: # row: int, column: int
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
89/<- %ebp 4/r32/esp
|
||||
|
@ -109,7 +109,7 @@ move-cursor-on-screen: # row: int, column: int
|
|||
(write %ecx "H")
|
||||
# flush
|
||||
(write-stream 2 %ecx)
|
||||
$move-cursor-on-screen:end:
|
||||
$move-cursor-on-real-screen:end:
|
||||
# . reclaim locals
|
||||
81 0/subop/add %esp 0x2c/imm32
|
||||
# . restore registers
|
||||
|
@ -119,19 +119,19 @@ $move-cursor-on-screen:end:
|
|||
5d/pop-to-ebp
|
||||
c3/return
|
||||
|
||||
print-string-to-screen: # s: (addr array byte)
|
||||
print-string-to-real-screen: # s: (addr array byte)
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
89/<- %ebp 4/r32/esp
|
||||
#
|
||||
(write 2 *(ebp+8))
|
||||
$print-string-to-screen:end:
|
||||
$print-string-to-real-screen:end:
|
||||
# . epilogue
|
||||
89/<- %esp 5/r32/ebp
|
||||
5d/pop-to-ebp
|
||||
c3/return
|
||||
|
||||
print-byte-to-screen: # c: byte
|
||||
print-byte-to-real-screen: # c: byte
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
89/<- %ebp 4/r32/esp
|
||||
|
@ -142,7 +142,7 @@ print-byte-to-screen: # c: byte
|
|||
68/push 4/imm32/size
|
||||
89/<- %ecx 4/r32/esp
|
||||
(write 2 %ecx)
|
||||
$print-byte-to-screen:end:
|
||||
$print-byte-to-real-screen:end:
|
||||
# . reclaim locals
|
||||
81 0/subop/add %esp 8/imm32
|
||||
# . restore registers
|
||||
|
@ -152,20 +152,20 @@ $print-byte-to-screen:end:
|
|||
5d/pop-to-ebp
|
||||
c3/return
|
||||
|
||||
print-int32-hex-to-screen: # n: int
|
||||
print-int32-hex-to-real-screen: # n: int
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
89/<- %ebp 4/r32/esp
|
||||
#
|
||||
(write-int32-hex-buffered Stdout *(ebp+8))
|
||||
(flush Stdout)
|
||||
$print-int32-hex-to-screen:end:
|
||||
$print-int32-hex-to-real-screen:end:
|
||||
# . epilogue
|
||||
89/<- %esp 5/r32/ebp
|
||||
5d/pop-to-ebp
|
||||
c3/return
|
||||
|
||||
reset-formatting-on-screen:
|
||||
reset-formatting-on-real-screen:
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
89/<- %ebp 4/r32/esp
|
||||
|
@ -174,13 +174,13 @@ reset-formatting-on-screen:
|
|||
(write 2 "(B")
|
||||
(write 2 Esc)
|
||||
(write 2 "[m")
|
||||
$reset-formatting-on-screen:end:
|
||||
$reset-formatting-on-real-screen:end:
|
||||
# . epilogue
|
||||
89/<- %esp 5/r32/ebp
|
||||
5d/pop-to-ebp
|
||||
c3/return
|
||||
|
||||
start-color-on-screen: # fg: int, bg: int
|
||||
start-color-on-real-screen: # fg: int, bg: int
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
89/<- %ebp 4/r32/esp
|
||||
|
@ -205,7 +205,7 @@ start-color-on-screen: # fg: int, bg: int
|
|||
(write %ecx "m")
|
||||
# flush
|
||||
(write-stream 2 %ecx)
|
||||
$start-color-on-screen:end:
|
||||
$start-color-on-real-screen:end:
|
||||
# . reclaim locals
|
||||
81 0/subop/add %esp 0x2c/imm32
|
||||
# . restore registers
|
||||
|
@ -215,73 +215,73 @@ $start-color-on-screen:end:
|
|||
5d/pop-to-ebp
|
||||
c3/return
|
||||
|
||||
start-bold-on-screen:
|
||||
start-bold-on-real-screen:
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
89/<- %ebp 4/r32/esp
|
||||
#
|
||||
(write 2 Esc)
|
||||
(write 2 "[1m")
|
||||
$start-bold-on-screen:end:
|
||||
$start-bold-on-real-screen:end:
|
||||
# . epilogue
|
||||
89/<- %esp 5/r32/ebp
|
||||
5d/pop-to-ebp
|
||||
c3/return
|
||||
|
||||
start-underline-on-screen:
|
||||
start-underline-on-real-screen:
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
89/<- %ebp 4/r32/esp
|
||||
#
|
||||
(write 2 Esc)
|
||||
(write 2 "[4m")
|
||||
$start-underline-on-screen:end:
|
||||
$start-underline-on-real-screen:end:
|
||||
# . epilogue
|
||||
89/<- %esp 5/r32/ebp
|
||||
5d/pop-to-ebp
|
||||
c3/return
|
||||
|
||||
start-reverse-video-on-screen:
|
||||
start-reverse-video-on-real-screen:
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
89/<- %ebp 4/r32/esp
|
||||
#
|
||||
(write 2 Esc)
|
||||
(write 2 "[7m")
|
||||
$start-reverse-video-on-screen:end:
|
||||
$start-reverse-video-on-real-screen:end:
|
||||
# . epilogue
|
||||
89/<- %esp 5/r32/ebp
|
||||
5d/pop-to-ebp
|
||||
c3/return
|
||||
|
||||
# might require enabling blinking in your terminal program
|
||||
start-blinking-on-screen:
|
||||
start-blinking-on-real-screen:
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
89/<- %ebp 4/r32/esp
|
||||
#
|
||||
(write 2 Esc)
|
||||
(write 2 "[5m")
|
||||
$start-blinking-on-screen:end:
|
||||
$start-blinking-on-real-screen:end:
|
||||
# . epilogue
|
||||
89/<- %esp 5/r32/ebp
|
||||
5d/pop-to-ebp
|
||||
c3/return
|
||||
|
||||
hide-cursor-on-screen:
|
||||
hide-cursor-on-real-screen:
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
89/<- %ebp 4/r32/esp
|
||||
#
|
||||
(write 2 Esc)
|
||||
(write 2 "[?25l")
|
||||
$hide-cursor-on-screen:end:
|
||||
$hide-cursor-on-real-screen:end:
|
||||
# . epilogue
|
||||
89/<- %esp 5/r32/ebp
|
||||
5d/pop-to-ebp
|
||||
c3/return
|
||||
|
||||
show-cursor-on-screen:
|
||||
show-cursor-on-real-screen:
|
||||
# . prologue
|
||||
55/push-ebp
|
||||
89/<- %ebp 4/r32/esp
|
||||
|
@ -290,7 +290,7 @@ show-cursor-on-screen:
|
|||
(write 2 "[?12l")
|
||||
(write 2 Esc)
|
||||
(write 2 "[?25h")
|
||||
$show-cursor-on-screen:end:
|
||||
$show-cursor-on-real-screen:end:
|
||||
# . epilogue
|
||||
89/<- %esp 5/r32/ebp
|
||||
5d/pop-to-ebp
|
||||
|
|
32
400.mu
32
400.mu
|
@ -116,8 +116,8 @@ sig emit out: (addr buffered-file), word: (addr slice), width: int
|
|||
#sig get-or-insert table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int, ad: (addr allocation-descriptor) -> result/eax: (addr T)
|
||||
#sig get-or-insert-handle table: (addr stream {(handle array byte), T}), key: (handle array byte), row-size: int -> result/eax: (addr T)
|
||||
#sig get-or-insert-slice table: (addr stream {(handle array byte), T}), key: (addr slice), row-size: int, ad: (addr allocation-descriptor) -> result/eax: (addr T)
|
||||
#sig get-or-stop table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int,
|
||||
#sig get-slice-or-stop table: (addr stream {(handle array byte), _}), key: (addr slice), row-size: int,
|
||||
#sig get-or-stop table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int
|
||||
#sig get-slice-or-stop table: (addr stream {(handle array byte), _}), key: (addr slice), row-size: int
|
||||
#sig maybe-get table: (addr stream {(handle array byte), T}), key: (addr array byte), row-size: int -> result/eax: (addr T)
|
||||
#sig maybe-get-slice table: (addr stream {(handle array byte), T}), key: (addr slice), row-size: int -> result/eax: (addr T)
|
||||
sig slurp f: (addr buffered-file), s: (addr stream byte)
|
||||
|
@ -138,20 +138,20 @@ sig kernel-string-to-string ad: (addr allocation-descriptor), in: (addr kernel-s
|
|||
sig kernel-string-length in: (addr kernel-string) -> result/eax: int
|
||||
sig enable-screen-grid-mode
|
||||
sig enable-screen-type-mode
|
||||
sig screen-size -> nrows/eax: int, ncols/ecx: int
|
||||
sig clear-screen
|
||||
sig move-cursor-on-screen row: int, column: int
|
||||
sig print-string-to-screen s: (addr array byte)
|
||||
sig print-byte-to-screen c: byte
|
||||
sig print-int32-hex-to-screen n: int
|
||||
sig reset-formatting-on-screen
|
||||
sig start-color-on-screen fg: int, bg: int
|
||||
sig start-bold-on-screen
|
||||
sig start-underline-on-screen
|
||||
sig start-reverse-video-on-screen
|
||||
sig start-blinking-on-screen
|
||||
sig hide-cursor-on-screen
|
||||
sig show-cursor-on-screen
|
||||
sig real-screen-size -> nrows/eax: int, ncols/ecx: int
|
||||
sig clear-real-screen
|
||||
sig move-cursor-on-real-screen row: int, column: int
|
||||
sig print-string-to-real-screen s: (addr array byte)
|
||||
sig print-byte-to-real-screen c: byte
|
||||
sig print-int32-hex-to-real-screen n: int
|
||||
sig reset-formatting-on-real-screen
|
||||
sig start-color-on-real-screen fg: int, bg: int
|
||||
sig start-bold-on-real-screen
|
||||
sig start-underline-on-real-screen
|
||||
sig start-reverse-video-on-real-screen
|
||||
sig start-blinking-on-real-screen
|
||||
sig hide-cursor-on-real-screen
|
||||
sig show-cursor-on-real-screen
|
||||
sig enable-keyboard-immediate-mode
|
||||
sig enable-keyboard-type-mode
|
||||
sig read-key -> result/eax: byte
|
||||
|
|
|
@ -0,0 +1,263 @@
|
|||
# Wrappers for real screen primitives that can be passed in a fake screen.
|
||||
|
||||
type screen {
|
||||
num-rows: int
|
||||
num-cols: int
|
||||
data: (handle array screen-cell)
|
||||
pending-scroll?: boolean
|
||||
top-index: int
|
||||
cursor-row: int
|
||||
cursor-col: int
|
||||
cursor-hide?: boolean
|
||||
curr-attributes: screen-cell
|
||||
}
|
||||
|
||||
type screen-cell {
|
||||
color: int
|
||||
background-color: int
|
||||
bold?: boolean
|
||||
underline?: boolean
|
||||
reverse?: boolean
|
||||
blink?: boolean
|
||||
}
|
||||
|
||||
fn initialize-screen screen: (addr screen), nrows: int, ncols: int {
|
||||
var screen-addr/esi: (addr screen) <- copy screen
|
||||
var tmp/eax: int <- copy 0
|
||||
var dest/edi: (addr int) <- copy 0
|
||||
# screen->num-rows = nrows
|
||||
dest <- get screen-addr, num-rows
|
||||
tmp <- copy nrows
|
||||
copy-to *dest, tmp
|
||||
# screen->num-cols = ncols
|
||||
dest <- get screen-addr, num-cols
|
||||
tmp <- copy ncols
|
||||
copy-to *dest, tmp
|
||||
# screen->data = new screen-cell[nrows*ncols]
|
||||
{
|
||||
var data-addr/edi: (addr handle array screen-cell) <- get screen-addr, data
|
||||
tmp <- multiply nrows
|
||||
populate data-addr, tmp
|
||||
}
|
||||
# screen->cursor-row = 1
|
||||
dest <- get screen-addr, cursor-row
|
||||
copy-to *dest, 1
|
||||
# screen->cursor-col = 1
|
||||
dest <- get screen-addr, cursor-col
|
||||
copy-to *dest, 1
|
||||
}
|
||||
|
||||
fn screen-size screen: (addr screen) -> nrows/eax: int, ncols/ecx: int {
|
||||
$screen-size:body: {
|
||||
compare screen, 0
|
||||
{
|
||||
break-if-!=
|
||||
nrows, ncols <- real-screen-size
|
||||
break $screen-size:body
|
||||
}
|
||||
{
|
||||
break-if-=
|
||||
# fake screen
|
||||
var screen-addr/esi: (addr screen) <- copy screen
|
||||
var tmp/edx: (addr int) <- get screen-addr, num-rows
|
||||
nrows <- copy *tmp
|
||||
tmp <- get screen-addr, num-cols
|
||||
ncols <- copy *tmp
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn clear-screen screen: (addr screen) {
|
||||
$clear-screen:body: {
|
||||
compare screen, 0
|
||||
{
|
||||
break-if-!=
|
||||
clear-real-screen
|
||||
break $clear-screen:body
|
||||
}
|
||||
{
|
||||
break-if-=
|
||||
# fake screen
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn move-cursor screen: (addr screen), row: int, column: int {
|
||||
$move-cursor:body: {
|
||||
compare screen, 0
|
||||
{
|
||||
break-if-!=
|
||||
move-cursor-on-real-screen row, column
|
||||
break $move-cursor:body
|
||||
}
|
||||
{
|
||||
break-if-=
|
||||
# fake screen
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn print-string screen: (addr screen), s: (addr array byte) {
|
||||
$print-string:body: {
|
||||
compare screen, 0
|
||||
{
|
||||
break-if-!=
|
||||
print-string-to-real-screen s
|
||||
break $print-string:body
|
||||
}
|
||||
{
|
||||
break-if-=
|
||||
# fake screen
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn print-byte screen: (addr screen), c: byte {
|
||||
$print-byte:body: {
|
||||
compare screen, 0
|
||||
{
|
||||
break-if-!=
|
||||
print-byte-to-real-screen c
|
||||
break $print-byte:body
|
||||
}
|
||||
{
|
||||
break-if-=
|
||||
# fake screen
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn print-int32-hex screen: (addr screen), n: int {
|
||||
$print-int32-hex:body: {
|
||||
compare screen, 0
|
||||
{
|
||||
break-if-!=
|
||||
print-int32-hex-to-real-screen n
|
||||
break $print-int32-hex:body
|
||||
}
|
||||
{
|
||||
break-if-=
|
||||
# fake screen
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn reset-formatting screen: (addr screen) {
|
||||
$reset-formatting:body: {
|
||||
compare screen, 0
|
||||
{
|
||||
break-if-!=
|
||||
reset-formatting-on-real-screen
|
||||
break $reset-formatting:body
|
||||
}
|
||||
{
|
||||
break-if-=
|
||||
# fake screen
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn start-color screen: (addr screen), fg: int, bg: int {
|
||||
$start-color:body: {
|
||||
compare screen, 0
|
||||
{
|
||||
break-if-!=
|
||||
start-color-on-real-screen fg, bg
|
||||
break $start-color:body
|
||||
}
|
||||
{
|
||||
break-if-=
|
||||
# fake screen
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn start-bold screen: (addr screen) {
|
||||
$start-bold:body: {
|
||||
compare screen, 0
|
||||
{
|
||||
break-if-!=
|
||||
start-bold-on-real-screen
|
||||
break $start-bold:body
|
||||
}
|
||||
{
|
||||
break-if-=
|
||||
# fake screen
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn start-underline screen: (addr screen) {
|
||||
$start-underline:body: {
|
||||
compare screen, 0
|
||||
{
|
||||
break-if-!=
|
||||
start-underline-on-real-screen
|
||||
break $start-underline:body
|
||||
}
|
||||
{
|
||||
break-if-=
|
||||
# fake screen
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn start-reverse-video screen: (addr screen) {
|
||||
$start-reverse-video:body: {
|
||||
compare screen, 0
|
||||
{
|
||||
break-if-!=
|
||||
start-reverse-video-on-real-screen
|
||||
break $start-reverse-video:body
|
||||
}
|
||||
{
|
||||
break-if-=
|
||||
# fake screen
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn start-blinking screen: (addr screen) {
|
||||
$start-blinking:body: {
|
||||
compare screen, 0
|
||||
{
|
||||
break-if-!=
|
||||
start-blinking-on-real-screen
|
||||
break $start-blinking:body
|
||||
}
|
||||
{
|
||||
break-if-=
|
||||
# fake screen
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn hide-cursor screen: (addr screen) {
|
||||
$hide-cursor:body: {
|
||||
compare screen, 0
|
||||
{
|
||||
break-if-!=
|
||||
hide-cursor-on-real-screen
|
||||
break $hide-cursor:body
|
||||
}
|
||||
{
|
||||
break-if-=
|
||||
# fake screen
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn show-cursor screen: (addr screen) {
|
||||
$show-cursor:body: {
|
||||
compare screen, 0
|
||||
{
|
||||
break-if-!=
|
||||
show-cursor-on-real-screen
|
||||
break $show-cursor:body
|
||||
}
|
||||
{
|
||||
break-if-=
|
||||
# fake screen
|
||||
}
|
||||
}
|
||||
}
|
|
@ -35,19 +35,19 @@
|
|||
fn main -> exit-status/ebx: int {
|
||||
var look/esi: byte <- copy 0 # lookahead
|
||||
var n/eax: int <- copy 0 # result of each expression
|
||||
print-string-to-screen "press ctrl-c or ctrl-d to exit\n"
|
||||
print-string 0, "press ctrl-c or ctrl-d to exit\n"
|
||||
# read-eval-print loop
|
||||
{
|
||||
# print prompt
|
||||
print-string-to-screen "> "
|
||||
print-string 0, "> "
|
||||
# read and eval
|
||||
n, look <- simplify # we explicitly thread 'look' everywhere
|
||||
# if (look == 0) break
|
||||
compare look, 0
|
||||
break-if-=
|
||||
# print
|
||||
print-int32-hex-to-screen n
|
||||
print-string-to-screen "\n"
|
||||
print-int32-hex 0, n
|
||||
print-string 0, "\n"
|
||||
#
|
||||
loop
|
||||
}
|
||||
|
@ -249,7 +249,7 @@ fn get-char -> look/esi: byte {
|
|||
compare look, 0
|
||||
{
|
||||
break-if-!=
|
||||
print-string-to-screen "^D\n"
|
||||
print-string 0, "^D\n"
|
||||
syscall_exit
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ fn main args-on-stack: (addr array (addr array byte)) -> exit-status/ebx: int {
|
|||
enable-screen-grid-mode
|
||||
var nrows/eax: int <- copy 0
|
||||
var ncols/ecx: int <- copy 0
|
||||
nrows, ncols <- screen-size
|
||||
nrows, ncols <- screen-size 0
|
||||
enable-keyboard-immediate-mode
|
||||
{
|
||||
render file, nrows, ncols
|
||||
|
@ -65,7 +65,7 @@ fn render in: (addr buffered-file), nrows: int, ncols: int {
|
|||
var leftcol/edx: int <- copy 5 # page-margin
|
||||
var rightcol/ebx: int <- copy leftcol
|
||||
rightcol <- add 0x40 # page-width = 64 characters
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
{
|
||||
compare rightcol, ncols
|
||||
break-if->=
|
||||
|
@ -86,7 +86,7 @@ $line-loop: {
|
|||
compare row, botrow
|
||||
break-if->=
|
||||
var col/edx: int <- copy leftcol
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
{
|
||||
compare col, rightcol
|
||||
break-if->=
|
||||
|
@ -96,7 +96,7 @@ $line-loop: {
|
|||
update-attributes c, r
|
||||
compare c, 0xa # newline
|
||||
break-if-= # no need to print newlines
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
col <- increment
|
||||
loop
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ $update-attributes:check-state: {
|
|||
{
|
||||
break-if-!=
|
||||
# r->current-state == 0 && c == '*'
|
||||
start-bold-on-screen
|
||||
start-bold 0
|
||||
copy-to *state, 1
|
||||
break $update-attributes:check-state
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ $update-attributes:check-state: {
|
|||
{
|
||||
break-if-!=
|
||||
# r->current-state == 0 && c == '_'
|
||||
start-bold-on-screen
|
||||
start-bold 0
|
||||
copy-to *state, 1
|
||||
break $update-attributes:check-state
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ $update-attributes:check-state: {
|
|||
{
|
||||
break-if-!=
|
||||
# r->current-state == 1 && c == '*'
|
||||
reset-formatting-on-screen
|
||||
reset-formatting 0
|
||||
copy-to *state, 0
|
||||
break $update-attributes:check-state
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ $update-attributes:check-state: {
|
|||
{
|
||||
break-if-!=
|
||||
# r->current-state == 1 && c == '_'
|
||||
reset-formatting-on-screen
|
||||
reset-formatting 0
|
||||
copy-to *state, 0
|
||||
break $update-attributes:check-state
|
||||
}
|
||||
|
@ -159,11 +159,11 @@ fn clear toprow: int, leftcol: int, botrow: int, rightcol: int {
|
|||
compare row, botrow
|
||||
break-if->=
|
||||
var col/edx: int <- copy leftcol
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
{
|
||||
compare col, rightcol
|
||||
break-if->=
|
||||
print-string-to-screen " "
|
||||
print-string 0, " "
|
||||
col <- increment
|
||||
loop
|
||||
}
|
||||
|
@ -176,6 +176,6 @@ fn dump in: (addr buffered-file) {
|
|||
var c/eax: byte <- read-byte-buffered in
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ $main-body: {
|
|||
compare n, 1
|
||||
{
|
||||
break-if->
|
||||
print-string-to-screen "usage: parse-int <integer>\n"
|
||||
print-string 0, "usage: parse-int <integer>\n"
|
||||
exit-status <- copy 1
|
||||
break $main-body
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ $main-body: {
|
|||
compare n, 1
|
||||
{
|
||||
break-if->
|
||||
print-string-to-screen "usage: cat <filename>\n"
|
||||
print-string 0, "usage: cat <filename>\n"
|
||||
break $main-body
|
||||
}
|
||||
{
|
||||
|
@ -31,7 +31,7 @@ $main-body: {
|
|||
var c/eax: byte <- read-byte-buffered in-addr
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
}
|
||||
|
|
32
apps/tui.mu
32
apps/tui.mu
|
@ -7,28 +7,28 @@
|
|||
fn main -> exit-status/ebx: int {
|
||||
var nrows/eax: int <- copy 0
|
||||
var ncols/ecx: int <- copy 0
|
||||
nrows, ncols <- screen-size
|
||||
nrows, ncols <- screen-size 0
|
||||
enable-screen-grid-mode
|
||||
move-cursor-on-screen 5, 0x22
|
||||
start-color-on-screen 1, 0x7a
|
||||
start-blinking-on-screen
|
||||
print-string-to-screen "Hello world!"
|
||||
reset-formatting-on-screen
|
||||
move-cursor-on-screen 6, 0x22
|
||||
print-string-to-screen "tty dimensions: "
|
||||
print-int32-hex-to-screen nrows
|
||||
print-string-to-screen " rows, "
|
||||
print-int32-hex-to-screen ncols
|
||||
print-string-to-screen " rows\n"
|
||||
move-cursor 0, 5, 0x22
|
||||
start-color 0, 1, 0x7a
|
||||
start-blinking 0
|
||||
print-string 0, "Hello world!"
|
||||
reset-formatting 0
|
||||
move-cursor 0, 6, 0x22
|
||||
print-string 0, "tty dimensions: "
|
||||
print-int32-hex 0, nrows
|
||||
print-string 0, " rows, "
|
||||
print-int32-hex 0, ncols
|
||||
print-string 0, " rows\n"
|
||||
|
||||
print-string-to-screen "press a key to see its code: "
|
||||
print-string 0, "press a key to see its code: "
|
||||
enable-keyboard-immediate-mode
|
||||
var x/eax: byte <- read-key
|
||||
enable-keyboard-type-mode
|
||||
enable-screen-type-mode
|
||||
print-string-to-screen "You pressed "
|
||||
print-string 0, "You pressed "
|
||||
var x-int/eax: int <- copy x
|
||||
print-int32-hex-to-screen x-int
|
||||
print-string-to-screen "\n"
|
||||
print-int32-hex 0, x-int
|
||||
print-string 0, "\n"
|
||||
exit-status <- copy 0
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ fn dump in: (addr buffered-file) {
|
|||
var c/eax: byte <- read-byte-buffered in
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ fn main args: (addr array (addr array byte)) -> exit-status/ebx: int {
|
|||
enable-screen-grid-mode
|
||||
var nrows/eax: int <- copy 0
|
||||
var ncols/ecx: int <- copy 0
|
||||
nrows, ncols <- screen-size
|
||||
nrows, ncols <- screen-size 0
|
||||
enable-keyboard-immediate-mode
|
||||
{
|
||||
render file, nrows, ncols
|
||||
|
@ -44,7 +44,7 @@ fn render in: (addr buffered-file), nrows: int, ncols: int {
|
|||
var leftcol/edx: int <- copy 5 # page-margin
|
||||
var rightcol/ebx: int <- copy leftcol
|
||||
rightcol <- add 0x40 # page-width = 64 characters
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
{
|
||||
compare rightcol, ncols
|
||||
break-if->=
|
||||
|
@ -64,7 +64,7 @@ $line-loop: {
|
|||
compare row, botrow
|
||||
break-if->=
|
||||
var col/edx: int <- copy leftcol
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
{
|
||||
compare col, rightcol
|
||||
break-if->=
|
||||
|
@ -75,7 +75,7 @@ $line-loop: {
|
|||
compare c, 0xa # newline
|
||||
break-if-= # no need to print newlines
|
||||
# print c
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
col <- increment
|
||||
loop
|
||||
} # $char-loop
|
||||
|
@ -95,7 +95,7 @@ $check-state: {
|
|||
{
|
||||
break-if-!=
|
||||
# r->current-state == 0 && c == '*' => bold text
|
||||
start-bold-on-screen
|
||||
start-bold 0
|
||||
copy-to *state, 1
|
||||
break $check-state
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ $check-state: {
|
|||
{
|
||||
break-if-!=
|
||||
# r->current-state == 0 && c == '_' => bold text
|
||||
start-bold-on-screen
|
||||
start-bold 0
|
||||
copy-to *state, 1
|
||||
break $check-state
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ $check-state: {
|
|||
{
|
||||
break-if-!=
|
||||
# r->current-state == 1 && c == '*' => normal text
|
||||
reset-formatting-on-screen
|
||||
reset-formatting 0
|
||||
copy-to *state, 0
|
||||
break $check-state
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ $check-state: {
|
|||
{
|
||||
break-if-!=
|
||||
# r->current-state == 1 && c == '_' => normal text
|
||||
reset-formatting-on-screen
|
||||
reset-formatting 0
|
||||
copy-to *state, 0
|
||||
break $check-state
|
||||
}
|
||||
|
@ -138,11 +138,11 @@ fn clear toprow: int, leftcol: int, botrow: int, rightcol: int {
|
|||
compare row, botrow
|
||||
break-if->=
|
||||
var col/edx: int <- copy leftcol
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
{
|
||||
compare col, rightcol
|
||||
break-if->=
|
||||
print-string-to-screen " "
|
||||
print-string 0, " "
|
||||
col <- increment
|
||||
loop
|
||||
}
|
||||
|
@ -171,6 +171,6 @@ fn dump in: (addr buffered-file) {
|
|||
var c/eax: byte <- read-byte-buffered in
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ fn main args: (addr array (addr array byte)) -> exit-status/ebx: int {
|
|||
enable-screen-grid-mode
|
||||
var nrows/eax: int <- copy 0
|
||||
var ncols/ecx: int <- copy 0
|
||||
nrows, ncols <- screen-size
|
||||
nrows, ncols <- screen-size 0
|
||||
enable-keyboard-immediate-mode
|
||||
{
|
||||
render file, nrows, ncols
|
||||
|
@ -42,7 +42,7 @@ fn render in: (addr buffered-file), nrows: int, ncols: int {
|
|||
var leftcol/edx: int <- copy 5 # page-margin
|
||||
var rightcol/ebx: int <- copy leftcol
|
||||
rightcol <- add 0x40 # page-width = 64 characters
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
{
|
||||
compare rightcol, ncols
|
||||
break-if->=
|
||||
|
@ -64,7 +64,7 @@ $line-loop: {
|
|||
compare row, botrow
|
||||
break-if->=
|
||||
var col/edx: int <- copy leftcol
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
$char-loop: {
|
||||
compare col, rightcol
|
||||
break-if->=
|
||||
|
@ -79,7 +79,7 @@ $update-attributes:check-state: {
|
|||
{
|
||||
break-if-!=
|
||||
# r->current-state == 0 && c == '*' => bold text
|
||||
start-bold-on-screen
|
||||
start-bold 0
|
||||
copy-to *state, 1
|
||||
break $update-attributes:check-state
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ $update-attributes:check-state: {
|
|||
{
|
||||
break-if-!=
|
||||
# r->current-state == 0 && c == '_' => bold text
|
||||
start-bold-on-screen
|
||||
start-bold 0
|
||||
copy-to *state, 1
|
||||
break $update-attributes:check-state
|
||||
}
|
||||
|
@ -99,8 +99,8 @@ $update-attributes:check-state: {
|
|||
{
|
||||
break-if-!=
|
||||
# r->current-state == 1 && c == '*' => normal text
|
||||
reset-formatting-on-screen
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
reset-formatting 0
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
copy-to *state, 0
|
||||
break $update-attributes:check-state
|
||||
}
|
||||
|
@ -108,8 +108,8 @@ $update-attributes:check-state: {
|
|||
{
|
||||
break-if-!=
|
||||
# r->current-state == 1 && c == '_' => normal text
|
||||
reset-formatting-on-screen
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
reset-formatting 0
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
copy-to *state, 0
|
||||
break $update-attributes:check-state
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ $update-attributes:check-state: {
|
|||
compare c, 0xa # newline
|
||||
break-if-= # no need to print newlines
|
||||
# print c
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
col <- increment
|
||||
loop
|
||||
} # $char-loop
|
||||
|
@ -134,11 +134,11 @@ fn clear toprow: int, leftcol: int, botrow: int, rightcol: int {
|
|||
compare row, botrow
|
||||
break-if->=
|
||||
var col/edx: int <- copy leftcol
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
{
|
||||
compare col, rightcol
|
||||
break-if->=
|
||||
print-string-to-screen " "
|
||||
print-string 0, " "
|
||||
col <- increment
|
||||
loop
|
||||
}
|
||||
|
@ -167,6 +167,6 @@ fn dump in: (addr buffered-file) {
|
|||
var c/eax: byte <- read-byte-buffered in
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ fn main args: (addr array (addr array byte)) -> exit-status/ebx: int {
|
|||
enable-screen-grid-mode
|
||||
var nrows/eax: int <- copy 0
|
||||
var ncols/ecx: int <- copy 0
|
||||
nrows, ncols <- screen-size
|
||||
nrows, ncols <- screen-size 0
|
||||
enable-keyboard-immediate-mode
|
||||
{
|
||||
render file, nrows, ncols
|
||||
|
@ -41,7 +41,7 @@ fn render in: (addr buffered-file), nrows: int, ncols: int {
|
|||
var leftcol/edx: int <- copy 5 # page-margin
|
||||
var rightcol/ebx: int <- copy leftcol
|
||||
rightcol <- add 0x40 # page-width = 64 characters
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
{
|
||||
compare rightcol, ncols
|
||||
break-if->=
|
||||
|
@ -63,7 +63,7 @@ $line-loop: {
|
|||
compare row, botrow
|
||||
break-if->=
|
||||
var col/edx: int <- copy leftcol
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
$char-loop: {
|
||||
compare col, rightcol
|
||||
break-if->=
|
||||
|
@ -78,7 +78,7 @@ $update-attributes:check-state: {
|
|||
{
|
||||
break-if-!=
|
||||
# r->current-state == 0 && c == '*' => bold text
|
||||
start-bold-on-screen
|
||||
start-bold 0
|
||||
copy-to *state, 1
|
||||
break $update-attributes:check-state
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ $update-attributes:check-state: {
|
|||
{
|
||||
break-if-!=
|
||||
# r->current-state == 0 && c == '_' => bold text
|
||||
start-bold-on-screen
|
||||
start-bold 0
|
||||
copy-to *state, 1
|
||||
break $update-attributes:check-state
|
||||
}
|
||||
|
@ -98,10 +98,10 @@ $update-attributes:check-state: {
|
|||
{
|
||||
break-if-!=
|
||||
# r->current-state == 1 && c == '*' => print c, then normal text
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
col <- increment
|
||||
reset-formatting-on-screen
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
reset-formatting 0
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
copy-to *state, 0
|
||||
loop $char-loop
|
||||
}
|
||||
|
@ -109,10 +109,10 @@ $update-attributes:check-state: {
|
|||
{
|
||||
break-if-!=
|
||||
# r->current-state == 1 && c == '_' => print c, then normal text
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
col <- increment
|
||||
reset-formatting-on-screen
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
reset-formatting 0
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
copy-to *state, 0
|
||||
loop $char-loop
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ $update-attributes:check-state: {
|
|||
compare c, 0xa # newline
|
||||
break-if-= # no need to print newlines
|
||||
# print c
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
col <- increment
|
||||
loop
|
||||
} # $char-loop
|
||||
|
@ -137,11 +137,11 @@ fn clear toprow: int, leftcol: int, botrow: int, rightcol: int {
|
|||
compare row, botrow
|
||||
break-if->=
|
||||
var col/edx: int <- copy leftcol
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
{
|
||||
compare col, rightcol
|
||||
break-if->=
|
||||
print-string-to-screen " "
|
||||
print-string 0, " "
|
||||
col <- increment
|
||||
loop
|
||||
}
|
||||
|
@ -170,6 +170,6 @@ fn dump in: (addr buffered-file) {
|
|||
var c/eax: byte <- read-byte-buffered in
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ fn main args: (addr array (addr array byte)) -> exit-status/ebx: int {
|
|||
enable-screen-grid-mode
|
||||
var nrows/eax: int <- copy 0
|
||||
var ncols/ecx: int <- copy 0
|
||||
nrows, ncols <- screen-size
|
||||
nrows, ncols <- screen-size 0
|
||||
enable-keyboard-immediate-mode
|
||||
{
|
||||
render file, nrows, ncols
|
||||
|
@ -41,7 +41,7 @@ fn render in: (addr buffered-file), nrows: int, ncols: int {
|
|||
var leftcol/edx: int <- copy 5 # page-margin
|
||||
var rightcol/ebx: int <- copy leftcol
|
||||
rightcol <- add 0x40 # page-width = 64 characters
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
{
|
||||
compare rightcol, ncols
|
||||
break-if->=
|
||||
|
@ -63,7 +63,7 @@ $line-loop: {
|
|||
compare row, botrow
|
||||
break-if->=
|
||||
var col/edx: int <- copy leftcol
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
$char-loop: {
|
||||
compare col, rightcol
|
||||
break-if->=
|
||||
|
@ -78,7 +78,7 @@ $update-attributes:check-state: {
|
|||
{
|
||||
break-if-!=
|
||||
# r->current-state == 0 && c == '*' => bold text
|
||||
start-bold-on-screen
|
||||
start-bold 0
|
||||
copy-to *state, 1
|
||||
break $update-attributes:check-state
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ $update-attributes:check-state: {
|
|||
{
|
||||
break-if-!=
|
||||
# r->current-state == 0 && c == '_' => bold text
|
||||
start-bold-on-screen
|
||||
start-bold 0
|
||||
copy-to *state, 1
|
||||
break $update-attributes:check-state
|
||||
}
|
||||
|
@ -99,10 +99,10 @@ $update-attributes:check-state: {
|
|||
{
|
||||
break-if-!=
|
||||
# r->current-state == 1 && c == '*' => print c, then normal text
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
col <- increment
|
||||
reset-formatting-on-screen
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
reset-formatting 0
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
copy-to *state, 0
|
||||
loop $char-loop
|
||||
}
|
||||
|
@ -110,10 +110,10 @@ $update-attributes:check-state: {
|
|||
{
|
||||
break-if-!=
|
||||
# r->current-state == 1 && c == '_' => print c, then normal text
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
col <- increment
|
||||
reset-formatting-on-screen
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
reset-formatting 0
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
copy-to *state, 0
|
||||
loop $char-loop
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ $update-attributes:check-state: {
|
|||
compare c, 0xa # newline
|
||||
break-if-= # no need to print newlines
|
||||
# print c
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
col <- increment
|
||||
loop
|
||||
} # $char-loop
|
||||
|
@ -138,11 +138,11 @@ fn clear toprow: int, leftcol: int, botrow: int, rightcol: int {
|
|||
compare row, botrow
|
||||
break-if->=
|
||||
var col/edx: int <- copy leftcol
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
{
|
||||
compare col, rightcol
|
||||
break-if->=
|
||||
print-string-to-screen " "
|
||||
print-string 0, " "
|
||||
col <- increment
|
||||
loop
|
||||
}
|
||||
|
@ -171,6 +171,6 @@ fn dump in: (addr buffered-file) {
|
|||
var c/eax: byte <- read-byte-buffered in
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ fn main args: (addr array (addr array byte)) -> exit-status/ebx: int {
|
|||
enable-screen-grid-mode
|
||||
var nrows/eax: int <- copy 0
|
||||
var ncols/ecx: int <- copy 0
|
||||
nrows, ncols <- screen-size
|
||||
nrows, ncols <- screen-size 0
|
||||
enable-keyboard-immediate-mode
|
||||
{
|
||||
render file, nrows, ncols
|
||||
|
@ -39,7 +39,7 @@ fn render in: (addr buffered-file), nrows: int, ncols: int {
|
|||
var leftcol/edx: int <- copy 5 # page-margin
|
||||
var rightcol/ebx: int <- copy leftcol
|
||||
rightcol <- add 0x40 # page-width = 64 characters
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
{
|
||||
compare rightcol, ncols
|
||||
break-if->=
|
||||
|
@ -61,7 +61,7 @@ $line-loop: {
|
|||
compare row, botrow
|
||||
break-if->=
|
||||
var col/edx: int <- copy leftcol
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
$char-loop: {
|
||||
compare col, rightcol
|
||||
break-if->=
|
||||
|
@ -76,7 +76,7 @@ $change-state: {
|
|||
{
|
||||
break-if-!=
|
||||
# r->current-state == 0 && c == '*' => bold text
|
||||
start-bold-on-screen
|
||||
start-bold 0
|
||||
copy-to *state, 1
|
||||
break $change-state
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ $change-state: {
|
|||
{
|
||||
break-if-!=
|
||||
# r->current-state == 0 && c == '_' => bold text
|
||||
start-bold-on-screen
|
||||
start-bold 0
|
||||
copy-to *state, 1
|
||||
break $change-state
|
||||
}
|
||||
|
@ -97,10 +97,10 @@ $change-state: {
|
|||
{
|
||||
break-if-!=
|
||||
# r->current-state == 1 && c == '*' => print c, then normal text
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
col <- increment
|
||||
reset-formatting-on-screen
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
reset-formatting 0
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
copy-to *state, 0
|
||||
loop $char-loop
|
||||
}
|
||||
|
@ -108,10 +108,10 @@ $change-state: {
|
|||
{
|
||||
break-if-!=
|
||||
# r->current-state == 1 && c == '_' => print c, then normal text
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
col <- increment
|
||||
reset-formatting-on-screen
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
reset-formatting 0
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
copy-to *state, 0
|
||||
loop $char-loop
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ $change-state: {
|
|||
compare c, 0xa # newline
|
||||
break-if-= # no need to print newlines
|
||||
# print c
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
col <- increment
|
||||
loop
|
||||
} # $char-loop
|
||||
|
@ -136,11 +136,11 @@ fn clear toprow: int, leftcol: int, botrow: int, rightcol: int {
|
|||
compare row, botrow
|
||||
break-if->=
|
||||
var col/edx: int <- copy leftcol
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
{
|
||||
compare col, rightcol
|
||||
break-if->=
|
||||
print-string-to-screen " "
|
||||
print-string 0, " "
|
||||
col <- increment
|
||||
loop
|
||||
}
|
||||
|
@ -169,6 +169,6 @@ fn dump in: (addr buffered-file) {
|
|||
var c/eax: byte <- read-byte-buffered in
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ fn main args: (addr array (addr array byte)) -> exit-status/ebx: int {
|
|||
enable-screen-grid-mode
|
||||
var nrows/eax: int <- copy 0
|
||||
var ncols/ecx: int <- copy 0
|
||||
nrows, ncols <- screen-size
|
||||
nrows, ncols <- screen-size 0
|
||||
enable-keyboard-immediate-mode
|
||||
{
|
||||
render file, nrows, ncols
|
||||
|
@ -49,7 +49,7 @@ fn render in: (addr buffered-file), nrows: int, ncols: int {
|
|||
var leftcol/edx: int <- copy 5 # page-margin
|
||||
var rightcol/ebx: int <- copy leftcol
|
||||
rightcol <- add 0x40 # page-width = 64 characters
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
{
|
||||
compare rightcol, ncols
|
||||
break-if->=
|
||||
|
@ -71,7 +71,7 @@ $line-loop: {
|
|||
compare row, botrow
|
||||
break-if->=
|
||||
var col/edx: int <- copy leftcol
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
$char-loop: {
|
||||
compare col, rightcol
|
||||
break-if->=
|
||||
|
@ -86,7 +86,7 @@ $change-state: {
|
|||
{
|
||||
break-if-!=
|
||||
# r->current-state == 0 && c == '*' => bold text
|
||||
start-bold-on-screen
|
||||
start-bold 0
|
||||
copy-to *state, 1
|
||||
break $change-state
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ $change-state: {
|
|||
{
|
||||
break-if-!=
|
||||
# r->current-state == 0 && c == '_' => bold text
|
||||
start-bold-on-screen
|
||||
start-bold 0
|
||||
copy-to *state, 1
|
||||
break $change-state
|
||||
}
|
||||
|
@ -121,10 +121,10 @@ $change-state: {
|
|||
{
|
||||
break-if-!=
|
||||
# r->current-state == 1 && c == '*' => print c, then normal text
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
col <- increment
|
||||
reset-formatting-on-screen
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
reset-formatting 0
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
copy-to *state, 0
|
||||
loop $char-loop
|
||||
}
|
||||
|
@ -132,10 +132,10 @@ $change-state: {
|
|||
{
|
||||
break-if-!=
|
||||
# r->current-state == 1 && c == '_' => print c, then normal text
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
col <- increment
|
||||
reset-formatting-on-screen
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
reset-formatting 0
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
copy-to *state, 0
|
||||
loop $char-loop
|
||||
}
|
||||
|
@ -150,8 +150,8 @@ $change-state: {
|
|||
var s/eax: (addr boolean) <- get r, start-of-line?
|
||||
copy-to *s, 1 # true
|
||||
# switch to normal text
|
||||
reset-formatting-on-screen
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
reset-formatting 0
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
# no need to print newlines
|
||||
break $char-loop
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ $change-state: {
|
|||
copy-to *s, 0 # false
|
||||
}
|
||||
# print c
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
col <- increment
|
||||
loop
|
||||
}
|
||||
|
@ -178,11 +178,11 @@ fn clear toprow: int, leftcol: int, botrow: int, rightcol: int {
|
|||
compare row, botrow
|
||||
break-if->=
|
||||
var col/edx: int <- copy leftcol
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
{
|
||||
compare col, rightcol
|
||||
break-if->=
|
||||
print-string-to-screen " "
|
||||
print-string 0, " "
|
||||
col <- increment
|
||||
loop
|
||||
}
|
||||
|
@ -211,6 +211,6 @@ fn dump in: (addr buffered-file) {
|
|||
var c/eax: byte <- read-byte-buffered in
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ fn main args: (addr array (addr array byte)) -> exit-status/ebx: int {
|
|||
enable-keyboard-immediate-mode
|
||||
var nrows/eax: int <- copy 0
|
||||
var ncols/ecx: int <- copy 0
|
||||
nrows, ncols <- screen-size
|
||||
nrows, ncols <- screen-size 0
|
||||
var screen-position-state-storage: screen-position-state
|
||||
var screen-position-state: (addr screen-position-state)
|
||||
init-screen-position-state screen-position-state, nrows, ncols
|
||||
|
@ -68,8 +68,8 @@ fn render-normal in: (addr buffered-file), state: (addr screen-position-state) {
|
|||
# if (c == EOF) break
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
# if (c == '*') start-bold-on-screen, render-until-asterisk(in, state), reset
|
||||
# else if (c == '_') start-bold-on-screen, render-until-underscore(in, state), reset
|
||||
# if (c == '*') start-bold 0,, render-until-asterisk(in, state), reset
|
||||
# else if (c == '_') start-bold 0,, render-until-underscore(in, state), reset
|
||||
# else if (c == '#') compute-color, start color, render-header-line(in, state), reset
|
||||
# else add-char(state, c)
|
||||
}
|
||||
|
@ -183,6 +183,6 @@ fn dump in: (addr buffered-file) {
|
|||
var c/eax: byte <- read-byte-buffered in
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -28,6 +28,6 @@ fn dump in: (addr buffered-file) {
|
|||
var c/eax: byte <- read-byte-buffered in
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ fn main args: (addr array (addr array byte)) -> exit-status/ebx: int {
|
|||
# initialize screen state from screen size
|
||||
var nrows/eax: int <- copy 0
|
||||
var ncols/ecx: int <- copy 0
|
||||
nrows, ncols <- screen-size
|
||||
nrows, ncols <- screen-size 0
|
||||
var screen-position-state-storage: screen-position-state
|
||||
var screen-position-state: (addr screen-position-state)
|
||||
init-screen-position-state screen-position-state, nrows, ncols
|
||||
|
@ -44,8 +44,8 @@ fn render-normal fs: (addr file-state), state: (addr screen-position-state) {
|
|||
# if (c == EOF) break
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
# if (c == '*') start-bold-on-screen, render-until-asterisk(fs, state), reset
|
||||
# else if (c == '_') start-bold-on-screen, render-until-underscore(fs, state), reset
|
||||
# if (c == '*') start-bold 0,, render-until-asterisk(fs, state), reset
|
||||
# else if (c == '_') start-bold 0,, render-until-underscore(fs, state), reset
|
||||
# else if (c == '#' and fs is at start of line) compute-color, start color, render-header-line(fs, state), reset
|
||||
# else add-char(state, c)
|
||||
}
|
||||
|
|
|
@ -39,6 +39,6 @@ fn dump in: (addr buffered-file) {
|
|||
var c/eax: byte <- read-byte-buffered in
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ fn render-normal fs: (addr file-state) {
|
|||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
#
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
#
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -39,6 +39,6 @@ fn dump in: (addr buffered-file) {
|
|||
var c/eax: byte <- read-byte-buffered in
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ fn init-screen-position-state _self: (addr screen-position-state) {
|
|||
var self/esi: (addr screen-position-state) <- copy _self
|
||||
var nrows/eax: int <- copy 0
|
||||
var ncols/ecx: int <- copy 0
|
||||
nrows, ncols <- screen-size
|
||||
nrows, ncols <- screen-size 0
|
||||
var dest/edx: (addr int) <- copy 0
|
||||
# self->nrows = nrows
|
||||
dest <- get self, nrows
|
||||
|
@ -63,7 +63,7 @@ fn start-drawing _self: (addr screen-position-state) {
|
|||
fn add-char _self: (addr screen-position-state), c: byte {
|
||||
var self/esi: (addr screen-position-state) <- copy _self
|
||||
# print c
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
# self->col++
|
||||
var tmp/eax: (addr int) <- get self, col
|
||||
increment *tmp
|
||||
|
@ -131,5 +131,5 @@ fn reposition-cursor _self: (addr screen-position-state) {
|
|||
var self/esi: (addr screen-position-state) <- copy _self
|
||||
var r/eax: (addr int) <- get self, row
|
||||
var c/ecx: (addr int) <- get self, col
|
||||
move-cursor-on-screen *r *c
|
||||
move-cursor 0, *r *c
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ fn dump in: (addr buffered-file) {
|
|||
var c/eax: byte <- read-byte-buffered in
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,6 @@ fn dump in: (addr buffered-file) {
|
|||
var c/eax: byte <- read-byte-buffered in
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ fn init-screen-position-state _self: (addr screen-position-state) {
|
|||
var self/esi: (addr screen-position-state) <- copy _self
|
||||
var nrows/eax: int <- copy 0
|
||||
var ncols/ecx: int <- copy 0
|
||||
nrows, ncols <- screen-size
|
||||
nrows, ncols <- screen-size 0
|
||||
var dest/edx: (addr int) <- copy 0
|
||||
# self->nrows = nrows
|
||||
dest <- get self, nrows
|
||||
|
@ -71,7 +71,7 @@ $add-char:body: {
|
|||
break $add-char:body
|
||||
}
|
||||
# print c
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
# self->col++
|
||||
var tmp/eax: (addr int) <- get self, col
|
||||
increment *tmp
|
||||
|
@ -140,5 +140,5 @@ fn reposition-cursor _self: (addr screen-position-state) {
|
|||
var self/esi: (addr screen-position-state) <- copy _self
|
||||
var r/eax: (addr int) <- get self, row
|
||||
var c/ecx: (addr int) <- get self, col
|
||||
move-cursor-on-screen *r *c
|
||||
move-cursor 0, *r *c
|
||||
}
|
||||
|
|
|
@ -39,6 +39,6 @@ fn dump in: (addr buffered-file) {
|
|||
var c/eax: byte <- read-byte-buffered in
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ fn init-screen-position-state _self: (addr screen-position-state) {
|
|||
var self/esi: (addr screen-position-state) <- copy _self
|
||||
var nrows/eax: int <- copy 0
|
||||
var ncols/ecx: int <- copy 0
|
||||
nrows, ncols <- screen-size
|
||||
nrows, ncols <- screen-size 0
|
||||
var dest/edx: (addr int) <- copy 0
|
||||
# self->nrows = nrows
|
||||
dest <- get self, nrows
|
||||
|
@ -70,7 +70,7 @@ $add-char:body: {
|
|||
break $add-char:body
|
||||
}
|
||||
# print c
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
# self->col++
|
||||
var tmp/eax: (addr int) <- get self, col
|
||||
increment *tmp
|
||||
|
@ -139,5 +139,5 @@ fn reposition-cursor _self: (addr screen-position-state) {
|
|||
var self/esi: (addr screen-position-state) <- copy _self
|
||||
var r/eax: (addr int) <- get self, row
|
||||
var c/ecx: (addr int) <- get self, col
|
||||
move-cursor-on-screen *r *c
|
||||
move-cursor 0, *r *c
|
||||
}
|
||||
|
|
|
@ -39,6 +39,6 @@ fn dump in: (addr buffered-file) {
|
|||
var c/eax: byte <- read-byte-buffered in
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ fn init-screen-position-state _self: (addr screen-position-state) {
|
|||
var self/esi: (addr screen-position-state) <- copy _self
|
||||
var nrows/eax: int <- copy 0
|
||||
var ncols/ecx: int <- copy 0
|
||||
nrows, ncols <- screen-size
|
||||
nrows, ncols <- screen-size 0
|
||||
var dest/edx: (addr int) <- copy 0
|
||||
# self->nrows = nrows
|
||||
dest <- get self, nrows
|
||||
|
@ -70,7 +70,7 @@ $add-char:body: {
|
|||
break $add-char:body
|
||||
}
|
||||
# print c
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
# self->col++
|
||||
var tmp/eax: (addr int) <- get self, col
|
||||
increment *tmp
|
||||
|
@ -159,5 +159,5 @@ fn reposition-cursor _self: (addr screen-position-state) {
|
|||
var self/esi: (addr screen-position-state) <- copy _self
|
||||
var r/eax: (addr int) <- get self, row
|
||||
var c/ecx: (addr int) <- get self, col
|
||||
move-cursor-on-screen *r *c
|
||||
move-cursor 0, *r *c
|
||||
}
|
||||
|
|
|
@ -39,6 +39,6 @@ fn dump in: (addr buffered-file) {
|
|||
var c/eax: byte <- read-byte-buffered in
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ fn init-screen-position-state _self: (addr screen-position-state) {
|
|||
var self/esi: (addr screen-position-state) <- copy _self
|
||||
var nrows/eax: int <- copy 0
|
||||
var ncols/ecx: int <- copy 0
|
||||
nrows, ncols <- screen-size
|
||||
nrows, ncols <- screen-size 0
|
||||
var dest/edx: (addr int) <- copy 0
|
||||
# self->nrows = nrows
|
||||
dest <- get self, nrows
|
||||
|
@ -39,7 +39,7 @@ fn start-drawing _self: (addr screen-position-state) {
|
|||
var self/esi: (addr screen-position-state) <- copy _self
|
||||
var tmp/eax: (addr int) <- copy 0
|
||||
var tmp2/ecx: int <- copy 0
|
||||
clear-screen
|
||||
clear-screen 0
|
||||
# self->leftcol = page-margin
|
||||
tmp <- get self, leftcol
|
||||
copy-to *tmp, 5 # left-margin
|
||||
|
@ -71,7 +71,7 @@ $add-char:body: {
|
|||
break $add-char:body
|
||||
}
|
||||
# print c
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
# self->col++
|
||||
var tmp/eax: (addr int) <- get self, col
|
||||
increment *tmp
|
||||
|
@ -160,5 +160,5 @@ fn reposition-cursor _self: (addr screen-position-state) {
|
|||
var self/esi: (addr screen-position-state) <- copy _self
|
||||
var r/eax: (addr int) <- get self, row
|
||||
var c/ecx: (addr int) <- get self, col
|
||||
move-cursor-on-screen *r *c
|
||||
move-cursor 0, *r *c
|
||||
}
|
||||
|
|
|
@ -39,6 +39,6 @@ fn dump in: (addr buffered-file) {
|
|||
var c/eax: byte <- read-byte-buffered in
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ $render-normal:body: {
|
|||
compare c, 0x2a # '*'
|
||||
{
|
||||
break-if-!=
|
||||
start-bold-on-screen
|
||||
start-bold 0
|
||||
render-until-asterisk fs, state
|
||||
normal-text
|
||||
loop $render-normal:body
|
||||
|
@ -52,11 +52,11 @@ $render-normal:body: {
|
|||
compare c, 0x5f # '_'
|
||||
{
|
||||
break-if-!=
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
start-bold-on-screen
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
start-bold 0
|
||||
render-until-underscore fs, state
|
||||
reset-formatting-on-screen
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
reset-formatting 0
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
loop $render-normal:body
|
||||
}
|
||||
#
|
||||
|
@ -115,6 +115,6 @@ fn first-arg args-on-stack: (addr array (addr array byte)) -> out/eax: (addr arr
|
|||
}
|
||||
|
||||
fn normal-text {
|
||||
reset-formatting-on-screen
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
reset-formatting 0
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ fn init-screen-position-state _self: (addr screen-position-state) {
|
|||
var self/esi: (addr screen-position-state) <- copy _self
|
||||
var nrows/eax: int <- copy 0
|
||||
var ncols/ecx: int <- copy 0
|
||||
nrows, ncols <- screen-size
|
||||
nrows, ncols <- screen-size 0
|
||||
var dest/edx: (addr int) <- copy 0
|
||||
# self->nrows = nrows
|
||||
dest <- get self, nrows
|
||||
|
@ -39,7 +39,7 @@ fn start-drawing _self: (addr screen-position-state) {
|
|||
var self/esi: (addr screen-position-state) <- copy _self
|
||||
var tmp/eax: (addr int) <- copy 0
|
||||
var tmp2/ecx: int <- copy 0
|
||||
clear-screen
|
||||
clear-screen 0
|
||||
# self->leftcol = page-margin
|
||||
tmp <- get self, leftcol
|
||||
copy-to *tmp, 5 # left-margin
|
||||
|
@ -71,7 +71,7 @@ $add-char:body: {
|
|||
break $add-char:body
|
||||
}
|
||||
# print c
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
# self->col++
|
||||
var tmp/eax: (addr int) <- get self, col
|
||||
increment *tmp
|
||||
|
@ -160,5 +160,5 @@ fn reposition-cursor _self: (addr screen-position-state) {
|
|||
var self/esi: (addr screen-position-state) <- copy _self
|
||||
var r/eax: (addr int) <- get self, row
|
||||
var c/ecx: (addr int) <- get self, col
|
||||
move-cursor-on-screen *r *c
|
||||
move-cursor 0, *r *c
|
||||
}
|
||||
|
|
|
@ -39,6 +39,6 @@ fn dump in: (addr buffered-file) {
|
|||
var c/eax: byte <- read-byte-buffered in
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ $render-normal:flush-buffered-newline: {
|
|||
compare c, 0x2a # '*'
|
||||
{
|
||||
break-if-!=
|
||||
start-bold-on-screen
|
||||
start-bold 0
|
||||
render-until-asterisk fs, state
|
||||
normal-text
|
||||
loop $render-normal:loop
|
||||
|
@ -96,11 +96,11 @@ $render-normal:flush-buffered-newline: {
|
|||
compare c, 0x5f # '_'
|
||||
{
|
||||
break-if-!=
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
start-bold-on-screen
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
start-bold 0
|
||||
render-until-underscore fs, state
|
||||
reset-formatting-on-screen
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
reset-formatting 0
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
loop $render-normal:loop
|
||||
}
|
||||
#
|
||||
|
@ -159,6 +159,6 @@ fn first-arg args-on-stack: (addr array (addr array byte)) -> out/eax: (addr arr
|
|||
}
|
||||
|
||||
fn normal-text {
|
||||
reset-formatting-on-screen
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
reset-formatting 0
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ fn init-screen-position-state _self: (addr screen-position-state) {
|
|||
var self/esi: (addr screen-position-state) <- copy _self
|
||||
var nrows/eax: int <- copy 0xa
|
||||
var ncols/ecx: int <- copy 0x20
|
||||
nrows, ncols <- screen-size # Comment this out to debug with a tiny page. You'll also need to adjust rightcol below.
|
||||
nrows, ncols <- screen-size 0 # Comment this out to debug with a tiny page. You'll also need to adjust rightcol below.
|
||||
var dest/edx: (addr int) <- copy 0
|
||||
# self->nrows = nrows
|
||||
dest <- get self, nrows
|
||||
|
@ -39,7 +39,7 @@ fn start-drawing _self: (addr screen-position-state) {
|
|||
var self/esi: (addr screen-position-state) <- copy _self
|
||||
var tmp/eax: (addr int) <- copy 0
|
||||
var tmp2/ecx: int <- copy 0
|
||||
clear-screen
|
||||
clear-screen 0
|
||||
# self->leftcol = page-margin
|
||||
tmp <- get self, leftcol
|
||||
copy-to *tmp, 5 # left-margin
|
||||
|
@ -72,7 +72,7 @@ $add-char:body: {
|
|||
break $add-char:body
|
||||
}
|
||||
# print c
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
# self->col++
|
||||
var tmp/eax: (addr int) <- get self, col
|
||||
increment *tmp
|
||||
|
@ -167,5 +167,5 @@ fn reposition-cursor _self: (addr screen-position-state) {
|
|||
var self/esi: (addr screen-position-state) <- copy _self
|
||||
var r/eax: (addr int) <- get self, row
|
||||
var c/ecx: (addr int) <- get self, col
|
||||
move-cursor-on-screen *r *c
|
||||
move-cursor 0, *r *c
|
||||
}
|
||||
|
|
|
@ -39,6 +39,6 @@ fn dump in: (addr buffered-file) {
|
|||
var c/eax: byte <- read-byte-buffered in
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ $render-normal:flush-buffered-newline: {
|
|||
compare c, 0x2a # '*'
|
||||
{
|
||||
break-if-!=
|
||||
start-bold-on-screen
|
||||
start-bold 0
|
||||
render-until-asterisk fs, state
|
||||
normal-text
|
||||
loop $render-normal:loop
|
||||
|
@ -105,11 +105,11 @@ $render-normal:flush-buffered-newline: {
|
|||
compare c, 0x5f # '_'
|
||||
{
|
||||
break-if-!=
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
start-bold-on-screen
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
start-bold 0
|
||||
render-until-underscore fs, state
|
||||
reset-formatting-on-screen
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
reset-formatting 0
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
loop $render-normal:loop
|
||||
}
|
||||
#
|
||||
|
@ -169,32 +169,32 @@ $render-header-line:body: {
|
|||
# colors for a light background, going from bright to dark (meeting up with bold-text)
|
||||
fn start-heading header-level: int {
|
||||
$start-heading:body: {
|
||||
start-bold-on-screen
|
||||
start-bold 0
|
||||
compare header-level, 1
|
||||
{
|
||||
break-if-!=
|
||||
start-color-on-screen 0xa0, 7
|
||||
start-color 0, 0xa0, 7
|
||||
break $start-heading:body
|
||||
}
|
||||
compare header-level, 2
|
||||
{
|
||||
break-if-!=
|
||||
start-color-on-screen 0x7c, 7
|
||||
start-color 0, 0x7c, 7
|
||||
break $start-heading:body
|
||||
}
|
||||
compare header-level, 3
|
||||
{
|
||||
break-if-!=
|
||||
start-color-on-screen 0x58, 7
|
||||
start-color 0, 0x58, 7
|
||||
break $start-heading:body
|
||||
}
|
||||
compare header-level, 4
|
||||
{
|
||||
break-if-!=
|
||||
start-color-on-screen 0x34, 7
|
||||
start-color 0, 0x34, 7
|
||||
break $start-heading:body
|
||||
}
|
||||
start-color-on-screen 0xe8, 7
|
||||
start-color 0, 0xe8, 7
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -247,6 +247,6 @@ fn first-arg args-on-stack: (addr array (addr array byte)) -> out/eax: (addr arr
|
|||
}
|
||||
|
||||
fn normal-text {
|
||||
reset-formatting-on-screen
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
reset-formatting 0
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ fn init-screen-position-state _self: (addr screen-position-state) {
|
|||
var self/esi: (addr screen-position-state) <- copy _self
|
||||
var nrows/eax: int <- copy 0xa
|
||||
var ncols/ecx: int <- copy 0x20
|
||||
nrows, ncols <- screen-size # Comment this out to debug with a tiny page. You'll also need to adjust rightcol below.
|
||||
nrows, ncols <- screen-size 0 # Comment this out to debug with a tiny page. You'll also need to adjust rightcol below.
|
||||
var dest/edx: (addr int) <- copy 0
|
||||
# self->nrows = nrows
|
||||
dest <- get self, nrows
|
||||
|
@ -39,7 +39,7 @@ fn start-drawing _self: (addr screen-position-state) {
|
|||
var self/esi: (addr screen-position-state) <- copy _self
|
||||
var tmp/eax: (addr int) <- copy 0
|
||||
var tmp2/ecx: int <- copy 0
|
||||
clear-screen
|
||||
clear-screen 0
|
||||
# self->leftcol = page-margin
|
||||
tmp <- get self, leftcol
|
||||
copy-to *tmp, 5 # left-margin
|
||||
|
@ -72,7 +72,7 @@ $add-char:body: {
|
|||
break $add-char:body
|
||||
}
|
||||
# print c
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
# self->col++
|
||||
var tmp/eax: (addr int) <- get self, col
|
||||
increment *tmp
|
||||
|
@ -167,5 +167,5 @@ fn reposition-cursor _self: (addr screen-position-state) {
|
|||
var self/esi: (addr screen-position-state) <- copy _self
|
||||
var r/eax: (addr int) <- get self, row
|
||||
var c/ecx: (addr int) <- get self, col
|
||||
move-cursor-on-screen *r *c
|
||||
move-cursor 0, *r *c
|
||||
}
|
||||
|
|
|
@ -39,6 +39,6 @@ fn dump in: (addr buffered-file) {
|
|||
var c/eax: byte <- read-byte-buffered in
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ $render-normal:flush-buffered-newline: {
|
|||
compare c, 0x2a # '*'
|
||||
{
|
||||
break-if-!=
|
||||
start-bold-on-screen
|
||||
start-bold 0
|
||||
render-until-asterisk fs, state
|
||||
normal-text
|
||||
loop $render-normal:loop
|
||||
|
@ -112,11 +112,11 @@ $render-normal:flush-buffered-newline: {
|
|||
compare c, 0x5f # '_'
|
||||
{
|
||||
break-if-!=
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
start-bold-on-screen
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
start-bold 0
|
||||
render-until-underscore fs, state
|
||||
reset-formatting-on-screen
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
reset-formatting 0
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
loop $render-normal:loop
|
||||
}
|
||||
#
|
||||
|
@ -176,32 +176,32 @@ $render-header-line:body: {
|
|||
# colors for a light background, going from bright to dark (meeting up with bold-text)
|
||||
fn start-heading header-level: int {
|
||||
$start-heading:body: {
|
||||
start-bold-on-screen
|
||||
start-bold 0
|
||||
compare header-level, 1
|
||||
{
|
||||
break-if-!=
|
||||
start-color-on-screen 0xa0, 7
|
||||
start-color 0, 0xa0, 7
|
||||
break $start-heading:body
|
||||
}
|
||||
compare header-level, 2
|
||||
{
|
||||
break-if-!=
|
||||
start-color-on-screen 0x7c, 7
|
||||
start-color 0, 0x7c, 7
|
||||
break $start-heading:body
|
||||
}
|
||||
compare header-level, 3
|
||||
{
|
||||
break-if-!=
|
||||
start-color-on-screen 0x58, 7
|
||||
start-color 0, 0x58, 7
|
||||
break $start-heading:body
|
||||
}
|
||||
compare header-level, 4
|
||||
{
|
||||
break-if-!=
|
||||
start-color-on-screen 0x34, 7
|
||||
start-color 0, 0x34, 7
|
||||
break $start-heading:body
|
||||
}
|
||||
start-color-on-screen 0xe8, 7
|
||||
start-color 0, 0xe8, 7
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,6 +254,6 @@ fn first-arg args-on-stack: (addr array (addr array byte)) -> out/eax: (addr arr
|
|||
}
|
||||
|
||||
fn normal-text {
|
||||
reset-formatting-on-screen
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
reset-formatting 0
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ fn init-screen-position-state _self: (addr screen-position-state) {
|
|||
var self/esi: (addr screen-position-state) <- copy _self
|
||||
var nrows/eax: int <- copy 0xa
|
||||
var ncols/ecx: int <- copy 0x20
|
||||
nrows, ncols <- screen-size # Comment this out to debug with a tiny page. You'll also need to adjust rightcol below.
|
||||
nrows, ncols <- screen-size 0 # Comment this out to debug with a tiny page. You'll also need to adjust rightcol below.
|
||||
var dest/edx: (addr int) <- copy 0
|
||||
# self->nrows = nrows
|
||||
dest <- get self, nrows
|
||||
|
@ -39,7 +39,7 @@ fn start-drawing _self: (addr screen-position-state) {
|
|||
var self/esi: (addr screen-position-state) <- copy _self
|
||||
var tmp/eax: (addr int) <- copy 0
|
||||
var tmp2/ecx: int <- copy 0
|
||||
clear-screen
|
||||
clear-screen 0
|
||||
# self->leftcol = page-margin
|
||||
tmp <- get self, leftcol
|
||||
copy-to *tmp, 5 # left-margin
|
||||
|
@ -72,7 +72,7 @@ $add-char:body: {
|
|||
break $add-char:body
|
||||
}
|
||||
# print c
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
# self->col++
|
||||
var tmp/eax: (addr int) <- get self, col
|
||||
increment *tmp
|
||||
|
@ -167,5 +167,5 @@ fn reposition-cursor _self: (addr screen-position-state) {
|
|||
var self/esi: (addr screen-position-state) <- copy _self
|
||||
var r/eax: (addr int) <- get self, row
|
||||
var c/ecx: (addr int) <- get self, col
|
||||
move-cursor-on-screen *r *c
|
||||
move-cursor 0, *r *c
|
||||
}
|
||||
|
|
|
@ -39,6 +39,6 @@ fn dump in: (addr buffered-file) {
|
|||
var c/eax: byte <- read-byte-buffered in
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ $render-normal:flush-buffered-newline: {
|
|||
compare c, 0x2a # '*'
|
||||
{
|
||||
break-if-!=
|
||||
start-bold-on-screen
|
||||
start-bold 0
|
||||
render-until-asterisk fs, state
|
||||
normal-text
|
||||
break $render-normal:loop-body
|
||||
|
@ -113,11 +113,11 @@ $render-normal:flush-buffered-newline: {
|
|||
compare c, 0x5f # '_'
|
||||
{
|
||||
break-if-!=
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
start-bold-on-screen
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
start-bold 0
|
||||
render-until-underscore fs, state
|
||||
reset-formatting-on-screen
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
reset-formatting 0
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
break $render-normal:loop-body
|
||||
}
|
||||
#
|
||||
|
@ -178,32 +178,32 @@ $render-header-line:body: {
|
|||
# colors for a light background, going from bright to dark (meeting up with bold-text)
|
||||
fn start-heading header-level: int {
|
||||
$start-heading:body: {
|
||||
start-bold-on-screen
|
||||
start-bold 0
|
||||
compare header-level, 1
|
||||
{
|
||||
break-if-!=
|
||||
start-color-on-screen 0xa0, 7
|
||||
start-color 0, 0xa0, 7
|
||||
break $start-heading:body
|
||||
}
|
||||
compare header-level, 2
|
||||
{
|
||||
break-if-!=
|
||||
start-color-on-screen 0x7c, 7
|
||||
start-color 0, 0x7c, 7
|
||||
break $start-heading:body
|
||||
}
|
||||
compare header-level, 3
|
||||
{
|
||||
break-if-!=
|
||||
start-color-on-screen 0x58, 7
|
||||
start-color 0, 0x58, 7
|
||||
break $start-heading:body
|
||||
}
|
||||
compare header-level, 4
|
||||
{
|
||||
break-if-!=
|
||||
start-color-on-screen 0x34, 7
|
||||
start-color 0, 0x34, 7
|
||||
break $start-heading:body
|
||||
}
|
||||
start-color-on-screen 0xe8, 7
|
||||
start-color 0, 0xe8, 7
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -256,6 +256,6 @@ fn first-arg args-on-stack: (addr array (addr array byte)) -> out/eax: (addr arr
|
|||
}
|
||||
|
||||
fn normal-text {
|
||||
reset-formatting-on-screen
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
reset-formatting 0
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ fn init-screen-position-state _self: (addr screen-position-state) {
|
|||
var self/esi: (addr screen-position-state) <- copy _self
|
||||
var nrows/eax: int <- copy 0xa
|
||||
var ncols/ecx: int <- copy 0x20
|
||||
nrows, ncols <- screen-size # Comment this out to debug with a tiny page. You'll also need to adjust rightcol below.
|
||||
nrows, ncols <- screen-size 0 # Comment this out to debug with a tiny page. You'll also need to adjust rightcol below.
|
||||
var dest/edx: (addr int) <- copy 0
|
||||
# self->nrows = nrows
|
||||
dest <- get self, nrows
|
||||
|
@ -39,7 +39,7 @@ fn start-drawing _self: (addr screen-position-state) {
|
|||
var self/esi: (addr screen-position-state) <- copy _self
|
||||
var tmp/eax: (addr int) <- copy 0
|
||||
var tmp2/ecx: int <- copy 0
|
||||
clear-screen
|
||||
clear-screen 0
|
||||
# self->leftcol = page-margin
|
||||
tmp <- get self, leftcol
|
||||
copy-to *tmp, 5 # left-margin
|
||||
|
@ -72,7 +72,7 @@ $add-char:body: {
|
|||
break $add-char:body
|
||||
}
|
||||
# print c
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
# self->col++
|
||||
var tmp/eax: (addr int) <- get self, col
|
||||
increment *tmp
|
||||
|
@ -167,5 +167,5 @@ fn reposition-cursor _self: (addr screen-position-state) {
|
|||
var self/esi: (addr screen-position-state) <- copy _self
|
||||
var r/eax: (addr int) <- get self, row
|
||||
var c/ecx: (addr int) <- get self, col
|
||||
move-cursor-on-screen *r *c
|
||||
move-cursor 0, *r *c
|
||||
}
|
||||
|
|
|
@ -39,6 +39,6 @@ fn dump in: (addr buffered-file) {
|
|||
var c/eax: byte <- read-byte-buffered in
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ $render-normal:whitespace-separated-regions: {
|
|||
compare c, 0x2a # '*'
|
||||
{
|
||||
break-if-!=
|
||||
start-bold-on-screen
|
||||
start-bold 0
|
||||
render-until-asterisk fs, state
|
||||
normal-text
|
||||
break $render-normal:loop-body
|
||||
|
@ -122,11 +122,11 @@ $render-normal:whitespace-separated-regions: {
|
|||
compare c, 0x5f # '_'
|
||||
{
|
||||
break-if-!=
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
start-bold-on-screen
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
start-bold 0
|
||||
render-until-underscore fs, state
|
||||
reset-formatting-on-screen
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
reset-formatting 0
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
break $render-normal:loop-body
|
||||
}
|
||||
}
|
||||
|
@ -188,32 +188,32 @@ $render-header-line:body: {
|
|||
# colors for a light background, going from bright to dark (meeting up with bold-text)
|
||||
fn start-heading header-level: int {
|
||||
$start-heading:body: {
|
||||
start-bold-on-screen
|
||||
start-bold 0
|
||||
compare header-level, 1
|
||||
{
|
||||
break-if-!=
|
||||
start-color-on-screen 0xa0, 7
|
||||
start-color 0, 0xa0, 7
|
||||
break $start-heading:body
|
||||
}
|
||||
compare header-level, 2
|
||||
{
|
||||
break-if-!=
|
||||
start-color-on-screen 0x7c, 7
|
||||
start-color 0, 0x7c, 7
|
||||
break $start-heading:body
|
||||
}
|
||||
compare header-level, 3
|
||||
{
|
||||
break-if-!=
|
||||
start-color-on-screen 0x58, 7
|
||||
start-color 0, 0x58, 7
|
||||
break $start-heading:body
|
||||
}
|
||||
compare header-level, 4
|
||||
{
|
||||
break-if-!=
|
||||
start-color-on-screen 0x34, 7
|
||||
start-color 0, 0x34, 7
|
||||
break $start-heading:body
|
||||
}
|
||||
start-color-on-screen 0xe8, 7
|
||||
start-color 0, 0xe8, 7
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -266,6 +266,6 @@ fn first-arg args-on-stack: (addr array (addr array byte)) -> out/eax: (addr arr
|
|||
}
|
||||
|
||||
fn normal-text {
|
||||
reset-formatting-on-screen
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
reset-formatting 0
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ fn init-screen-position-state _self: (addr screen-position-state) {
|
|||
var self/esi: (addr screen-position-state) <- copy _self
|
||||
var nrows/eax: int <- copy 0xa
|
||||
var ncols/ecx: int <- copy 0x20
|
||||
nrows, ncols <- screen-size # Comment this out to debug with a tiny page. You'll also need to adjust rightcol below.
|
||||
nrows, ncols <- screen-size 0 # Comment this out to debug with a tiny page. You'll also need to adjust rightcol below.
|
||||
var dest/edx: (addr int) <- copy 0
|
||||
# self->nrows = nrows
|
||||
dest <- get self, nrows
|
||||
|
@ -39,7 +39,7 @@ fn start-drawing _self: (addr screen-position-state) {
|
|||
var self/esi: (addr screen-position-state) <- copy _self
|
||||
var tmp/eax: (addr int) <- copy 0
|
||||
var tmp2/ecx: int <- copy 0
|
||||
clear-screen
|
||||
clear-screen 0
|
||||
# self->leftcol = page-margin
|
||||
tmp <- get self, leftcol
|
||||
copy-to *tmp, 5 # left-margin
|
||||
|
@ -72,7 +72,7 @@ $add-char:body: {
|
|||
break $add-char:body
|
||||
}
|
||||
# print c
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
# self->col++
|
||||
var tmp/eax: (addr int) <- get self, col
|
||||
increment *tmp
|
||||
|
@ -167,5 +167,5 @@ fn reposition-cursor _self: (addr screen-position-state) {
|
|||
var self/esi: (addr screen-position-state) <- copy _self
|
||||
var r/eax: (addr int) <- get self, row
|
||||
var c/ecx: (addr int) <- get self, col
|
||||
move-cursor-on-screen *r *c
|
||||
move-cursor 0, *r *c
|
||||
}
|
||||
|
|
|
@ -24,6 +24,6 @@ fn dump in: (addr buffered-file) {
|
|||
var c/eax: byte <- read-byte-buffered in
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ $line-loop: {
|
|||
compare row, botrow
|
||||
break-if->=
|
||||
var col/edx: int <- copy leftcol
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
{
|
||||
compare col, rightcol
|
||||
break-if->=
|
||||
|
@ -29,7 +29,7 @@ $line-loop: {
|
|||
compare c, 0xffffffff # EOF marker
|
||||
break-if-= $line-loop
|
||||
# print c
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
col <- increment
|
||||
loop
|
||||
} # $char-loop
|
||||
|
@ -44,11 +44,11 @@ fn clear toprow: int, leftcol: int, botrow: int, rightcol: int {
|
|||
compare row, botrow
|
||||
break-if->=
|
||||
var col/edx: int <- copy leftcol
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
{
|
||||
compare col, rightcol
|
||||
break-if->=
|
||||
print-string-to-screen " "
|
||||
print-string 0, " "
|
||||
col <- increment
|
||||
loop
|
||||
}
|
||||
|
@ -76,6 +76,6 @@ fn dump in: (addr buffered-file) {
|
|||
var c/eax: byte <- read-byte-buffered in
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ $line-loop: {
|
|||
compare row, botrow
|
||||
break-if->=
|
||||
var col/edx: int <- copy leftcol
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
{
|
||||
compare col, rightcol
|
||||
break-if->=
|
||||
|
@ -31,7 +31,7 @@ $line-loop: {
|
|||
compare c, 0xa # newline
|
||||
break-if-= # no need to print newlines
|
||||
# print c
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
col <- increment
|
||||
loop
|
||||
} # $char-loop
|
||||
|
@ -46,11 +46,11 @@ fn clear toprow: int, leftcol: int, botrow: int, rightcol: int {
|
|||
compare row, botrow
|
||||
break-if->=
|
||||
var col/edx: int <- copy leftcol
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
{
|
||||
compare col, rightcol
|
||||
break-if->=
|
||||
print-string-to-screen " "
|
||||
print-string 0, " "
|
||||
col <- increment
|
||||
loop
|
||||
}
|
||||
|
@ -78,6 +78,6 @@ fn dump in: (addr buffered-file) {
|
|||
var c/eax: byte <- read-byte-buffered in
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ $line-loop: {
|
|||
compare row, botrow
|
||||
break-if->=
|
||||
var col/edx: int <- copy leftcol
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
{
|
||||
compare col, rightcol
|
||||
break-if->=
|
||||
|
@ -42,7 +42,7 @@ $line-loop: {
|
|||
compare c, 0xa # newline
|
||||
break-if-= # no need to print newlines
|
||||
# print c
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
col <- increment
|
||||
loop
|
||||
} # $char-loop
|
||||
|
@ -57,11 +57,11 @@ fn clear toprow: int, leftcol: int, botrow: int, rightcol: int {
|
|||
compare row, botrow
|
||||
break-if->=
|
||||
var col/edx: int <- copy leftcol
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
{
|
||||
compare col, rightcol
|
||||
break-if->=
|
||||
print-string-to-screen " "
|
||||
print-string 0, " "
|
||||
col <- increment
|
||||
loop
|
||||
}
|
||||
|
@ -89,6 +89,6 @@ fn dump in: (addr buffered-file) {
|
|||
var c/eax: byte <- read-byte-buffered in
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ fn main args: (addr array (addr array byte)) -> exit-status/ebx: int {
|
|||
enable-screen-grid-mode
|
||||
var nrows/eax: int <- copy 0
|
||||
var ncols/ecx: int <- copy 0
|
||||
nrows, ncols <- screen-size
|
||||
nrows, ncols <- screen-size 0
|
||||
enable-keyboard-immediate-mode
|
||||
{
|
||||
render file, nrows, ncols
|
||||
|
@ -36,7 +36,7 @@ $line-loop: {
|
|||
compare row, botrow
|
||||
break-if->=
|
||||
var col/edx: int <- copy leftcol
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
{
|
||||
compare col, rightcol
|
||||
break-if->=
|
||||
|
@ -46,7 +46,7 @@ $line-loop: {
|
|||
compare c, 0xa # newline
|
||||
break-if-= # no need to print newlines
|
||||
# print c
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
col <- increment
|
||||
loop
|
||||
} # $char-loop
|
||||
|
@ -61,11 +61,11 @@ fn clear toprow: int, leftcol: int, botrow: int, rightcol: int {
|
|||
compare row, botrow
|
||||
break-if->=
|
||||
var col/edx: int <- copy leftcol
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
{
|
||||
compare col, rightcol
|
||||
break-if->=
|
||||
print-string-to-screen " "
|
||||
print-string 0, " "
|
||||
col <- increment
|
||||
loop
|
||||
}
|
||||
|
@ -94,6 +94,6 @@ fn dump in: (addr buffered-file) {
|
|||
var c/eax: byte <- read-byte-buffered in
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ fn main args: (addr array (addr array byte)) -> exit-status/ebx: int {
|
|||
enable-screen-grid-mode
|
||||
var nrows/eax: int <- copy 0
|
||||
var ncols/ecx: int <- copy 0
|
||||
nrows, ncols <- screen-size
|
||||
nrows, ncols <- screen-size 0
|
||||
enable-keyboard-immediate-mode
|
||||
{
|
||||
render file, nrows, ncols
|
||||
|
@ -52,7 +52,7 @@ $line-loop: {
|
|||
compare row, botrow
|
||||
break-if->=
|
||||
var col/edx: int <- copy leftcol
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
{
|
||||
compare col, rightcol
|
||||
break-if->=
|
||||
|
@ -62,7 +62,7 @@ $line-loop: {
|
|||
compare c, 0xa # newline
|
||||
break-if-= # no need to print newlines
|
||||
# print c
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
col <- increment
|
||||
loop
|
||||
} # $char-loop
|
||||
|
@ -77,11 +77,11 @@ fn clear toprow: int, leftcol: int, botrow: int, rightcol: int {
|
|||
compare row, botrow
|
||||
break-if->=
|
||||
var col/edx: int <- copy leftcol
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
{
|
||||
compare col, rightcol
|
||||
break-if->=
|
||||
print-string-to-screen " "
|
||||
print-string 0, " "
|
||||
col <- increment
|
||||
loop
|
||||
}
|
||||
|
@ -110,6 +110,6 @@ fn dump in: (addr buffered-file) {
|
|||
var c/eax: byte <- read-byte-buffered in
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ fn main args: (addr array (addr array byte)) -> exit-status/ebx: int {
|
|||
enable-screen-grid-mode
|
||||
var nrows/eax: int <- copy 0
|
||||
var ncols/ecx: int <- copy 0
|
||||
nrows, ncols <- screen-size
|
||||
nrows, ncols <- screen-size 0
|
||||
enable-keyboard-immediate-mode
|
||||
{
|
||||
render file, nrows, ncols
|
||||
|
@ -39,7 +39,7 @@ fn render in: (addr buffered-file), nrows: int, ncols: int {
|
|||
var leftcol/edx: int <- copy 5 # page-margin
|
||||
var rightcol/ebx: int <- copy leftcol
|
||||
rightcol <- add 0x40 # page-width = 64 characters
|
||||
start-color-on-screen 0xec, 7 # 236 = darkish gray
|
||||
start-color 0, 0xec, 7 # 236 = darkish gray
|
||||
{
|
||||
compare rightcol, ncols
|
||||
break-if->=
|
||||
|
@ -59,7 +59,7 @@ $line-loop: {
|
|||
compare row, botrow
|
||||
break-if->=
|
||||
var col/edx: int <- copy leftcol
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
{
|
||||
compare col, rightcol
|
||||
break-if->=
|
||||
|
@ -70,7 +70,7 @@ $line-loop: {
|
|||
compare c, 0xa # newline
|
||||
break-if-= # no need to print newlines
|
||||
# print c
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
col <- increment
|
||||
loop
|
||||
} # $char-loop
|
||||
|
@ -90,7 +90,7 @@ $check-state: {
|
|||
{
|
||||
break-if-!=
|
||||
# r->current-state == 0 && c == '*' => bold text
|
||||
start-bold-on-screen
|
||||
start-bold 0
|
||||
copy-to *state, 1
|
||||
}
|
||||
break $check-state
|
||||
|
@ -101,7 +101,7 @@ $check-state: {
|
|||
{
|
||||
break-if-!=
|
||||
# r->current-state == 1 && c == '*' => normal text
|
||||
reset-formatting-on-screen
|
||||
reset-formatting 0
|
||||
copy-to *state, 0
|
||||
}
|
||||
}
|
||||
|
@ -114,11 +114,11 @@ fn clear toprow: int, leftcol: int, botrow: int, rightcol: int {
|
|||
compare row, botrow
|
||||
break-if->=
|
||||
var col/edx: int <- copy leftcol
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
{
|
||||
compare col, rightcol
|
||||
break-if->=
|
||||
print-string-to-screen " "
|
||||
print-string 0, " "
|
||||
col <- increment
|
||||
loop
|
||||
}
|
||||
|
@ -147,6 +147,6 @@ fn dump in: (addr buffered-file) {
|
|||
var c/eax: byte <- read-byte-buffered in
|
||||
compare c, 0xffffffff # EOF marker
|
||||
break-if-=
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
# https://archive.org/details/akkartik-2min-2020-07-01
|
||||
|
||||
fn main -> exit-status/ebx: int {
|
||||
clear-screen
|
||||
move-cursor-on-screen 5, 5
|
||||
print-string-to-screen "_________"
|
||||
clear-screen 0
|
||||
move-cursor 0, 5, 5
|
||||
print-string 0, "_________"
|
||||
enable-keyboard-immediate-mode
|
||||
var dummy/eax: byte <- read-key
|
||||
var row/eax: int <- copy 5
|
||||
|
@ -26,7 +26,7 @@ fn main -> exit-status/ebx: int {
|
|||
}
|
||||
var dummy/eax: byte <- read-key
|
||||
enable-keyboard-type-mode
|
||||
clear-screen
|
||||
clear-screen 0
|
||||
exit-status <- copy 0
|
||||
}
|
||||
|
||||
|
@ -35,11 +35,11 @@ fn animate row: int {
|
|||
{
|
||||
compare col, 0xe
|
||||
break-if-=
|
||||
move-cursor-on-screen row, col
|
||||
print-string-to-screen " "
|
||||
move-cursor 0, row, col
|
||||
print-string 0, " "
|
||||
increment row
|
||||
move-cursor-on-screen row, col
|
||||
print-string-to-screen "_"
|
||||
move-cursor 0, row, col
|
||||
print-string 0, "_"
|
||||
decrement row
|
||||
col <- increment
|
||||
loop
|
||||
|
|
|
@ -75,7 +75,7 @@ $main:loop: {
|
|||
render root-addr, cursor-addr
|
||||
loop
|
||||
}
|
||||
clear-screen
|
||||
clear-screen 0
|
||||
enable-keyboard-type-mode
|
||||
exit-status <- copy 0
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ fn create-child node: (handle cell) {
|
|||
#######################################################
|
||||
|
||||
fn render root: (addr cell), cursor: (addr cell) {
|
||||
clear-screen
|
||||
clear-screen 0
|
||||
var depth/eax: int <- tree-depth root
|
||||
var viewport-width/ecx: int <- copy 0x65 # col2
|
||||
viewport-width <- subtract 5 # col1
|
||||
|
@ -318,11 +318,11 @@ fn draw-hatching row1: int, col1: int, row2: int, col2: int {
|
|||
|
||||
fn draw-horizontal-line row: int, col1: int, col2: int {
|
||||
var col/eax: int <- copy col1
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
{
|
||||
compare col, col2
|
||||
break-if->=
|
||||
print-string-to-screen "-"
|
||||
print-string 0, "-"
|
||||
col <- increment
|
||||
loop
|
||||
}
|
||||
|
@ -333,8 +333,8 @@ fn draw-vertical-line row1: int, row2: int, col: int {
|
|||
{
|
||||
compare row, row2
|
||||
break-if->=
|
||||
move-cursor-on-screen row, col
|
||||
print-string-to-screen "|"
|
||||
move-cursor 0, row, col
|
||||
print-string 0, "|"
|
||||
row <- increment
|
||||
loop
|
||||
}
|
||||
|
@ -346,8 +346,8 @@ fn try-divide _nr: int, _dr: int -> result/eax: int {
|
|||
# x = next power-of-2 multiple of _dr after _nr
|
||||
var x/ecx: int <- copy 1
|
||||
{
|
||||
#? print-int32-hex-to-screen x
|
||||
#? print-string-to-screen "\n"
|
||||
#? print-int32-hex 0, x
|
||||
#? print-string 0, "\n"
|
||||
var tmp/edx: int <- copy _dr
|
||||
tmp <- multiply x
|
||||
compare tmp, _nr
|
||||
|
@ -355,7 +355,7 @@ fn try-divide _nr: int, _dr: int -> result/eax: int {
|
|||
x <- shift-left 1
|
||||
loop
|
||||
}
|
||||
#? print-string-to-screen "--\n"
|
||||
#? print-string 0, "--\n"
|
||||
# min, max = x/2, x
|
||||
var max/ecx: int <- copy x
|
||||
var min/edx: int <- copy max
|
||||
|
@ -363,8 +363,8 @@ fn try-divide _nr: int, _dr: int -> result/eax: int {
|
|||
# narrow down result between min and max
|
||||
var i/eax: int <- copy min
|
||||
{
|
||||
#? print-int32-hex-to-screen i
|
||||
#? print-string-to-screen "\n"
|
||||
#? print-int32-hex 0, i
|
||||
#? print-string 0, "\n"
|
||||
var foo/ebx: int <- copy _dr
|
||||
foo <- multiply i
|
||||
compare foo, _nr
|
||||
|
@ -374,9 +374,9 @@ fn try-divide _nr: int, _dr: int -> result/eax: int {
|
|||
}
|
||||
result <- copy i
|
||||
result <- decrement
|
||||
#? print-string-to-screen "=> "
|
||||
#? print-int32-hex-to-screen result
|
||||
#? print-string-to-screen "\n"
|
||||
#? print-string 0, "=> "
|
||||
#? print-int32-hex 0, result
|
||||
#? print-string 0, "\n"
|
||||
}
|
||||
|
||||
fn test-try-divide-1 {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
fn main -> exit-status/ebx: int {
|
||||
var num-lines/ecx: int <- copy 0x10
|
||||
clear-screen
|
||||
clear-screen 0
|
||||
# open a file
|
||||
var f: (addr buffered-file)
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ fn main -> exit-status/ebx: int {
|
|||
enable-keyboard-type-mode
|
||||
}
|
||||
# clean up
|
||||
clear-screen
|
||||
clear-screen 0
|
||||
exit-status <- copy 0
|
||||
}
|
||||
|
||||
|
@ -48,11 +48,11 @@ $render:clear-loop: {
|
|||
break-if-<=
|
||||
decrement start-row
|
||||
var col/eax: int <- copy 1
|
||||
move-cursor-on-screen start-row, col
|
||||
move-cursor 0, start-row, col
|
||||
{
|
||||
compare col, num-cols
|
||||
break-if->
|
||||
print-string-to-screen " "
|
||||
print-string 0, " "
|
||||
col <- increment
|
||||
loop
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ $render:clear-loop: {
|
|||
# render rest of screen below
|
||||
var row/edx: int <- copy start-row
|
||||
var col/ebx: int <- copy 1
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
$render:render-loop: {
|
||||
compare row, num-rows
|
||||
break-if->=
|
||||
|
@ -73,10 +73,10 @@ $render:render-loop: {
|
|||
break-if-!=
|
||||
row <- increment
|
||||
col <- copy 0
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
loop $render:render-loop
|
||||
}
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
col <- increment
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
fn main -> exit-status/ebx: int {
|
||||
var num-lines/ecx: int <- copy 0x64 # 100
|
||||
clear-screen
|
||||
clear-screen 0
|
||||
# open a file
|
||||
var f: (addr buffered-file)
|
||||
{
|
||||
|
@ -36,14 +36,14 @@ fn main -> exit-status/ebx: int {
|
|||
var t3/esi: int <- copy t2
|
||||
t3 <- subtract t1
|
||||
# clean up
|
||||
clear-screen
|
||||
clear-screen 0
|
||||
# results
|
||||
print-int32-hex-to-screen t1
|
||||
print-string-to-screen "\n"
|
||||
print-int32-hex-to-screen t2
|
||||
print-string-to-screen "\n"
|
||||
print-int32-hex-to-screen t3
|
||||
print-string-to-screen "\n"
|
||||
print-int32-hex 0, t1
|
||||
print-string 0, "\n"
|
||||
print-int32-hex 0, t2
|
||||
print-string 0, "\n"
|
||||
print-int32-hex 0, t3
|
||||
print-string 0, "\n"
|
||||
#
|
||||
exit-status <- copy 0
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ fn render f: (addr buffered-file), num-rows: int {
|
|||
# render screen
|
||||
var row/edx: int <- copy 1
|
||||
var col/ebx: int <- copy 1
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
$render:render-loop: {
|
||||
compare row, num-rows
|
||||
break-if->=
|
||||
|
@ -65,10 +65,10 @@ $render:render-loop: {
|
|||
break-if-!=
|
||||
row <- increment
|
||||
col <- copy 0
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
loop $render:render-loop
|
||||
}
|
||||
print-byte-to-screen c
|
||||
print-byte 0, c
|
||||
col <- increment
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
# $ ./a.elf
|
||||
|
||||
fn main -> exit-status/ebx: int {
|
||||
clear-screen
|
||||
clear-screen 0
|
||||
enable-keyboard-immediate-mode
|
||||
var dummy/eax: byte <- read-key
|
||||
draw-box 5, 5, 0x23, 0x23 # 35, 35
|
||||
|
@ -19,12 +19,12 @@ fn main -> exit-status/ebx: int {
|
|||
draw-box 5, 5, 0x23, 0xaf # 35, 175
|
||||
var dummy/eax: byte <- read-key
|
||||
enable-keyboard-type-mode
|
||||
clear-screen
|
||||
clear-screen 0
|
||||
exit-status <- copy 0
|
||||
}
|
||||
|
||||
fn draw-box row1: int, col1: int, row2: int, col2: int {
|
||||
clear-screen
|
||||
clear-screen 0
|
||||
draw-horizontal-line row1, col1, col2
|
||||
draw-vertical-line row1, row2, col1
|
||||
draw-horizontal-line row2, col1, col2
|
||||
|
@ -33,11 +33,11 @@ fn draw-box row1: int, col1: int, row2: int, col2: int {
|
|||
|
||||
fn draw-horizontal-line row: int, col1: int, col2: int {
|
||||
var col/eax: int <- copy col1
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
{
|
||||
compare col, col2
|
||||
break-if->=
|
||||
print-string-to-screen "-"
|
||||
print-string 0, "-"
|
||||
col <- increment
|
||||
loop
|
||||
}
|
||||
|
@ -48,8 +48,8 @@ fn draw-vertical-line row1: int, row2: int, col: int {
|
|||
{
|
||||
compare row, row2
|
||||
break-if->=
|
||||
move-cursor-on-screen row, col
|
||||
print-string-to-screen "|"
|
||||
move-cursor 0, row, col
|
||||
print-string 0, "|"
|
||||
row <- increment
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ $main:loop: {
|
|||
render root-addr
|
||||
loop
|
||||
}
|
||||
clear-screen
|
||||
clear-screen 0
|
||||
enable-keyboard-type-mode
|
||||
exit-status <- copy 0
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ fn create-child node: (addr cell) {
|
|||
#######################################################
|
||||
|
||||
fn render root: (addr cell) {
|
||||
clear-screen
|
||||
clear-screen 0
|
||||
var depth/eax: int <- tree-depth root
|
||||
var viewport-width/ecx: int <- copy 0x64 # col2
|
||||
viewport-width <- subtract 5 # col1
|
||||
|
@ -134,11 +134,11 @@ fn draw-box row1: int, col1: int, row2: int, col2: int {
|
|||
|
||||
fn draw-horizontal-line row: int, col1: int, col2: int {
|
||||
var col/eax: int <- copy col1
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
{
|
||||
compare col, col2
|
||||
break-if->=
|
||||
print-string-to-screen "-"
|
||||
print-string 0, "-"
|
||||
col <- increment
|
||||
loop
|
||||
}
|
||||
|
@ -149,8 +149,8 @@ fn draw-vertical-line row1: int, row2: int, col: int {
|
|||
{
|
||||
compare row, row2
|
||||
break-if->=
|
||||
move-cursor-on-screen row, col
|
||||
print-string-to-screen "|"
|
||||
move-cursor 0, row, col
|
||||
print-string 0, "|"
|
||||
row <- increment
|
||||
loop
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ $main:loop: {
|
|||
render root-addr
|
||||
loop
|
||||
}
|
||||
clear-screen
|
||||
clear-screen 0
|
||||
enable-keyboard-type-mode
|
||||
exit-status <- copy 0
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ fn process c: byte, root: (addr handle cell), cursor: (addr handle cell) {
|
|||
var c2/eax: (addr cell) <- lookup *c1
|
||||
var c3/edx: (addr cell) <- copy c2
|
||||
{
|
||||
print-string-to-screen "iter\n"
|
||||
print-string 0, "iter\n"
|
||||
var tmp/ebx: (addr handle cell) <- get c3, first-child
|
||||
var tmp2/eax: (addr cell) <- lookup *tmp
|
||||
compare tmp2, 0
|
||||
|
@ -106,7 +106,7 @@ fn create-child node: (addr cell) {
|
|||
#######################################################
|
||||
|
||||
fn render root: (addr cell) {
|
||||
clear-screen
|
||||
clear-screen 0
|
||||
var depth/eax: int <- tree-depth root
|
||||
var viewport-width/ecx: int <- copy 0x64 # col2
|
||||
viewport-width <- subtract 5 # col1
|
||||
|
@ -161,11 +161,11 @@ fn draw-box row1: int, col1: int, row2: int, col2: int {
|
|||
|
||||
fn draw-horizontal-line row: int, col1: int, col2: int {
|
||||
var col/eax: int <- copy col1
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
{
|
||||
compare col, col2
|
||||
break-if->=
|
||||
print-string-to-screen "-"
|
||||
print-string 0, "-"
|
||||
col <- increment
|
||||
loop
|
||||
}
|
||||
|
@ -176,8 +176,8 @@ fn draw-vertical-line row1: int, row2: int, col: int {
|
|||
{
|
||||
compare row, row2
|
||||
break-if->=
|
||||
move-cursor-on-screen row, col
|
||||
print-string-to-screen "|"
|
||||
move-cursor 0, row, col
|
||||
print-string 0, "|"
|
||||
row <- increment
|
||||
loop
|
||||
}
|
||||
|
@ -189,8 +189,8 @@ fn try-divide _nr: int, _dr: int -> result/eax: int {
|
|||
# x = next power-of-2 multiple of _dr after _nr
|
||||
var x/ecx: int <- copy 1
|
||||
{
|
||||
#? print-int32-hex-to-screen x
|
||||
#? print-string-to-screen "\n"
|
||||
#? print-int32-hex 0, x
|
||||
#? print-string 0, "\n"
|
||||
var tmp/edx: int <- copy _dr
|
||||
tmp <- multiply x
|
||||
compare tmp, _nr
|
||||
|
@ -198,7 +198,7 @@ fn try-divide _nr: int, _dr: int -> result/eax: int {
|
|||
x <- shift-left 1
|
||||
loop
|
||||
}
|
||||
#? print-string-to-screen "--\n"
|
||||
#? print-string 0, "--\n"
|
||||
# min, max = x/2, x
|
||||
var max/ecx: int <- copy x
|
||||
var min/edx: int <- copy max
|
||||
|
@ -206,8 +206,8 @@ fn try-divide _nr: int, _dr: int -> result/eax: int {
|
|||
# narrow down result between min and max
|
||||
var i/eax: int <- copy min
|
||||
{
|
||||
#? print-int32-hex-to-screen i
|
||||
#? print-string-to-screen "\n"
|
||||
#? print-int32-hex 0, i
|
||||
#? print-string 0, "\n"
|
||||
var foo/ebx: int <- copy _dr
|
||||
foo <- multiply i
|
||||
compare foo, _nr
|
||||
|
@ -217,9 +217,9 @@ fn try-divide _nr: int, _dr: int -> result/eax: int {
|
|||
}
|
||||
result <- copy i
|
||||
result <- decrement
|
||||
#? print-string-to-screen "=> "
|
||||
#? print-int32-hex-to-screen result
|
||||
#? print-string-to-screen "\n"
|
||||
#? print-string 0, "=> "
|
||||
#? print-int32-hex 0, result
|
||||
#? print-string 0, "\n"
|
||||
}
|
||||
|
||||
fn test-try-divide-1 {
|
||||
|
|
|
@ -72,7 +72,7 @@ $main:loop: {
|
|||
render root-addr
|
||||
loop
|
||||
}
|
||||
clear-screen
|
||||
clear-screen 0
|
||||
enable-keyboard-type-mode
|
||||
exit-status <- copy 0
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ fn create-child node: (addr cell) {
|
|||
#######################################################
|
||||
|
||||
fn render root: (addr cell) {
|
||||
clear-screen
|
||||
clear-screen 0
|
||||
var depth/eax: int <- tree-depth root
|
||||
var viewport-width/ecx: int <- copy 0x64 # col2
|
||||
viewport-width <- subtract 5 # col1
|
||||
|
@ -175,11 +175,11 @@ fn draw-box row1: int, col1: int, row2: int, col2: int {
|
|||
|
||||
fn draw-horizontal-line row: int, col1: int, col2: int {
|
||||
var col/eax: int <- copy col1
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
{
|
||||
compare col, col2
|
||||
break-if->=
|
||||
print-string-to-screen "-"
|
||||
print-string 0, "-"
|
||||
col <- increment
|
||||
loop
|
||||
}
|
||||
|
@ -190,8 +190,8 @@ fn draw-vertical-line row1: int, row2: int, col: int {
|
|||
{
|
||||
compare row, row2
|
||||
break-if->=
|
||||
move-cursor-on-screen row, col
|
||||
print-string-to-screen "|"
|
||||
move-cursor 0, row, col
|
||||
print-string 0, "|"
|
||||
row <- increment
|
||||
loop
|
||||
}
|
||||
|
@ -203,8 +203,8 @@ fn try-divide _nr: int, _dr: int -> result/eax: int {
|
|||
# x = next power-of-2 multiple of _dr after _nr
|
||||
var x/ecx: int <- copy 1
|
||||
{
|
||||
#? print-int32-hex-to-screen x
|
||||
#? print-string-to-screen "\n"
|
||||
#? print-int32-hex 0, x
|
||||
#? print-string 0, "\n"
|
||||
var tmp/edx: int <- copy _dr
|
||||
tmp <- multiply x
|
||||
compare tmp, _nr
|
||||
|
@ -212,7 +212,7 @@ fn try-divide _nr: int, _dr: int -> result/eax: int {
|
|||
x <- shift-left 1
|
||||
loop
|
||||
}
|
||||
#? print-string-to-screen "--\n"
|
||||
#? print-string 0, "--\n"
|
||||
# min, max = x/2, x
|
||||
var max/ecx: int <- copy x
|
||||
var min/edx: int <- copy max
|
||||
|
@ -220,8 +220,8 @@ fn try-divide _nr: int, _dr: int -> result/eax: int {
|
|||
# narrow down result between min and max
|
||||
var i/eax: int <- copy min
|
||||
{
|
||||
#? print-int32-hex-to-screen i
|
||||
#? print-string-to-screen "\n"
|
||||
#? print-int32-hex 0, i
|
||||
#? print-string 0, "\n"
|
||||
var foo/ebx: int <- copy _dr
|
||||
foo <- multiply i
|
||||
compare foo, _nr
|
||||
|
@ -231,9 +231,9 @@ fn try-divide _nr: int, _dr: int -> result/eax: int {
|
|||
}
|
||||
result <- copy i
|
||||
result <- decrement
|
||||
#? print-string-to-screen "=> "
|
||||
#? print-int32-hex-to-screen result
|
||||
#? print-string-to-screen "\n"
|
||||
#? print-string 0, "=> "
|
||||
#? print-int32-hex 0, result
|
||||
#? print-string 0, "\n"
|
||||
}
|
||||
|
||||
fn test-try-divide-1 {
|
||||
|
|
|
@ -72,7 +72,7 @@ $main:loop: {
|
|||
render root-addr
|
||||
loop
|
||||
}
|
||||
clear-screen
|
||||
clear-screen 0
|
||||
enable-keyboard-type-mode
|
||||
exit-status <- copy 0
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ fn create-child node: (addr cell) {
|
|||
#######################################################
|
||||
|
||||
fn render root: (addr cell) {
|
||||
clear-screen
|
||||
clear-screen 0
|
||||
var depth/eax: int <- tree-depth root
|
||||
var viewport-width/ecx: int <- copy 0x64 # col2
|
||||
viewport-width <- subtract 5 # col1
|
||||
|
@ -205,11 +205,11 @@ fn draw-box row1: int, col1: int, row2: int, col2: int {
|
|||
|
||||
fn draw-horizontal-line row: int, col1: int, col2: int {
|
||||
var col/eax: int <- copy col1
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
{
|
||||
compare col, col2
|
||||
break-if->=
|
||||
print-string-to-screen "-"
|
||||
print-string 0, "-"
|
||||
col <- increment
|
||||
loop
|
||||
}
|
||||
|
@ -220,8 +220,8 @@ fn draw-vertical-line row1: int, row2: int, col: int {
|
|||
{
|
||||
compare row, row2
|
||||
break-if->=
|
||||
move-cursor-on-screen row, col
|
||||
print-string-to-screen "|"
|
||||
move-cursor 0, row, col
|
||||
print-string 0, "|"
|
||||
row <- increment
|
||||
loop
|
||||
}
|
||||
|
@ -233,8 +233,8 @@ fn try-divide _nr: int, _dr: int -> result/eax: int {
|
|||
# x = next power-of-2 multiple of _dr after _nr
|
||||
var x/ecx: int <- copy 1
|
||||
{
|
||||
#? print-int32-hex-to-screen x
|
||||
#? print-string-to-screen "\n"
|
||||
#? print-int32-hex 0, x
|
||||
#? print-string 0, "\n"
|
||||
var tmp/edx: int <- copy _dr
|
||||
tmp <- multiply x
|
||||
compare tmp, _nr
|
||||
|
@ -242,7 +242,7 @@ fn try-divide _nr: int, _dr: int -> result/eax: int {
|
|||
x <- shift-left 1
|
||||
loop
|
||||
}
|
||||
#? print-string-to-screen "--\n"
|
||||
#? print-string 0, "--\n"
|
||||
# min, max = x/2, x
|
||||
var max/ecx: int <- copy x
|
||||
var min/edx: int <- copy max
|
||||
|
@ -250,8 +250,8 @@ fn try-divide _nr: int, _dr: int -> result/eax: int {
|
|||
# narrow down result between min and max
|
||||
var i/eax: int <- copy min
|
||||
{
|
||||
#? print-int32-hex-to-screen i
|
||||
#? print-string-to-screen "\n"
|
||||
#? print-int32-hex 0, i
|
||||
#? print-string 0, "\n"
|
||||
var foo/ebx: int <- copy _dr
|
||||
foo <- multiply i
|
||||
compare foo, _nr
|
||||
|
@ -261,9 +261,9 @@ fn try-divide _nr: int, _dr: int -> result/eax: int {
|
|||
}
|
||||
result <- copy i
|
||||
result <- decrement
|
||||
#? print-string-to-screen "=> "
|
||||
#? print-int32-hex-to-screen result
|
||||
#? print-string-to-screen "\n"
|
||||
#? print-string 0, "=> "
|
||||
#? print-int32-hex 0, result
|
||||
#? print-string 0, "\n"
|
||||
}
|
||||
|
||||
fn test-try-divide-1 {
|
||||
|
|
|
@ -71,7 +71,7 @@ $main:loop: {
|
|||
render root-addr, cursor-addr
|
||||
loop
|
||||
}
|
||||
clear-screen
|
||||
clear-screen 0
|
||||
enable-keyboard-type-mode
|
||||
exit-status <- copy 0
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ fn create-child node: (addr cell) {
|
|||
#######################################################
|
||||
|
||||
fn render root: (addr cell), cursor: (addr cell) {
|
||||
clear-screen
|
||||
clear-screen 0
|
||||
var depth/eax: int <- tree-depth root
|
||||
var viewport-width/ecx: int <- copy 0x64 # col2
|
||||
viewport-width <- subtract 5 # col1
|
||||
|
@ -283,11 +283,11 @@ fn draw-box row1: int, col1: int, row2: int, col2: int {
|
|||
|
||||
fn draw-horizontal-line row: int, col1: int, col2: int {
|
||||
var col/eax: int <- copy col1
|
||||
move-cursor-on-screen row, col
|
||||
move-cursor 0, row, col
|
||||
{
|
||||
compare col, col2
|
||||
break-if->=
|
||||
print-string-to-screen "-"
|
||||
print-string 0, "-"
|
||||
col <- increment
|
||||
loop
|
||||
}
|
||||
|
@ -298,8 +298,8 @@ fn draw-vertical-line row1: int, row2: int, col: int {
|
|||
{
|
||||
compare row, row2
|
||||
break-if->=
|
||||
move-cursor-on-screen row, col
|
||||
print-string-to-screen "|"
|
||||
move-cursor 0, row, col
|
||||
print-string 0, "|"
|
||||
row <- increment
|
||||
loop
|
||||
}
|
||||
|
@ -311,8 +311,8 @@ fn try-divide _nr: int, _dr: int -> result/eax: int {
|
|||
# x = next power-of-2 multiple of _dr after _nr
|
||||
var x/ecx: int <- copy 1
|
||||
{
|
||||
#? print-int32-hex-to-screen x
|
||||
#? print-string-to-screen "\n"
|
||||
#? print-int32-hex 0, x
|
||||
#? print-string 0, "\n"
|
||||
var tmp/edx: int <- copy _dr
|
||||
tmp <- multiply x
|
||||
compare tmp, _nr
|
||||
|
@ -320,7 +320,7 @@ fn try-divide _nr: int, _dr: int -> result/eax: int {
|
|||
x <- shift-left 1
|
||||
loop
|
||||
}
|
||||
#? print-string-to-screen "--\n"
|
||||
#? print-string 0, "--\n"
|
||||
# min, max = x/2, x
|
||||
var max/ecx: int <- copy x
|
||||
var min/edx: int <- copy max
|
||||
|
@ -328,8 +328,8 @@ fn try-divide _nr: int, _dr: int -> result/eax: int {
|
|||
# narrow down result between min and max
|
||||
var i/eax: int <- copy min
|
||||
{
|
||||
#? print-int32-hex-to-screen i
|
||||
#? print-string-to-screen "\n"
|
||||
#? print-int32-hex 0, i
|
||||
#? print-string 0, "\n"
|
||||
var foo/ebx: int <- copy _dr
|
||||
foo <- multiply i
|
||||
compare foo, _nr
|
||||
|
@ -339,9 +339,9 @@ fn try-divide _nr: int, _dr: int -> result/eax: int {
|
|||
}
|
||||
result <- copy i
|
||||
result <- decrement
|
||||
#? print-string-to-screen "=> "
|
||||
#? print-int32-hex-to-screen result
|
||||
#? print-string-to-screen "\n"
|
||||
#? print-string 0, "=> "
|
||||
#? print-int32-hex 0, result
|
||||
#? print-string 0, "\n"
|
||||
}
|
||||
|
||||
fn test-try-divide-1 {
|
||||
|
|
Loading…
Reference in New Issue