2018-04-02 22:21:26 +00:00
[< back to index ](../index.md )
2017-12-06 23:23:30 +00:00
# Getting started
## Hello world example
2017-12-06 23:37:57 +00:00
Save the following as `hello_world.mfk` :
2017-12-06 23:23:30 +00:00
```
import stdio
array hello_world = "hello world" petscii
void main(){
putstr(hello_world, hello_world.length)
while(true){}
}
```
Compile is using the following commandline:
```
2018-01-24 16:47:20 +00:00
java -jar millfork.jar hello_world.mfk -o hello_world -t c64 -I path_to_millfork\include
2017-12-06 23:23:30 +00:00
```
Run the output executable (here using the VICE emulator):
```
x64 hello_world.prg
```
## Basic commandline usage
The following options are crucial when compiling your sources:
2018-06-04 14:24:18 +00:00
* `-o FILENAME` – specifies the base name for your output file, an appropriate file extension will be appended (`prg` for Commodore, `xex` for Atari, `a2` for Apple, `asm` for assembly output, `lbl` for label file, `inf` for BBC file metadata)
2017-12-06 23:23:30 +00:00
* `-I DIR;DIR;DIR;...` – specifies the paths to directories with modules to include.
2018-01-18 21:35:25 +00:00
* `-t PLATFORM` – specifies the target platform (`c64` is the default). Each platform is defined in an `.ini` file in the include directory. For the list of supported platforms, see [Supported platforms ](target-platforms.md )
2017-12-06 23:23:30 +00:00
You may be also interested in the following:
2018-06-04 14:24:18 +00:00
* `-O` , `-O2` , `-O3` , `-O4` – enable optimization (various levels)
2017-12-06 23:23:30 +00:00
2018-02-27 12:26:56 +00:00
* `--inline` – automatically inline functions for better optimization
2017-12-06 23:23:30 +00:00
* `-s` – additionally generate assembly output
* `-g` – additionally generate a label file, in format compatible with VICE emulator
* `-r PROGRAM` – automatically launch given program after successful compilation
* `-Wall` – enable all warnings
2018-01-04 00:15:04 +00:00
* `--help` – list all commandline options