Commit Graph

46 Commits

Author SHA1 Message Date
transistor
ba298fad64 Minor refactoring 2022-01-08 19:48:04 -08:00
transistor
b8906fdbb1 Minor fixes 2022-01-06 23:40:22 -08:00
transistor
c6eeed03ff Added hackish H/V counter for YM7101 2022-01-02 15:44:41 -08:00
transistor
cdbc93bb8a Minor reorganization 2021-12-31 14:00:55 -08:00
transistor
a67c7bf56e Removed old draw code from YM7101 2021-12-31 11:41:34 -08:00
transistor
ec461a61c0 Added support for window in Genesis 2021-12-31 11:40:13 -08:00
transistor
8c58903f73 Rewrote the Genesis/YM7101 draw loop to work pixel-by-pixel
In order to more accurately emulate the VDP, the main draw loop is
now going through each pixel on the screen and calculates the various
cells that should be displayed, gets the exact pixel data, and then
draws lines them all up in priority-order, and whichever is the first
non-mask pixel colour gets put into the frame buffer.  It's rather
verbose and duplicative, but I'll fix it up now that I have something
working
2021-12-30 22:46:57 -08:00
transistor
aee956f2fa Refactored ym7101 (Genesis VDP) code
The memory handling and DMA transfer code is separate from the
drawing code, but it's still a bit clumsy so I'll probably change
it more eventually
2021-12-30 11:27:50 -08:00
transistor
5d6af61531 Incomplete addition of shadow/highlight mode for Genesis 2021-12-29 10:54:43 -08:00
transistor
bf938855e1 Fixed final major bug with hscroll, where I needed to multiply by 32 instead of 16 2021-12-26 21:29:01 -08:00
transistor
ac9ec8840c Fixed hscroll issue (vscroll and hscroll were backwards) 2021-12-26 19:45:45 -08:00
transistor
10ca0c7995 Added watch command to debugger
It's a bit weirdly implemented because the Addressable trait doesn't
have access to System, so it has to set a flag on the Bus which is
then checked during the step function in System to activate the
breakpoint if a watched memory location was written to
2021-12-26 16:32:15 -08:00
transistor
825331df39 Fixed occasional error with debug, and modified frame swapper 2021-12-23 19:32:15 -08:00
transistor
f08c4fc4a9 Fixed minor bug 2021-12-22 19:27:20 -08:00
transistor
5c415da3c3 Minor fixes 2021-12-21 21:02:55 -08:00
transistor
ed030082cd Finally fixed the animation speed in sonic 2
It turned out to be an issue with the interrupts and when the
vertical interrupt was triggered vs when the vertical blanking
bit was set.  The interrupt code in sonic 2 tries to read the
status bit after the vint occurs, and if the vblank bit is set,
it runs the Vint_Level function, but the hacky code I wrote
turned the vblanking bit on after 14ms and off when it triggered
the vint, instead of turning it on at 15ms, and off at 1.2ms, with
the int occuring at the *start* of the time the blanking bit is
set.  So the code had been waiting for 14ms after the vint until
it actually started processing thing, which didn't complete before
the next vint, so it only ran the main game loop every 33.2ms which
is why doubling the speed of the simulated execution time made it
seem about the right speed
2021-12-20 20:41:25 -08:00
transistor
18e54f4a44 Added line-based hscroll and fixed an hscroll bug
The hscroll table was multiplying by 2 (because scroll a and b values
are next to each other) but it should have multiplied by 4 because
each value is also 2 bytes and the array is of u8.

