forked from TCShenanigans/symphony_stdlib
Added support for global variables. This requires including `start.asm` as the first code. This includes a `jmp` to 0x100 for user code, and a magic number that modules can check to verify th the user has correctly reserved the space. The magic number is 0xb301534c: * This has the high bit set so is not a valid instruction * On builds that ignore the high bit this decodes to `nor zr, zr, 0x534c` a no-op. * The immediate is "SL" for standardl ibrary. Due to a bug start pads with U... 0, instead of @addr. `start.asm` also initialises `sp` so it start just below the 64KiB LUT memory alocation. Added some error codes for the upcoming graphics module.
36 lines
1.6 KiB
Markdown
36 lines
1.6 KiB
Markdown
# Contributing
|
|
|
|
## Code of Conduct
|
|
Be nice, we are all just doing this to have fun
|
|
|
|
## General rules
|
|
- All text (names, comments, etc.) has to be in English
|
|
- You are responsible for ensuring that you have the rights for us to use the code you contribute to the project
|
|
- follow the guidelines, for code, documentation, etc.
|
|
- all code has to work with the standard symphony ISA
|
|
|
|
## Documenting Functions
|
|
All functions in the standard library should follow the following outline:
|
|
```
|
|
; <description>
|
|
; Arguments: <which register contains what argument>
|
|
; Result: <what is the result, and where is it stored>
|
|
; Clobbers: <list of registers that are clobbered>
|
|
; Globals: <list of globals are accessed. OPTIONAL>
|
|
<label>: <;SHOULD BE INLINED>
|
|
<CODE>
|
|
|
|
```
|
|
|
|
Functions should be in the appropriate asm file, if you are unsure where functionality fits make a seperate file and ask in the pull request
|
|
Functions that are provided for convenience/reference but should be inlined in production code should be marked with `;SHOULD BE INLINED` after their label.
|
|
|
|
If the function returns a status code in flags, the preamble should list all it might return.
|
|
|
|
## Globals
|
|
|
|
Any function that uses global variables should document this in the preamble comment, see above.
|
|
|
|
A file/module should check on intialisation that the address `globals.MAGIC_ADDRESS` contains the 16 bit value `globals.MAGIC_VALUE`, to ensure that the user has properly included [[src/start.asm]] and reservered the global variable area.
|
|
|
|
No opinion is offered on whether modules can assume globals variables are initialised to zero. |