7701
This commit is contained in:
parent
94e43069c7
commit
c1e841fc2d
|
@ -1,6 +1,6 @@
|
||||||
# some primitives for moving the cursor without making assumptions about
|
# some primitives for moving the cursor without making assumptions about
|
||||||
# raster order
|
# raster order
|
||||||
fn cursor-left screen: (addr screen) {
|
fn move-cursor-left screen: (addr screen) {
|
||||||
var cursor-x/eax: int <- copy 0
|
var cursor-x/eax: int <- copy 0
|
||||||
var cursor-y/ecx: int <- copy 0
|
var cursor-y/ecx: int <- copy 0
|
||||||
cursor-x, cursor-y <- cursor-position screen
|
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
|
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 _width/eax: int <- copy 0
|
||||||
var dummy/ecx: int <- copy 0
|
var dummy/ecx: int <- copy 0
|
||||||
_width, dummy <- screen-size screen
|
_width, dummy <- screen-size screen
|
||||||
|
@ -31,7 +31,7 @@ fn cursor-right screen: (addr screen) {
|
||||||
set-cursor-position screen, cursor-x, cursor-y
|
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-x/eax: int <- copy 0
|
||||||
var cursor-y/ecx: int <- copy 0
|
var cursor-y/ecx: int <- copy 0
|
||||||
cursor-x, cursor-y <- cursor-position screen
|
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
|
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 dummy/eax: int <- copy 0
|
||||||
var _height/ecx: int <- copy 0
|
var _height/ecx: int <- copy 0
|
||||||
dummy, _height <- screen-size screen
|
dummy, _height <- screen-size screen
|
||||||
|
|
|
@ -21,28 +21,28 @@ fn main {
|
||||||
break-if-!=
|
break-if-!=
|
||||||
var g/eax: grapheme <- copy 0x2d/dash
|
var g/eax: grapheme <- copy 0x2d/dash
|
||||||
draw-grapheme-at-cursor 0/screen, g, 0x31/fg, 0/bg
|
draw-grapheme-at-cursor 0/screen, g, 0x31/fg, 0/bg
|
||||||
cursor-left 0
|
move-cursor-left 0
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
compare key, 0x6a/j
|
compare key, 0x6a/j
|
||||||
break-if-!=
|
break-if-!=
|
||||||
var g/eax: grapheme <- copy 0x7c/vertical-bar
|
var g/eax: grapheme <- copy 0x7c/vertical-bar
|
||||||
draw-grapheme-at-cursor 0/screen, g, 0x31/fg, 0/bg
|
draw-grapheme-at-cursor 0/screen, g, 0x31/fg, 0/bg
|
||||||
cursor-down 0
|
move-cursor-down 0
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
compare key, 0x6b/k
|
compare key, 0x6b/k
|
||||||
break-if-!=
|
break-if-!=
|
||||||
var g/eax: grapheme <- copy 0x7c/vertical-bar
|
var g/eax: grapheme <- copy 0x7c/vertical-bar
|
||||||
draw-grapheme-at-cursor 0/screen, g, 0x31/fg, 0/bg
|
draw-grapheme-at-cursor 0/screen, g, 0x31/fg, 0/bg
|
||||||
cursor-up 0
|
move-cursor-up 0
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
compare key, 0x6c/l
|
compare key, 0x6c/l
|
||||||
break-if-!=
|
break-if-!=
|
||||||
var g/eax: grapheme <- copy 0x2d/dash
|
var g/eax: grapheme <- copy 0x2d/dash
|
||||||
draw-grapheme-at-cursor 0/screen, g, 0x31/fg, 0/bg
|
draw-grapheme-at-cursor 0/screen, g, 0x31/fg, 0/bg
|
||||||
cursor-right 0
|
move-cursor-right 0
|
||||||
}
|
}
|
||||||
loop
|
loop
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ fn main -> _/ebx: int {
|
||||||
append-byte in, key2
|
append-byte in, key2
|
||||||
var g/eax: grapheme <- copy key2
|
var g/eax: grapheme <- copy key2
|
||||||
draw-grapheme-at-cursor 0/screen, g, 0xf/fg, 0/bg
|
draw-grapheme-at-cursor 0/screen, g, 0xf/fg, 0/bg
|
||||||
cursor-right 0
|
move-cursor-right 0
|
||||||
loop
|
loop
|
||||||
}
|
}
|
||||||
# clear cursor
|
# clear cursor
|
||||||
|
|
Loading…
Reference in New Issue