This commit is contained in:
Irmen de Jong 2019-01-08 02:25:22 +01:00
parent 0146a39ebb
commit 58854ef45b
3 changed files with 42 additions and 14 deletions

View File

@ -320,7 +320,14 @@ Initial values across multiple runs of the program
When declaring values with an initial value, this value will be set into the variable each time
the program reaches the declaration again. This can be in loops, multiple subroutine calls,
or even multiple invocations of the entire program.
or even multiple invocations of the entire program. If you omit an initial value, it will
be set to zero only for the first run of the program. A second run will utilize the last value
where it left off (but your code will be a bit smaller because no initialization instructions
are generated)
.. warning::
this behavior may change in a future version so that subsequent runs always
use the same initial values
This only works for simple types, *and not for string variables and arrays*.
It is assumed these are left unchanged by the program.

View File

@ -108,9 +108,9 @@ Directives
For a module option, only the ``enable_floats`` option is recognised, which will tell the compiler
to deal with floating point numbers (by using various subroutines from the Commodore-64 kernal).
Otherwise, floating point support is not enabled.
When used in a block with the ``force_output`` option, it will force the block to be outputted
in the final program. Can be useful to make sure some
data is generated that would otherwise be discarded because it's not referenced (such as sprite data).
When used in a block with the ``force_output`` option, it will force the block to be outputted
in the final program. Can be useful to make sure some
data is generated that would otherwise be discarded because it's not referenced (such as sprite data).
.. data:: %asmbinary "<filename>" [, <offset>[, <length>]]
@ -370,7 +370,7 @@ arithmetic: ``+`` ``-`` ``*`` ``/`` ``//`` ``**`` ``%``
bitwise arithmetic: ``&`` ``|`` ``^`` ``~`` ``<<`` ``>>``
``&`` is bitwise and, ``|`` is bitwise or, ``^`` is bitwise xor, ``~`` is bitwise invert (this one is an unary operator)
``&`` is bitwise and, ``|`` is bitwise or, ``^`` is bitwise xor, ``~`` is bitwise invert (this one is an unary operator)
``<<`` is bitwise left shift and ``>>`` is bitwise right shift (both will not change the datatype of the value)
assignment: ``=``

View File

@ -2,15 +2,6 @@
TODO
====
### Macros
@todo macros are meta-code that is executed by the compiler, in a preprecessing step
during the compilation, and can produce output that is then replaced on that point in the input source.
Allows us to create pre calculated sine tables and such.
Memory Block Operations
^^^^^^^^^^^^^^^^^^^^^^^
@ -26,6 +17,7 @@ Memory Block Operations
these should call (or emit inline) optimized pieces of assembly code, so they run as fast as possible
At least we have memcopy() already and some screen related routines in asm
Bitmap Definition (for Sprites and Characters)
@ -36,4 +28,33 @@ to define CHARACTERS (8x8 monochrome or 4x8 multicolor = 8 bytes)
and SPRITES (24x21 monochrome or 12x21 multicolor = 63 bytes)
--> PLACE in memory on correct address (base+sprite pointer, 64-byte aligned)
--> actually not needed because a block at the correct address, and an array using 3x21 binary values, more or less does exactly this already::
~ spritedata $0a00 {
; this memory block contains the sprite data
; it must start on an address aligned to 64 bytes.
%option force_output ; make sure the data in this block appears in the resulting program
ubyte[63] balloonsprite = [ %00000000,%01111111,%00000000,
%00000001,%11111111,%11000000,
%00000011,%11111111,%11100000,
%00000011,%11100011,%11100000,
%00000111,%11011100,%11110000,
%00000111,%11011101,%11110000,
%00000111,%11011100,%11110000,
%00000011,%11100011,%11100000,
%00000011,%11111111,%11100000,
%00000011,%11111111,%11100000,
%00000010,%11111111,%10100000,
%00000001,%01111111,%01000000,
%00000001,%00111110,%01000000,
%00000000,%10011100,%10000000,
%00000000,%10011100,%10000000,
%00000000,%01001001,%00000000,
%00000000,%01001001,%00000000,
%00000000,%00111110,%00000000,
%00000000,%00111110,%00000000,
%00000000,%00111110,%00000000,
%00000000,%00011100,%00000000 ]
}