OXYGENHUB
# bd65c0cc08c7 x16-emulator / src / coverage.h
1.0 KiB · Objective-C · last changed chore(): initial commit 15 days ago source blame history raw
1
// Commander X16 Emulator
2
// Execution coverage: which addresses the CPU fetched an instruction from.
3
4
/*
5
-coverage <file> marks every address the CPU runs an instruction from, keeping
6
the bank for the two banked windows, and writes the marks to <file> when the
7
emulator exits: normally, or on SIGTERM, which is how a test harness stops it.
8
A host tool maps them to source lines through the program's line tables.
9
10
The file is text, one run of consecutive marked addresses a line:
11
12
    x16emu-coverage 1
13
    m 0801-0843          low memory, $0000-$9FFF
14
    r 03:a000-a01f       a RAM bank in the $A000-$BFFF window
15
    k 20:c000-c00a       a ROM or cartridge bank in the $C000-$FFFF window
16
17
An address is marked once however often it runs: one byte of memory per
18
address, and no counting in the CPU loop.
19
*/
20
21
#ifndef COVERAGE_H
22
#define COVERAGE_H
23
24
#include <stdbool.h>
25
#include <stdint.h>
26
27
extern bool coverage_enabled;
28
extern volatile bool coverage_stop;
29
30
bool coverage_init(const char *path);
31
void coverage_mark(uint16_t pc);
32
void coverage_write(void);
33
34
#endif