tests: add hello2, simple, banktest smoke tests
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>
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
# Build banked.exe — HUGE memory mode (small + banked code in W3).
|
||||
#
|
||||
# Layout:
|
||||
# CODE/HOME at 0x4100 (W1), DATA at 0x8000 (W2), banks at 0x{N}C000 (W3).
|
||||
# crt0_banked.s loads N banks from the .EXE before calling main.
|
||||
|
||||
PROJ_ROOT := $(abspath $(CURDIR)/../..)
|
||||
EXAMPLE := banked
|
||||
MEMORY := huge
|
||||
EXTRA_FLAGS := --bank 1=bank1.c --bank 2=bank2.c
|
||||
include $(PROJ_ROOT)/app.mk
|
||||
@@ -0,0 +1,18 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <sprinter.h>
|
||||
|
||||
uint16_t bank1var = 0;
|
||||
extern uint16_t bank2var;
|
||||
|
||||
void bank1_func(void) __banked
|
||||
{
|
||||
printf("BANK1: hello from the first bank, phys page = 0x%02X, var = %u\n", _io_page_w3, bank1var);
|
||||
}
|
||||
|
||||
void bank1_func2(uint16_t x) __banked
|
||||
{
|
||||
printf("BANK1: hello from the first bank, phys page = 0x%02X, set var in SECOND bank to %u\n", _io_page_w3, x);
|
||||
bank2var = x;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <sprinter.h>
|
||||
|
||||
uint16_t bank2var = 0;
|
||||
|
||||
void bank2_func(void) __banked
|
||||
{
|
||||
printf("BANK2: hello from the second bank, phys page = 0x%02X, var = %u\n", _io_page_w3, bank2var);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <sprinter.h>
|
||||
|
||||
/* crt0_banked.s reads this constant to know how many banks to load. */
|
||||
const uint8_t n_banks = 2;
|
||||
|
||||
void bank1_func(void) __banked;
|
||||
void bank2_func(void) __banked;
|
||||
void bank1_func2(uint16_t) __banked;
|
||||
|
||||
extern uint16_t bank1var;
|
||||
extern uint16_t bank2var;
|
||||
|
||||
extern uint8_t bank_pages[]; /* filled by crt0_banked.s */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
bank1var = 1;
|
||||
bank2var = 2;
|
||||
puts("HOME: program start.");
|
||||
printf("HOME: window 3 phys page = 0x%02X\n", _io_page_w3);
|
||||
printf("HOME: bank_pages[1] = 0x%02X\n", bank_pages[1]);
|
||||
printf("HOME: bank_pages[2] = 0x%02X\n", bank_pages[2]);
|
||||
|
||||
bank1_func();
|
||||
bank2_func();
|
||||
bank1_func2(25);
|
||||
bank2_func();
|
||||
|
||||
puts("Press any key to exit...");
|
||||
(void)getchar();
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user