mirror of
https://github.com/Ed94/pikuma_ps1.git
synced 2026-08-06 23:58:49 +00:00
Added jump_rel (can't use abs jump with asm dsl). Fixes + improvements to ps1 asm meta passes.
This commit is contained in:
@@ -459,9 +459,7 @@ atom_label(disconnected) /* === Disconnected body. */
|
||||
load_upper_i(R_T4, 0x8080), or_i_self(R_T4, 0x8080),
|
||||
store_word( R_T4, R_PadState, O_(PadState,left_x)),
|
||||
store_byte( R_RawId, R_PadState, O_(PadState,id)),
|
||||
branch_equal(R_0, R_0, atom_offset(disconnected, snap_end)), nop,
|
||||
// TODO(Ed): Lua metaprogram: Support jump instruction here..
|
||||
// jump(atom_offset(disconnected, snap_end)), nop,
|
||||
jump_rel(atom_offset(disconnected, snap_end)), nop,
|
||||
atom_label(skip_disconnected)
|
||||
|
||||
/* === Case 2: Pending (status == 0 && id == 0)
|
||||
@@ -479,9 +477,7 @@ atom_label(pending) /* === Pending body */
|
||||
load_upper_i(R_T4, 0x8080), or_i_self(R_T4, 0x8080),
|
||||
store_word( R_T4, R_PadState, O_(PadState,left_x)),
|
||||
store_byte( R_RawId, R_PadState, O_(PadState,id)),
|
||||
branch_equal(R_0, R_0, atom_offset(pending, snap_end)), nop,
|
||||
// TODO(Ed): Lua metaprogram: Support jump instruction here..
|
||||
// jump(atom_offset(pending, snap_end)), nop,
|
||||
jump_rel(atom_offset(pending, snap_end)), nop,
|
||||
|
||||
atom_label(id_dispatch) /* === Case 3-6: ID dispatch */
|
||||
add_ui(R_T4, R_0, 0x41), branch_ne(R_RawId, R_T4, atom_offset(id_dispatch, try_analog_stick)),
|
||||
@@ -503,9 +499,7 @@ atom_label(id_dispatch) /* === Case 3-6: ID dispatch */
|
||||
add_ui( R_T4, R_0, 0x41),
|
||||
store_byte( R_T4, R_PadState, O_(PadState,id)),
|
||||
|
||||
branch_equal(R_0, R_0, atom_offset(id_dispatch, snap_end)), nop,
|
||||
// TODO(Ed): Lua metaprogram: Support jump instruction here..
|
||||
// jump(atom_offset(id_dispatch, snap_end)), nop,
|
||||
jump_rel(atom_offset(id_dispatch, snap_end)), nop,
|
||||
|
||||
atom_label(try_analog_stick) /* === Case 4: AnalogStick (id == 0x53)*/
|
||||
add_ui(R_T4, R_0, 0x53), branch_ne(R_RawId, R_T4, atom_offset(try_analog_stick, try_analog_pad)),
|
||||
@@ -526,9 +520,7 @@ atom_label(analog_stick) /* === AnalogStick body
|
||||
store_half( R_T4, R_PadState, O_(PadState,right_x)),
|
||||
add_ui( R_T5, R_0, 0x53), /* R_T5 = id value (clobbers left_xy, already stored) */
|
||||
store_byte( R_T5, R_PadState, O_(PadState,id)),
|
||||
branch_equal(R_0, R_0, atom_offset(analog_stick, snap_end)), nop,
|
||||
// TODO(Ed): Lua metaprogram: Support jump instruction here..
|
||||
// jump(atom_offset(analog_stick, snap_end)), nop,
|
||||
jump_rel(atom_offset(analog_stick, snap_end)), nop,
|
||||
|
||||
atom_label(try_analog_pad) /* === Case 5-6: AnalogPad (id & 0xF0 == 0x70) */
|
||||
and_i( R_T4, R_RawId, 0xF0),
|
||||
@@ -550,9 +542,7 @@ atom_label(analog_pad) /* === AnalogPad body
|
||||
store_half( R_T4, R_PadState, O_(PadState,right_x)),
|
||||
store_byte( R_RawId, R_PadState, O_(PadState,id)),
|
||||
|
||||
branch_equal(R_0, R_0, atom_offset(analog_pad, snap_end)), nop,
|
||||
// TODO(Ed): Lua metaprogram: Support jump instruction here..
|
||||
// jump(atom_offset(analog_pad, snap_end)), nop,
|
||||
jump_rel(atom_offset(analog_pad, snap_end)), nop,
|
||||
|
||||
atom_label(try_unsupported) /* === Case 7: Unsupported — fall through from the AnalogPad range-check miss. */
|
||||
add_ui( R_T4, R_0, PadStatus_Unsupported),
|
||||
@@ -650,10 +640,7 @@ atom_label(dead_check_upper)
|
||||
/* R_T4 = (0x90 < left_x) ? 1 : 0 → (left_x > 0x90) ? 1 : 0 */
|
||||
set_lt_u(R_T4, R_T4, R_T3), branch_ne(R_T4, R_0, atom_offset(dead_zone_high_check, dead_high_active)),
|
||||
add_ui( R_T4, R_0, 0x80), /* BD-slot: pre-load 0x80 for dead_high_active */
|
||||
branch_equal(R_0, R_0, atom_offset(dead_zone_skip, exit_stick)), nop,
|
||||
/* Fall-through = left_x in [0x70, 0x90] (dead zone); skip analog entirely. */
|
||||
// TODO(Ed): Lua metaprogram: Support jump instruction here..
|
||||
// jump(atom_offset(dead_zone_skip, exit_stick)), nop,
|
||||
jump_rel(atom_offset(dead_zone_skip, exit_stick)), nop,
|
||||
|
||||
atom_label(dead_low_active)
|
||||
/* R_T3 = left_x (from line 632 lbu; not clobbered between dead_zone_low_check branch + its BD-slot `add_ui R_T4, 0x80`).
|
||||
@@ -675,9 +662,7 @@ atom_label(dead_low_active)
|
||||
add_u( R_T0, R_T0, R_T4),
|
||||
store_half( R_T0, R_FloorRot, O_(V3_S2,y)),
|
||||
|
||||
branch_equal(R_0, R_0, atom_offset(end_low, exit_stick)), nop,
|
||||
// TODO(Ed): Lua metaprogram: Support jump instruction here..
|
||||
// jump(atom_offset(end_low, exit_stick)), nop,
|
||||
jump_rel(atom_offset(end_low, exit_stick)), nop,
|
||||
|
||||
atom_label(dead_high_active)
|
||||
/* R_T3 = left_x (from line 641 lbu in dead_check_upper; not clobbered between dead_zone_high_check branch + its BD-slot `add_ui R_T4, 0x80`).
|
||||
|
||||
Reference in New Issue
Block a user