mirror of
https://github.com/Oibaf66/fbzx-wii.git
synced 2024-11-28 11:04:15 +01:00
Fixed SNA, Z80 loading, added load"" in F9, remapped sinclair Joysticks
This commit is contained in:
parent
ec7dbc28ae
commit
c8973f8493
4
Makefile
4
Makefile
@ -117,12 +117,14 @@ dist: $(BUILD)
|
||||
mkdir -p $@/fbzx-wii/tapes
|
||||
mkdir -p $@/fbzx-wii/snapshots
|
||||
mkdir -p $@/fbzx-wii/microdrives
|
||||
mkdir -p $@/fbzx-wii/pixmaps
|
||||
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 AMSTRAD CAPABILITIES COPYING FAQ README README.TZX VERSIONS $@/apps/fbzx-wii/doc
|
||||
touch $@/fbzx-wii/tapes/dummy
|
||||
touch $@/fbzx-wii/snapshots/dummy
|
||||
touch $@/fbzx-wii/microdrives/dummy
|
||||
cd $@ && tar -czf ../fbzx-wii-bin.tar.gz *
|
||||
|
||||
#---------------------------------------------------------------------------------
|
||||
|
@ -97,8 +97,6 @@ int save_z80(char *filename) {
|
||||
|
||||
if(ordenador.mode128k==0) // 48K
|
||||
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
|
||||
|
||||
@ -161,7 +159,7 @@ int save_z80(char *filename) {
|
||||
|
||||
int load_z80(char *filename) {
|
||||
|
||||
struct z80snapshot snap;
|
||||
static struct z80snapshot snap;
|
||||
unsigned char tempo[30],tempo2[56],memo[49152],type,compressed,page,byte_read[3];
|
||||
FILE *fichero;
|
||||
int longitud=0,longitud2,bucle,retval;
|
||||
@ -427,10 +425,16 @@ int load_sna(char *filename) {
|
||||
unsigned char tempo2[98308];
|
||||
unsigned char type=0;
|
||||
FILE *fichero;
|
||||
struct z80snapshot snap;
|
||||
static struct z80snapshot snap;
|
||||
unsigned char v1,v2;
|
||||
int addr,loop;
|
||||
|
||||
//Some inits
|
||||
for(loop=0;loop<16;loop++)
|
||||
snap.ay_regs[loop]=0;
|
||||
snap.ay_latch=0;
|
||||
snap.issue=3;
|
||||
snap.joystick=0;
|
||||
|
||||
printf("Loading SNA file\n");
|
||||
|
||||
@ -568,7 +572,7 @@ void load_snap(struct z80snapshot *snap) {
|
||||
procesador.Rm.br.E=snap->E;
|
||||
procesador.Rm.br.H=snap->H;
|
||||
procesador.Rm.br.L=snap->L;
|
||||
printf("A:%d F:%d B:%d C:%d D:%d E:%d H:%d L:%d\n",snap->A,snap->F,snap->B,snap->C,snap->D,snap->E,snap->H,snap->L);
|
||||
printf("A:%x F:%x B:%x C:%x D:%x E:%x H:%x L:%x\n",snap->A,snap->F,snap->B,snap->C,snap->D,snap->E,snap->H,snap->L);
|
||||
procesador.Ra.br.A=snap->AA;
|
||||
procesador.Ra.br.F=snap->FF;
|
||||
procesador.Ra.br.B=snap->BB;
|
||||
@ -577,16 +581,16 @@ void load_snap(struct z80snapshot *snap) {
|
||||
procesador.Ra.br.E=snap->EE;
|
||||
procesador.Ra.br.H=snap->HH;
|
||||
procesador.Ra.br.L=snap->LL;
|
||||
printf("A:%d F:%d B:%d C:%d D:%d E:%d H:%d L:%d\n",snap->AA,snap->FF,snap->BB,snap->CC,snap->DD,snap->EE,snap->HH,snap->LL);
|
||||
printf("A:%x F:%x B:%x C:%x D:%x E:%x H:%x L:%x\n",snap->AA,snap->FF,snap->BB,snap->CC,snap->DD,snap->EE,snap->HH,snap->LL);
|
||||
procesador.Rm.wr.IX=snap->IX;
|
||||
procesador.Rm.wr.IY=snap->IY;
|
||||
procesador.Rm.wr.SP=snap->SP;
|
||||
procesador.PC=snap->PC;
|
||||
printf("IX:%d IY:%d SP:%d PC:%d\n",snap->IX,snap->IY,snap->SP,snap->PC);
|
||||
printf("IX:%x IY:%x SP:%x PC:%x\n",snap->IX,snap->IY,snap->SP,snap->PC);
|
||||
procesador.I=snap->I;
|
||||
procesador.R=snap->R;
|
||||
procesador.R2=snap->R;
|
||||
printf("I:%d R:%d\n",snap->I,snap->R);
|
||||
printf("I:%x R:%x\n",snap->I,snap->R);
|
||||
|
||||
if(snap->IFF1) {
|
||||
procesador.IFF1=1;
|
||||
@ -598,8 +602,9 @@ void load_snap(struct z80snapshot *snap) {
|
||||
} else {
|
||||
procesador.IFF2=0;
|
||||
}
|
||||
|
||||
printf("IFF1:%x IFF2:%x\n",snap->IFF1,snap->IFF1);
|
||||
procesador.IM=snap->Imode;
|
||||
printf("IM:%x\n",snap->Imode);
|
||||
Z80free_Out(0xFFFE,((snap->border&0x07)|0x10));
|
||||
|
||||
switch(snap->type) {
|
||||
|
@ -29,7 +29,7 @@ struct z80snapshot {
|
||||
byte border; // border color
|
||||
byte pager; // content of pagination register in 128K mode
|
||||
unsigned char page[12][16384];
|
||||
unsigned int found_pages; // bit=1: page exists. bit=0: page don't exists.
|
||||
//unsigned int found_pages; // bit=1: page exists. bit=0: page don't exists.
|
||||
unsigned char ay_regs[16];
|
||||
unsigned char ay_latch;
|
||||
unsigned char joystick;
|
||||
|
@ -123,6 +123,7 @@ void computer_init () {
|
||||
ordenador.ay_envel_way = 0;
|
||||
|
||||
ordenador.tape_loop_counter = 0;
|
||||
ordenador.kbd_buffer_pointer = 0;
|
||||
}
|
||||
|
||||
void computer_set_palete() {
|
||||
@ -696,6 +697,29 @@ inline void read_keyboard (SDL_Event *pevento2) {
|
||||
SDL_Event evento,evento2,*pevento;
|
||||
Sint16 valor;
|
||||
Uint8 eje;
|
||||
static int countdown;
|
||||
|
||||
|
||||
if (ordenador.kbd_buffer_pointer)
|
||||
{
|
||||
if (countdown)
|
||||
countdown--;
|
||||
else
|
||||
{
|
||||
if (ordenador.kbd_buffer_pointer != 1)
|
||||
{
|
||||
SDL_PushEvent(&ordenador.keyboard_buffer[ordenador.kbd_buffer_pointer-2]);
|
||||
ordenador.kbd_buffer_pointer--;
|
||||
countdown=5;
|
||||
}
|
||||
else
|
||||
{
|
||||
ordenador.kbd_buffer_pointer = 0;
|
||||
if ((ordenador.tape_fast_load == 0) || (ordenador.tape_file_type==TAP_TZX))
|
||||
ordenador.pause = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pevento2==NULL) {
|
||||
pevento=&evento;
|
||||
@ -868,7 +892,43 @@ inline void read_keyboard (SDL_Event *pevento2) {
|
||||
break;
|
||||
|
||||
case SDLK_F9:
|
||||
SDL_Fullscreen_Switch();
|
||||
//SDL_Fullscreen_Switch();
|
||||
//Emulate load ""
|
||||
|
||||
ordenador.keyboard_buffer[9].key.keysym.sym=SDLK_j;
|
||||
ordenador.keyboard_buffer[9].type=SDL_KEYDOWN;
|
||||
|
||||
ordenador.keyboard_buffer[8].key.keysym.sym=SDLK_j;
|
||||
ordenador.keyboard_buffer[8].type=SDL_KEYUP;
|
||||
|
||||
ordenador.keyboard_buffer[7].key.keysym.sym=SDLK_RCTRL;
|
||||
ordenador.keyboard_buffer[7].type=SDL_KEYDOWN;
|
||||
|
||||
ordenador.keyboard_buffer[6].key.keysym.sym=SDLK_p;
|
||||
ordenador.keyboard_buffer[6].type=SDL_KEYDOWN;
|
||||
|
||||
ordenador.keyboard_buffer[5].key.keysym.sym=SDLK_p;
|
||||
ordenador.keyboard_buffer[5].type=SDL_KEYUP;
|
||||
|
||||
ordenador.keyboard_buffer[4].key.keysym.sym=SDLK_p;
|
||||
ordenador.keyboard_buffer[4].type=SDL_KEYDOWN;
|
||||
|
||||
ordenador.keyboard_buffer[3].key.keysym.sym=SDLK_p;
|
||||
ordenador.keyboard_buffer[3].type=SDL_KEYUP;
|
||||
|
||||
ordenador.keyboard_buffer[2].key.keysym.sym=SDLK_RCTRL;
|
||||
ordenador.keyboard_buffer[2].type=SDL_KEYUP;
|
||||
|
||||
ordenador.keyboard_buffer[1].key.keysym.sym=SDLK_RETURN;
|
||||
ordenador.keyboard_buffer[1].type=SDL_KEYDOWN;
|
||||
|
||||
ordenador.keyboard_buffer[0].key.keysym.sym=SDLK_RETURN;
|
||||
ordenador.keyboard_buffer[0].type=SDL_KEYUP;
|
||||
|
||||
|
||||
ordenador.kbd_buffer_pointer=11;
|
||||
countdown=5;
|
||||
|
||||
break;
|
||||
|
||||
case SDLK_F10: // Reset emulator
|
||||
@ -932,7 +992,7 @@ inline void read_keyboard (SDL_Event *pevento2) {
|
||||
break;
|
||||
|
||||
case 3: // sinclair 2
|
||||
temporal_io = SDLK_7;
|
||||
temporal_io = SDLK_9;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -968,11 +1028,11 @@ inline void read_keyboard (SDL_Event *pevento2) {
|
||||
break;
|
||||
|
||||
case 2: // sinclair 1
|
||||
temporal_io = SDLK_1;
|
||||
temporal_io = SDLK_2;
|
||||
break;
|
||||
|
||||
case 3: // sinclair 2
|
||||
temporal_io = SDLK_9;
|
||||
temporal_io = SDLK_7;
|
||||
break;
|
||||
|
||||
}
|
||||
@ -989,11 +1049,11 @@ inline void read_keyboard (SDL_Event *pevento2) {
|
||||
break;
|
||||
|
||||
case 2: // sinclair 1
|
||||
temporal_io = SDLK_2;
|
||||
temporal_io = SDLK_1;
|
||||
break;
|
||||
|
||||
case 3: // sinclair 2
|
||||
temporal_io = SDLK_0;
|
||||
temporal_io = SDLK_6;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@ -1018,7 +1078,7 @@ inline void read_keyboard (SDL_Event *pevento2) {
|
||||
break;
|
||||
|
||||
case 3: // sinclair 2
|
||||
temporal_io = SDLK_6;
|
||||
temporal_io = SDLK_0;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -193,6 +193,8 @@ struct computer {
|
||||
unsigned char other_ret; // 0=no change; 1=memory returns RET (201)
|
||||
|
||||
unsigned char turbo;
|
||||
SDL_Event keyboard_buffer[10];
|
||||
unsigned int kbd_buffer_pointer;
|
||||
};
|
||||
|
||||
void computer_init();
|
||||
|
@ -430,7 +430,7 @@ void load_config(struct computer *object) {
|
||||
continue;
|
||||
}
|
||||
if (!strncmp(line,"mode=",5)) {
|
||||
printf("Cambio a modo %c\n",line[5]-'0');
|
||||
printf("Cambio a modo %c\n",line[5]);
|
||||
mode128k=line[5]-'0';
|
||||
continue;
|
||||
}
|
||||
@ -636,7 +636,7 @@ int main(int argc,char *argv[]) {
|
||||
argumento++;
|
||||
} else if(0==strncmp(argv[argumento],"-jump",5)) {
|
||||
jump_frames=(int)(argv[argumento][5]);
|
||||
jump_frames-=48;
|
||||
jump_frames-=48;//???
|
||||
argumento++;
|
||||
printf ("Jump %d\n",jump_frames);
|
||||
} else {
|
||||
|
@ -284,10 +284,13 @@ void settings_menu() {
|
||||
if(ordenador.turbo){
|
||||
ordenador.tst_sample=3500000/ordenador.freq;
|
||||
ordenador.turbo = 0;
|
||||
jump_frames=0;
|
||||
} else {
|
||||
ordenador.tst_sample=100000000/ordenador.freq;
|
||||
ordenador.tst_sample=12000000/ordenador.freq; //5,0 MHz max emulation speed for wii
|
||||
ordenador.turbo = 1;
|
||||
jump_frames=3;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} while(fin);
|
||||
|
||||
@ -334,7 +337,7 @@ void help_menu() {
|
||||
print_string(fbuffer,"tools",382,280,15,0,ancho);
|
||||
|
||||
print_string(fbuffer,"F9:",14,320,12,0,ancho);
|
||||
print_string(fbuffer,"Toggle fullscreen",62,320,15,0,ancho);
|
||||
print_string(fbuffer,"load",62,320,15,0,ancho);
|
||||
|
||||
print_string(fbuffer,"F10:",336,320,12,0,ancho);
|
||||
print_string(fbuffer,"reset spectrum",398,320,15,0,ancho);
|
||||
|
@ -499,8 +499,8 @@ void sound_play() {
|
||||
ordenador.volume, ordenador.volume, callback);
|
||||
started_sound_asnd = 1;
|
||||
}
|
||||
|
||||
while (!ASND_TestVoiceBufferReady(1)){};
|
||||
//Double buffer
|
||||
while (!ASND_TestVoiceBufferReady(1)){}; //Wait for one buffer to be free
|
||||
if (!ASND_TestPointer (1, sound[0]))
|
||||
{ASND_AddVoice(1,sound[0],ordenador.buffer_len);
|
||||
ordenador.current_buffer = sound[0]; }
|
||||
|
Loading…
Reference in New Issue
Block a user