diff options
Diffstat (limited to 'home/serial.asm')
-rw-r--r-- | home/serial.asm | 39 |
1 files changed, 13 insertions, 26 deletions
diff --git a/home/serial.asm b/home/serial.asm index c32e559dd..663f74d3b 100644 --- a/home/serial.asm +++ b/home/serial.asm @@ -1,4 +1,4 @@ -Serial:: ; 6ef +Serial:: ; The serial interrupt. push af @@ -87,9 +87,8 @@ Serial:: ; 6ef pop bc pop af reti -; 75f -Serial_ExchangeBytes:: ; 75f +Serial_ExchangeBytes:: ld a, $1 ld [hSerialIgnoringInitialData], a .loop @@ -123,9 +122,8 @@ Serial_ExchangeBytes:: ; 75f or c jr nz, .loop ret -; 78a -Serial_ExchangeByte:: ; 78a +Serial_ExchangeByte:: .loop xor a ld [hSerialReceivedNewData], a @@ -232,27 +230,24 @@ Serial_ExchangeByte:: ; 78a dec a jr nz, .delay_cycles ret -; 82b -CheckwLinkTimeoutFramesNonzero:: ; 82b +CheckwLinkTimeoutFramesNonzero:: push hl ld hl, wLinkTimeoutFrames ld a, [hli] or [hl] pop hl ret -; 833 -SerialDisconnected:: ; 833 +SerialDisconnected:: dec a ; a is always 0 when this is called ld [wLinkTimeoutFrames], a ld [wLinkTimeoutFrames + 1], a ret -; 83b ; This is used to exchange the button press and selected menu item on the link menu. ; The data is sent thrice and read twice to increase reliability. -Serial_ExchangeLinkMenuSelection:: ; 83b +Serial_ExchangeLinkMenuSelection:: ld hl, wPlayerLinkAction ld de, wOtherPlayerLinkMode ld c, 2 @@ -276,24 +271,21 @@ Serial_ExchangeLinkMenuSelection:: ; 83b dec c jr nz, .asm_847 ret -; 862 -Serial_PrintWaitingTextAndSyncAndExchangeNybble:: ; 862 +Serial_PrintWaitingTextAndSyncAndExchangeNybble:: call LoadTileMapToTempTileMap callfar PlaceWaitingText call WaitLinkTransfer jp Call_LoadTempTileMapToTileMap -; 871 -Serial_SyncAndExchangeNybble:: ; 871 +Serial_SyncAndExchangeNybble:: call LoadTileMapToTempTileMap callfar PlaceWaitingText jp WaitLinkTransfer -; 87d ; One "giant" leap for machinekind -WaitLinkTransfer:: ; 87d +WaitLinkTransfer:: ld a, $ff ld [wOtherPlayerLinkAction], a .loop @@ -338,9 +330,8 @@ WaitLinkTransfer:: ; 87d ld a, [wOtherPlayerLinkAction] ld [wOtherPlayerLinkMode], a ret -; 8c1 -LinkTransfer:: ; 8c1 +LinkTransfer:: push bc ld b, SERIAL_TIMECAPSULE ld a, [wLinkMode] @@ -370,9 +361,8 @@ LinkTransfer:: ; 8c1 call .Receive pop bc ret -; 8f3 -.Receive: ; 8f3 +.Receive: ld a, [hSerialReceive] ld [wOtherPlayerLinkMode], a and $f0 @@ -384,9 +374,8 @@ LinkTransfer:: ; 8c1 and $f ld [wOtherPlayerLinkAction], a ret -; 908 -LinkDataReceived:: ; 908 +LinkDataReceived:: ; Let the other system know that the data has been received. xor a ld [hSerialSend], a @@ -398,9 +387,8 @@ LinkDataReceived:: ; 908 ld a, (1 << rSC_ON) | 1 ld [rSC], a ret -; 919 -Unreferenced_Function919:: ; 919 +Unreferenced_Function919:: ld a, [wLinkMode] and a ret nz @@ -413,4 +401,3 @@ Unreferenced_Function919:: ; 919 ld a, 1 << rSC_ON ld [rSC], a ret -; 92e |