Subversion Repositories SvarDOS

Compare Revisions

Ignore whitespace Rev 1078 → Rev 1079

/svarcom/trunk/cmd/ver.c
31,7 → 31,7
 
static enum cmd_result cmd_ver(struct cmd_funcparam *p) {
char *buff = p->BUFFER;
unsigned char rc = 0, maj = 0, min = 0, rev = 0, verflags = 0;
unsigned char rc = 0, maj = 0, min = 0, truemaj = 0, truemin = 0, rev = 0, verflags = 0;
 
/* help screen */
if (cmd_ishlp(p)) {
105,51 → 105,47
push ax
push bx
push cx
push dx
 
/* get the "normal" (spoofable) DOS version */
mov ah, 0x30 /* Get DOS version number (DOS 2+) */
int 0x21 /* AL=maj_ver_num AH=min_ver_num BX,CX=OEM */
mov [maj], al
mov [min], ah
pop cx
pop bx
pop ax
}
 
sprintf(buff, svarlang_str(20,1), maj, min); /* "DOS kernel version %u.%u" */
outputnl(buff);
 
_asm {
push ax
push bx
push dx
 
/* get the "true" DOS version, along with a couple of extra data */
mov ax, 0x3306 /* Get true DOS version number (DOS 5+) */
int 0x21 /* AL=return_code BL=maj_ver_num BH=min_ver_num */
mov [rc], al /* DL=revision DH=kernel_memory_area */
mov [maj], bl
mov [min], bh
mov [rc], al /* DL=revision DH=kernel_memory_area */
mov [truemaj], bl
mov [truemin], bh
mov [rev], dl
mov [verflags], dh
 
pop dx
pop cx
pop bx
pop ax
}
 
/* MS-DOS 2-4 return 0xff, DR DOS 5&6 return 0x01 */
if ((rc != 255) && (rc != 1)) {
sprintf(buff, svarlang_str(20,10), maj, min); /* "True version %u.%u" */
outputnl(buff);
sprintf(buff, svarlang_str(20,1), maj, min); /* "DOS kernel version %u.%u" */
output(buff);
if ((maj != truemaj) || (min != truemin)) {
output(" (");
sprintf(buff, svarlang_str(20,10), maj, min); /* "true ver xx.xx" */
output(")");
}
outputnl("");
 
sprintf(buff, svarlang_str(20,5), 'A' + rev); /* "Revision %c" */
sprintf(buff, svarlang_str(20,5), 'A' + rev); /* "Revision %c" */
outputnl(buff);
 
{
const char *loc = svarlang_str(20,7); /* "low memory" */
if (verflags & 16) loc = svarlang_str(20,8); /* "HMA" */
if (verflags & 8) loc = svarlang_str(20,9); /* "ROM" */
sprintf(buff, svarlang_str(20,6), loc); /* "DOS is in %s" */
outputnl(buff);
 
{
const char *loc = svarlang_str(20,7); /* "low memory" */
if (verflags & 16) loc = svarlang_str(20,8); /* "HMA" */
if (verflags & 8) loc = svarlang_str(20,9); /* "ROM" */
sprintf(buff, svarlang_str(20,6), loc); /* "DOS is in %s" */
outputnl(buff);
}
}
 
outputnl("");