Subversion Repositories SvarDOS

Compare Revisions

Ignore whitespace Rev 1744 → Rev 1745

/svarcom/trunk/cmd/dir.c
73,46 → 73,6
};
 
 
/* returns current COUNTRY id (1=USA, 7=RU, 33=FR, 48=PL, 49=DE, etc) */
static unsigned short dir_cur_country(void) {
_Packed struct { /* Extended Country Info Block */
unsigned char bRecID; /* Information ID */
unsigned short wRecLen; /* size of information */
unsigned short wCountryID; /* country code */
unsigned short wCodePgID; /* code page */
/* the block structure is much larger, but I only need the fields above */
} buff;
void *buffptr = &buff;
 
_asm {
push ax
push bx
push cx
push dx
push es
push di
 
mov ax, 0x6501 /* DOS 3.3+ - Get Extended Country Information */
mov bx, 0xffff /* code page (FFFFh = current) */
mov cx, 7 /* sizeof(buff) */
mov dx, bx /* country code (FFFFh = current) */
push ds
pop es
mov di, buffptr
int 0x21
 
pop di
pop es
pop dx
pop cx
pop bx
pop ax
}
 
return(buff.wCountryID);
}
 
 
/* fills freebytes with free bytes for drv (A=0, B=1, etc)
* returns DOS ERR code on failure */
static unsigned short cmd_dir_df(unsigned long *freebytes, unsigned char drv) {
522,10 → 482,8
 
/* try to replace (or complement) my naive collation table with an NLS-aware
* version provided by the kernel (or NLSFUNC)
* do this ONLY for COUNTRY codes that are higher than 1, because zero is
* invalid and value 1 can mean either "USA" or "undefined".
* ref: https://github.com/SvarDOS/bugz/issues/68 */
if (dir_cur_country() > 1) {
* see https://github.com/SvarDOS/bugz/issues/68 for some thoughts */
{
_Packed struct nlsseqtab {
unsigned char id;
unsigned short taboff;
565,11 → 523,20
if ((errflag == 0) && (collat.id == 6)) {
unsigned char far *ptr = MK_FP(collat.tabseg, collat.taboff);
unsigned short count = *(unsigned short far *)ptr;
/* printf("NLS AT %04X:%04X (%u elements)\n", collat.tabseg, collat.taboff, count); */
#ifdef DIR_DUMPNLSCOLLATE
printf("NLS AT %04X:%04X (%u elements)\n", collat.tabseg, collat.taboff, count);
#endif
if (count <= 256) { /* you never know */
ptr += 2; /* skip the count header */
for (i = 0; i < count; i++) {
glob_sortcmp_dat.sortownia[i] = ptr[i];
#ifdef DIR_DUMPNLSCOLLATE
printf(" %03u", ptr[i]);
if ((i & 15) == 15) {
printf("\n");
fflush(stdout);
}
#endif
}
}
}
/svarcom/trunk/makefile
9,8 → 9,16
#
 
FEATURES =
 
# hidden (debug-oriented) features:
 
# display debug data within the "ver" screen
#FEATURES += -DVERDBG
 
# dump the NLS collate table to screen at each DIR
#FEATURES += -DDIR_DUMPNLSCOLLATE
 
 
LDFLAGS = -0 -y -wx -mt -lr -we -d0 -ox -fm=command.map
CFLAGS = -0 -wx -ms -we -d0 -ox $(FEATURES)
# -0 generate 8086 compatible code