Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 09:12 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 : CMM2: V5.06.00RC1

     Page 1 of 3    
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 01:41pm 05 Dec 2020
Copy link to clipboard 
Print this post

Please download V5.06.00RC1

http://geoffg.net/Downloads/Maximite/CMM2_Beta.zip

This includes the following changes from b14

Fixes a bug where the random data in memory on power up could be sufficiently like real data that the firmware interpreted it as real and caused memory corruption

Allows an extra parameter "dontcopyblack" for IMAGE RESIZE and IMAGE ROTATE. The parameter list is now the same as for IMAGE ROTATE_FAST and IMAGE RESIZE_FAST

Includes extra checks for the USB keyboard during File I/O that could result in key-up messages being missed. This was likely to occur on SDcards with many files and particularly if formatted in exFAT.

Includes extra checks for the USB keyboard during editor screen output that could result in key-up messages being missed.
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4311
Posted: 01:59pm 05 Dec 2020
Copy link to clipboard 
Print this post

  matherp said  Fixes a bug where the random data in memory on power up could be sufficiently like real data that the firmware interpreted it as real and caused memory corruption


Well done Peter, sounds like it was real doozy.

Tom
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1132
Posted: 07:32pm 05 Dec 2020
Copy link to clipboard 
Print this post

I've been chasing a sprite drawing problem in mode 1,16 for recent firmware.



Here is minimal program that shows the problem on my CMM2 (400 MHz Waveshare)

Sprites are drawn with what appear to be 16 pixel horizontal strips missing/transparent. The strange thing is, the missing parts slowly reappear when other areas of the screen are drawn.

When I save the screen image, the resulting BMP is perfect: no glitches.

' Mode 1,16 Sprite Draw Problem

mode 1,16
cls &hFFFFFF    ' white back ground

pausetime = 1000
sz = 50

' load and prepare graphics
page write 2
load png "cobographics.png"
page write 0

do
 cls &hFFFFFF
 for i = 0 to 9
   sprite read i+1,i*SZ,250,SZ,SZ,2      ' 10 coloured balls
   sprite show i+1,int(rnd * 12) * 50,int(rnd*10)*50,1
   pause pausetime
 next i

 sprite read 11,500,250,SZ,SZ,2  ' cursor
 sprite show 11,int(rnd * 12) * 50,int(rnd*10)*50,2
 pause pausetime

loop until inkey$ <> ""


The graphics file (plus the complete game) are here:
Cobo2.zip
Visit Vegipete's *Mite Library for cool programs.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 08:17pm 05 Dec 2020
Copy link to clipboard 
Print this post

  Quote  Sprites are drawn with what appear to be 16 pixel horizontal strips missing/transparent. The strange thing is, the missing parts slowly reappear when other areas of the screen are drawn.


Fixed in V5.06.00RC2 - just posted

http://geoffg.net/Downloads/Maximite/CMM2_Beta.zip

This also has the lighting functionality in the 3D engine but docs for that will have to wait until tomorrow

