1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-11-30 08:51:53 +00:00
Commit Graph

369 Commits

Author SHA1 Message Date
Peter Evans
882cf2c166 Comment out cycles 2018-01-23 21:41:43 -06:00
Peter Evans
9f518d5141 We should not resolv the address a second time 2018-01-23 21:41:30 -06:00
Peter Evans
47630fdc88 pha/php only push one byte onto the stack 2018-01-23 21:37:36 -06:00
Peter Evans
c946eb3f69 Fix incorrect stack info
(The previous behavior of RTS/JSR was not right.)
2018-01-23 21:35:59 -06:00
Peter Evans
2e334e2ee1 Update tests with correct expected text from disassembler 2018-01-23 21:19:26 -06:00
Peter Evans
1751a7af1f Don't try to call resolv() if resolv is NULL 2018-01-23 21:18:42 -06:00
Peter Evans
80136e9360 Most status flags are now set when the CPU is created 2018-01-23 20:41:48 -06:00
Peter Evans
0b03fd24f5 Carry must also be factored in 2018-01-23 20:26:01 -06:00
Peter Evans
5656b271ee Account for carry being set by default 2018-01-23 16:30:52 -06:00
Peter Evans
746e2246b3 Set negative and unset zero since the operand >= A 2018-01-23 16:29:53 -06:00
Peter Evans
3c7002c6c7 Carry is only unset if the operand >= A 2018-01-23 16:29:08 -06:00
Peter Evans
dc97a6996e Account for carry being set by default 2018-01-23 16:28:39 -06:00
Peter Evans
b02679f6a0 Carry must be unset 2018-01-23 16:26:05 -06:00
Peter Evans
522905b39c Carry must be unset in this test 2018-01-23 16:24:46 -06:00
Peter Evans
60ff0e5781 Carry is set by default now 2018-01-23 16:24:16 -06:00
Peter Evans
a3598ecd16 The stack pushes from the end of the page now 2018-01-23 16:21:43 -06:00
Peter Evans
8edf83f7ad Carry is set only if the result is > 0xFF 2018-01-23 16:20:33 -06:00
Peter Evans
8133781fd3 Use the address mode enum itself 2018-01-23 16:18:22 -06:00
Peter Evans
7a0ea50aa3 The stack now only works with 8bit values; disable carry 2018-01-23 16:16:59 -06:00
Peter Evans
9215600148 Don't attempt to render a glyph if render is NULL 2018-01-23 16:09:27 -06:00
Peter Evans
ef13fe4ef1 Require STATUS_DEFAULT, stack pointer at ff 2018-01-23 16:07:21 -06:00
Peter Evans
766aea9c96 Change dbuf switches to work off correct addresses 2018-01-23 15:51:06 -06:00
Peter Evans
8f516db42b Remove arbitrary counter and allow escape to exit 2018-01-23 15:04:11 -06:00
Peter Evans
775a145480 Rework screen display logic for more efficiency 2018-01-23 14:52:16 -06:00
Peter Evans
b5e1e09a35 Bump up counter by a ton 2018-01-22 21:43:18 -06:00
Peter Evans
b97af6cb16 Disable active refresh 2018-01-22 21:43:01 -06:00
Peter Evans
47d7483297 Disable usleep delay for now 2018-01-22 21:42:42 -06:00
Peter Evans
e0b4fd27e8 Better logging 2018-01-22 21:42:30 -06:00
Peter Evans
56433e2ebe Show nothing if no value is associated with an instruction 2018-01-22 12:31:19 -06:00
Peter Evans
945bf23f22 Use correct default status and memory mode 2018-01-21 21:33:12 -06:00
Peter Evans
c2debec4d3 Make output more compact 2018-01-21 21:32:43 -06:00
Peter Evans
ef7977c18b Only set or unset DHIRES if IOUDIS is on 2018-01-21 21:32:22 -06:00
Peter Evans
d119854631 Carry is set by left- or right-most bits
Don't rely on modify_status() to get it right.
2018-01-21 16:21:15 -06:00
Peter Evans
3206332a7d Set carry if the right-most bit is 1
Don't consider the left-most bit
2018-01-21 16:17:31 -06:00
Peter Evans
5d8403aaa7 Only set negative if operand has it set
That is, don't consider A & operand for negative.
2018-01-21 16:12:03 -06:00
Peter Evans
ecd8a7974a Add "BAD" instruction to crash when we hit an invalid opcode 2018-01-21 12:48:34 -06:00
Peter Evans
1334e34e76 Use A & oper here 2018-01-21 12:47:58 -06:00
Peter Evans
f9a95827f5 Change carry flag strategy according to docs 2018-01-21 12:47:36 -06:00
Peter Evans
5f93bdae25 Try to match technical behavior described for JSR/RTS 2018-01-21 01:17:04 -06:00
Peter Evans
0581ed6b44 Fix stack in several ways
1. The stack should descend, not ascend;
2. The stack should be pushed byte for byte; meaning, when pushing P or
A, those should consume one byte, not two;
3. The MSB should be pushed first when doing JSR and BRK, which makes
some sense if you were reading the stack from $0100 - $01FF.
2018-01-21 01:09:42 -06:00
Peter Evans
42c7fcbb47 XOR the orig and result bit 7 for overflow
We should have done this all along. We hadn't accounted for if orig >=
0x80 and result < 0x80, but at that point, it's kind of silly to have a
long complicated condition that we can satisfy simply with an XOR.
(Which is what the machine would do anyway.)
2018-01-21 00:05:49 -06:00
Peter Evans
809e6ca7c6 Overflow should simply be bit 6's value 2018-01-20 23:47:02 -06:00
Peter Evans
fcd25f6385 Use set16 to push items to the stack.
The previous method was not incorrect, but set16 already handles the
little-endian logic for us, and there's no need to do something bespoke
here that we then need to test for separately.
2018-01-20 23:43:58 -06:00
Peter Evans
2f777ce881 Several core changes to status, soft switches
Regarding soft switches, we had several we should have been listening
for on both reads and writes, but were only doing so on writes; this is
now fixed.

Regarding statuses, we were incorrectly calculating both carry and
overflow. This should now be fixed, although some quick examinations of
disassembly output suggest there is something else amiss. Debugging will
continue shortly.
2018-01-20 21:01:26 -06:00
Peter Evans
103a188faf Add an extra line break
Mostly for vim to make it easier to skip over blocks with '}'.
2018-01-19 19:14:59 -06:00
Peter Evans
a9cf25853d Show the individual flags of the P register 2018-01-19 13:14:02 -06:00
Peter Evans
6b160c6ca2 Show the dereferenced value for a given address 2018-01-19 12:18:24 -06:00
Peter Evans
2c319399d2 Change disassembly to add more info 2018-01-19 00:34:57 -06:00
Peter Evans
e286ba34f5 Greatly increase counter 2018-01-18 22:19:31 -06:00
Peter Evans
8d9a990997 Remove addresses that aren't handled in dbuf 2018-01-18 22:19:15 -06:00