This commit is contained in:
Kartik K. Agaram 2021-02-09 20:53:47 -08:00
parent 94e43069c7
commit c1e841fc2d
3 changed files with 9 additions and 9 deletions

View File

@ -1,6 +1,6 @@
# some primitives for moving the cursor without making assumptions about
# raster order
fn cursor-left screen: (addr screen) {
fn move-cursor-left screen: (addr screen) {
var cursor-x/eax: int <- copy 0
var cursor-y/ecx: int <- copy 0
cursor-x, cursor-y <- cursor-position screen
@ -13,7 +13,7 @@ fn cursor-left screen: (addr screen) {
set-cursor-position screen, cursor-x, cursor-y
}
fn cursor-right screen: (addr screen) {
fn move-cursor-right screen: (addr screen) {
var _width/eax: int <- copy 0
var dummy/ecx: int <- copy 0
_width, dummy <- screen-size screen
@ -31,7 +31,7 @@ fn cursor-right screen: (addr screen) {
set-cursor-position screen, cursor-x, cursor-y
}
fn cursor-up screen: (addr screen) {
fn move-cursor-up screen: (addr screen) {
var cursor-x/eax: int <- copy 0
var cursor-y/ecx: int <- copy 0
cursor-x, cursor-y <- cursor-position screen
@ -44,7 +44,7 @@ fn cursor-up screen: (addr screen) {
set-cursor-position screen, cursor-x, cursor-y
}
fn cursor-down screen: (addr screen) {
fn move-cursor-down screen: (addr screen) {
var dummy/eax: int <- copy 0
var _height/ecx: int <- copy 0
dummy, _height <- screen-size screen

View File

@ -21,28 +21,28 @@ fn main {
break-if-!=
var g/eax: grapheme <- copy 0x2d/dash
draw-grapheme-at-cursor 0/screen, g, 0x31/fg, 0/bg
cursor-left 0
move-cursor-left 0
}
{
compare key, 0x6a/j
break-if-!=
var g/eax: grapheme <- copy 0x7c/vertical-bar
draw-grapheme-at-cursor 0/screen, g, 0x31/fg, 0/bg
cursor-down 0
move-cursor-down 0
}
{
compare key, 0x6b/k
break-if-!=
var g/eax: grapheme <- copy 0x7c/vertical-bar
draw-grapheme-at-cursor 0/screen, g, 0x31/fg, 0/bg
cursor-up 0
move-cursor-up 0
}
{
compare key, 0x6c/l
break-if-!=
var g/eax: grapheme <- copy 0x2d/dash
draw-grapheme-at-cursor 0/screen, g, 0x31/fg, 0/bg
cursor-right 0
move-cursor-right 0
}
loop
}

View File

@ -38,7 +38,7 @@ fn main -> _/ebx: int {
append-byte in, key2
var g/eax: grapheme <- copy key2
draw-grapheme-at-cursor 0/screen, g, 0xf/fg, 0/bg
cursor-right 0
move-cursor-right 0
loop
}
# clear cursor