diff --git a/FEATURES.md b/FEATURES.md new file mode 100644 index 0000000..b46e4dd --- /dev/null +++ b/FEATURES.md @@ -0,0 +1,47 @@ +# Features + +1. Raw text output support to channels A and B +1. ANSI terminal support for channels A and B +1. A2560K "Moe" keyboard driver +1. PS/2 keyboard driver +1. Channel (Stream) driver model +1. System call library +1. Channel driver for console (raw output and ANSI output) +1. Channel driver for the serial ports +1. Channel driver for the parallel port +1. Channel driver for the MIDI ports +1. Block driver model +1. SDC block driver +1. PATA block driver +1. Floppy block driver +1. FatFS library integration +1. Memory management +1. PGX file loader +1. PGZ file loader +1. ELF file loader +1. Command Line Interface +1. Mouse driver + +## CLI Features + +1. Ability to load a file +1. Auto-run/configuration file +1. Built-in commands: + 1. DIR [path] + 1. COPY [path] TO [path] + 1. RENAME [path] TO [path] + 1. DELETE [path] + 1. CD [path] + 1. PWD + 1. FORMAT [drive] -- Format a drive... should this be built in? + 1. PRINT [expression] + 1. POKE [address], [value] -- value to an address + 1. PEEK [address] -- value from an address + 1. CALL [address] -- Start running assembly code + 1. DUMP [address], [size] + 1. SETCOLOR [lut], [index], [r], [g], [b] -- set a color LUT value + 1. TIME + 1. DATE + 1. GRAPHICS + 1. BORDER + 1. BACKGROUND diff --git a/README.md b/README.md index 1a527e4..5c4c414 100644 --- a/README.md +++ b/README.md @@ -56,4 +56,10 @@ kernel currently uses the FatFS embedded file system, which is covered under separate license. Please see the [src/fatfs](src/fatfs) directory for license details. +## Features + +See the [features list](FEATURES.md) for the features intended for this kernel +and the status of implementation. + + # //END-OF-LINE diff --git a/src/Makefile b/src/Makefile index 52fb53f..e0b89d3 100644 --- a/src/Makefile +++ b/src/Makefile @@ -9,16 +9,21 @@ cpu_assembly_src := $(wildcard $(cpu)/*.s) cpu_c_src := $(wildcard $(cpu)/*.c) cpu_assembly_obj := $(subst .s,.o,$(cpu_assembly_src)) cpu_c_obj := $(subst .c,.o,$(cpu_c_src)) +dev_c_src := $(wildcard dev/*.c) +dev_c_obj := $(subst .c,.o,$(dev_c_src)) -.PHONY: all $(cpu) +.PHONY: all $(cpu) dev -all: foenixmcp.s68 $(cpu) +all: foenixmcp.s68 $(cpu) dev $(cpu): $(MAKE) --directory=$@ -foenixmcp.s68: foenixmcp.o text_screen.o $(cpu) - $(CC) $(CFLAGS) -o foenixmcp.s68 foenixmcp.o text_screen.o $(cpu_c_obj) +dev: + $(MAKE) --directory=dev + +foenixmcp.s68: foenixmcp.o log.o $(cpu) dev + $(CC) $(CFLAGS) -o foenixmcp.s68 foenixmcp.o log.o $(cpu_c_obj) $(dev_c_obj) %.o: %.c $(DEPS) $(CC) -S -c -o $@ $< $(CFLAGS) @@ -28,3 +33,4 @@ foenixmcp.s68: foenixmcp.o text_screen.o $(cpu) clean: $(RM) *.s68 *.o $(MAKE) --directory=$(cpu) clean + $(MAKE) --directory=dev clean diff --git a/src/dev/Makefile b/src/dev/Makefile new file mode 100644 index 0000000..592ad0d --- /dev/null +++ b/src/dev/Makefile @@ -0,0 +1,15 @@ +override CFLAGS = +../../vbcc/config/m68k-foenix -I. -I.. -I../include + +csources = $(wildcard *.c) +cobjects = $(subst .c,.o,$(csources)) + +.PHONY: all +all: $(cobjects) + +%.o: %.c + $(CC) -c -o $@ $< $(CFLAGS) + +.PHONY: clean + +clean: + $(RM) $(aobjects) $(cobjects) diff --git a/src/dev/channel.c b/src/dev/channel.c new file mode 100644 index 0000000..bb8d48e --- /dev/null +++ b/src/dev/channel.c @@ -0,0 +1,377 @@ +/** + * Implmentation of support low level channel device drivers + * + * A channel or stream is a sequence of bytes that may be read or written to. + * + * Examples include: console, serial port, an open file, etc. + */ + +#include "dev/channel.h" +#include "errors.h" +#include "types.h" +#include "log.h" + +t_dev_chan g_channel_devs[CDEV_DEVICES_MAX]; +t_channel g_channels[CHAN_MAX]; + +// +// Initialize the channel driver system +// +void cdev_init_system() { + int i; + + // Clear out all the channel device records... + for (i = 0; i < CDEV_DEVICES_MAX; i++) { + g_channel_devs[i].number = 0; + g_channel_devs[i].name = 0; + } + + // Clear out all the channel records + for (i = 0; i < CHAN_MAX; i++) { + g_channels[i].number = -1; + g_channels[i].dev = -1; + } + + // Pre-open a channel for the console and EVID + g_channels[0].number = 0; + g_channels[0].dev = 0; + + g_channels[1].number = 1; + g_channels[1].dev = 1; +} + +// +// Register a channel device driver +// +short cdev_register(p_dev_chan device) { + short dev; + + dev = device->number; + if (dev < CDEV_DEVICES_MAX) { + // Copy the device description into the master table + + p_dev_chan cdev = &g_channel_devs[dev]; + cdev->number = device->number; + cdev->name = device->name; + cdev->init = device->init; + cdev->read = device->read; + cdev->readline = device->readline; + cdev->read_b = device->read_b; + cdev->write = device->write; + cdev->write_b = device->write_b; + cdev->status = device->status; + cdev->seek = device->seek; + cdev->flush = device->flush; + cdev->ioctrl = device->ioctrl; + return 0; + } else { + return DEV_ERR_BADDEV; + } +} + +// +// Get a free channel +// +// Returns: +// A pointer to the free channel, 0 if none are available. +// +p_channel chan_alloc() { + int i; + + for (i = 0; i < CHAN_MAX; i++) { + if (g_channels[i].number < 0) { + g_channels[i].number = i; + return &g_channels[i]; + } + } + + return 0; +} + +// +// Return a pointer to the channel record for a given channel handle. +// +// Inputs: +// c = the number of the channel +// +// Returns: +// a pointer to the channel record. +// +p_channel chan_get_record(short c) { + return &g_channels[c]; +} + +// +// Return a channel to the pool of unused channels +// +// Inputs: +// chan = a pointer to the channel record to return to the kernel +// +void chan_free(p_channel chan) { + chan->number = -1; + chan->dev = 0; +} + +// +// Initialize the device +// +// Inputs: +// dev = the number of the device +// +// Returns: +// 0 on success, any negative number is an error code +// +short cdev_init(short dev) { + if (dev < CDEV_DEVICES_MAX) { + p_dev_chan cdev = &g_channel_devs[dev]; + if (cdev->number == dev) { + return cdev->init(); + } else { + return DEV_ERR_BADDEV; + } + } +} + +// +// Find the records for the channel and the channel's device, given the channel number +// +// Inputs: +// channel = the number of the channel to look up +// chan = pointer to the channel structure pointer to set +// cdev = pointer to the channel device structure pointer to set +// +// Returns: +// 0 on success, a negative number on error +// +short chan_get_records(short channel, p_channel * chan, p_dev_chan * cdev) { + if (channel < CHAN_MAX) { + *chan = &g_channels[channel]; + if ((*chan)->number == channel) { + if ((*chan)->dev < CDEV_DEVICES_MAX) { + *cdev = &g_channel_devs[(*chan)->dev]; + return 0; + } else { + return DEV_ERR_BADDEV; + } + + } else { + return DEV_ERR_BADDEV; + } + + } else { + return ERR_BADCHANNEL; + } +} + +// +// Read bytes from the channel +// +// Inputs: +// channel = the number of the channel +// buffer = the buffer into which to copy the channel data +// size = the size of the buffer. +// +// Returns: +// number of bytes read, any negative number is an error code +// +short chan_read(short channel, uint8_t * buffer, short size) { + p_channel chan; + p_dev_chan cdev; + short res; + + res = chan_get_records(channel, &chan, &cdev); + if (res == 0) { + return cdev->read(chan, buffer, size); + } else { + return res; + } +} + +// +// Read a line from the channel +// +// Inputs: +// channel = the number of the channel +// buffer = the buffer into which to copy the channel data +// size = the size of the buffer. +// +// Returns: +// number of bytes read, any negative number is an error code +// +short chan_readline(short channel, uint8_t * buffer, short size) { + p_channel chan; + p_dev_chan cdev; + short res; + + res = chan_get_records(channel, &chan, &cdev); + if (res == 0) { + return cdev->readline(chan, buffer, size); + } else { + return res; + } +} + + +// +// Read a single uint8_t from the channel +// +// Inputs: +// channel = the number of the channel +// +// Returns: +// the value read (if negative, error) +// +short chan_read_b(short channel) { + p_channel chan; + p_dev_chan cdev; + short res; + + res = chan_get_records(channel, &chan, &cdev); + if (res == 0) { + return cdev->read_b(chan); + } else { + return res; + } +} + +// +// Write a bytes to the channel +// +// Inputs: +// channel = the number of the channel +// buffer = the buffer containing the data to write +// size = the size of the buffer. +// +// Returns: +// number of bytes written, any negative number is an error code +// +short chan_write(short channel, const uint8_t * buffer, short size) { + p_channel chan; + p_dev_chan cdev; + short res; + + res = chan_get_records(channel, &chan, &cdev); + if (res == 0) { + return cdev->write(chan, buffer, size); + } else { + DEBUG("chan_write error\n"); + return res; + } +} + +// +// Write a single uint8_t to the device +// +// Inputs: +// channel = the number of the channel +// b = the uint8_t to write +// +// Returns: +// 0 on success, a negative value on error +// +short chan_write_b(short channel, uint8_t b) { + p_channel chan; + p_dev_chan cdev; + short res; + + res = chan_get_records(channel, &chan, &cdev); + if (res == 0) { + return cdev->write_b(chan, b); + } else { + return res; + } +} + + +// +// Return the status of the channel device +// +// Inputs: +// channel = the number of the channel +// +// Returns: +// the status of the device +// +short chan_status(short channel) { + p_channel chan; + p_dev_chan cdev; + short res; + + res = chan_get_records(channel, &chan, &cdev); + if (res == 0) { + return cdev->status(chan); + } else { + return res; + } +} + +// +// Ensure that any pending writes to teh device have been completed +// +// Inputs: +// channel = the number of the channel +// +// Returns: +// 0 on success, any negative number is an error code +// +short chan_flush(short channel) { + p_channel chan; + p_dev_chan cdev; + short res; + + res = chan_get_records(channel, &chan, &cdev); + if (res == 0) { + return cdev->flush(chan); + } else { + return res; + } +} + +// +// Attempt to set the position of the channel cursor (if supported) +// +// Inputs: +// channel = the number of the channel +// position = the position of the cursor +// base = whether the position is absolute or relative to the current position +// +// Returns: +// 0 = success, a negative number is an error. +// +short chan_seek(short channel, long position, short base) { + p_channel chan; + p_dev_chan cdev; + short res; + + res = chan_get_records(channel, &chan, &cdev); + if (res == 0) { + return cdev->seek(chan, position, base); + } else { + return res; + } +} + +// +// Issue a control command to the device +// +// Inputs: +// channel = the number of the channel +// command = the number of the command to send +// buffer = pointer to bytes of additional data for the command +// size = the size of the buffer +// +// Returns: +// 0 on success, any negative number is an error code +// +short chan_ioctrl(short channel, short command, uint8_t * buffer, short size) { + p_channel chan; + p_dev_chan cdev; + short res; + + res = chan_get_records(channel, &chan, &cdev); + if (res == 0) { + return cdev->ioctrl(chan, command, buffer, size); + } else { + return res; + } +} diff --git a/src/dev/channel.h b/src/dev/channel.h new file mode 100644 index 0000000..84eccba --- /dev/null +++ b/src/dev/channel.h @@ -0,0 +1,241 @@ +/** + * Definitions support low level channel device drivers + * + * A channel or stream is a sequence of bytes that may be read or written to. + * + * Examples include: console, serial port, an open file, etc. + */ + +#ifndef __CHANNEL_H +#define __CHANNEL_H + +#include "types.h" + +/* + * Preset channel device numbers + */ + +#define CDEV_DEVICES_MAX 8 // The maximum number of channel devices we will support +#define CHAN_MAX 16 // The maximum number of open channels we will support +#define CHAN_DATA_SIZE 32 // The number of bytes in the channel's data area + +#define CDEV_CONSOLE 0 +#define CDEV_EVID 1 +#define CDEV_COM1 2 +#define CDEV_COM2 3 +#define CDEV_LPT 4 +#define CDEV_MIDI 5 +#define CDEV_FILE 6 + +/* + * Channel status bits + */ + +#define CDEV_STAT_EOF 0x01 // The channel has reached the end of the data +#define CDEV_STAT_ERROR 0x02 // The channel has encountered some error +#define CDEV_STAT_READABLE 0x04 // The channel has data to read (read will not block) +#define CDEV_STAT_WRITABLE 0x08 // The channel can accept data (write will not block) + +#define CDEV_SEEK_ABSOLUTE 0 +#define CDEV_SEEK_RELATIVE 1 + +/* + * Structure defining a channel + */ + +typedef struct s_channel { + short number; // The number of the channel + short dev; // The number of the channel's device + uint8_t data[CHAN_DATA_SIZE]; // A block of state data that the channel code can use for its own purposes +} t_channel, *p_channel; + +typedef short (*FUNC_V_2_S)(); +typedef short (*FUNC_CBS_2_S)(p_channel, uint8_t *, short); +typedef short (*FUNC_C_2_S)(p_channel); +typedef short (*FUNC_CcBS_2_S)(p_channel, const uint8_t *, short); +typedef short (*FUNC_CB_2_S)(p_channel, uint8_t); +typedef short (*FUNC_CLS_2_S)(p_channel, long, short); +typedef short (*FUNC_CSBS_2_S)(p_channel, short, uint8_t *, short); + +/* + * Structure defining a channel device's functions + */ + +typedef struct s_dev_chan { + short number; // The number of the device (assigned by registration) + char * name; // The name of the device + FUNC_V_2_S init; // short init() -- Initialize the device + FUNC_CBS_2_S read; // short read(t_channel *, uint8_t * buffer, short size) -- Read a a buffer from the device + FUNC_CBS_2_S readline; // short readline(t_channel *, uint8_t * buffer, short size) -- Read a line of text from the device + FUNC_C_2_S read_b; // short read_b(t_channel *) -- read a single uint8_t from the device + FUNC_CcBS_2_S write; // short write(t_channel *, uint8_t * buffer, short size) -- Write a buffer to the device + FUNC_CB_2_S write_b; // short write_b(t_channel *, const uint8_t b) -- Write a single uint8_t to the device + FUNC_C_2_S status; // short status(t_channel *) -- Get the status of the device + FUNC_C_2_S flush; // short flush(t_channel *) -- Ensure that any pending writes to teh device have been completed + FUNC_CLS_2_S seek; // short cdev_seek(t_channel *, long position, short base) -- attempt to move the "cursor" position in the channel + FUNC_CSBS_2_S ioctrl; // short ioctrl(t_channel *, short command, uint8_t * buffer, short size)) -- Issue a control command to the device +} t_dev_chan, *p_dev_chan; + +/* + * Initialize the channel driver system + */ +extern void cdev_init_system(); + +/* + * Register a channel device driver + * + * Inputs: + * p_dev_chan = pointer to the description of the channel device + */ +extern short cdev_register(p_dev_chan device); + +/* + * Get a free channel + * + * Returns: + * A pointer to the free channel, 0 if none are available. + */ +extern p_channel chan_alloc(); + +/* + * Return a channel to the pool of unused channels + * + * Inputs: + * chan = a pointer to the channel record to return to the kernel + */ +extern void chan_free(p_channel chan); + +/* + * Return a pointer to the channel record for a given channel handle. + * + * Inputs: + * c = the number of the channel + * + * Returns: + * a pointer to the channel record. + */ +extern p_channel chan_get_record(short c); + +/* + * Initialize the device + * + * Inputs: + * dev = the number of the device + * + * Returns: + * 0 on success, any negative number is an error code + */ +extern short cdev_init(short dev); + +/* + * Read bytes from the channel + * + * Inputs: + * channel = the number of the channel + * buffer = the buffer into which to copy the channel data + * size = the size of the buffer. + * + * Returns: + * number of bytes read, any negative number is an error code + */ +extern short chan_read(short channel, uint8_t * buffer, short size); + +/* + * Read a line from the channel + * + * Inputs: + * channel = the number of the channel + * buffer = the buffer into which to copy the channel data + * size = the size of the buffer. + * + * Returns: + * number of bytes read, any negative number is an error code + */ +extern short chan_readline(short channel, uint8_t * buffer, short size); + +/* + * Read a single uint8_t from the channel + * + * Inputs: + * channel = the number of the channel + * + * Returns: + * the value read (if negative, error) + */ +extern short chan_read_b(short channel); + +/* + * Write a bytes to the channel + * + * Inputs: + * channel = the number of the channel + * buffer = the buffer containing the data to write + * size = the size of the buffer. + * + * Returns: + * number of bytes written, any negative number is an error code + */ +extern short chan_write(short channel, const uint8_t * buffer, short size); + +/* + * Write a single uint8_t to the device + * + * Inputs: + * channel = the number of the channel + * b = the uint8_t to write + * + * Returns: + * 0 on success, a negative value on error + */ +extern short chan_write_b(short channel, uint8_t b); + +/* + * Return the status of the channel device + * + * Inputs: + * channel = the number of the channel + * + * Returns: + * the status of the device + */ +extern short chan_status(short channel); + +/* + * Ensure that any pending writes to teh device have been completed + * + * Inputs: + * channel = the number of the channel + * + * Returns: + * 0 on success, any negative number is an error code + */ +extern short chan_flush(short channel); + +/* + * Attempt to set the position of the channel cursor (if supported) + * + * Inputs: + * channel = the number of the channel + * position = the position of the cursor + * base = whether the position is absolute or relative to the current position + * + * Returns: + * 0 = success, a negative number is an error. + */ +extern short chan_seek(short channel, long position, short base); + +/* + * Issue a control command to the device + * + * Inputs: + * channel = the number of the channel + * command = the number of the command to send + * buffer = pointer to bytes of additional data for the command + * size = the size of the buffer + * + * Returns: + * 0 on success, any negative number is an error code + */ +extern short chan_ioctrl(short channel, short command, uint8_t * buffer, short size); + +#endif \ No newline at end of file diff --git a/src/dev/console.c b/src/dev/console.c new file mode 100644 index 0000000..80f7460 --- /dev/null +++ b/src/dev/console.c @@ -0,0 +1,196 @@ +/** + * Implementation of the console channel device + * + * The console maps to the main screen and keyboard. + * + */ + +#include "types.h" +#include "constants.h" +#include "dev/channel.h" +#include "dev/console.h" +#include "dev/text_screen_iii.h" + + +// +// Initialize the console... nothing needs to happen here +// +short con_init() { + return 0; +} + +// +// Send a uint8_t to the console screen +// +short con_write_b(p_channel chan, uint8_t b) { + text_put_raw(chan->dev, (char)b); + return 0; +} + +// +// Attempt to read from the keyboard. +// +short con_read_b(p_channel chan) { + // char c; + // do { + // c = kbd_getc(); + // } while (c == 0); + + // // Echo the character to the screen + // con_write_b(chan, c); + + // return c; + + return 0; +} + + +// +// Attempt to read a buffer's worth of bytes from the keyboard +// +short con_read(p_channel chan, uint8_t * buffer, short size) { + int i; + + for (i = 0; i < size; i++) { + short c = con_read_b(chan); + if (c < 0) { + return c; + } else if (c > 0) { + buffer[i] = (uint8_t)(c & 0xff); + } + } + + return i; +} + +// +// Attempt to read a line of text from the keyboard (stops at buffer size or newline) +// +// This routine also allows for some basic line editing +// +short con_readline(p_channel chan, uint8_t * buffer, short size) { + int i = 0; + + while (i < size - 1) { + short c = con_read_b(chan); + if (c < 0) { + // Return the error, if we got one + return c; + + } else if (c > 0) { + c = c & 0xff; + + buffer[i] = 0; // By default, we'll have this as the end of string sentinel + + switch (c) { + case CHAR_NL: + // Newline character, end the string and return the size of the string + buffer[i] = 0; + return i; + + case CHAR_BS: + // Backspace character, delete the character to the left + if (i > 0) { + buffer[--i] = 0; + } + break; + + default: + // Ordinary character, add it to the buffer + buffer[i++] = (char)c; + buffer[i] = 0; + break; + } + } + } + + return i; +} + +// +// Write a string of bytes to the console. +// +// Terminates writing bytes at a null. +// +// Inputs: +// buffer = the string of bytes +// size = the number of bytes to write +// +short con_write(p_channel chan, const uint8_t * buffer, short size) { + int i; + + for (i = 0; i < size; i++) { + char c = (char)buffer[i]; + if (c == 0) { + break; + } else { + text_put_raw(chan->dev, c); + } + } + + return i; +} + +// +// Return the status of the console +// +short con_status(p_channel chan) { + // TODO: make CDEV_STAT_READABLE conditional + + return CDEV_STAT_READABLE | CDEV_STAT_WRITABLE; +} + +// +// Flush the output to the console... this does nothing... +// +short con_flush(p_channel chan) { + return 0; +} + +// +// We can't seek on the console... just return 0 +// +short con_seek(p_channel chan, long position, short base) { + return 0; +} + +short con_ioctrl(p_channel chan, short command, uint8_t * buffer, short size) { + return 0; +} + +// +// Install the console device driver +// +short con_install() { + t_dev_chan dev; + + dev.name = "CONSOLE"; + dev.number = CDEV_CONSOLE; + dev.init = con_init; + dev.read = con_read; + dev.readline = con_readline; + dev.read_b = con_read_b; + dev.write = con_write; + dev.write_b = con_write_b; + dev.flush = con_flush; + dev.seek = con_seek; + dev.status = con_status; + dev.ioctrl = con_ioctrl; + + cdev_register(&dev); + + dev.name = "EVID"; + dev.number = CDEV_EVID; + dev.init = con_init; + dev.read = con_read; + dev.readline = con_readline; + dev.read_b = con_read_b; + dev.write = con_write; + dev.write_b = con_write_b; + dev.flush = con_flush; + dev.seek = con_seek; + dev.status = con_status; + dev.ioctrl = con_ioctrl; + + return cdev_register(&dev); +} diff --git a/src/dev/console.h b/src/dev/console.h new file mode 100644 index 0000000..2378cb7 --- /dev/null +++ b/src/dev/console.h @@ -0,0 +1,16 @@ +/** + * Implementation of the console channel device + * + * The console maps to the main screen and keyboard. + * + */ + +#ifndef __CONSOLE_H +#define __CONSOLE_H + +// +// Install the console device driver +// +extern short con_install(); + +#endif diff --git a/src/text_screen.c b/src/dev/text_screen_iii.c similarity index 90% rename from src/text_screen.c rename to src/dev/text_screen_iii.c index 3f10b84..1e2bfaf 100644 --- a/src/text_screen.c +++ b/src/dev/text_screen_iii.c @@ -2,8 +2,9 @@ * Driver for VICKY III text screens, both channel A and channel B */ +#include "constants.h" #include "vicky_general.h" -#include "text_screen.h" +#include "text_screen_iii.h" #define MAX_TEXT_CHANNELS 2 @@ -42,7 +43,7 @@ int text_init() { chan_a->cursor_settings = CursorControlReg_L_A; chan_a->cursor_position = CursorControlReg_H_A; text_setsizes(0); - text_set_color(0, 1, 0); + text_set_color(0, 15, 0); text_clear(0); text_set_xy(0, 0, 0); @@ -51,7 +52,7 @@ int text_init() { chan_b->cursor_settings = CursorControlReg_L_B; chan_b->cursor_position = CursorControlReg_H_B; text_setsizes(1); - text_set_color(1, 4, 0); + text_set_color(1, 15, 0); text_clear(1); text_set_xy(1, 0, 0); @@ -109,8 +110,8 @@ void text_setsizes(short screen) { if (screen < MAX_TEXT_CHANNELS) { /* TODO: compute sizes based on master control register settings */ p_text_channel chan = &text_channel[screen]; - chan->rows = (short)((480 - 32) / 8); - chan->columns = (short)((640 - 32) / 8); + chan->rows = (short)480/8; + chan->columns = 80; } } @@ -156,9 +157,21 @@ void text_clear(short screen) { void text_put_raw(short screen, char c) { if (screen < MAX_TEXT_CHANNELS) { p_text_channel chan = &text_channel[screen]; - *chan->text_cursor_ptr++ = c; - *chan->color_cursor_ptr++ = chan->current_color; - text_set_xy(screen, chan->x + 1, chan->y); + + switch (c) { + case CHAR_NL: + text_set_xy(screen, 0, chan->y + 1); + break; + + case CHAR_CR: + break; + + default: + *chan->text_cursor_ptr++ = c; + *chan->color_cursor_ptr++ = chan->current_color; + text_set_xy(screen, chan->x + 1, chan->y); + break; + } } } diff --git a/src/text_screen.h b/src/dev/text_screen_iii.h similarity index 97% rename from src/text_screen.h rename to src/dev/text_screen_iii.h index e6055e4..e300b52 100644 --- a/src/text_screen.h +++ b/src/dev/text_screen_iii.h @@ -1,5 +1,5 @@ -#ifndef __TEXT_SCREEN_H -#define __TEXT_SCREEN_H +#ifndef __TEXT_SCREEN_III_H +#define __TEXT_SCREEN_III_H /* * Driver for VICKY III text screens, both channel A and channel B diff --git a/src/foenixmcp.c b/src/foenixmcp.c index e9859dc..7ef8876 100644 --- a/src/foenixmcp.c +++ b/src/foenixmcp.c @@ -5,21 +5,41 @@ #include #include "sys_general.h" -#include "m68k/syscalls_m68k.h" -#include "text_screen.h" +#include "syscalls.h" +#include "dev/channel.h" +#include "dev/console.h" +#include "dev/text_screen_iii.h" +#include "log.h" -void print(short screen, char * message) { - int i; - for (i = 0; i < strlen(message); i++) { - text_put_raw(screen, message[i]); +/* + * Initialize the kernel systems. + */ +void initialize() { + text_init(); // Initialize the text channels + DEBUG("Foenix/MCP starting up...\n"); + cdev_init_system(); // Initialize the channel device system + DEBUG("Channel device system ready.\n"); + if (con_install()) { + DEBUG("FAILED: Console installation.\n"); + } else { + DEBUG("Console installed.\n"); } + + // At this point, we should be able to call into to console to print to the screens + +} + +void print(short channel, char * message) { + syscall(SYS_CHAN_WRITE, channel, message, strlen(message)); } int main(int argc, char * argv[]) { - text_init(); + initialize(); - print(0, "Hello from Screen A!"); - print(1, "Hello from Screen B!"); + print(CDEV_CONSOLE, "Hello from Screen A!\n"); + print(CDEV_EVID, "Hello from Screen B!\n"); + + DEBUG("Stopping.\n"); /* Infinite loop... */ while (1) {}; diff --git a/src/foenixmcp.s68 b/src/foenixmcp.s68 new file mode 100644 index 0000000..02bd09d --- /dev/null +++ b/src/foenixmcp.s68 @@ -0,0 +1,139 @@ +S0100000666F656E69786D63702E73363817 +S22400000000020000000100000001002C0001002C0001002C0001002C0001002C0001002CCA +S2240000200001002C0001002C0001002C0001002C0001002C0001002C0001002C0001002C53 +S2240000400001002C0001002C0001002C0001002C0001002C0001002C0001002C0001002C33 +S2240000600001002C0001002C0001002C0001002C0001002C0001002C0001002C0001002C13 +S2240000800001002C0001002C0001002C0001002C0001002C0001002C0001002C0001002CF3 +S2240000A00001002C0001002C0001002C0001002C0001002C000100560001002C0001002CA9 +S2240100004FF90002000041F900010FF8203C000003F867104298598066FA41FA003A327C4A +S22401002000B422884EB9000100F460FE4E7348E77F002E2F00382C2F00342A2F0030282F8F +S224010040002C262F0028242F0024222F00204E4D4CDF00FE4E752F072F062F052F042F037E +S2240100602F022F014EB9000102DC4FEF001C4E7348E7203047F900010FE2203C00010FE219 +S224010080672674014AAB0004670C52822002E5884AB3080066F45382670E2002E5882473BA +S2240100A008004E92538266F22F2F00104EB90001002A584F4CDF0C044E754E7148E70030C2 +S2240100C04AB900010FF46626267900010FF8700123C000010FF4200B670C246B00044E9277 +S2240100E02653200B66F42F2F000C6184584F4CDF0C004E7548E7003047F900010FEE203C13 +S22401010000010FEA670C4A936708245B4E924A9366F82F2F00102F2F00104EB90001022080 +S2240101202F0061984FEF000C4CDF0C004E7500004EB900010C18487A00744EB90001028859 +S2240101404EB9000103A4487A00804EB9000102884EB900010B2C504F4A40670E487A001A5D +S2240101604EB900010288584F600C487A002C4EB900010288584F4E754641494C45443A20EB +S224010180436F6E736F6C6520696E7374616C6C6174696F6E2E0A0000436F6E736F6C652029 +S2240101A0696E7374616C6C65642E0A00466F656E69782F4D4350207374617274696E67201D +S2240101C075702E2E2E0A00004368616E6E656C206465766963652073797374656D2072659B +S2240101E06164792E0A004E7148E72020342F000E246F0010204A20084A1866FC908846800D +S2240102002F002F0A300248C02F00487800024EB90001002E4FEF00104CDF04044E754E710C +S2240102206100FF0E487A002642A761BC487A00364878000161B2487A00444EB900010288F8 +S2240102404FEF001460FE70004E754E7148656C6C6F2066726F6D2053637265656E2041212C +S2240102600A004E7148656C6C6F2066726F6D2053637265656E2042210A004E7153746F7075 +S22401028070696E672E0A000048E72020246F000C7400601841F228001010488048C02F00FE +S2240102A042A74EB900010F38504F52822F0A4EB9000102C0584FB0826EDA4CDF04044E7573 +S2240102C0226F00047000204952894A10670A5280204952894A1066F64E75000048E73C000A +S2240102E02A2F0020282F0014262F001C242F00182004538067065380672A6050487A00629C +S2240103004EB9000102881003C0BC000000FF2F00300248C02F004EB90001082C48C04FEF9D +S224010320000C6036487A004E4EB900010288300548C02F0020432F08300248C02F004EB9FD +S224010340000107AC48C04FEF0010600E487A003A4EB90001028870FF584F4CDF003C4E7551 +S2240103605359535F4348414E5F57524954455F420A004E715359535F4348414E5F575249E2 +S22401038054455F420A004E7173797363616C6C20756E6B6E6F776E2066756E6374696F6EA3 +S2240103A00A00000048E7300072006046702E2400260148424843C4C1C6C0C0C1D44348428B +S2240103C04242D08241F900010FFC42700800702E2400260148424843C4C1C6C0C0C1D443A0 +S2240103E048424242D08241F900010FFC42B0080252817008B0816EB47200604A70242400E3 +S224010400260148424843C4C1C6C0C0C1D44348424242D08241F90001116C31BCFFFF0800EC +S22401042070242400260148424843C4C1C6C0C0C1D44348424242D08241F90001116C31BC1A +S224010440FFFF080252817010B0816EB042790001116C42790001116E33FC000100011190A6 +S22401046033FC0001000111924CDF000C4E754E7148E73830266F00183213B27C00086C6E50 +S224010480300148C0742E2600280248434844C6C2C8C0C0C2D64448434243D08341F90001CA +S2240104A00FFCD1C024483493256B00020002256B00060006256B000A000A256B000E000EE7 +S2240104C0256B00120012256B00160016256B001A001A256B001E001E256B00260026256BAA +S2240104E000220022256B002A002A7000600270FE4CDF0C1C4E754E7148E730007200606C1C +S22401050070242400260148424843C4C1C6C0C0C1D44348424242D08241F90001116C4A706C +S22401052008006C4670242400260148424843C4C1C6C0C0C1D44348424242D08241F90001C9 +S224010540116C3181080070242400260148424843C4C1C6C0C0C1D44348424242D08241F92D +S2240105600001116CD1C02008600A52817010B0816E8E70004CDF000C4E754E7148E73800C4 +S224010580322F0012300148C074242600280248434844C6C2C8C0C0C2D64448434243D0839B +S2240105A041F90001116CD1C020084CDF001C4E75226F000432BCFFFF426900024E754E710A +S2240105C0514F48E73820342F001EB47C00086C38300248C0722E2600280148434844C6C1CA +S2240105E0C8C0C0C1D64448434243D08341F900010FFCD1C02448B452660C226A00062F49AA +S22401060000144E91600270FE4CDF041C504F4E7548E73820246F001C322F0016226F00180E +S224010620B27C00106C70300148C074242600280248434844C6C2C8C0C0C2D64448434243A6 +S224010640D08341F90001116CD1C022882051B250663E20510C68000800026C2E20513028E5 +S224010660000248C0742E2600280248434844C6C2C8C0C0C2D64448434243D08341F9000117 +S2240106800FFCD1C024887000600E70FE600A600470FE6004600270F64CDF041C4E754E718B +S2240106A04FEFFFF048E73820382F002E362F0026246F002841EF00142F0841EF00142F08AF +S2240106C0300348C02F006100FF4834004FEF000C6620300448C02F002F0A2F2F0018206F55 +S2240106E000202268000A2F4900264E914FEF000C600230024CDF041C4FEF00104E754E71CA +S2240107004FEFFFF048E73820382F002E362F0026246F002841EF00142F0841EF00142F084E +S224010720300348C02F006100FEE834004FEF000C6620300448C02F002F0A2F2F0018206F55 +S22401074000202268000E2F4900264E914FEF000C600230024CDF041C4FEF00104E754E7165 +S2240107604FEFFFF048E73000362F001E41EF000C2F0841EF000C2F08300348C02F006100B3 +S224010780FE9034004FEF000C66162F2F0008206F0010226800122F4900164E91584F6002B4 +S2240107A030024CDF000C4FEF00104E754FEFFFF048E73820382F002E362F0026246F00282A +S2240107C041EF00142F0841EF00142F08300348C02F006100FE3C34004FEF000C66203004E0 +S2240107E048C02F002F0A2F2F0018206F0020226800162F4900264E914FEF000C600E487AC7 +S22401080000184EB9000102883002584F4CDF041C4FEF00104E754E716368616E5F777269E9 +S2240108207465206572726F720A004E714FEFFFF048E73800182F0027362F002241EF0010FD +S2240108402F0841EF00102F08300348C02F006100FDC034004FEF000C661C700010042F00A9 +S2240108602F2F0010206F00182268001A2F49001E4E91504F600230024CDF001C4FEF00107C +S2240108804E754E714FEFFFF048E73000362F001E41EF000C2F0841EF000C2F08300348C0A0 +S2240108A02F006100FD6C34004FEF000C66162F2F0008206F00102268001E2F4900164E9125 +S2240108C0584F600230024CDF000C4FEF00104E754FEFFFF048E73000362F001E41EF000C44 +S2240108E02F0841EF000C2F08300348C02F006100FD2034004FEF000C66162F2F0008206F71 +S2240109000010226800222F4900164E91584F600230024CDF000C4FEF00104E754FEFFFF0F8 +S22401092048E73C003A2F002E282F0028362F002641EF00142F0841EF00142F08300348C074 +S2240109402F006100FCCC34004FEF000C6620300548C02F002F042F2F0018206F00202268E7 +S22401096000262F4900264E914FEF000C600230024CDF003C4FEF00104E754E714FEFFFF08C +S22401098048E73C203A2F0036382F002E362F002A246F003041EF00182F0841EF00182F0842 +S2240109A0300348C02F006100FC6834004FEF000C6626300548C02F002F0A300448C02F00E8 +S2240109C02F2F0020206F00282268002A2F49002E4E914FEF0010600230024CDF043C4FEF18 +S2240109E000104E7570004E7548E72020142F0013246F000C1002488048C02F00302A00021A +S224010A0048C02F004EB900010F387000504F4CDF04044E7570004E7548E73830382F0022F2 +S224010A20266F001C246F0018760060222F0A61E43400584F6C043002601E4A426F0E3002A8 +S224010A4048C0C0BC000000FF178038005283300448C0B0836ED630034CDF0C1C4E754E71AE +S224010A6048E73830382F0022266F0018246F001C7400604C2F0B619C3600584F6C0430031D +S224010A80604A4A436F3A10034A00760016004232280030035140670E5540670260144232CC +S224010AA02800300260264A826F06538242322800600E1003220252821580180042322800DC +S224010AC0300448C05380B0826EAA30024CDF0C1C4E754E7148E73830382F0022266F001CDF +S224010AE0246F00187400602216332800660260221003488048C02F00302A000248C02F004F +S224010B004EB900010F38504F5282300448C0B0826ED630024CDF0C1C4E754E71700C4E7515 +S224010B2070004E7570004E7570004E754FEFFFD02F7C00010C08000242572F7C000109E415 +S224010B4000062F7C00010A18000A2F7C00010A60000E2F7C00010A1400122F7C00010AD427 +S224010B6000162F7C000109E8001A2F7C00010B2000222F7C00010B2400262F7C00010B1CD5 +S224010B80001E2F7C00010B28002A41D72F084EB9000104702F7C00010C1000063F7C0001D3 +S224010BA000042F7C000109E4000A2F7C00010A18000E2F7C00010A6000122F7C00010A14BA +S224010BC000162F7C00010AD4001A2F7C000109E8001E2F7C00010B2000262F7C00010B24C2 +S224010BE0002A2F7C00010B1C00222F7C00010B28002E41EF00042F084EB900010470504F3D +S224010C004FEF00304E754E71434F4E534F4C4500455649440000000048E7003045F9000105 +S224010C2013AC47F9000113CE24BC00C60000257C00C680000004257C00C400100008257C1E +S224010C4000C40014000C42A7610001CA42A74878000F42A76100020642A76100026442A7F2 +S224010C6042A742A7610000EE26BC00CA0000277C00CA80000004277C00C800100008277C8A +S224010C8000C80014000C487800016100018842A74878000F48780001610001C2487800015D +S224010CA06100021E42A742A748780001610000A670004FEF00404CDF0C004E7548E73F00BD +S224010CC03C2F002E3A2F002A182F0027362F0022342F001EB47C00026C74300248C072228C +S224010CE02F022E00240148474842CEC1C4C0C0C1DE4248474247D087241F41F9000113ACF1 +S224010D00D1C0224810034A00C07C00FFC0BC0000FFFF7218E3A81204488148C17E10EFA99D +S224010D2080811205C23C0002C27C00FFC2BC0000FFFFD28180811206C23C0001C27C00FF34 +S224010D40C2BC0000FFFF80812069000820804CDF00FC4E7548E73E20382F001E362F002658 +S224010D60342F0022B87C00026C0000A2300448C072222A002C0148454846CAC1CCC0C0C1CA +S224010D80DA4648454245D08541F9000113ACD1C0244835420014354300167000300372108F +S224010DA0E3A8720032028081206A000C208070003003322A001048C12A002C01484548463B +S224010DC0CAC1CCC0C0C1DA4648454245D08572003202D0812052D1C02548001870003003CA +S224010DE0322A001048C12A002C0148454846CAC1CCC0C0C1DA4648454245D085720032023F +S224010E00D081206A0004D1C02548001C4CDF047C4E754E7148E73800322F0012B27C00029C +S224010E206C32300148C074222600280248434844C6C2C8C0C0C2D64448434243D08341F98F +S224010E40000113ACD1C02248337C003C0012337C005000104CDF001C4E754E7148E73E008F +S224010E60382F0022362F001E342F001AB47C00026C48300248C072222A002C0148454846BD +S224010E80CAC1CCC0C0C1DA4648454245D08541F9000113ACD1C022481003C03C000FC07CDC +S224010EA000FFC0BC0000FFFFE988320448C1C2BC0000000F8081134000204CDF007C4E7598 +S224010EC048E73C20362F001AB67C00026C64300348C0722228002A0148444845C8C1CAC0B0 +S224010EE0C0C1D84548444244D08441F9000113ACD1C0244874006014205211BC0020280082 +S224010F00226A000413AA002028005282302A001048C0322A001248C128002A01484448450D +S224010F20C8C1CAC0C0C1D84548444244D084B0826EC64CDF043C4E7548E73C30162F0023FD +S224010F40342F001EB47C00026C00008A300248C0722228002A0148444845C8C1CAC0C0C114 +S224010F60D84548444244D08441F9000113ACD1C026481003903C000A67065700671E601E3F +S224010F80302B001648C052802F0042A7300248C02F006100FDC04FEF000C6038603641EBBD +S224010FA0001822505290128343EB001C2451529114AB0020302B001648C02F00302B001492 +S224010FC048C052802F00300248C02F006100FD864FEF000C4CDF0C3C4E754E71302F000611 +S206010FE04E7546 +S20C010FE2000000000000000001 +S20C010FEA0000000000000000F9 +S208010FF400000000F3 +S804000000FB diff --git a/src/include/FMX/constants.h b/src/include/FMX/constants.h new file mode 100644 index 0000000..165079d --- /dev/null +++ b/src/include/FMX/constants.h @@ -0,0 +1,22 @@ +/** + * Definitions of major constants + */ + +#ifndef __CONSTANTS_H +#define __CONSTANTS_H + +/* + * Miscellaneous definitions + */ + +#define MAX_TRIES_BUSY 10000 /* The maximum number of times to check for an operation to complete (general purpose) */ + +/* + * Definitions of special characters + */ + +#define CHAR_ESC '\x2b' /* Escape character */ +#define CHAR_NL '\r' /* Newline character */ +#define CHAR_BS '\b' /* Backspace */ + +#endif diff --git a/src/include/constants.h b/src/include/constants.h new file mode 100644 index 0000000..3ebebb1 --- /dev/null +++ b/src/include/constants.h @@ -0,0 +1,24 @@ + +/** + * Definitions of major constants + */ + +#ifndef __CONSTANTS_H +#define __CONSTANTS_H + +/* + * Miscellaneous definitions + */ + +#define MAX_TRIES_BUSY 10000 // The maximum number of times to check for an operation to complete (general purpose) + +/* + * Definitions of special characters + */ + +#define CHAR_ESC '\x2b' // Escape character +#define CHAR_CR '\x0D' // Carriage return +#define CHAR_NL '\x0A' // Newline character +#define CHAR_BS '\b' // Backspace + +#endif \ No newline at end of file diff --git a/src/include/errors.h b/src/include/errors.h new file mode 100644 index 0000000..b22eee2 --- /dev/null +++ b/src/include/errors.h @@ -0,0 +1,22 @@ +/** + * Definition of error numbers + */ + +#ifndef __ERRORS_H +#define __ERRORS_H + +#define MAX_ERROR_NUMBER 10 // Largest (absolute value) of the error number + +#define ERR_OUT_OF_MEMORY -1 +#define DEV_ERR_BADDEV -2 // Device number is bad (too big or no device assigned) +#define DEV_TIMEOUT -3 // The block device function timed out +#define DEV_CANNOT_INIT -4 // The block device could not initilize +#define DEV_CANNOT_READ -5 // The device cannot complete the READ +#define DEV_CANNOT_WRITE -6 // The device cannot complete the WRITE +#define DEV_BOUNDS_ERR -7 // The buffer provided is not big enough +#define DEV_NOMEDIA -8 // There is no media present for that device +#define DEV_WRITEPROT -9 // The media is write protected +#define ERR_BADCHANNEL -10 // The channel number was bad +#define ERR_OUT_OF_HANDLES -11 // There are no available handles for channels, files, etc. + +#endif \ No newline at end of file diff --git a/src/include/syscalls.h b/src/include/syscalls.h new file mode 100644 index 0000000..db89707 --- /dev/null +++ b/src/include/syscalls.h @@ -0,0 +1,23 @@ +/* + * Declarations for calling into the Foenix/MCP kernel + * + * Code calling into the MCP should include this or a similar set of bindings + * The kernel will use this to allow for system calls to be replaced if needed + * by other code. + * + */ + +#ifndef __SYSCALLS_M68K_H +#define __SYSCALLS_M68K_H + +#include "types.h" + +#define SYS_CHAN_WRITE_B 1 +#define SYS_CHAN_WRITE 2 + +/* + * Call into the kernel (provided by assembly) + */ +extern int32_t syscall(int32_t function, ...); + +#endif diff --git a/src/log.c b/src/log.c new file mode 100644 index 0000000..593a358 --- /dev/null +++ b/src/log.c @@ -0,0 +1,16 @@ +/* + * A logging utility + */ + +#include "log.h" +#include "dev/text_screen_iii.h" + +/* + * Send a message to the debugging channel + */ +void DEBUG(char * message) { + int i; + for (i = 0; i < strlen(message); i++) { + text_put_raw(0, message[i]); + } +} \ No newline at end of file diff --git a/src/log.h b/src/log.h new file mode 100644 index 0000000..458c26f --- /dev/null +++ b/src/log.h @@ -0,0 +1,13 @@ +/* + * A logging utility... + */ + +#ifndef __LOG_H +#define __LOG_H + +/* + * Send a message to the debugging channel + */ +extern void DEBUG(char * message); + +#endif \ No newline at end of file diff --git a/src/m68k/Makefile b/src/m68k/Makefile index a31dad8..6b2b43c 100644 --- a/src/m68k/Makefile +++ b/src/m68k/Makefile @@ -1,8 +1,8 @@ -override CFLAGS = +../../vbcc/config/m68k-foenix -I. -I../include +override CFLAGS = +../../vbcc/config/m68k-foenix -I. -I.. -I../include asources = startup_m68k.s aobjects = $(subst .s,.o,$(asources)) -csources = bios_m68k.c syscalls_m68k.c +csources = bios_m68k.c cobjects = $(subst .c,.o,$(csources)) .PHONY: all diff --git a/src/m68k/README.md b/src/m68k/README.md index 5f90096..15ef4be 100644 --- a/src/m68k/README.md +++ b/src/m68k/README.md @@ -17,4 +17,5 @@ VBCC ABI, and then issuing a ``TRAP`` instruction. ## BIOS -All BIOS calls are issued through a ``TRAP #13`` instruction. The first argument (last pushed to the stack) will be the 16-bit function number describing which particular call to make. +All BIOS calls are issued through a ``TRAP #13`` instruction. Register D0 contains the number of the system call to make. + diff --git a/src/m68k/bios_m68k.c b/src/m68k/bios_m68k.c index 604a7a0..56864a3 100644 --- a/src/m68k/bios_m68k.c +++ b/src/m68k/bios_m68k.c @@ -1,57 +1,29 @@ /** - * Implementation of 68000 specific BIOS routines. + * Implementation of 68000 specific syscall routines. * * NOTE: these routines are not called directly but are instead called through TRAP#13 */ #include "types.h" - -#define TEXT_MATRIX_0 ((volatile char *)0x00004000) - -typedef void (* int32_terrupt_handler)(); - -int32_t text_cursor_0 = 0; - -int32_t impl_bconout(char c) { - TEXT_MATRIX_0[text_cursor_0++] = c; - return 0; -} - -// /* -// * Set an exception handler -// * -// * If handler is the nil point32_ter, just return the current value. -// * -// * Inputs: -// * number = the number of the 68000 exception vector (2 - 255) -// * handler = point32_ter to the handler (must be coded as an int32_terrupt handler) -// * -// * Return: -// * the previous value -// */ -// long impl_setexc(unsigned short number, void (* handler)()) { -// int32_terrupt_handler * address = 0; -// long result = 0; -// if ((number > 1) && (number < 256)) { -// address = (int32_terrupt_handler *)(number * 2); -// result = (long)(*address); -// if (handler != 0) { -// *address = handler; -// } -// } - -// return result; -// } +#include "syscalls.h" +#include "log.h" +#include "dev/channel.h" /* - * Determine the correct BIOS function implementation to call and call it. + * Determine the correct system function implementation and call it. */ -int32_t bios_dispatch(int32_t function, int32_t param0, int32_t param1, int32_t param2, int32_t param3, int32_t param4, int32_t param5) { +int32_t syscall_dispatch(int32_t function, int32_t param0, int32_t param1, int32_t param2, int32_t param3, int32_t param4, int32_t param5) { switch (function) { - case 1: - return impl_bconout(param0); + case SYS_CHAN_WRITE_B: + DEBUG("SYS_CHAN_WRITE_B\n"); + return chan_write_b((short)param0, (uint8_t)param1); + + case SYS_CHAN_WRITE: + DEBUG("SYS_CHAN_WRITE_B\n"); + return chan_write((short)param0, (const uint8_t *)param1, (short)param2); default: + DEBUG("syscall unknown function\n"); return -1; } } \ No newline at end of file diff --git a/src/m68k/startup_m68k.s b/src/m68k/startup_m68k.s index 2fe8b07..89afa62 100644 --- a/src/m68k/startup_m68k.s +++ b/src/m68k/startup_m68k.s @@ -1,11 +1,59 @@ xref ___main - xdef _bios + xdef _syscall xdef ___exit section "vectors",code - dc.l ___STACK ; Initial stack pointer - dc.l coldboot ; Initial PC + dc.l ___STACK ; 00 - Initial stack pointer + dc.l coldboot ; 01 - Initial PC + dc.l not_impl ; 02 - Bus error + dc.l not_impl ; 03 - Address error + dc.l not_impl ; 04 - Illegal instruction + dc.l not_impl ; 05 - Zero divide + dc.l not_impl ; 06 - CHK instruction + dc.l not_impl ; 07 - TRAPV instruction + dc.l not_impl ; 08 - Priviledge error + dc.l not_impl ; 09 - Trace + dc.l not_impl ; 10 - Line 1010 + dc.l not_impl ; 11 - Line 1111 + dc.l not_impl ; 12 - Reserved + dc.l not_impl ; 13 - Reserved + dc.l not_impl ; 14 - Format error + dc.l not_impl ; 15 - Uninitialized Interrupt Error + dc.l not_impl ; 16 - Reserved + dc.l not_impl ; 17 - Reserved + dc.l not_impl ; 18 - Reserved + dc.l not_impl ; 19 - Reserved + dc.l not_impl ; 20 - Reserved + dc.l not_impl ; 21 - Reserved + dc.l not_impl ; 22 - Reserved + dc.l not_impl ; 23 - Reserved + dc.l not_impl ; 24 - Spurious Interrupt + dc.l not_impl ; 25 - Level 1 Interrupt Autovector + dc.l not_impl ; 26 - Level 2 Interrupt Autovector + dc.l not_impl ; 27 - Level 3 Interrupt Autovector + dc.l not_impl ; 28 - Level 4 Interrupt Autovector + dc.l not_impl ; 29 - Level 5 Interrupt Autovector + dc.l not_impl ; 30 - Level 6 Interrupt Autovector + dc.l not_impl ; 31 - Level 7 Interrupt Autovector + dc.l not_impl ; 32 - TRAP #0 + dc.l not_impl ; 33 - TRAP #1 + dc.l not_impl ; 34 - TRAP #2 + dc.l not_impl ; 35 - TRAP #3 + dc.l not_impl ; 36 - TRAP #4 + dc.l not_impl ; 37 - TRAP #5 + dc.l not_impl ; 38 - TRAP #6 + dc.l not_impl ; 39 - TRAP #7 + dc.l not_impl ; 40 - TRAP #8 + dc.l not_impl ; 41 - TRAP #9 + dc.l not_impl ; 42 - TRAP #10 + dc.l not_impl ; 43 - TRAP #11 + dc.l not_impl ; 44 - TRAP #12 + dc.l h_trap_13 ; 45 - TRAP #13 + dc.l not_impl ; 46 - TRAP #14 + dc.l not_impl ; 47 - TRAP #15 + + ; TODO: make room for reserved and User Interrupt Vectors code @@ -30,34 +78,45 @@ ___exit: bra ___exit ; -; Function to make a BIOS system call based on the number of the BIOS function: -; int32_t bios(int32_t number, int32_t p0, int32_t p1, int32_t p2, int32_t p3, int32_t p4, int32_t p5) +; Unimplemented Exception Handler -- just return ; -_bios: - movem.l d1-d7,-(sp) - move.l (18,sp),d7 ; Parameter 5 to D7 - move.l (22,sp),d6 ; Parameter 4 to D6 - move.l (26,sp),d5 ; Parameter 3 to D5 - move.l (30,sp),d4 ; Parameter 2 to D4 - move.l (44,sp),d3 ; Parameter 1 to D3 - move.l (48,sp),d2 ; Parameter 0 to D2 - move.l (42,sp),d1 ; Function number to D1 +not_impl: rte - trap #13 +; +; Function to make a system call based on the number of the system function: +; int32_t syscall(int32_t number, int32_t p0, int32_t p1, int32_t p2, int32_t p3, int32_t p4, int32_t p5) +; +_syscall: + movem.l d1-d7,-(sp) ; Save caller's registers + move.l (56,sp),d7 ; Parameter 5 to D7 + move.l (52,sp),d6 ; Parameter 4 to D6 + move.l (48,sp),d5 ; Parameter 3 to D5 + move.l (44,sp),d4 ; Parameter 2 to D4 + move.l (40,sp),d3 ; Parameter 1 to D3 + move.l (36,sp),d2 ; Parameter 0 to D2 + move.l (32,sp),d1 ; Function number to D1 - movem.l (sp)+,d1-d7 + TRAP #13 ; Call into the kernel + + movem.l (sp)+,d1-d7 ; Restore caller's registers rts + ; ; TRAP#13 handler... transfer control to the C dispatcher ; h_trap_13: + move.l d7,-(sp) ; Push the parameters to the stack for the C call + move.l d6,-(sp) + move.l d5,-(sp) + move.l d4,-(sp) + move.l d3,-(sp) move.l d2,-(sp) move.l d1,-(sp) - jsr _bios_dispatch ; Call the C routine to do the dispatch + jsr _syscall_dispatch ; Call the C routine to do the dispatch ; Note: the C routine depends upon the register push order - addq.l #8,a7 + add.l #28,sp ; Remove parameters from the stack rte ; Return to the caller diff --git a/src/m68k/syscalls_m68k.c b/src/m68k/syscalls_m68k.c deleted file mode 100644 index 92da8bd..0000000 --- a/src/m68k/syscalls_m68k.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Definitions for calling into the Foenix/MCP BIOS on the 68000 series - */ - -#include "types.h" -#include "syscalls_m68k.h" - -/* - * Call into the BIOS by issuing a TRAP #13 - */ -extern int32_t bios(int32_t function, ...); - -// /* -// * Set an exception handler -// * -// * If handler is the nil pointer, just return the current value. -// * -// * Inputs: -// * number = the number of the 68000 exception vector (2 - 255) -// * handler = pointer to the handler (must be coded as an interrupt handler) -// * -// * Return: -// * the previous value -// */ -// int setexc(unsigned short number, void (* handler)()) { -// return bios(5, number, (int)handler); -// } - -/* - * Print a character to the text screen - * - * Inputs: - * c = character to print - */ -int32_t bconout(char c) { - return bios(1, c); -} \ No newline at end of file diff --git a/src/m68k/syscalls_m68k.h b/src/m68k/syscalls_m68k.h deleted file mode 100644 index 7f2151f..0000000 --- a/src/m68k/syscalls_m68k.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Declarations for calling into the Foenix/MCP BIOS on the 68000 series - * - * Code calling into the MCP should include this or a similar set of bindings - * The kernel will use this to allow for system calls to be replaced if needed - * by other code. - * - */ - -#ifndef __SYSCALLS_M68K_H -#define __SYSCALLS_M68K_H - -#include "types.h" - -// /* -// * Set an exception handler -// * -// * Inputs: -// * number = the number of the 68000 exception vector -// * handler = pointer to the handler (must be coded as an interrupt handler) -// */ -// extern int setexc(unsigned short number, void (* handler)()); - -/* - * Print a character to the text screen - * - * Inputs: - * c = character to print - */ -extern int32_t bconout(char c); - -#endif diff --git a/src/mapfile b/src/mapfile index 8445fdc..3f06b93 100644 --- a/src/mapfile +++ b/src/mapfile @@ -1,170 +1,398 @@ ..\vbcc\targets\m68k-foenix\lib\libvc.a (_main.o) needed due to ___main +..\vbcc\targets\m68k-foenix\lib\libvc.a (strlen.o) needed due to _strlen Files: - startup_m68k.o: vectors 0(8), CODE 10000(62) hex - ..\vbcc\targets\m68k-foenix\lib\libvc.a (_main.o): CODE 10064(be), DATA 105c8(4), BSS 105d0(4) hex - foenixmcp.o: CODE 10124(95) hex - text_screen.o: CODE 101bc(39a), BSS 105d4(44) hex - bios_m68k.o: CODE 10558(40), DATA 105cc(4) hex - syscalls_m68k.o: CODE 10598(1e) hex - INITEXIT: .dtors 105b6(8), .ctors 105be(8) hex + startup_m68k.o: vectors 0(c0), CODE 10000(70) hex + ..\vbcc\targets\m68k-foenix\lib\libvc.a (_main.o): CODE 10070(be), DATA 10ff4(4), BSS 10ff8(4) hex + foenixmcp.o: CODE 10130(157) hex + log.o: CODE 10288(38) hex + ..\vbcc\targets\m68k-foenix\lib\libvc.a (strlen.o): CODE 102c0(1a) hex + bios_m68k.o: CODE 102dc(c6) hex + channel.o: CODE 103a4(640), BSS 10ffc(3b0) hex + console.o: CODE 109e4(231) hex + text_screen_iii.o: CODE 10c18(3ca), BSS 113ac(44) hex + INITEXIT: .dtors 10fe2(8), .ctors 10fea(8) hex Section mapping (numbers in hex): ------------------------------ - 00000000 vectors (size 8) - 00000000 - 00000008 startup_m68k.o(vectors) + 00000000 vectors (size c0) + 00000000 - 000000c0 startup_m68k.o(vectors) ------------------------------ - 00010000 text (size 5b6) - 00010000 - 00010062 startup_m68k.o(CODE) - 00010064 - 00010122 _main.o(CODE) - 00010124 - 000101b9 foenixmcp.o(CODE) - 000101bc - 00010556 text_screen.o(CODE) - 00010558 - 00010598 bios_m68k.o(CODE) - 00010598 - 000105b6 syscalls_m68k.o(CODE) + 00010000 text (size fe2) + 00010000 - 00010070 startup_m68k.o(CODE) + 00010070 - 0001012e _main.o(CODE) + 00010130 - 00010287 foenixmcp.o(CODE) + 00010288 - 000102c0 log.o(CODE) + 000102c0 - 000102da strlen.o(CODE) + 000102dc - 000103a2 bios_m68k.o(CODE) + 000103a4 - 000109e4 channel.o(CODE) + 000109e4 - 00010c15 console.o(CODE) + 00010c18 - 00010fe2 text_screen_iii.o(CODE) ------------------------------ - 000105b6 .dtors (size 8, allocated 0) - 000105b6 - 000105be INITEXIT(.dtors) + 00010fe2 .dtors (size 8, allocated 0) + 00010fe2 - 00010fea INITEXIT(.dtors) ------------------------------ - 000105be .ctors (size 8, allocated 0) - 000105be - 000105c6 INITEXIT(.ctors) + 00010fea .ctors (size 8, allocated 0) + 00010fea - 00010ff2 INITEXIT(.ctors) ------------------------------ - 000105c8 data (size 8, allocated 4) - 000105c8 - 000105cc _main.o(DATA) - 000105cc - 000105d0 bios_m68k.o(DATA) + 00010ff4 data (size 4, allocated 0) + 00010ff4 - 00010ff8 _main.o(DATA) ------------------------------ - 000105d0 bss (size 48, allocated 0) - 000105d0 - 000105d4 _main.o(BSS) - 000105d4 - 00010618 text_screen.o(BSS) + 00010ff8 bss (size 3f8, allocated 0) + 00010ff8 - 00010ffc _main.o(BSS) + 00010ffc - 000113ac channel.o(BSS) + 000113ac - 000113f0 text_screen_iii.o(BSS) Symbols of text: - 0x00000000 l17: local abs, size 0 + 0x00000000 l73: local abs, size 0 + 0x00000000 l10: local abs, size 0 + 0x00000000 l28: local abs, size 0 + 0x00000000 l13: local abs, size 0 + 0x00000000 l70: local abs, size 0 + 0x00000000 l75: local abs, size 0 + 0x00000000 l68: local abs, size 0 + 0x00000000 l26: local abs, size 0 + 0x00000000 l40: local abs, size 0 + 0x00000000 l15: local abs, size 0 + 0x00000000 l78: local abs, size 0 + 0x00000000 l61: local abs, size 0 + 0x00000000 l80: local abs, size 0 + 0x00000000 l87: local abs, size 0 + 0x00000000 l42: local abs, size 0 0x00000000 l5: local abs, size 0 - 0x00000000 l57: local abs, size 0 + 0x00000000 l65: local abs, size 0 + 0x00000000 l85: local abs, size 0 + 0x00000000 l12: local abs, size 0 + 0x00000000 l10: local abs, size 0 + 0x00000000 l63: local abs, size 0 0x00000000 l3: local abs, size 0 - 0x00000000 l59: local abs, size 0 - 0x00000000 l19: local abs, size 0 - 0x00000004 l3: local abs, size 0 - 0x00000004 l5: local abs, size 0 - 0x00000008 l31: local abs, size 0 - 0x00000008 l6: local abs, size 0 - 0x00000008 l13: local abs, size 0 + 0x00000000 l63: local abs, size 0 + 0x00000000 l8: local abs, size 0 + 0x00000008 l10: local abs, size 0 0x00000008 l43: local abs, size 0 + 0x00000008 l9: local abs, size 0 + 0x00000008 l115: local abs, size 0 + 0x00000008 l13: local abs, size 0 + 0x00000008 l32: local abs, size 0 + 0x00000008 l17: local abs, size 0 + 0x00000008 l90: local abs, size 0 + 0x00000008 l31: local abs, size 0 + 0x00000008 l123: local abs, size 0 + 0x00000008 l6: local abs, size 0 0x0000000c l27: local abs, size 0 - 0x0000000c l18: local abs, size 0 - 0x0000000c l9: local abs, size 0 + 0x0000000c l107: local abs, size 0 0x0000000c l11: local abs, size 0 + 0x0000000c l37: local abs, size 0 + 0x0000000c l121: local abs, size 0 + 0x0000000c l88: local abs, size 0 + 0x0000000c l30: local abs, size 0 + 0x0000000c l18: local abs, size 0 + 0x0000000c l113: local abs, size 0 + 0x00000010 l66: local abs, size 0 + 0x00000010 l131: local abs, size 0 + 0x00000010 l52: local abs, size 0 + 0x00000010 l74: local abs, size 0 + 0x00000010 l99: local abs, size 0 + 0x00000010 l12: local abs, size 0 + 0x00000010 l82: local abs, size 0 + 0x00000014 l21: local abs, size 0 0x00000014 l34: local abs, size 0 + 0x00000014 l29: local abs, size 0 0x00000014 l45: local abs, size 0 + 0x00000014 l48: local abs, size 0 + 0x00000014 l60: local abs, size 0 + 0x00000014 l139: local abs, size 0 + 0x00000018 l56: local abs, size 0 0x00000018 l13: local abs, size 0 - 0x00000018 l52: local abs, size 0 0x00000018 l20: local abs, size 0 + 0x0000001c l105: local abs, size 0 + 0x0000001c l35: local abs, size 0 0x0000001c l25: local abs, size 0 + 0x0000003c l10: local abs, size 0 + 0x0000003c l129: local abs, size 0 0x0000007c l32: local abs, size 0 0x000000fc l11: local abs, size 0 - 0x0000040c l7: local abs, size 0 + 0x00000404 l8: local abs, size 0 + 0x00000404 l15: local abs, size 0 + 0x00000404 l7: local abs, size 0 + 0x0000041c l72: local abs, size 0 + 0x0000041c l80: local abs, size 0 + 0x0000041c l64: local abs, size 0 + 0x0000041c l50: local abs, size 0 + 0x0000041c l97: local abs, size 0 0x0000043c l43: local abs, size 0 + 0x0000043c l137: local abs, size 0 0x0000047c l18: local abs, size 0 0x00000c00 l29: local abs, size 0 - 0x00000c00 l4: local abs, size 0 0x00000c00 l41: local abs, size 0 + 0x00000c00 l4: local abs, size 0 0x00000c04 l16: local abs, size 0 - 0x00000c3c l50: local abs, size 0 + 0x00000c1c l46: local abs, size 0 + 0x00000c1c l58: local abs, size 0 + 0x00000c1c l19: local abs, size 0 + 0x00000c1c l27: local abs, size 0 + 0x00000c3c l54: local abs, size 0 0x00010000 coldboot: local reloc, size 0 0x00010014 clrloop: local reloc, size 0 0x00010024 callmain: local reloc, size 0 0x0001002a ___exit: global reloc, size 0 - 0x0001002c _bios: global reloc, size 0 - 0x00010054 h_trap_13: local reloc, size 0 - 0x00010064 __Exit: global reloc, size 0 - 0x0001007e l12: local reloc, size 0 - 0x0001008a l14: local reloc, size 0 - 0x0001008e l13: local reloc, size 0 - 0x0001009c l15: local reloc, size 0 - 0x000100b0 _exit: global reloc, size 0 - 0x000100ce l27: local reloc, size 0 - 0x000100da l28: local reloc, size 0 - 0x000100e2 l23: local reloc, size 0 - 0x000100e8 ___main: global reloc, size 0 - 0x000100fe l39: local reloc, size 0 - 0x00010106 l40: local reloc, size 0 - 0x00010124 _print: global reloc, size 0 - 0x00010134 l3: local reloc, size 0 - 0x0001014e l6: local reloc, size 0 - 0x00010150 l4: local reloc, size 0 - 0x00010160 l1: local reloc, size 0 - 0x00010160 l5: local reloc, size 0 - 0x00010168 _main: global reloc, size 0 - 0x00010184 l14: local reloc, size 0 - 0x00010186 l16: local reloc, size 0 - 0x00010188 l10: local reloc, size 0 - 0x0001018c l12: local reloc, size 0 - 0x000101a4 l13: local reloc, size 0 - 0x000101bc _text_init: global reloc, size 0 - 0x0001025a l2: local reloc, size 0 - 0x00010260 _text_set_cursor: global reloc, size 0 - 0x0001027e l9: local reloc, size 0 - 0x000102f2 l10: local reloc, size 0 - 0x000102f2 l7: local reloc, size 0 - 0x000102f8 _text_set_xy: global reloc, size 0 - 0x00010310 l16: local reloc, size 0 - 0x000103b0 l17: local reloc, size 0 - 0x000103b0 l14: local reloc, size 0 - 0x000103b8 _text_setsizes: global reloc, size 0 - 0x000103c6 l23: local reloc, size 0 - 0x000103f8 l21: local reloc, size 0 - 0x000103f8 l24: local reloc, size 0 - 0x00010400 _text_set_color: global reloc, size 0 - 0x00010416 l30: local reloc, size 0 - 0x0001045e l28: local reloc, size 0 - 0x0001045e l31: local reloc, size 0 - 0x00010464 _text_clear: global reloc, size 0 - 0x00010472 l37: local reloc, size 0 - 0x0001049c l39: local reloc, size 0 - 0x000104ae l42: local reloc, size 0 - 0x000104b0 l40: local reloc, size 0 - 0x000104d6 l35: local reloc, size 0 - 0x000104d6 l38: local reloc, size 0 - 0x000104d6 l41: local reloc, size 0 - 0x000104dc _text_put_raw: global reloc, size 0 - 0x000104ee l48: local reloc, size 0 - 0x0001054a l46: local reloc, size 0 - 0x0001054a l49: local reloc, size 0 - 0x00010550 _text_put_ansi: global reloc, size 0 - 0x00010554 l53: local reloc, size 0 - 0x00010554 l55: local reloc, size 0 - 0x00010554 l56: local reloc, size 0 - 0x00010558 _impl_bconout: global reloc, size 0 - 0x00010572 l1: local reloc, size 0 - 0x00010574 _bios_dispatch: global reloc, size 0 - 0x00010588 l9: local reloc, size 0 - 0x00010590 l10: local reloc, size 0 - 0x00010592 l6: local reloc, size 0 - 0x00010592 l8: local reloc, size 0 - 0x00010598 _bconout: global reloc, size 0 - 0x000105b2 l1: local reloc, size 0 + 0x0001002c not_impl: local reloc, size 0 + 0x0001002e _syscall: global reloc, size 0 + 0x00010056 h_trap_13: local reloc, size 0 + 0x00010070 __Exit: global reloc, size 0 + 0x0001008a l12: local reloc, size 0 + 0x00010096 l14: local reloc, size 0 + 0x0001009a l13: local reloc, size 0 + 0x000100a8 l15: local reloc, size 0 + 0x000100bc _exit: global reloc, size 0 + 0x000100da l27: local reloc, size 0 + 0x000100e6 l28: local reloc, size 0 + 0x000100ee l23: local reloc, size 0 + 0x000100f4 ___main: global reloc, size 0 + 0x0001010a l39: local reloc, size 0 + 0x00010112 l40: local reloc, size 0 + 0x00010130 _initialize: global reloc, size 0 + 0x0001016a l6: local reloc, size 0 + 0x00010176 l8: local reloc, size 0 + 0x00010176 l1: local reloc, size 0 + 0x00010178 l7: local reloc, size 0 + 0x00010198 l9: local reloc, size 0 + 0x000101ac l3: local reloc, size 0 + 0x000101c8 l4: local reloc, size 0 + 0x000101e8 _print: global reloc, size 0 + 0x00010218 l13: local reloc, size 0 + 0x00010220 _main: global reloc, size 0 + 0x00010244 l23: local reloc, size 0 + 0x00010246 l25: local reloc, size 0 + 0x00010248 l18: local reloc, size 0 + 0x0001024c l20: local reloc, size 0 + 0x00010264 l21: local reloc, size 0 + 0x0001027c l22: local reloc, size 0 + 0x00010288 _DEBUG: global reloc, size 0 + 0x00010294 l3: local reloc, size 0 + 0x000102aa l6: local reloc, size 0 + 0x000102ac l4: local reloc, size 0 + 0x000102ba l5: local reloc, size 0 + 0x000102ba l1: local reloc, size 0 + 0x000102c0 _strlen: global reloc, size 0 + 0x000102ce l6: local reloc, size 0 + 0x000102d8 l7: local reloc, size 0 + 0x000102dc _syscall_dispatch: global reloc, size 0 + 0x000102fc l4: local reloc, size 0 + 0x00010324 l6: local reloc, size 0 + 0x0001034c l8: local reloc, size 0 + 0x0001035a l1: local reloc, size 0 + 0x0001035a l3: local reloc, size 0 + 0x00010360 l5: local reloc, size 0 + 0x00010374 l7: local reloc, size 0 + 0x00010388 l9: local reloc, size 0 + 0x000103a4 _cdev_init_system: global reloc, size 0 + 0x000103ac l3: local reloc, size 0 + 0x000103f0 l6: local reloc, size 0 + 0x000103f2 l4: local reloc, size 0 + 0x000103f8 l5: local reloc, size 0 + 0x000103fc l7: local reloc, size 0 + 0x00010444 l10: local reloc, size 0 + 0x00010446 l8: local reloc, size 0 + 0x0001044c l9: local reloc, size 0 + 0x00010468 l1: local reloc, size 0 + 0x00010470 _cdev_register: global reloc, size 0 + 0x00010480 l16: local reloc, size 0 + 0x000104ee l17: local reloc, size 0 + 0x000104f0 l14: local reloc, size 0 + 0x000104f0 l18: local reloc, size 0 + 0x000104f8 _chan_alloc: global reloc, size 0 + 0x00010500 l24: local reloc, size 0 + 0x00010524 l28: local reloc, size 0 + 0x0001056a l29: local reloc, size 0 + 0x0001056a l27: local reloc, size 0 + 0x0001056c l25: local reloc, size 0 + 0x00010572 l26: local reloc, size 0 + 0x00010574 l22: local reloc, size 0 + 0x0001057c _chan_get_record: global reloc, size 0 + 0x000105aa l33: local reloc, size 0 + 0x000105b0 _chan_free: global reloc, size 0 + 0x000105bc l38: local reloc, size 0 + 0x000105c0 _cdev_init: global reloc, size 0 + 0x000105d0 l45: local reloc, size 0 + 0x000105fa l47: local reloc, size 0 + 0x00010606 l48: local reloc, size 0 + 0x00010608 l43: local reloc, size 0 + 0x00010608 l49: local reloc, size 0 + 0x00010608 l46: local reloc, size 0 + 0x00010610 _chan_get_records: global reloc, size 0 + 0x00010626 l55: local reloc, size 0 + 0x00010652 l57: local reloc, size 0 + 0x0001065c l59: local reloc, size 0 + 0x0001068a l60: local reloc, size 0 + 0x0001068e l61: local reloc, size 0 + 0x00010690 l58: local reloc, size 0 + 0x00010694 l62: local reloc, size 0 + 0x00010696 l56: local reloc, size 0 + 0x00010698 l63: local reloc, size 0 + 0x00010698 l53: local reloc, size 0 + 0x000106a0 _chan_read: global reloc, size 0 + 0x000106d2 l69: local reloc, size 0 + 0x000106f2 l70: local reloc, size 0 + 0x000106f4 l67: local reloc, size 0 + 0x000106f4 l71: local reloc, size 0 + 0x00010700 _chan_readline: global reloc, size 0 + 0x00010732 l77: local reloc, size 0 + 0x00010752 l78: local reloc, size 0 + 0x00010754 l75: local reloc, size 0 + 0x00010754 l79: local reloc, size 0 + 0x00010760 _chan_read_b: global reloc, size 0 + 0x0001078a l85: local reloc, size 0 + 0x000107a0 l86: local reloc, size 0 + 0x000107a2 l87: local reloc, size 0 + 0x000107a2 l83: local reloc, size 0 + 0x000107ac _chan_write: global reloc, size 0 + 0x000107de l93: local reloc, size 0 + 0x000107fe l94: local reloc, size 0 + 0x0001080c l95: local reloc, size 0 + 0x0001080c l91: local reloc, size 0 + 0x00010818 l96: local reloc, size 0 + 0x0001082c _chan_write_b: global reloc, size 0 + 0x0001085a l102: local reloc, size 0 + 0x00010876 l103: local reloc, size 0 + 0x00010878 l100: local reloc, size 0 + 0x00010878 l104: local reloc, size 0 + 0x00010884 _chan_status: global reloc, size 0 + 0x000108ae l110: local reloc, size 0 + 0x000108c4 l111: local reloc, size 0 + 0x000108c6 l108: local reloc, size 0 + 0x000108c6 l112: local reloc, size 0 + 0x000108d0 _chan_flush: global reloc, size 0 + 0x000108fa l118: local reloc, size 0 + 0x00010910 l119: local reloc, size 0 + 0x00010912 l120: local reloc, size 0 + 0x00010912 l116: local reloc, size 0 + 0x0001091c _chan_seek: global reloc, size 0 + 0x0001094e l126: local reloc, size 0 + 0x0001096e l127: local reloc, size 0 + 0x00010970 l124: local reloc, size 0 + 0x00010970 l128: local reloc, size 0 + 0x0001097c _chan_ioctrl: global reloc, size 0 + 0x000109b2 l134: local reloc, size 0 + 0x000109d8 l135: local reloc, size 0 + 0x000109da l136: local reloc, size 0 + 0x000109da l132: local reloc, size 0 + 0x000109e4 _con_init: global reloc, size 0 + 0x000109e6 l1: local reloc, size 0 + 0x000109e8 _con_write_b: global reloc, size 0 + 0x00010a0e l6: local reloc, size 0 + 0x00010a14 _con_read_b: global reloc, size 0 + 0x00010a16 l11: local reloc, size 0 + 0x00010a18 _con_read: global reloc, size 0 + 0x00010a2c l18: local reloc, size 0 + 0x00010a36 l22: local reloc, size 0 + 0x00010a3a l23: local reloc, size 0 + 0x00010a3e l25: local reloc, size 0 + 0x00010a4c l24: local reloc, size 0 + 0x00010a4c l26: local reloc, size 0 + 0x00010a4c l21: local reloc, size 0 + 0x00010a4e l19: local reloc, size 0 + 0x00010a56 l20: local reloc, size 0 + 0x00010a58 l16: local reloc, size 0 + 0x00010a60 _con_readline: global reloc, size 0 + 0x00010a74 l32: local reloc, size 0 + 0x00010a7e l35: local reloc, size 0 + 0x00010a82 l36: local reloc, size 0 + 0x00010a86 l38: local reloc, size 0 + 0x00010a9e l41: local reloc, size 0 + 0x00010aa6 l42: local reloc, size 0 + 0x00010aaa l43: local reloc, size 0 + 0x00010ab0 l44: local reloc, size 0 + 0x00010ab2 l45: local reloc, size 0 + 0x00010ac0 l39: local reloc, size 0 + 0x00010ac0 l37: local reloc, size 0 + 0x00010ac0 l40: local reloc, size 0 + 0x00010ac0 l33: local reloc, size 0 + 0x00010aca l34: local reloc, size 0 + 0x00010acc l30: local reloc, size 0 + 0x00010ad4 _con_write: global reloc, size 0 + 0x00010ae8 l51: local reloc, size 0 + 0x00010aee l55: local reloc, size 0 + 0x00010af0 l56: local reloc, size 0 + 0x00010b08 l57: local reloc, size 0 + 0x00010b08 l54: local reloc, size 0 + 0x00010b0a l52: local reloc, size 0 + 0x00010b12 l53: local reloc, size 0 + 0x00010b14 l49: local reloc, size 0 + 0x00010b1c _con_status: global reloc, size 0 + 0x00010b1e l61: local reloc, size 0 + 0x00010b20 _con_flush: global reloc, size 0 + 0x00010b22 l66: local reloc, size 0 + 0x00010b24 _con_seek: global reloc, size 0 + 0x00010b26 l71: local reloc, size 0 + 0x00010b28 _con_ioctrl: global reloc, size 0 + 0x00010b2a l76: local reloc, size 0 + 0x00010b2c _con_install: global reloc, size 0 + 0x00010c00 l81: local reloc, size 0 + 0x00010c08 l83: local reloc, size 0 + 0x00010c10 l84: local reloc, size 0 + 0x00010c18 _text_init: global reloc, size 0 + 0x00010cb6 l2: local reloc, size 0 + 0x00010cbc _text_set_cursor: global reloc, size 0 + 0x00010cda l9: local reloc, size 0 + 0x00010d4e l7: local reloc, size 0 + 0x00010d4e l10: local reloc, size 0 + 0x00010d54 _text_set_xy: global reloc, size 0 + 0x00010d6c l16: local reloc, size 0 + 0x00010e0c l17: local reloc, size 0 + 0x00010e0c l14: local reloc, size 0 + 0x00010e14 _text_setsizes: global reloc, size 0 + 0x00010e22 l23: local reloc, size 0 + 0x00010e54 l21: local reloc, size 0 + 0x00010e54 l24: local reloc, size 0 + 0x00010e5c _text_set_color: global reloc, size 0 + 0x00010e72 l30: local reloc, size 0 + 0x00010eba l28: local reloc, size 0 + 0x00010eba l31: local reloc, size 0 + 0x00010ec0 _text_clear: global reloc, size 0 + 0x00010ece l37: local reloc, size 0 + 0x00010ef8 l39: local reloc, size 0 + 0x00010f0a l42: local reloc, size 0 + 0x00010f0c l40: local reloc, size 0 + 0x00010f32 l38: local reloc, size 0 + 0x00010f32 l41: local reloc, size 0 + 0x00010f32 l35: local reloc, size 0 + 0x00010f38 _text_put_raw: global reloc, size 0 + 0x00010f4c l48: local reloc, size 0 + 0x00010f80 l51: local reloc, size 0 + 0x00010f9c l52: local reloc, size 0 + 0x00010f9e l53: local reloc, size 0 + 0x00010fd4 l50: local reloc, size 0 + 0x00010fd4 l49: local reloc, size 0 + 0x00010fd4 l46: local reloc, size 0 + 0x00010fdc _text_put_ansi: global reloc, size 0 + 0x00010fe0 l57: local reloc, size 0 + 0x00010fe0 l60: local reloc, size 0 + 0x00010fe0 l59: local reloc, size 0 Symbols of .dtors: - 0x000105b6 ___DTOR_LIST__: global reloc object, size 8 + 0x00010fe2 ___DTOR_LIST__: global reloc object, size 8 Symbols of .ctors: - 0x000105be ___CTOR_LIST__: global reloc object, size 8 + 0x00010fea ___CTOR_LIST__: global reloc object, size 8 Symbols of data: - 0x000105c8 l21: local reloc, size 0 - 0x000105cc _text_cursor_0: global reloc, size 0 + 0x00010ff4 l21: local reloc, size 0 Symbols of bss: - 0x000105d0 ___firstexit: global reloc, size 0 - 0x000105d4 l1: local reloc, size 0 + 0x00010ff8 ___firstexit: global reloc, size 0 + 0x00010ffc _g_channel_devs: global reloc, size 0 + 0x0001116c _g_channels: global reloc, size 0 + 0x000113ac l1: local reloc, size 0 Linker symbols: 0x00010000 RAMSTART: global abs, size 0 0x00010000 RAMSIZE: global abs, size 0 0x00000400 STACKLEN: global abs, size 0 - 0x00010618 ___heap: global abs, size 0 + 0x000113f0 ___heap: global abs, size 0 0x0001fc00 ___heapend: global abs, size 0 - 0x000105d0 ___BSSSTART: global abs, size 0 - 0x00000048 ___BSSSIZE: global abs, size 0 + 0x00010ff8 ___BSSSTART: global abs, size 0 + 0x000003f8 ___BSSSIZE: global abs, size 0 0x00020000 ___STACK: global abs, size 0 diff --git a/src/proc.h b/src/proc.h deleted file mode 100644 index 2506a11..0000000 --- a/src/proc.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Processes - */ - -#ifndef __PROC_H -#define __PROC_H - -#define PROC_NAME_SIZE 8 - -#define PROC_STAT_RUNNING 0x01 -#define PROC_STAT_IDLE 0x02 - -typedef struct s_proc_info { - short status; /* The status of the process */ - short pid; /* The ID of the process */ - char name[PROC_NAME_SIZE]; /* A readable name for the process */ - int return_value; /* The value returned by the process when it ended */ -} t_proc_info, * p_proc_info; - -/* - * Initialize the process management system - */ -extern void proc_init(); - -/* - * Terminate the current process with a return value - * - * Inputs: - * return_value = the value to return from the process - */ -extern void proc_terminate(int return_value); - -/* - * Terminate a process with no return value. - */ -extern void proc_kill(short pid); - -/* - * Mark the process as running and make it the current process - * - * Mark the process that was current as IDLE - */ -extern void proc_running(short pid); - -#endif \ No newline at end of file