Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-8081-

[GBDK] GAMEBOY [C]

Name: !MILKRIBS4k 2009-06-16 17:13

Anyone on here use the gameboy c compiler gbdk? http://gbdk.sourceforge.net/ There doesn't seem to be much documentation on it! Most of the code I find on google is designed for an older version of the compiler! How would I go about displaying a simple sprite! Someone help MILKRIBS4k!

Name: Anonymous 2009-06-16 17:42

This is open-source: write the documentation instead of bitching about the lack of it.

Name: Anonymous 2009-06-16 17:45

just buy a gameboy advance for $10 and use gcc.

Name: !MILKRIBS4k 2009-06-16 17:47

>>3
But 8-bit consoles are cooler!
>>2
I am not smart enough! I only have a limited knowledge of C!

Name: Anonymous 2009-06-16 17:47

>>1
28th Feburary, 2001
It seems dead, dead projects make me want to cry. :(

Name: Anonymous 2009-06-16 17:48

MILKRIBS4k? Programming? last news 2001? ITIHBT

Name: !MILKRIBS4k 2009-06-16 17:51

>>5
No one likes gameboy! :(

Name: Anonymous 2009-06-16 17:52

>>1
Aren't you an anus? Or, even worse, FV?

Name: !MILKRIBS4k 2009-06-16 17:53

>>8
I can insure you I am no anus, now help me display sprites!

Name: Anonymous 2009-06-16 17:57

>>9
Show me the code.

Name: !MILKRIBS4k 2009-06-16 18:01

>>10
Well it is standard ANSI/ISO C! I compiled a little text adventure! But I have no idea how to use the graphic librarys!

Name: Anonymous 2009-06-16 18:03

>>4
But 8-bit consoles are cooler!
only if you use assembly.

Name: Anonymous 2009-06-16 18:06

>>11
Show me the code.

Name: !MILKRIBS4k 2009-06-16 18:12

>>12
Assembly a little to complicated for me!
>>13
I don't know what code you want? Here is an example that comes with it, which I don't really get! I just want to know how to display a sprite! http://pastebin.com/m10dd649

Name: Anonymous 2009-06-16 18:42

>>1,4,7,9,11,14
Back to /lounge/, MILKRIBS

Name: !MILKRIBS4k 2009-06-16 19:04

>>15
/lounge/ can't help me with my question though!

Name: Anonymous 2009-06-16 19:52

>>16
Back to /lounge/, MILKRIBS

Name: !MILKRIBS4k 2009-06-16 19:56

>>17
NO THANK YOU

Name: Anonymous 2009-06-17 6:33

Please help the anus!

Name: !MILKRIBS4k 2009-06-17 8:50

>>19
I can insure you I am no anus!

Name: Anonymous 2009-06-17 8:55

Back to /lounge/, MILKRIBS.

Name: Anonymous 2009-06-17 9:02

>>14
Why the hell are you using 16 bit colour maps? Seriously what the hell... When I code even for the NDS I use at maximum 8 bit.

Displaying a sprite on the GBC/GB...
set_sprite_palette(sprite,n,&spritemap);
SPRITES_8x8;
set_sprite_data(sprite, n, tiledata);
set_sprite_tile(sprite,tile);
set_sprite_prop(sprite,prop);
move_sprite(sprite,x,y);
SHOW_SPRITES;   
Enjoy.

Name: !MILKRIBS4k 2009-06-17 9:07

>>22
Thanks this information will come in useful!

Name: !MILKRIBS4k 2009-06-17 9:14

saging this fucking thread

Name: Anonymous 2009-06-17 12:01

>>24
Not an anus ( ≖‿≖)

Name: Anonymous 2009-06-17 12:07

MILKRIBS, it seems that C is your first codan (no offence), so here are some beginner tips!

1. Use fprintf (``fast printf'') instead of printf.
2. ++i is faster than both i++ and i = i + 1. I won't get into detail why, because it goes down to ASM.
3. void main(void) is faster than int main(void) or int main(int, char **) since no value needs to be returned to the OS. It's also safer (no errors) and more portable.
4. Swapping with exclusive-or (a^=b^=a^=b swaps a and b) is faster than using a temporary. This works for all types (including structures), but not on all compilers. Some compilers may also give you a harmless warning.
5.Avoid indentation, the whitespace makes the program bigger. It also makes it slower, because the compiler has to remove all whitespace anyway before parsing.
6. Static storage duration objects are faster than automatic storage duration objects because the CPU doesn't have to set aside storage on the stack every time a function is called. Make your loop indexes global so that you can use them everywhere:
    int i;
    void func(void) { for (i = 0; i < 10; i++) ; /* ... */ }
    void func2(void) { for (i = 0; i < 20; i++) ; /* ... */ }
    /* ... */

7. Compilers often give more memory to arrays than you asked for. Here's how to check how big an array actually is (memset returns a null pointer if the size you passed to it is bigger than the size of the array you passed to it):
    int arr[256];
    size_t realsize;
    for (realsize = 0; realsize <= SIZE_MAX; ++realsize)
            if (!memset(arr, 0, realsize)) break;
    /* now you know that arr actually has realsize / sizeof (int) elements */

If you combine this with #6, your program will be faster in the long run (but this usually doesn't work for short programs).

Name: Anonymous 2009-06-17 12:25

I fucking lol'd at 6

Name: !MILKRIBS4k 2009-06-17 12:26

>>24
NOT ME!
>>25
NO ONLINE IS AN ANUS!
>>26
This will come in useful!

Name: !MILKRIBS4k 2009-06-17 12:28

>>26
Wait a minute, a lot of this is wrong! Nice try DOCTOR FAIL!

Name: Anonymous 2009-06-17 12:31

>>29
How about *YOU* are full of bullshit? Even thought of that? This is taken straight from K&R, which, in case you don't know, is a de facto standard of C.

Name: Anonymous 2009-06-17 12:33

Okay, maybe point 1 seems dubious, so I gotta clarify; just use a pointer to stdout where you would use a pointer to the file.

Name: (≖‿≖) 2009-06-17 12:33

>>26
( ≖‿≖)

Name: !MILKRIBS4k 2009-06-17 12:48

>>30
I can insure you I am no anus! I am MILKRIBS4k, I will not fall for your trolling DOCTOR FAIL! Now back to /b/, plz

Name: Anonymous 2009-06-17 13:14

>>33
Where did I claim that you are an anus? That's retarded.
Also read K&R before you try to do *anything* with C. It's the most natural thing to do. I've given you the most useful excerpts from the book, but no, you must enter with your bullshit and claim that you're smarter than Dennis Motherfucking Ritchie. Good luck in programming with that attitude, faggot, at least have some humility, because there are people smarter than you out there. Like, you know, the dude that designed the fucking language you use. Go on, try to logically show that *any* of these points is wrong, I'll be more than happy to disprove whatever nonsensical bullshit you utter.
Finally, I have not been in /b/ for two years, but seeing your attitude, I guess it's a place more suitable for you rather than me to go to. You go back to /b/, please, and come back when you've learned your place. And learned to fucking type, because ``plz'' is not a word in any language known to man.

Name: Anonymous 2009-06-17 13:16

Also, I have admitted, in >>31​, that one point might seem dubious for novice C programmers, but it's a common practice in real world, but hey, you know better.

Name: Anonymous 2009-06-17 13:17

>>34
!Milkribs4k status: TOLD

Name: Anonymous 2009-06-17 13:19

ALSO, the word you're looking for is ``assure'', not ``insure''.

http://www.wsu.edu/~brians/errors/assure.html

Name: Anonymous 2009-06-17 13:25

>>37
ensure

Name: Anonymous 2009-06-17 13:30

>>38
Whoops, sorry, you're obviously correct, I was blinded with anger.

Name: !MILKRIBS4k 2009-06-17 13:44

>>34
Give me a reference(link) to back up what you are saying and I will believe you! Stuff like 5. makes no sense! Also I haven't been to /b/ in over 3 years so please step down!
>>36
NO THANK YOU
>>37
I know what I am saying!

Name: Anonymous 2009-06-17 13:59

>>40
Stuff like 5. makes no sense!
Let's just look at an example;

[~] echo 'I can ensure you I an no anus!' > milkribs1
[~] echo 'I can ensure you I an no anus!                 ' > milkribs2
[~] du -b milkribs1 milkribs2
31      milkribs1
48      milkribs2

Oh no, the second file, with superfluous whitespace, is bigger! By 17 bytes, which looks like the number of added trailing spaces.
Now let's look at some actual code.


[~] cat milk
{
  int i, j;

  for(i = 0; i < BOARD_ROW; i++)
    for(j = 0; j < BOARD_COL; j++)
    {
      move(i, j);
      addch(board[i][j]);
    }
  move(row, col);
}
[~] cat milk | sed -s 's/ //g' > milk2
[~] cat milk2
{
inti,j;

for(i=0;i<BOARD_ROW;i++)
for(j=0;j<BOARD_COL;j++)
{
move(i,j);
addch(board[i][j]);
}
move(row,col);
}
[~] du -b milk milk2
159     milk
113     milk2
[~]


Did I just make the file ~75% of its original size?

Also, about the speed; the compiler has to strip down the input file to pure code. Whitespace is not pure code, it is discarded before compiling the file. There is no whitespace in pure C. And the more whitespace there is, the longer will the discarding take. Granted, it won't make a difference in a 100-LOC file, but when you're writing a big project, it matters. It's about 20 seconds additional compile time for a 5-kLOC program (here, you just have to believe me, because I no longer have the source file; I don't keep four-year old stuff on my machine. But it makes sense, doesn't it?)

Seriously, are you trolling me?

Name: Anonymous 2009-06-17 14:01

Again, whoops, there has to be some whitespace, namely between type and declared variables. So that's one more byte in the stripped code. But the point still stands.
>>40
Read K&K, it's all explained there.

Name: Anonymous 2009-06-17 14:06

>>42
FUCK I meant K&R. Obviously.

Name: !MILKRIBS4k 2009-06-17 14:18

>>41
OK I see what you are saying here!
>>43
What the fuck is K&R, link perhaps!

Name: Anonymous 2009-06-17 14:18

I have to admit I find MILKRIBS midly entertaining, not just a stupid idiot like FV.
Also >>41
[~] cat milk
I kind of giggled.

Name: Anonymous 2009-06-17 14:19

>>41
Seriously, are you trolling me?
You couldn't tell?

Name: !MILKRIBS4k 2009-06-17 14:22

>>46
I am not a troll! I am just new to programing! I am not that informed on a lot of topics! GIVE ME TIME

Name: Anonymous 2009-06-17 14:32

>>41
See, it wasn't that hard. Take your time, don't act like you know everything, and it will be easy to be a good programmer.
                                              ***
K&R is an *excellent* book on the C language; the best perhaps, maybe inferior only to the SICP;

http://en.wikipedia.org/wiki/The_C_Programming_Language_(book)

Name: Anonymous 2009-06-17 15:00

Name: Anonymous 2009-06-17 15:52

Jesus christ.. Print out a copy of the Yoshi docs and program in assembler, that will be a lot easier than dicking around with an obsolete unsupported environment.

Name: !MILKRIBS4k 2009-06-17 16:00

>>50
Link to Yoshi docs please!
>>49
back to /b/, plz

Name: Anonymous 2009-06-17 16:31

>>51
Seems I misremembered the name, it's the Pan docs you want. Ordinarily I'd just tell you to fucking Google them yourself, but as you're too fucking stupid to even manage something so simple I'll just give a link directly:
http://nocash.emubase.de/pandocs.txt

Name: !MILKRIBS4k 2009-06-17 16:40

>>52
I did google Yoshi docs but noting relevant came up!

Name: Anonymous 2009-06-17 20:25

>>53
Can you please stop using exclamation marks all the time? :(

Name: !MILKRIBS4k 2009-06-17 20:31

>>54
NO! I already went over why on /lounge/!

Name: Anonymous 2009-06-17 20:45

>>55
[citation needed] or you're an anus!

Name: !MILKRIBS4k 2009-06-17 21:09

>>56
I don't know what thread it was now! You do the research!

Name: Anonymous 2009-06-17 21:27

Someone needs to write a greasemonkey script to change the exclamation marks in the milkribs post into full stops.

Name: Anonymous 2009-06-17 21:49

>>41
This is honestly the most stupid thing I've seen in my entire life. Please tell me you're just trolling milkribs here.

Name: Anonymous 2009-06-17 22:25

>>58
They're called periods, you anus.

>>1,4,7,9,11,14,16,18,20,23,28-29,33,40,44,47,51,53,55,57
Back to /lounge/, MILKRIBS,you anus.

Name: Anonymous 2009-06-17 22:34

>>55
So a ran a /lounge/ scrape query...
I can't! I am just always so pumped![1]
That's your grand explanation? Just stop being such an idiot and type like a normal person.

1. http://dis.4chan.org/read/lounge/1245089309/24

Name: Anonymous 2009-06-17 23:13

>>59
What's wrong? It makes perfect sense to me.

Name: Anonymous 2009-06-18 0:42

>>62
It makes perfect sense because IT'S OBVIOUS THAT MORE CHARACTERS WILL EQUAL MORE ROOM BUT IT'S NOT A REASON NOT TO INDENT.

Who gives a shit about a .c/.h that takes 60kb instead of 50? Especially at the cost of readability. If it affected the performance once it's compiled, I would maybe agree (actually no, I wouldn't anyway) but this is just fucking stupid.

Name: Anonymous 2009-06-18 1:05

>>63
s/MORE ROOM/MORE SPACE TAKEN/

or something like that.

Name: Anonymous 2009-06-18 1:39

>>63
Please play along.

Name: Anonymous 2009-06-18 1:40

MILKRIBS are you there? I gotta talk to you about something important.

Name: Anonymous 2009-06-18 1:42

(  ≖‿≖) けいかくどおり

Name: Anonymous 2009-06-18 2:10

>>34
I've argued against a number of these in the past.
To make this quick,
4. Swapping with exclusive-or (a^=b^=a^=b swaps a and b) is faster than using a temporary. This works for all types (including structures), but not on all compilers. Some compilers may also give you a harmless warning.
Reasons for avoidance in practice
Most modern compilers can optimize away the temporary variable in the naive swap, in which case the naive swap uses the same amount of memory and the same number of registers as the XOR swap and is at least as fast, and often faster. As a general rule, you should never use the XOR swap unless you know for a fact that the naive swap will not suit your application (which is very rare in this day and age). The XOR swap is also much less readable, and can be completely opaque to anyone who isn't already familiar with the technique.1
__________________
1. http://en.wikipedia.org/wiki/XOR_swap_algorithm#Reasons_for_avoidance_in_practice

Name: Anonymous 2009-06-18 3:17

>>68
YHBT

that list is compiled by an idiot on some site

Name: Anonymous 2009-06-18 5:49

>>68

that's right >>69-san. pp macroes can make hacks like this readable without a performance hit

Name: Anonymous 2009-06-18 5:57

>>69
I searched for the source but the only thing that came up was /prog/. Was this, the site you referred to?

Name: Anonymous 2009-06-18 6:10

>>71
0/10

Name: Anonymous 2009-06-18 6:22

>>68
Ha ha.  Do YOU, Anonymous@Sage, think your smarter than Brian Kernighan??  Why don't you pipe down and leave theory tot he professionals.

Name: Anonymous 2009-06-18 6:23

>>30
>How about *YOU* are full of bullshit?
It's juhannus now, Linus, just grab a beer and chill.

Name: Anonymous 2009-06-18 6:28

>>73
Do YOU Anonymous, think your (sic) smarter than Leonardo da Vinci?? Why don't you pipe down and leave perpetual motion machines to the professionals.

Name: !MILKRIBS4k 2009-06-18 7:45

>>66
I am here now!

Name: Anonymous 2009-06-18 7:52

>>76
You're an Anus!

Name: !MILKRIBS4k 2009-06-18 7:55

>>77
I can insure you I am no anus!

Name: Anonymous 2009-06-18 10:54

>>76
You should collaborate with FrozenVoid and help him on his encryption project! He's also learning C, it'd be good for you two! Everything's better when you're doing it with someone!

Name: !MILKRIBS4k 2009-06-18 11:38

>>79
Do you have this "FrozenVoid"'s e-mail, or anyway I can get in contact with him!

Name: Anonymous 2009-06-18 11:47

>>80
All I have is the blog, try posting a comment asking for an email;
http://frozenvoid.blogspot.com/

Name: Anonymous 2009-06-18 13:58

>>68
Swapping by XOR creates dependencies which stall the pipeline. On anything recent, swapping via a temporary will be faster.

Name: Anonymous 2009-06-18 16:10

>>80
Can you please leave?

Name: !MILKRIBS4k 2009-06-18 16:15

>>83
I can insure you I am no anus!

Name: Anonymous 2009-06-18 16:18

>>84
THE WORD YOU'RE LOOKING FOR IS ``ENSURE'', YOU FUCKING FLAMING CRETIN WHY CAN'T YOU SEE THAT?

Name: Anonymous 2009-06-18 16:22

>>85
“ENSURE” AND “INSURE” ARE THE SAME WORD.

Name: Anonymous 2009-06-18 16:24

Name: Anonymous 2009-06-18 16:27

>>87
http://en.wiktionary.org/wiki/ensure
http://en.wiktionary.org/wiki/insure

It's an alternative North American spelling. Now, GTFO and take your FAIL with you.

Name: Anonymous 2009-06-18 16:34

>>88
Not only do you not understand the language, you are clearly posting on the wrong board.  We have a place for people like you, and it's called /b/.

Name: Anonymous 2009-06-18 16:34

>>88
I guess I'll leave then, and take my REAL ENGLISH with me.

Name: Anonymous 2009-06-18 16:40

It's an alternative North American spelling.
Translation: "stupid fucking americans"

Name: Anonymous 2009-06-18 16:45

>>87
assure.html
You seem to be posting about the completely different word he should have used instead of either. Please stay on topic.

Name: Anonymous 2009-06-18 16:47

>>92
Please open the wobsite and look at the header.

Name: !MILKRIBS4k 2009-06-18 17:01

>>84
NOT ME!
>>85
I know what I am saying! I am educated!

Name: Anonymous 2009-06-18 17:08

>>94
You are fucking clueless! Stop being a pompous anushole and just admit that you made a mistake! Errare humanum est!

Name: !MILKRIBS4k 2009-06-18 17:54

>>95
MILKRIBS4k is not "fucking clueless"! Step down!

Name: Anonymous 2009-06-18 19:15

>>96
I'd say back to /lounge/, but you're not wanted there either.

Name: Anonymous 2009-06-18 22:34

>>96
Hax my milkribs anus

Name: Anonymous 2009-06-18 22:45

>>71
/prog/

Name: Anonymous 2009-06-19 0:17

>>96
No, you step down, motherfucker. I have the renowned website on my side, what do you have, boy? Cite your references, something stronger than mine, you tool.

Name: Anonymous 2009-06-19 2:18

I was at a conference in 2002 where the chairman of ARM, Sir Robin Saxby, gave a keynote talk on ARM. In the Q&A session afterwards one of the attendees asked what Mr. Saxby thought of Linux - he replied that it was a toy operating system that would never amount to anything, and that open source was a useless strategy for developing software and he didn't see any place for it in the business world.

Name: Anonymous 2009-06-19 2:44

>>40
http://sxs.ifp.tuwien.ac.at/institut/lva/skripten/134.121%20Datenverarbeitung%20fuer%20Physiker%20I/C%20Programming%20Language.pdf

Read it before thinking about writing anything other than attempting their exercises. Seriously it helps.

Name: Anonymous 2009-06-19 4:06

>>102
Faggot quotes considered harmful.

Name: !MILKRIBS4k 2009-06-19 5:53

>>102
I will! Thank you!

Name: Anonymous 2009-06-19 9:00

>>104
Back to /lounge/, MILKRIBS.

Incidentally, answer my question over there too.

Name: Anonymous 2009-09-17 16:22

Lain.

Name: Anonymous 2009-09-17 16:22

Lain.

Name: Anonymous 2009-09-17 16:23

Lain.

Name: Anonymous 2009-09-17 16:23

Lain.

Name: Anonymous 2010-12-09 14:49

Name: Anonymous 2010-12-17 1:36

Erika once told me that Xarn is a bad boyfriend

Name: Anonymous 2011-02-04 11:29

Name: Anonymous 2011-02-04 19:59

Don't change these.
Name: Email:
Entire Thread Thread List