WiiApple: Apple IIe Emulator for Wii

I just learned about developing applications on Wii 3 days ago. I was wondering what application should I make, and I noticed that there was no Apple II emulator for Wii yet. Apple IIe was my first computer, so I thought it will be fun to be able to emulate it on my Wii. AppleWin is a good Apple emulator, but it is very windows specific, fortunately someone already ported it to Linux using SDL, and the name is LinApple.

Someone already made an early SDL port to Wii, but it is missing threading support (which is needed by the emulator). After reading things at wiibrew.org and devkitpro.org, I decided to complete the threading part. The next problem is the input. I want to be able to write BASIC applications, so I decided that the SDL port must support keyboard input, someone already made LibWiikeyboard, so I can just plug it in SDL (actually this is a hack, to correctly handle SDL requirements, there are some things that needs to be changed, in LibWiikeyboard and in the SDL gamecube implementation).

Next part is the porting process itself. The difficult part is making sure all the endiannes conversion of 6502 (Apple II CPU) to Wii’s PowerPC is done correctly, because I don’t have a USB gecko to debug it. Currently the port works, but don’t expect too much from this first release. I can already play some games, but I haven’t tested many other things. Sound is not yet now supported.

Here are some screenshots (made using tvtime, captured through my USB TV Box)

This is the application that you can extract to your SD Card

http://tinyhack.com/wii/wiiapple/wiiapple.zip

Note: Latest version is available at: http://code.google.com/p/wiiapple

The plan is: Everytime I update the application, I will still use the same file name, you can look at http://tinyhack.com/wii/wiiapple/ to look for older releases.
You will need to install Homebrew Channel to use it.

And the source codes are available at:

http://tinyhack.com/wii/wiiapple/

Note: Latest source code is available at: http://code.google.com/p/wiiapple

Update:

version 0.0.2:

– Fixed text overlay
– Disable saving options (dangerous for now, because you might overwrite your files)

version 0.0.3:

– Sound support
– Fix joypad problem
– Invalid disk image will not freeze the emulator (in case of invalid disk, Master.dsk will be reloaded)

January 6, 2009 (0.0.4)
– new keyboard driver, now work with most USB keyboards
Note: I am still working on the keyboard issue (some USB keyboard stillĀ  doesn’t work). I think this is because the limitation of Libwiikeyboard that can only do control transfer instead of interrupt transfer. Now I have rewritten the SDL keyboard part with my own code (part was based on the code from Guitar Fun).

January 6, 2009 (0.0.5)
– Support Gamecube controller (Wiimote support is planned for next version)
– updated some bug in keyboard handling

January 7, 2009 (0.0.6)
– Increased gamecube joystick sensitivity
– Fixed (most) crashing issue

January 8, 2009 (0.0.7)
– Support Wiimote as Joystick (Press A button in Gamecube controller to switch to gamecube joypad)

note: Mac USB keyboard works.

Configure Gadmei USB TV Box TVR200 in Linux

I have an old GADMEI USB TV BOX, in the back it says MODEL: TVR200. I haven’t use this since few years ago in Windows. I am planning to learn a little bit about Wii homebrew, so I thought if I can use my computer as display, I don’t have to go back and forth to my TV. When I plugged the USB TV BOX, the kernel display some messages about em28xx:

[ 3662.345631] em28xx #0: Your board has no unique USB ID and thus need a hint to be detected.
[ 3662.345634] em28xx #0: You may try to use card= insmod option to workaround that.
[ 3662.345636] em28xx #0: Please send an email with this log to:
[ 3662.345638] em28xx #0: 	V4L Mailing List 
[ 3662.345640] em28xx #0: Board eeprom hash is 0x00000000
[ 3662.345643] em28xx #0: Board i2c devicelist hash is 0xc51200e3
[ 3662.345645] em28xx #0: Here is a list of valid choices for the card= insmod option:
[ 3662.345647] em28xx #0:     card=0 -> Unknown EM2800 video grabber
[ 3662.345650] em28xx #0:     card=1 -> Unknown EM2750/28xx video grabber
[ 3662.345652] em28xx #0:     card=2 -> Terratec Cinergy 250 USB
[ 3662.345654] em28xx #0:     card=3 -> Pinnacle PCTV USB 2
[ 3662.345656] em28xx #0:     card=4 -> Hauppauge WinTV USB 2
[ 3662.345659] em28xx #0:     card=5 -> MSI VOX USB 2.0
[ 3662.345661] em28xx #0:     card=6 -> Terratec Cinergy 200 USB
[ 3662.345663] em28xx #0:     card=7 -> Leadtek Winfast USB II
[ 3662.345665] em28xx #0:     card=8 -> Kworld USB2800
[ 3662.345667] em28xx #0:     card=9 -> Pinnacle Dazzle DVC 90/DVC 100
[ 3662.345670] em28xx #0:     card=10 -> Hauppauge WinTV HVR 900
[ 3662.345672] em28xx #0:     card=11 -> Terratec Hybrid XS
[ 3662.345674] em28xx #0:     card=12 -> Kworld PVR TV 2800 RF
[ 3662.345676] em28xx #0:     card=13 -> Terratec Prodigy XS
[ 3662.345679] em28xx #0:     card=14 -> Pixelview Prolink PlayTV USB 2.0
[ 3662.345681] em28xx #0:     card=15 -> V-Gear PocketTV
[ 3662.345683] em28xx #0:     card=16 -> Hauppauge WinTV HVR 950
[ 3662.685938] em28xx #0: V4L2 device registered as /dev/video0 and /dev/vbi0

