Newer
Older
AMI-Aptio-BIOS-Reversed / AmiModulePkg / KbcEmulation / KbcEmulDxe / KbcEmulDxe_6E8.c
@Ajax Dong Ajax Dong 2 days ago 1 KB Restructure the repo
// Original function: sub_6E8
// Address: 0x6E8
// Signature: char __fastcall sub_6E8(char a1)

char __fastcall sub_6E8(char a1)
{
  unsigned __int16 *v2; // rdi
  __int64 n2; // rsi
  __int64 v4; // rdx
  unsigned __int16 v5; // bx
  __int64 v6; // rbp
  __int64 n43; // rcx

  v2 = (unsigned __int16 *)&unk_11E8; /*0x704*/
  n2 = 2; /*0x70b*/
  do /*0x79e*/
  {
    if ( (unsigned __int8)sub_9A4(v2) ) /*0x713*/
    {
      LOBYTE(v4) = *((_BYTE *)v2 + 5); /*0x71c*/
      v5 = sub_A74(*v2, v4); /*0x72e*/
      if ( (v5 & (unsigned __int16)n43) == n43 && (v5 & (unsigned __int16)word_11E0) != 0 ) /*0x743*/
        word_1250 |= v5; /*0x745*/
      v6 = (*(__int64 (__fastcall **)(__int64))(BootServices_0 + 24))(31); /*0x762*/
      sub_9EC((unsigned __int16)(v5 | word_11E0)); /*0x768*/
      n43 = (unsigned __int16)n43; /*0x76d*/
      if ( a1 ) /*0x777*/
        LOWORD(n43) = v5 | n43; /*0x779*/
      else
        LOWORD(n43) = v5 & ~n43; /*0x781*/
      sub_9EC(n43); /*0x784*/
      (*(void (__fastcall **)(__int64))(BootServices_0 + 32))(v6); /*0x793*/
    }
    v2 += 3; /*0x796*/
    --n2; /*0x79a*/
  }
  while ( n2 ); /*0x79e*/
  return 1; /*0x7ba*/
}