Merge branch 'refs/heads/master' into structs

# Conflicts:
#	examples/test.p8
This commit is contained in:
Irmen de Jong
2025-06-18 17:53:20 +02:00
17 changed files with 611 additions and 26 deletions

View File

@@ -998,6 +998,7 @@ cx16 {
&uword r14 = $1bfc &uword r14 = $1bfc
&uword r15 = $1bfe &uword r15 = $1bfe
; signed word versions
&word r0s = $1be0 &word r0s = $1be0
&word r1s = $1be2 &word r1s = $1be2
&word r2s = $1be4 &word r2s = $1be4
@@ -1015,6 +1016,7 @@ cx16 {
&word r14s = $1bfc &word r14s = $1bfc
&word r15s = $1bfe &word r15s = $1bfe
; ubyte versions (low and high bytes)
&ubyte r0L = $1be0 &ubyte r0L = $1be0
&ubyte r1L = $1be2 &ubyte r1L = $1be2
&ubyte r2L = $1be4 &ubyte r2L = $1be4
@@ -1049,6 +1051,7 @@ cx16 {
&ubyte r14H = $1bfd &ubyte r14H = $1bfd
&ubyte r15H = $1bff &ubyte r15H = $1bff
; signed byte versions (low and high bytes)
&byte r0sL = $1be0 &byte r0sL = $1be0
&byte r1sL = $1be2 &byte r1sL = $1be2
&byte r2sL = $1be4 &byte r2sL = $1be4
@@ -1083,6 +1086,42 @@ cx16 {
&byte r14sH = $1bfd &byte r14sH = $1bfd
&byte r15sH = $1bff &byte r15sH = $1bff
; boolean versions (low and high bytes)
&bool r0bL = $1be0
&bool r1bL = $1be2
&bool r2bL = $1be4
&bool r3bL = $1be6
&bool r4bL = $1be8
&bool r5bL = $1bea
&bool r6bL = $1bec
&bool r7bL = $1bee
&bool r8bL = $1bf0
&bool r9bL = $1bf2
&bool r10bL = $1bf4
&bool r11bL = $1bf6
&bool r12bL = $1bf8
&bool r13bL = $1bfa
&bool r14bL = $1bfc
&bool r15bL = $1bfe
&bool r0bH = $1be1
&bool r1bH = $1be3
&bool r2bH = $1be5
&bool r3bH = $1be7
&bool r4bH = $1be9
&bool r5bH = $1beb
&bool r6bH = $1bed
&bool r7bH = $1bef
&bool r8bH = $1bf1
&bool r9bH = $1bf3
&bool r10bH = $1bf5
&bool r11bH = $1bf7
&bool r12bH = $1bf9
&bool r13bH = $1bfb
&bool r14bH = $1bfd
&bool r15bH = $1bff
asmsub save_virtual_registers() clobbers(A,Y) { asmsub save_virtual_registers() clobbers(A,Y) {
%asm {{ %asm {{
ldy #31 ldy #31

View File

@@ -1020,6 +1020,7 @@ cx16 {
&uword r14 = $cffc &uword r14 = $cffc
&uword r15 = $cffe &uword r15 = $cffe
; signed word versions
&word r0s = $cfe0 &word r0s = $cfe0
&word r1s = $cfe2 &word r1s = $cfe2
&word r2s = $cfe4 &word r2s = $cfe4
@@ -1037,6 +1038,7 @@ cx16 {
&word r14s = $cffc &word r14s = $cffc
&word r15s = $cffe &word r15s = $cffe
; ubyte versions (low and high bytes)
&ubyte r0L = $cfe0 &ubyte r0L = $cfe0
&ubyte r1L = $cfe2 &ubyte r1L = $cfe2
&ubyte r2L = $cfe4 &ubyte r2L = $cfe4
@@ -1071,6 +1073,7 @@ cx16 {
&ubyte r14H = $cffd &ubyte r14H = $cffd
&ubyte r15H = $cfff &ubyte r15H = $cfff
; signed byte versions (low and high bytes)
&byte r0sL = $cfe0 &byte r0sL = $cfe0
&byte r1sL = $cfe2 &byte r1sL = $cfe2
&byte r2sL = $cfe4 &byte r2sL = $cfe4
@@ -1105,6 +1108,42 @@ cx16 {
&byte r14sH = $cffd &byte r14sH = $cffd
&byte r15sH = $cfff &byte r15sH = $cfff
; boolean versions
&bool r0bL = $cfe0
&bool r1bL = $cfe2
&bool r2bL = $cfe4
&bool r3bL = $cfe6
&bool r4bL = $cfe8
&bool r5bL = $cfea
&bool r6bL = $cfec
&bool r7bL = $cfee
&bool r8bL = $cff0
&bool r9bL = $cff2
&bool r10bL = $cff4
&bool r11bL = $cff6
&bool r12bL = $cff8
&bool r13bL = $cffa
&bool r14bL = $cffc
&bool r15bL = $cffe
&bool r0bH = $cfe1
&bool r1bH = $cfe3
&bool r2bH = $cfe5
&bool r3bH = $cfe7
&bool r4bH = $cfe9
&bool r5bH = $cfeb
&bool r6bH = $cfed
&bool r7bH = $cfef
&bool r8bH = $cff1
&bool r9bH = $cff3
&bool r10bH = $cff5
&bool r11bH = $cff7
&bool r12bH = $cff9
&bool r13bH = $cffb
&bool r14bH = $cffd
&bool r15bH = $cfff
asmsub save_virtual_registers() clobbers(A,Y) { asmsub save_virtual_registers() clobbers(A,Y) {
%asm {{ %asm {{
ldy #31 ldy #31

View File

@@ -177,6 +177,7 @@ cx16 {
&uword r14 = $001e &uword r14 = $001e
&uword r15 = $0020 &uword r15 = $0020
; signed word versions
&word r0s = $0002 &word r0s = $0002
&word r1s = $0004 &word r1s = $0004
&word r2s = $0006 &word r2s = $0006
@@ -194,6 +195,7 @@ cx16 {
&word r14s = $001e &word r14s = $001e
&word r15s = $0020 &word r15s = $0020
; ubyte versions (low and high bytes)
&ubyte r0L = $0002 &ubyte r0L = $0002
&ubyte r1L = $0004 &ubyte r1L = $0004
&ubyte r2L = $0006 &ubyte r2L = $0006
@@ -228,6 +230,7 @@ cx16 {
&ubyte r14H = $001f &ubyte r14H = $001f
&ubyte r15H = $0021 &ubyte r15H = $0021
; signed byte versions (low and high bytes)
&byte r0sL = $0002 &byte r0sL = $0002
&byte r1sL = $0004 &byte r1sL = $0004
&byte r2sL = $0006 &byte r2sL = $0006
@@ -262,6 +265,42 @@ cx16 {
&byte r14sH = $001f &byte r14sH = $001f
&byte r15sH = $0021 &byte r15sH = $0021
; boolean versions
&bool r0bL = $0002
&bool r1bL = $0004
&bool r2bL = $0006
&bool r3bL = $0008
&bool r4bL = $000a
&bool r5bL = $000c
&bool r6bL = $000e
&bool r7bL = $0010
&bool r8bL = $0012
&bool r9bL = $0014
&bool r10bL = $0016
&bool r11bL = $0018
&bool r12bL = $001a
&bool r13bL = $001c
&bool r14bL = $001e
&bool r15bL = $0020
&bool r0bH = $0003
&bool r1bH = $0005
&bool r2bH = $0007
&bool r3bH = $0009
&bool r4bH = $000b
&bool r5bH = $000d
&bool r6bH = $000f
&bool r7bH = $0011
&bool r8bH = $0013
&bool r9bH = $0015
&bool r10bH = $0017
&bool r11bH = $0019
&bool r12bH = $001b
&bool r13bH = $001d
&bool r14bH = $001f
&bool r15bH = $0021
; VERA registers ; VERA registers
const uword VERA_BASE = $9F20 const uword VERA_BASE = $9F20

View File

@@ -533,6 +533,7 @@ cx16 {
&uword r14 = $7ffc &uword r14 = $7ffc
&uword r15 = $7ffe &uword r15 = $7ffe
; signed word versions
&word r0s = $7fe0 &word r0s = $7fe0
&word r1s = $7fe2 &word r1s = $7fe2
&word r2s = $7fe4 &word r2s = $7fe4
@@ -550,6 +551,7 @@ cx16 {
&word r14s = $7ffc &word r14s = $7ffc
&word r15s = $7ffe &word r15s = $7ffe
; ubyte versions (low and high bytes)
&ubyte r0L = $7fe0 &ubyte r0L = $7fe0
&ubyte r1L = $7fe2 &ubyte r1L = $7fe2
&ubyte r2L = $7fe4 &ubyte r2L = $7fe4
@@ -584,6 +586,7 @@ cx16 {
&ubyte r14H = $7ffd &ubyte r14H = $7ffd
&ubyte r15H = $7fff &ubyte r15H = $7fff
; signed byte versions (low and high bytes)
&byte r0sL = $7fe0 &byte r0sL = $7fe0
&byte r1sL = $7fe2 &byte r1sL = $7fe2
&byte r2sL = $7fe4 &byte r2sL = $7fe4
@@ -618,6 +621,42 @@ cx16 {
&byte r14sH = $7ffd &byte r14sH = $7ffd
&byte r15sH = $7fff &byte r15sH = $7fff
; boolean versions
&bool r0bL = $7fe0
&bool r1bL = $7fe2
&bool r2bL = $7fe4
&bool r3bL = $7fe6
&bool r4bL = $7fe8
&bool r5bL = $7fea
&bool r6bL = $7fec
&bool r7bL = $7fee
&bool r8bL = $7ff0
&bool r9bL = $7ff2
&bool r10bL = $7ff4
&bool r11bL = $7ff6
&bool r12bL = $7ff8
&bool r13bL = $7ffa
&bool r14bL = $7ffc
&bool r15bL = $7ffe
&bool r0bH = $7fe1
&bool r1bH = $7fe3
&bool r2bH = $7fe5
&bool r3bH = $7fe7
&bool r4bH = $7fe9
&bool r5bH = $7feb
&bool r6bH = $7fed
&bool r7bH = $7fef
&bool r8bH = $7ff1
&bool r9bH = $7ff3
&bool r10bH = $7ff5
&bool r11bH = $7ff7
&bool r12bH = $7ff9
&bool r13bH = $7ffb
&bool r14bH = $7ffd
&bool r15bH = $7fff
asmsub save_virtual_registers() clobbers(A,Y) { asmsub save_virtual_registers() clobbers(A,Y) {
%asm {{ %asm {{
ldy #31 ldy #31

View File

@@ -267,6 +267,7 @@ cx16 {
&uword r14 = $ff1e &uword r14 = $ff1e
&uword r15 = $ff20 &uword r15 = $ff20
; signed word versions
&word r0s = $ff02 &word r0s = $ff02
&word r1s = $ff04 &word r1s = $ff04
&word r2s = $ff06 &word r2s = $ff06
@@ -284,6 +285,7 @@ cx16 {
&word r14s = $ff1e &word r14s = $ff1e
&word r15s = $ff20 &word r15s = $ff20
; ubyte versions (low and high bytes)
&ubyte r0L = $ff02 &ubyte r0L = $ff02
&ubyte r1L = $ff04 &ubyte r1L = $ff04
&ubyte r2L = $ff06 &ubyte r2L = $ff06
@@ -318,6 +320,7 @@ cx16 {
&ubyte r14H = $ff1f &ubyte r14H = $ff1f
&ubyte r15H = $ff21 &ubyte r15H = $ff21
; signed byte versions (low and high bytes)
&byte r0sL = $ff02 &byte r0sL = $ff02
&byte r1sL = $ff04 &byte r1sL = $ff04
&byte r2sL = $ff06 &byte r2sL = $ff06
@@ -352,6 +355,42 @@ cx16 {
&byte r14sH = $ff1f &byte r14sH = $ff1f
&byte r15sH = $ff21 &byte r15sH = $ff21
; boolean versions
&bool r0bL = $ff02
&bool r1bL = $ff04
&bool r2bL = $ff06
&bool r3bL = $ff08
&bool r4bL = $ff0a
&bool r5bL = $ff0c
&bool r6bL = $ff0e
&bool r7bL = $ff10
&bool r8bL = $ff12
&bool r9bL = $ff14
&bool r10bL = $ff16
&bool r11bL = $ff18
&bool r12bL = $ff1a
&bool r13bL = $ff1c
&bool r14bL = $ff1e
&bool r15bL = $ff20
&bool r0bH = $ff03
&bool r1bH = $ff05
&bool r2bH = $ff07
&bool r3bH = $ff09
&bool r4bH = $ff0b
&bool r5bH = $ff0d
&bool r6bH = $ff0f
&bool r7bH = $ff11
&bool r8bH = $ff13
&bool r9bH = $ff15
&bool r10bH = $ff17
&bool r11bH = $ff19
&bool r12bH = $ff1b
&bool r13bH = $ff1d
&bool r14bH = $ff1f
&bool r15bH = $ff21
sub save_virtual_registers() { sub save_virtual_registers() {
uword[32] storage uword[32] storage
storage[0] = r0 storage[0] = r0

View File

@@ -17,9 +17,7 @@ import prog8.code.ast.*
import prog8.code.core.BaseDataType import prog8.code.core.BaseDataType
import prog8.code.core.DataType import prog8.code.core.DataType
import prog8.code.core.Position import prog8.code.core.Position
import prog8.code.target.C64Target import prog8.code.target.*
import prog8.code.target.Cx16Target
import prog8.code.target.VMTarget
import prog8tests.helpers.ErrorReporterForTests import prog8tests.helpers.ErrorReporterForTests
import prog8tests.helpers.compileText import prog8tests.helpers.compileText
@@ -1058,6 +1056,42 @@ main {
compileText(VMTarget(), optimize=false, src, outputDir, writeAssembly=true) shouldNotBe null compileText(VMTarget(), optimize=false, src, outputDir, writeAssembly=true) shouldNotBe null
} }
test("using the cx16 virtual registers as various datatypes") {
val src="""
main {
sub start() {
uword uw = 9999
word sw = -2222
ubyte ub = 42
byte sb = -99
bool bb = true
cx16.r0 = uw
cx16.r0s = sw
cx16.r0L = ub
cx16.r0H = ub
cx16.r0sL = sb
cx16.r0sH = sb
cx16.r0bL = bb
cx16.r0bH = bb
uw = cx16.r0
sw = cx16.r0s
ub = cx16.r0L
ub = cx16.r0H
sb = cx16.r0sL
sb = cx16.r0sH
bb = cx16.r0bL
bb = cx16.r0bH
}
}"""
compileText(Cx16Target(), optimize=false, src, outputDir, writeAssembly=false) shouldNotBe null
compileText(VMTarget(), optimize=false, src, outputDir, writeAssembly=false) shouldNotBe null
compileText(C64Target(), optimize=false, src, outputDir, writeAssembly=false) shouldNotBe null
compileText(PETTarget(), optimize=false, src, outputDir, writeAssembly=false) shouldNotBe null
compileText(C128Target(), optimize=false, src, outputDir, writeAssembly=false) shouldNotBe null
}
test("on..goto") { test("on..goto") {
val src=""" val src="""

View File

@@ -1,6 +1,5 @@
Prog8 compiler v11.4-SNAPSHOT by Irmen de Jong (irmen@razorvine.net) Prog8 compiler v11.4 by Irmen de Jong (irmen@razorvine.net)
Prerelease version from git commit a87f2640 in branch master
This software is licensed under the GNU GPL 3.0, see https://www.gnu.org/licenses/gpl.html This software is licensed under the GNU GPL 3.0, see https://www.gnu.org/licenses/gpl.html
Compiling program import-all-c128.p8 Compiling program import-all-c128.p8
@@ -109,7 +108,6 @@ LIBRARY MODULE NAME: coroutines
coroutines { coroutines {
const ubyte MAX_TASKS const ubyte MAX_TASKS
ubyte active_task ubyte active_task
uword[] returnaddresses
uword supervisor uword supervisor
uword[] tasklist uword[] tasklist
uword[] userdatas uword[] userdatas
@@ -238,6 +236,7 @@ strings {
copy (uword source @R0, uword target @AY) -> clobbers (A) -> ubyte @Y copy (uword source @R0, uword target @AY) -> clobbers (A) -> ubyte @Y
endswith (str st, str suffix) -> bool endswith (str st, str suffix) -> bool
find (uword string @AY, ubyte character @X) -> ubyte @A, bool @Pc find (uword string @AY, ubyte character @X) -> ubyte @A, bool @Pc
find_eol (uword string @AY) -> ubyte @A, bool @Pc
findstr (str haystack, str needle) -> ubyte findstr (str haystack, str needle) -> ubyte
hash (str string @AY) -> ubyte @A hash (str string @AY) -> ubyte @A
isdigit (ubyte petsciichar @A) -> bool @Pc isdigit (ubyte petsciichar @A) -> bool @Pc
@@ -529,6 +528,7 @@ sys {
exit (ubyte returnvalue @A) exit (ubyte returnvalue @A)
exit2 (ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) exit2 (ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y)
exit3 (ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) exit3 (ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc)
get_as_returnaddress (uword address @XY) -> uword @AX
internal_stringcopy (uword source @R0, uword target @AY) -> clobbers (A,Y) internal_stringcopy (uword source @R0, uword target @AY) -> clobbers (A,Y)
irqsafe_clear_irqd () irqsafe_clear_irqd ()
irqsafe_set_irqd () irqsafe_set_irqd ()
@@ -561,6 +561,8 @@ cx16 {
&uword r0 &uword r0
&ubyte r0H &ubyte r0H
&ubyte r0L &ubyte r0L
&bool r0bH
&bool r0bL
&word r0s &word r0s
&byte r0sH &byte r0sH
&byte r0sL &byte r0sL
@@ -568,89 +570,119 @@ cx16 {
&uword r10 &uword r10
&ubyte r10H &ubyte r10H
&ubyte r10L &ubyte r10L
&bool r10bH
&bool r10bL
&word r10s &word r10s
&byte r10sH &byte r10sH
&byte r10sL &byte r10sL
&uword r11 &uword r11
&ubyte r11H &ubyte r11H
&ubyte r11L &ubyte r11L
&bool r11bH
&bool r11bL
&word r11s &word r11s
&byte r11sH &byte r11sH
&byte r11sL &byte r11sL
&uword r12 &uword r12
&ubyte r12H &ubyte r12H
&ubyte r12L &ubyte r12L
&bool r12bH
&bool r12bL
&word r12s &word r12s
&byte r12sH &byte r12sH
&byte r12sL &byte r12sL
&uword r13 &uword r13
&ubyte r13H &ubyte r13H
&ubyte r13L &ubyte r13L
&bool r13bH
&bool r13bL
&word r13s &word r13s
&byte r13sH &byte r13sH
&byte r13sL &byte r13sL
&uword r14 &uword r14
&ubyte r14H &ubyte r14H
&ubyte r14L &ubyte r14L
&bool r14bH
&bool r14bL
&word r14s &word r14s
&byte r14sH &byte r14sH
&byte r14sL &byte r14sL
&uword r15 &uword r15
&ubyte r15H &ubyte r15H
&ubyte r15L &ubyte r15L
&bool r15bH
&bool r15bL
&word r15s &word r15s
&byte r15sH &byte r15sH
&byte r15sL &byte r15sL
&ubyte r1H &ubyte r1H
&ubyte r1L &ubyte r1L
&bool r1bH
&bool r1bL
&word r1s &word r1s
&byte r1sH &byte r1sH
&byte r1sL &byte r1sL
&uword r2 &uword r2
&ubyte r2H &ubyte r2H
&ubyte r2L &ubyte r2L
&bool r2bH
&bool r2bL
&word r2s &word r2s
&byte r2sH &byte r2sH
&byte r2sL &byte r2sL
&uword r3 &uword r3
&ubyte r3H &ubyte r3H
&ubyte r3L &ubyte r3L
&bool r3bH
&bool r3bL
&word r3s &word r3s
&byte r3sH &byte r3sH
&byte r3sL &byte r3sL
&uword r4 &uword r4
&ubyte r4H &ubyte r4H
&ubyte r4L &ubyte r4L
&bool r4bH
&bool r4bL
&word r4s &word r4s
&byte r4sH &byte r4sH
&byte r4sL &byte r4sL
&uword r5 &uword r5
&ubyte r5H &ubyte r5H
&ubyte r5L &ubyte r5L
&bool r5bH
&bool r5bL
&word r5s &word r5s
&byte r5sH &byte r5sH
&byte r5sL &byte r5sL
&uword r6 &uword r6
&ubyte r6H &ubyte r6H
&ubyte r6L &ubyte r6L
&bool r6bH
&bool r6bL
&word r6s &word r6s
&byte r6sH &byte r6sH
&byte r6sL &byte r6sL
&uword r7 &uword r7
&ubyte r7H &ubyte r7H
&ubyte r7L &ubyte r7L
&bool r7bH
&bool r7bL
&word r7s &word r7s
&byte r7sH &byte r7sH
&byte r7sL &byte r7sL
&uword r8 &uword r8
&ubyte r8H &ubyte r8H
&ubyte r8L &ubyte r8L
&bool r8bH
&bool r8bL
&word r8s &word r8s
&byte r8sH &byte r8sH
&byte r8sL &byte r8sL
&uword r9 &uword r9
&ubyte r9H &ubyte r9H
&ubyte r9L &ubyte r9L
&bool r9bH
&bool r9bL
&word r9s &word r9s
&byte r9sH &byte r9sH
&byte r9sL &byte r9sL

View File

@@ -1,6 +1,5 @@
Prog8 compiler v11.4-SNAPSHOT by Irmen de Jong (irmen@razorvine.net) Prog8 compiler v11.4 by Irmen de Jong (irmen@razorvine.net)
Prerelease version from git commit a87f2640 in branch master
This software is licensed under the GNU GPL 3.0, see https://www.gnu.org/licenses/gpl.html This software is licensed under the GNU GPL 3.0, see https://www.gnu.org/licenses/gpl.html
Compiling program import-all-c64.p8 Compiling program import-all-c64.p8
@@ -109,7 +108,6 @@ LIBRARY MODULE NAME: coroutines
coroutines { coroutines {
const ubyte MAX_TASKS const ubyte MAX_TASKS
ubyte active_task ubyte active_task
uword[] returnaddresses
uword supervisor uword supervisor
uword[] tasklist uword[] tasklist
uword[] userdatas uword[] userdatas
@@ -365,6 +363,7 @@ strings {
copy (uword source @R0, uword target @AY) -> clobbers (A) -> ubyte @Y copy (uword source @R0, uword target @AY) -> clobbers (A) -> ubyte @Y
endswith (str st, str suffix) -> bool endswith (str st, str suffix) -> bool
find (uword string @AY, ubyte character @X) -> ubyte @A, bool @Pc find (uword string @AY, ubyte character @X) -> ubyte @A, bool @Pc
find_eol (uword string @AY) -> ubyte @A, bool @Pc
findstr (str haystack, str needle) -> ubyte findstr (str haystack, str needle) -> ubyte
hash (str string @AY) -> ubyte @A hash (str string @AY) -> ubyte @A
isdigit (ubyte petsciichar @A) -> bool @Pc isdigit (ubyte petsciichar @A) -> bool @Pc
@@ -658,6 +657,7 @@ sys {
exit (ubyte returnvalue @A) exit (ubyte returnvalue @A)
exit2 (ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) exit2 (ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y)
exit3 (ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) exit3 (ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc)
get_as_returnaddress (uword address @XY) -> uword @AX
internal_stringcopy (uword source @R0, uword target @AY) -> clobbers (A,Y) internal_stringcopy (uword source @R0, uword target @AY) -> clobbers (A,Y)
irqsafe_clear_irqd () irqsafe_clear_irqd ()
irqsafe_set_irqd () irqsafe_set_irqd ()
@@ -690,6 +690,8 @@ cx16 {
&uword r0 &uword r0
&ubyte r0H &ubyte r0H
&ubyte r0L &ubyte r0L
&bool r0bH
&bool r0bL
&word r0s &word r0s
&byte r0sH &byte r0sH
&byte r0sL &byte r0sL
@@ -697,89 +699,119 @@ cx16 {
&uword r10 &uword r10
&ubyte r10H &ubyte r10H
&ubyte r10L &ubyte r10L
&bool r10bH
&bool r10bL
&word r10s &word r10s
&byte r10sH &byte r10sH
&byte r10sL &byte r10sL
&uword r11 &uword r11
&ubyte r11H &ubyte r11H
&ubyte r11L &ubyte r11L
&bool r11bH
&bool r11bL
&word r11s &word r11s
&byte r11sH &byte r11sH
&byte r11sL &byte r11sL
&uword r12 &uword r12
&ubyte r12H &ubyte r12H
&ubyte r12L &ubyte r12L
&bool r12bH
&bool r12bL
&word r12s &word r12s
&byte r12sH &byte r12sH
&byte r12sL &byte r12sL
&uword r13 &uword r13
&ubyte r13H &ubyte r13H
&ubyte r13L &ubyte r13L
&bool r13bH
&bool r13bL
&word r13s &word r13s
&byte r13sH &byte r13sH
&byte r13sL &byte r13sL
&uword r14 &uword r14
&ubyte r14H &ubyte r14H
&ubyte r14L &ubyte r14L
&bool r14bH
&bool r14bL
&word r14s &word r14s
&byte r14sH &byte r14sH
&byte r14sL &byte r14sL
&uword r15 &uword r15
&ubyte r15H &ubyte r15H
&ubyte r15L &ubyte r15L
&bool r15bH
&bool r15bL
&word r15s &word r15s
&byte r15sH &byte r15sH
&byte r15sL &byte r15sL
&ubyte r1H &ubyte r1H
&ubyte r1L &ubyte r1L
&bool r1bH
&bool r1bL
&word r1s &word r1s
&byte r1sH &byte r1sH
&byte r1sL &byte r1sL
&uword r2 &uword r2
&ubyte r2H &ubyte r2H
&ubyte r2L &ubyte r2L
&bool r2bH
&bool r2bL
&word r2s &word r2s
&byte r2sH &byte r2sH
&byte r2sL &byte r2sL
&uword r3 &uword r3
&ubyte r3H &ubyte r3H
&ubyte r3L &ubyte r3L
&bool r3bH
&bool r3bL
&word r3s &word r3s
&byte r3sH &byte r3sH
&byte r3sL &byte r3sL
&uword r4 &uword r4
&ubyte r4H &ubyte r4H
&ubyte r4L &ubyte r4L
&bool r4bH
&bool r4bL
&word r4s &word r4s
&byte r4sH &byte r4sH
&byte r4sL &byte r4sL
&uword r5 &uword r5
&ubyte r5H &ubyte r5H
&ubyte r5L &ubyte r5L
&bool r5bH
&bool r5bL
&word r5s &word r5s
&byte r5sH &byte r5sH
&byte r5sL &byte r5sL
&uword r6 &uword r6
&ubyte r6H &ubyte r6H
&ubyte r6L &ubyte r6L
&bool r6bH
&bool r6bL
&word r6s &word r6s
&byte r6sH &byte r6sH
&byte r6sL &byte r6sL
&uword r7 &uword r7
&ubyte r7H &ubyte r7H
&ubyte r7L &ubyte r7L
&bool r7bH
&bool r7bL
&word r7s &word r7s
&byte r7sH &byte r7sH
&byte r7sL &byte r7sL
&uword r8 &uword r8
&ubyte r8H &ubyte r8H
&ubyte r8L &ubyte r8L
&bool r8bH
&bool r8bL
&word r8s &word r8s
&byte r8sH &byte r8sH
&byte r8sL &byte r8sL
&uword r9 &uword r9
&ubyte r9H &ubyte r9H
&ubyte r9L &ubyte r9L
&bool r9bH
&bool r9bL
&word r9s &word r9s
&byte r9sH &byte r9sH
&byte r9sL &byte r9sL

View File

@@ -1,6 +1,5 @@
Prog8 compiler v11.4-SNAPSHOT by Irmen de Jong (irmen@razorvine.net) Prog8 compiler v11.4 by Irmen de Jong (irmen@razorvine.net)
Prerelease version from git commit a87f2640 in branch master
This software is licensed under the GNU GPL 3.0, see https://www.gnu.org/licenses/gpl.html This software is licensed under the GNU GPL 3.0, see https://www.gnu.org/licenses/gpl.html
Compiling program import-all-cx16.p8 Compiling program import-all-cx16.p8
@@ -147,7 +146,6 @@ LIBRARY MODULE NAME: coroutines
coroutines { coroutines {
const ubyte MAX_TASKS const ubyte MAX_TASKS
ubyte active_task ubyte active_task
uword[] returnaddresses
uword supervisor uword supervisor
uword[] tasklist uword[] tasklist
uword[] userdatas uword[] userdatas
@@ -676,6 +674,7 @@ strings {
copy (uword source @R0, uword target @AY) -> clobbers (A) -> ubyte @Y copy (uword source @R0, uword target @AY) -> clobbers (A) -> ubyte @Y
endswith (str st, str suffix) -> bool endswith (str st, str suffix) -> bool
find (uword string @AY, ubyte character @X) -> ubyte @A, bool @Pc find (uword string @AY, ubyte character @X) -> ubyte @A, bool @Pc
find_eol (uword string @AY) -> ubyte @A, bool @Pc
findstr (str haystack, str needle) -> ubyte findstr (str haystack, str needle) -> ubyte
hash (str string @AY) -> ubyte @A hash (str string @AY) -> ubyte @A
isdigit (ubyte petsciichar @A) -> bool @Pc isdigit (ubyte petsciichar @A) -> bool @Pc
@@ -894,6 +893,8 @@ cx16 {
&uword r0 &uword r0
&ubyte r0H &ubyte r0H
&ubyte r0L &ubyte r0L
&bool r0bH
&bool r0bL
&word r0s &word r0s
&byte r0sH &byte r0sH
&byte r0sL &byte r0sL
@@ -901,89 +902,119 @@ cx16 {
&uword r10 &uword r10
&ubyte r10H &ubyte r10H
&ubyte r10L &ubyte r10L
&bool r10bH
&bool r10bL
&word r10s &word r10s
&byte r10sH &byte r10sH
&byte r10sL &byte r10sL
&uword r11 &uword r11
&ubyte r11H &ubyte r11H
&ubyte r11L &ubyte r11L
&bool r11bH
&bool r11bL
&word r11s &word r11s
&byte r11sH &byte r11sH
&byte r11sL &byte r11sL
&uword r12 &uword r12
&ubyte r12H &ubyte r12H
&ubyte r12L &ubyte r12L
&bool r12bH
&bool r12bL
&word r12s &word r12s
&byte r12sH &byte r12sH
&byte r12sL &byte r12sL
&uword r13 &uword r13
&ubyte r13H &ubyte r13H
&ubyte r13L &ubyte r13L
&bool r13bH
&bool r13bL
&word r13s &word r13s
&byte r13sH &byte r13sH
&byte r13sL &byte r13sL
&uword r14 &uword r14
&ubyte r14H &ubyte r14H
&ubyte r14L &ubyte r14L
&bool r14bH
&bool r14bL
&word r14s &word r14s
&byte r14sH &byte r14sH
&byte r14sL &byte r14sL
&uword r15 &uword r15
&ubyte r15H &ubyte r15H
&ubyte r15L &ubyte r15L
&bool r15bH
&bool r15bL
&word r15s &word r15s
&byte r15sH &byte r15sH
&byte r15sL &byte r15sL
&ubyte r1H &ubyte r1H
&ubyte r1L &ubyte r1L
&bool r1bH
&bool r1bL
&word r1s &word r1s
&byte r1sH &byte r1sH
&byte r1sL &byte r1sL
&uword r2 &uword r2
&ubyte r2H &ubyte r2H
&ubyte r2L &ubyte r2L
&bool r2bH
&bool r2bL
&word r2s &word r2s
&byte r2sH &byte r2sH
&byte r2sL &byte r2sL
&uword r3 &uword r3
&ubyte r3H &ubyte r3H
&ubyte r3L &ubyte r3L
&bool r3bH
&bool r3bL
&word r3s &word r3s
&byte r3sH &byte r3sH
&byte r3sL &byte r3sL
&uword r4 &uword r4
&ubyte r4H &ubyte r4H
&ubyte r4L &ubyte r4L
&bool r4bH
&bool r4bL
&word r4s &word r4s
&byte r4sH &byte r4sH
&byte r4sL &byte r4sL
&uword r5 &uword r5
&ubyte r5H &ubyte r5H
&ubyte r5L &ubyte r5L
&bool r5bH
&bool r5bL
&word r5s &word r5s
&byte r5sH &byte r5sH
&byte r5sL &byte r5sL
&uword r6 &uword r6
&ubyte r6H &ubyte r6H
&ubyte r6L &ubyte r6L
&bool r6bH
&bool r6bL
&word r6s &word r6s
&byte r6sH &byte r6sH
&byte r6sL &byte r6sL
&uword r7 &uword r7
&ubyte r7H &ubyte r7H
&ubyte r7L &ubyte r7L
&bool r7bH
&bool r7bL
&word r7s &word r7s
&byte r7sH &byte r7sH
&byte r7sL &byte r7sL
&uword r8 &uword r8
&ubyte r8H &ubyte r8H
&ubyte r8L &ubyte r8L
&bool r8bH
&bool r8bL
&word r8s &word r8s
&byte r8sH &byte r8sH
&byte r8sL &byte r8sL
&uword r9 &uword r9
&ubyte r9H &ubyte r9H
&ubyte r9L &ubyte r9L
&bool r9bH
&bool r9bL
&word r9s &word r9s
&byte r9sH &byte r9sH
&byte r9sL &byte r9sL
@@ -1233,6 +1264,7 @@ sys {
exit (ubyte returnvalue @A) exit (ubyte returnvalue @A)
exit2 (ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) exit2 (ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y)
exit3 (ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) exit3 (ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc)
get_as_returnaddress (uword address @XY) -> uword @AX
internal_stringcopy (uword source @R0, uword target @AY) -> clobbers (A,Y) internal_stringcopy (uword source @R0, uword target @AY) -> clobbers (A,Y)
irqsafe_clear_irqd () irqsafe_clear_irqd ()
irqsafe_set_irqd () irqsafe_set_irqd ()

View File

@@ -1,6 +1,5 @@
Prog8 compiler v11.4-SNAPSHOT by Irmen de Jong (irmen@razorvine.net) Prog8 compiler v11.4 by Irmen de Jong (irmen@razorvine.net)
Prerelease version from git commit a87f2640 in branch master
This software is licensed under the GNU GPL 3.0, see https://www.gnu.org/licenses/gpl.html This software is licensed under the GNU GPL 3.0, see https://www.gnu.org/licenses/gpl.html
Compiling program import-all-pet32.p8 Compiling program import-all-pet32.p8
@@ -109,7 +108,6 @@ LIBRARY MODULE NAME: coroutines
coroutines { coroutines {
const ubyte MAX_TASKS const ubyte MAX_TASKS
ubyte active_task ubyte active_task
uword[] returnaddresses
uword supervisor uword supervisor
uword[] tasklist uword[] tasklist
uword[] userdatas uword[] userdatas
@@ -189,6 +187,7 @@ strings {
copy (uword source @R0, uword target @AY) -> clobbers (A) -> ubyte @Y copy (uword source @R0, uword target @AY) -> clobbers (A) -> ubyte @Y
endswith (str st, str suffix) -> bool endswith (str st, str suffix) -> bool
find (uword string @AY, ubyte character @X) -> ubyte @A, bool @Pc find (uword string @AY, ubyte character @X) -> ubyte @A, bool @Pc
find_eol (uword string @AY) -> ubyte @A, bool @Pc
findstr (str haystack, str needle) -> ubyte findstr (str haystack, str needle) -> ubyte
hash (str string @AY) -> ubyte @A hash (str string @AY) -> ubyte @A
isdigit (ubyte petsciichar @A) -> bool @Pc isdigit (ubyte petsciichar @A) -> bool @Pc
@@ -276,6 +275,7 @@ sys {
exit (ubyte returnvalue @A) exit (ubyte returnvalue @A)
exit2 (ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y) exit2 (ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y)
exit3 (ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc) exit3 (ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc)
get_as_returnaddress (uword address @XY) -> uword @AX
internal_stringcopy (uword source @R0, uword target @AY) -> clobbers (A,Y) internal_stringcopy (uword source @R0, uword target @AY) -> clobbers (A,Y)
irqsafe_clear_irqd () irqsafe_clear_irqd ()
irqsafe_set_irqd () irqsafe_set_irqd ()
@@ -304,6 +304,8 @@ cx16 {
&uword r0 &uword r0
&ubyte r0H &ubyte r0H
&ubyte r0L &ubyte r0L
&bool r0bH
&bool r0bL
&word r0s &word r0s
&byte r0sH &byte r0sH
&byte r0sL &byte r0sL
@@ -311,89 +313,119 @@ cx16 {
&uword r10 &uword r10
&ubyte r10H &ubyte r10H
&ubyte r10L &ubyte r10L
&bool r10bH
&bool r10bL
&word r10s &word r10s
&byte r10sH &byte r10sH
&byte r10sL &byte r10sL
&uword r11 &uword r11
&ubyte r11H &ubyte r11H
&ubyte r11L &ubyte r11L
&bool r11bH
&bool r11bL
&word r11s &word r11s
&byte r11sH &byte r11sH
&byte r11sL &byte r11sL
&uword r12 &uword r12
&ubyte r12H &ubyte r12H
&ubyte r12L &ubyte r12L
&bool r12bH
&bool r12bL
&word r12s &word r12s
&byte r12sH &byte r12sH
&byte r12sL &byte r12sL
&uword r13 &uword r13
&ubyte r13H &ubyte r13H
&ubyte r13L &ubyte r13L
&bool r13bH
&bool r13bL
&word r13s &word r13s
&byte r13sH &byte r13sH
&byte r13sL &byte r13sL
&uword r14 &uword r14
&ubyte r14H &ubyte r14H
&ubyte r14L &ubyte r14L
&bool r14bH
&bool r14bL
&word r14s &word r14s
&byte r14sH &byte r14sH
&byte r14sL &byte r14sL
&uword r15 &uword r15
&ubyte r15H &ubyte r15H
&ubyte r15L &ubyte r15L
&bool r15bH
&bool r15bL
&word r15s &word r15s
&byte r15sH &byte r15sH
&byte r15sL &byte r15sL
&ubyte r1H &ubyte r1H
&ubyte r1L &ubyte r1L
&bool r1bH
&bool r1bL
&word r1s &word r1s
&byte r1sH &byte r1sH
&byte r1sL &byte r1sL
&uword r2 &uword r2
&ubyte r2H &ubyte r2H
&ubyte r2L &ubyte r2L
&bool r2bH
&bool r2bL
&word r2s &word r2s
&byte r2sH &byte r2sH
&byte r2sL &byte r2sL
&uword r3 &uword r3
&ubyte r3H &ubyte r3H
&ubyte r3L &ubyte r3L
&bool r3bH
&bool r3bL
&word r3s &word r3s
&byte r3sH &byte r3sH
&byte r3sL &byte r3sL
&uword r4 &uword r4
&ubyte r4H &ubyte r4H
&ubyte r4L &ubyte r4L
&bool r4bH
&bool r4bL
&word r4s &word r4s
&byte r4sH &byte r4sH
&byte r4sL &byte r4sL
&uword r5 &uword r5
&ubyte r5H &ubyte r5H
&ubyte r5L &ubyte r5L
&bool r5bH
&bool r5bL
&word r5s &word r5s
&byte r5sH &byte r5sH
&byte r5sL &byte r5sL
&uword r6 &uword r6
&ubyte r6H &ubyte r6H
&ubyte r6L &ubyte r6L
&bool r6bH
&bool r6bL
&word r6s &word r6s
&byte r6sH &byte r6sH
&byte r6sL &byte r6sL
&uword r7 &uword r7
&ubyte r7H &ubyte r7H
&ubyte r7L &ubyte r7L
&bool r7bH
&bool r7bL
&word r7s &word r7s
&byte r7sH &byte r7sH
&byte r7sL &byte r7sL
&uword r8 &uword r8
&ubyte r8H &ubyte r8H
&ubyte r8L &ubyte r8L
&bool r8bH
&bool r8bL
&word r8s &word r8s
&byte r8sH &byte r8sH
&byte r8sL &byte r8sL
&uword r9 &uword r9
&ubyte r9H &ubyte r9H
&ubyte r9L &ubyte r9L
&bool r9bH
&bool r9bL
&word r9s &word r9s
&byte r9sH &byte r9sH
&byte r9sL &byte r9sL

View File

@@ -1,6 +1,5 @@
Prog8 compiler v11.4-SNAPSHOT by Irmen de Jong (irmen@razorvine.net) Prog8 compiler v11.4 by Irmen de Jong (irmen@razorvine.net)
Prerelease version from git commit a87f2640 in branch master
This software is licensed under the GNU GPL 3.0, see https://www.gnu.org/licenses/gpl.html This software is licensed under the GNU GPL 3.0, see https://www.gnu.org/licenses/gpl.html
Compiling program import-all-virtual.p8 Compiling program import-all-virtual.p8
@@ -280,7 +279,8 @@ strings {
contains (str st, ubyte character) -> bool contains (str st, ubyte character) -> bool
copy (str source, str target) -> ubyte copy (str source, str target) -> ubyte
endswith (str st, str suffix) -> bool endswith (str st, str suffix) -> bool
find (str st, ubyte character) -> ubyte find (str st, ubyte character) -> ubyte, bool
find_eol (str st) -> ubyte, bool
findstr (str haystack, str needle) -> ubyte findstr (str haystack, str needle) -> ubyte
hash (str st) -> ubyte hash (str st) -> ubyte
isdigit (ubyte character) -> bool isdigit (ubyte character) -> bool
@@ -298,7 +298,7 @@ strings {
ltrim (str s) ltrim (str s)
ltrimmed (str s) -> str ltrimmed (str s) -> str
ncompare (str st1, str st2, ubyte length) -> byte ncompare (str st1, str st2, ubyte length) -> byte
rfind (uword stringptr, ubyte character) -> ubyte rfind (uword stringptr, ubyte character) -> ubyte, bool
right (str source, ubyte slen, str target) right (str source, ubyte slen, str target)
rstrip (str s) rstrip (str s)
rtrim (str s) rtrim (str s)
@@ -338,6 +338,7 @@ sys {
disable_caseswitch () disable_caseswitch ()
enable_caseswitch () enable_caseswitch ()
exit (ubyte returnvalue) exit (ubyte returnvalue)
get_as_returnaddress (uword address) -> uword
gfx_clear (ubyte color) gfx_clear (ubyte color)
gfx_enable (ubyte mode) gfx_enable (ubyte mode)
gfx_getpixel (uword xx, uword yy) -> ubyte gfx_getpixel (uword xx, uword yy) -> ubyte
@@ -366,6 +367,8 @@ cx16 {
&uword r0 &uword r0
&ubyte r0H &ubyte r0H
&ubyte r0L &ubyte r0L
&bool r0bH
&bool r0bL
&word r0s &word r0s
&byte r0sH &byte r0sH
&byte r0sL &byte r0sL
@@ -373,89 +376,119 @@ cx16 {
&uword r10 &uword r10
&ubyte r10H &ubyte r10H
&ubyte r10L &ubyte r10L
&bool r10bH
&bool r10bL
&word r10s &word r10s
&byte r10sH &byte r10sH
&byte r10sL &byte r10sL
&uword r11 &uword r11
&ubyte r11H &ubyte r11H
&ubyte r11L &ubyte r11L
&bool r11bH
&bool r11bL
&word r11s &word r11s
&byte r11sH &byte r11sH
&byte r11sL &byte r11sL
&uword r12 &uword r12
&ubyte r12H &ubyte r12H
&ubyte r12L &ubyte r12L
&bool r12bH
&bool r12bL
&word r12s &word r12s
&byte r12sH &byte r12sH
&byte r12sL &byte r12sL
&uword r13 &uword r13
&ubyte r13H &ubyte r13H
&ubyte r13L &ubyte r13L
&bool r13bH
&bool r13bL
&word r13s &word r13s
&byte r13sH &byte r13sH
&byte r13sL &byte r13sL
&uword r14 &uword r14
&ubyte r14H &ubyte r14H
&ubyte r14L &ubyte r14L
&bool r14bH
&bool r14bL
&word r14s &word r14s
&byte r14sH &byte r14sH
&byte r14sL &byte r14sL
&uword r15 &uword r15
&ubyte r15H &ubyte r15H
&ubyte r15L &ubyte r15L
&bool r15bH
&bool r15bL
&word r15s &word r15s
&byte r15sH &byte r15sH
&byte r15sL &byte r15sL
&ubyte r1H &ubyte r1H
&ubyte r1L &ubyte r1L
&bool r1bH
&bool r1bL
&word r1s &word r1s
&byte r1sH &byte r1sH
&byte r1sL &byte r1sL
&uword r2 &uword r2
&ubyte r2H &ubyte r2H
&ubyte r2L &ubyte r2L
&bool r2bH
&bool r2bL
&word r2s &word r2s
&byte r2sH &byte r2sH
&byte r2sL &byte r2sL
&uword r3 &uword r3
&ubyte r3H &ubyte r3H
&ubyte r3L &ubyte r3L
&bool r3bH
&bool r3bL
&word r3s &word r3s
&byte r3sH &byte r3sH
&byte r3sL &byte r3sL
&uword r4 &uword r4
&ubyte r4H &ubyte r4H
&ubyte r4L &ubyte r4L
&bool r4bH
&bool r4bL
&word r4s &word r4s
&byte r4sH &byte r4sH
&byte r4sL &byte r4sL
&uword r5 &uword r5
&ubyte r5H &ubyte r5H
&ubyte r5L &ubyte r5L
&bool r5bH
&bool r5bL
&word r5s &word r5s
&byte r5sH &byte r5sH
&byte r5sL &byte r5sL
&uword r6 &uword r6
&ubyte r6H &ubyte r6H
&ubyte r6L &ubyte r6L
&bool r6bH
&bool r6bL
&word r6s &word r6s
&byte r6sH &byte r6sH
&byte r6sL &byte r6sL
&uword r7 &uword r7
&ubyte r7H &ubyte r7H
&ubyte r7L &ubyte r7L
&bool r7bH
&bool r7bL
&word r7s &word r7s
&byte r7sH &byte r7sH
&byte r7sL &byte r7sL
&uword r8 &uword r8
&ubyte r8H &ubyte r8H
&ubyte r8L &ubyte r8L
&bool r8bH
&bool r8bL
&word r8s &word r8s
&byte r8sH &byte r8sH
&byte r8sL &byte r8sL
&uword r9 &uword r9
&ubyte r9H &ubyte r9H
&ubyte r9L &ubyte r9L
&bool r9bH
&bool r9bL
&word r9s &word r9s
&byte r9sH &byte r9sH
&byte r9sL &byte r9sL

View File

@@ -1113,14 +1113,19 @@ so pay attention to any jumps and rts instructions in the inlined code!
don't want a ``rts`` or ``jmp`` or ``bra`` in it! don't want a ``rts`` or ``jmp`` or ``bra`` in it!
.. note:: .. note::
The 'virtual' 16-bit registers from the Commander X16 can also be specified as ``R0`` .. ``R15`` . The **sixteen 'virtual' 16-bit registers** from the Commander X16 can also be specified as ``R0`` .. ``R15`` .
This means you don't have to set them up manually before calling a subroutine that takes This means you don't have to set them up manually before calling a subroutine that takes
one or more parameters in those 'registers'. You can just list the arguments directly. one or more parameters in those 'registers'. You can just list the arguments directly.
*This also works on the Commodore 64!* (however they are not as efficient there because they're not in zeropage) *This also works on the other compilation targets!* (however they might not be as efficient there as on the X16,
In prog8 and assembly code these 'registers' are directly accessible too via because on most other targets such as the C64, these registers are not placed in zeropage due to lack of space)
``cx16.r0`` .. ``cx16.r15`` (these are memory-mapped uword values), In both regular **prog8** *and* **assembly** code these 'registers' are directly accessible too via:
``cx16.r0s`` .. ``cx16.r15s`` (these are memory-mapped word values),
and ``L`` / ``H`` variants are also available to directly access the low and high bytes of these. - ``cx16.r0`` - ``cx16.r15`` (memory-mapped **uword** values, most often these are used)
- ``cx16.r0s`` - ``cx16.r15s`` (memory-mapped **word** values, used when you need a signed word)
- ``cx16.r0H``, ``cx16.r0L`` (for each r0..r15; memory-mapped **ubyte** values, both bytes of the register)
- ``cx16.r0sH``, ``cx16.r0sL`` (for each r0..r15; memory-mapped **byte** values, both bytes of the register)
- ``cx16.r0bH``, ``cx16.r0bL`` (for each r0..r15; memory-mapped **bool** values, both bytes of the register)
You can use them directly but their name isn't very descriptive, so it may be useful to define You can use them directly but their name isn't very descriptive, so it may be useful to define
an alias for them when using them regularly. an alias for them when using them regularly.

View File

@@ -416,7 +416,6 @@ save_SCRATCH_ZPWORD2 .word ?
cx16 { cx16 {
; 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
&uword r0 = $1b00 &uword r0 = $1b00
&uword r1 = $1b02 &uword r1 = $1b02
&uword r2 = $1b04 &uword r2 = $1b04
@@ -434,6 +433,7 @@ cx16 {
&uword r14 = $1b1c &uword r14 = $1b1c
&uword r15 = $1b1e &uword r15 = $1b1e
; signed word versions
&word r0s = $1b00 &word r0s = $1b00
&word r1s = $1b02 &word r1s = $1b02
&word r2s = $1b04 &word r2s = $1b04
@@ -451,6 +451,7 @@ cx16 {
&word r14s = $1b1c &word r14s = $1b1c
&word r15s = $1b1e &word r15s = $1b1e
; ubyte versions (low and high bytes)
&ubyte r0L = $1b00 &ubyte r0L = $1b00
&ubyte r1L = $1b02 &ubyte r1L = $1b02
&ubyte r2L = $1b04 &ubyte r2L = $1b04
@@ -485,6 +486,7 @@ cx16 {
&ubyte r14H = $1b1d &ubyte r14H = $1b1d
&ubyte r15H = $1b1f &ubyte r15H = $1b1f
; signed byte versions (low and high bytes)
&byte r0sL = $1b00 &byte r0sL = $1b00
&byte r1sL = $1b02 &byte r1sL = $1b02
&byte r2sL = $1b04 &byte r2sL = $1b04
@@ -519,6 +521,41 @@ cx16 {
&byte r14sH = $1b1d &byte r14sH = $1b1d
&byte r15sH = $1b1f &byte r15sH = $1b1f
; boolean versions
&bool r0bL = $1b00
&bool r1bL = $1b02
&bool r2bL = $1b04
&bool r3bL = $1b06
&bool r4bL = $1b08
&bool r5bL = $1b0a
&bool r6bL = $1b0c
&bool r7bL = $1b0e
&bool r8bL = $1b10
&bool r9bL = $1b12
&bool r10bL = $1b14
&bool r11bL = $1b16
&bool r12bL = $1b18
&bool r13bL = $1b1a
&bool r14bL = $1b1c
&bool r15bL = $1b1e
&bool r0bH = $1b01
&bool r1bH = $1b03
&bool r2bH = $1b05
&bool r3bH = $1b07
&bool r4bH = $1b09
&bool r5bH = $1b0b
&bool r6bH = $1b0d
&bool r7bH = $1b0f
&bool r8bH = $1b11
&bool r9bH = $1b13
&bool r10bH = $1b15
&bool r11bH = $1b17
&bool r12bH = $1b19
&bool r13bH = $1b1b
&bool r14bH = $1b1d
&bool r15bH = $1b1f
asmsub save_virtual_registers() clobbers(A,Y) { asmsub save_virtual_registers() clobbers(A,Y) {
%asm {{ %asm {{
ldy #31 ldy #31

View File

@@ -365,6 +365,7 @@ cx16 {
&uword r14 = $001e &uword r14 = $001e
&uword r15 = $0020 &uword r15 = $0020
; signed word versions
&word r0s = $0002 &word r0s = $0002
&word r1s = $0004 &word r1s = $0004
&word r2s = $0006 &word r2s = $0006
@@ -382,6 +383,7 @@ cx16 {
&word r14s = $001e &word r14s = $001e
&word r15s = $0020 &word r15s = $0020
; ubyte versions (low and high bytes)
&ubyte r0L = $0002 &ubyte r0L = $0002
&ubyte r1L = $0004 &ubyte r1L = $0004
&ubyte r2L = $0006 &ubyte r2L = $0006
@@ -416,6 +418,7 @@ cx16 {
&ubyte r14H = $001f &ubyte r14H = $001f
&ubyte r15H = $0021 &ubyte r15H = $0021
; signed byte versions (low and high bytes)
&byte r0sL = $0002 &byte r0sL = $0002
&byte r1sL = $0004 &byte r1sL = $0004
&byte r2sL = $0006 &byte r2sL = $0006
@@ -450,6 +453,42 @@ cx16 {
&byte r14sH = $001f &byte r14sH = $001f
&byte r15sH = $0021 &byte r15sH = $0021
; boolean versions
&bool r0bL = $0002
&bool r1bL = $0004
&bool r2bL = $0006
&bool r3bL = $0008
&bool r4bL = $000a
&bool r5bL = $000c
&bool r6bL = $000e
&bool r7bL = $0010
&bool r8bL = $0012
&bool r9bL = $0014
&bool r10bL = $0016
&bool r11bL = $0018
&bool r12bL = $001a
&bool r13bL = $001c
&bool r14bL = $001e
&bool r15bL = $0020
&bool r0bH = $0003
&bool r1bH = $0005
&bool r2bH = $0007
&bool r3bH = $0009
&bool r4bH = $000b
&bool r5bH = $000d
&bool r6bH = $000f
&bool r7bH = $0011
&bool r8bH = $0013
&bool r9bH = $0015
&bool r10bH = $0017
&bool r11bH = $0019
&bool r12bH = $001b
&bool r13bH = $001d
&bool r14bH = $001f
&bool r15bH = $0021
asmsub save_virtual_registers() clobbers(A,Y) { asmsub save_virtual_registers() clobbers(A,Y) {
%asm {{ %asm {{
ldy #31 ldy #31

View File

@@ -159,6 +159,7 @@ cx16 {
&uword r14 = $cffc &uword r14 = $cffc
&uword r15 = $cffe &uword r15 = $cffe
; signed word versions
&word r0s = $cfe0 &word r0s = $cfe0
&word r1s = $cfe2 &word r1s = $cfe2
&word r2s = $cfe4 &word r2s = $cfe4
@@ -176,6 +177,7 @@ cx16 {
&word r14s = $cffc &word r14s = $cffc
&word r15s = $cffe &word r15s = $cffe
; ubyte versions (low and high bytes)
&ubyte r0L = $cfe0 &ubyte r0L = $cfe0
&ubyte r1L = $cfe2 &ubyte r1L = $cfe2
&ubyte r2L = $cfe4 &ubyte r2L = $cfe4
@@ -210,6 +212,7 @@ cx16 {
&ubyte r14H = $cffd &ubyte r14H = $cffd
&ubyte r15H = $cfff &ubyte r15H = $cfff
; signed byte versions (low and high bytes)
&byte r0sL = $cfe0 &byte r0sL = $cfe0
&byte r1sL = $cfe2 &byte r1sL = $cfe2
&byte r2sL = $cfe4 &byte r2sL = $cfe4
@@ -243,4 +246,39 @@ cx16 {
&byte r13sH = $cffb &byte r13sH = $cffb
&byte r14sH = $cffd &byte r14sH = $cffd
&byte r15sH = $cfff &byte r15sH = $cfff
; boolean versions
&bool r0bL = $cfe0
&bool r1bL = $cfe2
&bool r2bL = $cfe4
&bool r3bL = $cfe6
&bool r4bL = $cfe8
&bool r5bL = $cfea
&bool r6bL = $cfec
&bool r7bL = $cfee
&bool r8bL = $cff0
&bool r9bL = $cff2
&bool r10bL = $cff4
&bool r11bL = $cff6
&bool r12bL = $cff8
&bool r13bL = $cffa
&bool r14bL = $cffc
&bool r15bL = $cffe
&bool r0bH = $cfe1
&bool r1bH = $cfe3
&bool r2bH = $cfe5
&bool r3bH = $cfe7
&bool r4bH = $cfe9
&bool r5bH = $cfeb
&bool r6bH = $cfed
&bool r7bH = $cfef
&bool r8bH = $cff1
&bool r9bH = $cff3
&bool r10bH = $cff5
&bool r11bH = $cff7
&bool r12bH = $cff9
&bool r13bH = $cffb
&bool r14bH = $cffd
&bool r15bH = $cfff
} }

View File

@@ -159,6 +159,7 @@ cx16 {
&uword r14 = $001e &uword r14 = $001e
&uword r15 = $0020 &uword r15 = $0020
; signed word versions
&word r0s = $0002 &word r0s = $0002
&word r1s = $0004 &word r1s = $0004
&word r2s = $0006 &word r2s = $0006
@@ -176,6 +177,7 @@ cx16 {
&word r14s = $001e &word r14s = $001e
&word r15s = $0020 &word r15s = $0020
; ubyte versions (low and high bytes)
&ubyte r0L = $0002 &ubyte r0L = $0002
&ubyte r1L = $0004 &ubyte r1L = $0004
&ubyte r2L = $0006 &ubyte r2L = $0006
@@ -210,6 +212,7 @@ cx16 {
&ubyte r14H = $001f &ubyte r14H = $001f
&ubyte r15H = $0021 &ubyte r15H = $0021
; signed byte versions (low and high bytes)
&byte r0sL = $0002 &byte r0sL = $0002
&byte r1sL = $0004 &byte r1sL = $0004
&byte r2sL = $0006 &byte r2sL = $0006
@@ -243,4 +246,39 @@ cx16 {
&byte r13sH = $001d &byte r13sH = $001d
&byte r14sH = $001f &byte r14sH = $001f
&byte r15sH = $0021 &byte r15sH = $0021
; boolean versions
&bool r0bL = $0002
&bool r1bL = $0004
&bool r2bL = $0006
&bool r3bL = $0008
&bool r4bL = $000a
&bool r5bL = $000c
&bool r6bL = $000e
&bool r7bL = $0010
&bool r8bL = $0012
&bool r9bL = $0014
&bool r10bL = $0016
&bool r11bL = $0018
&bool r12bL = $001a
&bool r13bL = $001c
&bool r14bL = $001e
&bool r15bL = $0020
&bool r0bH = $0003
&bool r1bH = $0005
&bool r2bH = $0007
&bool r3bH = $0009
&bool r4bH = $000b
&bool r5bH = $000d
&bool r6bH = $000f
&bool r7bH = $0011
&bool r8bH = $0013
&bool r9bH = $0015
&bool r10bH = $0017
&bool r11bH = $0019
&bool r12bH = $001b
&bool r13bH = $001d
&bool r14bH = $001f
&bool r15bH = $0021
} }

View File

@@ -155,6 +155,7 @@ cx16 {
&uword r14 = $7ffc &uword r14 = $7ffc
&uword r15 = $7ffe &uword r15 = $7ffe
; signed word versions
&word r0s = $7fe0 &word r0s = $7fe0
&word r1s = $7fe2 &word r1s = $7fe2
&word r2s = $7fe4 &word r2s = $7fe4
@@ -172,6 +173,7 @@ cx16 {
&word r14s = $7ffc &word r14s = $7ffc
&word r15s = $7ffe &word r15s = $7ffe
; ubyte versions (low and high bytes)
&ubyte r0L = $7fe0 &ubyte r0L = $7fe0
&ubyte r1L = $7fe2 &ubyte r1L = $7fe2
&ubyte r2L = $7fe4 &ubyte r2L = $7fe4
@@ -206,6 +208,7 @@ cx16 {
&ubyte r14H = $7ffd &ubyte r14H = $7ffd
&ubyte r15H = $7fff &ubyte r15H = $7fff
; signed byte versions (low and high bytes)
&byte r0sL = $7fe0 &byte r0sL = $7fe0
&byte r1sL = $7fe2 &byte r1sL = $7fe2
&byte r2sL = $7fe4 &byte r2sL = $7fe4
@@ -239,4 +242,39 @@ cx16 {
&byte r13sH = $7ffb &byte r13sH = $7ffb
&byte r14sH = $7ffd &byte r14sH = $7ffd
&byte r15sH = $7fff &byte r15sH = $7fff
; boolean versions
&bool r0bL = $7fe0
&bool r1bL = $7fe2
&bool r2bL = $7fe4
&bool r3bL = $7fe6
&bool r4bL = $7fe8
&bool r5bL = $7fea
&bool r6bL = $7fec
&bool r7bL = $7fee
&bool r8bL = $7ff0
&bool r9bL = $7ff2
&bool r10bL = $7ff4
&bool r11bL = $7ff6
&bool r12bL = $7ff8
&bool r13bL = $7ffa
&bool r14bL = $7ffc
&bool r15bL = $7ffe
&bool r0bH = $7fe1
&bool r1bH = $7fe3
&bool r2bH = $7fe5
&bool r3bH = $7fe7
&bool r4bH = $7fe9
&bool r5bH = $7feb
&bool r6bH = $7fed
&bool r7bH = $7fef
&bool r8bH = $7ff1
&bool r9bH = $7ff3
&bool r10bH = $7ff5
&bool r11bH = $7ff7
&bool r12bH = $7ff9
&bool r13bH = $7ffb
&bool r14bH = $7ffd
&bool r15bH = $7fff
} }