Jump to content



Photo
- - - - -

Revolution-FX Project


  • Please log in to reply
26 replies to this topic

#1 kucalc

kucalc

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1422 posts
  • Gender:Male
  • Location:USA
  • Interests:Programming: C/C++, Fortran, LISP, COBOL 85 Standard, PHP, x86 and SH3 Assembly

    Computer graphics

  • Calculators:
    fx-9860G / fx-7400G Plus / Algebra FX 2.0+ / fx-9770G / CFX-9850G / CFX-9850GB+ / TI-89 / TI-nSpire

Posted 10 September 2007 - 03:48 AM

This thread is for discussion and help for the Revolution-FX project.

Downloads can be found here: http://revolution-fx.../downloads.html
Documentation has also been updated for v0.3: http://revolution-fx.../documents.html

Documentation for offline viewing and printing has also been requested. PDF versions have now been released. :D Download here:

#2 k3v

k3v

    Casio Fan

  • Members
  • PipPip
  • 40 posts
  • Gender:Male
  • Location:Australia

  • Calculators:
    Casio Classpad 300 Plus \
    2 x Casio Fx-9860AU \
    Casio CFX-9850GB Plus \

Posted 11 September 2007 - 11:47 AM

Hehe, lets get it started off with some noob questions :geek: (this is k3v from CK btw 8-) )

Planning to take on CK with this eh? :D

Can you show me how to get three colours happening?
i assume its something like this:
unsigned char buffer1[1024]; 
   unsigned char buffer2[1024]; 
   unsigned char buffer3[1024];

   unsigned char box_one[16] = {0xFF,0xFF,0x80,0x0F,0x80,0x0F,0x80,0x0F,0x80,0x0F,0x80,
   0x0F,0x80,0x0F,0x80,0x0F,0x80,0x0F,0x80,0x0F,0x80,0x0F,0x80,0x0F,0x80,0x0F,0x80,
0x0F,
   0x80,0x0F,0xFF,0xFF};

   unsigned char box_two[16] ={0xFF,0xFF,0x80,0xF1,0x80,0xF1,0x80,0xF1,0x80,0xF1,0x80,
   0xF1,0x80,0xF1,0x80,0xF1,0x80,0xF1,0x80,0xF1,0x80,0xF1,0x80,0xF1,0x80,0xF1,0x80,
0xF1,
   0x80,0xF1,0xFF,0xFF};

   unsigned char box_three[16] ={0xFF,0xFF,0x8F,0x01,0x8F,0x01,0x8F,0x01,0x8F,0x01,0x8F,
   0x01,0x8F,0x01,0x8F,0x01,0x8F,0x01,0x8F,0x01,0x8F,0x01,0x8F,0x01,0x8F,0x01,0x8F,
0x01,
   0x8F,0x01,0xFF,0xFF};

	
   memset(&buffer1, 0, 1024); 
   memset(&buffer2, 0, 1024); 
   memset(&buffer3, 0, 1024); 

   GrayInit3(somevalue1, somevalue2, somevalue3); 
   GrayLinkBuffers3(buffer1, buffer2, buffer3); 

   while (IsKeyDown(KEY_CTRL_EXIT) != 1) { 
	  DrawSprite16(52, 24, buffer1, box_one, 0); 
	  DrawSprite16(52, 24, buffer2, box_two, 0); 
	  DrawSprite16(52, 24, buffer3, box_two, 0); 
   } 

   Reset_Calc(); 
   return 0;
I just dont know the GreyInit3(); values required. Or am i completely off the plot alltogether!?

My project features lots of 12x12 sprites, is it possible for you to add support for this size sprite, or should i just use the 16x16 functions and squash them together, or should i use the CopyVRAM(); function?

#3 kucalc

kucalc

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1422 posts
  • Gender:Male
  • Location:USA
  • Interests:Programming: C/C++, Fortran, LISP, COBOL 85 Standard, PHP, x86 and SH3 Assembly

    Computer graphics

  • Calculators:
    fx-9860G / fx-7400G Plus / Algebra FX 2.0+ / fx-9770G / CFX-9850G / CFX-9850GB+ / TI-89 / TI-nSpire

Posted 12 September 2007 - 03:41 AM

I like this forum, it's easier on the eyes. No small text with a black background. I think I can even have users choose their own theme if they like. And this forum has cool smilies. :ugeek:

#4 Guest_krisse7_*

Guest_krisse7_*
  • Guests

Posted 14 September 2007 - 01:09 PM

A few questions about serial port communication...

How do I use the serial port functions? Like this?

unsigned char r;
unsigned char t = 123;

Init_SerialPort();
Start_SerialPort();
while(...) r = SerialReceive();
if (r == ...) ...
SerialTransmit(t);
...
Stop_SerialPort();

and in the other calculator ...
unsigned char r;
unsigned char t = 234;

Init_SerialPort();
Start_SerialPort();
SerialTransmit(t);
while(...) r = SerialReceive();
if (r == ...) ...
...
Stop_SerialPort();

When I call SerialReceive() how do I know if the data returned by the function is some new data that has just arrived or some old data that I have already read with the previous call of that function and no new data has arrived?

It looks like you have to add Reset_Calc() to the end of the program so that the calculator does not freeze. But what does that function actually do? The documentation says something about erasing the contents of main memory. What kind of data is erased?

#5 kucalc

kucalc

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1422 posts
  • Gender:Male
  • Location:USA
  • Interests:Programming: C/C++, Fortran, LISP, COBOL 85 Standard, PHP, x86 and SH3 Assembly

    Computer graphics

  • Calculators:
    fx-9860G / fx-7400G Plus / Algebra FX 2.0+ / fx-9770G / CFX-9850G / CFX-9850GB+ / TI-89 / TI-nSpire

Posted 14 September 2007 - 01:30 PM

Hello Krisse7 and welcome to the UCPF! :D

When I call SerialReceive() how do I know if the data returned by the function is some new data that has just arrived or some old data that I have already read with the previous call of that function and no new data has arrived?


What you could do is also make sure that the variable is set to zero before you use SerialReceive().

r = 0;
r = SerialReceive();
if (r != 0) {
   PrintMini(1, 1, (unsigned char *)"Received", MINI_OVER);
} else {
   PrintMini(1, 1, (unsigned char *)"Nothing yet", MINI_OVER);
}

It looks like you have to add Reset_Calc() to the end of the program so that the calculator does not freeze. But what does that function actually do? The documentation says something about erasing the contents of main memory. What kind of data is erased?

Reset_Calc basically resets the calculator. It restarts the OS. The main memory is erased because the OS is restarted. It's not a big problem though if you don't have important things in the User RAM (64KB). You can always backup the main memories to the storage memory. But the good effect of Reset_Calc() is that it allows you to open the addin again after immediately exiting it.

#6 Guest_krisse7_*

Guest_krisse7_*
  • Guests

Posted 17 September 2007 - 12:45 PM

Ok, thanks for the information. But it looks like on my calculator SerialReceive() returns 212, not zero, if there is no new data... (But that's not a problem, at least not yet...)

#7 kucalc

kucalc

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1422 posts
  • Gender:Male
  • Location:USA
  • Interests:Programming: C/C++, Fortran, LISP, COBOL 85 Standard, PHP, x86 and SH3 Assembly

    Computer graphics

  • Calculators:
    fx-9860G / fx-7400G Plus / Algebra FX 2.0+ / fx-9770G / CFX-9850G / CFX-9850GB+ / TI-89 / TI-nSpire

Posted 17 September 2007 - 11:50 PM

I guess it should be easy to accommodate 212 instead of 0. If you have any more questions, please ask. :)

#8 Guest_visceroid_*

Guest_visceroid_*
  • Guests

Posted 18 October 2007 - 05:05 AM

what's all this C style coding?
Or is my calculator too old.
I have an fx9750G, which supports basic
is C only for later calculators or something?

#9 kucalc

kucalc

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1422 posts
  • Gender:Male
  • Location:USA
  • Interests:Programming: C/C++, Fortran, LISP, COBOL 85 Standard, PHP, x86 and SH3 Assembly

    Computer graphics

  • Calculators:
    fx-9860G / fx-7400G Plus / Algebra FX 2.0+ / fx-9770G / CFX-9850G / CFX-9850GB+ / TI-89 / TI-nSpire

Posted 18 October 2007 - 05:33 AM

Yes, I'm afraid all this C code is for the newer calculators, specifically the fx-9860G. You can read more about the fx-9860G here: http://en.wikipedia....fx-9860G_Series

#10 kucalc

kucalc

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1422 posts
  • Gender:Male
  • Location:USA
  • Interests:Programming: C/C++, Fortran, LISP, COBOL 85 Standard, PHP, x86 and SH3 Assembly

    Computer graphics

  • Calculators:
    fx-9860G / fx-7400G Plus / Algebra FX 2.0+ / fx-9770G / CFX-9850G / CFX-9850GB+ / TI-89 / TI-nSpire

Posted 20 October 2007 - 01:55 AM

Revolution-FX v0.3.1 Final has been released! :cool:
http://revolution-fx.../downloads.html

This package contains fixes the bugs in v0.3 BETA:
  • string_input() can now be used multiple times within a function
  • DrawLine() now fixed and draws lines properly
  • Grayscale with 3 buffers engine now "flips" through all 3 buffers (pointed out by Muelsaco)


#11 Fez

Fez

    Casio Freak

  • Members
  • PipPipPipPip
  • 162 posts
  • Gender:Male
  • Location:Australia

  • Calculators:
    Casio fx-9860G AU

Posted 20 October 2007 - 01:58 AM

YES thank you. Go String Input!
i think i speak for all when i say
thanx
thanx
thanx
thanx
thanx
thanx
thanx
thanx
thanx
thanx
thanx
thanx
thanx
thanx
thanx
thanx
thanx
thanx
thanx
thanx
thanx
thanx

#12 kucalc

kucalc

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1422 posts
  • Gender:Male
  • Location:USA
  • Interests:Programming: C/C++, Fortran, LISP, COBOL 85 Standard, PHP, x86 and SH3 Assembly

    Computer graphics

  • Calculators:
    fx-9860G / fx-7400G Plus / Algebra FX 2.0+ / fx-9770G / CFX-9850G / CFX-9850GB+ / TI-89 / TI-nSpire

Posted 20 October 2007 - 02:32 AM

Lol, ok. :)

Now that I got that out of the way, I can probably finish up MLC PC now.

#13 E_net4

E_net4

    Casio Freak

  • Members
  • PipPipPipPip
  • 189 posts
  • Gender:Male
  • Location:Output("Error: Coord type not specified");
  • Interests:Programming 'n' stuff...

  • Calculators:
    CASIO fx 9860G SD

Posted 20 October 2007 - 09:38 PM

Lol, ok. :)

Now that I got that out of the way, I can probably finish up MLC PC now.

Gopher it, I've been waiting for MLC PC for ages!

#14 kucalc

kucalc

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1422 posts
  • Gender:Male
  • Location:USA
  • Interests:Programming: C/C++, Fortran, LISP, COBOL 85 Standard, PHP, x86 and SH3 Assembly

    Computer graphics

  • Calculators:
    fx-9860G / fx-7400G Plus / Algebra FX 2.0+ / fx-9770G / CFX-9850G / CFX-9850GB+ / TI-89 / TI-nSpire

Posted 29 October 2007 - 07:05 AM

Hey guys, have you looked at the sprite drawing routines in Revolution-FX? :http://revolution-fx...amp;view=markup

Do any of you have suggestions in optimizing the functions for drawing sprites? I know that optimizations can be made.

#15 Andreas B

Andreas B

    Casio Freak

  • Members
  • PipPipPipPip
  • 160 posts
  • Gender:Male
  • Location:Norway

  • Calculators:
    fx-9860G SD

Posted 29 October 2007 - 02:44 PM

I think we should provide fast drawing that does not plot individual pixels, but instead copies the sprite directly to VRAM. The limitation is of course not being able to draw it at any location, only at offsets of 1 whole byte.

I was also thinking about some trickery using right/left shifts on the data, combined with the method I mentioned to be able to write to any x,y location, though that seems hard.

Also, the inline comments are thin. Do you want me to comment some?

#16 Andreas B

Andreas B

    Casio Freak

  • Members
  • PipPipPipPip
  • 160 posts
  • Gender:Male
  • Location:Norway

  • Calculators:
    fx-9860G SD

Posted 29 October 2007 - 05:59 PM

