Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 21:51 28 Mar 2024 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 : Colour Maximite 1 & 2 BASIC Programming Challenge 2021

     Page 1 of 8    
Author Message
Nimue

Guru

Joined: 06/08/2020
Location: United Kingdom
Posts: 367
Posted: 03:50pm 10 Feb 2021
Copy link to clipboard 
Print this post

Thanks to the generosity of Mick Gulovsen (bigmik) we are pleased to announce the inaugural Colour Maximite 1 & 2 BASIC Programming Challenge.

We hope it will encourage the endeavours of our community and perhaps prompt some of the lurkers to reveal themselves and their projects.

Challenge rules and how to submit your entry are in the attached pdf below.

CMM1_2 Programming Challenge 2021.pdf

Have fun and happy coding.

@thwill
@bigmik
@Nimue
Edited 2021-02-11 01:51 by Nimue
Entropy is not what it used to be
 
PeteCotton

Guru

Joined: 13/08/2020
Location: Canada
Posts: 311
Posted: 05:01pm 10 Feb 2021
Copy link to clipboard 
Print this post

Fantastic! I wish I had time to enter!

My CMM2 is sitting on my desk taunting me - I am desperate to get back to playing with it, but Covid downturn has left me working long hours trying to keep my business afloat  

I am keeping an eye on this forum though - and I am seriously going to have to re-read the new manual when things get back to normal. So many amazing and exciting changes to tinker with!

Good luck all. Now, if someone could write me a program that controls the weather, I would be very appreciative.

 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1081
Posted: 07:00pm 10 Feb 2021
Copy link to clipboard 
Print this post

Points for clarity?
Hah, I'm going for the exact opposite - OPACITY/CHAOS/CONFUSION - all without a single GOTO.  
Visit Vegipete's *Mite Library for cool programs.
 
Nimue

Guru

Joined: 06/08/2020
Location: United Kingdom
Posts: 367
Posted: 07:25pm 10 Feb 2021
Copy link to clipboard 
Print this post

  vegipete said  Points for clarity?
Hah, I'm going for the exact opposite - OPACITY/CHAOS/CONFUSION - all without a single GOTO.  


I loves a bit of obfuscation - so potential bonus points (or at least an honorary mention) for code that literally makes no sense, but works!!!  <<< Not really!!

Seriously though, I seem to remember in QBASIC / GWBASIC days that there was some pre-processor (shareware probably) that made the code unreadable (similar to javscript that does the same for HTML).

N
Entropy is not what it used to be
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3807
Posted: 07:38pm 10 Feb 2021
Copy link to clipboard 
Print this post

  vegipete said  Points for clarity?
Hah, I'm going for the exact opposite - OPACITY/CHAOS/CONFUSION - all without a single GOTO.  


It's OK, I've got a piece of code that with a little additional development should be capable of reformatting most offenders ... end result will probably be considerably more than 48 lines though, and it can't help if you've obfuscated the variable names.

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

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1081
Posted: 08:34pm 10 Feb 2021
Copy link to clipboard 
Print this post

No specific obfuscation - just lots of 1 and 2 character variable names. Plus lines packed like crazy using ":".

Turning each ":" into a "CRLF" will break my program. Instead, each ":" on a line after a "THEN" that is NOT immediately followed by a ":" must be left alone.

I'll give it a try in Notepad++ ...

Wow, it currently expands to about 170 lines. And still works!
Visit Vegipete's *Mite Library for cool programs.
 
PeteCotton

Guru

Joined: 13/08/2020
Location: Canada
Posts: 311
Posted: 09:58pm 10 Feb 2021
Copy link to clipboard 
Print this post

You could always go for self-modifying code.......  
 
Nimue

Guru

Joined: 06/08/2020
Location: United Kingdom
Posts: 367
Posted: 11:59pm 10 Feb 2021
Copy link to clipboard 
Print this post

  PeteCotton said  You could always go for self-modifying code.......  


Is that a use-case for the EVAL() function.....

But....

Hack$="NEW"
EVAL(Hack$)

Doesn't work as EVAL only returns int, float or $

I even tried:
HA$=CHR$(78)+CHR$(69)+CHR$(87)
EVAL HA$

Also - no joy.

I wonder if self modifying code is possible in MMBasic (PEEK / POKE maybe?)

N
Entropy is not what it used to be
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2861
Posted: 12:01am 11 Feb 2021
Copy link to clipboard 
Print this post

  PeteCotton said  You could always go for self-modifying code.......  


Hi Pete, All,

Funny you say that, I was wondering if someone would come up with some method of modifying the stored code at run time.
I remember back in my TRS-80 days some programs did this (I think one was dancing demon) if you could list before run it looked normal but a list after run looked gibberish, I think it was embedded machine code.

Good luck trying..

Regards,

MICK
Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
LeoNicolas

Guru

Joined: 07/10/2020
Location: Canada
Posts: 432
Posted: 05:17am 11 Feb 2021
Copy link to clipboard 
Print this post

I love it.

Unfortunately, there are 2 months that I can't play with my CMM2 :(

I'll try to post some code.
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3807
Posted: 09:56am 11 Feb 2021
Copy link to clipboard 
Print this post

@Nimue,

Rather than EVAL use EXECUTE to execute an arbitrary statement contained in a STRING. Not everything is possible / it's a bit flakey, but most importantly (for me) you can use it to call RUN and RESTORE taking their parameters from a variable, something that neither command can do in normal usage.

I don't think this would count as self-modifying code though.

I'm not certain, and perhaps @matherp will stop by and let us know, but at least in the default OPTION FLASH mode the CMM2 has Harvard rather than Von-Neumann architecture which (and I don't claim to be an expert) I think means self-modifying code is not possible. I don't know if this changes when using OPTION RAM.

On a related topic I'm still hoping that someone can demonstrate:

- load machine code from a file into an int array
- call a CSUB to transfer the execution (the program counter) into that code
- return safetly to BASIC

Unless @matherp is going to tell us that such is impossible (as opposed to very hard) due to the way the CMM2 architecture / memory-map works.

Best wishes,

Tom
Edited 2021-02-11 19:58 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8516
Posted: 10:06am 11 Feb 2021
Copy link to clipboard 
Print this post

  Quote  Unless @matherp is going to tell us that such is impossible (as opposed to very hard) due to the way the CMM2 architecture / memory-map works.


It is impossible
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3807
Posted: 10:13am 11 Feb 2021
Copy link to clipboard 
Print this post

  matherp said  It is impossible


Good morning Peter. To be honest I was hoping for more of an explanation, but I know you're a busy man.

Best wishes,

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

Joined: 11/12/2012
Location: United Kingdom
Posts: 8516
Posted: 10:15am 11 Feb 2021
Copy link to clipboard 
Print this post

Memory management of ram for variables doesn't allow execution
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3807
Posted: 10:30am 11 Feb 2021
Copy link to clipboard 
Print this post

  matherp said  Memory management of ram for variables doesn't allow execution


OK, so there is a sort-of Harvard architecture approach baked in. Fair enough, I'll strike that off my TODO list.

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

Joined: 06/03/2016
Location: Brazil
Posts: 303
Posted: 10:56am 11 Feb 2021
Copy link to clipboard 
Print this post

I started my program yesterday and I believe is almost done, and now I perceived how powerful is the MMBasic in contrast with other BASIC variants, as in a screen of 48x100 characters we have plenty of room to make many things that even I had not thought before.

Thanks to the brilliant minds of Peter and Geoff, in one single command we can make things that in other BASIC variants would need much more development.

For sure the CMM2 is a very capable machine in many aspects and can bring any type of program to life, but no doubt it has a great powerhouse to make interesting games with fewer lines of code, and engaging in this contest made me feel this deeply.

I am anxious to see what other minds will produce.

I wish a happy coding to all!
 
PeteCotton

Guru

Joined: 13/08/2020
Location: Canada
Posts: 311
Posted: 05:07pm 11 Feb 2021
Copy link to clipboard 
Print this post

Ha ha! To be clear, I was being facetious with the "self modifying code" suggestion! But I'm glad that it spawned am interesting side conversation!

