Files
Sprinter-SDCC/tests/conio2/conio2.c
T
snark13 737c974400 Add mdview markdown viewer, reorganize tests/examples and libc layout
- Split tests/ (libc feature tests) and examples/ (real apps); shared
  app.mk in repo root, was examples/example.mk
- libc/io/* split into libc/{conio,env,errno,file,mouse,string,sys,
  time,video}/ — clearer module boundaries
- New examples/mdview/: markdown viewer (Phases 1-5 + light nested
  lists). Headers (H1-H4), HR, ulist/olist/quote with nesting via
  leading spaces, fenced code blocks, inline emphasis (bold/italic/
  underscore/code), wrap/unwrap mode with soft wrap (F2), horizontal
  pan (← →) with '>' truncation indicator
- libc additions: scroll() in conio (ESTEX SCROLL), strlwr/strupr,
  gets() test
- Makefile updates across tests/ for the new shared app.mk path

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-04 22:23:36 +03:00

64 lines
1.6 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#include <stdio.h>
#include <conio.h>
#include <unistd.h> /* sleep */
/*
* Exercises every conio function:
* clrscr — clear the screen
* gotoxy — move cursor to (x, y), 0-based
* putch — single character
* cputs — string without auto-newline
* kbhit — non-blocking key probe
* getch — blocking, no echo
* getche — blocking, with echo
*
* Sprinter native text mode is 80×32, so we anchor corners at
* (0,0), (79,0), (0,31), (79,31).
*/
int main(void)
{
/* 1. clrscr + diagnostic probes + a centered banner.
*
* Row-0 probe: figure out why [NW]/[NE] don't paint.
* '0','1','2','3' — single putch at row 0, cols 0/5/40/79
* "R0" — cputs at row 0, col 10
* 'a','b','c','R1'— same pattern on row 1 (control)
*/
clrscr();
gotoxy(0, 0); putch('0');
textattr(0x70);
gotoxy(1, 0); putch('1');
set_putch_raw_mode(1);
textattr(0x0F);
gotoxy(4, 3);
for (int i = 0; i < 16; i++) {
putch(i < 10 ? '0' + i : 'A' - 10 + i);
putch(' ');
}
for (int j = 0; j < 16; j++) {
gotoxy(2, 4 + j);
textattr(0x0F);
putch(j < 10 ? '0' + j : 'A' - 10 + j);
putch(' ');
for (int i = 0; i < 16; i++) {
textattr((j << 4) + i);
putch((j << 4) + i); putch(' ');
}
}
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");
(void)getch();
return 0;
}