From 1a74eec1d5f41a5fcc89f6fec0f5c93ef7e3eb68 Mon Sep 17 00:00:00 2001 From: "fabio.olimpieri" Date: Wed, 2 Jan 2013 07:11:31 +0000 Subject: [PATCH] Fixed contention in normal mode emulation --- src/computer.c | 15 ++++++++++----- src/computer.h | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/computer.c b/src/computer.c index e1ad96b..25aa36d 100644 --- a/src/computer.c +++ b/src/computer.c @@ -1510,7 +1510,7 @@ void ResetComputer () { ordenador.lower_border_line = 64 + 192; ordenador.cpufreq = 3500000; ordenador.tstatodos_frame= 69888; - //ordenador.start_contention = 14335; + ordenador.start_contention = 14335; //ordenador.end_contention = 14335+224*192; ordenador.first_line = 40; ordenador.last_line = 280; @@ -1522,7 +1522,7 @@ void ResetComputer () { ordenador.lower_border_line = 40 + 192; ordenador.cpufreq = 3527500; ordenador.tstatodos_frame= 59136; - //ordenador.start_contention = 8959; + ordenador.start_contention = 8959; //ordenador.end_contention = 8959+224*192; ordenador.first_line = 16; ordenador.last_line = 256; @@ -1546,7 +1546,7 @@ void ResetComputer () { ordenador.lower_border_line = 63 + 192; ordenador.cpufreq = 3546900; ordenador.tstatodos_frame= 70908; - //ordenador.start_contention = 14361; + ordenador.start_contention = 14361; //ordenador.end_contention = 14361+228*192; ordenador.first_line = 40; ordenador.last_line = 280; @@ -1570,16 +1570,21 @@ void do_contention() { if ((ordenador.currline < ordenador.upper_border_line ) || (ordenador.currline >= ordenador.lower_border_line) || (ordenador.currpix < 40) || (ordenador.currpix > 295)) return; + if (ordenador.mode128k==3) //+3 { - ccicles=((ordenador.currpix-28)/2)%8; //44-16 + if (ordenador.precision) ccicles=((ordenador.currpix-28)/2)%8; //44-16 + else ccicles=(ordenador.cicles_counter-ordenador.start_contention)%8; + if (ccicles>6) return; ordenador.contention+=7-ccicles; emulate_screen(7-ccicles); } else //64k/128k/+2 { - ccicles=((ordenador.currpix-40)/2)%8; + if (ordenador.precision) ccicles=((ordenador.currpix-40)/2)%8; + else ccicles=(ordenador.cicles_counter-ordenador.start_contention)%8; + if (ccicles>5) return; ordenador.contention+=6-ccicles; emulate_screen(6-ccicles); diff --git a/src/computer.h b/src/computer.h index 5c408b4..62f01e3 100644 --- a/src/computer.h +++ b/src/computer.h @@ -78,7 +78,7 @@ struct computer { int tstatodos_frame; //number of tstados per frame int pixels_octect; //2 bits in the octect int pixels_word; //2 bits in the word - //int start_contention; //start tstados for contention + int start_contention; //start tstados for contention //int end_contention; //end tstados for contention unsigned char screen_snow; // 0-> no emulate snow; 1-> emulate snow