Skip to content

Commit

Permalink
chore(*): add comment for asm files and hirom
Browse files Browse the repository at this point in the history
  • Loading branch information
alekmaul committed Apr 8, 2024
1 parent d7f26e5 commit 983292c
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions wiki/HiRom-and-FastRom.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,27 @@ TCC compiler was changed to have some small functions that inyect .BASE directiv

To use HiRom, you must specify it inside your makefile
```bash
export HIROM=1
HIROM=1
```

To use FastRom, you must specify it inside your makefile
```bash
export FASTROM=1
FASTROM=1
```

If you are allocating a RAM variable inside an assembly file, you will need to reset the **.base** to **0** before the **.ramsection** or else the memory will be allocated to the wrong bank.

For example, without the **.base 0**, the memory could be erroniously allocated to bank **$be** if **.base** is **$40** (SlowRom HiRom) or **$13e** if **.base** is **$c0** (FastRom HiRom).

```bash
.base 0
.ramsection "asm_vars" BANK $7e SLOT 2
asm_variable: dw
.ends
```

You will need to restore **.base** to **$80/$40/$c0** (depending on the mapping) if you add code or data after the **.ramsection**.

# memory_mapping example to help you with coding

In this example, all the source code are in the **src** directory. It consists of only one file **memory_mapping.c**.
Expand Down

0 comments on commit 983292c

Please sign in to comment.