Original Post

Sorry if this has been asked a billion times. I just recieved my Flashboy and I wanted to start coding. I am a bit partial to C++ classes, so I was wondering if anyone got even G++ compiled with even basic support for features. More or less, I simply want new/delete and classes with constructors/deconstruction. I don’t really care for RTTI or Exceptions (or even templates).

Thanks.

12 Replies

AFAIK nobody has g++ working for VB… if you haven’t checked it out already, you may want to try VBJAENGINE (http://www.vr32.de/modules/news/article.php?storyid=252 and http://www.vr32.de/modules/dokuwiki/doku.php?id=vbjaengine_programmer_s_guide ), which according to the wiki supports some object oriented programming. Personally, I prefer C to C++, but everyone’s entitled to their own opinion and coding styles. Even if you did have dynamic memory, there’s only 64KB of work RAM, so the size of the heap would be pretty limited (and you could just allocate a large chunk of memory in C, then manage your own memory). The system isn’t that fast either, so the extra overhead of other C++ stuff would reduce the performance, although for simple stuff, it may not matter (although C++ is really most convenient for larger apps).

DogP

Well, with very little effort, I was able to get g++ compiled, and it seems to compile simple c++ code fine (simply added “c++” to –enable-languages in the build script for GCC). However, I haven’t tested the resulting binary. I will keep you updated on where I get.

Hey that’s pretty cool! I didn’t know it was that easy to enable C++.

If the resulting binaries actually work, the next step is to make some kind of library to take advantage of the OOP features. Maybe Jorge could port the vbJAEngine to C++…

Thanks for working on this, MindChild.

EDIT:

I just found this. It’s a specification for a subset of C++ designed for embedded systems (like our red friend ;-)) Might be useful…

http://www.caravan.net/ec2plus/

I am very happy to hear that GCC 2.95 will support C++ coding structures. However, with 64 KB of memory (as stated in David Tucker’s Programmer’s Manual), things will be very tight from a software design point with those structures in mind. This does not take into account advanced engine design (physics, polygon rendering) or even the graphics manipulation end of things.

Wikipedia states that the Virtual Boy comes with 1 MB of RAM. Is there any method of verifying this claim’s validity? 1 MB may not seem like much, but it’s quite a bit more room to work in compared to 64 KB.

1mbit (128KByte) is the amount of DRAM… for things like Char RAM, Affine tables, etc… 512kbit (64Kbyte) is the amount of work RAM (PSRAM) available for the user to use (variables and stuff).

DogP

Thanks for the information. I’m hoping to start working with the VB since the Flashboy came out. I wanted to do so when David Tucker first put up his development information, but couldn’t because of the need for a reprogrammable cartridge.

You should also check out Reality Boy (especially the newest version)… I rarely use my flash carts when developing anymore, since the emulator is MUCH more convenient, and pretty accurate.

DogP

Does Reality Boy or some other Emulator inform the developer if they have exceeded that 64 KB limit? Or rather might there be a symptom to indicate this? I doubt it would flash OUT OF MEMORY on the screen, but just flaking out wouldn’t tell you much.

Of course you are correct, when I did programming for GBA, I would use the cartridge mostly for demonstrations and such. I wanted the same thing for the Virtual Boy. I used the Emulator for most of the development process. Of course, if I hit some major milestone, the cart would be used in celebration.

It never hurts though if you’re going up for a job to bring a demonstration of your previous work in case the prospective employer wishes to see it.

IIRC the newest gcc warns that you’ve allocated RAM outside of the memory space… but I don’t remember for sure. I know the older gcc didn’t, and would just flake out.

But yeah, the emu has caught up pretty well in the last couple years… a few years ago I was doing most of the testing on actual hardware (the emu wasn’t accurate enough for a lot of stuff)… now it supports pretty much everything, at least to some extent.

Heh… that’s funny that you mention demoing this for a job interview… when I switched jobs last year, I put this stuff on my resume, and most of the stuff I talked about in the interviews were these projects. One of the guys said after the interview w/ my current boss he said “This guy programs video games in his spare time… lets hire him!” 😀

DogP

That’s good to know. I’m just getting started, mind. Currently I’m designing a headband to play the Virtual Boy on the 4 hour bus ride each day (back and forth to work.) I’m using Disney key chains, the cloth is pretty thick and I’m hoping it will work well. I’ll put up pictures when it’s completed.

