Author Topic: [TIGCC] 68k C  (Read 28531 times)

0 Members and 2 Guests are viewing this topic.

Liazon

  • Guest
[TIGCC] 68k C
« on: December 17, 2005, 12:40:00 pm »
Can somebody please help me learn and understand how to make 68k games in C using TIGCC?

My only experience in programming is a little bit of Ti83+ Basic, a little Ti86 Basic, very very little Ti89 Basic, and a little Ti83+ASM.  I have never made an average graphics game in my life except for a small 83+ASM game where you chase a moving sprite.  I'd like to learn enough C so I can make a 68k RPG.

Thanks in advace for any help!

tenniskid493

  • Guest
[TIGCC] 68k C
« Reply #1 on: December 17, 2005, 02:18:00 pm »
Check tifreak8x's asm/C resource page.  It has a lot of good tutorials.  http://tifreakware.calcgames.org/asmresc.htm

Offline Ranman

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1354
  • Rating: +83/-0
    • View Profile
[TIGCC] 68k C
« Reply #2 on: December 17, 2005, 02:58:00 pm »
I can help out... but I don't know where to begin.

I would say try reading some of the tutorials at tifreak's forum to see what and how they work. This will surely bring some questions to mind. :)smile.gif
Ranman
Bringing Randy Glover's Jumpman to the TI-89 calculator. Download available at Ticalc.

Liazon

  • Guest
[TIGCC] 68k C
« Reply #3 on: December 17, 2005, 03:28:00 pm »
Well, it's more like I've got issues with understanding structures.

Like in ASM, you can do almost anything you want, which is why it takes forever to build stuff for it sometimes.  And on occasion, if you're bad at it like me, you can actually write a slow game with it.

In Basic, the structure is a little more complex.  Loops, lbls, etc.  There's still a lot more freedom of structure.

NOW C, I just don't get functions in general.  Besides, the main() function, I just don't get how all the other ones interact with it.  It just seems to me really complex.  I can input many things, but I can only output one?  What's the deal?

The other issue I have with structure is just basic game concepts like collision/hit detection, gravity/jumping/falling objects.  Even platforms I have an issue with.

Well I'm glad I can at least make a sprite move in ASM (and chase a weird looking 8x8 Turkey!) and make another sprite jump.  But so far, all my attempts to port those simple concepts into C have failed.  

I tried to write a program that just simply moved a sprite left and right on the bottom of the screen using dequequeing, but it just zooms to all the way to one direction even if you just tap it.  I just set the sprite to move once during every key press.

Offline Ranman

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1354
  • Rating: +83/-0
    • View Profile
[TIGCC] 68k C
« Reply #4 on: December 17, 2005, 04:11:00 pm »
QUOTE
Well, it's more like I've got issues with understanding structures.

Are you talking about data structures or program/functions structure?

QuoteBegin
-->
QUOTE
In Basic, the structure is a little more complex.
Ranman
Bringing Randy Glover's Jumpman to the TI-89 calculator. Download available at Ticalc.

Liazon

  • Guest
[TIGCC] 68k C
« Reply #5 on: December 18, 2005, 02:15:00 pm »
So I should think of C functions as calls, except I have to pass all the pointers for all the data I want to change using the function.  Can I write a function that checks the state of something and then return 0 if false, 1 if true?

So
if (myfunction(&x,&y,&z)=0){
}

But that would probably be really ineffcient right?  How many functions are there in a good 68k C game?  How many of them are inline.  Can you use inline with code like the above?

Offline Ranman

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1354
  • Rating: +83/-0
    • View Profile
[TIGCC] 68k C
« Reply #6 on: December 18, 2005, 04:29:00 pm »
QUOTE
So I should think of C functions as calls,

Yes.

QuoteBegin
-->
QUOTE
except I have to pass all the pointers for all the data I want to change using the function.

Yes. If you want the function to actually modify the data. This is called "passing by reference". If you just want the function to use the data, you can pass in the actual value. This is called "passing by value".

QuoteBegin
-->
QUOTE
Can I write a function that checks the state of something and then return 0 if false, 1 if true?

So
if (myfunction(&x,&y,&z)=0){
}

Yes... See, you are getting the hang of it!

QuoteBegin
-->
QUOTE
But that would probably be really ineffcient right?
Ranman
Bringing Randy Glover's Jumpman to the TI-89 calculator. Download available at Ticalc.

Liazon

  • Guest
