Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 10:36 01 Aug 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 : polygons

     Page 1 of 2    
Author Message
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2566
Posted: 08:27pm 23 Feb 2023
Copy link to clipboard 
Print this post

Hi, in the manual it says under polygons- For example, this will draw 3 triangles in yellow, green and red:
DIM c%(2)=(3,3,3)
DIM x%(8)=(100,50,150,100,50,150,100,50,150)
DIM y%(8)=(50,100,100,150,200,200,250,300,300)
DIM fc%(2)=(rgb(yellow),rgb(green),rgb(red))
POLYGON c%(),x%(),y%(),fc%(),fc%()

But it only draws 2 triangles, yellow and green.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 08:44pm 23 Feb 2023
Copy link to clipboard 
Print this post

You didn't say what size screen you are using but I guess it is too small for the coordinates so the last triangle is off screen.
If using a 320 by 240 display try:
DIM c%(2)=(3,3,3)
DIM x%(8)=(100,50,150,100,50,150,200,150,250)
DIM y%(8)=(50,100,100,150,200,200,150,200,200)
DIM fc%(2)=(RGB(YELLOW),RGB(GREEN),RGB(RED))
CLS
POLYGON c%(),x%(),y%(),fc%(),fc%()

VK7JH
MMedit
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2566
Posted: 09:05pm 23 Feb 2023
Copy link to clipboard 
Print this post

@TassyJim, thanks. My first polygon test. What resolution was the manual referring to as mode 2 320x240 is the only colour vga mode?
I don't understand the code
dim x%(8) 9 elements so arrays start at 0?
Very hard to understand code without comments as to what each line does.
cheers, stan
Edited 2023-02-24 07:07 by stanleyella
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 09:14pm 23 Feb 2023
Copy link to clipboard 
Print this post

arrays can start at a base of zero (the default) in which case the 9 values are from zero to 8

If you use OPTION BASE 1, the 9 values would be from 1 to 9, in which case they wouldn't fit.

You didn't say what version of picomite you were using so I had no idea that 320 x 240 was the only option. The standard pico can have many different display resolutions.

I think the manual probably should be changed to fit 320 x 240.

The help file does explain each line of the code. This sort of command does need playing around with to learn what it can do.

Jim
VK7JH
MMedit
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2566
Posted: 09:52pm 23 Feb 2023
Copy link to clipboard 
Print this post

Hi Jim, I'm using rpi picomite vga beta v7,7,b18. afaik mode 2 320x240 16 colour is only colour mode, 8 colour with simpler vga circuit.
the latest manual for vga has errors like only 8 sprites when there are 32. Lots of other errors that probably refer to pre rpi picomite yet it goes into rpi-picomite gpio programming so is for rpi picomite. The manual is very important. Should not need forum help. I don't know where the help file is that explains each line of the code, using opera as pdf viewer where it shows as microsoft word doc.
stan
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7937
Posted: 10:25pm 23 Feb 2023
Copy link to clipboard 
Print this post

There aren't all that many fully worked lines of code in the manual - it would be huge if everything was covered like that. Instead every command and function is listed, together with the possible options. If you would like to write a more in-depth manual that shows a worked example of every command and function I'm sure no-one would mind. :)

There are errors in the manual. Geoff does a great job but the manual only gets updated on each full release, *not on alpha or beta releases*, so a lot of what we see as familiar stuff isn't in the manual. They are always out of step. It would be far too much work to update it continually. Consequently, if you want to depend on the manual then only run that particular release of MMBasic - and (I don't think Geoff will mind me saying this) there's still no guarantee that it'll be error free. :)
Mick

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

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 10:27pm 23 Feb 2023
Copy link to clipboard 
Print this post

My apologies Stan.
I was trying to help you, not get into an argument.
Sorry again.
I won't make that mistake again.

Good luck.
VK7JH
MMedit
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 10:37pm 23 Feb 2023
Copy link to clipboard 
Print this post