option explicit
option default none
mode 2,16
dim float phi=(1+sqr(5))/2
' data for location of verticies for verticesahedron of edge length 2
data 0,1,3*phi
data 0,1,-3*phi
data 0,-1,3*phi
data 0,-1,-3*phi
data 1,3*phi,0
data 1,-3*phi,0
data -1,3*phi,0
data -1,-3*phi,0
data 3*phi,0,1
data 3*phi,0,-1
data -3*phi,0,1
data -3*phi,0,-1
data 2,(1+2*phi),phi
data 2,(1+2*phi),-phi
data 2,-(1+2*phi),phi
data 2,-(1+2*phi),-phi
data -2,(1+2*phi),phi
data -2,(1+2*phi),-phi
data -2,-(1+2*phi),phi
data -2,-(1+2*phi),-phi
data (1+2*phi),phi,2
data (1+2*phi),phi,-2
data (1+2*phi),-phi,2
data (1+2*phi),-phi,-2
data -(1+2*phi),phi,2
data -(1+2*phi),phi,-2
data -(1+2*phi),-phi,2
data -(1+2*phi),-phi,-2
data phi,2,(1+2*phi)
data phi,2,-(1+2*phi)
data phi,-2,(1+2*phi)
data phi,-2,-(1+2*phi)
data -phi,2,(1+2*phi)
data -phi,2,-(1+2*phi)
data -phi,-2,(1+2*phi)
data -phi,-2,-(1+2*phi)
data 1,(2+phi),2*phi
data 1,(2+phi),-2*phi
data 1,-(2+phi),2*phi
data 1,-(2+phi),-2*phi
data -1,(2+phi),2*phi
data -1,(2+phi),-2*phi
data -1,-(2+phi),2*phi
data -1,-(2+phi),-2*phi
data (2+phi),2*phi,1
data (2+phi),2*phi,-1
data (2+phi),-2*phi,1
data (2+phi),-2*phi,-1
data -(2+phi),2*phi,1
data -(2+phi),2*phi,-1
data -(2+phi),-2*phi,1
data -(2+phi),-2*phi,-1
data 2*phi,1,(2+phi)
data 2*phi,1,-(2+phi)
data 2*phi,-1,(2+phi)
data 2*phi,-1,-(2+phi)
data -2*phi,1,(2+phi)
data -2*phi,1,-(2+phi)
data -2*phi,-1,(2+phi)
data -2*phi,-1,-(2+phi)
' 12 faces with 5 sides
data 0,28,36,40,32
data 33,41,37,29,1
data 34,42,38,30,2
data 3,31,39,43,35
data 4,12,44,45,13
data 15,47,46,14,5
data 17,49,48,16,6
data 7,18,50,51,19
data 8,20,52,54,22
data 23,55,53,21,9
data 26,58,56,24,10
data 25,57,59,27,11
' 20 faces with 6 sides
data 32,56,58,34,2,0
data 0,2,30,54,52,28
data 29,53,55,31,3,1
data 1,3,35,59,57,33
data 13,37,41,17,6,4
data 4,6,16,40,36,12
data 5,7,19,43,39,15
data 14,38,42,18,7,5
data 22,46,47,23,9,8
data 8,9,21,45,44,20
data 10,11,27,51,50,26
data 24,48,49,25,11,10
data 36,28,52,20,44,12
data 13,45,21,53,29,37
data 14,46,22,54,30,38
data 39,31,55,23,47,15
data 16,48,24,56,32,40
data 41,33,57,25,49,17
data 42,34,58,26,50,18
data 19,51,27,59,35,43
'
dim float q1(4)
dim float yaw=rad(1),pitch=rad(2),roll=rad(0.5)
dim integer i, j, nf=32, nv=60, camera=1
dim float vertices(2,59)
' read in the coordinates of the verticies and scale
for j=0 to 59
for i=0 to 2
 read vertices(i,j)
 vertices(i,j)=vertices(i,j)*50
next i
next j
'math scale vertices(),50,vertices()
'
dim integer faces(179)
for i=0 to 179
read faces(i)
next i

dim integer fc(nf-1)=  (5,5,5,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6)
dim integer colours(2)=(rgb(red),rgb(white),rgb(black))
dim integer edge(nf-1)=(2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2)
dim integer fill(nf-1)=(0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
math q_create rad(2),1,0.5,0.25,q1()
draw3d create 1, nv,nf, camera, vertices(), fc(), faces(), colours(), edge(), fill()
draw3d camera 1,800,0,0
draw3d light 1,1000,1000,100,32 'light from the top right with ambient of 32
draw3d set flag 1,8,0,nf 'enable the light level adjustment on all faces
'draw3d diagnose 1,mm.hres\2,mm.vres\2,1000
page write 1
draw3d show 1,0,0,1000
do
math q_create rad(0.25),1,3,5,q1()
' math q_euler yaw,pitch,roll,q1()

' inc pitch,rad(2)
' inc roll,rad(0.5)
draw3d rotate q1(),1
draw3d reset 1
draw3d show 1,0,0,1000
page copy 1 to 0,b
loop

Edited 2020-12-06 06:18 by matherp
 
toml_12953
Guru

Joined: 13/02/2015
Location: United States
Posts: 442
Posted: 08:42pm 05 Dec 2020
Copy link to clipboard 
Print this post

  matherp said  
  Quote  Sprites are drawn with what appear to be 16 pixel horizontal strips missing/transparent. The strange thing is, the missing parts slowly reappear when other areas of the screen are drawn.


Fixed in V5.06.00RC2 - just posted



RC2 already? You've been busy today!
 
toml_12953
Guru

Joined: 13/02/2015
Location: United States
Posts: 442
Posted: 11:15pm 05 Dec 2020
Copy link to clipboard 
Print this post

  thwill said  
  matherp said  Fixes a bug where the random data in memory on power up could be sufficiently like real data that the firmware interpreted it as real and caused memory corruption


Well done Peter, sounds like it was real doozy.

Tom


Here's one for you, Tom:

When I run the welcome tape in 05.06.00RC2. the logo screen comes up and waits for me to press a key. When I do, I get this:

Error in line 31: A hard error occurred in the low level disk I/O layer.

I can edit all the welcome tape programs so I'm pretty sure the SD card is fine.

I have OPTION SD NORMAL.
 
mclout999
Guru

Joined: 05/07/2020
Location: United States
Posts: 490
Posted: 11:22pm 05 Dec 2020
Copy link to clipboard 
Print this post

  Quote  When I run the welcome tape in 05.06.00RC2. the logo screen comes up and waits for me to press a key. When I do, I get this:

Error in line 31: A hard error occurred in the low-level disk I/O layer.


I am getting the same thing in Gauntlet and a few other things I tried. I have to power cycle to get it to do anything because if I hit F1 it gives the same error. Glad it's not just me.
 
toml_12953
Guru

Joined: 13/02/2015
Location: United States
Posts: 442
Posted: 11:39pm 05 Dec 2020
Copy link to clipboard 
Print this post

  mclout999 said  
  Quote  When I run the welcome tape in 05.06.00RC2. the logo screen comes up and waits for me to press a key. When I do, I get this:

Error in line 31: A hard error occurred in the low-level disk I/O layer.


I am getting the same thing in Gauntlet and a few other things I tried. I have to power cycle to get it to do anything because if I hit F1 it gives the same error. Glad it's not just me.


Not that I'm glad you're getting errors but I am glad that I'm not the only one this time! It takes at least two people reporting an error before the hardware can be ruled out.
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1132
Posted: 12:48am 06 Dec 2020
Copy link to clipboard 
Print this post

I get hanging with the Welcome Tape during the opening animation. If I comment out the "play mp3" command on line 20 of "./menu.menu.bas", things work much better.

I have this suspicion that something broke in the mp3 player a few versions back, but no proof or demo program yet.

Also, in LunarLander on the welcome tape, there is a subroutine named "help". This is now an illegal name.
The subroutine definition on line 401 must be changed, to "DisplayHelp" for example.
The subroutine calls on lines 208, 212, 332, 336 and 459 must likewise be changed.
Edited 2020-12-06 10:56 by vegipete
Visit Vegipete's *Mite Library for cool programs.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 12:51am 06 Dec 2020
Copy link to clipboard 
Print this post

SELECT CASE

"IS" requires a space after it or "Error in line 5: IS is not declared"


option explicit
dim integer x,h

select case x
     case is<2 ' error
       h = 1
     case is <4 ' OK
       h = 2
     case else
       h = 5
   end select


Jim
VK7JH
MMedit
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4311
Posted: 01:05am 06 Dec 2020
Copy link to clipboard 
Print this post

  toml_12953 said  
  mclout999 said  
  Quote  When I run the welcome tape in 05.06.00RC2. the logo screen comes up and waits for me to press a key. When I do, I get this:

Error in line 31: A hard error occurred in the low-level disk I/O layer.


I am getting the same thing in Gauntlet and a few other things I tried. I have to power cycle to get it to do anything because if I hit F1 it gives the same error. Glad it's not just me.


Not that I'm glad you're getting errors but I am glad that I'm not the only one this time! It takes at least two people reporting an error before the hardware can be ruled out.


I gave it all a smoke test with b13 and other than none of the CSUB programs working and the LunarLander problem reported by @vegipete it was all working. This "low-level disk I/O" error sounds like a firmware or hardware problem above my pay grade.

Recently I've had very limited time to sit at the CMM2 so I've been holding off trying to fix Welcome Tape issues until the latest version of the firmware is officially "released" ... Then I will be asking for help especially from the original CSUB authors.

Best wishes,

Tom
Edited 2020-12-06 11:58 by thwill
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
mclout999
Guru

Joined: 05/07/2020
Location: United States
Posts: 490
Posted: 03:32am 06 Dec 2020
Copy link to clipboard 
Print this post

  Quote  I gave it all a smoke test with b13
We are experiencing the issue with  V5.06.00RC2 not one of the betas. Was that a mistake and you tried it on the RC2?
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 08:19am 06 Dec 2020
Copy link to clipboard 
Print this post

  Quote  SELECT CASE

"IS" requires a space after it or "Error in line 5: IS is not declared"


This is the case in all versions of MMBasic. Geoff is aware

  Quote  Error in line 31: A hard error occurred in the low-level disk I/O layer.


That is a side effect of trying to fix the stuck keys when doing disk I/O - back to the drawing board  
The problem is that on SDcards with lots of files, particularly if formatted in exFAT searching the directory tree inside FatFS can take several milliseconds which can mean the USB polling stops and KEYUP messages are missed. I put in a poll inside the FatFS code but it is clearly having unintended side effects
Edited 2020-12-06 18:22 by matherp
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4311
Posted: 08:41am 06 Dec 2020
Copy link to clipboard 
Print this post

  mclout999 said  
  Quote  I gave it all a smoke test with b13
We are experiencing the issue with  V5.06.00RC2 not one of the betas. Was that a mistake and you tried it on the RC2?


Not a mistake, Peter produces betas/release candidates faster than I can test them   I appreciate everyone reporting any issues that they find.

Best wishes,

Tom
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 10:54am 06 Dec 2020
Copy link to clipboard 
Print this post

V5.06.00RC3 - just posted

http://geoffg.net/Downloads/Maximite/CMM2_Beta.zip

Fixes the disk error in RC2 without (hopefully) re-introducing the stuck key issue when using a SDcard with many files

NEW COMMAND

MATH INTERPOLATE array1(), array(2), ratio, array3()


This implements the following equation on every array element

out = (in2 - in1) * ratio + in1

Arrays can have any number of dimensions and must be distinct and have the same number of total elements

Why this new command?

Ask JoOngle

NB: in this release DRAW3D SET FLAG is renamed DRAW3D SET FLAGS

Updated 3D documentation to follow......
 
MauroXavier
Guru

Joined: 06/03/2016
Location: Brazil
Posts: 303
Posted: 03:23pm 06 Dec 2020
Copy link to clipboard 
Print this post

MATH INTERPOLATE is very useful to make polygonal animations, something like what updated source of QUAKE 1 use to make smooth animations.
 
NPHighview

Senior Member

Joined: 02/09/2020
Location: United States
Posts: 203
Posted: 03:39pm 06 Dec 2020
Copy link to clipboard 
Print this post

Peter - the MATH INTERPOLATE command will be extremely useful for scaled plotting, very much appreciated.  However, is it:
  Quote  out = (in2 - in1) * ratio + in1

or
  Quote  out = (in2 - in1) * ratio + in3

?

Really spectacular work.  I'm looking forward to testing and adjusting my stuff as well.

- Steve ("NPHighview") Johnson
Live in the Future. It's Just Starting Now!
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 04:29pm 06 Dec 2020
Copy link to clipboard 
Print this post

MATH INTERPOLATE in1(), in2(), ratio, out()

This command This implements the following equation on every array element:
out = (in2 - in1) * ratio + in1
Arrays can have any number of dimensions and must be distinct and have the same number of total elements. The command works with both integer and floating point arrays in any mixture
 
mclout999
Guru

Joined: 05/07/2020
Location: United States
Posts: 490
Posted: 08:10pm 06 Dec 2020
Copy link to clipboard 
Print this post

Hi All.

Can someone post some example code of the new command
  Quote  MATH INTERPOLATE array1(), array(2), ratio, array3()
other than matherp (let him work, I like it when he works.  Stuff gets done) I am very bad with the maths on the 3D stuff and really learn a lot from practical code. Thanks
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1132
Posted: 08:27pm 08 Dec 2020
Copy link to clipboard 
Print this post

Characterizing the MOD file issue that has been causing me some grief.

My asteroids clone Rocks in Space uses samples in a mod file for sound effects. For this to work, the mod file has to actually be 'playing'. So I created a mod file with the samples, and a single blank pattern.
"play modfile filename$" works great - silence except when I "play modsample ..."

Recent firmware versions broke Rocks in Space, with a system hang at "play modfile". I've been experimenting and discovered the following different fixes:

changing to "play modfile filename$, 8000" seems to fix it,
adding "pause 10" right after "play modfile filename$" seems to fix it,
turning on trace seems to fix it.

The code around the "play modfile filename$" command is:
' Sounds: sounds are stored in a custom MOD file.
' This MOD file contains only a single blank pattern, which the CMM2 will
' dutifully play as silence. However, the individual samples can be played
' on demand while the MOD file is silently playing.
play modfile "RISsound.mod" ', 8000  ' adding ,8000 fixes problem

'trace on  ' fixes problem
pause 10  ' fixes problem
'pause 1   ' too short, doesn't fix

hurn = 1    ' hurry up sound number 1 to start
hurs = 1000
settick hurs + 175,HurryUp

'end   ' program doesn't hang

' Vector Font 16 x 20
' ascii 32 to 128  - used for number display, ought to simplify the font
load font "Vector16x20.fnt"


It could be that disk access too quickly after the 'play modfile' is the cause of my problem. The extra hint is that the SD access LED is on when the system hangs.
Visit Vegipete's *Mite Library for cool programs.
 
     Page 1 of 3    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025