[TIGCC] 68k C
« Reply #7 on: December 20, 2005, 12:07:00 pm »
By the way, how do you tile map the Ti-89Ti's 100x160 pixel screen?

What are the dimensions (#rows,#columns) of your tiles?  What are the dimensions of the sprites?

At first I was thinking of using 10x16 tiles and 20x16 tiles, but I'm not sure if that'd work.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
[TIGCC] 68k C
« Reply #8 on: December 20, 2005, 01:28:00 pm »
arent tiles clipped in 68k C so you can use 16x16 ones even if they dont fit the screen? Because I saw games liek Zelda using 16x16 sprites with no problem on the 160x100 screen

Liazon

  • Guest
[TIGCC] 68k C
« Reply #9 on: December 20, 2005, 01:44:00 pm »
I thought you had to combine the routines with bit manipulations to get clipped sprites.

Offline Ranman

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1354
  • Rating: +83/-0
    • View Profile
[TIGCC] 68k C
« Reply #10 on: December 20, 2005, 02:03:00 pm »
QuoteBegin-calcul831415+20 December 2005, 18:07-->
QUOTE (calcul831415 @ 20 December 2005, 18:07)
By the way, how do you tile map the Ti-89Ti's 100x160 pixel screen?

What are the dimensions (#rows,#columns) of your tiles?
Ranman
Bringing Randy Glover's Jumpman to the TI-89 calculator. Download available at Ticalc.

Liazon

  • Guest
[TIGCC] 68k C
« Reply #11 on: December 20, 2005, 03:46:00 pm »
Wait, how'd you get an 11x11 sprite routine?  Did you make your own?  Perhaps I should just stick with 10/20x16 for now.

Looks like I'm going to have to get good at monochrome pixel art.  Unless there is a specific easy to use greyscale library you recommend.  At most I'd probably just use black grey, and white.  4-level greyscale would already be more than what I need.   :thumb:google.gif

edit:  Oh, and considering how the 83+ had an 8k limit on ASM executables, what is the limit for the 89, if there is any?  And my friend who programs in C++ says that in C, you can access data outside the program, meaning I can have external data files.  Is this true for 68k C?

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
[TIGCC] 68k C
« Reply #12 on: December 20, 2005, 04:00:00 pm »
I heard each files cant be more than 64kb on the calc, but I'm not sure about that

Offline Ranman

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1354
  • Rating: +83/-0
    • View Profile
[TIGCC] 68k C
« Reply #13 on: December 20, 2005, 04:33:00 pm »
QuoteBegin-calcul831415+20 December 2005, 21:46-->
QUOTE (calcul831415 @ 20 December 2005, 21:46)
Wait, how'd you get an 11x11 sprite routine?
Ranman
Bringing Randy Glover's Jumpman to the TI-89 calculator. Download available at Ticalc.

Liazon

  • Guest
[TIGCC] 68k C
« Reply #14 on: December 20, 2005, 04:55:00 pm »
QuoteBegin-Ranman+20 December 2005, 22:33-->
QUOTE (Ranman @ 20 December 2005, 22:33)





QuoteBegin
-->
QUOTE
For the 68k calcs... 64Kb is the max file size (including the file header and footer. This limit is imposed by the TI operating system... not TIGCC.

For the 68k calcs... AMS verions 1.xx and 3.xx can execute any file up to 64Kb. AMS 2.xx calcs are limited are limited to 24Kb (I think the first version of AMS 2.xx limited it to 8Kb).


But didn't AMS give you more freedom with the LCD buffers?

QuoteBegin
-->
QUOTE
Actual sprite width must be a multiple of 8 bits. So, if a sprite "viewable" width is not a multiple of 8 bits, you must round up to the next full 8 bits. My Ultima V tiles are 11x11 "viewable" but in reality there are 16x11 pixels. The 5 rightmost bits are not used. Does that make sense?


Let me guess... You mask the 5 unused bits.

QuoteBegin
-->
QUOTE
I use the GraySprite16_RPLC() functions from extgraph library. I am actually drawing a full 16x11 tile. But, when I draw the next tile, I draw over the 5 unused pixels of the previous tile. With the extgraph library, you can draw a sprite at any x,y position..

Use the extgraph library for grayscale... It even has double buffering.


This will be supported by AMS 3.xx plue HW3 patch, right?  Will I find this on ticalc.org, TIGCC website, or the Ti Chess team website?