reset buffers

This commit is contained in:
PikalaxALT 2017-11-16 22:13:42 -05:00
parent 2fd6aad25a
commit cc37d7e15b
2 changed files with 40 additions and 98 deletions

View File

@ -5,104 +5,6 @@
.text
thumb_func_start sub_800BDFC
sub_800BDFC: @ 800BDFC
push {r4-r6,lr}
ldr r1, =gLink
ldr r2, =0x00000339
adds r0, r1, r2
movs r2, 0
strb r2, [r0]
movs r3, 0xCE
lsls r3, 2
adds r0, r1, r3
strb r2, [r0]
movs r0, 0
movs r6, 0x64
adds r5, r1, 0
adds r5, 0x18
ldr r4, =0x0000efff
_0800BE1A:
movs r2, 0
adds r1, r0, 0x1
adds r3, r0, 0
muls r3, r6
_0800BE22:
lsls r0, r2, 1
adds r0, r3
adds r0, r5
strh r4, [r0]
adds r0, r2, 0x1
lsls r0, 24
lsrs r2, r0, 24
cmp r2, 0x31
bls _0800BE22
lsls r0, r1, 24
lsrs r0, 24
cmp r0, 0x7
bls _0800BE1A
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_800BDFC
thumb_func_start sub_800BE50
sub_800BE50: @ 800BE50
push {r4-r7,lr}
ldr r1, =gLink
ldr r2, =0x00000fbd
adds r0, r1, r2
movs r2, 0
strb r2, [r0]
ldr r3, =0x00000fbc
adds r0, r1, r3
strb r2, [r0]
movs r0, 0x64
mov r12, r0
movs r3, 0xCF
lsls r3, 2
adds r7, r1, r3
ldr r6, =0x0000efff
_0800BE6E:
movs r3, 0
lsls r0, r2, 1
adds r5, r2, 0x1
adds r0, r2
lsls r0, 3
adds r0, r2
lsls r4, r0, 5
_0800BE7C:
movs r2, 0
adds r1, r3, 0x1
mov r0, r12
muls r0, r3
adds r3, r0, 0
_0800BE86:
lsls r0, r2, 1
adds r0, r3
adds r0, r4
adds r0, r7
strh r6, [r0]
adds r0, r2, 0x1
lsls r0, 24
lsrs r2, r0, 24
cmp r2, 0x31
bls _0800BE86
lsls r0, r1, 24
lsrs r3, r0, 24
cmp r3, 0x7
bls _0800BE7C
lsls r0, r5, 24
lsrs r2, r0, 24
cmp r2, 0x3
bls _0800BE6E
pop {r4-r7}
pop {r0}
bx r0
.pool
thumb_func_end sub_800BE50
// RFU; bss indicates that no file boundary exists here
thumb_func_start sub_800BEC0

View File

@ -1771,6 +1771,8 @@ static void CB2_PrintErrorMessage(void)
}
}
// TODO: there might be a file boundary here, let's name it
bool8 GetSioMultiSI(void)
{
return (REG_SIOCNT & 0x04) != 0;
@ -1940,6 +1942,8 @@ void ResetSerial(void)
DisableSerial();
}
// link_main1.c
u32 LinkMain1(u8 *shouldAdvanceLinkState, u16 *sendCmd, u16 (*recvCmds)[CMD_LENGTH])
{
u32 retVal;
@ -2396,3 +2400,39 @@ static void SendRecvDone(void)
REG_TM3CNT_H |= TIMER_ENABLE;
}
}
void ResetSendBuffer(void)
{
u8 i;
u8 j;
gLink.sendQueue.count = 0;
gLink.sendQueue.pos = 0;
for (i = 0; i < CMD_LENGTH; i++)
{
for (j = 0; j < QUEUE_CAPACITY; j++)
{
gLink.sendQueue.data[i][j] = 0xEFFF;
}
}
}
void ResetRecvBuffer(void)
{
u8 i;
u8 j;
u8 k;
gLink.recvQueue.count = 0;
gLink.recvQueue.pos = 0;
for (i = 0; i < MAX_LINK_PLAYERS; i++)
{
for (j = 0; j < CMD_LENGTH; j++)
{
for (k = 0; k < QUEUE_CAPACITY; k++)
{
gLink.recvQueue.data[i][j][k] = 0xEFFF;
}
}
}
}