Home JAQForum Ver 24.01 Log In or Join Active Topics Local Time 20:30 08 Sep 2024 Privacy Policy Jump to Select Sites home page Forum home page Windmills Solar EV's Electronics Microcontrollers PCB Manufacture Other Stuff Site News

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 demo programs

Page 3 of 4
Author Message
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3971
 Posted: 09:34am 28 Jun 2020 Copy link to clipboard Print this post

Awesome stuff Mauro,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures

Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 847
 Posted: 06:51am 29 Jun 2020 Copy link to clipboard Print this post

I wanted to see what the fonts looked like - not very sophisticated but it works.

Cheers,

Andrew

'CMM2 FontPlay.Bas
Dim Integer I, J
cls

For I = 0 to 15  '0 to 100
for J = 0 to 15  '0 to 9
if (I*16+32)+J => 256 then goto SkipIt
text (J*10),20+I*20,chr\$((I*16+32)+J),LT,1,1,RGB(green)
Next J
Next I
Skipit:

For I = 0 to 15
for J = 0 to 15
if (I*16+32)+J => 127 then goto SkipIt2
text (J*12)+200,20+I*40,chr\$((I*16+32)+J),LT,2,1,RGB(green)
Next J
Next I
SkipIt2:

For I = 0 to 15
for J = 0 to 15
if (I*16+32)+J => 127 then goto SkipIt3
text (J*20)+400,20+I*40,chr\$((I*16+32)+J),LT,3,1,RGB(green)
Next J
Next I
SkipIt3:

For I = 0 to 15
for J = 0 to 15
if (I*16+32)+J => 127 then goto SkipIt4
text (J*20),320+I*40,chr\$((I*16+32)+J),LT,4,1,RGB(green)
Next J
Next I
SkipIt4:

For I = 0 to 15
for J = 0 to 15
if (I*16+32)+J => 127 then goto SkipIt5
text (J*20)+400,320+I*40,chr\$((I*16+32)+J),LT,5,1,RGB(green)
Next J
Next I
SkipIt5:

text 800,600,"Press A Key When Read", RB, 1,1,RGB(Cyan)
Do: loop while inkey\$ = ""

Cls

For I = 4 to 9
for J = 0 to 9
if (I*10)+6 => 127 then goto SkipIt6
text (J*40),I*70-250,chr\$((I*10)+J),LT,6,1,RGB(green)
text 15+J*40,I*70 - 180,Str\$((I*10)+J),CB,1,1,RGB(cyan)
Box J*40-5, I*70-250, 39, 69,,RGB(Gray)
Next J
Next I
Skipit6:

For I = 0 to 15
for J = 0 to 15
if (I*16+32)+J => 127 then goto SkipIt7
text (J*20)+450,320+I*40,chr\$((I*16+32)+J),LT,7,1,RGB(green)
Next J
Next I
SkipIt7:

End

Grogster

Joined: 31/12/2012
Location: New Zealand
Posts: 9259
 Posted: 02:07pm 29 Jun 2020 Copy link to clipboard Print this post

@ Mauro: Wow.  You really excelled yourself with that demo-X monster!  Superb!
Smoke makes things work. When the smoke gets out, it stops!

MauroXavier
Guru

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

Now I'm "playing" with many things trying to extract all performance from every single transistor of the CMM2 to bring a game that many users would not believe that it could run on this machine... To say sincerely, until 10 days ago even I would not believe that is possible.

It's a long way to walk and of all programs that I developed until now, it is the most challenging because it's a pain to keep the performance acceptable at each new implementation done. Optimizations and more optimizations, this drives me nuts (but I like it a lot!).

For me, it is indispensable to make things that can attract more interested people. I'm really want to see this new community of CMM2 grow stronger with good games and principally, good people.

matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8809
 Posted: 06:33pm 29 Jun 2020 Copy link to clipboard Print this post

Quote  Now I'm "playing" with many things trying to extract all performance from every single transistor of the CMM2 to bring a game that many users would not believe that it could run on this machine... To say sincerely, until 10 days ago even I would not believe that is possible.

I've seen what Mauro is doing and I certainly don't believe what he has achieved so far is remotely possible but somehow he has done it - watch this space

Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 847
 Posted: 11:40pm 05 Jul 2020 Copy link to clipboard Print this post

Good morning (here in Aus) all,
I'm not sure if this is the right place to post this but the ONE game I'd love to have is "Lunar Lander" (I played it once on a DEC mainframe (about 1976) - no graphics, just printed characters, but it was great!).
Its way out of my league to write it but what are the chances of one of you clever shedders converting or writing a CMM2 MMBASIC version?

Cheers,

Andrew
Edited 2020-07-06 09:42 by Andrew_G

bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2906
 Posted: 12:34am 06 Jul 2020 Copy link to clipboard Print this post

Hi Andrew, All,

I remember playing lunar lander on a TRS-80 model I in the store (was lv1 4K as well) and it had rudimentary block graphics as well..

I loved it and it is what hooked me into computers way back in (what year was it now??) late 1979 or early 1980..

I ended up buying a System-80 (PMC-80 over the USA) off Dick Smith,

Regards,

Mick

EDIT ***

I also remember going to the airport with Don just to play on the new fangled `PONG’ ping pong machine they had there, it was like a coffee table and two people sat either side and twiddled their knob.

Mik
Edited 2020-07-06 10:37 by bigmik
Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<

Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1608
 Posted: 01:25am 06 Jul 2020 Copy link to clipboard Print this post

There is a Lunar Lander for the CMM1 in the Fruit of the shed
I've not tried it though.

Bill
Keep safe. Live long and prosper.

Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 847
 Posted: 07:32am 06 Jul 2020 Copy link to clipboard Print this post

Hi Bill,
That link took me straight to the listing - thanks.
It is written by Hugh Buckle and Geoff Graham.
One has to save the listing as say "Lunar.BAS" and transfer the unzipped attachments (top right corner of the site) to the SD card. So far easy.
BUT - is is written for a joystick - OK, I commented out those pin assignments and statements as it also accepts keyboard entries.

BUT - then I got into differences in syntax between MMBASIC for the CMM1 vs CMM2 so I got out of my depth fairly quickly.

BUT (again) - it exists, and may form the basis of a good program. I need to learn a lot more before I can tackle it.

Cheers,

Andrew

Sasquatch

Guru

Joined: 08/05/2020
Location: United States
Posts: 319
 Posted: 02:31pm 06 Jul 2020 Copy link to clipboard Print this post

BUT - then I got into differences in syntax between MMBASIC for the CMM1 vs CMM2 so I got out of my depth fairly quickly.

BUT (again) - it exists, and may form the basis of a good program. I need to learn a lot more before I can tackle it.

I also enjoyed Lunar Lander.  I haven't looked into converting the CMM1 version yet but check out the OPTION LEGACY command this can go a long way to patching the differences.  You will also likely need to use the MODE command to get the proper graphics mode set.  Of course a re-write of the game using the more advanced features of the CMM2 would also be an option.
-Carl

thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3971
 Posted: 07:21pm 06 Jul 2020 Copy link to clipboard Print this post

For kicks-and-giggles I am giving "Lunar" a kick to see if I can can persuade it to run on the CMM2. If anyone thinks I am treading on their toes and would rather I left it as an exercise for them then please let me know.

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures

abraxas
Regular Member

Joined: 16/06/2020
Posts: 99
 Posted: 07:36pm 06 Jul 2020 Copy link to clipboard Print this post

thwill said  For kicks-and-giggles I am giving "Lunar" a kick to see if I can can persuade it to run on the CMM2. If anyone thinks I am treading on their toes and would rather I left it as an exercise for them then please let me know.

Tom

Not treading as I'm not doing working on that specific one but my hope is to eventually make a few 80's remakes for the CMM2 starting with a Boulder Dash clone followed by other 80's titles that I have a strong nostalgia for: Jet Pac, MinerWilly series, Montezuma's Revenge and many others. Someone's already done a very usable remake of ManicMiner from what I saw. I'll probably take on Montezuma's Revenge right after I'm done with my Boulder Dash clone.

thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3971
 Posted: 07:41pm 06 Jul 2020 Copy link to clipboard Print this post

abraxas said  Not treading as I'm not doing working on that specific one but my hope is to eventually make a few 80's remakes for the CMM2 ..

Nice. I was just going to get "Lunar" to work on the CMM2 and re-post it on Fruit of the Shed, not do any polishing on it.

Regards,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures

matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8809
 Posted: 09:52pm 06 Jul 2020 Copy link to clipboard Print this post

Lunar converted. Use 5.05.04b3d just posted to correct minor colour issue

'Lunar Lander for Colour Maximite v4.0
'
option legacy on
Option Base 1
Clear
'Array declaration
Dim Tevel(MM.HRes)
Dim BoosterSpr(2)
Dim ExplodeSpr(5)
Dim PlatformLSpr(5)
Dim PlatformRSpr(5)
Dim FootPix(2)
'Set 240 x 216 8 colours resolution
mode 5
'We get the Sprites from file
'Drive "b:"
'Sprite declaration
LanderSpr = 1
BoosterSpr(1) = 2 : BoosterSpr(2) = 3
For a = 1 To 5
ExplodeSpr(a) = a + 3
PlatformLSpr(a) = a + 8
PlatformRSpr(a) = a + 13
Next a
FootPix(1) = 0 : FootPix(2) = 0
'1st animated Sprite per type
PlatFormSprNum = 1
NextPlatSprnum=2
ExplodeSprNum = 1
BoosterSprNum = 1
'Set the Joystick pin's
'PIN 11 = UP (Booster)
SetPin 11,din,pullup
'PIN 13 = LEFT
SetPin 13,din,pullup
'PIN 12 = RIGHT
SetPin 12,din,pullup
'Set some variables
Booster = 0
LemSpeed = 0.1
SpeedX = 0.0
Fuel = 25.0
Gravity = 1.63
GoRight = 0 : GoUp = 0 : GoLeft = 0
Score = 0
PixLeft = 0
PixRight = 0
GMx = MM.HRes - 1
GMy = MM.VRes - 1
Print @(70,100) "Press a key to Start"
Do While (Inkey\$ = "") And (Pin(11) = 1) And (Pin(13) = 1) And (Pin(12) = 1)
Loop
Cls
'Randomize Timer
'Landing platform position
Platformx = Int(Rnd * (GMx -60)) + 20
Platformy = Int(Rnd * 80) + (GMy - 80)
'Here we draw the terrain and the Landing platform
Sprite show PlatformLSpr(PlatFormSprNum) , Platformx , Platformy,1
Sprite show PlatformRSpr(PlatFormSprNum) , Platformx + 16, Platformy,1
'Terrain at Left from the platform
py = Platformy + (Rnd * 7) - 3
For a = Platformx - 1 To 0 Step - 1
py = py + (Rnd * 7) - 3
Line (a,GMy) - (a,py),3
Tevel(a) = py
Next a
'Terrain at Right from the platform
py = Platformy + (Rnd * 7) - 3
For a = Platformx + 33 To GMx
py = py + (Rnd * 7) - 3
Line (a,GMy) - (a,py),3
Tevel(a) = py
Next a
'Terrain under the platform
For a = Platformx To Platformx + 32
Line (a,GMy) - (a,Platformy + 6),3
Next a
'LEM position at start
LemX = Rnd * (GMx - 60) + 20
LemY = Rnd * 50 + 25
'Show the LEM
Sprite show LanderSpr , LemX , LemY,1
BoosterWas1 = 0
'Initialise the platform sprite counter
PlatformCount = 0
'Next load's will be from drive "a:"
Mod_is_playing = 0
Timer = 0
'Main program loop
Do While 1
keypressed = keydown(1)
If (Pin(11) = 0) Or keypressed = 128) Then GoUP = 1
If (Pin(12) = 0) Or keypressed = 131) Then GoRight = 1
If (Pin(13) = 0) Or keypressed = 130) Then GoLeft = 1
'
'Test if we are over the platform
If LemY > (Platformy - 17) Then
'Test if we have landed or Collided
If (LemX >= Platformx) And (Lemx < (Platformx + 16)) Then
'Landing test
If LemSpeed <= 2.0 Then
If Mod_is_playing = 1 Then
Play Stop
EndIf
play modfile "landed.mod"
Print @(75,50) "Successfully Landed"
Pause 2000
Run
Else
If BoosterWas1 = 1 Then
Sprite hide BoosterSpr(BoosterSprNum)
EndIf
If Mod_is_playing = 1 Then
Play Stop
EndIf
Play modfile  "explode.mod"
Sprite hide LanderSpr
For a = 1 To 5
Sprite show ExplodeSpr(a) , LemX , LemY,1
Pause 100
Sprite hide ExplodeSpr(a)
Next a
Print @(80,50) "You Crashed !!!"
Pause 2000
Run
EndIf
EndIf
EndIf
'We check collision with the Terrain
FootPix(1) = Pixel(LemX,LemY + 16)
FootPix(2) = Pixel(LemX + 15,LemY + 16)
If (FootPix(1) <> 0) Or (FootPix(2) <> 0) Then
If BoosterWas1 = 1 Then
Sprite hide BoosterSpr(BoosterSprNum)
EndIf
Sprite hide LanderSpr
If Mod_is_playing = 1 Then
Play Stop
EndIf
Play modfile "explode.mod"
For a = 1 To 5
Sprite show ExplodeSpr(a) , LemX , LemY,1
Pause 100
Sprite hide ExplodeSpr(a)
Next a
Print @(80,50) "You Crashed !!!"
Pause 2000
Run
EndIf
If Timer >= 100 Then
'Timer routine every 100mS
PlatformCount = PlatformCount + 1
Recompute
Redraw
Timer = 0
EndIf
Loop

Sub Recompute
'This part is executed every 100mS
LEMSpeed = LEMSpeed + (Gravity * 0.1)
If (GoUP = 1) And (Fuel > 0) Then
LemSpeed = LemSpeed - (Gravity * 0.2)
Fuel = Fuel - 0.3
GoUp = 0
Booster = 1
Else
Booster = 0
EndIf
If (GoRight = 1) And (Fuel > 0) Then
Vx = Vx + 0.1
Fuel = Fuel - 0.1
GoRight = 0
EndIf
If (GoLeft = 1) And (Fuel > 0) Then
Vx = Vx - 0.1
Fuel = Fuel - 0.1
GoLeft = 0
EndIf
'Record the LEM position
OldLemX = Int(LemX) : OldLemY = Int(LemY)
LemY = Int(LemY + LemSpeed)
LemX = Int(LemX + Vx)
'Clip the LEM in the screen
If LemX > (GMx - 17) Then LemX = GMx - 17
If LemX < 5 Then LemX = 5
If LemY > (GMy - 17) Then LemY = GMy - 17
If LemY < 50 Then LemY = 50
End Sub

Sub Redraw
'This part is executed every 100mS
Print @(0,0) "Speed " @(35,0) Str\$(Int(LemSpeed)) + " "
Print @(100,0) "Fuel "@(135,0) Str\$(Int(Fuel)) + " "
'Check if we have to erase the booster
If BoosterWas1 = 1 Then
Sprite hide BoosterSpr(BoosterSprNum)
BoosterWas1 = 0
Else
If Mod_is_playing = 1 Then
Play Stop
Mod_is_playing = 0
EndIf
EndIf
'We redraw the LEM
Sprite show LanderSpr , LemX , LemY,1
' Draw the Booster if needed
If Booster = 1 Then
If Mod_is_playing = 0 Then
Play modfile "turbine.mod"
Mod_is_playing = 1
EndIf
BoosterSprNum = BoosterSprNum + 1
If BoosterSprNum > 2 Then BoosterSprNum = 1
Sprite show BoosterSpr(BoosterSprNum) , LemX + 5 , LemY + 12,1
Booster = 0
BoosterWas1 = 1
EndIf
'Cycle the platform Sprites evey 300mS
If PlatformCount = 3 Then
Sprite swap PlatformRSpr(PlatFormSprNum),PlatformRSpr(NextPlatSprnum)
Sprite swap PlatformLSpr(PlatFormSprNum),PlatformLSpr(NextPlatSprnum)
PlatFormSprNum = PlatFormSprNum + 1
If PlatFormSprNum > 5 Then PlatFormSprNum = 1
NextPlatSprnum = NextPlatSprnum + 1
if NextPlatSprnum > 5 then NextPlatSprnum = 1
PlatformCount = 0
EndIf
End Sub

Sprite file

16,18

22222222
2111111112
216666666612
21666111166612
2266613333166622
2116613333166112
2666613333166662
2116662222666112
2666111111116662
1111 111111 1111
222  1111  222
22        22
2          2
2          2
222        222
664646
466464
6464
66

466464
644646
4646
46

6

64    6 4
4466
664646
6 6644646
4 646666
6  6646 6
4
4  6

4   6
6 4     6
6    6     4
4
64    6 466
4    6666  6
6666666
6446446466
4666646646 6
6646666 6
6646
6 46 466  4
4  6
6 4       6

64   6
6 6      466
6 44     4 4
4 444 6
66    664
4   66666 6
6  6666
644 4  466
466664 646 6
6    66 6666 6
4   66464
66   466  4
4      4
6 46     6

4      6
46 6      446
6 6
464
6     64
4         6
6   6 6
64 6   66
4       4  4
6 6  6     6
4    6 64
6   46   46
4
46     6

4
4  46

6
6       4

4
4 6        6
4
6
4
4
6  4 6
4

3222222222222222
2222222222222222
1277744447777444
1277744447777444
1222222222222222
1111111111111111
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3222222222222222
2222222222222222
1277774444777744
1277774444777744
1222222222222222
1111111111111111
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3222222222222222
2222222222222222
1247777444477774
1247777444477774
1222222222222222
1111111111111111
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3222222222222222
2222222222222222
1244777744447777
1244777744447777
1222222222222222
1111111111111111
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3222222222222222
2222222222222222
1244477774444777
1244477774444777
1222222222222222
1111111111111111
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
2222222222222223
2222222222222222
4777744447777421
4777744447777421
2222222222222221
1111111111111111
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
2222222222222223
2222222222222222
4477774444777721
4477774444777721
2222222222222221
1111111111111111
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
2222222222222223
2222222222222222
4447777444477721
4447777444477721
2222222222222221
1111111111111111
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
2222222222222223
2222222222222222
4444777744447721
4444777744447721
2222222222222221
1111111111111111
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
2222222222222223
2222222222222222
7444477774444721
7444477774444721
2222222222222221
1111111111111111
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333
3333333333333333

Edited 2020-07-07 07:55 by matherp

thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3971
 Posted: 10:23pm 06 Jul 2020 Copy link to clipboard Print this post

matherp said  Lunar converted. Use 5.05.04b3d just posted to correct minor colour issue ...

I think someone just stomped all over my toes in their Size 11's

Let's see if it works a second time ...

For kicks-and-giggles I'm going to port Elite to the CMM2. If anyone thinks I am treading on their toes and would rather I left it as an exercise for them then please let me know.

Regards,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures

Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 847
 Posted: 12:36am 07 Jul 2020 Copy link to clipboard Print this post

Peter,
You are amazing! Thank you!
I'll load it shortly and start landing . . . and then check the code to see how it works.

And just to confirm that you ARE appreciated - but not necessarily "by all the people all the time" to lift a quotation (and another one is "ship happens").

(I'd forgotten about OPTION LEGACY - I can be slow at times)

Cheers,

Andrew

Andrew_G
Guru

Joined: 18/10/2016
Location: Australia
Posts: 847
 Posted: 12:40am 07 Jul 2020 Copy link to clipboard Print this post

Hi all,
The other favorite game of mine was "Larry The Lounge Lizard" (I don't go in for the tooting and shooting types).

Andrew

Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1608
 Posted: 02:23am 07 Jul 2020 Copy link to clipboard Print this post

Quote  I think someone just stomped all over my toes in their Size 11's

We can look at the changes made and consider it a tutorial.

Quote  For kicks-and-giggles I'm going to port Elite to the CMM2. If anyone thinks I am treading on their toes and would rather I left it as an exercise for them then please let me know.

Good luck! How about DONUT or MAXMAN?

Bill
Keep safe. Live long and prosper.

TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6006
 Posted: 03:21am 07 Jul 2020 Copy link to clipboard Print this post

Life

life2.zip

Code was left readable(ish) rather than trying for speed.

Jim
VK7JH
MMedit Â  MMBasic Help

Sasquatch

Guru

Joined: 08/05/2020
Location: United States
Posts: 319
 Posted: 01:54am 08 Jul 2020 Copy link to clipboard Print this post

This simple program displays the distribution of the hardware random number generator as a dynamic histogram.  If you think you can see a pattern, try running it a few more times to see if the pattern persists LOL

'Entropy.bas

Setup:
Mode 1,8
Dim A%(800)
XMax = MM.HRES - 1
YMax = MM.VRES - 1

Start:
CLS

Do
X = FIX(RND * XMax)
A%(X) = A%(X) + 1
Pixel X,YMAX - A%(X),RGB(WHITE)
Loop until A%(X) > YMax 'OR Inkey\$ <> ""

-Carl

Page 3 of 4