I checked out PlotPixel, used a lot in the sprite routines. Here are my discoveries:
Note that I have _not_ tested any of this code, it compiles, but might still have something wrong :) Would be nice if you tested it.

Edit: I moved the assembly listing to http://casio.pastebin.com/f285df85c - also added some comments on the last listing.

Original code, 144b, 71 instructions
void PlotPixel(char x, char y, unsigned char *buffer, char draw_type) {
	int i=((int)x >> 3) + ((int)y -1 && y>-1 && x> (x & 7); break;
		}
	}
}

+Pregenerate mask, 96 bytes, 46 instructions
The code 0x80 >> (x & 7) exists three times in the code, once is enough.
[code=auto:0]void PlotPixel(char x, char y, unsigned char *buffer, char draw_type) {
char mask;
int i;
mask = 0x80 >> (x & 7);
i = ((int)x >> 3) + ((int)y = 0 && i

#17 Fez

Fez

    Casio Freak

  • Members
  • PipPipPipPip
  • 162 posts
  • Gender:Male
  • Location:Australia

  • Calculators:
    Casio fx-9860G AU

Posted 30 October 2007 - 04:43 AM

:shock: Dabadee wha?
you lost me at, umm... the start. Im will never understand what the hell you guys talk about XD

#18 E_net4

E_net4

    Casio Freak

  • Members
  • PipPipPipPip
  • 189 posts
  • Gender:Male
  • Location:Output("Error: Coord type not specified");
  • Interests:Programming 'n' stuff...

  • Calculators:
    CASIO fx 9860G SD

Posted 30 October 2007 - 08:28 PM

The code seems to be Assembly. Be scared!

#19 kucalc

kucalc

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1422 posts
  • Gender:Male
  • Location:USA
  • Interests:Programming: C/C++, Fortran, LISP, COBOL 85 Standard, PHP, x86 and SH3 Assembly

    Computer graphics

  • Calculators:
    fx-9860G / fx-7400G Plus / Algebra FX 2.0+ / fx-9770G / CFX-9850G / CFX-9850GB+ / TI-89 / TI-nSpire

Posted 31 October 2007 - 03:09 AM

I think we should provide fast drawing that does not plot individual pixels, but instead copies the sprite directly to VRAM.
...
I was also thinking about some trickery using right/left shifts on the data, combined with the method I mentioned to be able to write to any x,y location, though that seems hard.

I was thinking of doing that also before I started writing the graphics functions, but I also found it hard. I tried searching for algorithms on the web but couldn't find any.

Also, the inline comments are thin. Do you want me to comment some?

Sure, go ahead.

Reduction from 144b/71i to 96b/46i with minimal loss of functionality. About 65% of original size. Of course, if you think it is important to keep strict bounds checking, add it ;). I think we should let dev's add this functionality in their code themselves if they really need it.

Yeah, I should probably remove the bounds checking. Thanks for doing a comparison between the different methods. I still wondering though on how to approach drawing the sprites byte-by-byte instead of bit-by-bit.

#20 Andreas B

Andreas B

    Casio Freak

  • Members
  • PipPipPipPip
  • 160 posts
  • Gender:Male
  • Location:Norway

  • Calculators:
    fx-9860G SD

Posted 31 October 2007 - 03:17 PM

Yeah, I should probably remove the bounds checking. Thanks for doing a comparison between the different methods. I still wondering though on how to approach drawing the sprites byte-by-byte instead of bit-by-bit.

No problem, feel free to use my snippet if it works ;)

Yes, making byte-writes work for any xy location is tricky.
One option is to limit the coordinates to coloumns and rows, where we have 16 coloumns and 64 rows. The user can then offset the bitmap data, increasing its size, in exchange for speed. There is certainly a use for this method.

#21 SebHoll

SebHoll

    Newbie

  • Members
  • Pip
  • 19 posts
  • Gender:Male

  • Calculators:
    FX-9860G

Posted 13 November 2007 - 09:32 AM

Hey everyone,

After having implemented greyscale support in my Casio Image Generatorprogram, I have noticed that at present, Revolution-FX only allows you to draw 8x8, 16x16 and 32x32 sprites to buffers. Is there a technical reason for this?

Cheers

#22 Andreas B

