mirror of
https://github.com/exoticorn/microw8.git
synced 2026-01-20 11:16:42 +01:00
Compare commits
6 Commits
348def0b2a
...
v0.4.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 195376cd28 | |||
| bf14d4bd3f | |||
| 0c68328700 | |||
| fb3fd5e8bb | |||
| b85f96b0bb | |||
| b69055b58d |
1151
Cargo.lock
generated
1151
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "uw8"
|
||||
version = "0.3.0"
|
||||
version = "0.4.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
@@ -11,7 +11,7 @@ native = ["wasmtime", "uw8-window", "cpal", "rubato" ]
|
||||
browser = ["warp", "tokio", "tokio-stream", "webbrowser"]
|
||||
|
||||
[dependencies]
|
||||
wasmtime = { version = "19.0.1", optional = true }
|
||||
wasmtime = { git = "https://github.com/bytecodealliance/wasmtime.git", rev = "0f48f939b9870036562ca02ff21253547a9f1a5c", optional = true }
|
||||
anyhow = "1"
|
||||
env_logger = "0.11.3"
|
||||
log = "0.4"
|
||||
|
||||
@@ -15,9 +15,9 @@ See [here](https://exoticorn.github.io/microw8/) for more information and docs.
|
||||
|
||||
## Downloads
|
||||
|
||||
* [Linux](https://github.com/exoticorn/microw8/releases/download/v0.3.0/microw8-0.3.0-linux.tgz)
|
||||
* [MacOS](https://github.com/exoticorn/microw8/releases/download/v0.3.0/microw8-0.3.0-macos.tgz)
|
||||
* [Windows](https://github.com/exoticorn/microw8/releases/download/v0.3.0/microw8-0.3.0-windows.zip)
|
||||
* [Linux](https://github.com/exoticorn/microw8/releases/download/v0.3.0/microw8-0.4.0-linux.tgz)
|
||||
* [MacOS](https://github.com/exoticorn/microw8/releases/download/v0.3.0/microw8-0.4.0-macos.tgz)
|
||||
* [Windows](https://github.com/exoticorn/microw8/releases/download/v0.3.0/microw8-0.4.0-windows.zip)
|
||||
|
||||
The download includes
|
||||
|
||||
|
||||
@@ -3,12 +3,14 @@ include "../include/microw8-api.cwa"
|
||||
export fn upd() {
|
||||
let i: i32;
|
||||
loop pixels {
|
||||
let inline t = time() * 63 as f32;
|
||||
let lazy x = (i % 320 - 160) as f32;
|
||||
let lazy y = (i / 320 - 120) as f32;
|
||||
let inline d = 40000 as f32 / sqrt(x * x + y * y);
|
||||
let inline u = atan2(x, y) * (512.0 / 3.141);
|
||||
let inline c = ((i32.trunc_sat_f32_s(d + t * 2 as f32) ^ i32.trunc_sat_f32_s(u + t)) & 255) >> 4;
|
||||
let inline t = 16!56;
|
||||
let inline x = (i % 320 - 160) as f32;
|
||||
let inline y = (i #/ 320 - 120) as f32;
|
||||
let inline d = 0xa000 as f32 / sqrt(x * x + y * y);
|
||||
let inline a = atan2(x, y) * 163_f; // (512 / pi)
|
||||
let inline u = i32.trunc_sat_f32_s(a) + t;
|
||||
let inline v = i32.trunc_sat_f32_s(d) + t * 2;
|
||||
let inline c = ((v ^ u) #/ 16) % 16;
|
||||
i?FRAMEBUFFER = c;
|
||||
|
||||
branch_if (i := i + 1) < 320*240: pixels;
|
||||
|
||||
Binary file not shown.
@@ -31,19 +31,19 @@ Examplers for older versions:
|
||||
|
||||
## Versions
|
||||
|
||||
### v0.3.0
|
||||
### v0.4.0
|
||||
|
||||
* [Web runtime](v0.3.0)
|
||||
* [Linux](https://github.com/exoticorn/microw8/releases/download/v0.3.0/microw8-0.3.0-linux.tgz)
|
||||
* [MacOS](https://github.com/exoticorn/microw8/releases/download/v0.3.0/microw8-0.3.0-macos.tgz)
|
||||
* [Windows](https://github.com/exoticorn/microw8/releases/download/v0.3.0/microw8-0.3.0-windows.zip)
|
||||
* [Web runtime](../v0.4.0)
|
||||
* [Linux](https://github.com/exoticorn/microw8/releases/download/v0.4.0/microw8-0.4.0-linux.tgz)
|
||||
* [MacOS](https://github.com/exoticorn/microw8/releases/download/v0.4.0/microw8-0.4.0-macos.tgz)
|
||||
* [Windows](https://github.com/exoticorn/microw8/releases/download/v0.4.0/microw8-0.4.0-windows.zip)
|
||||
|
||||
Changes:
|
||||
|
||||
* add blitSprite and grabSprite API calls
|
||||
* add support for integer scaling up to 16x for printing text
|
||||
* fix incompatibility with sound devices only offering 16bit audio formats
|
||||
* add support for br_table instruction in packed carts
|
||||
* add support for sound on mono- and surround-only devices
|
||||
* update wasmtime dependency to fix performance regression in 0.3.0
|
||||
* add frame counter since module start at location 72
|
||||
* add 6 and 7 parameter function types to base module
|
||||
|
||||
### Older versions
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ loaded.
|
||||
00000-00040: user memory
|
||||
00040-00044: time since module start in ms
|
||||
00044-0004c: gamepad state
|
||||
0004c-00050: reserved
|
||||
0004c-00050: number of frames since module start
|
||||
00050-00070: sound data (synced to sound thread)
|
||||
00070-00078: reserved
|
||||
00078-12c78: frame buffer
|
||||
@@ -594,7 +594,7 @@ a base module provided by MicroW8.
|
||||
|
||||
You can generate this base module yourself using
|
||||
`uw8-tool`. As a quick summary, it provides all function
|
||||
types with up to 5 parameters (i32 or f32) where the
|
||||
types with up to 7 parameters (i32 or f32) where the
|
||||
`f32` parameters always preceed the `i32` parameters.
|
||||
Then it includes all imports that MicroW8 provides,
|
||||
a function section with a single function of type
|
||||
|
||||
@@ -2,6 +2,20 @@
|
||||
description = "Versions"
|
||||
+++
|
||||
|
||||
### v0.4.0
|
||||
|
||||
* [Web runtime](../v0.4.0)
|
||||
* [Linux](https://github.com/exoticorn/microw8/releases/download/v0.4.0/microw8-0.4.0-linux.tgz)
|
||||
* [MacOS](https://github.com/exoticorn/microw8/releases/download/v0.4.0/microw8-0.4.0-macos.tgz)
|
||||
* [Windows](https://github.com/exoticorn/microw8/releases/download/v0.4.0/microw8-0.4.0-windows.zip)
|
||||
|
||||
Changes:
|
||||
|
||||
* add support for sound on mono- and surround-only devices
|
||||
* update wasmtime dependency to fix performance regression in 0.3.0
|
||||
* add frame counter since module start at location 72
|
||||
* add 6 and 7 parameter function types to base module
|
||||
|
||||
### v0.3.0
|
||||
|
||||
* [Web runtime](../v0.3.0)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<section>
|
||||
<h1 class="text-center heading-text">A WebAssembly based fantasy console</h1>
|
||||
</section>
|
||||
<a href="v0.3.0">
|
||||
<a href="v0.4.0">
|
||||
<img class="demonstration-gif" style="width:640px;height:480px;image-rendering:pixelated" src="img/technotunnel.png"></img>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -27,6 +27,7 @@ struct UW8Instance {
|
||||
end_frame: TypedFunc<(), ()>,
|
||||
update: Option<TypedFunc<(), ()>>,
|
||||
start_time: Instant,
|
||||
frame_counter: u32,
|
||||
watchdog: Arc<Mutex<UW8WatchDog>>,
|
||||
sound_tx: Option<mpsc::SyncSender<RegisterUpdate>>,
|
||||
}
|
||||
@@ -159,6 +160,7 @@ impl super::Runtime for MicroW8 {
|
||||
end_frame,
|
||||
update,
|
||||
start_time: Instant::now(),
|
||||
frame_counter: 0,
|
||||
watchdog,
|
||||
sound_tx,
|
||||
});
|
||||
@@ -191,8 +193,11 @@ impl super::Runtime for MicroW8 {
|
||||
let mem = instance.memory.data_mut(&mut instance.store);
|
||||
mem[64..68].copy_from_slice(&time.to_le_bytes());
|
||||
mem[68..72].copy_from_slice(&input.gamepads);
|
||||
mem[72..76].copy_from_slice(&instance.frame_counter.to_le_bytes());
|
||||
}
|
||||
|
||||
instance.frame_counter = instance.frame_counter.wrapping_add(1);
|
||||
|
||||
instance.store.set_epoch_deadline(self.timeout as u64);
|
||||
if let Some(ref update) = instance.update {
|
||||
if let Err(err) = update.call(&mut instance.store, ()) {
|
||||
@@ -328,9 +333,8 @@ fn init_sound(
|
||||
let mut configs: Vec<_> = device
|
||||
.supported_output_configs()?
|
||||
.filter(|config| {
|
||||
config.channels() <= 2
|
||||
&& (config.sample_format() == cpal::SampleFormat::F32
|
||||
|| config.sample_format() == cpal::SampleFormat::I16)
|
||||
config.sample_format() == cpal::SampleFormat::F32
|
||||
|| config.sample_format() == cpal::SampleFormat::I16
|
||||
})
|
||||
.collect();
|
||||
|
||||
@@ -532,6 +536,25 @@ fn init_sound(
|
||||
}
|
||||
}
|
||||
|
||||
fn stereo_to_surround<F>(mut buffer: &mut [f32], num_channels: usize, callback: &mut F)
|
||||
where
|
||||
F: FnMut(&mut [f32]),
|
||||
{
|
||||
let mut in_buffer = [0f32; 256];
|
||||
buffer.fill(0.);
|
||||
|
||||
while !buffer.is_empty() {
|
||||
let step_size = (buffer.len() / num_channels).min(in_buffer.len() / 2);
|
||||
let step_buffer = &mut in_buffer[..step_size * 2];
|
||||
callback(step_buffer);
|
||||
for index in 0..step_size {
|
||||
buffer[index * num_channels + 0] = step_buffer[index * 2 + 0];
|
||||
buffer[index * num_channels + 1] = step_buffer[index * 2 + 1];
|
||||
}
|
||||
buffer = &mut buffer[step_size * num_channels..];
|
||||
}
|
||||
}
|
||||
|
||||
let stream = if sample_format == cpal::SampleFormat::F32 {
|
||||
if num_channels == 2 {
|
||||
device.build_output_stream(
|
||||
@@ -542,7 +565,7 @@ fn init_sound(
|
||||
},
|
||||
None,
|
||||
)?
|
||||
} else {
|
||||
} else if num_channels == 1 {
|
||||
device.build_output_stream(
|
||||
&config,
|
||||
move |buffer: &mut [f32], _| stereo_to_mono(buffer, &mut callback),
|
||||
@@ -551,6 +574,17 @@ fn init_sound(
|
||||
},
|
||||
None,
|
||||
)?
|
||||
} else {
|
||||
device.build_output_stream(
|
||||
&config,
|
||||
move |buffer: &mut [f32], _| {
|
||||
stereo_to_surround(buffer, num_channels as usize, &mut callback)
|
||||
},
|
||||
move |err| {
|
||||
dbg!(err);
|
||||
},
|
||||
None,
|
||||
)?
|
||||
}
|
||||
} else {
|
||||
if num_channels == 2 {
|
||||
@@ -562,7 +596,7 @@ fn init_sound(
|
||||
},
|
||||
None,
|
||||
)?
|
||||
} else {
|
||||
} else if num_channels == 1 {
|
||||
device.build_output_stream(
|
||||
&config,
|
||||
move |buffer: &mut [i16], _| {
|
||||
@@ -573,6 +607,19 @@ fn init_sound(
|
||||
},
|
||||
None,
|
||||
)?
|
||||
} else {
|
||||
device.build_output_stream(
|
||||
&config,
|
||||
move |buffer: &mut [i16], _| {
|
||||
f32_to_i16(buffer, &mut |b| {
|
||||
stereo_to_surround(b, num_channels as usize, &mut callback)
|
||||
})
|
||||
},
|
||||
move |err| {
|
||||
dbg!(err);
|
||||
},
|
||||
None,
|
||||
)?
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ impl BaseModule {
|
||||
|
||||
let mut types = vec![];
|
||||
let mut type_map = HashMap::new();
|
||||
for num_params in 0..6 {
|
||||
for num_params in 0..8 {
|
||||
for num_f32 in 0..=num_params {
|
||||
for &result in &[None, Some(ValType::I32), Some(ValType::F32)] {
|
||||
let mut params = vec![];
|
||||
|
||||
@@ -143,7 +143,6 @@ fn to_val_type(type_: &wasmparser::ValType) -> Result<ValType> {
|
||||
I64 => ValType::I64,
|
||||
F32 => ValType::F32,
|
||||
F64 => ValType::F64,
|
||||
V128 => ValType::V128,
|
||||
_ => bail!("Type {:?} isn't a value type", type_),
|
||||
})
|
||||
}
|
||||
@@ -973,244 +972,6 @@ fn remap_function(
|
||||
De::I64TruncSatF64U => En::I64TruncSatF64U,
|
||||
De::MemoryCopy { src_mem, dst_mem } => En::MemoryCopy { src_mem, dst_mem },
|
||||
De::MemoryFill { mem } => En::MemoryFill(mem),
|
||||
|
||||
De::V128Const { value } => En::V128Const(value.i128()),
|
||||
De::V128Load { memarg } => En::V128Load(mem(memarg)),
|
||||
De::V128Store { memarg } => En::V128Store(mem(memarg)),
|
||||
De::V128Load8x8S { memarg } => En::V128Load8x8S(mem(memarg)),
|
||||
De::V128Load8x8U { memarg } => En::V128Load8x8U(mem(memarg)),
|
||||
De::V128Load16x4S { memarg } => En::V128Load16x4S(mem(memarg)),
|
||||
De::V128Load16x4U { memarg } => En::V128Load16x4U(mem(memarg)),
|
||||
De::V128Load32x2S { memarg } => En::V128Load32x2S(mem(memarg)),
|
||||
De::V128Load32x2U { memarg } => En::V128Load32x2U(mem(memarg)),
|
||||
De::V128Load8Splat { memarg } => En::V128Load8Splat(mem(memarg)),
|
||||
De::V128Load16Splat { memarg } => En::V128Load16Splat(mem(memarg)),
|
||||
De::V128Load32Splat { memarg } => En::V128Load32Splat(mem(memarg)),
|
||||
De::V128Load64Splat { memarg } => En::V128Load64Splat(mem(memarg)),
|
||||
De::V128Load32Zero { memarg } => En::V128Load32Zero(mem(memarg)),
|
||||
De::V128Load64Zero { memarg } => En::V128Load64Zero(mem(memarg)),
|
||||
|
||||
De::V128Load8Lane { memarg, lane } => En::V128Load8Lane { memarg: mem(memarg), lane },
|
||||
De::V128Load16Lane { memarg, lane } => En::V128Load16Lane { memarg: mem(memarg), lane },
|
||||
De::V128Load32Lane { memarg, lane } => En::V128Load32Lane { memarg: mem(memarg), lane },
|
||||
De::V128Load64Lane { memarg, lane } => En::V128Load64Lane { memarg: mem(memarg), lane },
|
||||
De::V128Store8Lane { memarg, lane } => En::V128Store8Lane { memarg: mem(memarg), lane },
|
||||
De::V128Store16Lane { memarg, lane } => En::V128Store16Lane { memarg: mem(memarg), lane },
|
||||
De::V128Store32Lane { memarg, lane } => En::V128Store32Lane { memarg: mem(memarg), lane },
|
||||
De::V128Store64Lane { memarg, lane } => En::V128Store64Lane { memarg: mem(memarg), lane },
|
||||
|
||||
De::I8x16ExtractLaneS { lane } => En::I8x16ExtractLaneS(lane),
|
||||
De::I8x16ExtractLaneU { lane } => En::I8x16ExtractLaneU(lane),
|
||||
De::I8x16ReplaceLane { lane } => En::I8x16ReplaceLane(lane),
|
||||
De::I16x8ExtractLaneS { lane } => En::I16x8ExtractLaneS(lane),
|
||||
De::I16x8ExtractLaneU { lane } => En::I16x8ExtractLaneU(lane),
|
||||
De::I16x8ReplaceLane { lane } => En::I16x8ReplaceLane(lane),
|
||||
De::I32x4ExtractLane { lane } => En::I32x4ExtractLane(lane),
|
||||
De::I32x4ReplaceLane { lane } => En::I32x4ReplaceLane(lane),
|
||||
De::I64x2ExtractLane { lane } => En::I64x2ExtractLane(lane),
|
||||
De::I64x2ReplaceLane { lane } => En::I64x2ReplaceLane(lane),
|
||||
De::F32x4ExtractLane { lane } => En::F32x4ExtractLane(lane),
|
||||
De::F32x4ReplaceLane { lane } => En::F32x4ReplaceLane(lane),
|
||||
De::F64x2ExtractLane { lane } => En::F64x2ExtractLane(lane),
|
||||
De::F64x2ReplaceLane { lane } => En::F64x2ReplaceLane(lane),
|
||||
|
||||
De::I8x16Splat => En::I8x16Splat,
|
||||
De::I16x8Splat => En::I16x8Splat,
|
||||
De::I32x4Splat => En::I32x4Splat,
|
||||
De::I64x2Splat => En::I64x2Splat,
|
||||
De::F32x4Splat => En::F32x4Splat,
|
||||
De::F64x2Splat => En::F64x2Splat,
|
||||
De::I8x16Swizzle => En::I8x16Swizzle,
|
||||
De::I8x16Add => En::I8x16Add,
|
||||
De::I16x8Add => En::I16x8Add,
|
||||
De::I32x4Add => En::I32x4Add,
|
||||
De::I64x2Add => En::I64x2Add,
|
||||
De::F32x4Add => En::F32x4Add,
|
||||
De::F64x2Add => En::F64x2Add,
|
||||
De::I8x16Sub => En::I8x16Sub,
|
||||
De::I16x8Sub => En::I16x8Sub,
|
||||
De::I32x4Sub => En::I32x4Sub,
|
||||
De::I64x2Sub => En::I64x2Sub,
|
||||
De::F32x4Sub => En::F32x4Sub,
|
||||
De::F64x2Sub => En::F64x2Sub,
|
||||
De::I16x8Mul => En::I16x8Mul,
|
||||
De::I32x4Mul => En::I32x4Mul,
|
||||
De::I64x2Mul => En::I64x2Mul,
|
||||
De::F32x4Mul => En::F32x4Mul,
|
||||
De::F64x2Mul => En::F64x2Mul,
|
||||
De::I32x4DotI16x8S => En::I32x4DotI16x8S,
|
||||
De::I8x16Neg => En::I8x16Neg,
|
||||
De::I16x8Neg => En::I16x8Neg,
|
||||
De::I32x4Neg => En::I32x4Neg,
|
||||
De::I64x2Neg => En::I64x2Neg,
|
||||
De::F32x4Neg => En::F32x4Neg,
|
||||
De::F64x2Neg => En::F64x2Neg,
|
||||
De::I16x8ExtMulLowI8x16S => En::I16x8ExtMulLowI8x16S,
|
||||
De::I16x8ExtMulHighI8x16S => En::I16x8ExtMulHighI8x16S,
|
||||
De::I16x8ExtMulLowI8x16U => En::I16x8ExtMulLowI8x16U,
|
||||
De::I16x8ExtMulHighI8x16U => En::I16x8ExtMulHighI8x16U,
|
||||
De::I32x4ExtMulLowI16x8S => En::I32x4ExtMulLowI16x8S,
|
||||
De::I32x4ExtMulHighI16x8S => En::I32x4ExtMulHighI16x8S,
|
||||
De::I32x4ExtMulLowI16x8U => En::I32x4ExtMulLowI16x8U,
|
||||
De::I32x4ExtMulHighI16x8U => En::I32x4ExtMulHighI16x8U,
|
||||
De::I64x2ExtMulLowI32x4S => En::I64x2ExtMulLowI32x4S,
|
||||
De::I64x2ExtMulHighI32x4S => En::I64x2ExtMulHighI32x4S,
|
||||
De::I64x2ExtMulLowI32x4U => En::I64x2ExtMulLowI32x4U,
|
||||
De::I64x2ExtMulHighI32x4U => En::I64x2ExtMulHighI32x4U,
|
||||
De::I16x8ExtAddPairwiseI8x16S => En::I16x8ExtAddPairwiseI8x16S,
|
||||
De::I16x8ExtAddPairwiseI8x16U => En::I16x8ExtAddPairwiseI8x16U,
|
||||
De::I32x4ExtAddPairwiseI16x8S => En::I32x4ExtAddPairwiseI16x8S,
|
||||
De::I32x4ExtAddPairwiseI16x8U => En::I32x4ExtAddPairwiseI16x8U,
|
||||
De::I8x16AddSatS => En::I8x16AddSatS,
|
||||
De::I8x16AddSatU => En::I8x16AddSatU,
|
||||
De::I16x8AddSatS => En::I16x8AddSatS,
|
||||
De::I16x8AddSatU => En::I16x8AddSatU,
|
||||
De::I8x16SubSatS => En::I8x16SubSatS,
|
||||
De::I8x16SubSatU => En::I8x16SubSatU,
|
||||
De::I16x8SubSatS => En::I16x8SubSatS,
|
||||
De::I16x8SubSatU => En::I16x8SubSatU,
|
||||
De::I16x8Q15MulrSatS => En::I16x8Q15MulrSatS,
|
||||
De::I8x16MinS => En::I8x16MinS,
|
||||
De::I8x16MinU => En::I8x16MinU,
|
||||
De::I16x8MinS => En::I16x8MinS,
|
||||
De::I16x8MinU => En::I16x8MinU,
|
||||
De::I32x4MinS => En::I32x4MinS,
|
||||
De::I32x4MinU => En::I32x4MinU,
|
||||
De::F32x4Min => En::F32x4Min,
|
||||
De::F64x2Min => En::F64x2Min,
|
||||
De::F32x4PMin => En::F32x4PMin,
|
||||
De::F64x2PMin => En::F64x2PMin,
|
||||
De::I8x16MaxS => En::I8x16MaxS,
|
||||
De::I8x16MaxU => En::I8x16MaxU,
|
||||
De::I16x8MaxS => En::I16x8MaxS,
|
||||
De::I16x8MaxU => En::I16x8MaxU,
|
||||
De::I32x4MaxS => En::I32x4MaxS,
|
||||
De::I32x4MaxU => En::I32x4MaxU,
|
||||
De::F32x4Max => En::F32x4Max,
|
||||
De::F64x2Max => En::F64x2Max,
|
||||
De::F32x4PMax => En::F32x4PMax,
|
||||
De::F64x2PMax => En::F64x2PMax,
|
||||
De::I8x16AvgrU => En::I8x16AvgrU,
|
||||
De::I16x8AvgrU => En::I16x8AvgrU,
|
||||
De::I8x16Abs => En::I8x16Abs,
|
||||
De::I16x8Abs => En::I16x8Abs,
|
||||
De::I32x4Abs => En::I32x4Abs,
|
||||
De::I64x2Abs => En::I64x2Abs,
|
||||
De::F32x4Abs => En::F32x4Abs,
|
||||
De::F64x2Abs => En::F64x2Abs,
|
||||
De::I8x16Shl => En::I8x16Shl,
|
||||
De::I16x8Shl => En::I16x8Shl,
|
||||
De::I32x4Shl => En::I32x4Shl,
|
||||
De::I64x2Shl => En::I64x2Shl,
|
||||
De::I8x16ShrS => En::I8x16ShrS,
|
||||
De::I8x16ShrU => En::I8x16ShrU,
|
||||
De::I16x8ShrS => En::I16x8ShrS,
|
||||
De::I16x8ShrU => En::I16x8ShrU,
|
||||
De::I32x4ShrS => En::I32x4ShrS,
|
||||
De::I32x4ShrU => En::I32x4ShrU,
|
||||
De::I64x2ShrS => En::I64x2ShrS,
|
||||
De::I64x2ShrU => En::I64x2ShrU,
|
||||
De::V128And => En::V128And,
|
||||
De::V128Or => En::V128Or,
|
||||
De::V128Xor => En::V128Xor,
|
||||
De::V128Not => En::V128Not,
|
||||
De::V128AndNot => En::V128AndNot,
|
||||
De::V128Bitselect => En::V128Bitselect,
|
||||
De::I8x16Popcnt => En::I8x16Popcnt,
|
||||
De::V128AnyTrue => En::V128AnyTrue,
|
||||
De::I8x16AllTrue => En::I8x16AllTrue,
|
||||
De::I16x8AllTrue => En::I16x8AllTrue,
|
||||
De::I32x4AllTrue => En::I32x4AllTrue,
|
||||
De::I64x2AllTrue => En::I64x2AllTrue,
|
||||
De::I8x16Bitmask => En::I8x16Bitmask,
|
||||
De::I16x8Bitmask => En::I16x8Bitmask,
|
||||
De::I32x4Bitmask => En::I32x4Bitmask,
|
||||
De::I64x2Bitmask => En::I64x2Bitmask,
|
||||
De::I8x16Eq => En::I8x16Eq,
|
||||
De::I16x8Eq => En::I16x8Eq,
|
||||
De::I32x4Eq => En::I32x4Eq,
|
||||
De::I64x2Eq => En::I64x2Eq,
|
||||
De::F32x4Eq => En::F32x4Eq,
|
||||
De::F64x2Eq => En::F64x2Eq,
|
||||
De::I8x16Ne => En::I8x16Ne,
|
||||
De::I16x8Ne => En::I16x8Ne,
|
||||
De::I32x4Ne => En::I32x4Ne,
|
||||
De::I64x2Ne => En::I64x2Ne,
|
||||
De::F32x4Ne => En::F32x4Ne,
|
||||
De::F64x2Ne => En::F64x2Ne,
|
||||
De::I8x16LtS => En::I8x16LtS,
|
||||
De::I8x16LtU => En::I8x16LtU,
|
||||
De::I16x8LtS => En::I16x8LtS,
|
||||
De::I16x8LtU => En::I16x8LtU,
|
||||
De::I32x4LtS => En::I32x4LtS,
|
||||
De::I32x4LtU => En::I32x4LtU,
|
||||
De::F32x4Lt => En::F32x4Lt,
|
||||
De::F64x2Lt => En::F64x2Lt,
|
||||
De::I8x16LeS => En::I8x16LeS,
|
||||
De::I8x16LeU => En::I8x16LeU,
|
||||
De::I16x8LeS => En::I16x8LeS,
|
||||
De::I16x8LeU => En::I16x8LeU,
|
||||
De::I32x4LeS => En::I32x4LeS,
|
||||
De::I32x4LeU => En::I32x4LeU,
|
||||
De::F32x4Le => En::F32x4Le,
|
||||
De::F64x2Le => En::F64x2Le,
|
||||
De::I8x16GtS => En::I8x16GtS,
|
||||
De::I8x16GtU => En::I8x16GtU,
|
||||
De::I16x8GtS => En::I16x8GtS,
|
||||
De::I16x8GtU => En::I16x8GtU,
|
||||
De::I32x4GtS => En::I32x4GtS,
|
||||
De::I32x4GtU => En::I32x4GtU,
|
||||
De::F32x4Gt => En::F32x4Gt,
|
||||
De::F64x2Gt => En::F64x2Gt,
|
||||
De::I8x16GeS => En::I8x16GeS,
|
||||
De::I8x16GeU => En::I8x16GeU,
|
||||
De::I16x8GeS => En::I16x8GeS,
|
||||
De::I16x8GeU => En::I16x8GeU,
|
||||
De::I32x4GeS => En::I32x4GeS,
|
||||
De::I32x4GeU => En::I32x4GeU,
|
||||
De::F32x4Ge => En::F32x4Ge,
|
||||
De::F64x2Ge => En::F64x2Ge,
|
||||
De::F32x4Div => En::F32x4Div,
|
||||
De::F64x2Div => En::F64x2Div,
|
||||
De::F32x4Sqrt => En::F32x4Sqrt,
|
||||
De::F64x2Sqrt => En::F64x2Sqrt,
|
||||
De::F32x4Ceil => En::F32x4Ceil,
|
||||
De::F64x2Ceil => En::F64x2Ceil,
|
||||
De::F32x4Floor => En::F32x4Floor,
|
||||
De::F64x2Floor => En::F64x2Floor,
|
||||
De::F32x4Trunc => En::F32x4Trunc,
|
||||
De::F64x2Trunc => En::F64x2Trunc,
|
||||
De::F32x4Nearest => En::F32x4Nearest,
|
||||
De::F64x2Nearest => En::F64x2Nearest,
|
||||
De::F32x4ConvertI32x4S => En::F32x4ConvertI32x4S,
|
||||
De::F32x4ConvertI32x4U => En::F32x4ConvertI32x4U,
|
||||
De::F64x2ConvertLowI32x4S => En::F64x2ConvertLowI32x4S,
|
||||
De::F64x2ConvertLowI32x4U => En::F64x2ConvertLowI32x4U,
|
||||
De::I32x4TruncSatF32x4S => En::I32x4TruncSatF32x4S,
|
||||
De::I32x4TruncSatF32x4U => En::I32x4TruncSatF32x4U,
|
||||
De::I32x4TruncSatF64x2SZero => En::I32x4TruncSatF64x2SZero,
|
||||
De::I32x4TruncSatF64x2UZero => En::I32x4TruncSatF64x2UZero,
|
||||
De::F32x4DemoteF64x2Zero => En::F32x4DemoteF64x2Zero,
|
||||
De::F64x2PromoteLowF32x4 => En::F64x2PromoteLowF32x4,
|
||||
De::I8x16NarrowI16x8S => En::I8x16NarrowI16x8S,
|
||||
De::I8x16NarrowI16x8U => En::I8x16NarrowI16x8U,
|
||||
De::I16x8NarrowI32x4S => En::I16x8NarrowI32x4S,
|
||||
De::I16x8NarrowI32x4U => En::I16x8NarrowI32x4U,
|
||||
De::I16x8ExtendLowI8x16S => En::I16x8ExtendLowI8x16S,
|
||||
De::I16x8ExtendHighI8x16S => En::I16x8ExtendHighI8x16S,
|
||||
De::I16x8ExtendLowI8x16U => En::I16x8ExtendLowI8x16U,
|
||||
De::I16x8ExtendHighI8x16U => En::I16x8ExtendHighI8x16U,
|
||||
De::I32x4ExtendLowI16x8S => En::I32x4ExtendLowI16x8S,
|
||||
De::I32x4ExtendHighI16x8S => En::I32x4ExtendHighI16x8S,
|
||||
De::I32x4ExtendLowI16x8U => En::I32x4ExtendLowI16x8U,
|
||||
De::I32x4ExtendHighI16x8U => En::I32x4ExtendHighI16x8U,
|
||||
De::I64x2ExtendLowI32x4S => En::I64x2ExtendLowI32x4S,
|
||||
De::I64x2ExtendHighI32x4S => En::I64x2ExtendHighI32x4S,
|
||||
De::I64x2ExtendLowI32x4U => En::I64x2ExtendLowI32x4U,
|
||||
De::I64x2ExtendHighI32x4U => En::I64x2ExtendHighI32x4U,
|
||||
|
||||
De::I8x16Shuffle { lanes } => En::I8x16Shuffle(lanes),
|
||||
|
||||
other => bail!("Unsupported instruction {:?}", other),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="uw8">
|
||||
<a href="https://exoticorn.github.io/microw8">MicroW8</a> 0.3.0
|
||||
<a href="https://exoticorn.github.io/microw8">MicroW8</a> 0.3.1
|
||||
</div>
|
||||
<div id="centered">
|
||||
<canvas class="screen" id="screen" width="320" height="240">
|
||||
|
||||
@@ -240,6 +240,7 @@ export default function MicroW8(screen, config = {}) {
|
||||
await audioReadyPromise;
|
||||
|
||||
let startTime = Date.now();
|
||||
let frameCounter = 0;
|
||||
|
||||
const timePerFrame = 1000 / 60;
|
||||
|
||||
@@ -306,6 +307,7 @@ export default function MicroW8(screen, config = {}) {
|
||||
let time = Date.now() - startTime;
|
||||
u32Mem[16] = time;
|
||||
u32Mem[17] = pad | gamepad;
|
||||
u32Mem[18] = frameCounter++;
|
||||
if(instance.exports.upd) {
|
||||
instance.exports.upd();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user