Commit graph

49 commits

Author SHA1 Message Date
Fabian 53098adc5c Delete src/browser/lib.js, move remaining code to lib.js 2022-09-19 22:24:09 +08:00
Fabian e0d4e1808b Move buffer code around 2022-09-19 22:24:09 +08:00
Fabian cdfc8a0f1f Improve hex_dump 2022-08-02 21:40:57 +09:00
Fabian bca3648fd2 Move hex_dump, add NE2K_LOG_PACKETS 2022-08-02 21:40:57 +09:00
Fabian b1fdd5640b Fix random int in workers 2021-01-03 17:22:44 -06:00
Fabian 497f618cab Merge branch 'wasm' into master 2021-01-03 02:07:20 -06:00
Fabian bb529ccfec Add state functions to synchronous buffers 2020-12-31 19:14:31 -06:00
Fabian 392128679b Fix rdrand on Node 2020-12-31 19:14:31 -06:00
Fabian 492601cf01 Dead 2020-12-31 19:14:29 -06:00
Fabian 9efade88ee Fix compilation with latest closure compiler 2020-12-31 19:14:29 -06:00
Fabian 4827732a4c Make closure compiler happy 2020-08-30 19:37:15 -05:00
Fabian 47e91de601 Remove has_rand_int, always require get_rand_int to be available 2020-08-30 19:37:15 -05:00
Fabian 0d70c87796 Implement rdrand on Node (for __x86_rdrand) 2020-08-30 19:37:15 -05:00
Fabian 2233b069b3 Mark Bitmap as constructor 2020-08-30 19:37:15 -05:00
Fabian 58b8c49fb0 Pack memory in state image, reduces memory use during state loading 2020-08-30 19:37:15 -05:00
Fabian e94c30ef6f Don't wrap text in SyncBuffer 2020-08-30 19:37:14 -05:00
Fabian d07cc4f7fa Fix state images 2020-08-30 19:29:53 -05:00
Fabian 05d0079015 Use Proxy over getters for memory views (works in compiled mode) 2020-08-30 19:29:53 -05:00
Ernest Wong 791a041092 Avoid undefined values in pci_space 2020-08-30 19:27:07 -05:00
Ernest Wong b4556b2adb Virtio tidyup
- Use array.includes over .indexOf for existence checking.
- Immediate object returns.
- Correct commenting for non JSDoc comments.
- Improve assert messages for failures.
- Move generic reusable code into lib.js
2020-08-30 19:27:07 -05:00
Fabian ae2407a4dc Minor: Simplify and delete dead code 2020-08-30 19:27:02 -05:00
Fabian 4129335287 Stats printing 2020-08-30 19:27:02 -05:00
Amaan Cheval 8416882c98 Listen to the linter 2020-07-21 20:10:13 -05:00
Amaan Cheval 538a2cb64c Major refactor for coverage logger
- Moved all helper functions to coverage.js
- Refactor individual cov_*[func_id] objects to coverage[func_id].*
- Write coverage data to its own directory (./build/coverage/coverage_data*)
- Enable/disable coverage logging in do_many_cycles to account for exceptions
- Better naming
- Minor stylistic refactoring
2020-07-21 20:10:13 -05:00
Amaan Cheval 96ec4e0457 Add check_env_node to v86util and make it accessible
Since we only want to log coverage data to a file in Node.js, we need to detect
the environment.
2020-07-21 20:10:13 -05:00
Fabian d6f856207c Protect against call from C 2020-07-21 20:10:11 -05:00
copy 289b8038b1 Cleanup 2019-05-18 14:16:37 -05:00
iamahuman 9c3f704d57 Use ES intrinsics for mul / imul, bsr / bsf
For integer multiplication, direct product of two 32-bit integers in
double precision FP arithmetic yields its higher 53 bits which are
sufficient for higher half of the product, while the lower half may be
computed with `Math.imul()`. A polyfill is provided for < IE 10.

For `floor(log2(n))` where `n` is a 32-bit integer, `31 - Math.clz32(n)`
is an accurate substitute for `v86util.int_log2` and preserves
`int_log2(0) = -1` (should it ever occur).
2019-05-18 14:16:16 -05:00
Ernest Wong 0fc48f81d3 Share and reuse download() function 2018-04-08 14:38:24 -07:00
Ernest Wong b22826525b Fix duplicated code after FloatQueue rewrite 2017-12-16 22:51:40 -06:00
Ernest Wong 147cc8bf37 Rewrite FloatQueue to prototypical notation 2017-12-16 22:51:40 -06:00
Ernest Wong c017373c76 Avoid unnecessary copying of buffers. 2017-12-16 22:51:40 -06:00
Ernest Wong 0ec16f5a03 Tidyup: use underscore naming 2017-12-16 22:51:40 -06:00
Ernest Wong d793d2eb51 Simplify FloatQueue.shiftBlock logic 2017-12-16 22:51:40 -06:00
Ernest Wong dfd3202149 Send audio data only through bus
Problem: transferring ownership of the audio Float32Array buffers from
the speaker adapter to sb16 does not appear to work.

Demo: https://jsbin.com/vilafof/edit?html,js,output

This is probably because:

> the returned AudioBuffer is only valid in the scope of the
> onaudioprocess function.
(https://developer.mozilla.org/en-US/docs/Web/API/AudioProcessingEvent)

and probably because transferring ownership will make the buffer
unreadable in the non-worker thread.

Solution: send data through to the speaker adapter directly using the
bus. The sb16.dac_buffers has been modified to allow shifting out a chunk of
consequtive elements more efficiently.
2017-12-16 22:51:40 -06:00
Ernest Wong 3275fcb12d Handle different sb16 dma modes properly 2017-12-16 22:51:40 -06:00
copy 64c3cc84a9 Minor: whitespace 2017-06-07 09:46:50 -05:00
copy d8cb6bf802 Improve code structure
Remove lazy_init
Move things to v86lib
2017-03-17 15:07:38 -05:00
copy f557156256 trailing whitespace 2015-09-12 01:10:38 +02:00
copy 9cd277f552 Clean up 2015-03-06 20:20:37 +01:00
copy 14318beea2 Clean up the buffer abstractions and make them consisten with each other 2015-01-21 04:14:31 +01:00
copy 1664d39fa8 Don't put properties on native objects 2015-01-12 18:50:15 +01:00
copy 2673dd6fbf unused 2015-01-12 18:28:25 +01:00
copy 1032ef3ef2 New publicly usable interface called V86Starter, refactor browser/main.js using it 2015-01-09 04:49:44 +01:00
copy 0863b668b7 Move code to log.js 2015-01-09 00:10:40 +01:00
copy b77c3f5795 exports for closure compiler 2014-12-29 17:44:35 +01:00
copy 42b0b098ca more cleaning up 2014-12-21 21:32:18 +01:00
copy d195406fba add time to log messages 2014-12-21 20:34:22 +01:00
copy 910a80a65a split up code into more files 2014-12-21 20:28:13 +01:00