ramhelpr on autoexec.bat

By DamnedAngel

Expert (85)

DamnedAngel's picture

22-01-2018, 14:05

Hi guys,

My Ethernet cart from Tecnobytes (Obsonet2 compatible) arrived and I managed to set it up, download things and do other network stuff.

From Lavandeira's blog I learned to bring the interface up, receive an IP addr from the DHCP server and adjust the MSX date and time:

ramhelpr i
inl i
sntp a.ntp.br -02:00

The odd thing is: when I manually run these commands from the prompt, they work fine. When I put them in a .bat file and run the bat from the command prompt, it ALSO runs fine. If I use these lines inside autoexec.bat OR call the .bat file with them from autoexec.bat, however, the execution stops after ramhelpr, and inl is never executed (nor is anything after it).

It came to my knowledge that ramhelpr is able to execute other commands after it runs, so I made the following workaround in my autoexec.bat:

ramhelpr i inl i & sntp a.ntp.br -02:00 & echo & reboot %1

That solution, however, is annoying me, because I don't think it is nice to have all the remainder of autoexec.bat nested in ramhelpr's line.

Has anybody experienced such problem and discovered a good solution?

PS question, somewhat related: How can one test the system date's day and month (and possible weekday) from a MSXDOS batch script? That would help me test for daylight saving time and adjust the timezone (and time).

Login or register to post comments

By DamnedAngel

Expert (85)

DamnedAngel's picture

25-01-2018, 11:42

Bump. Does anyone have any clue on this?

By Wild_Penguin

Champion (483)

Wild_Penguin's picture

25-01-2018, 16:05

Seems like this is a bit over my head, but just my 0,02€:

There is little information about ramhelpr and what it actually does, but I guess, since it is some kind of memory manager (?), it cleans up the shell/command interpreter and starts a new instance (or something) and supposedly restores everything so that a .bat file execution resumes; but perhaps autoexec.bat is handled somehow specially in MSX-DOS and this special situation is not handled by ramhelpr?

Some DOS guru might take a look at the source, which is in github (I don't understand it :-) )

One thing you could try, is to use some.btm instead of some.bat, and call it from autoexec.bat (just a longshot, but as msxdos2 scripts they may be handled differently and *might* work).

By NYYRIKKI

Enlighted (5028)

NYYRIKKI's picture

26-01-2018, 07:15

I'm also quite convinced that the problem is the fact that the ramhelpr has this possibility to start other programs. Some part of it is not now working correctly. I would take a careful look especially to how the program uses "fork to child process" and "join"-function calls.

Quote:

PS question, somewhat related: How can one test the system date's day and month (and possible weekday) from a MSXDOS batch script?

On old versions of DOS2 you are pretty much limited to "ECHO | DATE". Since from version 2.40 you have %_DATE% and %_DOW% variables that you can use in your scripts.

By konamiman

Paladin (949)

konamiman's picture

26-01-2018, 12:47

Hey! Allow me to shed some light on this since ramhelpr is my baby.

First, the ramhelpr.com tool available in my web site is an implementation of the RAM helper defined in the UNAPI specification (chapter 4). TLDR is that it provides a way to invoke code in RAM segments using only five bytes of code, hence fitting in standard hooks. This way it is possible to develop UNAPI compliant TSRs (or any TSRs, for that matter) that don't need to allocate page 3 space just for hanging into a hook - put instead a 5-byte call to the RAM helper in the desired hooks and you're done.

Second, the source code for ramhelpr.com is available in my MSX repository in GitHub. This tool needs to allocate page 3 RAM for itself, and it does so by using the old trick of modifying HIMSAV, jumping to BASIC and then back to DOS. This means the end of the execution of the .BAT file if one was being executed, that's why as a workaround I added an option to add an extra command to be executed after the installation finishes. I'm sorry that the resulting command line doesn't read nice. :)

By DamnedAngel

Expert (85)

DamnedAngel's picture

26-01-2018, 15:09

Hi Wild_Penguin and NYYRIKKI,

Thanks for your insights. I will try the tips you suggested during the weekend and will let you know the outcome!

NYYRIKKI, how do I parse these variables on MSXDOS? Can "FOR" be used like in MS-DOS? Can I substring them?

best regards,

By DamnedAngel

Expert (85)

DamnedAngel's picture

26-01-2018, 15:58

Hi konamiman,

Thanks for the reply of the father of the baby. LOL!

I have a question, though: why would ramhelpr prevent the execution of autoexec.bat but NOT the execution of some other batch file, called from command line?

What would be your recommendation for the usage of ramhelpr in autoexec.bat? I have been thinking that, there is no solution to resume it, I will probably use

ramhelpr i endexec

and an endexec.bat file with

inl i
sntp a.ntp.br -02:00
;; whatever to fix summertime savings
echo
reboot %1

Do you have a better idea?

Thanks a lot in advance!

best,

By DamnedAngel

Expert (85)

DamnedAngel's picture

30-01-2018, 12:13

Wild_Penguin wrote:

One thing you could try, is to use some.btm instead of some.bat, and call it from autoexec.bat (just a longshot, but as msxdos2 scripts they may be handled differently and *might* work).

I tried the btm and the behavior was the same. I then ended up puting the rest of my autoexec.bat in the endexec.bat and calling endexec from ramhelpr.

Anyway, my ethernet cartridge died this weekend Crying so no use of this commands until I get it working again.

Thanks for the support!

By NYYRIKKI

Enlighted (5028)

NYYRIKKI's picture

30-01-2018, 22:30

DamnedAngel wrote:

NYYRIKKI, how do I parse these variables on MSXDOS? Can "FOR" be used like in MS-DOS? Can I substring them?

type "HELP ENV" and take a look at @LEFT, @LEN, @MID, @RIGHT and @INSTR... FOR is not among supported commands, but there is IF, IFF and GOTO & GOSUB... MSX-DOS2 is not really a number cruncher, so don't expect anything to be easy, fast or working just like you expect. If you want to do something more serious, I think it is less damaging to your brains if you just write a real program to do it and forget the batch files. Smile

My MSX profile