Updated 7 November 2026

Input

Buttons are read once per frame by the runtime; query them from c8b.update. Core8Bit has D-pad, A, B, X, Y, Menu and Select plus two analog sticks.

Conventions on every page: Availability says whether a symbol exists on the console BIOS, the emulator, or both. c8b and C8B are the same table.

Contents

Buttons

c8b.buttonIsPressed

c8b.buttonIsPressed(button)

True while the button is held. button is a kButton* mask or a name: "a","b","x","y","up","down","left","right","menu","select" (also capitalised forms).

  • Returns: boolean
  • Availability: Console (BIOS) and emulator
if c8b.buttonIsPressed("left") then x = x - 2 end

c8b.buttonJustPressed

c8b.buttonJustPressed(button)

True on the frame the button went down.

  • Returns: boolean
  • Availability: Console (BIOS) and emulator

c8b.buttonJustReleased

c8b.buttonJustReleased(button)

True on the frame the button went up.

  • Returns: boolean
  • Availability: Console (BIOS) and emulator

c8b.getButtonState

c8b.getButtonState()

Bitmask of buttons currently held.

  • Returns: integer
  • Availability: Console (BIOS) and emulator
  • Note: For the held, pressed and released masks together, use require("core8bit.input").getButtonState().

Button constants

c8b.kButtonLeft

c8b.kButtonLeft = 1

Button bit mask.

  • Availability: Console (BIOS) and emulator

c8b.kButtonRight

c8b.kButtonRight = 2

Button bit mask.

  • Availability: Console (BIOS) and emulator

c8b.kButtonUp

c8b.kButtonUp = 4

Button bit mask.

  • Availability: Console (BIOS) and emulator

c8b.kButtonDown

c8b.kButtonDown = 8

Button bit mask.

  • Availability: Console (BIOS) and emulator

c8b.kButtonA

c8b.kButtonA = 16

Button bit mask.

  • Availability: Console (BIOS) and emulator

c8b.kButtonB

c8b.kButtonB = 32

Button bit mask.

  • Availability: Console (BIOS) and emulator

c8b.kButtonX

c8b.kButtonX = 64

Button bit mask.

  • Availability: Console (BIOS) and emulator

c8b.kButtonY

c8b.kButtonY = 128

Button bit mask.

  • Availability: Console (BIOS) and emulator

c8b.kButtonMenu

c8b.kButtonMenu = 256

Button bit mask.

  • Availability: Console (BIOS) and emulator

c8b.kButtonSelect

c8b.kButtonSelect = 512

Button bit mask.

  • Availability: Console (BIOS) and emulator

Input module — require("core8bit.input") (analog sticks, calibration)

Input.buttonIsPressed

Input.buttonIsPressed(button)

Held state; names limited to left/right/up/down/a/b. Module returned by require("core8bit.input"); not stored in c8b by the SDK.

  • Returns: boolean
  • Availability: Console (BIOS) and emulator

Input.buttonJustPressed

Input.buttonJustPressed(button)

Pressed this frame. Module returned by require("core8bit.input"); not stored in c8b by the SDK.

  • Returns: boolean
  • Availability: Console (BIOS) and emulator

Input.buttonJustReleased

Input.buttonJustReleased(button)

Released this frame. Module returned by require("core8bit.input"); not stored in c8b by the SDK.

  • Returns: boolean
  • Availability: Console (BIOS) and emulator

Input.getButtonState

Input.getButtonState()

Current, just-pressed and just-released masks. Module returned by require("core8bit.input"); not stored in c8b by the SDK.

  • Returns: current, pressed, released
  • Availability: Console (BIOS) and emulator

Input.getLeftStickX

Input.getLeftStickX()

Left stick X, 0.0..1.0 (centre 0.5). Module returned by require("core8bit.input"); not stored in c8b by the SDK.

  • Returns: number
  • Availability: Console (BIOS) and emulator

Input.getLeftStickY

Input.getLeftStickY()

Left stick Y. Module returned by require("core8bit.input"); not stored in c8b by the SDK.

  • Returns: number
  • Availability: Console (BIOS) and emulator

Input.getRightStickX

Input.getRightStickX()

Right stick X. Module returned by require("core8bit.input"); not stored in c8b by the SDK.

  • Returns: number
  • Availability: Console (BIOS) and emulator

