CEMETECH
Leading The Way To The Future
Login [Register]
Username:
Password:
Autologin:

Don't have an account? Register now to chat, post, use our tools, and much more.
Latest Headlines
Online Users
There are 78 users online: 0 members, 49 guests and 29 bots.
Members: None.
Bots: VoilaBot (1), Spinn3r (2), MSN/Bing (2), Magpie Crawler (3), VoilaBot (5), Googlebot (15), MSN/Bing (1).
RSS & Social Media
SAX
You must log in to view the SAX chat widget
Author Message
zeldaking


Power User


Joined: 31 Jul 2011
Posts: 470
Location: Utah

Posted: 11 Jun 2012 04:08:08 pm    Post subject: Casio Prizm Development Tutorial

Section 1: Introduction

Preface:
In this section of the tutorial, you’ll learn where to find resources for learning computer C, as well as set up the Prizm SDK which will start you coding right away.

Resources:
First off you will need to have to know C, or C++. C is recommended since coding C++ for the Prizm is very splotchy. If you have no clue what C is we recommend visiting:
www.cprogramming.com
If you have any questions concerning code become a member here and post:
www.cemetech.net

Setting up the SDK and other Files
Now we are sure you have some coding experience you will need a source code editor, most preferably Notepad++. This allows you to code in the easiest way possible. Google or Bing search it and download.
Now Go to:
www.prizm.cemetech.net
Click on:
For Programmers: Prizm Programming Portal for SDKs, syscall references, and useful routines
Click on something that looks like this:
PrizmSDK: PrizmSDK v0.3
This will bring you to the cemetech website, you can download the .tar or the .zip file. I prefer the .zip because it is easier to extract.
.Zip file:
Find the folder where the Prizm SDK was downloaded (possibly in downloads). Right click and select extract all, this will leave you with the empty .zip file, and a normal folder. The folder has all of the files you will need. Right click again and select cut, navigate to your computer C:/ file (local disk C:/). Right click and paste. Now you have the SDK in the correct place.



Section 2: The Basics

Preface
In this section of the tutorial, you’ll learn the development of icons, become more comfortable with the SDK, and learn the layout of a C program coded for the Prizm.
Various tasks you’ll be able to complete at the end of reading this section include:

- Correct Icon development
- Correctly compile C programs using the SDK
- Identify the general layout of a C program coded for the Prizm

Icon Development:
Go here: (credits go to JosJuice)
http://cemetech.net/forum/viewtopic.php?t=6211&start=0


Hello World -- Familiarizing Yourself With the Compiling Process
Since you should have the SDK set up and have the correct files where need be (if not read Section 1) we can continue. Open up Notpad++ and copy this into it.

Code:
#include <keyboard_syscalls.h>
#include <keyboard.hpp>
#include <display_syscalls.h>
#include <color.h>
#define true 1
int main() {

PrintXY(1, 1, "XXHello World!", TEXT_MODE_NORMAL, TEXT_COLOR_BLACK);

int key;

while(true) {

GetKey(&key);

Bdisp_PutDisp_DD();

}

return 0;
}


Save this file as a C source file named, "Hello_World". Click into the Prizm SDK and navigate into the projects folder. Copy and paste another folder of the "example" folder. Rename one of them to "Hello_World". You will need to do this for each project, always copying the example folder (this folder holds the basic files needed for each project). Now you will need to find where the "Hello_World" C source file is saved and move it into the new "Hello_World" folder.


Note: make sure your project folder name does not have spaces in it, either in the folder name or in the makefile; using spaces will cause the build system to not recognize your project.


Select your source and copy it into the “src” folder. Assuming you have your two icons made, we can continue. Rename your icons, “selected” and “unselected”. Next right click on the “Makefile” (this is the file not the Batch), and select “Edit it with Notepad++”. Scroll down until you will see this:

Code:
TARGET  := $(notdir $(CURDIR))
Where it says “$(notdir $(CURDIR))” replace it with “Hello_World” (or whatever your project name is)
Now scroll down again until you see this:
MKG3AFLAGS := -n basic:example -i uns:../unselected.bmp -i sel:../selected.bmp

