mirror of
https://github.com/KarolS/millfork.git
synced 2025-04-06 20:37:12 +00:00
Update documentation
This commit is contained in:
parent
43e75276df
commit
7635fc256f
@ -2,6 +2,8 @@
|
||||
|
||||
## Current version
|
||||
|
||||
* Preliminary experimental Game Boy support.
|
||||
|
||||
* Added `memory_barrier` macro.
|
||||
|
||||
* Added `random` module.
|
||||
@ -12,6 +14,8 @@
|
||||
|
||||
* Added hint for identifiers with typos.
|
||||
|
||||
* Aliases now also support subfields.
|
||||
|
||||
* 6502: Fixed optimizations using index registers.
|
||||
|
||||
* Fixed volatile-related bugs.
|
||||
|
@ -36,6 +36,8 @@ For binary releases, see: https://github.com/KarolS/millfork/releases
|
||||
* CP/M
|
||||
|
||||
* Atari 2600 (experimental)
|
||||
|
||||
* Game Boy (experimental)
|
||||
|
||||
* inline assembly
|
||||
|
||||
|
@ -53,6 +53,8 @@
|
||||
|
||||
* [NES-only modules](stdlib/nes.md)
|
||||
|
||||
* [Game Boy–only modules](stdlib/gb.md)
|
||||
|
||||
## Implementation details
|
||||
|
||||
* [Variable storage](abi/variable-storage.md)
|
||||
|
@ -7,7 +7,7 @@
|
||||
Original 6502 processors accidentally supported a bunch of extra undocumented instructions.
|
||||
Millfork can emit them if so desired.
|
||||
|
||||
## Mnemonics
|
||||
#### Mnemonics
|
||||
|
||||
Since various assemblers use different mnemonics for undocumented opcodes,
|
||||
Millfork supports multiple mnemonics per opcode. The default one is given first:
|
||||
@ -55,7 +55,7 @@ but Millfork can distinguish between them and the NMOS illegal instructions base
|
||||
|
||||
\*\* AXS is also used for SAX in some assemblers. Millfork interprets AXS based on the addressing mode.
|
||||
|
||||
## Generation
|
||||
#### Generation
|
||||
|
||||
In order for the compiler to emit one of those opcodes,
|
||||
an appropriate CPU architecture must be chosen (`nmos` or `ricoh`)
|
||||
|
22
docs/api/gb-programming-guide.md
Normal file
22
docs/api/gb-programming-guide.md
Normal file
@ -0,0 +1,22 @@
|
||||
[< back to index](../index.md)
|
||||
|
||||
# Game Boy programming guide
|
||||
|
||||
**This guide is incomplete.
|
||||
Support for Game Boy targets is experimental and all information in this document may become obsolete.**
|
||||
|
||||
## Program lifecycle
|
||||
|
||||
The default Game Boy vectors are defined as following:
|
||||
|
||||
The minimal Game Boy program thus looks like this:
|
||||
|
||||
void main() {
|
||||
// initialize things
|
||||
while(true) { }
|
||||
}
|
||||
|
||||
void on_vblank() {
|
||||
// do things
|
||||
}
|
||||
|
@ -78,6 +78,10 @@ The compiler emits tape images.
|
||||
|
||||
* `zxspectrum_8080` – Sinclair ZX Spectrum 48k, using only Intel 8080 instructions
|
||||
|
||||
* `gb_small` – a tiny 32K Game Boy program. (experimental)
|
||||
The compiler emits GB files.
|
||||
Read [the Game Boy programming guide](./gb-programming-guide.md) for more info.
|
||||
|
||||
* `cpm` – CP/M on Intel 8080.
|
||||
The compiler emits COM files.
|
||||
|
||||
|
@ -18,7 +18,7 @@ The goal of Millfork is to succeed where Atalan failed.
|
||||
Large programs in Millfork have been developed for Commodore 64.
|
||||
|
||||
Millfork was also tested (via emulators) to run trivial programs on other 8-bit Commodore computers,
|
||||
Atari 8-bit computers, Apple II, BBC Micro, ZX Spectrum 48k, NEC PC-88, CP/M, NES, and Atari 2600.
|
||||
Atari 8-bit computers, Apple II, BBC Micro, ZX Spectrum 48k, NEC PC-88, CP/M, NES, Game Boy and Atari 2600.
|
||||
|
||||
Support for other devices using supported processors can be easily added, usually without even modifying the compiler.
|
||||
|
||||
|
@ -53,6 +53,8 @@
|
||||
|
||||
* [NES-only modules](stdlib/nes.md)
|
||||
|
||||
* [Game Boy–only modules](stdlib/gb.md)
|
||||
|
||||
## Implementation details
|
||||
|
||||
* [Variable storage](abi/variable-storage.md)
|
||||
|
@ -52,7 +52,7 @@ Since most automatic variables will be overwritten by the inner call, the functi
|
||||
In all other cases, the recursive call may cause undefined behaviour.
|
||||
|
||||
The easiest, but suboptimal way to make a function recursion-safe is to make all local variables stack-allocated
|
||||
and assigning all parameters to variables as soon as possible. This is slow though, so don't do it unless really necessary.
|
||||
and assign all parameters to variables as soon as possible. This is slow though, so don't do it unless really necessary.
|
||||
|
||||
## Interrupt safety
|
||||
|
||||
|
@ -119,6 +119,10 @@ If the declared size and the size deduced from the `<initial_values>` don't matc
|
||||
* on 6502, it means that the array will not cross a page boundary
|
||||
* on Z80, it means that the array will not cross a page boundary
|
||||
|
||||
* `<address>` is a constant expression that defines where in the memory the array is or will be located.
|
||||
|
||||
* `<initial_values>` is an array literal, see [Literals](./literals.md)
|
||||
|
||||
TODO
|
||||
|
||||
### Function declarations
|
||||
@ -305,6 +309,7 @@ continue <variable>
|
||||
|
||||
### `asm` statements
|
||||
|
||||
See [Using assembly within Millfork programs](./assembly.md).
|
||||
See [Using 6502 assembly within Millfork programs](./assembly.md)
|
||||
or [Using 8080/LR35902/Z80 assembly within Millfork programs](./assemblyz80.md).
|
||||
|
||||
|
38
docs/stdlib/gb.md
Normal file
38
docs/stdlib/gb.md
Normal file
@ -0,0 +1,38 @@
|
||||
[< back to index](../index.md)
|
||||
|
||||
# Game Boy–oriented modules
|
||||
|
||||
## gb_hardware
|
||||
|
||||
The `gb_hardware` module is imported automatically on Game Boy targets.
|
||||
|
||||
TODO
|
||||
|
||||
## gb_header_small
|
||||
|
||||
The `gb_header_small` module is imported automatically on small Game Boy targets.
|
||||
It contains the default header for 32K Game Boy programs.
|
||||
|
||||
## gb_joy
|
||||
|
||||
Provides an interface for reading joypads that is compatible with the `joy` module.
|
||||
|
||||
#### `alias input_a = input_btn`
|
||||
|
||||
1 if A button pressed, 0 id not pressed.
|
||||
|
||||
#### `byte input_b`
|
||||
|
||||
1 if B button pressed, 0 id not pressed.
|
||||
|
||||
#### `byte input_select`
|
||||
|
||||
1 if Select button pressed, 0 id not pressed.
|
||||
|
||||
#### `byte input_start`
|
||||
|
||||
1 if Start button pressed, 0 id not pressed.
|
||||
|
||||
#### `void read_joy()`
|
||||
|
||||
Reads the joypad.
|
Loading…
x
Reference in New Issue
Block a user