Input.getRightStickY

Input.getRightStickY()

Right stick Y. Module returned by require("core8bit.input"); not stored in c8b by the SDK.

  • Returns: number
  • Availability: Console (BIOS) and emulator

Input.getLeftStick

Input.getLeftStick()

Left stick. Module returned by require("core8bit.input"); not stored in c8b by the SDK.

  • Returns: x, y
  • Availability: Console (BIOS) and emulator

Input.getRightStick

Input.getRightStick()

Right stick. Module returned by require("core8bit.input"); not stored in c8b by the SDK.

  • Returns: x, y
  • Availability: Console (BIOS) and emulator

Input.getLeftStickRaw

Input.getLeftStickRaw()

Raw ADC (0-1023, centre 512). Module returned by require("core8bit.input"); not stored in c8b by the SDK.

  • Returns: x, y
  • Availability: Console (BIOS) and emulator

Input.getRightStickRaw

Input.getRightStickRaw()

Raw ADC. Module returned by require("core8bit.input"); not stored in c8b by the SDK.

  • Returns: x, y
  • Availability: Console (BIOS) and emulator

Input.startCalibration

Input.startCalibration()

Starts joystick calibration. Module returned by require("core8bit.input"); not stored in c8b by the SDK.

  • Availability: Console (BIOS) and emulator

Input.updateCalibration

Input.updateCalibration()

Call every frame while calibrating. Module returned by require("core8bit.input"); not stored in c8b by the SDK.

  • Availability: Console (BIOS) and emulator

Input.completeCalibration

Input.completeCalibration()

Finishes and saves calibration. Module returned by require("core8bit.input"); not stored in c8b by the SDK.

  • Availability: Console (BIOS) and emulator

Input.isCalibrationActive

Input.isCalibrationActive()

Calibration running. Module returned by require("core8bit.input"); not stored in c8b by the SDK.

  • Returns: boolean
  • Availability: Console (BIOS) and emulator

Input.getCalibrationTimeRemaining

Input.getCalibrationTimeRemaining()

Seconds until auto-complete. Module returned by require("core8bit.input"); not stored in c8b by the SDK.

  • Returns: integer
  • Availability: Console (BIOS) and emulator

Input.getRawADC

Input.getRawADC(channel)

Raw ADC of channel 0-3. Module returned by require("core8bit.input"); not stored in c8b by the SDK.

  • Returns: integer
  • Availability: Console (BIOS) and emulator

Input.getCalibrationData

Input.getCalibrationData(channel)

Calibration values. Module returned by require("core8bit.input"); not stored in c8b by the SDK.

  • Returns: min, center, max
  • Availability: Console (BIOS) and emulator

Input.saveCalibration

Input.saveCalibration()

Saves calibration to the SD card. Module returned by require("core8bit.input"); not stored in c8b by the SDK.

  • Availability: Console (BIOS) and emulator

Input.loadCalibration

Input.loadCalibration()

Loads calibration. Module returned by require("core8bit.input"); not stored in c8b by the SDK.

  • Returns: boolean
  • Availability: Console (BIOS) and emulator

Low-level bindings (C8B.*)

C8B.Input_getRawADC

C8B.Input_getRawADC(channel)

Native input binding: get raw adc.

  • Returns: 1 value(s): integer
  • Availability: Console (BIOS) and emulator

C8B.Input_getLeftStickX

C8B.Input_getLeftStickX()

Native input binding: get left stick x.

  • Returns: 1 value(s): number
  • Availability: Console (BIOS) and emulator

C8B.Input_getLeftStickY

C8B.Input_getLeftStickY()

Native input binding: get left stick y.

  • Returns: 1 value(s): number
  • Availability: Console (BIOS) and emulator

C8B.Input_getButtonState

C8B.Input_getButtonState()

Native input binding: get button state.

  • Returns: 1 value(s): integer
  • Availability: Console (BIOS) and emulator

C8B.Input_getRightStickX

C8B.Input_getRightStickX()

Native input binding: get right stick x.

  • Returns: 1 value(s): number
  • Availability: Console (BIOS) and emulator

C8B.Input_getRightStickY

C8B.Input_getRightStickY()