Geoff and I are clearly not competent to write a manual that is good enough for you so please use another platform. I'm sure you would find the Arduino documentation much better -NOT
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2566
Posted: 12:02am 24 Feb 2023
Copy link to clipboard 
Print this post

I'm sorry. It Is a great manual.
Jim said "I think the manual probably should be changed to fit 320 x 240."
Yes because rpi picomite seems to be the focus and that's it's colour vga res.
Referring to sprites, or blits in non vga mmbasic, both manuals say only 8 sprites or blits.
polygons- Jim said " This sort of command does need playing around with to learn what it can do."
Compared to box,circle,triangle,arc yes.
It comes together after study. DIM n(1)=(3,3) would define that 2 polygons are to be
drawn with three vertices each.
So DIM c%(2)=(3,3,3) makes sense now... 3  polygons are to be
drawn with three vertices each. I thought arrays default to 1 as 1st element.
I should have worked out the demo problem myself but assumed it would work. Still don't know what res it was for.
@Mixtel90 said "Consequently, if you want to depend on the manual then only run that particular release of MMBasic"
??? I'm using rpi picomite vga second version manual. I do depend on the manual and am using that. Don't know what you mean  "Consequently, if you want to depend on the manual then only run that particular release of MMBasic"
I seemed to have pissed people off, not my intention.
I'm using beta 18 and 9 pages on the forum people reporting what's wrong but I say about errors in the manual and get slated??
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2566
Posted: 12:18am 24 Feb 2023
Copy link to clipboard 
Print this post

  matherp said  Geoff and I are clearly not competent to write a manual that is good enough for you so please use another platform. I'm sure you would find the Arduino documentation much better -NOT


You posted when I was replying. That is not the case. I never used arduino just picaxe and gcbasic. Their manuals are not brill, they use an ide with help button but results can be minimum of help for new user.
Actually now prodded, ESP32 fabgl has 2 basic interpreters and is supposed to be a retro 80,s computer and looks better spec than rpi picomite and I have a board so I may take your advice.
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4311
Posted: 12:18am 24 Feb 2023
Copy link to clipboard 
Print this post

I wouldn't worry about it Stan, the written word on the internet is a poor substitute for face to face communication and one of its worse aspects is is tendency to exaggerate critique.

I think Mick's point was that if you are running an alpha or a beta then the manual is by definition out of date as Geoff only issues versions (and corrections) corresponding to release versions off the firmware.

Best wishes,

Tom
Edited 2023-02-24 10:20 by thwill
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2640
Posted: 04:51am 24 Feb 2023
Copy link to clipboard 
Print this post

Most Beta Zip packages include "PicoMite_readme.txt" which contains brief descriptions of what has changed.
If you need more info on particular changes search the forum using key words from that file.
In your browser search area type:-

site:thebackshed.com  searchterms

eg. site:thebackshed.com stanleyella AND polygon  shows all the the posts with those words with this thread at the top, including this from 2015 (not PicoMite but interesting anyway):-

https://www.thebackshed.com/forum/uploads/darthmite/2015-10-28_214154_polygon.pdf
.
Edited 2023-02-24 15:12 by phil99
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1642
Posted: 05:14am 24 Feb 2023
Copy link to clipboard 
Print this post

Stan, If you find what you think is a bug in the program or the manual I think you should report it in the post where the program was presented after checking that it has not already been reported.

We are blessed to have such great software, manuals and support. I don't know how they do it for the price!  

On that note, before you joined the forum, the suggestion was made several times that Geoff and Peter should have a donate button somewhere but that was always ignored so we just gave up.

Like you I heavily rely on the manual so unfortunately there are a couple of MMBasic ports that I struggle with (no Manual)    and therefore don't use. But that's my loss. Sometimes I struggle a bit trying to understand some command or function but can usually nut it out with a bit of testing.

Bill
Keep safe. Live long and prosper.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7937
Posted: 08:11am 24 Feb 2023
Copy link to clipboard 
Print this post

My approach is that, if I'm having trouble with a particular command, save where I'm up to, NEW, and write a trivial program just to test that command on a clean system. Once I have it figured out I can reload my program and carry on. (This is one of the reasons I love flash slots - I can keep my test program in another).

As I said previously, you can't really do a worked example of every command and function in a sensibly-sized manual. It has been done - I have a book on MSX BASIC that has one page per command. It's a thick book! The old Sinclair computer manuals were also great in this respect, particularly that for the Spectrum. If you need *real* command detail - often with enhancements not included in MMBasic - then the GW Basic manual is excellent. It doesn't include MMBasic-only stuff of course.

Tom hit the nail on the head, Stan. You won't find any specific info on alpha or beta releases (those where the release ends in something like a5 or b19) in the manual as they may still change before the next firmware release. The manual is only valid for the exact release written on the cover. (At this point I hang my head in shame as my current printed manual, in regular use, is for 5.07.03 and has scribbled pencil mark-ups in some places).

Alpha releases are experimental. If they work and are reasonably stable then they may become beta releases. If they don't work or Peter has a lot of problems with reliability then they may simply be dropped. Beta releases are runnable and are usually reasonably stable. The idea is to refine the details and improve stability through testing and reporting results. There will still be changes made though, so any documentation will be in the forum and/or in a readme file in the beta package.
Mick

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

Joined: 18/11/2011
Location: United Kingdom
Posts: 4044
Posted: 09:50am 24 Feb 2023
Copy link to clipboard 
Print this post

  stanleyella said  I'm using rpi picomite vga beta v7,7,b18.

If you don't want confusing results - avoid test versions!

Stick to the version the manual is for.

Then if a sample in the manual doesn't work it's likely a bug.

edit: Looks like it was a newly-introduced bug, now fixed (hopefully) in V5.07.07b23.

The manual's first reference to arrays (under DIM etc) would be improved if it said something like dimensions by default count from zero.  I suppose it might explain what an array is, too.

It's hard & time-consuming writing software. Likewise manuals. (I can't do hardware but I guess the same.)

John
Edited 2023-02-24 19:58 by JohnS
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1642
Posted: 10:09am 24 Feb 2023
Copy link to clipboard 
Print this post

Stan has had issues with arrays before, I would have though it should be clear by now.

Bill
Keep safe. Live long and prosper.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7937
Posted: 11:19am 24 Feb 2023
Copy link to clipboard 
Print this post

The "Programming In Basic" appendix in the manual covers arrays, including stating that the default base for arrays is zero. That appendix is really very good.
Mick

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

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2566
Posted: 08:25pm 24 Feb 2023
Copy link to clipboard 
Print this post

I'm sorry this got weird, the forum doesn't have mind reading.
The polygon error I got made me look at the code and understand it, thanks @TassyJim,
the missing triangle was off screen- y% 300.
I will test polygon with more sides.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7937
Posted: 08:31pm 24 Feb 2023
Copy link to clipboard 
Print this post

No matter - you found the error. :)
I don't think MMBasic does bounds checking on all the graphics commands as it depends on the current screen resolution. The programmer knows (or can get with MM.INFO() ) the resolution so it's easy enough to do.
Mick

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

Joined: 18/10/2016
Location: Australia
Posts: 871
Posted: 08:56pm 24 Feb 2023
Copy link to clipboard 
Print this post

Stan (et al),
I'm not sure if you are using MMEdit? (it is VERY good). A link to it is at the bottom of TassyJim's signature.
To the right of that is another link to Jim's 'MMBasic Help'. It is a comprehensive list of MMBasic features, with many examples.
I'm sure that Jim does his best to keep it up-to-date but bear in mind that ALL who contribute to MMBasic and TBS do so in their spare time and without payment.
Another good source of examples is on "Fruit of the Shed".

Cheers,

Andrew
 
     Page 1 of 2    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025