![]() |
Forum Index : Microcontroller and PC projects : New CMM2 user here + possible colour bug.
Author | Message | ||||
JoOngle Regular Member ![]() Joined: 25/07/2020 Location: SwedenPosts: 82 |
First of all, finally inside the forum. Been lurking for a while before and after I got my first CMM2 (thanks to the Admin for helping me inside the forum now that there are some email notification issues). When I saw it on 8-Bit guy, I was sold, right away. I'm an old school Basic/assembly coder from the Commodore 64 / Amiga era, I even worked as a service Tech for our local certified chapter of Commodore Computers as a warranty repairman, fun times! I always loved the simplicity of the Commodore 64, just turn it on, and program straight away, if you had an IDEA, you could execute it on the spot, the I/O ports too, which I used extensively. Then I saw the Maximite 2, and was blown away by it. My little childhood dreams of creating simple 2D arcade games came back in me, and I had to have one. Received mine from UK (micromite.org), assembled (Yes I could do it, but I am lazy, period). I was super pleased to see how simple it was to code on, I could literally just skip the manual and code straight away on it, I started by changing existing demo code, such as the circles program which is very simple, and I wanted to check out the colour palette. And here comes the problem...or my own fault? Don't know yet, but I'll ask the more experienced of you (that's basically anyone but me in here): ![]() See something weird? That's right - the blue is missing some shades, 4 of them I think, why is that (if you zoom in a little you can see the entire code right there, so yell out at me if you spot an error that could result in such a weird colourshades-skipping in the blue). Again, thanks for your reply - and I am excited like a little kid when I read your posts in here every day. Edited 2020-07-26 12:15 by JoOngle |
||||
mkopack73 Senior Member ![]() Joined: 03/07/2020 Location: United StatesPosts: 261 |
Ok, haven't tried your code... and the folks who have been at it more than me can maybe comment in BUT... No I think it's proper... (this is where reading the manual would help you ![]() Depending upon which color mode you're in, the green channel gets 1 extra bit (and thus gets some additional shades...) If you look, the Red follows the same pattern as the blue.. Try setting the mode as "1,8" (or 12 or 16) to set the different color bit depth)... I believe if you don't you're likely in 12 (or whichever color depth the last thing you ran is in, but I think the editor is in 8 bit). See if that changes things at all... Edited 2020-07-26 12:27 by mkopack73 |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
This will show you the full range of modes and the difference in colour when using them. ' test card for CMM2 ' TassyJim May 2020 OPTION EXPLICIT OPTION DEFAULT NONE DIM INTEGER wd, ht, wbox, sh, x, w, n, nn, m DIM FLOAT a DIM k$, imgtitle$, fname$, mess$ DIM INTEGER c(8) c(0) = RGB(BLACK) c(1) = RGB(YELLOW) c(2) = RGB(CYAN) c(3) = RGB(GREEN) c(4) = RGB(MAGENTA) c(5) = RGB(RED) c(6) = RGB(BLUE) c(7) = RGB(WHITE) c(8) = RGB(64,64,64) cls DO SELECT CASE m case 0 MODE 1, 8 CASE 1 MODE 1, 8 nn = 10 a = 1 ' aspect ratio used in the CIRCLE command. imgtitle$ =" MODE 1,8 Ratio "+str$(a,1,2)+" " CASE 2 MODE 1, 12 nn = 10 a = 1 ' aspect ratio used in the CIRCLE command. imgtitle$ =" MODE 1,12 Ratio "+str$(a,1,2)+" " CASE 3 MODE 1, 16 nn = 10 a = 1 ' aspect ratio used in the CIRCLE command. imgtitle$ =" MODE 1,16 Ratio "+str$(a,1,2)+" " CASE 4 MODE 2,8 nn = 8 a = 1.08 ' aspect ratio used in the CIRCLE command. imgtitle$ =" MODE 2,8 Ratio "+str$(a,1,2)+" " CASE 5 MODE 2,12 nn = 8 a = 1.08 ' aspect ratio used in the CIRCLE command. imgtitle$ =" MODE 2,12 Ratio "+str$(a,1,2)+" " CASE 6 MODE 2,16 nn = 8 a = 1.08 ' aspect ratio used in the CIRCLE command. imgtitle$ =" MODE 2,16 Ratio "+str$(a,1,2)+" " CASE 7 MODE 3,8 nn = 4 a = 1.08 ' aspect ratio used in the CIRCLE command. imgtitle$ =" MODE 3,8 Ratio "+str$(a,1,2)+" " CASE 8 MODE 3,12 nn = 4 a = 1.08 ' aspect ratio used in the CIRCLE command. imgtitle$ =" MODE 3,12 Ratio "+str$(a,1,2)+" " CASE 9 MODE 3,16 nn = 4 a = 1.08 ' aspect ratio used in the CIRCLE command. imgtitle$ =" MODE 3,16 Ratio "+str$(a,1,2)+" " CASE 10 MODE 4,8 nn = 4 a = 0.833 ' aspect ratio used in the CIRCLE command. imgtitle$ =" MODE 4,8 Ratio "+str$(a,1,3)+" " CASE 11 MODE 4,12 nn = 4 a = 0.833 ' aspect ratio used in the CIRCLE command. imgtitle$ =" MODE 4,12 Ratio "+str$(a,1,3)+" " CASE 12 MODE 4,16 nn = 4 a = 0.833 ' aspect ratio used in the CIRCLE command. imgtitle$ =" MODE 4,16 Ratio "+str$(a,1,3)+" " CASE 13 MODE 5,8 nn = 4 a = 0.833 ' aspect ratio used in the CIRCLE command. imgtitle$ =" MODE 5,8 Ratio "+str$(a,1,3)+" " CASE 14 MODE 5,12 nn = 4 a = 0.833 ' aspect ratio used in the CIRCLE command. imgtitle$ =" MODE 5,12 Ratio "+str$(a,1,3)+" " CASE 15 MODE 5,16 nn = 4 a = 0.833 ' aspect ratio used in the CIRCLE command. imgtitle$ =" MODE 5,16 Ratio "+str$(a,1,3)+" " END SELECT 'PRINT imgtitle$ ' for debug if m = 0 then cls TEXT 400,100, "Video mode test",cm,5,1 TEXT 400,180, "Ratio = aspect ratio used in the circle command",cm,1,1 TEXT 400,220, "Q to quit, P to save page as a BMP",cm,3,1 text 400,260,"UP arrow to go back, any other key to advance",cm,3,1 else wd = MM.HRES : ht = MM.VRES wbox = wd / 8 FOR x = 0 TO 7 BOX x*wbox,ht/4,wbox,ht/2,0,c(x), c(x) NEXT x FOR x = 0 TO wd-1 sh = 255*x/wd LINE x,0,x,ht/12,1,RGB(sh,0,0) LINE x,ht/12,x,ht/6,1,RGB(0,sh,0) LINE x,ht/6,x,ht/4,1,RGB(0,0,sh) LINE x,ht*9/12,x,ht*10/12,1,RGB(0,sh,sh) LINE x,ht*10/12,x,ht*11/12,1,RGB(sh,0,sh) LINE x,ht*11/12,x,ht,1,RGB(sh,sh,0) LINE x,ht/2,x,ht*3/4,1,RGB(sh,sh,sh) NEXT x CIRCLE wd/2,ht/2, ht*15/32,3,a,c(7) sh = 0 x = wd/2 - 55*nn/2 FOR w = 10 TO 1 STEP -1 FOR n = 1 TO nn sh = 255 - sh LINE x,ht*3/8,x,ht*5/8,w,RGB(sh,sh,sh) x = x + w NEXT n NEXT w BOX 0,0,wd,ht,3,c(7) BOX 1,1,wd-2,ht-2,1,c(5) TEXT wd/2,ht/2, imgtitle$,cm,1,1 endif DO k$ = INKEY$ LOOP UNTIL k$<>"" IF k$ = "P" OR k$ = "p" THEN fname$ = MID$(imgtitle$,2)+".bmp" timer = 0 SAVE IMAGE fname$ ' mess$ = "Saved as "+fname$+" in "+str$(timer/1000,3,2)+" Sec" TEXT wd/2,ht/2,"Saved as "+fname$+" in "+str$(timer/1000,3,2)+" Sec" ,cm,1,1 DO k$ = INKEY$ LOOP UNTIL k$<>"" ENDIF IF k$ = "Q" OR k$ = "q" THEN EXIT DO 'PRINT ASC(k$) IF ASC(k$) = 128 THEN m = m - 1 IF m < 1 THEN m = 15 ELSE m = m + 1 IF m > 15 THEN m = 1 ENDIF LOOP MODE 1,8 ' restore before ending program CLS Jim VK7JH MMedit |
||||
panky![]() Guru ![]() Joined: 02/10/2012 Location: AustraliaPosts: 1114 |
@JoOngle, If you are getting into the graphics capabilities, you might find this manual on Graphics Programming (which is a collection of all Peter's posts on graphics) helpfull in understanding modes, colours pages, etc. etc. Graphics Programming on the CMM2-v1.0b.pdf Doug ... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it! |
||||
panky![]() Guru ![]() Joined: 02/10/2012 Location: AustraliaPosts: 1114 |
Jim, May I include your demo program above in the Graphics Programming manual please? Doug. ... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it! |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
Go for it. Jim VK7JH MMedit |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10310 |
Its worth explaining what you were seeing: The default mode for the CMM2 is 8 bit colour. This is RGB332. i.e. there are 7-levels each of red and green (+ off) + 3 levels of blue (+off). Switch to 12-bit mode for RGB444 or 16 bit mode for RGB565. All explained in the manual. |
||||
JoOngle Regular Member ![]() Joined: 25/07/2020 Location: SwedenPosts: 82 |
Hi again, wow - overwhelming response, thanks so much! Sorry for the late answer but I live in Sweden so there will be some time-zone differences across the world. @mkopack73 You're right. I tried changing those right after you explained it, the full colour mode worked just fine with the program. (mode 1,16) @TassyJim Awesome, going to try that right away! Thanks for the elaborate code example, I love code examples, that is how I have been learning anything I've messed around with, I like examples so much better as it teaches old dogs new tricks and different aspects of coding. @panky Thanks, will read into that manual indeed. @matherp Ah, that is SO peculiar to me, well - whatever works - works I guess. I'll have to dive into the manual anyway, right now I'm experimenting around because I like to explore things so I can match my existing knowledge and see how much of it matches MMBasic, so far it's an incredibly pleasant experience. I love how CMM2 works so far, you guys have outdone yourselves making it both easy and simple and fun to code on this box, love how the function keys makes it a breeze to jump from code to run-time terminal and file system. And I just adore the fact I can simply just either pull the plug or switch it off, and switch it right back on again to continue wherever I was the last time. You guys brought the FUN back in personal computing. |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |