VOGONS


First post, by luc7

User metadata
Rank Newbie
Rank
Newbie

Hello.

Below is my attempt in changing the command TIME so it accepts hh🇲🇲ss user supplied.
I dont really know if a dos_call 0x2D works in this context or it should be a "mem_writed(BIOS_TIMER,ticks)"
in order to set the running time in the dosbox engine.

So I wrote OPTION 1 and OPTION2...
How to have this code to reach the active developers of DOSBox for their valuable comments/help ? (is posting here sufficient?)

I can go on and just make a build for myself but I think this would very be nice to get into the official sources.

Thanks.
luis/luc7.

the code for the CMD_TIME() modified is below, still with option 1 and option 2, one of them to be commented
or deleted.

void DOS_Shell::CMD_TIME(char * args) {
HELP("TIME");
if(ScanCMDBool(args,"H")) {
// synchronize time with host parameter
time_t curtime;
struct tm *loctime;
curtime = time (NULL);
loctime = localtime (&curtime);

//reg_cx = loctime->;
//reg_dh = loctime->;
//reg_dl = loctime->;

// reg_ah=0x2d; // set system time TODO
// CALLBACK_RunRealInt(0x21);

Bit32u ticks=(Bit32u)(((double)(loctime->tm_hour*3600+
loctime->tm_min*60+
loctime->tm_sec))*18.206481481);
mem_writed(BIOS_TIMER,ticks);
return;
}

bool timeonly = ScanCMDBool(args,"T");

// luc7 OPTION 1
// check if a time was passed in command line
Bit32u newhour,newminute,newsecond;
if(sscanf(args,"%u:%u:%u",&newhour,&newminute,&newsecond)==3) {
reg_ch = static_cast<Bit8u>(newhour);
reg_cl = static_cast<Bit8u>(newminuts);
reg_dh = static_cast<Bit8u>(newseconds);
reg_dl = 0x00;

reg_ah=0x2d; // set system time
CALLBACK_RunRealInt(0x21);
if(reg_al==0xff) WriteOut(MSG_Get("SHELL_CMD_TIME_ERROR"));
return;
}
// end OPTION 1

// luc7 OPTION 2
// check if a time was passed in command line
Bit32u newhour,newminute,newsecond;
if(sscanf(args,"%u:%u:%u",&newhour,&newminute,&newsecond)==3) {
Bit32u ticks=(Bit32u)(((double)(newhour*3600+
newminute*60+
newsecond))*18.206481481);
mem_writed(BIOS_TIMER,ticks);
return;
// end OPTION 2

reg_ah=0x2c; // get system time
CALLBACK_RunRealInt(0x21);
/*
reg_dl= // 1/100 seconds
reg_dh= // seconds
reg_cl= // minutes
reg_ch= // hours
*/
if(timeonly) {
WriteOut("%2u:%02u\n",reg_ch,reg_cl);
} else {
WriteOut(MSG_Get("SHELL_CMD_TIME_NOW"));
WriteOut("%2u:%02u:%02u,%02u\n",reg_ch,reg_cl,reg_dh,reg_dl);
}
};