1
0
mirror of https://github.com/KarolS/millfork.git synced 2024-12-27 19:30:04 +00:00
millfork/docs/stdlib/x16.md
2019-10-23 11:03:01 +02:00

3.3 KiB

< back to index

Commander X16-oriented modules

WARNING! Commander X16 is not yet a finalised design. Therefore, both the device itself and the modules for its support may change at any moment.

x16_kernal module

The x16_kernal module is imported automatically on the X16 target.

Currently, it automatically imports the c64_kernal module.

x16_hardware module

The x16_hardware module is imported automatically on the X16 target.

void set_ram_bank(byte)

Switches the RAM segment at $A000-$BFFF.

void set_rom_bank(byte)

Switches the ROM segment at $C000-$DFFF.

void vera_poke(int24 address, byte value)

Writes a byte into the VERA memory space.

byte vera_peek(int24 address)

Reads a byte from the VERA memory space.

void vera_fill(int24 address, byte value, word size)

Writes size bytes into the VERA memory space.

void vera_upload(int24 address, pointer source, byte size)

void vera_upload_large(int24 address, pointer source, word size)

Copies size bytes from the RAM at address source into the VERA memory space at address address.

struct vera_layer_setup

Hardware register values for a video layer:

byte ctrl0
byte ctrl1
word map_base
word tile_base
word hscroll
word vscroll

void set_vera_layer1(pointer.vera_layer_setup)

Sets up the layer 1.

void set_vera_layer2(pointer.vera_layer_setup)

Sets up the layer 2.

struct vera_sprite_data

Hardware register values for a sprite:

word address
word x
word y
byte ctrl0
byte ctrl1

const int24 VERA_COMPOSER_CTRL

const int24 VERA_PALETTE

const int24 VERA_LAYER_1

const int24 VERA_LAYER_2

const int24 VERA_SPRITE_CTRL

const int24 VERA_SPRITES

Various addresses in the VERA memory space.

x16_joy module

The x16_joy module implements a joystick driver compatible with the joy module.

void read_joy1()

Reads the joystick from the port 1.

void read_joy2()

Reads the joystick from the port 1.

void read_also_joy1()

Reads the joystick from the port 1 and adds its readouts to the current readouts.

void read_also_joy2()

Reads the joystick from the port 2 and adds its readouts to the current readouts.

byte input_*

The following variables have the value 1 if the key is pressed and 0 if not:

Warning: The assignment of NES controller buttons and keyboard keys may change in the future.

Variable SNES controller NES controller Keyboard (joy 1 only)
input_a A
input_b B A Ctrl
input_x X B Alt
input_y Y
input_start Start Start Enter
input_select Select Select Space
input_l L
input_r R

input_b is an alias for input_btn. Single-button games should use input_btn for compatibility.

x16_joy1_default module

Defines the joystick in port 1 as the default joystick.

alias read_joy = read_joy1