Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 19:39 29 Mar 2024 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 : PicoMite and autorun.bas

Author Message
andreas

Senior Member

Joined: 07/12/2020
Location: Germany
Posts: 187
Posted: 12:27pm 22 Sep 2022
Copy link to clipboard 
Print this post

Hello,

yesterday I build the VGA PicoMite from the Silicon Chip Kit. So there is an SD-Card, VGA and PS/2 connector. Everything works well.

As early microcomputers like the TRS-80 this setup does not have a RTC on board and I had to set the time$ and date$ manually.

I could add an RTC module, but I want to keep the PicoMite as simple as possible.

The idea is to autorun some code to set time$ and date$ at boot. The only mechanism I found in the handbook was to use some mm.startup sub which has to be in the flash somewhere when the pico boots.

I wrote 2 files: autorun.bas and mmstartup.bas and stored them on the sd-card.

In autorun.bas are all commands I want to execute at startup and in mmstartup.bas is the definition of sub mm.startup which calls autorun.bas.

I placed the mmstartup.bas into flash 1 to load it at the end of the day with a flash load 1 and then switching off the VGA PicoMite. At the next boot the Sub will be in memory and found by the firmware.

If someone knows a better way (like CMM2) I would be glad to hear! I think taking care of some mm.startup sub every time I switch off the picomite is not very elegant.
May be I simply don't understand how the "autostart" should work normally?!

' mmstartup.bas - prepare next boot
' (2022) Andreas Mueller, Gerolsbach
'
Sub mm.startup
 Run "autorun.bas"
End Sub


' autorun.bas
' startup program - will be started when picomite boots
' (2022) Andreas Mueller, Gerolsbach

Dim T$,D$ As String = ""

Do
 Input "Time: (hh:mm:ss)"; T$
 On error skip 1
 Time$ = T$
Loop Until MM.Errno = 0

Do
 Input "Date: (dd-mm-yyyy)"; D$
 On error skip 1
 Date$ = D$
Loop Until MM.Errno = 0

Run "mmstartup.bas" ' restore mm.startup sub
End


-andreas
Edited 2022-09-22 23:01 by andreas
 
pwillard
Senior Member

Joined: 07/06/2022
Location: United States
Posts: 272
Posted: 01:14pm 22 Sep 2022
Copy link to clipboard 
Print this post

I was under the impression that you can't specify a FILENAME unless you were using an SDCARD with actual files on it, not flash.  

With the Flash option,  you would need to use Flash Chain X where X is the FLASH SLOT number where your program code is stored.

Correct me if I'm wrong...   this is all still rather new.

Note: I've also had a situation where SUB MM.STARTUP didn't always seem to run (at least that was my perception a few weeks back but that might have been a coding error on my part -- a common occurance)
Edited 2022-09-22 23:18 by pwillard
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 5648
Posted: 01:55pm 22 Sep 2022
Copy link to clipboard 
Print this post

To run a PicoMite program automatically from flash it's very easy. Write your program. Use FLASH SAVE n to store it into flash slot n. Run OPTION AUTORUN n where n is the number of the flash slot. That's it. On boot the program in flash slot n will run.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
andreas

Senior Member

Joined: 07/12/2020
Location: Germany
Posts: 187
Posted: 02:11pm 22 Sep 2022
Copy link to clipboard 
Print this post

  Mixtel90 said  To run a PicoMite program automatically from flash it's very easy. Write your program. Use FLASH SAVE n to store it into flash slot n. Run OPTION AUTORUN n where n is the number of the flash slot. That's it. On boot the program in flash slot n will run.


thank you! just a few seconds before you wrote it i found it this way:

pdfgrep -in auto PicoMiteVGA_User_Manual.pdf | grep -i run

14:In addition the command OPTION AUTORUN can be used to specify a flash program location to be set
14:location and in that case MMBasic will automatically load and run the program that is in the program memory.
47: MM.INFO$(AUTORUN)               Returns the setting of the OPTION AUTORUN command
48:                           will run. “option” can be one of AUTORUN, BASE, BREAK,
49:OPTION AUTORUN ON
49:                                             MMBasic to automatically run a program on power up or
49:OPTION AUTORUN n                      ON will cause the the current program to be run.
49:OPTION AUTORUN OFF
49:                                      OFF will disable the autorun option and is the default for a new program.
53:AUTOSAVE CRUNCH                     This mode is terminated by entering Control-Z or F1 which will then cause
57:                              If OPTION AUTORUN has been set the program in the specified flash
61:                               One of these flash memory locations can be automatically loaded and run
61:                               when power is applied using the OPTION AUTORUN n command.
85:                          stopped running) the PicoMiteVGA will be automatically restarted and the
85:                          false (i.e. 0). Note that OPTION AUTORUN must be specified for the

-andreas
 
andreas

Senior Member

Joined: 07/12/2020
Location: Germany
Posts: 187
Posted: 02:23pm 22 Sep 2022
Copy link to clipboard 
Print this post

  pwillard said  I was under the impression that you can't specify a FILENAME unless you were using an SDCARD with actual files on it, not flash.  

With the Flash option,  you would need to use Flash Chain X where X is the FLASH SLOT number where your program code is stored.

Correct me if I'm wrong...   this is all still rather new.

Note: I've also had a situation where SUB MM.STARTUP didn't always seem to run (at least that was my perception a few weeks back but that might have been a coding error on my part -- a common occurance)


Yes, I'm using the sd-card as filestore.

My current solution is based on "autorun.bas" on sd-card and the SUB mm.startup in flash 1. After OPTION AUTORUN 1 the mm.startup sub will call the autorun.bas.

This way I have only to think about the content of "autorun.bas". I can switch on and off without thinking about the current state of the system - it will always call autorun.bas.

The only thing I have to prevent is to change flash 1 which is the caller.

-andreas
 
Print this page


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

© JAQ Software 2024