New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
conditional traps #187
Comments
|
...and mirrors! 😆 |
|
Corrected! |
|
I think the condition should be evaluated at the start of the read/write operation. So in the previous example, in case the address is an hotspot, the condition is true if the starting bank is 1, that is before the bankswitching caused by accessig the hotspot. |
|
But the trap is evaluated afterwards. |
|
Would it be possible to evaluate the condition, then perform the memory access, and then, only if the condition was true, evaluate the trap? I thought it would be preferable in the case of hotspot access, but no big issue if it's not feasible. And, thinking more about it, there are probably situations (when storing values in ram or registers, for example) where it might be preferable to evaluate the condition after the memory access. |
|
Actually I would prefer the trap to stop before instruction execution (like a break). Then you can move one step forward if you want. Not sure if that's feasible. |
|
I scratched my head about interrupting before a trap is hit. The problem is, that a trap can trigger somewhere in the middle of an instruction. And if you want to break there, you have to be able to continue from exactly there too. Unless someone has a better idea, it seems like that would require a major rewrite of the 6502 emulation core.
So a current: would have to be changed into something like: And that for all 240 or so opcodes. |
|
@ale-79 I am currently working on trapifs. This turned out to be quite adventurous. 😄 E.g. I found that two traps with overlapping address ranges eliminate themselves where they overlap. I don't think this is a good idea for trapifs, because usually their conditions will differ. Only in the special case where the conditions are identical, this might make sense and would be consistent with trap (which would be just a special case of trapif with a condition always being Is that what you would expect from trapif? And would you be prepared to test this extensively? |
Yes. I think that it could behave the same as break and breakif.
I sure will, but I also suggest to open a thread on AA in the emulation or 2600 programming forum so that you can get more authoritative opinions and feedback from programmers. |
|
Thanks for the feedback. I have discussed the issue and some technical implications with Stephen today. (BTW: we were also wondering about how to delete the traps) An alternative Idee was to extend |
|
That sounds like a good solution to me. |
|
Is it feasible, when constinuous savestates is enabled with ALT-R, to reserve a slot for a savestate of the situation before executing each instruction, in addition to those saved every frame so that if a break/trap is triggered, you can go back before the memory access occurs? The first rewind would be of 1 instruction, the following ones of 1 frame as per #71. |
|
I am sure that would be way too slow. |
|
To be clear, with |
|
I noticed that. Probably adding brackets around all conditions before the |
|
@ale-79 I have implemented 'trapif' in a new branch called 'trapif_attempt_1'. Please give it a try. Things to look for:
Of course I have made developer tests for everything already, but not that thoroughly. Thanks in advance! |
|
I won't be able to test it until tomorrow as I won't be at home today after lunch. This is the error I get (I figured out how to have "make" print out errors in English, instead of the Italian/English mix I usually get...): |
|
My bad. Fixed (I hope). |
|
Yup, it works now. |
|
@ale-79 Any updates from your test? |
|
Not much to report so far, I need to do more tests. Old traps seem to work like before. I like the new method of displaying address ranges in a single line, it makes the 'listtraps' output more readable. Conditional traps seem to work fine too. 'listtraps', 'deltrap' and 'cleartraps' work as expected. It seems that mirrors work correctly now, (e.g. 'trap 40 7f') There's a bug in the status line: addresses/labels are not shown if they're in cart space (this is also true for breakpoints, not only traps). |
|
Thanks. I have committed trapif (and more) with 3fddc03 to the master now. (the last point is fixed too) |
|
BTW: You can also delete trap(if)s by adding the same one again |
|
I just compiled the master with 3fddc03, but the status line is still missing the address if in cart space. |
|
Sorry, my old fix only worked for user labels, not bare addresses. Please try again. |
|
Works! |
From the stella 5.0 thread on AA:
It could be useful to have conditional trap commands in the debugger, similar to conditional breaks, and using the same functions and pseudo-registers:
For example:
trapreadif _bank==1 BE00 BEFFwould trap any read from addresses $BE00 to $BEFF and mirrors if bank 1 is active
The text was updated successfully, but these errors were encountered: