// File: rpavlik[P]edid-decode/parse-base-block.cpp
// Function: edid_state::list_established_timings()
void edid_state::list_established_timings()
{
	printf("Established Timings I & II, 'Byte' is the EDID address:\n\n");
	for (unsigned i = 0; i < ARRAY_SIZE(established_timings12); i++) {
		unsigned char dmt_id = established_timings12[i].dmt_id;
		const struct timings *t;
		char type[16];

		if (dmt_id) {
			sprintf(type, "DMT 0x%02x", dmt_id);
			t = find_dmt_id(dmt_id);
		} else {
			t = &established_timings12[i].t;
			sprintf(type, "%-8s", established_timings12[i].type);
		}
		printf("Byte 0x%02x, Bit %u: ", 0x23 + i / 8, 7 - i % 8);
		print_timings("", t, type, "", false, false);
	}
	printf("\nEstablished timings III, 'Byte' is the offset from the start of the descriptor:\n\n");
	for (unsigned i = 0; i < ARRAY_SIZE(established_timings3_dmt_ids); i++) {
		unsigned char dmt_id = established_timings3_dmt_ids[i];
		char type[16];

		sprintf(type, "DMT 0x%02x", dmt_id);
		printf("Byte 0x%02x, Bit %u: ", 6 + i / 8, 7 - i % 8);
		print_timings("", find_dmt_id(dmt_id), type, "", false, false);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
leaq 0x25155(%rip), %rdi     # 0x33890
movb $0x0, %al
callq 0x4050
movl $0x0, -0xc(%rbp)
movl -0xc(%rbp), %eax
cmpq $0x11, %rax
jae 0xe834
movl -0xc(%rbp), %eax
movl %eax, %ecx
leaq 0x3bfde(%rip), %rax     # 0x4a740
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movl (%rax), %eax
movb %al, -0xd(%rbp)
cmpb $0x0, -0xd(%rbp)
je 0xe799
leaq -0x30(%rbp), %rdi
movzbl -0xd(%rbp), %edx
leaq 0x21336(%rip), %rsi     # 0x2fab9
movb $0x0, %al
callq 0x40a0
movzbl -0xd(%rbp), %edi
callq 0xe6b0
movq %rax, -0x18(%rbp)
jmp 0xe7dd
movl -0xc(%rbp), %eax
movl %eax, %ecx
leaq 0x3bf9b(%rip), %rax     # 0x4a740
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
addq $0x4, %rax
movq %rax, -0x18(%rbp)
leaq -0x30(%rbp), %rdi
movl -0xc(%rbp), %eax
movl %eax, %ecx
leaq 0x3bf7c(%rip), %rax     # 0x4a740
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
movq 0x58(%rax), %rdx
leaq 0x250f4(%rip), %rsi     # 0x338ca
movb $0x0, %al
callq 0x40a0
movl -0xc(%rbp), %esi
shrl $0x3, %esi
addl $0x23, %esi
movl -0xc(%rbp), %eax
andl $0x7, %eax
movl $0x7, %edx
subl %eax, %edx
leaq 0x250d5(%rip), %rdi     # 0x338cf
movb $0x0, %al
callq 0x4050
movq -0x58(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq -0x30(%rbp), %rcx
leaq 0x216a5(%rip), %r8      # 0x2feb9
xorl %r9d, %r9d
movq %r8, %rsi
movl $0x0, (%rsp)
callq 0x50c0
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0xe749
leaq 0x250aa(%rip), %rdi     # 0x338e5
movb $0x0, %al
callq 0x4050
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpq $0x2c, %rax
jae 0xe8dd
movl -0x34(%rbp), %eax
movl %eax, %ecx
leaq 0x24fce(%rip), %rax     # 0x33830
movb (%rax,%rcx), %al
movb %al, -0x35(%rbp)
leaq -0x50(%rbp), %rdi
movzbl -0x35(%rbp), %edx
leaq 0x21242(%rip), %rsi     # 0x2fab9
movb $0x0, %al
callq 0x40a0
movl -0x34(%rbp), %esi
shrl $0x3, %esi
addl $0x6, %esi
movl -0x34(%rbp), %eax
andl $0x7, %eax
movl $0x7, %edx
subl %eax, %edx
leaq 0x25034(%rip), %rdi     # 0x338cf
movb $0x0, %al
callq 0x4050
movzbl -0x35(%rbp), %edi
callq 0xe6b0
movq -0x58(%rbp), %rdi
movq %rax, %rdx
leaq -0x50(%rbp), %rcx
leaq 0x215fc(%rip), %r8      # 0x2feb9
xorl %r9d, %r9d
movq %r8, %rsi
movl $0x0, (%rsp)
callq 0x50c0
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xe849
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)