Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 11:08 09 Nov 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : autorun.bas ? on micromite

Author Message
sagt3k

Guru

Joined: 01/02/2015
Location: Italy
Posts: 313
Posted: 11:44pm 24 Mar 2017
Copy link to clipboard 
Print this post

Hi to everybody
I don't remember .. but with micromite MX or MZ with uSD ..is it possibile to load a file .bas as "autorun.bas" at power on?
Thanks
Sagt3k
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9745
Posted: 12:15am 25 Mar 2017
Copy link to clipboard 
Print this post

You could write a simple code along the lines of:


CHDIR "\"
LOAD "AUTORUN.SYS",R


...and save that as your "Code" in the main memory.

Now, set that to AUTORUN ON from the command prompt.

When you power up, this two-line code will execute, and load and run AUTORUN.SYS - or whatever filename you nominate.

EDIT: Actually, that will only work once. Your best bet would be to put that code in the library area rather then the main-memory area.

IE: Save those two lines of code above via the LIBRARY SAVE command. Then no matter what program is in the code memory, when you restart the Micromite, it will execute the library code area first, which instructs the system to load the autorun program.

Not tested, but that should work.Edited by Grogster 2017-03-26
Smoke makes things work. When the smoke gets out, it stops!
 
sagt3k

Guru

Joined: 01/02/2015
Location: Italy
Posts: 313
Posted: 12:29am 25 Mar 2017
Copy link to clipboard 
Print this post

Hi Grogster

I follow your suggestion (in AUTORUN.SYS I have already saved two lines..):

> load "AUTORUN.SYS"
> library SAVE
> list
> run
[LIBRARY] Load "AUTORUN.SYS",R
Error: Expression is too complex
> list
Chdir "\"
Load "AUTORUN.SYS",R
> library list
Chdir "\"
Load "AUTORUN.SYS",R
>

Thanks
sagt3k
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9745
Posted: 01:45am 25 Mar 2017
Copy link to clipboard 
Print this post

The LIBRARY contains the two lines, but the main code MUST NOT.

If you have the two lines saved in the library as above, AND also a file called AUTORUN.SYS with the same two lines in it, you will have created something of a crazy loop as far as MMBASIC is concerned, whereby at startup, the library calls AUTORUN.SYS, which is the same code, runs that, which calls AUTORUN.SYS, which calls AUTORUN.SYS, which calls AUTORUN.SYS, which calls AUTORUN.SYS..........

The library code calls the program called AUTORUN.SYS.

AUTORUN.SYS needs to be the program you want to run - NOT the two lines of code.

Hopefully I am making some kind of sense!
Smoke makes things work. When the smoke gets out, it stops!
 
sagt3k

Guru

Joined: 01/02/2015
Location: Italy
Posts: 313
Posted: 02:20am 25 Mar 2017
Copy link to clipboard 
Print this post

Hi Grogster
Thanks, I have solved so:
I created a code that recall the file "autorun.sys" with a infinite loop. I need test stability of uSD recall always the file "autorun.sys". With mm.startup it's a good solution. Now I need another solution. I have variable X ..I know that with NEW and LOAD all variable are cleaned. OK .. but if I want to store in RAM a variable ..
I can use VAR SAVE, It is limited to the flash with few written.
Now if possibile to create a command for example DIM RAM X which allows to not reset the variable in the case of commands such as NEW and LOAD ...
Could be possible ?

'FILE:AUTORUN.SYS -------------
Option autorun on
Print "--AUTORUN.SYS--"

SetPin 2,dout
SetTick 1000,ReLoad
Do
Pin(2)=Not Pin(2)
Print "X="X, "Timer="Timer
Pause 100
X=X+1
Loop

Sub mm.startup
Load "autorun.sys",r
End Sub

Sub ReLoad
mm.startup
End Sub
'END:AUTORUN.SYS -------------

 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025