1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-11-23 23:32:45 +00:00
Commit Graph

235 Commits

Author SHA1 Message Date
Peter Evans
8ad1311536 Add set_memory function 2018-01-06 21:37:15 -06:00
Peter Evans
d9527db033 Retrieve the 16-bit PC address.
This fixes a bug where we only got an 8-bit address from $FFFC and
ignored the LSB at $FFFD.
2018-01-05 16:15:13 -06:00
Peter Evans
70516a7f91 Add function to return 16-bit value from a segment address 2018-01-05 16:14:51 -06:00
Peter Evans
c6799db689 Separate reset logic from boot function 2018-01-05 16:04:01 -06:00
Peter Evans
af7dae6924 Advance PC by # of bytes consumed 2018-01-05 15:52:20 -06:00
Peter Evans
7ceee608b3 Stop delaying by 2 seconds 2018-01-05 15:52:04 -06:00
Peter Evans
c7aa9e9fc3 Resolver may be NULL; don't call if so
This change also registers a default value for operand (0).
2018-01-05 14:57:38 -06:00
Peter Evans
d5b6205713 Actually execute some opcodes 2018-01-05 14:55:33 -06:00
Peter Evans
fd8f36b34e We need to use the mach cpu 2018-01-05 14:19:13 -06:00
Peter Evans
1de1e7788a Rename status flags to MOS_ 2018-01-05 14:18:39 -06:00
Peter Evans
2da613f7aa Provisional state upon reboot 2018-01-04 20:09:53 -06:00
Peter Evans
3f0a091520 Use const pointers; fix function name typo 2018-01-04 19:59:04 -06:00
Peter Evans
700bc31465 Copy system rom into $C800..$CFFF; document.
Things are getting a little hairy...at least, as to my own
comprehension. Documentation is a must.
2018-01-04 19:53:12 -06:00
Peter Evans
e184304ec5 A little more documentation post-rwops changes 2018-01-04 14:21:05 -06:00
Peter Evans
171ff62551 Change create to use objstore vm_8bit data 2018-01-03 21:50:30 -06:00
Peter Evans
565dd1b34b Make sure the object store got built 2018-01-03 21:50:01 -06:00
Peter Evans
06d37d24d7 Allow us to call objstore_init more than once.
This also separates some code into objstore_ready().
2018-01-03 21:49:26 -06:00
Peter Evans
7182608473 Copy vm_8bit buffer into rom/memory directly 2018-01-03 21:10:46 -06:00
Peter Evans
90d6c637c5 Add function to copy a buffer into a segment 2018-01-03 21:10:25 -06:00
Peter Evans
4d07bd7640 Add objstore code, tests 2018-01-03 20:51:20 -06:00
Peter Evans
b1c2a2109e Just use stdout if we never opened a log file 2018-01-03 20:47:41 -06:00
Peter Evans
484a11e976 Pass in zero for an offset 2018-01-03 15:21:00 -06:00
Peter Evans
fac6b4f574 Initialize system and disk2 rom 2018-01-03 15:20:48 -06:00
Peter Evans
86dad129b6 Let us fread into a segment offset 2018-01-03 15:16:30 -06:00
Peter Evans
e7a404508e Add init functions for disk2, sys rom
Also move the defines for bank offset, rom size, etc. into apple2.mem.h
which makes a little more sense.
2018-01-03 15:07:19 -06:00
Peter Evans
5b2c376abc Prevent writes to the ROM bank 2018-01-03 14:27:55 -06:00
Peter Evans
9a1e51fec3 We need to pass the machine, not memory 2018-01-02 23:49:29 -06:00
Peter Evans
cb9a7d0fce Let the segment vm know about the machine 2018-01-02 21:12:21 -06:00
Peter Evans
ee7b5f66b0 Add support for a map machine pointer
To be sent to the read/write functions that are implemented by said
machine.
2018-01-02 21:11:43 -06:00
Peter Evans
3fe7a4e0bb Use explicit memory size of MOS6502 2018-01-02 20:48:42 -06:00
Peter Evans
73f7d8f63a Actually map memory when we create an apple2 2018-01-02 16:30:21 -06:00
Peter Evans
33c8f0de9d Add memory map functions 2018-01-02 16:26:51 -06:00
Peter Evans
834959c10a Add rom, ram2 bank memory; modify read/write sig
The signature for read/write map functions now accepts a void pointer so
that we can pass in the machine that those functions may need to know
about. This is a bit hairy, but allows us to avoid the need for a
yet-uglier global variable.
2018-01-02 16:24:51 -06:00
Peter Evans
49d475d534 Documentation 2018-01-01 17:41:15 -06:00
Peter Evans
d53b6df7a4 Add documentation; plus set sector/track pos to 0 on eject 2018-01-01 17:26:29 -06:00
Peter Evans
2aeef09f97 Remove unused msb variable 2018-01-01 17:12:41 -06:00
Peter Evans
8f04deb642 Comment out unused cycles variable 2018-01-01 17:12:25 -06:00
Peter Evans
78aab1bd13 Fix potential memory leaks in create() 2018-01-01 17:11:03 -06:00
Peter Evans
a2b4fe1466 Write an fread function for segments; use in apple2.dd 2017-12-31 20:28:11 -06:00
Peter Evans
e14e22a596 Uh, so we forgot to read data into the disk 2017-12-31 15:54:30 -06:00
Peter Evans
f70f21789b Add flash memory, disassemble options 2017-12-31 15:50:59 -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
7e142e2736 Properly handle indirect addresses 2017-12-30 21:48:16 -06:00
Peter Evans
26529f77ab Implement jump table, labels in code 2017-12-29 17:08: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
491b3c0c38 Add scan function for disassembly 2017-12-28 21:47:35 -06:00
Peter Evans
d95572bd4a Move instruction strings to mos6502.dis.c 2017-12-27 21:21:33 -06:00
Peter Evans
32d08fbbc5 Add new file for opcode disassembly 2017-12-27 21:21:11 -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
efb8f04555 Use vm_area for draw_rect.
This simplifies and to some degree normalizes the way we reference areas
in the vm subsystem.
2017-12-27 16:42:30 -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
5407ce2d32 Add documentation for option functions 2017-12-27 14:32:13 -06:00
Peter Evans
76191991c8 Add a lot of missing documentation 2017-12-27 01:14:52 -06:00
Peter Evans
f8ce9ae1d1 Documentation 2017-12-26 17:13:34 -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
253db81460 Comment out unused instruction string table 2017-12-26 16:45:24 -06:00
Peter Evans
81804532df Reorganize log.c 2017-12-26 16:44:28 -06:00
Peter Evans
a86fc8e80e Reorganize 2017-12-26 16:42:04 -06:00
Peter Evans
f5af03786d Reorganize 2017-12-26 16:39:23 -06:00
Peter Evans
f50d599545 Beginnings of lo-res graphics 2017-12-24 15:07:24 -06:00
Peter Evans
7b19279f1d No need for this comment any longer 2017-12-22 20:45:26 -06:00
Peter Evans
4ad690212f Blank out the space we want to render a character 2017-12-22 17:49:36 -06:00
Peter Evans
29652b2368 Implement draw text functionality 2017-12-22 15:48:48 -06:00
Peter Evans
b2c1bd9e6d Hello world, in rendered text; use nearest pixel sampling
The scale change removes some blurriness that we saw when copying pixels
from the bitmap font into the renderer.
2017-12-22 12:56:22 -06:00
Peter Evans
979ca65f43 Add bitmap font to apple2, remove rectangle draw 2017-12-21 23:33:04 -06:00
Peter Evans
adac6346e8 Add color mode, text video modes 2017-12-21 11:52:56 -06:00
Peter Evans
87b67216b0 Default to lo-res mode 2017-12-20 21:54:54 -06:00
Peter Evans
23e113e72a Add video mode switcher to handle logical sizes 2017-12-20 21:52:28 -06:00
Peter Evans
7d62548248 Add the bones of the draw functions and file 2017-12-20 21:33:15 -06:00
Peter Evans
f55b608bee Move screen run logic into apple run_loop and create 2017-12-20 20:45:26 -06:00
Peter Evans
8c23f3fa7e Switch window sizes for 4.375:3 2017-12-20 19:32:54 -06:00
Peter Evans
53db99f4fd Use size options for window 2017-12-20 17:08:19 -06:00
Peter Evans
609e3eea7c Add size option, functions to get width and height 2017-12-20 17:06:03 -06:00
Peter Evans
b1c146c62d Add ability to set logical size of window at any time
We also removed the scale field, as the screen does not expect to manage
its own logical coordinates in SDL.

