Added ASND sound, centered menus, added other save directories

This commit is contained in:
fabio.olimpieri 2012-04-08 09:16:42 +00:00
parent de19c97eae
commit dbff026c93
10 changed files with 161 additions and 74 deletions

View File

@ -25,7 +25,7 @@ INCLUDES :=
# options for code generation
#---------------------------------------------------------------------------------
CFLAGS = -g -O2 -Wall $(MACHDEP) $(INCLUDE) -Wno-pointer-sign -DDEBUG
CFLAGS = -g -O2 -Wall -Wno-unused-but-set-variable $(MACHDEP) $(INCLUDE) -Wno-pointer-sign -DDEBUG
CXXFLAGS = $(CFLAGS)
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
@ -33,7 +33,7 @@ LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS := -lSDL_mixer -lsmpeg -lvorbisidec -lSDL_image -lpng -ljpeg -lz -lSDL -lSDL_gfx -lfreetype -lfat -lwiiuse -lbte -logc -lm -lwiikeyboard
LIBS := -lasnd -lSDL_mixer -lsmpeg -lvorbisidec -lSDL_image -lpng -ljpeg -lz -lSDL -lSDL_gfx -lfreetype -lfat -lwiiuse -lbte -logc -lm -lwiikeyboard
#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
@ -114,15 +114,15 @@ dist: $(BUILD)
mkdir -p $@/apps/fbzx-wii
mkdir -p $@/fbzx-wii/fbzx
mkdir -p $@/fbzx-wii/spectrum-roms
mkdir -p $@/fbzx-wii/applications
mkdir -p $@/fbzx-wii/tapes
mkdir -p $@/fbzx-wii/snapshots
mkdir -p $@/fbzx-wii/microdrives
mkdir -p $@/fbzx-wii/pixmaps
mkdir -p $@/fbzx-wii/doc/fbzx
mkdir -p $@/apps/fbzx-wii/doc
cp fbzx.dol $@/apps/fbzx-wii/boot.dol
cp spectrum-roms/* $@/fbzx-wii/spectrum-roms
cp keymap.bmp $@/fbzx-wii/fbzx
cp fbzx.desktop $@/fbzx-wii/applications
cp fbzx.svg $@/fbzx-wii/pixmaps
cp AMSTRAD CAPABILITIES COPYING FAQ README README.TZX VERSIONS $@/fbzx-wii/doc/fbzx/
cp AMSTRAD CAPABILITIES COPYING FAQ README README.TZX VERSIONS $@/apps/fbzx-wii/doc
cd $@ && tar -czf ../fbzx-wii-bin.tar.gz *
#---------------------------------------------------------------------------------

View File

@ -24,6 +24,15 @@
#include <stdio.h>
#include <string.h>
#ifdef DEBUG
extern FILE *fdebug;
#define printf(...) fprintf(fdebug,__VA_ARGS__)
#else
#ifdef GEKKO
#define printf(...)
#endif
#endif
void uncompress_z80(FILE *fichero,int length,unsigned char *memo) {
unsigned char byte_loaded,EDfound,counter;
@ -87,7 +96,9 @@ int save_z80(char *filename) {
fprintf(fichero,"%c%c%c%c%c%c",procesador.Rm.br.A,procesador.Rm.br.F,procesador.Rm.br.C,procesador.Rm.br.B,procesador.Rm.br.L,procesador.Rm.br.H); // AF, BC and HL
if(ordenador.mode128k==0) // 48K
fprintf(fichero,"%c%c",(byte)(procesador.PC&0x0FF),(byte)((procesador.PC>>8)&0xFF)); // PC
fprintf(fichero,"%c%c",(byte)(procesador.PC&0x0FF),(byte)((procesador.PC>>8)&0xFF)); // PC
//Endian?
//fprintf(fichero,"%c%c",(byte)(procesador.PC&0x0FF),(byte)((procesador.PC<<8)&0xFF)); // PC
else
fprintf(fichero,"%c%c",0,0); // 128K

View File

@ -37,10 +37,10 @@ void printchar(unsigned char *memo, unsigned char carac, int x, int y, unsigned
lugar2=lugar;
for (bucle2=0;bucle2 < 16;bucle2++) {
if ((characters[carac-32][pos]) & bit_rot)
paint_one_pixel (colors + (int) (color), lugar2);
paint_one_pixel ((unsigned char *) (colors + (int) (color)), lugar2);
//*((unsigned int *)lugar2)=*(colors+(int)(color-16));
else if ((ordenador.text_mini==0)||((bucle1%2==0)&&(bucle2%2==0)))
paint_one_pixel (colors + (int) (back), lugar2);
paint_one_pixel ((unsigned char *)(colors + (int) (back)), lugar2);
//*((unsigned int *)lugar2)=*(colors+(int)(back-16));
if ((ordenador.text_mini==0)||(bucle2%2==1)) {
lugar2+=ordenador.bpp;

View File

@ -33,7 +33,11 @@
#ifdef DEBUG
extern FILE *fdebug;
#define printf(...) fprintf(fdebug,__VA_ARGS__); fflush (fdebug)
#define printf(...) fprintf(fdebug,__VA_ARGS__)
#else
#ifdef GEKKO
#define printf(...)
#endif
#endif
/* Returns the bus value when reading a port without a periferial */
@ -581,12 +585,12 @@ inline void show_screen (int tstados) {
}
if (ordenador.osd_time)
print_string (ordenador.screenbuffer,ordenador.osd_text, -1,460, 12, 0,ordenador.screen_width);
print_string (ordenador.screenbuffer,ordenador.osd_text, -1,450, 12, 0,ordenador.screen_width);
else {
if (ordenador.zaurus_mini==0)
print_string (ordenador.screenbuffer," ",-1, 460, 12, 0,ordenador.screen_width);
print_string (ordenador.screenbuffer," ",-1, 450, 12, 0,ordenador.screen_width);
else
print_string (ordenador.screenbuffer," ",-1, 460, 12, 0,ordenador.screen_width);
print_string (ordenador.screenbuffer," ",-1, 450, 12, 0,ordenador.screen_width);
}
}

