Commit c82b1a4c authored by Sergio Costas's avatar Sergio Costas

Even better timming

parent 317bada0
fbzx (3.4.0-Debian1) sid; urgency=low
* Slightly better adjusted the memory contention
-- Sergio Costas Rodriguez <raster@rastersoft.com> Mon, 13 Feb 2017 23:55:00 +0200
fbzx (3.3.0-Debian1) sid; urgency=low
* Fixed the Fast Load
* Now the tape is paused automatically when it reachs the end
-- Sergio Costas Rodriguez <raster@rastersoft.com> Mon, 13 Feb 2017 23:55:00 +0200
-- Sergio Costas Rodriguez <raster@rastersoft.com> Mon, 13 Feb 2017 23:50:00 +0200
fbzx (3.2.0-Debian1) sid; urgency=low
......
......@@ -5,7 +5,7 @@ Priority: optional
Build-Depends: build-essential, make, libpulse-dev, libasound2-dev, libsdl1.2-dev
Package: fbzx
Version: 3.3.0
Version: 3.4.0
Architecture: any
Depends: libpulse0,libasound2,libsdl1.2debian,spectrum-roms (>=20081224-1)
Homepage: http://www.rastersoft.com/fbzx.html
......
## VERSIONS ##
* Version 3.4.0 (2017-02-13)
* Slightly better adjusted the memory contention
* Version 3.3.0 (2017-02-13)
* Fixed the Fast Load
* Now the tape is paused automatically when it reachs the end
......
Name: fbzx
Version: 3.3.0
Version: 3.4.0
Release: 1
License: GPL3
Summary: A Sinclair ZX Spectrum emulator
......
......@@ -186,10 +186,23 @@ void ResetComputer () {
mouse->reset();
}
void extra_contention(bool IO) {
int tstates;
if (IO) {
tstates = 3;
} else if (procesador.M1) {
tstates = 4;
} else {
tstates = 3;
}
ordenador->emulate(tstates);
ordenador->contended_cicles += tstates;
}
void Z80free_Wr (word Addr, byte Value) {
ordenador->emulate(CONTENTION_WR);
ordenador->contended_cicles += CONTENTION_WR;
extra_contention(false);
if ((Addr & 0xC000) == 0x4000) {
ordenador->do_contention();
}
......@@ -223,8 +236,7 @@ void computer::write_memory (uint16_t Addr, uint8_t Value) {
byte Z80free_Rd (word Addr) {
ordenador->emulate(CONTENTION_RD);
ordenador->contended_cicles += CONTENTION_RD;
extra_contention(false);
if((microdrive->mdr_active)&&(microdrive->mdr_paged)&&(Addr<8192)) // Interface I
return((byte)ordenador->shadowrom[Addr]);
......@@ -273,8 +285,7 @@ void Z80free_Out (word Port, byte Value) {
// Microdrive access
register word maskport;
ordenador->emulate(CONTENTION_OUT);
ordenador->contended_cicles += CONTENTION_OUT;
extra_contention(true);
if (((Port&0x0001)==0)||((Port>=0x4000)&&(Port<0x8000))) {
if (ordenador->current_mode != MODE_P3) {
......@@ -345,8 +356,7 @@ byte Z80free_In (word Port) {
static unsigned int temporal_io;
byte pines;
ordenador->emulate(CONTENTION_IN);
ordenador->contended_cicles += CONTENTION_IN;
extra_contention(true);
if (((Port&0x0001)==0)||((Port>=0x4000)&&(Port<0x8000))) {
if (ordenador->current_mode != MODE_P3) {
ordenador->do_contention();
......
......@@ -56,7 +56,7 @@ void help_menu() {
llscreen->clear_screen();
llscreen->print_string("FBZX (3.3.0)",-1,1,15,0);
llscreen->print_string("FBZX (3.4.0)",-1,1,15,0);
llscreen->print_string("Available keys",-1,2,14,0);
llscreen->print_string("Shift:Caps Shift Ctrl:Symbol Shift",-1,4,11,0);
......
......@@ -295,7 +295,7 @@ void Screen::show_screen (int tstados) {
curr_frames=0;
this->currline = 0;
ordenador->interr = 1;
ordenador->cicles_counter = 4;
ordenador->cicles_counter = 0;
this->pixel = this->base_pixel+this->init_line;
this->p_translt = this->translate;
this->p_translt2 = this->translate2;
......
......@@ -66,6 +66,7 @@ int Z80free_ustep(Z80FREE *processor) {
static byte opcode,d1;
int retval=0;
processor->M1 = true;
processor->R++;
if (processor->Status==Z80XX) {
if (processor->NMI_P) { // NMI triggered
......@@ -123,15 +124,18 @@ int Z80free_ustep(Z80FREE *processor) {
processor->Status=Z80FD;
return 4;
} else {
processor->M1 = false;
return(Z80free_codes(processor,opcode));
}
break;
case Z80CB:
processor->Status=Z80XX;
processor->M1 = false;
return(Z80free_codesCB(processor,opcode));
break;
case Z80ED:
processor->Status=Z80XX;
processor->M1 = false;
return(Z80free_codesED(processor,opcode));
break;
case Z80DD:
......@@ -145,8 +149,10 @@ int Z80free_ustep(Z80FREE *processor) {
processor->Status=Z80XX;
if (opcode==0xCB) {
d1=Z80free_Rd(processor->PC++);
processor->M1 = false;
retval+=Z80free_codesDDCB(processor,d1);
} else {
processor->M1 = false;
retval+=Z80free_codesDD(processor,opcode);
}
processor->IAddr_done=0;
......@@ -163,8 +169,10 @@ int Z80free_ustep(Z80FREE *processor) {
processor->Status=Z80XX;
if (opcode==0xCB) {
d1=Z80free_Rd(processor->PC++);
processor->M1 = false;
retval+=Z80free_codesFDCB(processor,d1);
} else {
processor->M1 = false;
retval+=Z80free_codesFD(processor,opcode);
}
processor->IAddr_done=0;
......
......@@ -15,7 +15,7 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
*/
......@@ -34,7 +34,7 @@ extern int Z80free_parityBit[256];
#define F_Z 0x40
#define F_5 0x20
#define F_H 0x10
#define F_3 0x08
#define F_3 0x08
#define F_PV 0x04
#define F_N 0x02
#define F_C 0x01
......@@ -47,9 +47,9 @@ typedef union {
{
word AF, BC, DE, HL, IX, IY, SP;
} wr;
/** Byte registers. SP can be accessed partially to simplify the load/save code. */
#if __BYTE_ORDER == __LITTLE_ENDIAN
struct
{
......@@ -85,6 +85,7 @@ typedef struct
word IAddr; /* address with offset for IX+d and IY+d */
byte IAddr_done; /* if 1, IAddr contains a valid data */
enum Z80Status Status;
bool M1; /* true if the processor is in M1 state */
} Z80FREE;
/* internal Z80 methods */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment