You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-11Lines changed: 13 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,18 +26,18 @@ For the Z80:
26
26
27
27
For the Homemade CPU:
28
28
29
-
-A branch delay slot executes the instruction already in the pipeline if a jump occurs. The emulator may not produce the correct results if the instruction in the delay slot is another jump (but this will probably be disallowed either by the hardware or the assembler anyway).
30
-
- A store-to-memory delay slot is probably also needed, but is not implemented (`STOR (mm)` and `PUSH` instructions). This may be better described as a delayed fetch, because the fetch that would occur during the execution phase of a store-to-memory instruction would need to be delayed until the existing write to memory has completed.
29
+
-The emulator always executes the instruction after a jump instruction (a branch delay slot), since that instruction is already in the pipeline in the actual CPU hardware. The emulator may not produce the correct results if the instruction in the delay slot is another jump (but this will probably be disallowed either by the hardware or the assembler anyway).
30
+
- A store-to-memory (`STOR (mm)` and `PUSH` instructions) delay slot is probably also needed, but is not implemented. This may be better described as a delayed fetch, because the fetch that would occur during the execution phase of a store-to-memory instruction would need to be delayed until the existing write to memory has completed.
31
31
32
32
The [Future Functionality](#future-functionality) items listed below may be included in later releases.
33
33
34
34
## Usage
35
35
36
-
```shell
36
+
```text
37
37
emulator [-az | -ah] [-h] [input-file]
38
38
```
39
39
40
-
Optional parameters `-az` or `ah` specify the architecture to emulate: `-az` for Z80, `-ah` for the Homemade CPU. If no architecture parameter is specified, then Z80 is emulated.
40
+
Optional parameters `-az` or `-ah` specify the architecture to emulate: `-az` for Z80, `-ah` for the Homemade CPU. If no architecture parameter is specified, then Z80 is emulated.
41
41
42
42
`-h` displays a brief help summary, then exits the program.
43
43
@@ -61,15 +61,17 @@ make verbose # Adds --verbose to the compiler and linker options
61
61
make clean # Removes the executable, object, and linker files
62
62
```
63
63
64
-
## Implementation Details
64
+
## Supported OSes
65
65
66
-
The emulator was developed using Ubuntu 20.04 with gcc version 9.4.0 (by way of [WSL 2][26]) and MacOS Ventura with clang version 12.0.0.
66
+
The emulator should compile and run on any modern unix or Linux OS.
67
67
68
-
It is compatible with MacOS Sequoia and clang version 17.0. It should also work with other versions of MacOS and clang, but has not been tested.
68
+
It was originally developed and tested using Ubuntu 20.04 with gcc version 9.4.0 (by way of [WSL 2][26]) and MacOS Ventura with clang version 12.0.0.
69
69
70
-
It is compatible with Ubuntu 22.04/gcc 11.3 and Ubuntu 24.04/gcc 13.2 within the GitHub Actions environment.
70
+
Further development and testing was done with MacOS Sequoia and clang version 17.0.
71
71
72
-
I have not tried it on other platforms, but there is no machine dependent code. It should work as-is (or with minimal changes) on other unix-like platforms and compiler versions.
72
+
Within the GitHub Actions environment, it has been tested with Ubuntu 22.04/gcc 11.3 and Ubuntu 24.04/gcc 13.2.
73
+
74
+
## Implementation Details
73
75
74
76
### General Program Flow
75
77
@@ -99,7 +101,7 @@ I have not tried it on other platforms, but there is no machine dependent code.
99
101
100
102
The CPU-specific code is encapsulated in classes named `Z80` and `HomemadeCPU` which inherit from the abstract base class `abstract_CPU`. Additional CPUs can be emulated by creating classes specific to those CPUs.
101
103
102
-
The CPU opcodes are defined in several tables implemented with arrays of structs for the main and extended opcodes (`Z80_opcodes.h`, `HomemadeCPU_opcodes.h`). Each array entry contains the size of the instruction, the opcode/data layout, and the instruction mnemonic. The opcode value is represented by the array index.
104
+
The CPU opcodes are defined in several tables implemented with arrays of structs for the main and extended opcodes (`Z80_opcodes.h`, `HomemadeCPU_opcodes.h`). Each array entry contains the opcode/data layout, the instruction mnemonic, and, if necessary, the length of the instruction. The opcode value is represented by the array index.
103
105
104
106
The `Z80` class contains:
105
107
@@ -124,7 +126,7 @@ The `Z80` class contains:
124
126
- Generate a string containing the disassembled instruction and data
125
127
- Execute the actual instruction (load, store, jump, etc.)
126
128
127
-
The `HomemadeCPU` class structure is similar to the `Z80` class, but simplified in many areas due to the RISC vs. CISC differences in the processor architectures. One notable difference is that the Homemade CPU has fixed-length 2-byte instructions.
129
+
The `HomemadeCPU` class structure is similar to the `Z80` class, but simplified in many areas due to the RISC vs. CISC differences in the processor architectures. One notable difference is that the Homemade CPU has fixed-length 2-byte instructions, and therefore does not need to specify the instruction length in the opcodes array.
0 commit comments