conio: switch cursor get/set to BIOS calls, rename text-mode accessors
_get_cursor/_set_cursor now use BIOS GetCursor/SetCursor (RST 8, 08Eh/084h) instead of ESTEX CURSOR/LOCATE; cursor position packed into a two_bytes union. get_videotextmode/set_videotextmode renamed to gettextmode/settextmode. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+27
-5
@@ -1,6 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include <conio.h>
|
||||
#include <unistd.h> /* sleep */
|
||||
#include <sprinter_exit.h>
|
||||
|
||||
/*
|
||||
* Exercises every conio function:
|
||||
@@ -16,6 +17,8 @@
|
||||
* (0,0), (79,0), (0,31), (79,31).
|
||||
*/
|
||||
|
||||
extern two_bytes pc_place;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
/* 1. clrscr + diagnostic probes + a centered banner.
|
||||
@@ -27,9 +30,16 @@ int main(void)
|
||||
*/
|
||||
clrscr();
|
||||
|
||||
gotoxy(0, 0); putch('0');
|
||||
gotoxy(1, 0);
|
||||
textattr(0x07);
|
||||
putch('0');
|
||||
textattr(0x70);
|
||||
gotoxy(1, 0); putch('1');
|
||||
putch('1');
|
||||
// gotoxy(10, 20);
|
||||
printf("X = %u, Y = %u\n", pc_place.byte.low, pc_place.byte.high);
|
||||
uint8_t x = wherex();
|
||||
uint8_t y = wherey();
|
||||
printf("X = %u, Y = %u\n", x, y);
|
||||
|
||||
set_putch_raw_mode(1);
|
||||
|
||||
@@ -51,11 +61,23 @@ int main(void)
|
||||
}
|
||||
}
|
||||
|
||||
set_text_attr(0x011D);
|
||||
set_putch_raw_mode(0);
|
||||
gotoxy(0,22);
|
||||
set_text_attr(0x000E);
|
||||
// cputs("Test message line");
|
||||
cputs("Test message line 1\nTest message line2\rline3\n\r\n\r1234\t5678\b90");
|
||||
cputs("Test message line 1\nTest message line2\rline3\n\r1234\t5678\b90\n\r");
|
||||
|
||||
set_putch_raw_mode(1);
|
||||
gotoxy(0,25);
|
||||
cputs("Test message line 1\nTest message line2\rline3\n\r1234\t5678\b90\n\r");
|
||||
|
||||
set_text_attr(0x001D);
|
||||
set_putch_raw_mode(0);
|
||||
gotoxy(0,28);
|
||||
cputs("Test message line 1\nTest message line2\rline3\n\r1234\t5678\b90\n\r");
|
||||
|
||||
set_putch_raw_mode(1);
|
||||
gotoxy(0,31);
|
||||
cputs("Test message line 1\nTest message line2\rline3\n\r1234\t5678\b90\n\r");
|
||||
|
||||
(void)getch();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user