/* * p3scan.c — диагностика полного пути scan/store/sort большого каталога. * * Использует те же банковые модули P3, но не делает panel change/rollback, * поэтому сохраняет точные rc, errno и состояние панели в точке отказа. */ #include #include #include #include #include #include #include "sc_panel.h" #include "sc_source.h" #include "sc_store.h" static ScPanel panel; static ScDirEntry entry; int main(void) { uint8_t block; uint8_t page; int rc; int saved_errno; (void)settextmode(TEXT_MODE_80x32); clrscr_attr(0x17); gotoxy(0, 0); textattr(0x1Fu); cputs("P3 scan/store/sort diagnostic\r\n\r\n"); textattr(0x17u); block = mem_alloc_pages(1u); page = block ? mem_get_page(block, 0u) : 0u; printf("EMM: block=%u page=%02X errno=%d\n", (unsigned)block, (unsigned)page, errno); if (!block || !page) goto done; memset(&panel, 0, sizeof(panel)); strcpy(panel.path, "\\BIGDIR"); panel.phys_page = page; puts("Calling sc_source_fs_scan..."); errno = 0; rc = sc_source_fs_scan(&panel); saved_errno = errno; printf("scan: rc=%d errno=%d count=%u trunc=%u\n", rc, saved_errno, (unsigned)panel.count, (unsigned)panel.truncated); printf("view: cursor=%u top=%u total=%lu\n", (unsigned)panel.cursor, (unsigned)panel.top, (unsigned long)panel.total_size); if (panel.count != 0u && sc_store_get(&panel, 0u, &entry) == 0) printf("first: %s attr=%02X flags=%02X\n", entry.name, (unsigned)entry.attr, (unsigned)entry.flags); if (panel.count != 0u && sc_store_get(&panel, (uint16_t)(panel.count - 1u), &entry) == 0) printf("last : %s attr=%02X flags=%02X\n", entry.name, (unsigned)entry.attr, (unsigned)entry.flags); mem_free_block(block); done: textattr(0x1Eu); cputs("\r\nProbe stopped; MAME test will take snapshots."); for (;;) (void)getkey(); }