mirror of
https://github.com/irmen/prog8.git
synced 2024-10-25 00:24:16 +00:00
allow %option no_symbol_prefixing also on module scope
This commit is contained in:
parent
8ae435549d
commit
38a22fbc99
@ -1,9 +1,10 @@
|
|||||||
; Prog8 definitions for the Atari800XL
|
; Prog8 definitions for the Atari800XL
|
||||||
; Including memory registers, I/O registers, Basic and Kernal subroutines.
|
; Including memory registers, I/O registers, Basic and Kernal subroutines.
|
||||||
|
|
||||||
atari {
|
|
||||||
%option no_symbol_prefixing
|
%option no_symbol_prefixing
|
||||||
|
|
||||||
|
atari {
|
||||||
|
|
||||||
&uword NMI_VEC = $FFFA ; 6502 nmi vector, determined by the kernal if banked in
|
&uword NMI_VEC = $FFFA ; 6502 nmi vector, determined by the kernal if banked in
|
||||||
&uword RESET_VEC = $FFFC ; 6502 reset vector, determined by the kernal if banked in
|
&uword RESET_VEC = $FFFC ; 6502 reset vector, determined by the kernal if banked in
|
||||||
&uword IRQ_VEC = $FFFE ; 6502 interrupt vector, determined by the kernal if banked in
|
&uword IRQ_VEC = $FFFE ; 6502 interrupt vector, determined by the kernal if banked in
|
||||||
@ -20,8 +21,6 @@ atari {
|
|||||||
sys {
|
sys {
|
||||||
; ------- lowlevel system routines --------
|
; ------- lowlevel system routines --------
|
||||||
|
|
||||||
%option no_symbol_prefixing
|
|
||||||
|
|
||||||
const ubyte target = 8 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16, 8 = atari800XL
|
const ubyte target = 8 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16, 8 = atari800XL
|
||||||
|
|
||||||
asmsub init_system() {
|
asmsub init_system() {
|
||||||
@ -273,8 +272,6 @@ save_SCRATCH_ZPWORD2 .word 0
|
|||||||
}
|
}
|
||||||
|
|
||||||
cx16 {
|
cx16 {
|
||||||
%option no_symbol_prefixing
|
|
||||||
|
|
||||||
; the sixteen virtual 16-bit registers that the CX16 has defined in the zeropage
|
; the sixteen virtual 16-bit registers that the CX16 has defined in the zeropage
|
||||||
; they are simulated on the Atari as well but their location in memory is different
|
; they are simulated on the Atari as well but their location in memory is different
|
||||||
; TODO
|
; TODO
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
; Prog8 definitions for the Commodore-128
|
; Prog8 definitions for the Commodore-128
|
||||||
; Including memory registers, I/O registers, Basic and Kernal subroutines.
|
; Including memory registers, I/O registers, Basic and Kernal subroutines.
|
||||||
|
|
||||||
|
%option no_symbol_prefixing
|
||||||
|
|
||||||
cbm {
|
cbm {
|
||||||
; Commodore (CBM) common variables, vectors and kernal routines
|
; Commodore (CBM) common variables, vectors and kernal routines
|
||||||
%option no_symbol_prefixing
|
|
||||||
|
|
||||||
&ubyte TIME_HI = $a0 ; software jiffy clock, hi byte
|
&ubyte TIME_HI = $a0 ; software jiffy clock, hi byte
|
||||||
&ubyte TIME_MID = $a1 ; .. mid byte
|
&ubyte TIME_MID = $a1 ; .. mid byte
|
||||||
@ -141,7 +142,6 @@ sub CLEARST() {
|
|||||||
|
|
||||||
c64 {
|
c64 {
|
||||||
; C64 I/O registers (VIC, SID, CIA)
|
; C64 I/O registers (VIC, SID, CIA)
|
||||||
%option no_symbol_prefixing
|
|
||||||
|
|
||||||
; the default locations of the 8 sprite pointers (store address of sprite / 64)
|
; the default locations of the 8 sprite pointers (store address of sprite / 64)
|
||||||
&ubyte SPRPTR0 = 2040
|
&ubyte SPRPTR0 = 2040
|
||||||
@ -296,7 +296,6 @@ c64 {
|
|||||||
|
|
||||||
c128 {
|
c128 {
|
||||||
; ---- C128 specific registers ----
|
; ---- C128 specific registers ----
|
||||||
%option no_symbol_prefixing
|
|
||||||
|
|
||||||
&ubyte VM1 = $0A2C ; shadow for VUC $d018 in text mode
|
&ubyte VM1 = $0A2C ; shadow for VUC $d018 in text mode
|
||||||
&ubyte VM2 = $0A2D ; shadow for VIC $d018 in bitmap screen mode
|
&ubyte VM2 = $0A2D ; shadow for VIC $d018 in bitmap screen mode
|
||||||
@ -333,7 +332,6 @@ asmsub disable_basic() clobbers(A) {
|
|||||||
|
|
||||||
sys {
|
sys {
|
||||||
; ------- lowlevel system routines --------
|
; ------- lowlevel system routines --------
|
||||||
%option no_symbol_prefixing
|
|
||||||
|
|
||||||
const ubyte target = 128 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16.
|
const ubyte target = 128 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16.
|
||||||
|
|
||||||
@ -779,8 +777,6 @@ _longcopy
|
|||||||
}
|
}
|
||||||
|
|
||||||
cx16 {
|
cx16 {
|
||||||
%option no_symbol_prefixing
|
|
||||||
|
|
||||||
; the sixteen virtual 16-bit registers that the CX16 has defined in the zeropage
|
; the sixteen virtual 16-bit registers that the CX16 has defined in the zeropage
|
||||||
; they are simulated on the C128 as well but their location in memory is different
|
; they are simulated on the C128 as well but their location in memory is different
|
||||||
; (because there's no room for them in the zeropage)
|
; (because there's no room for them in the zeropage)
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
; Prog8 definitions for floating point handling on the Commodore-64
|
; Prog8 definitions for floating point handling on the Commodore-64
|
||||||
|
|
||||||
%option enable_floats
|
%option enable_floats, no_symbol_prefixing
|
||||||
%import floats_functions
|
%import floats_functions
|
||||||
|
|
||||||
floats {
|
floats {
|
||||||
; ---- this block contains C-64 floating point related functions ----
|
; ---- this block contains C-64 floating point related functions ----
|
||||||
%option no_symbol_prefixing
|
|
||||||
|
|
||||||
const float π = 3.141592653589793
|
const float π = 3.141592653589793
|
||||||
const float PI = π
|
const float PI = π
|
||||||
const float TWOPI = 2*π
|
const float TWOPI = 2*π
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
; Prog8 definitions for the Commodore-64
|
; Prog8 definitions for the Commodore-64
|
||||||
; Including memory registers, I/O registers, Basic and Kernal subroutines.
|
; Including memory registers, I/O registers, Basic and Kernal subroutines.
|
||||||
|
|
||||||
|
%option no_symbol_prefixing
|
||||||
|
|
||||||
cbm {
|
cbm {
|
||||||
|
|
||||||
; Commodore (CBM) common variables, vectors and kernal routines
|
; Commodore (CBM) common variables, vectors and kernal routines
|
||||||
|
|
||||||
%option no_symbol_prefixing
|
|
||||||
|
|
||||||
&ubyte TIME_HI = $a0 ; software jiffy clock, hi byte
|
&ubyte TIME_HI = $a0 ; software jiffy clock, hi byte
|
||||||
&ubyte TIME_MID = $a1 ; .. mid byte
|
&ubyte TIME_MID = $a1 ; .. mid byte
|
||||||
&ubyte TIME_LO = $a2 ; .. lo byte. Updated by IRQ every 1/60 sec
|
&ubyte TIME_LO = $a2 ; .. lo byte. Updated by IRQ every 1/60 sec
|
||||||
@ -142,8 +140,6 @@ sub CLEARST() {
|
|||||||
c64 {
|
c64 {
|
||||||
; C64 I/O registers (VIC, SID, CIA)
|
; C64 I/O registers (VIC, SID, CIA)
|
||||||
|
|
||||||
%option no_symbol_prefixing
|
|
||||||
|
|
||||||
; the default locations of the 8 sprite pointers (store address of sprite / 64)
|
; the default locations of the 8 sprite pointers (store address of sprite / 64)
|
||||||
; (depending on the VIC bank and screen ram address selection these can be shifted around though,
|
; (depending on the VIC bank and screen ram address selection these can be shifted around though,
|
||||||
; see the two routines after this for a dynamic way of determining the correct memory location)
|
; see the two routines after this for a dynamic way of determining the correct memory location)
|
||||||
@ -333,8 +329,6 @@ c64 {
|
|||||||
sys {
|
sys {
|
||||||
; ------- lowlevel system routines --------
|
; ------- lowlevel system routines --------
|
||||||
|
|
||||||
%option no_symbol_prefixing
|
|
||||||
|
|
||||||
const ubyte target = 64 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16.
|
const ubyte target = 64 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16.
|
||||||
|
|
||||||
|
|
||||||
@ -781,9 +775,6 @@ _longcopy
|
|||||||
}
|
}
|
||||||
|
|
||||||
cx16 {
|
cx16 {
|
||||||
|
|
||||||
%option no_symbol_prefixing
|
|
||||||
|
|
||||||
; the sixteen virtual 16-bit registers that the CX16 has defined in the zeropage
|
; the sixteen virtual 16-bit registers that the CX16 has defined in the zeropage
|
||||||
; they are simulated on the C64 as well but their location in memory is different
|
; they are simulated on the C64 as well but their location in memory is different
|
||||||
; (because there's no room for them in the zeropage in the default configuration)
|
; (because there's no room for them in the zeropage in the default configuration)
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
; Prog8 definitions for floating point handling on the CommanderX16
|
; Prog8 definitions for floating point handling on the CommanderX16
|
||||||
|
|
||||||
%option enable_floats
|
%option enable_floats, no_symbol_prefixing
|
||||||
%import floats_functions
|
%import floats_functions
|
||||||
|
|
||||||
floats {
|
floats {
|
||||||
; ---- this block contains C-64 compatible floating point related functions ----
|
; ---- this block contains C-64 compatible floating point related functions ----
|
||||||
|
|
||||||
%option no_symbol_prefixing
|
|
||||||
|
|
||||||
const float π = 3.141592653589793
|
const float π = 3.141592653589793
|
||||||
const float PI = π
|
const float PI = π
|
||||||
const float TWOPI = 2*π
|
const float TWOPI = 2*π
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
; Prog8 definitions for the CommanderX16
|
; Prog8 definitions for the CommanderX16
|
||||||
; Including memory registers, I/O registers, Basic and Kernal subroutines.
|
; Including memory registers, I/O registers, Basic and Kernal subroutines.
|
||||||
|
|
||||||
cbm {
|
%option no_symbol_prefixing
|
||||||
|
|
||||||
|
cbm {
|
||||||
; Commodore (CBM) common variables, vectors and kernal routines
|
; Commodore (CBM) common variables, vectors and kernal routines
|
||||||
|
|
||||||
%option no_symbol_prefixing
|
|
||||||
|
|
||||||
; STROUT --> use txt.print
|
; STROUT --> use txt.print
|
||||||
; CLEARSCR -> use txt.clear_screen
|
; CLEARSCR -> use txt.clear_screen
|
||||||
@ -94,8 +94,6 @@ sub CLEARST() {
|
|||||||
|
|
||||||
cx16 {
|
cx16 {
|
||||||
|
|
||||||
%option no_symbol_prefixing
|
|
||||||
|
|
||||||
; irq, system and hardware vectors:
|
; irq, system and hardware vectors:
|
||||||
&uword IERROR = $0300
|
&uword IERROR = $0300
|
||||||
&uword IMAIN = $0302
|
&uword IMAIN = $0302
|
||||||
@ -1168,12 +1166,9 @@ sub search_x16edit() -> ubyte {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sys {
|
sys {
|
||||||
; ------- lowlevel system routines --------
|
; ------- lowlevel system routines --------
|
||||||
|
|
||||||
%option no_symbol_prefixing
|
|
||||||
|
|
||||||
const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16.
|
const ubyte target = 16 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16.
|
||||||
|
|
||||||
asmsub init_system() {
|
asmsub init_system() {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
; Experimental Vera FX support.
|
; Somewhat experimental Vera FX support.
|
||||||
; Docs:
|
; Docs:
|
||||||
; https://github.com/X16Community/x16-docs/blob/master/VERA%20FX%20Reference.md
|
; https://github.com/X16Community/x16-docs/blob/master/VERA%20FX%20Reference.md
|
||||||
; https://docs.google.com/document/d/1q34uWOiM3Be2pnaHRVgSdHySI-qsiQWPTo_gfE54PTg/edit
|
; https://docs.google.com/document/d/1q34uWOiM3Be2pnaHRVgSdHySI-qsiQWPTo_gfE54PTg/edit
|
||||||
|
@ -2,9 +2,10 @@
|
|||||||
; Including memory registers, I/O registers, Basic and Kernal subroutines.
|
; Including memory registers, I/O registers, Basic and Kernal subroutines.
|
||||||
; see: https://www.pagetable.com/?p=926 , http://www.zimmers.net/cbmpics/cbm/PETx/petmem.txt
|
; see: https://www.pagetable.com/?p=926 , http://www.zimmers.net/cbmpics/cbm/PETx/petmem.txt
|
||||||
|
|
||||||
|
%option no_symbol_prefixing
|
||||||
|
|
||||||
cbm {
|
cbm {
|
||||||
; Commodore (CBM) common variables, vectors and kernal routines
|
; Commodore (CBM) common variables, vectors and kernal routines
|
||||||
%option no_symbol_prefixing
|
|
||||||
|
|
||||||
&ubyte TIME_HI = $8d ; software jiffy clock, hi byte
|
&ubyte TIME_HI = $8d ; software jiffy clock, hi byte
|
||||||
&ubyte TIME_MID = $8e ; .. mid byte
|
&ubyte TIME_MID = $8e ; .. mid byte
|
||||||
@ -79,7 +80,6 @@ asmsub RDTIM16() clobbers(X) -> uword @AY {
|
|||||||
|
|
||||||
sys {
|
sys {
|
||||||
; ------- lowlevel system routines --------
|
; ------- lowlevel system routines --------
|
||||||
%option no_symbol_prefixing
|
|
||||||
|
|
||||||
const ubyte target = 32 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16, 32=PET
|
const ubyte target = 32 ; compilation target specifier. 64 = C64, 128 = C128, 16 = CommanderX16, 32=PET
|
||||||
|
|
||||||
@ -364,8 +364,6 @@ save_SCRATCH_ZPWORD2 .word 0
|
|||||||
}
|
}
|
||||||
|
|
||||||
cx16 {
|
cx16 {
|
||||||
%option no_symbol_prefixing
|
|
||||||
|
|
||||||
; the sixteen virtual 16-bit registers that the CX16 has defined in the zeropage
|
; the sixteen virtual 16-bit registers that the CX16 has defined in the zeropage
|
||||||
; they are simulated on the PET as well but their location in memory is different
|
; they are simulated on the PET as well but their location in memory is different
|
||||||
; (because there's no room for them in the zeropage)
|
; (because there's no room for them in the zeropage)
|
||||||
|
@ -856,7 +856,7 @@ internal class AstChecker(private val program: Program,
|
|||||||
err("using an option that is not valid for blocks")
|
err("using an option that is not valid for blocks")
|
||||||
}
|
}
|
||||||
if(directive.parent is Module) {
|
if(directive.parent is Module) {
|
||||||
if(directive.args.any {it.name !in arrayOf("enable_floats", "no_sysinit", "splitarrays")})
|
if(directive.args.any {it.name !in arrayOf("enable_floats", "no_sysinit", "splitarrays", "no_symbol_prefixing")})
|
||||||
err("using an option that is not valid for modules")
|
err("using an option that is not valid for modules")
|
||||||
}
|
}
|
||||||
if(directive.args.any { it.name=="verafxmuls" } && compilerOptions.compTarget.name != Cx16Target.NAME)
|
if(directive.args.any { it.name=="verafxmuls" } && compilerOptions.compTarget.name != Cx16Target.NAME)
|
||||||
|
@ -164,7 +164,7 @@ class IntermediateAstMaker(private val program: Program, private val errors: IEr
|
|||||||
var alignment = PtBlock.BlockAlignment.NONE
|
var alignment = PtBlock.BlockAlignment.NONE
|
||||||
var forceOutput = false
|
var forceOutput = false
|
||||||
var veraFxMuls = false
|
var veraFxMuls = false
|
||||||
var noSymbolPrefixing = false
|
var noSymbolPrefixing = "no_symbol_prefixing" in srcBlock.definingModule.options()
|
||||||
val directives = srcBlock.statements.filterIsInstance<Directive>()
|
val directives = srcBlock.statements.filterIsInstance<Directive>()
|
||||||
for (directive in directives.filter { it.directive == "%option" }) {
|
for (directive in directives.filter { it.directive == "%option" }) {
|
||||||
for (arg in directive.args) {
|
for (arg in directive.args) {
|
||||||
|
@ -145,8 +145,9 @@ Directives
|
|||||||
Warning: if you use this to align array variables in the block, these have to be initialized with a value to make them stay in the block and get aligned properly. Otherwise they'll end up at a random spot in the BSS section and the alignment doesn't apply there.
|
Warning: if you use this to align array variables in the block, these have to be initialized with a value to make them stay in the block and get aligned properly. Otherwise they'll end up at a random spot in the BSS section and the alignment doesn't apply there.
|
||||||
- ``merge`` (in a block) will merge this block's contents into an already existing block with the same name. Useful in library scenarios. Can result in a bunch of unused symbol warnings, this depends on the import order.
|
- ``merge`` (in a block) will merge this block's contents into an already existing block with the same name. Useful in library scenarios. Can result in a bunch of unused symbol warnings, this depends on the import order.
|
||||||
- ``splitarrays`` (block or module) makes all word-arrays in this scope lsb/msb split arrays (as if they all have the @split tag). See Arrays.
|
- ``splitarrays`` (block or module) makes all word-arrays in this scope lsb/msb split arrays (as if they all have the @split tag). See Arrays.
|
||||||
- ``no_symbol_prefixing`` (block) makes the compiler *not* use symbol-prefixing when translating prog8 code into assembly.
|
- ``no_symbol_prefixing`` (block or module) makes the compiler *not* use symbol-prefixing when translating prog8 code into assembly.
|
||||||
Only use this if you know what you're doing because it could result in invalid assembly code being generated.
|
Only use this if you know what you're doing because it could result in invalid assembly code being generated.
|
||||||
|
It can be useful when writing library modules that you don't want to be exposing prefixed assembly symbols.
|
||||||
- ``verafxmuls`` (block, cx16 target only) uses Vera FX hardware word multiplication on the CommanderX16 for all word multiplications in this block. Warning: this may interfere with IRQs and other Vera operations, so use this only when you know what you're doing. It's safer to explicitly use ``verafx.muls()``.
|
- ``verafxmuls`` (block, cx16 target only) uses Vera FX hardware word multiplication on the CommanderX16 for all word multiplications in this block. Warning: this may interfere with IRQs and other Vera operations, so use this only when you know what you're doing. It's safer to explicitly use ``verafx.muls()``.
|
||||||
|
|
||||||
.. data:: %encoding <encodingname>
|
.. data:: %encoding <encodingname>
|
||||||
|
Loading…
Reference in New Issue
Block a user