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
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
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
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
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
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
9564f86a57
Remove flash_memory function
2018-01-11 21:57:52 -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
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
04854d903c
Add aux memory field
2018-01-10 20:36:44 -06:00
Peter Evans
8898c3e59d
Use macros to define segment read/write map functions
2018-01-10 20:12:48 -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
538b5ddaa0
Add address for reset vector, applesoft, powerup
2018-01-10 16:47:45 -06:00
Peter Evans
fcba14f91b
Add set16 function
2018-01-10 16:43:14 -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
0e0244162f
Change objstore structure to contain all peripheral ROM
2018-01-09 15:56:21 -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
b2add9c3de
Move vm_area logic into its own file
2018-01-07 20:05:02 -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
ba47de0e4b
Add objstore_clear(), tests for objstore
2018-01-07 16:30:33 -06:00
Peter Evans
888eb25797
Refactor a bit for easier testing; add log_stream()
2018-01-07 15:05:20 -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
8ad1311536
Add set_memory function
2018-01-06 21:37:15 -06:00
Peter Evans
610068cb8b
Add missing decl for apple2_reset()
2018-01-05 16:20: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
1de1e7788a
Rename status flags to MOS_
2018-01-05 14:18:39 -06:00
Peter Evans
171ff62551
Change create to use objstore vm_8bit data
2018-01-03 21:50:30 -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
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
fd4b135d5a
Add compiled object store data
2018-01-03 20:49:52 -06:00
Peter Evans
6963883a60
Define the size of the bitmap font for apple2
2018-01-03 20:48:16 -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
09bb474008
Missing param for mach on read/write_bank
2018-01-03 01:00:31 -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
73f7d8f63a
Actually map memory when we create an apple2
2018-01-02 16:30:21 -06:00
Peter Evans
e967e9a5c7
Add the aforementioned read/write sig changes
...
oops
2018-01-02 16:26:11 -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
a2b4fe1466
Write an fread function for segments; use in apple2.dd
2017-12-31 20:28:11 -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
1942a75d9e
More documentation; remove DEFWIDTH/DEFHEIGHT
2017-12-27 17:14:54 -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
89a6161272
Reorganize header files
2017-12-26 16:47:34 -06:00
Peter Evans
81804532df
Reorganize log.c
2017-12-26 16:44:28 -06:00
Peter Evans
68084cc0c3
Add apple2 header file
2017-12-26 16:43:08 -06:00
Peter Evans
a86fc8e80e
Reorganize
2017-12-26 16:42:04 -06:00
Peter Evans
5fbd921d83
Reorganize
2017-12-26 16:39:32 -06:00
Peter Evans
f50d599545
Beginnings of lo-res graphics
2017-12-24 15:07:24 -06:00
Peter Evans
29652b2368
Implement draw text functionality
2017-12-22 15:48:48 -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
23e113e72a
Add video mode switcher to handle logical sizes
2017-12-20 21:52:28 -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
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
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
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
ed1a7b3278
Rename to read/write (without byte)
2017-12-15 21:03:38 -06:00
Peter Evans
4cc79b1ba8
Add 140k, 240k, decls for read/write
2017-12-15 21:01:15 -06:00
Peter Evans
c5c010699c
Move MAX_SECTOR_POS into header file
2017-12-15 16:52:35 -06:00
Peter Evans
0c82a58f79
Add ERR_BADFILE
2017-12-15 16:52:26 -06:00
Peter Evans
a034408f03
Add headers for insert, shift
2017-12-15 16:46:22 -06:00
Peter Evans
e84b79819b
Allow position function to be globally visible
2017-12-14 23:08:50 -06:00
Peter Evans
a82348ff9a
Missing header files, esp. stdbool
2017-12-14 22:30:09 -06:00
Peter Evans
091939b06b
Renaming files
2017-12-14 22:24:30 -06:00
Peter Evans
58137cb2a0
Remove io_byte field; rename to apple2dd
2017-12-14 22:13:39 -06:00
Peter Evans
0162544fa6
Add initial struct and drive code
2017-12-13 20:30:32 -06:00
Peter Evans
7da2f9e791
Add support for setting read/write map functions
2017-12-12 14:58:06 -06:00
Peter Evans
b36bb78a12
Add read/write map functions to vm_segment
2017-12-12 14:31:44 -06:00
Peter Evans
850fdc55b5
Add error codes to segment functions
2017-12-09 15:16:56 -06:00
Peter Evans
cf62694ef0
Add option parsing code, tests
2017-12-08 17:06:21 -06:00
Peter Evans
dccf80be5d
More documentation
2017-12-06 21:37:14 -06:00
Peter Evans
ea2b68dc8c
Documentation, and reorganizing macro definitions
2017-12-06 21:29:03 -06:00
Peter Evans
4af7e4444c
This macro was no longer needed
2017-12-06 21:26:09 -06:00
Peter Evans
8cd9c5ffab
Documentation, lacking
2017-12-06 21:25:47 -06:00
Peter Evans
079cd9f096
We need to know what a FILE is
2017-12-06 16:52:33 -06:00
Peter Evans
ffd2550364
Better documentation; log to stdout
2017-12-06 16:43:30 -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
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
eaa6c85fe4
Add the type for the execute function
2017-12-05 19:03:40 -06:00
Peter Evans
4e6073cf2e
Add function decl for the execute func
2017-12-05 19:03:02 -06:00
Peter Evans
631451afe5
Use C-style to denote documentation
2017-12-05 18:40:40 -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