mirror of
https://github.com/KarolS/millfork.git
synced 2026-04-20 18:16:35 +00:00
Preprocessor. Z80 improvements. Library improvements.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
[< back to index](../index.md)
|
||||
|
||||
# Commodore 64-oriented modules
|
||||
|
||||
## `c64_kernal` module
|
||||
|
||||
The `c64_kernal` module is imported automatically on the C64 target.
|
||||
|
||||
TODO
|
||||
|
||||
## `c64_basic` module
|
||||
|
||||
TODO
|
||||
|
||||
## `c1531_mouse` module
|
||||
|
||||
The `c1531_mouse` module implements a Commodore 1531 proportional mouse driver compatible with the `mouse` module.
|
||||
|
||||
#### `void c1531_mouse ()`
|
||||
|
||||
Updates the state of the mouse.
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
[< back to index](../index.md)
|
||||
|
||||
# NES/Famicom-oriented modules
|
||||
|
||||
## `nes_hardware` module
|
||||
|
||||
The `nes_hardware` module is imported automatically on NES targets.
|
||||
|
||||
TODO
|
||||
|
||||
## `nes_mmc4` module
|
||||
|
||||
The `nes_mmc4` module is imported automatically on the NES MMC4 target.
|
||||
and contains routines related to MMC4 bankswitching.
|
||||
|
||||
#### `void set_prg_bank(byte a)`
|
||||
|
||||
Changes the $8000-$BFFF PRG bank.
|
||||
|
||||
#### `void set_chr_bank0(byte a)`
|
||||
|
||||
Changes the CHR bank 0 ($0000-$0fff in the PPU memory space).
|
||||
|
||||
The high nibble (0 or 1) selects between `chrrom0` and `chrrom1` segments.
|
||||
The low nibble L (0-$F) selects a 4K-aligned address in the segment ($L000).
|
||||
|
||||
#### `void set_chr_bank1(byte a)`
|
||||
|
||||
Changes the CHR bank 1 ($1000-$1fff in the PPU memory space).
|
||||
|
||||
The high nibble (0 or 1) selects between `chrrom0` and `chrrom1` segments.
|
||||
The low nibble L (0-$F) selects a 4K-aligned address in the segment ($L000).
|
||||
|
||||
#### `void set_vertical_mirroring()`
|
||||
|
||||
Switches nametable mirroring to vertical.
|
||||
|
||||
#### `void set_horizontal_mirroring()`
|
||||
|
||||
Switches nametable mirroring to horizontal.
|
||||
@@ -0,0 +1,53 @@
|
||||
[< back to index](../index.md)
|
||||
|
||||
## `stdio` module
|
||||
|
||||
The `stdio` module automatically imports the `string` module.
|
||||
It requires an implementation of `void putchar(byte a)` and therefore works only on targets with console output.
|
||||
|
||||
#### `void putstr(pointer str, byte len)`
|
||||
|
||||
Prints a string of length `len` located at address `str`.
|
||||
|
||||
#### `void putstrz(pointer str)`
|
||||
|
||||
Prints a null-terminated string located at address `str`.
|
||||
If the string is longer than 255 bytes, then the behaviour is undefined (might even crash).
|
||||
|
||||
## `string` module
|
||||
|
||||
#### `byte strzlen(pointer str)`
|
||||
|
||||
Calculates the length of a null-terminated string.
|
||||
If the string is longer than 255 bytes, then the behaviour is undefined (might even crash).
|
||||
|
||||
## `mouse` module
|
||||
|
||||
The `mouse` module automatically imports the `x_coord` module.
|
||||
|
||||
The module contains global variables representing the state of the mouse.
|
||||
If the program is not using any mouse driver, the state of these variables is undefined.
|
||||
|
||||
#### `x_coord mouse_x`
|
||||
|
||||
Mouse X position.
|
||||
|
||||
#### `byte mouse_y`
|
||||
|
||||
Mouse Y position.
|
||||
|
||||
#### `byte mouse_lbm`
|
||||
|
||||
1 if the left mouse button is being pressed, 0 otherwise
|
||||
|
||||
#### `byte mouse_rbm`
|
||||
|
||||
1 if the right mouse button is being pressed, 0 otherwise
|
||||
|
||||
## `x_coord` module
|
||||
|
||||
#### `alias x_coord`
|
||||
|
||||
The type for representing horizontal screen coordinates.
|
||||
It's `byte` if the screen is 256 pixels wide or less,
|
||||
or `word` if the screen is more that 256 pixels wide.
|
||||
@@ -0,0 +1,33 @@
|
||||
[< back to index](../index.md)
|
||||
|
||||
## `stdlib` module
|
||||
|
||||
The `stdlib` module is automatically imported on most targets.
|
||||
|
||||
#### `macro asm void poke(word const addr, byte a)`
|
||||
|
||||
Stores a byte at given constant address. Will not be optimized away by the optimizer.
|
||||
|
||||
#### `macro asm byte peek(word const addr)`
|
||||
|
||||
Reads a byte from given constant address. Will not be optimized away by the optimizer.
|
||||
|
||||
#### `macro asm void disable_irq()`
|
||||
|
||||
Disables interrupts.
|
||||
|
||||
#### `macro asm void enable_irq()`
|
||||
|
||||
Enables interrupts.
|
||||
|
||||
#### `byte hi_nibble_to_hex(byte a)`
|
||||
|
||||
Returns an ASCII representation of the upper nibble of the given byte.
|
||||
|
||||
#### `byte lo_nibble_to_hex(byte a)`
|
||||
|
||||
Returns an ASCII representation of the lower nibble of the given byte.
|
||||
|
||||
#### `macro asm void panic()`
|
||||
|
||||
Crashes the program.
|
||||
Reference in New Issue
Block a user