Files

44 lines
1.5 KiB
C

#ifndef VT1200_XLIB_H
#define VT1200_XLIB_H
typedef unsigned int XID;
typedef unsigned int Window;
/* ROM v2.2 layout (xhello.asm). TMS34010 indirect displacements are *bit*
offsets: xhello's `*a11(0480h)` / `*a10(040h)` are bit offsets 0x480/0x40,
which are byte offsets 0x90/0x8. Cross-checks: the classic 32-bit
Screen.root is at byte 8, and the Terminal Manager scales its screen index
by 0x280 = sizeof(Screen) (0x50 bytes) * 8. */
typedef struct {
unsigned char pad[0x90];
void *screens;
} Display;
typedef struct {
unsigned char pad[0x8];
unsigned int root;
} Screen;
extern Display *XOpenDisplay(const char *name);
extern Window XCreateSimpleWindow(Display *display, Window parent,
int x, int y, unsigned width,
unsigned height, unsigned border_width,
unsigned long border,
unsigned long background);
extern int XMapWindow(Display *display, Window window);
extern int XSync(Display *display, int discard);
/* clang is invoked at -O0 (the optimizer runs separately), which marks every
definition noinline. Keep this helper always-inline so layout.c and the
Xlib client do not each emit a local _vt1200_root for GSPA/GSPLNK to
collide on. */
static inline __attribute__((always_inline)) unsigned int
vt1200_root(Display *d) {
return ((Screen *)((Display *)d)->screens)->root;
}
int layout_screens(void);
int layout_root(void);
#endif