CODEC and PSG

Bringing back the CODEC and PSG code (mainly using the C256 code).
This commit is contained in:
Peter Weingartner 2024-06-22 20:38:28 -04:00
parent e64f109f2f
commit 0dde64c34d
5 changed files with 31 additions and 29 deletions

View file

@ -37,7 +37,7 @@ else ifeq ($(UNIT),F256)
AS=as65816
AR=nlib
SRCS_FOR_UNIT=txt_f256.c # indicators_c256.c interrupts_c256.c timers_c256.c
SRCS_FOR_UNIT=txt_f256.c indicators_c256.c # interrupts_c256.c timers_c256.c
CFLAGS_FOR_UNIT=-DMODEL=2 -DCPU=255 --code-model large --data-model large # --target Foenix
endif

View file

@ -623,11 +623,9 @@ static void txt_f256_init() {
txt_f256_set_cursor(1, 0, 0xB1);
/* Set the border */
txt_f256_set_border(8, 8); /* Set up the border */
txt_f256_set_border(0, 0); /* Set up the border */
txt_f256_set_border_color(0xf0, 0, 0);
INFO("Border set");
/*
* Enable set_sizes, now that everything is set up initially
* And calculate the size of the screen

View file

@ -170,7 +170,9 @@ unsigned char uart_get(short uart) {
/* Return the byte */
return uart_base[UART_TRHB];
}
} else {
return 0;
}
}
/*
@ -227,12 +229,12 @@ short uart_status(p_channel chan) {
* @param mode an unused parameter
* @return 0 on success, any other number is an error
*/
short uart_open(p_channel chan, const char * spec, short mode) {
short uart_open(p_channel chan, const unsigned char * spec, short mode) {
unsigned short bps = 0, lcr = 0;
char * saveptr;
char spec_copy[80];
char *token = 0;
short i = 0;
long i = 0;
short bps_code = 0;
short lcr_code = 0;
@ -240,14 +242,14 @@ short uart_open(p_channel chan, const char * spec, short mode) {
uart_init(cdev_to_uart(chan->dev));
// Make a local copy of the specification so we can tokenize it
strncpy(spec_copy, spec, 80);
strncpy(spec_copy, (char *)spec, 80);
// Get the first token
saveptr = spec_copy;
token = strtok_r(spec_copy, ",", &saveptr);
if (token) {
// Parse the bit rate token
i = atoi(token);
i = atol(token);
switch (i) {
case 300:
bps_code = UART_300;
@ -392,7 +394,7 @@ short uart_read_b(p_channel chan) {
* @param size the size of the buffer.
* @return number of bytes read, any negative number is an error code
*/
short uart_read(p_channel chan, char * buffer, short size) {
short uart_read(p_channel chan, unsigned char * buffer, short size) {
short i = 0, count = 0;
for (i = 0; i < size; i++) {
buffer[i] = uart_get(cdev_to_uart(chan->dev));
@ -410,7 +412,7 @@ short uart_read(p_channel chan, char * buffer, short size) {
* @param size the size of the buffer.
* @returns number of bytes read, any negative number is an error code
*/
short uart_readline(p_channel chan, char * buffer, short size) {
short uart_readline(p_channel chan, unsigned char * buffer, short size) {
short i = 0, count = 0;
for (i = 0; i < size; i++) {
char c = uart_get(cdev_to_uart(chan->dev));
@ -444,7 +446,7 @@ short uart_write_b(p_channel chan, unsigned char c) {
* @param size the size of the buffer.
* @return number of bytes written, any negative number is an error code
*/
short uart_write(p_channel chan, const char * buffer, short size) {
short uart_write(p_channel chan, const unsigned char * buffer, short size) {
int i;
for (i = 0; i < size; i++) {
uart_put(cdev_to_uart(chan->dev), buffer[i]);
@ -484,8 +486,5 @@ short uart_install() {
dev.number = CDEV_COM2;
result = cdev_register(&dev);
if (result) {
return result;
}
return result;
}

View file

@ -1,5 +1,5 @@
UNIT := C256U_PLUS
UNIT := F256
# Define OS-dependent variables
@ -32,6 +32,13 @@ else ifeq ($(UNIT),C256_FMX)
SRCS_FOR_UNIT=psg.c sid.c codec_c256.c
CFLAGS_FOR_UNIT=-DMODEL=0 -DCPU=255 --target Foenix --code-model large --data-model large
else ifeq ($(UNIT),F256)
CC=cc65816
AS=as65816
AR=nlib
SRCS_FOR_UNIT=psg.c codec_c256.c # sid.c
CFLAGS_FOR_UNIT=-DMODEL=2 -DCPU=255 --code-model large --data-model large
endif
INCLUDES=-I.. -I../include

View file

@ -133,27 +133,24 @@ void initialize() {
#error Cannot identify screen setup
#endif
txt_set_border_color(0, 0x80, 0x80, 0x80);
txt_print(0, "Foenix Toolbox starting up...\n");
printf("Foenix Toolbox v%d.%02d.%04d starting up...\n", VER_MAJOR, VER_MINOR, VER_BUILD);
INFO("Text system initialized.");
while (1) ;
// // Initialize the bitmap system
// bm_init();
// INFO("Bitmap system initialized...");
// /* Initialize the indicators */
// ind_init();
// INFO("Indicators initialized");
/* Initialize the indicators */
ind_init();
INFO("Indicators initialized");
// /* Initialize the interrupt system */
// int_init();
// INFO("Interrupts initialized");
// /* Mute the PSG */
// psg_mute_all();
/* Mute the PSG */
psg_mute_all();
INFO("PSG Muted.");
// /* Initialize and mute the SID chips */
// sid_init_all();
@ -161,8 +158,9 @@ void initialize() {
// // /* Initialize the Yamaha sound chips (well, turn their volume down at least) */
// // ym_init();
// /* Initialize the CODEC */
// init_codec();
/* Initialize the CODEC */
init_codec();
INFO("CODEC initialized.");
// cdev_init_system(); // Initialize the channel device system
// INFO("Channel device system ready.");