Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 07:36 05 Jul 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 : dim var as byte

     Page 8 of 16    
Author Message
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2586
Posted: 04:36am 07 Aug 2022
Copy link to clipboard 
Print this post

  Quote  
teraterm is imho terrible to use. I can't use it for writing a program.

Repeating what so many have said, it is a terminal, not an editor BUT you can program through TeraTerm to the MMBasic editor in the PicoMite firmware. At the > prompt (in the TeraTerm window) type EDIT<enter> or press F4 (shortcut for EDIT), and the editor will takeover the TeraTerm window. The mouse is not supported by the internal editor, F-key commands relevant to the current state of the editor are listed along the bottom of the editor window. Practice on a very small program first. When finished press F1 to save or F2 to save and run immediately.
To view the resulting program type LIST<enter> or press F3 (shortcut for LIST).
This is all in the Manual.
Edited 2022-08-07 14:38 by phil99
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7830
Posted: 06:46am 07 Aug 2022
Copy link to clipboard 
Print this post

From my personal point of view, Tera Term is probably one of the best terminals you can get for Windows and it's the only one that's *guaranteed* to work wih the PicoMite without hassle. It's awful for writing programs because that's not what it does and it can't do it. :)

In spite of what some others say, I love using the built-in editor in the 'Mites. It's easier to see than the GUI editors and has a lovely 80's computer look to it. :) The only problems with it as far as I'm concerned are that you can't copy & paste blocks of over 256 characters within it and pasting pieces of code from an external file is a pain. (If I want to do patchwork programming like that I work with the SD card and do part of the editing in Notepad on the PC.) It's very fast to develop small to medium sized programs using it.

I did try an earlier version of MMEdit but we didn't get along well together, probably because I just don't like GUI editors. It's why I prefer Notepad to Notepad++ for most things. :)  I tend to go "icon blind" sometimes, where I see the icons but they lose their meaning. Without hot tips they are useless to me when I get like that.
Mick

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

Joined: 11/12/2012
Location: United Kingdom
Posts: 10201
Posted: 06:51am 07 Aug 2022
Copy link to clipboard 
Print this post

  Quote  It's annoying that I can't see why my code doesn't work and nobody can point out why.
Is it that rpi pico and mmbasic is buggy? It's not a "mite" yet.


A lot of people have spent significant time trying to help you but you seem determined to ignore them and the documentation and the simple fact that half the time you aren't even talking to the Pico but Jim's test server.
Sorry, but I for one will no longer be replying to you.
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4301
Posted: 07:31am 07 Aug 2022
Copy link to clipboard 
Print this post

@stanleyella

Firstly do yourself a favour and set MMEdit aside until you have mastered the basics of TeraTerm and the PicoMite with its in-firmware EDIT command. Sure IDE's are great but they are also a crutch and blind use of them stunts understanding.

Secondly don't start by trying to port a graphical program from a different BASIC dialect. Either start with a non graphical program, or write some simple graphical examples yourself, or look at a pre-existing PicoMite program - does anyone have a link to PicoInvaders? - I'm on my phone.

Thirdly when reporting an issue or asking a question reduce your problem to the smallest example that demonstrates the issue and provide step by step instructions of what you are doing. Try to limit yourself to one outstanding problem at a time.

Finally, don't assume MMBasic or the PicoMite are "beta quality". Sure, they are not perfect, but they are extremely functional and for the most part the developer is extremely responsive to bug reports.

Best wishes,

Tom
Edited 2022-08-07 17:32 by thwill
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2527
Posted: 03:41pm 07 Aug 2022
Copy link to clipboard 
Print this post

first, thanks for the help and patience with a new user.
I do read instructions!
How tassyjim chat in mmedit not a clue but I set up mmedit to serial com 13 and not getting errors but not right but getting somewhere. Thanks
sorry I don't like teraterm. I'm a win mouse user, it's 2022 not 80's.

In spite of what some others say, I love using the built-in editor in the 'Mites. It's easier to see than the GUI editors and has a lovely 80's computer look to it. :)

not my thoughts. if I get mmedit or notepad to work then mmbasic will be excellent.

all this from an ExplainingComputers.com youtube video that made mmbasic on rpipico look easy , ha.
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2527
Posted: 04:25pm 07 Aug 2022
Copy link to clipboard 
Print this post

Firstly do yourself a favour and set MMEdit aside until you have mastered the basics of TeraTerm and the PicoMite with its in-firmware EDIT command. Sure IDE's are great but they are also a crutch and blind use of them stunts understanding.

Secondly don't start by trying to port a graphical program from a different BASIC dialect. Either start with a non graphical program, or write some simple graphical examples yourself, or look at a pre-existing PicoMite program

cheers but my using picomite?? was it's graphics with ili9341 and touch works and looks promising and it reads the sd card which wasn't implemented in a previous basic so was attractive feature.

I should start mmedit with a simple print "hello" but that didn't work on lcd. Yawn.
I'll get there I hope. It's become a challenge to get it working but it won't beat me.
I shall go to the ball.
 
pwillard
Guru

Joined: 07/06/2022
Location: United States
Posts: 313
Posted: 05:10pm 07 Aug 2022
Copy link to clipboard 
Print this post

Way back on page 3 I recommended...
And really... you need to isolate your code blocks into things that work before tackling the "whole enchilada" in one bite.


You should really try it.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7830
Posted: 05:36pm 07 Aug 2022
Copy link to clipboard 
Print this post

We keep getting back to the manual, I'm afraid. :( You have to look up every command that you want to use to see how it works in MMBasic - not Spectrum BASIC or Free BASIC or Apple BASIC or Commodore BASIC or any other variation.

PRINT sends text to the console.
TEXT sends text to a graphical display.
CLS clears a graphical display.

You have to get it into your head that the console and graphic displays are separate and both can be attached to the same PicoMite at the same time. They work independently, using their own commands, and have different capabilities.

When you write a text-only program its output goes to the console by default, the graphical display is ignored. It's a good way to experiment with MMBasic for the beginner. Then you can modify it - changing PRINT commands to TEXT (with other suitable changes, of course) to send the output to a LCD display.

I know you want to bypass all this "boring" stuff and get your program written, but you are making it very difficult for yourself in the long run. You aren't learning how and why things work in a particular way.

I can assure you that MMBasic on the PicoMite is currently pretty bomb-proof. There are probably still bugs (all software has them) but none that most people will come across under most circumstances. It's almost certain that if something doesn't work you've done something wrong. The first step is to try to isolate the faulty bit of code and write some test routines to see where you've made the error. You may have to re-write something. You'll probably have to check commands in the manual as you go along.

The built-in editor is simple and quick to use, even if you don't like it. :) It has the big advantage that you can switch to Edit mode by pressing F4 and back to command mode using F1. There's no uploading to the PicoMite, everything is self-contained. While in command mode you can quickly save or restore flash slots, so you don't *have* to have a SD card. Yes, there are more flexible editors but you don't need them for learning MMBasic. In fact, by breaking up the programming flow, they get in the way of the learning process. You are having to learn MMBasic *and* an editor/IDE at the same time. Far better to just learn one at once.
Mick

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

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1220
Posted: 06:18pm 07 Aug 2022
Copy link to clipboard 
Print this post

  thwill said  @stanleyella
... , or look at a pre-existing PicoMite program - does anyone have a link to PicoInvaders? - I'm on my phone.

Thirdly when reporting an issue or asking a question reduce your problem to the smallest example that demonstrates the issue and provide step by step instructions of what you are doing. Try to limit yourself to one outstanding problem at a time.

Finally, don't assume MMBasic or the PicoMite are "beta quality". Sure, they are not perfect, but they are extremely functional and for the most part the developer is extremely responsive to bug reports.

Best wishes,

Tom

thank you Tom for the recommendation
https://www.thebackshed.com/forum/ViewTopic.php?FID=16&TID=14976

I started with MM Basic after I saw it in the Youtube-Video by by Christopher Barnatt https://www.youtube.com/watch?v=Cxmjy1nz6MM
I started programming Basic with the ZX 81 - Spectrum - Dragon32 etc.. up to Visual Basic and VBA.
This was 40 years ago, so I have to remeber and learn the particularities of MM-Basic, so PicoVaders is just a "Snapshot of my learning curve.

So, as recommendet, start with simple little Programs and see how far you get.
Edited 2022-08-08 04:46 by Martin H.
'no comment
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2527
Posted: 07:17pm 07 Aug 2022
Copy link to clipboard 
Print this post

mmedit works! :)
cls
text 10,10,"hello"
box 8,8,100,20
does it on lcd no errors just click running man button, as it should be in 2022.
no teraterm just mmedit com13:115200
Thanks for info guys, I think it will work and sorry I expressed my frustration by negative comments. I still think mmedit is better than tera term, sorry.
I'll try a program and see what happens. This is the furthest I got with mmbasic/mmedit.. code that runs.
errors are my fault but without the forum advice would not have sorted mmedit or variables. cheers, I appreciate your advice. no way I can offer help yet.
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2527
Posted: 08:41pm 07 Aug 2022
Copy link to clipboard 
Print this post

this works!
cls
CONST bk = RGB(BLack)
const wh = rgb(white)
const bl = rgb(blue)
const gr = rgb(green)
const cy = rgb(cyan)
const re = rgb(red)
const ma = rgb(magenta)
const ye = rgb(yellow)
const br = rgb(brown)
text 10,10,"hello"
box 8,8,100,20
for n = 10 to 100 step 5
 circle 120,120,n
next

for  y=100 to 105
 for x=10 to 200
   pixel x,y,ye
 next x
next y
for x=20 to 50 step 5
 box x,50,x,x,4,bl
next x
I've not set variables, they're default. Finally getting somewhere, pleased, constant colour abreviations work. looking good, one simple connect button option and it falls over but nice when it works. ie. mmedit not mmbasic. finally coding.. I hope
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2527
Posted: 09:10pm 07 Aug 2022
Copy link to clipboard 
Print this post

My sprite code DOES WORK! I'm really happy I got it all working.. with help from the forum. My problems where also variables. I haven't bothered setting variables, they default and ok but you got to dim arrays.

dim sp1(255),sp2(255)

CONST bk = RGB(BLack)
const wh = rgb(white)
const bl = rgb(blue)
const gr = rgb(green)
const cy = rgb(cyan)
const re = rgb(red)
const ma = rgb(magenta)
const ye = rgb(yellow)
const br = rgb(brown)
'
restore
for ptr=0 to 255
 read sp1(ptr)
next ptr

spx=100
spy=100

cls
sprite1
do
loop

sub sprite1
 ptr=0
 for spht=0 to 15
   for spw=0 to 15
     pixel spx+spw,spy+spht,sp1(ptr)
     ptr=ptr+1
   next spw
 next spht
end sub

data wh,bl,bl,bl,bl,bk,bk,bk,bk,bk,bk,bl,bl,bl,bl,wh
data bk,bl,re,re,re,bl,bl,bk,bk,bl,bl,re,re,re,bl,bk
data bk,bk,bk,bl,re,wh,bl,bk,bk,bl,wh,re,bl,bk,bk,bk
data bk,bk,bk,bl,re,wh,bl,bk,bk,bl,wh,re,bl,bk,bk,bk
data bk,bk,bk,bk,bl,wh,bl,bk,bk,bl,wh,bl,bk,bk,bk,bk
data bk,bk,bk,bk,bk,bl,bl,bk,bk,bl,bl,bk,bk,bk,bk,bk
data bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk
data bk,bk,bk,bk,ye,ye,ye,bk,bk,ye,ye,ye,bk,bk,bk,bk
data bk,bk,bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk,bk,bk
data bk,ye,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,ye,bk
data bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk
data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bl,ye
data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye
data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye
data bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk
data bk,bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk,bk
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2527
Posted: 09:39pm 07 Aug 2022
Copy link to clipboard 
Print this post

as I set up the lcd and calibrated it in teraterm there's no reference to the lcd in the code. this is new to me but it works. only prob is it's landscape and I want portrait and looks hard to change.. like I don't want to mess it up as it's working.
mmedit is working like a nice ide without much icon overload, just connect button then running man button to save/run. I don't get errors since setting connect serial com 13.
it's nice to use, all mouse. I'm very happy after all the effort to have it working. pity it was so trivial a setup option that stopped it working for me.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6268
Posted: 09:51pm 07 Aug 2022
Copy link to clipboard 
Print this post

Please use the "code" tags if you post code. It is much easier for others to follow.
If you are going to quote others in your reply, use the "quote" tags. It saves a lot of confusion.
Both tags can be inserted using the buttons above the forum text entry box.

Use the preview to see the results.

Please remember that MMEdit is not clever. It highlights words that in it's keyword list but  does NOT tell you if you are using the correct command in the correct place. It is a dumb text editor. A chisel and a slab of sandstone is just as clever.

Please also remember that we all have strongly recommended that you use OPTION EXPLICIT and OPTION DEFAULT xxx at the start of anything more than a couple of lines. It is a good habit to get into and saves a lot of grief.
VK7JH
MMedit
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2527
Posted: 10:14pm 07 Aug 2022
Copy link to clipboard 
Print this post

OK option explicit but now it works I found I don't have to load an array from data, I can plot data directly even though there's loads of ram.. maybe ram is faster.
This idea was converted from a basic that used tables.. like data in prog mem.

