diff --git a/CHANGELOG.md b/CHANGELOG.md index 115e892d..56e1394e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,8 @@ * Added `vectrex`, `msx_br`, `koi7n2`, `iso15`, `zx80` and `zx81` text encodings. +* `reset_joy` is now defined to always reset all joypad state variables. + * Fixed arithmetic promotion bugs for signed values. * Fixed parsing of `zp_bytes` in platform definitions. diff --git a/docs/stdlib/input.md b/docs/stdlib/input.md index b694e317..c445524f 100644 --- a/docs/stdlib/input.md +++ b/docs/stdlib/input.md @@ -21,9 +21,9 @@ Vertical joystick movement. 1 if down, -1 if up, 0 if neither. #### `void reset_joy()` -Resets the state variables. -For platforms with more than one button, this resets only the main button state. -On those platforms use the platform-specific functions instead. +Resets the state variables. +The default implementation resets only the main button. +May be overridden by a strong alias on some platforms that have more buttons. ## null_joy_default @@ -31,6 +31,8 @@ This module set the default joystick to no joystick. #### `alias read_joy` +A reserved name for reading the default joystick. + ## mouse The `mouse` module automatically imports the `x_coord` module. diff --git a/docs/stdlib/nes.md b/docs/stdlib/nes.md index 3468f0f5..fa18f096 100644 --- a/docs/stdlib/nes.md +++ b/docs/stdlib/nes.md @@ -76,9 +76,9 @@ Reads the joypad from the port 1 and adds its readouts to the current readouts. Reads the joypad from the port 2 and adds its readouts to the current readouts. #### `void nes_reset_joy()` +#### `alias reset_joy = nes_reset_joy!` Resets the state variables. -Unlike `reset_joy`, this resets all the NES button states. ## nes_joy1_default diff --git a/include/nes_joy.mfk b/include/nes_joy.mfk index 2ffedef5..bf7d2cce 100644 --- a/include/nes_joy.mfk +++ b/include/nes_joy.mfk @@ -19,12 +19,16 @@ macro void read_joy2() { } void nes_reset_joy() { + input_dx = 0 + input_dy = 0 + input_a = 0 input_b = 0 input_select = 0 input_start = 0 - reset_joy() } +alias reset_joy = nes_reset_joy! + inline void read_also_joy1() { strobe_joypad() __parse_nes_joypad1()