Setting up project.
h3rald h3rald@h3rald.com
Mon, 24 Nov 2025 14:42:30 +0100
4 files changed,
49 insertions(+),
18 deletions(-)
A
Makefile
@@ -0,0 +1,14 @@
+CC = gcc +CFLAGS = -Wall -Wextra -g +LDFLAGS = + +.PHONY: clean + +xyw: xyw.o + $(CC) $(CFLAGS) $(LDFLAGS) xyw.o -o xyw + +xyw.o: xyw.c xyw.h + $(CC) $(CFLAGS) -c xyw.c -o xyw.o + +clean: + rm -f xyw xyw.exe xyw.o
M
xyw.c
→
xyw.c
@@ -1,7 +1,5 @@
#include <stdio.h> - -typedef unsigned char xyw_byte; -typedef unsigned short xyw_short; +#include "xyw.h" #define MEMORY_SIZE 0xffff #define STACK_SIZE 0xff@@ -20,7 +18,8 @@ #define SYSTEM_Y 0x05
#define SYSTEM_XW 0x06 #define SYSTEM_YW 0x08 #define SYSTEM_PC 0x0A -#define SYSTEM_ON_ERROR 0x0C +#define SYSTEM_PAGE 0x0C +#define SYSTEM_ON_ERROR 0x0D /* console device */ #define CONSOLE_BASE 0x10@@ -50,25 +49,27 @@ #define FILE_READ 0x35
#define FILE_WRITE 0x36 #define FILE_APPEND 0x37 -/* video device */ -#define VIDEO_WIDTH 0x40 -#define VIDEO_HEIGHT 0x41 -#define VIDEO_FILL 0x42 -#define VIDEO_X 0x43 -#define VIDEO_Y 0x44 -#define VIDEO_ON_RENDER 0x45 +/* display device */ +#define DISPLAY_WIDTH 0x40 +#define DISPLAY_HEIGHT 0x41 +#define DISPLAY_FILL 0x42 +#define DISPLAY_X 0x43 +#define DISPLAY_Y 0x44 +#define DISPLAY_ON_RENDER 0x45 -/* audio device */ -#define AUDIO_STATE 0x50 -#define AUDIO_SAMPLES 0x51 -#define AUDIO_N_SAMPLES 0x53 -#define AUDIO_ON_STOP 0x55 +/* display device */ +#define BUZZER_STATE 0x50 +#define BUZZER_SAMPLES 0x51 +#define BUZZER_N_SAMPLES 0x53 +#define BUZZER_ON_STOP 0x55 xyw_byte xyw_memory[MEMORY_SIZE]; +xyw_byte system_stack[STACK_SIZE]; +xyw_byte user_stack[STACK_SIZE]; //// 1-byte pointers -xyw_byte *ssp = &xyw_memory[SYSTEM_STACK_START]; -xyw_byte *usp = &xyw_memory[USER_STACK_START]; +xyw_byte *ssp = &xyw_memory[SYSTEM_SSP]; +xyw_byte *usp = &xyw_memory[SYSTEM_USP]; xyw_byte *x = &xyw_memory[SYSTEM_X]; xyw_byte *y = &xyw_memory[SYSTEM_Y];@@ -102,3 +103,10 @@ static inline void xw_add(int delta) { madd(SYSTEM_XW, delta); }
static inline xyw_short yw(void) { return mget(SYSTEM_YW); } static inline void yw_set(xyw_short val) { mset(SYSTEM_YW, val); } static inline void yw_add(int delta) { madd(SYSTEM_YW, delta); } + +//// Main Function +int main(int argc, char *argv[]) +{ + (void)argc; + (void)argv; +}
A
xyw.h
@@ -0,0 +1,7 @@
+#ifndef XYW_H +#define XYW_H + +typedef unsigned char xyw_byte; +typedef unsigned short xyw_short; + +#endif // XYW_H