1
0
mirror of https://github.com/KarolS/millfork.git synced 2026-04-23 21:17:27 +00:00

X16: Updated to the newest hardware design

This commit is contained in:
Karol Stasiak
2020-05-01 15:19:25 +02:00
parent 655edc35ff
commit 4b5d290d6c
12 changed files with 540 additions and 183 deletions
+63 -8
View File
@@ -3,7 +3,8 @@
# 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.
Therefore, both the device itself and the modules for its support may change at any moment.
The X16-oriented modules may be out of date and not support the current design of the device.
## x16_kernal
@@ -11,6 +12,11 @@ The `x16_kernal` module is imported automatically on the X16 target.
Currently, it automatically imports the [`c64_kernal` module](./c64.md).
#### `void mouse_config(byte register(a) enable, byte register(x) scale)`
Configures the mouse pointer.
`enable` should be `1` to enable, `0` to disable and `$ff` to enable without reconfiguration.
`scale` should be `1` on 640×480 screens, `2` on 320×240 screens, and `0` to keep the current scale.
## x16_hardware
@@ -43,7 +49,7 @@ Copies `size` bytes from the RAM at address `source` into the VERA memory space
#### `struct vera_layer_setup`
Hardware register values for a video layer:
Hardware register values for a video layer. For VERA 0.7 and 0.8:
byte ctrl0
byte ctrl1
@@ -51,14 +57,32 @@ Hardware register values for a video layer:
word tile_base
word hscroll
word vscroll
For VERA 0.9:
byte config
byte map_base
byte tile_base
word hscroll
word vscroll
#### `void set_vera_layer1(pointer.vera_layer_setup)`
Sets up the layer 1.
Sets up the layer 1. VERA 0.7 and 0.8 only.
On VERA 0.9, use `vera_layer0` directly.
#### `void set_vera_layer2(pointer.vera_layer_setup)`
Sets up the layer 2.
Sets up the layer 2. VERA 0.7 and 0.8 only.
On VERA 0.9, use `vera_layer1` directly.
#### `vera_layer_setup vera_layer0`
Direct access to registers for the layer 0. VERA 0.9 only.
#### `vera_layer_setup vera_layer1`
Direct access to registers for the layer 1. VERA 0.9 only.
#### `struct vera_sprite_data`
@@ -70,15 +94,33 @@ Hardware register values for a sprite:
byte ctrl0
byte ctrl1
#### `const int24 VERA_COMPOSER_CTRL`
#### `void vera_upload_sprite(byte sprite_id, pointer.vera_sprite_data source)`
Uploads sprite data for given sprite id.
#### `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.
#### `const int24 VERA_COMPOSER_CTRL`
#### `const int24 VERA_LAYER_1`
#### `const int24 VERA_LAYER_2`
#### `const int24 VERA_SPRITE_CTRL`
Various addresses in the VERA memory space. VERA 0.7 and 0.8 only.
#### `void vera_reset()`
Resets the VERA.
#### `void vera_set_sprites_enable(bool enabled)`
Enables/disables sprites.
#### `void set_border(byte color)`
Changes the color of the border.
## x16_joy
@@ -119,6 +161,10 @@ Variable | SNES controller | NES controller | Keyboard (joy 1 only)
`input_b` is an alias for `input_btn`. Single-button games should use `input_btn` for compatibility.
#### `x16_joy_type joy_type`
The type of the last read joystick. One of `joy_none`, `joy_nes`, `joy_snes`, `joy_keyboard`.
## x16_joy1_default module
@@ -126,3 +172,12 @@ Defines the joystick in port 1 as the default joystick.
#### `alias read_joy = read_joy1`
## x16_mouse
The `x16_mouse` module implements a mouse driver compatible with the `mouse` module.
Before using this, you may want to call `mouse_config` from the `x16_kernal` module.
#### `void read_mouse()`
Reads the state of the mouse.