show_biostbl proc far
               ; ES:DI
               mov  ax, word ptr es:[di+0]
               call putnum
               _echo ' '
               xor  ax, ax
               mov  al, byte ptr es:[di+2]
               call putnum
               _echo ' '
               mov  ax, word ptr es:[di+3]
               call putnum
               _echo ' '
               mov  ax, word ptr es:[di+5]
               call putnum
               _echo ' '
               _echo 'E'
               _echo 'C'
               _echo 'C'
               _echo ' '
               xor  ax, ax
               mov  al, byte ptr es:[di+7]
               call putnum
               _echo ' '
               xor  ax, ax
               mov  al, byte ptr es:[di+8]
               call putbin
               _echo ' '
               xor  ax, ax
               mov  al, byte ptr es:[di+9]
               call putnum
               _echo ' '
               xor  ax, ax
               mov  al, byte ptr es:[di+0ah]
               call putnum
               _echo ' '
               _echo ' '
               xor  ax, ax
               mov  al, byte ptr es:[di+0bh]
               call putnum
               _newline
     ret
show_biostbl endp

detect_ide proc far
     mov  cx, 0080h
detectdrvs:
          push cx
          ; ... query hardware
          mov  ah, 08h
          mov  dl, cl
          int  13h      
          jc   _nodrive
               call show_biostbl
_nodrive:
     pop  cx
     inc  cx
     cmp  cx, 00ffh
     jb   detectdrvs
     ret
detect_ide endp

testblock proc far

          call detect_ide

          ret
testblock endp

IRQ_INPROGRESS EQU 1
desc_lock   db ?
desc_status dw ?

spinlock:
        ; call smb_rmb
        mov  al, cs:desc_lock
        or   al, al
        jnz  no_brk
             ; call smb_rmb
             mov  ax, desc_status
             and  ax, IRQ_INPROGRESS
             or   ax, ax
             jz   no_brk
                  jmp  short  @@break
no_brk:
        ; call cpu_relax
        jmp  spinlock
@@break:
        nop
        ret
