1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-11-18 22:06:01 +00:00
Commit Graph

435 Commits

Author SHA1 Message Date
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
Peter Evans
0ae4f041e5 Increase counter amount 2018-01-18 16:21:56 -06:00
Peter Evans
d4bf5da480 Draw text in 40 column mode 2018-01-18 16:21:25 -06:00
Peter Evans
a55fd2f71f Remove log message 2018-01-18 16:20:53 -06:00
Peter Evans
e77837ceed Reformat; add a bit more info on running 2018-01-17 16:07:42 -06:00
Peter Evans
818adb4f72 Add some updates! 2018-01-17 16:00:28 -06:00
Peter Evans
96b8b77f37 Use apple2.tests.h for setup/teardown 2018-01-17 15:31:12 -06:00
Peter Evans
37df8db225 Initiate last_key and key_pressed with default values 2018-01-17 15:28:23 -06:00
Peter Evans
c0ce4ec2f1 Set strobe to false by default
Otherwise we could get garbage values, and that was flagging some tests
as failed at random times
2018-01-17 15:16:25 -06:00
Peter Evans
c8dbf1c84c Add missing tests for new vm_screen functions 2018-01-17 15:16:12 -06:00
Peter Evans
53f40ff960 Add tests for apple2.kb.c 2018-01-17 14:58:42 -06:00
Peter Evans
6670df930b Remove unnecessary functions and tests 2018-01-17 14:02:37 -06:00
Peter Evans
bf529d6c9b Finish map, mapper handling for keyboard events
We still need to revise the test code we currently have for handling
keyboard functions; I imagine some code will need to be removed.
2018-01-17 01:07:31 -06:00
Peter Evans
8d4283b1dc Add first work on keyboard support
Mainly the switch_read function, which had necessitated some work done
in the vm_screen area
2018-01-16 23:50:02 -06:00
Peter Evans
2b688c7815 Add last key, strobe fields 2018-01-16 23:49:34 -06:00
Peter Evans
9d6869bfc4 Add missing decls for switch read/write 2018-01-16 23:49:14 -06:00
Peter Evans
9811bbe450 Add switch read/write for display buffer switches 2018-01-16 23:48:49 -06:00
Peter Evans
b1177784a0 Allow access to the last key pressed and key_pressed status 2018-01-16 23:42:10 -06:00
Peter Evans
05e95d7798 Use bitwise OR, not AND, to add flags.
This was a copy-n-paste oops. I swear I know how bitwise AND and OR
works. Pinky swear!
2018-01-16 20:51:14 -06:00
Peter Evans
603ad7a036 Begin adding support for memory soft switches 2018-01-16 16:34:38 -06:00
Peter Evans
2c39120098 Rename video_mode -> display_mode
This also changes the _kind_ of field from an incrementally enumerated
one to a collection of bit flags.
2018-01-16 16:13:50 -06:00
Peter Evans
bcf6b213a6 Account for changes to rom segment structure 2018-01-16 15:46:35 -06:00
Peter Evans
caea83f9c6 Add missing unit tests for pc mapper functions 2018-01-16 14:22:08 -06:00
Peter Evans
a0a5132099 Add pc file for peripheral card ROM 2018-01-15 23:50:33 -06:00
Peter Evans
2db5c791ba Remove peripheral rom init 2018-01-15 17:42:27 -06:00
Peter Evans
ac39349344 Reorganize ROM storage 2018-01-15 17:10:27 -06:00
Peter Evans
6cbcf0f9ab Increase the counter to see more ops running 2018-01-14 22:31:10 -06:00
Peter Evans
be23bb7166 Remove unneeded test stub 2018-01-13 15:57:02 -06:00
Peter Evans
cadc19b3e5 Add display buffer read/write mappers 2018-01-13 15:40:40 -06:00
Peter Evans
45eb7b5e58 Add zero page memory mapper functions
This also adds tests for those functions. We have, furthermore, removed
some redundant (and non-externed!) functions from apple2.mem.c which was
the old bank switching code that got moved to apple2.bank.c.
2018-01-13 00:38:29 -06:00
Peter Evans
3738d70a43 Switch bank code into its own file 2018-01-12 22:06:49 -06:00
Peter Evans
208c909fc2 Memory is determined solely by BANK_ALTZP.
Previously, we just used whatever the segment was that got passed in.
But aside from switching the stack and zero page, ALTZP also changes
where bank-switchable memory is read from and written to; it's either
always aux memory (ALTZP is on) or always main memory (ALTZP is off).
2018-01-12 21:21:08 -06:00
Peter Evans
c953616a71 Finish refactor to separate bank_switch and memory_mode
There is one failing test, which I expect to fail at this point; that's
because we need to write a read/write map function for the stack and
zero page so that they use aux memory when BANK_ALTZP is on, and main
memory when not.
2018-01-12 21:04:21 -06:00
Peter Evans
ceccacfbc8 Rework bank switch and memory mode into their own fields.
This is to better define and respect the various modes that you can have
in Apple II memory access. This is a work in progress at the moment.
2018-01-12 16:21:49 -06:00
Peter Evans
647139924b Small comment 2018-01-12 14:51:00 -06:00