So I tried modprobe em28xx card=0 and then card=1, and then card=2, thankfully it worked with card=2. I used tvtime program to see the output of the usb tv. To make it permanent, add this line:

options em28xx card=2

to your /etc/modprobe.conf, or create a new file (any name is fine) at /etc/modprobe.d and fill it with that line. Note: audio is not working yet, but I don’t really need it right now.

Hotlink Protection in Hostmonster's CPanel

So far I have been quite happy with hostmonster’s performance and quality. It is not really that good, but for the price, I get what I pay for. There is this one problem in the Hotlink Protection that I never bother to fix.  Sometimes ago, I enabled hotlink protection, and when I tried to disable it, suddenly all of my WordPress blogs permalinks stops working. I didn’t know what was wrong, and I just re-enabled the hotlink protection. Today I found out that the problem is in CPanel, it removes the "RewriteEngine  on" line from the .htaccess files when you turn off the hotlink protection (after turning it on).

Re-adding the "RewriteEngine on" to the first line of the .htaccess files fixed that. I have several blogs, so editing one by one will take a long time, so I did the editing from command line. Inserting a text to the first line of a file can be done using sed:

sed -i '1i\RewriteEngine on' $i filename

And to change a lot of files at once you can do this (bash shell):

for i in dir1/.htaccess dir2/.htaccess  ; do sed -i '1i\RewriteEngine on' $i; done

Unicode: from text and font to display

I’ve always wanted to be able to support all kind of text on my Symbian bible. The problem is this: the Unicode support for Symbian is very limited and even non-existent for some languages. A few weeks ago someone asked me if I can make Symbian bible to support Malayalam bible (using Malayalam script of course). Malayalam writing system was only supported recently by major operating systems (such as Windows XP and OS X Leopard), and Symbian haven’t supported it yet (and even if it supports it, the support will only be activated to phones on certain sales area).

I know that there are several Unicode layout libraries, such as Pango, Qt or ICU. All of them are too big for me to understand and port to Symbian. So my solution was to use the FreeType library and harfbuzz font shaping. After using those two libraries on Symbian, I think now I can understand Unicode. Here is my quick guide to understanding Unicode, from having a data and a font, to displaying the data with that font.

The first thing that you need to understand is: Unicode defines a list of characters for many languages of the world.

Some languages don’t have the concept of lower or upper case. Some languages have their own numbering system. Every language has their own system of ordering things. If possible: always use the function provided by the library you are using.

Continue reading “Unicode: from text and font to display”

Update – Debian on Agestar Firmware

Warning/Note: This is not an update to the existing firmware. This is for installing Debian. If you don’t know anything about Linux, this is not for you. This firmware DOES NOT contain web interface.

I haven’t looked again on Debian installer for Agestar, but I have built a new firmware for Debian on Agestar using the latest kernel patch (faster network). If you have installed Debian using the instruction in here, you can download zImage-20092008 to Agestar, and then do:

dd if=zImage-20092008 of=/dev/mtdblock1

If you haven’t installed Debian, then when following the instruction, but instead of using star.bin use star-20092008.bin. To make it clear, use zImage-20092008 to update existing installation, and star-20092008.bin for new installation (starting from the original Agestar firmware). If you made a mistake, then you need a serial port to unbrick your Agestar. NOTE: the web update method only works on agestar, other models can work by using serial port and latest patch for kernel source (2.6.29 or later).

If you are interested to make your own firmware, this is what you should do:

  1. Download armboot.bin and put it to a directory
  2. Download mergefile.c to the same directory as armboot.bin
  3. Compile mergefile.c (just do cc mergefile.c -o mergefile)
  4. Compile your kernel according to the instruction at http://tinyhack.com/2008/09/08/how-to-compile-kernel-for-agestar/ to create zImage, copy/move it to the same directory as armboot.bin
  5. Type ./mergefile to merge armboot.bin and zImage to star.bin.

You can use star.bin to flash (replace) original firmware. If you already installed Debian, and you want to update your kernel, you only need to build zImage and do dd if=newzImage of=/dev/mtdblock1.

EEE PC 900

One of our friend bought an EEE PC 900, it has 4 GB + 16 GB SSD. The seller didn’t told us that the 16 GB SSD was very slow (I should have read this). I found out about his when she tried to install many programs in the 4 gb SSD, and is was full. Using some steps that i found on the Internet, I tried moving her Windows installation to the 16 GB SSD. And the result is: the Windows is very slow.

I found some other guides to speed up Windows on the 16 GB partition. I didn’t try all of the suggestions (too many steps), so I finally gave up because the speed improvement is not so much in my case. Finally I just moved the Windows back to the 4 GB SSD, and then reinstalling some seldom used software to the 16 GB partition.

How to compile kernel for Agestar

Here is a guide how to compile a kernel for your Agestar. In this latest patch from me, I have included the network driver with scatter/gather support. For FTP transfer, HTTP, or other transfers that uses sendfile syscall, the speed is about 50% faster than before, for ordinary transfer, it almost doesn’t change.

  1. Download vanilla kernel from kernel.org (use version linux-2.6.25.4)
  2. Extract kernel , and apply this patch file (patchfile-20080907.gz)
  3. Download initramfs.cpio.gz put it in the kernel directory and extract it
  4. Download my configuration file config-20080907 put it into kernel directory, rename it as .config
  5. Install an arm compiler, your distribution may have them (for instance in Debian you can use aptitude with emdebian.org repository), or download from codesourcery.com.
  6. Edit Makefile, find CROSS_COMPILE and change the value to the location and prefix of your compiler. For example, of your compiler is /opt/arm/920t_le/bin/arm_920t_le-gcc, fill in /opt/arm/920t_le/bin/arm_920t_le- (without the gcc part)
  7. To configure the kernel, type “make menuconfig”
  8. Type make to build zImage

NOTE: the zImage is NOT a FIRMWARE. You can write zImage to /dev/mtdblock1 on the agestar to update your kernel but not through the web interface. I will write another tutorial on how to make zImage into a firmware that can be flashed using the web interface.

If you want a newer kernel, start from the current kernel, and keep on patching with the next incremental patch until you reach the kernel number that you want. This is not always easy, because sometimes a patch will conflict with the changes that i have made.

Tips For Debian on Agestar

Chris (Whites11) and several others have pointed that the source code for a device similar to Agestar have been released by a German company (http://www.multicase.de/en/products/76/ns348s.html). I have not looked carefully at the source code of this one, but none of the people on the mailing list have got it working with networking enabled.

Kari Ahtiala who owned several NAS devices (SLUG, NCB3AST, NCH3AHT), said that you can just move your disk from NSLU (SLUG) to Agestar just fine:

Continue reading “Tips For Debian on Agestar”

Installing Debian on Agestar without serial port

I have prepared a firmware and tutorial to Install Debian here, this time without the need for serial port. I have tested this, and it seems that everything works. But of course I will not be responsible if anything happens. If you think there are some missing, unclear or inaccurate steps, or if you doubt about something, then don’t install it. If you have anything to ask just email to yohanes [at] gmail.com, or just post your questions as comments.

NOTE: the web update method only works on agestar ncb3ast, other models can work by using serial port and latest patch for kernel source (2.6.29 or later).

New Firmware Progress

My wife agrees that I can buy another Agestar to hack and use the other one for our network storage. With this new Agestar I can continue my hacks. Currently I am working on building a firmware that can be used to install Debian without serial port. On the first stage, I will build a generic firmware without automatic installer, so the user still needs to do some manual steps to install Debian. So it is something like the manual Debian install on NSLU2 (http://www.cyrius.com/debian/nslu2/unpack.html).  Actually because this is generic command line, you would be able to install Gentoo or something else. The next step would be to make an automatic installer like in NSLU2(http://www.cyrius.com/debian/nslu2/install.html).

The main reason why I started with manual installer is because I am not yet familiar with the Debian installer. Currently the manual installer is almost complete, I just need to test it thoroughly to make sure that this will really works without serial port. I hope I can release this in the next few days (or this weekend at the latest).