Start on FILE i/O

This commit is contained in:
Kilian committed 2026-09-28 14:44:11 +02:00
1 parent 7033104799
commit 03518c4937
22 files changed
+330 -127

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
#ifndef FILE_H
#define FILE_H
#define COMMAND_OPEN 1
#define COMMAND_CLOSE 2
#define COMMAND_SELECT_IN 3
#define COMMAND_SELECT_OUT 4
#define COMMAND_READ 5
#define COMMAND_WRITE 6
#define COMMAND_RESET 7
int openFile(int fd, const char *path);
int closeFile(int fd);
int readByte(const int fd, int *data);
int writeByte(const int fd, const int data);
#endif // FILE_H
+4 -3
View File
@@ -9,8 +9,9 @@
#define SCREEN_ADDRESS 0
#define KEYBOARD_ADDRESS 1
#define ROM_BANKED_OUT 2
int putChar(uint8_t c);
int getChar(void);
#define FILE_COMMAND 3
#define FILE_DESCRIPTOR 4
#define FILE_DATA 5 // two bytes, for pointer to string
#define FILE_STATUS 7
#endif // IO_H
+5 -3
View File
@@ -1,11 +1,13 @@
#ifndef MEMORY_MAP_H
#define MEMORY_MAP_H
#ifndef MEMORY_H
#define MEMORY_H
#include <stdint.h>
#include "file.h"
#include "io.h"
#include "ram.h"
#include "rom.h"
#include "screen.h"
uint8_t readMemory(uint16_t address, uint8_t *ram, uint8_t *rom);
void writeMemory(uint16_t address, uint8_t value, uint8_t *ram);
@@ -13,4 +15,4 @@ void writeMemory(uint16_t address, uint8_t value, uint8_t *ram);
uint8_t readStack(uint8_t address, uint8_t *ram);
void writeStack(uint8_t address, uint8_t value, uint8_t *ram);
#endif // MEMORY_MAP_H
#endif // MEMORY_H
+9
View File
@@ -0,0 +1,9 @@
#ifndef SCREEN_H
#define SCREEN_H
#include <stdint.h>
int putChar(uint8_t c);
int getChar(void);
#endif // SCREEN_H