Andreas B

    Casio Freak

  • Members
  • PipPipPipPip
  • 160 posts
  • Gender:Male
  • Location:Norway

  • Calculators:
    fx-9860G SD

Posted 13 November 2007 - 08:04 PM

[...] Revolution-FX only allows you to draw 8x8, 16x16 and 32x32 sprites to buffers. Is there a technical reason for this?

Yes, - those bitmaps fit nicely in memory, and a specialized function is quicker than general sprite function that can be used for sprites of any size. We should have a more general one though.

Here's some code, not tested/compiled. It can write bytes in a column/row range of 0,0 to 16,64. It can be improved, like calculating the 'current row offset' inside the for-loop statement:
void DrawSprit(int column, int row, int sx, int sy, char *src, char *dest) {
	int i,j;
	char byte;
	for (j = 0; j < sy; j++) {	/* go through rows */
		for (i = 0; i < sx) { /* for each row */
			offset =
			(row*16)			/* base row offset */
			+ (j*16)			/* current row offset*/
			+ column			/* base column offset */
			+ i;			/* current row offset */

			/* implement xor, or, and or whatever here: */
			dest[offset] = src[offset];
		}
	}
}


#23 kucalc

kucalc

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1422 posts
  • Gender:Male
  • Location:USA
  • Interests:Programming: C/C++, Fortran, LISP, COBOL 85 Standard, PHP, x86 and SH3 Assembly

    Computer graphics

  • Calculators:
    fx-9860G / fx-7400G Plus / Algebra FX 2.0+ / fx-9770G / CFX-9850G / CFX-9850GB+ / TI-89 / TI-nSpire

Posted 23 November 2007 - 04:05 AM

Happy Thanksgiving! Version 0.3.2 of Revolution-FX has been released. It fixes a couple of problems that occur during compilation. It also features Andreas addition of the optimized PlotPixel function() (Thanks andreas! :D). The DrawSprites should be a bit faster. You can download it right here: http://revolution-fx.../downloads.html

#24 E_net4

E_net4

    Casio Freak

  • Members
  • PipPipPipPip
  • 189 posts
  • Gender:Male
  • Location:Output(&quot;Error: Coord type not specified&quot;);
  • Interests:Programming 'n' stuff...

  • Calculators:
    CASIO fx 9860G SD

Posted 23 November 2007 - 02:18 PM

Great!
By the way, I don't celebrate thanks giving here.

#25 Kapytanhook

Kapytanhook

    Newbie

  • Members
  • Pip
  • 25 posts

  • Calculators:
    fx-9860G

Posted 25 November 2008 - 04:24 PM

Loads of releases later i try join in on the fun, and i just cant get it to work fully,
so here is my problem, so you have the source code: Revolution-FX v0.3 Source Code (ZIP)
, the Latest binary release for renesas : Revolution-FX v0.3.2 (Win32 Installer) and Latest binary release for GCC: GCC Revolution-FX Complete - Pre-Initial Release (Win32 Installer).

How would i go about installing this?
and whats the thing with renesas and GCC, can someone please explain me the differnce between the 2?

#26 kucalc

kucalc

    Casio Maniac

  • [Legends]
  • PipPipPipPipPipPipPipPip
  • 1422 posts
  • Gender:Male
  • Location:USA
  • Interests:Programming: C/C++, Fortran, LISP, COBOL 85 Standard, PHP, x86 and SH3 Assembly

    Computer graphics

  • Calculators:
    fx-9860G / fx-7400G Plus / Algebra FX 2.0+ / fx-9770G / CFX-9850G / CFX-9850GB+ / TI-89 / TI-nSpire

Posted 25 November 2008 - 11:45 PM

Download the one for the Renesas. The fx-9860G SDK uses the Renesas toolchain.

After downloading it, just double click on it and let it install. When it gets to the part of where you want to install it, make sure it installs where your fx-9860G SDK is installed.

Offtopic: Is that a Magic: The Gathering card I see in your avatar? :lol:

#27 Kapytanhook

Kapytanhook

    Newbie

  • Members
  • Pip
  • 25 posts

  • Calculators:
    fx-9860G

Posted 26 November 2008 - 06:29 AM

Ty again (and no its a mix of alot of cards (mainly pokémon), to see the full size image go to the funny stuff thread).
http://www.casiocalc...amp;#entry46320




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users