A gamebuino "emulator" ?

Libraries, utilities, bootloaders...

A gamebuino "emulator" ?

Postby 65c02 » Fri Mar 28, 2014 1:26 pm

Hi,

While waiting for a gamebuino I would like to code some stuff to test.
Is there an emulator or something else, that would allow me to see some rendering ?

( I've never worked on arduino project before so sorry if my question is stupid :mrgreen: )
User avatar
65c02
 
Posts: 11
Joined: Fri Mar 28, 2014 10:13 am

Re: A gamebuino "emulator" ?

Postby adekto » Fri Mar 28, 2014 1:33 pm

there arduino emulators out there, but i dont know any with the lcd screen
autodesk even has one
User avatar
adekto
 
Posts: 448
Joined: Tue Feb 25, 2014 9:47 pm
Location: belgium

Re: A gamebuino "emulator" ?

Postby rodot » Fri Mar 28, 2014 1:35 pm

Your question if far from being stupid, you're not the first one who ask for an emulator. The thing is, developing an emulator would take a lot of time, and I prefer to spend my time on developing Gamebuino itself. Moreover, once you'll have your Gamebuino, it will only be a matter of seconds to compile and upload your game, so you won't really need an emulator. And the Gamebuino library changes everyday, so I would have to update the emulator all the time...

But if you really can't wait, you can hook up a screen, a speaker and few buttons. Look in the "Hardware Gallery" category, there is already Gamebuino clones out there ;)
User avatar
rodot
Site Admin
 
Posts: 1290
Joined: Mon Nov 19, 2012 11:54 pm
Location: France

Re: A gamebuino "emulator" ?

Postby 65c02 » Fri Mar 28, 2014 1:42 pm

Whaou !

I did not ask that you develop an emulator :D
I just thought : Arduino seem to be a kind of standard hardware, and may be there is a plugin for Arduino IDE or a simulator.

Anyway, I'll wait;
It's just a question of time :)
User avatar
65c02
 
Posts: 11
Joined: Fri Mar 28, 2014 10:13 am

Re: A gamebuino "emulator" ?

Postby 65c02 » Fri Mar 28, 2014 1:49 pm

adekto wrote:there arduino emulators out there, but i dont know any with the lcd screen
autodesk even has one

What a crazy tool !
But I'm too far from my comfort zone :mrgreen:
User avatar
65c02
 
Posts: 11
Joined: Fri Mar 28, 2014 10:13 am

Re: A gamebuino "emulator" ?

Postby 65c02 » Sat Mar 29, 2014 4:24 pm

Ok,
I must confess that I'm looking forward to playing with gamebuino.
So, I started programming an as3 class that simulate its rendering.
For now, I've implemented the function DrawBitmap

My goal is to simulate the same data constraint (screen size, 8 pixels / byte, remanence)
I can now try to develop some graphic algorithms.

here is the current result

Here is the code if anyone interested

Code: Select all
package 
{
   import flash.display.Bitmap;
   import flash.display.BitmapData;
   import flash.geom.ColorTransform;
   
   /**
    * Try to simulate the gamebuino display
    * @author Alain Le Guirec
    */
   public class LCD extends Bitmap
   {
      // this buffer is the memory
      protected var m_buffer:Vector.<int> = new Vector.<int>(48 * (80 / 8));
      
      // this buffer is used by flash to render buffer fast
      // usefull to simulate the remanence to
      protected var m_colors:Vector.<uint> = new Vector.<uint>(48*80);

      public function LCD()
      {
         super();
         bitmapData = new BitmapData(80, 48, false, 0xFFFFFF);         
         transform.colorTransform = new ColorTransform(0.8, 0.9, 0.8); // put here the screen color (rgb values between 0.0 and 1.0)
      }
      
      public function setPixel(px:uint, py:uint, bState:Boolean):void
      {
         if (px >= 80 || py >= 48)
            return;
            
         if(bState)
            m_buffer[(py * 10) + (px >> 3)] |= 0xFF & (1 << (7 - (px & 7)));
         else
            m_buffer[(py * 10) + (px >> 3)] &= 0xFF ^ (1 << (7 - (px & 7)));
      }

      /*
       * simulate the gamebuino display function
       */
      public function drawBitmap(px:int, py:int, btm:Vector.<int>):void
      {
         var idxRead:int = 2;
         var byteWidth:int = btm[0] >> 3;
                  
         for (var py:int = 0; py < btm[1]; py++)
         {
            for (var nbyte:int = 0; nbyte < byteWidth; nbyte++)
            {
               var val:int = btm[idxRead++];
               
               for (var nbits:int = 0; nbits < 8; nbits++)
               {
                  setPixel(px + nbits, py, (val & 0x80) != 0);                   
                  val <<= 1;
               }
            }
         }
      }
      
      /*
       * this function transfert the memory buffer to the flash bitmap
       * must be called each frame
       */
      public function update():void
      {
         var idxRead:int = 0;
         var idxWrite:int = 0;
         
         for (var py:int = 0; py < 48; py++)
         {
            var px:int = 0;
            
            for (var nbyte:int = 0; nbyte < 10; nbyte++)
            {
               var byte:int = m_buffer[idxRead++];
               
               for (var npix:int = 0; npix < 8; npix++,px++, idxWrite++)
               {
                  if ((byte & 0x80) != 0)
                     m_colors[idxWrite] = 0;
                  else
                  {
                     var l:int = ((m_colors[idxWrite] & 0xFF) + 0xFF) >> 1;
                     m_colors[idxWrite] = l<<16 | l<<8 | l;
                  }   
                  
                  byte <<= 1;
               }               
            }
         }

         bitmapData.setVector(bitmapData.rect, m_colors);
      }
   }
}
User avatar
65c02
 
Posts: 11
Joined: Fri Mar 28, 2014 10:13 am

Re: A gamebuino "emulator" ?

Postby adekto » Sat Mar 29, 2014 4:36 pm

hi there, i have tryed this to but in lua
the problem is u have to interprite c code or the hex comiled code to emulate it properly
User avatar
adekto
 
Posts: 448
Joined: Tue Feb 25, 2014 9:47 pm
Location: belgium

Re: A gamebuino "emulator" ?

Postby rodot » Sat Mar 29, 2014 4:41 pm

I still think that it's easier to assemble a fake-buino on a breadboard :P
User avatar
rodot
Site Admin
 
Posts: 1290
Joined: Mon Nov 19, 2012 11:54 pm
Location: France

Re: A gamebuino "emulator" ?

Postby 65c02 » Sat Mar 29, 2014 5:01 pm

adekto wrote:hi there, i have tryed this to but in lua
the problem is u have to interprite c code or the hex comiled code to emulate it properly

I don't try to emulate the hardware. I just want to try some algorithm in the good constraint.
If my algorithms works on as3, it will be easy to recode everything in C.
User avatar
65c02
 
Posts: 11
Joined: Fri Mar 28, 2014 10:13 am

Re: A gamebuino "emulator" ?

Postby 65c02 » Sat Mar 29, 2014 5:01 pm

rodot wrote:I still think that it's easier to assemble a fake-buino on a breadboard :P

:mrgreen:
User avatar
65c02
 
Posts: 11
Joined: Fri Mar 28, 2014 10:13 am

Next

Return to Software Development

Who is online

Users browsing this forum: No registered users and 6 guests

cron