I added hscroll by-line support by using a different function for the
line scroll vs the cell or whole screen scrolling.  There are still
a bunch of glitches in scroll b's scroll values that I need to fix
2021-12-20 20:11:43 -08:00
transistor
4ca0c9b625 Fixed bug in genesis controllers with incorrect counter
The TH counter in the genesis controller code was increasing each
time the TH bit changed state instead of only in one direction.
Surprisingly it worked before, and fixing it made it not work in
Sonic 2, but after adding the 1.5ms timer to reset the TH counter,
it worked again.  I guess Sonic2 only reads the 3 buttons instead
of all 6.  It should now work with both 3 and 6 button games
2021-12-20 20:08:11 -08:00
transistor
148b4dcf2c Cleaned up warnings 2021-12-13 12:00:24 -08:00
transistor
0247279e4b Refactored signals and added a signal to break at the end of a frame draw 2021-12-08 19:07:27 -08:00
transistor
8db32ab9b3 Modified frame/frameswapper a bit 2021-12-08 13:52:11 -08:00
transistor
6dbae9620d Renamed SharedData to HostData 2021-12-07 14:29:38 -08:00
transistor
9a751e5e90 Sega Genesis coprocessor bus is now working
I've added skeleton devices for the sound chips, and added the bank
register and banked area of ram mapped to the Z80's bus.  Sonic1 will
now run (if the ym2612 device's size is set to 0x1000 instead of 0x04)
2021-12-06 14:51:57 -08:00
transistor
8b8430bf13 Updated readme 2021-12-05 19:41:23 -08:00
transistor
5c7c9d065f Fixed issue with Scroll B offsets 2021-12-05 17:19:27 -08:00
transistor
dd0e84fa51 Improved genesis controllers a bit
Some games still broken, but sonic 2 works now
2021-12-05 15:38:11 -08:00
transistor
a5e4f51469 Fixed horizontal scroll
The mask for the scroll values was 0x3F but it should have been 0x3FF
2021-12-05 14:26:21 -08:00
transistor
fe60d01340 Added vertical and horizontal scrollling, but it's still a bit broken 2021-12-04 21:04:03 -08:00
transistor
73c5b26e86 Modified controller inputs to work like keys 2021-12-04 14:41:27 -08:00
transistor
8ced62cca0 Fixed bug in ym7101 DMA 2021-12-04 13:58:50 -08:00
transistor
1518ffbc60 Refactored ym7101 to store state unpacked
Previously it was storing data in the registers, which was an array
of u8, but now it's storing eg. full addresses for the scroll tables
so that they don't need to be fetched from the register values and
converted every rendering.  I was thinking this would maybe make
DMA debugging easier, in particular.
2021-12-04 13:55:58 -08:00
transistor
b540e53ea1 Fixed issues with Genesis controllers and sprite rendering
The controller th count was starting at 1 instead of 0 which caused
inputs to be read incorrectly, as well as the fact that inputs are
inverted.

The sprite fix now draws them in the right order so that ComradeOj's
sprite test renders correctly, but games still render them broken
because of some other bug yet to be found
2021-12-03 15:32:59 -08:00
transistor
9464e4c75a Renamed joystick to controller in host traits 2021-12-02 15:04:41 -08:00
transistor
0f2f989775 Fixed bug in m68k with Extend flag in shift instructions 2021-12-01 10:45:24 -08:00
transistor
31ff828f15 Added Inspectable trait for getting debug data from peripherals 2021-11-29 11:11:32 -08:00
transistor
cb47d23233 Fixed issue with colour 0 being the mask colour
For systems that legitimately use 0 for black, this causes a
problem, so I instead use 0xFFFFFFFF for the mask colour which
corresponds to transparent white in ARGB format, which minifb
doesn't support anyways
2021-11-23 11:45:44 -08:00
transistor
812f6800a8 Minor fixes 2021-11-18 08:46:41 -08:00
transistor
1d8065026d Minor fixes 2021-11-15 20:51:33 -08:00
transistor
a00d7b2f26 Fixed warnings 2021-11-13 11:39:20 -08:00
transistor
7e999d4c3a Changed the way frontend works and added keyboard support 2021-11-06 21:44:25 -07:00
transistor
a3a11f7459 Fixed some sprites issues 2021-10-31 23:01:56 -07:00
transistor
8fe76334af Added joystick host adapter 2021-10-31 11:00:14 -07:00
transistor
a02d8e5241 Fixed graphics finally for YM7101 scrolls 2021-10-30 16:17:28 -07:00
transistor
250c0e83d2 Minor fixes 2021-10-29 15:05:41 -07:00
transistor
109ae4db55 Added minifb frontend with very WIP genesis peripherals 2021-10-27 21:01:18 -07:00
transistor
c980c2f56d Added WIP 2021-10-25 19:31:28 -07:00