// File: /workspace/github_cpp_makefile_star2_O2/rpavlik[P]edid-decode/parse-di-ext-block.cpp
// Function: edid_state::parse_display_device(unsigned char const*)
void edid_state::parse_display_device(const unsigned char *x)
{
	data_block = "Display Device";
	printf("  %s:\n", data_block.c_str());

	printf("    Sub-Pixel Layout: ");
	unsigned char v = x[0x0e];
	switch (v) {
	case 0x00: printf("Not defined\n"); break;
	case 0x01: printf("RGB\n"); break;
	case 0x02: printf("BGR\n"); break;
	case 0x03: printf("Quad Pixel - G at bottom left & top right\n"); break;
	case 0x04: printf("Quad Pixel - G at bottom right & top left\n"); break;
	default:
		   printf("Unknown (0x%02x)\n", v);
		   fail("Unknown Sub-Pixel Layout 0x%02x.\n", v);
		   break;
	}
	printf("    Sub-Pixel Configuration: ");
	v = x[0x0f];
	switch (v) {
	case 0x00: printf("Not defined\n"); break;
	case 0x01: printf("Delta (Tri-ad)\n"); break;
	case 0x02: printf("Stripe\n"); break;
	case 0x03: printf("Stripe Offset\n"); break;
	case 0x04: printf("Quad Pixel\n"); break;
	default:
		   printf("Unknown (0x%02x)\n", v);
		   fail("Unknown Sub-Pixel Configuration 0x%02x.\n", v);
		   break;
	}
	printf("    Sub-Pixel Shape: ");
	v = x[0x10];
	switch (v) {
	case 0x00: printf("Not defined\n"); break;
	case 0x01: printf("Round\n"); break;
	case 0x02: printf("Square\n"); break;
	case 0x03: printf("Rectangular\n"); break;
	case 0x04: printf("Oval\n"); break;
	case 0x05: printf("Elliptical\n"); break;
	default:
		   printf("Unknown (0x%02x)\n", v);
		   fail("Unknown Sub-Pixel Shape 0x%02x.\n", v);
		   break;
	}
	if (x[0x11])
		printf("    Horizontal Dot/Pixel Pitch: %.2f mm\n",
		       x[0x11] / 100.0);
	if (x[0x12])
		printf("    Vertical Dot/Pixel Pitch: %.2f mm\n",
		       x[0x12] / 100.0);
	v = x[0x13];
	printf("    Display Device %s a Fixed Pixel Format\n",
	       (v & 0x80) ? "has" : "does not have");
	printf("    View Direction: ");
	switch ((v & 0x60) >> 5) {
	case 0x00: printf("Not specified\n"); break;
	case 0x01: printf("Direct\n"); break;
	case 0x02: printf("Reflected\n"); break;
	case 0x03: printf("Direct & Reflected\n"); break;
	}
	printf("    Display Device uses %stransparent background\n",
	       (v & 0x10) ? "" : "non-");
	printf("    Physical Implementation: ");
	switch ((v & 0x0c) >> 2) {
	case 0x00: printf("Not specified\n"); break;
	case 0x01: printf("Large Image device for group viewing\n"); break;
	case 0x02: printf("Desktop or personal display\n"); break;
	case 0x03: printf("Eyepiece type personal display\n"); break;
	}
	printf("    Monitor/display does %ssupport DDC/CI\n",
	       (v & 0x02) ? "" : "not ");
	if (v & 0x01)
		fail("Bit 0 of byte 0x13 should be 0.\n");
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
addq $0x30, %rdi
leaq 0x13d67(%rip), %rsi     # 0x2bf24
callq 0x3460
movq 0x30(%r14), %rsi
leaq 0x6c3e(%rip), %rdi      # 0x1ee0b
xorl %eax, %eax
callq 0x3030
leaq 0x13d58(%rip), %rdi     # 0x2bf33
xorl %eax, %eax
callq 0x3030
movzbl 0xe(%rbx), %r14d
cmpq $0x4, %r14
ja 0x182c4
leaq 0x13824(%rip), %rax     # 0x2ba1c
movslq (%rax,%r14,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0xfb95(%rip), %rdi      # 0x27d9d
jmp 0x1822c
leaq 0x14c53(%rip), %rdi     # 0x2ce64
jmp 0x1822c
leaq 0x150a5(%rip), %rdi     # 0x2d2bf
jmp 0x1822c
leaq 0x14c6b(%rip), %rdi     # 0x2ce8e
jmp 0x1822c
leaq 0x12ae1(%rip), %rdi     # 0x2ad0d
callq 0x33b0
leaq 0x13d34(%rip), %rdi     # 0x2bf6c
xorl %eax, %eax
callq 0x3030
movzbl 0xf(%rbx), %r14d
cmpq $0x4, %r14
ja 0x182ed
leaq 0x137db(%rip), %rax     # 0x2ba30
movslq (%rax,%r14,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0xfb38(%rip), %rdi      # 0x27d9d
jmp 0x18289
leaq 0x14c4a(%rip), %rdi     # 0x2ceb8
jmp 0x18289
leaq 0x14c5a(%rip), %rdi     # 0x2ced1
jmp 0x18289
leaq 0x14c43(%rip), %rdi     # 0x2cec3
jmp 0x18289
leaq 0x14c4f(%rip), %rdi     # 0x2ced8
callq 0x33b0
leaq 0x13d1e(%rip), %rdi     # 0x2bfb3
xorl %eax, %eax
callq 0x3030
movzbl 0x10(%rbx), %r14d
cmpq $0x5, %r14
ja 0x18466
leaq 0x13792(%rip), %rax     # 0x2ba44
movslq (%rax,%r14,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0xfadb(%rip), %rdi      # 0x27d9d
jmp 0x18341
leaq 0x6c41(%rip), %rdi      # 0x1ef0c
movl %r14d, %esi
xorl %eax, %eax
callq 0x3030
leaq 0x13c6e(%rip), %rsi     # 0x2bf4a
xorl %edi, %edi
movl %r14d, %edx
xorl %eax, %eax
callq 0x362c
jmp 0x18231
leaq 0x6c18(%rip), %rdi      # 0x1ef0c
movl %r14d, %esi
xorl %eax, %eax
callq 0x3030
leaq 0x13c85(%rip), %rsi     # 0x2bf8a
xorl %edi, %edi
movl %r14d, %edx
xorl %eax, %eax
callq 0x362c
jmp 0x1828e
leaq 0x14bd5(%rip), %rdi     # 0x2cef2
jmp 0x18341
leaq 0x14bdd(%rip), %rdi     # 0x2cf03
jmp 0x18341
leaq 0x14bc8(%rip), %rdi     # 0x2cef7
jmp 0x18341
leaq 0x14bd2(%rip), %rdi     # 0x2cf0a
jmp 0x18341
leaq 0x14ba6(%rip), %rdi     # 0x2cee7
callq 0x33b0
movb 0x11(%rbx), %al
testb %al, %al
je 0x1836a
movzbl %al, %eax
cvtsi2sd %eax, %xmm0
divsd 0x1cc4(%rip), %xmm0     # 0x1a020
leaq 0x13c87(%rip), %rdi     # 0x2bfea
movb $0x1, %al
callq 0x3030
movb 0x12(%rbx), %al
testb %al, %al
je 0x1838e
movzbl %al, %eax
cvtsi2sd %eax, %xmm0
divsd 0x1ca0(%rip), %xmm0     # 0x1a020
leaq 0x13c8c(%rip), %rdi     # 0x2c013
movb $0x1, %al
callq 0x3030
movzbl 0x13(%rbx), %ebx
testb %bl, %bl
leaq 0x13ccf(%rip), %rax     # 0x2c06a
leaq 0x13cc4(%rip), %rsi     # 0x2c066
cmovnsq %rax, %rsi
leaq 0x13c8d(%rip), %rdi     # 0x2c03a
xorl %eax, %eax
callq 0x3030
leaq 0x13cbd(%rip), %rdi     # 0x2c078
xorl %eax, %eax
callq 0x3030
movl %ebx, %eax
shrl $0x3, %eax
andl $0xc, %eax
leaq 0x1371b(%rip), %rcx     # 0x2baec
movslq (%rax,%rcx), %rdi
addq %rcx, %rdi
callq 0x33b0
testb $0x10, %bl
leaq 0x6abf(%rip), %rsi      # 0x1eea6
leaq 0x289b(%rip), %r14      # 0x1ac89
cmovneq %r14, %rsi
leaq 0x13c94(%rip), %rdi     # 0x2c08d
xorl %eax, %eax
callq 0x3030
leaq 0x13cb8(%rip), %rdi     # 0x2c0bf
xorl %eax, %eax
callq 0x3030
movl %ebx, %eax
andl $0xc, %eax
leaq 0x136e2(%rip), %rcx     # 0x2bafc
movslq (%rax,%rcx), %rdi
addq %rcx, %rdi
callq 0x33b0
testb $0x2, %bl
leaq 0x13964(%rip), %rsi     # 0x2bd94
cmovneq %r14, %rsi
leaq 0x13ca2(%rip), %rdi     # 0x2c0dd
xorl %eax, %eax
callq 0x3030
testb $0x1, %bl
jne 0x1844f
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x13cb2(%rip), %rsi     # 0x2c108
xorl %edi, %edi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x362c
leaq 0x6a9f(%rip), %rdi      # 0x1ef0c
movl %r14d, %esi
xorl %eax, %eax
callq 0x3030
leaq 0x13b4b(%rip), %rsi     # 0x2bfc9
xorl %edi, %edi
movl %r14d, %edx
xorl %eax, %eax
callq 0x362c
jmp 0x18346
nop