Feature request : 31 Oct 2022 : Please give PE6 the ability to edit and simulate multi #slot code.

Buzby

Senior Member
#Slots are useful, but PE6 can't create more than one, or simulate them. ( At least, I've not found a way to make it work. )

The editor in PE6 won't allow the use of more than one #Slot directive, which seems a bit of a limitation.
It is not unreasonable to write code for two slots in one .bas file. Slots are not only useful for when slot 0 gets full, they can be used for other things as well.

( Now I know this is a 'Feature request', and not likely to be even acknowledged, even less likely to be implemented, but if you don't ask you have no chance of getting. )

The original request for this feature was over 10 years ago, in Jan 2012, in the Wishlist - https://picaxeforum.co.uk/threads/programming-editor-wishlist.20188/#post-192021 - so it's not a new request, Rev-Ed knew about it before PE6 was released. Why did they choose not to make it happen ?

It doesn't seem like it would be a major effort to implement this.
All the tools are already in PE6 ( Editor, Pre-processor, Simulator ), they just need to be able to handle multiple slots.
It could be done by a kind of 'context switching', to switch the tools to a different slot, or it could be done by having multiple instances of the tools, each dedicated to a particular slot.

Cheers,

Buzby
 
Now I know this is a 'Feature request', and not likely to be even acknowledged, even less likely to be implemented, but if you don't ask you have no chance of getting.

A year later, and my words are proved !

If someone is struggling to implement multi-slot, I suggest that Rev-Ed upload the code to ChatGPT ( the paid version ) and ask it to do the changes. Then the task is one of testing and tweaking, a lot easier than starting from scratch.
 
Is it likely we will ever get multi-slot running in the PE simulator ?.

From the PE6 intro document - "By moving to a modern development platform our software developers can also now work far more productively. Furthermore the entire PICAXE software architecture has simultaneously been moved over to a much more modular system, allowing future additions and new features (e.g. new PICAXE chip generations or extra code assistance wizards) to be added much more rapidly."

In a 'much more modular system' it should be reasonably easy to implement multi-slot. Also, it's not as complex as I first thought.

The simulator runs the code a line at a time, and the PICAXE runs a line at a time, no matter what #slot it is in. ( This is not the same as 'tasks', where the PICAXE 'appears' to be running multiple lines at the same time, each in a different task. )

Because it just one line at a time, it should be fairly easy to execute #slot code. In fact, I suspect most of what's needed for multi-slot simulation could be implemented in the pre-processor.

On the first pass the PP records the location of each #slot directive, then on the second pass these locations are added to the #run directive. ( Or maybe a table is made of #run / #slot locations )

Now, if the simulator sees a #slot it just ends the prog, like a 'stop'. But if it sees a #run then it resets the stacks etc., and jumps to the location associated with the #run.

This is just a rough idea. I'm not familiar with exactly how the simulator executes code. However, no matter how the simulator is built it should not be difficult to add some new behaviors. This is, after all, just a 'new feature', exactly what PE6 promised to make easy to add !.

Cheers,

Buzby
 
Here is my first attempt at a Multi-slot simulator.


I did have a LOT of help from AI, and the conversations also showed me some quirks that a multi-slot simulator has to overcome.

The .bas file names need to be in the format 'project_S00.bas', 'project_S01.bas' so that SIMPE8 can load them in order to make one long file.
Then a set of parsers make lists of variables, instructions, stacks, etc. followed by an engine that process those lists to actually execute them.

This application uses context switching to handle multiple slots ( You can see the currently executed slot in the top-right of the main window. )
Context switching sounds complicated, but it's not !. All it does is reset the programme counter, stacks, etc., and load the new symbols.

There are still a lot of instructions I need to implement, but it should be plain sailing now I have a solid base system running.

From scratch, with the help of AI, this has taken me about 30 hours of work. Although the app looks complicated, it's only 2300 lines of Python.
However, I do wonder how quickly could it be done if the source code for PE was the starting point.
 
Wow, really impressed with the simulator!! I haven't needed multi-slot in the past although I was close to needing it in one project. In Linux I can use the Linux specific compilers and if I went through some more hoops I could even use a separate preprocesor app. To my knowledge I'd still lack any simulator though! That's why I use Wine to simulate Windows and run PE, as my only Windows app. It was despair when Wine broke for a while, so I'd really like a PE in Linux, otherwise I don't seem to have even a reliable single slot simulation! I love the fun and simplicity of the PICAXE system but if Wine proves unreliable I'd feel forced to GCBASIC or different languages like C and Zig.
 
@Engle

SIMPE8 is written in Python, so it should run on any system that runs Python.

There are still a few bugs to iron out, and a few operations to add, before I can release it in the wild.

Would like to be my beta tester ?

Cheers,

Buzby
 
I'd be happy to do some testing.

I've tried to steer clear of python in the past, mainly because I didn't like the fit with microcontrollers and colleagues would complain of indentation and speed, but I'll see if I can be of help. Have 20 years of fairly extreme Office VBA experience that is rapidly being forgotten and some old Java, which led to dabbling with Kotlin too.
 
@Engle

That would be great.

I don't want you to edit the Python, I've got Claude doing that !.
( I exactly understand why you steered clear of Python, it's not my favourite either, but it is portable, so that's why I got the AI to write in Python. )

All I want is a list of un-captured syntax errors or faults in the executed code. Anything that's 'Not Right'.

The app is fairly easy to use. The PICAXE source files need to be named like MyProject_S00.bas, MyProject_S01, etc, where _Snn corresponds to the #Slot n directive in the file. They don't need to be contiguous, you could have _S00 and _S04, like you might find in a 20X2 project.

Cheers,

Buzby
 

Attachments

Last edited:
@Buzby

I've been helping my daughter move house over the weekend but taken an initial look this evening. It seems very easy to use and at full speed it runs like a Ferrari!! Setting breakpoints, step and run etc all worked a charm.

I found I have python 3.12.3 and there were a few small issues: when starting the script the tk import didn't work, so had to install that package. The demo file was missing a #picaxe definition. There were a couple of strange characters in the dialogue's title bar after SIMPE8.

For my lonely Linux environment it would be nice to have a simulator with M2 support but I realise you have different priorities. What would be a killer for me would be lack of pre-processor directives because I make extensive use of #define, #include etc. On the other hand I've been working on a maths module and this has been my main use of the PE simulator, so just testing its core code in isolation would be much faster in your app using a single slot.

It's fun to continue and I should find some more time tomorrow night or Wednesday. It would be a struggle to make an all encompassing simulator but others will probably want to set input values and simulate sound, displays and external EEPROM. That's a very tall order when it appears to me like a relatively small change to the PE, as you've pointed out.
 

Attachments

  • Screenshot Dialogue Title.png
    Screenshot Dialogue Title.png
    4.9 KB · Views: 5
What would be a killer for me would be lack of pre-processor directives because I make extensive use of #define, #include etc.
Engle & Buzby,

FYI. The user pliser wrote a Python script that can process the PICAXE "#" directives on Linux & Mac OS and in this post https://picaxeforum.co.uk/threads/is-picaxe-support-for-mac-officially-dead.32196/post-336485 he describes the latest updates to his script and gives the link where you can download it.

I'm not a python user so I don't know if this python pre-processor can be easily integrated into Buzby's Multi-slot simulator.
 
Latest.

Fixed a few bugs that were found when running the test BASIC in both PE and SIMPE8.

Regarding #MACRO and #INCLUDE, I think the simplest solution is to use PE's pre-compiler output file as the source.

SIMPE8 was born from the specific need to simulate my project, which does not ( yet ) have any IO. I wanted to get the complex logic sorted first.
 

Attachments

Last edited:
@Buzby

You've clearly put a great deal of work into development and testing! For slot simulation on X2's it's working very well so I'm sure it will serve you and others well. I completed my main round of testing, although I'll have a play with a couple of programs too, perhaps testing my UQ32.16 binary maths module in the simulator (it offers a heck of a lot of bit shifting, or a Newton-Raphson method for reciprocal based division too).

The attached provides tests and results, which I hope you don't think are too critical because it compares functionality against the PE, my slot specific expectations and some ideals. The missing functionality is clearly too much to ask from a hobbyist though and it's really there to share my perspective.

If you add pre-processor directives and a download option, you'd be pretty much a multi-platform PE. 😁

Thanks to Flenser for the link. I suppose this may make a convoluted way forward on Linux with that pre-processor. The PE Option "Diagnostics->Pre-Processor→Display Pre-processor Output” gives an error when doing a syntax check that the system can't find the specified file and that report was sent to RevEd.
 

Attachments

Thanks for your comprehensive and clear test result document. I wish all clients were like this !

1.4, Ergonomics. I never thought about dark/light themes, I like it bright. I don't know if tkinter has an overall theme function, all I've used is hardcoded colours. I will investigate, later. Coloured syntax highlighting in never coming in SIMPE8 !.

The Watch table was very tricky to determine exactly how it handled 'same byte, different symbol' across slots, so I decided all slots must have the same symbol definitions if you want a stable display.

TAB spacing bugs me too !. It's on my ToDo list, as is the terminal 'clear' button.

1.11, Known Syntax Omissions. I've not tested that specific INC of address 56. I'll put that on my ToDo list. Regarding 'symbol myzw = zw56' or similar, you are right. Another for my ToDo list !

1.14, Digital input setting. This will be coming, but not yet.

1.16, Chip graphics. Not likely. It would be easy to use the graphics from PE, but Rev-Ed would probably come down on me like a ton of bricks.

1.21, Freezing at row 184 etc. This should be fixed in the latest issue, at least in the Memory window. Not sure about the Watch window.

1.24, TABLE display. Might implement this, but I don't use it myself, so it's low on my ToDo list.

1.30, Directive support. #Directives are useful, and I'm going to look into them. However, it looks quite difficult to add a pre-processor. I'll try when I'm certain all that's currently implemented is working properly.

( The PE Pre-Processor I only know works on Windows. I don't use any Linux, so I can't help with your specific problem there. )

As for adding bells and whistles, such as variable display in binary, or simulating ADC, I won't be adding these unless I need them.
2.7, Reset. The 'Reset' function was more complicated than I expected, but resetting to Slot 0 is correct behavior for a PICAXE chip.

3.1, Simulated input from a terminal. This would be cool, but at the moment SIMPE8 has no inputs at all, not even from its own terminal window. This is high on my ToDo list.

3.5, Simulate more slots. SIMPE8 simulates slots from 0 to 31. ( I am unclear exactly what the highest #Slot PE can handle, or a PICAXE chip can address. It's at least 31, and might be 35. I thought 31 was big enough for anybody. ( Shades of '640K ought to be enough for anyone.' )

3.6, BootI2c. I like this. Another project of mine uses this extensively, along with READ/WRITE external EEPROM bytes. It would be cool to simulate not just #Slots, but the actual EEPROM as well. Wait and see.

The whole reason for developing this is because PE6 can't simulate multi-slot programmes, and I've got a project that needs to be able to simulate a fully #slot based system. We had never had a reason from Rev_Ed why PE6 won't support multi-slot, even though it was requested before PE6 was released many years ago.
 
Glad you liked the report. Your plans look good.

I was getting the pre-processor error message on Windows with PE 6.2.0.0. The error in Linux is subtly different, saying "file not found" instead of the "system cannot find the file specified". I presume its my setup and not fixed in the PE 6.2.1.0 patch, which I couldn't install in Linux anyway. For now I'll have a play with Pleiser's python pre-processor and if that works it may reinvigorate my interest in getting the Kate text/code editor running again with the Linux compilers. RevEd had some instructions for Kate but these stopped working when Kate made major changes in the past.

I sympathise with RevEd tring to support lots of features and platforms in what may be a limited and even reducing market. Unless I've missed it, it would be good to hear a possible timeline, or a flat no, to slot simulation and Linux support in the PE in future. For Linux, the desktop share is still small but has doubled in the last 2 years and doubled in the previous 10 years too. Windows 10 retirement has been a factor here but it's also driven by Linux maturity and the financial and geopolitical reasons that will no doubt follow down to schools too. After all, my 9 year old Linux PC probably runs faster than my 2 year old Windows PC!
 
I don't sympathise with Rev-Ed at all. They knew about the request for multi-slot well before PE6 was released, so they could have said then that the feature was not going to be included, then keep us hanging on for years with no indication one way or the other.

The problem is compounded by the fact that Rev-ED have used Smart Assembly to completely obfusticate the executable, never mind letting it go open source. Why they made these decisions is beyond my comprehension.

Rev-Ed make no money from PE6, its given away free. An open-source model would allow other to improve or cross-platform it, at no cost to Rev-Ed. There will be the issue of support for 'unofficial' PEs, but there are ways to alleviate this.

Anyway, here is the latest version. This one has a Terminal 'Print' button. This is the thing I can't test on Linux. It should open your default text editor, and you print from there. On Windows it opens Notepad. ( It also has a Grid Terminal, which handles a few VT-100 type cursor positioning controls. Not needed for most people, but I have a project where it will be very useful. )

Regarding the pre-processor on Windows, I'm using 6.2.0.0, ( no patch )and it works fine.
 

Attachments

Last edited:
@Buzby It opened my default editor, Kate, no problems. The Clear worked too. Obviously the escape sequences look a little odd but the screen grab shows how it looked.
 

Attachments

  • Screenshot from 2026-02-26 21-42-02.png
    Screenshot from 2026-02-26 21-42-02.png
    62 KB · Views: 4
There are two buttons, 'Terminal' and 'Grid Terminal'. Did you try the test in both versions of the terminal ?
 
Missed that but Grid Terminal works a treat. VT100 takes me back a few decades!
 

Attachments

  • Screenshot from 2026-02-26 22-38-08.png
    Screenshot from 2026-02-26 22-38-08.png
    58.2 KB · Views: 5
Back
Top