banner logo
Updates Blog Support Contact Links
Programming JdiWeb JdiMOO JdiBoy JdiMail JdiMOOpp NetCheck Tutorials
Gaming AVR Othello

Archive for May, 2008

Emulation part 2

Tuesday, May 27th, 2008

Many of you have probably been shown the page I setup for my gameboy emulator project. If not, click here. Anyway, I thought I’d post an update for the rest of you. The emulator now works…. mostly. It reads the ROM data for a game and it displays things on the screen. Past that, it’s dicey. Sound doesn’t work, yet. I need to find a way to have better control over the sound output., more than what I can easily find in RB. There is no good way to play a specific frequency, and I am not even sure what format the sound tables I already create are in. The video displays, but it is incredibly slow. It takes several minutes to display the first logo. But most of that is coming from the many many loops it goes through to convert a picture into a memoryblock and back. I think I will see about taking the memoryblock out of the picture (no pun intended). If I can eliminate the approximate 6 million loops iterations (2 conversions, 160×140 px images, looking up 256 colors in a loop (avg 128))  I have to do in the conversions two and from a memoryblock each time a line gets drawn, that would speed things up a lot. Everything posted up there is up to date as of this posting. If anyone has any idea on how to get sound going, that would be awesome.

Emulation

Thursday, May 15th, 2008

You all probably know that I like low level things in programming. I’ve covered compilers extensively. I’ve dealt with some embedded systems work which was fun. I’ve learned a lot though this, but, in the process, I stopped using Realbasic, using C, C++, and assembly instead, depending on what the task required.

Realbasic, as a language, just seem intuitive to understand to me. You don’t have strange things like the ternary operator in C, or strange macros, or pointer craziness. I know from experience, that going through that is helpful and sometimes you have to, but RB seems to be really good about some things.

Because RB is so nice about some things, yet so different than some other languages,  I occasionally will translate a piece of code to RB, from, say, C. This proves challenging enough that it requires both good knowledge of C and RB, and it also forces me to understand the code that I’m writing more than just reading it.

One thing that I had been looking at was how to play video game music, specifically on a small embedded system I have. But that was proving overwhelming. I didn’t know how the sound systems worked or how to emulate them. So I took a step back. I thought about how emulators worked. This got really interesting, and I figured, hey, maybe I can do this.

So I went out and found some an open source Gameboy emulator written in C++. I chose a gameboy emulator for several reasons. First, the system is old and slow, so speed issues would be reduced, even maybe to the point where I’d need to slow down. Newer systems might run to fast for mine to keep up. Hey, it’s my first time out. Second, the gameboy has a builtin screen, so video output gets written in specific ways to display directly to a screen. An NES might have to have additional layers to convert it from an analog TV signal to something to draw. Finally, I was told that the almighty SNES had some crazy special modes that hurt people’s heads to manage. Again, it’s my first time out.

I found a nice emulator (I haven’t actually run it) written in object oriented C++. This makes it easy to understand and translate into RB. There’s a GameBoy class that has a Cartridge, a CPU, and buttons, the CPU has some memory, a ROM, some timers, and such. It just breaks down really well. Probably not optimized like other emulators would have to be, but this is how I would probably make an emulator starting out, replicating the real thing in code.

I’m in the process of porting the CPU code to RB right now, and let me tell you, it’s a lot to it. Just because there is one “add” keyword in the assembly doesn’t mean there is one “add” opcode. Depending on where the data for the add operation is coming from, the opcode changes. So then you have 16 different add functions, which then call another function that actually does the adding.

I think I’ll post sections of the code as I finish them on a new project page. The project that I’m basing mine on can be found here. It’s called Mario there. I’m open to suggestions for a name for this project, though.

I Can Has Free OS?

Monday, May 12th, 2008

I mentioned earlier about Richard Stallman coming to VCU. For those who don’t know, RMS is the founder of the GNU project, founder of the Free Software Foundation, creator of the GPL, and an all around visionary.

As an introduction, Free Software doesn’t mean you don’t have to spend money to get it. It usually does, but that isn’t part of the definition. Free software means that the software has freedom. You can share it, you can edit it, you can use it, and you can share your edits of it, freely. RMS distingushes between Free Software and Open Source software. Open Source just means that the source itself it available, but doesn’t insure the above freedoms.

He lectured about how it is an ethical emparitive to use Free Software. Basically, if you use proprietary software, there are issues for both the users and the developers. One example he have for users, if you are using some proprietary software, and your friend asked for a copy, you would either deny your friend (not good, as he’s your friend), or break the EULA (not good either). From the developer’s standpoint, creating propriatary software creates a monopoly on the software and creates issues of ownership of it. The single developer (as a person or a company) is the only source of support and for improvement and an do whatever they want with it, even malisiously.

From my perspective, free software is very good and solves many problems. For my RB friends out there, imagine if RB was free software. We could go in and fix it ;) . It prevents malisious code because people can see everything that is there. But I don’t think it is correct for everything, at least not yet. There are only really two sources of money from free software: Support, or freelancing. You can sell support like Red Hat and make money. Or you can freelance, making software for companies that either sell support for the software, or use it for internal usages. This sqeezes out independent developers. It squeezes out many smaller programs that are our there that are only there because some independent developers wouldn’t make them without finantial insentivie.

Also, as far as using, not even developing, non-free software, there are reasons to use it, but not many. You can get the software for free.

RMS also is picky about terms. It’s GNU/Linux and it’s not Open Source. Linux is just the kernel, and GNU is the operating system. He’s right, but look at many modern distros, the kernel is the heart, and the other stuff gets added on. People see the distros for what they add to the base system. A basic Gentoo setup will only have GNU/Linux, but then to make it usable, you add in GNOME, Firefox, OOo, XTerm, VLC and what not. One thing that makes Debian distros differ from Red Hat distros is Apt vs Yum. Neither of those are a part of GNU/Linux, yet are considered a core matter between many distros. People don’t pay much attention to the fact that cd, ls, cp, grep and what not are core components to the system. GCC is just a compiler, and many distros don’t include it by default.  Even the GCC site calls it Linux and not GNU/Linux. It’s like Band-Aid trying to make people call everything else bandages, when they really call them all Band-Aids. It’s a loosing battle. It’s Linux. Get over it.

What are your thought’s on Linux and Free Software?

Internship Updates

Monday, May 12th, 2008

Well, school’s out for the summer! Hurray! But I haven’t secured an internship. Boo!

I have an interview tomorrow at Carmax to be a “Enterprise UNIX/Linux Support Intern” which sounds to me to be a server gopher job. Could get the job done, but might not be all that interesting. I also got word that a professor has an opening during the summer in his lab that’s paid and would count. I’m thinking that I might do that if possible, as he tends to work with UAV’s, or Unmanned Ariel Vehicles. To paraphrase Han Solo “This ain’t like dusting servers, kid”