Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Syntax: mp <inputfile>.pas [options]

-ipath:<folder> Add the folder <folder> to the unit include path
-define:<symbol> Define the symbol <symbol>
-cpu:<cpu> Specify the CPU mode: 6502 (default), 65c02, 65816
-target:<platform> Specify the target platform: a8 (default), c4p, c64, neo, raw, x16
-cpu:<cpu> Specify the CPU mode: 6502 (default), 65c02, 65816
-code:<address> Specify the memory start address for the code
-data:<address> Specify the memory start address for variables and arrays
-stack:<address> Specify the memory start address for the software stack (64 bytes required)
Expand All @@ -16,7 +16,11 @@ Syntax: mp <inputfile>.pas [options]
```

The unit include path must contain the **Mad-Pascal** folder `lib` which contains the standard Pascal libraries.
Additional optional standard libraries are in the `blib`, `dlib` and `wlib` folders.
During startup, **Mad-Pascal** looks for the `lib` folder in the same folder that also contains the **Mad-Pascal** executable.
If the `lib` is not found, it will try again with the first and second parent folders.
This way, you do not have to specify the `-ipath` parameter when using the standard folder structure.
Additional optional standard libraries are in the `blib`, `dlib`, and `wlib` folders.
They must be added explicitly using the `-ipath` parameter if they are required.

mp.exe example.pas -ipath:<MadPascalPath>\lib -ipath:<MadPascalPath>\blib

Expand All @@ -30,16 +34,16 @@ The `-target` option supports the following values for the target platform:

The `-diag` option activates the generation of an additional `*.txt` file with information about all used variables, procedures, and functions.

The default output file name is `<inputfile>.a65`. It must be assembled using **Mad-Assembler**. The assembler include path must contain the **Mad-Pascal** assembler base folder using, for example:
The default output file name is `<inputfile>.a65`. It must be assembled using **Mad-Assembler**. The assembler include path must contain the **Mad-Pascal** assembler base folder, using, for example:

mads example.a65 -x -i:<MadPascalPath>\base

Using the `-x` option to **Exclude unreferenced procedures** is mandatory. It ensures that only the used parts of the libraries are compiled and the resulting **MOS 6502** object code has the minimum size.
Using the `-x` option to **Exclude unreferenced procedures** is mandatory. It ensures that only the used parts of the libraries are compiled, and the resulting **MOS 6502** object code has the minimum size.

## Exit Codes

0 = No errors occurred, the output files were created correctly
2 = Errors occurred, and compiling was aborted
3 = Wrong parameters were specified, and compiling was not started
2 = Errors occurred, and compilation was aborted
3 = Wrong parameters were specified, and compilation was not started

Warning messages issued by **Mad-Pascal** do not affect the exit code.