next up previous contents
Next: Tile Accelerator (ta.c) Up: Hardware Abstraction Layer: DC Previous: Maple Access (maple.c)   Contents

Subsections

Maple Peripheral Support Modules

Support modules are included for standard controllers, keyboards, VMUs, and mice. Most peripherals fit into these molds. Eventually we'll probably add support for more things like the purupuru pack (force feedback) but we don't have one yet, so we can't. =) Notable among this list is the mouse since it just came out. Wow your friends by writing software that uses it before Sega gets a chance! =)

Since these are mostly the same (except for names and structure values) I won't go over them in detail. Each module generally contains a poll function that checks the state of the peripheral and fills in a device-specific structure. See the header files for the specific structure information. I'll list out the poll functions here for convienence though.

int cont_get_cond(uint8 addr, cont_cond_t *cond)

Check controller status. Returns which buttons are pressed and the state of the various analog controls.

int kbd_get_cond(uint8 addr, kbd_cond_t *cond)

Check keyboard status. Returns up to six keys being pressed at once. There are other support functions for the keyboard that you should look up in keyboard.h if you want to use it seriously. These do queueing and buffering for you. If you want this functionality, you should use kbd_poll(uint8 addr) and then kbd_get_key() to get key presses.

int vmu_draw_lcd(uint8 addr, void *bitmap)

Draws the given bitmap to the LCD screen. Generally these are on VMUs (which is why it's part of vmu.c) but it's not required. The bitmap should be a 48x32 bit array. The picture will show up right side up on the VMU itself, so when it's inserted in a controller you'll need to flip it in each direction.

int vmu_block_read(uint8 addr, uint16 blocknum, uint8 *buffer)

Read the requested block of the VMU's flash ram and put it in ``buffer''.

int vmu_block_write(uint8 addr, uint16 blocknum, uint8 *buffer)

Take what's in ``buffer'' and write it to the requested block of the VMU's flash ram.

int mouse_get_cond(uint8 addr, mouse_cond_t *cond)

Gets the condition of the mouse peripheral specified. Returns button states and delta x, y, and z (roller).


next up previous contents
Next: Tile Accelerator (ta.c) Up: Hardware Abstraction Layer: DC Previous: Maple Access (maple.c)   Contents
Dan Potter 2002-07-29