Working on more kernel support.

This commit is contained in:
Scott Duensing 2024-01-25 16:56:37 -06:00
parent fb8a2415c2
commit 616e6602a3
6 changed files with 55 additions and 13 deletions

View file

@ -29,7 +29,7 @@ void dirtest(void) {
DIR *dir;
struct dirent *dirent;
//textPrint("Starting directory test.\n");
textPrint("Starting directory test.\n");
if ((dir = opendir("0:"))) {
//textPrint("Directory opened.\n");
@ -70,8 +70,13 @@ void dirtest(void) {
int main(void) {
f256Init();
// dirtest();
printf("Int = %d\n", sizeof(int));
//dirtest();
while(true) {
kernelCall(Clock.GetTime);
textGotoXY(0, 0);
printf("%d.%d ", kernelEventData.clock.seconds, kernelEventData.clock.centis);
}
return 0;
}

View file

@ -106,7 +106,7 @@ struct call { // Mount at $ff00
long vectors816_2; // 12 bytes skipped here.
long vectors816_3;
long SetTimer; //
} Config;
} Clock;
};
// Kernel Call Arguments; mount at $f0
@ -310,6 +310,8 @@ struct events {
uint16_t EOF;
uint16_t CLOSED;
uint16_t ERROR;
uint16_t CREATED;
uint16_t DELETED;
} directory;
struct {
@ -317,9 +319,13 @@ struct events {
uint16_t UDP;
} net;
struct {
uint16_t TICK;
} clock;
struct {
uint16_t EXPIRED;
} timer;
struct {
uint16_t TICK;
} clock;
};
@ -369,8 +375,8 @@ struct event_file_t {
uint8_t stream;
uint8_t cookie;
union {
struct event_fs_data_t data;
struct event_fs_wrote_t wrote;
struct event_fs_data_t data;
struct event_fs_wrote_t wrote;
};
};
@ -402,6 +408,23 @@ struct event_dir_t {
};
};
struct event_clock_t {
uint8_t century;
uint8_t year;
uint8_t month;
uint8_t day;
uint8_t hours;
uint8_t minutes;
uint8_t seconds;
uint8_t centis;
};
struct event_timer_t {
uint8_t units;
uint8_t absolute;
uint8_t cookie;
};
struct event_t {
uint8_t type;
uint8_t buf; // kernel's buf page ID
@ -412,6 +435,9 @@ struct event_t {
struct event_game_t game;
struct event_file_t file;
struct event_dir_t directory;
//struct event_net_t net;
struct event_clock_t clock;
struct event_timer_t timer;
};
};

View file

@ -62,7 +62,9 @@ void f256Init(void) {
spriteReset();
fileReset();
randomSeed(0); //***TODO*** Use clock or something.
//***TODO*** The clock stuff doesn't actually work.
kernelCall(Clock.GetTime);
randomSeed(kernelEventData.clock.centis);
}

View file

@ -109,6 +109,8 @@ typedef unsigned char bool;
#define VKY_TS6_SQUARE (VKY_TS6_ADDR_H+1)
#define VKY_TS7_SQUARE (VKY_TS7_ADDR_H+1)
#define VIRQ 0xfffe
#define JOY_UP 1
#define JOY_DOWN 2
#define JOY_LEFT 4
@ -151,6 +153,9 @@ typedef struct colorS {
#define SET_BIT(x, pos) (x |= (1U << pos))
extern byte SOF;
void f256Init(void);
byte FAR_PEEK(uint32_t address);
void FAR_POKE(uint32_t address, byte value);

View file

@ -54,6 +54,10 @@ int16_t fileUnlink(char *name);
int16_t fileWrite(void *buf, uint16_t nbytes, uint16_t nmemb, uint8_t *fd);
// mkdir
// rmdir
#define _DE_ISREG(t) (t == 0)
#define _DE_ISDIR(t) (t == 1)
#define _DE_ISLBL(t) (t == 2)

View file

@ -38,16 +38,16 @@ extern "C"
#define kernelEvent(member) (size_t)(&((struct events *)0)->member)
#define kernelVector(member) (size_t)(&((struct call *)0xff00)->member)
#define kernelCall(fn) \
({ asm( \
({ char ret; asm( \
"jsr %[addy] \n" \
"sta (%[ret]) \n" \
"lda #0 \n" \
"ror a \n" \
"sta (%[err]) \n" \
: [err] "=m"(kernelError), [ret] "=m"(kernelReturn) \
: [err] "=m"(kernelError), [ret] "=m"(ret) \
: [addy] "i"(kernelVector(fn)) \
: "a", "c", "v"); \
kernelReturn; })
ret; })
/*
asm (
".text\n"