mirror of
https://github.com/Oibaf66/fbzx-wii.git
synced 2024-11-28 11:04:15 +01:00
Fixed virtual keyboard bug, fixed CPIR and CPDR instructions
This commit is contained in:
parent
dd1edcde76
commit
a93b567fda
@ -791,6 +791,11 @@ inline void read_keyboard () {
|
||||
ordenador.keyboard_buffer[0][ordenador.kbd_buffer_pointer+1] = 0;
|
||||
ordenador.keyboard_buffer[1][ordenador.kbd_buffer_pointer+1] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
joybutton_matrix[0][(ordenador.keyboard_buffer[0][ordenador.kbd_buffer_pointer+1])]=1;
|
||||
joybutton_matrix[0][(ordenador.keyboard_buffer[1][ordenador.kbd_buffer_pointer+1])]=1;
|
||||
}
|
||||
countdown--;
|
||||
}
|
||||
else if (ordenador.kbd_buffer_pointer)
|
||||
@ -1275,16 +1280,18 @@ void Z80free_Out (register word Port, register byte Value) {
|
||||
|
||||
register word maskport;
|
||||
|
||||
if (((Port&0x0001)==0)||((Port>=0x4000)&&(Port<0x8000))||Port == 0xBF3B||Port == 0xFF3B) {
|
||||
if (((Port&0x0001)==0)||((Port>=0x4000)&&(Port<0x8000))) {
|
||||
do_contention();
|
||||
}
|
||||
|
||||
// ULAPlus
|
||||
if (Port == 0xBF3B) {
|
||||
do_contention();
|
||||
ordenador.ulaplus_reg = Value;
|
||||
return;
|
||||
}
|
||||
if (Port == 0xFF3B) {
|
||||
do_contention();
|
||||
if (ordenador.ulaplus_reg==0x40) { // mode
|
||||
ordenador.ulaplus=Value&0x01;
|
||||
return;
|
||||
@ -1348,13 +1355,14 @@ byte Z80free_In (register word Port) {
|
||||
static unsigned int temporal_io;
|
||||
byte pines;
|
||||
|
||||
if (((Port&0x0001)==0)||((Port>=0x4000)&&(Port<0x8000))||Port == 0xFF3B) {
|
||||
if (((Port&0x0001)==0)||((Port>=0x4000)&&(Port<0x8000))) {
|
||||
do_contention();
|
||||
}
|
||||
|
||||
temporal_io = (unsigned int) Port;
|
||||
|
||||
if (Port == 0xFF3B) {
|
||||
do_contention();
|
||||
if (ordenador.ulaplus_reg==0x40) { // mode
|
||||
return(ordenador.ulaplus&0x01);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
CC = gcc -c -O1 -Wall
|
||||
CCo = gcc -O1 -Wall
|
||||
CC = gcc -c -O1 -Wall -DBYTE_ORDER=LITTLE_ENDIAN
|
||||
CCo = gcc -O1 -Wall -DBYTE_ORDER=LITTLE_ENDIAN
|
||||
|
||||
z80free_tester: z80free_tester.o Z80free.o Z80free_codes.o Z80free_codesCB.o Z80free_codesED.o Z80free_codesDD.o Z80free_codesFD.o Z80free_codesDDCB.o Z80free_codesFDCB.o
|
||||
$(CCo) -o z80free_tester z80free_tester.o Z80free.o Z80free_codes.o Z80free_codesCB.o Z80free_codesED.o Z80free_codesDD.o Z80free_codesFD.o Z80free_codesDDCB.o Z80free_codesFDCB.o
|
||||
|
@ -22,7 +22,10 @@
|
||||
#ifndef Z80FREE_H
|
||||
#define Z80FREE_H
|
||||
|
||||
#ifdef GEKKO
|
||||
#include <machine/endian.h>
|
||||
#endif
|
||||
|
||||
#ifndef Z80_H
|
||||
typedef unsigned short int word;
|
||||
typedef unsigned char byte;
|
||||
|
@ -279,8 +279,8 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) {
|
||||
processor->PC=Z80free_doPop(processor);
|
||||
return (10);
|
||||
break;
|
||||
case 78: // IM 1
|
||||
processor->IM=1;
|
||||
case 78: // IM 0
|
||||
processor->IM=0;
|
||||
return (4);
|
||||
break;
|
||||
case 79: // LD R,A
|
||||
@ -724,11 +724,14 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) {
|
||||
processor->Rm.wr.BC--;
|
||||
if ((processor->Rm.wr.BC)&&(!(processor->Rm.br.F&F_Z))) {
|
||||
processor->PC-=2;
|
||||
Z80free_valFlag(processor,F_C,tmp2);
|
||||
return (17);
|
||||
} else {
|
||||
Z80free_resFlag(processor,F_H|F_N|F_PV|F_3|F_5);
|
||||
Z80free_resFlag(processor,F_H|F_PV|F_3|F_5);
|
||||
Z80free_setFlag(processor,F_N);
|
||||
Z80free_valFlag(processor,F_C,tmp2);
|
||||
return (12);
|
||||
if (processor->Rm.wr.BC)
|
||||
Z80free_setFlag(processor,F_PV); return (12);
|
||||
}
|
||||
break;
|
||||
case 178: // INIR
|
||||
@ -786,11 +789,14 @@ int Z80free_codesED (Z80FREE *processor,byte opcode) {
|
||||
processor->Rm.wr.BC--;
|
||||
if ((processor->Rm.wr.BC)&&(!(processor->Rm.br.F&F_Z))) {
|
||||
processor->PC-=2;
|
||||
Z80free_valFlag(processor,F_C,tmp2);
|
||||
return (17);
|
||||
} else {
|
||||
Z80free_resFlag(processor,F_H|F_N|F_PV|F_3|F_5);
|
||||
Z80free_resFlag(processor,F_H|F_PV|F_3|F_5);
|
||||
Z80free_setFlag(processor,F_N);
|
||||
Z80free_valFlag(processor,F_C,tmp2);
|
||||
return (12);
|
||||
if (processor->Rm.wr.BC)
|
||||
Z80free_setFlag(processor,F_PV); return (12);
|
||||
}
|
||||
break;
|
||||
case 186: // INDR
|
||||
|
@ -838,7 +838,7 @@ class z80_parser(generic_parser):
|
||||
return False
|
||||
|
||||
if opcode=="OUTI":
|
||||
self.file_out.write("\t\t/*OUTI, OUTD, OTIR and OTDR first decrements B and then uses it*/\n")
|
||||
self.file_out.write("\t\t/*OUTI, OUTD, OTIR and OTDR first decrement B and then uses it*/\n")
|
||||
self.file_out.write("\t\tprocessor->Rm.br.B=Z80free_doIncDec(processor,processor->Rm.br.B,1);\n")
|
||||
self.file_out.write("\t\tZ80free_Out(processor->Rm.wr.BC,Z80free_Rd(processor->Rm.wr.HL));\n")
|
||||
self.file_out.write("\t\tprocessor->Rm.wr.HL++;\n")
|
||||
@ -910,8 +910,11 @@ class z80_parser(generic_parser):
|
||||
self.file_out.write("\t\t\tprocessor->PC-=2;\n")
|
||||
self.file_out.write("\t\t\treturn ("+str(tst1)+");\n")
|
||||
self.file_out.write("\t\t} else {\n")
|
||||
self.file_out.write("\t\t\tZ80free_resFlag(processor,F_H|F_N|F_PV|F_3|F_5);\n")
|
||||
self.file_out.write("\t\t\tZ80free_resFlag(processor,F_H|F_PV|F_3|F_5);\n")
|
||||
self.file_out.write("\t\t\tZ80free_setFlag(processor,F_N);\n")
|
||||
self.file_out.write("\t\tZ80free_valFlag(processor,F_C,tmp2);\n")
|
||||
self.file_out.write("\t\tif (processor->Rm.wr.BC)\n")
|
||||
self.file_out.write("\t\t\tZ80free_setFlag(processor,F_PV);")
|
||||
self.file_out.write("\t\t\treturn ("+str(tst2)+");\n")
|
||||
self.file_out.write("\t\t}\n")
|
||||
return True
|
||||
@ -964,8 +967,11 @@ class z80_parser(generic_parser):
|
||||
self.file_out.write("\t\t\tprocessor->PC-=2;\n")
|
||||
self.file_out.write("\t\t\treturn ("+str(tst1)+");\n")
|
||||
self.file_out.write("\t\t} else {\n")
|
||||
self.file_out.write("\t\t\tZ80free_resFlag(processor,F_H|F_N|F_PV|F_3|F_5);\n")
|
||||
self.file_out.write("\t\t\tZ80free_resFlag(processor,F_H|F_PV|F_3|F_5);\n")
|
||||
self.file_out.write("\t\t\tZ80free_setFlag(processor,F_N);\n")
|
||||
self.file_out.write("\t\tZ80free_valFlag(processor,F_C,tmp2);\n")
|
||||
self.file_out.write("\t\tif (processor->Rm.wr.BC)\n")
|
||||
self.file_out.write("\t\t\tZ80free_setFlag(processor,F_PV);")
|
||||
self.file_out.write("\t\t\treturn ("+str(tst2)+");\n")
|
||||
self.file_out.write("\t\t}\n")
|
||||
return True
|
||||
@ -1306,3 +1312,4 @@ aparser=parser_ED("Z80free_codesED")
|
||||
aparser=parser_FD("Z80free_codesFD")
|
||||
aparser=parser_FDCB("Z80free_codesFDCB")
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user