OXYGENHUB
◆ main enhanced-x16-emulator / src / testbench.h
2.1 KiB · Objective-C · last changed chore(): initial commit 25 days ago source blame history raw
9120e874 Andy McCall 1
// Commander X16 Emulator
2
// Copyright (c) 2019 Michael Steil
3
// All rights reserved. License: 2-clause BSD
4
5
/*
6
TESTBENCH
7
---------
8
9
1. General
10
11
The testbench option is intended to be used for unit testing where the test runner is
12
made in a high level language. The test runner starts the emulator with the
13
-testbench option. During the test, the test runner communicates with the emulator
14
over stdin/stdout.
15
16
17
2. Messages from the emulator to the test runner (stdout)
18
19
RDY                 Sent when the emulator is ready to receive commands from the test runner
20
<hex value>         Emulator response to get requests
21
ERR <message>       Invalid arguments
22
STP                 Sent when STP instruction is executed
23
24
25
3. Messages from the test runner to the emulator (stdin)
26
27
RAM                 Set RAM bank
28
ROM                 Set ROM bank
29
STM nnnn nn         Set value of memory address nnnn to nn
30
FLM nnnn nnnn nn    Fill memory address range nnnn to nnnn with value nn
31
STA nn              Set accumulator value to nn
32
STX nn              Set X register value to nn
33
STY nn              Set Y register value to nn
34
SST nn              Set status register value to nn
35
SSP nn              Set stack pointer value to nn
36
RUN nnnn            Execute code at address nnnn, when done emulator respond with RDY
37
RQM nnnn            Request value of memory address nnnn
38
RQA                 Request value of accumulator
39
RQX                 Request value of X register
40
RQY                 Request value of Y register
41
RST                 Request value of status register
42
RSP                 Request value of stack pointer
43
44
45
4. Message formatting
46
47
Commands sent to the emulator must be formatted precisely as follows:
48
49
- One command per line written to stdin
50
- The first three characters is the command in upper case
51
- 16 bit values must be written with exactly four digits in hex format
52
- 8 bit values must be written with exactly two digits in hex format
53
- There is exactly one character separating the command field and each value field; it doesn't matter what character is used as separator
54
55
*/
56
57
58
#ifndef TEST_H
59
#define TEST_H
60
61
void testbench_init();
62
63
#endif