Files
gw-basic-2026/include/hal.h
Eremey Valetov 1f4c460f4f Phase 5: CI, terminal I/O, Sixel graphics, classic programs
Add GitHub Actions CI with automated build and test. Implement real
terminal I/O with raw mode (enable_raw/disable_raw, proper INKEY$
polling via VMIN=0/VTIME=0, INPUT$ function). Add Sixel graphics
engine with virtual framebuffer (SCREEN 1: 320x200, SCREEN 2:
640x200), Bresenham line drawing, midpoint circle, flood fill PAINT,
DRAW mini-language parser, and Sixel encoder with RLE. Replace all
graphics stubs with real implementations (PSET, LINE, CIRCLE, DRAW,
PAINT, COLOR, SCREEN, POINT). Fix AND/OR/XOR operator precedence
to be lower than relational operators. Add 13 classic test programs
(39 total). Bump version to 0.5.0.
2026-02-10 16:46:34 -05:00

43 lines
1001 B
C

#ifndef GW_HAL_H
#define GW_HAL_H
#include <stdint.h>
#include <stdbool.h>
/* Hardware Abstraction Layer vtable */
typedef struct hal_ops {
/* Terminal I/O */
void (*putch)(int ch);
void (*puts)(const char *s);
int (*getch)(void); /* blocking read */
bool (*kbhit)(void); /* key available? */
void (*locate)(int row, int col);
int (*get_cursor_row)(void);
int (*get_cursor_col)(void);
void (*cls)(void);
void (*set_width)(int cols);
/* Raw mode for INKEY$/INPUT$ */
void (*enable_raw)(void);
void (*disable_raw)(void);
/* Write raw bytes bypassing cursor tracking (for Sixel, etc.) */
void (*write_raw)(const char *data, int len);
/* Terminal properties */
int screen_width;
int screen_height;
bool is_tty;
/* Lifecycle */
void (*init)(void);
void (*shutdown)(void);
} hal_ops_t;
extern hal_ops_t *gw_hal;
/* Platform implementations */
hal_ops_t *hal_posix_create(void);
#endif