1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-07-05 01:28:58 +00:00
Commit Graph

507 Commits

Author SHA1 Message Date
Peter Evans
7f6b8d3587 We can no longer assume PC increments during address handling
This change required a number of consequent changes to assumptions we'd
made, and I'm not 100% confident we have things right at this point in
time.
2018-01-09 20:59:14 -06:00
Peter Evans
e3ab043aee We no longer need to pass the opcode here 2018-01-09 20:58:53 -06:00
Peter Evans
80a7671a19 Remove next_byte, read_byte; execute works without an opcode arg
This also adds RTS and RTI as instructions that "would jump".
2018-01-09 20:58:19 -06:00
Peter Evans
a785eb5665 Remove next_byte, read_byte; remove opcode from execute
The execute function should just work from the PC register. It might
seem to be easier to test by passing an arbitrary opcode into the
function, but because so much of the chip's execution is
context-sensitive (that is, it expects PC to be pointing at the opcode,
to have its operand in front of it, etc.), passing an arbitrary opcode
is not really reflective of what needs to be in place for the function
to work correctly.
2018-01-09 20:56:11 -06:00
Peter Evans
04aab568df Oh, little-endian issues; you are my bane 2018-01-09 16:28:14 -06:00
Peter Evans
68b1b79549 Added a "fix" to JSR test.
It's really wrong, because we _should_ be storing PC + 2 in the stack.
And software's definitely gonna bork when we try emulating them, because
they will invariably inspect the stack and assume that's what we have in
there.

But the proper fix is to not actually do next_byte(), and to never
advance PC outside of the execute function. But that's a bigger change
than I want to do at this specific moment.