Native input binding: get right stick y.

  • Returns: 1 value(s): number
  • Availability: Console (BIOS) and emulator

C8B.Input_buttonIsPressed

C8B.Input_buttonIsPressed(button)

Native input binding: button is pressed.

  • Returns: 1 value(s): boolean
  • Availability: Console (BIOS) and emulator

C8B.Input_getAxisInverted

C8B.Input_getAxisInverted(channel)

Whether an analog axis is inverted.

  • Returns: 1 value(s): boolean
  • Availability: Console (BIOS) and emulator

C8B.Input_loadCalibration

C8B.Input_loadCalibration()

Native input binding: load calibration.

  • Returns: 1 value(s): boolean
  • Availability: Console (BIOS) and emulator

C8B.Input_saveCalibration

C8B.Input_saveCalibration()

Native input binding: save calibration.

  • Availability: Console (BIOS) and emulator

C8B.Input_setAxisInverted

C8B.Input_setAxisInverted(channel, inverted)

Inverts an analog axis.

  • Availability: Console (BIOS) and emulator

C8B.Input_getLeftStickRawX

C8B.Input_getLeftStickRawX()

Native input binding: get left stick raw x.

  • Returns: 1 value(s): integer
  • Availability: Console (BIOS) and emulator

C8B.Input_getLeftStickRawY

C8B.Input_getLeftStickRawY()

Native input binding: get left stick raw y.

  • Returns: 1 value(s): integer
  • Availability: Console (BIOS) and emulator

C8B.Input_startCalibration

C8B.Input_startCalibration()

Native input binding: start calibration.

  • Availability: Console (BIOS) and emulator

C8B.Input_buttonJustPressed

C8B.Input_buttonJustPressed(button)

Native input binding: button just pressed.

  • Returns: 1 value(s): boolean
  • Availability: Console (BIOS) and emulator

C8B.Input_getCalibrationMax

C8B.Input_getCalibrationMax(channel)

Native input binding: get calibration max.

  • Returns: 1 value(s): integer
  • Availability: Console (BIOS) and emulator

C8B.Input_getCalibrationMin

C8B.Input_getCalibrationMin(channel)

Native input binding: get calibration min.

  • Returns: 1 value(s): integer
  • Availability: Console (BIOS) and emulator

C8B.Input_getRightStickRawX

C8B.Input_getRightStickRawX()

Native input binding: get right stick raw x.

  • Returns: 1 value(s): integer
  • Availability: Console (BIOS) and emulator

C8B.Input_getRightStickRawY

C8B.Input_getRightStickRawY()

Native input binding: get right stick raw y.

  • Returns: 1 value(s): integer
  • Availability: Console (BIOS) and emulator

C8B.Input_updateCalibration

C8B.Input_updateCalibration()

Native input binding: update calibration.

  • Availability: Console (BIOS) and emulator

C8B.Input_buttonJustReleased

C8B.Input_buttonJustReleased(button)

Native input binding: button just released.

  • Returns: 1 value(s): boolean
  • Availability: Console (BIOS) and emulator

C8B.Input_completeCalibration

C8B.Input_completeCalibration()

Native input binding: complete calibration.

  • Availability: Console (BIOS) and emulator

C8B.Input_isCalibrationActive

C8B.Input_isCalibrationActive()

Native input binding: is calibration active.

  • Returns: 1 value(s): boolean
  • Availability: Console (BIOS) and emulator

C8B.Input_getCalibrationCenter

C8B.Input_getCalibrationCenter(channel)

Native input binding: get calibration center.

  • Returns: 1 value(s): integer
  • Availability: Console (BIOS) and emulator

C8B.Input_getButtonsJustPressed

C8B.Input_getButtonsJustPressed()

Mask of buttons pressed this frame.

  • Returns: 1 value(s): integer
  • Availability: Console (BIOS) and emulator

C8B.Input_getButtonsJustReleased

C8B.Input_getButtonsJustReleased()

Mask of buttons released this frame.

  • Returns: 1 value(s): integer
  • Availability: Console (BIOS) and emulator

C8B.Input_getCalibrationTimeRemaining

C8B.Input_getCalibrationTimeRemaining()

Native input binding: get calibration time remaining.

  • Returns: 1 value(s): integer
  • Availability: Console (BIOS) and emulator