Commit 32d4c58c authored by Sergio Costas's avatar Sergio Costas

Now the interrupt line is kept exactly 32tstates

Now the EI as prefix works fine
parent 296ce35b
......@@ -598,7 +598,6 @@ int main(int argc,char *argv[]) {
if(ordenador->interr==1) {
keyboard->read_keyboard (NULL); // read the physical keyboard
Z80free_INT(&procesador,ordenador->bus_empty());
ordenador->interr=0;
}
}
......
......@@ -41,6 +41,7 @@ Screen::Screen() {
this->flash = 0;
this->screen_snow = false;
this->bus_value = 255;
this->int_counter = 0;
switch (ordenador->zaurus_mini) {
case 0:
......@@ -200,7 +201,13 @@ void Screen::show_screen (int tstados) {
} else {
this->screen_snow = false;
}
if (this->int_counter > 0) {
this->int_counter -= tstados;
if (this->int_counter <= 0) {
Z80free_INTserved(&procesador);
this->int_counter = 0;
}
}
this->tstados_counter += tstados;
ordenador->cicles_counter += tstados;
......@@ -295,6 +302,8 @@ void Screen::show_screen (int tstados) {
curr_frames=0;
this->currline = 0;
ordenador->interr = 1;
this->int_counter = 32;
Z80free_INT(&procesador,ordenador->bus_empty());
ordenador->cicles_counter = 4;
this->pixel = this->base_pixel+this->init_line;
this->p_translt = this->translate;
......
......@@ -38,6 +38,7 @@ class Screen {
int contador_flash;
int tstados_counter; // counts tstates leaved to the next call
int int_counter; // counts the interrupt duration
int pixancho,pixalto; // maximum pixel value for width and height
bool screen_snow; // 0-> no emulate snow; 1-> emulate snow
......
......@@ -52,6 +52,10 @@ void Z80free_INT(Z80FREE *processor,byte value) {
}
void Z80free_INTserved(Z80FREE *processor) {
processor->INT_P=0;
}
int Z80free_step(Z80FREE *processor) {
int retval=0;
......@@ -82,14 +86,15 @@ int Z80free_ustep(Z80FREE *processor) {
return(11); // we use 11 tstates for attending a NMI
}
if (processor->INT_P) {
processor->INT_P=0;
if (processor->IFF1==1) { // allow INTs only in this case
if (processor->HALT) {
processor->HALT=0;
processor->PC++;
}
processor->INT_P=0;
processor->Status=Z80INT;
processor->IFF1=0;
processor->IFF2=0;
Z80free_doPush(processor,processor->PC);
if (processor->IM!=2) { // we will forget IM0 mode for now; maybe in the future...
processor->PC=0x0038;
......
......@@ -135,6 +135,7 @@ void Z80free_reset(Z80FREE *);
int Z80free_step(Z80FREE *);
int Z80free_ustep(Z80FREE *);
void Z80free_INT(Z80FREE *,byte);
void Z80free_INTserved(Z80FREE *processor);
byte Z80free_Rd (word Addr);
void Z80free_Wr (word Addr, byte Value);
......
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