Where it says “basic:example” replace the “example” with “Hello World”, you will rename this to whatever you want your add-in to be named.
Now time for compiling, run the make.bat (the batch file) and a command prompt screen should appear and compile your code. After compiling the .g3a file will be in your project folder. Connect your Prizm and drag it into the main memory folder.

The General C Format for the Prizm
Because you are programming C for the Prizm, you need to follow this general format that stays consistent. To be consistent, the program will continue until you press [menu] which returns you to the main menu.

Code:
//Headers go here
//defines go here
define true 1   //declares true to equal 1
//global variable declarations go here
int main () {
    //local variable declarations go here

int key;

while(true) {

GetKey(&key);

//code goes here
    }
return 0;
}
//functions go here

Along with following this format, indent each block of code (Notepad++ does this for you). This increases readability and allows others to understand your code.


Last edited by zeldaking on 11 Jun 2012 04:29:56 pm; edited 1 time in total
Back to top
AHelper


LONG LIVE COMICTECH


Joined: 30 Jan 2011
Posts: 1662
Location: Aufhelperstan, Utopian Republic

Posted: 11 Jun 2012 04:16:13 pm    Post subject:

This should be moved/copied onto the Prizm wiki eventually. I started making tutorials, but I stopped, hoping someone else would make some :\
_________________
°ᴥ° Get Lucky

<BrandonW> "You don't even want to know what TI Connect does when it's just detecting your calculator...It ACTUALLY ERASES THE SWAP SECTOR on every communication attempt...EVERY SINGLE ATTEMPT...Yes, TI Connect will kill your calculator..What do I have to do to get your attention?!....Such a bloated protocol."
Back to top
zeldaking


Power User


Joined: 31 Jul 2011
Posts: 470
Location: Utah

Posted: 11 Jun 2012 04:38:45 pm    Post subject:

Why not help me continue with it? Since I sort of slacked of since Ashbad moved on. It would be motivating if I had some help.
Back to top
AHelper


LONG LIVE COMICTECH


Joined: 30 Jan 2011
Posts: 1662
Location: Aufhelperstan, Utopian Republic

Posted: 11 Jun 2012 04:42:58 pm    Post subject:

I am porting it to wikiprizm now.

Quote:
C is recommended since coding C++ for the Prizm is very splotchy.


I wouldn't say that it is bad. 3D checkers and my game engine both use C++ just fine. The checkers engine even has a full software floating point library in C++.

I will write up a separate article on using C++ on the prizm eventually.
_________________
°ᴥ° Get Lucky

<BrandonW> "You don't even want to know what TI Connect does when it's just detecting your calculator...It ACTUALLY ERASES THE SWAP SECTOR on every communication attempt...EVERY SINGLE ATTEMPT...Yes, TI Connect will kill your calculator..What do I have to do to get your attention?!....Such a bloated protocol."


Last edited by AHelper on 11 Jun 2012 05:12:48 pm; edited 2 times in total
Back to top
zeldaking


Power User


Joined: 31 Jul 2011
Posts: 470
Location: Utah

Posted: 11 Jun 2012 04:55:25 pm    Post subject:

Well I wouldn't say it is bad either Razz Just more support. Yeah C++ would be a good article.
Back to top
AHelper


LONG LIVE COMICTECH


Joined: 30 Jan 2011
Posts: 1662
Location: Aufhelperstan, Utopian Republic

Posted: 11 Jun 2012 05:12:05 pm    Post subject:

Added the pages. When you have changes, let me know what you change Smile

Your last code example has errors. I will fix them on the wiki.
_________________
°ᴥ° Get Lucky

<BrandonW> "You don't even want to know what TI Connect does when it's just detecting your calculator...It ACTUALLY ERASES THE SWAP SECTOR on every communication attempt...EVERY SINGLE ATTEMPT...Yes, TI Connect will kill your calculator..What do I have to do to get your attention?!....Such a bloated protocol."
Back to top
lirkaren


Newbie


Joined: 25 Jan 2012
Posts: 34
Location: Sweden

Posted: 12 Jun 2012 04:24:44 am    Post subject:

GCC is only for Linux if I got it right? I need to use "Code::Blocks with MinGW" sense im running Windows?

EDIT: I am using this "guide" http://www.cprogramming.com/code_blocks/ and it says that I can open "main.cpp" but all I got is "main.c" Is that okay to or am I doing something wrong?

