1b39a60ff0
hello2 — stdio vs conio output API comparison (fast/no-attr vs
slower/attributed), also exercises textcolor/textbackground.
simple — packed 2-bit style array bit-twiddling smoke test.
banktest — __banked function calls across two explicit banks in huge
memory mode.
hello2.c updated to call the renamed gettextmode/settextmode (see the
conio rename in 5e5e70d).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
47 lines
1.0 KiB
C
47 lines
1.0 KiB
C
/*
|
|
* hello — smoke test for the two output APIs:
|
|
*
|
|
* stdio (printf/puts/putchar) — FAST, no attribute (ambient colour)
|
|
* conio (cprintf/cputs/putch) — SLOWER, applies textcolor/textbackground
|
|
*
|
|
* Demonstrates textcolor/textbackground (Turbo-C-compatible names).
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <conio.h>
|
|
#include <gfx.h>
|
|
#include <sprinter.h>
|
|
#include <sprinter_exit.h>
|
|
#include <errno.h>
|
|
|
|
static uint8_t buff[] = {0xE4, 0x1B};
|
|
|
|
uint8_t get_style(uint32_t idx) {
|
|
return (uint8_t)((buff[idx >> 2] >> ((idx & 3) << 1)) & 3u);
|
|
}
|
|
|
|
void set_style(uint32_t idx, uint8_t style) {
|
|
buff[idx >> 2] = buff[idx >> 2] & ~(3u << ((idx & 3) << 1)) | ((style & 3u) << ((idx & 3) << 1));
|
|
}
|
|
|
|
int main(void)
|
|
{
|
|
for(int i = 0; i < 8; i++) {
|
|
dec8(get_style(i));
|
|
puts("");
|
|
}
|
|
|
|
for(int i = 0; i < 8; i++) {
|
|
set_style(i, (i + 1) & 3);
|
|
}
|
|
puts("");
|
|
for(int i = 0; i < 8; i++) {
|
|
dec8(get_style(i));
|
|
puts("");
|
|
}
|
|
|
|
cputs("Press any key to exit...");
|
|
(void)getchar();
|
|
return 0;
|
|
}
|