Additionally, we added an xcoords and ycoords function to the screen
externs so that you don't have to "know" that screen has those as
fields.
2017-12-20 16:44:24 -06:00
Peter Evans
f31fcd9c37 Add support for vm_bitfont 2017-12-19 21:50:50 -06:00
Peter Evans
05a641c8f6 Use SDL's render logical size feature
This allows us to work with the pure x/y coordinate system we set when
creating the vm_screen. SDL will take care of the translation of those
coordinates to whatever the window size is.
2017-12-18 14:32:15 -06:00
Peter Evans
4ef9e50792 Really basic implementation of SDL2.
Plus a crappy rectangle to prove that our vm screen code is working in
principle. (It will be removed shortly.)
2017-12-17 23:31:56 -06:00
Peter Evans
ad37d59b2d Remove references to OpenGL/GLFW/GLEW 2017-12-17 20:20:11 -06:00
Peter Evans
afa07e346f A few comments 2017-12-17 19:22:33 -06:00
Peter Evans
83dcfaf646 Add glew, defines for width/height 2017-12-17 19:09:54 -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
3f3210205f We missed the size multiplier for memset()
In doing so, only a small portion of memory would have reliably been set
to zero; specifically, just the first element!

This change should resolve some intermittent test failures to guarantee
that all memory be zeroed.
2017-12-15 21:22:22 -06:00
Peter Evans
ed1a7b3278 Rename to read/write (without byte) 2017-12-15 21:03:38 -06:00
Peter Evans
b07848dd9d Change name; move 140k, 240k 2017-12-15 21:00:59 -06:00
Peter Evans
06c8d623e7 Move MAX_SECTOR_POS and change shift into a while loop 2017-12-15 16:52:47 -06:00
Peter Evans
079a35507c A number of updates in heavy dev phase
1. Add an insert function (to insert a new disk).
2. Add a new shift function to coordinate sector position updates when
reading or writing.
2017-12-15 16:45:20 -06:00
Peter Evans
256e0cf1d6 Don't write to the log stream if null
This prevents a somewhat vexing crash condition from happening.
2017-12-15 16:28:14 -06:00
Peter Evans
4dffea1dda Make position non-static; add case for NULL data 2017-12-14 23:08:33 -06:00
Peter Evans
f629b350fa We can't have a negative track pos; zero is the lowest 2017-12-14 22:46:50 -06:00
Peter Evans
82d22c8fab Change name of header file in #include 2017-12-14 22:27:45 -06:00
Peter Evans
091939b06b Renaming files 2017-12-14 22:24:30 -06:00
Peter Evans
24e599a8fd Rename to apple2dd; add read/write functions 2017-12-14 22:14:55 -06:00
Peter Evans
0162544fa6 Add initial struct and drive code 2017-12-13 20:30:32 -06:00
Peter Evans
577e92de9e Documentation is good. Write documentation. 2017-12-12 15:10:42 -06:00
Peter Evans
7da3c2ec20 Make use of our read/write mappers 2017-12-12 15:00:47 -06:00
Peter Evans
e019b6daee A warning to the concerned 2017-12-12 14:59:00 -06:00
Peter Evans
7da2f9e791 Add support for setting read/write map functions 2017-12-12 14:58:06 -06:00
Peter Evans
bb92162dba Zero, not NULL.
Not that there's a practical difference, but we should be clear that
we're zeroing out memory because its contents are vm_8bit values, not
pointers.
2017-12-12 14:45:48 -06:00
Peter Evans
da62ac4ca6 Use double-slash comments 2017-12-12 14:35:13 -06:00
Peter Evans
6f4627802f We should also NULL out segment memory.
Er... oops
2017-12-12 14:33:55 -06:00
Peter Evans
06705f21fc Add mallocs for read/write tables, NULL-out code 2017-12-12 14:32:32 -06:00
Peter Evans
daab8a7f58 Add instruction strings (mapped to enum symbols) 2017-12-11 21:03:16 -06:00
Peter Evans
850fdc55b5 Add error codes to segment functions 2017-12-09 15:16:56 -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
3954b1647f Missing status modifications in a number of instructions 2017-12-08 23:26:46 -06:00
Peter Evans
b0aa6d400a We should be pushing and popping status 2017-12-08 23:24:58 -06:00
Peter Evans
0336fe7366 Documentation for files 2017-12-08 22:12:31 -06:00
Peter Evans
50563b44a2 Close any open files we have 2017-12-08 17:09:58 -06:00
Peter Evans
cf62694ef0 Add option parsing code, tests 2017-12-08 17:06:21 -06:00
Peter Evans
8cd9c5ffab Documentation, lacking 2017-12-06 21:25:47 -06:00
Peter Evans
ccd7a3f665 Moar documentation 2017-12-06 18:01:13 -06:00
Peter Evans
fca069d5de Documentation 2017-12-06 17:16:20 -06:00
Peter Evans
12d0e5403a Add documentation for the arith instructions 2017-12-06 17:03:37 -06:00
Peter Evans
d0dad61db8 Better documentation; use a macro to define modes 2017-12-06 16:54:14 -06:00
Peter Evans
102378640a Proper indentation 2017-12-06 16:45:16 -06:00
Peter Evans
ffd2550364 Better documentation; log to stdout 2017-12-06 16:43:30 -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
Peter Evans
50a84b4099 Remove cycles field from mos6502 struct
It was both unused and not necessary, as we can simply compute the
number of cycles in the execute function.
2017-12-05 20:23:17 -06:00
Peter Evans
5ada987c83 Add the execute function for the 6502
This executes a single opcode. Note this also makes a change to the
get_address_resolver function such that accepts an opcode, not the
address mode itself.
2017-12-05 19:01:43 -06:00
Peter Evans
eaaf63a069 Zero out last_addr and cycles
This fixes a super-annoying bug in the unit-test suite where we would
fail randomly because sometimes last_addr would have garbage in it.
2017-12-05 18:41:34 -06:00
Peter Evans
8454d1a6c9 Add instruction handler function, handler table 2017-12-05 18:38:36 -06:00
Peter Evans
54473be302 Add functions for instructions, cycles, and address modes.
This also adds a new table for cycles, and adds unit test functions for
the work as well.
2017-12-04 23:30:18 -06:00
Peter Evans
87de0a877a Add all our tests, plus other fixes 2017-12-03 20:19:17 -06:00
Peter Evans
fe9ce3aca3 Tests for the new mos6502 functions 2017-12-02 13:27:30 -06:00
Peter Evans
3cebed2377 Adding all of the instruction files 2017-12-02 13:05:53 -06:00
Peter Evans
237d5e3cb6 First commit 2017-11-21 23:24:51 -06:00