I can't wait to see what everyone produces. I think it's a brilliant challenge.
Edited 2021-02-12 03:08 by PeteCotton
 
Nimue

Guru

Joined: 06/08/2020
Location: United Kingdom
Posts: 367
Posted: 10:09pm 11 Feb 2021
Copy link to clipboard 
Print this post

  PeteCotton said  Ha ha! To be clear, I was being facetious with the "self modifying code" suggestion! But I'm glad that it spawned am interesting side conversation!

I can't wait to see what everyone produces. I think it's a brilliant challenge.


What I love about this Forum (aside from feeding my inner geek) is you never know which posts will blow up and have 95+ replies.  Love it.

N
Entropy is not what it used to be
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 2989
Posted: 11:25pm 11 Feb 2021
Copy link to clipboard 
Print this post

  Nimue said  you never know which posts will blow up and have 95+ replies.


The regulars on this forum have a good many hundreds of years (combined) of diverse tech experience. Anything may trigger a release of esoteric knowledge, and then trigger ramifications.
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1081
Posted: 03:31am 12 Feb 2021
Copy link to clipboard 
Print this post

OK folks, here is what I have created.

The title is "In Defense of the Green Hills of Earth"

46 lines total, of which the first two are identification comments.

I think I have squashed all the bugs, but let me know if you notice anything. I do know that collision detection is not as good as I would like.

For a challenge, who can figure out what this program does without actually running it?

