implement more control codes

This commit is contained in:
2021-12-31 23:09:49 +01:00
parent cd1275a78f
commit ed9d9fdeb5
3 changed files with 48 additions and 3 deletions

View File

@@ -6,7 +6,11 @@ export fn upd() {
} }
data 0x20000 { data 0x20000 {
i8(14, 0xfd, 12) // clear screen to color 0xfd i8(14, 0xfd, 15, 15, 12) // clear screen to color 0xfd
"Top left" "Top left"
i8(31, 28, 29) "Bottom right"
i8(31, 1, 2, 14, 10, 15, 0xf0) "Other colors"
i8(24)" inverted"
i8(5, 31, 6, 28, 15, 0xe5) "warning!"
i8(0) i8(0)
} }

Binary file not shown.

View File

@@ -331,6 +331,20 @@ fn printSingleChar(char: i32) {
return; return;
} }
if char == 8 {
textCursorX = textCursorX - 8;
if !graphicsText & textCursorX < 0 {
textCursorX = 320-8;
printSingleChar(11);
}
return;
}
if char == 9 {
textCursorX = textCursorX + 8;
return;
}
if char == 10 { if char == 10 {
textCursorY = textCursorY + 8; textCursorY = textCursorY + 8;
if !graphicsText & textCursorY >= 240 { if !graphicsText & textCursorY >= 240 {
@@ -345,6 +359,20 @@ fn printSingleChar(char: i32) {
return; return;
} }
if char == 11 {
textCursorY = textCursorY - 8;
if !graphicsText & textCursorY < 0 {
textCursorY = 0;
let i = 320 * (240 - 8);
loop scroll_copy {
i!(116 + 320 * 8) = i!116;
branch_if (i := i - 4): scroll_copy;
}
rectangle(0 as f32, 0 as f32, 320 as f32, 8 as f32, bgColor);
}
return;
}
if char == 12 { if char == 12 {
cls(bgColor); cls(bgColor);
return; return;
@@ -365,6 +393,19 @@ fn printSingleChar(char: i32) {
return; return;
} }
if char == 24 {
let tmp = textColor;
textColor = bgColor;
bgColor = tmp;
return;
}
if char == 31 {
textCursorX = 0x12d20?1 * (8 - graphicsText * 6);
textCursorY = 0x12d20?2 * (8 - graphicsText * 7);
return;
}
drawChar(char); drawChar(char);
} }
@@ -373,11 +414,11 @@ data(0x12d00) {
1, 2, 1, 1, // 0-3 1, 2, 1, 1, // 0-3
1, 1, 1, 1, // 4-7 1, 1, 1, 1, // 4-7
1, 1, 1, 1, // 8-11 1, 1, 1, 1, // 8-11
1, 1, 2, 1, // 12-15, 1, 1, 2, 2, // 12-15,
1, 1, 1, 1, // 16-19, 1, 1, 1, 1, // 16-19,
1, 1, 1, 1, // 20-23, 1, 1, 1, 1, // 20-23,
1, 1, 1, 1, // 24-27, 1, 1, 1, 1, // 24-27,
1, 1, 1, 1 // 28-31 1, 1, 1, 3 // 28-31
) )
} }