Picomite/PicoMiteVGA V5.07.05 release candidates


Author Message
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4048
Posted: 08:32am 30 Sep 2022      

Kudos to Jim for identifying the cause by inspection, minimal example to reproduce:

PicoMiteVGA MMBasic Version 5.07.05RC3
Copyright 2011-2022 Geoff Graham
Copyright 2016-2022 Peter Mather

> load "bug.bas"
> list
Option Break 4
On Key 3, break_interrupt
Do : Loop

Sub break_interrupt()
 End
End Sub
> run "bug.bas"


Press CTRL-C

> xmodem receive "some_file.bas"


From TeraTerm: [Transfer->XMODEM->Send...] "non-trivial-file.bas"

The PicoMite{VGA} hangs and must be reset.

The fix within the program appears to be to clear the interrupt:

Sub break_interrupt()
 On Key 3, 0
 End
End Sub


It is not sufficient/necessary to restore OPTION BREAK.

Best wishes,

Tom
Edited 2022-09-30 18:32 by thwill

thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4048
Posted: 08:34am 30 Sep 2022      

  Turbo46 said  
  the manual said  OPTION BREAK 4 will set the break key to the CTRL-D key

So what does typing Control_C do? What it says I guess but is the program still running?


It just puts ASCII code 3 in the keyboard input buffer which you can then read with INKEY$ (or calls an installed ON KEY 3, interrupt).

Best wishes,

Tom

matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9172
Posted: 08:51am 30 Sep 2022      

Tom

Please try the attached


PicoMiteVGA.zip

Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 516
Posted: 03:02pm 30 Sep 2022      

Hi Peter,
I am having problems with blit/sprite load.
PicoMiteVGA MMBasic Version 5.07.05RC4
If I do:-
load image "small.bmp"
The image loads fine, is displayed on the screen, no errors.
However I then tried.
> sprite load #1, "small.bmp"
Error : Syntax
> blit load #1, "small.bmp",0,0,19,17
Error : Syntax
> sprite load #1, "small.bmp",0,0,19,17
Error : Syntax
> blit load 1, "small.bmp",0,0,19,17  
Error : Syntax
> blit load #1, "small", 0,0,19,17    
Error : Syntax
I get the same in a program as well.
I've thoroughly scanned the manual but I can't see what I'm doing wrong.
Any suggestions.
Regards Kevin.

matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9172
Posted: 03:12pm 30 Sep 2022      

SPRITE LOAD loads a Maximite style text file - see the manual. Use SPRITE LOADBMP for a BMP. This however is missing from the manual. I'll ask Geoff to add it.

Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 516
Posted: 04:13pm 30 Sep 2022      

Hi Peter,
From the manual, Page 58. :-(
  Quote  BLIT LOAD will load a blit buffer from a 24-bit bmp image file. x,y define
the start position in the image to start loading and w,h specify the width and
height of the area to be loaded.
e.g.
BLIT LOAD #1,"image1", 50,50,100,100
will load an area of 100 pixels square with the top left had corner at 50,50
from the image image1.bmp
BLIT CLOSE will close the memory buffer '#b' to allow it to be used for
another BLIT READ operation and recover the memory used.
Notes:
? Thirty two buffers are available ranging from #1 to #32.
? When specifying the buffer number the # symbol is optional.
All other arguments are in pixels.

So I suspect this is your SPRITE LOADBMP or BLIT LOADBMP, but with the wrong command?
I've got around it for the moment by doing a :-
Load Image "small.bmp"
 For i=1 To 12:Sprite Read i,((i-1) Mod 12)*20,(i-1)\12*20,20,20:Next i

I'll try the SPRITE LOADBMP or BLIT LOADBMP? in a bit.
Regards Kevin.

Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 516
Posted: 04:13pm 30 Sep 2022      

Duplicate deleted.
Edited 2022-10-01 02:16 by Bleep

matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9172
Posted: 04:22pm 30 Sep 2022      

I'm looking at latest manual posted for review

Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 516
Posted: 04:30pm 30 Sep 2022      

Yep that's the one, page 58. :-)
Regards Kevin.

matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9172
Posted: 04:36pm 30 Sep 2022      

I'm looking at page 87 - some corrections needed  

Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 516
Posted: 05:04pm 30 Sep 2022      

Yep I did find that once you mentioned it. :-)
All it needs is for the command "BLIT LOAD" on page 58 to be changed to "BLIT LOADBMP" though the fact that there is a section for "SPRITE" & another for "BLIT" probably needs sorting as my understanding is BLIT & SPRITE are now the same thing?
Regards Kevin.

Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4271
Posted: 07:09pm 30 Sep 2022      

@Peter,

Running pico VGA 5.07.05RC4
Trying to port bar1010's CMM2 chess example to pico.
Stripped most graphics
Renamed "search" to "asearch" since search seems to be a keyword (MMEdit5 says).
Changed the TEXT to simple print.

The engine seems to run, but the code starts modifying itself....

See below
RUN
Tom Kerrigan's Simple Chess Program
(TSCP) version 1.81c, 2/3/19
Copyright 2019 Tom Kerrigan
MMBasic conversion by ceptimus
version 0.9g 29/11/19
"help" displays a list of commands
tscp>
help

on - computer plays
    for the side to move
off - computer stops playing
st n - search for n secs per move
sd n - search n ply per move
undo - takes back a move
new - starts a new game
v - view board from opposite side
bench - run the built-in benchmark
bye - exit the program
Enter moves in coordinate notation
              e.g., e2e4, e7e8Q