'   In Defense of the Green Hills of Earth  v1.0              by vegipete, Feb 2021
' Use left and right arrow keys, and either Ctrl key.
mode 3,12:dim ax(54),ay(54),m(9)=(0,1,0,1,2,3,2,3,4,5),ny(20),nx(20):ey=210:l=0:nf=200:tt=10000
dim sf(7)=(0,1,1,0,0,-1,-1,0):r=268369920:g=251723520:b=251658495:rg=r or g:gb=g or b:ww=rg or b
bx=-400:bd=1.5:yd=3:settick 4,ps,2:settick 1000,am,3:math set 210,ny():settick 35,af,4
pause 500:Page write 1:box-1,9,322,191,,b:page write 0
do:yd=0:text 90,26,"Press a key to start...",,,,rg:do while inkey$<>"":loop:do
loop until inkey$<>"":settick 20,kp,1:lf=2:l=0:yd=3:sc=0:nl=1:p=150:do:cls:x=70:y=min(170,94+5*l)
u=2:v=142:for i=0 to 54:ax(i)=(i mod 11)*16:ay(i)=(i\11)*15:next:e=55:sp(0):sh:O=1:nf=499:l=l+1
z=2:w(40):w(110):w(180):w(250):sl:do:if y>math(min ay())+176 then go:exit do
if (keydown(7)and 34)<>0 and(s<10)and(f1=0)then s=184:t=p+24:play tone 500,500,20:f1=10
for i=1 to 20:d=2*(abs(t-nx(i))<3 and abs(s-ny(i))<3):nx(i)=nx(i)*(1-d):if d then se
if pixel(nx(i),ny(i))=gb then:settick 0,kp,1:yd=0:text p+13,189,"Boom":play stop
for j=1 to 25:play sound 1,b,n,100,26-j:pause 50:next j:play stop:text p-16,186,".....",,8
lf=lf-1:if lf<0 then go:exit do ' Confused yet?
yd=3:ws:sl:text p-16,186,"..H..",,8,,gb:settick 20,kp,1:endif:next:d=pixel(t,s-1)
if s and d=g then:line t-1,s+6,t-1,s-4,3,0:s=9:elseif s and d=ww and s<26 then:pt=50*int(1+rnd*3)
fx=bx:se:bx=bd*240:text fx+16,17,str$(pt)+" ",,,,r:sp(pt):f2=25:elseif s and d=ww and s>y-58 then
i=(y-s+15)\15:h=(t-x)\16:ax(i*11+h)=-400:ay(i*11+h)=80:text ex,ey,"'",,8:ex=x+h*16:ey=y-i*15
text ex,ey,"@",,8,,rg:sp(10+5*m(i*2)):se:e=e-1:if e=0 then exit do
d=abs(ax(0)):for i=1 to 54:d=min(d,abs(ax(i))):next:u=2-d:v=302-math(max ax())
endif:if nf=0 then:nf=int(20+10*rnd+10*e):d=int(rnd*11):do while ay(d)>60:d=(d+7)mod 55:loop
for i=1 to 20:if ny(i) > 210 then nx(i)=8+x+ax(d):ny(i)=y-ay(d)+12:exit for
next:endif:loop:if e then exit do ' Why must "ws" appear twice on the next line? Firmware bug?
ws:ws:loop:loop:sub sp(q):sc=sc+q:?@(0,1)sc:lf=lf+((sc\tt)=nl):nl=nl+((sc\tt)=nl):sl:end sub
sub w(h):text h,160,"KL",,8,,g:text h,172,"IJ",,8,,g:end sub:sub sh:?@(75,1)"High Score"hs:end sub
sub sl:for j=1 to 5:text 330-16*j,0,chr$(77+(lf<j)),"R",8:next:end sub
sub ws:do:loop until nn=20:end sub:sub se:ss=s:s=9:line t,ss-1,t,ss+6,,0:end sub
sub kp:k=keydown(1):p=p+1*((k=131)*(p<288)-(k=130)*(p>-16)):text p,186,".H.",,8,,gb:f1=f1-(f1>0)
end sub:sub ps:s=s-(s>9):line t,s,t,s+6,,(s>9)*gb:pixel t,s+7,0:nf=nf-(nf>0):end sub
sub am:text ex,ey,"'",,8:ey=210:if e then:x=x+z:settick 10+e*6,am,3:if x<u or x>v then z=-z:y=y+yd
O=O=0:for i2=0 to 54:text x+ax(i2),y-ay(i2),chr$(65+O+m(i2\11*2)),,8:next:endif:end sub
sub af:math add ny(),1,ny():nn=0:for j1=1 to 20:c=(pixel(nx(j1),ny(j1)-6)=g)+(nx(j1)<0)
for j2=0 to 7:j3 = abs(nx(j1))+sf((ny(j1)+8-j2)mod 8):px(0):if c then px(-1):px(1)
next j2:ny(j1)=ny(j1)+120*c: nn=nn+(ny(j1)>210): next j1:f2=f2-1 ' Great Scott! What a disaster!
bx=bx+bd:text bx,13,"/G\",,8:if abs(bx)>450 then br=1-2*cint(rnd):bd=-1.5*br:bx=br*(400+rnd*200)
if f2=1 then text fx,13,"\_/",,8:endif:end sub:sub px(c1):pixel j3+c1,ny(j1)-j2,b*(j2<>7)*(c=0)
end sub:DefineFont #8:0E400C10 00000000 00000000 90094812 0C302004 90092004 00004812 00000000
00000000 F81FC003 9C39FC3F 700EFC3F 300C9819 00000000 00000000 F81FC003 9C39FC3F 700EFC3F 0C309819
00000000 00000000 20021004 D80DF007 F417FC1F 60031414 00000000 00000000 24121004 DC1DF417 F007F80F
08081004 00000000 00000000 E001C000 D806F003 2001F807 2805D002 00000000 00000000 E001C000 D806F003
1002F807 10020804 00000000 00000000 F81FE007 B66DFC3F 9C39FFFF 00000810 00000000 80008000 C001C001
FF7FFE3F FF7FFF7F 0000FF7F FF0FFF0F FF0FFF0F FF0FFF0F FF0FFF0F E00FF00F C00FC00F F0FFF0FF F0FFF0FF
F0FFF0FF F0FFF0FF F007F00F F003F003 00000000 00000000 00000000 00000000 FF01FF00 FF07FF03 00000000
00000000 00000000 00000000 80FF00FF E0FFC0FF 00010000 F01F0001 F83FF83F 0000F83F 00000000 00000000
END DefineFont:sub go:pause 500:hs=max(hs,sc):sh:play tts "game over":ws:end sub

Edited 2021-02-12 13:36 by vegipete
Visit Vegipete's *Mite Library for cool programs.
 
     Page 1 of 8    
Print this page
© JAQ Software 2024