Picaxe Tron

stan74

Senior Member
Here's a blurry video of Tron on a 128x64 oled. https://youtu.be/cL46P2ywqKk
I thought of a simple game and this was the simplest to do. Now the computer opponent bit is done, I just copy the player code to make it 2 player. I haven't got printing and graphics on the same screen because the screens memory is changed for text. If I posted the code for the oled,well I did once to show the oled codes because it took ages to find them,maybe someone could show me how.
Think it could win me some vero if I polished it? :)
 

edmunds

Senior Member
Nice! :)

Maybe this thread I started long ago is of assistance. I did not try drawing lines or pictures, but updating entire screens seems slower in your implementation. Maybe the code or the discussion in the thread is useful.


Good luck,

Edmunds
 

techElder

Well-known member
"Back in the day ..." I reprogrammed a game called "worm" on the TRS-80 Model I (Ok, try not to get nostalgic.) That was a fun exercise.

I worked on the code until it was as fast as the computer could put dots on the screen, but there was still a kid in the neighborhood that could play it!

Your video reminded me of that game. It was a single player game and only used 4 buttons.

PS. Something like this: http://www.worm-game.net/

PPS. I have seen it called "snake."
 

stan74

Senior Member
Cheers for the link Tex.I'll check it out but characters aren't plotted,they're just 5 adjacent bytes but I used someone else's code and the screen is remapped.
Code:
[color=Black]SetPosition:
      [/color][color=Green]'20 line x 4 rows is accompished by wrapping the text on each line past 20 characters to two lines down (not next line down). Position 20 (dec) is row 3, col 1[/color]
[color=Blue]let [/color][color=Black]abyte[/color][color=DarkCyan]= [/color][color=Black]SSD1306_PAGEADDR[/color]
[color=Blue]hi2cout ([/color][color=Navy]0[/color][color=Black],abyte[/color][color=Blue])
let [/color][color=Black]abyte [/color][color=DarkCyan]= [/color][color=Black]row[/color]
[color=Blue]hi2cout ([/color][color=Navy]0[/color][color=Black],abyte[/color][color=Blue])
let [/color][color=Black]abyte [/color][color=DarkCyan]= [/color][color=Navy]7[/color]
[color=Blue]hi2cout ([/color][color=Navy]0[/color][color=Black],abyte[/color][color=Blue])
      
let [/color][color=Black]abyte[/color][color=DarkCyan]= [/color][color=Black]SSD1306_COLUMNADDR[/color]
[color=Blue]let [/color][color=Black]col [/color][color=DarkCyan]= [/color][color=Black]col [/color][color=DarkCyan]* [/color][color=Navy]5 [/color][color=Green];columns per character[/color]
[color=Blue]hi2cout ([/color][color=Navy]0[/color][color=Black],abyte[/color][color=Blue])
let [/color][color=Black]abyte [/color][color=DarkCyan]= [/color][color=Black]col[/color]
[color=Blue]hi2cout ([/color][color=Navy]0[/color][color=Black],abyte[/color][color=Blue])
let [/color][color=Black]abyte [/color][color=DarkCyan]= [/color][color=Navy]127[/color]
[color=Blue]hi2cout ([/color][color=Navy]0[/color][color=Black],abyte[/color][color=Blue])
return[/color]
I did a worm game. You just use an array of x,y coords of each segment,move the head and erase the tail. Usually character size graphics so only 32x24 screen. oled screen too small and pixel array too large though.
Would starting a thread about these lovely, cheap displays be of interest? It seems people have had difficulties with these in the past but the codes are easier to find now. Adafruit and GCB have libraries that draw lines and filled circles much faster than a picaxe using Bresenham's line and mid point circle algorithm. My code might save someone reinventing the wheel.
You can see the screen being cleared. I hic2out_64 1024 bytes to the screen but each byte is preceded by a 64 so that's 2K but code I've seen just sends one 64, then 1K of consecutive bytes. Strange.
I remember the TRS80. A company here re-made them as the Dragon 32. Ah, nostalgia isn't what it used to be.
 

stan74

Senior Member
I posted a new video in the audio/video projects and the code which is hackable and commented. The subroutines might be useful to someone who bought an oled like this..they don't come with instructions :)
They have pixel hardware scrolling,just tell it to scroll how often and it just keeps scrolling,wrap around but just plot pixels at the edge.
Nice for showing data graphically.
 
Top