Minor changes and Sound Test Work

This commit is contained in:
Peter Weingartner 2022-01-02 18:21:13 -05:00
parent 3df0ceb725
commit ba08f317de
13 changed files with 8838 additions and 8606 deletions

View file

@ -7,7 +7,7 @@
#include "timers.h"
#include "sound_cmds.h"
#include "sound_reg.h"
#include "snd/opl2.h"
#include "snd/opn2.h"
#include "snd/psg.h"
#include "snd/sid.h"
#include "dev/midi.h"

View file

@ -33,6 +33,7 @@
#include "snd/codec.h"
#include "snd/psg.h"
#include "snd/sid.h"
#include "snd/yamaha.h"
#include "fatfs/ff.h"
#include "cli/cli.h"
@ -66,7 +67,7 @@ const char* VolumeStr[FF_VOLUMES] = { "sd", "fd", "hd" };
*GP30_REG = 0x01;
*GP31_REG = 0x01;
*GP32_REG = 0x01;
*GP33_REG = 0x01;
*GP33_REG = 0x04; // FAN1 GPIO Config
*GP34_REG = 0x01;
*GP35_REG = 0x01;
*GP36_REG = 0x01;
@ -96,6 +97,10 @@ const char* VolumeStr[FF_VOLUMES] = { "sd", "fd", "hd" };
*LED1_REG = 0x01;
*LED2_REG = 0x02;
*FAN1_REG = 0xE0; // <= Value to change to Get the Fan running.
// See doc for more options, need to set $80 to get it started and use other bits to change the PWN...
*FAN_CTRL_REG = 0x01;
}
#endif
@ -110,9 +115,9 @@ void load_splashscreen() {
/* Turn off the screen */
#if MODEL == MODEL_FOENIX_A2560K
*MasterControlReg_B = VKY3_MCR_BLANK_EN;
*MasterControlReg_B = VKY3_MCR_VIDEO_DISABLE;
#else
*MasterControlReg_A = VKY3_MCR_BLANK_EN;
*MasterControlReg_A = VKY3_MCR_VIDEO_DISABLE;
#endif
for (i = 0; i < 256; i++) {
@ -196,12 +201,15 @@ void initialize() {
/* Mute the PSG */
psg_mute_all();
/* Initialize and mute the SID chips */
sid_init_all();
/* Initialize the Yamaha sound chips (well, turn their volume down at least) */
ym_init();
/* Initialize the CODEC */
init_codec();
/* Initialize the SID chips */
sid_init_all();
cdev_init_system(); // Initialize the channel device system
log(LOG_INFO, "Channel device system ready.");

View file

@ -14,6 +14,7 @@
#define VKY3_MCR_TEXT_OVRLY 0x00000002 /* Text Mode overlay */
#define VKY3_MCR_GRAPH_EN 0x00000004 /* Graphic Mode Enable */
#define VKY3_MCR_BITMAP_EN 0x00000008 /* Bitmap Engine Enable */
#define VKY3_MCR_VIDEO_DISABLE 0x00000080 /* Disable the video engine and VRAM access by Vicky */
#define VKY3_MCR_RESOLUTION_MASK 0x00000300 /* Resolution - 00: 640x480, 01:800x600, 10: 1024x768, 11: 640x400 */
#define VKY3_MCR_640x480 0x00000000
#define VKY3_MCR_800x600 0x00000100
@ -22,7 +23,7 @@
#define VKY3_MCR_DOUBLE_EN 0x00000400 /* Doubling Pixel */
#define VKY3_MCR_GAMMA_EN 0x00010000 /* GAMMA Enable */
#define VKY3_MCR_MANUAL_GAMMA_EN 0x00020000 /* Enable Manual GAMMA Enable */
#define VKY3_MCR_BLANK_EN 0x00040000 /* Turn OFF sync (to monitor in sleep mode) */
#define VKY3_MCR_DISABLE_SYNC 0x00040000 /* Turn OFF sync (to monitor in sleep mode) */
/* Access to DIP switch information (read only) */

View file

@ -53,7 +53,7 @@
#define RTC_RATES_WD 0xf0
#define RTC_RATES_RS 0x0f
#define RTC_RATE_976us 0x06
#define RTC_RATE_4ms 0x04
#define RTC_RATE_4ms 0x08
#define RTC_RATE_15ms 0x0A

17229
src/mapfile

File diff suppressed because it is too large Load diff

View file

@ -1,9 +1,9 @@
/*
* Definitions for the OPL2
* Definitions for the OPN2
*/
#ifndef __OPL2_H
#define __OPL2_H
#ifndef __OPN2_H
#define __OPN2_H
#define OPN2_OFFSET_PART_II 0x100

88
src/snd/yamaha.c Normal file
View file

@ -0,0 +1,88 @@
/*
* Master file for the Yamaha sound chips
*/
#include "sound_reg.h"
#include "snd/yamaha.h"
/*
* Write a byte to a Yamaha sound chip register
*
* Inputs:
* dev = the Yamaha device to access SND_OPN2, SND_OPM, SND_OPL3
* position = whether external (physical chip) or internal (FPGA), and left/right channel
* port = the number of the register to update
* value = the byte value to write to the port
*/
void ym_write(enum e_ym_snd_dev dev, enum e_ym_position position, short port, unsigned char value) {
switch (dev) {
#if MODEL == MODEL_FOENIX_A2560K
case SND_OPN2:
switch (position) {
case EXTERNAL:
OPN2_EXT_BASE[port] = value;
break;
case INTERNAL:
OPN2_INT_BASE[port] = value;
break;
default:
break;
}
break;
case SND_OPM:
switch (position) {
case EXTERNAL:
OPM_EXT_BASE[port] = value;
break;
case INTERNAL:
OPM_INT_BASE[port] = value;
break;
default:
break;
}
break;
#endif
case SND_OPL3:
OPL3_PORT[port] = value;
break;
default:
break;
}
}
/*
* Initialize and mute all the Yamaha sound chips
*/
void ym_init() {
short position;
short port;
#if MODEL == MODEL_FOENIX_A2560K
/* OPN */
for (position = EXTERNAL; position <= INTERNAL; position++) {
for (port = 0x40; port <= 0x4F; port++) {
ym_write(SND_OPN2, position, port, 0x7F); /* Maximum attentuation */
}
}
/* OPM */
for (position = EXTERNAL; position <= INTERNAL; position++) {
for (port = 0x60; port <= 0x6F; port++) {
ym_write(SND_OPM, position, port, 0x7F); /* Maximum attentuation */
}
}
#endif
/* OPL3 */
for (port = 0x40; port <= 0x55; port++) {
ym_write(SND_OPL3, position, port, 0x3F); /* Maximum attenuation */
}
}

41
src/snd/yamaha.h Normal file
View file

@ -0,0 +1,41 @@
/*
* Master include file for the Yamaha sound chips
*/
#ifndef __YAMAHA_H
#define __YAMAHA_H
/*
* The Yamaha sound chip protocol to access
*/
enum e_ym_snd_dev {
SND_OPN2 = 0,
SND_OPM,
SND_OPL3
};
/*
* The particular implementation to access
*/
enum e_ym_position {
EXTERNAL, /* A physical Yamaha chip installed on the board */
INTERNAL, /* FPGA implementation */
};
/*
* Write a byte to a Yamaha sound chip register
*
* Inputs:
* dev = the Yamaha device to access SND_OPN2, SND_OPM, SND_OPL3
* position = whether external (physical chip) or internal (FPGA)
* port = the number of the register to update
* value = the byte value to write to the port
*/
extern void ym_write(enum e_ym_snd_dev dev, enum e_ym_position position, short port, unsigned char value);
/*
* Initialize and mute all the Yamaha sound chips
*/
extern void ym_init();
#endif

View file

@ -7,6 +7,6 @@
#define VER_MAJOR 0
#define VER_MINOR 1
#define VER_BUILD 4
#define VER_BUILD 6
#endif

Binary file not shown.

View file

@ -2,10 +2,12 @@
* A simple utility to convert Motorola SREC to the Foenix PGZ file format
*/
#include <ctype.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define MAX_BUFFER 128

13
vbcc/config/a2560k_flash Normal file
View file

@ -0,0 +1,13 @@
-cc=vbccm68k -quiet %s -o= %s %s -O=%ld -I%%VBCC%%\targets\m68k-foenix\include
-ccv=vbccm68k %s -o= %s %s -O=%ld -I%%VBCC%%\targets\m68k-foenix\include
-as=vasmm68k_mot -quiet -Fvobj -nowarn=62 %s -o %s
-asv=vasmm68k_mot -Fvobj -nowarn=62 %s -o %s
-rm=del %s
-rmv=del %s
-ld=vlink -brawbin1 -x -Cvbcc m68040\startup_m68040.o %s %s -L%%VBCC%%\targets\m68k-foenix\lib -T%%VBCC%%\targets\m68k-foenix\vlink_flash_a2560k.cmd -lvc -o %s -Mmapfile
-l2=vlink -brawbin1 -x -Cvbcc %s %s -L%%VBCC%%\targets\m68k-foenix\lib -T%%VBCC%%\targets\m68k-foenix\vlink_flash_a2560k.cmd -o %s -Mmapfile
-ldv=vlink -brawbin1 -t -x -Cvbcc m68040\startup_m68040.o %s %s -L%%VBCC%%\targets\m68k-foenix\lib -T%%VBCC%%\targets\m68k-foenix\vlink_flash_a2560k.cmd -lvc -o %s -Mmapfile
-l2v=vlink -brawbin1 -t -x -Cvbcc %s %s -L%%VBCC%%\targets\m68k-foenix\lib -T%%VBCC%%\targets\m68k-foenix\vlink_flash_a2560k.cmd -o %s -Mmapfile
-ul=-l%s
-cf=-F%s
-ml=1000

View file

@ -0,0 +1,36 @@
FLASHSTART = 0xFFC10000;
FLASHLEN = 0x00200000;
RAMSTART = 0x00001000;
RAMSIZE = 0x00010000;
STACKLEN = 0x400;
VECTORSIZE = 0x400;
BINFILESTART = 0x00000000;
PAGESIZE = 0x10000;
MEMORY
{
vectors : org = 0x000000, len = VECTORSIZE
ram : org = RAMSTART + VECTORSIZE, len = RAMSIZE - VECTORSIZE
flash: org = FLASHSTART, len = FLASHLEN
binpage0: org = BINFILESTART, len = PAGESIZE
binpages: org = BINFILESTART + PAGESIZE, len = FLASHLEN - PAGESIZE
}
SECTIONS
{
vectors : { *(VECTORS) } >vectors AT>binpage0
text : {*(CODE)} >flash AT>binpages
.dtors : { *(.dtors) } >ram AT>binpage0
.ctors : { *(.ctors) } >ram AT>binpage0
rodata : {*(RODATA)} >flash AT>binpages
data: {*(DATA)} >ram
bss (NOLOAD): {*(BSS)} >ram
___heap = ADDR(bss) + SIZEOF(bss);
___heapend = RAMSTART + RAMSIZE - STACKLEN;
___BSSSTART = ADDR(bss);
___BSSSIZE = SIZEOF(bss);
___STACK = RAMSTART + RAMSIZE;
}