Files
Sprinter-SDCC/examples/conio2/conio2.c
T
snark13 c71e249a4e Add full compiler toolchain, libc, examples and reference docs
First substantive commit: the entire Sprinter C compiler tree on top of
the bare README+gitignore initial commit.

What's in here:
  bin/sprinter-cc        — driver script invoking SDCC + linker + mkexe
  libc/                  — Sprinter-specific libc layer over ESTEX/BIOS
                           (conio, gfx, io, mem, stdio + headers)
  runtime/               — crt0 variants (default/small/banked/minimal)
                           + heap + bank trampolines
  toolchain/             — mkexe (SprintEXE packer, C + tests)
  examples/              — 30 demo programs (gfx, file I/O, env, time, …)
  lib/Makefile           — builds the libc archive (sprinter.lib)
  docs/                  — converted Sprinter manuals + asm reference samples
  third_party/           — solid-c reference compiler dump + sdcc setup script
  release_docs/          — packaging / release notes

gitignore overhaul:
  • Drop dangerous blanket patterns: *.asm (would hide docs/samples/*.asm)
    and *.exe (case-insensitive match was hiding third_party/solid-c/*.EXE
    on macOS APFS).  Replaced with examples/*/*.{asm,exe,…} and lib/*.lib.
  • Restore tracking of toolchain/mkexe/tests/{one,big}.bin — those are
    INPUT fixtures, not build outputs.
  • Collapse the duplicated SDCC/C/Sdcc sections into one section per
    concern (build outputs / vendored / OS-junk).
  • Add .sprinter-cc-*/, build/ (catches lib/build/ too), .claude/.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-03 16:13:21 +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;
}