mirror of
https://github.com/irmen/prog8.git
synced 2024-11-26 11:49:22 +00:00
docs
This commit is contained in:
parent
548721e306
commit
f2c62bee7e
@ -106,7 +106,7 @@ class TestCodegen: FunSpec({
|
|||||||
Files.deleteIfExists(Path("${result.name}.asm"))
|
Files.deleteIfExists(Path("${result.name}.asm"))
|
||||||
}
|
}
|
||||||
|
|
||||||
test("64tass assembler available? - if this fails you need to install 64tass in the path") {
|
test("64tass assembler available? - if this fails you need to install 64tass version 1.58 or newer in the path") {
|
||||||
val command = mutableListOf("64tass", "--version")
|
val command = mutableListOf("64tass", "--version")
|
||||||
shouldNotThrowAny {
|
shouldNotThrowAny {
|
||||||
val proc = ProcessBuilder(command).start()
|
val proc = ProcessBuilder(command).start()
|
||||||
|
@ -8,6 +8,12 @@ Porting Guide
|
|||||||
Here is a guide for porting Prog8 to other compilation targets.
|
Here is a guide for porting Prog8 to other compilation targets.
|
||||||
Answers to the questions below are used to configure the new target and supporting libraries.
|
Answers to the questions below are used to configure the new target and supporting libraries.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
The assembly code that prog8 generates is not suitable to be put into ROM. (It contains
|
||||||
|
embedded variables, and self-modifying code).
|
||||||
|
If the target system is designed to run programs from ROM, and has just a little bit of RAM
|
||||||
|
intended for variables, prog8 is likely not a feasible language for such a system right now.
|
||||||
|
|
||||||
|
|
||||||
CPU
|
CPU
|
||||||
---
|
---
|
||||||
@ -17,8 +23,8 @@ CPU
|
|||||||
Memory Map
|
Memory Map
|
||||||
----------
|
----------
|
||||||
|
|
||||||
zeropage
|
Zeropage
|
||||||
=========
|
========
|
||||||
#. *Absolute requirement:* Provide three times 2 consecutive bytes (i.e. three 16-bit pointers) in the zeropage that are free to use at all times.
|
#. *Absolute requirement:* Provide three times 2 consecutive bytes (i.e. three 16-bit pointers) in the zeropage that are free to use at all times.
|
||||||
#. Provide list of any additional free zeropage locations for a normal running system (BASIC + Kernal enabled)
|
#. Provide list of any additional free zeropage locations for a normal running system (BASIC + Kernal enabled)
|
||||||
#. Provide list of any additional free zeropage locations when BASIC is off, but floating point routines should still work
|
#. Provide list of any additional free zeropage locations when BASIC is off, but floating point routines should still work
|
||||||
@ -33,11 +39,11 @@ RAM, ROM, I/O
|
|||||||
|
|
||||||
#. what part(s) of the address space is RAM? What parts of the RAM can be used by user programs?
|
#. what part(s) of the address space is RAM? What parts of the RAM can be used by user programs?
|
||||||
#. what is the usual starting memory address of programs?
|
#. what is the usual starting memory address of programs?
|
||||||
#. what is the best place to put a page (256 bytes total) of scratch area data in RAM?
|
|
||||||
#. what part(s) of the address space is ROM?
|
#. what part(s) of the address space is ROM?
|
||||||
#. what part(s) of the address space is memory mapped I/O registers?
|
#. what part(s) of the address space is memory mapped I/O registers?
|
||||||
#. is there a block of "high ram" available (ram that is not the main ram used to load programs in) that could be used for variables?
|
#. is there a block of "high ram" available (ram that is not the main ram used to load programs in) that could be used for variables?
|
||||||
#. is there a banking system? How does it work (how do you select Ram/Rom banks)? How is the default bank configuration set?
|
#. is there a banking system? How does it work (how do you select Ram/Rom banks)? How is the default bank configuration set?
|
||||||
|
Note that prog8 itself has no notion of banking, but this knowledge may be required for proper system initialization.
|
||||||
|
|
||||||
Character encodings
|
Character encodings
|
||||||
-------------------
|
-------------------
|
||||||
@ -57,8 +63,7 @@ The more the merrier.
|
|||||||
|
|
||||||
Floating point
|
Floating point
|
||||||
==============
|
==============
|
||||||
Prog8 supports floating point math *if* the target system has floating point math routines in ROM.
|
Prog8 can support floating point math *if* the target system has floating point math routines in ROM. If that is the case:
|
||||||
If the machine has this:
|
|
||||||
|
|
||||||
#. what is the binary representation format of the floating point numbers? (how many bytes, how the bits are set up)
|
#. what is the binary representation format of the floating point numbers? (how many bytes, how the bits are set up)
|
||||||
#. what are the valid minimum negative and maximum positive floating point values?
|
#. what are the valid minimum negative and maximum positive floating point values?
|
||||||
@ -71,11 +76,10 @@ The most important libraries are ``syslib`` and ``textio``.
|
|||||||
``syslib`` *has* to provide several system level functions such as how to initialize the machine to a sane state,
|
``syslib`` *has* to provide several system level functions such as how to initialize the machine to a sane state,
|
||||||
and how to warm reset it, etc.
|
and how to warm reset it, etc.
|
||||||
``textio`` contains the text output and input routines, it's very welcome if they are implemented also for
|
``textio`` contains the text output and input routines, it's very welcome if they are implemented also for
|
||||||
the new target system.
|
the new target system. But not required.
|
||||||
|
|
||||||
There are several other support libraries that you may want to port (``diskio``, ``graphics`` to name a few).
|
There are several other support libraries that you may want to port (``diskio``, ``graphics`` to name a few).
|
||||||
|
|
||||||
Also of course if there are unique things available on the new target system, don't hesitate to provide
|
Also of course if there are unique things available on the new target system, don't hesitate to provide
|
||||||
extensions to the ``syslib`` or perhaps a new special custom library altogether.
|
extensions to the ``syslib`` or perhaps a new special custom library altogether.
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
TODO
|
TODO
|
||||||
====
|
====
|
||||||
|
|
||||||
|
- add a mechanism to put the original p8 source lines into the generated assembly as comments (not only the line numbers).
|
||||||
|
- add a mechanism to pass the original p8 source lines into the p8ir file as comments. Remove the position xml tags.
|
||||||
|
|
||||||
- IR: reduce the number of branch instructions such as BEQ, BEQR, etc (gradually), replace with CMP(I) + status branch instruction
|
- IR: reduce the number of branch instructions such as BEQ, BEQR, etc (gradually), replace with CMP(I) + status branch instruction
|
||||||
- IR: reduce amount of CMP/CMPI after instructions that set the status bits correctly (LOADs? INC? etc), but only after setting the status bits is verified!
|
- IR: reduce amount of CMP/CMPI after instructions that set the status bits correctly (LOADs? INC? etc), but only after setting the status bits is verified!
|
||||||
|
|
||||||
|
@ -1,23 +1,16 @@
|
|||||||
%import textio
|
%import textio
|
||||||
|
|
||||||
main {
|
main {
|
||||||
ubyte[2] data = [100, 100]
|
const ubyte ATTR_FALLING=$04
|
||||||
uword dRef = &data
|
const ubyte ATTRF_EATABLE=$80
|
||||||
|
|
||||||
sub start() {
|
sub start() {
|
||||||
dRef[0]--
|
void test(10,20)
|
||||||
dRef[1]++
|
|
||||||
|
|
||||||
cx16.r0L = 0
|
|
||||||
cx16.r1L = 1
|
|
||||||
dRef[cx16.r0L]--
|
|
||||||
dRef[cx16.r1L]++
|
|
||||||
|
|
||||||
txt.print_ub(data[0])
|
|
||||||
txt.spc()
|
|
||||||
txt.print_ub(data[1])
|
|
||||||
|
|
||||||
repeat {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ubyte[10] attributes
|
||||||
|
|
||||||
|
sub test(ubyte tattr, ubyte tobject) -> bool {
|
||||||
|
return tattr&ATTR_FALLING==0 and attributes[tobject]&ATTRF_EATABLE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user