Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
21 May, 2013, 19:44:42 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: 1 2 3 [4] 5   Go Down
  Print  
Author Topic: [TIGCC] 68k C -  (Read 1735 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
saubue
Guest
« Reply #45 on: 23 January, 2006, 05:56:00 »
0

QuoteBegin-Liazon+20 January 2006, 18:45-->
QUOTE (Liazon @ 20 January 2006, 18:45)
How do you know when you need to optimize your C code?  

 Hm.. I try to comment my code as clear as possible, so when I read through my code and find pages of uncommented functions, I think it's time to read through it again and to structure and comment it.

It's hard to define what BAD code is; I would say it's uncommented, unstructured (no tab indents, no blank lines). Avoiding memory-management with malloc() is also bad.
I like (so I think it's good code) making typedefs and structs, so that variables tell you what they do.  
Logged
arti
Guest
« Reply #46 on: 23 January, 2006, 08:44:00 »
0

My C code!
Logged
Liazon
Guest
« Reply #47 on: 23 January, 2006, 14:12:00 »
0

QuoteBegin-saubue+23 January 2006, 4:56-->
QUOTE (saubue @ 23 January 2006, 4:56)
It's hard to define what BAD code is; I would say it's uncommented, unstructured (no tab indents, no blank lines). Avoiding memory-management with malloc() is also bad.
I like (so I think it's good code) making typedefs and structs, so that variables tell you what they do.  

Wow I don't even know what those are.  But malloc() I still quite don't get.  What is it really? and why do you need it?

Based on my previous ASM experience, all I know is that every label you make, ever command you type, all takes up bytes in memory.  The label is a manifest constant of the actual location/address of that data.  It just makes it easier to reference the part of the program.  Otherwise you can define areas of saferam to hold data until the program is done executing.  Does this have anything to do with malloc()?

It's quite obvious that I have a lot more reading to go through.  Perhaps I should take a break from z80 for awhile and put more focus on understanding C.  I think this is a good idea considering how I need to figure out how to access an external data file, pass on sprite data to a sprite data buffer, and lots of other things for DEM.  After pondering the pseudo-code for DEM's battle engine, I'm starting to wonder how I can optimize it, considering so far it seems really huge in my head, and it has lots and lots of animations.
Logged
MathStuf
Guest
« Reply #48 on: 23 January, 2006, 19:09:00 »
0

Malloc is way to reserve RAM for a variable instead of reserving it inside the program itself.

Labels are, in general, bad. There is always a way around using labels.

If you need any help with file manipulation, just catch me on IRC and I can walk you through it there on what you need.
Logged
Liazon
Guest
« Reply #49 on: 23 January, 2006, 19:21:00 »
0

What channel?

oh so malloc() is the z80 equivalent of #define variable = saferam+1

edit: oh nvm omnimaga channel.
Logged
Liazon
Guest
« Reply #50 on: 26 January, 2006, 17:01:00 »
0

c1-->
CODE
ec1void GraySprite16_MASK(short x,short y,short h,unsigned short* sprite1,unsigned short* sprite2,unsigned short* mask1,unsigned short* mask2,void* dest1,void* dest2) __attribute__((__stkparm__));c2
ec2

c1
-->
CODE
ec1void GraySprite16_MASK_R(register short x asm("%d0"),register short y asm("%d1"),register short h asm("%d2"),unsigned short *sprt0,unsigned short *sprt1,unsigned short *mask0,unsigned short *mask1,register void *dest0 asm("%a0"),register void *dest1 asm("%a1")) __attribute__((__stkparm__));c2
ec2

What's the difference?  the second one just looks to me like the first one plus more complicated inputs?

btw, is MASK faster or BLIT?

edit: the reason why I can't test this out myself at the moment is that I forgot I don't have an emulator anymore, and I can't seem to get TiEmu to work.  I installed th GTK and then TiEmu, but when I ran TiEmu, it came out with a message saying that some dlls were missing.
Logged
Ranman
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Last Login: 23 April, 2013, 23:37:04
Date Registered: 16 October, 2008, 23:25:59
Posts: 1390


Total Post Ratings: +78

View Profile
« Reply #51 on: 26 January, 2006, 17:06:00 »
0

QuoteBegin-Liazon+26 January 2006, 16:01-->
QUOTE (Liazon @ 26 January 2006, 16:01)
What's the difference?  the second one just looks to me like the first one plus more complicated inputs?

btw, is MASK faster or BLIT?  

 The "_R" functions are a tad faster. The arguments get passed directly into registers. The others are put on the stack then copied into registers.

Not sure about BLIT... I've never used it.
Logged

Ranman
Bringing Randy Glover's Jumpman to the TI-89 calculator.  Download available here.
Liazon
Guest
« Reply #52 on: 26 January, 2006, 17:07:00 »
0

Can the _R ones be used interchangeably? or can I only input values of the "register short type?"  hehe, must be the register part that is confusing me.
Logged
Ranman
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Last Login: 23 April, 2013, 23:37:04
Date Registered: 16 October, 2008, 23:25:59
Posts: 1390


Total Post Ratings: +78

View Profile
« Reply #53 on: 26 January, 2006, 19:27:00 »
0

QuoteBegin-Liazon+26 January 2006, 16:07-->
QUOTE (Liazon @ 26 January 2006, 16:07)
Can the _R ones be used interchangeably? or can I only input values of the "register short type?"  hehe, must be the register part that is confusing me.  

 Yes, they can be used interchangeably.

Don't worry too much about the 'register' keyword. It is basically a compiler implementation modifier that says "if a register is available, then use it". If a register is not available, then the compiler will choose what to do. Putting values directly into registers is just a bit faster. In your Extgraph API call above, it expressly states to put parameters you pass into registers D0, D1, and D2.  
Logged

Ranman
Bringing Randy Glover's Jumpman to the TI-89 calculator.  Download available here.
Liazon
Guest
« Reply #54 on: 04 February, 2006, 22:17:00 »
0

What are all the data compression options for 68k?  Like, how do you fit so much stuff (sprites, maps, etc.) into a game?

In fact, I don't even know how you do that on an 83+.  I don't even understand what a group file is!

edit: oh ya, what's ppg?

edit (again): oh ya, please forgive my ignorance :bow:worship.gif:bow:worship.gif
Logged
saubue
Guest
« Reply #55 on: 05 February, 2006, 01:42:00 »
0

Normally, you can all store your data in your program. If the program gets too large (> 64kB), there are different ways to make it still possible to make larger:

- You can ExePack your program after it has been compiled by TIGCC. The compression ratio is very good. TIGCC then creates a launcher (an ASM Program that is about 1kB small) and a .ppg-file that contains the compressed program.

- You can store data (like sprites, maps, strings etc.) in external files. These can be created in multiple ways, although it's common to create them with ttarchive (a program that is part of the TIGCC Tools Suite). ttarchive also offers the possibility to compress the data.
This way, you can load the data from the files just when they are needed.

- You can make a DLL-file that contains executable code (e.g. the FAT-Engine. CalcRogue uses this, too).

Hm... that's all I can think of right now (sun begins to rise, so I think I should go to sleep Winkwink.gif )
Logged
Liazon
Guest
« Reply #56 on: 05 February, 2006, 12:50:00 »
0

Why can't I find the TIGCC Tools suite on the TICT website?

Thanks saubue.  Is the dll file the same as creating a .a file?  I'm guessing I need to read the readmes to learn how to access data in ttarchives and ppg files and dll files.
Logged
Ranman
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Last Login: 23 April, 2013, 23:37:04
Date Registered: 16 October, 2008, 23:25:59
Posts: 1390


Total Post Ratings: +78

View Profile
« Reply #57 on: 05 February, 2006, 14:07:00 »
0

QuoteBegin-Liazon+5 February 2006, 11:5-->
QUOTE (Liazon @ 5 February 2006, 11:50)
Why can't I find the TIGCC Tools suite on the TICT website?

Here are some good links for you:

http://tict.ticalc.org/
http://www.ticalc.org/archives/files/fileinfo/161/16198.html
http://tigcc.ticalc.org/

QuoteBegin-Liazon+5 February 2006, 11:50
-->
QUOTE (Liazon @ 5 February 2006, 11:50)
Thanks saubue.
Logged

Ranman
Bringing Randy Glover's Jumpman to the TI-89 calculator.  Download available here.
Liazon
Guest
« Reply #58 on: 05 February, 2006, 14:14:00 »
0

I'm sorry, forgive my ignorance.  :bow:worship.gif

so TIGCC creates the dll?

argh!!! I'll figure this out eventually, somehow, on my own, I duno what I'm doing, wutever
Logged
Ranman
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Last Login: 23 April, 2013, 23:37:04
Date Registered: 16 October, 2008, 23:25:59
Posts: 1390


Total Post Ratings: +78

View Profile
« Reply #59 on: 05 February, 2006, 14:27:00 »
0

QuoteBegin-Liazon+5 February 2006, 13:14-->
QUOTE (Liazon @ 5 February 2006, 13:14)
I'm sorry, forgive my ignorance.  :bow:worship.gif

so TIGCC creates the dll?  

 Don't worry about it...

TIGCC can create '.a' and '.dll' files. I haven't messed with DLL files much so I wont be much help. But, you only need them if you think your main program is going to be larger than 64Kb. If it is not... don't worry about a DLL.

Ultima V may need a DLL file. So, I may have to look into this for myself. If you still want more details, I'll be glad to check this out and provide more in-depth details.
Logged

Ranman
Bringing Randy Glover's Jumpman to the TI-89 calculator.  Download available here.
Pages: 1 2 3 [4] 5   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.275 seconds with 30 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.