From b82e445a3e7811d9492b66353f83f336d4ab76bc Mon Sep 17 00:00:00 2001 From: simon987 Date: Thu, 30 Jul 2020 19:44:45 -0400 Subject: [PATCH] Document sections --- Assembler-directives.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Assembler-directives.md b/Assembler-directives.md index 5c6e519..7735241 100644 --- a/Assembler-directives.md +++ b/Assembler-directives.md @@ -125,8 +125,15 @@ someBigStaticMemoryBlock: DW 100 DUP(0x20), 0 It can only be used in combination with the `DW` directive ## Sections -// TODO +Sections are useful to organize your code. +There is currently two section, `.text` and `.data`. By default, the .data section implicitly starts at the beginning of your code and ends where the `.text` section starts, but you are allowed to reorder them as you wish. You must explicitly specify where the `.text` section starts. + +At the beginning of each tick, your code is executed starting at the first instruction after the `.text` directive until it reaches the `BRK` instruction (See [Execution cycle](https://github.com/simon987/Much-Assembly-Required/wiki/CPU#execution-cycle). + +Notes: +* There is nothing stopping you from executing code in the `.data` section (or to store variables in the `.text` section) +* There is no padding in between sections ## ORG