From bdbc8cbd48765cf287a524bea5ae2323772cc1c8 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Mon, 11 Aug 2025 15:43:27 -0400 Subject: Update hardware.inc to 5.3.0 and use its `JOYP_SGB_*` constants --- engine/gfx/palettes.asm | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'engine') diff --git a/engine/gfx/palettes.asm b/engine/gfx/palettes.asm index ef532c66..fe69144c 100644 --- a/engine/gfx/palettes.asm +++ b/engine/gfx/palettes.asm @@ -338,30 +338,30 @@ SendSGBPacket: ld a, 1 ldh [hDisableJoypadPolling], a ; send RESET signal (P14=LOW, P15=LOW) - xor a + xor a ; JOYP_SGB_START ldh [rJOYP], a ; set P14=HIGH, P15=HIGH - ld a, $30 + ld a, JOYP_SGB_FINISH ldh [rJOYP], a ;load length of packets (16 bytes) - ld b, $10 + ld b, 16 .nextByte ;set bit counter (8 bits per byte) - ld e, $08 + ld e, 8 ; get next byte in the packet ld a, [hli] ld d, a .nextBit0 bit 0, d ; if 0th bit is not zero set P14=HIGH, P15=LOW (send bit 1) - ld a, $10 + ld a, JOYP_SGB_ONE jr nz, .next0 ; else (if 0th bit is zero) set P14=LOW, P15=HIGH (send bit 0) - ld a, $20 + ld a, JOYP_SGB_ZERO .next0 ldh [rJOYP], a ; must set P14=HIGH,P15=HIGH between each "pulse" - ld a, $30 + ld a, JOYP_SGB_FINISH ldh [rJOYP], a ; rotation will put next bit in 0th position (so we can always use command ; "bit 0, d" to fetch the bit that has to be sent) @@ -371,11 +371,11 @@ SendSGBPacket: jr nz, .nextBit0 dec b jr nz, .nextByte -; send bit 1 as a "stop bit" (end of parameter data) - ld a, $20 +; send bit 0 as a "stop bit" (end of parameter data) + ld a, JOYP_SGB_ZERO ldh [rJOYP], a ; set P14=HIGH,P15=HIGH - ld a, $30 + ld a, JOYP_SGB_FINISH ldh [rJOYP], a xor a ldh [hDisableJoypadPolling], a @@ -465,17 +465,17 @@ CheckSGB: and $3 cp $3 jr nz, .isSGB - ld a, $20 + ld a, JOYP_SGB_ZERO ldh [rJOYP], a ldh a, [rJOYP] ldh a, [rJOYP] call Wait7000 call Wait7000 - ld a, $30 + ld a, JOYP_SGB_FINISH ldh [rJOYP], a call Wait7000 call Wait7000 - ld a, $10 + ld a, JOYP_SGB_ONE ldh [rJOYP], a ldh a, [rJOYP] ldh a, [rJOYP] @@ -486,7 +486,7 @@ CheckSGB: call Wait7000 vc_hook Unknown_network_reset call Wait7000 - ld a, $30 + ld a, JOYP_SGB_FINISH ldh [rJOYP], a ldh a, [rJOYP] ldh a, [rJOYP] -- cgit v1.3.1-sl0p