CONST bk = RGB(BLack)   colour abbreviations
const wh = rgb(white)
const bl = rgb(blue)
const gr = rgb(green)
const cy = rgb(cyan)
const re = rgb(red)
const ma = rgb(magenta)
const ye = rgb(yellow)
const br = rgb(brown)
'
spx=100 'sprite x
spy=100 'sprite y

cls
sprite1 'draw sprite1
do
loop

sub sprite1
 restore sprite1data
 for spht=0 to 15 'y axis
   for spw=0 to 15 'x axis
     read sp1 'read sprite1data
     pixel spx+spw,spy+spht,sp1 'plot sprit1data
   next spw
 next spht
end sub

sprite1data: 'pixel colours
data wh,bl,bl,bl,bl,bk,bk,bk,bk,bk,bk,bl,bl,bl,bl,wh
data bk,bl,re,re,re,bl,bl,bk,bk,bl,bl,re,re,re,bl,bk
data bk,bk,bk,bl,re,wh,bl,bk,bk,bl,wh,re,bl,bk,bk,bk
data bk,bk,bk,bl,re,wh,bl,bk,bk,bl,wh,re,bl,bk,bk,bk
data bk,bk,bk,bk,bl,wh,bl,bk,bk,bl,wh,bl,bk,bk,bk,bk
data bk,bk,bk,bk,bk,bl,bl,bk,bk,bl,bl,bk,bk,bk,bk,bk
data bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk
data bk,bk,bk,bk,ye,ye,ye,bk,bk,ye,ye,ye,bk,bk,bk,bk
data bk,bk,bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk,bk,bk
data bk,ye,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,ye,bk
data bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk
data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bl,ye
data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye
data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye
data bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk
data bk,bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk,bk
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2527
Posted: 10:49pm 07 Aug 2022
Copy link to clipboard 
Print this post

  Quote  

option default give invalid option error the rest is ok
OPTION BASE 0        ' 0 based arrays
OPTION EXPLICIT
dim spw,spht,spx,spy,sp1 integer

CONST bk = RGB(BLack)
const wh = rgb(white)
const bl = rgb(blue)
const gr = rgb(green)
const cy = rgb(cyan)
const re = rgb(red)
const ma = rgb(magenta)
const ye = rgb(yellow)
const br = rgb(brown)
'
spx=100
spy=100

cls
sprite1
do
loop

sub sprite1
 restore sprite1data
 for spht=0 to 15
   for spw=0 to 15
     read sp1
     pixel spx+spw,spy+spht,sp1
   next spw
 next spht
end sub
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3348
Posted: 11:49pm 07 Aug 2022
Copy link to clipboard 
Print this post

Note that with the code shown, you still haven't defined spw, spht, etc. as integers:

> new
> option explicit
> dim spw,spht,spx,spy,sp1 integer
> spw=4
> spw=spw/3
> ?spw
1.333333333

spw is a floating point variable. Please read the manual to see how to specify the type of a variable. (Many people have already shown you correct examples.)
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1638
Posted: 12:13am 08 Aug 2022
Copy link to clipboard 
Print this post

From the manuals:

OPTION DEFAULT INTEGER




DISPLAY ORIENTATION




Bill
Keep safe. Live long and prosper.
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2586
Posted: 01:52am 08 Aug 2022
Copy link to clipboard 
Print this post

You have portrait mode because that is what you have set.
Following the above instructions you need to change the saved LCD option.
In your post at 07:12 Aug 6 you have:-
  Quote  
> option list
OPTION SYSTEM SPI GP18,GP19,GP16
OPTION LCDPANEL ILI9341, LANDSCAPE,GP15,GP14,GP13
OPTION TOUCH GP12,GP11
GUI CALIBRATE 0, 3878, 3882, -881, -647
OPTION SDCARD GP22


remove landscape with

OPTION LCDPANEL DISABLE

Then re-do it with

OPTION LCDPANEL ILI9341, PORTRAIT,GP15,GP14,GP13

As shown in Peter's post just above yours.

You may have to re-do GUI CALIBRATE if the touch co-ordinates are now wrong.
Edited 2022-08-08 17:47 by phil99
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4034
Posted: 09:19am 08 Aug 2022
Copy link to clipboard 
Print this post

  stanleyella said  
option default give invalid option error the rest is ok

It doesn't follow the manual, so an error is to be expected!

John
Edited 2022-08-08 19:20 by JohnS
 
     Page 8 of 16    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025