Menu
JAQForum Ver 19.10.27

Forum Index : Microcontroller and PC projects : MMBasic for Windows - betas

   Page 21 of 30    
Posted: 10:35pm
27 Apr 2023
Copy link to clipboard
Turbo46
Guru


  Quote  MY preference is and will remain, assume passing by reference and don't change the parameter withing the sub unless that is what you really want.

I agree. I've never used passing by value but I think it's worth documenting in case you get unexpected results. It was never clear to me.

I would have used a LOCAL to handle that case if I ever had a need for it.

Thank you.

Bill
 
Posted: 10:51pm
27 Apr 2023
Copy link to clipboard
panky
Guru


After an long night arm wrestling with Libre Office Writer, I have now got both versions in book form with appropriate gutters on odd and even pages as well as page numbers on the outer edge as requested by Turbo46 (don't get me wrong, very happy with Libre Office).

Full version with bookmarks
Condensed version without bookmarks - smaller
Doug.
 
Posted: 11:41pm
27 Apr 2023
Copy link to clipboard
Goksteroo
Senior Member

I cannot see a reference to negative mode numbers. Is this missed or are my eyes/mind getting too old?
 
Posted: 11:57pm
27 Apr 2023
Copy link to clipboard
Turbo46
Guru


I found a reference to that in Mick's notes:
  Quote  Mode command - use a negative value for the mode and you will get fullscreen with no border e.g. MODE -16 will fill a 1080p monitor perfectly


Bill
 
Posted: 12:22am
28 Apr 2023
Copy link to clipboard
Turbo46
Guru


Hi Doug,
I've printed another section of the manual. I looks good. I didn't say it before but I like the extra level of headings in the index. It makes it easier to find what you want. The program listings look good and I think the lighter blue background looks better.

I use Libre Office too and it does all I want, some things you want to do aren't all that intuitive to me, but Dr Google helps.

Bill
 
Posted: 06:17am
28 Apr 2023
Copy link to clipboard
Turbo46
Guru


Hi Doug,

A few more things. I've never read an MMBasic manual so thoroughly before, usually I just look for info on what I'm working on currently.

No errors here but just suggestions. You're the boss.

P32.
Screen Coordinates
All screen coordinates and measurements on the screen are done in terms of pixels with the X coordinate being the horizontal position and Y the vertical position. The top left corner of the screen has the coordinates X = 0 and Y = 0 and the values increase as you move down and to the right of the screen.
This can be changed by using the OPTION Y_AXIS DOWN|UP setting.

P32.
The RGB() function also supports a shortcut where you can specify common colours by naming them. For example, RGB(red) or RGB(cyan). The colours that can be named using the shortcut form are white black, blue, green, cyan, red, magenta, yellow, brown, white, orange, pink, gold, salmon, beige, lightgrey and grey (or USA spelling gray/lightgray).
I would like to see this in the form of a table or maybe include TassyJim's demo and program here

P34.
Under Drawing Commands
<snip>
The drawing commands are described below, see the COMMANDS section for more information
- CLS...

P37.
Under File System Support
<snip>
There are 34 commands and function...
Maybe change the number 34 to 'many' just in case there are future additions or deletions to that number?

P38.
Under File and Directory Management
<snip>
MM.INFO(function)
Returns many types of information related to the SD card (size, free space, file size, etc).
See MM.INFO in Predefined Read Only Variables for the functions available.

P42.
Under Generating Sine Waves
<snip>
The frequency can be from 1 Hz to 20 KHz and is very accurate. The frequency can be changed at any time by issuing a new PLAY TONE command. Note that the sine wave is generated by stepping through a lookup table so to reduce the distortion the audio output should be passed through a low pass filter. When used externally to the PC.


Bill
 
Posted: 07:00am
28 Apr 2023
Copy link to clipboard
panky
Guru


Bill,

Thanks for that - all good suggestions and will be included in the next release.

Regarding the last suggestion on PLAY TONE, looking at the output on a CRO shows the sine wave to be quite good with just a bit of very high frequency noise. It appears to be generated differently to the 'mites.

Cheers,
Doug.
 
Posted: 07:57am
28 Apr 2023
Copy link to clipboard
Turbo46
Guru


Thanks Doug,

A few more for you:

P46.
Displaying Images
The Colour Maximite 2 can load and display images stored on the SD card in a variety of formats including BMP, GIF, PNG and JPG. These are read from the SD card by the LOAD command and can be of any size and positioned anywhere on the screen. In addition on-screen images can be scaled and rotated under control of the program.
Fonts
Built in to MMBasic is support for seven fonts ranging from small to large. In addition user supported fonts can be defined by the BASIC program or dynamically loaded from the SD card. All fonts can be displayed in various colours, scaled and rotated

P48.
SD Card and File Related Commands
There is no drive A: or B: in MMBasic for Windows. All storage is as for MS Windows.
The command CHAIN is not implemented. MMBasic for Windows has an exceptionally large program memory space so this feature is not necessary. The library and the LIBRARY commands are not implemented and not needed on tMMBasic for Windows . Instead of using these commands you can use #INCLUDE to insert files into the program at run time.
(Some may still have floppy drives? Extra 't' before MMBasic and a space between Windows and the period)

P49.
Random Number Generator
MMBasic for Windows has an advanced random number generator based on the internal MS Windows function that generates a sequence of true random numbers which will never repeat. For this reason t MMBasic for Windows does not require (or allow) the programmer to seed the random generator to get different sequences.
(Extra 't' before MMBasic)

P50.
MMBasic Implementation Characteristics
<snip>
Maximum number of interrupt pins that can be configured: 10
<snip>
Maximum normal string length is 255 characters
(Longstrings can be longer)

I am only questioning the parts I think I know. I'm out of my depth with a lot of the graphics stuff and accepting what seems sensible as read.

Bill
 
Posted: 04:33am
29 Apr 2023
Copy link to clipboard
Turbo46
Guru


I started looking at the MM.INFO()/MM.INFO$() predefined read only variables. Just the ones that I thought maybe were inappropriate and found that:

? MM.INFO(FREE SPACE)

gave a syntax error so I guess that it is not implemented. Setting up the conditions to test a lot of them would take a long time so...

I wonder if Peter can supply a list of the predefined read only variables or perhaps there is a method to list them please?

Bill

EDIT: Whoops, removed the mention of MM.INFO(KEYBOARD). I had the CMM2 manual open at the same time and must have looked at the wrong one.

I suspect that the vast majority of them are OK.
Edited 2023-04-29 14:49 by Turbo46
 
Posted: 04:58am
29 Apr 2023
Copy link to clipboard
panky
Guru


Bill,
Great job on the feedback - all are implemented and will be out in the next release. Just waiting a bit to see if Peter comes up with anything to be added/removed/changed.
Doug.
 
Posted: 05:08am
29 Apr 2023
Copy link to clipboard
Turbo46
Guru


It might pay to wait Doug, I'm still going. Perhaps wait til I've finished before you issue a revised manual.

In the meantime I have found that:

MM.INFO(UPTIME)

and

OPTION BASELINE ON|OFF and
OPTION BAUDRATE nbr

are not implemented.

Bill
 
Posted: 07:31am
29 Apr 2023
Copy link to clipboard
Turbo46
Guru


For some reason I thought that the MATH(CRC...) function had been added to MMB4W but apparently not. Will be added in the future?

I'm not sure the syntax is correct in the Pico manual:
  Quote  MATH(CRCn data [,length]
[polynome] [startmask,]
[endmask,] [reverseIn,]
[reverseOut]


Commas missing I think, Peter's original post:
  Quote  MATH(CRC8 array(), length, [polynome,] [startmask,] [endmask,] [reverseIn,] [reverseOut]
MATH(CRC12 array(), length, [polynome,] [startmask,] [endmask,] [reverseIn,] [reverseOut]
MATH(CRC16 array(), length, [polynome,] [startmask,] [endmask,] [reverseIn,] [reverseOut]
MATH(CRC32 array(), length, [polynome,] [startmask,] [endmask,] [reverseIn,] [reverseOut]


MATH(CRCn function now accepts a string as the input

e.g.

a$="123456789"
? math(crc16 a$,9,,&H1021)

Bill
 
Posted: 11:03am
29 Apr 2023
Copy link to clipboard
panky
Guru


Hi Bill, CRC always struck me as some wierd type of black magic gobblydeegook - I understand why it is needed but the methods and ways of 'getting there' have defied understanding on my part. A decent write up would make a usefull annex.
Doug.
 
Posted: 11:58am
29 Apr 2023
Copy link to clipboard
TassyJim
Guru


There are many different incarnations of CRCs
For ONEWIRE,
The one to use is
ow_crc = math(crc8 romcode(),n,&h31,0,0,1,1)


Jim
 
Posted: 12:01pm
29 Apr 2023
Copy link to clipboard
Turbo46
Guru


Hi Doug,
If it is included in MMB4W I'll have a go at that if you like.

You may or may not know that, due to my work background, I am a strong advocate of using CRCs for all types of communication and I have been disappointed that many see it as being 'all too hard'. You don't need to understand the mathematics involved, just accept how easy they are to use and how much more reliable they can make your communications.

MODBUS and XMODEM have used CRCs for yonks even the DS18B20 and other MAXIM devices make use of them.

I'll wait on whether Peter wants to add it to the MMB4W functions.

Bill
 
Posted: 03:30pm
29 Apr 2023
Copy link to clipboard
matherp
Guru

V5.07.03b17


MMBasic.zip

Now includes the MATH CRC function as per the PicoMite (untested)
Edited 2023-04-30 01:31 by matherp
 
Posted: 09:56pm
29 Apr 2023
Copy link to clipboard
Turbo46
Guru


Thanks Peter, I tested it with this from your post:
a$="123456789"
? math(crc16 a$,9,&H1021)

and got this:




Bill
 
Posted: 10:05pm
29 Apr 2023
Copy link to clipboard
matherp
Guru

Here you go


MMBasic.zip
 
Posted: 10:40pm
29 Apr 2023
Copy link to clipboard
Turbo46
Guru


Thanks Peter, That worked.
I tried Volhout's test program and got the same values as a result.
'MATH CRC evaluation

option base 1

'determine timer set/read time
timer=0
tr=timer

? tr*1000;" us"

'test string
a$="123456789"
l%=len(a$)

'convert test string to array (needed in V50706b5)
dim b%(l%)
for i=1 to l% : b%(i)=asc(mid$(a$,i,1)) : next i

'perform CRC validation
dim CRC%

'check CCITT CRC16
timer=0
CRC% = math (crc16 b%(),l%,,&hffff)
t=timer
? "CRC16-CCITT ";(t-tr)*1000;" us, CRC = &h"; hex$(CRC%)

'check MODBUS CRC16
timer=0
CRC% = math (crc16 b%(),l%,&h8005,&hffff,0,1,1)
t=timer
? "CRC16-MODBUS ";(t-tr)*1000;" us, CRC = &h"; hex$(CRC%)

'check XMODEM CRC16
timer=0
CRC% = math (crc16 b%(),l%)
t=timer
? "CRC16-XMODEM ";(t-tr)*1000;" us, CRC = &h"; hex$(CRC%)

'check MAXIM CRC8 (used in DALLAS signle wire devices)
timer=0
CRC% = math (crc8 b%(),l%,&h31,,,1,1)
t=timer
? "CRC8-MAXIM  ";(t-tr)*1000;" us, CRC = &h"; hex$(CRC%)

'check standard CRC32
timer=0
CRC% = math (crc32 b%(),l%,,&hffffffff,&hffffffff,1,1)
t=timer
? "CRC32    ";(t-tr)*1000;" us, CRC = &h"; hex$(CRC%)

Much faster though, the times are negative you must have added a flux capacitor to MMB4W.  




Bill
 
Posted: 10:50pm
29 Apr 2023
Copy link to clipboard
Turbo46
Guru


Doug, I'll keep ploughing on through the manual. I have found some more things and I'll try to finish today.

Bill
 
   Page 21 of 30    
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025