extracting neo and atari compiler targets into configuration files instead

This commit is contained in:
Irmen de Jong 2025-02-12 00:34:51 +01:00
parent 49982b49b6
commit 99ff5dd078
20 changed files with 28 additions and 877 deletions

View File

@ -91,8 +91,6 @@ val CompilationTargets = listOf(
C128Target.NAME,
Cx16Target.NAME,
PETTarget.NAME,
AtariTarget.NAME,
Neo6502Target.NAME,
VMTarget.NAME
)
@ -101,8 +99,6 @@ fun getCompilationTargetByName(name: String) = when(name.lowercase()) {
C128Target.NAME -> C128Target()
Cx16Target.NAME -> Cx16Target()
PETTarget.NAME -> PETTarget()
AtariTarget.NAME -> AtariTarget()
VMTarget.NAME -> VMTarget()
Neo6502Target.NAME -> Neo6502Target()
else -> throw IllegalArgumentException("invalid compilation target")
}

View File

@ -2,10 +2,8 @@ package prog8.codegen.cpu6502
import prog8.code.ast.PtLabel
import prog8.code.core.*
import prog8.code.target.AtariTarget
import prog8.code.target.C128Target
import prog8.code.target.C64Target
import prog8.code.target.Neo6502Target
import prog8.code.target.PETTarget
import java.nio.file.Path
@ -21,7 +19,6 @@ internal class AssemblyProgram(
private val binFile = outputDir.resolve("$name.bin")
private val viceMonListFile = outputDir.resolve(C64Target.viceMonListName(name))
private val listFile = outputDir.resolve("$name.list")
private val targetWithoutBreakpointsForEmulator = arrayOf(AtariTarget.NAME, Neo6502Target.NAME)
override fun assemble(options: CompilationOptions, errors: IErrorReporter): Boolean {
@ -145,7 +142,7 @@ internal class AssemblyProgram(
val proc = ProcessBuilder(assemblerCommand).inheritIO().start()
val result = proc.waitFor()
if (result == 0 && compTarget.name !in targetWithoutBreakpointsForEmulator) {
if (result == 0) {
removeGeneratedLabelsFromMonlist()
generateBreakpointList()
}

View File

@ -12,7 +12,10 @@ import prog8.code.ast.verifyFinalAstBeforeAsmGen
import prog8.code.core.*
import prog8.code.optimize.optimizeSimplifiedAst
import prog8.code.source.ImportFileSystem.expandTilde
import prog8.code.target.*
import prog8.code.target.ConfigFileTarget
import prog8.code.target.Cx16Target
import prog8.code.target.VMTarget
import prog8.code.target.getCompilationTargetByName
import prog8.codegen.vm.VmCodeGen
import prog8.compiler.astprocessing.*
import prog8.optimizer.*
@ -245,11 +248,6 @@ internal fun determineProgramLoadAddress(program: Program, options: CompilationO
}
else {
when(options.output) {
OutputType.RAW -> {
if(options.compTarget.name==Neo6502Target.NAME)
loadAddress = options.compTarget.PROGRAM_LOAD_ADDRESS
// for all other targets, RAW has no predefined load address.
}
OutputType.PRG -> {
if(options.launcher==CbmPrgLauncherType.BASIC) {
loadAddress = options.compTarget.PROGRAM_LOAD_ADDRESS
@ -269,6 +267,8 @@ internal fun determineProgramLoadAddress(program: Program, options: CompilationO
throw AssemblyError("library output can't have sysinit")
// LIBRARY has no predefined load address.
}
OutputType.RAW -> { }
}
}
@ -361,8 +361,6 @@ fun parseMainModule(filepath: Path,
} else {
if (compilerOptions.launcher == CbmPrgLauncherType.BASIC && compilerOptions.output != OutputType.PRG)
errors.err("BASIC launcher requires output type PRG", program.toplevelModule.position)
if (compilerOptions.launcher == CbmPrgLauncherType.BASIC && compTarget.name == AtariTarget.NAME)
errors.err("atari target cannot use CBM BASIC launcher, use NONE", program.toplevelModule.position)
}
errors.report()
@ -409,10 +407,7 @@ internal fun determineCompilationOptions(program: Program, compTarget: ICompilat
.toList()
val outputType = if (outputTypeStr == null) {
if(compTarget is AtariTarget)
OutputType.XEX
else
OutputType.PRG
OutputType.PRG
} else {
try {
OutputType.valueOf(outputTypeStr)

View File

@ -4,11 +4,17 @@ import io.kotest.core.spec.style.FunSpec
import io.kotest.datatest.withData
import io.kotest.matchers.shouldNotBe
import prog8.code.core.ICompilationTarget
import prog8.code.target.*
import prog8.code.target.C128Target
import prog8.code.target.C64Target
import prog8.code.target.Cx16Target
import prog8.code.target.VMTarget
import prog8.compiler.CompilationResult
import prog8.compiler.CompilerArguments
import prog8.compiler.compileProgram
import prog8tests.helpers.*
import prog8tests.helpers.assumeDirectory
import prog8tests.helpers.cartesianProduct
import prog8tests.helpers.outputDir
import prog8tests.helpers.workingDir
import java.nio.file.Path
import kotlin.io.path.absolute
import kotlin.io.path.exists
@ -57,8 +63,6 @@ private fun prepareTestFiles(source: String, optimize: Boolean, target: ICompila
is Cx16Target -> searchIn.add(0, assumeDirectory(examplesDir, "cx16"))
is VMTarget -> searchIn.add(0, assumeDirectory(examplesDir, "vm"))
is C128Target -> searchIn.add(0, assumeDirectory(examplesDir, "c128"))
is AtariTarget -> searchIn.add(0, assumeDirectory(examplesDir, "atari"))
is Neo6502Target -> searchIn.add(0, assumeDirectory(examplesDir, "neo"))
}
val filepath = searchIn.asSequence()
.map { it.resolve("$source.p8") }

View File

@ -14,7 +14,10 @@ import prog8.ast.expressions.PrefixExpression
import prog8.ast.statements.*
import prog8.code.core.*
import prog8.code.source.SourceCode
import prog8.code.target.*
import prog8.code.target.C128Target
import prog8.code.target.C64Target
import prog8.code.target.PETTarget
import prog8.code.target.VMTarget
import prog8tests.helpers.DummyFunctions
import prog8tests.helpers.DummyMemsizer
import prog8tests.helpers.DummyStringEncoder
@ -253,7 +256,7 @@ class TestMemory: FunSpec({
}
context("memsizer") {
withData(VMTarget(), AtariTarget(), C64Target(), PETTarget(), AtariTarget(), C128Target(), Neo6502Target()) { target ->
withData(VMTarget(), C64Target(), PETTarget(), C128Target()) { target ->
shouldThrow<IllegalArgumentException> {
target.memorySize(BaseDataType.UNDEFINED)
}

View File

@ -17,12 +17,10 @@ help:
symboldumps:
mkdir -p source/_static/symboldumps
prog8c -target atari import-all-atari.p8 -dumpsymbols > source/_static/symboldumps/skeletons-atari.txt
prog8c -target c64 import-all-c64.p8 -dumpsymbols > source/_static/symboldumps/skeletons-c64.txt
prog8c -target c128 import-all-c128.p8 -dumpsymbols > source/_static/symboldumps/skeletons-c128.txt
prog8c -target cx16 import-all-cx16.p8 -dumpsymbols > source/_static/symboldumps/skeletons-cx16.txt
prog8c -target pet32 import-all-pet32.p8 -dumpsymbols > source/_static/symboldumps/skeletons-pet32.txt
prog8c -target neo import-all-neo.p8 -dumpsymbols > source/_static/symboldumps/skeletons-neo.txt
prog8c -target virtual import-all-virtual.p8 -dumpsymbols > source/_static/symboldumps/skeletons-virtual.txt

View File

@ -1,13 +0,0 @@
; all library modules for the atari compiler target
%import buffers
%import compression
%import coroutines
%import conv
%import cx16logo
%import math
%import prog8_lib
%import strings
%import syslib
%import test_stack
%import textio

View File

@ -1,10 +0,0 @@
; all library modules for the atari compiler target
%import buffers
%import compression
%import conv
%import coroutines
%import math
%import prog8_lib
%import strings
%import syslib

View File

@ -1,444 +0,0 @@
Prog8 compiler v11.0.1 by Irmen de Jong (irmen@razorvine.net)
This software is licensed under the GNU GPL 3.0, see https://www.gnu.org/licenses/gpl.html
Compiling program import-all-atari.p8
Compiler target: atari
LIBRARY MODULE NAME: buffers
----------------------------
smallringbuffer {
ubyte[] buffer
ubyte fill
ubyte head
ubyte tail
free () -> ubyte
get () -> ubyte
getw () -> uword
init ()
isempty () -> bool
isfull () -> bool
put (ubyte value)
putw (uword value)
size () -> ubyte
}
stack {
uword buffer_ptr
uword sp
free () -> uword
init ()
isempty () -> bool
isfull () -> bool
pop () -> ubyte
popw () -> uword
push (ubyte value)
pushw (uword value)
size () -> uword
}
ringbuffer {
uword buffer_ptr
uword fill
uword head
uword tail
free () -> uword
get () -> ubyte
getw () -> uword
inc_head ()
inc_tail ()
init ()
isempty () -> bool
isfull () -> bool
put (ubyte value)
putw (uword value)
size () -> uword
}
LIBRARY MODULE NAME: compression
--------------------------------
compression {
decode_rle (uword compressed @AY, uword target @R0, uword maxsize @R1) -> clobbers (X) -> uword @AY
decode_rle_srcfunc (uword source_function @AY, uword target @R0, uword maxsize @R1) -> clobbers (X) -> uword @AY
decode_tscrunch (uword compressed @R0, uword target @R1) -> clobbers (A,X,Y)
decode_tscrunch_inplace (uword compressed @R0) -> clobbers (A,X,Y)
decode_zx0 (uword compressed @R0, uword target @R1) -> clobbers (A,X,Y)
encode_rle (uword data, uword size, uword target, bool is_last_block) -> uword
encode_rle_outfunc (uword data, uword size, uword output_function, bool is_last_block)
}
LIBRARY MODULE NAME: conv
-------------------------
conv {
str @shared string_out
any2uword (str string @AY) -> clobbers (Y) -> ubyte @A
bin2uword (str string @AY) -> uword @AY
hex2uword (str string @AY) -> uword @AY
internal_byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X
internal_ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @X, ubyte @A
internal_ubyte2hex (ubyte value @A) -> clobbers (X) -> ubyte @A, ubyte @Y
internal_uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X
internal_uword2hex (uword value @AY) -> clobbers (A,Y)
str2byte (str string @AY) -> clobbers (Y) -> byte @A
str2ubyte (str string @AY) -> clobbers (Y) -> ubyte @A
str2uword (str string @AY) -> uword @AY
str2word (str string @AY) -> word @AY
str_b (byte value @A) -> clobbers (X) -> str @AY
str_ub (ubyte value @A) -> clobbers (X) -> str @AY
str_ub0 (ubyte value @A) -> clobbers (X) -> str @AY
str_ubbin (ubyte value @A) -> clobbers (X) -> str @AY
str_ubhex (ubyte value @A) -> clobbers (X) -> str @AY
str_uw (uword value @AY) -> clobbers (X) -> str @AY
str_uw0 (uword value @AY) -> clobbers (X) -> str @AY
str_uwbin (uword value @AY) -> clobbers (X) -> str @AY
str_uwhex (uword value @AY) -> str @AY
str_w (word value @AY) -> clobbers (X) -> str @AY
}
LIBRARY MODULE NAME: coroutines
-------------------------------
coroutines {
const ubyte MAX_TASKS
ubyte active_task
uword[] returnaddresses
uword supervisor
uword[] tasklist
uword[] userdatas
add (uword taskaddress, uword userdata) -> ubyte
current () -> ubyte
kill (ubyte taskid)
killall ()
run (uword supervisor_routine)
termination ()
yield () -> uword
}
LIBRARY MODULE NAME: cx16logo
-----------------------------
cx16logo {
uword[] logo_lines
logo ()
logo_at (ubyte column, ubyte row)
}
LIBRARY MODULE NAME: math
-------------------------
math {
atan2 (ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A
cos8 (ubyte angle @A) -> clobbers (Y) -> byte @A
cos8u (ubyte angle @A) -> clobbers (Y) -> ubyte @A
cosr8 (ubyte radians @A) -> clobbers (Y) -> byte @A
cosr8u (ubyte radians @A) -> clobbers (Y) -> ubyte @A
crc16 (uword data, uword length) -> uword
crc16_end () -> uword
crc16_start ()
crc16_update (ubyte value @A)
crc32 (uword data, uword length)
crc32_end ()
crc32_end_result () -> uword @R15, uword @R14
crc32_start ()
crc32_update (ubyte value)
diff (ubyte v1 @A, ubyte v2 @Y) -> ubyte @A
diffw (uword w1 @R0, uword w2 @AY) -> uword @AY
direction (ubyte x1, ubyte y1, ubyte x2, ubyte y2) -> ubyte
direction_qd (ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A
direction_sc (byte x1, byte y1, byte x2, byte y2) -> ubyte
interpolate (ubyte v, ubyte inputMin, ubyte inputMax, ubyte outputMin, ubyte outputMax) -> ubyte
lerp (ubyte v0, ubyte v1, ubyte t) -> ubyte
lerpw (uword v0, uword v1, uword t) -> uword
log2 (ubyte value @A) -> ubyte @Y
log2w (uword value @AY) -> ubyte @Y
mul16_last_upper () -> uword @AY
randrange (ubyte n) -> ubyte
randrangew (uword n) -> uword
rnd () -> clobbers (Y) -> ubyte @A
rndseed (uword seed1 @AY, uword seed2 @R0) -> clobbers (A,Y)
rndw () -> uword @AY
sin8 (ubyte angle @A) -> clobbers (Y) -> byte @A
sin8u (ubyte angle @A) -> clobbers (Y) -> ubyte @A
sinr8 (ubyte radians @A) -> clobbers (Y) -> byte @A
sinr8u (ubyte radians @A) -> clobbers (Y) -> ubyte @A
}
LIBRARY MODULE NAME: strings
----------------------------
strings {
append (uword target @R0, uword suffix @R1) -> clobbers (Y) -> ubyte @A
compare (uword string1 @R0, uword string2 @AY) -> clobbers (Y) -> byte @A
contains (uword string @AY, ubyte character @X) -> bool @Pc
copy (uword source @R0, uword target @AY) -> clobbers (A) -> ubyte @Y
endswith (str st, str suffix) -> bool
find (uword string @AY, ubyte character @X) -> ubyte @A, bool @Pc
findstr (str haystack, str needle) -> ubyte
hash (str string @R0) -> ubyte @A
isdigit (ubyte petsciichar @A) -> bool @Pc
isletter (ubyte petsciichar @A) -> bool @Pc
islower (ubyte petsciichar @A) -> bool @Pc
isprint (ubyte petsciichar @A) -> bool @Pc
isspace (ubyte petsciichar @A) -> bool @Pc
isupper (ubyte petsciichar @A) -> bool @Pc
left (uword source @AX, ubyte length @Y, uword target @R1) -> clobbers (A,Y)
length (uword string @AY) -> clobbers (A) -> ubyte @Y
lower (uword st @AY) -> ubyte @Y
lowerchar (ubyte character @A) -> ubyte @A
lstrip (str s)
lstripped (str s) -> str
ltrim (str s)
ltrimmed (str s) -> str
pattern_match (str string @AY, str pattern @R0) -> clobbers (Y) -> bool @A
rfind (uword string @AY, ubyte character @X) -> ubyte @A, bool @Pc
right (uword source @AY, ubyte length @X, uword target @R1) -> clobbers (A,Y)
rstrip (str s)
rtrim (str s)
slice (uword source @R0, ubyte start @A, ubyte length @Y, uword target @R1) -> clobbers (A,Y)
startswith (str st, str prefix) -> bool
strip (str s)
trim (str s)
upper (uword st @AY) -> ubyte @Y
upperchar (ubyte character @A) -> ubyte @A
}
LIBRARY MODULE NAME: syslib
---------------------------
atari {
&uword COLCRS
&uword IRQ_VEC
&uword NMI_VEC
&uword RESET_VEC
&ubyte ROWCRS
getchar () -> ubyte @A = $f24a
outchar (ubyte character @A) = $f2b0
waitkey () -> ubyte @A = $f2fd
}
sys {
const byte MAX_BYTE
const ubyte MAX_UBYTE
const uword MAX_UWORD
const word MAX_WORD
const byte MIN_BYTE
const ubyte MIN_UBYTE
const uword MIN_UWORD
const word MIN_WORD
const ubyte SIZEOF_BOOL
const ubyte SIZEOF_BYTE
const ubyte SIZEOF_FLOAT
const ubyte SIZEOF_UBYTE
const ubyte SIZEOF_UWORD
const ubyte SIZEOF_WORD
const ubyte target
clear_carry ()
clear_irqd ()
disable_caseswitch ()
enable_caseswitch ()
exit (ubyte returnvalue @A)
exit2 (ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y)
exit3 (ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc)
internal_stringcopy (uword source @R0, uword target @AY) -> clobbers (A,Y)
irqsafe_clear_irqd ()
irqsafe_set_irqd ()
memcmp (uword address1 @R0, uword address2 @R1, uword size @AY) -> byte @A
memcopy (uword source @R0, uword target @R1, uword count @AY) -> clobbers (A,X,Y)
memset (uword mem @R0, uword numbytes @R1, ubyte value @A) -> clobbers (A,X,Y)
memsetw (uword mem @R0, uword numwords @R1, uword value @AY) -> clobbers (A,X,Y)
pop () -> ubyte @A
popw () -> uword @AY
progend () -> uword @AY
progstart () -> uword @AY
push (ubyte value @A)
push_returnaddress (uword address @XY)
pushw (uword value @AY)
read_flags () -> ubyte @A
reset_system ()
restore_prog8_internals ()
save_prog8_internals ()
set_carry ()
set_irqd ()
wait (uword jiffies)
waitvsync () -> clobbers (A)
}
cx16 {
&uword r0
&ubyte r0H
&ubyte r0L
&word r0s
&byte r0sH
&byte r0sL
&uword r1
&uword r10
&ubyte r10H
&ubyte r10L
&word r10s
&byte r10sH
&byte r10sL
&uword r11
&ubyte r11H
&ubyte r11L
&word r11s
&byte r11sH
&byte r11sL
&uword r12
&ubyte r12H
&ubyte r12L
&word r12s
&byte r12sH
&byte r12sL
&uword r13
&ubyte r13H
&ubyte r13L
&word r13s
&byte r13sH
&byte r13sL
&uword r14
&ubyte r14H
&ubyte r14L
&word r14s
&byte r14sH
&byte r14sL
&uword r15
&ubyte r15H
&ubyte r15L
&word r15s
&byte r15sH
&byte r15sL
&ubyte r1H
&ubyte r1L
&word r1s
&byte r1sH
&byte r1sL
&uword r2
&ubyte r2H
&ubyte r2L
&word r2s
&byte r2sH
&byte r2sL
&uword r3
&ubyte r3H
&ubyte r3L
&word r3s
&byte r3sH
&byte r3sL
&uword r4
&ubyte r4H
&ubyte r4L
&word r4s
&byte r4sH
&byte r4sL
&uword r5
&ubyte r5H
&ubyte r5L
&word r5s
&byte r5sH
&byte r5sL
&uword r6
&ubyte r6H
&ubyte r6L
&word r6s
&byte r6sH
&byte r6sL
&uword r7
&ubyte r7H
&ubyte r7L
&word r7s
&byte r7sH
&byte r7sL
&uword r8
&ubyte r8H
&ubyte r8L
&word r8s
&byte r8sH
&byte r8sL
&uword r9
&ubyte r9H
&ubyte r9L
&word r9s
&byte r9sH
&byte r9sL
cpu_is_65816 () -> bool
restore_virtual_registers () -> clobbers (A,Y)
save_virtual_registers () -> clobbers (A,Y)
}
p8_sys_startup {
cleanup_at_exit ()
init_system ()
init_system_phase2 ()
}
LIBRARY MODULE NAME: test_stack
-------------------------------
test_stack {
test ()
}
LIBRARY MODULE NAME: textio
---------------------------
txt {
const ubyte DEFAULT_HEIGHT
const ubyte DEFAULT_WIDTH
bell ()
chrout (ubyte character @A)
clear_screen ()
clear_screenchars (ubyte character @A) -> clobbers (Y)
clear_screencolors (ubyte color @A) -> clobbers (Y)
cls ()
color (ubyte txtcol)
column (ubyte col)
fill_screen (ubyte character @A, ubyte color @Y) -> clobbers (A)
get_column () -> ubyte
get_cursor (uword colptr, uword rowptr)
get_row () -> ubyte
getchr (ubyte col @A, ubyte row @Y) -> clobbers (Y) -> ubyte @A
getclr (ubyte col @A, ubyte row @Y) -> clobbers (Y) -> ubyte @A
height () -> clobbers (X,Y) -> ubyte @A
input_chars (uword buffer @AY) -> clobbers (A) -> ubyte @Y
lowercase ()
nl ()
plot (ubyte col, ubyte rownum)
print (str text @AY) -> clobbers (A,Y)
print_b (byte value @A) -> clobbers (A,X,Y)
print_ub (ubyte value @A) -> clobbers (A,X,Y)
print_ub0 (ubyte value @A) -> clobbers (A,X,Y)
print_ubbin (ubyte value @A, bool prefix @Pc) -> clobbers (A,X,Y)
print_ubhex (ubyte value @A, bool prefix @Pc) -> clobbers (A,X,Y)
print_uw (uword value @AY) -> clobbers (A,X,Y)
print_uw0 (uword value @AY) -> clobbers (A,X,Y)
print_uwbin (uword value @AY, bool prefix @Pc) -> clobbers (A,X,Y)
print_uwhex (uword value @AY, bool prefix @Pc) -> clobbers (A,X,Y)
print_w (word value @AY) -> clobbers (A,X,Y)
row (ubyte rownum)
scroll_down (bool alsocolors @Pc) -> clobbers (A)
scroll_left (bool alsocolors @Pc) -> clobbers (A,Y)
scroll_right (bool alsocolors @Pc) -> clobbers (A)
scroll_up (bool alsocolors @Pc) -> clobbers (A)
setcc (ubyte col, ubyte row, ubyte char, ubyte charcolor)
setchr (ubyte col @X, ubyte row @Y, ubyte character @A) -> clobbers (A,Y)
setclr (ubyte col @X, ubyte row @Y, ubyte color @A) -> clobbers (A,Y)
spc ()
uppercase ()
waitkey () -> ubyte @A
width () -> clobbers (X,Y) -> ubyte @A
}

View File

@ -1,369 +0,0 @@
Prog8 compiler v11.0.1 by Irmen de Jong (irmen@razorvine.net)
This software is licensed under the GNU GPL 3.0, see https://www.gnu.org/licenses/gpl.html
Compiling program import-all-neo.p8
Compiler target: neo
LIBRARY MODULE NAME: buffers
----------------------------
smallringbuffer {
ubyte[] buffer
ubyte fill
ubyte head
ubyte tail
free () -> ubyte
get () -> ubyte
getw () -> uword
init ()
isempty () -> bool
isfull () -> bool
put (ubyte value)
putw (uword value)
size () -> ubyte
}
stack {
uword buffer_ptr
uword sp
free () -> uword
init ()
isempty () -> bool
isfull () -> bool
pop () -> ubyte
popw () -> uword
push (ubyte value)
pushw (uword value)
size () -> uword
}
ringbuffer {
uword buffer_ptr
uword fill
uword head
uword tail
free () -> uword
get () -> ubyte
getw () -> uword
inc_head ()
inc_tail ()
init ()
isempty () -> bool
isfull () -> bool
put (ubyte value)
putw (uword value)
size () -> uword
}
LIBRARY MODULE NAME: compression
--------------------------------
compression {
decode_rle (uword compressed @AY, uword target @R0, uword maxsize @R1) -> clobbers (X) -> uword @AY
decode_rle_srcfunc (uword source_function @AY, uword target @R0, uword maxsize @R1) -> clobbers (X) -> uword @AY
decode_tscrunch (uword compressed @R0, uword target @R1) -> clobbers (A,X,Y)
decode_tscrunch_inplace (uword compressed @R0) -> clobbers (A,X,Y)
decode_zx0 (uword compressed @R0, uword target @R1) -> clobbers (A,X,Y)
encode_rle (uword data, uword size, uword target, bool is_last_block) -> uword
encode_rle_outfunc (uword data, uword size, uword output_function, bool is_last_block)
}
LIBRARY MODULE NAME: conv
-------------------------
conv {
str @shared string_out
any2uword (str string @AY) -> clobbers (Y) -> ubyte @A
bin2uword (str string @AY) -> uword @AY
hex2uword (str string @AY) -> uword @AY
internal_byte2decimal (byte value @A) -> ubyte @Y, ubyte @A, ubyte @X
internal_ubyte2decimal (ubyte value @A) -> ubyte @Y, ubyte @X, ubyte @A
internal_ubyte2hex (ubyte value @A) -> clobbers (X) -> ubyte @A, ubyte @Y
internal_uword2decimal (uword value @AY) -> ubyte @Y, ubyte @A, ubyte @X
internal_uword2hex (uword value @AY) -> clobbers (A,Y)
str2byte (str string @AY) -> clobbers (Y) -> byte @A
str2ubyte (str string @AY) -> clobbers (Y) -> ubyte @A
str2uword (str string @AY) -> uword @AY
str2word (str string @AY) -> word @AY
str_b (byte value @A) -> clobbers (X) -> str @AY
str_ub (ubyte value @A) -> clobbers (X) -> str @AY
str_ub0 (ubyte value @A) -> clobbers (X) -> str @AY
str_ubbin (ubyte value @A) -> clobbers (X) -> str @AY
str_ubhex (ubyte value @A) -> clobbers (X) -> str @AY
str_uw (uword value @AY) -> clobbers (X) -> str @AY
str_uw0 (uword value @AY) -> clobbers (X) -> str @AY
str_uwbin (uword value @AY) -> clobbers (X) -> str @AY
str_uwhex (uword value @AY) -> str @AY
str_w (word value @AY) -> clobbers (X) -> str @AY
}
LIBRARY MODULE NAME: coroutines
-------------------------------
coroutines {
const ubyte MAX_TASKS
ubyte active_task
uword[] returnaddresses
uword supervisor
uword[] tasklist
uword[] userdatas
add (uword taskaddress, uword userdata) -> ubyte
current () -> ubyte
kill (ubyte taskid)
killall ()
run (uword supervisor_routine)
termination ()
yield () -> uword
}
LIBRARY MODULE NAME: math
-------------------------
math {
atan2 (ubyte x1 @R0, ubyte y1 @R1, ubyte x2 @R2, ubyte y2 @R3) -> ubyte @A
cos8 (ubyte angle @A) -> clobbers (Y) -> byte @A
cos8u (ubyte angle @A) -> clobbers (Y) -> ubyte @A
cosr8 (ubyte radians @A) -> clobbers (Y) -> byte @A
cosr8u (ubyte radians @A) -> clobbers (Y) -> ubyte @A
crc16 (uword data, uword length) -> uword
crc16_end () -> uword
crc16_start ()
crc16_update (ubyte value @A)
crc32 (uword data, uword length)
crc32_end ()
crc32_end_result () -> uword @R15, uword @R14
crc32_start ()
crc32_update (ubyte value)
diff (ubyte v1 @A, ubyte v2 @Y) -> ubyte @A
diffw (uword w1 @R0, uword w2 @AY) -> uword @AY
direction (ubyte x1, ubyte y1, ubyte x2, ubyte y2) -> ubyte
direction_qd (ubyte quadrant @A, ubyte xdelta @X, ubyte ydelta @Y) -> ubyte @A
direction_sc (byte x1, byte y1, byte x2, byte y2) -> ubyte
interpolate (ubyte v, ubyte inputMin, ubyte inputMax, ubyte outputMin, ubyte outputMax) -> ubyte
lerp (ubyte v0, ubyte v1, ubyte t) -> ubyte
lerpw (uword v0, uword v1, uword t) -> uword
log2 (ubyte value @A) -> ubyte @Y
log2w (uword value @AY) -> ubyte @Y
mul16_last_upper () -> uword @AY
randrange (ubyte n) -> ubyte
randrangew (uword n) -> uword
rnd () -> clobbers (Y) -> ubyte @A
rndseed (uword seed1 @AY, uword seed2 @R0) -> clobbers (A,Y)
rndw () -> uword @AY
sin8 (ubyte angle @A) -> clobbers (Y) -> byte @A
sin8u (ubyte angle @A) -> clobbers (Y) -> ubyte @A
sinr8 (ubyte radians @A) -> clobbers (Y) -> byte @A
sinr8u (ubyte radians @A) -> clobbers (Y) -> ubyte @A
}
LIBRARY MODULE NAME: strings
----------------------------
strings {
append (uword target @R0, uword suffix @R1) -> clobbers (Y) -> ubyte @A
compare (uword string1 @R0, uword string2 @AY) -> clobbers (Y) -> byte @A
contains (uword string @AY, ubyte character @X) -> bool @Pc
copy (uword source @R0, uword target @AY) -> clobbers (A) -> ubyte @Y
endswith (str st, str suffix) -> bool
find (uword string @AY, ubyte character @X) -> ubyte @A, bool @Pc
findstr (str haystack, str needle) -> ubyte
hash (str string @R0) -> ubyte @A
isdigit (ubyte petsciichar @A) -> bool @Pc
isletter (ubyte petsciichar @A) -> bool @Pc
islower (ubyte petsciichar @A) -> bool @Pc
isprint (ubyte petsciichar @A) -> bool @Pc
isspace (ubyte petsciichar @A) -> bool @Pc
isupper (ubyte petsciichar @A) -> bool @Pc
left (uword source @AX, ubyte length @Y, uword target @R1) -> clobbers (A,Y)
length (uword string @AY) -> clobbers (A) -> ubyte @Y
lower (uword st @AY) -> ubyte @Y
lowerchar (ubyte character @A) -> ubyte @A
lstrip (str s)
lstripped (str s) -> str
ltrim (str s)
ltrimmed (str s) -> str
pattern_match (str string @AY, str pattern @R0) -> clobbers (Y) -> bool @A
rfind (uword string @AY, ubyte character @X) -> ubyte @A, bool @Pc
right (uword source @AY, ubyte length @X, uword target @R1) -> clobbers (A,Y)
rstrip (str s)
rtrim (str s)
slice (uword source @R0, ubyte start @A, ubyte length @Y, uword target @R1) -> clobbers (A,Y)
startswith (str st, str prefix) -> bool
strip (str s)
trim (str s)
upper (uword st @AY) -> ubyte @Y
upperchar (ubyte character @A) -> ubyte @A
}
LIBRARY MODULE NAME: syslib
---------------------------
neo {
&uword IRQ_VEC
&uword NMI_VEC
&uword RESET_VEC
}
sys {
const byte MAX_BYTE
const ubyte MAX_UBYTE
const uword MAX_UWORD
const word MAX_WORD
const byte MIN_BYTE
const ubyte MIN_UBYTE
const uword MIN_UWORD
const word MIN_WORD
const ubyte SIZEOF_BOOL
const ubyte SIZEOF_BYTE
const ubyte SIZEOF_FLOAT
const ubyte SIZEOF_UBYTE
const ubyte SIZEOF_UWORD
const ubyte SIZEOF_WORD
const ubyte target
clear_carry ()
clear_irqd ()
disable_caseswitch ()
enable_caseswitch ()
exit (ubyte returnvalue @A)
exit2 (ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y)
exit3 (ubyte resulta @A, ubyte resultx @X, ubyte resulty @Y, bool carry @Pc)
internal_stringcopy (uword source @R0, uword target @AY) -> clobbers (A,Y)
irqsafe_clear_irqd ()
irqsafe_set_irqd ()
memcopy (uword source @R0, uword target @R1, uword count @AY) -> clobbers (A,X,Y)
memset (uword mem @R0, uword numbytes @R1, ubyte value @A) -> clobbers (A,X,Y)
memsetw (uword mem @R0, uword numwords @R1, uword value @AY) -> clobbers (A,X,Y)
pop () -> ubyte @A
popw () -> uword @AY
progend () -> uword @AY
progstart () -> uword @AY
push (ubyte value @A)
push_returnaddress (uword address @XY)
pushw (uword value @AY)
read_flags () -> ubyte @A
reset_system ()
restore_prog8_internals ()
save_prog8_internals ()
set_carry ()
set_irqd ()
wait (uword jiffies)
waitvsync () -> clobbers (A)
}
cx16 {
&uword r0
&ubyte r0H
&ubyte r0L
&word r0s
&byte r0sH
&byte r0sL
&uword r1
&uword r10
&ubyte r10H
&ubyte r10L
&word r10s
&byte r10sH
&byte r10sL
&uword r11
&ubyte r11H
&ubyte r11L
&word r11s
&byte r11sH
&byte r11sL
&uword r12
&ubyte r12H
&ubyte r12L
&word r12s
&byte r12sH
&byte r12sL
&uword r13
&ubyte r13H
&ubyte r13L
&word r13s
&byte r13sH
&byte r13sL
&uword r14
&ubyte r14H
&ubyte r14L
&word r14s
&byte r14sH
&byte r14sL
&uword r15
&ubyte r15H
&ubyte r15L
&word r15s
&byte r15sH
&byte r15sL
&ubyte r1H
&ubyte r1L
&word r1s
&byte r1sH
&byte r1sL
&uword r2
&ubyte r2H
&ubyte r2L
&word r2s
&byte r2sH
&byte r2sL
&uword r3
&ubyte r3H
&ubyte r3L
&word r3s
&byte r3sH
&byte r3sL
&uword r4
&ubyte r4H
&ubyte r4L
&word r4s
&byte r4sH
&byte r4sL
&uword r5
&ubyte r5H
&ubyte r5L
&word r5s
&byte r5sH
&byte r5sL
&uword r6
&ubyte r6H
&ubyte r6L
&word r6s
&byte r6sH
&byte r6sL
&uword r7
&ubyte r7H
&ubyte r7L
&word r7s
&byte r7sH
&byte r7sL
&uword r8
&ubyte r8H
&ubyte r8L
&word r8s
&byte r8sH
&byte r8sL
&uword r9
&ubyte r9H
&ubyte r9L
&word r9s
&byte r9sH
&byte r9sL
cpu_is_65816 () -> bool
restore_virtual_registers () -> clobbers (A,Y)
save_virtual_registers () -> clobbers (A,Y)
}
p8_sys_startup {
cleanup_at_exit ()
init_system ()
init_system_phase2 ()
}

View File

@ -231,7 +231,7 @@ One or more .p8 module files
``-target <compilation target>``
Sets the target output of the compiler. This option is required.
``c64`` = Commodore 64, ``c128`` = Commodore 128, ``cx16`` = Commander X16, ``pet32`` - Commodore PET model 4032,
``atari`` = Atari 800 XL, ``neo`` = Neo6502, ``virtual`` = builtin virtual machine.
``virtual`` = builtin virtual machine.
You can also specify a file name as target, prog8 will when try to read the target
machine's configuration and properties from that configuration file instead of using one of the built-in targets.
See :ref:`customizable_target` for details about this.

View File

@ -205,8 +205,6 @@ If you're targeting the Commander X16 instead,
download a recent emulator version for the CommanderX16, such as `x16emu <https://cx16forum.com/forum/viewforum.php?f=30>`_
(preferred, this is the official emulator. If required, source code is `here <https://github.com/X16Community/x16-emulator/>`_.
There is also `Box16 <https://github.com/indigodarkwolf/box16>`_ which has powerful debugging features.
For the Atari target, it assumes the "atari800" or "altirra" emulator.
For the Neo6502, it assumes "neo" is the emulator program.
If multiple options are listed above, you can select which one you want to launch using the ``-emu`` or ``-emu2`` command line options.
**Syntax highlighting:** for a few different editors, syntax highlighting definition files are provided.

View File

@ -238,12 +238,10 @@ Low-fi variable and subroutine definitions in all available library modules
These are auto generated and contain no documentation, but provide a view into what's available.
Grouped per compilation target.
* `atari <_static/symboldumps/skeletons-atari.txt>`_
* `c64 <_static/symboldumps/skeletons-c64.txt>`_
* `c128 <_static/symboldumps/skeletons-c128.txt>`_
* `cx16 <_static/symboldumps/skeletons-cx16.txt>`_
* `pet32 <_static/symboldumps/skeletons-pet32.txt>`_
* `neo <_static/symboldumps/skeletons-neo.txt>`_
* `virtual <_static/symboldumps/skeletons-virtual.txt>`_
@ -985,7 +983,7 @@ as ROM/Kernal subroutine definitions, memory location constants, and utility sub
Many of these definitions overlap for the C64 and Commander X16 targets so it is still possible
to write programs that work on both targets without modifications.
This module is usually imported automatically and can provide definitions in the ``sys``, ``cbm``, ``c64``, ``cx16``, ``c128``, ``atari`` blocks
This module is usually imported automatically and can provide definitions in the ``sys``, ``cbm``, ``c64``, ``cx16``, ``c128`` blocks
depending on the chosen compilation target. Read the `sys lib source code <https://github.com/irmen/prog8/tree/master/compiler/res/prog8lib>`_ for the correct compilation target to see exactly what is there.

View File

@ -15,8 +15,6 @@ Currently these machines can be selected as a compilation target (via the ``-tar
- 'cx16': the `Commander X16 <https://www.commanderx16.com/>`_
- 'c128': the Commodore 128 (*limited support*)
- 'pet32': the Commodore PET 4032 (*limited support*)
- 'atari': the Atari 800 XL (*experimental*)
- 'neo': the `Neo6502 <https://github.com/paulscottrobson/neo6502-firmware/wiki>`_ (*experimental*)
- 'virtual': a builtin virtual machine
This chapter explains some relevant system details of the c64 and cx16 machines.

View File

@ -1,9 +1,9 @@
TODO
====
- Make neo and atari targets external via configs? They are very bare bones atm so easier to contribute to if they're configurable externally? What about the pet32 target
- (WIP) Make neo and atari targets external via configs? They are very bare bones atm so easier to contribute to if they're configurable externally? What about the pet32 target
- add Adiee5's NES target and example to the docs somewhere https://github.com/adiee5/prog8-nes-target
- add Adiee5's NES target and example to the docs (or the custom targets examples) somewhere https://github.com/adiee5/prog8-nes-target
- add paypal donation button as well?
- announce prog8 on the 6502.org site?
@ -14,7 +14,7 @@ TODO
Future Things and Ideas
^^^^^^^^^^^^^^^^^^^^^^^
- Improve compilation target configurability: the program type (CBMPRG, ATARIXEX etc) is still hardcoded into the compiler (AssemblyProgram.kt)
- Improve compilation target configurability: the program type (CBMPRG, ATARIXEX etc) is still hardcoded into the compiler (AssemblyProgram.kt) + emulator binary
- Look at github PR for improved romability
- Kotlin: can we use inline value classes in certain spots?
- add float support to the configurable compiler targets
@ -67,11 +67,11 @@ IR/VM
Libraries
---------
- Sorting module gnomesort_uw could be optimized more by fully rewriting it in asm? Shellshort seems consistently faster even if most of the words are already sorted.
- See if the raster interrupt handler on the C64 can be tweaked to be a more stable raster irq
- Add split-word array sorting routines to sorting module?
- add even more general raster irq routines to build some sort of "copper list" , like Oscar64 has?
- pet32 target: make syslib more complete (missing kernal routines)?
- need help with: PET disk routines (OPEN, SETLFS etc are not exposed as kernal calls)
- fix the problems in atari target, and flesh out its libraries.
- c128 target: make syslib more complete (missing kernal routines)?
- VM: implement the last diskio support (file listings)

View File

@ -11,7 +11,7 @@ main {
gfx_hires.graphics_mode() ; select 640*480 mode, 4 colors
mouse.set_pointer_image()
cx16.mouse_config(-1, 640/8, 240/8)
palette.set_rgb([$aaa, $000, $fff, $68c], 4, 0) ; set Amiga's workbench 2.0 gray, black, white, lightblue colors
palette.set_rgb_nosplit([$aaa, $000, $fff, $68c], 4, 0) ; set Amiga's workbench 2.0 gray, black, white, lightblue colors
cx16.VERA_DC_VSCALE = 64 ; have the vertical resolution so it is 640*240 - more or less Amiga's default non interlaced mode
gfx_hires.text_charset(1)