From a3529cd048a35c00223bb86c170907eb10953588 Mon Sep 17 00:00:00 2001 From: uz Date: Sat, 3 Oct 2009 18:38:39 +0000 Subject: [PATCH] Ignore start address in cbm_opendir. Rearrange the code somewhat to make it shorter. git-svn-id: svn://svn.cc65.org/cc65/trunk@4319 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- libsrc/cbm/cbm_dir.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/libsrc/cbm/cbm_dir.c b/libsrc/cbm/cbm_dir.c index b46df177a..ca250cea7 100644 --- a/libsrc/cbm/cbm_dir.c +++ b/libsrc/cbm/cbm_dir.c @@ -13,20 +13,21 @@ -unsigned char __fastcall__ cbm_opendir (unsigned char lfn, unsigned char device) -{ +unsigned char __fastcall__ cbm_opendir (unsigned char lfn, unsigned +char device) { unsigned char status; if ((status = cbm_open (lfn, device, CBM_READ, "$")) == 0) { if (cbm_k_chkin (lfn) == 0) { - if (cbm_k_basin () == 0x01) { /* Start address */ - if (cbm_k_basin () == 0x04) { - cbm_k_clrch (); - return 0; - } + /* Ignore start address */ + cbm_k_basin(); + cbm_k_basin(); + if (cbm_k_readst()) { + cbm_close(lfn); + status = 2; + cbm_k_clrch(); } else { - cbm_close (lfn); - cbm_k_clrch (); - return 2; + status = 0; + cbm_k_clrch(); } } } @@ -40,7 +41,7 @@ unsigned char __fastcall__ cbm_readdir (unsigned char lfn, register struct cbm_d unsigned char byte, i; unsigned char rv; unsigned char is_header; - static const unsigned char types[] = { + static const unsigned char types[] = { CBM_T_OTHER, CBM_T_OTHER, CBM_T_CBM, CBM_T_DIR, /* a b c d */ CBM_T_OTHER, CBM_T_OTHER, CBM_T_OTHER, CBM_T_OTHER, /* e f g h */ CBM_T_OTHER, CBM_T_OTHER, CBM_T_OTHER, CBM_T_OTHER, /* i j k l */ -- 2.39.5