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 AS=as65816
AR=nlib 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 CFLAGS_FOR_UNIT=-DMODEL=2 -DCPU=255 --code-model large --data-model large # --target Foenix
endif endif

View file

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

View file

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

View file

@ -1,5 +1,5 @@
UNIT := C256U_PLUS UNIT := F256
# Define OS-dependent variables # Define OS-dependent variables
@ -32,6 +32,13 @@ else ifeq ($(UNIT),C256_FMX)
SRCS_FOR_UNIT=psg.c sid.c codec_c256.c 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 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 endif
INCLUDES=-I.. -I../include INCLUDES=-I.. -I../include

View file

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