mirror of
https://github.com/irmen/prog8.git
synced 2024-11-25 19:31:36 +00:00
docs about new asm symbol prefixes
This commit is contained in:
parent
6bc079c7b7
commit
66d939df0d
@ -38,6 +38,7 @@ class AsmGen6502(val prefixSymbols: Boolean): ICodeGeneratorBackend {
|
|||||||
is PtBlock -> node.name = "p8b_${node.name}"
|
is PtBlock -> node.name = "p8b_${node.name}"
|
||||||
is PtLabel -> node.name = "p8l_${node.name}"
|
is PtLabel -> node.name = "p8l_${node.name}"
|
||||||
is PtVariable, is PtConstant, is PtMemMapped, is PtSubroutineParameter -> node.name = "p8v_${node.name}"
|
is PtVariable, is PtConstant, is PtMemMapped, is PtSubroutineParameter -> node.name = "p8v_${node.name}"
|
||||||
|
else -> node.name = "p8_${node.name}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ class CallGraph(private val program: Program) : IAstVisitor {
|
|||||||
return allIdentifiersAndTargets.filter { decl===it.value }.map{ it.key }
|
return allIdentifiersAndTargets.filter { decl===it.value }.map{ it.key }
|
||||||
}
|
}
|
||||||
|
|
||||||
private val prefixes = listOf("p8_", "p8b_", "p8v_", "p8s_", "p8l_", "")
|
private val prefixes = listOf("p8b_", "p8v_", "p8s_", "p8l_", "p8_", "")
|
||||||
private fun nameInAssemblyCode(name: String): Boolean {
|
private fun nameInAssemblyCode(name: String): Boolean {
|
||||||
return allAssemblyNodes.any {
|
return allAssemblyNodes.any {
|
||||||
prefixes.any { prefix -> prefix+name in it.names }
|
prefixes.any { prefix -> prefix+name in it.names }
|
||||||
|
@ -32,16 +32,21 @@ Symbol prefixing in generated Assembly code
|
|||||||
|
|
||||||
*All* symbols in the prog8 program will be prefixed in the generated assembly code:
|
*All* symbols in the prog8 program will be prefixed in the generated assembly code:
|
||||||
|
|
||||||
Block names
|
============ ========
|
||||||
will be prefixed with ``p8b_``
|
Element type prefix
|
||||||
All other names
|
============ ========
|
||||||
will be prefixed with ``p8_``
|
Block ``p8b_``
|
||||||
|
Subroutine ``p8s_``
|
||||||
|
Variable ``p8v_``
|
||||||
|
Label ``p8l_``
|
||||||
|
other ``p8_``
|
||||||
|
============ ========
|
||||||
|
|
||||||
This is to avoid naming conflicts with CPU registers, assembly instructions, etc.
|
This is to avoid naming conflicts with CPU registers, assembly instructions, etc.
|
||||||
So if you're referencing symbols from the prog8 program in inlined assembly code, you have to take
|
So if you're referencing symbols from the prog8 program in inlined assembly code, you have to take
|
||||||
this into account. Stick a ``p8_`` in front of everything (``p8b_`` for block names) that you want to reference that is coming
|
this into account. Stick the proper prefix in front of every symbol name component that you want to reference that is coming
|
||||||
from a prog8 source file.
|
from a prog8 source file.
|
||||||
All elements in scoped names such as ``main.routine.var1`` are prefixed so this becomes ``p8b_main.p8_routine.p8_var1``.
|
All elements in scoped names such as ``main.routine.var1`` are prefixed so this becomes ``p8b_main.p8s_routine.p8v_var1``.
|
||||||
|
|
||||||
.. attention::
|
.. attention::
|
||||||
Symbols from library modules are *not* prefixed and can be used
|
Symbols from library modules are *not* prefixed and can be used
|
||||||
|
@ -2,9 +2,6 @@
|
|||||||
TODO
|
TODO
|
||||||
====
|
====
|
||||||
|
|
||||||
- also change asm subroutine and variable prefixes from `p8_` to `p8s_` / `p8v_` and be done with it once and for all.
|
|
||||||
|
|
||||||
|
|
||||||
- verafx vram-vram copy routine?
|
- verafx vram-vram copy routine?
|
||||||
set the cache fill and cache write bits in fx ctrl, set one data port's increment to 1 and the other one to 4,
|
set the cache fill and cache write bits in fx ctrl, set one data port's increment to 1 and the other one to 4,
|
||||||
Assuming your writes are aligned to 32-bit boundaries, do four reads from the increment-1 port
|
Assuming your writes are aligned to 32-bit boundaries, do four reads from the increment-1 port
|
||||||
|
Loading…
Reference in New Issue
Block a user