mirror of
https://github.com/irmen/prog8.git
synced 2024-11-23 07:32:10 +00:00
remove eval stack from documentation
This commit is contained in:
parent
41af63b333
commit
4784f1c65a
@ -56,9 +56,7 @@ Both systems have ways to alter the memory map and/or to switch memory banks, bu
|
||||
Footnotes for the Commander X16
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
*Golden Ram $0400 - $07FF*
|
||||
*reserved:* $0700 - $07FF (expression evaluation stack)
|
||||
|
||||
*free to use:* $0400 - $06FF
|
||||
*free to use.*
|
||||
|
||||
*Zero Page $0000 - $00FF*
|
||||
$00 and $01 are hardwired as Rom and Ram banking registers.
|
||||
@ -76,10 +74,8 @@ Footnotes for the Commodore 64
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
*RAM $C000-$CFFF*
|
||||
*reserved:* $CF00 - $CFFF (expression evaluation stack)
|
||||
*this includes:* $CF00 - $CF20 for the 16 virtual cx16 registers R0-R15
|
||||
|
||||
*free to use:* $C000 - $CEFF
|
||||
*free to use:* $C000 - $CFDF
|
||||
*reserved:* $CFE0 - $CFFF for the 16 virtual cx16 registers R0-R15
|
||||
|
||||
*Zero Page $0000 - $00FF*
|
||||
Consider the full zero page to be reserved for use by the Kernal and Basic in normal operation.
|
||||
@ -127,8 +123,6 @@ Directly Usable Registers
|
||||
|
||||
The hardware CPU registers are not directly accessible from regular Prog8 code.
|
||||
If you need to mess with them, you'll have to use inline assembly.
|
||||
Be extra wary of the ``X`` register because it is used as an evaluation stack pointer and
|
||||
changing its value you will destroy the evaluation stack and likely crash the program.
|
||||
|
||||
The status register (P) carry flag and interrupt disable flag can be written via a couple of special
|
||||
builtin functions (``set_carry()``, ``clear_carry()``, ``set_irqd()``, ``clear_irqd()``),
|
||||
|
@ -44,28 +44,6 @@ All elements in scoped names such as ``main.routine.var1`` are prefixed so this
|
||||
}}
|
||||
|
||||
|
||||
Software stack for expression evaluation
|
||||
----------------------------------------
|
||||
|
||||
Prog8 uses a software stack to evaluate complex expressions that it can't calculate in-place or
|
||||
directly into the target variable, register, or memory location.
|
||||
|
||||
'software stack' means: seperated and not using the processor's hardware stack.
|
||||
|
||||
The software stack is implemented as follows:
|
||||
|
||||
- 2*128 bytes = 1 page of memory allocated for this, exact locations vary per machine target.
|
||||
For the C64 this page is at $cf00-$cfff.
|
||||
For the Commander X16 it is at $0700-$07ff (top of the "golden ram" area).
|
||||
This default location can be overridden using the `-esa` command line option.
|
||||
- these are the high and low bytes of the values on the stack (it's a 'split 16 bit word stack')
|
||||
- for byte values just the lsb page is used, for word values both pages
|
||||
- float values (5 bytes) are chopped up into 2 words and 1 byte on this stack.
|
||||
- the X register is permanently allocated to be the stack pointer in the software stack.
|
||||
- you can use the X register as long as you're not using the software stack.
|
||||
But you *must* make sure it is saved and restored after the code that modifies it,
|
||||
otherwise the evaluation stack gets corrupted.
|
||||
|
||||
Subroutine Calling Convention
|
||||
-----------------------------
|
||||
|
||||
@ -94,8 +72,7 @@ regular subroutines
|
||||
^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
- subroutine parameters are just variables scoped to the subroutine.
|
||||
- the arguments passed in a call are evaluated (using the eval-stack if needed) and then
|
||||
copied into those variables.
|
||||
- the arguments passed in a call are evaluated and then copied into those variables.
|
||||
Using variables for this sometimes can seem inefficient but it's required to allow subroutines to work locally
|
||||
with their parameters and allow them to modify them as required, without changing the
|
||||
variables used in the call's arguments. If you want to get rid of this overhead you'll
|
||||
|
@ -1,7 +1,6 @@
|
||||
TODO
|
||||
====
|
||||
|
||||
- (branch): clean up docs about eval stack and X register
|
||||
- (branch): fix optimizeCmpSequence in AsmOptimizer
|
||||
- (branch): fix inplaceModification TODO in AugmentableAssignmentAsmGen
|
||||
- (branch): fix up cx16/keyboardhandler.p8 X register shenanigans
|
||||
@ -56,16 +55,6 @@ Libraries:
|
||||
- actually implement modes 3 and perhaps even 2 to gfx2 (lores 16 color and 4 color)
|
||||
|
||||
|
||||
Expressions:
|
||||
|
||||
- Once the evalstack-free expression codegen is in place, the Eval Stack can be removed from the compiler.
|
||||
Machinedefinition, .p8 and .asm library files, all routines operationg on estack, and everything saving/restoring the X register related to this stack.
|
||||
- Or rewrite expression tree evaluation such that it doesn't use an eval stack but flatten the tree into linear code
|
||||
that, for instance, uses a fixed number of predetermined value 'variables'?
|
||||
The VM IL solves this already (by using unlimited registers) but that still lacks a translation to 6502.
|
||||
- this removes the need for the BinExprSplitter? (which is problematic and very limited now)
|
||||
and perhaps the assignment splitting in BeforeAsmAstChanger too
|
||||
|
||||
Optimizations:
|
||||
|
||||
- VariableAllocator: can we think of a smarter strategy for allocating variables into zeropage, rather than first-come-first-served?
|
||||
|
Loading…
Reference in New Issue
Block a user