Maby I should use my own thread for these questions sense this is a tutorial guide, if so mod can move my post. Smile
_________________
(=
Back to top
Eiyeron


Member


Joined: 12 Dec 2011
Posts: 158

Posted: 12 Jun 2012 05:10:33 am    Post subject:

Add the "std=c99" to get C99 specifications, like the for(int i=0;...) to the Makefile, at the "CFLAGS".
_________________
Back to top
KermMartian


Site Admin


Joined: 14 Mar 2005
Posts: 55773
Location: Earth, Sol, Milky Way

Posted: 12 Jun 2012 09:35:20 am    Post subject:

lirkaren wrote:
GCC is only for Linux if I got it right? I need to use "Code::Blocks with MinGW" sense im running Windows?

EDIT: I am using this "guide" http://www.cprogramming.com/code_blocks/ and it says that I can open "main.cpp" but all I got is "main.c" Is that okay to or am I doing something wrong?
main.cpp is for C++ programs; main.c is for C programs. GCC is not only for Linux; you can compile it for Windows.
_________________


Back to top
prizmos


Newbie


Joined: 16 Jul 2012
Posts: 13

Posted: 18 Jul 2012 03:07:23 pm    Post subject:

I followed the above instruction step by step. After compiling appears a Hello_World.bin file but no .g3a file in the project folder...
Back to top
prizmos


Newbie


Joined: 16 Jul 2012
Posts: 13

Posted: 18 Jul 2012 03:30:22 pm    Post subject:

Sorry it worked! Thanks! Finally a working example!
Back to top
KermMartian


Site Admin


Joined: 14 Mar 2005
Posts: 55773
Location: Earth, Sol, Milky Way

Posted: 18 Jul 2012 03:37:46 pm    Post subject:

prizmos wrote:
Sorry it worked! Thanks! Finally a working example!
What was wrong that you fixed between your two posts? Feel free to keep the questions coming.
_________________


Back to top
prizmos


Newbie


Joined: 16 Jul 2012
Posts: 13

Posted: 18 Jul 2012 03:40:27 pm    Post subject:

my mistake...I have originally replaced “basic:example” with “Hello World”...
Back to top
KermMartian


Site Admin


Joined: 14 Mar 2005
Posts: 55773
Location: Earth, Sol, Milky Way

Posted: 18 Jul 2012 03:41:44 pm    Post subject:

prizmos wrote:
my mistake...I have originally replaced “basic:example” with “Hello World”...
Ah, and that didn't work anymore. It should have at least spit out an error message of some sort for you, no?
_________________


Back to top
prizmos


Newbie


Joined: 16 Jul 2012
Posts: 13

Posted: 18 Jul 2012 03:45:51 pm    Post subject:

Maybe it has...I closed the cmd window immediately so I didn't notice. But 3 files were created: 2 in folder build and the .bin file in the project folder.
Back to top
KermMartian


Site Admin


Joined: 14 Mar 2005
Posts: 55773
Location: Earth, Sol, Milky Way

Posted: 18 Jul 2012 07:43:58 pm    Post subject:

prizmos wrote:
Maybe it has...I closed the cmd window immediately so I didn't notice. But 3 files were created: 2 in folder build and the .bin file in the project folder.
Oh, you're running under Windows? I recommend that your script that launches make actually contain:
Code:
make
pause

_________________


Back to top
AHelper


LONG LIVE COMICTECH


Joined: 30 Jan 2011
Posts: 1662
Location: Aufhelperstan, Utopian Republic

Posted: 30 Jul 2012 10:29:22 pm    Post subject:

Bump. Any more tutorials? I am working on a bunch right now in my own section. Just wondering if any more are planned.
_________________
°ᴥ° Get Lucky

<BrandonW> "You don't even want to know what TI Connect does when it's just detecting your calculator...It ACTUALLY ERASES THE SWAP SECTOR on every communication attempt...EVERY SINGLE ATTEMPT...Yes, TI Connect will kill your calculator..What do I have to do to get your attention?!....Such a bloated protocol."
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are GMT - 5 Hours

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© Copyright 2000-2013 Cemetech & Kerm Martian :: Page Execution Time: 0.035420 seconds.