1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-12-21 23:29:16 +00:00
Commit Graph

257 Commits

Author SHA1 Message Date
Peter Evans
bef19539f6 Implement (most of) text_area test 2018-02-03 22:43:00 -06:00
Peter Evans
c503189b7c Add exception for 40col 2018-02-03 22:02:25 -06:00
Peter Evans
de67d5064b Add test for vm_screen_dirty, exception for prepare 2018-02-03 22:01:27 -06:00
Peter Evans
3329753ef7 Add test for vm_segment_fwrite 2018-02-03 22:00:04 -06:00
Peter Evans
3a1784a5a7 Add image, stream to eject test 2018-02-03 20:50:30 -06:00
Peter Evans
2dd21f1487 Add image type, image segment 2018-02-03 18:10:29 -06:00
Peter Evans
f45a64dfe4 Add missing tests file 2018-02-03 17:43:04 -06:00
Peter Evans
a340c963a0 Add proper test for sector decode 2018-02-02 17:20:17 -06:00
Peter Evans
55c85b0ec6 Encoded code needed to change 2018-02-01 18:41:34 -06:00
Peter Evans
fadf5a9782 Add decode...code 2018-02-01 18:41:01 -06:00
Peter Evans
f4cdff0bfb Add sector encoding test 2018-01-31 16:52:58 -06:00
Peter Evans
b202e70b9b Add test suite for enc.c 2018-01-31 16:03:03 -06:00
Peter Evans
ce405531b8 We switched the logic for C015 2018-01-31 00:20:37 -06:00
Peter Evans
38d80078d9 Remove obsoleted test functions 2018-01-27 00:16:39 -06:00
Peter Evans
dde7312864 No need to deal with carry here 2018-01-27 00:15:06 -06:00
Peter Evans
9bbfb95b02 Carry is no longer factored 2018-01-26 22:04:47 -06:00
Peter Evans
d29dfd442a Account for SLOTCXROM being on by default 2018-01-26 22:03:57 -06:00
Peter Evans
4509f61be6 dd_write no longer accepts the byte it will wryte 2018-01-26 20:00:10 -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
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
ef13fe4ef1 Require STATUS_DEFAULT, stack pointer at ff 2018-01-23 16:07:21 -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
2c319399d2 Change disassembly to add more info 2018-01-19 00:34:57 -06:00
Peter Evans
96b8b77f37 Use apple2.tests.h for setup/teardown 2018-01-17 15:31:12 -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
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
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
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
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
647139924b Small comment 2018-01-12 14:51:00 -06:00
Peter Evans
f69454c965 Some soft switches now require consecutive reads
To allow this to work, we had to allow the CPU struct to record what the
last opcode/operand/address were, although in truth we only needed the
last address.
2018-01-12 14:49:27 -06:00
Peter Evans
7d6886a3a8 Change last_addr field to eff_addr 2018-01-12 13:57:48 -06:00
Peter Evans
1b2e9d952b Add missing test code for the aux bank switch 2018-01-11 22:35:23 -06:00
Peter Evans
c4c0312402 Add missing tests for read/write bank switches 2018-01-11 22:24:19 -06:00
Peter Evans
6d21774e78 Add missing tests 2018-01-11 21:58:17 -06:00
Peter Evans
578e0b291c Allow us to switch main/aux; write bank switch mappers 2018-01-11 19:52:13 -06:00
Peter Evans
9d2f9b6f60 Refactor to remove ram2
Both main and auxiliary memory need to keep an extra 4k of memory that
is bank-switchable, so we have changed to store that memory literally
within the main and aux segments.
2018-01-11 13:19:17 -06:00
Peter Evans
288b4a9e8d The boot procedure no longer defaults bank_switch to 0 2018-01-10 21:50:43 -06:00
Peter Evans
8d9b48912e Add memory injection to 6502; main memory in apple2
Note that memory _is_ now managed in apple2, and _not_ in mos6502.
2018-01-10 21:28:05 -06:00
Peter Evans
3db536a83d Change memory_mode -> bank_switch
This also changes the concept of the field; bank_switch is a collection
of bit flags now.
2018-01-10 19:59:33 -06:00
Peter Evans
fcba14f91b Add set16 function 2018-01-10 16:43:14 -06:00
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
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
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
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
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
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
c3d35dca72 Move address resolver test 2018-01-07 15:50:06 -06:00
Peter Evans
0fa930b548 Fix incorrect test name 2018-01-07 15:48:19 -06:00
Peter Evans
7b2450131e Add tests for would_jump, flash_memory 2018-01-07 15:47:26 -06:00
Peter Evans
55cb80162c Add missing tests 2018-01-07 15:06:07 -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
62af6ef606 Add missing files for tests
They're empty, which is ok for the moment.
2018-01-06 21:35:32 -06:00
Peter Evans
1de1e7788a Rename status flags to MOS_ 2018-01-05 14:18:39 -06:00
Peter Evans
45f5975cdf Add test for write_bank 2018-01-04 19:34:15 -06:00
Peter Evans
d7ea991127 Implement first crack at read_bank test 2018-01-04 15:14:32 -06:00
Peter Evans
171ff62551 Change create to use objstore vm_8bit data 2018-01-03 21:50:30 -06:00
Peter Evans
4d07bd7640 Add objstore code, tests 2018-01-03 20:51:20 -06:00
Peter Evans
14f2dcae1a Set the map machine on setup; revert to NULL on teardown 2018-01-03 15:21:24 -06:00
Peter Evans
194ec07b1f Add skeletons for read/write_bank tests 2018-01-03 01:01:53 -06:00
Peter Evans
80c7f38368 Add test suite for apple2.mem.c 2018-01-03 01:00:51 -06:00
Peter Evans
425ca1b1e1 Include the mach argument 2018-01-02 23:52:40 -06:00
Peter Evans
ead5f28e79 Refactor to use cpu, not literal segments 2017-12-30 23:02:30 -06:00
Peter Evans
b42d5370aa Small bug in the jump label code for IND
This also required a rethink on some core functions which now needed to
know about the memory segment; and further changes in the unit-testing
code on the disassembly suite was also necessary.
2017-12-30 22:50:23 -06:00
Peter Evans
b7211f43c2 Testing relative label assignments 2017-12-29 17:14:20 -06:00
Peter Evans
26529f77ab Implement jump table, labels in code 2017-12-29 17:08:25 -06:00
Peter Evans
9000245002 Much documentation; use BUFSIZ for buf length 2017-12-29 15:55:25 -06:00
Peter Evans
927d03ebbe Add scan function (rename original scan -> opcode); test 2017-12-29 15:31:05 -06:00
Peter Evans
f98e2f65ee Add disassembly scan function, tests 2017-12-28 23:47:36 -06:00
Peter Evans
6a230341e1 Make vm_area_set be an inline function.
Gets most of the benefits of being a macro, but also gains type safety
(which macros do not have).
2017-12-27 17:10:51 -06:00
Peter Evans
30223e0bca Remove screen area field; document area fields 2017-12-27 16:59:56 -06:00
Peter Evans
27f91ec00f Use vm_area with bitfont_offset
This should further standardize on vm_area.
2017-12-27 16:47:26 -06:00
Peter Evans
c7b830bb4a Switch references from SDL_Rect to vm_area
We still use SDL_Rect internally, but we want to abstract the use of it
in our API. The only thing the rest of the app should care about is the
vm_area struct.
2017-12-27 16:31:02 -06:00
Peter Evans
bcf354989d Tests for bitfont and screen 2017-12-27 01:02:56 -06:00
Peter Evans
eeecaf4bdc Add tests for get_width and get_height 2017-12-26 22:35:50 -06:00
Peter Evans
04d40a44f9 Reorganize tests 2017-12-26 17:20:06 -06:00
Peter Evans
8146687110 Don't create a window when testing
We do this by creating the notion of a "headless" mode, and skip window
creation in SDL.
2017-12-26 17:06:08 -06:00
Peter Evans
5b35e2294e Add tests for new functions in apple2 2017-12-26 17:03:32 -06:00
Peter Evans
f50d599545 Beginnings of lo-res graphics 2017-12-24 15:07:24 -06:00
Peter Evans
f31fcd9c37 Add support for vm_bitfont 2017-12-19 21:50:50 -06:00
Peter Evans
28cd93d5e9 Do static analysis if env variable is set 2017-12-19 01:02:48 -06:00
Peter Evans
c84f194c8b Get our test suite working with SDL
Had to remove a couple of screen tests for now; it needs a big re-think
now that we're using SDL. Namely, how do we test SDL?
2017-12-18 14:46:40 -06:00
Peter Evans
f3966dc010 Enable static analysis through clang
If you want to, just uncomment the line that adds the --analyze flag to
CMAKE_C_FLAGS.
2017-12-18 14:26:53 -06:00
Peter Evans
ad37d59b2d Remove references to OpenGL/GLFW/GLEW 2017-12-17 20:20:11 -06:00
Peter Evans
a73c15c37c Rename vm_screen_context to vm_screen 2017-12-17 16:42:05 -06:00
Peter Evans
8beb761535 Actually show a window.
This is also the beginning outline of how we want to abstract graphics
away in erc.
2017-12-16 23:38:59 -06:00
Peter Evans
b646bfc511 First stab at adding graphics.
This involves using glfw. This first commit creates a window but doesn't
do anything with it; it also just hangs until you can escape out
somehow.
2017-12-16 22:45:39 -06:00
Peter Evans
294fab76aa Add boot function; modify main to use apple2 boot 2017-12-15 22:22:40 -06:00
Peter Evans
ed1a7b3278 Rename to read/write (without byte) 2017-12-15 21:03:38 -06:00
Peter Evans
047d9eabd0 Add tests for read/write 2017-12-15 21:01:49 -06:00
Peter Evans
9c646435c5 Add bad image file for testing 2017-12-15 16:53:22 -06:00
Peter Evans
223edd14fe Add shift test 2017-12-15 16:53:12 -06:00
Peter Evans
eae302e686 Add eject, insert tests 2017-12-15 16:46:40 -06:00
Peter Evans
7811f4da44 No, use actual zero bytes
Forgot the ol' backslash in the script I wrote to make this file
2017-12-15 14:39:57 -06:00
Peter Evans
9689d984bc Add data directory, image file with all zeroes 2017-12-14 23:22:10 -06:00
Peter Evans
a48bc05bd0 Further testing 2017-12-14 23:09:32 -06:00
Peter Evans
cebdedeff0 Add initial test suite for apple2dd 2017-12-14 22:47:11 -06:00
Peter Evans
060b7000de Add tests to prove read/write mappers are used 2017-12-12 15:07:26 -06:00
Peter Evans
7da2f9e791 Add support for setting read/write map functions 2017-12-12 14:58:06 -06:00
Peter Evans
ca7e576266 Use a setup and teardown function 2017-12-12 14:53:45 -06:00
Peter Evans
0bcf9e006d Explicit test that memory (plus others) are zeroed 2017-12-12 14:45:06 -06:00
Peter Evans
850fdc55b5 Add error codes to segment functions 2017-12-09 15:16:56 -06:00
Peter Evans
c4a6f77bcd We should be using the rts handler function
Oops!
2017-12-09 14:53:18 -06:00
Peter Evans
a720246e26 We need to account for the P register on the stack 2017-12-09 14:52:55 -06:00
Peter Evans
f44b029083 We need to check P's value as well
This test broke once we began to (properly) push P onto the stack.
However, I'm not _clear_ on whether we should push P before or after we
set the INTERRUPT bit... We'll go with things as-is for now.
2017-12-09 14:50:33 -06:00
Peter Evans
96b2542ea6 CARRY should be set if oper > 0
This error became apparent once we added the missing modify_status
function to some instructions.
2017-12-09 14:47:49 -06:00
Peter Evans
8a261f6600 We need to include the max disk slot
Tiny comparison logic error. :grimace:
2017-12-08 17:10:13 -06:00
Peter Evans
cf62694ef0 Add option parsing code, tests 2017-12-08 17:06:21 -06:00
Peter Evans
eb865243bb We have to pass NULL into log_open now 2017-12-06 16:53:15 -06:00
Peter Evans
18dca43e61 It's erc, not emp 2017-12-06 16:07:36 -06:00
Peter Evans
00ff9f069d Vastly simplify unit tests for mos6502
Criterion's init and fini config options allow us to register setup and
teardown functions. We now use this to register the common cpu variable
for the mos6502 tests, albeit through the use of a global variable.

Doing so necessitated that each of the different test files have their
own suites, due to some implementation details in Criterion, but this is
No Big Deal.
2017-12-06 15:57:15 -06:00
Peter Evans
98f70e0a9a Add functions for pressing/releasing keys 2017-12-06 15:21:39 -06:00
Peter Evans
0e02fb8a1a Add struct, initial create function for apple2 2017-12-06 14:36:14 -06:00
Peter Evans
89ddd20658 Add read_byte function to return the next byte in memory 2017-12-05 20:40:35 -06:00