; LSTOFLST.SCR
; INTRSPY script to examine DOS List Of Lists (INT 21h Function 52h)

structure list_20 fields            ; DOS 2.x
    share_retry_count (word)
    retry_delay (word)
    curr_disk_buff (dword, ptr)
    unread_con (word)
    mcb (word)
    dpb (dword, ptr)
    file_tbl (dword, ptr)
    clock (dword, ptr)
    con (dword, ptr)
    num_drives (byte, hex)
    max_bytes (word)
    first_disk_buff (dword, ptr)
    nul (byte,dump,18)
    
structure list_30 fields            ; DOS 3.0
    share_retry_count (word)
    retry_delay (word)
    curr_disk_buff (dword, ptr)
    unread_con (word)
    mcb (word)
    dpb (dword, ptr)
    file_tbl (dword, ptr)
    clock (dword, ptr)
    con (dword, ptr)
    num_blk_dev (byte,hex)
    max_bytes (word)
    first_disk_buff (dword, ptr)
    curr_dir (dword, ptr)
    lastdrive (byte,hex)
    string_area (dword, ptr)
    size_string_area (word)
    fcb_tbl (dword, ptr)
    fcb_y (word)
    nul (byte,dump,18)

structure list_31 fields            ; DOS 3.1+
    share_retry_count (word)
    retry_delay (word)
    curr_disk_buff (dword, ptr)
    unread_con (word)
    mcb (word)
    dpb (dword, ptr)
    file_tbl (dword, ptr)
    clock (dword, ptr)
    con (dword, ptr)
    max_bytes (word)
    disk_buff (dword, ptr)
    curr_dir (dword, ptr)
    fcb (dword, ptr)
    num_prot_fcb (word)
    num_blk_dev (byte,hex)
    lastdrive (byte,hex)
    nul (byte,dump,18)
    num_join (word)

intercept 21h
    function 52h
        on_exit
            if (OS_MAJOR == 2)
                output (es:bx[-12]->list_20)
            if (OS_MAJOR == 3) and (OS_MINOR == 0)
                output (es:bx[-12]->list_30)
            if (OS_MAJOR == 3) and (OS_MINOR != 0)
                output (es:bx[-12]->list_31)
                output (es:bx[-12]->list_31.con->byte,dump,18)
                output (es:bx[-12]->list_31.clock->byte,dump,18)
            if (OS_MAJOR == 4) or (OS_MAJOR == 5)
                output (es:bx[-12]->list_31)
        on_exit
            output ""
