// File: /workspace/github_cpp_makefile_star2_O2/rpavlik[P]edid-decode/parse-displayid-block.cpp
// Function: edid_state::parse_displayid_display_device(unsigned char const*)
void edid_state::parse_displayid_display_device(const unsigned char *x)
{
	check_displayid_datablock_revision(x[1]);

	if (!check_displayid_datablock_length(x, 13, 13))
		return;

	printf("    Display Device Technology: ");
	switch (x[3]) {
	case 0x00: printf("Monochrome CRT\n"); break;
	case 0x01: printf("Standard tricolor CRT\n"); break;
	case 0x02: printf("Other/undefined CRT\n"); break;
	case 0x10: printf("Passive matrix TN\n"); break;
	case 0x11: printf("Passive matrix cholesteric LC\n"); break;
	case 0x12: printf("Passive matrix ferroelectric LC\n"); break;
	case 0x13: printf("Other passive matrix LC type\n"); break;
	case 0x14: printf("Active-matrix TN\n"); break;
	case 0x15: printf("Active-matrix IPS (all types)\n"); break;
	case 0x16: printf("Active-matrix VA (all types)\n"); break;
	case 0x17: printf("Active-matrix OCB\n"); break;
	case 0x18: printf("Active-matrix ferroelectric\n"); break;
	case 0x1f: printf("Other LC type\n"); break;
	case 0x20: printf("DC plasma\n"); break;
	case 0x21: printf("AC plasma\n"); break;
	}
	switch (x[3] & 0xf0) {
	case 0x30: printf("Electroluminescent, except OEL/OLED\n"); break;
	case 0x40: printf("Inorganic LED\n"); break;
	case 0x50: printf("Organic LED/OEL\n"); break;
	case 0x60: printf("FED or sim. \"cold-cathode,\" phosphor-based types\n"); break;
	case 0x70: printf("Electrophoretic\n"); break;
	case 0x80: printf("Electrochromic\n"); break;
	case 0x90: printf("Electromechanical\n"); break;
	case 0xa0: printf("Electrowetting\n"); break;
	case 0xf0: printf("Other type not defined here\n"); break;
	}
	printf("    Display operating mode: ");
	switch (x[4] >> 4) {
	case 0x00: printf("Direct-view reflective, ambient light\n"); break;
	case 0x01: printf("Direct-view reflective, ambient light, also has light source\n"); break;
	case 0x02: printf("Direct-view reflective, uses light source\n"); break;
	case 0x03: printf("Direct-view transmissive, ambient light\n"); break;
	case 0x04: printf("Direct-view transmissive, ambient light, also has light source\n"); break;
	case 0x05: printf("Direct-view transmissive, uses light source\n"); break;
	case 0x06: printf("Direct-view emissive\n"); break;
	case 0x07: printf("Direct-view transflective, backlight off by default\n"); break;
	case 0x08: printf("Direct-view transflective, backlight on by default\n"); break;
	case 0x09: printf("Transparent display, ambient light\n"); break;
	case 0x0a: printf("Transparent emissive display\n"); break;
	case 0x0b: printf("Projection device using reflective light modulator\n"); break;
	case 0x0c: printf("Projection device using transmissive light modulator\n"); break;
	case 0x0d: printf("Projection device using emissive image transducer\n"); break;
	default: printf("Reserved\n"); break;
	}
	if (x[4] & 0x08)
		printf("    The backlight may be switched on and off\n");
	if (x[4] & 0x04)
		printf("    The backlight's intensity can be controlled\n");
	unsigned w = x[5] | (x[6] << 8);
	unsigned h = x[7] | (x[8] << 8);
	if (w && h) {
		printf("    Display native pixel format: %ux%u\n", w + 1, h + 1);
		dispid.native_width = w + 1;
		dispid.native_height = h + 1;
	} else if (w || h) {
		fail("Invalid Native Pixel Format %ux%u.\n", w, h);
	}
	printf("    Aspect ratio and orientation:\n");
	printf("      Aspect Ratio: %.2f\n", (100 + x[9]) / 100.0);
	unsigned char v = x[0x0a];
	printf("      Default Orientation: ");
	switch ((v & 0xc0) >> 6) {
	case 0x00: printf("Landscape\n"); break;
	case 0x01: printf("Portrait\n"); break;
	case 0x02: printf("Not Fixed\n"); break;
	case 0x03: printf("Undefined\n"); break;
	}
	printf("      Rotation Capability: ");
	switch ((v & 0x30) >> 4) {
	case 0x00: printf("None\n"); break;
	case 0x01: printf("Can rotate 90 degrees clockwise\n"); break;
	case 0x02: printf("Can rotate 90 degrees counterclockwise\n"); break;
	case 0x03: printf("Can rotate 90 degrees in either direction)\n"); break;
	}
	printf("      Zero Pixel Location: ");
	switch ((v & 0x0c) >> 2) {
	case 0x00: printf("Upper Left\n"); break;
	case 0x01: printf("Upper Right\n"); break;
	case 0x02: printf("Lower Left\n"); break;
	case 0x03: printf("Lower Right\n"); break;
	}
	printf("      Scan Direction: ");
	switch (v & 0x03) {
	case 0x00: printf("Not defined\n"); break;
	case 0x01: printf("Fast Scan is on the Major (Long) Axis and Slow Scan is on the Minor Axis\n"); break;
	case 0x02: printf("Fast Scan is on the Minor (Short) Axis and Slow Scan is on the Major Axis\n"); break;
	case 0x03: printf("Reserved\n");
		   fail("Scan Direction used the reserved value 0x03.\n");
		   break;
	}
	printf("    Sub-pixel layout/configuration/shape: ");
	switch (x[0x0b]) {
	case 0x00: printf("Not defined\n"); break;
	case 0x01: printf("RGB vertical stripes\n"); break;
	case 0x02: printf("RGB horizontal stripes\n"); break;
	case 0x03: printf("Vertical stripes using primary order\n"); break;
	case 0x04: printf("Horizontal stripes using primary order\n"); break;
	case 0x05: printf("Quad sub-pixels, red at top left\n"); break;
	case 0x06: printf("Quad sub-pixels, red at bottom left\n"); break;
	case 0x07: printf("Delta (triad) RGB sub-pixels\n"); break;
	case 0x08: printf("Mosaic\n"); break;
	case 0x09: printf("Quad sub-pixels, RGB + 1 additional color\n"); break;
	case 0x0a: printf("Five sub-pixels, RGB + 2 additional colors\n"); break;
	case 0x0b: printf("Six sub-pixels, RGB + 3 additional colors\n"); break;
	case 0x0c: printf("Clairvoyante, Inc. PenTile Matrix (tm) layout\n"); break;
	default: printf("Reserved\n"); break;
	}
	printf("    Horizontal and vertical dot/pixel pitch: %.2fx%.2f mm\n",
	       (double)(x[0x0c]) / 100.0, (double)(x[0x0d]) / 100.0);
	printf("    Color bit depth: %u\n", x[0x0e] & 0x0f);
	v = x[0x0f];
	printf("    Response time for %s transition: %u ms\n",
	       (v & 0x80) ? "white-to-black" : "black-to-white", v & 0x7f);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movzbl 0x1(%rsi), %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x123f0
pushq $0xd
popq %rdx
movq %rbx, %rdi
movl %edx, %esi
xorl %ecx, %ecx
callq 0x126fe
testb %al, %al
je 0x13979
leaq 0x1572d(%rip), %rdi     # 0x29015
xorl %eax, %eax
callq 0x3030
movzbl 0x3(%rbx), %eax
cmpq $0x21, %rax
ja 0x1391c
movabsq $0x381ff0007, %rcx      # imm = 0x381FF0007
btq %rax, %rcx
jae 0x1391c
leaq 0x150d0(%rip), %rcx     # 0x289e0
movslq (%rcx,%rax,4), %rdi
addq %rcx, %rdi
callq 0x33b0
movzbl 0x3(%rbx), %eax
addl $-0x30, %eax
cmpl $0xcf, %eax
ja 0x1394c
shrl $0x4, %eax
movl $0x10ff, %ecx           # imm = 0x10FF
btl %eax, %ecx
jae 0x1394c
movl %eax, %eax
leaq 0x15128(%rip), %rcx     # 0x28a68
movslq (%rcx,%rax,4), %rdi
addq %rcx, %rdi
callq 0x33b0
leaq 0x156e2(%rip), %rdi     # 0x29035
xorl %eax, %eax
callq 0x3030
movzbl 0x4(%rbx), %eax
cmpq $0xdf, %rax
ja 0x13984
shrl $0x4, %eax
leaq 0x1512c(%rip), %rcx     # 0x28a9c
movslq (%rcx,%rax,4), %rdi
addq %rcx, %rdi
jmp 0x1398b
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x17c35(%rip), %rdi     # 0x2b5c0
callq 0x33b0
movb 0x4(%rbx), %al
testb $0x8, %al
je 0x139a6
leaq 0x17903(%rip), %rdi     # 0x2b2a1
callq 0x33b0
movb 0x4(%rbx), %al
testb $0x4, %al
je 0x139b6
leaq 0x1791d(%rip), %rdi     # 0x2b2ce
callq 0x33b0
movzwl 0x5(%rbx), %r15d
movzwl 0x7(%rbx), %ebp
testl %r15d, %r15d
je 0x139f0
testl %ebp, %ebp
je 0x139f0
incl %r15d
incl %ebp
leaq 0x1567e(%rip), %rdi     # 0x29052
movl %r15d, %esi
movl %ebp, %edx
xorl %eax, %eax
callq 0x3030
movl %r15d, 0x940(%r14)
movl %ebp, 0x944(%r14)
jmp 0x13a0c
movl %r15d, %eax
orl %ebp, %eax
je 0x13a0c
leaq 0x1567c(%rip), %rsi     # 0x2907a
xorl %edi, %edi
movl %r15d, %edx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x362c
leaq 0x178eb(%rip), %rdi     # 0x2b2fe
callq 0x33b0
movzbl 0x9(%rbx), %eax
addl $0x64, %eax
cvtsi2sd %eax, %xmm0
divsd 0x65f5(%rip), %xmm0     # 0x1a020
leaq 0x1566c(%rip), %rdi     # 0x2909e
movb $0x1, %al
callq 0x3030
movzbl 0xa(%rbx), %r14d
leaq 0x15673(%rip), %rdi     # 0x290b8
xorl %eax, %eax
callq 0x3030
movl %r14d, %eax
shrl $0x6, %eax
leaq 0x1507b(%rip), %rcx     # 0x28ad4
movslq (%rcx,%rax,4), %rdi
addq %rcx, %rdi
callq 0x33b0
leaq 0x15668(%rip), %rdi     # 0x290d4
xorl %eax, %eax
callq 0x3030
movl %r14d, %eax
shrl $0x2, %eax
andl $0xc, %eax
leaq 0x150a5(%rip), %rcx     # 0x28b28
movslq (%rax,%rcx), %rdi
addq %rcx, %rdi
callq 0x33b0
leaq 0x1565a(%rip), %rdi     # 0x290f0
xorl %eax, %eax
callq 0x3030
movl %r14d, %eax
andl $0xc, %eax
leaq 0x1503a(%rip), %rcx     # 0x28ae4
movslq (%rax,%rcx), %rdi
addq %rcx, %rdi
callq 0x33b0
leaq 0x1564f(%rip), %rdi     # 0x2910c
xorl %eax, %eax
callq 0x3030
andl $0x3, %r14d
leaq 0x14bf1(%rip), %rax     # 0x286c0
movslq (%rax,%r14,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0x142be(%rip), %rdi     # 0x27d9d
jmp 0x13b0f
leaq 0x14094(%rip), %rdi     # 0x27b7c
jmp 0x13b0f
leaq 0x17acf(%rip), %rdi     # 0x2b5c0
callq 0x33b0
leaq 0x127b2(%rip), %rsi     # 0x262af
xorl %edi, %edi
xorl %eax, %eax
callq 0x362c
jmp 0x13b14
leaq 0x140b7(%rip), %rdi     # 0x27bc6
callq 0x33b0
leaq 0x15608(%rip), %rdi     # 0x29123
xorl %eax, %eax
callq 0x3030
movzbl 0xb(%rbx), %eax
cmpq $0xc, %rax
ja 0x13b3c
leaq 0x14fc1(%rip), %rcx     # 0x28af4
movslq (%rcx,%rax,4), %rdi
addq %rcx, %rdi
jmp 0x13b43
leaq 0x17a7d(%rip), %rdi     # 0x2b5c0
callq 0x33b0
movzbl 0xc(%rbx), %eax
cvtsi2sd %eax, %xmm0
movsd 0x64c8(%rip), %xmm2     # 0x1a020
divsd %xmm2, %xmm0
movzbl 0xd(%rbx), %eax
cvtsi2sd %eax, %xmm1
divsd %xmm2, %xmm1
leaq 0x155df(%rip), %rdi     # 0x2914e
movb $0x2, %al
callq 0x3030
movzbl 0xe(%rbx), %esi
andl $0xf, %esi
leaq 0x15605(%rip), %rdi     # 0x29189
xorl %eax, %eax
callq 0x3030
movzbl 0xf(%rbx), %edx
testb %dl, %dl
leaq 0x15645(%rip), %rax     # 0x291dd
leaq 0x1562f(%rip), %rsi     # 0x291ce
cmovnsq %rax, %rsi
andl $0x7f, %edx
leaq 0x155f5(%rip), %rdi     # 0x291a2
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3030