Skip to content

Commit

Permalink
* support for tracking multiple t-state counters by writing the count…
Browse files Browse the repository at this point in the history
…er number to 0x86 (#44)
  • Loading branch information
zoul0813 authored Oct 15, 2024
1 parent af837a3 commit 4232227
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions hardemu/screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,7 @@ function VideoChip(Zeal, PIO, scale) {
/**
* @brief Video configuration sees a write, address is relative to this space
*/
var previous_tstate = 0;
var previous_tstate = {};
function vConfigWrite(address, value) {
switch (address) {
case 0x0:
Expand All @@ -1091,11 +1091,16 @@ function VideoChip(Zeal, PIO, scale) {
case 0x6:
/* Benchmark! */
const current_states = zealcom.getTstates();
const diff = current_states - previous_tstate;
const micros = diff/10
const millis = micros/1000;
console.log("Elapsed T-states: " + diff + " (" + millis + " ms)");
previous_tstate = current_states;
const tracked = previous_tstate[value];
if(tracked != undefined) {
delete previous_tstate[value];
const diff = current_states - tracked;
const micros = diff/10
const millis = micros/1000;
console.log(`Elapsed T-states (${value}): ${diff} (${millis}ms)`);
} else {
previous_tstate[value] = current_states;
}
case 0xe: mapping.io_bank = value & 0x3f;
break;
case 0xf: mapping.mem_start = (value & 0x1f) >> (22 - 5);
Expand Down

0 comments on commit 4232227

Please sign in to comment.