Skip to content

Commit

Permalink
Merge pull request #56 from suzukiplan/1.9.3
Browse files Browse the repository at this point in the history
Add compile flags for performance
  • Loading branch information
suzukiplan authored Jul 12, 2023
2 parents 32dc731 + 58b5145 commit f789c41
Show file tree
Hide file tree
Showing 6 changed files with 911 additions and 197 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Change log

## Version 1.9.3 (Jul 10, 2023 JST)

- Add compile flags for performance:
- `-DZ80_DISABLE_DEBUG` ... disable `setDebugMessage` method
- `-DZ80_DISABLE_BREAKPOINT` ... disable `addBreakPoint` and `addBreakOperand` methods
- `-DZ80_DISABLE_NESTCHECK` ... disable `addCallHandler` and `addReturnHandler` methods
- The return value of `consumeClock` was returning the number of clocks consumed, but this was changed to `void` because it was redundant.
- Add the constructor without arguments.
- Add an execute method without expected clocks
- optimize acqauire register-pointer and register procedure
- optimize bit calculation
- optimize checkConditionFlags

## Version 1.9.2 (Jan 20, 2023 JST)

- The value of the upper 8 bits of the port number of the immediate I/O operands (`IN A, (n)` and `OUT (n), A`) when executed in 16-bit port mode has been changed from register B to A.
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,14 @@ ReturnHandler will be called back immediately **before** a branch by a RET instr
- call `addReturnHandlerFP` if you want to use the function pointer.
- In the case of a condition-specified branch instruction, only the case where the branch is executed is callbacked.

## Advanced Compile Flags

There is a compile flag that disables certain features in order to adapt to environments with poor performance environments, i.e: Arduino or ESP32:

- `-DZ80_DISABLE_DEBUG` ... disable `setDebugMessage` method
- `-DZ80_DISABLE_BREAKPOINT` ... disable `addBreakPoint` and `addBreakOperand` methods
- `-DZ80_DISABLE_NESTCHECK` ... disable `addCallHandler` and `addReturnHandler` methods

## License

[MIT](LICENSE.txt)
3 changes: 2 additions & 1 deletion test-ex/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ COMMON_FLAGS=-I../ \
-Wunused-variable \
-Wsign-conversion \
-Wtype-limits \
-Werror
-Werror \
-DZ80_DISABLE_DEBUG

all: cpm zexdoc zexall

Expand Down
6 changes: 6 additions & 0 deletions test-ex/cpm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,17 +90,21 @@ int main(int argc, char* argv[])
{
char* cimPath = NULL;
bool checkError = false;
#ifndef Z80_DISABLE_DEBUG
bool verboseMode = false;
#endif
bool noAnimation = false;
for (int i = 1; i < argc; i++) {
if ('-' == argv[i][0]) {
switch (argv[i][1]) {
case 'e':
checkError = true;
break;
#ifndef Z80_DISABLE_DEBUG
case 'v':
verboseMode = true;
break;
#endif
case 'n':
noAnimation = true;
break;
Expand Down Expand Up @@ -131,11 +135,13 @@ int main(int argc, char* argv[])
z80.addBreakPointFP(0xFF04, [](void* arg) {
((CPM*)arg)->halted = true;
});
#ifndef Z80_DISABLE_DEBUG
if (verboseMode) {
z80.setDebugMessageFP([](void* arg, const char* msg) {
puts(msg);
});
}
#endif
cpm.lineCallback = [](CPM* cpmPtr, char* line) {
if (cpmPtr->checkError && strstr(line, "ERROR")) {
cpmPtr->halted = true;
Expand Down
2 changes: 1 addition & 1 deletion test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test-unknown:
cat test-unknown.txt

test-clock:
clang $(CFLAGS) test-clock.cpp -lstdc++
clang $(CFLAGS) -DZ80_DISABLE_BREAKPOINT -DZ80_DISABLE_NESTCHECK test-clock.cpp -lstdc++
./a.out

test-status:
Expand Down
Loading

0 comments on commit f789c41

Please sign in to comment.