# Supplied Sample Programs

This page describes the sample programs that are supplied with OpenXDK. You will find that most of them do whatever they do, and then reboot after sleeping for a couple of seconds. I used to loop forever, but I got sick and tired of having to get up to reboot the damn XBOX. Now, I get a few seconds to look at the output and it automatically reboots itself.

## ComingSoon

This is the first program that I compiled using OpenXDK. It came from the original Microsoft VC6 version of OpenXDK and essentially draws a logo in the middle of the screen. The data for the logo comes from a bitmap that is defined byte-by-byte in a header file. It is pretty simple... it just plots pixels in the middle of the screen (using direct video buffer access).

## DebugPrint

As I was developing OpenXDK, it became a real pain to get debugging information (especially before I had file I/O working). The debugPrint and debugPrintNum function calls draw a string/number respectively on the screen (using direct video buffer access) using a very simple 8x8 fixed font. This program just tests that it works OK.

## FileHal

Using the `HAL` file I/O routines:

- creates a file
- writes some data
- closes the file
- opens the file
- reads data
- seeks to a certain offset
- reads more data
- closes the file

## FileStdio

Using the `libc` file I/O routines:

- creates a file
- writes some data
- closes the file
- opens the file
- reads data
- seeks to a certain offset
- reads more data
- closes the file

## PadTest

Using the `HAL` joystick routines, initialises the joystick library and waits for joystick input. Dumps out some diagnostics to the screen and then exits when you press the A button. Very rudimentary code, but it works.

## Reboot

Gee... I wonder what this does?

## SDLJoystick

Using the event handling capabilities of SDL, this program waits for input from the joystick and outputs some info about what sort of events it received. The main loop is very typical of an SDL main processing loop.

## SDLVideo

This was the first SDL program I ever wrote (on XBOX or PC). It just uses the SDL graphics APIs to draw some pretty colours on the screen. It cycles through 8, 16, 24, and 32 bit colours with the same pattern, so you can see the difference.

## TestNewlib

This is my test harness for the newlib functions. Nothing very exciting:

- `sprintf()`
- `times()`
- `stat()`
- `ctime()`
- `freopen()`
- `fclose()`

Boring, boring, boring!

## Doom

Now, we're talking!! I downloaded the sources to sdldoom 1.10 as ported by Sam Lantiga (the author of SDL). After commenting out the network portions of the code and adding some joystick handling, we have a working version of Doom for the XBOX. Woohoo!! Currently supported controller configuration is as follows:

- DPAD - Left/Right/Up/Down
- Button A - Shoot
- Button B - Strafe
- Button X - Speed
- Button Y - Use

Back to Home Page