tscp>
on

Computer's move: d2d4
tscp>
d7d5

Computer's move: g1f3
tscp>
b8a6

ply    nodes  score  pv
 1       34     50
b1c3

[91] If n=-1 Then Len(
Error : Expected closing bracket
>


Line 91 in the code says
If n=-1 then exit do


The program stalls, and pico needs to re-power to start again.
Below is the code.

chess_try.zip

Is this a stack/heap issue (to much memory used by thinking too deep ?)

Volhout

TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6108
Posted: 08:24pm 30 Sep 2022      

  Volhout said  
Renamed "search" to "asearch" since search seems to be a keyword (MMEdit5 says).

Use LIST COMMANDS and LIST FUNCTIONS to get the critical keywords.
MMEdit includes a lot of parameters as well and SEARCH if probably left over from a parameter of a previous version of MMBasic. I can't find it anywhere in picomite parameters.
I will remove it from the list.
Jim

thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4048
Posted: 09:46pm 30 Sep 2022      

  matherp said  Tom

Please try the attached

PicoMiteVGA.zip


Thanks Peter,

I've only had time this evening for the briefest smoke-test but that seems to work.

Also unless I'm mistaken it looks like you have also made "PLAY STOP" on break and END, but not on ERROR. Thank you for the first two, is there a reason for not doing so on the latter as well ?

Best wishes,

Tom

matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9172
Posted: 07:49am 01 Oct 2022      

  Quote  Is this a stack/heap issue (to much memory used by thinking too deep ?)


Looks like C stack overflow
I just let it play itself and it went further before giving an incorrect error. Interestingly it dropped the USB CDC but I could still use the PS2 keyboard and enter edit but wouldn't exit from edit.
You will have to try to simplify in some way (inline subs etc.)

Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4271
Posted: 08:55am 01 Oct 2022      

Hi Peter,

Thanks for looking. What would you advise? Limit the number of subs, or make the subs smaller in size, or limit usage of local variables?

Edit: there is not much to gain. I will have to check how much nesting is going on.
Edited 2022-10-01 19:22 by Volhout

Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 516
Posted: 10:00am 01 Oct 2022      

Hi Volhout,
You and I have started the same thing. :-) I'm getting exactly the same type of crash as you. I have integrated all the graphics on to a mode 2 screen, except all the pieces are prawns ;-) I was going to work on getting that going better if/when I/we can get the code to work.
Bar has now specified we should get Tom Kerrigan's permission before releasing a working version, I'm hoping that will not be a problem as he has specifically put this out as an example of how to do it.
I don't currently think it's an out of memory problem, unless there is a recursion/stack problem, I did a version with memory utilisation as low as I could get, but still working and it still crashed.

Regards Kevin.

My version with working graphics attached.
TSCPChess.zip

PS. I have just done a request to both Tom and Bar to confirm that we can continue using their code to convert to MMBasic on PicoMite.
PPS. Might be a good idea to move this discussion to a new thread, or possibly over to bars original thread?
Edited 2022-10-01 20:41 by Bleep

Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4271
Posted: 11:28am 01 Oct 2022      

Hi Kevin,

Agree, let's move to the other thread for the chess development. Tonight I will check your graphics.

But

If both of us get the same crash behaviour withou any sensible error message we will need Peters help to get closer to a solution.
I can exactly duplicate what Peter observed. The USB disconnecting, PS2 works, the editor that can start but not close, and in the editor, at line 91, the changed commands. At reboot the program is again correct.
Maybe a test version of the firmware with larger stack, or some debug Peter wants to add.

I think we should realize nor all programs that run on cmm2 will run on pico, but when you use pure basic, not a direct poke into some invalid location, you would expect a clean stop. Or a watchdog reboot.? Preferably with a error desciption.

This part of the fix should remain in this thread I believe..

Volhout

EDIT: I ran the code in MMB4W and noticed it uses 99kbyte in variables. Seems like a lot. But it runs in MMB4W. Maybe it is simply a memory issue.
Edited 2022-10-01 21:56 by Volhout

Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4271
Posted: 12:00pm 01 Oct 2022      

  Bleep said  Hi Volhout,
You and I have started the same thing. :-) I'm getting exactly the same type of crash as you. I have integrated all the graphics on to a mode 2 screen, except all the pieces are prawns ;-) I was going to work on getting that going better if/when I/we can get the code to work.
Bar has now specified we should get Tom Kerrigan's permission before releasing a working version, I'm hoping that will not be a problem as he has specifically put this out as an example of how to do it.
I don't currently think it's an out of memory problem, unless there is a recursion/stack problem, I did a version with memory utilisation as low as I could get, but still working and it still crashed.

Regards Kevin.

My version with working graphics attached.
TSCPChess.zip

PS. I have just done a request to both Tom and Bar to confirm that we can continue using their code to convert to MMBasic on PicoMite.
PPS. Might be a good idea to move this discussion to a new thread, or possibly over to bars original thread?


Missing sprite files in the ZIP

Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4271
Posted: 12:32pm 01 Oct 2022      

@Peter,

Tried the chess program on the normal picomite, and it goes for 5 moves before it stops. Used 99k vars, 53k free. The VGA version goes for 2-3 moves before it stops Used 99k, 31k free. I try "on" to play it against itself, so it would be better repeatable.

As before: on MMB4W the program runs for at least 20 moves (then I was beaten by the computer).

Volhout
Edited 2022-10-01 22:36 by Volhout