Magic Lantern Forum

Developing Magic Lantern => General Development => Topic started by: kitor on November 27, 2021, 02:43:36 PM

Title: Canon Basic scripting (DIGIC 6, DIGIC 7 models)
Post by: kitor on November 27, 2021, 02:43:36 PM
... there's Basic interpreter on Digic 6 and 7 models too! (checked on 750D, 5D4, 200D). It works differently than D8 (https://www.magiclantern.fm/forum/index.php?topic=25305.0)+, so I'm creating a separate thread.

There's no need for script.req file on card, or any bootsector flags.

I found no way to execute script without UART. With UART:

' Comment test, will this be ignored?

public sub my_test(string)
    ' moar comments
    Printf("\nyo man!\n")
end sub


K393[1]>LoadScript B:/test.m
Load B:/test.m
LoadScript returned 0(0x0)
K393[1]>ShowScript
Show Script
                          Name:     Code: CodeSize:     Data: DataSize:
======================================================================
                      B:/test.m  0x9ac3cc      0x28  0x9ac400      0x14
----------------------------------------------------------------------
ShowScript returned 0(0x0)
K393[1]>my_test
yo man!

my_test returned 0(0x0)


Quirks: I found no way to auto execute any function from script. All public subroutines get exported into Evprocs.
If subroutine doesn't have any arguments, parser complains:
K393[1]>LoadScript B:/test.m
Load B:/test.m
Syntax Error:Invalid Parameter Name
3:private sub my_test()

LoadScript returned 1(0x1)


Thanks to Lorenzo for pointing me into that direction. He claimed that there may be Basic engine on 6D, unfortunately this is not yet confirmed/busted. autoexec.sc on D5 is something with different syntax.
Title: Re: Canon Basic scripting (DIGIC 6, DIGIC 7 models)
Post by: srsa on February 07, 2022, 12:05:39 AM
This could possibly be used over PTP (for creating event procedures). See this (https://chdk.setepontos.com/index.php?topic=4338.msg147738#msg147738) for details.
Title: Re: Canon Basic scripting (DIGIC 6, DIGIC 7 models)
Post by: kitor on February 07, 2022, 09:29:07 AM
Yes, most likely.

There's yet another scripting language on D6+ but I still have no idea how to execute it without running own code just to do that.

File is AUTOSHT.SEQ, syntax seems pretty simple - allows for shoot automation, but parser also has option to call (probably arbitrary) evprocs from script.

File load is done by SVDSTask; task is created by one of states of SVDSState which is part of ShootVfxDebug class, which is one of handlers (stages?) for ShootVfxService (SVS).
Seems that state transition can be executed calling PostStageEvent wrapper specific for SVDS, or via event delivered through ShootVfs StageClass (event callback routes messages to selected stage).

If we find a way to execute this on camera I'll make a separate thread.