Specify the ldh instruction, don't turn ld into ldh

This commit is contained in:
Rangi 2020-07-06 19:03:05 -04:00
parent c480632d54
commit 772fcc7588
219 changed files with 2556 additions and 2556 deletions

View file

@ -102,25 +102,25 @@ CableClub_DoBattleOrTradeAgain:
ld a, SERIAL_PATCH_LIST_PART_TERMINATOR
ld [de], a ; end of part 2
call Serial_SyncAndExchangeNybble
ld a, [hSerialConnectionStatus]
ldh a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
jr nz, .skipSendingTwoZeroBytes
; if using internal clock
; send two zero bytes for syncing purposes?
call Delay3
xor a
ld [hSerialSendData], a
ldh [hSerialSendData], a
ld a, START_TRANSFER_INTERNAL_CLOCK
ld [rSC], a
ldh [rSC], a
call DelayFrame
xor a
ld [hSerialSendData], a
ldh [hSerialSendData], a
ld a, START_TRANSFER_INTERNAL_CLOCK
ld [rSC], a
ldh [rSC], a
.skipSendingTwoZeroBytes
call Delay3
ld a, (1 << SERIAL)
ld [rIE], a
ldh [rIE], a
ld hl, wSerialRandomNumberListBlock
ld de, wSerialOtherGameboyRandomNumberListBlock
ld bc, $11
@ -138,10 +138,10 @@ CableClub_DoBattleOrTradeAgain:
ld bc, $c8
call Serial_ExchangeBytes
ld a, (1 << SERIAL) | (1 << TIMER) | (1 << VBLANK)
ld [rIE], a
ldh [rIE], a
ld a, SFX_STOP_ALL_MUSIC
call PlaySound
ld a, [hSerialConnectionStatus]
ldh a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
jr z, .skipCopyingRandomNumberList ; the list generated by the gameboy clocking the connection is used by both gameboys
ld hl, wSerialOtherGameboyRandomNumberListBlock
@ -263,7 +263,7 @@ CableClub_DoBattleOrTradeAgain:
ld [wTradeCenterPointerTableIndex], a
ld a, SFX_STOP_ALL_MUSIC
call PlaySound
ld a, [hSerialConnectionStatus]
ldh a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
ld c, 66
call z, DelayFrames ; delay if using internal clock
@ -551,7 +551,7 @@ TradeCenter_SelectMon:
Coorda 1, 16
.cancelMenuItem_JoypadLoop
call JoypadLowSensitivity
ld a, [hJoy5]
ldh a, [hJoy5]
and a ; pressed anything?
jr z, .cancelMenuItem_JoypadLoop
bit 0, a ; A button pressed?
@ -663,7 +663,7 @@ TradeCenter_PrintPartyListNames:
push de
push hl
ld a, c
ld [hPastLeadingZeros], a
ldh [hPastLeadingZeros], a
call GetMonName
pop hl
call PlaceString
@ -837,7 +837,7 @@ TradeCenter_Trade:
call LoadHpBarAndStatusTilePatterns
xor a
ld [wUnusedCC5B], a
ld a, [hSerialConnectionStatus]
ldh a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK
jr z, .usingExternalClock
predef InternalClockTradeAnim
@ -914,7 +914,7 @@ CableClub_Run:
ld [wGrassRate], a
inc a ; LINK_STATE_IN_CABLE_CLUB
ld [wLinkState], a
ld [hJoy5], a
ldh [hJoy5], a
ld a, 10
ld [wAudioFadeOutControl], a
ld a, BANK(Music_Celadon)

View file

@ -15,27 +15,27 @@ CableClubNPC::
ld a, 90
ld [wLinkTimeoutCounter], a
.establishConnectionLoop
ld a, [hSerialConnectionStatus]
ldh a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
jr z, .establishedConnection
cp USING_EXTERNAL_CLOCK
jr z, .establishedConnection
ld a, CONNECTION_NOT_ESTABLISHED
ld [hSerialConnectionStatus], a
ldh [hSerialConnectionStatus], a
ld a, ESTABLISH_CONNECTION_WITH_EXTERNAL_CLOCK
ld [rSB], a
ldh [rSB], a
xor a
ld [hSerialReceiveData], a
ldh [hSerialReceiveData], a
ld a, START_TRANSFER_EXTERNAL_CLOCK
ld [rSC], a
ldh [rSC], a
ld a, [wLinkTimeoutCounter]
dec a
ld [wLinkTimeoutCounter], a
jr z, .failedToEstablishConnection
ld a, ESTABLISH_CONNECTION_WITH_INTERNAL_CLOCK
ld [rSB], a
ldh [rSB], a
ld a, START_TRANSFER_INTERNAL_CLOCK
ld [rSC], a
ldh [rSC], a
call DelayFrame
jr .establishConnectionLoop
.establishedConnection
@ -65,7 +65,7 @@ CableClubNPC::
ld [hli], a
xor a
ld [hl], a
ld [hSerialReceivedNewData], a
ldh [hSerialReceivedNewData], a
ld [wSerialExchangeNybbleSendData], a
call Serial_SyncAndExchangeNybble
ld hl, wUnknownSerialCounter
@ -141,11 +141,11 @@ CableClubNPCMakingPreparationsText:
CloseLinkConnection:
call Delay3
ld a, CONNECTION_NOT_ESTABLISHED
ld [hSerialConnectionStatus], a
ldh [hSerialConnectionStatus], a
ld a, ESTABLISH_CONNECTION_WITH_EXTERNAL_CLOCK
ld [rSB], a
ldh [rSB], a
xor a
ld [hSerialReceiveData], a
ldh [hSerialReceiveData], a
ld a, START_TRANSFER_EXTERNAL_CLOCK
ld [rSC], a
ldh [rSC], a
ret