// File: /workspace/github_c_makefile_star2_O0/simh[P]simtools/converters/fsio/os8.c
// Function: info
static void info(
  struct mountedFS *mount,
  uint8_t unit
)
{
  struct OS8data *data = &mount->os8data;
  unsigned int dirblk = OS8_DSSTART;

  printf("\n%s%o:\n\n", mount->name, unit);

  do {
    uint16_t i, entrysz, entries, extra, startblk, off = OS8_DH_SIZE;

    if (os8ReadBlock(mount, unit, dirblk, NULL) == 0)
      return;

    entrysz = OS8_DI_SIZE + (-os8SXT(le16toh(data->buf[OS8_DH_EXTRA])));
    entries = os8Neg(le16toh(data->buf[OS8_DH_ENTRIES]));
    extra = os8Neg(le16toh(data->buf[OS8_DH_EXTRA]));

    startblk = os8Word(le16toh(data->buf[OS8_DH_START]));

    printf("\nDirectory Segment %d:\n\n", dirblk);
    printf(" File  Type  Length    Date       Disk Region\n\n");

    for (i = 0; i < entries; i++) {
      char temp1[16], temp2[16];
      uint16_t length;

      if (os8Word(le16toh(data->buf[off + OS8_DI_FNAME1])) != 0) {
        uint16_t dateval = 0;

        length = os8Neg(le16toh(data->buf[off + extra + OS8_DI_LENGTH]));
        if (extra != 0)
          dateval = os8Word(le16toh(data->buf[off + OS8_DI_DATE]));

        printf("%s    %4hu  %s    %4d - %4d\n",
               os8FileName(mount, off, temp1), length,
               os8Date(dateval, temp2), startblk, startblk + length - 1);

        off += entrysz;
      } else {
        length = os8Neg(le16toh(data->buf[off + OS8_ED_LENGTH]));

        printf("<EMPTY>      %4hu                 %4d - %4d\n",
               os8Neg(le16toh(data->buf[off + OS8_ED_LENGTH])),
               startblk, startblk + length - 1);

        off += OS8_ED_SIZE;
      }
      startblk += length;
    }

    dirblk = os8Word(le16toh(data->buf[OS8_DH_NEXT]));
  } while (dirblk != 0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movb %sil, %al
movq %rdi, -0x8(%rbp)
movb %al, -0x9(%rbp)
movq -0x8(%rbp), %rax
addq $0x48, %rax
movq %rax, -0x18(%rbp)
movl $0x1, -0x1c(%rbp)
movq -0x8(%rbp), %rsi
addq $0x8, %rsi
movzbl -0x9(%rbp), %edx
leaq 0x3c1d(%rip), %rdi      # 0x1aab5
movb $0x0, %al
callq 0x3160
movw $0x5, -0x28(%rbp)
movq -0x8(%rbp), %rdi
movb -0x9(%rbp), %al
movl -0x1c(%rbp), %edx
xorl %ecx, %ecx
movzbl %al, %esi
callq 0x132f0
cmpl $0x0, %eax
jne 0x16ec3
jmp 0x17110
movq -0x18(%rbp), %rax
movzwl 0x1c(%rax), %edi
callq 0x14890
movzwl %ax, %edi
callq 0x148b0
movzwl %ax, %ecx
xorl %eax, %eax
subl %ecx, %eax
addl $0x5, %eax
movw %ax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movzwl 0x14(%rax), %edi
callq 0x14890
movzwl %ax, %edi
callq 0x14860
movw %ax, -0x22(%rbp)
movq -0x18(%rbp), %rax
movzwl 0x1c(%rax), %edi
callq 0x14890
movzwl %ax, %edi
callq 0x14860
movw %ax, -0x24(%rbp)
movq -0x18(%rbp), %rax
movzwl 0x16(%rax), %edi
callq 0x14890
movzwl %ax, %edi
callq 0x14f90
movw %ax, -0x26(%rbp)
movl -0x1c(%rbp), %esi
leaq 0x3b83(%rip), %rdi      # 0x1aabe
movb $0x0, %al
callq 0x3160
leaq 0x3b8e(%rip), %rdi      # 0x1aad7
movb $0x0, %al
callq 0x3160
movw $0x0, -0x1e(%rbp)
movzwl -0x1e(%rbp), %eax
movzwl -0x22(%rbp), %ecx
cmpl %ecx, %eax
jge 0x170eb
movq -0x18(%rbp), %rax
movzwl -0x28(%rbp), %ecx
addl $0x0, %ecx
movslq %ecx, %rcx
movzwl 0x14(%rax,%rcx,2), %edi
callq 0x14890
movzwl %ax, %edi
callq 0x14f90
movzwl %ax, %eax
cmpl $0x0, %eax
je 0x1705b
movw $0x0, -0x54(%rbp)
movq -0x18(%rbp), %rax
movzwl -0x28(%rbp), %ecx
movzwl -0x24(%rbp), %edx
addl %edx, %ecx
addl $0x4, %ecx
movslq %ecx, %rcx
movzwl 0x14(%rax,%rcx,2), %edi
callq 0x14890
movzwl %ax, %edi
callq 0x14860
movw %ax, -0x52(%rbp)
movzwl -0x24(%rbp), %eax
cmpl $0x0, %eax
je 0x16fef
movq -0x18(%rbp), %rax
movzwl -0x28(%rbp), %ecx
addl $0x4, %ecx
movslq %ecx, %rcx
movzwl 0x14(%rax,%rcx,2), %edi
callq 0x14890
movzwl %ax, %edi
callq 0x14f90
movw %ax, -0x54(%rbp)
movq -0x8(%rbp), %rdi
movw -0x28(%rbp), %ax
leaq -0x40(%rbp), %rdx
movzwl %ax, %esi
callq 0x17120
movq %rax, -0x60(%rbp)
movzwl -0x52(%rbp), %eax
movl %eax, -0x58(%rbp)
movw -0x54(%rbp), %ax
leaq -0x50(%rbp), %rsi
movzwl %ax, %edi
callq 0x172d0
movq -0x60(%rbp), %rsi
movl -0x58(%rbp), %edx
movq %rax, %rcx
movzwl -0x26(%rbp), %r8d
movzwl -0x26(%rbp), %r9d
movzwl -0x52(%rbp), %eax
addl %eax, %r9d
subl $0x1, %r9d
leaq 0x3ac3(%rip), %rdi      # 0x1ab07
movb $0x0, %al
callq 0x3160
movzwl -0x20(%rbp), %ecx
movzwl -0x28(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x28(%rbp)
jmp 0x170cc
movq -0x18(%rbp), %rax
movzwl -0x28(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movzwl 0x14(%rax,%rcx,2), %edi
callq 0x14890
movzwl %ax, %edi
callq 0x14860
movw %ax, -0x52(%rbp)
movq -0x18(%rbp), %rax
movzwl -0x28(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movzwl 0x14(%rax,%rcx,2), %edi
callq 0x14890
movzwl %ax, %edi
callq 0x14860
movzwl %ax, %esi
movzwl -0x26(%rbp), %edx
movzwl -0x26(%rbp), %ecx
movzwl -0x52(%rbp), %eax
addl %eax, %ecx
subl $0x1, %ecx
leaq 0x3a6a(%rip), %rdi      # 0x1ab24
movb $0x0, %al
callq 0x3160
movzwl -0x28(%rbp), %eax
addl $0x2, %eax
movw %ax, -0x28(%rbp)
movzwl -0x52(%rbp), %ecx
movzwl -0x26(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x26(%rbp)
movw -0x1e(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x1e(%rbp)
jmp 0x16f56
movq -0x18(%rbp), %rax
movzwl 0x18(%rax), %edi
callq 0x14890
movzwl %ax, %edi
callq 0x14f90
movzwl %ax, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x16e9f
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)