EarthBound/Controller input memory: Difference between revisions

From Data Crystal
Jump to navigation Jump to search
m (→‎Controller Data Format: correct "byte" to "bit")
m (Xkeeper moved page EarthBound:Controller input memory to EarthBound/Controller input memory: normalize subpages and titles)
 
(3 intermediate revisions by one other user not shown)
Line 42: Line 42:
<code>RPxxxxxx</code>
<code>RPxxxxxx</code>


If <tt>R</tt> is <code>1</code>, controller input is currently being recorded.
If <tt>R</tt> (bit <tt>#$80</tt>) is <code>1</code>, controller input is currently being recorded.


If <tt>P</tt> is <code>1</code>, controller input is being overridden using the data in a record table.
If <tt>P</tt> (bit <tt>#$40</tt>) is <code>1</code>, controller input is being overridden using the data in a record table.


===<tt>$7E007D-$7E0080</tt>: Long pointer to record table entry for playback <span class="anchor" id="$7E007D"></span> ===
===<tt>$7E007D-$7E0080</tt>: Long pointer to record table entry for playback <span class="anchor" id="$7E007D"></span> ===
Line 50: Line 50:


===<tt>$7E0081</tt>: Num frames remaining for current playback value <span class="anchor" id="$7E0081"></span> ===
===<tt>$7E0081</tt>: Num frames remaining for current playback value <span class="anchor" id="$7E0081"></span> ===
Number of frames remaining to override controller input with the value in [[#$7E0083|<tt>$7E0083</tt>]] before moving on to the next entry in the record table. On loading a new record table entry, set to the first byte of the entry (<code>[$7E0081] & #$00FF</code>).
Number of frames remaining to override controller input with the value in [[#$7E0083|<tt>$7E0083</tt>]] before moving on to the next entry in the record table. On loading a new record table entry, set to the first byte of the entry (<code>[$7E007D] & #$00FF</code>).


===<tt>$7E0083</tt>: Current playback value <span class="anchor" id="$7E0083"></span> ===
===<tt>$7E0083</tt>: Current playback value <span class="anchor" id="$7E0083"></span> ===
Current value being used to override controller input. On loading a new record table entry, set to bytes 2 and 3 of the entry (<code>[$7E0081], #$0001</code>).
Current value being used to override controller input. On loading a new record table entry, set to bytes 2 and 3 of the entry (<code>[$7E007D], #$0001</code>).


===<tt>$7E0085-$7E0088</tt>: Long pointer to record table entry for record <span class="anchor" id="$7E0085"></span> ===
===<tt>$7E0085-$7E0088</tt>: Long pointer to record table entry for record <span class="anchor" id="$7E0085"></span> ===

Latest revision as of 02:41, 24 January 2024

This is a sub-page of EarthBound.

Memory Locations

$7E0065: Latest controller1 data

Most recently read input from controller1, masked by #$fff0, the bits expected to be valid for a standard SNES controller. Contains the OR of both controller1 and controller2 data if $7E436C is #$0000.

$7E0067: Latest controller2 data

Most recently read input from controller2, masked by #$fff0, the bits expected to be valid for a standard SNES controller.

$7E0069: Controller1 data with repeat pulses

Contains #$0000 except when controller1 input changes or has stayed stable. Whenever controller1 input changes, for one frame only, contains just the newly set controller data bits ($7E006D) that were not set on the previous frame. When controller1 input has not changed for 15 frames, contains all controller1 data ($7E0065) only every four frames.

Contains the OR of both controller1 and controller2 values if $7E436C is #$0000.

$7E006B: Controller2 data with repeat pulses

Contains #$0000 except when controller2 input changes or has stayed stable. Whenever controller2 input changes, for one frame only, contains just the newly set controller data bits ($7E006F) that were not set on the previous frame. When controller2 input has not changed for 15 frames, contains all controller2 data ($7E0067) only every four frames.

$7E006D: New controller1 data

Contains newly set controller1 data bits that were not set on the previous frame. Contains the OR of both controller1 and controller2 values if $7E436C is #$0000.

$7E006F: New controller2 data

Contains newly set controller2 data bits that were not set on the previous frame.

$7E0071: Num frames until next controller1 pulse

Number of remaining frames of no change to controller1 data before the data will next be pulsed to $7E0069.

$7E0073: Num frames until next controller2 pulse

Number of remaining frames of no change to controller2 data before the data will next be pulsed to $7E006B.

$7E0075: Controller data

Same as $7E0065. Most likely only intended as a temporary storage location during controller input processing.

$7E0077: Raw controller1 data

Most recently read raw input from controller1.

$7E0079: Raw controller2 data

Most recently read raw input from controller2.

$7E007B: Controller playback/record status

Status bit flags for controller playback and record. Format: RPxxxxxx

If R (bit #$80) is 1, controller input is currently being recorded.

If P (bit #$40) is 1, controller input is being overridden using the data in a record table.

$7E007D-$7E0080: Long pointer to record table entry for playback

24-bit long pointer to the current entry in a record table being used for overriding controller input.

$7E0081: Num frames remaining for current playback value

Number of frames remaining to override controller input with the value in $7E0083 before moving on to the next entry in the record table. On loading a new record table entry, set to the first byte of the entry ([$7E007D] & #$00FF).

$7E0083: Current playback value

Current value being used to override controller input. On loading a new record table entry, set to bytes 2 and 3 of the entry ([$7E007D], #$0001).

$7E0085-$7E0088: Long pointer to record table entry for record

24-bit long pointer to the current entry in a record table being used for recording controller input.

$7E0089: Num frames current controller data has been recording

Number of frames the value in $7E008B has been recording from controller input.

$7E008B: Current controller data being recorded

Current value being recorded from controller input.

Controller Data Format

ABCDEFGHIJKL0000

  • A (bit #$8000): B button
  • B (bit #$4000): Y button
  • C (bit #$2000): Select
  • D (bit #$1000): Start
  • E (bit #$0800): Up
  • F (bit #$0400): Down
  • G (bit #$0200): Left
  • H (bit #$0100): Right
  • I (bit #$0080): A button
  • J (bit #$0040): X button
  • K (bit #$0020): L button
  • L (bit #$0010): R button

Record Table Format

Controller input playback and recording use the same format, allowing playback to use a table recorded by the recording functionality. The table consists of 3-byte entries, in order, and the table ends with a 00 byte.

Number of frames

Number of frames for the following controller data value to override input for playback, or the number of frames the following controller value was recorded.

If it is desired for a particular controller data value to override for more than 255 frames, multiple table entries with the same controller data value can be placed consecutively. The record controller data routine will do this automatically on recording an input held for more than 255 frames.

Controller data value

The controller data value to override input for playback, or the controller data value that was recorded.