With the job I’m at now, I demo’ed my thesis for my BS in Math, it’s a tree that can be rotated in three dimensions. Pretty rudimentary but I did get hired, so it must have been pretty good. For that interview, I strategically placed a Master’s level book so they would see it when I was getting at my developer’s journal.

Showing that the interest and motivation is there is quite important in an interview, aids like that reinforce the message. Like your current job, according to my supervisor, I was hired solely because of my dedication and interest.

I’ll have to try and get that version of GCC onto my ThinkPad to get started. I wanted to first try and get David Tucker’s guide memorized. I’d prefer to handle the low level stuff at one end, but have the flexibility to do high level stuff like Polymorphism as well.

The concept of virtual methods really makes a lot of things possible beyond simple tasks. With that, a Mario that inherits from sprite could manage how it’s going to move, die and so forth. A spiny or turtle could determine their actions as well. The Object Oriented Paradigm simplifies the debugging and testing aspects quite a bit. In SMB, some turtles (green shells) can not go beyond the ledge they are on. Others (red) could go past the edge to fall to a lower platform or into a pit. Of course if implemented in VB both would have to be red.

Plus, I get extra experience with the OOP stuff I need for work, while doing something fun!

  • This reply was modified 15 years, 11 months ago by vbman.

Hi guys, it would be great to have feasible C++ support for the VB, I myself find it very hard to design/program anything without thinking of objects after I learned OOP, but as stated by many of you the memory allocation on a heap would kill the performance and constraint the work RAM of the machine.

It never hurts though if you’re going up for a job to bring a demonstration of your previous work in case the prospective employer wishes to see it.

Nice comment and good tip, I myself got my current job position by showing the vbjaengine 🙂

The concept of virtual methods really makes a lot of things possible beyond simple tasks. With that, a Mario that inherits from sprite could manage how it’s going to move, die and so forth. A spiny or turtle could determine their actions as well. The Object Oriented Paradigm simplifies the debugging and testing aspects quite a bit. In SMB, some turtles (green shells) can not go beyond the ledge they are on. Others (red) could go past the edge to fall to a lower platform or into a pit. Of course if implemented in VB both would have to be red.

After I understood Polymorphism there was not way back for me, and that’s why I had to find a way to have that feature for my VB programming, it was a joy for me to understand the underlaying of how it works behind the scenes in languages like C++ to do it’s magic and trying by myself to replicate it to some extent, which was indeed more fun than any other thing I did for the engine.

jorgeche

My previous post may have been hasty. I did a bit of research about the origins of C++ and found some interesting things.

The creator of C++ Bjarne Stroustrup designed this language in 1983 in AT&T labs. One would assume that he would be testing it out at that time to verify the theories that he had. Commercially available programs for PCs using this style appeared earlier than 1987. Memory for those machines varied widely, some having less than the VB and others, like my father’s Tandy 1000 in 1988 had as much as 640KB.

It’s worth noting, that those machines also had to run DOS in the background which is comparatively memory expensive compared with the TRON variant that the Virtual Boy runs. DOS can eat up as much as 384 KB of memory.

In SAMS Teach Yourself Wireless Java With J2ME In 21 Days, they give a specification for the CLDC profile for use with J2ME. In part the CLDC requires a 16 Bit CPU with 160 KB memory available to Java. Now this takes into account the interpreter, which is not cheap with regard to memory. It looks pretty possible. The J2ME specification does not diminish the language features ie Inheritance, Polymorphism, Abstract Base Classes (ABCs) and others.

I can’t be sure that C++ would run well on it, but given the historical precedence described above it may not be as bad as we think. I’ll try and come up with some kind of benchmark and test it out. It’s worth a shot at least. Assembler would be the best for performance, but not all code segments need to be in Assembler for it to function effectively. Only about 15 to 20% of the Linux Kernel by volume is Assembler.

  • This reply was modified 15 years, 11 months ago by vbman.
  • This reply was modified 15 years, 11 months ago by vbman.
  • This reply was modified 15 years, 11 months ago by vbman.
  • This reply was modified 15 years, 11 months ago by vbman.

 

Write a reply

You must be logged in to reply to this topic.