View File

@ -26,6 +26,7 @@
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <malloc.h>
#include "characters.h"
#include "menus.h"
#include <string.h>
@ -42,7 +43,11 @@
#ifdef DEBUG
FILE *fdebug;
#define printf(...) fprintf(fdebug,__VA_ARGS__); fflush (fdebug)
#define printf(...) fprintf(fdebug,__VA_ARGS__)
#else
#ifdef GEKKO
#define printf(...)
#endif
#endif
char debug_var=1;
@ -293,7 +298,9 @@ void init_screen(int resx,int resy,int depth,int fullscreen,int dblbuffer,int hw
value=0;
for(bucle2=0;bucle2<NUM_SNDBUF;bucle2++) {
sound[bucle2]=(unsigned char *)malloc(ordenador.buffer_len*ordenador.increment+8);
//sound[bucle2]=(unsigned char *)malloc(ordenador.buffer_len*ordenador.increment+8);
//ASND Required alligned memory with padding
sound[bucle2]=(unsigned char *)memalign(32,ordenador.buffer_len*ordenador.increment+32);
for(bucle=0;bucle<ordenador.buffer_len*ordenador.increment+4;bucle++)
sound[bucle2][bucle]=value;
value+=4;
@ -515,13 +522,10 @@ int main(int argc,char *argv[]) {
#endif
#ifdef GEKKO
fullscreen=1;
dblbuffer=1;
hwsurface=1;
setenv("HOME", "/fbzx-wii", 1);
printf("\x1b[2;0H");
//initialize libfat library
if (!fatInitDefault())
{
@ -532,7 +536,6 @@ int main(int argc,char *argv[]) {
else
printf("SD FAT subsytem initialized\n\n");
//SDL_Delay(3000);
#endif
@ -678,6 +681,10 @@ int main(int argc,char *argv[]) {
strcat(path_snaps,"/");
strcpy(path_taps,path_snaps);
strcpy(path_mdrs,path_snaps);
strcat(path_snaps,"snapshots");
strcat(path_taps,"tapes");
strcat(path_mdrs,"microdrives");
ordenador.current_tap[0]=0;
// assign random values to the memory before start execution
@ -798,5 +805,10 @@ int main(int argc,char *argv[]) {
}
save_config(&ordenador);
#ifdef GEKKO
fatUnmount(0);
#endif
return 0;
}

View File

@ -90,7 +90,7 @@ void settings_menu() {
do {
clean_screen();
print_string(fbuffer,"Current settings",-1,5,15,0,ancho);
print_string(fbuffer,"Current settings",-1,20,15,0,ancho);
switch(ordenador.mode128k) {
case 0:
if(ordenador.issue==2)
@ -207,8 +207,8 @@ void settings_menu() {
print_string(fbuffer,"V:",30,400,12,0,ancho);
print_string(fbuffer,"TV Set mode",78,400,15,0,ancho);
print_string(fbuffer,"ESC:",168,460,12,0,ancho);
print_string(fbuffer,"return emulator",232,460,15,0,ancho);
print_string(fbuffer,"ESC:",168,450,12,0,ancho);
print_string(fbuffer,"return emulator",232,450,15,0,ancho);
switch(wait_key()) {
case SDLK_ESCAPE:
@ -305,8 +305,8 @@ void help_menu() {
clean_screen();
print_string(fbuffer,"FBZX (2.7.0)",-1,10,15,0,ancho);
print_string(fbuffer,"Available keys",-1,40,14,0,ancho);
print_string(fbuffer,"FBZX (2.7.0)",-1,20,15,0,ancho);
print_string(fbuffer,"Available keys",-1,50,14,0,ancho);
print_string(fbuffer,"Shift:Caps Shift Ctrl:Symbol Shift",-1,95,11,0,ancho);
print_string(fbuffer,"F1:",14,160,12,0,ancho);
@ -470,13 +470,13 @@ void tools_menu() {
do {
clean_screen();
print_string(fbuffer,"Tools",-1,10,15,0,ancho);
print_string(fbuffer,"Tools",-1,20,15,0,ancho);
print_string(fbuffer,"1:",14,50,12,0,ancho);
print_string(fbuffer,"show keyboard template",62,50,15,0,ancho);
print_string(fbuffer,"1:",14,60,12,0,ancho);
print_string(fbuffer,"show keyboard template",62,60,15,0,ancho);
print_string(fbuffer,"2:",14,90,12,0,ancho);
print_string(fbuffer,"insert POKEs",62,90,15,0,ancho);
print_string(fbuffer,"2:",14,100,12,0,ancho);
print_string(fbuffer,"insert POKEs",62,100,15,0,ancho);
print_string(fbuffer,"ESC:",14,250,12,0,ancho);
print_string(fbuffer,"return emulator",78,250,15,0,ancho);
@ -518,7 +518,7 @@ void snapshots_menu() {
clean_screen();
print_string(fbuffer,"SNAPSHOTS",-1,10,15,0,ancho);
print_string(fbuffer,"SNAPSHOTS",-1,30,15,0,ancho);
print_string(fbuffer,"1:",14,100,12,0,ancho);
print_string(fbuffer,"load a Z80/SNA snapshot",62,100,15,0,ancho);
@ -582,29 +582,29 @@ void taps_menu() {
do {
clean_screen();
print_string(fbuffer,"TAP/TZX files",-1,10,15,0,ancho);
print_string(fbuffer,"TAP/TZX files",-1,20,15,0,ancho);
print_string(fbuffer,"1:",14,50,12,0,ancho);
print_string(fbuffer,"select a TAP/TZX file",62,50,15,0,ancho);
print_string(fbuffer,"1:",14,60,12,0,ancho);
print_string(fbuffer,"select a TAP/TZX file",62,60,15,0,ancho);
print_string(fbuffer,"2:",14,90,12,0,ancho);
print_string(fbuffer,"rewind TAP/TZX file",62,90,15,0,ancho);
print_string(fbuffer,"2:",14,100,12,0,ancho);
print_string(fbuffer,"rewind TAP/TZX file",62,100,15,0,ancho);
print_string(fbuffer,"3:",14,130,12,0,ancho);
print_string(fbuffer,"fast/normal speed",62,130,15,0,ancho);
print_string(fbuffer,"3:",14,140,12,0,ancho);
print_string(fbuffer,"fast/normal speed",62,140,15,0,ancho);
print_string(fbuffer,"4:",14,170,12,0,ancho);
print_string(fbuffer,"write protection",62,170,15,0,ancho);
print_string(fbuffer,"4:",14,180,12,0,ancho);
print_string(fbuffer,"write protection",62,180,15,0,ancho);
print_string(fbuffer,"5:",14,210,12,0,ancho);
print_string(fbuffer,"create TAP file",62,210,15,0,ancho);
print_string(fbuffer,"5:",14,220,12,0,ancho);
print_string(fbuffer,"create TAP file",62,220,15,0,ancho);
print_string(fbuffer,"ESC:",14,250,12,0,ancho);
print_string(fbuffer,"return emulator",78,250,15,0,ancho);
print_string(fbuffer,"ESC:",14,260,12,0,ancho);
print_string(fbuffer,"return emulator",78,260,15,0,ancho);
print_string(fbuffer,"Current TAP/TZX file is:",-1,300,12,0,ancho);
print_string(fbuffer,ordenador.current_tap,-1,320,12,0,ancho);
print_string(fbuffer,"Current TAP/TZX file is:",-1,310,12,0,ancho);
print_string(fbuffer,ordenador.current_tap,-1,330,12,0,ancho);
print_copy(fbuffer,ancho);
@ -745,7 +745,7 @@ void create_tapfile() {
print_string(videomem,path_taps,0,152,12,0,ancho);
retorno=ask_filename(nombre2,84,"tap");
retorno=ask_filename(nombre2,84,"tap",path_taps);
clean_screen();
@ -801,19 +801,19 @@ void microdrive_menu() {
do {
clean_screen();
print_string(fbuffer,"MICRODRIVE files",-1,10,15,0,ancho);
print_string(fbuffer,"MICRODRIVE files",-1,20,15,0,ancho);
print_string(fbuffer,"1:",14,50,12,0,ancho);
print_string(fbuffer,"select a MDR file",62,50,15,0,ancho);
print_string(fbuffer,"1:",14,60,12,0,ancho);
print_string(fbuffer,"select a MDR file",62,60,15,0,ancho);
print_string(fbuffer,"2:",14,90,12,0,ancho);
print_string(fbuffer,"create a MDR file",62,90,15,0,ancho);
print_string(fbuffer,"2:",14,100,12,0,ancho);
print_string(fbuffer,"create a MDR file",62,100,15,0,ancho);
print_string(fbuffer,"3:",14,130,12,0,ancho);
print_string(fbuffer,"write protection",62,130,15,0,ancho);
print_string(fbuffer,"3:",14,140,12,0,ancho);
print_string(fbuffer,"write protection",62,140,15,0,ancho);
print_string(fbuffer,"ESC:",14,170,12,0,ancho);
print_string(fbuffer,"return emulator",78,170,15,0,ancho);
print_string(fbuffer,"ESC:",14,180,12,0,ancho);
print_string(fbuffer,"return emulator",78,180,15,0,ancho);
print_string(fbuffer,"Current MDR file is:",-1,300,12,0,ancho);
print_string(fbuffer,ordenador.mdr_current_mdr,-1,320,12,0,ancho);
@ -928,7 +928,7 @@ void create_mdrfile() {
print_string(videomem,"MDR file will be saved in:",-1,132,12,0,ancho);
print_string(videomem,path_mdrs,0,152,12,0,ancho);
retorno=ask_filename(nombre2,84,"mdr");
retorno=ask_filename(nombre2,84,"mdr",path_mdrs);
clean_screen();
@ -991,9 +991,9 @@ void create_scrfile() {
print_string(videomem,"(up to 30 characters)",-1,52,14,0,ancho);
print_string(videomem,"SCR file will be saved in:",-1,132,12,0,ancho);
print_string(videomem,path_mdrs,0,152,12,0,ancho);
print_string(videomem,path_snaps,0,152,12,0,ancho);
retorno=ask_filename(nombre2,84,"scr");
retorno=ask_filename(nombre2,84,"scr",path_snaps);
clean_screen();
@ -1038,7 +1038,7 @@ void create_scrfile() {
}
int ask_filename(char *nombre_final,int y_coord,char *extension) {
int ask_filename(char *nombre_final,int y_coord,char *extension, char *path) {
int longitud,retorno;
unsigned char nombre[37],nombre2[38];
@ -1335,11 +1335,11 @@ int ask_filename(char *nombre_final,int y_coord,char *extension) {
nombre[longitud]=0; // erase cursor
longitud=strlen(path_snaps);
if((path_snaps[longitud-1]!='/')&&(longitud>1))
sprintf(nombre_final,"%s/%s.%s",path_snaps,nombre,extension); // name
longitud=strlen(path);
if((path[longitud-1]!='/')&&(longitud>1))
sprintf(nombre_final,"%s/%s.%s",path,nombre,extension); // name
else
sprintf(nombre_final,"%s%s.%s",path_snaps,nombre,extension);
sprintf(nombre_final,"%s%s.%s",path,nombre,extension);
return (retorno);
}
@ -1462,7 +1462,7 @@ void save_z80file() {
print_string(videomem,path_snaps,0,152,12,0,ancho);
retorno=ask_filename(nombre2,84,"z80");
retorno=ask_filename(nombre2,84,"z80", path_snaps);
clean_screen();
@ -1827,7 +1827,7 @@ void keyboard_menu() {
for (bucle1=0;bucle1<344;bucle1++)
for(bucle2=0;bucle2<640;bucle2++) {
retval=fscanf(fichero,"%c",&valor);
paint_one_pixel(colors+valor,buffer);
paint_one_pixel((unsigned char *)(colors+valor),buffer);
buffer+=ordenador.bpp;
}
} else {
@ -1836,7 +1836,7 @@ void keyboard_menu() {
buffer2=buffer;
for(bucle2=0;bucle2<640;bucle2++) {
retval=fscanf(fichero,"%c",&valor);
paint_one_pixel(colors+valor,buffer);
paint_one_pixel((unsigned char *)(colors+valor),buffer);
buffer+=(480*ordenador.bpp);
}
buffer=buffer2-ordenador.bpp;

View File

@ -45,7 +45,7 @@ void create_mdrfile();
void microdrive_menu();
void keyboard_menu();
void load_scrfile();
int ask_filename(char *nombre,int y_coord,char *extension);
int ask_filename(char *nombre,int y_coord,char *extension, char *path);
void create_scrfile();
void do_poke();
int ask_value(int *final_value,int y_coord,int max_value);

View File

@ -33,7 +33,11 @@ char tabla[1024];
#ifdef DEBUG
extern FILE *fdebug;
#define printf(...) fprintf(fdebug,__VA_ARGS__); fflush (fdebug)
#define printf(...) fprintf(fdebug,__VA_ARGS__)
#else
#ifdef GEKKO
#define printf(...)
#endif
#endif
/*#include <SDL/SDL.h>
@ -60,6 +64,10 @@ snd_pcm_t * _soundDevice;
pa_simple *pulse_s;
#endif
#ifdef GEKKO
#include <asndlib.h>
#endif
enum e_soundtype sound_type;
int sound_init() {
@ -112,6 +120,19 @@ int sound_init() {
}
break;
#endif
#ifdef GEKKO
case SOUND_ASND:
printf("Trying ASND sound\n");
if(0==sound_init_asnd()) {
sound_type=SOUND_ASND;
return 0;
} else {
printf("Failed\n");
return -1;
}
break;
#endif
default:
break;
}
@ -140,9 +161,32 @@ int sound_init() {
}
#endif
#ifdef GEKKO
printf("Trying ASND sound\n");
if(0==sound_init_asnd()) {
sound_type=SOUND_ASND;
return 0;
}
#endif
return -1;
}
#ifdef GEKKO
int sound_init_asnd() {
ASND_Init();
ASND_Pause(0);
ordenador.sign=0;
ordenador.format=0;
ordenador.channels=1;
ordenador.freq=48000;
ordenador.buffer_len=4096;
return 0;
}
#endif
#ifdef D_SOUND_PULSE
int sound_init_pulse() {
@ -443,6 +487,15 @@ void sound_play() {
return;
break;
#endif
#ifdef GEKKO
case SOUND_ASND: // ASND
retval=ASND_SetVoice(1,VOICE_MONO_8BIT,48000,0,ordenador.current_buffer,ordenador.buffer_len,
ordenador.volume, ordenador.volume, NULL);
while (ASND_StatusVoice(1) == SND_WORKING){};
return;
break;
#endif
default:
break;
}
@ -470,6 +523,12 @@ void sound_close() {
pa_simple_free(pulse_s);
break;
#endif
#ifdef GEKKO
case SOUND_ASND:
ASND_End();
break;
#endif
default:
break;
}

View File

@ -20,7 +20,7 @@
#ifndef SOUND_H
#define SOUND_H
enum e_soundtype {SOUND_NO, SOUND_OSS, SOUND_ALSA, SOUND_PULSEAUDIO, SOUND_AUTOMATIC};
enum e_soundtype {SOUND_NO, SOUND_OSS, SOUND_ALSA, SOUND_PULSEAUDIO, SOUND_AUTOMATIC, SOUND_ASND};
extern enum e_soundtype sound_type;
@ -33,7 +33,8 @@ extern volatile unsigned char *sdl_sound_buffer;
int sound_init_oss();
int sound_init_alsa();
int sound_init_pulse();
int sound_init_asnd();
void sdlcallback(void *userdata, Uint8 *stream, int len);
//void sdlcallback(void *userdata, Uint8 *stream, int len);
#endif

View File

@ -29,7 +29,7 @@ CFLAGS = -g -O1 -Wall $(MACHDEP) $(INCLUDE)
CXXFLAGS = $(CFLAGS)
LDFLAGS = -g $(MACHDEP) -Wl,-Map,$(notdir $@).map
#-fpack-struct
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------