Newer
Older
AMI-Aptio-BIOS-Reversed / EarlyVideoPei / VgaDisplayProgram.c
@Ajax Dong Ajax Dong 2 days ago 2 KB Init
__int16 __fastcall VgaDisplayProgram(int a1, __int16 n290, int a3)
{
  int v4; // ecx
  int v5; // ebp
  char *dst; // edi
  int n64; // ebx
  char *dst_6; // ecx
  int v9; // edx
  int v10; // esi
  __int16 n290_1; // ax
  int *v12; // ebp
  int v13; // esi
  int v14; // eax
  char *dst_5; // [esp+14h] [ebp-28h]
  char *dst_1; // [esp+18h] [ebp-24h]
  int v19; // [esp+18h] [ebp-24h]
  char *dst_2; // [esp+1Ch] [ebp-20h]
  int v21; // [esp+1Ch] [ebp-20h]
  char *dst_3; // [esp+20h] [ebp-1Ch]
  int v23; // [esp+20h] [ebp-1Ch]
  int v24; // [esp+24h] [ebp-18h]
  int v25; // [esp+28h] [ebp-14h]
  int v26; // [esp+2Ch] [ebp-10h]
  int v27; // [esp+30h] [ebp-Ch]
  char *dst_4; // [esp+40h] [ebp+4h]

  v4 = *(_DWORD *)(a3 + 70);
  v5 = *(_DWORD *)(a3 + 14);
  dst = *(char **)(a3 + 34);
  v26 = *(_DWORD *)(a3 + 22);
  dst_1 = *(char **)(a3 + 38);
  dst_2 = *(char **)(a3 + 42);
  dst_3 = *(char **)(a3 + 46);
  dst_4 = *(char **)(a3 + 50);
  dst_5 = *(char **)(a3 + 54);
  v25 = v4;
  v24 = *(_DWORD *)(a3 + 66);
  VgaCrtcProgramAll(v5, dst, (_WORD *)(a3 + 74), v24, 1, a3);
  if ( n290 == 290 )
  {
    VgaCrtcProgramAll(v5, dst_1, (_WORD *)(a3 + 74), v24, 1, a3);
    VgaCrtcProgramAll(v5, dst_2, (_WORD *)(a3 + 74), v24, 1, a3);
    VgaCrtcProgramAll(v5, dst_3, (_WORD *)(a3 + 74), v24, 1, a3);
  }
  n64 = 0;
  VgaCrtcProgramAll(v26, dst_4, (_WORD *)(a3 + 76), v25, 0, a3);
  VgaCrtcProgramAll(v26, dst_5, (_WORD *)(a3 + 78), v25, 0, a3);
  dst_6 = dst_4;
  v19 = dst_1 - dst;
  v9 = dst_5 - dst_4;
  v21 = dst_2 - dst;
  v10 = dst_4 - dst;
  n290_1 = n290;
  v12 = (int *)(a1 + 512);
  v23 = dst_3 - dst;
  v27 = dst_4 - dst;
  do
  {
    if ( n290_1 == 273 )
    {
      *(v12 - 128) = VgaDisplayEnableColor(*(_WORD *)dst, *(_WORD *)&dst[v10], *(_WORD *)&dst[v10 + v9]);
    }
    else
    {
      if ( n290_1 != 290 )
        goto LABEL_9;
      v13 = (n64 >> 1) & 0x7FFB;
      *(v12 - 128) = VgaDisplayEnableColor(*(_WORD *)dst, *(_WORD *)&dst_6[2 * v13], *(_WORD *)&dst_5[2 * v13]);
      *(v12 - 64) = VgaDisplayEnableColor(
                      *(_WORD *)&dst[v19],
                      *(_WORD *)&dst_4[2 * v13 + 8],
                      *(_WORD *)&dst_5[2 * v13 + 8]);
      *v12 = VgaDisplayEnableColor(*(_WORD *)&dst[v21], *(_WORD *)&dst_4[2 * v13 + 64], *(_WORD *)&dst_5[2 * v13 + 64]);
      v14 = VgaDisplayEnableColor(*(_WORD *)&dst[v23], *(_WORD *)&dst_4[2 * v13 + 72], *(_WORD *)&dst_5[2 * v13 + 72]);
      v10 = v27;
      v12[64] = v14;
    }
    v9 = dst_5 - dst_4;
    dst_6 = dst_4;
    n290_1 = n290;
LABEL_9:
    ++n64;
    ++v12;
    dst += 2;
  }
  while ( n64 < 64 );
  return n290_1;
}