Commit 119a2ce3 authored by Sergio Costas's avatar Sergio Costas

Now the interrupt duration is exactly 32 tstates

parent ba125b85
......@@ -500,6 +500,7 @@ int main(int argc,char *argv[]) {
printf("BPP: %d\n",llscreen->bpp);
debug_var = false;
while(salir) {
do {
......@@ -596,9 +597,8 @@ int main(int argc,char *argv[]) {
microdrive->mdr_paged = 2;
}
if(ordenador->interr==1) {
if(ordenador->interr>=1) {
keyboard->read_keyboard (NULL); // read the physical keyboard
Z80free_INT(&procesador,ordenador->bus_empty());
ordenador->interr=0;
}
}
......
......@@ -91,6 +91,7 @@ Screen::Screen() {
this->init_line *= llscreen->bpp;
this->next_pixel *= llscreen->bpp;
this->jump_pixel *= llscreen->bpp;
this->int_counter = 0;
llscreen->set_paletes(ordenador->bw);
......@@ -210,6 +211,13 @@ void Screen::show_screen (int tstados) {
this->tstados_counter2 += tstados;
this->tstados_counter2 %= 8;
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;
......@@ -328,6 +336,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 = 0;
this->pixel = this->base_pixel+this->init_line;
this->p_translt = this->translate;
......
......@@ -36,6 +36,7 @@ class Screen {
int tstados_counter; // counts tstates leaved to the next call
int tstados_counter2; // counts tstates for empty bus
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
......
......@@ -49,7 +49,10 @@ void Z80free_INT(Z80FREE *processor,byte value) {
processor->INT_P=1;
processor->empty_bus=value;
}
void Z80free_INTserved(Z80FREE *processor) {
processor->INT_P=0;
}
int Z80free_step(Z80FREE *processor) {
......@@ -84,7 +87,6 @@ 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;
......
......@@ -137,6 +137,7 @@ void Z80free_reset(Z80FREE *);
int Z80free_step(Z80FREE *);
int Z80free_ustep(Z80FREE *);
void Z80free_INT(Z80FREE *,byte);
void Z80free_INTserved(Z80FREE *);
byte Z80free_Rd_Internal (Z80FREE *processor,word Addr);
void Z80free_Wr_Internal (Z80FREE *processor,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