So, in the meantime, you have me prattling on in a commit message. Lucky
you!
2018-01-09 16:26:21 -06:00
Peter Evans
b492b44e0c We have a raft of changes here...
1. In some cases we corrected little-endian issues.
2. In others, we need to correct expected output to account for PC,
cycles and hex dumps.
2018-01-09 16:24:51 -06:00
Peter Evans
de859bcea8 We were not obeying little-endianness here 2018-01-09 16:24:25 -06:00
Peter Evans
7e51339b88 Account for incremented PC byte in rel tests 2018-01-09 16:06:41 -06:00
Peter Evans
4beff0bff8 Remember that we must obey little-endian order 2018-01-09 16:00:15 -06:00
Peter Evans
42394fee80 Add new peripheral ROMs, plus a stub ROM
...The latter being in the form of the zeropad file, 256 bytes long.
2018-01-09 15:58:29 -06:00
Peter Evans
d7148b88bf Relative address was not being calculated correctly.
The disassembler is using the correct approach, so I adapted it to the
execution code.
2018-01-09 15:57:37 -06:00
Peter Evans
a267065059 Include cycle information 2018-01-09 15:57:20 -06:00
Peter Evans
8201117223 Change init routine to use peripheral function 2018-01-09 15:56:48 -06:00
Peter Evans
0e0244162f Change objstore structure to contain all peripheral ROM 2018-01-09 15:56:21 -06:00
Peter Evans
3c46a41351 Fix little-endian issue with IND output
Also change the ADDR label to emit a hex code, not a decimal code.
2018-01-08 23:36:11 -06:00
Peter Evans
1abf0223c8 The value of PC by that point is correct.
Adding 2 skips us ahead farther than we should be going.
2018-01-08 22:25:37 -06:00
Peter Evans
f7b8740c2e Let the CPU run for longer before it dies 2018-01-08 22:24:30 -06:00
Peter Evans
b21b48cac0 Fix a couple of issues...
1. The execute function should not be incrementing the PC register, as
this happens in other places.
2. The push_ and pop_stack functions were not considering that the data
should be in little-endian order.
2018-01-08 21:22:29 -06:00
Peter Evans
e4049a6a11 Better info on each opcode sequence
Plus fix a display bug that showed the operand in the wrong order.
2018-01-08 21:21:09 -06:00
Peter Evans
7c899122ad We should advance to the next byte in execution 2018-01-08 21:15:56 -06:00
Peter Evans
a8bba409c3 Change 16-bit references to respect little-endianness
As the Apple II (or rather the 6502 chip) is little-endian, meaning the
least significant byte is the first byte you read going forward, rather
than the last byte.
2018-01-08 17:10:26 -06:00
Peter Evans
01174b63dd The data in objstore_data was not in the correct order.
See also the change in tools/store-data; the system rom was first, when
the disk2 rom should have been first.
2018-01-08 16:19:41 -06:00
Peter Evans
3f59db311b Allow us to ignore some docblock errors 2018-01-07 20:08:46 -06:00
Peter Evans
62035d03b8 Remove test (which is now done from vm_area.c) 2018-01-07 20:08:27 -06:00
Peter Evans
b2add9c3de Move vm_area logic into its own file 2018-01-07 20:05:02 -06:00
Peter Evans
143a2b176c Add missing tests and note missing ones 2018-01-07 20:00:28 -06:00
Peter Evans
95e57a8e19 Add get_map_machine function.
Mostly useless except for testing.
2018-01-07 20:00:09 -06:00
Peter Evans
db6dde7757 Note intentionally missing tests 2018-01-07 19:42:03 -06:00
Peter Evans
bc563b8aca Note intentionally missing tests; add test for flag 2018-01-07 19:39:16 -06:00
Peter Evans
087c424d2f Rename test suite 2018-01-07 16:31:00 -06:00
Peter Evans
a3dff9193b Add missing tests 2018-01-07 16:30:52 -06:00
Peter Evans
ba47de0e4b Add objstore_clear(), tests for objstore 2018-01-07 16:30:33 -06:00
Peter Evans
1c36c4ea4d Add missing docblock comments 2018-01-07 16:07:29 -06:00
Peter Evans
c3d35dca72 Move address resolver test 2018-01-07 15:50:06 -06:00
Peter Evans
2c3503e752 Clarify test conditions; allow docblock on line above 2018-01-07 15:48:43 -06:00
Peter Evans
0fa930b548 Fix incorrect test name 2018-01-07 15:48:19 -06:00
Peter Evans
cccf6df354 Move address resolver 2018-01-07 15:47:57 -06:00
Peter Evans
7b2450131e Add tests for would_jump, flash_memory 2018-01-07 15:47:26 -06:00
Peter Evans
366f10efcb Don't count main.c 2018-01-07 15:08:03 -06:00
Peter Evans
55cb80162c Add missing tests 2018-01-07 15:06:07 -06:00
Peter Evans
888eb25797 Refactor a bit for easier testing; add log_stream() 2018-01-07 15:05:20 -06:00
Peter Evans
5da65e0a9e Change apple2dd -> apple2_dd 2018-01-07 14:46:54 -06:00
Peter Evans
d8431828a8 Add missing tests for sys/disk2 rom 2018-01-07 14:46:29 -06:00
Peter Evans
216ad72d4c Add comment for free function (handled in teardown) 2018-01-07 14:45:59 -06:00
Peter Evans
d71a5c83ca Change test suite to expected name 2018-01-07 14:38:51 -06:00
Peter Evans
32f0ba21f4 Add comments for tests that we will not write at this time 2018-01-07 13:46:12 -06:00
Peter Evans
665f7de37c Rename apple2dd_ to apple2_dd_
Except for the struct object (apple2dd).
2018-01-07 13:44:07 -06:00
Peter Evans
419b82faf1 Add missing tests for reset, set_memory
This also consciously ignores tests for free() (handled implicitly in
all teardowns) and run_loop (for which I don't have a good notion to
test right now).
2018-01-07 13:43:09 -06:00
Peter Evans
6011580a99 Add source code inspector 2018-01-06 22:42:45 -06:00