Commit graph

36 commits

Author SHA1 Message Date
Ernest Wong 911ed0cc52 Fix dma update mask logic: 1 !== true
Pass consistent types
2018-02-18 12:14:39 -06:00
Ernest Wong dd7f845e57 Make DMA on_unmask states restorable
Instead of registering an on_unmask listener every time we want a
transfer, and unregistering the listener every time we're done with it,
SB16 now registers a handler during init, and keeps this handler
registered throughout the session. The handler function is moved to SB16's
prototype.

The dma_waiting_transfer flag indicates whether the handler should
actually carry out the transfer.
2017-12-16 22:51:40 -06:00
Ernest Wong 584548de5c Tidy code
- Constant variable names to uppercase.
- Consistent use of spacing and semicolons.
- Avoid recursion.
- Prefer bitwise operators.
- Place operators before line continuation (to disambiguate problems
associated with automatic semicolon insertion).
2017-12-16 22:51:40 -06:00
Ernest Wong edf589cc46 Nuke commented out old dma.js code
This is what version control is for right? Silly me.
2017-12-16 22:51:40 -06:00
Ernest Wong 60ca5c04cd Update DMA registers correctly. Update read_count
Previously, the channel_count and channel_addr registers were
incremented/decremented using read_count. However, read_bytes can be
reassigned (from the original bytes assosiated with channel_count) to
len. When do_write is performed with len less than available data,
read_bytes is reduced to len, but read_count is still referring to the
entire data, making subsequent writes restarting at the initial address.
2017-12-16 22:51:40 -06:00
Ernest Wong cb704b9563 Implement state restoration for sb16 and new dma 2017-12-16 22:51:40 -06:00
Ernest Wong a218381dc7 Implement page high-byte EISA ports/registers (DMA) 2017-12-16 22:51:40 -06:00
Ernest Wong 0c05905ced Fix: dma should read number of bytes, not count 2017-12-16 22:51:40 -06:00
Ernest Wong 9f75c81e00 Wrap DMA channel count after incrementing 2017-12-16 22:51:40 -06:00
Ernest Wong 7581a4af5b DMA auto should wrap around. Use Uint16 counters 2017-12-16 22:51:40 -06:00
Ernest Wong 7733452fa8 Implement DMA autoinit mode 2017-12-16 22:51:40 -06:00
Ernest Wong b868e48283 Transfer dma data in small, timed, chunks (sb16)
This allows double buffering method of audio transfer, as the memory
would get updated progressively.

See http://the.earth.li/~tfm/oldpage/sb_wave.html
2017-12-16 22:51:40 -06:00
Ernest Wong 0a499bd089 Fix: dma singlemask_write check bit 2 not 3 2017-12-16 22:51:40 -06:00
Ernest Wong 6ada19b5b5 Fix: dma channel count, misplaced '+1' 2017-12-16 22:51:40 -06:00
Ernest Wong 2b2a6d6d3d Handle DMA register reads 2017-12-16 22:51:40 -06:00
Ernest Wong 03071edbb7 Fix: bedmas with DMA channel mask and offsets 2017-12-16 22:51:40 -06:00
Ernest Wong 3936d75e3a Handle DMA 16bit channels with 8-bit do_read/write
The addresses and counts are doubled/left-shifted accordingly
2017-12-16 22:51:40 -06:00
Ernest Wong ef02bafa6f Fix: DMA channel selection using first two bits
The bit masks has been corrected from 0x4 to 0x3.
2017-12-16 22:51:40 -06:00
Ernest Wong 6fe4796415 Re-enable dma page and mask io handlers 2017-12-16 22:51:40 -06:00
Ernest Wong 5f077989e2 Handle all eight DMA channels 2017-12-16 22:51:40 -06:00
copy 70ad2f9031 Move memory to cpu 2016-08-02 04:15:24 +02:00
copy 8f3fe17f7b Fix floppy disk writes, fixes #76 2015-11-13 02:01:17 +01:00
copy 9d1dc4de96 Improve speed of state restoring by loading ram directly 2015-09-16 02:03:42 +02:00
copy 7fba276f86 Fix warnings 2015-09-15 21:58:40 +02:00
copy f82373d6b2 Build state of emulator explicitly. Fixes #40 2015-05-18 22:18:59 +02:00
copy 4244e295eb Remove channel objects 2015-05-17 03:06:54 +02:00
copy 27ced06ac9 Some annotations 2015-02-25 18:21:54 +01:00
copy a0da169168 Make _state_skip work by value (instead of key). Fixes certain Closure Compiler builds 2015-01-12 18:05:10 +01:00
copy 5fd2a1bd35 Improved handling of IO port operations 2014-10-21 21:51:42 +02:00
Fabian 9b031d4e40 Initial version of save/restore state feature, #18
Everything that is valid json plus arraybuffers and arraybuffer-views
can be restored automatically (without making changes to other code).
Properties that should not be part of the state buffer needed to be
annotated using a magic `_state_skip` property. Shared arraybuffer views
are broken during restoration and also need to be annotated. Adapters
are not (and should never be) saved.

Current limitations:
- Before restoring, the cpu needs to be initialised with the original
  settings. This is not a hard requirement and can be fixed later.
- Pending asynchronous operations are lost. It's a good idea to pause
  the cpu before saving the state.
2014-09-28 22:10:47 -07:00
copy 2a9759537d Minor cleanups 2014-07-13 00:42:39 +02:00
Fabian 6ce08cfe02 Convert DMA to prototypical definition 2014-04-14 16:41:16 +02:00
copy 3dff735d17 whoops 2013-11-28 22:34:12 +01:00
copy 096001f9c9 Verify buffer read length and offset 2013-11-28 00:59:36 +01:00
copy 8996c72eb2 DMA corrected read count. Fixes #1 2013-11-07 19:38:59 +01:00
copy 8180d49f24 first public release 2013-11-06 01:12:55 +01:00