Subversion Repositories SvarDOS

Rev

Rev 2225 | Rev 2241 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2225 Rev 2230
Line 89... Line 89...
89
/*  char fname[13]; */
89
/*  char fname[13]; */
90
  char fname[12];
90
  char fname[12];
91
};
91
};
92
 
92
 
93
 
93
 
-
 
94
static void far *cmd_dir_farmalloc(unsigned short segcount);
-
 
95
#pragma aux cmd_dir_farmalloc = \
-
 
96
"mov ah, 0x48" \
-
 
97
"int 0x21" \
-
 
98
"jnc DONE" \
-
 
99
"xor ax, ax" \
-
 
100
"DONE:" \
-
 
101
"xor bx, bx" \
-
 
102
"mov es, ax" \
-
 
103
parm [bx] \
-
 
104
modify [ax] \
-
 
105
value [es bx] \
-
 
106
 
-
 
107
 
-
 
108
static void cmd_dir_farfree(void far *ptr);
-
 
109
#pragma aux cmd_dir_farfree = \
-
 
110
"mov ah, 0x49" \
-
 
111
"int 0x21" \
-
 
112
parm [es ax] \
-
 
113
modify [ax]
-
 
114
 
-
 
115
 
-
 
116
 
94
/* fills freebytes with free bytes for drv (A=0, B=1, etc)
117
/* fills freebytes with free bytes for drv (A=0, B=1, etc)
95
 * returns DOS ERR code on failure */
118
 * returns DOS ERR code on failure */
96
static unsigned short cmd_dir_df(unsigned long *freebytes, unsigned char drv) {
119
static unsigned short cmd_dir_df(unsigned long *freebytes, unsigned char drv) {
97
  unsigned short res = 0;
120
  unsigned short res = 0;
98
  unsigned short sects_per_clust = 0, avail_clusts = 0, bytes_per_sect = 0;
121
  unsigned short sects_per_clust = 0, avail_clusts = 0, bytes_per_sect = 0;
Line 780... Line 803...
780
    /* allocate a memory buffer - try several sizes until one succeeds */
803
    /* allocate a memory buffer - try several sizes until one succeeds */
781
    unsigned short max_dta_bufcount;
804
    unsigned short max_dta_bufcount;
782
 
805
 
783
    /* compute the amount of DTAs I can buffer */
806
    /* compute the amount of DTAs I can buffer */
784
    for (max_dta_bufcount = MAX_SORTABLE_FILES; max_dta_bufcount != 0; max_dta_bufcount /= 2) {
807
    for (max_dta_bufcount = MAX_SORTABLE_FILES; max_dta_bufcount != 0; max_dta_bufcount /= 2) {
785
      dtabuf = _fmalloc(max_dta_bufcount * sizeof(struct TINYDTA));
808
      dtabuf = cmd_dir_farmalloc(max_dta_bufcount * sizeof(struct TINYDTA) / 16);
786
      if (dtabuf != NULL) break;
809
      if (dtabuf != NULL) break;
787
    }
810
    }
788
    /* printf("max_dta_bufcount = %u\n", max_dta_bufcount); */
811
    /* printf("max_dta_bufcount = %u\n", max_dta_bufcount); */
789
 
812
 
790
    if (dtabuf == NULL) {
813
    if (dtabuf == NULL) {
Line 1029... Line 1052...
1029
  }
1052
  }
1030
 
1053
 
1031
  GAMEOVER:
1054
  GAMEOVER:
1032
 
1055
 
1033
  /* free the buffer memory (if used) */
1056
  /* free the buffer memory (if used) */
1034
  if (glob_sortcmp_dat.dtabuf_root != NULL) _ffree(glob_sortcmp_dat.dtabuf_root);
1057
  if (glob_sortcmp_dat.dtabuf_root != NULL) cmd_dir_farfree(glob_sortcmp_dat.dtabuf_root);
1035
 
1058
 
1036
  free(buf);
1059
  free(buf);
1037
  return(CMD_OK);
1060
  return(CMD_OK);
1038
}
1061
}