1
0
Fork 0
mirror of https://github.com/notwa/mm synced 2024-11-14 09:19:02 -08:00
mm/asm/dpad control.asm

20 lines
452 B
NASM
Raw Normal View History

2016-01-12 06:59:29 -08:00
dpad_control:
// a0: number you want to control
// a1: button state
// v0: number after modifications
la t1, dpad_values
srl t0, a1, 8
andi t0, 0xF
add t0, t1
2016-01-12 06:59:29 -08:00
lb t0, 0(t0)
jr
add v0, a0, t0
dpad_values:
// use table of values for branchless operation
.byte 0, 1, -1, 0
2016-01-13 11:20:28 -08:00
.byte -16, -4, -64, -16
.byte +16, +64, +4, +16
2016-01-12 06:59:29 -08:00
.byte 0, 1, -1, 0
.align