Second part of patch 1022702. (All except addkey). Changed loading of a BCD in the fpu a bit to get more resolution and speed.
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@1959
This commit is contained in:
parent
5c6506d1bf
commit
30f2bb7612
4 changed files with 70 additions and 12 deletions
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: shell.h,v 1.6 2004-08-04 09:12:51 qbix79 Exp $ */
|
||||
/* $Id: shell.h,v 1.7 2004-09-09 18:36:50 qbix79 Exp $ */
|
||||
|
||||
#ifndef SHELL_H_
|
||||
#define SHELL_H_
|
||||
|
@ -100,6 +100,8 @@ public:
|
|||
void CMD_PAUSE(char * args);
|
||||
void CMD_SUBST(char* args);
|
||||
void CMD_LOADHIGH(char* args);
|
||||
void CMD_CHOICE(char * args);
|
||||
void CMD_ATTRIB(char * args);
|
||||
/* The shell's variables */
|
||||
Bit16u input_handle;
|
||||
BatchFile * bf;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: fpu_instructions.h,v 1.20 2004-09-08 10:33:16 qbix79 Exp $ */
|
||||
/* $Id: fpu_instructions.h,v 1.21 2004-09-09 18:36:50 qbix79 Exp $ */
|
||||
|
||||
|
||||
static void FPU_FINIT(void) {
|
||||
|
@ -264,7 +264,7 @@ static void FPU_FBST(PhysPt addr)
|
|||
|
||||
static Real64 FPU_FBLD(PhysPt addr)
|
||||
{
|
||||
Real64 val = 0;
|
||||
Bit64u val = 0;
|
||||
Bitu in = 0;
|
||||
Bit64u base = 1;
|
||||
for(Bitu i = 0;i < 9;i++){
|
||||
|
@ -275,11 +275,13 @@ static Real64 FPU_FBLD(PhysPt addr)
|
|||
base *= 10;
|
||||
}
|
||||
|
||||
//last number
|
||||
//last number, only now convert to float in order to get
|
||||
//the best signification
|
||||
Real64 temp = static_cast<Real64>(val);
|
||||
in = mem_readb(addr + 9);
|
||||
val += ( (in&0xf) * base );
|
||||
if(in&0x80) val *= -1.0;
|
||||
return val;
|
||||
temp += ( (in&0xf) * base );
|
||||
if(in&0x80) temp *= -1.0;
|
||||
return temp;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: shell.cpp,v 1.45 2004-08-26 19:49:26 qbix79 Exp $ */
|
||||
/* $Id: shell.cpp,v 1.46 2004-09-09 18:36:50 qbix79 Exp $ */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
|
@ -108,6 +108,7 @@ Bitu DOS_Shell::GetRedirection(char *s, char **ifn, char **ofn,bool * append) {
|
|||
}
|
||||
|
||||
void DOS_Shell::ParseLine(char * line) {
|
||||
LOG(LOG_EXEC,LOG_ERROR)("Parsing command line: %s",line);
|
||||
/* Check for a leading @ */
|
||||
if (line[0]=='@') line[0]=' ';
|
||||
line=trim(line);
|
||||
|
@ -324,6 +325,8 @@ void SHELL_Init() {
|
|||
MSG_Add("SHELL_CMD_CALL_HELP","Start a batch file from within another batch file.\n");
|
||||
MSG_Add("SHELL_CMD_SUBST_HELP","Assign an internal directory to a drive\n");
|
||||
MSG_Add("SHELL_CMD_LOADHIGH_HELP","Run a program. For batch file compatibility only.\n");
|
||||
MSG_Add("SHELL_CMD_CHOICE_HELP","Waits for a keypress and sets ERRORLEVEL.\n");
|
||||
MSG_Add("SHELL_CMD_ATTRIB_HELP","Does nothing. Provided for compatibility.\n");
|
||||
|
||||
/* Regular startup */
|
||||
call_shellstop=CALLBACK_Allocate();
|
||||
|
|
|
@ -16,9 +16,10 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* $Id: shell_cmds.cpp,v 1.45 2004-08-04 09:12:57 qbix79 Exp $ */
|
||||
/* $Id: shell_cmds.cpp,v 1.46 2004-09-09 18:36:50 qbix79 Exp $ */
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "shell.h"
|
||||
#include "callback.h"
|
||||
|
@ -36,7 +37,7 @@ static SHELL_Cmd cmd_list[]={
|
|||
{ "ERASE", 1, &DOS_Shell::CMD_DELETE, "SHELL_CMD_DELETE_HELP"},
|
||||
{ "ECHO", 0, &DOS_Shell::CMD_ECHO, "SHELL_CMD_ECHO_HELP"},
|
||||
{ "EXIT", 0, &DOS_Shell::CMD_EXIT, "SHELL_CMD_EXIT_HELP"},
|
||||
{ "HELP", 0, &DOS_Shell::CMD_HELP, "SHELL_CMD_HELP_HELP"},
|
||||
{ "HELP", 1, &DOS_Shell::CMD_HELP, "SHELL_CMD_HELP_HELP"},
|
||||
{ "MKDIR", 0, &DOS_Shell::CMD_MKDIR, "SHELL_CMD_MKDIR_HELP"},
|
||||
{ "MD", 1, &DOS_Shell::CMD_MKDIR, "SHELL_CMD_MKDIR_HELP"},
|
||||
{ "RMDIR", 0, &DOS_Shell::CMD_RMDIR, "SHELL_CMD_RMDIR_HELP"},
|
||||
|
@ -53,6 +54,8 @@ static SHELL_Cmd cmd_list[]={
|
|||
{ "SUBST", 0, &DOS_Shell::CMD_SUBST, "SHELL_CMD_SUBST_HELP"},
|
||||
{ "LOADHIGH", 0, &DOS_Shell::CMD_LOADHIGH, "SHELL_CMD_LOADHIGH_HELP"},
|
||||
{ "LH", 1, &DOS_Shell::CMD_LOADHIGH, "SHELL_CMD_LOADHIGH_HELP"},
|
||||
{ "CHOICE", 0, &DOS_Shell::CMD_CHOICE, "SHELL_CMD_CHOICE_HELP"},
|
||||
{ "ATTRIB", 0, &DOS_Shell::CMD_ATTRIB, "SHELL_CMD_ATTRIB_HELP"},
|
||||
{0,0,0,0}
|
||||
};
|
||||
|
||||
|
@ -361,11 +364,16 @@ void DOS_Shell::CMD_DIR(char * args) {
|
|||
}
|
||||
|
||||
void DOS_Shell::CMD_COPY(char * args) {
|
||||
static char defaulttarget[] = ".";
|
||||
StripSpaces(args);
|
||||
DOS_DTA dta(dos.dta());
|
||||
Bit32u size;Bit16u date;Bit16u time;Bit8u attr;
|
||||
char name[DOS_NAMELENGTH_ASCII];
|
||||
|
||||
// ignore /b and /t switches: always copy binary
|
||||
ScanCMDBool(args,"B");
|
||||
ScanCMDBool(args,"T");
|
||||
|
||||
char * rem=ScanCMDRemain(args);
|
||||
if (rem) {
|
||||
WriteOut(MSG_Get("SHELL_ILLEGAL_SWITCH"),rem);
|
||||
|
@ -373,7 +381,9 @@ void DOS_Shell::CMD_COPY(char * args) {
|
|||
}
|
||||
// source/target
|
||||
char* source = StripWord(args);
|
||||
char* target = StripWord(args);
|
||||
char* target = NULL;
|
||||
if (args && *args) target = StripWord(args);
|
||||
if (!target || !*target) target = defaulttarget;
|
||||
|
||||
// Target and Source have to be there
|
||||
if (!source || !strlen(source)) {
|
||||
|
@ -577,7 +587,6 @@ void DOS_Shell::CMD_PAUSE(char * args){
|
|||
DOS_ReadFile (STDIN,&c,&n);
|
||||
}
|
||||
|
||||
|
||||
void DOS_Shell::CMD_CALL(char * args){
|
||||
this->call=true; /* else the old batchfile will be closed first */
|
||||
this->ParseLine(args);
|
||||
|
@ -642,3 +651,45 @@ void DOS_Shell::CMD_SUBST (char * args) {
|
|||
void DOS_Shell::CMD_LOADHIGH(char *args){
|
||||
this->ParseLine(args);
|
||||
}
|
||||
|
||||
void DOS_Shell::CMD_CHOICE(char * args){
|
||||
static char defargs[] = "[YN]";
|
||||
static char defchoice[] = "yn";
|
||||
char *rem = NULL, *ptr;
|
||||
bool optN = false;
|
||||
if (args) {
|
||||
char *last = strchr(args,0);
|
||||
StripSpaces(args);
|
||||
optN=ScanCMDBool(args,"N");
|
||||
rem=ScanCMDRemain(args);
|
||||
if (rem && *rem && (tolower(rem[1]) != 'c' || rem[2] != ':')) {
|
||||
WriteOut(MSG_Get("SHELL_ILLEGAL_SWITCH"),rem);
|
||||
return;
|
||||
}
|
||||
if (args == rem) args = strchr(rem,0)+1;
|
||||
if (rem) rem += 3;
|
||||
if (args > last) args = NULL;
|
||||
}
|
||||
if (!args || !*args) args = defargs;
|
||||
if (!rem || !*rem) rem = defchoice;
|
||||
ptr = rem;
|
||||
Bit8u c;
|
||||
while ((c = *ptr)) *ptr++ = tolower(c);
|
||||
|
||||
WriteOut(args);
|
||||
if (!optN) WriteOut("\r\n");
|
||||
Bit16u n=1;
|
||||
do {
|
||||
DOS_ReadFile (STDIN,&c,&n);
|
||||
} while (!c || !(ptr = strchr(rem,tolower(c))));
|
||||
if (optN) {
|
||||
DOS_WriteFile (STDOUT,&c, &n);
|
||||
WriteOut("\r\n");
|
||||
}
|
||||
dos.return_code = ptr-rem+1;
|
||||
}
|
||||
|
||||
void DOS_Shell::CMD_ATTRIB(char *args){
|
||||
// No-Op for now.
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue