mirror of
https://github.com/irmen/prog8.git
synced 2026-10-22 05:02:58 +00:00
added amiga1200 target (68020 + FPU)
This commit is contained in:
1 parent
e074fe614f
commit
687d86d36e
88 files changed
+16753
-10922
No files matched your search
@@ -105,7 +105,8 @@ What does Prog8 provide?
|
||||
- "c64": Commodore-64 (6502 like CPU)
|
||||
- "c128": Commodore-128 (6502 like CPU - the Z80 cpu mode is not supported)
|
||||
- "pet32": Commodore PET (limited support)
|
||||
- "amiga500": Commodore Amiga 500 (32-bit 68000 CPU - the intended machine for the m68k code generator backend)
|
||||
- "amiga500": Commodore Amiga 500 (16/32-bit 68000 CPU)
|
||||
- "amiga1200": Commodore Amiga 1200 (32-bit 68020 CPU with optional FPU)
|
||||
- "qemu68k": Qemu M68k simulator (experimental)
|
||||
- via external configurable targets: Atari 800 XL, Neo6502, NES, C64 OS, Foenix F256, ...
|
||||
- If you only use standard kernal and prog8 library routines, it is possible to compile the *exact same program* for different machines (just change the compiler target flag)
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
package prog8.code.target
|
||||
|
||||
import prog8.code.core.*
|
||||
import prog8.code.target.encodings.Encoder
|
||||
import java.nio.file.Path
|
||||
|
||||
|
||||
class Amiga1200Target: ICompilationTarget,
|
||||
IStringEncoding by Encoder(false),
|
||||
IMemSizer by NormalMemSizer(4u, 4u) {
|
||||
|
||||
override val name = NAME
|
||||
override val supportsBankedCalls = true
|
||||
override val defaultEncoding = Encoding.ISO
|
||||
override val libraryPath = null
|
||||
override val customLauncher = emptyList<String>()
|
||||
override val additionalAssemblerOptions = emptyList<String>()
|
||||
override val defaultOutputType = OutputType.AMIGAHUNK
|
||||
override val defaultLauncherType = CbmPrgLauncherType.NONE
|
||||
|
||||
companion object {
|
||||
const val NAME = "amiga1200"
|
||||
|
||||
/** needed to map bank numbers to libraries in extsub/CALLFAR library calls */
|
||||
val LibraryNumbers = Amiga500Target.LibraryNumbers
|
||||
}
|
||||
|
||||
override val cpu = CpuType.M68020
|
||||
|
||||
override val FLOAT_MAX_POSITIVE = Float.MAX_VALUE.toDouble()
|
||||
override val FLOAT_MAX_NEGATIVE = -Float.MAX_VALUE.toDouble()
|
||||
override val FLOAT_MEM_SIZE = 4u
|
||||
override val POINTER_MEM_SIZE = 4u
|
||||
override val ARRAY_SIZE_LIMIT = 32768u
|
||||
override val PROGRAM_LOAD_ADDRESS = 0u // amiga executables are relocatable
|
||||
override val PROGRAM_MEMTOP_ADDRESS = 0xfffffffeu // not actually used
|
||||
|
||||
override val BSSHIGHRAM_START = 0u // not used
|
||||
override val BSSHIGHRAM_END = 0u // not used
|
||||
override val BSSGOLDENRAM_START = 0u // not used
|
||||
override val BSSGOLDENRAM_END = 0u // not used
|
||||
override lateinit var zeropage: Zeropage
|
||||
|
||||
override fun getFloatAsmBytes(num: Number): String {
|
||||
TODO("float asm bytes")
|
||||
}
|
||||
|
||||
override fun convertFloatToBytes(num: Double): List<UByte> {
|
||||
TODO("convert float to bytes")
|
||||
}
|
||||
|
||||
override fun convertBytesToFloat(bytes: List<UByte>): Double {
|
||||
require(bytes.size==4) { "need 4 bytes" }
|
||||
TODO("convert bytes to float")
|
||||
}
|
||||
|
||||
override fun launchEmulator(selectedEmulator: Int, programNameWithPath: Path, quiet: Boolean) {
|
||||
if(selectedEmulator!=1) {
|
||||
System.err.println("The amiga1200 target only supports the main emulator (Amitools's vamos).")
|
||||
return
|
||||
}
|
||||
val cpuStr = when(this.cpu) {
|
||||
CpuType.M68000 -> "68000"
|
||||
CpuType.M68020 -> "68020"
|
||||
else -> error("invalid cpu type")
|
||||
}
|
||||
val exeFile = programNameWithPath.resolveSibling("${programNameWithPath.fileName}")
|
||||
val cmd =
|
||||
listOf(
|
||||
"vamos",
|
||||
"--cpu", cpuStr,
|
||||
exeFile.toString(),
|
||||
)
|
||||
if(!quiet)
|
||||
println("Launching Amitools's Vamos...")
|
||||
val pb = ProcessBuilder(cmd).inheritIO()
|
||||
try {
|
||||
pb.start().waitFor()
|
||||
} catch(_: Exception) {
|
||||
System.err.println("Cannot find 'vamos' (Amitools's Amiga emulator). Install it from: https://github.com/cnvogelg/amitools")
|
||||
}
|
||||
}
|
||||
|
||||
override fun isIOAddress(address: UInt): Boolean =
|
||||
address in 0xbfd000u..0xbfdfffu || // CIA-B
|
||||
address in 0xbfe000u..0xbfefffu || // CIA-A
|
||||
address in 0xdff000u..0xdff1ffu || // Custom chipset (Paula, Alice, Lisa, Denise)
|
||||
address in 0xe80000u..0xefffffu // Zorro II autoconfig space
|
||||
|
||||
override fun initializeMemoryAreas(compilerOptions: CompilationOptions) {
|
||||
zeropage = Amiga1200Zeropage(compilerOptions)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class Amiga1200Zeropage(options: CompilationOptions): Zeropage(options) {
|
||||
override val SCRATCH_B1: UInt
|
||||
get() = throw IllegalStateException("m68k shouldn't use this zeropage variable")
|
||||
override val SCRATCH_REG: UInt
|
||||
get() = throw IllegalStateException("m68k shouldn't use this zeropage variable")
|
||||
override val SCRATCH_W1: UInt
|
||||
get() = throw IllegalStateException("m68k shouldn't use this zeropage variable")
|
||||
override val SCRATCH_W2: UInt
|
||||
get() = throw IllegalStateException("m68k shouldn't use this zeropage variable")
|
||||
override val SCRATCH_PTR: UInt
|
||||
get() = throw IllegalStateException("m68k shouldn't use this zeropage variable")
|
||||
}
|
||||
@@ -31,7 +31,7 @@ class C64Target: ICompilationTarget,
|
||||
|
||||
override val FLOAT_MAX_POSITIVE = Mflpt5.FLOAT_MAX_POSITIVE
|
||||
override val FLOAT_MAX_NEGATIVE = Mflpt5.FLOAT_MAX_NEGATIVE
|
||||
override val FLOAT_MEM_SIZE = Mflpt5.FLOAT_MEM_SIZE.toUInt()
|
||||
override val FLOAT_MEM_SIZE = Mflpt5.FLOAT_MEM_SIZE
|
||||
override val POINTER_MEM_SIZE = 2u
|
||||
override val ARRAY_SIZE_LIMIT = 256u
|
||||
override val PROGRAM_LOAD_ADDRESS = 0x0801u
|
||||
@@ -101,6 +101,7 @@ val CompilationTargets = listOf(
|
||||
PETTarget.NAME,
|
||||
Qemu68kTarget.NAME,
|
||||
Amiga500Target.NAME,
|
||||
Amiga1200Target.NAME,
|
||||
VMTarget.NAME
|
||||
)
|
||||
|
||||
@@ -111,6 +112,7 @@ fun getCompilationTargetByName(name: String) = when(name.lowercase()) {
|
||||
PETTarget.NAME -> PETTarget()
|
||||
Qemu68kTarget.NAME -> Qemu68kTarget()
|
||||
Amiga500Target.NAME -> Amiga500Target()
|
||||
Amiga1200Target.NAME -> Amiga1200Target()
|
||||
VMTarget.NAME -> VMTarget()
|
||||
else -> throw IllegalArgumentException("invalid compilation target")
|
||||
}
|
||||
@@ -163,7 +163,7 @@ object RegisterPacker {
|
||||
if (chunk.instructions.isEmpty())
|
||||
continue
|
||||
|
||||
var liveSet = liveOut[chunk]?.toMutableSet() ?: mutableSetOf()
|
||||
val liveSet = liveOut[chunk]?.toMutableSet() ?: mutableSetOf()
|
||||
val lastUse = mutableMapOf<Int, Int>()
|
||||
|
||||
// Scan backward through instructions
|
||||
|
||||
@@ -316,10 +316,10 @@ internal class AsmGen(val program: IRProgram, internal val target: ICompilationT
|
||||
emitDataSection()
|
||||
emitBssSection()
|
||||
|
||||
if(target.name=="amiga500") {
|
||||
if(program.options.output == OutputType.AMIGAHUNK) {
|
||||
emitRaw("prog8_program_end: ; end of the program")
|
||||
} else {
|
||||
// label prog8_program_end is defined by the linker script
|
||||
// label prog8_program_end is defined by the linker script (ELF)
|
||||
}
|
||||
|
||||
val options = program.options
|
||||
@@ -406,7 +406,7 @@ internal class AsmGen(val program: IRProgram, internal val target: ICompilationT
|
||||
// extb.l is a 68020+ instruction; on the 68000 use the two-step EXT sequence
|
||||
// (ext.w then ext.l) which is functionally equivalent.
|
||||
internal fun AsmGen.emitSignExtendByteToLong(reg: String) {
|
||||
if (cpu == CpuType.M68000) {
|
||||
if (cpu <= CpuType.M68000) {
|
||||
emitLine("ext.w $reg")
|
||||
emitLine("ext.l $reg")
|
||||
} else {
|
||||
@@ -423,7 +423,7 @@ internal class AsmGen(val program: IRProgram, internal val target: ICompilationT
|
||||
|
||||
for (block in program.blocks) {
|
||||
val blockLabel = fixNameSymbols(block.label)
|
||||
val chipram = target.name == "amiga500" && block.options.amigaChipram
|
||||
val chipram = target.name in setOf("amiga500", "amiga1200") && block.options.amigaChipram
|
||||
if (chipram) {
|
||||
emitRaw(" SECTION code_c,code,chip ; amiga CHIP ram code")
|
||||
}
|
||||
@@ -801,7 +801,7 @@ internal class AsmGen(val program: IRProgram, internal val target: ICompilationT
|
||||
// === data section ===
|
||||
|
||||
private fun emitDataSection() {
|
||||
val chipramBlocks = if (target.name == "amiga500") chipramBlockLabels() else emptySet()
|
||||
val chipramBlocks = if (target.name in setOf("amiga500", "amiga1200")) chipramBlockLabels() else emptySet()
|
||||
val initdVars: List<IRStStaticVariable> = program.st.allVariables().filter { !it.inBss }.toList()
|
||||
val (chipramVars: List<IRStStaticVariable>, normalVars: List<IRStStaticVariable>) =
|
||||
if (chipramBlocks.isNotEmpty()) {
|
||||
@@ -1107,7 +1107,7 @@ internal class AsmGen(val program: IRProgram, internal val target: ICompilationT
|
||||
|
||||
|
||||
private fun emitBssSection() {
|
||||
val chipramBlocks = if (target.name == "amiga500") chipramBlockLabels() else emptySet()
|
||||
val chipramBlocks = if (target.name in setOf("amiga500", "amiga1200")) chipramBlockLabels() else emptySet()
|
||||
|
||||
// 1. Map variables to their sizes and actual M68k alignment requirements
|
||||
val allBssVars: List<IRStStaticVariable> = program.st.allVariables().filter { it.inBss }.toList()
|
||||
|
||||
@@ -5,6 +5,7 @@ import prog8.code.core.CompilationOptions
|
||||
import prog8.code.core.CpuType
|
||||
import prog8.code.core.IErrorReporter
|
||||
import prog8.code.core.OutputType
|
||||
import prog8.code.target.Amiga1200Target
|
||||
import prog8.code.target.Amiga500Target
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
@@ -55,36 +56,7 @@ class AssemblyProgramM68k(override val name: String, private val outputDir: Path
|
||||
}
|
||||
val assemblerCpu = if(options.compTarget.name == "amiga500" && options.floats) "68020" else cpu
|
||||
|
||||
val loadAddr = options.compTarget.PROGRAM_LOAD_ADDRESS.toInt()
|
||||
when(options.output) {
|
||||
OutputType.RAW -> {
|
||||
val rawFile = outputDir.resolve("$name.bin")
|
||||
val listFile = outputDir.resolve("$name.lis")
|
||||
val assembleCmd = mutableListOf(
|
||||
"vasmm68k_mot",
|
||||
"-m$assemblerCpu",
|
||||
"-m68881", // enable FPU
|
||||
"-Fbin",
|
||||
"-opt-speed",
|
||||
"-warnunaligned",
|
||||
"-ldots",
|
||||
"-spaces",
|
||||
"-join=0x${loadAddr.toString(16)}",
|
||||
"-o", rawFile.toString(),
|
||||
assemblyFile.toString()
|
||||
)
|
||||
if (options.asmListfile)
|
||||
assembleCmd.addAll(listOf("-L", listFile.toString()))
|
||||
if (options.asmQuiet)
|
||||
assembleCmd.add("-quiet")
|
||||
// clean up any leftover ELF/obj files from previous builds
|
||||
Files.deleteIfExists(outputDir.resolve("$name.elf"))
|
||||
Files.deleteIfExists(outputDir.resolve("$name.o"))
|
||||
val ok = runProcess(assembleCmd, options.quiet, "vasm")
|
||||
if(ok && !options.quiet)
|
||||
println("Executable written to '$rawFile'")
|
||||
return ok
|
||||
}
|
||||
OutputType.ELF -> {
|
||||
// Step 1: assemble to ELF object file
|
||||
val objFile = outputDir.resolve("$name.o")
|
||||
@@ -161,8 +133,8 @@ class AssemblyProgramM68k(override val name: String, private val outputDir: Path
|
||||
cmd.add("-quiet")
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
// assume at least an amiga 1200 with 68020 and optional FPU
|
||||
is Amiga1200Target -> {
|
||||
// amiga 1200 with 68020 and optional FPU
|
||||
mutableListOf(
|
||||
"vasmm68k_mot",
|
||||
"-m$assemblerCpu",
|
||||
@@ -172,6 +144,7 @@ class AssemblyProgramM68k(override val name: String, private val outputDir: Path
|
||||
"-warnunaligned",
|
||||
"-ldots",
|
||||
"-spaces",
|
||||
"-nosym", // no debug symbols
|
||||
"-o", exefile.toString(),
|
||||
assemblyFile.toString()
|
||||
).also { cmd ->
|
||||
@@ -183,6 +156,7 @@ class AssemblyProgramM68k(override val name: String, private val outputDir: Path
|
||||
cmd.add("-quiet")
|
||||
}
|
||||
}
|
||||
else -> error("unsupported target for AMIGAHUNK output: ${options.compTarget.name}")
|
||||
}
|
||||
if (!runProcess(assembleCmd, options.quiet, "vasm"))
|
||||
return false
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
package prog8.codegen.m68k
|
||||
|
||||
import prog8.code.target.Qemu68kTarget
|
||||
import prog8.intermediate.IRDataType
|
||||
import prog8.intermediate.IRInstruction
|
||||
import prog8.intermediate.Opcode
|
||||
@@ -240,7 +241,7 @@ private fun AsmGen.shiftOpcode(isLeft: Boolean, isArithmetic: Boolean, isRotate:
|
||||
// a0 and use `(a0)` addressing. A0 is a scratch address register in the m68k
|
||||
// codegen, so this is safe.
|
||||
private fun AsmGen.emitMemoryWordShiftOrRotate(op: String, address: String) {
|
||||
if (target.name == "qemu68k") {
|
||||
if (target.name == Qemu68kTarget.NAME) {
|
||||
emitLine("lea $address, a0")
|
||||
emitLine("$op.w (a0)")
|
||||
} else {
|
||||
|
||||
@@ -19,8 +19,7 @@ class TestInstructionSelectionOptimizations : FunSpec({
|
||||
|
||||
val tempRoot = tempdir().toPath()
|
||||
|
||||
fun generateAsmChunks(outputDir: Path, chunks: List<IRCodeChunkBase>): List<String> {
|
||||
val target = Qemu68kTarget()
|
||||
fun generateAsmChunks(outputDir: Path, chunks: List<IRCodeChunkBase>, target: ICompilationTarget = Qemu68kTarget()): List<String> {
|
||||
val options = CompilationOptions.builder(target)
|
||||
.output(OutputType.RAW)
|
||||
.zeropage(ZeropageType.FLOATSAFE)
|
||||
@@ -46,10 +45,10 @@ class TestInstructionSelectionOptimizations : FunSpec({
|
||||
return asmFile.readText().lines().map { it.trim() }
|
||||
}
|
||||
|
||||
fun generateAsm(outputDir: Path, instructions: List<IRInstruction>): List<String> {
|
||||
fun generateAsm(outputDir: Path, instructions: List<IRInstruction>, target: ICompilationTarget = Qemu68kTarget()): List<String> {
|
||||
val chunk = IRCodeChunk(null, null)
|
||||
chunk.instructions.addAll(instructions)
|
||||
return generateAsmChunks(outputDir, listOf(chunk))
|
||||
return generateAsmChunks(outputDir, listOf(chunk), target)
|
||||
}
|
||||
|
||||
test("uses quick address adjustments and preserves large offsets") {
|
||||
@@ -1255,4 +1254,29 @@ class TestInstructionSelectionOptimizations : FunSpec({
|
||||
lines.any { it.contains("move.l d0,p8_regfile+6") } shouldBe true
|
||||
lines.any { it.contains("move.l (a0,d0.w), a0") } shouldBe false
|
||||
}
|
||||
|
||||
// === extb.l gate robustification ===
|
||||
|
||||
test("M68020 sign-extends byte to long with extb.l") {
|
||||
val lines = generateAsm(
|
||||
tempRoot.resolve("test-m68k-extbl-qemu"),
|
||||
listOf(IRInstruction(Opcode.EXTLS, IRDataType.BYTE, reg1 = 1, reg2 = 2))
|
||||
)
|
||||
|
||||
lines.count { it == "extb.l d0" } shouldBe 1
|
||||
lines.count { it == "ext.w d0" } shouldBe 0
|
||||
lines.count { it == "ext.l d0" } shouldBe 0
|
||||
}
|
||||
|
||||
test("M68000 sign-extends byte to long with ext.w plus ext.l") {
|
||||
val lines = generateAsm(
|
||||
tempRoot.resolve("test-m68k-extbl-amiga"),
|
||||
listOf(IRInstruction(Opcode.EXTLS, IRDataType.BYTE, reg1 = 1, reg2 = 2)),
|
||||
target = Amiga500Target()
|
||||
)
|
||||
|
||||
lines.count { it == "extb.l d0" } shouldBe 0
|
||||
lines.count { it == "ext.w d0" } shouldBe 1
|
||||
lines.count { it == "ext.l d0" } shouldBe 1
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,5 @@
|
||||
%import shared_amiga_arexx
|
||||
|
||||
arexx {
|
||||
%option no_symbol_prefixing, ignore_unused
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
%import shared_amiga_audio
|
||||
|
||||
audio {
|
||||
%option no_symbol_prefixing, ignore_unused
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
%import shared_amiga_bcd
|
||||
@@ -0,0 +1,5 @@
|
||||
%import shared_amiga_blitter
|
||||
|
||||
blitter {
|
||||
%option no_symbol_prefixing, ignore_unused
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
; **experimental** data compression/decompression routines, API subject to change!!
|
||||
|
||||
%import shared_m68k_compression
|
||||
|
||||
compression {
|
||||
%option ignore_unused
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
%import shared_amiga_conv
|
||||
|
||||
conv {
|
||||
%option ignore_unused
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
%import shared_amiga_copper
|
||||
|
||||
copper {
|
||||
%option no_symbol_prefixing, ignore_unused
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
%import shared_m68k_coroutines
|
||||
|
||||
coroutines {
|
||||
%option ignore_unused
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
%import shared_amiga_custom
|
||||
|
||||
custom {
|
||||
%option no_symbol_prefixing, ignore_unused
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
%import shared_amiga_dos
|
||||
|
||||
dos {
|
||||
%option no_symbol_prefixing, ignore_unused
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
%import shared_amiga_exec
|
||||
|
||||
exec {
|
||||
%option no_symbol_prefixing, ignore_unused
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
%import shared_m68k_floats
|
||||
%import textio
|
||||
|
||||
txt {
|
||||
%option merge, ignore_unused
|
||||
alias print_f = floats.print
|
||||
}
|
||||
|
||||
floats {
|
||||
%option no_symbol_prefixing, ignore_unused
|
||||
%asminclude "library:shared_m68k_floats.asm"
|
||||
|
||||
asmsub print(float value @FP0) {
|
||||
%asm {{
|
||||
jsr floats._tostr
|
||||
move.l a0,d1
|
||||
move.l sys.DOSBase,a6
|
||||
jmp -948(a6) ; PutStr()
|
||||
}}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
%import shared_amiga_graphics
|
||||
|
||||
graphics {
|
||||
%option no_symbol_prefixing, ignore_unused
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
%import shared_amiga_icon
|
||||
|
||||
icon {
|
||||
%option no_symbol_prefixing, ignore_unused
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
%import shared_amiga_iffparse
|
||||
|
||||
iffparse {
|
||||
%option no_symbol_prefixing, ignore_unused
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
%import shared_amiga_intuition
|
||||
|
||||
intuition {
|
||||
%option no_symbol_prefixing, ignore_unused
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
%import shared_m68k_lineclip
|
||||
|
||||
lineclip {
|
||||
%option ignore_unused
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
%import shared_amiga_lists
|
||||
|
||||
lists {
|
||||
%option ignore_unused
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
%import shared_m68k_math
|
||||
|
||||
math {
|
||||
%option no_symbol_prefixing, ignore_unused
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
%option no_symbol_prefixing, ignore_unused
|
||||
|
||||
%import exec
|
||||
|
||||
p8_sys_startup {
|
||||
%option force_output
|
||||
|
||||
private long @shared orig_stackpointer ; saved initial SP for sys.exit()
|
||||
private long @shared WBMsg
|
||||
|
||||
; NOTE: the executable loader already zero-fills the BSS section
|
||||
; (LoadSeg on Amiga HUNK, or the ELF loader on qemu68k), so this
|
||||
; manual clear is unnecessary and has been commented out.
|
||||
; asmsub clear_bss_section() {
|
||||
; %asm {{
|
||||
; ; clear BSS section
|
||||
; lea prog8_bss_section_start, a0
|
||||
; lea prog8_program_end, a1
|
||||
; sub.l a0, a1 ; bss size in bytes
|
||||
; beq 2$
|
||||
; moveq #0, d0
|
||||
; 1$
|
||||
; move.b d0, (a0)+
|
||||
; subq.l #1, a1
|
||||
; bne 1$
|
||||
; 2$
|
||||
; rts
|
||||
; }}
|
||||
; }
|
||||
|
||||
sub init_system() {
|
||||
%asm {{
|
||||
; save CLI arguments
|
||||
move.l d0,-(sp)
|
||||
move.l a0,-(sp)
|
||||
|
||||
; save original stackpointer
|
||||
move.l sp,a0
|
||||
add.l #4*3,a0 ; take care of JSR to this routine, and the 2 saved longs
|
||||
move.l a0,p8_sys_startup.orig_stackpointer
|
||||
|
||||
proc_MsgPort = 92
|
||||
proc_CLI = 172
|
||||
|
||||
move.l 4.w,a6
|
||||
move.l #-1,d0
|
||||
move.l d0,d1
|
||||
jsr -648(a6) ; CacheControl(): turn on all cpu caches
|
||||
|
||||
; Check if we are started from Workbench
|
||||
sub.l a1,a1
|
||||
jsr exec.FindTask(a6)
|
||||
move.l d0,a5
|
||||
beq.w 2$
|
||||
tst.l proc_CLI(a5)
|
||||
bne.b 2$
|
||||
lea.l proc_MsgPort(a5),a0
|
||||
jsr exec.WaitPort(a6) ; Wait for workbench message
|
||||
lea.l proc_MsgPort(a5),a0
|
||||
jsr exec.GetMsg(a6)
|
||||
move.l d0,p8_sys_startup.WBMsg ; Store message pointer to reply at exit later
|
||||
2$:
|
||||
|
||||
; CLI launch: restore saved arguments (if any)
|
||||
move.l (sp)+,a0
|
||||
move.l (sp)+,d0
|
||||
tst.l p8_sys_startup.WBMsg
|
||||
bne.s .workbench
|
||||
tst.l d0
|
||||
beq.s .emptyargs
|
||||
subq.l #1,d0
|
||||
clr.b (a0,d0.w) ; replace newline by 0 terminator
|
||||
move.l a0,sys.arguments
|
||||
bra.s .done
|
||||
.emptyargs:
|
||||
move.l a0,sys.arguments ; empty string, but still CLI launch
|
||||
bra.s .done
|
||||
.workbench:
|
||||
moveq #0,d0
|
||||
move.l d0,sys.arguments ; NULL for Workbench launches
|
||||
.done:
|
||||
}}
|
||||
|
||||
sys.DOSBase = exec.OpenLibrary("dos.library",0)
|
||||
sys.GfxBase = exec.OpenLibrary("graphics.library",0)
|
||||
sys.IntuitionBase = exec.OpenLibrary("intuition.library",0)
|
||||
sys.IconBase = exec.OpenLibrary("icon.library",0)
|
||||
sys.UtilityBase = exec.OpenLibrary("utility.library",0)
|
||||
}
|
||||
|
||||
sub init_system_phase2() {
|
||||
%asm {{
|
||||
moveq #0,d0
|
||||
moveq #0,d1
|
||||
moveq #0,d2
|
||||
moveq #0,d3
|
||||
moveq #0,d4
|
||||
moveq #0,d5
|
||||
moveq #0,d6
|
||||
moveq #0,d7
|
||||
move.w d0,ccr
|
||||
suba.l a0,a0
|
||||
suba.l a1,a1
|
||||
suba.l a2,a2
|
||||
suba.l a3,a3
|
||||
suba.l a4,a4
|
||||
suba.l a5,a5
|
||||
suba.l a6,a6
|
||||
}}
|
||||
}
|
||||
|
||||
sub cleanup_at_exit() {
|
||||
%asm {{
|
||||
movem.l d0,-(sp) ; keep return code
|
||||
|
||||
; reply to Workbench message if it exists
|
||||
move.l 4.w,a6
|
||||
tst.l p8_sys_startup.WBMsg
|
||||
beq.b 1$
|
||||
move.l p8_sys_startup.WBMsg,a1
|
||||
jsr exec.ReplyMsg(a6)
|
||||
1$:
|
||||
}}
|
||||
|
||||
if sys.RexxSysBase != 0 exec.CloseLibrary(sys.RexxSysBase)
|
||||
if sys.IFFParseBase != 0 exec.CloseLibrary(sys.IFFParseBase)
|
||||
if sys.UtilityBase != 0 exec.CloseLibrary(sys.UtilityBase)
|
||||
if sys.IconBase != 0 exec.CloseLibrary(sys.IconBase)
|
||||
if sys.IntuitionBase != 0 exec.CloseLibrary(sys.IntuitionBase)
|
||||
if sys.GfxBase != 0 exec.CloseLibrary(sys.GfxBase)
|
||||
if sys.DOSBase != 0 exec.CloseLibrary(sys.DOSBase)
|
||||
|
||||
%asm {{
|
||||
movem.l (sp)+,d0 ; restore return code
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
||||
prog8_lib {
|
||||
asmsub strcmp(str st1 @D0, str st2 @D1) -> byte @D0 {
|
||||
; Compares two strings for sorting, case-sensitively.
|
||||
; Returns -1 (255 as byte), 0 or 1.
|
||||
%asm {{
|
||||
movea.l d0,a0
|
||||
movea.l d1,a1
|
||||
.loop:
|
||||
move.b (a0)+,d0
|
||||
move.b (a1)+,d1
|
||||
cmp.b d1,d0
|
||||
bne .diff
|
||||
tst.b d0
|
||||
bne .loop
|
||||
moveq #0,d0
|
||||
rts
|
||||
.diff:
|
||||
blo .less
|
||||
moveq #1,d0
|
||||
rts
|
||||
.less:
|
||||
moveq #-1,d0
|
||||
rts
|
||||
}}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
prog8_math {
|
||||
%option no_symbol_prefixing, ignore_unused
|
||||
|
||||
%asminclude "library:shared_m68k_prog8_math.asm"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
%import shared_amiga_ptplayer
|
||||
|
||||
ptplayer {
|
||||
%option ignore_unused
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
%import shared_amiga_sorting
|
||||
@@ -0,0 +1,5 @@
|
||||
%import shared_m68k_strings
|
||||
|
||||
strings {
|
||||
%option no_symbol_prefixing, ignore_unused
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
; Prog8 definitions for the Amiga1200 target
|
||||
|
||||
%option no_symbol_prefixing, ignore_unused
|
||||
%import shared_m68k_memory_routines
|
||||
|
||||
%import dos
|
||||
|
||||
sys {
|
||||
; ------- lowlevel system routines --------
|
||||
|
||||
const ubyte target = 120 ; compilation target specifier.
|
||||
|
||||
const ubyte SIZEOF_BOOL = sizeof(bool)
|
||||
const ubyte SIZEOF_BYTE = sizeof(byte)
|
||||
const ubyte SIZEOF_UBYTE = sizeof(ubyte)
|
||||
const ubyte SIZEOF_WORD = sizeof(word)
|
||||
const ubyte SIZEOF_UWORD = sizeof(uword)
|
||||
const ubyte SIZEOF_LONG = sizeof(long)
|
||||
const ubyte SIZEOF_POINTER = sizeof(&sys.wait)
|
||||
const ubyte SIZEOF_FLOAT = sizeof(float)
|
||||
const byte MIN_BYTE = -128
|
||||
const byte MAX_BYTE = 127
|
||||
const ubyte MIN_UBYTE = 0
|
||||
const ubyte MAX_UBYTE = 255
|
||||
const word MIN_WORD = -32768
|
||||
const word MAX_WORD = 32767
|
||||
const uword MIN_UWORD = 0
|
||||
const uword MAX_UWORD = 65535
|
||||
const long MIN_LONG = -2147483648
|
||||
const long MAX_LONG = 2147483647
|
||||
; MIN_FLOAT and MAX_FLOAT are defined in the floats module if imported
|
||||
|
||||
|
||||
; SysBase/ExecBase is always simply available at 4.w
|
||||
pointer @shared DOSBase
|
||||
pointer @shared GfxBase
|
||||
pointer @shared IntuitionBase
|
||||
pointer @shared IconBase
|
||||
pointer @shared UtilityBase
|
||||
pointer @shared RexxSysBase ; loaded from disk on demand
|
||||
pointer @shared IFFParseBase ; loaded from disk on demand
|
||||
pointer @shared TimerBase ; opened on demand
|
||||
|
||||
^^ubyte @shared arguments ; CLI argument string (null-terminated), or NULL if Workbench launch
|
||||
|
||||
sub reset_system() {
|
||||
%asm {{
|
||||
move.l 4.w,a6
|
||||
jmp -726(a6) ; ColdReboot()
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub wait(long jiffies @D1) {
|
||||
; --- wait approximately the given number of jiffies (1/60th seconds)
|
||||
%asm {{
|
||||
move.l sys.DOSBase,a6
|
||||
jmp -198(a6) ; Delay
|
||||
}}
|
||||
}
|
||||
|
||||
inline asmsub waitvsync() {
|
||||
; --- Wait until the next vsync has occurred.
|
||||
; This routine requires the OS to be functioning.
|
||||
; If you have disabled the OS/interrupts and are banging the hardware directly, use custom.waitvsync() instead.
|
||||
%asm {{
|
||||
move.l sys.GfxBase,a6
|
||||
jsr -270(a6) ; WaitTOF
|
||||
}}
|
||||
}
|
||||
|
||||
sub exit(ubyte returnvalue) {
|
||||
; -- exit the program with a return code in D0. When invoked from Prog8 via sys.exit(), all active defers in the call chain are unwound program-wide (LIFO) before system cleanup. sys.reset_system() does not run defers.
|
||||
%asm {{
|
||||
moveq.l #0,d0
|
||||
move.b sys.exit.returnvalue,d0
|
||||
move.l p8_sys_startup.orig_stackpointer,sp
|
||||
jmp p8_sys_startup.cleanup_at_exit
|
||||
}}
|
||||
}
|
||||
|
||||
sub set_carry() {
|
||||
%asm {{
|
||||
; set both C (comparison carry) and X (rotate carry) bits
|
||||
moveq #$11,d0
|
||||
move.w d0,ccr
|
||||
}}
|
||||
}
|
||||
|
||||
sub clear_carry() {
|
||||
%asm {{
|
||||
; clear C and X bits
|
||||
moveq #0,d0
|
||||
move.w d0,ccr
|
||||
}}
|
||||
}
|
||||
|
||||
inline asmsub memcopy(long source @A0, long tgt @A1, long count @D0) {
|
||||
%asm {{
|
||||
move.l 4.w,a6
|
||||
jsr exec.CopyMem(a6)
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub exec_version() -> uword @D0 {
|
||||
; Returns the exec library version.
|
||||
; This corresponds to the Kickstart/ROM version:
|
||||
; 30 = KS 1.0, 33 = KS 1.2, 34 = KS 1.3,
|
||||
; 37 = KS 2.0, 39 = KS 3.0, 40 = KS 3.1
|
||||
%asm {{
|
||||
move.l $4,a0
|
||||
move.w 20(a0),d0
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
inline asmsub progstart() -> long @A0 {
|
||||
%asm {{
|
||||
lea prog8_program_start,a0
|
||||
}}
|
||||
}
|
||||
|
||||
inline asmsub progend() -> long @A0 {
|
||||
%asm {{
|
||||
lea prog8_program_end,a0
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub cpuAtLeast68020() clobbers (A6, D0) -> bool @Pz {
|
||||
%asm {{
|
||||
move.l 4.w,a6
|
||||
move.w 296(a6),d0
|
||||
andi.w #$008e,d0
|
||||
rts
|
||||
}}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,229 @@
|
||||
%import dos
|
||||
%import conv
|
||||
%import strings
|
||||
%option ignore_unused
|
||||
|
||||
txt {
|
||||
%option ignore_unused
|
||||
asmsub chrout(ubyte char @D0) clobbers(D0,D1,D2,A0,A6) {
|
||||
%asm {{
|
||||
move.l sys.DOSBase,a6
|
||||
move.b d0,-(sp) ; push character, A7 now points to it
|
||||
move.l sp,d1
|
||||
moveq #1,d2
|
||||
jsr -942(a6) ; WriteChars
|
||||
addq.l #2, sp
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
sub nl() {
|
||||
chrout('\n')
|
||||
}
|
||||
|
||||
sub spc() {
|
||||
chrout(' ')
|
||||
}
|
||||
|
||||
sub tab() {
|
||||
chrout('\t')
|
||||
}
|
||||
|
||||
asmsub flush() {
|
||||
%asm {{
|
||||
move.l sys.DOSBase,a6
|
||||
jsr -60(a6) ; Output()
|
||||
move.l d0,d1
|
||||
jmp -360(a6) ; Flush
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub print(str text @A0) clobbers(D0,D1,A0,A6) {
|
||||
%asm {{
|
||||
move.l sys.DOSBase,a6
|
||||
move.l a0,d1
|
||||
jsr -948(a6) ; PutStr()
|
||||
jsr -60(a6) ; Output()
|
||||
move.l d0,d1
|
||||
jmp -360(a6) ; Flush
|
||||
}}
|
||||
}
|
||||
|
||||
private long @shared fmt_value_l
|
||||
private uword @shared fmt_value_w
|
||||
|
||||
sub print_ub(ubyte value) {
|
||||
fmt_value_w = value as uword
|
||||
void dos.VPrintf("%d", &fmt_value_w)
|
||||
}
|
||||
|
||||
sub print_ub0(ubyte value) {
|
||||
fmt_value_w = value as uword
|
||||
void dos.VPrintf("%03d", &fmt_value_w)
|
||||
}
|
||||
|
||||
sub print_b(byte value) {
|
||||
fmt_value_w = value as uword
|
||||
void dos.VPrintf("%d", &fmt_value_w)
|
||||
}
|
||||
|
||||
sub print_uw(uword value) {
|
||||
fmt_value_l = value as long
|
||||
void dos.VPrintf("%lu", &fmt_value_l)
|
||||
}
|
||||
|
||||
sub print_uw0(uword value) {
|
||||
fmt_value_l = value as long
|
||||
void dos.VPrintf("%05lu", &fmt_value_l)
|
||||
}
|
||||
|
||||
sub print_w(word value) {
|
||||
void dos.VPrintf("%d", &value)
|
||||
}
|
||||
|
||||
sub print_l(long value) {
|
||||
void dos.VPrintf("%ld", &value)
|
||||
}
|
||||
|
||||
sub print_ulhex(long value, bool prefix) {
|
||||
void dos.VPrintf(if prefix then "$%08lx" else "%08lx", &value)
|
||||
}
|
||||
|
||||
sub print_uwhex(uword value, bool prefix) {
|
||||
void dos.VPrintf(if prefix then "$%04x" else "%04x", &value)
|
||||
}
|
||||
|
||||
sub print_ubhex(ubyte value, bool prefix) {
|
||||
fmt_value_w = value as uword
|
||||
void dos.VPrintf(if prefix then "$%02x" else "%02x", &fmt_value_w)
|
||||
}
|
||||
|
||||
sub print_ubbin(ubyte value, bool prefix) {
|
||||
if prefix
|
||||
chrout('%')
|
||||
print(conv.str_ubbin(value))
|
||||
}
|
||||
|
||||
sub print_uwbin(uword value, bool prefix) {
|
||||
if prefix
|
||||
chrout('%')
|
||||
print(conv.str_uwbin(value))
|
||||
}
|
||||
|
||||
sub print_bool(bool value) {
|
||||
if value
|
||||
print("true")
|
||||
else
|
||||
print("false")
|
||||
}
|
||||
|
||||
sub input_chars(str buffer) -> ubyte {
|
||||
; Input a string (max. 80 chars) from the keyboard. Returns length of input.
|
||||
; User entered EOL is trimmed, and the string is terminated with a 0 byte.
|
||||
; Uses line-buffered input (stdin stays in its default line mode).
|
||||
pointer fh = dos.Input()
|
||||
if fh == 0
|
||||
return 0
|
||||
long actual = dos.Read(fh, buffer, 80)
|
||||
if actual <= 0 {
|
||||
buffer[0] = 0
|
||||
return 0
|
||||
}
|
||||
ubyte count = actual as ubyte
|
||||
if count > 0 and (buffer[count-1] == '\n' or buffer[count-1] == '\r')
|
||||
count--
|
||||
buffer[count] = 0
|
||||
return count
|
||||
}
|
||||
|
||||
sub iso() {
|
||||
; is the default
|
||||
}
|
||||
|
||||
sub lowercase() {
|
||||
; is the default
|
||||
}
|
||||
|
||||
sub cls() {
|
||||
clear_screen()
|
||||
}
|
||||
|
||||
sub clear_screen() {
|
||||
print("\x1b[H\x1B[J")
|
||||
}
|
||||
|
||||
sub home() {
|
||||
print("\x1b[H")
|
||||
}
|
||||
|
||||
sub bold() {
|
||||
print("\x1b[1m")
|
||||
}
|
||||
|
||||
sub dim() {
|
||||
print("\x1b[2m")
|
||||
}
|
||||
|
||||
sub italic() {
|
||||
print("\x1b[3m")
|
||||
}
|
||||
|
||||
sub underline() {
|
||||
print("\x1b[4m")
|
||||
}
|
||||
|
||||
sub rvs() {
|
||||
print("\x1b[7m")
|
||||
}
|
||||
|
||||
sub normal() {
|
||||
print("\x1b[0m")
|
||||
}
|
||||
|
||||
sub cursor_off() {
|
||||
txt.print("\x1b[0 p")
|
||||
}
|
||||
|
||||
sub cursor_on() {
|
||||
txt.print("\x1b[1 p")
|
||||
}
|
||||
|
||||
sub color (ubyte txtcol) {
|
||||
print("\x1b[3")
|
||||
chrout('0' + txtcol)
|
||||
chrout('m')
|
||||
}
|
||||
|
||||
sub bell() {
|
||||
chrout(7)
|
||||
}
|
||||
|
||||
sub width() -> ubyte {
|
||||
; TODO use console Query WIndow Size escape sequence
|
||||
return 80
|
||||
}
|
||||
|
||||
sub height() -> ubyte {
|
||||
; TODO use console Query WIndow Size escape sequence
|
||||
return 25
|
||||
}
|
||||
|
||||
sub size() -> ubyte, ubyte {
|
||||
; TODO use console Query WIndow Size escape sequence
|
||||
return width(), height()
|
||||
}
|
||||
|
||||
sub plot(ubyte col, ubyte row) {
|
||||
; use ANSI escape sequence to position the cursor
|
||||
print("\x1b[")
|
||||
print_ub(row)
|
||||
chrout(';')
|
||||
print_ub(col)
|
||||
chrout('H')
|
||||
}
|
||||
|
||||
sub setchr(ubyte col, ubyte row, ubyte char) {
|
||||
plot(col, row)
|
||||
chrout(char)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
%import exec
|
||||
|
||||
timer {
|
||||
%option no_symbol_prefixing, ignore_unused
|
||||
|
||||
^^TimeRequest @shared TimerIO
|
||||
|
||||
enum UNIT {
|
||||
MICROHZ = 0,
|
||||
VBLANK = 1,
|
||||
ECLOCK = 2,
|
||||
WAITUNTIL = 3,
|
||||
WAITECLOCK = 4
|
||||
}
|
||||
|
||||
; timer.device IO commands:
|
||||
const uword TR_ADDREQUEST = 9
|
||||
const uword TR_GETSYSTIME = 9+1
|
||||
const uword TR_SETSYSTIME = 9+2
|
||||
|
||||
|
||||
struct TimeVal {
|
||||
long secs
|
||||
long micro
|
||||
}
|
||||
|
||||
struct TimeRequest {
|
||||
; struct IORequest
|
||||
^^exec.Node Succ ; 0
|
||||
^^exec.Node Pred ; 4
|
||||
ubyte Type ; 8
|
||||
byte Pri ; 9
|
||||
str Name ; 10
|
||||
^^exec.MsgPort ReplyPort ; 14
|
||||
uword Length ; 18
|
||||
pointer Device ; 20
|
||||
pointer Unit ; 24
|
||||
uword Command ; 28
|
||||
ubyte Flags ; 30
|
||||
byte Error ; 31
|
||||
; struct TimeVal
|
||||
long secs ; 32
|
||||
long micro ; 36
|
||||
}
|
||||
|
||||
struct EClockVal {
|
||||
; This is really a 64 bit integer value split into two 32 bit integers
|
||||
long hi
|
||||
long lo
|
||||
}
|
||||
|
||||
sub opendevice() -> bool {
|
||||
^^exec.MsgPort timerPort = exec.CreateMsgPort()
|
||||
if timerPort == 0 return false
|
||||
TimerIO = exec.CreateIORequest(timerPort, sizeof(timer.TimeRequest))
|
||||
if TimerIO == 0 {
|
||||
exec.DeleteMsgPort(timerPort)
|
||||
return false
|
||||
}
|
||||
|
||||
if exec.OpenDevice("timer.device", timer.UNIT::MICROHZ, TimerIO, 0)==0 {
|
||||
sys.TimerBase = TimerIO.Device
|
||||
return true
|
||||
}
|
||||
exec.DeleteIORequest(TimerIO)
|
||||
exec.DeleteMsgPort(timerPort)
|
||||
TimerIO = 0
|
||||
return false
|
||||
}
|
||||
|
||||
sub closedevice() {
|
||||
if TimerIO != 0 {
|
||||
^^exec.MsgPort timerPort = TimerIO.ReplyPort
|
||||
exec.CloseDevice(TimerIO)
|
||||
exec.DeleteIORequest(TimerIO)
|
||||
exec.DeleteMsgPort(timerPort)
|
||||
TimerIO = 0
|
||||
}
|
||||
}
|
||||
|
||||
sub getsystime() -> long, long {
|
||||
TimerIO.Command = timer.TR_GETSYSTIME
|
||||
void exec.DoIO(TimerIO)
|
||||
return TimerIO.secs, TimerIO.micro
|
||||
}
|
||||
|
||||
sub setsystime(long secs, long micro) {
|
||||
TimerIO.Command = timer.TR_SETSYSTIME
|
||||
TimerIO.secs = secs
|
||||
TimerIO.micro = micro
|
||||
void exec.DoIO(TimerIO)
|
||||
}
|
||||
|
||||
extsub @bank 18 -42 = AddTime( ^^TimeVal dest @A0, ^^TimeVal src @A1 )
|
||||
extsub @bank 18 -48 = SubTime( ^^TimeVal dest @A0, ^^TimeVal src @A1 )
|
||||
extsub @bank 18 -54 = CmpTime( ^^TimeVal dest @A0, ^^TimeVal src @A1 ) -> long @D0
|
||||
extsub @bank 18 -60 = ReadEClock( ^^EClockVal dest @A0 ) -> long @D0 ; returns tickrate value
|
||||
extsub @bank 18 -66 = GetSysTime( ^^TimeVal dest @A0 )
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
%import shared_amiga_utility
|
||||
|
||||
utility {
|
||||
%option no_symbol_prefixing, ignore_unused
|
||||
}
|
||||
@@ -1,223 +1,5 @@
|
||||
;; Auto-generated from arexx_lib.sfd and arexx_lib.i
|
||||
;; Library base: _RexxSysBase in prog8: sys.RexxSysBase
|
||||
;; Bank: 29
|
||||
;; Functions: 17
|
||||
|
||||
%import exec
|
||||
%import shared_amiga_arexx
|
||||
|
||||
arexx {
|
||||
%option no_symbol_prefixing
|
||||
|
||||
sub openlib() -> bool {
|
||||
sys.RexxSysBase = exec.OpenLibrary("rexxsyslib.library", 0)
|
||||
return sys.RexxSysBase!=0
|
||||
}
|
||||
|
||||
sub closelib() {
|
||||
if sys.RexxSysBase!=0 {
|
||||
exec.CloseLibrary(sys.RexxSysBase)
|
||||
sys.RexxSysBase = 0
|
||||
}
|
||||
}
|
||||
|
||||
extsub @bank 29 -126 = CreateArgstring(str string @A0, long length @D0) -> pointer @D0
|
||||
extsub @bank 29 -132 = DeleteArgstring(pointer argstring @A0)
|
||||
extsub @bank 29 -138 = LengthArgstring(pointer argstring @A0) -> long @D0
|
||||
extsub @bank 29 -144 = CreateRexxMsg(^^exec.MsgPort port @A0, str extension @A1, str host @D0) -> ^^RexxMsg @D0
|
||||
extsub @bank 29 -150 = DeleteRexxMsg(^^RexxMsg packet @A0)
|
||||
extsub @bank 29 -156 = ClearRexxMsg(^^RexxMsg msgptr @A0, long count @D0)
|
||||
extsub @bank 29 -162 = FillRexxMsg(^^RexxMsg msgptr @A0, long count @D0, long mask @D1) -> bool @D0
|
||||
extsub @bank 29 -168 = IsRexxMsg(^^RexxMsg msgptr @A0) -> bool @D0
|
||||
extsub @bank 29 -450 = LockRexxBase(long resource @D0)
|
||||
extsub @bank 29 -456 = UnlockRexxBase(long resource @D0)
|
||||
extsub @bank 29 -480 = CreateRexxHostPort(str basename @A0) -> ^^exec.MsgPort @D0
|
||||
extsub @bank 29 -486 = DeleteRexxHostPort(^^exec.MsgPort port @A0)
|
||||
extsub @bank 29 -492 = GetRexxVarFromMsg(str var @A0, ^^RexxMsg msgptr @A2, str value @A1) -> long @D0
|
||||
extsub @bank 29 -498 = SetRexxVarFromMsg(str var @A0, ^^RexxMsg msgptr @A2, str value @A1) -> long @D0
|
||||
extsub @bank 29 -504 = LaunchRexxScript(str script @A0, ^^exec.MsgPort replyport @A1, str extension @A2, pointer input @D1, pointer output @D2) -> ^^RexxMsg @D0
|
||||
extsub @bank 29 -510 = FreeRexxMsg(^^RexxMsg msgptr @A0)
|
||||
extsub @bank 29 -516 = GetRexxBufferFromMsg(str var @A0, ^^RexxMsg msgptr @A2, str buffer @A1, long buffer_size @D0) -> long @D0
|
||||
|
||||
; ---- struct definitions ----
|
||||
|
||||
struct RexxMsg { ; total size: 128
|
||||
^^exec.Node Succ ; 0
|
||||
^^exec.Node Pred ; 4
|
||||
ubyte Type ; 8
|
||||
byte Pri ; 9
|
||||
str Name ; 10
|
||||
^^exec.MsgPort ReplyPort ; 14
|
||||
uword Length ; 18
|
||||
pointer TaskBlock ; 20
|
||||
pointer LibBase ; 24
|
||||
long Action ; 28
|
||||
long Result1 ; 32
|
||||
long Result2 ; 36
|
||||
str[16] Args ; 40
|
||||
^^exec.MsgPort PassPort ; 104
|
||||
str CommAddr ; 108
|
||||
str FileExt ; 112
|
||||
long Stdin ; 116
|
||||
long Stdout ; 120
|
||||
long Avail ; 124
|
||||
}
|
||||
|
||||
; ---- constants ----
|
||||
const ubyte ERRC_MSG = $0000
|
||||
const long RC_FAIL = -1
|
||||
const ubyte RC_OK = $0000
|
||||
const ubyte RC_WARN = $0005
|
||||
const ubyte RC_ERROR = $000a
|
||||
const ubyte RC_FATAL = $0014
|
||||
const ubyte RXBUFFSZ = $00cc
|
||||
const long RXIO_EXIST = -1
|
||||
const ubyte RXIO_STRF = $0000
|
||||
const ubyte RXIO_READ = $0001
|
||||
const ubyte RXIO_WRITE = $0002
|
||||
const ubyte RXIO_APPEND = $0003
|
||||
const long RXIO_BEGIN = -1
|
||||
const ubyte RXIO_CURR = $0000
|
||||
const ubyte RXIO_END = $0001
|
||||
const ubyte DT_DEV = $0000
|
||||
const ubyte DT_DIR = $0001
|
||||
const ubyte DT_VOL = $0002
|
||||
const uword ACTION_STACK = $07d2
|
||||
const uword ACTION_QUEUE = $07d3
|
||||
const ubyte RLFB_STOP = $0006
|
||||
const ubyte RLFB_CLOSE = $0007
|
||||
const ubyte RLFMASK = $0001
|
||||
const uword RXSCHUNK = $0400
|
||||
const ubyte RXSNEST = $0020
|
||||
const ubyte RXSTPRI = $0000
|
||||
const uword RXSSTACK = $1000
|
||||
const ubyte CTB_SPACE = $0000
|
||||
const ubyte CTB_DIGIT = $0001
|
||||
const ubyte CTB_ALPHA = $0002
|
||||
const ubyte CTB_REXXSYM = $0003
|
||||
const ubyte CTB_REXXOPR = $0004
|
||||
const ubyte CTB_REXXSPC = $0005
|
||||
const ubyte CTB_UPPER = $0006
|
||||
const ubyte CTB_LOWER = $0007
|
||||
const ubyte CTF_SPACE = $0001
|
||||
const ubyte CTF_DIGIT = $0001
|
||||
const ubyte CTF_ALPHA = $0001
|
||||
const ubyte CTF_REXXSYM = $0001
|
||||
const ubyte CTF_REXXOPR = $0001
|
||||
const ubyte CTF_REXXSPC = $0001
|
||||
const ubyte CTF_UPPER = $0001
|
||||
const ubyte CTF_LOWER = $0001
|
||||
const ubyte NSB_KEEP = $0000
|
||||
const ubyte NSB_STRING = $0001
|
||||
const ubyte NSB_NOTNUM = $0002
|
||||
const ubyte NSB_NUMBER = $0003
|
||||
const ubyte NSB_BINARY = $0004
|
||||
const ubyte NSB_FLOAT = $0005
|
||||
const ubyte NSB_EXT = $0006
|
||||
const ubyte NSB_SOURCE = $0007
|
||||
const ubyte NSF_KEEP = $0001
|
||||
const ubyte NSF_STRING = $0001
|
||||
const ubyte NSF_NOTNUM = $0001
|
||||
const ubyte NSF_NUMBER = $0001
|
||||
const ubyte NSF_BINARY = $0001
|
||||
const ubyte NSF_FLOAT = $0001
|
||||
const ubyte NSF_EXT = $0001
|
||||
const ubyte NSF_SOURCE = $0001
|
||||
const ubyte MAXRMARG = $000f
|
||||
const long RXCOMM = $01000000
|
||||
const long RXFUNC = $02000000
|
||||
const long RXCLOSE = $03000000
|
||||
const long RXQUERY = $04000000
|
||||
const long RXADDFH = $07000000
|
||||
const long RXADDLIB = $08000000
|
||||
const long RXREMLIB = $09000000
|
||||
const long RXADDCON = $0A000000
|
||||
const long RXREMCON = $0B000000
|
||||
const long RXTCOPN = $0C000000
|
||||
const long RXTCCLS = $0D000000
|
||||
const ubyte RXFB_NOIO = $0010
|
||||
const ubyte RXFB_RESULT = $0011
|
||||
const ubyte RXFB_STRING = $0012
|
||||
const ubyte RXFB_TOKEN = $0013
|
||||
const ubyte RXFB_NONRET = $0014
|
||||
const ubyte RXFB_SCRIPT = $0015
|
||||
const ubyte RXFF_RESULT = $0001
|
||||
const ubyte RXFF_STRING = $0001
|
||||
const ubyte RXFF_TOKEN = $0001
|
||||
const ubyte RXFF_NONRET = $0001
|
||||
const ubyte RXFF_SCRIPT = $0001
|
||||
const long RXCODEMASK = $FF000000
|
||||
const long RXARGMASK = $0000000F
|
||||
const ubyte RRT_ANY = $0000
|
||||
const ubyte RRT_LIB = $0001
|
||||
const ubyte RRT_PORT = $0002
|
||||
const ubyte RRT_FILE = $0003
|
||||
const ubyte RRT_HOST = $0004
|
||||
const ubyte RRT_CLIP = $0005
|
||||
const ubyte GLOBALSZ = $00c8
|
||||
const ubyte NUMLISTS = $0005
|
||||
const ubyte RTFB_TRACE = $0000
|
||||
const ubyte RTFB_HALT = $0001
|
||||
const ubyte RTFB_SUSP = $0002
|
||||
const ubyte RTFB_TCUSE = $0003
|
||||
const ubyte RTFB_WAIT = $0006
|
||||
const ubyte RTFB_CLOSE = $0007
|
||||
const ubyte MEMQUANT = $0010
|
||||
const long MEMMASK = $FFFFFFF0
|
||||
const ubyte MEMQUICK = $0001
|
||||
const long MEMCLEAR = $00010000
|
||||
const ubyte ERR10_001 = $0001
|
||||
const ubyte ERR10_002 = $0002
|
||||
const ubyte ERR10_003 = $0003
|
||||
const ubyte ERR10_005 = $0005
|
||||
const ubyte ERR10_006 = $0006
|
||||
const ubyte ERR10_008 = $0008
|
||||
const ubyte ERR10_009 = $0009
|
||||
const ubyte ERR10_010 = $000a
|
||||
const ubyte ERR10_011 = $000b
|
||||
const ubyte ERR10_012 = $000c
|
||||
const ubyte ERR10_013 = $000d
|
||||
const ubyte ERR10_014 = $000e
|
||||
const ubyte ERR10_015 = $000f
|
||||
const ubyte ERR10_016 = $0010
|
||||
const ubyte ERR10_017 = $0011
|
||||
const ubyte ERR10_018 = $0012
|
||||
const ubyte ERR10_019 = $0013
|
||||
const ubyte ERR10_020 = $0014
|
||||
const ubyte ERR10_021 = $0015
|
||||
const ubyte ERR10_022 = $0016
|
||||
const ubyte ERR10_023 = $0017
|
||||
const ubyte ERR10_024 = $0018
|
||||
const ubyte ERR10_025 = $0019
|
||||
const ubyte ERR10_026 = $001a
|
||||
const ubyte ERR10_027 = $001b
|
||||
const ubyte ERR10_028 = $001c
|
||||
const ubyte ERR10_029 = $001d
|
||||
const ubyte ERR10_030 = $001e
|
||||
const ubyte ERR10_031 = $001f
|
||||
const ubyte ERR10_032 = $0020
|
||||
const ubyte ERR10_033 = $0021
|
||||
const ubyte ERR10_034 = $0022
|
||||
const ubyte ERR10_035 = $0023
|
||||
const ubyte ERR10_036 = $0024
|
||||
const ubyte ERR10_037 = $0025
|
||||
const ubyte ERR10_039 = $0027
|
||||
const ubyte ERR10_040 = $0028
|
||||
const ubyte ERR10_041 = $0029
|
||||
const ubyte ERR10_042 = $002a
|
||||
const ubyte ERR10_043 = $002b
|
||||
const ubyte ERR10_044 = $002c
|
||||
const ubyte ERR10_045 = $002d
|
||||
const ubyte ERR10_046 = $002e
|
||||
const ubyte ERR10_047 = $002f
|
||||
const ubyte ERR10_048 = $0030
|
||||
const ubyte RLFB_TRACE = $0000
|
||||
const ubyte RLFB_HALT = $0001
|
||||
const ubyte RLFB_SUSP = $0002
|
||||
const ubyte NSF_INTNUM = $0001
|
||||
const ubyte NSF_DPNUM = $0001
|
||||
const ubyte NSF_ALPHA = $0001
|
||||
const ubyte NSF_OWNED = $0001
|
||||
const ubyte KEEPSTR = $0001
|
||||
const ubyte KEEPNUM = $0001
|
||||
%option no_symbol_prefixing, ignore_unused
|
||||
}
|
||||
;; End of auto-generated arexx_lib.sfd
|
||||
@@ -1,296 +1,5 @@
|
||||
%import exec
|
||||
%import syslib
|
||||
%import shared_amiga_audio
|
||||
|
||||
audio {
|
||||
%option no_symbol_prefixing, ignore_unused
|
||||
|
||||
; audio.device IO commands:
|
||||
const uword ADCMD_FREE = 9
|
||||
const uword ADCMD_SETPREC = 10
|
||||
const uword ADCMD_FINISH = 11
|
||||
const uword ADCMD_PERVOL = 12
|
||||
const uword ADCMD_LOCK = 13
|
||||
const uword ADCMD_WAITCYCLE = 14
|
||||
const uword ADCMD_ALLOCATE = 32
|
||||
|
||||
; IOAudio flags (explicit ubyte values):
|
||||
const ubyte ADIOB_PERVOL = 4
|
||||
const ubyte ADIOF_PERVOL = $10
|
||||
const ubyte ADIOB_SYNCCYCLE = 5
|
||||
const ubyte ADIOF_SYNCCYCLE = $20
|
||||
const ubyte ADIOB_NOWAIT = 6
|
||||
const ubyte ADIOF_NOWAIT = $40
|
||||
const ubyte ADIOB_WRITEMESSAGE = 7
|
||||
const ubyte ADIOF_WRITEMESSAGE = $80
|
||||
|
||||
; IOAudio error codes:
|
||||
const byte ADIOERR_NOALLOCATION = -10
|
||||
const byte ADIOERR_ALLOCFAILED = -11
|
||||
const byte ADIOERR_CHANNELSTOLEN = -12
|
||||
|
||||
; hardware constants:
|
||||
const uword ADHARD_CHANNELS = 4
|
||||
const byte ADALLOC_MINPREC = -128
|
||||
const byte ADALLOC_MAXPREC = 127
|
||||
|
||||
struct IOAudio {
|
||||
; struct IORequest (base, 32 bytes)
|
||||
^^exec.Node Succ ; 0
|
||||
^^exec.Node Pred ; 4
|
||||
ubyte Type ; 8
|
||||
byte Pri ; 9
|
||||
str Name ; 10
|
||||
^^exec.MsgPort ReplyPort ; 14
|
||||
uword Length ; 18
|
||||
pointer Device ; 20
|
||||
pointer Unit ; 24
|
||||
uword Command ; 28
|
||||
ubyte Flags ; 30
|
||||
byte Error ; 31
|
||||
; struct IOAudio specific fields
|
||||
word AllocKey ; 32
|
||||
pointer Data ; 34
|
||||
long IOAudio_Length ; 38
|
||||
uword Period ; 42
|
||||
uword Volume ; 44
|
||||
uword Cycles ; 46
|
||||
; struct Message ioa_WriteMsg (20 bytes)
|
||||
^^exec.Node Msg_Succ ; 48
|
||||
^^exec.Node Msg_Pred ; 52
|
||||
ubyte Msg_Type ; 56
|
||||
byte Msg_Pri ; 57
|
||||
str Msg_Name ; 58
|
||||
^^exec.MsgPort Msg_ReplyPort ; 62
|
||||
uword Msg_Length ; 66
|
||||
}
|
||||
|
||||
; 4 audio channel I/O structures to address each channel individually
|
||||
^^IOAudio AudioIO0 = []
|
||||
^^IOAudio AudioIO1 = []
|
||||
^^IOAudio AudioIO2 = []
|
||||
^^IOAudio AudioIO3 = []
|
||||
|
||||
private ^^exec.MsgPort msgport0 = []
|
||||
private ^^exec.MsgPort msgport1 = []
|
||||
private ^^exec.MsgPort msgport2 = []
|
||||
private ^^exec.MsgPort msgport3 = []
|
||||
private bool[4] active_channels
|
||||
|
||||
; Separate control-request structures for the ADCMD_* control commands.
|
||||
; An IORequest carrying an in-flight CMD_WRITE is queued inside audio.device
|
||||
; and must not be reused for another command, so the controls get their own.
|
||||
private ^^IOAudio CtrlIO0 = []
|
||||
private ^^IOAudio CtrlIO1 = []
|
||||
private ^^IOAudio CtrlIO2 = []
|
||||
private ^^IOAudio CtrlIO3 = []
|
||||
|
||||
; ---- high level audio interface ----
|
||||
|
||||
sub init() -> bool {
|
||||
; -- Initialize the audio device on all 4 channels.
|
||||
ubyte[1] channel_matrix = [15] ; allocate all 4 channels at once
|
||||
for ubyte channel in 0 to 3
|
||||
active_channels[channel] = false
|
||||
return opendevice(channel_matrix, 1, 0)
|
||||
}
|
||||
|
||||
sub closedown() {
|
||||
; -- Close down the audio device on all 4 channels. Does not wait for sounds to finish playing.
|
||||
stop_all()
|
||||
closedevice()
|
||||
for ubyte channel in 0 to 3
|
||||
active_channels[channel] = false
|
||||
}
|
||||
|
||||
sub play(ubyte channel, ^^byte samples, long num_samples, uword sample_rate, ubyte volume, uword cycles) {
|
||||
; -- Play a sample asynchronously on the given channel (0-3), with the given parameters.
|
||||
^^IOAudio io = get_io(channel)
|
||||
io.Command = exec.CMD_WRITE
|
||||
io.Flags = ADIOF_PERVOL
|
||||
io.Data = samples
|
||||
io.IOAudio_Length = num_samples
|
||||
io.Period = period(sample_rate)
|
||||
io.Volume = volume
|
||||
io.Cycles = cycles
|
||||
BeginIO(io) ; not exec.DoIO/SendIO: those clear io_Flags, wiping ADIOF_PERVOL!
|
||||
active_channels[channel] = true
|
||||
; sound now plays asynchronously.
|
||||
}
|
||||
|
||||
sub wait_channel(ubyte channel) {
|
||||
; wait for the current sound on this channel to finish playing.
|
||||
if active_channels[channel] {
|
||||
void exec.WaitIO(get_io(channel))
|
||||
active_channels[channel] = false
|
||||
}
|
||||
}
|
||||
|
||||
sub wait_all() {
|
||||
; wait for all channels to finish playing their sounds.
|
||||
wait_channel(0)
|
||||
wait_channel(1)
|
||||
wait_channel(2)
|
||||
wait_channel(3)
|
||||
}
|
||||
|
||||
sub stop(ubyte channel) {
|
||||
; -- Abort the sound currently playing on this channel (ADCMD_FINISH).
|
||||
; The sound stops immediately; blocks until the aborted write request has completed.
|
||||
if not active_channels[channel]
|
||||
return
|
||||
^^IOAudio ctrl = get_ctrl(channel)
|
||||
ctrl.Command = ADCMD_FINISH
|
||||
ctrl.Flags = 0
|
||||
BeginIO(ctrl)
|
||||
void exec.WaitIO(ctrl) ; reap the control request
|
||||
void exec.WaitIO(get_io(channel)) ; reap the aborted write request
|
||||
active_channels[channel] = false
|
||||
}
|
||||
|
||||
sub stop_all() {
|
||||
; -- Abort the sounds currently playing on all channels.
|
||||
stop(0)
|
||||
stop(1)
|
||||
stop(2)
|
||||
stop(3)
|
||||
}
|
||||
|
||||
sub set_freqvol(ubyte channel, uword samplerate, ubyte volume) {
|
||||
; -- Change the playback rate and volume of the sound currently playing on this channel (ADCMD_PERVOL).
|
||||
; Takes effect immediately. Both are always set together: ADCMD_PERVOL has no way to change just one.
|
||||
if not active_channels[channel]
|
||||
return
|
||||
^^IOAudio ctrl = get_ctrl(channel)
|
||||
ctrl.Command = ADCMD_PERVOL
|
||||
ctrl.Flags = 0
|
||||
ctrl.Period = period(samplerate)
|
||||
ctrl.Volume = volume
|
||||
BeginIO(ctrl)
|
||||
}
|
||||
|
||||
inline sub is_playing(ubyte channel) -> bool {
|
||||
; -- Returns true while a sound is playing on this channel,
|
||||
; i.e. between play() and wait_channel()/wait_all()/stop().
|
||||
return active_channels[channel]
|
||||
}
|
||||
|
||||
|
||||
; ---- low level audio interface ----
|
||||
|
||||
sub opendevice(pointer channelPrefs, ubyte prefsLen, byte precedence) -> bool {
|
||||
; Set channel allocation preferences before opening
|
||||
AudioIO0.Pri = precedence
|
||||
AudioIO0.AllocKey = 0
|
||||
AudioIO0.Data = channelPrefs
|
||||
AudioIO0.IOAudio_Length = prefsLen
|
||||
|
||||
if exec.OpenDevice("audio.device", 0, AudioIO0, 0)!=0 {
|
||||
AudioIO0.Type = 0
|
||||
return false
|
||||
}
|
||||
|
||||
; Clone the other 3 IOAudio instances via CopyMem
|
||||
; This preserves AllocKey and channel binding from OpenDevice
|
||||
AudioIO1^^ = AudioIO0^^
|
||||
AudioIO2^^ = AudioIO0^^
|
||||
AudioIO3^^ = AudioIO0^^
|
||||
AudioIO0.Unit = 1 ; channel 1
|
||||
AudioIO1.Unit = 2 ; channel 2
|
||||
AudioIO2.Unit = 4 ; channel 3
|
||||
AudioIO3.Unit = 8 ; channel 4
|
||||
|
||||
; Allocate separate MsgPorts for each cloned IOAudio
|
||||
AudioIO0.ReplyPort = init_msgport(msgport0)
|
||||
AudioIO1.ReplyPort = init_msgport(msgport1)
|
||||
AudioIO2.ReplyPort = init_msgport(msgport2)
|
||||
AudioIO3.ReplyPort = init_msgport(msgport3)
|
||||
|
||||
; Clone the channel bindings into the control structures
|
||||
CtrlIO0^^ = AudioIO0^^
|
||||
CtrlIO1^^ = AudioIO1^^
|
||||
CtrlIO2^^ = AudioIO2^^
|
||||
CtrlIO3^^ = AudioIO3^^
|
||||
|
||||
return true
|
||||
|
||||
private sub init_msgport(^^exec.MsgPort port) -> ^^exec.MsgPort {
|
||||
port.Type = exec.NT_MSGPORT
|
||||
port.Flags = exec.PA_SIGNAL
|
||||
port.SigBit = exec.AllocSignal(-1) as ubyte
|
||||
port.SigTask = exec.FindTask(0)
|
||||
exec.NewList(&port.Head)
|
||||
return port
|
||||
}
|
||||
}
|
||||
|
||||
sub closedevice() {
|
||||
if AudioIO0.Type == 0
|
||||
return
|
||||
|
||||
exec.CloseDevice(AudioIO0)
|
||||
^^exec.MsgPort port = AudioIO0.ReplyPort
|
||||
exec.FreeSignal(port.SigBit as byte)
|
||||
port = AudioIO1.ReplyPort
|
||||
exec.FreeSignal(port.SigBit as byte)
|
||||
port = AudioIO2.ReplyPort
|
||||
exec.FreeSignal(port.SigBit as byte)
|
||||
port = AudioIO3.ReplyPort
|
||||
exec.FreeSignal(port.SigBit as byte)
|
||||
AudioIO0.Type = 0
|
||||
AudioIO1.Type = 0
|
||||
AudioIO2.Type = 0
|
||||
AudioIO3.Type = 0
|
||||
}
|
||||
|
||||
sub get_io(ubyte channel) -> ^^IOAudio {
|
||||
when channel {
|
||||
0 -> return AudioIO0
|
||||
1 -> return AudioIO1
|
||||
2 -> return AudioIO2
|
||||
else -> return AudioIO3
|
||||
}
|
||||
}
|
||||
|
||||
private sub get_ctrl(ubyte channel) -> ^^IOAudio {
|
||||
when channel {
|
||||
0 -> return CtrlIO0
|
||||
1 -> return CtrlIO1
|
||||
2 -> return CtrlIO2
|
||||
else -> return CtrlIO3
|
||||
}
|
||||
}
|
||||
|
||||
sub period(uword samplerate) -> uword {
|
||||
; calculate the Period to use for the desired sample rate
|
||||
return clock() / samplerate as uword
|
||||
}
|
||||
|
||||
sub sample_rate(uword per) -> uword {
|
||||
; calculate the sample rate belonging to the given Period; the inverse of period()
|
||||
return clock() / per as uword
|
||||
}
|
||||
|
||||
asmsub clock() clobbers (A6) -> long @D0 {
|
||||
; return the Audio/Color clock, used for Period calculations to get the correct frequency
|
||||
%asm {{
|
||||
move.l sys.GfxBase, a6
|
||||
btst.b #0, $dc(a6)
|
||||
bne.s .ntsc
|
||||
move.l #3546895, d0 ; PAL
|
||||
rts
|
||||
.ntsc:
|
||||
move.l #3579545, d0 ; NTSC
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
private asmsub BeginIO(^^IOAudio io @A1) clobbers (D0, D1, A0, A1, A6) {
|
||||
; Calls the device's BeginIO vector directly, instead of exec DoIO/SendIO,
|
||||
; because those clear io_Flags which would wipe ADIOF_PERVOL and friends.
|
||||
%asm {{
|
||||
move.l 20(a1), a6 ; a6 = io_Device (offset 20 in IORequest)
|
||||
jsr -30(a6) ; device BeginIO vector
|
||||
rts
|
||||
}}
|
||||
}
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
; no support for BCD
|
||||
%import shared_amiga_bcd
|
||||
@@ -1,345 +1,5 @@
|
||||
%import custom
|
||||
%import shared_amiga_blitter
|
||||
|
||||
blitter {
|
||||
%option no_symbol_prefixing, ignore_unused
|
||||
|
||||
; WARNING: All pointers passed to blitter routines MUST point to CHIP RAM.
|
||||
; The Amiga blitter hardware can only access CHIP RAM directly.
|
||||
; Using fast RAM pointers will result in bus errors or corrupted data.
|
||||
;
|
||||
; WIDTH LIMITATION: The blitter can only handle 64 words (1024 pixels) width per operation.
|
||||
; Standard Amiga screens (320/640 pixels) fit within this limit.
|
||||
; For wider images, split the blit into multiple operations manually.
|
||||
;
|
||||
; WAITING BEHAVIOR: All blitter operations wait for the blitter to become idle
|
||||
; at the START of the call, but do NOT wait for the operation to finish before
|
||||
; returning. This allows the CPU to continue working while the blitter runs.
|
||||
; Call blitter.wait() explicitly when you need to ensure the blitter has completed
|
||||
; (e.g., before reading back modified memory or swapping display buffers).
|
||||
|
||||
const uword MINTERM_MASKED = $CA ; (A AND B) OR (NOT A AND C) - masked sprite blit
|
||||
const uword MINTERM_A_ONLY = $F0 ; channel A only (same as COPY)
|
||||
const uword MINTERM_B_ONLY = $CC ; channel B only
|
||||
const uword MINTERM_A_XOR_C = $5A ; A XOR C (erase/restore patterns)
|
||||
|
||||
asmsub wait() {
|
||||
; Wait until the blitter is completely idle.
|
||||
; Use this before reading back blitter-modified memory or swapping buffers.
|
||||
%asm {{
|
||||
.busy:
|
||||
btst.b #6,custom.DMACONR
|
||||
bne.s .busy
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub set_blitpri(bool hasprio @D0) clobbers (D0) {
|
||||
; Set or clear blitter priority over the CPU.
|
||||
; When enabled, the blitter gets bus priority and completes faster,
|
||||
; but the CPU runs slower during the blit.
|
||||
; Disable when you need full CPU speed while the blitter runs.
|
||||
%asm {{
|
||||
tst.b d0
|
||||
beq.s .clear
|
||||
move.w #$8400,custom.DMACON ; SET bit + BLITPRI bit
|
||||
rts
|
||||
.clear:
|
||||
move.w #$0400,custom.DMACON ; BLITPRI bit only (clears it)
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
; Copy a rectangular block from src to dst.
|
||||
; Waits for blitter idle at start, returns immediately after triggering the blit.
|
||||
asmsub copy_rect(pointer src @A0, pointer dst @A1, uword width_words @D0, uword height @D1, uword src_mod @D2, uword dst_mod @D3, uword minterm @D4, ubyte descending @D5) clobbers (D0,D1,D2,D3,D4,D5,A0,A1) {
|
||||
%asm {{
|
||||
movem.l d2-d7/a2-a6,-(sp)
|
||||
move.w d0,d6 ; d6 = width
|
||||
move.w d1,d7 ; d7 = height
|
||||
move.w d2,d2 ; src_mod
|
||||
move.w d3,d3 ; dst_mod
|
||||
bsr .wait_blt
|
||||
tst.w d5
|
||||
beq.s .no_desc
|
||||
move.w d6,d0
|
||||
lsl.w #1,d0
|
||||
add.w d2,d0
|
||||
move.w d7,d1
|
||||
subq.w #1,d1
|
||||
mulu.w d0,d1
|
||||
move.w d6,d0
|
||||
subq.w #1,d0
|
||||
lsl.w #1,d0
|
||||
ext.l d0
|
||||
add.l d0,d1
|
||||
add.l d1,a0
|
||||
move.w d6,d0
|
||||
lsl.w #1,d0
|
||||
add.w d3,d0
|
||||
move.w d7,d1
|
||||
subq.w #1,d1
|
||||
mulu.w d0,d1
|
||||
move.w d6,d0
|
||||
subq.w #1,d0
|
||||
lsl.w #1,d0
|
||||
ext.l d0
|
||||
add.l d0,d1
|
||||
add.l d1,a1
|
||||
.no_desc:
|
||||
move.w d2,custom.BLTAMOD
|
||||
move.w d3,custom.BLTDMOD
|
||||
move.w #$ffff,custom.BLTAFWM
|
||||
move.w #$ffff,custom.BLTALWM
|
||||
move.l a0,custom.BLTAPT
|
||||
move.l a1,custom.BLTDPT
|
||||
move.w d4,d1
|
||||
or.w #$0900,d1
|
||||
move.w d1,custom.BLTCON0
|
||||
moveq #0,d1
|
||||
tst.w d5
|
||||
beq.s .nodesc
|
||||
move.w #$0002,d1
|
||||
.nodesc:
|
||||
or.w #$0800,d1 ; B32: AGA 32-bit blit mode
|
||||
move.w d1,custom.BLTCON1
|
||||
move.w d7,d1
|
||||
lsl.w #6,d1
|
||||
or.w d6,d1
|
||||
move.w d1,custom.BLTSIZE
|
||||
movem.l (sp)+,d2-d7/a2-a6
|
||||
rts
|
||||
.wait_blt:
|
||||
btst.b #6,custom.DMACONR
|
||||
bne.s .wait_blt
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
; Fill a rectangular block with a pattern.
|
||||
; Waits for blitter idle at start, returns immediately after triggering the blit.
|
||||
asmsub fill_rect(pointer dst @A0, uword width_words @D0, uword height @D1, uword pattern @D2, uword modulo @D3) clobbers (D0,D1,D2,D3,A0) {
|
||||
%asm {{
|
||||
movem.l d2-d7/a2-a6,-(sp)
|
||||
bsr .wait_blt
|
||||
move.w d3,custom.BLTDMOD
|
||||
move.w #$ffff,custom.BLTAFWM
|
||||
move.w #$ffff,custom.BLTALWM
|
||||
move.w d2,custom.BLTCDAT
|
||||
move.l a0,custom.BLTDPT
|
||||
move.w #$01aa,custom.BLTCON0 ; USED=1, USEC=0, minterm=$AA (BLTCDAT -> D)
|
||||
move.w #$0800,custom.BLTCON1 ; B32: AGA 32-bit blit mode
|
||||
move.w d1,d1
|
||||
lsl.w #6,d1
|
||||
or.w d0,d1
|
||||
move.w d1,custom.BLTSIZE
|
||||
movem.l (sp)+,d2-d7/a2-a6
|
||||
rts
|
||||
.wait_blt:
|
||||
btst.b #6,custom.DMACONR
|
||||
bne.s .wait_blt
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
; Initialize the blitter for fast line drawing.
|
||||
; Call this once before drawing a batch of lines with the same parameters.
|
||||
; mask: first/last word mask (usually $ffff for full-word lines)
|
||||
; pixel: line pixel pattern in BLTADAT (usually $8000 for single pixel)
|
||||
; pattern: line fill pattern in BLTBDAT (usually $ffff for solid lines)
|
||||
; screen_mod: bytes per row of the destination bitplane (pitch)
|
||||
; Waits for blitter idle at start, returns immediately after setup.
|
||||
asmsub line_init(uword mask @D0, uword pixel @D1, uword pattern @D2, uword screen_mod @D4) clobbers (D0,D1,D2,D4,A0,A1) {
|
||||
%asm {{
|
||||
movem.l d2-d7/a2-a6,-(sp)
|
||||
bsr .wait_blt
|
||||
move.w d0,custom.BLTAFWM
|
||||
move.w #$ffff,custom.BLTALWM
|
||||
move.w d1,custom.BLTADAT
|
||||
move.w d2,custom.BLTBDAT
|
||||
move.w d4,custom.BLTCMOD
|
||||
movem.l (sp)+,d2-d7/a2-a6
|
||||
rts
|
||||
.wait_blt:
|
||||
btst.b #6,custom.DMACONR
|
||||
bne.s .wait_blt
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
; Draw a single line using the blitter's hardware Bresenham line mode.
|
||||
; Must be preceded by a call to line_init() with the appropriate parameters.
|
||||
; Uses the octant-lookup-table algorithm from coppershade.org
|
||||
; (see https://coppershade.org/asmskool/SOURCES/Developing-Demo-Effects/DDE4/LineVectors/).
|
||||
; x1, y1: starting coordinates (absolute, any direction supported)
|
||||
; x2, y2: ending coordinates
|
||||
; screen_mod: bytes per row of the destination bitplane (pitch)
|
||||
; screen_ptr: pointer to bitplane memory (CHIP RAM)
|
||||
; Waits for blitter idle at start, returns immediately after triggering the blit.
|
||||
asmsub line_draw(uword x1 @D0, uword y1 @D1, uword x2 @D2, uword y2 @D3, uword screen_mod @D4, pointer screen_ptr @A1) clobbers (D0,D1,D2,D3,D5,D6,A0,A1) {
|
||||
%asm {{
|
||||
movem.l d2-d7/a2-a6,-(sp)
|
||||
|
||||
; CPU setup (these would normally be done once in LineInit and
|
||||
; preserved across calls; we set them up here for self-containment).
|
||||
move.w #1*64+2,a3 ; add-value for BLTSIZE
|
||||
move.l #$bfa0000f,a4 ; minterm+mask for quick-rol
|
||||
|
||||
; d0=x1, d1=y1, d2=x2, d3=y2, d4=screen_mod, a1=screen_ptr
|
||||
move.l a4,d6 ; minterm+mask
|
||||
and.w d0,d6 ; mask x 0..15
|
||||
ror.l #4,d6 ; shift it in at top, low word cleared
|
||||
|
||||
; --- deltas ---
|
||||
sub.w d1,d3 ; d3 = y2 - y1
|
||||
bpl.s .dyplus
|
||||
neg.w d3
|
||||
addq.b #8,d6
|
||||
.dyplus:
|
||||
sub.w d0,d2 ; d2 = x2 - x1
|
||||
bgt.s .dxplus
|
||||
neg.w d2
|
||||
addq.b #4,d6
|
||||
.dxplus:
|
||||
cmp.w d2,d3
|
||||
bge.s .dylarger
|
||||
exg d2,d3 ; d2=Small delta, d3=Large delta
|
||||
addq.b #2,d6
|
||||
.dylarger:
|
||||
|
||||
; --- blit values ---
|
||||
muls d4,d1 ; d1 = y1 * screen_mod
|
||||
asr.w #3,d0 ; bit 0 ignored by Blitter
|
||||
add.w d0,d1 ; offset on screen
|
||||
add.l a1,d1 ; add current screen buffer ptr
|
||||
|
||||
add.w d2,d2 ; d2 = 2*SDelta
|
||||
move.w d2,d5 ; d5 = 2*SDelta
|
||||
swap d2 ; d2 high word = 2*SDelta
|
||||
sub.w d3,d5 ; d5 = 2*SDelta - LDelta
|
||||
smi d0 ; if (2*Sdelta-Ldelta) < 0,
|
||||
sub.b d0,d6 ; add 1 (subtract -1) to octant lookup
|
||||
move.b OctTbl(pc,d6.w),d6 ; look up BLTCON bits for octant
|
||||
|
||||
move.w d5,d2 ; d2 low word = 2*SDelta - LDelta
|
||||
sub.w d3,d2 ; d2 low word = 2*SDelta - 2*LDelta
|
||||
asl.w #6,d3 ; d3 = LDelta << 6
|
||||
add.w a3,d3 ; d3 = BLTSIZE
|
||||
|
||||
; --- blit ---
|
||||
bsr .wait_blt
|
||||
move.l d6,custom.BLTCON0 ; shift, minterm, octant bits
|
||||
move.w d5,custom.BLTAPTL ; 2*SDelta - LDelta
|
||||
move.l d2,custom.BLTBMOD ; 2*SDelta | 2*SDelta - 2*LDelta
|
||||
move.l d1,custom.BLTCPT ; source
|
||||
move.l d1,custom.BLTDPT ; destination
|
||||
move.w d3,custom.BLTSIZE
|
||||
movem.l (sp)+,d2-d7/a2-a6
|
||||
rts
|
||||
|
||||
.wait_blt:
|
||||
btst.b #6,custom.DMACONR
|
||||
bne.s .wait_blt
|
||||
rts
|
||||
|
||||
; Octant lookup table placed right after the rts so it is reachable via
|
||||
; PC-relative addressing from the move.b OctTbl(PC,d6.w) instruction above.
|
||||
; Each pair of entries encodes BLTCON1 octant bits for one of the 8 octants.
|
||||
; First byte has SING=0, second has SING=1 (descending mode).
|
||||
OctTbl:
|
||||
dc.b 0*4+1,0*4+1+64 ;7
|
||||
dc.b 4*4+1,4*4+1+64 ;6
|
||||
dc.b 2*4+1,2*4+1+64 ;4
|
||||
dc.b 5*4+1,5*4+1+64 ;5
|
||||
dc.b 1*4+1,1*4+1+64 ;0
|
||||
dc.b 6*4+1,6*4+1+64 ;1
|
||||
dc.b 3*4+1,3*4+1+64 ;3
|
||||
dc.b 7*4+1,7*4+1+64 ;2
|
||||
; !notreached!
|
||||
}}
|
||||
}
|
||||
|
||||
; Masked blit: copy src to dst using a mask channel.
|
||||
; Waits for blitter idle at start, returns immediately after triggering the blit.
|
||||
asmsub masked_blit(pointer src @A0, pointer mask @A1, pointer dst @A2, uword width_words @D0, uword height @D1, uword src_mod @D2, uword mask_mod @D3, uword dst_mod @D4) clobbers (D0,D1,D2,D3,D4,A0,A1,A2) {
|
||||
%asm {{
|
||||
movem.l d2-d7/a2-a6,-(sp)
|
||||
bsr .wait_blt
|
||||
move.w d2,custom.BLTBMOD
|
||||
move.w d3,custom.BLTAMOD
|
||||
move.w d4,custom.BLTDMOD
|
||||
move.w d4,custom.BLTCMOD
|
||||
move.w #$ffff,custom.BLTAFWM
|
||||
move.w #$ffff,custom.BLTALWM
|
||||
move.l a1,custom.BLTAPT
|
||||
move.l a0,custom.BLTBPT
|
||||
move.l a2,custom.BLTCPT
|
||||
move.l a2,custom.BLTDPT
|
||||
move.w #$0fca,custom.BLTCON0
|
||||
move.w #$0800,custom.BLTCON1 ; B32: AGA 32-bit blit mode
|
||||
move.w d1,d1
|
||||
lsl.w #6,d1
|
||||
or.w d0,d1
|
||||
move.w d1,custom.BLTSIZE
|
||||
movem.l (sp)+,d2-d7/a2-a6
|
||||
rts
|
||||
.wait_blt:
|
||||
btst.b #6,custom.DMACONR
|
||||
bne.s .wait_blt
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
; Clear a rectangular region of a bitplane to zero.
|
||||
; Waits for blitter idle at start, returns immediately after triggering the blit.
|
||||
asmsub clear_plane(pointer dst @A0, uword width_words @D0, uword height @D1) clobbers (D0,D1,A0) {
|
||||
%asm {{
|
||||
movem.l d2-d7/a2-a6,-(sp)
|
||||
bsr .wait_blt
|
||||
move.w #$ffff,custom.BLTAFWM
|
||||
move.w #$ffff,custom.BLTALWM
|
||||
move.w #$0000,custom.BLTCDAT
|
||||
move.w #$0000,custom.BLTDMOD
|
||||
move.l a0,custom.BLTDPT
|
||||
move.w #$01aa,custom.BLTCON0
|
||||
move.w #$0800,custom.BLTCON1 ; B32: AGA 32-bit blit mode
|
||||
move.w d1,d1
|
||||
lsl.w #6,d1
|
||||
or.w d0,d1
|
||||
move.w d1,custom.BLTSIZE
|
||||
movem.l (sp)+,d2-d7/a2-a6
|
||||
rts
|
||||
.wait_blt:
|
||||
btst.b #6,custom.DMACONR
|
||||
bne.s .wait_blt
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
; Fill an entire bitplane (or any width_words x height block) with a 16-bit pattern.
|
||||
; pattern: the value written to every word of the destination (e.g. $0000 clears,
|
||||
; $ffff fills solid, $aaaa produces a vertical stripe pattern).
|
||||
; Waits for blitter idle at start, returns immediately after triggering the blit.
|
||||
asmsub fill_plane(pointer dst @A0, uword width_words @D0, uword height @D1, uword pattern @D2) clobbers (D0,D1,D2,A0) {
|
||||
%asm {{
|
||||
movem.l d2-d7/a2-a6,-(sp)
|
||||
bsr .wait_blt
|
||||
move.w #$ffff,custom.BLTAFWM
|
||||
move.w #$ffff,custom.BLTALWM
|
||||
move.w d2,custom.BLTCDAT
|
||||
move.l a0,custom.BLTDPT
|
||||
move.w #$01aa,custom.BLTCON0 ; USED=1, USEC=0, minterm=$AA (BLTCDAT -> D)
|
||||
move.w #$0800,custom.BLTCON1 ; B32: AGA 32-bit blit mode
|
||||
move.w #$0000,custom.BLTDMOD
|
||||
move.w d1,d1
|
||||
lsl.w #6,d1
|
||||
or.w d0,d1
|
||||
move.w d1,custom.BLTSIZE
|
||||
movem.l (sp)+,d2-d7/a2-a6
|
||||
rts
|
||||
.wait_blt:
|
||||
btst.b #6,custom.DMACONR
|
||||
bne.s .wait_blt
|
||||
rts
|
||||
}}
|
||||
}
|
||||
}
|
||||
@@ -1,279 +1,5 @@
|
||||
; Number conversions routines.
|
||||
|
||||
%import strings
|
||||
%import shared_amiga_conv
|
||||
|
||||
conv {
|
||||
|
||||
; ----- number conversions to decimal strings ----
|
||||
|
||||
%option ignore_unused
|
||||
str string_out = "????????????????" ; result buffer for the string conversion routines
|
||||
private long @shared fmt_value_l
|
||||
private uword @shared fmt_value_w
|
||||
|
||||
private asmsub putcharproc(ubyte character @D0, pointer output @A3) -> ubyte @D0 {
|
||||
%asm {{
|
||||
move.b d0, (a3)+ ; Store character in buffer and advance pointer
|
||||
rts ; Return control to RawDoFmt loop
|
||||
}}
|
||||
}
|
||||
|
||||
sub str_ub0(ubyte value) -> str {
|
||||
; ---- convert the ubyte in A in decimal string form, with left padding 0s (3 positions total)
|
||||
fmt_value_w = value as uword
|
||||
void exec.RawDoFmt("%03d", &fmt_value_w, putcharproc, string_out)
|
||||
return string_out
|
||||
}
|
||||
|
||||
sub str_ub(ubyte value) -> str {
|
||||
; ---- convert the ubyte in A in decimal string form, without left padding 0s
|
||||
fmt_value_w = value as uword
|
||||
void exec.RawDoFmt("%d", &fmt_value_w, putcharproc, string_out)
|
||||
return string_out
|
||||
}
|
||||
|
||||
sub str_b(byte value) -> str {
|
||||
; ---- convert the byte in A in decimal string form, without left padding 0s
|
||||
fmt_value_w = value as uword
|
||||
void exec.RawDoFmt("%d", &fmt_value_w, putcharproc, string_out)
|
||||
return string_out
|
||||
}
|
||||
|
||||
sub str_ubhex (ubyte value) -> str {
|
||||
; ---- convert the ubyte in A in hex string form
|
||||
fmt_value_w = value as uword
|
||||
void exec.RawDoFmt("%02x", &fmt_value_w, putcharproc, string_out)
|
||||
return string_out
|
||||
}
|
||||
|
||||
sub str_ubbin (ubyte value) -> str {
|
||||
; ---- convert the ubyte in binary string form
|
||||
^^ubyte out_ptr = &string_out
|
||||
ubyte mask = 128
|
||||
repeat 8 {
|
||||
if value & mask != 0
|
||||
@(out_ptr) = '1'
|
||||
else
|
||||
@(out_ptr) = '0'
|
||||
out_ptr++
|
||||
mask >>= 1
|
||||
}
|
||||
@(out_ptr) = 0
|
||||
return string_out
|
||||
}
|
||||
|
||||
sub str_uwbin (uword value) -> str {
|
||||
; ---- convert the uword in binary string form
|
||||
^^ubyte out_ptr = &string_out
|
||||
uword mask = $8000
|
||||
repeat 16 {
|
||||
if value & mask != 0
|
||||
@(out_ptr) = '1'
|
||||
else
|
||||
@(out_ptr) = '0'
|
||||
out_ptr++
|
||||
mask >>= 1
|
||||
}
|
||||
@(out_ptr) = 0
|
||||
return string_out
|
||||
}
|
||||
|
||||
sub str_uwhex (uword value) -> str {
|
||||
; ---- convert the uword in hexadecimal string form (4 digits)
|
||||
void exec.RawDoFmt("%04x", &value, putcharproc, string_out)
|
||||
return string_out
|
||||
}
|
||||
|
||||
sub str_ulhex (long value) -> str {
|
||||
; ---- convert the long in hexadecimal string form (8 digits)
|
||||
void exec.RawDoFmt("%08lx", &value, putcharproc, string_out)
|
||||
return string_out
|
||||
}
|
||||
|
||||
sub str_uw0 (uword value) -> str {
|
||||
; ---- convert the uword in decimal string form, with left padding 0s (5 positions total)
|
||||
; requires kickstart 2.0+
|
||||
fmt_value_l = value as long
|
||||
void exec.RawDoFmt("%05lu", &fmt_value_l, putcharproc, string_out)
|
||||
return string_out
|
||||
}
|
||||
|
||||
sub str_uw (uword value) -> str {
|
||||
; ---- convert the uword in decimal string form, without left padding 0s
|
||||
; requires kickstart 2.0+
|
||||
fmt_value_l = value as long
|
||||
void exec.RawDoFmt("%lu", &fmt_value_l, putcharproc, string_out)
|
||||
return string_out
|
||||
}
|
||||
|
||||
sub str_w (word value) -> str {
|
||||
; ---- convert the (signed) word into decimal string form, without left padding 0's
|
||||
void exec.RawDoFmt("%d", &value, putcharproc, string_out)
|
||||
return string_out
|
||||
}
|
||||
|
||||
sub str_l (long value) -> str {
|
||||
; ---- convert the (signed) long into decimal string form
|
||||
void exec.RawDoFmt("%ld", &value, putcharproc, string_out)
|
||||
return string_out
|
||||
}
|
||||
|
||||
|
||||
; ---- string conversion to numbers -----
|
||||
|
||||
sub str2ubyte(str string) -> ubyte {
|
||||
; -- returns in A the unsigned byte value of the string number argument in AY
|
||||
; the number may NOT be preceded by a + sign and may NOT contain spaces
|
||||
; (any non-digit character will terminate the number string that is parsed)
|
||||
return str2uword(string) as ubyte
|
||||
}
|
||||
|
||||
sub str2byte(str string) -> byte {
|
||||
; -- returns in A the signed byte value of the string number argument in AY
|
||||
; the number may be preceded by a + or - sign but may NOT contain spaces
|
||||
; (any non-digit character will terminate the number string that is parsed)
|
||||
return str2word(string) as byte
|
||||
}
|
||||
|
||||
sub str2uword(str string) -> uword {
|
||||
uword result
|
||||
ubyte ii
|
||||
while string[ii] >= '0' and string[ii] <= '9' {
|
||||
result = result * 10 + (string[ii] - '0') as uword
|
||||
ii++
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
sub str2word(str string) -> word {
|
||||
bool negative
|
||||
ubyte ii
|
||||
if string[0] == '-' {
|
||||
negative = true
|
||||
ii = 1
|
||||
} else {
|
||||
if string[0] == '+'
|
||||
ii = 1
|
||||
}
|
||||
uword result
|
||||
while string[ii] >= '0' and string[ii] <= '9' {
|
||||
result = result * 10 + (string[ii] - '0') as uword
|
||||
ii++
|
||||
}
|
||||
if negative
|
||||
return 0 - result as word
|
||||
return result as word
|
||||
}
|
||||
|
||||
sub hex2uword(str string) -> uword {
|
||||
; -- hexadecimal string (with or without '$') to uword.
|
||||
; stops parsing at the first character that's not a hex digit (except leading $)
|
||||
uword result
|
||||
ubyte char
|
||||
if @(string)=='$'
|
||||
string++
|
||||
repeat {
|
||||
char = strings.lowerchar(@(string))
|
||||
if strings.isxdigit(char) {
|
||||
result <<= 4
|
||||
if char>='0' and char<='9'
|
||||
result |= char-'0'
|
||||
else
|
||||
result |= char-'a'+10
|
||||
} else
|
||||
return result
|
||||
string++
|
||||
}
|
||||
}
|
||||
|
||||
sub hex2long(str string) -> long {
|
||||
; -- hexadecimal string (with or without '$') to long.
|
||||
; stops parsing at the first character that's not a hex digit (except leading $)
|
||||
long result
|
||||
ubyte char
|
||||
if @(string)=='$'
|
||||
string++
|
||||
repeat {
|
||||
char = strings.lowerchar(@(string))
|
||||
if strings.isxdigit(char) {
|
||||
result <<= 4
|
||||
if char>='0' and char<='9'
|
||||
result |= char-'0'
|
||||
else
|
||||
result |= char-'a'+10
|
||||
} else
|
||||
return result
|
||||
string++
|
||||
}
|
||||
}
|
||||
|
||||
sub str2long(str string) -> long {
|
||||
; -- convert a decimal string (terminated with a zero byte) into a long. Clobbers R0
|
||||
long result = 0
|
||||
bool negative = string[0] == '-'
|
||||
if negative or string[0]=='+'
|
||||
string++
|
||||
repeat {
|
||||
ubyte digit_char = @(string)
|
||||
if strings.isdigit(digit_char) {
|
||||
result = (result<<1) + (result<<3) ; multiply by 10
|
||||
result += digit_char - '0' ; add digit
|
||||
} else {
|
||||
break ; Invalid character, stop processing
|
||||
}
|
||||
string++
|
||||
}
|
||||
|
||||
if negative
|
||||
return -result
|
||||
else
|
||||
return result
|
||||
}
|
||||
|
||||
sub bin2uword(str string) -> uword {
|
||||
; -- binary string (with or without '%') to uword.
|
||||
; stops parsing at the first character that's not a 0 or 1. (except leading %)
|
||||
uword result
|
||||
ubyte char
|
||||
if @(string)=='%'
|
||||
string++
|
||||
repeat {
|
||||
char = @(string)
|
||||
if char=='0' {
|
||||
result <<= 1
|
||||
} else if char=='1' {
|
||||
result <<= 1
|
||||
result |= 1
|
||||
} else
|
||||
return result
|
||||
string++
|
||||
}
|
||||
}
|
||||
|
||||
sub any2uword(str string) -> uword, ubyte {
|
||||
; -- convert any number string (any prefix allowed) to uword.
|
||||
; returns the parsed word value, and the number of processed characters (including the prefix symbol)
|
||||
ubyte count
|
||||
when string[0] {
|
||||
'$' -> {
|
||||
count = 1
|
||||
while strings.isxdigit(string[count])
|
||||
count++
|
||||
return hex2uword(string), count
|
||||
}
|
||||
'%' -> {
|
||||
count = 1
|
||||
while string[count]=='0' or string[count]=='1'
|
||||
count++
|
||||
return bin2uword(string), count
|
||||
}
|
||||
else -> {
|
||||
count = 0
|
||||
while strings.isdigit(string[count])
|
||||
count++
|
||||
return str2uword(string), count
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,137 +1,5 @@
|
||||
; Copper list builder and manager for Amiga custom hardware.
|
||||
; IMPORTANT: Copper lists MUST be allocated in CHIP RAM (accessible by both CPU and custom chips).
|
||||
; Use memory() or ensure your list buffers are in CHIP RAM range.
|
||||
|
||||
%import custom
|
||||
%import shared_amiga_copper
|
||||
|
||||
copper {
|
||||
%option no_symbol_prefixing, ignore_unused
|
||||
|
||||
; Current write position in copper list (used by assembly routines)
|
||||
pointer @shared _copper_pos
|
||||
|
||||
; ========== List building routines (assembly) ==========
|
||||
|
||||
asmsub init(pointer list_ptr @A0) clobbers (A0) {
|
||||
%asm {{
|
||||
move.l a0,copper._copper_pos
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub move(uword reg_addr @D0, uword value @D1) clobbers (D0, D1, A0) {
|
||||
; Add a MOVE instruction to the copper list.
|
||||
; reg_addr is the custom register address offsetr (e.g., $0180 for COLOR00 / $dff180).
|
||||
; The copper MOVE instruction encodes the register offset from $dff000.
|
||||
%asm {{
|
||||
move.l copper._copper_pos,a0
|
||||
and.w #$1fe,d0 ; mask to even register offset (bit 0 must be 0)
|
||||
move.w d0,(a0)+ ; word 1: register offset (bit 0 = 0 identifies MOVE)
|
||||
move.w d1,(a0)+ ; word 2: value
|
||||
move.l a0,copper._copper_pos
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub wait(ubyte vpos @D0, ubyte hpos @D1, uword compare_mask @D2) clobbers (D0, D1, D2, A0) {
|
||||
; Add a WAIT instruction to the copper list.
|
||||
; Word1 = (vpos<<8) | (hpos<<1) | 1 (bit 0 = 1 identifies WAIT/SKIP)
|
||||
; Word2 = compare_mask with bit 0 = 0 (distinguishes WAIT from SKIP).
|
||||
; Word2 bit 15 = BFD (1 = no blitter wait, 0 = also wait for blitter)
|
||||
; Word2 bits 14-8 = VE (vertical compare enable mask)
|
||||
; Word2 bits 7-1 = HE (horizontal compare enable mask)
|
||||
%asm {{
|
||||
move.l copper._copper_pos,a0
|
||||
and.w #$ff,d0 ; zero-extend vpos to word
|
||||
lsl.w #8,d0 ; vpos to high byte
|
||||
and.w #$ff,d1 ; zero-extend hpos to word
|
||||
lsl.w #1,d1 ; hpos to bit 1
|
||||
or.w d1,d0 ; combine vpos and hpos
|
||||
or.w #1,d0 ; set bit 0 to identify instruction as WAIT/SKIP
|
||||
move.w d0,(a0)+ ; word 1
|
||||
and.w #$fffe,d2 ; clear bit 0 to indicate WAIT (not SKIP)
|
||||
move.w d2,(a0)+ ; word 2
|
||||
move.l a0,copper._copper_pos
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub skip(ubyte vpos @D0, ubyte hpos @D1, uword compare_mask @D2) clobbers (D0, D1, D2, A0) {
|
||||
; Add a SKIP instruction to the copper list.
|
||||
; Word1 = (vpos<<8) | (hpos<<1) | 1 (bit 0 = 1 identifies WAIT/SKIP)
|
||||
; Word2 = compare_mask with bit 0 = 1 (distinguishes SKIP from WAIT).
|
||||
%asm {{
|
||||
move.l copper._copper_pos,a0
|
||||
and.w #$ff,d0 ; zero-extend vpos to word
|
||||
lsl.w #8,d0 ; vpos to high byte
|
||||
and.w #$ff,d1 ; zero-extend hpos to word
|
||||
lsl.w #1,d1 ; hpos to bit 1
|
||||
or.w d1,d0 ; combine vpos and hpos
|
||||
or.w #1,d0 ; set bit 0 to identify instruction as WAIT/SKIP
|
||||
move.w d0,(a0)+ ; word 1
|
||||
or.w #1,d2 ; set bit 0 to indicate SKIP (not WAIT)
|
||||
move.w d2,(a0)+ ; word 2
|
||||
move.l a0,copper._copper_pos
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub end() clobbers (A0) {
|
||||
; Terminate the copper list with the end marker ($FFFF, $FFFE).
|
||||
%asm {{
|
||||
move.l copper._copper_pos,a0
|
||||
move.w #$ffff,(a0)+ ; end marker word 1
|
||||
move.w #$fffe,(a0)+ ; end marker word 2
|
||||
move.l a0,copper._copper_pos
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub get_pos() -> pointer @A0 {
|
||||
; Return the current write position in the copper list.
|
||||
; Useful for calculating list size or continuing from a saved position.
|
||||
%asm {{
|
||||
move.l copper._copper_pos,a0
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
; ========== Activation routines (assembly) ==========
|
||||
|
||||
asmsub start(pointer list_ptr @A0) clobbers (A0) {
|
||||
; Activate a copper list by loading its address into COP1LC and enabling Copper DMA.
|
||||
; The copper list must be in CHIP RAM.
|
||||
%asm {{
|
||||
move.l a0,custom.COP1LC ; load copper list pointer (auto-increments)
|
||||
move.w #$8280,custom.DMACON ; DMACON: SET(0x8000) | DMAEN(0x0200) | COPEN(0x0080)
|
||||
clr.w custom.COPJMP1 ; strobe COPJMP1 to activate
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
; ========== Effects routines (Prog8) ==========
|
||||
|
||||
sub append_raster_colors(ubyte vpos_start, ^^uword colors, ubyte num_lines) {
|
||||
; Append WAIT+MOVE instructions to change background color per scanline.
|
||||
; Does NOT call init() or end() - caller must handle list setup.
|
||||
;
|
||||
; Parameters:
|
||||
; vpos_start - starting vertical beam position (0-255)
|
||||
; colors - pointer to array of color values (12-bit RGB, e.g., $0F00 for red)
|
||||
; num_lines - number of scanlines to color
|
||||
;
|
||||
; Example:
|
||||
; copper.init(my_list)
|
||||
; ... add other copper instructions ...
|
||||
; copper.append_raster_colors(50, bar_colors, 8)
|
||||
; copper.end()
|
||||
|
||||
ubyte vpos = vpos_start
|
||||
ubyte i
|
||||
for i in 0 to num_lines - 1 {
|
||||
wait(vpos, 0, $fffe)
|
||||
move($180, colors[i])
|
||||
vpos += 1
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,709 +1,5 @@
|
||||
%import exec
|
||||
%import syslib
|
||||
%import shared_amiga_custom
|
||||
|
||||
custom {
|
||||
%option no_symbol_prefixing, ignore_unused
|
||||
|
||||
|
||||
asmsub grab_system() {
|
||||
; take over the whole OS and system, to run hardware banging programs (games, demos, etc)
|
||||
%asm {{
|
||||
|
||||
exec_AttnFlags = 296
|
||||
gfx_ActiView = $22
|
||||
gfx_copinit = $26
|
||||
gfx_LOFlist = $32
|
||||
VBlankFrequency = $212
|
||||
GfxLoadView = -222
|
||||
GfxWaitTOF = -270
|
||||
IRQ1 = $64
|
||||
IRQ2 = $68
|
||||
IRQ3 = $6C
|
||||
IRQ4 = $70
|
||||
IRQ5 = $74
|
||||
IRQ6 = $78
|
||||
IRQ7 = $7C
|
||||
|
||||
move.l 4.w,a6
|
||||
jsr exec.Forbid(a6) ; Do not run other tasks
|
||||
btst.b #0,exec_AttnFlags+1(a6) ; Check if > 68000 processor
|
||||
beq.s 1$ ; On 68000 no VBR (always zero)
|
||||
lea.l .getvbr(PC),a5 ; Function to call as supervisor
|
||||
jsr exec.Supervisor(a6) ; Call supervisor function in A5
|
||||
move.l d0,custom.cpuVBR ; Store the returned VBR contents
|
||||
1$
|
||||
cmp.b #50,VBlankFrequency(a6)
|
||||
seq.b custom.isPAL
|
||||
|
||||
move.l sys.GfxBase,a6 ; A6 = Graphics base
|
||||
move.l gfx_ActiView(a6),custom.savedView ; Store current View pointer
|
||||
sub.l a1,a1 ; NULL view = default settings
|
||||
jsr GfxLoadView(a6) ; Load the view
|
||||
jsr GfxWaitTOF(a6) ; Wait one screen refresh
|
||||
jsr GfxWaitTOF(a6) ; Wait a 2nd (in case of interlace)
|
||||
|
||||
move.w #$8000,d0 ; Value
|
||||
move.w custom.DMACONR,custom.savedDMACON ; Store system DMA channels
|
||||
or.w d0,custom.savedDMACON ; SET/CLR set to SET
|
||||
move.w custom.INTENAR,custom.savedINTENA ; Store system enabled interrupts
|
||||
or.w d0,custom.savedINTENA ; SET/CLR set to SET
|
||||
move.w custom.ADKCONR,custom.savedADKCON ; Audio, disk and UART
|
||||
or.w d0,custom.savedADKCON ; SET/CLR set to SET
|
||||
|
||||
btst.b #14-8,custom.DMACONR ; Dummy read
|
||||
3$ btst.b #14-8,custom.DMACONR ; Blitter still busy?
|
||||
bne.s 3$ ; If yes, wait a bit
|
||||
move.w #$01FF,custom.DMACON ; Disable all DMA
|
||||
move.w #$3FFF,custom.INTENA ; Disable all interrupts
|
||||
|
||||
move.l custom.cpuVBR,a0 ; A0 = Pointer to vector base
|
||||
move.l IRQ1(a0),custom.savedIRQ1 ; Store IRQ1 vector
|
||||
move.l IRQ3(a0),custom.savedIRQ3 ; Store IRQ3 vector
|
||||
move.l IRQ4(a0),custom.savedIRQ4 ; Store IRQ4 vector
|
||||
bra.s .skip
|
||||
|
||||
.getvbr: dc.l $4E7A0801 ; MOVEC VBR,d0 - privileged instruction
|
||||
rte
|
||||
|
||||
.skip: rts
|
||||
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub restore_system() {
|
||||
; restore the original OS and multitasking operation when the game/demo exits.
|
||||
%asm {{
|
||||
btst.b #14-8,custom.DMACONR ; Dummy read
|
||||
1$ btst.b #14-8,custom.DMACONR ; Blitter still busy?
|
||||
bne.s 1$ ; If yes, wait a bit
|
||||
move.w #$01FF,custom.DMACON ; Disable all DMA
|
||||
move.w #$3FFF,custom.INTENA ; Disable all interrupts
|
||||
|
||||
move.l custom.cpuVBR,a0 ; A0 = Pointer to vector base
|
||||
move.l custom.savedIRQ4,d0 ; Restore IRQ4 vector
|
||||
move.l d0,IRQ4(a0)
|
||||
move.l custom.savedIRQ3,d0 ; Restore IRQ3 vector
|
||||
move.l d0,IRQ3(a0)
|
||||
move.l custom.savedIRQ1,d0 ; Restore IRQ1 vector
|
||||
move.l d0,IRQ1(a0)
|
||||
|
||||
move.l sys.GfxBase,a6 ; A6 = Graphics base
|
||||
move.l gfx_copinit(a6),custom.COP1LC ; Restore coplist pointer 1
|
||||
move.l gfx_LOFlist(a6),custom.COP2LC ; Restore coplist pointer 2
|
||||
clr.w custom.COPJMP1 ; Make Copper use restored pointer
|
||||
|
||||
move.w custom.savedADKCON,custom.ADKCON ; Restore audio, disk and UART
|
||||
move.w custom.savedINTENA,custom.INTENA ; Restore original interrupts
|
||||
move.w custom.savedDMACON,custom.DMACON ; Restore original DMA
|
||||
|
||||
move.l custom.savedView,a1 ; Get original view pointer
|
||||
jsr GfxLoadView(a6) ; Restore the original view
|
||||
jsr GfxWaitTOF(a6) ; Wait one screen refresh
|
||||
jsr GfxWaitTOF(a6) ; Wait a 2nd (in case of interlace)
|
||||
|
||||
move.l 4.w,a6
|
||||
jsr exec.Permit(a6) ; Re-enable multitasking
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub waitvsync() {
|
||||
%asm {{
|
||||
; synchronize to the screen's vsync, this routine doesn't require the OS to be active (sys.waitvsync is the OS-compatible version of this routine)
|
||||
; Wait until the raster beam reaches line 300
|
||||
.WaitLine300:
|
||||
MOVE.L $DFF004, D0 ; Read VPOSR + VHPOSR simultaneously
|
||||
LSR.L #8, D0 ; Shift vertical position bits into low word
|
||||
AND.W #$01FF, D0 ; Mask out horizontal beam bits (get 9-bit line #)
|
||||
CMP.W #300, D0 ; Are we at raster line 300?
|
||||
BNE.S .WaitLine300
|
||||
|
||||
; Wait until the beam MOVES PAST line 300
|
||||
; (Prevents fast CPUs like 030/040/060 from executing twice on the same line)
|
||||
.WaitLineNext:
|
||||
MOVE.L $DFF004, D0
|
||||
LSR.L #8, D0
|
||||
AND.W #$01FF, D0
|
||||
CMP.W #300, D0
|
||||
BEQ.S .WaitLineNext
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
|
||||
pointer @shared cpuVBR ; after calling grab_system: contains CPU VBR register
|
||||
bool @shared isPAL ; after calling grab_system: is true when system is PAL, false if NTSC
|
||||
|
||||
private pointer @shared savedView ; original graphics view pointer
|
||||
private uword @shared savedDMACON ; original DMA control with SET/CLR bit
|
||||
private uword @shared savedINTENA ; original interrupt enable with SET/CLR bit
|
||||
private uword @shared savedADKCON ; original ADK control with SET/CLR bit
|
||||
private pointer @shared savedIRQ1 ; original IRQ1 vector
|
||||
private pointer @shared savedIRQ3 ; original IRQ3 vector
|
||||
private pointer @shared savedIRQ4 ; original IRQ4 vector
|
||||
|
||||
|
||||
; ========== AGA palette utilities ==========
|
||||
|
||||
asmsub set_aga_color(ubyte color_index @D0, long rgb24 @D1) clobbers (D0,D1,D2,D3,D4,A0) {
|
||||
; Write a 24-bit RGB color ($00RRGGBB) to an AGA palette entry.
|
||||
; AGA uses eight banks of 32 COLOR registers and two writes per color:
|
||||
; first the upper nibble of each channel, then the lower nibble.
|
||||
; Keep this routine 68000-compatible: the amiga500 target is assembled as
|
||||
; 68000 by default, even though AGA hardware is normally paired with a 68020.
|
||||
%asm {{
|
||||
and.l #$ff,d0
|
||||
move.l d0,d4
|
||||
lsr.w #5,d4
|
||||
lsl.w #8,d4
|
||||
lsl.w #5,d4
|
||||
|
||||
and.w #$1f,d0
|
||||
lsl.w #1,d0
|
||||
move.l #$dff180,a0
|
||||
adda.w d0,a0
|
||||
|
||||
move.l d1,d2
|
||||
and.l #$f00000,d2
|
||||
lsr.l #8,d2
|
||||
lsr.l #4,d2
|
||||
move.l d1,d3
|
||||
and.l #$00f000,d3
|
||||
lsr.l #8,d3
|
||||
or.w d3,d2
|
||||
move.l d1,d3
|
||||
and.l #$0000f0,d3
|
||||
lsr.l #4,d3
|
||||
or.w d3,d2
|
||||
|
||||
move.l d1,d3
|
||||
and.l #$0f0000,d3
|
||||
lsr.l #8,d3
|
||||
move.l d1,d0
|
||||
and.l #$000f00,d0
|
||||
lsr.l #4,d0
|
||||
or.w d0,d3
|
||||
move.l d1,d0
|
||||
and.l #$00000f,d0
|
||||
or.w d0,d3
|
||||
|
||||
move.w d4,custom.BPLCON3
|
||||
move.w d2,(a0)
|
||||
ori.w #$0200,d4
|
||||
move.w d4,custom.BPLCON3
|
||||
move.w d3,(a0)
|
||||
andi.w #$fdff,d4
|
||||
move.w d4,custom.BPLCON3
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub set_aga_color_nibbles(ubyte color_index @D0, uword rgb_high_nibbles @D1, uword rgb_low_nibbles @D2) clobbers (D0,D1,D2,D3,A0) {
|
||||
; Write preformatted AGA palette nibbles. Each value is $0RGB. Result will still be 24 bit RRGGBB AGA color.
|
||||
; Keep this routine 68000-compatible: the amiga500 target is assembled as
|
||||
; 68000 by default, even though AGA hardware is normally paired with a 68020.
|
||||
%asm {{
|
||||
and.l #$ff,d0
|
||||
move.l d0,d3
|
||||
lsr.w #5,d3
|
||||
lsl.w #8,d3
|
||||
lsl.w #5,d3
|
||||
|
||||
and.w #$1f,d0
|
||||
lsl.w #1,d0
|
||||
move.l #$dff180,a0
|
||||
adda.w d0,a0
|
||||
|
||||
move.w d3,custom.BPLCON3
|
||||
move.w d1,(a0)
|
||||
ori.w #$0200,d3
|
||||
move.w d3,custom.BPLCON3
|
||||
move.w d2,(a0)
|
||||
andi.w #$fdff,d3
|
||||
move.w d3,custom.BPLCON3
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
; ========== audio filter =======
|
||||
|
||||
asmsub filter_on() {
|
||||
; ENABLE Audio Filter (Muffled audio / Dimmed Power LED)
|
||||
%asm {{
|
||||
bclr #1,custom.CIAA_PRA ; Set Bit 1 to LOW -> Filter ON
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub filter_off() {
|
||||
; DISABLE Audio Filter (Clear, crisp audio / Bright Power LED)
|
||||
%asm {{
|
||||
bset #1,custom.CIAA_PRA ; Set Bit 1 to HIGH -> Filter OFF
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
; ========== mouse button status ==========
|
||||
|
||||
sub left_button() -> bool {
|
||||
; Returns true if the left mouse button (port 1) is pressed.
|
||||
; Left button is CIA-A PRA bit 6, active low.
|
||||
return (custom.CIAA_PRA & %01000000) == 0
|
||||
}
|
||||
|
||||
sub right_button() -> bool {
|
||||
; Returns true if the right mouse button (port 1) is pressed.
|
||||
; Right button is POTGOR ($dff016) bit 10, active low.
|
||||
return (custom.POTGOR & %0000010000000000) == 0
|
||||
}
|
||||
|
||||
sub middle_button() -> bool {
|
||||
; Returns true if the middle mouse button (port 1) is pressed.
|
||||
; Middle button is POTGOR ($dff016) bit 8, active low.
|
||||
return (custom.POTGOR & %0000000100000000) == 0
|
||||
}
|
||||
|
||||
|
||||
; Amiga custom chip registers (full addresses, base $dff000)
|
||||
; Regenerated from https://github.com/alfishe/amiga-bootcamp/blob/main/14_references/custom_chip_registers.md
|
||||
; All registers are 16-bit words accessed on even byte boundaries.
|
||||
|
||||
; ========== Read-only registers ==========
|
||||
|
||||
&uword BLTDDAT = $dff000 ; blitter destination early read
|
||||
&uword DMACONR = $dff002 ; DMA control read
|
||||
&uword VPOSR = $dff004 ; beam position (V high bits + LOF)
|
||||
&uword VHPOSR = $dff006 ; beam position (V low + H)
|
||||
&uword DSKDATR = $dff008 ; disk data early read
|
||||
&uword JOY0DAT = $dff00a ; joystick/mouse port 0
|
||||
&uword JOY1DAT = $dff00c ; joystick/mouse port 1
|
||||
&uword CLXDAT = $dff00e ; collision detection
|
||||
&uword ADKCONR = $dff010 ; audio/disk control read
|
||||
&uword POT0DAT = $dff012 ; pot port 0 data
|
||||
&uword POT1DAT = $dff014 ; pot port 1 data
|
||||
&uword POTGOR = $dff016 ; pot port data read
|
||||
&uword SERDATR = $dff018 ; serial port data + status
|
||||
&uword DSKBYTR = $dff01a ; disk data byte + status
|
||||
&uword INTENAR = $dff01c ; interrupt enable read
|
||||
&uword INTREQR = $dff01e ; interrupt request read
|
||||
|
||||
; ========== Write / Read-Write registers ==========
|
||||
|
||||
; Disk
|
||||
&uword DSKPTH = $dff020 ; disk DMA pointer (high)
|
||||
&uword DSKPTL = $dff022 ; disk DMA pointer (low)
|
||||
&pointer DSKPT = $dff020 ; disk DMA pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword DSKLEN = $dff024 ; disk DMA length
|
||||
&uword DSKDAT = $dff026 ; disk DMA data write
|
||||
&uword REFPTR = $dff028 ; refresh pointer
|
||||
|
||||
; Beam position (write)
|
||||
&uword VPOSW = $dff02a ; beam position write (V)
|
||||
&uword VHPOSW = $dff02c ; beam position write (H)
|
||||
&uword COPCON = $dff02e ; copper control
|
||||
|
||||
; Serial
|
||||
&uword SERDAT = $dff030 ; serial port data write
|
||||
&uword SERPER = $dff032 ; serial port period/control
|
||||
|
||||
; Pot/Game
|
||||
&uword POTGO = $dff034 ; pot port control
|
||||
&uword JOYTEST = $dff036 ; joystick counter test
|
||||
&uword STREQU = $dff038 ; short frame strobe (ECS)
|
||||
&uword STRVBL = $dff03a ; vertical blank strobe (ECS)
|
||||
&uword STRHOR = $dff03c ; horizontal sync strobe (ECS)
|
||||
&uword STRLONG = $dff03e ; long frame strobe (ECS)
|
||||
|
||||
; Blitter
|
||||
&uword BLTCON0 = $dff040 ; blitter control 0
|
||||
&uword BLTCON1 = $dff042 ; blitter control 1
|
||||
&uword BLTAFWM = $dff044 ; blitter A first word mask
|
||||
&uword BLTALWM = $dff046 ; blitter A last word mask
|
||||
&uword BLTCPTH = $dff048 ; blitter C pointer (high)
|
||||
&uword BLTCPTL = $dff04a ; blitter C pointer (low)
|
||||
&pointer BLTCPT = $dff048 ; blitter C pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword BLTBPTH = $dff04c ; blitter B pointer (high)
|
||||
&uword BLTBPTL = $dff04e ; blitter B pointer (low)
|
||||
&pointer BLTBPT = $dff04c ; blitter B pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword BLTAPTH = $dff050 ; blitter A pointer (high)
|
||||
&uword BLTAPTL = $dff052 ; blitter A pointer (low)
|
||||
&pointer BLTAPT = $dff050 ; blitter A pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword BLTDPTH = $dff054 ; blitter D pointer (high)
|
||||
&uword BLTDPTL = $dff056 ; blitter D pointer (low)
|
||||
&pointer BLTDPT = $dff054 ; blitter D pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword BLTSIZE = $dff058 ; blitter size (starts blit)
|
||||
&uword BLTCON0L = $dff05a ; blitter control 0 (lower bits, ECS)
|
||||
&uword BLTSIZV = $dff05c ; blitter V size (ECS)
|
||||
&uword BLTSIZH = $dff05e ; blitter H size (ECS, starts blit)
|
||||
&uword BLTCMOD = $dff060 ; blitter C modulo
|
||||
&uword BLTBMOD = $dff062 ; blitter B modulo
|
||||
&uword BLTAMOD = $dff064 ; blitter A modulo
|
||||
&uword BLTDMOD = $dff066 ; blitter D modulo
|
||||
&uword BLTCDAT = $dff070 ; blitter C data
|
||||
&uword BLTBDAT = $dff072 ; blitter B data
|
||||
&uword BLTADAT = $dff074 ; blitter A data
|
||||
&uword SPRHDAT = $dff078 ; ext sprite data (ECS)
|
||||
&uword DENISEID = $dff07c ; Denise/Lisa chip ID (ECS/AGA)
|
||||
&uword DSKSYNC = $dff07e ; disk sync pattern
|
||||
|
||||
; Copper
|
||||
&uword COP1LCH = $dff080 ; copper 1 list pointer (high)
|
||||
&uword COP1LCL = $dff082 ; copper 1 list pointer (low)
|
||||
&pointer COP1LC = $dff080 ; copper 1 list pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword COP2LCH = $dff084 ; copper 2 list pointer (high)
|
||||
&uword COP2LCL = $dff086 ; copper 2 list pointer (low)
|
||||
&pointer COP2LC = $dff084 ; copper 2 list pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword COPJMP1 = $dff088 ; copper jump strobe 1
|
||||
&uword COPJMP2 = $dff08a ; copper jump strobe 2
|
||||
&uword COPINS = $dff08c ; copper instruction fetch
|
||||
|
||||
; Display window / data fetch
|
||||
&uword DIWSTRT = $dff08e ; display window start
|
||||
&uword DIWSTOP = $dff090 ; display window stop
|
||||
&uword DDFSTRT = $dff092 ; data fetch start
|
||||
&uword DDFSTOP = $dff094 ; data fetch stop
|
||||
|
||||
; Control registers
|
||||
&uword DMACON = $dff096 ; DMA control write
|
||||
&uword CLXCON = $dff098 ; collision control
|
||||
&uword INTENA = $dff09a ; interrupt enable
|
||||
&uword INTREQ = $dff09c ; interrupt request
|
||||
&uword ADKCON = $dff09e ; audio/disk control
|
||||
|
||||
; ========== Audio channels ==========
|
||||
|
||||
&uword AUD0PTH = $dff0a0 ; audio 0 pointer (high)
|
||||
&uword AUD0PTL = $dff0a2 ; audio 0 pointer (low)
|
||||
&pointer AUD0PT = $dff0a0 ; audio 0 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword AUD0LEN = $dff0a4 ; audio 0 length
|
||||
&uword AUD0PER = $dff0a6 ; audio 0 period
|
||||
&uword AUD0VOL = $dff0a8 ; audio 0 volume
|
||||
&uword AUD0DAT = $dff0aa ; audio 0 sample data
|
||||
|
||||
&uword AUD1PTH = $dff0b0 ; audio 1 pointer (high)
|
||||
&uword AUD1PTL = $dff0b2 ; audio 1 pointer (low)
|
||||
&pointer AUD1PT = $dff0b0 ; audio 1 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword AUD1LEN = $dff0b4 ; audio 1 length
|
||||
&uword AUD1PER = $dff0b6 ; audio 1 period
|
||||
&uword AUD1VOL = $dff0b8 ; audio 1 volume
|
||||
&uword AUD1DAT = $dff0ba ; audio 1 sample data
|
||||
|
||||
&uword AUD2PTH = $dff0c0 ; audio 2 pointer (high)
|
||||
&uword AUD2PTL = $dff0c2 ; audio 2 pointer (low)
|
||||
&pointer AUD2PT = $dff0c0 ; audio 2 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword AUD2LEN = $dff0c4 ; audio 2 length
|
||||
&uword AUD2PER = $dff0c6 ; audio 2 period
|
||||
&uword AUD2VOL = $dff0c8 ; audio 2 volume
|
||||
&uword AUD2DAT = $dff0ca ; audio 2 sample data
|
||||
|
||||
&uword AUD3PTH = $dff0d0 ; audio 3 pointer (high)
|
||||
&uword AUD3PTL = $dff0d2 ; audio 3 pointer (low)
|
||||
&pointer AUD3PT = $dff0d0 ; audio 3 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword AUD3LEN = $dff0d4 ; audio 3 length
|
||||
&uword AUD3PER = $dff0d6 ; audio 3 period
|
||||
&uword AUD3VOL = $dff0d8 ; audio 3 volume
|
||||
&uword AUD3DAT = $dff0da ; audio 3 sample data
|
||||
|
||||
; ========== Bitplane pointers ==========
|
||||
|
||||
&uword BPL1PTH = $dff0e0 ; bitplane 1 pointer (high)
|
||||
&uword BPL1PTL = $dff0e2 ; bitplane 1 pointer (low)
|
||||
&pointer BPL1PT = $dff0e0 ; bitplane 1 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword BPL2PTH = $dff0e4 ; bitplane 2 pointer (high)
|
||||
&uword BPL2PTL = $dff0e6 ; bitplane 2 pointer (low)
|
||||
&pointer BPL2PT = $dff0e4 ; bitplane 2 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword BPL3PTH = $dff0e8 ; bitplane 3 pointer (high)
|
||||
&uword BPL3PTL = $dff0ea ; bitplane 3 pointer (low)
|
||||
&pointer BPL3PT = $dff0e8 ; bitplane 3 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword BPL4PTH = $dff0ec ; bitplane 4 pointer (high)
|
||||
&uword BPL4PTL = $dff0ee ; bitplane 4 pointer (low)
|
||||
&pointer BPL4PT = $dff0ec ; bitplane 4 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword BPL5PTH = $dff0f0 ; bitplane 5 pointer (high)
|
||||
&uword BPL5PTL = $dff0f2 ; bitplane 5 pointer (low)
|
||||
&pointer BPL5PT = $dff0f0 ; bitplane 5 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword BPL6PTH = $dff0f4 ; bitplane 6 pointer (high)
|
||||
&uword BPL6PTL = $dff0f6 ; bitplane 6 pointer (low)
|
||||
&pointer BPL6PT = $dff0f4 ; bitplane 6 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword BPL7PTH = $dff0f8 ; bitplane 7 pointer (high)
|
||||
&uword BPL7PTL = $dff0fa ; bitplane 7 pointer (low)
|
||||
&pointer BPL7PT = $dff0f8 ; bitplane 7 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword BPL8PTH = $dff0fc ; bitplane 8 pointer (high)
|
||||
&uword BPL8PTL = $dff0fe ; bitplane 8 pointer (low)
|
||||
&pointer BPL8PT = $dff0fc ; bitplane 8 pointer (full 32-bit, hi/lo auto-increment)
|
||||
|
||||
; ========== Bitplane control ==========
|
||||
|
||||
&uword BPLCON0 = $dff100 ; bitplane control 0
|
||||
&uword BPLCON1 = $dff102 ; bitplane control 1 (scroll)
|
||||
&uword BPLCON2 = $dff104 ; bitplane control 2 (priority)
|
||||
&uword BPLCON3 = $dff106 ; bitplane control 3 (AGA)
|
||||
&uword BPL1MOD = $dff108 ; bitplane modulo (odd planes)
|
||||
&uword BPL2MOD = $dff10a ; bitplane modulo (even planes)
|
||||
&uword BPLCON4 = $dff10c ; bitplane control 4 (AGA)
|
||||
|
||||
&uword BPL1DAT = $dff110 ; bitplane 1 data
|
||||
&uword BPL2DAT = $dff112 ; bitplane 2 data
|
||||
&uword BPL3DAT = $dff114 ; bitplane 3 data
|
||||
&uword BPL4DAT = $dff116 ; bitplane 4 data
|
||||
&uword BPL5DAT = $dff118 ; bitplane 5 data
|
||||
&uword BPL6DAT = $dff11a ; bitplane 6 data
|
||||
&uword BPL7DAT = $dff11c ; bitplane 7 data
|
||||
&uword BPL8DAT = $dff11e ; bitplane 8 data
|
||||
|
||||
; ========== Sprite pointers ==========
|
||||
|
||||
&uword SPR0PTH = $dff120 ; sprite 0 pointer (high)
|
||||
&uword SPR0PTL = $dff122 ; sprite 0 pointer (low)
|
||||
&pointer SPR0PT = $dff120 ; sprite 0 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword SPR1PTH = $dff124 ; sprite 1 pointer (high)
|
||||
&uword SPR1PTL = $dff126 ; sprite 1 pointer (low)
|
||||
&pointer SPR1PT = $dff124 ; sprite 1 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword SPR2PTH = $dff128 ; sprite 2 pointer (high)
|
||||
&uword SPR2PTL = $dff12a ; sprite 2 pointer (low)
|
||||
&pointer SPR2PT = $dff128 ; sprite 2 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword SPR3PTH = $dff12c ; sprite 3 pointer (high)
|
||||
&uword SPR3PTL = $dff12e ; sprite 3 pointer (low)
|
||||
&pointer SPR3PT = $dff12c ; sprite 3 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword SPR4PTH = $dff130 ; sprite 4 pointer (high)
|
||||
&uword SPR4PTL = $dff132 ; sprite 4 pointer (low)
|
||||
&pointer SPR4PT = $dff130 ; sprite 4 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword SPR5PTH = $dff134 ; sprite 5 pointer (high)
|
||||
&uword SPR5PTL = $dff136 ; sprite 5 pointer (low)
|
||||
&pointer SPR5PT = $dff134 ; sprite 5 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword SPR6PTH = $dff138 ; sprite 6 pointer (high)
|
||||
&uword SPR6PTL = $dff13a ; sprite 6 pointer (low)
|
||||
&pointer SPR6PT = $dff138 ; sprite 6 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword SPR7PTH = $dff13c ; sprite 7 pointer (high)
|
||||
&uword SPR7PTL = $dff13e ; sprite 7 pointer (low)
|
||||
&pointer SPR7PT = $dff13c ; sprite 7 pointer (full 32-bit, hi/lo auto-increment)
|
||||
|
||||
; ========== Sprite data ==========
|
||||
|
||||
&uword SPR0POS = $dff140 ; sprite 0 position
|
||||
&uword SPR0CTL = $dff142 ; sprite 0 control
|
||||
&uword SPR0DATA = $dff144 ; sprite 0 data A
|
||||
&uword SPR0DATB = $dff146 ; sprite 0 data B
|
||||
&uword SPR1POS = $dff148 ; sprite 1 position
|
||||
&uword SPR1CTL = $dff14a ; sprite 1 control
|
||||
&uword SPR1DATA = $dff14c ; sprite 1 data A
|
||||
&uword SPR1DATB = $dff14e ; sprite 1 data B
|
||||
&uword SPR2POS = $dff150 ; sprite 2 position
|
||||
&uword SPR2CTL = $dff152 ; sprite 2 control
|
||||
&uword SPR2DATA = $dff154 ; sprite 2 data A
|
||||
&uword SPR2DATB = $dff156 ; sprite 2 data B
|
||||
&uword SPR3POS = $dff158 ; sprite 3 position
|
||||
&uword SPR3CTL = $dff15a ; sprite 3 control
|
||||
&uword SPR3DATA = $dff15c ; sprite 3 data A
|
||||
&uword SPR3DATB = $dff15e ; sprite 3 data B
|
||||
&uword SPR4POS = $dff160 ; sprite 4 position
|
||||
&uword SPR4CTL = $dff162 ; sprite 4 control
|
||||
&uword SPR4DATA = $dff164 ; sprite 4 data A
|
||||
&uword SPR4DATB = $dff166 ; sprite 4 data B
|
||||
&uword SPR5POS = $dff168 ; sprite 5 position
|
||||
&uword SPR5CTL = $dff16a ; sprite 5 control
|
||||
&uword SPR5DATA = $dff16c ; sprite 5 data A
|
||||
&uword SPR5DATB = $dff16e ; sprite 5 data B
|
||||
&uword SPR6POS = $dff170 ; sprite 6 position
|
||||
&uword SPR6CTL = $dff172 ; sprite 6 control
|
||||
&uword SPR6DATA = $dff174 ; sprite 6 data A
|
||||
&uword SPR6DATB = $dff176 ; sprite 6 data B
|
||||
&uword SPR7POS = $dff178 ; sprite 7 position
|
||||
&uword SPR7CTL = $dff17a ; sprite 7 control
|
||||
&uword SPR7DATA = $dff17c ; sprite 7 data A
|
||||
&uword SPR7DATB = $dff17e ; sprite 7 data B
|
||||
|
||||
; ========== Color palette ==========
|
||||
|
||||
&uword COLOR00 = $dff180 ; color 0 (background)
|
||||
&uword COLOR01 = $dff182
|
||||
&uword COLOR02 = $dff184
|
||||
&uword COLOR03 = $dff186
|
||||
&uword COLOR04 = $dff188
|
||||
&uword COLOR05 = $dff18a
|
||||
&uword COLOR06 = $dff18c
|
||||
&uword COLOR07 = $dff18e
|
||||
&uword COLOR08 = $dff190
|
||||
&uword COLOR09 = $dff192
|
||||
&uword COLOR10 = $dff194
|
||||
&uword COLOR11 = $dff196
|
||||
&uword COLOR12 = $dff198
|
||||
&uword COLOR13 = $dff19a
|
||||
&uword COLOR14 = $dff19c
|
||||
&uword COLOR15 = $dff19e
|
||||
&uword COLOR16 = $dff1a0
|
||||
&uword COLOR17 = $dff1a2
|
||||
&uword COLOR18 = $dff1a4
|
||||
&uword COLOR19 = $dff1a6
|
||||
&uword COLOR20 = $dff1a8
|
||||
&uword COLOR21 = $dff1aa
|
||||
&uword COLOR22 = $dff1ac
|
||||
&uword COLOR23 = $dff1ae
|
||||
&uword COLOR24 = $dff1b0
|
||||
&uword COLOR25 = $dff1b2
|
||||
&uword COLOR26 = $dff1b4
|
||||
&uword COLOR27 = $dff1b6
|
||||
&uword COLOR28 = $dff1b8
|
||||
&uword COLOR29 = $dff1ba
|
||||
&uword COLOR30 = $dff1bc
|
||||
&uword COLOR31 = $dff1be
|
||||
|
||||
; ========== ECS/AGA extended registers ==========
|
||||
|
||||
&uword HTOTAL = $dff1c0 ; H total (ECS)
|
||||
&uword HSSTOP = $dff1c2 ; H sync stop (ECS)
|
||||
&uword HBSTRT = $dff1c4 ; H blank start (ECS)
|
||||
&uword HBSTOP = $dff1c6 ; H blank stop (ECS)
|
||||
&uword VTOTAL = $dff1c8 ; V total (ECS)
|
||||
&uword VSSTOP = $dff1ca ; V sync stop (ECS)
|
||||
&uword VBSTRT = $dff1cc ; V blank start (ECS)
|
||||
&uword VBSTOP = $dff1ce ; V blank stop (ECS)
|
||||
&uword SPRHSTRT = $dff1d0 ; sprite horizontal start (AGA)
|
||||
&uword SPRHSTOP = $dff1d2 ; sprite horizontal stop (AGA)
|
||||
&uword BPLHSTRT = $dff1d4 ; bitplane horizontal start (AGA)
|
||||
&uword BPLHSTOP = $dff1d6 ; bitplane horizontal stop (AGA)
|
||||
&uword HHPOSW = $dff1d8 ; horizontal hardware position write (AGA)
|
||||
&uword HHPOSR = $dff1da ; horizontal hardware position read (AGA)
|
||||
&uword BEAMCON0 = $dff1dc ; beam counter control (ECS)
|
||||
&uword HSSTRT = $dff1de ; H sync start (ECS)
|
||||
&uword VSSTRT = $dff1e0 ; V sync start (ECS)
|
||||
&uword DIWHIGH = $dff1e4 ; display window high bits (ECS)
|
||||
&uword FMODE = $dff1fc ; fetch mode (AGA)
|
||||
|
||||
; ========== Blitter minterm constants ==========
|
||||
|
||||
const uword ABC = $80 ; A and B and C
|
||||
const uword ABNC = $40 ; A and B and not C
|
||||
const uword ANBC = $20 ; A and not B and C
|
||||
const uword ANBNC = $10 ; A and not B and not C
|
||||
const uword NABC = $8 ; not A and B and C
|
||||
const uword NABNC = $4 ; not A and not B and C
|
||||
const uword NANBC = $2 ; not A and B and not C
|
||||
const uword NANBNC = $1 ; not A and not B and not C
|
||||
|
||||
; Common blitter minterms
|
||||
const uword MINTERM_COPY = ABC | ABNC | ANBC | NABC ; A (straight copy)
|
||||
const uword MINTERM_OR = ABC | ABNC | ANBC | NABC | ANBNC | NANBC ; A or B
|
||||
const uword MINTERM_AND = ABC ; A and B
|
||||
const uword MINTERM_XOR = ANBC | NABC ; A xor B
|
||||
const uword MINTERM_NOT = ANBNC | NANBNC ; not A
|
||||
const uword MINTERM_CLEAR = 0 ; clear all
|
||||
const uword MINTERM_NOP = ABNC | ANBNC ; no operation
|
||||
|
||||
; ========== DMA control bits (dmacon) ==========
|
||||
|
||||
const uword DMAF_SETCLR = $8000
|
||||
const uword DMAF_AUD0 = $0001
|
||||
const uword DMAF_AUD1 = $0002
|
||||
const uword DMAF_AUD2 = $0004
|
||||
const uword DMAF_AUD3 = $0008
|
||||
const uword DMAF_AUDIO = $000f
|
||||
const uword DMAF_DISK = $0010
|
||||
const uword DMAF_SPRITE = $0020
|
||||
const uword DMAF_BLITTER = $0040
|
||||
const uword DMAF_COPPER = $0080
|
||||
const uword DMAF_RASTER = $0100
|
||||
const uword DMAF_MASTER = $0200
|
||||
const uword DMAF_BLITHOG = $0400
|
||||
const uword DMAF_ALL = $01ff
|
||||
|
||||
; DMA status read bits
|
||||
const uword DMAF_BLTDONE = $4000
|
||||
const uword DMAF_BLTNZERO = $2000
|
||||
|
||||
; ========== Interrupt bits (intena/intreq) ==========
|
||||
|
||||
const uword INTF_SETCLR = $8000
|
||||
const uword INTF_INTEN = $4000
|
||||
const uword INTF_EXTER = $2000
|
||||
const uword INTF_DSKSYNC = $1000
|
||||
const uword INTF_RBF = $0800
|
||||
const uword INTF_AUD3 = $0400
|
||||
const uword INTF_AUD2 = $0200
|
||||
const uword INTF_AUD1 = $0100
|
||||
const uword INTF_AUD0 = $0080
|
||||
const uword INTF_BLIT = $0040
|
||||
const uword INTF_VERTB = $0020
|
||||
const uword INTF_COPER = $0010
|
||||
const uword INTF_PORTS = $0008
|
||||
const uword INTF_SOFTINT = $0004
|
||||
const uword INTF_DSKBLK = $0002
|
||||
const uword INTF_TBE = $0001
|
||||
|
||||
; ========== ADK control bits (adkcon) ==========
|
||||
|
||||
const uword ADKF_SETCLR = $8000
|
||||
const uword ADKF_PRECOMP1 = $4000
|
||||
const uword ADKF_PRECOMP0 = $2000
|
||||
const uword ADKF_MFMPREC = $1000
|
||||
const uword ADKF_UARTBRK = $0800
|
||||
const uword ADKF_WORDSYNC = $0400
|
||||
const uword ADKF_MSBSYNC = $0200
|
||||
const uword ADKF_FAST = $0100
|
||||
const uword ADKF_USE3PN = $0080
|
||||
const uword ADKF_USE2P3 = $0040
|
||||
const uword ADKF_USE1P2 = $0020
|
||||
const uword ADKF_USE0P1 = $0010
|
||||
const uword ADKF_USE3VN = $0008
|
||||
const uword ADKF_USE2V3 = $0004
|
||||
const uword ADKF_USE1V2 = $0002
|
||||
const uword ADKF_USE0V1 = $0001
|
||||
|
||||
; ========== Blitter control bits (bltcon0) ==========
|
||||
|
||||
const uword BC0F_DEST = $0100
|
||||
const uword BC0F_SRCC = $0200
|
||||
const uword BC0F_SRCB = $0400
|
||||
const uword BC0F_SRCA = $0800
|
||||
|
||||
; ========== Blitter control bits (bltcon1) ==========
|
||||
|
||||
const uword BC1F_DESC = $0002
|
||||
const uword BC1F_LINEMODE = $0001
|
||||
const uword BC1F_FILL_OR = $0008
|
||||
const uword BC1F_FILL_XOR = $0010
|
||||
const uword BC1F_FILL_CARRYIN = $0004
|
||||
const uword BC1F_ONEDOT = $0002
|
||||
const uword BC1F_OVFLAG = $0020
|
||||
const uword BC1F_SIGNFLAG = $0040
|
||||
const uword BC1F_SUD = $0010
|
||||
const uword BC1F_SUL = $0008
|
||||
const uword BC1F_AUL = $0004
|
||||
|
||||
; ========== CIA registers ==========
|
||||
|
||||
; CIA-A at $bfe001 (odd, accessed on D8-D15)
|
||||
; CIA-B at $bfd000 (even, accessed on D0-D7)
|
||||
; Each CIA register is spaced $100 apart
|
||||
|
||||
&ubyte CIAA_PRA = $bfe001 ; CIA-A peripheral A (serial data, floppy, keyboard)
|
||||
&ubyte CIAA_PRB = $bfe101 ; CIA-A peripheral B (parallel port)
|
||||
&ubyte CIAA_DDRA = $bfe201 ; CIA-A data direction A
|
||||
&ubyte CIAA_DDRB = $bfe301 ; CIA-A data direction B
|
||||
&ubyte CIAA_TALO = $bfe401 ; CIA-A timer A low
|
||||
&ubyte CIAA_TAHI = $bfe501 ; CIA-A timer A high
|
||||
&ubyte CIAA_TBLO = $bfe601 ; CIA-A timer B low
|
||||
&ubyte CIAA_TBHI = $bfe701 ; CIA-A timer B high
|
||||
&ubyte CIAA_TODLOW = $bfe801 ; CIA-A TOD low
|
||||
&ubyte CIAA_TODMID = $bfe901 ; CIA-A TOD mid
|
||||
&ubyte CIAA_TODHI = $bfea01 ; CIA-A TOD high
|
||||
&ubyte CIAA_SDR = $bfec01 ; CIA-A serial data
|
||||
&ubyte CIAA_ICR = $bfed01 ; CIA-A interrupt control
|
||||
&ubyte CIAA_CRA = $bfee01 ; CIA-A control A
|
||||
&ubyte CIAA_CRB = $bfef01 ; CIA-A control B
|
||||
|
||||
&ubyte CIAB_PRA = $bfd000 ; CIA-B peripheral A (RS-232)
|
||||
&ubyte CIAB_PRB = $bfd100 ; CIA-B peripheral B (printer)
|
||||
&ubyte CIAB_DDRA = $bfd200 ; CIA-B data direction A
|
||||
&ubyte CIAB_DDRB = $bfd300 ; CIA-B data direction B
|
||||
&ubyte CIAB_TALO = $bfd400 ; CIA-B timer A low
|
||||
&ubyte CIAB_TAHI = $bfd500 ; CIA-B timer A high
|
||||
&ubyte CIAB_TBLO = $bfd600 ; CIA-B timer B low
|
||||
&ubyte CIAB_TBHI = $bfd700 ; CIA-B timer B high
|
||||
&ubyte CIAB_TODLOW = $bfd800 ; CIA-B TOD low
|
||||
&ubyte CIAB_TODMID = $bfd900 ; CIA-B TOD mid
|
||||
&ubyte CIAB_TODHI = $bfda00 ; CIA-B TOD high
|
||||
&ubyte CIAB_SDR = $bfdc00 ; CIA-B serial data
|
||||
&ubyte CIAB_ICR = $bfdd00 ; CIA-B interrupt control
|
||||
&ubyte CIAB_CRA = $bfde00 ; CIA-B control A
|
||||
&ubyte CIAB_CRB = $bfdf00 ; CIA-B control B
|
||||
}
|
||||
@@ -1,868 +1,5 @@
|
||||
;; Auto-generated from dos_lib.sfd and dos_lib.i
|
||||
;; Library base: _DOSBase in prog8: sys.DOSBase
|
||||
;; Bank: 2
|
||||
;; Functions: 161
|
||||
|
||||
%import exec
|
||||
%import utility
|
||||
%import shared_amiga_dos
|
||||
|
||||
dos {
|
||||
%option no_symbol_prefixing
|
||||
extsub @bank 2 -30 = Open(str name @D1, long accessMode @D2) -> pointer @D0
|
||||
extsub @bank 2 -36 = Close(pointer file @D1) -> long @D0
|
||||
extsub @bank 2 -42 = Read(pointer file @D1, pointer buffer @D2, long length @D3) -> long @D0
|
||||
extsub @bank 2 -48 = Write(pointer file @D1, pointer buffer @D2, long length @D3) -> long @D0
|
||||
extsub @bank 2 -54 = Input() -> pointer @D0
|
||||
extsub @bank 2 -60 = Output() -> pointer @D0
|
||||
extsub @bank 2 -66 = Seek(pointer file @D1, long position @D2, long offset @D3) -> long @D0
|
||||
extsub @bank 2 -72 = DeleteFile(str name @D1) -> long @D0
|
||||
extsub @bank 2 -78 = Rename(str oldName @D1, str newName @D2) -> long @D0
|
||||
extsub @bank 2 -84 = Lock(str name @D1, long k_type @D2) -> pointer @D0
|
||||
extsub @bank 2 -90 = UnLock(pointer lock @D1)
|
||||
extsub @bank 2 -96 = DupLock(pointer lock @D1) -> pointer @D0
|
||||
extsub @bank 2 -102 = Examine(pointer lock @D1, ^^FileInfoBlock fileInfoBlock @D2) -> long @D0
|
||||
extsub @bank 2 -108 = ExNext(pointer lock @D1, ^^FileInfoBlock fileInfoBlock @D2) -> long @D0
|
||||
extsub @bank 2 -114 = Info(pointer lock @D1, ^^InfoData parameterBlock @D2) -> long @D0
|
||||
extsub @bank 2 -120 = CreateDir(str name @D1) -> pointer @D0
|
||||
extsub @bank 2 -126 = CurrentDir(pointer lock @D1) -> pointer @D0
|
||||
extsub @bank 2 -132 = IoErr() -> long @D0
|
||||
extsub @bank 2 -138 = CreateProc(str name @D1, long pri @D2, pointer segList @D3, long stackSize @D4) -> ^^exec.MsgPort @D0
|
||||
extsub @bank 2 -144 = Exit(long returnCode @D1)
|
||||
extsub @bank 2 -150 = LoadSeg(str name @D1) -> pointer @D0
|
||||
extsub @bank 2 -156 = UnLoadSeg(pointer seglist @D1)
|
||||
extsub @bank 2 -174 = DeviceProc(str name @D1) -> ^^exec.MsgPort @D0
|
||||
extsub @bank 2 -180 = SetComment(str name @D1, str comment @D2) -> long @D0
|
||||
extsub @bank 2 -186 = SetProtection(str name @D1, long protect @D2) -> long @D0
|
||||
extsub @bank 2 -192 = DateStamp(^^DateStampStruct date @D1) -> ^^DateStampStruct @D0
|
||||
extsub @bank 2 -198 = Delay(long timeout @D1)
|
||||
extsub @bank 2 -204 = WaitForChar(pointer file @D1, long timeout @D2) -> long @D0
|
||||
extsub @bank 2 -210 = ParentDir(pointer lock @D1) -> pointer @D0
|
||||
extsub @bank 2 -216 = IsInteractive(pointer file @D1) -> long @D0
|
||||
extsub @bank 2 -222 = Execute(str string @D1, pointer file @D2, pointer file2 @D3) -> long @D0
|
||||
extsub @bank 2 -228 = AllocDosObject(long k_type @D1, pointer tags @D2) -> pointer @D0
|
||||
extsub @bank 2 -234 = FreeDosObject(long k_type @D1, pointer ptr @D2)
|
||||
extsub @bank 2 -240 = DoPkt(^^exec.MsgPort port @D1, long action @D2, long arg1 @D3, long arg2 @D4, long arg3 @D5, long arg4 @D6, long arg5 @D7) -> long @D0
|
||||
extsub @bank 2 -246 = SendPkt(^^DosPacket dp @D1, ^^exec.MsgPort port @D2, ^^exec.MsgPort replyport @D3)
|
||||
extsub @bank 2 -252 = WaitPkt() -> ^^DosPacket @D0
|
||||
extsub @bank 2 -258 = ReplyPkt(^^DosPacket dp @D1, long res1 @D2, long res2 @D3)
|
||||
extsub @bank 2 -264 = AbortPkt(^^exec.MsgPort port @D1, ^^DosPacket pkt @D2)
|
||||
extsub @bank 2 -270 = LockRecord(pointer fh @D1, long offset @D2, long length @D3, long mode @D4, long timeout @D5) -> bool @D0
|
||||
extsub @bank 2 -276 = LockRecords(pointer recArray @D1, long timeout @D2) -> bool @D0
|
||||
extsub @bank 2 -282 = UnLockRecord(pointer fh @D1, long offset @D2, long length @D3) -> bool @D0
|
||||
extsub @bank 2 -288 = UnLockRecords(pointer recArray @D1) -> bool @D0
|
||||
extsub @bank 2 -294 = SelectInput(pointer fh @D1) -> pointer @D0
|
||||
extsub @bank 2 -300 = SelectOutput(pointer fh @D1) -> pointer @D0
|
||||
extsub @bank 2 -306 = FGetC(pointer fh @D1) -> long @D0
|
||||
extsub @bank 2 -312 = FPutC(pointer fh @D1, long ch @D2) -> long @D0
|
||||
extsub @bank 2 -318 = UnGetC(pointer fh @D1, long character @D2) -> long @D0
|
||||
extsub @bank 2 -324 = FRead(pointer fh @D1, pointer block @D2, long blocklen @D3, long number @D4) -> long @D0
|
||||
extsub @bank 2 -330 = FWrite(pointer fh @D1, pointer block @D2, long blocklen @D3, long number @D4) -> long @D0
|
||||
extsub @bank 2 -336 = FGets(pointer fh @D1, str buf @D2, long buflen @D3) -> str @D0
|
||||
extsub @bank 2 -342 = FPuts(pointer fh @D1, str k_str @D2) -> long @D0
|
||||
extsub @bank 2 -348 = VFWritef(pointer fh @D1, str format @D2, pointer argarray @D3)
|
||||
extsub @bank 2 -354 = VFPrintf(pointer fh @D1, str format @D2, pointer argarray @D3) -> long @D0
|
||||
extsub @bank 2 -360 = Flush(pointer fh @D1) -> long @D0
|
||||
extsub @bank 2 -366 = SetVBuf(pointer fh @D1, str buff @D2, long k_type @D3, long size @D4) -> long @D0
|
||||
extsub @bank 2 -372 = DupLockFromFH(pointer fh @D1) -> pointer @D0
|
||||
extsub @bank 2 -378 = OpenFromLock(pointer lock @D1) -> pointer @D0
|
||||
extsub @bank 2 -384 = ParentOfFH(pointer fh @D1) -> pointer @D0
|
||||
extsub @bank 2 -390 = ExamineFH(pointer fh @D1, ^^FileInfoBlock fib @D2) -> bool @D0
|
||||
extsub @bank 2 -396 = SetFileDate(str name @D1, ^^DateStampStruct date @D2) -> long @D0
|
||||
extsub @bank 2 -402 = NameFromLock(pointer lock @D1, str buffer @D2, long len @D3) -> long @D0
|
||||
extsub @bank 2 -408 = NameFromFH(pointer fh @D1, str buffer @D2, long len @D3) -> long @D0
|
||||
extsub @bank 2 -414 = SplitName(str name @D1, ubyte separator @D2, str buf @D3, word oldpos @D4, long size @D5) -> word @D0
|
||||
extsub @bank 2 -420 = SameLock(pointer lock1 @D1, pointer lock2 @D2) -> long @D0
|
||||
extsub @bank 2 -426 = SetMode(pointer fh @D1, long mode @D2) -> long @D0
|
||||
extsub @bank 2 -432 = ExAll(pointer lock @D1, ^^ExAllData buffer @D2, long size @D3, long data @D4, ^^ExAllControl control @D5) -> long @D0
|
||||
extsub @bank 2 -438 = ReadLink(^^exec.MsgPort port @D1, pointer lock @D2, str path @D3, str buffer @D4, long size @D5) -> long @D0
|
||||
extsub @bank 2 -444 = MakeLink(str name @D1, long dest @D2, long soft @D3) -> long @D0
|
||||
extsub @bank 2 -450 = ChangeMode(long k_type @D1, pointer fh @D2, long newmode @D3) -> long @D0
|
||||
extsub @bank 2 -456 = SetFileSize(pointer fh @D1, long pos @D2, long mode @D3) -> long @D0
|
||||
extsub @bank 2 -462 = SetIoErr(long result @D1) -> long @D0
|
||||
extsub @bank 2 -468 = Fault(long code @D1, str header @D2, str buffer @D3, long len @D4) -> bool @D0
|
||||
extsub @bank 2 -474 = PrintFault(long code @D1, str header @D2) -> bool @D0
|
||||
extsub @bank 2 -480 = ErrorReport(long code @D1, long k_type @D2, long arg1 @D3, ^^exec.MsgPort device @D4) -> long @D0
|
||||
extsub @bank 2 -492 = Cli() -> pointer @D0
|
||||
extsub @bank 2 -498 = CreateNewProc(pointer tags @D1) -> ^^Process @D0
|
||||
extsub @bank 2 -504 = RunCommand(pointer seg @D1, long stack @D2, str paramptr @D3, long paramlen @D4) -> long @D0
|
||||
extsub @bank 2 -510 = GetConsoleTask() -> ^^exec.MsgPort @D0
|
||||
extsub @bank 2 -516 = SetConsoleTask(^^exec.MsgPort task @D1) -> ^^exec.MsgPort @D0
|
||||
extsub @bank 2 -522 = GetFileSysTask() -> ^^exec.MsgPort @D0
|
||||
extsub @bank 2 -528 = SetFileSysTask(^^exec.MsgPort task @D1) -> ^^exec.MsgPort @D0
|
||||
extsub @bank 2 -534 = GetArgStr() -> str @D0
|
||||
extsub @bank 2 -540 = SetArgStr(str string @D1) -> str @D0
|
||||
extsub @bank 2 -546 = FindCliProc(long num @D1) -> ^^Process @D0
|
||||
extsub @bank 2 -552 = MaxCli() -> long @D0
|
||||
extsub @bank 2 -558 = SetCurrentDirName(str name @D1) -> bool @D0
|
||||
extsub @bank 2 -564 = GetCurrentDirName(str buf @D1, long len @D2) -> bool @D0
|
||||
extsub @bank 2 -570 = SetProgramName(str name @D1) -> bool @D0
|
||||
extsub @bank 2 -576 = GetProgramName(str buf @D1, long len @D2) -> bool @D0
|
||||
extsub @bank 2 -582 = SetPrompt(str name @D1) -> bool @D0
|
||||
extsub @bank 2 -588 = GetPrompt(str buf @D1, long len @D2) -> bool @D0
|
||||
extsub @bank 2 -594 = SetProgramDir(pointer lock @D1) -> pointer @D0
|
||||
extsub @bank 2 -600 = GetProgramDir() -> pointer @D0
|
||||
extsub @bank 2 -606 = SystemTagList(str command @D1, pointer tags @D2) -> long @D0
|
||||
extsub @bank 2 -612 = AssignLock(str name @D1, pointer lock @D2) -> long @D0
|
||||
extsub @bank 2 -618 = AssignLate(str name @D1, str path @D2) -> bool @D0
|
||||
extsub @bank 2 -624 = AssignPath(str name @D1, str path @D2) -> bool @D0
|
||||
extsub @bank 2 -630 = AssignAdd(str name @D1, pointer lock @D2) -> bool @D0
|
||||
extsub @bank 2 -636 = RemAssignList(str name @D1, pointer lock @D2) -> long @D0
|
||||
extsub @bank 2 -642 = GetDeviceProc(str name @D1, pointer dp @D2) -> pointer @D0
|
||||
extsub @bank 2 -648 = FreeDeviceProc(pointer dp @D1)
|
||||
extsub @bank 2 -654 = LockDosList(long flags @D1) -> pointer @D0
|
||||
extsub @bank 2 -660 = UnLockDosList(long flags @D1)
|
||||
extsub @bank 2 -666 = AttemptLockDosList(long flags @D1) -> pointer @D0
|
||||
extsub @bank 2 -672 = RemDosEntry(pointer dlist @D1) -> bool @D0
|
||||
extsub @bank 2 -678 = AddDosEntry(pointer dlist @D1) -> long @D0
|
||||
extsub @bank 2 -684 = FindDosEntry(pointer dlist @D1, str name @D2, long flags @D3) -> pointer @D0
|
||||
extsub @bank 2 -690 = NextDosEntry(pointer dlist @D1, long flags @D2) -> pointer @D0
|
||||
extsub @bank 2 -696 = MakeDosEntry(str name @D1, long k_type @D2) -> pointer @D0
|
||||
extsub @bank 2 -702 = FreeDosEntry(pointer dlist @D1)
|
||||
extsub @bank 2 -708 = IsFileSystem(str name @D1) -> bool @D0
|
||||
extsub @bank 2 -714 = Format(str filesystem @D1, str volumename @D2, long dostype @D3) -> bool @D0
|
||||
extsub @bank 2 -720 = Relabel(str drive @D1, str newname @D2) -> long @D0
|
||||
extsub @bank 2 -726 = Inhibit(str name @D1, long onoff @D2) -> long @D0
|
||||
extsub @bank 2 -732 = AddBuffers(str name @D1, long number @D2) -> long @D0
|
||||
extsub @bank 2 -738 = CompareDates(^^DateStampStruct date1 @D1, ^^DateStampStruct date2 @D2) -> long @D0
|
||||
extsub @bank 2 -744 = DateToStr(pointer datetime @D1) -> long @D0
|
||||
extsub @bank 2 -750 = StrToDate(pointer datetime @D1) -> long @D0
|
||||
extsub @bank 2 -756 = InternalLoadSeg(pointer fh @D0, pointer table @A0, pointer funcarray @A1, pointer stack @A2) -> pointer @D0
|
||||
extsub @bank 2 -762 = InternalUnLoadSeg(pointer seglist @D1, pointer freefunc @A1) -> bool @D0
|
||||
extsub @bank 2 -768 = NewLoadSeg(str file @D1, pointer tags @D2) -> pointer @D0
|
||||
extsub @bank 2 -774 = AddSegment(str name @D1, pointer seg @D2, long system @D3) -> long @D0
|
||||
extsub @bank 2 -780 = FindSegment(str name @D1, pointer seg @D2, long system @D3) -> pointer @D0
|
||||
extsub @bank 2 -786 = RemSegment(pointer seg @D1) -> long @D0
|
||||
extsub @bank 2 -792 = CheckSignal(long mask @D1) -> long @D0
|
||||
extsub @bank 2 -798 = ReadArgs(str arg_template @D1, pointer array @D2, pointer args @D3) -> pointer @D0
|
||||
extsub @bank 2 -804 = FindArg(str keyword @D1, str arg_template @D2) -> long @D0
|
||||
extsub @bank 2 -810 = ReadItem(str name @D1, long maxchars @D2, pointer cSource @D3) -> long @D0
|
||||
extsub @bank 2 -816 = StrToLong(str string @D1, pointer value @D2) -> long @D0
|
||||
extsub @bank 2 -822 = MatchFirst(str pat @D1, pointer anchor @D2) -> long @D0
|
||||
extsub @bank 2 -828 = MatchNext(pointer anchor @D1) -> long @D0
|
||||
extsub @bank 2 -834 = MatchEnd(pointer anchor @D1)
|
||||
extsub @bank 2 -840 = ParsePattern(str pat @D1, pointer patbuf @D2, long patbuflen @D3) -> long @D0
|
||||
extsub @bank 2 -846 = MatchPattern(pointer patbuf @D1, str k_str @D2) -> bool @D0
|
||||
extsub @bank 2 -858 = FreeArgs(pointer args @D1)
|
||||
extsub @bank 2 -870 = FilePart(str path @D1) -> str @D0
|
||||
extsub @bank 2 -876 = PathPart(str path @D1) -> str @D0
|
||||
extsub @bank 2 -882 = AddPart(str dirname @D1, str filename @D2, long size @D3) -> bool @D0
|
||||
extsub @bank 2 -888 = StartNotify(pointer notify @D1) -> bool @D0
|
||||
extsub @bank 2 -894 = EndNotify(pointer notify @D1)
|
||||
extsub @bank 2 -900 = SetVar(str name @D1, str buffer @D2, long size @D3, long flags @D4) -> bool @D0
|
||||
extsub @bank 2 -906 = GetVar(str name @D1, str buffer @D2, long size @D3, long flags @D4) -> long @D0
|
||||
extsub @bank 2 -912 = DeleteVar(str name @D1, long flags @D2) -> long @D0
|
||||
extsub @bank 2 -918 = FindVar(str name @D1, long k_type @D2) -> pointer @D0
|
||||
extsub @bank 2 -930 = CliInitNewcli(^^DosPacket dp @A0) -> long @D0
|
||||
extsub @bank 2 -936 = CliInitRun(^^DosPacket dp @A0) -> long @D0
|
||||
extsub @bank 2 -942 = WriteChars(str buf @D1, long buflen @D2) -> long @D0
|
||||
extsub @bank 2 -948 = PutStr(str k_str @D1) -> long @D0
|
||||
extsub @bank 2 -954 = VPrintf(str format @D1, pointer argarray @D2) -> long @D0
|
||||
extsub @bank 2 -966 = ParsePatternNoCase(str pat @D1, pointer patbuf @D2, long patbuflen @D3) -> long @D0
|
||||
extsub @bank 2 -972 = MatchPatternNoCase(pointer patbuf @D1, str k_str @D2) -> bool @D0
|
||||
extsub @bank 2 -984 = SameDevice(pointer lock1 @D1, pointer lock2 @D2) -> bool @D0
|
||||
extsub @bank 2 -990 = ExAllEnd(pointer lock @D1, ^^ExAllData buffer @D2, long size @D3, long data @D4, ^^ExAllControl control @D5)
|
||||
extsub @bank 2 -996 = SetOwner(str name @D1, long owner_info @D2) -> bool @D0
|
||||
extsub @bank 2 -1014 = VolumeRequestHook(str vol @D1) -> long @D0
|
||||
extsub @bank 2 -1026 = GetCurrentDir() -> pointer @D0
|
||||
extsub @bank 2 -1128 = PutErrStr(str k_str @D1) -> long @D0
|
||||
extsub @bank 2 -1134 = ErrorOutput() -> long @D0
|
||||
extsub @bank 2 -1140 = SelectError(pointer fh @D1) -> long @D0
|
||||
extsub @bank 2 -1152 = DoShellMethodTagList(long method @D0, pointer tags @A0) -> pointer @D0
|
||||
extsub @bank 2 -1158 = ScanStackToken(pointer seg @D1, long defaultstack @D2) -> long @D0
|
||||
|
||||
; ---- struct definitions ----
|
||||
|
||||
struct DateStampStruct { ; total size: 12
|
||||
long Days ; 0
|
||||
long Minute ; 4
|
||||
long Tick ; 8
|
||||
}
|
||||
|
||||
struct DosPacket { ; total size: 48
|
||||
^^exec.Message Link ; 0
|
||||
^^exec.MsgPort Port ; 4
|
||||
long Type ; 8
|
||||
long Res1 ; 12
|
||||
long Res2 ; 16
|
||||
long Arg1 ; 20
|
||||
long Arg2 ; 24
|
||||
long Arg3 ; 28
|
||||
long Arg4 ; 32
|
||||
long Arg5 ; 36
|
||||
long Arg6 ; 40
|
||||
long Arg7 ; 44
|
||||
}
|
||||
|
||||
struct ErrorString { ; total size: 8
|
||||
pointer Nums ; 0
|
||||
str Strings ; 4
|
||||
}
|
||||
|
||||
struct ExAllControl { ; total size: 16
|
||||
long Entries ; 0
|
||||
long LastKey ; 4
|
||||
str MatchString ; 8
|
||||
^^utility.Hook MatchFunc ; 12
|
||||
}
|
||||
|
||||
struct ExAllData { ; total size: 40
|
||||
^^ExAllData Next ; 0
|
||||
str Name ; 4
|
||||
long Type ; 8
|
||||
long Size ; 12
|
||||
long Prot ; 16
|
||||
long Days ; 20
|
||||
long Mins ; 24
|
||||
long Ticks ; 28
|
||||
str Comment ; 32
|
||||
uword OwnerUID ; 36
|
||||
uword OwnerGID ; 38
|
||||
}
|
||||
|
||||
struct FileHandle { ; total size: 44
|
||||
^^exec.Message Link ; 0
|
||||
^^exec.MsgPort Port ; 4
|
||||
^^exec.MsgPort Type ; 8
|
||||
pointer Buf ; 12
|
||||
long Pos ; 16
|
||||
long End ; 20
|
||||
long Funcs ; 24
|
||||
long Func2 ; 28
|
||||
long Func3 ; 32
|
||||
long Args ; 36
|
||||
long Arg2 ; 40
|
||||
}
|
||||
|
||||
struct FileInfoBlock { ; total size: 260
|
||||
long DiskKey ; 0
|
||||
long DirEntryType ; 4
|
||||
ubyte[108] FileName ; 8
|
||||
long Protection ; 116
|
||||
long EntryType ; 120
|
||||
long Size ; 124
|
||||
long NumBlocks ; 128
|
||||
long Days ; 132
|
||||
long Minute ; 136
|
||||
long Tick ; 140
|
||||
ubyte[80] Comment ; 144
|
||||
uword OwnerUID ; 224
|
||||
uword OwnerGID ; 226
|
||||
ubyte[32] Reserved ; 228
|
||||
}
|
||||
|
||||
struct FileLock { ; total size: 20
|
||||
pointer Link ; 0
|
||||
long Key ; 4
|
||||
long Access ; 8
|
||||
^^exec.MsgPort Task ; 12
|
||||
pointer Volume ; 16
|
||||
}
|
||||
|
||||
struct InfoData { ; total size: 36
|
||||
long NumSoftErrors ; 0
|
||||
long UnitNumber ; 4
|
||||
long DiskState ; 8
|
||||
long NumBlocks ; 12
|
||||
long NumBlocksUsed ; 16
|
||||
long BytesPerBlock ; 20
|
||||
long DiskType ; 24
|
||||
pointer VolumeNode ; 28
|
||||
long InUse ; 32
|
||||
}
|
||||
|
||||
struct Process { ; total size: 228
|
||||
^^exec.Node Succ ; 0
|
||||
^^exec.Node Pred ; 4
|
||||
ubyte Type ; 8
|
||||
byte Pri ; 9
|
||||
str Name ; 10
|
||||
ubyte Flags ; 14
|
||||
ubyte State ; 15
|
||||
byte IDNestCnt ; 16
|
||||
byte TDNestCnt ; 17
|
||||
long SigAlloc ; 18
|
||||
long SigWait ; 22
|
||||
long SigRecvd ; 26
|
||||
long SigExcept ; 30
|
||||
uword TrapAlloc ; 34
|
||||
uword TrapAble ; 36
|
||||
pointer ExceptData ; 38
|
||||
pointer ExceptCode ; 42
|
||||
pointer TrapData ; 46
|
||||
pointer TrapCode ; 50
|
||||
pointer SPReg ; 54
|
||||
pointer SPLower ; 58
|
||||
pointer SPUpper ; 62
|
||||
pointer Switch ; 66
|
||||
pointer Launch ; 70
|
||||
^^exec.Node Head ; 74
|
||||
^^exec.Node Tail ; 78
|
||||
^^exec.Node TailPred ; 82
|
||||
ubyte Process_List_Type ; 86
|
||||
ubyte Pad ; 87
|
||||
pointer UserData ; 88
|
||||
^^exec.Node Node_Succ ; 92
|
||||
^^exec.Node Node_Pred ; 96
|
||||
ubyte Node_Type ; 100
|
||||
byte Node_Pri ; 101
|
||||
str Node_Name ; 102
|
||||
ubyte MsgPort_Flags ; 106
|
||||
ubyte SigBit ; 107
|
||||
pointer SigTask ; 108
|
||||
^^exec.Node List_Head ; 112
|
||||
^^exec.Node List_Tail ; 116
|
||||
^^exec.Node List_TailPred ; 120
|
||||
ubyte List_Type ; 124
|
||||
ubyte List_Pad ; 125
|
||||
word Process_Pad ; 126
|
||||
pointer SegList ; 128
|
||||
long StackSize ; 132
|
||||
pointer GlobVec ; 136
|
||||
long TaskNum ; 140
|
||||
pointer StackBase ; 144
|
||||
long Result2 ; 148
|
||||
pointer CurrentDir ; 152
|
||||
pointer Cis ; 156
|
||||
pointer Cos ; 160
|
||||
pointer ConsoleTask ; 164
|
||||
pointer FileSystemTask ; 168
|
||||
pointer Cli ; 172
|
||||
pointer ReturnAddr ; 176
|
||||
pointer PktWait ; 180
|
||||
pointer WindowPtr ; 184
|
||||
pointer HomeDir ; 188
|
||||
long Process_Flags ; 192
|
||||
pointer ExitCode ; 196
|
||||
long ExitData ; 200
|
||||
str Arguments ; 204
|
||||
^^exec.MinNode MinList_Head ; 208
|
||||
^^exec.MinNode MinList_Tail ; 212
|
||||
^^exec.MinNode MinList_TailPred ; 216
|
||||
long ShellPrivate ; 220
|
||||
pointer Ces ; 224
|
||||
}
|
||||
|
||||
struct StandardPacket { ; total size: 68
|
||||
^^exec.Node Succ ; 0
|
||||
^^exec.Node Pred ; 4
|
||||
ubyte Type ; 8
|
||||
byte Pri ; 9
|
||||
str Name ; 10
|
||||
^^exec.MsgPort ReplyPort ; 14
|
||||
uword Length ; 18
|
||||
^^exec.Message Link ; 20
|
||||
^^exec.MsgPort Port ; 24
|
||||
long DosPacket_Type ; 28
|
||||
long Res1 ; 32
|
||||
long Res2 ; 36
|
||||
long Arg1 ; 40
|
||||
long Arg2 ; 44
|
||||
long Arg3 ; 48
|
||||
long Arg4 ; 52
|
||||
long Arg5 ; 56
|
||||
long Arg6 ; 60
|
||||
long Arg7 ; 64
|
||||
}
|
||||
|
||||
; ---- constants ----
|
||||
const ubyte LEN_DATSTRING = $0010
|
||||
const ubyte DTB_SUBST = 0
|
||||
const ubyte DTF_SUBST = $0001
|
||||
const ubyte DTB_FUTURE = 1
|
||||
const ubyte DTF_FUTURE = $0002
|
||||
const ubyte FORMAT_DOS = $0000
|
||||
const ubyte FORMAT_INT = $0001
|
||||
const ubyte FORMAT_USA = $0002
|
||||
const ubyte FORMAT_CDN = $0003
|
||||
const ubyte FORMAT_DEF = $0004
|
||||
const long DOSTRUE = -1
|
||||
const ubyte DOSFALSE = $0000
|
||||
const uword MODE_OLDFILE = $03ed
|
||||
const uword MODE_NEWFILE = $03ee
|
||||
const uword MODE_READWRITE = $03ec
|
||||
const long OFFSET_BEGINNING = -1
|
||||
const ubyte OFFSET_CURRENT = $0000
|
||||
const ubyte OFFSET_END = $0001
|
||||
const ubyte BITSPERBYTE = $0008
|
||||
const ubyte BYTESPERLONG = $0004
|
||||
const ubyte BITSPERLONG = $0020
|
||||
const long MAXINT = $7FFFFFFF
|
||||
const long MININT = $80000000
|
||||
const long SHARED_LOCK = -2
|
||||
const long ACCESS_READ = -2
|
||||
const long EXCLUSIVE_LOCK = -1
|
||||
const long ACCESS_WRITE = -1
|
||||
const ubyte TICKS_PER_SECOND = $0032
|
||||
const ubyte FIBB_OTR_READ = 15
|
||||
const uword FIBF_OTR_READ = $8000
|
||||
const ubyte FIBB_OTR_WRITE = 14
|
||||
const uword FIBF_OTR_WRITE = $4000
|
||||
const ubyte FIBB_OTR_EXECUTE = 13
|
||||
const uword FIBF_OTR_EXECUTE = $2000
|
||||
const ubyte FIBB_OTR_DELETE = 12
|
||||
const uword FIBF_OTR_DELETE = $1000
|
||||
const ubyte FIBB_GRP_READ = 11
|
||||
const uword FIBF_GRP_READ = $0800
|
||||
const ubyte FIBB_GRP_WRITE = 10
|
||||
const uword FIBF_GRP_WRITE = $0400
|
||||
const ubyte FIBB_GRP_EXECUTE = 9
|
||||
const uword FIBF_GRP_EXECUTE = $0200
|
||||
const ubyte FIBB_GRP_DELETE = 8
|
||||
const uword FIBF_GRP_DELETE = $0100
|
||||
const ubyte FIBB_HOLD = 7
|
||||
const ubyte FIBF_HOLD = $0080
|
||||
const ubyte FIBB_SCRIPT = 6
|
||||
const ubyte FIBF_SCRIPT = $0040
|
||||
const ubyte FIBB_PURE = 5
|
||||
const ubyte FIBF_PURE = $0020
|
||||
const ubyte FIBB_ARCHIVE = 4
|
||||
const ubyte FIBF_ARCHIVE = $0010
|
||||
const ubyte FIBB_READ = 3
|
||||
const ubyte FIBF_READ = $0008
|
||||
const ubyte FIBB_WRITE = 2
|
||||
const ubyte FIBF_WRITE = $0004
|
||||
const ubyte FIBB_EXECUTE = 1
|
||||
const ubyte FIBF_EXECUTE = $0002
|
||||
const ubyte FIBB_DELETE = 0
|
||||
const ubyte FIBF_DELETE = $0001
|
||||
const ubyte FAULT_MAX = $0052
|
||||
const ubyte ID_WRITE_PROTECTED = $0050
|
||||
const ubyte ID_VALIDATING = $0051
|
||||
const ubyte ID_VALIDATED = $0052
|
||||
const long ID_NO_DISK_PRESENT = -1
|
||||
const ubyte ID_UNREADABLE_DISK = $0042
|
||||
const ubyte ID_NOT_REALLY_DOS = $004e
|
||||
const ubyte ID_DOS_DISK = $0044
|
||||
const ubyte ID_FFS_DISK = $0044
|
||||
const ubyte ID_INTER_DOS_DISK = $0044
|
||||
const ubyte ID_INTER_FFS_DISK = $0044
|
||||
const ubyte ID_FASTDIR_DOS_DISK = $0044
|
||||
const ubyte ID_FASTDIR_FFS_DISK = $0044
|
||||
const ubyte ID_LONG_DOS_DISK = $0044
|
||||
const ubyte ID_LONG_FFS_DISK = $0044
|
||||
const ubyte ID_COMPLONG_FFS_DISK = $0044
|
||||
const ubyte ID_KICKSTART_DISK = $004b
|
||||
const ubyte ID_MSDOS_DISK = $004d
|
||||
const ubyte ERROR_NO_FREE_STORE = $0067
|
||||
const ubyte ERROR_TASK_TABLE_FULL = $0069
|
||||
const ubyte ERROR_BAD_TEMPLATE = $0072
|
||||
const ubyte ERROR_BAD_NUMBER = $0073
|
||||
const ubyte ERROR_REQUIRED_ARG_MISSING = $0074
|
||||
const ubyte ERROR_KEY_NEEDS_ARG = $0075
|
||||
const ubyte ERROR_TOO_MANY_ARGS = $0076
|
||||
const ubyte ERROR_UNMATCHED_QUOTES = $0077
|
||||
const ubyte ERROR_LINE_TOO_LONG = $0078
|
||||
const ubyte ERROR_FILE_NOT_OBJECT = $0079
|
||||
const ubyte ERROR_INVALID_RESIDENT_LIBRARY = $007a
|
||||
const ubyte ERROR_NO_DEFAULT_DIR = $00c9
|
||||
const ubyte ERROR_OBJECT_IN_USE = $00ca
|
||||
const ubyte ERROR_OBJECT_EXISTS = $00cb
|
||||
const ubyte ERROR_DIR_NOT_FOUND = $00cc
|
||||
const ubyte ERROR_OBJECT_NOT_FOUND = $00cd
|
||||
const ubyte ERROR_BAD_STREAM_NAME = $00ce
|
||||
const ubyte ERROR_OBJECT_TOO_LARGE = $00cf
|
||||
const ubyte ERROR_ACTION_NOT_KNOWN = $00d1
|
||||
const ubyte ERROR_INVALID_COMPONENT_NAME = $00d2
|
||||
const ubyte ERROR_INVALID_LOCK = $00d3
|
||||
const ubyte ERROR_OBJECT_WRONG_TYPE = $00d4
|
||||
const ubyte ERROR_DISK_NOT_VALIDATED = $00d5
|
||||
const ubyte ERROR_DISK_WRITE_PROTECTED = $00d6
|
||||
const ubyte ERROR_RENAME_ACROSS_DEVICES = $00d7
|
||||
const ubyte ERROR_DIRECTORY_NOT_EMPTY = $00d8
|
||||
const ubyte ERROR_TOO_MANY_LEVELS = $00d9
|
||||
const ubyte ERROR_DEVICE_NOT_MOUNTED = $00da
|
||||
const ubyte ERROR_SEEK_ERROR = $00db
|
||||
const ubyte ERROR_COMMENT_TOO_BIG = $00dc
|
||||
const ubyte ERROR_DISK_FULL = $00dd
|
||||
const ubyte ERROR_DELETE_PROTECTED = $00de
|
||||
const ubyte ERROR_WRITE_PROTECTED = $00df
|
||||
const ubyte ERROR_READ_PROTECTED = $00e0
|
||||
const ubyte ERROR_NOT_A_DOS_DISK = $00e1
|
||||
const ubyte ERROR_NO_DISK = $00e2
|
||||
const ubyte ERROR_NO_MORE_ENTRIES = $00e8
|
||||
const ubyte ERROR_IS_SOFT_LINK = $00e9
|
||||
const ubyte ERROR_OBJECT_LINKED = $00ea
|
||||
const ubyte ERROR_BAD_HUNK = $00eb
|
||||
const ubyte ERROR_NOT_IMPLEMENTED = $00ec
|
||||
const ubyte ERROR_RECORD_NOT_LOCKED = $00f0
|
||||
const ubyte ERROR_LOCK_COLLISION = $00f1
|
||||
const ubyte ERROR_LOCK_TIMEOUT = $00f2
|
||||
const ubyte ERROR_UNLOCK_ERROR = $00f3
|
||||
const ubyte RETURN_OK = $0000
|
||||
const ubyte RETURN_WARN = $0005
|
||||
const ubyte RETURN_ERROR = $000a
|
||||
const ubyte RETURN_FAIL = $0014
|
||||
const ubyte SIGBREAKB_CTRL_C = 12
|
||||
const uword SIGBREAKF_CTRL_C = $1000
|
||||
const ubyte SIGBREAKB_CTRL_D = 13
|
||||
const uword SIGBREAKF_CTRL_D = $2000
|
||||
const ubyte SIGBREAKB_CTRL_E = 14
|
||||
const uword SIGBREAKF_CTRL_E = $4000
|
||||
const ubyte SIGBREAKB_CTRL_F = 15
|
||||
const uword SIGBREAKF_CTRL_F = $8000
|
||||
const long LOCK_DIFFERENT = -1
|
||||
const ubyte LOCK_SAME = $0000
|
||||
const ubyte LOCK_SAME_VOLUME = $0001
|
||||
const ubyte CHANGE_LOCK = $0000
|
||||
const ubyte CHANGE_FH = $0001
|
||||
const ubyte LINK_HARD = $0000
|
||||
const ubyte LINK_SOFT = $0001
|
||||
const long ITEM_EQUAL = -2
|
||||
const long ITEM_ERROR = -1
|
||||
const ubyte ITEM_NOTHING = $0000
|
||||
const ubyte ITEM_UNQUOTED = $0001
|
||||
const ubyte ITEM_QUOTED = $0002
|
||||
const ubyte DOS_FILEHANDLE = $0000
|
||||
const ubyte DOS_EXALLCONTROL = $0001
|
||||
const ubyte DOS_FIB = $0002
|
||||
const ubyte DOS_STDPKT = $0003
|
||||
const ubyte DOS_CLI = $0004
|
||||
const ubyte DOS_RDARGS = $0005
|
||||
const ubyte reserve = $0004
|
||||
const ubyte vsize = $0006
|
||||
const ubyte APB_DOWILD = 0
|
||||
const ubyte APF_DOWILD = $0001
|
||||
const ubyte APB_ITSWILD = 1
|
||||
const ubyte APF_ITSWILD = $0002
|
||||
const ubyte APB_DODIR = 2
|
||||
const ubyte APF_DODIR = $0004
|
||||
const ubyte APB_DIDDIR = 3
|
||||
const ubyte APF_DIDDIR = $0008
|
||||
const ubyte APB_NOMEMERR = 4
|
||||
const ubyte APF_NOMEMERR = $0010
|
||||
const ubyte APB_DODOT = 5
|
||||
const ubyte APF_DODOT = $0020
|
||||
const ubyte APB_DirChanged = 6
|
||||
const ubyte APF_DirChanged = $0040
|
||||
const ubyte APB_FollowHLinks = 7
|
||||
const ubyte APF_FollowHLinks = $0080
|
||||
const ubyte DDB_PatternBit = 0
|
||||
const ubyte DDF_PatternBit = $0001
|
||||
const ubyte DDB_ExaminedBit = 1
|
||||
const ubyte DDF_ExaminedBit = $0002
|
||||
const ubyte DDB_Completed = 2
|
||||
const ubyte DDF_Completed = $0004
|
||||
const ubyte DDB_AllBit = 3
|
||||
const ubyte DDF_AllBit = $0008
|
||||
const ubyte DDB_SINGLE = 4
|
||||
const ubyte DDF_SINGLE = $0010
|
||||
const ubyte P_ANY = $80
|
||||
const ubyte P_SINGLE = $81
|
||||
const ubyte P_ORSTART = $82
|
||||
const ubyte P_ORNEXT = $83
|
||||
const ubyte P_OREND = $84
|
||||
const ubyte P_NOT = $85
|
||||
const ubyte P_NOTEND = $86
|
||||
const ubyte P_NOTCLASS = $87
|
||||
const ubyte P_CLASS = $88
|
||||
const ubyte P_REPBEG = $89
|
||||
const ubyte P_REPEND = $8A
|
||||
const ubyte P_STOP = $8B
|
||||
const ubyte COMPLEX_BIT = $0001
|
||||
const ubyte EXAMINE_BIT = $0002
|
||||
const uword ERROR_BUFFER_OVERFLOW = $012f
|
||||
const uword ERROR_BREAK = $0130
|
||||
const uword ERROR_NOT_EXECUTABLE = $0131
|
||||
const ubyte PRB_FREESEGLIST = 0
|
||||
const ubyte PRF_FREESEGLIST = $0001
|
||||
const ubyte PRB_FREECURRDIR = 1
|
||||
const ubyte PRF_FREECURRDIR = $0002
|
||||
const ubyte PRB_FREECLI = 2
|
||||
const ubyte PRF_FREECLI = $0004
|
||||
const ubyte PRB_CLOSEINPUT = 3
|
||||
const ubyte PRF_CLOSEINPUT = $0008
|
||||
const ubyte PRB_CLOSEOUTPUT = 4
|
||||
const ubyte PRF_CLOSEOUTPUT = $0010
|
||||
const ubyte PRB_FREEARGS = 5
|
||||
const ubyte PRF_FREEARGS = $0020
|
||||
const ubyte PRB_CLOSEERROR = 6
|
||||
const ubyte PRF_CLOSEERROR = $0040
|
||||
const ubyte ACTION_NIL = $0000
|
||||
const ubyte ACTION_STARTUP = $0000
|
||||
const ubyte ACTION_GET_BLOCK = $0002
|
||||
const ubyte ACTION_SET_MAP = $0004
|
||||
const ubyte ACTION_DIE = $0005
|
||||
const ubyte ACTION_EVENT = $0006
|
||||
const ubyte ACTION_CURRENT_VOLUME = $0007
|
||||
const ubyte ACTION_LOCATE_OBJECT = $0008
|
||||
const ubyte ACTION_RENAME_DISK = $0009
|
||||
const ubyte ACTION_WRITE = $0057
|
||||
const ubyte ACTION_READ = $0052
|
||||
const ubyte ACTION_FREE_LOCK = $000f
|
||||
const ubyte ACTION_DELETE_OBJECT = $0010
|
||||
const ubyte ACTION_RENAME_OBJECT = $0011
|
||||
const ubyte ACTION_MORE_CACHE = $0012
|
||||
const ubyte ACTION_COPY_DIR = $0013
|
||||
const ubyte ACTION_WAIT_CHAR = $0014
|
||||
const ubyte ACTION_SET_PROTECT = $0015
|
||||
const ubyte ACTION_CREATE_DIR = $0016
|
||||
const ubyte ACTION_EXAMINE_OBJECT = $0017
|
||||
const ubyte ACTION_EXAMINE_NEXT = $0018
|
||||
const ubyte ACTION_DISK_INFO = $0019
|
||||
const ubyte ACTION_INFO = $001a
|
||||
const ubyte ACTION_FLUSH = $001b
|
||||
const ubyte ACTION_SET_COMMENT = $001c
|
||||
const ubyte ACTION_PARENT = $001d
|
||||
const ubyte ACTION_TIMER = $001e
|
||||
const ubyte ACTION_INHIBIT = $001f
|
||||
const ubyte ACTION_DISK_TYPE = $0020
|
||||
const ubyte ACTION_DISK_CHANGE = $0021
|
||||
const ubyte ACTION_SET_DATE = $0022
|
||||
const uword ACTION_UNDISK_INFO = $0201
|
||||
const uword ACTION_SCREEN_MODE = $03e2
|
||||
const uword ACTION_READ_RETURN = $03e9
|
||||
const uword ACTION_WRITE_RETURN = $03ea
|
||||
const uword ACTION_SEEK = $03f0
|
||||
const uword ACTION_FINDUPDATE = $03ec
|
||||
const uword ACTION_FINDINPUT = $03ed
|
||||
const uword ACTION_FINDOUTPUT = $03ee
|
||||
const uword ACTION_END = $03ef
|
||||
const uword ACTION_SET_FILE_SIZE = $03fe
|
||||
const uword ACTION_WRITE_PROTECT = $03ff
|
||||
const ubyte ACTION_SAME_LOCK = $0028
|
||||
const uword ACTION_CHANGE_SIGNAL = $03e3
|
||||
const uword ACTION_FORMAT = $03fc
|
||||
const uword ACTION_MAKE_LINK = $03fd
|
||||
const uword ACTION_READ_LINK = $0400
|
||||
const uword ACTION_FH_FROM_LOCK = $0402
|
||||
const uword ACTION_IS_FILESYSTEM = $0403
|
||||
const uword ACTION_CHANGE_MODE = $0404
|
||||
const uword ACTION_COPY_DIR_FH = $0406
|
||||
const uword ACTION_PARENT_FH = $0407
|
||||
const uword ACTION_EXAMINE_ALL = $0409
|
||||
const uword ACTION_EXAMINE_FH = $040a
|
||||
const uword ACTION_LOCK_RECORD = $07d8
|
||||
const uword ACTION_FREE_RECORD = $07d9
|
||||
const uword ACTION_ADD_NOTIFY = $1001
|
||||
const uword ACTION_REMOVE_NOTIFY = $1002
|
||||
const uword ACTION_EXAMINE_ALL_END = $040b
|
||||
const uword ACTION_SET_OWNER = $040c
|
||||
const uword ACTION_SERIALIZE_DISK = $1068
|
||||
const ubyte RNB_WILDSTAR = 24
|
||||
const long RNF_WILDSTAR = $01000000
|
||||
const ubyte RNB_PRIVATE1 = 1
|
||||
const ubyte RNF_PRIVATE1 = $0002
|
||||
const long CMD_SYSTEM = -1
|
||||
const long CMD_INTERNAL = -2
|
||||
const long CMD_DISABLED = -999
|
||||
const ubyte DLT_DEVICE = $0000
|
||||
const ubyte DLT_DIRECTORY = $0001
|
||||
const ubyte DLT_VOLUME = $0002
|
||||
const ubyte DLT_LATE = $0003
|
||||
const ubyte DLT_NONBINDING = $0004
|
||||
const long DLT_PRIVATE = -1
|
||||
const ubyte DVPB_UNLOCK = 0
|
||||
const ubyte DVPF_UNLOCK = $0001
|
||||
const ubyte DVPB_ASSIGN = 1
|
||||
const ubyte DVPF_ASSIGN = $0002
|
||||
const ubyte LDB_DEVICES = 2
|
||||
const ubyte LDF_DEVICES = $0004
|
||||
const ubyte LDB_VOLUMES = 3
|
||||
const ubyte LDF_VOLUMES = $0008
|
||||
const ubyte LDB_ASSIGNS = 4
|
||||
const ubyte LDF_ASSIGNS = $0010
|
||||
const ubyte LDB_ENTRY = 5
|
||||
const ubyte LDF_ENTRY = $0020
|
||||
const ubyte LDB_DELETE = 6
|
||||
const ubyte LDF_DELETE = $0040
|
||||
const ubyte LDB_READ = 0
|
||||
const ubyte LDF_READ = $0001
|
||||
const ubyte LDB_WRITE = 1
|
||||
const ubyte LDF_WRITE = $0002
|
||||
const ubyte REPORT_STREAM = $0000
|
||||
const ubyte REPORT_TASK = $0001
|
||||
const ubyte REPORT_LOCK = $0002
|
||||
const ubyte REPORT_VOLUME = $0003
|
||||
const ubyte REPORT_INSERT = $0004
|
||||
const uword ABORT_DISK_ERROR = $0128
|
||||
const uword ABORT_BUSY = $0120
|
||||
const long RUN_EXECUTE = -1
|
||||
const long RUN_SYSTEM = -2
|
||||
const long RUN_SYSTEM_ASYNCH = -3
|
||||
const ubyte ST_ROOT = $0001
|
||||
const ubyte ST_USERDIR = $0002
|
||||
const ubyte ST_SOFTLINK = $0003
|
||||
const ubyte ST_LINKDIR = $0004
|
||||
const long ST_FILE = -3
|
||||
const long ST_LINKFILE = -4
|
||||
const long ST_PIPEFILE = -5
|
||||
const uword HUNK_UNIT = $03e7
|
||||
const uword HUNK_NAME = $03e8
|
||||
const uword HUNK_CODE = $03e9
|
||||
const uword HUNK_DATA = $03ea
|
||||
const uword HUNK_BSS = $03eb
|
||||
const uword HUNK_RELOC32 = $03ec
|
||||
const uword HUNK_RELOC16 = $03ed
|
||||
const uword HUNK_RELOC8 = $03ee
|
||||
const uword HUNK_EXT = $03ef
|
||||
const uword HUNK_SYMBOL = $03f0
|
||||
const uword HUNK_DEBUG = $03f1
|
||||
const uword HUNK_END = $03f2
|
||||
const uword HUNK_HEADER = $03f3
|
||||
const uword HUNK_OVERLAY = $03f5
|
||||
const uword HUNK_BREAK = $03f6
|
||||
const uword HUNK_DREL32 = $03f7
|
||||
const uword HUNK_DREL16 = $03f8
|
||||
const uword HUNK_DREL8 = $03f9
|
||||
const uword HUNK_LIB = $03fa
|
||||
const uword HUNK_INDEX = $03fb
|
||||
const uword HUNK_RELOC32SHORT = $03fc
|
||||
const uword HUNK_RELRELOC32 = $03fd
|
||||
const uword HUNK_ABSRELOC16 = $03fe
|
||||
const ubyte HUNKB_ADVISORY = 29
|
||||
const long HUNKF_ADVISORY = $20000000
|
||||
const ubyte HUNKB_CHIP = 30
|
||||
const long HUNKF_CHIP = $40000000
|
||||
const ubyte HUNKB_FAST = 31
|
||||
const long HUNKF_FAST = $80000000
|
||||
const ubyte EXT_SYMB = $0000
|
||||
const ubyte EXT_DEF = $0001
|
||||
const ubyte EXT_ABS = $0002
|
||||
const ubyte EXT_RES = $0003
|
||||
const ubyte EXT_COMMONDEF = $0004
|
||||
const ubyte EXT_REF32 = $0081
|
||||
const ubyte EXT_COMMON = $0082
|
||||
const ubyte EXT_REF16 = $0083
|
||||
const ubyte EXT_REF8 = $0084
|
||||
const ubyte EXT_DEXT32 = $0085
|
||||
const ubyte EXT_DEXT16 = $0086
|
||||
const ubyte EXT_DEXT8 = $0087
|
||||
const ubyte EXT_RELREF32 = $0088
|
||||
const ubyte EXT_RELCOMMON = $0089
|
||||
const ubyte EXT_ABSREF16 = $008a
|
||||
const ubyte EXT_ABSREF8 = $008b
|
||||
const long SYS_Dummy = $80000020
|
||||
const long NP_Dummy = $800003e8
|
||||
const long ADO_Dummy = $800007d0
|
||||
const ubyte ED_NAME = $0001
|
||||
const ubyte ED_TYPE = $0002
|
||||
const ubyte ED_SIZE = $0003
|
||||
const ubyte ED_PROTECTION = $0004
|
||||
const ubyte ED_DATE = $0005
|
||||
const ubyte ED_COMMENT = $0006
|
||||
const ubyte ED_OWNER = $0007
|
||||
const ubyte DE_TABLESIZE = $0000
|
||||
const ubyte DE_SIZEBLOCK = $0001
|
||||
const ubyte DE_SECORG = $0002
|
||||
const ubyte DE_NUMHEADS = $0003
|
||||
const ubyte DE_SECSPERBLK = $0004
|
||||
const ubyte DE_BLKSPERTRACK = $0005
|
||||
const ubyte DE_RESERVEDBLKS = $0006
|
||||
const ubyte DE_PREFAC = $0007
|
||||
const ubyte DE_INTERLEAVE = $0008
|
||||
const ubyte DE_LOWCYL = $0009
|
||||
const ubyte DE_UPPERCYL = $000a
|
||||
const ubyte DE_NUMBUFFERS = $000b
|
||||
const ubyte DE_MEMBUFTYPE = $000c
|
||||
const ubyte DE_BUFMEMTYPE = $000c
|
||||
const ubyte DE_MAXTRANSFER = $000d
|
||||
const ubyte DE_MASK = $000e
|
||||
const ubyte DE_BOOTPRI = $000f
|
||||
const ubyte DE_DOSTYPE = $0010
|
||||
const ubyte DE_BAUD = $0011
|
||||
const ubyte DE_CONTROL = $0012
|
||||
const ubyte DE_BOOTBLOCKS = $0013
|
||||
const ubyte ENVB_SCSIDIRECT = 16
|
||||
const long ENVF_SCSIDIRECT = $00010000
|
||||
const ubyte ENVB_SUPERFLOPPY = 17
|
||||
const long ENVF_SUPERFLOPPY = $00020000
|
||||
const ubyte ENVB_DISABLENSD = 18
|
||||
const long ENVF_DISABLENSD = $00040000
|
||||
const long NOTIFY_CLASS = $40000000
|
||||
const uword NOTIFY_CODE = $1234
|
||||
const ubyte NRB_SEND_MESSAGE = 0
|
||||
const ubyte NRF_SEND_MESSAGE = $0001
|
||||
const ubyte NRB_SEND_SIGNAL = 1
|
||||
const ubyte NRF_SEND_SIGNAL = $0002
|
||||
const ubyte NRB_WAIT_REPLY = 3
|
||||
const ubyte NRF_WAIT_REPLY = $0008
|
||||
const ubyte NRB_NOTIFY_INITIAL = 4
|
||||
const ubyte NRF_NOTIFY_INITIAL = $0010
|
||||
const ubyte NRB_MAGIC = 31
|
||||
const long NRF_MAGIC = $80000000
|
||||
const long NR_HANDLER_FLAGS = $ffff0000
|
||||
const ubyte RDAB_STDIN = 0
|
||||
const ubyte RDAF_STDIN = $0001
|
||||
const ubyte RDAB_NOALLOC = 1
|
||||
const ubyte RDAF_NOALLOC = $0002
|
||||
const ubyte RDAB_NOPROMPT = 2
|
||||
const ubyte RDAF_NOPROMPT = $0004
|
||||
const ubyte MAX_TEMPLATE_ITEMS = $0064
|
||||
const ubyte MAX_MULTIARGS = $0080
|
||||
const ubyte REC_EXCLUSIVE = $0000
|
||||
const ubyte REC_EXCLUSIVE_IMMED = $0001
|
||||
const ubyte REC_SHARED = $0002
|
||||
const ubyte REC_SHARED_IMMED = $0003
|
||||
const long SHELL_DUMMY = $80000bb8
|
||||
const ubyte DOS_STDIO_I = $0001
|
||||
const ubyte BUF_LINE = $0000
|
||||
const ubyte BUF_FULL = $0001
|
||||
const ubyte BUF_NONE = $0002
|
||||
const long ENDSTREAMCH = -1
|
||||
const ubyte LV_VAR = $0000
|
||||
const ubyte LV_ALIAS = $0001
|
||||
const ubyte LVB_IGNORE = $0007
|
||||
const ubyte LVF_IGNORE = $80
|
||||
const ubyte GVB_GLOBAL_ONLY = 8
|
||||
const uword GVF_GLOBAL_ONLY = $0100
|
||||
const ubyte GVB_LOCAL_ONLY = 9
|
||||
const uword GVF_LOCAL_ONLY = $0200
|
||||
const ubyte GVB_BINARY_VAR = 10
|
||||
const uword GVF_BINARY_VAR = $0400
|
||||
const ubyte GVB_DONT_NULL_TERM = 11
|
||||
const uword GVF_DONT_NULL_TERM = $0800
|
||||
const ubyte GVB_SAVE_VAR = 12
|
||||
const uword GVF_SAVE_VAR = $1000
|
||||
const ubyte FORMAT_MAX = $0003
|
||||
const long OFFSET_BEGINING = -1
|
||||
const ubyte LOCK_SAME_HANDLER = $0001
|
||||
const ubyte LDF_ALL = $001c
|
||||
const uword HUNK_ABSRELOC32 = $03ec
|
||||
const uword HUNK_RELRELOC16 = $03ed
|
||||
const uword HUNK_RELRELOC8 = $03ee
|
||||
const ubyte EXT_ABSREF32 = $0081
|
||||
const ubyte EXT_ABSCOMMON = $0082
|
||||
const ubyte EXT_RELREF16 = $0083
|
||||
const ubyte EXT_RELREF8 = $0084
|
||||
const long SYS_Input = $80000021
|
||||
const long SYS_Output = $80000022
|
||||
const long SYS_Asynch = $80000023
|
||||
const long SYS_UserShell = $80000024
|
||||
const long SYS_CustomShell = $80000025
|
||||
const long SYS_Error = $80000026
|
||||
const long SYS_ExecuteInputStream = $80000020
|
||||
const long SYS_CmdStream = $80000028
|
||||
const long NP_Seglist = $800003e9
|
||||
const long NP_FreeSeglist = $800003ea
|
||||
const long NP_Entry = $800003eb
|
||||
const long NP_Input = $800003ec
|
||||
const long NP_Output = $800003ed
|
||||
const long NP_CloseInput = $800003ee
|
||||
const long NP_CloseOutput = $800003ef
|
||||
const long NP_Error = $800003f0
|
||||
const long NP_CloseError = $800003f1
|
||||
const long NP_CurrentDir = $800003f2
|
||||
const long NP_StackSize = $800003f3
|
||||
const long NP_Name = $800003f4
|
||||
const long NP_Priority = $800003f5
|
||||
const long NP_ConsoleTask = $800003f6
|
||||
const long NP_WindowPtr = $800003f7
|
||||
const long NP_HomeDir = $800003f8
|
||||
const long NP_CopyVars = $800003f9
|
||||
const long NP_Cli = $800003fa
|
||||
const long NP_Path = $800003fb
|
||||
const long NP_CommandName = $800003fc
|
||||
const long NP_Arguments = $800003fd
|
||||
const long NP_NotifyOnDeath = $800003fe
|
||||
const long NP_Synchronous = $800003ff
|
||||
const long NP_ExitCode = $80000400
|
||||
const long NP_ExitData = $80000401
|
||||
const long ADO_FH_Mode = $800007d1
|
||||
const long ADO_DirLen = $800007d2
|
||||
const long ADO_CommNameLen = $800007d3
|
||||
const long ADO_CommFileLen = $800007d4
|
||||
const long ADO_PromptLen = $800007d5
|
||||
const long SHELL_FGETS_FULL = $80000bb9
|
||||
const long SHELL_ADDH_LINE = $80000bba
|
||||
%option no_symbol_prefixing, ignore_unused
|
||||
}
|
||||
;; End of auto-generated dos_lib.sfd
|
||||
@@ -1,656 +1,5 @@
|
||||
;; Auto-generated from exec_lib.sfd and exec_lib.i
|
||||
;; Library base: _SysBase in prog8: sys.SysBase
|
||||
;; Bank: 1
|
||||
;; Functions: 115
|
||||
%import shared_amiga_exec
|
||||
|
||||
exec {
|
||||
%option no_symbol_prefixing
|
||||
|
||||
asmsub NewList(^^List list @A0) {
|
||||
; manually added utility routine to initialize new exec linked lists
|
||||
%asm {{
|
||||
addq.l #4, a0 ; Point to lh_Tail
|
||||
move.l a0, -4(a0) ; lh_Head = &lh_Tail
|
||||
clr.l (a0) ; lh_Tail = NULL
|
||||
subq.l #4, a0 ; Point back to &lh_Head
|
||||
move.l a0, 8(a0) ; lh_TailPred = &lh_Head
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
extsub @bank 1 -30 = Supervisor(pointer userFunction @A5) -> long @D0
|
||||
extsub @bank 1 -72 = InitCode(long startClass @D0, long version @D1)
|
||||
extsub @bank 1 -78 = InitStruct(pointer initTable @A1, pointer k_memory @A2, long size @D0)
|
||||
extsub @bank 1 -84 = MakeLibrary(pointer funcInit @A0, pointer structInit @A1, pointer libInit @A2, long dataSize @D0, long segList @D1) -> ^^Library @D0
|
||||
extsub @bank 1 -90 = MakeFunctions(pointer target @A0, pointer functionArray @A1, long funcDispBase @A2)
|
||||
extsub @bank 1 -96 = FindResident(str name @A1) -> pointer @D0
|
||||
extsub @bank 1 -102 = InitResident(pointer resident @A1, long segList @D1) -> pointer @D0
|
||||
extsub @bank 1 -108 = Alert(long alertNum @D7)
|
||||
extsub @bank 1 -114 = Debug(long flags @D0)
|
||||
extsub @bank 1 -120 = Disable()
|
||||
extsub @bank 1 -126 = Enable()
|
||||
extsub @bank 1 -132 = Forbid()
|
||||
extsub @bank 1 -138 = Permit()
|
||||
extsub @bank 1 -144 = SetSR(long newSR @D0, long mask @D1) -> long @D0
|
||||
extsub @bank 1 -150 = SuperState() -> pointer @D0
|
||||
extsub @bank 1 -156 = UserState(pointer sysStack @D0)
|
||||
extsub @bank 1 -162 = SetIntVector(long intNumber @D0, ^^Interrupt interrupt @A1) -> ^^Interrupt @D0
|
||||
extsub @bank 1 -168 = AddIntServer(long intNumber @D0, ^^Interrupt interrupt @A1)
|
||||
extsub @bank 1 -174 = RemIntServer(long intNumber @D0, ^^Interrupt interrupt @A1)
|
||||
extsub @bank 1 -180 = Cause(^^Interrupt interrupt @A1)
|
||||
extsub @bank 1 -186 = Allocate(pointer freeList @A0, long byteSize @D0) -> pointer @D0
|
||||
extsub @bank 1 -192 = Deallocate(pointer freeList @A0, pointer memoryBlock @A1, long byteSize @D0)
|
||||
extsub @bank 1 -198 = AllocMem(long byteSize @D0, long requirements @D1) -> pointer @D0
|
||||
extsub @bank 1 -204 = AllocAbs(long byteSize @D0, pointer location @A1) -> pointer @D0
|
||||
extsub @bank 1 -210 = FreeMem(pointer memoryBlock @A1, long byteSize @D0)
|
||||
extsub @bank 1 -216 = AvailMem(long requirements @D1) -> long @D0
|
||||
extsub @bank 1 -222 = AllocEntry(pointer entry @A0) -> pointer @D0
|
||||
extsub @bank 1 -228 = FreeEntry(pointer entry @A0)
|
||||
extsub @bank 1 -234 = Insert(^^List list @A0, ^^Node node @A1, ^^Node pred @A2)
|
||||
extsub @bank 1 -240 = AddHead(^^List list @A0, ^^Node node @A1)
|
||||
extsub @bank 1 -246 = AddTail(^^List list @A0, ^^Node node @A1)
|
||||
extsub @bank 1 -252 = Remove(^^Node node @A1)
|
||||
extsub @bank 1 -258 = RemHead(^^List list @A0) -> ^^Node @D0
|
||||
extsub @bank 1 -264 = RemTail(^^List list @A0) -> ^^Node @D0
|
||||
extsub @bank 1 -270 = Enqueue(^^List list @A0, ^^Node node @A1)
|
||||
extsub @bank 1 -276 = FindName(^^List list @A0, str name @A1) -> ^^Node @D0
|
||||
extsub @bank 1 -282 = AddTask(^^Task task @A1, pointer initPC @A2, pointer finalPC @A3) -> pointer @D0
|
||||
extsub @bank 1 -288 = RemTask(^^Task task @A1)
|
||||
extsub @bank 1 -294 = FindTask(str name @A1) -> ^^Task @D0
|
||||
extsub @bank 1 -300 = SetTaskPri(^^Task task @A1, long priority @D0) -> byte @D0
|
||||
extsub @bank 1 -306 = SetSignal(long newSignals @D0, long signalSet @D1) -> long @D0
|
||||
extsub @bank 1 -312 = SetExcept(long newSignals @D0, long signalSet @D1) -> long @D0
|
||||
extsub @bank 1 -318 = Wait(long signalSet @D0) -> long @D0
|
||||
extsub @bank 1 -324 = Signal(^^Task task @A1, long signalSet @D0)
|
||||
extsub @bank 1 -330 = AllocSignal(byte signalNum @D0) -> byte @D0
|
||||
extsub @bank 1 -336 = FreeSignal(byte signalNum @D0)
|
||||
extsub @bank 1 -342 = AllocTrap(long trapNum @D0) -> long @D0
|
||||
extsub @bank 1 -348 = FreeTrap(long trapNum @D0)
|
||||
extsub @bank 1 -354 = AddPort(^^MsgPort port @A1)
|
||||
extsub @bank 1 -360 = RemPort(^^MsgPort port @A1)
|
||||
extsub @bank 1 -366 = PutMsg(^^MsgPort port @A0, ^^Message message @A1)
|
||||
extsub @bank 1 -372 = GetMsg(^^MsgPort port @A0) -> ^^Message @D0
|
||||
extsub @bank 1 -378 = ReplyMsg(^^Message message @A1)
|
||||
extsub @bank 1 -384 = WaitPort(^^MsgPort port @A0) -> ^^Message @D0
|
||||
extsub @bank 1 -390 = FindPort(str name @A1) -> ^^MsgPort @D0
|
||||
extsub @bank 1 -396 = AddLibrary(^^Library library @A1)
|
||||
extsub @bank 1 -402 = RemLibrary(^^Library library @A1)
|
||||
extsub @bank 1 -408 = OldOpenLibrary(str libName @A1) -> ^^Library @D0
|
||||
extsub @bank 1 -414 = CloseLibrary(^^Library library @A1)
|
||||
extsub @bank 1 -420 = SetFunction(^^Library library @A1, long funcOffset @A0, pointer newFunction @D0) -> pointer @D0
|
||||
extsub @bank 1 -426 = SumLibrary(^^Library library @A1)
|
||||
extsub @bank 1 -432 = AddDevice(pointer device @A1)
|
||||
extsub @bank 1 -438 = RemDevice(pointer device @A1)
|
||||
extsub @bank 1 -444 = OpenDevice(str devName @A0, long unit @D0, pointer ioRequest @A1, long flags @D1) -> byte @D0
|
||||
extsub @bank 1 -450 = CloseDevice(pointer ioRequest @A1)
|
||||
extsub @bank 1 -456 = DoIO(pointer ioRequest @A1) -> byte @D0
|
||||
extsub @bank 1 -462 = SendIO(pointer ioRequest @A1)
|
||||
extsub @bank 1 -468 = CheckIO(pointer ioRequest @A1) -> pointer @D0
|
||||
extsub @bank 1 -474 = WaitIO(pointer ioRequest @A1) -> byte @D0
|
||||
extsub @bank 1 -480 = AbortIO(pointer ioRequest @A1)
|
||||
extsub @bank 1 -486 = AddResource(pointer resource @A1)
|
||||
extsub @bank 1 -492 = RemResource(pointer resource @A1)
|
||||
extsub @bank 1 -498 = OpenResource(str resName @A1) -> pointer @D0
|
||||
extsub @bank 1 -522 = RawDoFmt(str formatString @A0, pointer dataStream @A1, pointer putChProc @A2, pointer putChData @A3) -> pointer @D0
|
||||
extsub @bank 1 -528 = GetCC() -> long @D0
|
||||
extsub @bank 1 -534 = TypeOfMem(pointer address @A1) -> long @D0
|
||||
extsub @bank 1 -540 = Procure(pointer sigSem @A0, pointer bidMsg @A1) -> long @D0
|
||||
extsub @bank 1 -546 = Vacate(pointer sigSem @A0, pointer bidMsg @A1)
|
||||
extsub @bank 1 -552 = OpenLibrary(str libName @A1, long version @D0) -> ^^Library @D0
|
||||
extsub @bank 1 -558 = InitSemaphore(pointer sigSem @A0)
|
||||
extsub @bank 1 -564 = ObtainSemaphore(pointer sigSem @A0)
|
||||
extsub @bank 1 -570 = ReleaseSemaphore(pointer sigSem @A0)
|
||||
extsub @bank 1 -576 = AttemptSemaphore(pointer sigSem @A0) -> long @D0
|
||||
extsub @bank 1 -582 = ObtainSemaphoreList(^^List sigSem @A0)
|
||||
extsub @bank 1 -588 = ReleaseSemaphoreList(^^List sigSem @A0)
|
||||
extsub @bank 1 -594 = FindSemaphore(str name @A1) -> pointer @D0
|
||||
extsub @bank 1 -600 = AddSemaphore(pointer sigSem @A1)
|
||||
extsub @bank 1 -606 = RemSemaphore(pointer sigSem @A1)
|
||||
extsub @bank 1 -612 = SumKickData() -> long @D0
|
||||
extsub @bank 1 -618 = AddMemList(long size @D0, long attributes @D1, long pri @D2, pointer base @A0, str name @A1)
|
||||
extsub @bank 1 -624 = CopyMem(pointer source @A0, pointer dest @A1, long size @D0)
|
||||
extsub @bank 1 -630 = CopyMemQuick(pointer source @A0, pointer dest @A1, long size @D0)
|
||||
extsub @bank 1 -636 = CacheClearU()
|
||||
extsub @bank 1 -642 = CacheClearE(pointer address @A0, long length @D0, long caches @D1)
|
||||
extsub @bank 1 -648 = CacheControl(long cacheBits @D0, long cacheMask @D1) -> long @D0
|
||||
extsub @bank 1 -654 = CreateIORequest(^^MsgPort port @A0, long size @D0) -> pointer @D0
|
||||
extsub @bank 1 -660 = DeleteIORequest(pointer iorequest @A0)
|
||||
extsub @bank 1 -666 = CreateMsgPort() -> ^^MsgPort @D0
|
||||
extsub @bank 1 -672 = DeleteMsgPort(^^MsgPort port @A0)
|
||||
extsub @bank 1 -678 = ObtainSemaphoreShared(pointer sigSem @A0)
|
||||
extsub @bank 1 -684 = AllocVec(long byteSize @D0, long requirements @D1) -> pointer @D0
|
||||
extsub @bank 1 -690 = FreeVec(pointer memoryBlock @A1)
|
||||
extsub @bank 1 -696 = CreatePool(long requirements @D0, long puddleSize @D1, long threshSize @D2) -> pointer @D0
|
||||
extsub @bank 1 -702 = DeletePool(pointer poolHeader @A0)
|
||||
extsub @bank 1 -708 = AllocPooled(pointer poolHeader @A0, long memSize @D0) -> pointer @D0
|
||||
extsub @bank 1 -714 = FreePooled(pointer poolHeader @A0, pointer k_memory @A1, long memSize @D0)
|
||||
extsub @bank 1 -720 = AttemptSemaphoreShared(pointer sigSem @A0) -> long @D0
|
||||
extsub @bank 1 -726 = ColdReboot()
|
||||
extsub @bank 1 -732 = StackSwap(pointer newStack @A0)
|
||||
extsub @bank 1 -762 = CachePreDMA(pointer address @A0, pointer length @A1, long flags @D0) -> pointer @D0
|
||||
extsub @bank 1 -768 = CachePostDMA(pointer address @A0, pointer length @A1, long flags @D0)
|
||||
extsub @bank 1 -774 = AddMemHandler(^^Interrupt memhand @A1)
|
||||
extsub @bank 1 -780 = RemMemHandler(^^Interrupt memhand @A1)
|
||||
extsub @bank 1 -786 = ObtainQuickVector(pointer interruptCode @A0) -> long @D0
|
||||
extsub @bank 1 -828 = NewMinList(^^MinList minlist @A0)
|
||||
|
||||
; ---- struct definitions ----
|
||||
|
||||
struct IOStdReq { ; total size: 48
|
||||
^^Node Succ ; 0
|
||||
^^Node Pred ; 4
|
||||
ubyte Type ; 8
|
||||
byte Pri ; 9
|
||||
str Name ; 10
|
||||
^^MsgPort ReplyPort ; 14
|
||||
uword Length ; 18
|
||||
pointer Device ; 20
|
||||
pointer Unit ; 24
|
||||
uword Command ; 28
|
||||
ubyte Flags ; 30
|
||||
byte Error ; 31
|
||||
long Actual ; 32
|
||||
long IOStdReq_Length ; 36
|
||||
pointer Data ; 40
|
||||
long Offset ; 44
|
||||
}
|
||||
|
||||
struct IORequest { ; total size: 32
|
||||
^^Node Succ ; 0
|
||||
^^Node Pred ; 4
|
||||
ubyte Type ; 8
|
||||
byte Pri ; 9
|
||||
str Name ; 10
|
||||
^^MsgPort ReplyPort ; 14
|
||||
uword Length ; 18
|
||||
pointer Device ; 20
|
||||
pointer Unit ; 24
|
||||
uword Command ; 28
|
||||
ubyte Flags ; 30
|
||||
byte Error ; 31
|
||||
}
|
||||
|
||||
struct Interrupt { ; total size: 22
|
||||
^^Node Succ ; 0
|
||||
^^Node Pred ; 4
|
||||
ubyte Type ; 8
|
||||
byte Pri ; 9
|
||||
str Name ; 10
|
||||
pointer Data ; 14
|
||||
pointer Code ; 18
|
||||
}
|
||||
|
||||
struct List { ; total size: 14
|
||||
^^Node Head ; 0
|
||||
pointer Tail ; 4
|
||||
^^Node TailPred ; 8
|
||||
ubyte Type ; 12
|
||||
ubyte Pad ; 13
|
||||
}
|
||||
|
||||
struct Library { ; total size: 34
|
||||
^^Node Succ ; 0
|
||||
^^Node Pred ; 4
|
||||
ubyte Type ; 8
|
||||
byte Pri ; 9
|
||||
str Name ; 10
|
||||
ubyte Flags ; 14
|
||||
ubyte Pad ; 15
|
||||
uword NegSize ; 16
|
||||
uword PosSize ; 18
|
||||
uword Version ; 20
|
||||
uword Revision ; 22
|
||||
str IdString ; 24
|
||||
long Sum ; 28
|
||||
uword OpenCnt ; 32
|
||||
}
|
||||
|
||||
struct Node { ; total size: 14
|
||||
^^Node Succ ; 0
|
||||
^^Node Pred ; 4
|
||||
ubyte Type ; 8
|
||||
byte Pri ; 9
|
||||
str Name ; 10
|
||||
}
|
||||
|
||||
struct MinList { ; total size: 12
|
||||
^^MinNode Head ; 0
|
||||
pointer Tail ; 4
|
||||
^^MinNode TailPred ; 8
|
||||
}
|
||||
|
||||
struct MinNode { ; total size: 8
|
||||
^^MinNode Succ ; 0
|
||||
^^MinNode Pred ; 4
|
||||
}
|
||||
|
||||
struct Message { ; total size: 20
|
||||
^^Message Succ ; 0
|
||||
^^Message Pred ; 4
|
||||
ubyte Type ; 8
|
||||
byte Pri ; 9
|
||||
str Name ; 10
|
||||
^^MsgPort ReplyPort ; 14
|
||||
uword Length ; 18
|
||||
}
|
||||
|
||||
struct MsgPort { ; total size: 34
|
||||
^^Node Succ ; 0
|
||||
^^Node Pred ; 4
|
||||
ubyte Type ; 8
|
||||
byte Pri ; 9
|
||||
str Name ; 10
|
||||
ubyte Flags ; 14
|
||||
ubyte SigBit ; 15
|
||||
pointer SigTask ; 16
|
||||
^^Node Head ; 20
|
||||
^^Node Tail ; 24
|
||||
^^Node TailPred ; 28
|
||||
ubyte List_Type ; 32
|
||||
ubyte Pad ; 33
|
||||
}
|
||||
|
||||
struct Task { ; total size: 92
|
||||
^^Node Succ ; 0
|
||||
^^Node Pred ; 4
|
||||
ubyte Type ; 8
|
||||
byte Pri ; 9
|
||||
str Name ; 10
|
||||
ubyte Flags ; 14
|
||||
ubyte State ; 15
|
||||
byte IDNestCnt ; 16
|
||||
byte TDNestCnt ; 17
|
||||
long SigAlloc ; 18
|
||||
long SigWait ; 22
|
||||
long SigRecvd ; 26
|
||||
long SigExcept ; 30
|
||||
uword TrapAlloc ; 34
|
||||
uword TrapAble ; 36
|
||||
pointer ExceptData ; 38
|
||||
pointer ExceptCode ; 42
|
||||
pointer TrapData ; 46
|
||||
pointer TrapCode ; 50
|
||||
pointer SPReg ; 54
|
||||
pointer SPLower ; 58
|
||||
pointer SPUpper ; 62
|
||||
pointer Switch ; 66
|
||||
pointer Launch ; 70
|
||||
^^Node Head ; 74
|
||||
^^Node Tail ; 78
|
||||
^^Node TailPred ; 82
|
||||
ubyte List_Type ; 86
|
||||
ubyte Pad ; 87
|
||||
pointer UserData ; 88
|
||||
}
|
||||
|
||||
; ---- constants ----
|
||||
const long ACPU_BusErr = $80000002
|
||||
const long ACPU_AddressErr = $80000003
|
||||
const long ACPU_InstErr = $80000004
|
||||
const long ACPU_DivZero = $80000005
|
||||
const long ACPU_CHK = $80000006
|
||||
const long ACPU_TRAPV = $80000007
|
||||
const long ACPU_PrivErr = $80000008
|
||||
const long ACPU_Trace = $80000009
|
||||
const long ACPU_LineA = $8000000A
|
||||
const long ACPU_LineF = $8000000B
|
||||
const long ACPU_Format = $8000000E
|
||||
const long ACPU_Spurious = $80000018
|
||||
const long ACPU_AutoVec1 = $80000019
|
||||
const long ACPU_AutoVec2 = $8000001A
|
||||
const long ACPU_AutoVec3 = $8000001B
|
||||
const long ACPU_AutoVec4 = $8000001C
|
||||
const long ACPU_AutoVec5 = $8000001D
|
||||
const long ACPU_AutoVec6 = $8000001E
|
||||
const long ACPU_AutoVec7 = $8000001F
|
||||
const long AT_DeadEnd = $80000000
|
||||
const long AT_Recovery = $00000000
|
||||
const long AG_NoMemory = $00010000
|
||||
const long AG_MakeLib = $00020000
|
||||
const long AG_OpenLib = $00030000
|
||||
const long AG_OpenDev = $00040000
|
||||
const long AG_OpenRes = $00050000
|
||||
const long AG_IOError = $00060000
|
||||
const long AG_NoSignal = $00070000
|
||||
const long AG_BadParm = $00080000
|
||||
const long AG_CloseLib = $00090000
|
||||
const long AG_CloseDev = $000A0000
|
||||
const long AG_ProcCreate = $000B0000
|
||||
const long AO_ExecLib = $00008001
|
||||
const long AO_GraphicsLib = $00008002
|
||||
const long AO_LayersLib = $00008003
|
||||
const long AO_Intuition = $00008004
|
||||
const long AO_MathLib = $00008005
|
||||
const long AO_DOSLib = $00008007
|
||||
const long AO_RAMLib = $00008008
|
||||
const long AO_IconLib = $00008009
|
||||
const long AO_ExpansionLib = $0000800A
|
||||
const long AO_DiskfontLib = $0000800B
|
||||
const long AO_UtilityLib = $0000800C
|
||||
const long AO_KeyMapLib = $0000800D
|
||||
const long AO_AudioDev = $00008010
|
||||
const long AO_ConsoleDev = $00008011
|
||||
const long AO_GamePortDev = $00008012
|
||||
const long AO_KeyboardDev = $00008013
|
||||
const long AO_TrackDiskDev = $00008014
|
||||
const long AO_TimerDev = $00008015
|
||||
const long AO_CIARsrc = $00008020
|
||||
const long AO_DiskRsrc = $00008021
|
||||
const long AO_MiscRsrc = $00008022
|
||||
const long AO_BootStrap = $00008030
|
||||
const long AO_Workbench = $00008031
|
||||
const long AO_DiskCopy = $00008032
|
||||
const long AO_GadTools = $00008033
|
||||
const long AO_Unknown = $00008035
|
||||
const long AN_ExecLib = $01000000
|
||||
const long AN_ExcptVect = $01000001
|
||||
const long AN_BaseChkSum = $01000002
|
||||
const long AN_LibChkSum = $01000003
|
||||
const long AN_MemCorrupt = $81000005
|
||||
const long AN_IntrMem = $81000006
|
||||
const long AN_InitAPtr = $01000007
|
||||
const long AN_SemCorrupt = $01000008
|
||||
const long AN_FreeTwice = $01000009
|
||||
const long AN_BogusExcpt = $8100000A
|
||||
const long AN_IOUsedTwice = $0100000B
|
||||
const long AN_MemoryInsane = $0100000C
|
||||
const long AN_IOAfterClose = $0100000D
|
||||
const long AN_StackProbe = $0100000E
|
||||
const long AN_BadFreeAddr = $0100000F
|
||||
const long AN_BadSemaphore = $01000010
|
||||
const long AN_BadQuickInt = $810000FF
|
||||
const long AN_AVLNotImpl = $01000011
|
||||
const long AN_TreeNotImpl = $01000012
|
||||
const long AN_GraphicsLib = $02000000
|
||||
const long AN_GfxNoMem = $82010000
|
||||
const long AN_GfxNoMemMspc = $82010001
|
||||
const long AN_LongFrame = $82010006
|
||||
const long AN_ShortFrame = $82010007
|
||||
const long AN_TextTmpRas = $02010009
|
||||
const long AN_BltBitMap = $8201000A
|
||||
const long AN_RegionMemory = $8201000B
|
||||
const long AN_MakeVPort = $82010030
|
||||
const long AN_GfxNewError = $0200000C
|
||||
const long AN_GfxFreeError = $0200000D
|
||||
const long AN_GfxNoLCM = $82011234
|
||||
const long AN_ObsoleteFont = $02000401
|
||||
const long AN_LayersLib = $03000000
|
||||
const long AN_LayersNoMem = $83010000
|
||||
const long AN_Intuition = $04000000
|
||||
const long AN_GadgetType = $84000001
|
||||
const long AN_BadGadget = $04000001
|
||||
const long AN_CreatePort = $84010002
|
||||
const long AN_ItemAlloc = $04010003
|
||||
const long AN_SubAlloc = $04010004
|
||||
const long AN_PlaneAlloc = $84010005
|
||||
const long AN_ItemBoxTop = $84000006
|
||||
const long AN_OpenScreen = $84010007
|
||||
const long AN_OpenScrnRast = $84010008
|
||||
const long AN_SysScrnType = $84000009
|
||||
const long AN_AddSWGadget = $8401000A
|
||||
const long AN_OpenWindow = $8401000B
|
||||
const long AN_BadState = $8400000C
|
||||
const long AN_BadMessage = $8400000D
|
||||
const long AN_WeirdEcho = $8400000E
|
||||
const long AN_NoConsole = $8400000F
|
||||
const long AN_NoISem = $04000010
|
||||
const long AN_ISemOrder = $04000011
|
||||
const long AN_DeadIntui = $04000012
|
||||
const long AN_MathLib = $05000000
|
||||
const long AN_DOSLib = $07000000
|
||||
const long AN_StartMem = $07010001
|
||||
const long AN_EndTask = $07000002
|
||||
const long AN_QPktFail = $07000003
|
||||
const long AN_AsyncPkt = $07000004
|
||||
const long AN_FreeVec = $07000005
|
||||
const long AN_DiskBlkSeq = $07000006
|
||||
const long AN_BitMap = $07000007
|
||||
const long AN_KeyFree = $07000008
|
||||
const long AN_BadChkSum = $07000009
|
||||
const long AN_DiskError = $0700000A
|
||||
const long AN_KeyRange = $0700000B
|
||||
const long AN_BadOverlay = $0700000C
|
||||
const long AN_BadInitFunc = $0700000D
|
||||
const long AN_FileReclosed = $0700000E
|
||||
const long AN_CLIObsolete = $0700000F
|
||||
const long AN_RAMLib = $08000000
|
||||
const long AN_BadSegList = $08000001
|
||||
const long AN_IconLib = $09000000
|
||||
const long AN_ExpansionLib = $0A000000
|
||||
const long AN_BadExpansionFree = $0A000001
|
||||
const long AN_DiskfontLib = $0B000000
|
||||
const long AN_AudioDev = $10000000
|
||||
const long AN_ConsoleDev = $11000000
|
||||
const long AN_NoWindow = $11000001
|
||||
const long AN_GamePortDev = $12000000
|
||||
const long AN_KeyboardDev = $13000000
|
||||
const long AN_TrackDiskDev = $14000000
|
||||
const long AN_TDCalibSeek = $14000001
|
||||
const long AN_TDDelay = $14000002
|
||||
const long AN_TimerDev = $15000000
|
||||
const long AN_TMBadReq = $15000001
|
||||
const long AN_TMBadSupply = $15000002
|
||||
const long AN_CIARsrc = $20000000
|
||||
const long AN_DiskRsrc = $21000000
|
||||
const long AN_DRHasDisk = $21000001
|
||||
const long AN_DRIntNoAct = $21000002
|
||||
const long AN_MiscRsrc = $22000000
|
||||
const long AN_BootStrap = $30000000
|
||||
const long AN_BootError = $30000001
|
||||
const long AN_Workbench = $31000000
|
||||
const long AN_NoFonts = $B1000001
|
||||
const long AN_WBBadStartupMsg1 = $31000001
|
||||
const long AN_WBBadStartupMsg2 = $31000002
|
||||
const long AN_WBBadIOMsg = $31000003
|
||||
const long AN_WBReLayoutToolMenu = $B1010009
|
||||
const long AN_DiskCopy = $32000000
|
||||
const long AN_GadTools = $33000000
|
||||
const long AN_UtilityLib = $34000000
|
||||
const long AN_Unknown = $35000000
|
||||
const ubyte UNITB_ACTIVE = 0
|
||||
const ubyte UNITF_ACTIVE = $0001
|
||||
const ubyte UNITB_INTASK = 1
|
||||
const ubyte UNITF_INTASK = $0002
|
||||
const long IOERR_OPENFAIL = -1
|
||||
const long IOERR_ABORTED = -2
|
||||
const long IOERR_NOCMD = -3
|
||||
const long IOERR_BADLENGTH = -4
|
||||
const long IOERR_BADADDRESS = -5
|
||||
const long IOERR_UNITBUSY = -6
|
||||
const long IOERR_SELFTEST = -7
|
||||
const ubyte AFB_68010 = 0
|
||||
const ubyte AFF_68010 = $0001
|
||||
const ubyte AFB_68020 = 1
|
||||
const ubyte AFF_68020 = $0002
|
||||
const ubyte AFB_68030 = 2
|
||||
const ubyte AFF_68030 = $0004
|
||||
const ubyte AFB_68040 = 3
|
||||
const ubyte AFF_68040 = $0008
|
||||
const ubyte AFB_68881 = 4
|
||||
const ubyte AFF_68881 = $0010
|
||||
const ubyte AFB_68882 = 5
|
||||
const ubyte AFF_68882 = $0020
|
||||
const ubyte AFB_FPU40 = 6
|
||||
const ubyte AFF_FPU40 = $0040
|
||||
const ubyte AFB_68060 = 7
|
||||
const ubyte AFF_68060 = $0080
|
||||
const ubyte AFB_FPGA = 10
|
||||
const uword AFF_FPGA = $0400
|
||||
const ubyte AFB_PRIVATE = 15
|
||||
const uword AFF_PRIVATE = $8000
|
||||
const ubyte CACRB_EnableI = 0
|
||||
const ubyte CACRF_EnableI = $0001
|
||||
const ubyte CACRB_FreezeI = 1
|
||||
const ubyte CACRF_FreezeI = $0002
|
||||
const ubyte CACRB_ClearI = 3
|
||||
const ubyte CACRF_ClearI = $0008
|
||||
const ubyte CACRB_IBE = 4
|
||||
const ubyte CACRF_IBE = $0010
|
||||
const ubyte CACRB_EnableD = 8
|
||||
const uword CACRF_EnableD = $0100
|
||||
const ubyte CACRB_FreezeD = 9
|
||||
const uword CACRF_FreezeD = $0200
|
||||
const ubyte CACRB_ClearD = 11
|
||||
const uword CACRF_ClearD = $0800
|
||||
const ubyte CACRB_DBE = 12
|
||||
const uword CACRF_DBE = $1000
|
||||
const ubyte CACRB_WriteAllocate = 13
|
||||
const uword CACRF_WriteAllocate = $2000
|
||||
const ubyte CACRB_EnableE = 30
|
||||
const long CACRF_EnableE = $40000000
|
||||
const ubyte CACRB_CopyBack = 31
|
||||
const long CACRF_CopyBack = $80000000
|
||||
const ubyte DMAB_Continue = 1
|
||||
const ubyte DMAF_Continue = $0002
|
||||
const ubyte DMAB_NoModify = 2
|
||||
const ubyte DMAF_NoModify = $0004
|
||||
const ubyte DMAB_ReadFromRAM = 3
|
||||
const ubyte DMAF_ReadFromRAM = $0008
|
||||
const ubyte SB_SAR = 15
|
||||
const uword SF_SAR = $8000
|
||||
const ubyte SB_TQE = 14
|
||||
const uword SF_TQE = $4000
|
||||
const ubyte SB_SINT = 13
|
||||
const uword SF_SINT = $2000
|
||||
const ubyte SIH_PRIMASK = $0F0
|
||||
const ubyte SIH_QUEUES = $0005
|
||||
const ubyte INTB_NMI = 15
|
||||
const uword INTF_NMI = $8000
|
||||
const ubyte IOB_QUICK = 0
|
||||
const ubyte IOF_QUICK = $0001
|
||||
const uword CMD_INVALID = $0000
|
||||
const uword CMD_RESET = $0001
|
||||
const uword CMD_READ = $0002
|
||||
const uword CMD_WRITE = $0003
|
||||
const uword CMD_UPDATE = $0004
|
||||
const uword CMD_CLEAR = $0005
|
||||
const uword CMD_STOP = $0006
|
||||
const uword CMD_START = $0007
|
||||
const uword CMD_FLUSH = $0008
|
||||
const uword CMD_NONSTD = $0009
|
||||
const ubyte LIB_VECTSIZE = $0006
|
||||
const ubyte LIB_RESERVED = $0004
|
||||
const ubyte LIBB_SUMMING = 0
|
||||
const ubyte LIBF_SUMMING = $0001
|
||||
const ubyte LIBB_CHANGED = 1
|
||||
const ubyte LIBF_CHANGED = $0002
|
||||
const ubyte LIBB_SUMUSED = 2
|
||||
const ubyte LIBF_SUMUSED = $0004
|
||||
const ubyte LIBB_DELEXP = 3
|
||||
const ubyte LIBF_DELEXP = $0008
|
||||
const ubyte LIBB_EXP0CNT = 4
|
||||
const ubyte LIBF_EXP0CNT = $0010
|
||||
const ubyte MEMF_ANY = $0000
|
||||
const ubyte MEMB_PUBLIC = 0
|
||||
const ubyte MEMF_PUBLIC = $0001
|
||||
const ubyte MEMB_CHIP = 1
|
||||
const ubyte MEMF_CHIP = $0002
|
||||
const ubyte MEMB_FAST = 2
|
||||
const ubyte MEMF_FAST = $0004
|
||||
const ubyte MEMB_LOCAL = 8
|
||||
const uword MEMF_LOCAL = $0100
|
||||
const ubyte MEMB_24BITDMA = 9
|
||||
const uword MEMF_24BITDMA = $0200
|
||||
const ubyte MEMB_KICK = 10
|
||||
const uword MEMF_KICK = $0400
|
||||
const ubyte MEMB_CLEAR = 16
|
||||
const long MEMF_CLEAR = $00010000
|
||||
const ubyte MEMB_LARGEST = 17
|
||||
const long MEMF_LARGEST = $00020000
|
||||
const ubyte MEMB_REVERSE = 18
|
||||
const long MEMF_REVERSE = $00040000
|
||||
const ubyte MEMB_TOTAL = 19
|
||||
const long MEMF_TOTAL = $00080000
|
||||
const ubyte MEMB_NO_EXPUNGE = 31
|
||||
const long MEMF_NO_EXPUNGE = $80000000
|
||||
const ubyte MEM_BLOCKSIZE = $0008
|
||||
const ubyte MEMHB_RECYCLE = 0
|
||||
const ubyte MEMHF_RECYCLE = $0001
|
||||
const ubyte MEM_DID_NOTHING = $0000
|
||||
const long MEM_ALL_DONE = -1
|
||||
const ubyte MEM_TRY_AGAIN = $0001
|
||||
const ubyte NT_UNKNOWN = $0000
|
||||
const ubyte NT_TASK = $0001
|
||||
const ubyte NT_INTERRUPT = $0002
|
||||
const ubyte NT_DEVICE = $0003
|
||||
const ubyte NT_MSGPORT = $0004
|
||||
const ubyte NT_MESSAGE = $0005
|
||||
const ubyte NT_FREEMSG = $0006
|
||||
const ubyte NT_REPLYMSG = $0007
|
||||
const ubyte NT_RESOURCE = $0008
|
||||
const ubyte NT_LIBRARY = $0009
|
||||
const ubyte NT_MEMORY = $000a
|
||||
const ubyte NT_SOFTINT = $000b
|
||||
const ubyte NT_FONT = $000c
|
||||
const ubyte NT_PROCESS = $000d
|
||||
const ubyte NT_SEMAPHORE = $000e
|
||||
const ubyte NT_SIGNALSEM = $000f
|
||||
const ubyte NT_BOOTNODE = $0010
|
||||
const ubyte NT_KICKMEM = $0011
|
||||
const ubyte NT_GRAPHICS = $0012
|
||||
const ubyte NT_DEATHMESSAGE = $0013
|
||||
const ubyte NT_USER = $00fe
|
||||
const ubyte NT_EXTENDED = $00ff
|
||||
const ubyte PF_ACTION = $0003
|
||||
const ubyte PA_SIGNAL = $0000
|
||||
const ubyte PA_SOFTINT = $0001
|
||||
const ubyte PA_IGNORE = $0002
|
||||
const uword RTC_MATCHWORD = $4AFC
|
||||
const ubyte RTB_COLDSTART = 0
|
||||
const ubyte RTF_COLDSTART = $0001
|
||||
const ubyte RTB_SINGLETASK = 1
|
||||
const ubyte RTF_SINGLETASK = $0002
|
||||
const ubyte RTB_AFTERDOS = 2
|
||||
const ubyte RTF_AFTERDOS = $0004
|
||||
const ubyte RTB_AUTOINIT = 7
|
||||
const ubyte RTF_AUTOINIT = $0080
|
||||
const ubyte RTW_NEVER = $0000
|
||||
const ubyte RTW_COLDSTART = $0001
|
||||
const ubyte EOS = $0000
|
||||
const ubyte BELL = $0007
|
||||
const ubyte LF = $000a
|
||||
const ubyte CR = $000d
|
||||
const ubyte BS = $0008
|
||||
const ubyte DEL = $7F
|
||||
const ubyte TB_PROCTIME = 0
|
||||
const ubyte TF_PROCTIME = $0001
|
||||
const ubyte TB_ETASK = 3
|
||||
const ubyte TF_ETASK = $0008
|
||||
const ubyte TB_STACKCHK = 4
|
||||
const ubyte TF_STACKCHK = $0010
|
||||
const ubyte TB_EXCEPT = 5
|
||||
const ubyte TF_EXCEPT = $0020
|
||||
const ubyte TB_SWITCH = 6
|
||||
const ubyte TF_SWITCH = $0040
|
||||
const ubyte TB_LAUNCH = 7
|
||||
const ubyte TF_LAUNCH = $0080
|
||||
const ubyte TS_INVALID = $0000
|
||||
const ubyte SIGB_ABORT = 0
|
||||
const ubyte SIGF_ABORT = $0001
|
||||
const ubyte SIGB_CHILD = 1
|
||||
const ubyte SIGF_CHILD = $0002
|
||||
const ubyte SIGB_BLIT = 4
|
||||
const ubyte SIGF_BLIT = $0010
|
||||
const ubyte SIGB_SINGLE = 4
|
||||
const ubyte SIGF_SINGLE = $0010
|
||||
const ubyte SIGB_INTUITION = 5
|
||||
const ubyte SIGF_INTUITION = $0020
|
||||
const ubyte SIGB_NET = 7
|
||||
const ubyte SIGF_NET = $0080
|
||||
const ubyte SIGB_DOS = 8
|
||||
const uword SIGF_DOS = $0100
|
||||
const uword SYS_SIGALLOC = $0FFFF
|
||||
const uword SYS_TRAPALLOC = $08000
|
||||
const ubyte INCLUDE_VERSION = $002f
|
||||
const ubyte LIBRARY_MINIMUM = $0021
|
||||
const long ERR_OPENDEVICE = -1
|
||||
const ubyte MEM_BLOCKMASK = $0007
|
||||
const ubyte NL = $000a
|
||||
const ubyte TS_ADDED = $0001
|
||||
const ubyte TS_RUN = $0002
|
||||
const ubyte TS_READY = $0003
|
||||
const ubyte TS_WAIT = $0004
|
||||
const ubyte TS_EXCEPT = $0005
|
||||
const ubyte TS_REMOVED = $0006
|
||||
%option no_symbol_prefixing, ignore_unused
|
||||
}
|
||||
;; End of auto-generated exec_lib.sfd
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,216 +1,5 @@
|
||||
;; Auto-generated from icon_lib.sfd and icon_lib.i
|
||||
;; Library base: _IconBase in prog8: sys.IconBase
|
||||
;; Bank: 11
|
||||
;; Functions: 24
|
||||
|
||||
%import graphics
|
||||
%import intuition
|
||||
%import shared_amiga_icon
|
||||
|
||||
icon {
|
||||
%option no_symbol_prefixing
|
||||
extsub @bank 11 -54 = FreeFreeList(pointer freelist @A0)
|
||||
extsub @bank 11 -72 = AddFreeList(pointer freelist @A0, pointer mem @A1, long size @A2) -> bool @D0
|
||||
extsub @bank 11 -78 = GetDiskObject(str name @A0) -> ^^DiskObject @D0
|
||||
extsub @bank 11 -84 = PutDiskObject(str name @A0, ^^DiskObject diskobj @A1) -> bool @D0
|
||||
extsub @bank 11 -90 = FreeDiskObject(^^DiskObject diskobj @A0)
|
||||
extsub @bank 11 -96 = FindToolType(str toolTypeArray @A0, str typeName @A1) -> pointer @D0
|
||||
extsub @bank 11 -102 = MatchToolValue(str typeString @A0, str value @A1) -> bool @D0
|
||||
extsub @bank 11 -108 = BumpRevision(str newname @A0, str oldname @A1) -> str @D0
|
||||
extsub @bank 11 -114 = FreeAlloc(pointer free @A0, long len @A1, long k_type @A2) -> pointer @D0
|
||||
extsub @bank 11 -120 = GetDefDiskObject(long k_type @D0) -> ^^DiskObject @D0
|
||||
extsub @bank 11 -126 = PutDefDiskObject(^^DiskObject diskObject @A0) -> bool @D0
|
||||
extsub @bank 11 -132 = GetDiskObjectNew(str name @A0) -> ^^DiskObject @D0
|
||||
extsub @bank 11 -138 = DeleteDiskObject(str name @A0) -> bool @D0
|
||||
extsub @bank 11 -144 = FreeFree(pointer fl @A0, pointer address @A1)
|
||||
extsub @bank 11 -150 = DupDiskObjectA(^^DiskObject diskObject @A0, pointer tags @A1) -> ^^DiskObject @D0
|
||||
extsub @bank 11 -156 = IconControlA(^^DiskObject icon @A0, pointer tags @A1) -> long @D0
|
||||
extsub @bank 11 -162 = DrawIconStateA(^^graphics.RastPort rp @A0, ^^DiskObject icon @A1, str label @A2, long leftOffset @D0, long topOffset @D1, long state @D2, pointer tags @A3)
|
||||
extsub @bank 11 -168 = GetIconRectangleA(^^graphics.RastPort rp @A0, ^^DiskObject icon @A1, str label @A2, pointer rect @A3, pointer tags @A4) -> bool @D0
|
||||
extsub @bank 11 -174 = NewDiskObject(long k_type @D0) -> ^^DiskObject @D0
|
||||
extsub @bank 11 -180 = GetIconTagList(str name @A0, pointer tags @A1) -> ^^DiskObject @D0
|
||||
extsub @bank 11 -186 = PutIconTagList(str name @A0, ^^DiskObject icon @A1, pointer tags @A2) -> bool @D0
|
||||
extsub @bank 11 -192 = LayoutIconA(^^DiskObject icon @A0, ^^intuition.Screen screen @A1, pointer tags @A2) -> bool @D0
|
||||
extsub @bank 11 -198 = ChangeToSelectedIconColor(pointer cr @A0)
|
||||
extsub @bank 11 -204 = BumpRevisionLength(str newname @A0, str oldname @A1, long maxLength @D0) -> str @D0
|
||||
|
||||
; ---- struct definitions ----
|
||||
|
||||
struct DiskObject { ; total size: 38
|
||||
uword Magic ; 0
|
||||
uword Version ; 2
|
||||
ubyte[4] emb_do_Gadget ; 4
|
||||
ubyte Type ; 8
|
||||
ubyte Pad_byte ; 9
|
||||
pointer DefaultTool ; 10
|
||||
pointer ToolTypes ; 14
|
||||
long CurrentX ; 18
|
||||
long CurrentY ; 22
|
||||
pointer DrawerData ; 26
|
||||
pointer ToolWindow ; 30
|
||||
long StackSize ; 34
|
||||
}
|
||||
|
||||
; ---- constants ----
|
||||
const ubyte WORKBENCH_WORKBENCH_I = $0001
|
||||
const ubyte WBDISK = $0001
|
||||
const ubyte WBDRAWER = $0002
|
||||
const ubyte WBTOOL = $0003
|
||||
const ubyte WBPROJECT = $0004
|
||||
const ubyte WBGARBAGE = $0005
|
||||
const ubyte WBDEVICE = $0006
|
||||
const ubyte WBKICK = $0007
|
||||
const ubyte WBAPPICON = $0008
|
||||
const ubyte DDVM_BYDEFAULT = $0000
|
||||
const ubyte DDVM_BYICON = $0001
|
||||
const ubyte DDVM_BYNAME = $0002
|
||||
const ubyte DDVM_BYDATE = $0003
|
||||
const ubyte DDVM_BYSIZE = $0004
|
||||
const ubyte DDVM_BYTYPE = $0005
|
||||
const uword DDFLAGS_SHOWMASK = $0003
|
||||
const uword DDFLAGS_SHOWDEFAULT = $0000
|
||||
const uword DDFLAGS_SHOWICONS = $0001
|
||||
const uword DDFLAGS_SHOWALL = $0002
|
||||
const uword DDFLAGS_SORTMASK = $0300
|
||||
const uword DDFLAGS_SORTDEFAULT = $0000
|
||||
const uword DDFLAGS_SORTASC = $0100
|
||||
const uword DDFLAGS_SORTDESC = $0200
|
||||
const uword WB_DISKMAGIC = $e310
|
||||
const ubyte WB_DISKVERSION = $0001
|
||||
const ubyte WB_DISKREVISION = $0001
|
||||
const ubyte WB_DISKREVISIONMASK = $ff
|
||||
const uword GFLG_GADGBACKFILL = $0001
|
||||
const uword GADGBACKFILL = $0001
|
||||
const long NO_ICON_POSITION = $80000000
|
||||
const ubyte AM_VERSION = $0001
|
||||
const ubyte AMTYPE_APPWINDOW = $0007
|
||||
const ubyte AMTYPE_APPICON = $0008
|
||||
const ubyte AMTYPE_APPMENUITEM = $0009
|
||||
const ubyte AMTYPE_APPWINDOWZONE = $000a
|
||||
const ubyte AMCLASSICON_Open = $0000
|
||||
const ubyte AMCLASSICON_Copy = $0001
|
||||
const ubyte AMCLASSICON_Rename = $0002
|
||||
const ubyte AMCLASSICON_Information = $0003
|
||||
const ubyte AMCLASSICON_Snapshot = $0004
|
||||
const ubyte AMCLASSICON_UnSnapshot = $0005
|
||||
const ubyte AMCLASSICON_LeaveOut = $0006
|
||||
const ubyte AMCLASSICON_PutAway = $0007
|
||||
const ubyte AMCLASSICON_Delete = $0008
|
||||
const ubyte AMCLASSICON_FormatDisk = $0009
|
||||
const ubyte AMCLASSICON_EjectDisk = $000d
|
||||
const ubyte AMCLASSICON_EmptyTrash = $000a
|
||||
const ubyte AMCLASSICON_Selected = $000b
|
||||
const ubyte AMCLASSICON_Unselected = $000c
|
||||
const long WBA_Dummy = $8000a000
|
||||
const ubyte SCHMSTATE_TryCleanup = $0000
|
||||
const ubyte SCHMSTATE_Cleanup = $0001
|
||||
const ubyte SCHMSTATE_Setup = $0002
|
||||
const long WBF_DRAWERPOSMASK = $00000003
|
||||
const long WBF_DRAWERPOSFREE = $00000000
|
||||
const long WBF_DRAWERPOSHEAD = $00000001
|
||||
const long WBF_DRAWERPOSTAIL = $00000002
|
||||
const long WBF_BOUNDTEXTVIEW = $00000080
|
||||
const long WBF_OLDDATESFIRST = $00010000
|
||||
const ubyte WBO_NONE = $0000
|
||||
const ubyte WBO_DRAWER = $0001
|
||||
const ubyte WBO_ICON = $0002
|
||||
const ubyte ADZMACTION_Enter = $0000
|
||||
const ubyte ADZMACTION_Leave = $0001
|
||||
const ubyte ISMACTION_Unselect = $0000
|
||||
const ubyte ISMACTION_Select = $0001
|
||||
const ubyte ISMACTION_Ignore = $0002
|
||||
const ubyte ISMACTION_Stop = $0003
|
||||
const ubyte CPACTION_Begin = $0000
|
||||
const ubyte CPACTION_Copy = $0001
|
||||
const ubyte CPACTION_End = $0002
|
||||
const ubyte DLACTION_BeginDiscard = $0000
|
||||
const ubyte DLACTION_BeginEmptyTrash = $0001
|
||||
const ubyte DLACTION_DeleteContents = $0003
|
||||
const ubyte DLACTION_DeleteObject = $0004
|
||||
const ubyte DLACTION_End = $0005
|
||||
const ubyte TIACTION_Rename = $0000
|
||||
const ubyte TIACTION_RelabelVolume = $0001
|
||||
const ubyte TIACTION_NewDrawer = $0002
|
||||
const ubyte TIACTION_Execute = $0003
|
||||
const ubyte UPDATEWB_ObjectRemoved = $0000
|
||||
const ubyte UPDATEWB_ObjectAdded = $0001
|
||||
const long WBAPPICONA_SupportsOpen = $8000a001
|
||||
const long WBAPPICONA_SupportsCopy = $8000a002
|
||||
const long WBAPPICONA_SupportsRename = $8000a003
|
||||
const long WBAPPICONA_SupportsInformation = $8000a004
|
||||
const long WBAPPICONA_SupportsSnapshot = $8000a005
|
||||
const long WBAPPICONA_SupportsUnSnapshot = $8000a006
|
||||
const long WBAPPICONA_SupportsLeaveOut = $8000a007
|
||||
const long WBAPPICONA_SupportsPutAway = $8000a008
|
||||
const long WBAPPICONA_SupportsDelete = $8000a009
|
||||
const long WBAPPICONA_SupportsFormatDisk = $8000a00a
|
||||
const long WBAPPICONA_SupportsEjectDisk = $8000a09e
|
||||
const long WBAPPICONA_SupportsEmptyTrash = $8000a00b
|
||||
const long WBAPPICONA_PropagatePosition = $8000a00c
|
||||
const long WBAPPICONA_RenderHook = $8000a00d
|
||||
const long WBAPPICONA_NotifySelectState = $8000a00e
|
||||
const long WBAPPMENUA_CommandKeyString = $8000a00f
|
||||
const long WBAPPMENUA_GetKey = $8000a041
|
||||
const long WBAPPMENUA_UseKey = $8000a042
|
||||
const long WBAPPMENUA_GetTitleKey = $8000a04d
|
||||
const long WBOPENA_ArgLock = $8000a010
|
||||
const long WBOPENA_ArgName = $8000a011
|
||||
const long WBOPENA_Show = $8000a04b
|
||||
const long WBOPENA_ViewBy = $8000a04c
|
||||
const long WBCTRLA_IsOpen = $8000a012
|
||||
const long WBCTRLA_DuplicateSearchPath = $8000a013
|
||||
const long WBCTRLA_FreeSearchPath = $8000a014
|
||||
const long WBCTRLA_GetDefaultStackSize = $8000a015
|
||||
const long WBCTRLA_SetDefaultStackSize = $8000a016
|
||||
const long WBCTRLA_RedrawAppIcon = $8000a017
|
||||
const long WBCTRLA_GetProgramList = $8000a018
|
||||
const long WBCTRLA_FreeProgramList = $8000a019
|
||||
const long WBCTRLA_GetSelectedIconList = $8000a024
|
||||
const long WBCTRLA_FreeSelectedIconList = $8000a025
|
||||
const long WBCTRLA_GetOpenDrawerList = $8000a026
|
||||
const long WBCTRLA_FreeOpenDrawerList = $8000a027
|
||||
const long WBCTRLA_GetHiddenDeviceList = $8000a02a
|
||||
const long WBCTRLA_FreeHiddenDeviceList = $8000a02b
|
||||
const long WBCTRLA_AddHiddenDeviceName = $8000a02c
|
||||
const long WBCTRLA_RemoveHiddenDeviceName = $8000a02d
|
||||
const long WBCTRLA_GetTypeRestartTime = $8000a02f
|
||||
const long WBCTRLA_SetTypeRestartTime = $8000a030
|
||||
const long WBCTRLA_GetCopyHook = $8000a045
|
||||
const long WBCTRLA_SetCopyHook = $8000a046
|
||||
const long WBCTRLA_GetDeleteHook = $8000a047
|
||||
const long WBCTRLA_SetDeleteHook = $8000a048
|
||||
const long WBCTRLA_GetTextInputHook = $8000a049
|
||||
const long WBCTRLA_SetTextInputHook = $8000a04a
|
||||
const long WBCTRLA_AddSetupCleanupHook = $8000a04e
|
||||
const long WBCTRLA_RemSetupCleanupHook = $8000a04f
|
||||
const long WBCTRLA_SetGlobalFlags = $8000a082
|
||||
const long WBCTRLA_GetGlobalFlags = $8000a083
|
||||
const long WBCTRLA_GetDiskInfoHook = $8000a09f
|
||||
const long WBCTRLA_SetDiskInfoHook = $8000a0a0
|
||||
const long WBDZA_Left = $8000a01a
|
||||
const long WBDZA_RelRight = $8000a01b
|
||||
const long WBDZA_Top = $8000a01c
|
||||
const long WBDZA_RelBottom = $8000a01d
|
||||
const long WBDZA_Width = $8000a01e
|
||||
const long WBDZA_RelWidth = $8000a01f
|
||||
const long WBDZA_Height = $8000a020
|
||||
const long WBDZA_RelHeight = $8000a021
|
||||
const long WBDZA_Box = $8000a022
|
||||
const long WBDZA_Hook = $8000a023
|
||||
const long WBOBJA_Type = $8000a056
|
||||
const long WBOBJA_Left = $8000a057
|
||||
const long WBOBJA_Top = $8000a058
|
||||
const long WBOBJA_Width = $8000a059
|
||||
const long WBOBJA_Height = $8000a05a
|
||||
const long WBOBJA_State = $8000a05b
|
||||
const long WBOBJA_IsFake = $8000a05c
|
||||
const long WBOBJA_Name = $8000a05d
|
||||
const long WBOBJA_NameSize = $8000a05e
|
||||
const long WBOBJA_FullPath = $8000a05f
|
||||
const long WBOBJA_FullPathSize = $8000a060
|
||||
const long WBOBJA_IsLink = $8000a061
|
||||
const long WBOBJA_DrawerPath = $8000a062
|
||||
const long WBOBJA_DrawerPathSize = $8000a063
|
||||
const long WBOBJA_DrawerFlags = $8000a074
|
||||
const long WBOBJA_DrawerModes = $8000a075
|
||||
%option no_symbol_prefixing, ignore_unused
|
||||
}
|
||||
;; End of auto-generated icon_lib.sfd
|
||||
@@ -1,148 +1,5 @@
|
||||
;; Auto-generated from iffparse_lib.sfd and iffparse_lib.i
|
||||
;; Library base: _IFFParseBase in prog8: sys.IFFParseBase
|
||||
;; Bank: 14
|
||||
;; Functions: 40
|
||||
|
||||
%import exec
|
||||
%import utility
|
||||
%import shared_amiga_iffparse
|
||||
|
||||
iffparse {
|
||||
%option no_symbol_prefixing
|
||||
|
||||
sub openlib() -> bool {
|
||||
sys.IFFParseBase = exec.OpenLibrary("iffparse.library", 0)
|
||||
return sys.IFFParseBase!=0
|
||||
}
|
||||
|
||||
sub closelib() {
|
||||
if sys.IFFParseBase!=0 {
|
||||
exec.CloseLibrary(sys.IFFParseBase)
|
||||
sys.IFFParseBase = 0
|
||||
}
|
||||
}
|
||||
|
||||
extsub @bank 14 -30 = AllocIFF() -> ^^IFFHandle @D0
|
||||
extsub @bank 14 -36 = OpenIFF(^^IFFHandle iff @A0, long rwMode @D0) -> long @D0
|
||||
extsub @bank 14 -42 = ParseIFF(^^IFFHandle iff @A0, long control @D0) -> long @D0
|
||||
extsub @bank 14 -48 = CloseIFF(^^IFFHandle iff @A0)
|
||||
extsub @bank 14 -54 = FreeIFF(^^IFFHandle iff @A0)
|
||||
extsub @bank 14 -60 = ReadChunkBytes(^^IFFHandle iff @A0, pointer buf @A1, long numBytes @D0) -> long @D0
|
||||
extsub @bank 14 -66 = WriteChunkBytes(^^IFFHandle iff @A0, pointer buf @A1, long numBytes @D0) -> long @D0
|
||||
extsub @bank 14 -72 = ReadChunkRecords(^^IFFHandle iff @A0, pointer buf @A1, long bytesPerRecord @D0, long numRecords @D1) -> long @D0
|
||||
extsub @bank 14 -78 = WriteChunkRecords(^^IFFHandle iff @A0, pointer buf @A1, long bytesPerRecord @D0, long numRecords @D1) -> long @D0
|
||||
extsub @bank 14 -84 = PushChunk(^^IFFHandle iff @A0, long k_type @D0, long id @D1, long size @D2) -> long @D0
|
||||
extsub @bank 14 -90 = PopChunk(^^IFFHandle iff @A0) -> long @D0
|
||||
extsub @bank 14 -102 = EntryHandler(^^IFFHandle iff @A0, long k_type @D0, long id @D1, long position @D2, ^^utility.Hook handler @A1, pointer object @A2) -> long @D0
|
||||
extsub @bank 14 -108 = ExitHandler(^^IFFHandle iff @A0, long k_type @D0, long id @D1, long position @D2, ^^utility.Hook handler @A1, pointer object @A2) -> long @D0
|
||||
extsub @bank 14 -114 = PropChunk(^^IFFHandle iff @A0, long k_type @D0, long id @D1) -> long @D0
|
||||
extsub @bank 14 -120 = PropChunks(^^IFFHandle iff @A0, pointer propArray @A1, long numPairs @D0) -> long @D0
|
||||
extsub @bank 14 -126 = StopChunk(^^IFFHandle iff @A0, long k_type @D0, long id @D1) -> long @D0
|
||||
extsub @bank 14 -132 = StopChunks(^^IFFHandle iff @A0, pointer propArray @A1, long numPairs @D0) -> long @D0
|
||||
extsub @bank 14 -138 = CollectionChunk(^^IFFHandle iff @A0, long k_type @D0, long id @D1) -> long @D0
|
||||
extsub @bank 14 -144 = CollectionChunks(^^IFFHandle iff @A0, pointer propArray @A1, long numPairs @D0) -> long @D0
|
||||
extsub @bank 14 -150 = StopOnExit(^^IFFHandle iff @A0, long k_type @D0, long id @D1) -> long @D0
|
||||
extsub @bank 14 -156 = FindProp(^^IFFHandle iff @A0, long k_type @D0, long id @D1) -> ^^StoredProperty @D0
|
||||
extsub @bank 14 -162 = FindCollection(^^IFFHandle iff @A0, long k_type @D0, long id @D1) -> ^^CollectionItem @D0
|
||||
extsub @bank 14 -168 = FindPropContext(^^IFFHandle iff @A0) -> ^^ContextNode @D0
|
||||
extsub @bank 14 -174 = CurrentChunk(^^IFFHandle iff @A0) -> ^^ContextNode @D0
|
||||
extsub @bank 14 -180 = ParentChunk(^^ContextNode contextNode @A0) -> ^^ContextNode @D0
|
||||
extsub @bank 14 -186 = AllocLocalItem(long k_type @D0, long id @D1, long ident @D2, long dataSize @D3) -> pointer @D0
|
||||
extsub @bank 14 -192 = LocalItemData(pointer localItem @A0) -> pointer @D0
|
||||
extsub @bank 14 -198 = SetLocalItemPurge(pointer localItem @A0, ^^utility.Hook purgeHook @A1)
|
||||
extsub @bank 14 -204 = FreeLocalItem(pointer localItem @A0)
|
||||
extsub @bank 14 -210 = FindLocalItem(^^IFFHandle iff @A0, long k_type @D0, long id @D1, long ident @D2) -> pointer @D0
|
||||
extsub @bank 14 -216 = StoreLocalItem(^^IFFHandle iff @A0, pointer localItem @A1, long position @D0) -> long @D0
|
||||
extsub @bank 14 -222 = StoreItemInContext(^^IFFHandle iff @A0, pointer localItem @A1, ^^ContextNode contextNode @A2)
|
||||
extsub @bank 14 -228 = InitIFF(^^IFFHandle iff @A0, long flags @D0, ^^utility.Hook streamHook @A1)
|
||||
extsub @bank 14 -234 = InitIFFasDOS(^^IFFHandle iff @A0)
|
||||
extsub @bank 14 -240 = InitIFFasClip(^^IFFHandle iff @A0)
|
||||
extsub @bank 14 -246 = OpenClipboard(long unitNumber @D0) -> pointer @D0
|
||||
extsub @bank 14 -252 = CloseClipboard(pointer clipHandle @A0)
|
||||
extsub @bank 14 -258 = GoodID(long id @D0) -> long @D0
|
||||
extsub @bank 14 -264 = GoodType(long k_type @D0) -> long @D0
|
||||
extsub @bank 14 -270 = IDtoStr(long id @D0, str buf @A0) -> str @D0
|
||||
|
||||
; ---- struct definitions ----
|
||||
|
||||
struct CollectionItem { ; total size: 12
|
||||
^^CollectionItem Next ; 0
|
||||
long Size ; 4
|
||||
pointer Data ; 8
|
||||
}
|
||||
|
||||
struct ContextNode { ; total size: 24
|
||||
^^exec.MinNode Succ ; 0
|
||||
^^exec.MinNode Pred ; 4
|
||||
long Id ; 8
|
||||
long Type ; 12
|
||||
long Size ; 16
|
||||
long Scan ; 20
|
||||
}
|
||||
|
||||
struct IFFHandle { ; total size: 12
|
||||
long Stream ; 0
|
||||
long Flags ; 4
|
||||
long Depth ; 8
|
||||
}
|
||||
|
||||
struct IFFStreamCmd { ; total size: 12
|
||||
long Command ; 0
|
||||
pointer Buf ; 4
|
||||
long NBytes ; 8
|
||||
}
|
||||
|
||||
struct StoredProperty { ; total size: 8
|
||||
long Size ; 0
|
||||
pointer Data ; 4
|
||||
}
|
||||
|
||||
; ---- constants ----
|
||||
const ubyte IFFF_READ = $0000
|
||||
const ubyte IFFF_WRITE = $0001
|
||||
const ubyte IFFF_FSEEK = $0002
|
||||
const ubyte IFFF_RSEEK = $0004
|
||||
const long IFFF_RESERVED = $FFFF0000
|
||||
const long IFFERR_EOF = -1
|
||||
const long IFFERR_EOC = -2
|
||||
const long IFFERR_NOSCOPE = -3
|
||||
const long IFFERR_NOMEM = -4
|
||||
const long IFFERR_READ = -5
|
||||
const long IFFERR_WRITE = -6
|
||||
const long IFFERR_SEEK = -7
|
||||
const long IFFERR_MANGLED = -8
|
||||
const long IFFERR_SYNTAX = -9
|
||||
const long IFFERR_NOTIFF = -10
|
||||
const long IFFERR_NOHOOK = -11
|
||||
const long IFF_RETURN2CLIENT = -12
|
||||
const long ID_FORM = $464f524d
|
||||
const long ID_LIST = $4c495354
|
||||
const long ID_CAT = $43415420
|
||||
const long ID_PROP = $50524f50
|
||||
const long ID_NULL = $20202020
|
||||
const long IFFLCI_PROP = $70726f70
|
||||
const long IFFLCI_COLLECTION = $636f6c6c
|
||||
const long IFFLCI_ENTRYHANDLER = $656e6864
|
||||
const long IFFLCI_EXITHANDLER = $65786864
|
||||
const ubyte IFFPARSE_SCAN = $0000
|
||||
const ubyte IFFPARSE_STEP = $0001
|
||||
const ubyte IFFPARSE_RAWSTEP = $0002
|
||||
const ubyte IFFSLI_ROOT = $0001
|
||||
const ubyte IFFSLI_TOP = $0002
|
||||
const ubyte IFFSLI_PROP = $0003
|
||||
const long IFFSIZE_UNKNOWN = -1
|
||||
const ubyte IFFCMD_INIT = $0000
|
||||
const ubyte IFFCMD_CLEANUP = $0001
|
||||
const ubyte IFFCMD_READ = $0002
|
||||
const ubyte IFFCMD_WRITE = $0003
|
||||
const ubyte IFFCMD_SEEK = $0004
|
||||
const ubyte IFFCMD_ENTRY = $0005
|
||||
const ubyte IFFCMD_EXIT = $0006
|
||||
const ubyte IFFCMD_PURGELCI = $0007
|
||||
const ubyte IFFF_RWBITS = $0001
|
||||
const ubyte IFFSCC_INIT = $0000
|
||||
const ubyte IFFSCC_CLEANUP = $0001
|
||||
const ubyte IFFSCC_READ = $0002
|
||||
const ubyte IFFSCC_WRITE = $0003
|
||||
const ubyte IFFSCC_SEEK = $0004
|
||||
%option no_symbol_prefixing, ignore_unused
|
||||
}
|
||||
;; End of auto-generated iffparse_lib.sfd
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,151 +1,5 @@
|
||||
;; Exec doubly linked lists - usage summary
|
||||
;;
|
||||
;; Purpose: this module is a super thin wrapper over the exec list
|
||||
;; headers and library routines. It exists for source code
|
||||
;; compatibility with other targets that supply their own lists.p8
|
||||
;; implementation. On amiga500 everything simply forwards to exec.library.
|
||||
;;
|
||||
;; Data structures (from Include_H/exec/nodes.h and exec/lists.h):
|
||||
;;
|
||||
;; A full Node is 14 bytes: Succ and Pred pointers at offsets 0 and 4,
|
||||
;; an ubyte Type at 8, a signed priority byte Pri at 9 and a Name
|
||||
;; string pointer at 10. A MinNode holds just the two link pointers
|
||||
;; (8 bytes). The list headers mirror this split: List consists of
|
||||
;; Head, Tail and TailPred pointers plus Type and Pad bytes (14 bytes),
|
||||
;; MinList has only the three pointers (12 bytes). This module aliases
|
||||
;; List/Node to the minimal variants; use FullNode when you need the
|
||||
;; Type/Pri/Name fields.
|
||||
;;
|
||||
;; Layout: an Exec list is a circular doubly linked list in which the
|
||||
;; header itself acts as the sentinel node - there are no separate
|
||||
;; head/tail marker pointers. The header's Tail field stays zero
|
||||
;; forever and serves as terminator: forward traversal via Succ ends
|
||||
;; when it reaches &Header.Tail, backward traversal via Pred ends when
|
||||
;; it reaches the header itself. The first real node's Pred points at
|
||||
;; the header, the last real node's Succ points at &Header.Tail.
|
||||
;;
|
||||
;; Creation and initialization:
|
||||
;; Place the list header in static memory or allocate it, then call
|
||||
;; init(listptr) once before any other use. init() is a thin wrapper
|
||||
;; around exec.NewList(), which sets Head = &Tail, Tail = 0 and
|
||||
;; TailPred = &Head. Nodes need no explicit setup beyond being
|
||||
;; cleared; fill in Type/Pri/Name as needed before using the routines
|
||||
;; below that depend on them. For MinList headers on very new
|
||||
;; Kickstarts there is also NewMinList (LVO -828), but NewList covers
|
||||
;; both variants because their layouts coincide.
|
||||
;;
|
||||
;; Empty test: the list is empty iff TailPred points back at the
|
||||
;; header itself (equivalently Head == &Tail); see is_empty().
|
||||
;;
|
||||
;; Operations (all resolve to exec.library LVO calls):
|
||||
;; - add_head / add_tail: link node at front / back of list
|
||||
;; (AddHead LVO -240, AddTail LVO -246).
|
||||
;; - insert(list, node, pred): links node after the given predecessor
|
||||
;; node anywhere in the list; pred = 0 means insert at head
|
||||
;; (Insert LVO -234).
|
||||
;; - enqueue(list, node): priority-sorted insertion using Pri, placed
|
||||
;; before the first lower-priority node so equal priorities come out
|
||||
;; FIFO. Requires full Nodes (Enqueue LVO -270).
|
||||
;; - remove(node): unlinks a node from whichever list it currently
|
||||
;; sits in; it must actually be linked into one (Remove LVO -252).
|
||||
;; - remove_head / remove_tail: unlink and return the first / last
|
||||
;; node, or null if empty; these give you queue and stack behaviour
|
||||
;; (RemHead LVO -258, RemTail LVO -264).
|
||||
;; - find_name(list, name): linear search over Name strings, returns
|
||||
;; matching node or null; requires full Nodes (FindName LVO -276).
|
||||
;;
|
||||
;; Concurrency warning: none of these routines arbitrate access to
|
||||
;; the list. If tasks or interrupts share a list you must serialize
|
||||
;; access yourself (Forbid/Permit, Disable/Enable, or semaphores).
|
||||
;;
|
||||
;; Allocator agnostic: the routines never allocate or free memory
|
||||
;; themselves, they only link the `pointer` values you pass in. Nodes
|
||||
;; and headers can come from static `[]` variables, `memory()` slabs,
|
||||
;; or any arena/bump allocator such as `arena_alloc(sizeof(MyNode))`
|
||||
;; as `^^MyNode` or `exec.AllocMem` on amiga. Just ensure the
|
||||
;; allocation is suitably aligned (long-aligned on m68k).
|
||||
;;
|
||||
;; Custom nodes: you can define your own node struct for use with the
|
||||
;; exec/lists routines and with `for node in mylist` loops. The only
|
||||
;; requirement is that the link pointers are the first fields at offset
|
||||
;; 0 (Succ at 0, Pred at 4 on 32-bit amiga). Minimal operations only
|
||||
;; need Succ/Pred; enqueue() and find_name() require the full
|
||||
;; Type/Pri/Name layout of exec.Node / lists.FullNode. Define the list
|
||||
;; header with your node type so `for`-iteration infers the correct
|
||||
;; type. Example:
|
||||
;;
|
||||
;; main {
|
||||
;; struct MyNode {
|
||||
;; ^^MyNode Succ ; must be first (offset 0)
|
||||
;; ^^MyNode Pred ; must be second (offset 4)
|
||||
;; ubyte Type ; include for FullNode compatibility if needed
|
||||
;; byte Pri
|
||||
;; str Name
|
||||
;; ubyte value ; your payload follows
|
||||
;; }
|
||||
;; struct MyList {
|
||||
;; ^^MyNode Head
|
||||
;; pointer Tail
|
||||
;; ^^MyNode TailPred
|
||||
;; }
|
||||
;; sub start() {
|
||||
;; ^^MyList mylist = [] ; zero-initialized header
|
||||
;; ^^MyNode n1 = [0, 0, 0, 0, 0, 11] ; Succ, Pred, Type, Pri, Name, value
|
||||
;; ^^MyNode n2 = [0, 0, 0, 0, 0, 22]
|
||||
;; exec.NewList(mylist as ^^exec.List) ; or lists.init(mylist as pointer)
|
||||
;; lists.add_tail(mylist as pointer, n1 as pointer)
|
||||
;; lists.add_tail(mylist as pointer, n2 as pointer)
|
||||
;; ; or directly: exec.AddTail(mylist as pointer, n1 as pointer)
|
||||
;; }
|
||||
;; }
|
||||
|
||||
%import exec
|
||||
%import shared_amiga_lists
|
||||
|
||||
lists {
|
||||
%option ignore_unused
|
||||
|
||||
alias Node = exec.MinNode
|
||||
alias List = exec.MinList
|
||||
alias FullNode = exec.Node
|
||||
|
||||
inline sub init(pointer listptr) {
|
||||
exec.NewList(listptr as ^^exec.List)
|
||||
}
|
||||
|
||||
inline sub is_empty(pointer listptr) -> bool {
|
||||
^^List lst = listptr as ^^List
|
||||
return lst.TailPred == (&lst.Head as ^^Node)
|
||||
}
|
||||
|
||||
inline sub add_head(pointer listptr, pointer node) {
|
||||
exec.AddHead(listptr, node)
|
||||
}
|
||||
|
||||
inline sub add_tail(pointer listptr, pointer node) {
|
||||
exec.AddTail(listptr, node)
|
||||
}
|
||||
|
||||
inline sub insert(pointer listptr, pointer node, pointer pred) {
|
||||
exec.Insert(listptr, node, pred)
|
||||
}
|
||||
|
||||
inline sub remove(pointer node) {
|
||||
exec.Remove(node)
|
||||
}
|
||||
|
||||
inline sub remove_head(pointer listptr) -> pointer {
|
||||
return exec.RemHead(listptr)
|
||||
}
|
||||
|
||||
inline sub remove_tail(pointer listptr) -> pointer {
|
||||
return exec.RemTail(listptr)
|
||||
}
|
||||
|
||||
inline sub enqueue(pointer listptr, pointer node) {
|
||||
exec.Enqueue(listptr, node)
|
||||
}
|
||||
|
||||
inline sub find_name(pointer listptr, str name) -> pointer {
|
||||
return exec.FindName(listptr, name)
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1 +1 @@
|
||||
; TODO
|
||||
%import shared_amiga_sorting
|
||||
@@ -4,6 +4,7 @@
|
||||
%option ignore_unused
|
||||
|
||||
txt {
|
||||
%option ignore_unused
|
||||
asmsub chrout(ubyte char @D0) clobbers(D0,D1,D2,D3,A0,A6) {
|
||||
%asm {{
|
||||
move.l sys.DOSBase,a6
|
||||
|
||||
@@ -1,109 +1,5 @@
|
||||
;; Auto-generated from utility_lib.sfd and utility_lib.i
|
||||
;; Library base: _UtilityBase in prog8: sys.UtilityBase
|
||||
;; Bank: 9
|
||||
;; Functions: 43
|
||||
|
||||
%import exec
|
||||
%import shared_amiga_utility
|
||||
|
||||
utility {
|
||||
%option no_symbol_prefixing
|
||||
extsub @bank 9 -30 = FindTagItem(long tagVal @D0, pointer tagList @A0) -> ^^TagItem @D0
|
||||
extsub @bank 9 -36 = GetTagData(long tagValue @D0, long defaultVal @D1, pointer tagList @A0) -> long @D0
|
||||
extsub @bank 9 -42 = PackBoolTags(long initialFlags @D0, pointer tagList @A0, pointer boolMap @A1) -> long @D0
|
||||
extsub @bank 9 -48 = NextTagItem(pointer tagListPtr @A0) -> ^^TagItem @D0
|
||||
extsub @bank 9 -54 = FilterTagChanges(pointer changeList @A0, pointer originalList @A1, long apply @D0)
|
||||
extsub @bank 9 -60 = MapTags(pointer tagList @A0, pointer mapList @A1, long mapType @D0)
|
||||
extsub @bank 9 -66 = AllocateTagItems(long numTags @D0) -> ^^TagItem @D0
|
||||
extsub @bank 9 -72 = CloneTagItems(pointer tagList @A0) -> ^^TagItem @D0
|
||||
extsub @bank 9 -78 = FreeTagItems(pointer tagList @A0)
|
||||
extsub @bank 9 -84 = RefreshTagItemClones(pointer clone @A0, pointer original @A1)
|
||||
extsub @bank 9 -90 = TagInArray(long tagValue @D0, pointer tagArray @A0) -> bool @D0
|
||||
extsub @bank 9 -96 = FilterTagItems(pointer tagList @A0, pointer filterArray @A1, long logic @D0) -> long @D0
|
||||
extsub @bank 9 -102 = CallHookPkt(^^Hook hook @A0, pointer object @A2, pointer paramPacket @A1) -> long @D0
|
||||
extsub @bank 9 -120 = Amiga2Date(long seconds @D0, ^^ClockData result @A0)
|
||||
extsub @bank 9 -126 = Date2Amiga(^^ClockData date @A0) -> long @D0
|
||||
extsub @bank 9 -132 = CheckDate(^^ClockData date @A0) -> long @D0
|
||||
extsub @bank 9 -138 = SMult32(long arg1 @D0, long arg2 @D1) -> long @D0
|
||||
extsub @bank 9 -144 = UMult32(long arg1 @D0, long arg2 @D1) -> long @D0
|
||||
extsub @bank 9 -150 = SDivMod32(long dividend @D0, long divisor @D1) -> long @D0
|
||||
extsub @bank 9 -156 = UDivMod32(long dividend @D0, long divisor @D1) -> long @D0
|
||||
extsub @bank 9 -162 = Stricmp(str string1 @A0, str string2 @A1) -> long @D0
|
||||
extsub @bank 9 -168 = Strnicmp(str string1 @A0, str string2 @A1, long length @D0) -> long @D0
|
||||
extsub @bank 9 -174 = ToUpper(ubyte character @D0) -> ubyte @D0
|
||||
extsub @bank 9 -180 = ToLower(ubyte character @D0) -> ubyte @D0
|
||||
extsub @bank 9 -186 = ApplyTagChanges(pointer list @A0, pointer changeList @A1)
|
||||
extsub @bank 9 -198 = SMult64(long arg1 @D0, long arg2 @D1) -> long @D0
|
||||
extsub @bank 9 -204 = UMult64(long arg1 @D0, long arg2 @D1) -> long @D0
|
||||
extsub @bank 9 -210 = PackStructureTags(pointer pack @A0, pointer packTable @A1, pointer tagList @A2) -> long @D0
|
||||
extsub @bank 9 -216 = UnpackStructureTags(pointer pack @A0, pointer packTable @A1, pointer tagList @A2) -> long @D0
|
||||
extsub @bank 9 -222 = AddNamedObject(pointer nameSpace @A0, pointer object @A1) -> bool @D0
|
||||
extsub @bank 9 -228 = AllocNamedObjectA(str name @A0, pointer tagList @A1) -> pointer @D0
|
||||
extsub @bank 9 -234 = AttemptRemNamedObject(pointer object @A0) -> long @D0
|
||||
extsub @bank 9 -240 = FindNamedObject(pointer nameSpace @A0, str name @A1, pointer lastObject @A2) -> pointer @D0
|
||||
extsub @bank 9 -246 = FreeNamedObject(pointer object @A0)
|
||||
extsub @bank 9 -252 = NamedObjectName(pointer object @A0) -> str @D0
|
||||
extsub @bank 9 -258 = ReleaseNamedObject(pointer object @A0)
|
||||
extsub @bank 9 -264 = RemNamedObject(pointer object @A0, ^^exec.Message message @A1)
|
||||
extsub @bank 9 -270 = GetUniqueID() -> long @D0
|
||||
extsub @bank 9 -312 = VSNPrintf(str buffer @A0, long bufsize @D0, str fmt @A1, pointer data @A2) -> long @D0
|
||||
extsub @bank 9 -438 = Strncpy(str dst @A1, str src @A0, long size @D0) -> str @D0
|
||||
extsub @bank 9 -444 = Strncat(str dst @A1, str src @A0, long size @D0) -> str @D0
|
||||
extsub @bank 9 -450 = SDivMod64(long hi @D1, long lo @D0, long divisor @D2) -> long @D0
|
||||
extsub @bank 9 -456 = UDivMod64(long hi @D1, long lo @D0, long divisor @D2) -> long @D0
|
||||
|
||||
; ---- struct definitions ----
|
||||
|
||||
struct ClockData { ; total size: 14
|
||||
uword Sec ; 0
|
||||
uword Min ; 2
|
||||
uword Hour ; 4
|
||||
uword Mday ; 6
|
||||
uword Month ; 8
|
||||
uword Year ; 10
|
||||
uword Wday ; 12
|
||||
}
|
||||
|
||||
struct Hook { ; total size: 20
|
||||
^^exec.MinNode Succ ; 0
|
||||
^^exec.MinNode Pred ; 4
|
||||
pointer Entry ; 8
|
||||
pointer SubEntry ; 12
|
||||
pointer Data ; 16
|
||||
}
|
||||
|
||||
struct TagItem { ; total size: 8
|
||||
long Tag ; 0
|
||||
long Data ; 4
|
||||
}
|
||||
|
||||
; ---- constants ----
|
||||
const ubyte UTILITY_NAME_I = $0001
|
||||
const uword ANO_NameSpace = $0fa0
|
||||
const uword ANO_UserSpace = $0fa1
|
||||
const uword ANO_Priority = $0fa2
|
||||
const uword ANO_Flags = $0fa3
|
||||
const ubyte NSB_NODUPS = 0
|
||||
const ubyte NSF_NODUPS = $0001
|
||||
const ubyte NSB_CASE = 1
|
||||
const ubyte NSF_CASE = $0002
|
||||
const ubyte UTILITY_PACK_I = $0001
|
||||
const ubyte PSTB_SIGNED = 31
|
||||
const long PSTF_SIGNED = $80000000
|
||||
const ubyte PSTB_UNPACK = 30
|
||||
const long PSTF_UNPACK = $40000000
|
||||
const ubyte PSTB_PACK = 29
|
||||
const long PSTF_PACK = $20000000
|
||||
const ubyte PSTB_EXISTS = 26
|
||||
const long PSTF_EXISTS = $04000000
|
||||
const ubyte TAG_DONE = $0000
|
||||
const ubyte TAG_END = $0000
|
||||
const ubyte TAG_IGNORE = $0001
|
||||
const ubyte TAG_MORE = $0002
|
||||
const ubyte TAG_SKIP = $0003
|
||||
const long TAG_USER = $80000000
|
||||
const ubyte TAGFILTER_AND = $0000
|
||||
const ubyte TAGFILTER_NOT = $0001
|
||||
const ubyte MAP_REMOVE_NOT_FOUND = $0000
|
||||
const ubyte MAP_KEEP_NOT_FOUND = $0001
|
||||
%option no_symbol_prefixing, ignore_unused
|
||||
}
|
||||
;; End of auto-generated utility_lib.sfd
|
||||
@@ -0,0 +1,223 @@
|
||||
;; Auto-generated from arexx_lib.sfd and arexx_lib.i
|
||||
;; Library base: _RexxSysBase in prog8: sys.RexxSysBase
|
||||
;; Bank: 29
|
||||
;; Functions: 17
|
||||
|
||||
%import exec
|
||||
|
||||
arexx {
|
||||
%option merge, no_symbol_prefixing
|
||||
|
||||
sub openlib() -> bool {
|
||||
sys.RexxSysBase = exec.OpenLibrary("rexxsyslib.library", 0)
|
||||
return sys.RexxSysBase!=0
|
||||
}
|
||||
|
||||
sub closelib() {
|
||||
if sys.RexxSysBase!=0 {
|
||||
exec.CloseLibrary(sys.RexxSysBase)
|
||||
sys.RexxSysBase = 0
|
||||
}
|
||||
}
|
||||
|
||||
extsub @bank 29 -126 = CreateArgstring(str string @A0, long length @D0) -> pointer @D0
|
||||
extsub @bank 29 -132 = DeleteArgstring(pointer argstring @A0)
|
||||
extsub @bank 29 -138 = LengthArgstring(pointer argstring @A0) -> long @D0
|
||||
extsub @bank 29 -144 = CreateRexxMsg(^^exec.MsgPort port @A0, str extension @A1, str host @D0) -> ^^RexxMsg @D0
|
||||
extsub @bank 29 -150 = DeleteRexxMsg(^^RexxMsg packet @A0)
|
||||
extsub @bank 29 -156 = ClearRexxMsg(^^RexxMsg msgptr @A0, long count @D0)
|
||||
extsub @bank 29 -162 = FillRexxMsg(^^RexxMsg msgptr @A0, long count @D0, long mask @D1) -> bool @D0
|
||||
extsub @bank 29 -168 = IsRexxMsg(^^RexxMsg msgptr @A0) -> bool @D0
|
||||
extsub @bank 29 -450 = LockRexxBase(long resource @D0)
|
||||
extsub @bank 29 -456 = UnlockRexxBase(long resource @D0)
|
||||
extsub @bank 29 -480 = CreateRexxHostPort(str basename @A0) -> ^^exec.MsgPort @D0
|
||||
extsub @bank 29 -486 = DeleteRexxHostPort(^^exec.MsgPort port @A0)
|
||||
extsub @bank 29 -492 = GetRexxVarFromMsg(str var @A0, ^^RexxMsg msgptr @A2, str value @A1) -> long @D0
|
||||
extsub @bank 29 -498 = SetRexxVarFromMsg(str var @A0, ^^RexxMsg msgptr @A2, str value @A1) -> long @D0
|
||||
extsub @bank 29 -504 = LaunchRexxScript(str script @A0, ^^exec.MsgPort replyport @A1, str extension @A2, pointer input @D1, pointer output @D2) -> ^^RexxMsg @D0
|
||||
extsub @bank 29 -510 = FreeRexxMsg(^^RexxMsg msgptr @A0)
|
||||
extsub @bank 29 -516 = GetRexxBufferFromMsg(str var @A0, ^^RexxMsg msgptr @A2, str buffer @A1, long buffer_size @D0) -> long @D0
|
||||
|
||||
; ---- struct definitions ----
|
||||
|
||||
struct RexxMsg { ; total size: 128
|
||||
^^exec.Node Succ ; 0
|
||||
^^exec.Node Pred ; 4
|
||||
ubyte Type ; 8
|
||||
byte Pri ; 9
|
||||
str Name ; 10
|
||||
^^exec.MsgPort ReplyPort ; 14
|
||||
uword Length ; 18
|
||||
pointer TaskBlock ; 20
|
||||
pointer LibBase ; 24
|
||||
long Action ; 28
|
||||
long Result1 ; 32
|
||||
long Result2 ; 36
|
||||
str[16] Args ; 40
|
||||
^^exec.MsgPort PassPort ; 104
|
||||
str CommAddr ; 108
|
||||
str FileExt ; 112
|
||||
long Stdin ; 116
|
||||
long Stdout ; 120
|
||||
long Avail ; 124
|
||||
}
|
||||
|
||||
; ---- constants ----
|
||||
const ubyte ERRC_MSG = $0000
|
||||
const long RC_FAIL = -1
|
||||
const ubyte RC_OK = $0000
|
||||
const ubyte RC_WARN = $0005
|
||||
const ubyte RC_ERROR = $000a
|
||||
const ubyte RC_FATAL = $0014
|
||||
const ubyte RXBUFFSZ = $00cc
|
||||
const long RXIO_EXIST = -1
|
||||
const ubyte RXIO_STRF = $0000
|
||||
const ubyte RXIO_READ = $0001
|
||||
const ubyte RXIO_WRITE = $0002
|
||||
const ubyte RXIO_APPEND = $0003
|
||||
const long RXIO_BEGIN = -1
|
||||
const ubyte RXIO_CURR = $0000
|
||||
const ubyte RXIO_END = $0001
|
||||
const ubyte DT_DEV = $0000
|
||||
const ubyte DT_DIR = $0001
|
||||
const ubyte DT_VOL = $0002
|
||||
const uword ACTION_STACK = $07d2
|
||||
const uword ACTION_QUEUE = $07d3
|
||||
const ubyte RLFB_STOP = $0006
|
||||
const ubyte RLFB_CLOSE = $0007
|
||||
const ubyte RLFMASK = $0001
|
||||
const uword RXSCHUNK = $0400
|
||||
const ubyte RXSNEST = $0020
|
||||
const ubyte RXSTPRI = $0000
|
||||
const uword RXSSTACK = $1000
|
||||
const ubyte CTB_SPACE = $0000
|
||||
const ubyte CTB_DIGIT = $0001
|
||||
const ubyte CTB_ALPHA = $0002
|
||||
const ubyte CTB_REXXSYM = $0003
|
||||
const ubyte CTB_REXXOPR = $0004
|
||||
const ubyte CTB_REXXSPC = $0005
|
||||
const ubyte CTB_UPPER = $0006
|
||||
const ubyte CTB_LOWER = $0007
|
||||
const ubyte CTF_SPACE = $0001
|
||||
const ubyte CTF_DIGIT = $0001
|
||||
const ubyte CTF_ALPHA = $0001
|
||||
const ubyte CTF_REXXSYM = $0001
|
||||
const ubyte CTF_REXXOPR = $0001
|
||||
const ubyte CTF_REXXSPC = $0001
|
||||
const ubyte CTF_UPPER = $0001
|
||||
const ubyte CTF_LOWER = $0001
|
||||
const ubyte NSB_KEEP = $0000
|
||||
const ubyte NSB_STRING = $0001
|
||||
const ubyte NSB_NOTNUM = $0002
|
||||
const ubyte NSB_NUMBER = $0003
|
||||
const ubyte NSB_BINARY = $0004
|
||||
const ubyte NSB_FLOAT = $0005
|
||||
const ubyte NSB_EXT = $0006
|
||||
const ubyte NSB_SOURCE = $0007
|
||||
const ubyte NSF_KEEP = $0001
|
||||
const ubyte NSF_STRING = $0001
|
||||
const ubyte NSF_NOTNUM = $0001
|
||||
const ubyte NSF_NUMBER = $0001
|
||||
const ubyte NSF_BINARY = $0001
|
||||
const ubyte NSF_FLOAT = $0001
|
||||
const ubyte NSF_EXT = $0001
|
||||
const ubyte NSF_SOURCE = $0001
|
||||
const ubyte MAXRMARG = $000f
|
||||
const long RXCOMM = $01000000
|
||||
const long RXFUNC = $02000000
|
||||
const long RXCLOSE = $03000000
|
||||
const long RXQUERY = $04000000
|
||||
const long RXADDFH = $07000000
|
||||
const long RXADDLIB = $08000000
|
||||
const long RXREMLIB = $09000000
|
||||
const long RXADDCON = $0A000000
|
||||
const long RXREMCON = $0B000000
|
||||
const long RXTCOPN = $0C000000
|
||||
const long RXTCCLS = $0D000000
|
||||
const ubyte RXFB_NOIO = $0010
|
||||
const ubyte RXFB_RESULT = $0011
|
||||
const ubyte RXFB_STRING = $0012
|
||||
const ubyte RXFB_TOKEN = $0013
|
||||
const ubyte RXFB_NONRET = $0014
|
||||
const ubyte RXFB_SCRIPT = $0015
|
||||
const ubyte RXFF_RESULT = $0001
|
||||
const ubyte RXFF_STRING = $0001
|
||||
const ubyte RXFF_TOKEN = $0001
|
||||
const ubyte RXFF_NONRET = $0001
|
||||
const ubyte RXFF_SCRIPT = $0001
|
||||
const long RXCODEMASK = $FF000000
|
||||
const long RXARGMASK = $0000000F
|
||||
const ubyte RRT_ANY = $0000
|
||||
const ubyte RRT_LIB = $0001
|
||||
const ubyte RRT_PORT = $0002
|
||||
const ubyte RRT_FILE = $0003
|
||||
const ubyte RRT_HOST = $0004
|
||||
const ubyte RRT_CLIP = $0005
|
||||
const ubyte GLOBALSZ = $00c8
|
||||
const ubyte NUMLISTS = $0005
|
||||
const ubyte RTFB_TRACE = $0000
|
||||
const ubyte RTFB_HALT = $0001
|
||||
const ubyte RTFB_SUSP = $0002
|
||||
const ubyte RTFB_TCUSE = $0003
|
||||
const ubyte RTFB_WAIT = $0006
|
||||
const ubyte RTFB_CLOSE = $0007
|
||||
const ubyte MEMQUANT = $0010
|
||||
const long MEMMASK = $FFFFFFF0
|
||||
const ubyte MEMQUICK = $0001
|
||||
const long MEMCLEAR = $00010000
|
||||
const ubyte ERR10_001 = $0001
|
||||
const ubyte ERR10_002 = $0002
|
||||
const ubyte ERR10_003 = $0003
|
||||
const ubyte ERR10_005 = $0005
|
||||
const ubyte ERR10_006 = $0006
|
||||
const ubyte ERR10_008 = $0008
|
||||
const ubyte ERR10_009 = $0009
|
||||
const ubyte ERR10_010 = $000a
|
||||
const ubyte ERR10_011 = $000b
|
||||
const ubyte ERR10_012 = $000c
|
||||
const ubyte ERR10_013 = $000d
|
||||
const ubyte ERR10_014 = $000e
|
||||
const ubyte ERR10_015 = $000f
|
||||
const ubyte ERR10_016 = $0010
|
||||
const ubyte ERR10_017 = $0011
|
||||
const ubyte ERR10_018 = $0012
|
||||
const ubyte ERR10_019 = $0013
|
||||
const ubyte ERR10_020 = $0014
|
||||
const ubyte ERR10_021 = $0015
|
||||
const ubyte ERR10_022 = $0016
|
||||
const ubyte ERR10_023 = $0017
|
||||
const ubyte ERR10_024 = $0018
|
||||
const ubyte ERR10_025 = $0019
|
||||
const ubyte ERR10_026 = $001a
|
||||
const ubyte ERR10_027 = $001b
|
||||
const ubyte ERR10_028 = $001c
|
||||
const ubyte ERR10_029 = $001d
|
||||
const ubyte ERR10_030 = $001e
|
||||
const ubyte ERR10_031 = $001f
|
||||
const ubyte ERR10_032 = $0020
|
||||
const ubyte ERR10_033 = $0021
|
||||
const ubyte ERR10_034 = $0022
|
||||
const ubyte ERR10_035 = $0023
|
||||
const ubyte ERR10_036 = $0024
|
||||
const ubyte ERR10_037 = $0025
|
||||
const ubyte ERR10_039 = $0027
|
||||
const ubyte ERR10_040 = $0028
|
||||
const ubyte ERR10_041 = $0029
|
||||
const ubyte ERR10_042 = $002a
|
||||
const ubyte ERR10_043 = $002b
|
||||
const ubyte ERR10_044 = $002c
|
||||
const ubyte ERR10_045 = $002d
|
||||
const ubyte ERR10_046 = $002e
|
||||
const ubyte ERR10_047 = $002f
|
||||
const ubyte ERR10_048 = $0030
|
||||
const ubyte RLFB_TRACE = $0000
|
||||
const ubyte RLFB_HALT = $0001
|
||||
const ubyte RLFB_SUSP = $0002
|
||||
const ubyte NSF_INTNUM = $0001
|
||||
const ubyte NSF_DPNUM = $0001
|
||||
const ubyte NSF_ALPHA = $0001
|
||||
const ubyte NSF_OWNED = $0001
|
||||
const ubyte KEEPSTR = $0001
|
||||
const ubyte KEEPNUM = $0001
|
||||
}
|
||||
;; End of auto-generated arexx_lib.sfd
|
||||
@@ -0,0 +1,296 @@
|
||||
%import exec
|
||||
%import syslib
|
||||
|
||||
audio {
|
||||
%option merge, no_symbol_prefixing, ignore_unused
|
||||
|
||||
; audio.device IO commands:
|
||||
const uword ADCMD_FREE = 9
|
||||
const uword ADCMD_SETPREC = 10
|
||||
const uword ADCMD_FINISH = 11
|
||||
const uword ADCMD_PERVOL = 12
|
||||
const uword ADCMD_LOCK = 13
|
||||
const uword ADCMD_WAITCYCLE = 14
|
||||
const uword ADCMD_ALLOCATE = 32
|
||||
|
||||
; IOAudio flags (explicit ubyte values):
|
||||
const ubyte ADIOB_PERVOL = 4
|
||||
const ubyte ADIOF_PERVOL = $10
|
||||
const ubyte ADIOB_SYNCCYCLE = 5
|
||||
const ubyte ADIOF_SYNCCYCLE = $20
|
||||
const ubyte ADIOB_NOWAIT = 6
|
||||
const ubyte ADIOF_NOWAIT = $40
|
||||
const ubyte ADIOB_WRITEMESSAGE = 7
|
||||
const ubyte ADIOF_WRITEMESSAGE = $80
|
||||
|
||||
; IOAudio error codes:
|
||||
const byte ADIOERR_NOALLOCATION = -10
|
||||
const byte ADIOERR_ALLOCFAILED = -11
|
||||
const byte ADIOERR_CHANNELSTOLEN = -12
|
||||
|
||||
; hardware constants:
|
||||
const uword ADHARD_CHANNELS = 4
|
||||
const byte ADALLOC_MINPREC = -128
|
||||
const byte ADALLOC_MAXPREC = 127
|
||||
|
||||
struct IOAudio {
|
||||
; struct IORequest (base, 32 bytes)
|
||||
^^exec.Node Succ ; 0
|
||||
^^exec.Node Pred ; 4
|
||||
ubyte Type ; 8
|
||||
byte Pri ; 9
|
||||
str Name ; 10
|
||||
^^exec.MsgPort ReplyPort ; 14
|
||||
uword Length ; 18
|
||||
pointer Device ; 20
|
||||
pointer Unit ; 24
|
||||
uword Command ; 28
|
||||
ubyte Flags ; 30
|
||||
byte Error ; 31
|
||||
; struct IOAudio specific fields
|
||||
word AllocKey ; 32
|
||||
pointer Data ; 34
|
||||
long IOAudio_Length ; 38
|
||||
uword Period ; 42
|
||||
uword Volume ; 44
|
||||
uword Cycles ; 46
|
||||
; struct Message ioa_WriteMsg (20 bytes)
|
||||
^^exec.Node Msg_Succ ; 48
|
||||
^^exec.Node Msg_Pred ; 52
|
||||
ubyte Msg_Type ; 56
|
||||
byte Msg_Pri ; 57
|
||||
str Msg_Name ; 58
|
||||
^^exec.MsgPort Msg_ReplyPort ; 62
|
||||
uword Msg_Length ; 66
|
||||
}
|
||||
|
||||
; 4 audio channel I/O structures to address each channel individually
|
||||
^^IOAudio AudioIO0 = []
|
||||
^^IOAudio AudioIO1 = []
|
||||
^^IOAudio AudioIO2 = []
|
||||
^^IOAudio AudioIO3 = []
|
||||
|
||||
private ^^exec.MsgPort msgport0 = []
|
||||
private ^^exec.MsgPort msgport1 = []
|
||||
private ^^exec.MsgPort msgport2 = []
|
||||
private ^^exec.MsgPort msgport3 = []
|
||||
private bool[4] active_channels
|
||||
|
||||
; Separate control-request structures for the ADCMD_* control commands.
|
||||
; An IORequest carrying an in-flight CMD_WRITE is queued inside audio.device
|
||||
; and must not be reused for another command, so the controls get their own.
|
||||
private ^^IOAudio CtrlIO0 = []
|
||||
private ^^IOAudio CtrlIO1 = []
|
||||
private ^^IOAudio CtrlIO2 = []
|
||||
private ^^IOAudio CtrlIO3 = []
|
||||
|
||||
; ---- high level audio interface ----
|
||||
|
||||
sub init() -> bool {
|
||||
; -- Initialize the audio device on all 4 channels.
|
||||
ubyte[1] channel_matrix = [15] ; allocate all 4 channels at once
|
||||
for ubyte channel in 0 to 3
|
||||
active_channels[channel] = false
|
||||
return opendevice(channel_matrix, 1, 0)
|
||||
}
|
||||
|
||||
sub closedown() {
|
||||
; -- Close down the audio device on all 4 channels. Does not wait for sounds to finish playing.
|
||||
stop_all()
|
||||
closedevice()
|
||||
for ubyte channel in 0 to 3
|
||||
active_channels[channel] = false
|
||||
}
|
||||
|
||||
sub play(ubyte channel, ^^byte samples, long num_samples, uword sample_rate, ubyte volume, uword cycles) {
|
||||
; -- Play a sample asynchronously on the given channel (0-3), with the given parameters.
|
||||
^^IOAudio io = get_io(channel)
|
||||
io.Command = exec.CMD_WRITE
|
||||
io.Flags = ADIOF_PERVOL
|
||||
io.Data = samples
|
||||
io.IOAudio_Length = num_samples
|
||||
io.Period = period(sample_rate)
|
||||
io.Volume = volume
|
||||
io.Cycles = cycles
|
||||
BeginIO(io) ; not exec.DoIO/SendIO: those clear io_Flags, wiping ADIOF_PERVOL!
|
||||
active_channels[channel] = true
|
||||
; sound now plays asynchronously.
|
||||
}
|
||||
|
||||
sub wait_channel(ubyte channel) {
|
||||
; wait for the current sound on this channel to finish playing.
|
||||
if active_channels[channel] {
|
||||
void exec.WaitIO(get_io(channel))
|
||||
active_channels[channel] = false
|
||||
}
|
||||
}
|
||||
|
||||
sub wait_all() {
|
||||
; wait for all channels to finish playing their sounds.
|
||||
wait_channel(0)
|
||||
wait_channel(1)
|
||||
wait_channel(2)
|
||||
wait_channel(3)
|
||||
}
|
||||
|
||||
sub stop(ubyte channel) {
|
||||
; -- Abort the sound currently playing on this channel (ADCMD_FINISH).
|
||||
; The sound stops immediately; blocks until the aborted write request has completed.
|
||||
if not active_channels[channel]
|
||||
return
|
||||
^^IOAudio ctrl = get_ctrl(channel)
|
||||
ctrl.Command = ADCMD_FINISH
|
||||
ctrl.Flags = 0
|
||||
BeginIO(ctrl)
|
||||
void exec.WaitIO(ctrl) ; reap the control request
|
||||
void exec.WaitIO(get_io(channel)) ; reap the aborted write request
|
||||
active_channels[channel] = false
|
||||
}
|
||||
|
||||
sub stop_all() {
|
||||
; -- Abort the sounds currently playing on all channels.
|
||||
stop(0)
|
||||
stop(1)
|
||||
stop(2)
|
||||
stop(3)
|
||||
}
|
||||
|
||||
sub set_freqvol(ubyte channel, uword samplerate, ubyte volume) {
|
||||
; -- Change the playback rate and volume of the sound currently playing on this channel (ADCMD_PERVOL).
|
||||
; Takes effect immediately. Both are always set together: ADCMD_PERVOL has no way to change just one.
|
||||
if not active_channels[channel]
|
||||
return
|
||||
^^IOAudio ctrl = get_ctrl(channel)
|
||||
ctrl.Command = ADCMD_PERVOL
|
||||
ctrl.Flags = 0
|
||||
ctrl.Period = period(samplerate)
|
||||
ctrl.Volume = volume
|
||||
BeginIO(ctrl)
|
||||
}
|
||||
|
||||
inline sub is_playing(ubyte channel) -> bool {
|
||||
; -- Returns true while a sound is playing on this channel,
|
||||
; i.e. between play() and wait_channel()/wait_all()/stop().
|
||||
return active_channels[channel]
|
||||
}
|
||||
|
||||
|
||||
; ---- low level audio interface ----
|
||||
|
||||
sub opendevice(pointer channelPrefs, ubyte prefsLen, byte precedence) -> bool {
|
||||
; Set channel allocation preferences before opening
|
||||
AudioIO0.Pri = precedence
|
||||
AudioIO0.AllocKey = 0
|
||||
AudioIO0.Data = channelPrefs
|
||||
AudioIO0.IOAudio_Length = prefsLen
|
||||
|
||||
if exec.OpenDevice("audio.device", 0, AudioIO0, 0)!=0 {
|
||||
AudioIO0.Type = 0
|
||||
return false
|
||||
}
|
||||
|
||||
; Clone the other 3 IOAudio instances via CopyMem
|
||||
; This preserves AllocKey and channel binding from OpenDevice
|
||||
AudioIO1^^ = AudioIO0^^
|
||||
AudioIO2^^ = AudioIO0^^
|
||||
AudioIO3^^ = AudioIO0^^
|
||||
AudioIO0.Unit = 1 ; channel 1
|
||||
AudioIO1.Unit = 2 ; channel 2
|
||||
AudioIO2.Unit = 4 ; channel 3
|
||||
AudioIO3.Unit = 8 ; channel 4
|
||||
|
||||
; Allocate separate MsgPorts for each cloned IOAudio
|
||||
AudioIO0.ReplyPort = init_msgport(msgport0)
|
||||
AudioIO1.ReplyPort = init_msgport(msgport1)
|
||||
AudioIO2.ReplyPort = init_msgport(msgport2)
|
||||
AudioIO3.ReplyPort = init_msgport(msgport3)
|
||||
|
||||
; Clone the channel bindings into the control structures
|
||||
CtrlIO0^^ = AudioIO0^^
|
||||
CtrlIO1^^ = AudioIO1^^
|
||||
CtrlIO2^^ = AudioIO2^^
|
||||
CtrlIO3^^ = AudioIO3^^
|
||||
|
||||
return true
|
||||
|
||||
private sub init_msgport(^^exec.MsgPort port) -> ^^exec.MsgPort {
|
||||
port.Type = exec.NT_MSGPORT
|
||||
port.Flags = exec.PA_SIGNAL
|
||||
port.SigBit = exec.AllocSignal(-1) as ubyte
|
||||
port.SigTask = exec.FindTask(0)
|
||||
exec.NewList(&port.Head)
|
||||
return port
|
||||
}
|
||||
}
|
||||
|
||||
sub closedevice() {
|
||||
if AudioIO0.Type == 0
|
||||
return
|
||||
|
||||
exec.CloseDevice(AudioIO0)
|
||||
^^exec.MsgPort port = AudioIO0.ReplyPort
|
||||
exec.FreeSignal(port.SigBit as byte)
|
||||
port = AudioIO1.ReplyPort
|
||||
exec.FreeSignal(port.SigBit as byte)
|
||||
port = AudioIO2.ReplyPort
|
||||
exec.FreeSignal(port.SigBit as byte)
|
||||
port = AudioIO3.ReplyPort
|
||||
exec.FreeSignal(port.SigBit as byte)
|
||||
AudioIO0.Type = 0
|
||||
AudioIO1.Type = 0
|
||||
AudioIO2.Type = 0
|
||||
AudioIO3.Type = 0
|
||||
}
|
||||
|
||||
sub get_io(ubyte channel) -> ^^IOAudio {
|
||||
when channel {
|
||||
0 -> return AudioIO0
|
||||
1 -> return AudioIO1
|
||||
2 -> return AudioIO2
|
||||
else -> return AudioIO3
|
||||
}
|
||||
}
|
||||
|
||||
private sub get_ctrl(ubyte channel) -> ^^IOAudio {
|
||||
when channel {
|
||||
0 -> return CtrlIO0
|
||||
1 -> return CtrlIO1
|
||||
2 -> return CtrlIO2
|
||||
else -> return CtrlIO3
|
||||
}
|
||||
}
|
||||
|
||||
sub period(uword samplerate) -> uword {
|
||||
; calculate the Period to use for the desired sample rate
|
||||
return clock() / samplerate as uword
|
||||
}
|
||||
|
||||
sub sample_rate(uword per) -> uword {
|
||||
; calculate the sample rate belonging to the given Period; the inverse of period()
|
||||
return clock() / per as uword
|
||||
}
|
||||
|
||||
asmsub clock() clobbers (A6) -> long @D0 {
|
||||
; return the Audio/Color clock, used for Period calculations to get the correct frequency
|
||||
%asm {{
|
||||
move.l sys.GfxBase, a6
|
||||
btst.b #0, $dc(a6)
|
||||
bne.s .ntsc
|
||||
move.l #3546895, d0 ; PAL
|
||||
rts
|
||||
.ntsc:
|
||||
move.l #3579545, d0 ; NTSC
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
private asmsub BeginIO(^^IOAudio io @A1) clobbers (D0, D1, A0, A1, A6) {
|
||||
; Calls the device's BeginIO vector directly, instead of exec DoIO/SendIO,
|
||||
; because those clear io_Flags which would wipe ADIOF_PERVOL and friends.
|
||||
%asm {{
|
||||
move.l 20(a1), a6 ; a6 = io_Device (offset 20 in IORequest)
|
||||
jsr -30(a6) ; device BeginIO vector
|
||||
rts
|
||||
}}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
; no support for BCD
|
||||
@@ -0,0 +1,345 @@
|
||||
%import custom
|
||||
|
||||
blitter {
|
||||
%option merge, no_symbol_prefixing, ignore_unused
|
||||
|
||||
; WARNING: All pointers passed to blitter routines MUST point to CHIP RAM.
|
||||
; The Amiga blitter hardware can only access CHIP RAM directly.
|
||||
; Using fast RAM pointers will result in bus errors or corrupted data.
|
||||
;
|
||||
; WIDTH LIMITATION: The blitter can only handle 64 words (1024 pixels) width per operation.
|
||||
; Standard Amiga screens (320/640 pixels) fit within this limit.
|
||||
; For wider images, split the blit into multiple operations manually.
|
||||
;
|
||||
; WAITING BEHAVIOR: All blitter operations wait for the blitter to become idle
|
||||
; at the START of the call, but do NOT wait for the operation to finish before
|
||||
; returning. This allows the CPU to continue working while the blitter runs.
|
||||
; Call blitter.wait() explicitly when you need to ensure the blitter has completed
|
||||
; (e.g., before reading back modified memory or swapping display buffers).
|
||||
|
||||
const uword MINTERM_MASKED = $CA ; (A AND B) OR (NOT A AND C) - masked sprite blit
|
||||
const uword MINTERM_A_ONLY = $F0 ; channel A only (same as COPY)
|
||||
const uword MINTERM_B_ONLY = $CC ; channel B only
|
||||
const uword MINTERM_A_XOR_C = $5A ; A XOR C (erase/restore patterns)
|
||||
|
||||
asmsub wait() {
|
||||
; Wait until the blitter is completely idle.
|
||||
; Use this before reading back blitter-modified memory or swapping buffers.
|
||||
%asm {{
|
||||
.busy:
|
||||
btst.b #6,custom.DMACONR
|
||||
bne.s .busy
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub set_blitpri(bool hasprio @D0) clobbers (D0) {
|
||||
; Set or clear blitter priority over the CPU.
|
||||
; When enabled, the blitter gets bus priority and completes faster,
|
||||
; but the CPU runs slower during the blit.
|
||||
; Disable when you need full CPU speed while the blitter runs.
|
||||
%asm {{
|
||||
tst.b d0
|
||||
beq.s .clear
|
||||
move.w #$8400,custom.DMACON ; SET bit + BLITPRI bit
|
||||
rts
|
||||
.clear:
|
||||
move.w #$0400,custom.DMACON ; BLITPRI bit only (clears it)
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
; Copy a rectangular block from src to dst.
|
||||
; Waits for blitter idle at start, returns immediately after triggering the blit.
|
||||
asmsub copy_rect(pointer src @A0, pointer dst @A1, uword width_words @D0, uword height @D1, uword src_mod @D2, uword dst_mod @D3, uword minterm @D4, ubyte descending @D5) clobbers (D0,D1,D2,D3,D4,D5,A0,A1) {
|
||||
%asm {{
|
||||
movem.l d2-d7/a2-a6,-(sp)
|
||||
move.w d0,d6 ; d6 = width
|
||||
move.w d1,d7 ; d7 = height
|
||||
move.w d2,d2 ; src_mod
|
||||
move.w d3,d3 ; dst_mod
|
||||
bsr .wait_blt
|
||||
tst.w d5
|
||||
beq.s .no_desc
|
||||
move.w d6,d0
|
||||
lsl.w #1,d0
|
||||
add.w d2,d0
|
||||
move.w d7,d1
|
||||
subq.w #1,d1
|
||||
mulu.w d0,d1
|
||||
move.w d6,d0
|
||||
subq.w #1,d0
|
||||
lsl.w #1,d0
|
||||
ext.l d0
|
||||
add.l d0,d1
|
||||
add.l d1,a0
|
||||
move.w d6,d0
|
||||
lsl.w #1,d0
|
||||
add.w d3,d0
|
||||
move.w d7,d1
|
||||
subq.w #1,d1
|
||||
mulu.w d0,d1
|
||||
move.w d6,d0
|
||||
subq.w #1,d0
|
||||
lsl.w #1,d0
|
||||
ext.l d0
|
||||
add.l d0,d1
|
||||
add.l d1,a1
|
||||
.no_desc:
|
||||
move.w d2,custom.BLTAMOD
|
||||
move.w d3,custom.BLTDMOD
|
||||
move.w #$ffff,custom.BLTAFWM
|
||||
move.w #$ffff,custom.BLTALWM
|
||||
move.l a0,custom.BLTAPT
|
||||
move.l a1,custom.BLTDPT
|
||||
move.w d4,d1
|
||||
or.w #$0900,d1
|
||||
move.w d1,custom.BLTCON0
|
||||
moveq #0,d1
|
||||
tst.w d5
|
||||
beq.s .nodesc
|
||||
move.w #$0002,d1
|
||||
.nodesc:
|
||||
or.w #$0800,d1 ; B32: AGA 32-bit blit mode
|
||||
move.w d1,custom.BLTCON1
|
||||
move.w d7,d1
|
||||
lsl.w #6,d1
|
||||
or.w d6,d1
|
||||
move.w d1,custom.BLTSIZE
|
||||
movem.l (sp)+,d2-d7/a2-a6
|
||||
rts
|
||||
.wait_blt:
|
||||
btst.b #6,custom.DMACONR
|
||||
bne.s .wait_blt
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
; Fill a rectangular block with a pattern.
|
||||
; Waits for blitter idle at start, returns immediately after triggering the blit.
|
||||
asmsub fill_rect(pointer dst @A0, uword width_words @D0, uword height @D1, uword pattern @D2, uword modulo @D3) clobbers (D0,D1,D2,D3,A0) {
|
||||
%asm {{
|
||||
movem.l d2-d7/a2-a6,-(sp)
|
||||
bsr .wait_blt
|
||||
move.w d3,custom.BLTDMOD
|
||||
move.w #$ffff,custom.BLTAFWM
|
||||
move.w #$ffff,custom.BLTALWM
|
||||
move.w d2,custom.BLTCDAT
|
||||
move.l a0,custom.BLTDPT
|
||||
move.w #$01aa,custom.BLTCON0 ; USED=1, USEC=0, minterm=$AA (BLTCDAT -> D)
|
||||
move.w #$0800,custom.BLTCON1 ; B32: AGA 32-bit blit mode
|
||||
move.w d1,d1
|
||||
lsl.w #6,d1
|
||||
or.w d0,d1
|
||||
move.w d1,custom.BLTSIZE
|
||||
movem.l (sp)+,d2-d7/a2-a6
|
||||
rts
|
||||
.wait_blt:
|
||||
btst.b #6,custom.DMACONR
|
||||
bne.s .wait_blt
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
; Initialize the blitter for fast line drawing.
|
||||
; Call this once before drawing a batch of lines with the same parameters.
|
||||
; mask: first/last word mask (usually $ffff for full-word lines)
|
||||
; pixel: line pixel pattern in BLTADAT (usually $8000 for single pixel)
|
||||
; pattern: line fill pattern in BLTBDAT (usually $ffff for solid lines)
|
||||
; screen_mod: bytes per row of the destination bitplane (pitch)
|
||||
; Waits for blitter idle at start, returns immediately after setup.
|
||||
asmsub line_init(uword mask @D0, uword pixel @D1, uword pattern @D2, uword screen_mod @D4) clobbers (D0,D1,D2,D4,A0,A1) {
|
||||
%asm {{
|
||||
movem.l d2-d7/a2-a6,-(sp)
|
||||
bsr .wait_blt
|
||||
move.w d0,custom.BLTAFWM
|
||||
move.w #$ffff,custom.BLTALWM
|
||||
move.w d1,custom.BLTADAT
|
||||
move.w d2,custom.BLTBDAT
|
||||
move.w d4,custom.BLTCMOD
|
||||
movem.l (sp)+,d2-d7/a2-a6
|
||||
rts
|
||||
.wait_blt:
|
||||
btst.b #6,custom.DMACONR
|
||||
bne.s .wait_blt
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
; Draw a single line using the blitter's hardware Bresenham line mode.
|
||||
; Must be preceded by a call to line_init() with the appropriate parameters.
|
||||
; Uses the octant-lookup-table algorithm from coppershade.org
|
||||
; (see https://coppershade.org/asmskool/SOURCES/Developing-Demo-Effects/DDE4/LineVectors/).
|
||||
; x1, y1: starting coordinates (absolute, any direction supported)
|
||||
; x2, y2: ending coordinates
|
||||
; screen_mod: bytes per row of the destination bitplane (pitch)
|
||||
; screen_ptr: pointer to bitplane memory (CHIP RAM)
|
||||
; Waits for blitter idle at start, returns immediately after triggering the blit.
|
||||
asmsub line_draw(uword x1 @D0, uword y1 @D1, uword x2 @D2, uword y2 @D3, uword screen_mod @D4, pointer screen_ptr @A1) clobbers (D0,D1,D2,D3,D5,D6,A0,A1) {
|
||||
%asm {{
|
||||
movem.l d2-d7/a2-a6,-(sp)
|
||||
|
||||
; CPU setup (these would normally be done once in LineInit and
|
||||
; preserved across calls; we set them up here for self-containment).
|
||||
move.w #1*64+2,a3 ; add-value for BLTSIZE
|
||||
move.l #$bfa0000f,a4 ; minterm+mask for quick-rol
|
||||
|
||||
; d0=x1, d1=y1, d2=x2, d3=y2, d4=screen_mod, a1=screen_ptr
|
||||
move.l a4,d6 ; minterm+mask
|
||||
and.w d0,d6 ; mask x 0..15
|
||||
ror.l #4,d6 ; shift it in at top, low word cleared
|
||||
|
||||
; --- deltas ---
|
||||
sub.w d1,d3 ; d3 = y2 - y1
|
||||
bpl.s .dyplus
|
||||
neg.w d3
|
||||
addq.b #8,d6
|
||||
.dyplus:
|
||||
sub.w d0,d2 ; d2 = x2 - x1
|
||||
bgt.s .dxplus
|
||||
neg.w d2
|
||||
addq.b #4,d6
|
||||
.dxplus:
|
||||
cmp.w d2,d3
|
||||
bge.s .dylarger
|
||||
exg d2,d3 ; d2=Small delta, d3=Large delta
|
||||
addq.b #2,d6
|
||||
.dylarger:
|
||||
|
||||
; --- blit values ---
|
||||
muls d4,d1 ; d1 = y1 * screen_mod
|
||||
asr.w #3,d0 ; bit 0 ignored by Blitter
|
||||
add.w d0,d1 ; offset on screen
|
||||
add.l a1,d1 ; add current screen buffer ptr
|
||||
|
||||
add.w d2,d2 ; d2 = 2*SDelta
|
||||
move.w d2,d5 ; d5 = 2*SDelta
|
||||
swap d2 ; d2 high word = 2*SDelta
|
||||
sub.w d3,d5 ; d5 = 2*SDelta - LDelta
|
||||
smi d0 ; if (2*Sdelta-Ldelta) < 0,
|
||||
sub.b d0,d6 ; add 1 (subtract -1) to octant lookup
|
||||
move.b OctTbl(pc,d6.w),d6 ; look up BLTCON bits for octant
|
||||
|
||||
move.w d5,d2 ; d2 low word = 2*SDelta - LDelta
|
||||
sub.w d3,d2 ; d2 low word = 2*SDelta - 2*LDelta
|
||||
asl.w #6,d3 ; d3 = LDelta << 6
|
||||
add.w a3,d3 ; d3 = BLTSIZE
|
||||
|
||||
; --- blit ---
|
||||
bsr .wait_blt
|
||||
move.l d6,custom.BLTCON0 ; shift, minterm, octant bits
|
||||
move.w d5,custom.BLTAPTL ; 2*SDelta - LDelta
|
||||
move.l d2,custom.BLTBMOD ; 2*SDelta | 2*SDelta - 2*LDelta
|
||||
move.l d1,custom.BLTCPT ; source
|
||||
move.l d1,custom.BLTDPT ; destination
|
||||
move.w d3,custom.BLTSIZE
|
||||
movem.l (sp)+,d2-d7/a2-a6
|
||||
rts
|
||||
|
||||
.wait_blt:
|
||||
btst.b #6,custom.DMACONR
|
||||
bne.s .wait_blt
|
||||
rts
|
||||
|
||||
; Octant lookup table placed right after the rts so it is reachable via
|
||||
; PC-relative addressing from the move.b OctTbl(PC,d6.w) instruction above.
|
||||
; Each pair of entries encodes BLTCON1 octant bits for one of the 8 octants.
|
||||
; First byte has SING=0, second has SING=1 (descending mode).
|
||||
OctTbl:
|
||||
dc.b 0*4+1,0*4+1+64 ;7
|
||||
dc.b 4*4+1,4*4+1+64 ;6
|
||||
dc.b 2*4+1,2*4+1+64 ;4
|
||||
dc.b 5*4+1,5*4+1+64 ;5
|
||||
dc.b 1*4+1,1*4+1+64 ;0
|
||||
dc.b 6*4+1,6*4+1+64 ;1
|
||||
dc.b 3*4+1,3*4+1+64 ;3
|
||||
dc.b 7*4+1,7*4+1+64 ;2
|
||||
; !notreached!
|
||||
}}
|
||||
}
|
||||
|
||||
; Masked blit: copy src to dst using a mask channel.
|
||||
; Waits for blitter idle at start, returns immediately after triggering the blit.
|
||||
asmsub masked_blit(pointer src @A0, pointer mask @A1, pointer dst @A2, uword width_words @D0, uword height @D1, uword src_mod @D2, uword mask_mod @D3, uword dst_mod @D4) clobbers (D0,D1,D2,D3,D4,A0,A1,A2) {
|
||||
%asm {{
|
||||
movem.l d2-d7/a2-a6,-(sp)
|
||||
bsr .wait_blt
|
||||
move.w d2,custom.BLTBMOD
|
||||
move.w d3,custom.BLTAMOD
|
||||
move.w d4,custom.BLTDMOD
|
||||
move.w d4,custom.BLTCMOD
|
||||
move.w #$ffff,custom.BLTAFWM
|
||||
move.w #$ffff,custom.BLTALWM
|
||||
move.l a1,custom.BLTAPT
|
||||
move.l a0,custom.BLTBPT
|
||||
move.l a2,custom.BLTCPT
|
||||
move.l a2,custom.BLTDPT
|
||||
move.w #$0fca,custom.BLTCON0
|
||||
move.w #$0800,custom.BLTCON1 ; B32: AGA 32-bit blit mode
|
||||
move.w d1,d1
|
||||
lsl.w #6,d1
|
||||
or.w d0,d1
|
||||
move.w d1,custom.BLTSIZE
|
||||
movem.l (sp)+,d2-d7/a2-a6
|
||||
rts
|
||||
.wait_blt:
|
||||
btst.b #6,custom.DMACONR
|
||||
bne.s .wait_blt
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
; Clear a rectangular region of a bitplane to zero.
|
||||
; Waits for blitter idle at start, returns immediately after triggering the blit.
|
||||
asmsub clear_plane(pointer dst @A0, uword width_words @D0, uword height @D1) clobbers (D0,D1,A0) {
|
||||
%asm {{
|
||||
movem.l d2-d7/a2-a6,-(sp)
|
||||
bsr .wait_blt
|
||||
move.w #$ffff,custom.BLTAFWM
|
||||
move.w #$ffff,custom.BLTALWM
|
||||
move.w #$0000,custom.BLTCDAT
|
||||
move.w #$0000,custom.BLTDMOD
|
||||
move.l a0,custom.BLTDPT
|
||||
move.w #$01aa,custom.BLTCON0
|
||||
move.w #$0800,custom.BLTCON1 ; B32: AGA 32-bit blit mode
|
||||
move.w d1,d1
|
||||
lsl.w #6,d1
|
||||
or.w d0,d1
|
||||
move.w d1,custom.BLTSIZE
|
||||
movem.l (sp)+,d2-d7/a2-a6
|
||||
rts
|
||||
.wait_blt:
|
||||
btst.b #6,custom.DMACONR
|
||||
bne.s .wait_blt
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
; Fill an entire bitplane (or any width_words x height block) with a 16-bit pattern.
|
||||
; pattern: the value written to every word of the destination (e.g. $0000 clears,
|
||||
; $ffff fills solid, $aaaa produces a vertical stripe pattern).
|
||||
; Waits for blitter idle at start, returns immediately after triggering the blit.
|
||||
asmsub fill_plane(pointer dst @A0, uword width_words @D0, uword height @D1, uword pattern @D2) clobbers (D0,D1,D2,A0) {
|
||||
%asm {{
|
||||
movem.l d2-d7/a2-a6,-(sp)
|
||||
bsr .wait_blt
|
||||
move.w #$ffff,custom.BLTAFWM
|
||||
move.w #$ffff,custom.BLTALWM
|
||||
move.w d2,custom.BLTCDAT
|
||||
move.l a0,custom.BLTDPT
|
||||
move.w #$01aa,custom.BLTCON0 ; USED=1, USEC=0, minterm=$AA (BLTCDAT -> D)
|
||||
move.w #$0800,custom.BLTCON1 ; B32: AGA 32-bit blit mode
|
||||
move.w #$0000,custom.BLTDMOD
|
||||
move.w d1,d1
|
||||
lsl.w #6,d1
|
||||
or.w d0,d1
|
||||
move.w d1,custom.BLTSIZE
|
||||
movem.l (sp)+,d2-d7/a2-a6
|
||||
rts
|
||||
.wait_blt:
|
||||
btst.b #6,custom.DMACONR
|
||||
bne.s .wait_blt
|
||||
rts
|
||||
}}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,279 @@
|
||||
; Number conversions routines.
|
||||
|
||||
%import strings
|
||||
|
||||
conv {
|
||||
|
||||
; ----- number conversions to decimal strings ----
|
||||
|
||||
%option merge, ignore_unused
|
||||
str string_out = "????????????????" ; result buffer for the string conversion routines
|
||||
private long @shared fmt_value_l
|
||||
private uword @shared fmt_value_w
|
||||
|
||||
private asmsub putcharproc(ubyte character @D0, pointer output @A3) -> ubyte @D0 {
|
||||
%asm {{
|
||||
move.b d0, (a3)+ ; Store character in buffer and advance pointer
|
||||
rts ; Return control to RawDoFmt loop
|
||||
}}
|
||||
}
|
||||
|
||||
sub str_ub0(ubyte value) -> str {
|
||||
; ---- convert the ubyte in A in decimal string form, with left padding 0s (3 positions total)
|
||||
fmt_value_w = value as uword
|
||||
void exec.RawDoFmt("%03d", &fmt_value_w, putcharproc, string_out)
|
||||
return string_out
|
||||
}
|
||||
|
||||
sub str_ub(ubyte value) -> str {
|
||||
; ---- convert the ubyte in A in decimal string form, without left padding 0s
|
||||
fmt_value_w = value as uword
|
||||
void exec.RawDoFmt("%d", &fmt_value_w, putcharproc, string_out)
|
||||
return string_out
|
||||
}
|
||||
|
||||
sub str_b(byte value) -> str {
|
||||
; ---- convert the byte in A in decimal string form, without left padding 0s
|
||||
fmt_value_w = value as uword
|
||||
void exec.RawDoFmt("%d", &fmt_value_w, putcharproc, string_out)
|
||||
return string_out
|
||||
}
|
||||
|
||||
sub str_ubhex (ubyte value) -> str {
|
||||
; ---- convert the ubyte in A in hex string form
|
||||
fmt_value_w = value as uword
|
||||
void exec.RawDoFmt("%02x", &fmt_value_w, putcharproc, string_out)
|
||||
return string_out
|
||||
}
|
||||
|
||||
sub str_ubbin (ubyte value) -> str {
|
||||
; ---- convert the ubyte in binary string form
|
||||
^^ubyte out_ptr = &string_out
|
||||
ubyte mask = 128
|
||||
repeat 8 {
|
||||
if value & mask != 0
|
||||
@(out_ptr) = '1'
|
||||
else
|
||||
@(out_ptr) = '0'
|
||||
out_ptr++
|
||||
mask >>= 1
|
||||
}
|
||||
@(out_ptr) = 0
|
||||
return string_out
|
||||
}
|
||||
|
||||
sub str_uwbin (uword value) -> str {
|
||||
; ---- convert the uword in binary string form
|
||||
^^ubyte out_ptr = &string_out
|
||||
uword mask = $8000
|
||||
repeat 16 {
|
||||
if value & mask != 0
|
||||
@(out_ptr) = '1'
|
||||
else
|
||||
@(out_ptr) = '0'
|
||||
out_ptr++
|
||||
mask >>= 1
|
||||
}
|
||||
@(out_ptr) = 0
|
||||
return string_out
|
||||
}
|
||||
|
||||
sub str_uwhex (uword value) -> str {
|
||||
; ---- convert the uword in hexadecimal string form (4 digits)
|
||||
void exec.RawDoFmt("%04x", &value, putcharproc, string_out)
|
||||
return string_out
|
||||
}
|
||||
|
||||
sub str_ulhex (long value) -> str {
|
||||
; ---- convert the long in hexadecimal string form (8 digits)
|
||||
void exec.RawDoFmt("%08lx", &value, putcharproc, string_out)
|
||||
return string_out
|
||||
}
|
||||
|
||||
sub str_uw0 (uword value) -> str {
|
||||
; ---- convert the uword in decimal string form, with left padding 0s (5 positions total)
|
||||
; requires kickstart 2.0+
|
||||
fmt_value_l = value as long
|
||||
void exec.RawDoFmt("%05lu", &fmt_value_l, putcharproc, string_out)
|
||||
return string_out
|
||||
}
|
||||
|
||||
sub str_uw (uword value) -> str {
|
||||
; ---- convert the uword in decimal string form, without left padding 0s
|
||||
; requires kickstart 2.0+
|
||||
fmt_value_l = value as long
|
||||
void exec.RawDoFmt("%lu", &fmt_value_l, putcharproc, string_out)
|
||||
return string_out
|
||||
}
|
||||
|
||||
sub str_w (word value) -> str {
|
||||
; ---- convert the (signed) word into decimal string form, without left padding 0's
|
||||
void exec.RawDoFmt("%d", &value, putcharproc, string_out)
|
||||
return string_out
|
||||
}
|
||||
|
||||
sub str_l (long value) -> str {
|
||||
; ---- convert the (signed) long into decimal string form
|
||||
void exec.RawDoFmt("%ld", &value, putcharproc, string_out)
|
||||
return string_out
|
||||
}
|
||||
|
||||
|
||||
; ---- string conversion to numbers -----
|
||||
|
||||
sub str2ubyte(str string) -> ubyte {
|
||||
; -- returns in A the unsigned byte value of the string number argument in AY
|
||||
; the number may NOT be preceded by a + sign and may NOT contain spaces
|
||||
; (any non-digit character will terminate the number string that is parsed)
|
||||
return str2uword(string) as ubyte
|
||||
}
|
||||
|
||||
sub str2byte(str string) -> byte {
|
||||
; -- returns in A the signed byte value of the string number argument in AY
|
||||
; the number may be preceded by a + or - sign but may NOT contain spaces
|
||||
; (any non-digit character will terminate the number string that is parsed)
|
||||
return str2word(string) as byte
|
||||
}
|
||||
|
||||
sub str2uword(str string) -> uword {
|
||||
uword result
|
||||
ubyte ii
|
||||
while string[ii] >= '0' and string[ii] <= '9' {
|
||||
result = result * 10 + (string[ii] - '0') as uword
|
||||
ii++
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
sub str2word(str string) -> word {
|
||||
bool negative
|
||||
ubyte ii
|
||||
if string[0] == '-' {
|
||||
negative = true
|
||||
ii = 1
|
||||
} else {
|
||||
if string[0] == '+'
|
||||
ii = 1
|
||||
}
|
||||
uword result
|
||||
while string[ii] >= '0' and string[ii] <= '9' {
|
||||
result = result * 10 + (string[ii] - '0') as uword
|
||||
ii++
|
||||
}
|
||||
if negative
|
||||
return 0 - result as word
|
||||
return result as word
|
||||
}
|
||||
|
||||
sub hex2uword(str string) -> uword {
|
||||
; -- hexadecimal string (with or without '$') to uword.
|
||||
; stops parsing at the first character that's not a hex digit (except leading $)
|
||||
uword result
|
||||
ubyte char
|
||||
if @(string)=='$'
|
||||
string++
|
||||
repeat {
|
||||
char = strings.lowerchar(@(string))
|
||||
if strings.isxdigit(char) {
|
||||
result <<= 4
|
||||
if char>='0' and char<='9'
|
||||
result |= char-'0'
|
||||
else
|
||||
result |= char-'a'+10
|
||||
} else
|
||||
return result
|
||||
string++
|
||||
}
|
||||
}
|
||||
|
||||
sub hex2long(str string) -> long {
|
||||
; -- hexadecimal string (with or without '$') to long.
|
||||
; stops parsing at the first character that's not a hex digit (except leading $)
|
||||
long result
|
||||
ubyte char
|
||||
if @(string)=='$'
|
||||
string++
|
||||
repeat {
|
||||
char = strings.lowerchar(@(string))
|
||||
if strings.isxdigit(char) {
|
||||
result <<= 4
|
||||
if char>='0' and char<='9'
|
||||
result |= char-'0'
|
||||
else
|
||||
result |= char-'a'+10
|
||||
} else
|
||||
return result
|
||||
string++
|
||||
}
|
||||
}
|
||||
|
||||
sub str2long(str string) -> long {
|
||||
; -- convert a decimal string (terminated with a zero byte) into a long. Clobbers R0
|
||||
long result = 0
|
||||
bool negative = string[0] == '-'
|
||||
if negative or string[0]=='+'
|
||||
string++
|
||||
repeat {
|
||||
ubyte digit_char = @(string)
|
||||
if strings.isdigit(digit_char) {
|
||||
result = (result<<1) + (result<<3) ; multiply by 10
|
||||
result += digit_char - '0' ; add digit
|
||||
} else {
|
||||
break ; Invalid character, stop processing
|
||||
}
|
||||
string++
|
||||
}
|
||||
|
||||
if negative
|
||||
return -result
|
||||
else
|
||||
return result
|
||||
}
|
||||
|
||||
sub bin2uword(str string) -> uword {
|
||||
; -- binary string (with or without '%') to uword.
|
||||
; stops parsing at the first character that's not a 0 or 1. (except leading %)
|
||||
uword result
|
||||
ubyte char
|
||||
if @(string)=='%'
|
||||
string++
|
||||
repeat {
|
||||
char = @(string)
|
||||
if char=='0' {
|
||||
result <<= 1
|
||||
} else if char=='1' {
|
||||
result <<= 1
|
||||
result |= 1
|
||||
} else
|
||||
return result
|
||||
string++
|
||||
}
|
||||
}
|
||||
|
||||
sub any2uword(str string) -> uword, ubyte {
|
||||
; -- convert any number string (any prefix allowed) to uword.
|
||||
; returns the parsed word value, and the number of processed characters (including the prefix symbol)
|
||||
ubyte count
|
||||
when string[0] {
|
||||
'$' -> {
|
||||
count = 1
|
||||
while strings.isxdigit(string[count])
|
||||
count++
|
||||
return hex2uword(string), count
|
||||
}
|
||||
'%' -> {
|
||||
count = 1
|
||||
while string[count]=='0' or string[count]=='1'
|
||||
count++
|
||||
return bin2uword(string), count
|
||||
}
|
||||
else -> {
|
||||
count = 0
|
||||
while strings.isdigit(string[count])
|
||||
count++
|
||||
return str2uword(string), count
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
; Copper list builder and manager for Amiga custom hardware.
|
||||
; IMPORTANT: Copper lists MUST be allocated in CHIP RAM (accessible by both CPU and custom chips).
|
||||
; Use memory() or ensure your list buffers are in CHIP RAM range.
|
||||
|
||||
%import custom
|
||||
|
||||
copper {
|
||||
%option merge, no_symbol_prefixing, ignore_unused
|
||||
|
||||
; Current write position in copper list (used by assembly routines)
|
||||
pointer @shared _copper_pos
|
||||
|
||||
; ========== List building routines (assembly) ==========
|
||||
|
||||
asmsub init(pointer list_ptr @A0) clobbers (A0) {
|
||||
%asm {{
|
||||
move.l a0,copper._copper_pos
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub move(uword reg_addr @D0, uword value @D1) clobbers (D0, D1, A0) {
|
||||
; Add a MOVE instruction to the copper list.
|
||||
; reg_addr is the custom register address offsetr (e.g., $0180 for COLOR00 / $dff180).
|
||||
; The copper MOVE instruction encodes the register offset from $dff000.
|
||||
%asm {{
|
||||
move.l copper._copper_pos,a0
|
||||
and.w #$1fe,d0 ; mask to even register offset (bit 0 must be 0)
|
||||
move.w d0,(a0)+ ; word 1: register offset (bit 0 = 0 identifies MOVE)
|
||||
move.w d1,(a0)+ ; word 2: value
|
||||
move.l a0,copper._copper_pos
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub wait(ubyte vpos @D0, ubyte hpos @D1, uword compare_mask @D2) clobbers (D0, D1, D2, A0) {
|
||||
; Add a WAIT instruction to the copper list.
|
||||
; Word1 = (vpos<<8) | (hpos<<1) | 1 (bit 0 = 1 identifies WAIT/SKIP)
|
||||
; Word2 = compare_mask with bit 0 = 0 (distinguishes WAIT from SKIP).
|
||||
; Word2 bit 15 = BFD (1 = no blitter wait, 0 = also wait for blitter)
|
||||
; Word2 bits 14-8 = VE (vertical compare enable mask)
|
||||
; Word2 bits 7-1 = HE (horizontal compare enable mask)
|
||||
%asm {{
|
||||
move.l copper._copper_pos,a0
|
||||
and.w #$ff,d0 ; zero-extend vpos to word
|
||||
lsl.w #8,d0 ; vpos to high byte
|
||||
and.w #$ff,d1 ; zero-extend hpos to word
|
||||
lsl.w #1,d1 ; hpos to bit 1
|
||||
or.w d1,d0 ; combine vpos and hpos
|
||||
or.w #1,d0 ; set bit 0 to identify instruction as WAIT/SKIP
|
||||
move.w d0,(a0)+ ; word 1
|
||||
and.w #$fffe,d2 ; clear bit 0 to indicate WAIT (not SKIP)
|
||||
move.w d2,(a0)+ ; word 2
|
||||
move.l a0,copper._copper_pos
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub skip(ubyte vpos @D0, ubyte hpos @D1, uword compare_mask @D2) clobbers (D0, D1, D2, A0) {
|
||||
; Add a SKIP instruction to the copper list.
|
||||
; Word1 = (vpos<<8) | (hpos<<1) | 1 (bit 0 = 1 identifies WAIT/SKIP)
|
||||
; Word2 = compare_mask with bit 0 = 1 (distinguishes SKIP from WAIT).
|
||||
%asm {{
|
||||
move.l copper._copper_pos,a0
|
||||
and.w #$ff,d0 ; zero-extend vpos to word
|
||||
lsl.w #8,d0 ; vpos to high byte
|
||||
and.w #$ff,d1 ; zero-extend hpos to word
|
||||
lsl.w #1,d1 ; hpos to bit 1
|
||||
or.w d1,d0 ; combine vpos and hpos
|
||||
or.w #1,d0 ; set bit 0 to identify instruction as WAIT/SKIP
|
||||
move.w d0,(a0)+ ; word 1
|
||||
or.w #1,d2 ; set bit 0 to indicate SKIP (not WAIT)
|
||||
move.w d2,(a0)+ ; word 2
|
||||
move.l a0,copper._copper_pos
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub end() clobbers (A0) {
|
||||
; Terminate the copper list with the end marker ($FFFF, $FFFE).
|
||||
%asm {{
|
||||
move.l copper._copper_pos,a0
|
||||
move.w #$ffff,(a0)+ ; end marker word 1
|
||||
move.w #$fffe,(a0)+ ; end marker word 2
|
||||
move.l a0,copper._copper_pos
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub get_pos() -> pointer @A0 {
|
||||
; Return the current write position in the copper list.
|
||||
; Useful for calculating list size or continuing from a saved position.
|
||||
%asm {{
|
||||
move.l copper._copper_pos,a0
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
; ========== Activation routines (assembly) ==========
|
||||
|
||||
asmsub start(pointer list_ptr @A0) clobbers (A0) {
|
||||
; Activate a copper list by loading its address into COP1LC and enabling Copper DMA.
|
||||
; The copper list must be in CHIP RAM.
|
||||
%asm {{
|
||||
move.l a0,custom.COP1LC ; load copper list pointer (auto-increments)
|
||||
move.w #$8280,custom.DMACON ; DMACON: SET(0x8000) | DMAEN(0x0200) | COPEN(0x0080)
|
||||
clr.w custom.COPJMP1 ; strobe COPJMP1 to activate
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
; ========== Effects routines (Prog8) ==========
|
||||
|
||||
sub append_raster_colors(ubyte vpos_start, ^^uword colors, ubyte num_lines) {
|
||||
; Append WAIT+MOVE instructions to change background color per scanline.
|
||||
; Does NOT call init() or end() - caller must handle list setup.
|
||||
;
|
||||
; Parameters:
|
||||
; vpos_start - starting vertical beam position (0-255)
|
||||
; colors - pointer to array of color values (12-bit RGB, e.g., $0F00 for red)
|
||||
; num_lines - number of scanlines to color
|
||||
;
|
||||
; Example:
|
||||
; copper.init(my_list)
|
||||
; ... add other copper instructions ...
|
||||
; copper.append_raster_colors(50, bar_colors, 8)
|
||||
; copper.end()
|
||||
|
||||
ubyte vpos = vpos_start
|
||||
ubyte i
|
||||
for i in 0 to num_lines - 1 {
|
||||
wait(vpos, 0, $fffe)
|
||||
move($180, colors[i])
|
||||
vpos += 1
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,709 @@
|
||||
%import exec
|
||||
%import syslib
|
||||
|
||||
custom {
|
||||
%option merge, no_symbol_prefixing, ignore_unused
|
||||
|
||||
|
||||
asmsub grab_system() {
|
||||
; take over the whole OS and system, to run hardware banging programs (games, demos, etc)
|
||||
%asm {{
|
||||
|
||||
exec_AttnFlags = 296
|
||||
gfx_ActiView = $22
|
||||
gfx_copinit = $26
|
||||
gfx_LOFlist = $32
|
||||
VBlankFrequency = $212
|
||||
GfxLoadView = -222
|
||||
GfxWaitTOF = -270
|
||||
IRQ1 = $64
|
||||
IRQ2 = $68
|
||||
IRQ3 = $6C
|
||||
IRQ4 = $70
|
||||
IRQ5 = $74
|
||||
IRQ6 = $78
|
||||
IRQ7 = $7C
|
||||
|
||||
move.l 4.w,a6
|
||||
jsr exec.Forbid(a6) ; Do not run other tasks
|
||||
btst.b #0,exec_AttnFlags+1(a6) ; Check if > 68000 processor
|
||||
beq.s 1$ ; On 68000 no VBR (always zero)
|
||||
lea.l .getvbr(PC),a5 ; Function to call as supervisor
|
||||
jsr exec.Supervisor(a6) ; Call supervisor function in A5
|
||||
move.l d0,custom.cpuVBR ; Store the returned VBR contents
|
||||
1$
|
||||
cmp.b #50,VBlankFrequency(a6)
|
||||
seq.b custom.isPAL
|
||||
|
||||
move.l sys.GfxBase,a6 ; A6 = Graphics base
|
||||
move.l gfx_ActiView(a6),custom.savedView ; Store current View pointer
|
||||
sub.l a1,a1 ; NULL view = default settings
|
||||
jsr GfxLoadView(a6) ; Load the view
|
||||
jsr GfxWaitTOF(a6) ; Wait one screen refresh
|
||||
jsr GfxWaitTOF(a6) ; Wait a 2nd (in case of interlace)
|
||||
|
||||
move.w #$8000,d0 ; Value
|
||||
move.w custom.DMACONR,custom.savedDMACON ; Store system DMA channels
|
||||
or.w d0,custom.savedDMACON ; SET/CLR set to SET
|
||||
move.w custom.INTENAR,custom.savedINTENA ; Store system enabled interrupts
|
||||
or.w d0,custom.savedINTENA ; SET/CLR set to SET
|
||||
move.w custom.ADKCONR,custom.savedADKCON ; Audio, disk and UART
|
||||
or.w d0,custom.savedADKCON ; SET/CLR set to SET
|
||||
|
||||
btst.b #14-8,custom.DMACONR ; Dummy read
|
||||
3$ btst.b #14-8,custom.DMACONR ; Blitter still busy?
|
||||
bne.s 3$ ; If yes, wait a bit
|
||||
move.w #$01FF,custom.DMACON ; Disable all DMA
|
||||
move.w #$3FFF,custom.INTENA ; Disable all interrupts
|
||||
|
||||
move.l custom.cpuVBR,a0 ; A0 = Pointer to vector base
|
||||
move.l IRQ1(a0),custom.savedIRQ1 ; Store IRQ1 vector
|
||||
move.l IRQ3(a0),custom.savedIRQ3 ; Store IRQ3 vector
|
||||
move.l IRQ4(a0),custom.savedIRQ4 ; Store IRQ4 vector
|
||||
bra.s .skip
|
||||
|
||||
.getvbr: dc.l $4E7A0801 ; MOVEC VBR,d0 - privileged instruction
|
||||
rte
|
||||
|
||||
.skip: rts
|
||||
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub restore_system() {
|
||||
; restore the original OS and multitasking operation when the game/demo exits.
|
||||
%asm {{
|
||||
btst.b #14-8,custom.DMACONR ; Dummy read
|
||||
1$ btst.b #14-8,custom.DMACONR ; Blitter still busy?
|
||||
bne.s 1$ ; If yes, wait a bit
|
||||
move.w #$01FF,custom.DMACON ; Disable all DMA
|
||||
move.w #$3FFF,custom.INTENA ; Disable all interrupts
|
||||
|
||||
move.l custom.cpuVBR,a0 ; A0 = Pointer to vector base
|
||||
move.l custom.savedIRQ4,d0 ; Restore IRQ4 vector
|
||||
move.l d0,IRQ4(a0)
|
||||
move.l custom.savedIRQ3,d0 ; Restore IRQ3 vector
|
||||
move.l d0,IRQ3(a0)
|
||||
move.l custom.savedIRQ1,d0 ; Restore IRQ1 vector
|
||||
move.l d0,IRQ1(a0)
|
||||
|
||||
move.l sys.GfxBase,a6 ; A6 = Graphics base
|
||||
move.l gfx_copinit(a6),custom.COP1LC ; Restore coplist pointer 1
|
||||
move.l gfx_LOFlist(a6),custom.COP2LC ; Restore coplist pointer 2
|
||||
clr.w custom.COPJMP1 ; Make Copper use restored pointer
|
||||
|
||||
move.w custom.savedADKCON,custom.ADKCON ; Restore audio, disk and UART
|
||||
move.w custom.savedINTENA,custom.INTENA ; Restore original interrupts
|
||||
move.w custom.savedDMACON,custom.DMACON ; Restore original DMA
|
||||
|
||||
move.l custom.savedView,a1 ; Get original view pointer
|
||||
jsr GfxLoadView(a6) ; Restore the original view
|
||||
jsr GfxWaitTOF(a6) ; Wait one screen refresh
|
||||
jsr GfxWaitTOF(a6) ; Wait a 2nd (in case of interlace)
|
||||
|
||||
move.l 4.w,a6
|
||||
jsr exec.Permit(a6) ; Re-enable multitasking
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub waitvsync() {
|
||||
%asm {{
|
||||
; synchronize to the screen's vsync, this routine doesn't require the OS to be active (sys.waitvsync is the OS-compatible version of this routine)
|
||||
; Wait until the raster beam reaches line 300
|
||||
.WaitLine300:
|
||||
MOVE.L $DFF004, D0 ; Read VPOSR + VHPOSR simultaneously
|
||||
LSR.L #8, D0 ; Shift vertical position bits into low word
|
||||
AND.W #$01FF, D0 ; Mask out horizontal beam bits (get 9-bit line #)
|
||||
CMP.W #300, D0 ; Are we at raster line 300?
|
||||
BNE.S .WaitLine300
|
||||
|
||||
; Wait until the beam MOVES PAST line 300
|
||||
; (Prevents fast CPUs like 030/040/060 from executing twice on the same line)
|
||||
.WaitLineNext:
|
||||
MOVE.L $DFF004, D0
|
||||
LSR.L #8, D0
|
||||
AND.W #$01FF, D0
|
||||
CMP.W #300, D0
|
||||
BEQ.S .WaitLineNext
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
|
||||
pointer @shared cpuVBR ; after calling grab_system: contains CPU VBR register
|
||||
bool @shared isPAL ; after calling grab_system: is true when system is PAL, false if NTSC
|
||||
|
||||
private pointer @shared savedView ; original graphics view pointer
|
||||
private uword @shared savedDMACON ; original DMA control with SET/CLR bit
|
||||
private uword @shared savedINTENA ; original interrupt enable with SET/CLR bit
|
||||
private uword @shared savedADKCON ; original ADK control with SET/CLR bit
|
||||
private pointer @shared savedIRQ1 ; original IRQ1 vector
|
||||
private pointer @shared savedIRQ3 ; original IRQ3 vector
|
||||
private pointer @shared savedIRQ4 ; original IRQ4 vector
|
||||
|
||||
|
||||
; ========== AGA palette utilities ==========
|
||||
|
||||
asmsub set_aga_color(ubyte color_index @D0, long rgb24 @D1) clobbers (D0,D1,D2,D3,D4,A0) {
|
||||
; Write a 24-bit RGB color ($00RRGGBB) to an AGA palette entry.
|
||||
; AGA uses eight banks of 32 COLOR registers and two writes per color:
|
||||
; first the upper nibble of each channel, then the lower nibble.
|
||||
; Keep this routine 68000-compatible: the amiga500 target is assembled as
|
||||
; 68000 by default, even though AGA hardware is normally paired with a 68020.
|
||||
%asm {{
|
||||
and.l #$ff,d0
|
||||
move.l d0,d4
|
||||
lsr.w #5,d4
|
||||
lsl.w #8,d4
|
||||
lsl.w #5,d4
|
||||
|
||||
and.w #$1f,d0
|
||||
lsl.w #1,d0
|
||||
move.l #$dff180,a0
|
||||
adda.w d0,a0
|
||||
|
||||
move.l d1,d2
|
||||
and.l #$f00000,d2
|
||||
lsr.l #8,d2
|
||||
lsr.l #4,d2
|
||||
move.l d1,d3
|
||||
and.l #$00f000,d3
|
||||
lsr.l #8,d3
|
||||
or.w d3,d2
|
||||
move.l d1,d3
|
||||
and.l #$0000f0,d3
|
||||
lsr.l #4,d3
|
||||
or.w d3,d2
|
||||
|
||||
move.l d1,d3
|
||||
and.l #$0f0000,d3
|
||||
lsr.l #8,d3
|
||||
move.l d1,d0
|
||||
and.l #$000f00,d0
|
||||
lsr.l #4,d0
|
||||
or.w d0,d3
|
||||
move.l d1,d0
|
||||
and.l #$00000f,d0
|
||||
or.w d0,d3
|
||||
|
||||
move.w d4,custom.BPLCON3
|
||||
move.w d2,(a0)
|
||||
ori.w #$0200,d4
|
||||
move.w d4,custom.BPLCON3
|
||||
move.w d3,(a0)
|
||||
andi.w #$fdff,d4
|
||||
move.w d4,custom.BPLCON3
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub set_aga_color_nibbles(ubyte color_index @D0, uword rgb_high_nibbles @D1, uword rgb_low_nibbles @D2) clobbers (D0,D1,D2,D3,A0) {
|
||||
; Write preformatted AGA palette nibbles. Each value is $0RGB. Result will still be 24 bit RRGGBB AGA color.
|
||||
; Keep this routine 68000-compatible: the amiga500 target is assembled as
|
||||
; 68000 by default, even though AGA hardware is normally paired with a 68020.
|
||||
%asm {{
|
||||
and.l #$ff,d0
|
||||
move.l d0,d3
|
||||
lsr.w #5,d3
|
||||
lsl.w #8,d3
|
||||
lsl.w #5,d3
|
||||
|
||||
and.w #$1f,d0
|
||||
lsl.w #1,d0
|
||||
move.l #$dff180,a0
|
||||
adda.w d0,a0
|
||||
|
||||
move.w d3,custom.BPLCON3
|
||||
move.w d1,(a0)
|
||||
ori.w #$0200,d3
|
||||
move.w d3,custom.BPLCON3
|
||||
move.w d2,(a0)
|
||||
andi.w #$fdff,d3
|
||||
move.w d3,custom.BPLCON3
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
; ========== audio filter =======
|
||||
|
||||
asmsub filter_on() {
|
||||
; ENABLE Audio Filter (Muffled audio / Dimmed Power LED)
|
||||
%asm {{
|
||||
bclr #1,custom.CIAA_PRA ; Set Bit 1 to LOW -> Filter ON
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub filter_off() {
|
||||
; DISABLE Audio Filter (Clear, crisp audio / Bright Power LED)
|
||||
%asm {{
|
||||
bset #1,custom.CIAA_PRA ; Set Bit 1 to HIGH -> Filter OFF
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
; ========== mouse button status ==========
|
||||
|
||||
sub left_button() -> bool {
|
||||
; Returns true if the left mouse button (port 1) is pressed.
|
||||
; Left button is CIA-A PRA bit 6, active low.
|
||||
return (custom.CIAA_PRA & %01000000) == 0
|
||||
}
|
||||
|
||||
sub right_button() -> bool {
|
||||
; Returns true if the right mouse button (port 1) is pressed.
|
||||
; Right button is POTGOR ($dff016) bit 10, active low.
|
||||
return (custom.POTGOR & %0000010000000000) == 0
|
||||
}
|
||||
|
||||
sub middle_button() -> bool {
|
||||
; Returns true if the middle mouse button (port 1) is pressed.
|
||||
; Middle button is POTGOR ($dff016) bit 8, active low.
|
||||
return (custom.POTGOR & %0000000100000000) == 0
|
||||
}
|
||||
|
||||
|
||||
; Amiga custom chip registers (full addresses, base $dff000)
|
||||
; Regenerated from https://github.com/alfishe/amiga-bootcamp/blob/main/14_references/custom_chip_registers.md
|
||||
; All registers are 16-bit words accessed on even byte boundaries.
|
||||
|
||||
; ========== Read-only registers ==========
|
||||
|
||||
&uword BLTDDAT = $dff000 ; blitter destination early read
|
||||
&uword DMACONR = $dff002 ; DMA control read
|
||||
&uword VPOSR = $dff004 ; beam position (V high bits + LOF)
|
||||
&uword VHPOSR = $dff006 ; beam position (V low + H)
|
||||
&uword DSKDATR = $dff008 ; disk data early read
|
||||
&uword JOY0DAT = $dff00a ; joystick/mouse port 0
|
||||
&uword JOY1DAT = $dff00c ; joystick/mouse port 1
|
||||
&uword CLXDAT = $dff00e ; collision detection
|
||||
&uword ADKCONR = $dff010 ; audio/disk control read
|
||||
&uword POT0DAT = $dff012 ; pot port 0 data
|
||||
&uword POT1DAT = $dff014 ; pot port 1 data
|
||||
&uword POTGOR = $dff016 ; pot port data read
|
||||
&uword SERDATR = $dff018 ; serial port data + status
|
||||
&uword DSKBYTR = $dff01a ; disk data byte + status
|
||||
&uword INTENAR = $dff01c ; interrupt enable read
|
||||
&uword INTREQR = $dff01e ; interrupt request read
|
||||
|
||||
; ========== Write / Read-Write registers ==========
|
||||
|
||||
; Disk
|
||||
&uword DSKPTH = $dff020 ; disk DMA pointer (high)
|
||||
&uword DSKPTL = $dff022 ; disk DMA pointer (low)
|
||||
&pointer DSKPT = $dff020 ; disk DMA pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword DSKLEN = $dff024 ; disk DMA length
|
||||
&uword DSKDAT = $dff026 ; disk DMA data write
|
||||
&uword REFPTR = $dff028 ; refresh pointer
|
||||
|
||||
; Beam position (write)
|
||||
&uword VPOSW = $dff02a ; beam position write (V)
|
||||
&uword VHPOSW = $dff02c ; beam position write (H)
|
||||
&uword COPCON = $dff02e ; copper control
|
||||
|
||||
; Serial
|
||||
&uword SERDAT = $dff030 ; serial port data write
|
||||
&uword SERPER = $dff032 ; serial port period/control
|
||||
|
||||
; Pot/Game
|
||||
&uword POTGO = $dff034 ; pot port control
|
||||
&uword JOYTEST = $dff036 ; joystick counter test
|
||||
&uword STREQU = $dff038 ; short frame strobe (ECS)
|
||||
&uword STRVBL = $dff03a ; vertical blank strobe (ECS)
|
||||
&uword STRHOR = $dff03c ; horizontal sync strobe (ECS)
|
||||
&uword STRLONG = $dff03e ; long frame strobe (ECS)
|
||||
|
||||
; Blitter
|
||||
&uword BLTCON0 = $dff040 ; blitter control 0
|
||||
&uword BLTCON1 = $dff042 ; blitter control 1
|
||||
&uword BLTAFWM = $dff044 ; blitter A first word mask
|
||||
&uword BLTALWM = $dff046 ; blitter A last word mask
|
||||
&uword BLTCPTH = $dff048 ; blitter C pointer (high)
|
||||
&uword BLTCPTL = $dff04a ; blitter C pointer (low)
|
||||
&pointer BLTCPT = $dff048 ; blitter C pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword BLTBPTH = $dff04c ; blitter B pointer (high)
|
||||
&uword BLTBPTL = $dff04e ; blitter B pointer (low)
|
||||
&pointer BLTBPT = $dff04c ; blitter B pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword BLTAPTH = $dff050 ; blitter A pointer (high)
|
||||
&uword BLTAPTL = $dff052 ; blitter A pointer (low)
|
||||
&pointer BLTAPT = $dff050 ; blitter A pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword BLTDPTH = $dff054 ; blitter D pointer (high)
|
||||
&uword BLTDPTL = $dff056 ; blitter D pointer (low)
|
||||
&pointer BLTDPT = $dff054 ; blitter D pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword BLTSIZE = $dff058 ; blitter size (starts blit)
|
||||
&uword BLTCON0L = $dff05a ; blitter control 0 (lower bits, ECS)
|
||||
&uword BLTSIZV = $dff05c ; blitter V size (ECS)
|
||||
&uword BLTSIZH = $dff05e ; blitter H size (ECS, starts blit)
|
||||
&uword BLTCMOD = $dff060 ; blitter C modulo
|
||||
&uword BLTBMOD = $dff062 ; blitter B modulo
|
||||
&uword BLTAMOD = $dff064 ; blitter A modulo
|
||||
&uword BLTDMOD = $dff066 ; blitter D modulo
|
||||
&uword BLTCDAT = $dff070 ; blitter C data
|
||||
&uword BLTBDAT = $dff072 ; blitter B data
|
||||
&uword BLTADAT = $dff074 ; blitter A data
|
||||
&uword SPRHDAT = $dff078 ; ext sprite data (ECS)
|
||||
&uword DENISEID = $dff07c ; Denise/Lisa chip ID (ECS/AGA)
|
||||
&uword DSKSYNC = $dff07e ; disk sync pattern
|
||||
|
||||
; Copper
|
||||
&uword COP1LCH = $dff080 ; copper 1 list pointer (high)
|
||||
&uword COP1LCL = $dff082 ; copper 1 list pointer (low)
|
||||
&pointer COP1LC = $dff080 ; copper 1 list pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword COP2LCH = $dff084 ; copper 2 list pointer (high)
|
||||
&uword COP2LCL = $dff086 ; copper 2 list pointer (low)
|
||||
&pointer COP2LC = $dff084 ; copper 2 list pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword COPJMP1 = $dff088 ; copper jump strobe 1
|
||||
&uword COPJMP2 = $dff08a ; copper jump strobe 2
|
||||
&uword COPINS = $dff08c ; copper instruction fetch
|
||||
|
||||
; Display window / data fetch
|
||||
&uword DIWSTRT = $dff08e ; display window start
|
||||
&uword DIWSTOP = $dff090 ; display window stop
|
||||
&uword DDFSTRT = $dff092 ; data fetch start
|
||||
&uword DDFSTOP = $dff094 ; data fetch stop
|
||||
|
||||
; Control registers
|
||||
&uword DMACON = $dff096 ; DMA control write
|
||||
&uword CLXCON = $dff098 ; collision control
|
||||
&uword INTENA = $dff09a ; interrupt enable
|
||||
&uword INTREQ = $dff09c ; interrupt request
|
||||
&uword ADKCON = $dff09e ; audio/disk control
|
||||
|
||||
; ========== Audio channels ==========
|
||||
|
||||
&uword AUD0PTH = $dff0a0 ; audio 0 pointer (high)
|
||||
&uword AUD0PTL = $dff0a2 ; audio 0 pointer (low)
|
||||
&pointer AUD0PT = $dff0a0 ; audio 0 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword AUD0LEN = $dff0a4 ; audio 0 length
|
||||
&uword AUD0PER = $dff0a6 ; audio 0 period
|
||||
&uword AUD0VOL = $dff0a8 ; audio 0 volume
|
||||
&uword AUD0DAT = $dff0aa ; audio 0 sample data
|
||||
|
||||
&uword AUD1PTH = $dff0b0 ; audio 1 pointer (high)
|
||||
&uword AUD1PTL = $dff0b2 ; audio 1 pointer (low)
|
||||
&pointer AUD1PT = $dff0b0 ; audio 1 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword AUD1LEN = $dff0b4 ; audio 1 length
|
||||
&uword AUD1PER = $dff0b6 ; audio 1 period
|
||||
&uword AUD1VOL = $dff0b8 ; audio 1 volume
|
||||
&uword AUD1DAT = $dff0ba ; audio 1 sample data
|
||||
|
||||
&uword AUD2PTH = $dff0c0 ; audio 2 pointer (high)
|
||||
&uword AUD2PTL = $dff0c2 ; audio 2 pointer (low)
|
||||
&pointer AUD2PT = $dff0c0 ; audio 2 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword AUD2LEN = $dff0c4 ; audio 2 length
|
||||
&uword AUD2PER = $dff0c6 ; audio 2 period
|
||||
&uword AUD2VOL = $dff0c8 ; audio 2 volume
|
||||
&uword AUD2DAT = $dff0ca ; audio 2 sample data
|
||||
|
||||
&uword AUD3PTH = $dff0d0 ; audio 3 pointer (high)
|
||||
&uword AUD3PTL = $dff0d2 ; audio 3 pointer (low)
|
||||
&pointer AUD3PT = $dff0d0 ; audio 3 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword AUD3LEN = $dff0d4 ; audio 3 length
|
||||
&uword AUD3PER = $dff0d6 ; audio 3 period
|
||||
&uword AUD3VOL = $dff0d8 ; audio 3 volume
|
||||
&uword AUD3DAT = $dff0da ; audio 3 sample data
|
||||
|
||||
; ========== Bitplane pointers ==========
|
||||
|
||||
&uword BPL1PTH = $dff0e0 ; bitplane 1 pointer (high)
|
||||
&uword BPL1PTL = $dff0e2 ; bitplane 1 pointer (low)
|
||||
&pointer BPL1PT = $dff0e0 ; bitplane 1 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword BPL2PTH = $dff0e4 ; bitplane 2 pointer (high)
|
||||
&uword BPL2PTL = $dff0e6 ; bitplane 2 pointer (low)
|
||||
&pointer BPL2PT = $dff0e4 ; bitplane 2 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword BPL3PTH = $dff0e8 ; bitplane 3 pointer (high)
|
||||
&uword BPL3PTL = $dff0ea ; bitplane 3 pointer (low)
|
||||
&pointer BPL3PT = $dff0e8 ; bitplane 3 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword BPL4PTH = $dff0ec ; bitplane 4 pointer (high)
|
||||
&uword BPL4PTL = $dff0ee ; bitplane 4 pointer (low)
|
||||
&pointer BPL4PT = $dff0ec ; bitplane 4 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword BPL5PTH = $dff0f0 ; bitplane 5 pointer (high)
|
||||
&uword BPL5PTL = $dff0f2 ; bitplane 5 pointer (low)
|
||||
&pointer BPL5PT = $dff0f0 ; bitplane 5 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword BPL6PTH = $dff0f4 ; bitplane 6 pointer (high)
|
||||
&uword BPL6PTL = $dff0f6 ; bitplane 6 pointer (low)
|
||||
&pointer BPL6PT = $dff0f4 ; bitplane 6 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword BPL7PTH = $dff0f8 ; bitplane 7 pointer (high)
|
||||
&uword BPL7PTL = $dff0fa ; bitplane 7 pointer (low)
|
||||
&pointer BPL7PT = $dff0f8 ; bitplane 7 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword BPL8PTH = $dff0fc ; bitplane 8 pointer (high)
|
||||
&uword BPL8PTL = $dff0fe ; bitplane 8 pointer (low)
|
||||
&pointer BPL8PT = $dff0fc ; bitplane 8 pointer (full 32-bit, hi/lo auto-increment)
|
||||
|
||||
; ========== Bitplane control ==========
|
||||
|
||||
&uword BPLCON0 = $dff100 ; bitplane control 0
|
||||
&uword BPLCON1 = $dff102 ; bitplane control 1 (scroll)
|
||||
&uword BPLCON2 = $dff104 ; bitplane control 2 (priority)
|
||||
&uword BPLCON3 = $dff106 ; bitplane control 3 (AGA)
|
||||
&uword BPL1MOD = $dff108 ; bitplane modulo (odd planes)
|
||||
&uword BPL2MOD = $dff10a ; bitplane modulo (even planes)
|
||||
&uword BPLCON4 = $dff10c ; bitplane control 4 (AGA)
|
||||
|
||||
&uword BPL1DAT = $dff110 ; bitplane 1 data
|
||||
&uword BPL2DAT = $dff112 ; bitplane 2 data
|
||||
&uword BPL3DAT = $dff114 ; bitplane 3 data
|
||||
&uword BPL4DAT = $dff116 ; bitplane 4 data
|
||||
&uword BPL5DAT = $dff118 ; bitplane 5 data
|
||||
&uword BPL6DAT = $dff11a ; bitplane 6 data
|
||||
&uword BPL7DAT = $dff11c ; bitplane 7 data
|
||||
&uword BPL8DAT = $dff11e ; bitplane 8 data
|
||||
|
||||
; ========== Sprite pointers ==========
|
||||
|
||||
&uword SPR0PTH = $dff120 ; sprite 0 pointer (high)
|
||||
&uword SPR0PTL = $dff122 ; sprite 0 pointer (low)
|
||||
&pointer SPR0PT = $dff120 ; sprite 0 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword SPR1PTH = $dff124 ; sprite 1 pointer (high)
|
||||
&uword SPR1PTL = $dff126 ; sprite 1 pointer (low)
|
||||
&pointer SPR1PT = $dff124 ; sprite 1 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword SPR2PTH = $dff128 ; sprite 2 pointer (high)
|
||||
&uword SPR2PTL = $dff12a ; sprite 2 pointer (low)
|
||||
&pointer SPR2PT = $dff128 ; sprite 2 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword SPR3PTH = $dff12c ; sprite 3 pointer (high)
|
||||
&uword SPR3PTL = $dff12e ; sprite 3 pointer (low)
|
||||
&pointer SPR3PT = $dff12c ; sprite 3 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword SPR4PTH = $dff130 ; sprite 4 pointer (high)
|
||||
&uword SPR4PTL = $dff132 ; sprite 4 pointer (low)
|
||||
&pointer SPR4PT = $dff130 ; sprite 4 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword SPR5PTH = $dff134 ; sprite 5 pointer (high)
|
||||
&uword SPR5PTL = $dff136 ; sprite 5 pointer (low)
|
||||
&pointer SPR5PT = $dff134 ; sprite 5 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword SPR6PTH = $dff138 ; sprite 6 pointer (high)
|
||||
&uword SPR6PTL = $dff13a ; sprite 6 pointer (low)
|
||||
&pointer SPR6PT = $dff138 ; sprite 6 pointer (full 32-bit, hi/lo auto-increment)
|
||||
&uword SPR7PTH = $dff13c ; sprite 7 pointer (high)
|
||||
&uword SPR7PTL = $dff13e ; sprite 7 pointer (low)
|
||||
&pointer SPR7PT = $dff13c ; sprite 7 pointer (full 32-bit, hi/lo auto-increment)
|
||||
|
||||
; ========== Sprite data ==========
|
||||
|
||||
&uword SPR0POS = $dff140 ; sprite 0 position
|
||||
&uword SPR0CTL = $dff142 ; sprite 0 control
|
||||
&uword SPR0DATA = $dff144 ; sprite 0 data A
|
||||
&uword SPR0DATB = $dff146 ; sprite 0 data B
|
||||
&uword SPR1POS = $dff148 ; sprite 1 position
|
||||
&uword SPR1CTL = $dff14a ; sprite 1 control
|
||||
&uword SPR1DATA = $dff14c ; sprite 1 data A
|
||||
&uword SPR1DATB = $dff14e ; sprite 1 data B
|
||||
&uword SPR2POS = $dff150 ; sprite 2 position
|
||||
&uword SPR2CTL = $dff152 ; sprite 2 control
|
||||
&uword SPR2DATA = $dff154 ; sprite 2 data A
|
||||
&uword SPR2DATB = $dff156 ; sprite 2 data B
|
||||
&uword SPR3POS = $dff158 ; sprite 3 position
|
||||
&uword SPR3CTL = $dff15a ; sprite 3 control
|
||||
&uword SPR3DATA = $dff15c ; sprite 3 data A
|
||||
&uword SPR3DATB = $dff15e ; sprite 3 data B
|
||||
&uword SPR4POS = $dff160 ; sprite 4 position
|
||||
&uword SPR4CTL = $dff162 ; sprite 4 control
|
||||
&uword SPR4DATA = $dff164 ; sprite 4 data A
|
||||
&uword SPR4DATB = $dff166 ; sprite 4 data B
|
||||
&uword SPR5POS = $dff168 ; sprite 5 position
|
||||
&uword SPR5CTL = $dff16a ; sprite 5 control
|
||||
&uword SPR5DATA = $dff16c ; sprite 5 data A
|
||||
&uword SPR5DATB = $dff16e ; sprite 5 data B
|
||||
&uword SPR6POS = $dff170 ; sprite 6 position
|
||||
&uword SPR6CTL = $dff172 ; sprite 6 control
|
||||
&uword SPR6DATA = $dff174 ; sprite 6 data A
|
||||
&uword SPR6DATB = $dff176 ; sprite 6 data B
|
||||
&uword SPR7POS = $dff178 ; sprite 7 position
|
||||
&uword SPR7CTL = $dff17a ; sprite 7 control
|
||||
&uword SPR7DATA = $dff17c ; sprite 7 data A
|
||||
&uword SPR7DATB = $dff17e ; sprite 7 data B
|
||||
|
||||
; ========== Color palette ==========
|
||||
|
||||
&uword COLOR00 = $dff180 ; color 0 (background)
|
||||
&uword COLOR01 = $dff182
|
||||
&uword COLOR02 = $dff184
|
||||
&uword COLOR03 = $dff186
|
||||
&uword COLOR04 = $dff188
|
||||
&uword COLOR05 = $dff18a
|
||||
&uword COLOR06 = $dff18c
|
||||
&uword COLOR07 = $dff18e
|
||||
&uword COLOR08 = $dff190
|
||||
&uword COLOR09 = $dff192
|
||||
&uword COLOR10 = $dff194
|
||||
&uword COLOR11 = $dff196
|
||||
&uword COLOR12 = $dff198
|
||||
&uword COLOR13 = $dff19a
|
||||
&uword COLOR14 = $dff19c
|
||||
&uword COLOR15 = $dff19e
|
||||
&uword COLOR16 = $dff1a0
|
||||
&uword COLOR17 = $dff1a2
|
||||
&uword COLOR18 = $dff1a4
|
||||
&uword COLOR19 = $dff1a6
|
||||
&uword COLOR20 = $dff1a8
|
||||
&uword COLOR21 = $dff1aa
|
||||
&uword COLOR22 = $dff1ac
|
||||
&uword COLOR23 = $dff1ae
|
||||
&uword COLOR24 = $dff1b0
|
||||
&uword COLOR25 = $dff1b2
|
||||
&uword COLOR26 = $dff1b4
|
||||
&uword COLOR27 = $dff1b6
|
||||
&uword COLOR28 = $dff1b8
|
||||
&uword COLOR29 = $dff1ba
|
||||
&uword COLOR30 = $dff1bc
|
||||
&uword COLOR31 = $dff1be
|
||||
|
||||
; ========== ECS/AGA extended registers ==========
|
||||
|
||||
&uword HTOTAL = $dff1c0 ; H total (ECS)
|
||||
&uword HSSTOP = $dff1c2 ; H sync stop (ECS)
|
||||
&uword HBSTRT = $dff1c4 ; H blank start (ECS)
|
||||
&uword HBSTOP = $dff1c6 ; H blank stop (ECS)
|
||||
&uword VTOTAL = $dff1c8 ; V total (ECS)
|
||||
&uword VSSTOP = $dff1ca ; V sync stop (ECS)
|
||||
&uword VBSTRT = $dff1cc ; V blank start (ECS)
|
||||
&uword VBSTOP = $dff1ce ; V blank stop (ECS)
|
||||
&uword SPRHSTRT = $dff1d0 ; sprite horizontal start (AGA)
|
||||
&uword SPRHSTOP = $dff1d2 ; sprite horizontal stop (AGA)
|
||||
&uword BPLHSTRT = $dff1d4 ; bitplane horizontal start (AGA)
|
||||
&uword BPLHSTOP = $dff1d6 ; bitplane horizontal stop (AGA)
|
||||
&uword HHPOSW = $dff1d8 ; horizontal hardware position write (AGA)
|
||||
&uword HHPOSR = $dff1da ; horizontal hardware position read (AGA)
|
||||
&uword BEAMCON0 = $dff1dc ; beam counter control (ECS)
|
||||
&uword HSSTRT = $dff1de ; H sync start (ECS)
|
||||
&uword VSSTRT = $dff1e0 ; V sync start (ECS)
|
||||
&uword DIWHIGH = $dff1e4 ; display window high bits (ECS)
|
||||
&uword FMODE = $dff1fc ; fetch mode (AGA)
|
||||
|
||||
; ========== Blitter minterm constants ==========
|
||||
|
||||
const uword ABC = $80 ; A and B and C
|
||||
const uword ABNC = $40 ; A and B and not C
|
||||
const uword ANBC = $20 ; A and not B and C
|
||||
const uword ANBNC = $10 ; A and not B and not C
|
||||
const uword NABC = $8 ; not A and B and C
|
||||
const uword NABNC = $4 ; not A and not B and C
|
||||
const uword NANBC = $2 ; not A and B and not C
|
||||
const uword NANBNC = $1 ; not A and not B and not C
|
||||
|
||||
; Common blitter minterms
|
||||
const uword MINTERM_COPY = ABC | ABNC | ANBC | NABC ; A (straight copy)
|
||||
const uword MINTERM_OR = ABC | ABNC | ANBC | NABC | ANBNC | NANBC ; A or B
|
||||
const uword MINTERM_AND = ABC ; A and B
|
||||
const uword MINTERM_XOR = ANBC | NABC ; A xor B
|
||||
const uword MINTERM_NOT = ANBNC | NANBNC ; not A
|
||||
const uword MINTERM_CLEAR = 0 ; clear all
|
||||
const uword MINTERM_NOP = ABNC | ANBNC ; no operation
|
||||
|
||||
; ========== DMA control bits (dmacon) ==========
|
||||
|
||||
const uword DMAF_SETCLR = $8000
|
||||
const uword DMAF_AUD0 = $0001
|
||||
const uword DMAF_AUD1 = $0002
|
||||
const uword DMAF_AUD2 = $0004
|
||||
const uword DMAF_AUD3 = $0008
|
||||
const uword DMAF_AUDIO = $000f
|
||||
const uword DMAF_DISK = $0010
|
||||
const uword DMAF_SPRITE = $0020
|
||||
const uword DMAF_BLITTER = $0040
|
||||
const uword DMAF_COPPER = $0080
|
||||
const uword DMAF_RASTER = $0100
|
||||
const uword DMAF_MASTER = $0200
|
||||
const uword DMAF_BLITHOG = $0400
|
||||
const uword DMAF_ALL = $01ff
|
||||
|
||||
; DMA status read bits
|
||||
const uword DMAF_BLTDONE = $4000
|
||||
const uword DMAF_BLTNZERO = $2000
|
||||
|
||||
; ========== Interrupt bits (intena/intreq) ==========
|
||||
|
||||
const uword INTF_SETCLR = $8000
|
||||
const uword INTF_INTEN = $4000
|
||||
const uword INTF_EXTER = $2000
|
||||
const uword INTF_DSKSYNC = $1000
|
||||
const uword INTF_RBF = $0800
|
||||
const uword INTF_AUD3 = $0400
|
||||
const uword INTF_AUD2 = $0200
|
||||
const uword INTF_AUD1 = $0100
|
||||
const uword INTF_AUD0 = $0080
|
||||
const uword INTF_BLIT = $0040
|
||||
const uword INTF_VERTB = $0020
|
||||
const uword INTF_COPER = $0010
|
||||
const uword INTF_PORTS = $0008
|
||||
const uword INTF_SOFTINT = $0004
|
||||
const uword INTF_DSKBLK = $0002
|
||||
const uword INTF_TBE = $0001
|
||||
|
||||
; ========== ADK control bits (adkcon) ==========
|
||||
|
||||
const uword ADKF_SETCLR = $8000
|
||||
const uword ADKF_PRECOMP1 = $4000
|
||||
const uword ADKF_PRECOMP0 = $2000
|
||||
const uword ADKF_MFMPREC = $1000
|
||||
const uword ADKF_UARTBRK = $0800
|
||||
const uword ADKF_WORDSYNC = $0400
|
||||
const uword ADKF_MSBSYNC = $0200
|
||||
const uword ADKF_FAST = $0100
|
||||
const uword ADKF_USE3PN = $0080
|
||||
const uword ADKF_USE2P3 = $0040
|
||||
const uword ADKF_USE1P2 = $0020
|
||||
const uword ADKF_USE0P1 = $0010
|
||||
const uword ADKF_USE3VN = $0008
|
||||
const uword ADKF_USE2V3 = $0004
|
||||
const uword ADKF_USE1V2 = $0002
|
||||
const uword ADKF_USE0V1 = $0001
|
||||
|
||||
; ========== Blitter control bits (bltcon0) ==========
|
||||
|
||||
const uword BC0F_DEST = $0100
|
||||
const uword BC0F_SRCC = $0200
|
||||
const uword BC0F_SRCB = $0400
|
||||
const uword BC0F_SRCA = $0800
|
||||
|
||||
; ========== Blitter control bits (bltcon1) ==========
|
||||
|
||||
const uword BC1F_DESC = $0002
|
||||
const uword BC1F_LINEMODE = $0001
|
||||
const uword BC1F_FILL_OR = $0008
|
||||
const uword BC1F_FILL_XOR = $0010
|
||||
const uword BC1F_FILL_CARRYIN = $0004
|
||||
const uword BC1F_ONEDOT = $0002
|
||||
const uword BC1F_OVFLAG = $0020
|
||||
const uword BC1F_SIGNFLAG = $0040
|
||||
const uword BC1F_SUD = $0010
|
||||
const uword BC1F_SUL = $0008
|
||||
const uword BC1F_AUL = $0004
|
||||
|
||||
; ========== CIA registers ==========
|
||||
|
||||
; CIA-A at $bfe001 (odd, accessed on D8-D15)
|
||||
; CIA-B at $bfd000 (even, accessed on D0-D7)
|
||||
; Each CIA register is spaced $100 apart
|
||||
|
||||
&ubyte CIAA_PRA = $bfe001 ; CIA-A peripheral A (serial data, floppy, keyboard)
|
||||
&ubyte CIAA_PRB = $bfe101 ; CIA-A peripheral B (parallel port)
|
||||
&ubyte CIAA_DDRA = $bfe201 ; CIA-A data direction A
|
||||
&ubyte CIAA_DDRB = $bfe301 ; CIA-A data direction B
|
||||
&ubyte CIAA_TALO = $bfe401 ; CIA-A timer A low
|
||||
&ubyte CIAA_TAHI = $bfe501 ; CIA-A timer A high
|
||||
&ubyte CIAA_TBLO = $bfe601 ; CIA-A timer B low
|
||||
&ubyte CIAA_TBHI = $bfe701 ; CIA-A timer B high
|
||||
&ubyte CIAA_TODLOW = $bfe801 ; CIA-A TOD low
|
||||
&ubyte CIAA_TODMID = $bfe901 ; CIA-A TOD mid
|
||||
&ubyte CIAA_TODHI = $bfea01 ; CIA-A TOD high
|
||||
&ubyte CIAA_SDR = $bfec01 ; CIA-A serial data
|
||||
&ubyte CIAA_ICR = $bfed01 ; CIA-A interrupt control
|
||||
&ubyte CIAA_CRA = $bfee01 ; CIA-A control A
|
||||
&ubyte CIAA_CRB = $bfef01 ; CIA-A control B
|
||||
|
||||
&ubyte CIAB_PRA = $bfd000 ; CIA-B peripheral A (RS-232)
|
||||
&ubyte CIAB_PRB = $bfd100 ; CIA-B peripheral B (printer)
|
||||
&ubyte CIAB_DDRA = $bfd200 ; CIA-B data direction A
|
||||
&ubyte CIAB_DDRB = $bfd300 ; CIA-B data direction B
|
||||
&ubyte CIAB_TALO = $bfd400 ; CIA-B timer A low
|
||||
&ubyte CIAB_TAHI = $bfd500 ; CIA-B timer A high
|
||||
&ubyte CIAB_TBLO = $bfd600 ; CIA-B timer B low
|
||||
&ubyte CIAB_TBHI = $bfd700 ; CIA-B timer B high
|
||||
&ubyte CIAB_TODLOW = $bfd800 ; CIA-B TOD low
|
||||
&ubyte CIAB_TODMID = $bfd900 ; CIA-B TOD mid
|
||||
&ubyte CIAB_TODHI = $bfda00 ; CIA-B TOD high
|
||||
&ubyte CIAB_SDR = $bfdc00 ; CIA-B serial data
|
||||
&ubyte CIAB_ICR = $bfdd00 ; CIA-B interrupt control
|
||||
&ubyte CIAB_CRA = $bfde00 ; CIA-B control A
|
||||
&ubyte CIAB_CRB = $bfdf00 ; CIA-B control B
|
||||
}
|
||||
@@ -0,0 +1,868 @@
|
||||
;; Auto-generated from dos_lib.sfd and dos_lib.i
|
||||
;; Library base: _DOSBase in prog8: sys.DOSBase
|
||||
;; Bank: 2
|
||||
;; Functions: 161
|
||||
|
||||
%import exec
|
||||
%import utility
|
||||
|
||||
dos {
|
||||
%option merge, no_symbol_prefixing
|
||||
extsub @bank 2 -30 = Open(str name @D1, long accessMode @D2) -> pointer @D0
|
||||
extsub @bank 2 -36 = Close(pointer file @D1) -> long @D0
|
||||
extsub @bank 2 -42 = Read(pointer file @D1, pointer buffer @D2, long length @D3) -> long @D0
|
||||
extsub @bank 2 -48 = Write(pointer file @D1, pointer buffer @D2, long length @D3) -> long @D0
|
||||
extsub @bank 2 -54 = Input() -> pointer @D0
|
||||
extsub @bank 2 -60 = Output() -> pointer @D0
|
||||
extsub @bank 2 -66 = Seek(pointer file @D1, long position @D2, long offset @D3) -> long @D0
|
||||
extsub @bank 2 -72 = DeleteFile(str name @D1) -> long @D0
|
||||
extsub @bank 2 -78 = Rename(str oldName @D1, str newName @D2) -> long @D0
|
||||
extsub @bank 2 -84 = Lock(str name @D1, long k_type @D2) -> pointer @D0
|
||||
extsub @bank 2 -90 = UnLock(pointer lock @D1)
|
||||
extsub @bank 2 -96 = DupLock(pointer lock @D1) -> pointer @D0
|
||||
extsub @bank 2 -102 = Examine(pointer lock @D1, ^^FileInfoBlock fileInfoBlock @D2) -> long @D0
|
||||
extsub @bank 2 -108 = ExNext(pointer lock @D1, ^^FileInfoBlock fileInfoBlock @D2) -> long @D0
|
||||
extsub @bank 2 -114 = Info(pointer lock @D1, ^^InfoData parameterBlock @D2) -> long @D0
|
||||
extsub @bank 2 -120 = CreateDir(str name @D1) -> pointer @D0
|
||||
extsub @bank 2 -126 = CurrentDir(pointer lock @D1) -> pointer @D0
|
||||
extsub @bank 2 -132 = IoErr() -> long @D0
|
||||
extsub @bank 2 -138 = CreateProc(str name @D1, long pri @D2, pointer segList @D3, long stackSize @D4) -> ^^exec.MsgPort @D0
|
||||
extsub @bank 2 -144 = Exit(long returnCode @D1)
|
||||
extsub @bank 2 -150 = LoadSeg(str name @D1) -> pointer @D0
|
||||
extsub @bank 2 -156 = UnLoadSeg(pointer seglist @D1)
|
||||
extsub @bank 2 -174 = DeviceProc(str name @D1) -> ^^exec.MsgPort @D0
|
||||
extsub @bank 2 -180 = SetComment(str name @D1, str comment @D2) -> long @D0
|
||||
extsub @bank 2 -186 = SetProtection(str name @D1, long protect @D2) -> long @D0
|
||||
extsub @bank 2 -192 = DateStamp(^^DateStampStruct date @D1) -> ^^DateStampStruct @D0
|
||||
extsub @bank 2 -198 = Delay(long timeout @D1)
|
||||
extsub @bank 2 -204 = WaitForChar(pointer file @D1, long timeout @D2) -> long @D0
|
||||
extsub @bank 2 -210 = ParentDir(pointer lock @D1) -> pointer @D0
|
||||
extsub @bank 2 -216 = IsInteractive(pointer file @D1) -> long @D0
|
||||
extsub @bank 2 -222 = Execute(str string @D1, pointer file @D2, pointer file2 @D3) -> long @D0
|
||||
extsub @bank 2 -228 = AllocDosObject(long k_type @D1, pointer tags @D2) -> pointer @D0
|
||||
extsub @bank 2 -234 = FreeDosObject(long k_type @D1, pointer ptr @D2)
|
||||
extsub @bank 2 -240 = DoPkt(^^exec.MsgPort port @D1, long action @D2, long arg1 @D3, long arg2 @D4, long arg3 @D5, long arg4 @D6, long arg5 @D7) -> long @D0
|
||||
extsub @bank 2 -246 = SendPkt(^^DosPacket dp @D1, ^^exec.MsgPort port @D2, ^^exec.MsgPort replyport @D3)
|
||||
extsub @bank 2 -252 = WaitPkt() -> ^^DosPacket @D0
|
||||
extsub @bank 2 -258 = ReplyPkt(^^DosPacket dp @D1, long res1 @D2, long res2 @D3)
|
||||
extsub @bank 2 -264 = AbortPkt(^^exec.MsgPort port @D1, ^^DosPacket pkt @D2)
|
||||
extsub @bank 2 -270 = LockRecord(pointer fh @D1, long offset @D2, long length @D3, long mode @D4, long timeout @D5) -> bool @D0
|
||||
extsub @bank 2 -276 = LockRecords(pointer recArray @D1, long timeout @D2) -> bool @D0
|
||||
extsub @bank 2 -282 = UnLockRecord(pointer fh @D1, long offset @D2, long length @D3) -> bool @D0
|
||||
extsub @bank 2 -288 = UnLockRecords(pointer recArray @D1) -> bool @D0
|
||||
extsub @bank 2 -294 = SelectInput(pointer fh @D1) -> pointer @D0
|
||||
extsub @bank 2 -300 = SelectOutput(pointer fh @D1) -> pointer @D0
|
||||
extsub @bank 2 -306 = FGetC(pointer fh @D1) -> long @D0
|
||||
extsub @bank 2 -312 = FPutC(pointer fh @D1, long ch @D2) -> long @D0
|
||||
extsub @bank 2 -318 = UnGetC(pointer fh @D1, long character @D2) -> long @D0
|
||||
extsub @bank 2 -324 = FRead(pointer fh @D1, pointer block @D2, long blocklen @D3, long number @D4) -> long @D0
|
||||
extsub @bank 2 -330 = FWrite(pointer fh @D1, pointer block @D2, long blocklen @D3, long number @D4) -> long @D0
|
||||
extsub @bank 2 -336 = FGets(pointer fh @D1, str buf @D2, long buflen @D3) -> str @D0
|
||||
extsub @bank 2 -342 = FPuts(pointer fh @D1, str k_str @D2) -> long @D0
|
||||
extsub @bank 2 -348 = VFWritef(pointer fh @D1, str format @D2, pointer argarray @D3)
|
||||
extsub @bank 2 -354 = VFPrintf(pointer fh @D1, str format @D2, pointer argarray @D3) -> long @D0
|
||||
extsub @bank 2 -360 = Flush(pointer fh @D1) -> long @D0
|
||||
extsub @bank 2 -366 = SetVBuf(pointer fh @D1, str buff @D2, long k_type @D3, long size @D4) -> long @D0
|
||||
extsub @bank 2 -372 = DupLockFromFH(pointer fh @D1) -> pointer @D0
|
||||
extsub @bank 2 -378 = OpenFromLock(pointer lock @D1) -> pointer @D0
|
||||
extsub @bank 2 -384 = ParentOfFH(pointer fh @D1) -> pointer @D0
|
||||
extsub @bank 2 -390 = ExamineFH(pointer fh @D1, ^^FileInfoBlock fib @D2) -> bool @D0
|
||||
extsub @bank 2 -396 = SetFileDate(str name @D1, ^^DateStampStruct date @D2) -> long @D0
|
||||
extsub @bank 2 -402 = NameFromLock(pointer lock @D1, str buffer @D2, long len @D3) -> long @D0
|
||||
extsub @bank 2 -408 = NameFromFH(pointer fh @D1, str buffer @D2, long len @D3) -> long @D0
|
||||
extsub @bank 2 -414 = SplitName(str name @D1, ubyte separator @D2, str buf @D3, word oldpos @D4, long size @D5) -> word @D0
|
||||
extsub @bank 2 -420 = SameLock(pointer lock1 @D1, pointer lock2 @D2) -> long @D0
|
||||
extsub @bank 2 -426 = SetMode(pointer fh @D1, long mode @D2) -> long @D0
|
||||
extsub @bank 2 -432 = ExAll(pointer lock @D1, ^^ExAllData buffer @D2, long size @D3, long data @D4, ^^ExAllControl control @D5) -> long @D0
|
||||
extsub @bank 2 -438 = ReadLink(^^exec.MsgPort port @D1, pointer lock @D2, str path @D3, str buffer @D4, long size @D5) -> long @D0
|
||||
extsub @bank 2 -444 = MakeLink(str name @D1, long dest @D2, long soft @D3) -> long @D0
|
||||
extsub @bank 2 -450 = ChangeMode(long k_type @D1, pointer fh @D2, long newmode @D3) -> long @D0
|
||||
extsub @bank 2 -456 = SetFileSize(pointer fh @D1, long pos @D2, long mode @D3) -> long @D0
|
||||
extsub @bank 2 -462 = SetIoErr(long result @D1) -> long @D0
|
||||
extsub @bank 2 -468 = Fault(long code @D1, str header @D2, str buffer @D3, long len @D4) -> bool @D0
|
||||
extsub @bank 2 -474 = PrintFault(long code @D1, str header @D2) -> bool @D0
|
||||
extsub @bank 2 -480 = ErrorReport(long code @D1, long k_type @D2, long arg1 @D3, ^^exec.MsgPort device @D4) -> long @D0
|
||||
extsub @bank 2 -492 = Cli() -> pointer @D0
|
||||
extsub @bank 2 -498 = CreateNewProc(pointer tags @D1) -> ^^Process @D0
|
||||
extsub @bank 2 -504 = RunCommand(pointer seg @D1, long stack @D2, str paramptr @D3, long paramlen @D4) -> long @D0
|
||||
extsub @bank 2 -510 = GetConsoleTask() -> ^^exec.MsgPort @D0
|
||||
extsub @bank 2 -516 = SetConsoleTask(^^exec.MsgPort task @D1) -> ^^exec.MsgPort @D0
|
||||
extsub @bank 2 -522 = GetFileSysTask() -> ^^exec.MsgPort @D0
|
||||
extsub @bank 2 -528 = SetFileSysTask(^^exec.MsgPort task @D1) -> ^^exec.MsgPort @D0
|
||||
extsub @bank 2 -534 = GetArgStr() -> str @D0
|
||||
extsub @bank 2 -540 = SetArgStr(str string @D1) -> str @D0
|
||||
extsub @bank 2 -546 = FindCliProc(long num @D1) -> ^^Process @D0
|
||||
extsub @bank 2 -552 = MaxCli() -> long @D0
|
||||
extsub @bank 2 -558 = SetCurrentDirName(str name @D1) -> bool @D0
|
||||
extsub @bank 2 -564 = GetCurrentDirName(str buf @D1, long len @D2) -> bool @D0
|
||||
extsub @bank 2 -570 = SetProgramName(str name @D1) -> bool @D0
|
||||
extsub @bank 2 -576 = GetProgramName(str buf @D1, long len @D2) -> bool @D0
|
||||
extsub @bank 2 -582 = SetPrompt(str name @D1) -> bool @D0
|
||||
extsub @bank 2 -588 = GetPrompt(str buf @D1, long len @D2) -> bool @D0
|
||||
extsub @bank 2 -594 = SetProgramDir(pointer lock @D1) -> pointer @D0
|
||||
extsub @bank 2 -600 = GetProgramDir() -> pointer @D0
|
||||
extsub @bank 2 -606 = SystemTagList(str command @D1, pointer tags @D2) -> long @D0
|
||||
extsub @bank 2 -612 = AssignLock(str name @D1, pointer lock @D2) -> long @D0
|
||||
extsub @bank 2 -618 = AssignLate(str name @D1, str path @D2) -> bool @D0
|
||||
extsub @bank 2 -624 = AssignPath(str name @D1, str path @D2) -> bool @D0
|
||||
extsub @bank 2 -630 = AssignAdd(str name @D1, pointer lock @D2) -> bool @D0
|
||||
extsub @bank 2 -636 = RemAssignList(str name @D1, pointer lock @D2) -> long @D0
|
||||
extsub @bank 2 -642 = GetDeviceProc(str name @D1, pointer dp @D2) -> pointer @D0
|
||||
extsub @bank 2 -648 = FreeDeviceProc(pointer dp @D1)
|
||||
extsub @bank 2 -654 = LockDosList(long flags @D1) -> pointer @D0
|
||||
extsub @bank 2 -660 = UnLockDosList(long flags @D1)
|
||||
extsub @bank 2 -666 = AttemptLockDosList(long flags @D1) -> pointer @D0
|
||||
extsub @bank 2 -672 = RemDosEntry(pointer dlist @D1) -> bool @D0
|
||||
extsub @bank 2 -678 = AddDosEntry(pointer dlist @D1) -> long @D0
|
||||
extsub @bank 2 -684 = FindDosEntry(pointer dlist @D1, str name @D2, long flags @D3) -> pointer @D0
|
||||
extsub @bank 2 -690 = NextDosEntry(pointer dlist @D1, long flags @D2) -> pointer @D0
|
||||
extsub @bank 2 -696 = MakeDosEntry(str name @D1, long k_type @D2) -> pointer @D0
|
||||
extsub @bank 2 -702 = FreeDosEntry(pointer dlist @D1)
|
||||
extsub @bank 2 -708 = IsFileSystem(str name @D1) -> bool @D0
|
||||
extsub @bank 2 -714 = Format(str filesystem @D1, str volumename @D2, long dostype @D3) -> bool @D0
|
||||
extsub @bank 2 -720 = Relabel(str drive @D1, str newname @D2) -> long @D0
|
||||
extsub @bank 2 -726 = Inhibit(str name @D1, long onoff @D2) -> long @D0
|
||||
extsub @bank 2 -732 = AddBuffers(str name @D1, long number @D2) -> long @D0
|
||||
extsub @bank 2 -738 = CompareDates(^^DateStampStruct date1 @D1, ^^DateStampStruct date2 @D2) -> long @D0
|
||||
extsub @bank 2 -744 = DateToStr(pointer datetime @D1) -> long @D0
|
||||
extsub @bank 2 -750 = StrToDate(pointer datetime @D1) -> long @D0
|
||||
extsub @bank 2 -756 = InternalLoadSeg(pointer fh @D0, pointer table @A0, pointer funcarray @A1, pointer stack @A2) -> pointer @D0
|
||||
extsub @bank 2 -762 = InternalUnLoadSeg(pointer seglist @D1, pointer freefunc @A1) -> bool @D0
|
||||
extsub @bank 2 -768 = NewLoadSeg(str file @D1, pointer tags @D2) -> pointer @D0
|
||||
extsub @bank 2 -774 = AddSegment(str name @D1, pointer seg @D2, long system @D3) -> long @D0
|
||||
extsub @bank 2 -780 = FindSegment(str name @D1, pointer seg @D2, long system @D3) -> pointer @D0
|
||||
extsub @bank 2 -786 = RemSegment(pointer seg @D1) -> long @D0
|
||||
extsub @bank 2 -792 = CheckSignal(long mask @D1) -> long @D0
|
||||
extsub @bank 2 -798 = ReadArgs(str arg_template @D1, pointer array @D2, pointer args @D3) -> pointer @D0
|
||||
extsub @bank 2 -804 = FindArg(str keyword @D1, str arg_template @D2) -> long @D0
|
||||
extsub @bank 2 -810 = ReadItem(str name @D1, long maxchars @D2, pointer cSource @D3) -> long @D0
|
||||
extsub @bank 2 -816 = StrToLong(str string @D1, pointer value @D2) -> long @D0
|
||||
extsub @bank 2 -822 = MatchFirst(str pat @D1, pointer anchor @D2) -> long @D0
|
||||
extsub @bank 2 -828 = MatchNext(pointer anchor @D1) -> long @D0
|
||||
extsub @bank 2 -834 = MatchEnd(pointer anchor @D1)
|
||||
extsub @bank 2 -840 = ParsePattern(str pat @D1, pointer patbuf @D2, long patbuflen @D3) -> long @D0
|
||||
extsub @bank 2 -846 = MatchPattern(pointer patbuf @D1, str k_str @D2) -> bool @D0
|
||||
extsub @bank 2 -858 = FreeArgs(pointer args @D1)
|
||||
extsub @bank 2 -870 = FilePart(str path @D1) -> str @D0
|
||||
extsub @bank 2 -876 = PathPart(str path @D1) -> str @D0
|
||||
extsub @bank 2 -882 = AddPart(str dirname @D1, str filename @D2, long size @D3) -> bool @D0
|
||||
extsub @bank 2 -888 = StartNotify(pointer notify @D1) -> bool @D0
|
||||
extsub @bank 2 -894 = EndNotify(pointer notify @D1)
|
||||
extsub @bank 2 -900 = SetVar(str name @D1, str buffer @D2, long size @D3, long flags @D4) -> bool @D0
|
||||
extsub @bank 2 -906 = GetVar(str name @D1, str buffer @D2, long size @D3, long flags @D4) -> long @D0
|
||||
extsub @bank 2 -912 = DeleteVar(str name @D1, long flags @D2) -> long @D0
|
||||
extsub @bank 2 -918 = FindVar(str name @D1, long k_type @D2) -> pointer @D0
|
||||
extsub @bank 2 -930 = CliInitNewcli(^^DosPacket dp @A0) -> long @D0
|
||||
extsub @bank 2 -936 = CliInitRun(^^DosPacket dp @A0) -> long @D0
|
||||
extsub @bank 2 -942 = WriteChars(str buf @D1, long buflen @D2) -> long @D0
|
||||
extsub @bank 2 -948 = PutStr(str k_str @D1) -> long @D0
|
||||
extsub @bank 2 -954 = VPrintf(str format @D1, pointer argarray @D2) -> long @D0
|
||||
extsub @bank 2 -966 = ParsePatternNoCase(str pat @D1, pointer patbuf @D2, long patbuflen @D3) -> long @D0
|
||||
extsub @bank 2 -972 = MatchPatternNoCase(pointer patbuf @D1, str k_str @D2) -> bool @D0
|
||||
extsub @bank 2 -984 = SameDevice(pointer lock1 @D1, pointer lock2 @D2) -> bool @D0
|
||||
extsub @bank 2 -990 = ExAllEnd(pointer lock @D1, ^^ExAllData buffer @D2, long size @D3, long data @D4, ^^ExAllControl control @D5)
|
||||
extsub @bank 2 -996 = SetOwner(str name @D1, long owner_info @D2) -> bool @D0
|
||||
extsub @bank 2 -1014 = VolumeRequestHook(str vol @D1) -> long @D0
|
||||
extsub @bank 2 -1026 = GetCurrentDir() -> pointer @D0
|
||||
extsub @bank 2 -1128 = PutErrStr(str k_str @D1) -> long @D0
|
||||
extsub @bank 2 -1134 = ErrorOutput() -> long @D0
|
||||
extsub @bank 2 -1140 = SelectError(pointer fh @D1) -> long @D0
|
||||
extsub @bank 2 -1152 = DoShellMethodTagList(long method @D0, pointer tags @A0) -> pointer @D0
|
||||
extsub @bank 2 -1158 = ScanStackToken(pointer seg @D1, long defaultstack @D2) -> long @D0
|
||||
|
||||
; ---- struct definitions ----
|
||||
|
||||
struct DateStampStruct { ; total size: 12
|
||||
long Days ; 0
|
||||
long Minute ; 4
|
||||
long Tick ; 8
|
||||
}
|
||||
|
||||
struct DosPacket { ; total size: 48
|
||||
^^exec.Message Link ; 0
|
||||
^^exec.MsgPort Port ; 4
|
||||
long Type ; 8
|
||||
long Res1 ; 12
|
||||
long Res2 ; 16
|
||||
long Arg1 ; 20
|
||||
long Arg2 ; 24
|
||||
long Arg3 ; 28
|
||||
long Arg4 ; 32
|
||||
long Arg5 ; 36
|
||||
long Arg6 ; 40
|
||||
long Arg7 ; 44
|
||||
}
|
||||
|
||||
struct ErrorString { ; total size: 8
|
||||
pointer Nums ; 0
|
||||
str Strings ; 4
|
||||
}
|
||||
|
||||
struct ExAllControl { ; total size: 16
|
||||
long Entries ; 0
|
||||
long LastKey ; 4
|
||||
str MatchString ; 8
|
||||
^^utility.Hook MatchFunc ; 12
|
||||
}
|
||||
|
||||
struct ExAllData { ; total size: 40
|
||||
^^ExAllData Next ; 0
|
||||
str Name ; 4
|
||||
long Type ; 8
|
||||
long Size ; 12
|
||||
long Prot ; 16
|
||||
long Days ; 20
|
||||
long Mins ; 24
|
||||
long Ticks ; 28
|
||||
str Comment ; 32
|
||||
uword OwnerUID ; 36
|
||||
uword OwnerGID ; 38
|
||||
}
|
||||
|
||||
struct FileHandle { ; total size: 44
|
||||
^^exec.Message Link ; 0
|
||||
^^exec.MsgPort Port ; 4
|
||||
^^exec.MsgPort Type ; 8
|
||||
pointer Buf ; 12
|
||||
long Pos ; 16
|
||||
long End ; 20
|
||||
long Funcs ; 24
|
||||
long Func2 ; 28
|
||||
long Func3 ; 32
|
||||
long Args ; 36
|
||||
long Arg2 ; 40
|
||||
}
|
||||
|
||||
struct FileInfoBlock { ; total size: 260
|
||||
long DiskKey ; 0
|
||||
long DirEntryType ; 4
|
||||
ubyte[108] FileName ; 8
|
||||
long Protection ; 116
|
||||
long EntryType ; 120
|
||||
long Size ; 124
|
||||
long NumBlocks ; 128
|
||||
long Days ; 132
|
||||
long Minute ; 136
|
||||
long Tick ; 140
|
||||
ubyte[80] Comment ; 144
|
||||
uword OwnerUID ; 224
|
||||
uword OwnerGID ; 226
|
||||
ubyte[32] Reserved ; 228
|
||||
}
|
||||
|
||||
struct FileLock { ; total size: 20
|
||||
pointer Link ; 0
|
||||
long Key ; 4
|
||||
long Access ; 8
|
||||
^^exec.MsgPort Task ; 12
|
||||
pointer Volume ; 16
|
||||
}
|
||||
|
||||
struct InfoData { ; total size: 36
|
||||
long NumSoftErrors ; 0
|
||||
long UnitNumber ; 4
|
||||
long DiskState ; 8
|
||||
long NumBlocks ; 12
|
||||
long NumBlocksUsed ; 16
|
||||
long BytesPerBlock ; 20
|
||||
long DiskType ; 24
|
||||
pointer VolumeNode ; 28
|
||||
long InUse ; 32
|
||||
}
|
||||
|
||||
struct Process { ; total size: 228
|
||||
^^exec.Node Succ ; 0
|
||||
^^exec.Node Pred ; 4
|
||||
ubyte Type ; 8
|
||||
byte Pri ; 9
|
||||
str Name ; 10
|
||||
ubyte Flags ; 14
|
||||
ubyte State ; 15
|
||||
byte IDNestCnt ; 16
|
||||
byte TDNestCnt ; 17
|
||||
long SigAlloc ; 18
|
||||
long SigWait ; 22
|
||||
long SigRecvd ; 26
|
||||
long SigExcept ; 30
|
||||
uword TrapAlloc ; 34
|
||||
uword TrapAble ; 36
|
||||
pointer ExceptData ; 38
|
||||
pointer ExceptCode ; 42
|
||||
pointer TrapData ; 46
|
||||
pointer TrapCode ; 50
|
||||
pointer SPReg ; 54
|
||||
pointer SPLower ; 58
|
||||
pointer SPUpper ; 62
|
||||
pointer Switch ; 66
|
||||
pointer Launch ; 70
|
||||
^^exec.Node Head ; 74
|
||||
^^exec.Node Tail ; 78
|
||||
^^exec.Node TailPred ; 82
|
||||
ubyte Process_List_Type ; 86
|
||||
ubyte Pad ; 87
|
||||
pointer UserData ; 88
|
||||
^^exec.Node Node_Succ ; 92
|
||||
^^exec.Node Node_Pred ; 96
|
||||
ubyte Node_Type ; 100
|
||||
byte Node_Pri ; 101
|
||||
str Node_Name ; 102
|
||||
ubyte MsgPort_Flags ; 106
|
||||
ubyte SigBit ; 107
|
||||
pointer SigTask ; 108
|
||||
^^exec.Node List_Head ; 112
|
||||
^^exec.Node List_Tail ; 116
|
||||
^^exec.Node List_TailPred ; 120
|
||||
ubyte List_Type ; 124
|
||||
ubyte List_Pad ; 125
|
||||
word Process_Pad ; 126
|
||||
pointer SegList ; 128
|
||||
long StackSize ; 132
|
||||
pointer GlobVec ; 136
|
||||
long TaskNum ; 140
|
||||
pointer StackBase ; 144
|
||||
long Result2 ; 148
|
||||
pointer CurrentDir ; 152
|
||||
pointer Cis ; 156
|
||||
pointer Cos ; 160
|
||||
pointer ConsoleTask ; 164
|
||||
pointer FileSystemTask ; 168
|
||||
pointer Cli ; 172
|
||||
pointer ReturnAddr ; 176
|
||||
pointer PktWait ; 180
|
||||
pointer WindowPtr ; 184
|
||||
pointer HomeDir ; 188
|
||||
long Process_Flags ; 192
|
||||
pointer ExitCode ; 196
|
||||
long ExitData ; 200
|
||||
str Arguments ; 204
|
||||
^^exec.MinNode MinList_Head ; 208
|
||||
^^exec.MinNode MinList_Tail ; 212
|
||||
^^exec.MinNode MinList_TailPred ; 216
|
||||
long ShellPrivate ; 220
|
||||
pointer Ces ; 224
|
||||
}
|
||||
|
||||
struct StandardPacket { ; total size: 68
|
||||
^^exec.Node Succ ; 0
|
||||
^^exec.Node Pred ; 4
|
||||
ubyte Type ; 8
|
||||
byte Pri ; 9
|
||||
str Name ; 10
|
||||
^^exec.MsgPort ReplyPort ; 14
|
||||
uword Length ; 18
|
||||
^^exec.Message Link ; 20
|
||||
^^exec.MsgPort Port ; 24
|
||||
long DosPacket_Type ; 28
|
||||
long Res1 ; 32
|
||||
long Res2 ; 36
|
||||
long Arg1 ; 40
|
||||
long Arg2 ; 44
|
||||
long Arg3 ; 48
|
||||
long Arg4 ; 52
|
||||
long Arg5 ; 56
|
||||
long Arg6 ; 60
|
||||
long Arg7 ; 64
|
||||
}
|
||||
|
||||
; ---- constants ----
|
||||
const ubyte LEN_DATSTRING = $0010
|
||||
const ubyte DTB_SUBST = 0
|
||||
const ubyte DTF_SUBST = $0001
|
||||
const ubyte DTB_FUTURE = 1
|
||||
const ubyte DTF_FUTURE = $0002
|
||||
const ubyte FORMAT_DOS = $0000
|
||||
const ubyte FORMAT_INT = $0001
|
||||
const ubyte FORMAT_USA = $0002
|
||||
const ubyte FORMAT_CDN = $0003
|
||||
const ubyte FORMAT_DEF = $0004
|
||||
const long DOSTRUE = -1
|
||||
const ubyte DOSFALSE = $0000
|
||||
const uword MODE_OLDFILE = $03ed
|
||||
const uword MODE_NEWFILE = $03ee
|
||||
const uword MODE_READWRITE = $03ec
|
||||
const long OFFSET_BEGINNING = -1
|
||||
const ubyte OFFSET_CURRENT = $0000
|
||||
const ubyte OFFSET_END = $0001
|
||||
const ubyte BITSPERBYTE = $0008
|
||||
const ubyte BYTESPERLONG = $0004
|
||||
const ubyte BITSPERLONG = $0020
|
||||
const long MAXINT = $7FFFFFFF
|
||||
const long MININT = $80000000
|
||||
const long SHARED_LOCK = -2
|
||||
const long ACCESS_READ = -2
|
||||
const long EXCLUSIVE_LOCK = -1
|
||||
const long ACCESS_WRITE = -1
|
||||
const ubyte TICKS_PER_SECOND = $0032
|
||||
const ubyte FIBB_OTR_READ = 15
|
||||
const uword FIBF_OTR_READ = $8000
|
||||
const ubyte FIBB_OTR_WRITE = 14
|
||||
const uword FIBF_OTR_WRITE = $4000
|
||||
const ubyte FIBB_OTR_EXECUTE = 13
|
||||
const uword FIBF_OTR_EXECUTE = $2000
|
||||
const ubyte FIBB_OTR_DELETE = 12
|
||||
const uword FIBF_OTR_DELETE = $1000
|
||||
const ubyte FIBB_GRP_READ = 11
|
||||
const uword FIBF_GRP_READ = $0800
|
||||
const ubyte FIBB_GRP_WRITE = 10
|
||||
const uword FIBF_GRP_WRITE = $0400
|
||||
const ubyte FIBB_GRP_EXECUTE = 9
|
||||
const uword FIBF_GRP_EXECUTE = $0200
|
||||
const ubyte FIBB_GRP_DELETE = 8
|
||||
const uword FIBF_GRP_DELETE = $0100
|
||||
const ubyte FIBB_HOLD = 7
|
||||
const ubyte FIBF_HOLD = $0080
|
||||
const ubyte FIBB_SCRIPT = 6
|
||||
const ubyte FIBF_SCRIPT = $0040
|
||||
const ubyte FIBB_PURE = 5
|
||||
const ubyte FIBF_PURE = $0020
|
||||
const ubyte FIBB_ARCHIVE = 4
|
||||
const ubyte FIBF_ARCHIVE = $0010
|
||||
const ubyte FIBB_READ = 3
|
||||
const ubyte FIBF_READ = $0008
|
||||
const ubyte FIBB_WRITE = 2
|
||||
const ubyte FIBF_WRITE = $0004
|
||||
const ubyte FIBB_EXECUTE = 1
|
||||
const ubyte FIBF_EXECUTE = $0002
|
||||
const ubyte FIBB_DELETE = 0
|
||||
const ubyte FIBF_DELETE = $0001
|
||||
const ubyte FAULT_MAX = $0052
|
||||
const ubyte ID_WRITE_PROTECTED = $0050
|
||||
const ubyte ID_VALIDATING = $0051
|
||||
const ubyte ID_VALIDATED = $0052
|
||||
const long ID_NO_DISK_PRESENT = -1
|
||||
const ubyte ID_UNREADABLE_DISK = $0042
|
||||
const ubyte ID_NOT_REALLY_DOS = $004e
|
||||
const ubyte ID_DOS_DISK = $0044
|
||||
const ubyte ID_FFS_DISK = $0044
|
||||
const ubyte ID_INTER_DOS_DISK = $0044
|
||||
const ubyte ID_INTER_FFS_DISK = $0044
|
||||
const ubyte ID_FASTDIR_DOS_DISK = $0044
|
||||
const ubyte ID_FASTDIR_FFS_DISK = $0044
|
||||
const ubyte ID_LONG_DOS_DISK = $0044
|
||||
const ubyte ID_LONG_FFS_DISK = $0044
|
||||
const ubyte ID_COMPLONG_FFS_DISK = $0044
|
||||
const ubyte ID_KICKSTART_DISK = $004b
|
||||
const ubyte ID_MSDOS_DISK = $004d
|
||||
const ubyte ERROR_NO_FREE_STORE = $0067
|
||||
const ubyte ERROR_TASK_TABLE_FULL = $0069
|
||||
const ubyte ERROR_BAD_TEMPLATE = $0072
|
||||
const ubyte ERROR_BAD_NUMBER = $0073
|
||||
const ubyte ERROR_REQUIRED_ARG_MISSING = $0074
|
||||
const ubyte ERROR_KEY_NEEDS_ARG = $0075
|
||||
const ubyte ERROR_TOO_MANY_ARGS = $0076
|
||||
const ubyte ERROR_UNMATCHED_QUOTES = $0077
|
||||
const ubyte ERROR_LINE_TOO_LONG = $0078
|
||||
const ubyte ERROR_FILE_NOT_OBJECT = $0079
|
||||
const ubyte ERROR_INVALID_RESIDENT_LIBRARY = $007a
|
||||
const ubyte ERROR_NO_DEFAULT_DIR = $00c9
|
||||
const ubyte ERROR_OBJECT_IN_USE = $00ca
|
||||
const ubyte ERROR_OBJECT_EXISTS = $00cb
|
||||
const ubyte ERROR_DIR_NOT_FOUND = $00cc
|
||||
const ubyte ERROR_OBJECT_NOT_FOUND = $00cd
|
||||
const ubyte ERROR_BAD_STREAM_NAME = $00ce
|
||||
const ubyte ERROR_OBJECT_TOO_LARGE = $00cf
|
||||
const ubyte ERROR_ACTION_NOT_KNOWN = $00d1
|
||||
const ubyte ERROR_INVALID_COMPONENT_NAME = $00d2
|
||||
const ubyte ERROR_INVALID_LOCK = $00d3
|
||||
const ubyte ERROR_OBJECT_WRONG_TYPE = $00d4
|
||||
const ubyte ERROR_DISK_NOT_VALIDATED = $00d5
|
||||
const ubyte ERROR_DISK_WRITE_PROTECTED = $00d6
|
||||
const ubyte ERROR_RENAME_ACROSS_DEVICES = $00d7
|
||||
const ubyte ERROR_DIRECTORY_NOT_EMPTY = $00d8
|
||||
const ubyte ERROR_TOO_MANY_LEVELS = $00d9
|
||||
const ubyte ERROR_DEVICE_NOT_MOUNTED = $00da
|
||||
const ubyte ERROR_SEEK_ERROR = $00db
|
||||
const ubyte ERROR_COMMENT_TOO_BIG = $00dc
|
||||
const ubyte ERROR_DISK_FULL = $00dd
|
||||
const ubyte ERROR_DELETE_PROTECTED = $00de
|
||||
const ubyte ERROR_WRITE_PROTECTED = $00df
|
||||
const ubyte ERROR_READ_PROTECTED = $00e0
|
||||
const ubyte ERROR_NOT_A_DOS_DISK = $00e1
|
||||
const ubyte ERROR_NO_DISK = $00e2
|
||||
const ubyte ERROR_NO_MORE_ENTRIES = $00e8
|
||||
const ubyte ERROR_IS_SOFT_LINK = $00e9
|
||||
const ubyte ERROR_OBJECT_LINKED = $00ea
|
||||
const ubyte ERROR_BAD_HUNK = $00eb
|
||||
const ubyte ERROR_NOT_IMPLEMENTED = $00ec
|
||||
const ubyte ERROR_RECORD_NOT_LOCKED = $00f0
|
||||
const ubyte ERROR_LOCK_COLLISION = $00f1
|
||||
const ubyte ERROR_LOCK_TIMEOUT = $00f2
|
||||
const ubyte ERROR_UNLOCK_ERROR = $00f3
|
||||
const ubyte RETURN_OK = $0000
|
||||
const ubyte RETURN_WARN = $0005
|
||||
const ubyte RETURN_ERROR = $000a
|
||||
const ubyte RETURN_FAIL = $0014
|
||||
const ubyte SIGBREAKB_CTRL_C = 12
|
||||
const uword SIGBREAKF_CTRL_C = $1000
|
||||
const ubyte SIGBREAKB_CTRL_D = 13
|
||||
const uword SIGBREAKF_CTRL_D = $2000
|
||||
const ubyte SIGBREAKB_CTRL_E = 14
|
||||
const uword SIGBREAKF_CTRL_E = $4000
|
||||
const ubyte SIGBREAKB_CTRL_F = 15
|
||||
const uword SIGBREAKF_CTRL_F = $8000
|
||||
const long LOCK_DIFFERENT = -1
|
||||
const ubyte LOCK_SAME = $0000
|
||||
const ubyte LOCK_SAME_VOLUME = $0001
|
||||
const ubyte CHANGE_LOCK = $0000
|
||||
const ubyte CHANGE_FH = $0001
|
||||
const ubyte LINK_HARD = $0000
|
||||
const ubyte LINK_SOFT = $0001
|
||||
const long ITEM_EQUAL = -2
|
||||
const long ITEM_ERROR = -1
|
||||
const ubyte ITEM_NOTHING = $0000
|
||||
const ubyte ITEM_UNQUOTED = $0001
|
||||
const ubyte ITEM_QUOTED = $0002
|
||||
const ubyte DOS_FILEHANDLE = $0000
|
||||
const ubyte DOS_EXALLCONTROL = $0001
|
||||
const ubyte DOS_FIB = $0002
|
||||
const ubyte DOS_STDPKT = $0003
|
||||
const ubyte DOS_CLI = $0004
|
||||
const ubyte DOS_RDARGS = $0005
|
||||
const ubyte reserve = $0004
|
||||
const ubyte vsize = $0006
|
||||
const ubyte APB_DOWILD = 0
|
||||
const ubyte APF_DOWILD = $0001
|
||||
const ubyte APB_ITSWILD = 1
|
||||
const ubyte APF_ITSWILD = $0002
|
||||
const ubyte APB_DODIR = 2
|
||||
const ubyte APF_DODIR = $0004
|
||||
const ubyte APB_DIDDIR = 3
|
||||
const ubyte APF_DIDDIR = $0008
|
||||
const ubyte APB_NOMEMERR = 4
|
||||
const ubyte APF_NOMEMERR = $0010
|
||||
const ubyte APB_DODOT = 5
|
||||
const ubyte APF_DODOT = $0020
|
||||
const ubyte APB_DirChanged = 6
|
||||
const ubyte APF_DirChanged = $0040
|
||||
const ubyte APB_FollowHLinks = 7
|
||||
const ubyte APF_FollowHLinks = $0080
|
||||
const ubyte DDB_PatternBit = 0
|
||||
const ubyte DDF_PatternBit = $0001
|
||||
const ubyte DDB_ExaminedBit = 1
|
||||
const ubyte DDF_ExaminedBit = $0002
|
||||
const ubyte DDB_Completed = 2
|
||||
const ubyte DDF_Completed = $0004
|
||||
const ubyte DDB_AllBit = 3
|
||||
const ubyte DDF_AllBit = $0008
|
||||
const ubyte DDB_SINGLE = 4
|
||||
const ubyte DDF_SINGLE = $0010
|
||||
const ubyte P_ANY = $80
|
||||
const ubyte P_SINGLE = $81
|
||||
const ubyte P_ORSTART = $82
|
||||
const ubyte P_ORNEXT = $83
|
||||
const ubyte P_OREND = $84
|
||||
const ubyte P_NOT = $85
|
||||
const ubyte P_NOTEND = $86
|
||||
const ubyte P_NOTCLASS = $87
|
||||
const ubyte P_CLASS = $88
|
||||
const ubyte P_REPBEG = $89
|
||||
const ubyte P_REPEND = $8A
|
||||
const ubyte P_STOP = $8B
|
||||
const ubyte COMPLEX_BIT = $0001
|
||||
const ubyte EXAMINE_BIT = $0002
|
||||
const uword ERROR_BUFFER_OVERFLOW = $012f
|
||||
const uword ERROR_BREAK = $0130
|
||||
const uword ERROR_NOT_EXECUTABLE = $0131
|
||||
const ubyte PRB_FREESEGLIST = 0
|
||||
const ubyte PRF_FREESEGLIST = $0001
|
||||
const ubyte PRB_FREECURRDIR = 1
|
||||
const ubyte PRF_FREECURRDIR = $0002
|
||||
const ubyte PRB_FREECLI = 2
|
||||
const ubyte PRF_FREECLI = $0004
|
||||
const ubyte PRB_CLOSEINPUT = 3
|
||||
const ubyte PRF_CLOSEINPUT = $0008
|
||||
const ubyte PRB_CLOSEOUTPUT = 4
|
||||
const ubyte PRF_CLOSEOUTPUT = $0010
|
||||
const ubyte PRB_FREEARGS = 5
|
||||
const ubyte PRF_FREEARGS = $0020
|
||||
const ubyte PRB_CLOSEERROR = 6
|
||||
const ubyte PRF_CLOSEERROR = $0040
|
||||
const ubyte ACTION_NIL = $0000
|
||||
const ubyte ACTION_STARTUP = $0000
|
||||
const ubyte ACTION_GET_BLOCK = $0002
|
||||
const ubyte ACTION_SET_MAP = $0004
|
||||
const ubyte ACTION_DIE = $0005
|
||||
const ubyte ACTION_EVENT = $0006
|
||||
const ubyte ACTION_CURRENT_VOLUME = $0007
|
||||
const ubyte ACTION_LOCATE_OBJECT = $0008
|
||||
const ubyte ACTION_RENAME_DISK = $0009
|
||||
const ubyte ACTION_WRITE = $0057
|
||||
const ubyte ACTION_READ = $0052
|
||||
const ubyte ACTION_FREE_LOCK = $000f
|
||||
const ubyte ACTION_DELETE_OBJECT = $0010
|
||||
const ubyte ACTION_RENAME_OBJECT = $0011
|
||||
const ubyte ACTION_MORE_CACHE = $0012
|
||||
const ubyte ACTION_COPY_DIR = $0013
|
||||
const ubyte ACTION_WAIT_CHAR = $0014
|
||||
const ubyte ACTION_SET_PROTECT = $0015
|
||||
const ubyte ACTION_CREATE_DIR = $0016
|
||||
const ubyte ACTION_EXAMINE_OBJECT = $0017
|
||||
const ubyte ACTION_EXAMINE_NEXT = $0018
|
||||
const ubyte ACTION_DISK_INFO = $0019
|
||||
const ubyte ACTION_INFO = $001a
|
||||
const ubyte ACTION_FLUSH = $001b
|
||||
const ubyte ACTION_SET_COMMENT = $001c
|
||||
const ubyte ACTION_PARENT = $001d
|
||||
const ubyte ACTION_TIMER = $001e
|
||||
const ubyte ACTION_INHIBIT = $001f
|
||||
const ubyte ACTION_DISK_TYPE = $0020
|
||||
const ubyte ACTION_DISK_CHANGE = $0021
|
||||
const ubyte ACTION_SET_DATE = $0022
|
||||
const uword ACTION_UNDISK_INFO = $0201
|
||||
const uword ACTION_SCREEN_MODE = $03e2
|
||||
const uword ACTION_READ_RETURN = $03e9
|
||||
const uword ACTION_WRITE_RETURN = $03ea
|
||||
const uword ACTION_SEEK = $03f0
|
||||
const uword ACTION_FINDUPDATE = $03ec
|
||||
const uword ACTION_FINDINPUT = $03ed
|
||||
const uword ACTION_FINDOUTPUT = $03ee
|
||||
const uword ACTION_END = $03ef
|
||||
const uword ACTION_SET_FILE_SIZE = $03fe
|
||||
const uword ACTION_WRITE_PROTECT = $03ff
|
||||
const ubyte ACTION_SAME_LOCK = $0028
|
||||
const uword ACTION_CHANGE_SIGNAL = $03e3
|
||||
const uword ACTION_FORMAT = $03fc
|
||||
const uword ACTION_MAKE_LINK = $03fd
|
||||
const uword ACTION_READ_LINK = $0400
|
||||
const uword ACTION_FH_FROM_LOCK = $0402
|
||||
const uword ACTION_IS_FILESYSTEM = $0403
|
||||
const uword ACTION_CHANGE_MODE = $0404
|
||||
const uword ACTION_COPY_DIR_FH = $0406
|
||||
const uword ACTION_PARENT_FH = $0407
|
||||
const uword ACTION_EXAMINE_ALL = $0409
|
||||
const uword ACTION_EXAMINE_FH = $040a
|
||||
const uword ACTION_LOCK_RECORD = $07d8
|
||||
const uword ACTION_FREE_RECORD = $07d9
|
||||
const uword ACTION_ADD_NOTIFY = $1001
|
||||
const uword ACTION_REMOVE_NOTIFY = $1002
|
||||
const uword ACTION_EXAMINE_ALL_END = $040b
|
||||
const uword ACTION_SET_OWNER = $040c
|
||||
const uword ACTION_SERIALIZE_DISK = $1068
|
||||
const ubyte RNB_WILDSTAR = 24
|
||||
const long RNF_WILDSTAR = $01000000
|
||||
const ubyte RNB_PRIVATE1 = 1
|
||||
const ubyte RNF_PRIVATE1 = $0002
|
||||
const long CMD_SYSTEM = -1
|
||||
const long CMD_INTERNAL = -2
|
||||
const long CMD_DISABLED = -999
|
||||
const ubyte DLT_DEVICE = $0000
|
||||
const ubyte DLT_DIRECTORY = $0001
|
||||
const ubyte DLT_VOLUME = $0002
|
||||
const ubyte DLT_LATE = $0003
|
||||
const ubyte DLT_NONBINDING = $0004
|
||||
const long DLT_PRIVATE = -1
|
||||
const ubyte DVPB_UNLOCK = 0
|
||||
const ubyte DVPF_UNLOCK = $0001
|
||||
const ubyte DVPB_ASSIGN = 1
|
||||
const ubyte DVPF_ASSIGN = $0002
|
||||
const ubyte LDB_DEVICES = 2
|
||||
const ubyte LDF_DEVICES = $0004
|
||||
const ubyte LDB_VOLUMES = 3
|
||||
const ubyte LDF_VOLUMES = $0008
|
||||
const ubyte LDB_ASSIGNS = 4
|
||||
const ubyte LDF_ASSIGNS = $0010
|
||||
const ubyte LDB_ENTRY = 5
|
||||
const ubyte LDF_ENTRY = $0020
|
||||
const ubyte LDB_DELETE = 6
|
||||
const ubyte LDF_DELETE = $0040
|
||||
const ubyte LDB_READ = 0
|
||||
const ubyte LDF_READ = $0001
|
||||
const ubyte LDB_WRITE = 1
|
||||
const ubyte LDF_WRITE = $0002
|
||||
const ubyte REPORT_STREAM = $0000
|
||||
const ubyte REPORT_TASK = $0001
|
||||
const ubyte REPORT_LOCK = $0002
|
||||
const ubyte REPORT_VOLUME = $0003
|
||||
const ubyte REPORT_INSERT = $0004
|
||||
const uword ABORT_DISK_ERROR = $0128
|
||||
const uword ABORT_BUSY = $0120
|
||||
const long RUN_EXECUTE = -1
|
||||
const long RUN_SYSTEM = -2
|
||||
const long RUN_SYSTEM_ASYNCH = -3
|
||||
const ubyte ST_ROOT = $0001
|
||||
const ubyte ST_USERDIR = $0002
|
||||
const ubyte ST_SOFTLINK = $0003
|
||||
const ubyte ST_LINKDIR = $0004
|
||||
const long ST_FILE = -3
|
||||
const long ST_LINKFILE = -4
|
||||
const long ST_PIPEFILE = -5
|
||||
const uword HUNK_UNIT = $03e7
|
||||
const uword HUNK_NAME = $03e8
|
||||
const uword HUNK_CODE = $03e9
|
||||
const uword HUNK_DATA = $03ea
|
||||
const uword HUNK_BSS = $03eb
|
||||
const uword HUNK_RELOC32 = $03ec
|
||||
const uword HUNK_RELOC16 = $03ed
|
||||
const uword HUNK_RELOC8 = $03ee
|
||||
const uword HUNK_EXT = $03ef
|
||||
const uword HUNK_SYMBOL = $03f0
|
||||
const uword HUNK_DEBUG = $03f1
|
||||
const uword HUNK_END = $03f2
|
||||
const uword HUNK_HEADER = $03f3
|
||||
const uword HUNK_OVERLAY = $03f5
|
||||
const uword HUNK_BREAK = $03f6
|
||||
const uword HUNK_DREL32 = $03f7
|
||||
const uword HUNK_DREL16 = $03f8
|
||||
const uword HUNK_DREL8 = $03f9
|
||||
const uword HUNK_LIB = $03fa
|
||||
const uword HUNK_INDEX = $03fb
|
||||
const uword HUNK_RELOC32SHORT = $03fc
|
||||
const uword HUNK_RELRELOC32 = $03fd
|
||||
const uword HUNK_ABSRELOC16 = $03fe
|
||||
const ubyte HUNKB_ADVISORY = 29
|
||||
const long HUNKF_ADVISORY = $20000000
|
||||
const ubyte HUNKB_CHIP = 30
|
||||
const long HUNKF_CHIP = $40000000
|
||||
const ubyte HUNKB_FAST = 31
|
||||
const long HUNKF_FAST = $80000000
|
||||
const ubyte EXT_SYMB = $0000
|
||||
const ubyte EXT_DEF = $0001
|
||||
const ubyte EXT_ABS = $0002
|
||||
const ubyte EXT_RES = $0003
|
||||
const ubyte EXT_COMMONDEF = $0004
|
||||
const ubyte EXT_REF32 = $0081
|
||||
const ubyte EXT_COMMON = $0082
|
||||
const ubyte EXT_REF16 = $0083
|
||||
const ubyte EXT_REF8 = $0084
|
||||
const ubyte EXT_DEXT32 = $0085
|
||||
const ubyte EXT_DEXT16 = $0086
|
||||
const ubyte EXT_DEXT8 = $0087
|
||||
const ubyte EXT_RELREF32 = $0088
|
||||
const ubyte EXT_RELCOMMON = $0089
|
||||
const ubyte EXT_ABSREF16 = $008a
|
||||
const ubyte EXT_ABSREF8 = $008b
|
||||
const long SYS_Dummy = $80000020
|
||||
const long NP_Dummy = $800003e8
|
||||
const long ADO_Dummy = $800007d0
|
||||
const ubyte ED_NAME = $0001
|
||||
const ubyte ED_TYPE = $0002
|
||||
const ubyte ED_SIZE = $0003
|
||||
const ubyte ED_PROTECTION = $0004
|
||||
const ubyte ED_DATE = $0005
|
||||
const ubyte ED_COMMENT = $0006
|
||||
const ubyte ED_OWNER = $0007
|
||||
const ubyte DE_TABLESIZE = $0000
|
||||
const ubyte DE_SIZEBLOCK = $0001
|
||||
const ubyte DE_SECORG = $0002
|
||||
const ubyte DE_NUMHEADS = $0003
|
||||
const ubyte DE_SECSPERBLK = $0004
|
||||
const ubyte DE_BLKSPERTRACK = $0005
|
||||
const ubyte DE_RESERVEDBLKS = $0006
|
||||
const ubyte DE_PREFAC = $0007
|
||||
const ubyte DE_INTERLEAVE = $0008
|
||||
const ubyte DE_LOWCYL = $0009
|
||||
const ubyte DE_UPPERCYL = $000a
|
||||
const ubyte DE_NUMBUFFERS = $000b
|
||||
const ubyte DE_MEMBUFTYPE = $000c
|
||||
const ubyte DE_BUFMEMTYPE = $000c
|
||||
const ubyte DE_MAXTRANSFER = $000d
|
||||
const ubyte DE_MASK = $000e
|
||||
const ubyte DE_BOOTPRI = $000f
|
||||
const ubyte DE_DOSTYPE = $0010
|
||||
const ubyte DE_BAUD = $0011
|
||||
const ubyte DE_CONTROL = $0012
|
||||
const ubyte DE_BOOTBLOCKS = $0013
|
||||
const ubyte ENVB_SCSIDIRECT = 16
|
||||
const long ENVF_SCSIDIRECT = $00010000
|
||||
const ubyte ENVB_SUPERFLOPPY = 17
|
||||
const long ENVF_SUPERFLOPPY = $00020000
|
||||
const ubyte ENVB_DISABLENSD = 18
|
||||
const long ENVF_DISABLENSD = $00040000
|
||||
const long NOTIFY_CLASS = $40000000
|
||||
const uword NOTIFY_CODE = $1234
|
||||
const ubyte NRB_SEND_MESSAGE = 0
|
||||
const ubyte NRF_SEND_MESSAGE = $0001
|
||||
const ubyte NRB_SEND_SIGNAL = 1
|
||||
const ubyte NRF_SEND_SIGNAL = $0002
|
||||
const ubyte NRB_WAIT_REPLY = 3
|
||||
const ubyte NRF_WAIT_REPLY = $0008
|
||||
const ubyte NRB_NOTIFY_INITIAL = 4
|
||||
const ubyte NRF_NOTIFY_INITIAL = $0010
|
||||
const ubyte NRB_MAGIC = 31
|
||||
const long NRF_MAGIC = $80000000
|
||||
const long NR_HANDLER_FLAGS = $ffff0000
|
||||
const ubyte RDAB_STDIN = 0
|
||||
const ubyte RDAF_STDIN = $0001
|
||||
const ubyte RDAB_NOALLOC = 1
|
||||
const ubyte RDAF_NOALLOC = $0002
|
||||
const ubyte RDAB_NOPROMPT = 2
|
||||
const ubyte RDAF_NOPROMPT = $0004
|
||||
const ubyte MAX_TEMPLATE_ITEMS = $0064
|
||||
const ubyte MAX_MULTIARGS = $0080
|
||||
const ubyte REC_EXCLUSIVE = $0000
|
||||
const ubyte REC_EXCLUSIVE_IMMED = $0001
|
||||
const ubyte REC_SHARED = $0002
|
||||
const ubyte REC_SHARED_IMMED = $0003
|
||||
const long SHELL_DUMMY = $80000bb8
|
||||
const ubyte DOS_STDIO_I = $0001
|
||||
const ubyte BUF_LINE = $0000
|
||||
const ubyte BUF_FULL = $0001
|
||||
const ubyte BUF_NONE = $0002
|
||||
const long ENDSTREAMCH = -1
|
||||
const ubyte LV_VAR = $0000
|
||||
const ubyte LV_ALIAS = $0001
|
||||
const ubyte LVB_IGNORE = $0007
|
||||
const ubyte LVF_IGNORE = $80
|
||||
const ubyte GVB_GLOBAL_ONLY = 8
|
||||
const uword GVF_GLOBAL_ONLY = $0100
|
||||
const ubyte GVB_LOCAL_ONLY = 9
|
||||
const uword GVF_LOCAL_ONLY = $0200
|
||||
const ubyte GVB_BINARY_VAR = 10
|
||||
const uword GVF_BINARY_VAR = $0400
|
||||
const ubyte GVB_DONT_NULL_TERM = 11
|
||||
const uword GVF_DONT_NULL_TERM = $0800
|
||||
const ubyte GVB_SAVE_VAR = 12
|
||||
const uword GVF_SAVE_VAR = $1000
|
||||
const ubyte FORMAT_MAX = $0003
|
||||
const long OFFSET_BEGINING = -1
|
||||
const ubyte LOCK_SAME_HANDLER = $0001
|
||||
const ubyte LDF_ALL = $001c
|
||||
const uword HUNK_ABSRELOC32 = $03ec
|
||||
const uword HUNK_RELRELOC16 = $03ed
|
||||
const uword HUNK_RELRELOC8 = $03ee
|
||||
const ubyte EXT_ABSREF32 = $0081
|
||||
const ubyte EXT_ABSCOMMON = $0082
|
||||
const ubyte EXT_RELREF16 = $0083
|
||||
const ubyte EXT_RELREF8 = $0084
|
||||
const long SYS_Input = $80000021
|
||||
const long SYS_Output = $80000022
|
||||
const long SYS_Asynch = $80000023
|
||||
const long SYS_UserShell = $80000024
|
||||
const long SYS_CustomShell = $80000025
|
||||
const long SYS_Error = $80000026
|
||||
const long SYS_ExecuteInputStream = $80000020
|
||||
const long SYS_CmdStream = $80000028
|
||||
const long NP_Seglist = $800003e9
|
||||
const long NP_FreeSeglist = $800003ea
|
||||
const long NP_Entry = $800003eb
|
||||
const long NP_Input = $800003ec
|
||||
const long NP_Output = $800003ed
|
||||
const long NP_CloseInput = $800003ee
|
||||
const long NP_CloseOutput = $800003ef
|
||||
const long NP_Error = $800003f0
|
||||
const long NP_CloseError = $800003f1
|
||||
const long NP_CurrentDir = $800003f2
|
||||
const long NP_StackSize = $800003f3
|
||||
const long NP_Name = $800003f4
|
||||
const long NP_Priority = $800003f5
|
||||
const long NP_ConsoleTask = $800003f6
|
||||
const long NP_WindowPtr = $800003f7
|
||||
const long NP_HomeDir = $800003f8
|
||||
const long NP_CopyVars = $800003f9
|
||||
const long NP_Cli = $800003fa
|
||||
const long NP_Path = $800003fb
|
||||
const long NP_CommandName = $800003fc
|
||||
const long NP_Arguments = $800003fd
|
||||
const long NP_NotifyOnDeath = $800003fe
|
||||
const long NP_Synchronous = $800003ff
|
||||
const long NP_ExitCode = $80000400
|
||||
const long NP_ExitData = $80000401
|
||||
const long ADO_FH_Mode = $800007d1
|
||||
const long ADO_DirLen = $800007d2
|
||||
const long ADO_CommNameLen = $800007d3
|
||||
const long ADO_CommFileLen = $800007d4
|
||||
const long ADO_PromptLen = $800007d5
|
||||
const long SHELL_FGETS_FULL = $80000bb9
|
||||
const long SHELL_ADDH_LINE = $80000bba
|
||||
}
|
||||
;; End of auto-generated dos_lib.sfd
|
||||
@@ -0,0 +1,656 @@
|
||||
;; Auto-generated from exec_lib.sfd and exec_lib.i
|
||||
;; Library base: _SysBase in prog8: sys.SysBase
|
||||
;; Bank: 1
|
||||
;; Functions: 115
|
||||
|
||||
exec {
|
||||
%option merge, no_symbol_prefixing
|
||||
|
||||
asmsub NewList(^^List list @A0) {
|
||||
; manually added utility routine to initialize new exec linked lists
|
||||
%asm {{
|
||||
addq.l #4, a0 ; Point to lh_Tail
|
||||
move.l a0, -4(a0) ; lh_Head = &lh_Tail
|
||||
clr.l (a0) ; lh_Tail = NULL
|
||||
subq.l #4, a0 ; Point back to &lh_Head
|
||||
move.l a0, 8(a0) ; lh_TailPred = &lh_Head
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
extsub @bank 1 -30 = Supervisor(pointer userFunction @A5) -> long @D0
|
||||
extsub @bank 1 -72 = InitCode(long startClass @D0, long version @D1)
|
||||
extsub @bank 1 -78 = InitStruct(pointer initTable @A1, pointer k_memory @A2, long size @D0)
|
||||
extsub @bank 1 -84 = MakeLibrary(pointer funcInit @A0, pointer structInit @A1, pointer libInit @A2, long dataSize @D0, long segList @D1) -> ^^Library @D0
|
||||
extsub @bank 1 -90 = MakeFunctions(pointer target @A0, pointer functionArray @A1, long funcDispBase @A2)
|
||||
extsub @bank 1 -96 = FindResident(str name @A1) -> pointer @D0
|
||||
extsub @bank 1 -102 = InitResident(pointer resident @A1, long segList @D1) -> pointer @D0
|
||||
extsub @bank 1 -108 = Alert(long alertNum @D7)
|
||||
extsub @bank 1 -114 = Debug(long flags @D0)
|
||||
extsub @bank 1 -120 = Disable()
|
||||
extsub @bank 1 -126 = Enable()
|
||||
extsub @bank 1 -132 = Forbid()
|
||||
extsub @bank 1 -138 = Permit()
|
||||
extsub @bank 1 -144 = SetSR(long newSR @D0, long mask @D1) -> long @D0
|
||||
extsub @bank 1 -150 = SuperState() -> pointer @D0
|
||||
extsub @bank 1 -156 = UserState(pointer sysStack @D0)
|
||||
extsub @bank 1 -162 = SetIntVector(long intNumber @D0, ^^Interrupt interrupt @A1) -> ^^Interrupt @D0
|
||||
extsub @bank 1 -168 = AddIntServer(long intNumber @D0, ^^Interrupt interrupt @A1)
|
||||
extsub @bank 1 -174 = RemIntServer(long intNumber @D0, ^^Interrupt interrupt @A1)
|
||||
extsub @bank 1 -180 = Cause(^^Interrupt interrupt @A1)
|
||||
extsub @bank 1 -186 = Allocate(pointer freeList @A0, long byteSize @D0) -> pointer @D0
|
||||
extsub @bank 1 -192 = Deallocate(pointer freeList @A0, pointer memoryBlock @A1, long byteSize @D0)
|
||||
extsub @bank 1 -198 = AllocMem(long byteSize @D0, long requirements @D1) -> pointer @D0
|
||||
extsub @bank 1 -204 = AllocAbs(long byteSize @D0, pointer location @A1) -> pointer @D0
|
||||
extsub @bank 1 -210 = FreeMem(pointer memoryBlock @A1, long byteSize @D0)
|
||||
extsub @bank 1 -216 = AvailMem(long requirements @D1) -> long @D0
|
||||
extsub @bank 1 -222 = AllocEntry(pointer entry @A0) -> pointer @D0
|
||||
extsub @bank 1 -228 = FreeEntry(pointer entry @A0)
|
||||
extsub @bank 1 -234 = Insert(^^List list @A0, ^^Node node @A1, ^^Node pred @A2)
|
||||
extsub @bank 1 -240 = AddHead(^^List list @A0, ^^Node node @A1)
|
||||
extsub @bank 1 -246 = AddTail(^^List list @A0, ^^Node node @A1)
|
||||
extsub @bank 1 -252 = Remove(^^Node node @A1)
|
||||
extsub @bank 1 -258 = RemHead(^^List list @A0) -> ^^Node @D0
|
||||
extsub @bank 1 -264 = RemTail(^^List list @A0) -> ^^Node @D0
|
||||
extsub @bank 1 -270 = Enqueue(^^List list @A0, ^^Node node @A1)
|
||||
extsub @bank 1 -276 = FindName(^^List list @A0, str name @A1) -> ^^Node @D0
|
||||
extsub @bank 1 -282 = AddTask(^^Task task @A1, pointer initPC @A2, pointer finalPC @A3) -> pointer @D0
|
||||
extsub @bank 1 -288 = RemTask(^^Task task @A1)
|
||||
extsub @bank 1 -294 = FindTask(str name @A1) -> ^^Task @D0
|
||||
extsub @bank 1 -300 = SetTaskPri(^^Task task @A1, long priority @D0) -> byte @D0
|
||||
extsub @bank 1 -306 = SetSignal(long newSignals @D0, long signalSet @D1) -> long @D0
|
||||
extsub @bank 1 -312 = SetExcept(long newSignals @D0, long signalSet @D1) -> long @D0
|
||||
extsub @bank 1 -318 = Wait(long signalSet @D0) -> long @D0
|
||||
extsub @bank 1 -324 = Signal(^^Task task @A1, long signalSet @D0)
|
||||
extsub @bank 1 -330 = AllocSignal(byte signalNum @D0) -> byte @D0
|
||||
extsub @bank 1 -336 = FreeSignal(byte signalNum @D0)
|
||||
extsub @bank 1 -342 = AllocTrap(long trapNum @D0) -> long @D0
|
||||
extsub @bank 1 -348 = FreeTrap(long trapNum @D0)
|
||||
extsub @bank 1 -354 = AddPort(^^MsgPort port @A1)
|
||||
extsub @bank 1 -360 = RemPort(^^MsgPort port @A1)
|
||||
extsub @bank 1 -366 = PutMsg(^^MsgPort port @A0, ^^Message message @A1)
|
||||
extsub @bank 1 -372 = GetMsg(^^MsgPort port @A0) -> ^^Message @D0
|
||||
extsub @bank 1 -378 = ReplyMsg(^^Message message @A1)
|
||||
extsub @bank 1 -384 = WaitPort(^^MsgPort port @A0) -> ^^Message @D0
|
||||
extsub @bank 1 -390 = FindPort(str name @A1) -> ^^MsgPort @D0
|
||||
extsub @bank 1 -396 = AddLibrary(^^Library library @A1)
|
||||
extsub @bank 1 -402 = RemLibrary(^^Library library @A1)
|
||||
extsub @bank 1 -408 = OldOpenLibrary(str libName @A1) -> ^^Library @D0
|
||||
extsub @bank 1 -414 = CloseLibrary(^^Library library @A1)
|
||||
extsub @bank 1 -420 = SetFunction(^^Library library @A1, long funcOffset @A0, pointer newFunction @D0) -> pointer @D0
|
||||
extsub @bank 1 -426 = SumLibrary(^^Library library @A1)
|
||||
extsub @bank 1 -432 = AddDevice(pointer device @A1)
|
||||
extsub @bank 1 -438 = RemDevice(pointer device @A1)
|
||||
extsub @bank 1 -444 = OpenDevice(str devName @A0, long unit @D0, pointer ioRequest @A1, long flags @D1) -> byte @D0
|
||||
extsub @bank 1 -450 = CloseDevice(pointer ioRequest @A1)
|
||||
extsub @bank 1 -456 = DoIO(pointer ioRequest @A1) -> byte @D0
|
||||
extsub @bank 1 -462 = SendIO(pointer ioRequest @A1)
|
||||
extsub @bank 1 -468 = CheckIO(pointer ioRequest @A1) -> pointer @D0
|
||||
extsub @bank 1 -474 = WaitIO(pointer ioRequest @A1) -> byte @D0
|
||||
extsub @bank 1 -480 = AbortIO(pointer ioRequest @A1)
|
||||
extsub @bank 1 -486 = AddResource(pointer resource @A1)
|
||||
extsub @bank 1 -492 = RemResource(pointer resource @A1)
|
||||
extsub @bank 1 -498 = OpenResource(str resName @A1) -> pointer @D0
|
||||
extsub @bank 1 -522 = RawDoFmt(str formatString @A0, pointer dataStream @A1, pointer putChProc @A2, pointer putChData @A3) -> pointer @D0
|
||||
extsub @bank 1 -528 = GetCC() -> long @D0
|
||||
extsub @bank 1 -534 = TypeOfMem(pointer address @A1) -> long @D0
|
||||
extsub @bank 1 -540 = Procure(pointer sigSem @A0, pointer bidMsg @A1) -> long @D0
|
||||
extsub @bank 1 -546 = Vacate(pointer sigSem @A0, pointer bidMsg @A1)
|
||||
extsub @bank 1 -552 = OpenLibrary(str libName @A1, long version @D0) -> ^^Library @D0
|
||||
extsub @bank 1 -558 = InitSemaphore(pointer sigSem @A0)
|
||||
extsub @bank 1 -564 = ObtainSemaphore(pointer sigSem @A0)
|
||||
extsub @bank 1 -570 = ReleaseSemaphore(pointer sigSem @A0)
|
||||
extsub @bank 1 -576 = AttemptSemaphore(pointer sigSem @A0) -> long @D0
|
||||
extsub @bank 1 -582 = ObtainSemaphoreList(^^List sigSem @A0)
|
||||
extsub @bank 1 -588 = ReleaseSemaphoreList(^^List sigSem @A0)
|
||||
extsub @bank 1 -594 = FindSemaphore(str name @A1) -> pointer @D0
|
||||
extsub @bank 1 -600 = AddSemaphore(pointer sigSem @A1)
|
||||
extsub @bank 1 -606 = RemSemaphore(pointer sigSem @A1)
|
||||
extsub @bank 1 -612 = SumKickData() -> long @D0
|
||||
extsub @bank 1 -618 = AddMemList(long size @D0, long attributes @D1, long pri @D2, pointer base @A0, str name @A1)
|
||||
extsub @bank 1 -624 = CopyMem(pointer source @A0, pointer dest @A1, long size @D0)
|
||||
extsub @bank 1 -630 = CopyMemQuick(pointer source @A0, pointer dest @A1, long size @D0)
|
||||
extsub @bank 1 -636 = CacheClearU()
|
||||
extsub @bank 1 -642 = CacheClearE(pointer address @A0, long length @D0, long caches @D1)
|
||||
extsub @bank 1 -648 = CacheControl(long cacheBits @D0, long cacheMask @D1) -> long @D0
|
||||
extsub @bank 1 -654 = CreateIORequest(^^MsgPort port @A0, long size @D0) -> pointer @D0
|
||||
extsub @bank 1 -660 = DeleteIORequest(pointer iorequest @A0)
|
||||
extsub @bank 1 -666 = CreateMsgPort() -> ^^MsgPort @D0
|
||||
extsub @bank 1 -672 = DeleteMsgPort(^^MsgPort port @A0)
|
||||
extsub @bank 1 -678 = ObtainSemaphoreShared(pointer sigSem @A0)
|
||||
extsub @bank 1 -684 = AllocVec(long byteSize @D0, long requirements @D1) -> pointer @D0
|
||||
extsub @bank 1 -690 = FreeVec(pointer memoryBlock @A1)
|
||||
extsub @bank 1 -696 = CreatePool(long requirements @D0, long puddleSize @D1, long threshSize @D2) -> pointer @D0
|
||||
extsub @bank 1 -702 = DeletePool(pointer poolHeader @A0)
|
||||
extsub @bank 1 -708 = AllocPooled(pointer poolHeader @A0, long memSize @D0) -> pointer @D0
|
||||
extsub @bank 1 -714 = FreePooled(pointer poolHeader @A0, pointer k_memory @A1, long memSize @D0)
|
||||
extsub @bank 1 -720 = AttemptSemaphoreShared(pointer sigSem @A0) -> long @D0
|
||||
extsub @bank 1 -726 = ColdReboot()
|
||||
extsub @bank 1 -732 = StackSwap(pointer newStack @A0)
|
||||
extsub @bank 1 -762 = CachePreDMA(pointer address @A0, pointer length @A1, long flags @D0) -> pointer @D0
|
||||
extsub @bank 1 -768 = CachePostDMA(pointer address @A0, pointer length @A1, long flags @D0)
|
||||
extsub @bank 1 -774 = AddMemHandler(^^Interrupt memhand @A1)
|
||||
extsub @bank 1 -780 = RemMemHandler(^^Interrupt memhand @A1)
|
||||
extsub @bank 1 -786 = ObtainQuickVector(pointer interruptCode @A0) -> long @D0
|
||||
extsub @bank 1 -828 = NewMinList(^^MinList minlist @A0)
|
||||
|
||||
; ---- struct definitions ----
|
||||
|
||||
struct IOStdReq { ; total size: 48
|
||||
^^Node Succ ; 0
|
||||
^^Node Pred ; 4
|
||||
ubyte Type ; 8
|
||||
byte Pri ; 9
|
||||
str Name ; 10
|
||||
^^MsgPort ReplyPort ; 14
|
||||
uword Length ; 18
|
||||
pointer Device ; 20
|
||||
pointer Unit ; 24
|
||||
uword Command ; 28
|
||||
ubyte Flags ; 30
|
||||
byte Error ; 31
|
||||
long Actual ; 32
|
||||
long IOStdReq_Length ; 36
|
||||
pointer Data ; 40
|
||||
long Offset ; 44
|
||||
}
|
||||
|
||||
struct IORequest { ; total size: 32
|
||||
^^Node Succ ; 0
|
||||
^^Node Pred ; 4
|
||||
ubyte Type ; 8
|
||||
byte Pri ; 9
|
||||
str Name ; 10
|
||||
^^MsgPort ReplyPort ; 14
|
||||
uword Length ; 18
|
||||
pointer Device ; 20
|
||||
pointer Unit ; 24
|
||||
uword Command ; 28
|
||||
ubyte Flags ; 30
|
||||
byte Error ; 31
|
||||
}
|
||||
|
||||
struct Interrupt { ; total size: 22
|
||||
^^Node Succ ; 0
|
||||
^^Node Pred ; 4
|
||||
ubyte Type ; 8
|
||||
byte Pri ; 9
|
||||
str Name ; 10
|
||||
pointer Data ; 14
|
||||
pointer Code ; 18
|
||||
}
|
||||
|
||||
struct List { ; total size: 14
|
||||
^^Node Head ; 0
|
||||
pointer Tail ; 4
|
||||
^^Node TailPred ; 8
|
||||
ubyte Type ; 12
|
||||
ubyte Pad ; 13
|
||||
}
|
||||
|
||||
struct Library { ; total size: 34
|
||||
^^Node Succ ; 0
|
||||
^^Node Pred ; 4
|
||||
ubyte Type ; 8
|
||||
byte Pri ; 9
|
||||
str Name ; 10
|
||||
ubyte Flags ; 14
|
||||
ubyte Pad ; 15
|
||||
uword NegSize ; 16
|
||||
uword PosSize ; 18
|
||||
uword Version ; 20
|
||||
uword Revision ; 22
|
||||
str IdString ; 24
|
||||
long Sum ; 28
|
||||
uword OpenCnt ; 32
|
||||
}
|
||||
|
||||
struct Node { ; total size: 14
|
||||
^^Node Succ ; 0
|
||||
^^Node Pred ; 4
|
||||
ubyte Type ; 8
|
||||
byte Pri ; 9
|
||||
str Name ; 10
|
||||
}
|
||||
|
||||
struct MinList { ; total size: 12
|
||||
^^MinNode Head ; 0
|
||||
pointer Tail ; 4
|
||||
^^MinNode TailPred ; 8
|
||||
}
|
||||
|
||||
struct MinNode { ; total size: 8
|
||||
^^MinNode Succ ; 0
|
||||
^^MinNode Pred ; 4
|
||||
}
|
||||
|
||||
struct Message { ; total size: 20
|
||||
^^Message Succ ; 0
|
||||
^^Message Pred ; 4
|
||||
ubyte Type ; 8
|
||||
byte Pri ; 9
|
||||
str Name ; 10
|
||||
^^MsgPort ReplyPort ; 14
|
||||
uword Length ; 18
|
||||
}
|
||||
|
||||
struct MsgPort { ; total size: 34
|
||||
^^Node Succ ; 0
|
||||
^^Node Pred ; 4
|
||||
ubyte Type ; 8
|
||||
byte Pri ; 9
|
||||
str Name ; 10
|
||||
ubyte Flags ; 14
|
||||
ubyte SigBit ; 15
|
||||
pointer SigTask ; 16
|
||||
^^Node Head ; 20
|
||||
^^Node Tail ; 24
|
||||
^^Node TailPred ; 28
|
||||
ubyte List_Type ; 32
|
||||
ubyte Pad ; 33
|
||||
}
|
||||
|
||||
struct Task { ; total size: 92
|
||||
^^Node Succ ; 0
|
||||
^^Node Pred ; 4
|
||||
ubyte Type ; 8
|
||||
byte Pri ; 9
|
||||
str Name ; 10
|
||||
ubyte Flags ; 14
|
||||
ubyte State ; 15
|
||||
byte IDNestCnt ; 16
|
||||
byte TDNestCnt ; 17
|
||||
long SigAlloc ; 18
|
||||
long SigWait ; 22
|
||||
long SigRecvd ; 26
|
||||
long SigExcept ; 30
|
||||
uword TrapAlloc ; 34
|
||||
uword TrapAble ; 36
|
||||
pointer ExceptData ; 38
|
||||
pointer ExceptCode ; 42
|
||||
pointer TrapData ; 46
|
||||
pointer TrapCode ; 50
|
||||
pointer SPReg ; 54
|
||||
pointer SPLower ; 58
|
||||
pointer SPUpper ; 62
|
||||
pointer Switch ; 66
|
||||
pointer Launch ; 70
|
||||
^^Node Head ; 74
|
||||
^^Node Tail ; 78
|
||||
^^Node TailPred ; 82
|
||||
ubyte List_Type ; 86
|
||||
ubyte Pad ; 87
|
||||
pointer UserData ; 88
|
||||
}
|
||||
|
||||
; ---- constants ----
|
||||
const long ACPU_BusErr = $80000002
|
||||
const long ACPU_AddressErr = $80000003
|
||||
const long ACPU_InstErr = $80000004
|
||||
const long ACPU_DivZero = $80000005
|
||||
const long ACPU_CHK = $80000006
|
||||
const long ACPU_TRAPV = $80000007
|
||||
const long ACPU_PrivErr = $80000008
|
||||
const long ACPU_Trace = $80000009
|
||||
const long ACPU_LineA = $8000000A
|
||||
const long ACPU_LineF = $8000000B
|
||||
const long ACPU_Format = $8000000E
|
||||
const long ACPU_Spurious = $80000018
|
||||
const long ACPU_AutoVec1 = $80000019
|
||||
const long ACPU_AutoVec2 = $8000001A
|
||||
const long ACPU_AutoVec3 = $8000001B
|
||||
const long ACPU_AutoVec4 = $8000001C
|
||||
const long ACPU_AutoVec5 = $8000001D
|
||||
const long ACPU_AutoVec6 = $8000001E
|
||||
const long ACPU_AutoVec7 = $8000001F
|
||||
const long AT_DeadEnd = $80000000
|
||||
const long AT_Recovery = $00000000
|
||||
const long AG_NoMemory = $00010000
|
||||
const long AG_MakeLib = $00020000
|
||||
const long AG_OpenLib = $00030000
|
||||
const long AG_OpenDev = $00040000
|
||||
const long AG_OpenRes = $00050000
|
||||
const long AG_IOError = $00060000
|
||||
const long AG_NoSignal = $00070000
|
||||
const long AG_BadParm = $00080000
|
||||
const long AG_CloseLib = $00090000
|
||||
const long AG_CloseDev = $000A0000
|
||||
const long AG_ProcCreate = $000B0000
|
||||
const long AO_ExecLib = $00008001
|
||||
const long AO_GraphicsLib = $00008002
|
||||
const long AO_LayersLib = $00008003
|
||||
const long AO_Intuition = $00008004
|
||||
const long AO_MathLib = $00008005
|
||||
const long AO_DOSLib = $00008007
|
||||
const long AO_RAMLib = $00008008
|
||||
const long AO_IconLib = $00008009
|
||||
const long AO_ExpansionLib = $0000800A
|
||||
const long AO_DiskfontLib = $0000800B
|
||||
const long AO_UtilityLib = $0000800C
|
||||
const long AO_KeyMapLib = $0000800D
|
||||
const long AO_AudioDev = $00008010
|
||||
const long AO_ConsoleDev = $00008011
|
||||
const long AO_GamePortDev = $00008012
|
||||
const long AO_KeyboardDev = $00008013
|
||||
const long AO_TrackDiskDev = $00008014
|
||||
const long AO_TimerDev = $00008015
|
||||
const long AO_CIARsrc = $00008020
|
||||
const long AO_DiskRsrc = $00008021
|
||||
const long AO_MiscRsrc = $00008022
|
||||
const long AO_BootStrap = $00008030
|
||||
const long AO_Workbench = $00008031
|
||||
const long AO_DiskCopy = $00008032
|
||||
const long AO_GadTools = $00008033
|
||||
const long AO_Unknown = $00008035
|
||||
const long AN_ExecLib = $01000000
|
||||
const long AN_ExcptVect = $01000001
|
||||
const long AN_BaseChkSum = $01000002
|
||||
const long AN_LibChkSum = $01000003
|
||||
const long AN_MemCorrupt = $81000005
|
||||
const long AN_IntrMem = $81000006
|
||||
const long AN_InitAPtr = $01000007
|
||||
const long AN_SemCorrupt = $01000008
|
||||
const long AN_FreeTwice = $01000009
|
||||
const long AN_BogusExcpt = $8100000A
|
||||
const long AN_IOUsedTwice = $0100000B
|
||||
const long AN_MemoryInsane = $0100000C
|
||||
const long AN_IOAfterClose = $0100000D
|
||||
const long AN_StackProbe = $0100000E
|
||||
const long AN_BadFreeAddr = $0100000F
|
||||
const long AN_BadSemaphore = $01000010
|
||||
const long AN_BadQuickInt = $810000FF
|
||||
const long AN_AVLNotImpl = $01000011
|
||||
const long AN_TreeNotImpl = $01000012
|
||||
const long AN_GraphicsLib = $02000000
|
||||
const long AN_GfxNoMem = $82010000
|
||||
const long AN_GfxNoMemMspc = $82010001
|
||||
const long AN_LongFrame = $82010006
|
||||
const long AN_ShortFrame = $82010007
|
||||
const long AN_TextTmpRas = $02010009
|
||||
const long AN_BltBitMap = $8201000A
|
||||
const long AN_RegionMemory = $8201000B
|
||||
const long AN_MakeVPort = $82010030
|
||||
const long AN_GfxNewError = $0200000C
|
||||
const long AN_GfxFreeError = $0200000D
|
||||
const long AN_GfxNoLCM = $82011234
|
||||
const long AN_ObsoleteFont = $02000401
|
||||
const long AN_LayersLib = $03000000
|
||||
const long AN_LayersNoMem = $83010000
|
||||
const long AN_Intuition = $04000000
|
||||
const long AN_GadgetType = $84000001
|
||||
const long AN_BadGadget = $04000001
|
||||
const long AN_CreatePort = $84010002
|
||||
const long AN_ItemAlloc = $04010003
|
||||
const long AN_SubAlloc = $04010004
|
||||
const long AN_PlaneAlloc = $84010005
|
||||
const long AN_ItemBoxTop = $84000006
|
||||
const long AN_OpenScreen = $84010007
|
||||
const long AN_OpenScrnRast = $84010008
|
||||
const long AN_SysScrnType = $84000009
|
||||
const long AN_AddSWGadget = $8401000A
|
||||
const long AN_OpenWindow = $8401000B
|
||||
const long AN_BadState = $8400000C
|
||||
const long AN_BadMessage = $8400000D
|
||||
const long AN_WeirdEcho = $8400000E
|
||||
const long AN_NoConsole = $8400000F
|
||||
const long AN_NoISem = $04000010
|
||||
const long AN_ISemOrder = $04000011
|
||||
const long AN_DeadIntui = $04000012
|
||||
const long AN_MathLib = $05000000
|
||||
const long AN_DOSLib = $07000000
|
||||
const long AN_StartMem = $07010001
|
||||
const long AN_EndTask = $07000002
|
||||
const long AN_QPktFail = $07000003
|
||||
const long AN_AsyncPkt = $07000004
|
||||
const long AN_FreeVec = $07000005
|
||||
const long AN_DiskBlkSeq = $07000006
|
||||
const long AN_BitMap = $07000007
|
||||
const long AN_KeyFree = $07000008
|
||||
const long AN_BadChkSum = $07000009
|
||||
const long AN_DiskError = $0700000A
|
||||
const long AN_KeyRange = $0700000B
|
||||
const long AN_BadOverlay = $0700000C
|
||||
const long AN_BadInitFunc = $0700000D
|
||||
const long AN_FileReclosed = $0700000E
|
||||
const long AN_CLIObsolete = $0700000F
|
||||
const long AN_RAMLib = $08000000
|
||||
const long AN_BadSegList = $08000001
|
||||
const long AN_IconLib = $09000000
|
||||
const long AN_ExpansionLib = $0A000000
|
||||
const long AN_BadExpansionFree = $0A000001
|
||||
const long AN_DiskfontLib = $0B000000
|
||||
const long AN_AudioDev = $10000000
|
||||
const long AN_ConsoleDev = $11000000
|
||||
const long AN_NoWindow = $11000001
|
||||
const long AN_GamePortDev = $12000000
|
||||
const long AN_KeyboardDev = $13000000
|
||||
const long AN_TrackDiskDev = $14000000
|
||||
const long AN_TDCalibSeek = $14000001
|
||||
const long AN_TDDelay = $14000002
|
||||
const long AN_TimerDev = $15000000
|
||||
const long AN_TMBadReq = $15000001
|
||||
const long AN_TMBadSupply = $15000002
|
||||
const long AN_CIARsrc = $20000000
|
||||
const long AN_DiskRsrc = $21000000
|
||||
const long AN_DRHasDisk = $21000001
|
||||
const long AN_DRIntNoAct = $21000002
|
||||
const long AN_MiscRsrc = $22000000
|
||||
const long AN_BootStrap = $30000000
|
||||
const long AN_BootError = $30000001
|
||||
const long AN_Workbench = $31000000
|
||||
const long AN_NoFonts = $B1000001
|
||||
const long AN_WBBadStartupMsg1 = $31000001
|
||||
const long AN_WBBadStartupMsg2 = $31000002
|
||||
const long AN_WBBadIOMsg = $31000003
|
||||
const long AN_WBReLayoutToolMenu = $B1010009
|
||||
const long AN_DiskCopy = $32000000
|
||||
const long AN_GadTools = $33000000
|
||||
const long AN_UtilityLib = $34000000
|
||||
const long AN_Unknown = $35000000
|
||||
const ubyte UNITB_ACTIVE = 0
|
||||
const ubyte UNITF_ACTIVE = $0001
|
||||
const ubyte UNITB_INTASK = 1
|
||||
const ubyte UNITF_INTASK = $0002
|
||||
const long IOERR_OPENFAIL = -1
|
||||
const long IOERR_ABORTED = -2
|
||||
const long IOERR_NOCMD = -3
|
||||
const long IOERR_BADLENGTH = -4
|
||||
const long IOERR_BADADDRESS = -5
|
||||
const long IOERR_UNITBUSY = -6
|
||||
const long IOERR_SELFTEST = -7
|
||||
const ubyte AFB_68010 = 0
|
||||
const ubyte AFF_68010 = $0001
|
||||
const ubyte AFB_68020 = 1
|
||||
const ubyte AFF_68020 = $0002
|
||||
const ubyte AFB_68030 = 2
|
||||
const ubyte AFF_68030 = $0004
|
||||
const ubyte AFB_68040 = 3
|
||||
const ubyte AFF_68040 = $0008
|
||||
const ubyte AFB_68881 = 4
|
||||
const ubyte AFF_68881 = $0010
|
||||
const ubyte AFB_68882 = 5
|
||||
const ubyte AFF_68882 = $0020
|
||||
const ubyte AFB_FPU40 = 6
|
||||
const ubyte AFF_FPU40 = $0040
|
||||
const ubyte AFB_68060 = 7
|
||||
const ubyte AFF_68060 = $0080
|
||||
const ubyte AFB_FPGA = 10
|
||||
const uword AFF_FPGA = $0400
|
||||
const ubyte AFB_PRIVATE = 15
|
||||
const uword AFF_PRIVATE = $8000
|
||||
const ubyte CACRB_EnableI = 0
|
||||
const ubyte CACRF_EnableI = $0001
|
||||
const ubyte CACRB_FreezeI = 1
|
||||
const ubyte CACRF_FreezeI = $0002
|
||||
const ubyte CACRB_ClearI = 3
|
||||
const ubyte CACRF_ClearI = $0008
|
||||
const ubyte CACRB_IBE = 4
|
||||
const ubyte CACRF_IBE = $0010
|
||||
const ubyte CACRB_EnableD = 8
|
||||
const uword CACRF_EnableD = $0100
|
||||
const ubyte CACRB_FreezeD = 9
|
||||
const uword CACRF_FreezeD = $0200
|
||||
const ubyte CACRB_ClearD = 11
|
||||
const uword CACRF_ClearD = $0800
|
||||
const ubyte CACRB_DBE = 12
|
||||
const uword CACRF_DBE = $1000
|
||||
const ubyte CACRB_WriteAllocate = 13
|
||||
const uword CACRF_WriteAllocate = $2000
|
||||
const ubyte CACRB_EnableE = 30
|
||||
const long CACRF_EnableE = $40000000
|
||||
const ubyte CACRB_CopyBack = 31
|
||||
const long CACRF_CopyBack = $80000000
|
||||
const ubyte DMAB_Continue = 1
|
||||
const ubyte DMAF_Continue = $0002
|
||||
const ubyte DMAB_NoModify = 2
|
||||
const ubyte DMAF_NoModify = $0004
|
||||
const ubyte DMAB_ReadFromRAM = 3
|
||||
const ubyte DMAF_ReadFromRAM = $0008
|
||||
const ubyte SB_SAR = 15
|
||||
const uword SF_SAR = $8000
|
||||
const ubyte SB_TQE = 14
|
||||
const uword SF_TQE = $4000
|
||||
const ubyte SB_SINT = 13
|
||||
const uword SF_SINT = $2000
|
||||
const ubyte SIH_PRIMASK = $0F0
|
||||
const ubyte SIH_QUEUES = $0005
|
||||
const ubyte INTB_NMI = 15
|
||||
const uword INTF_NMI = $8000
|
||||
const ubyte IOB_QUICK = 0
|
||||
const ubyte IOF_QUICK = $0001
|
||||
const uword CMD_INVALID = $0000
|
||||
const uword CMD_RESET = $0001
|
||||
const uword CMD_READ = $0002
|
||||
const uword CMD_WRITE = $0003
|
||||
const uword CMD_UPDATE = $0004
|
||||
const uword CMD_CLEAR = $0005
|
||||
const uword CMD_STOP = $0006
|
||||
const uword CMD_START = $0007
|
||||
const uword CMD_FLUSH = $0008
|
||||
const uword CMD_NONSTD = $0009
|
||||
const ubyte LIB_VECTSIZE = $0006
|
||||
const ubyte LIB_RESERVED = $0004
|
||||
const ubyte LIBB_SUMMING = 0
|
||||
const ubyte LIBF_SUMMING = $0001
|
||||
const ubyte LIBB_CHANGED = 1
|
||||
const ubyte LIBF_CHANGED = $0002
|
||||
const ubyte LIBB_SUMUSED = 2
|
||||
const ubyte LIBF_SUMUSED = $0004
|
||||
const ubyte LIBB_DELEXP = 3
|
||||
const ubyte LIBF_DELEXP = $0008
|
||||
const ubyte LIBB_EXP0CNT = 4
|
||||
const ubyte LIBF_EXP0CNT = $0010
|
||||
const ubyte MEMF_ANY = $0000
|
||||
const ubyte MEMB_PUBLIC = 0
|
||||
const ubyte MEMF_PUBLIC = $0001
|
||||
const ubyte MEMB_CHIP = 1
|
||||
const ubyte MEMF_CHIP = $0002
|
||||
const ubyte MEMB_FAST = 2
|
||||
const ubyte MEMF_FAST = $0004
|
||||
const ubyte MEMB_LOCAL = 8
|
||||
const uword MEMF_LOCAL = $0100
|
||||
const ubyte MEMB_24BITDMA = 9
|
||||
const uword MEMF_24BITDMA = $0200
|
||||
const ubyte MEMB_KICK = 10
|
||||
const uword MEMF_KICK = $0400
|
||||
const ubyte MEMB_CLEAR = 16
|
||||
const long MEMF_CLEAR = $00010000
|
||||
const ubyte MEMB_LARGEST = 17
|
||||
const long MEMF_LARGEST = $00020000
|
||||
const ubyte MEMB_REVERSE = 18
|
||||
const long MEMF_REVERSE = $00040000
|
||||
const ubyte MEMB_TOTAL = 19
|
||||
const long MEMF_TOTAL = $00080000
|
||||
const ubyte MEMB_NO_EXPUNGE = 31
|
||||
const long MEMF_NO_EXPUNGE = $80000000
|
||||
const ubyte MEM_BLOCKSIZE = $0008
|
||||
const ubyte MEMHB_RECYCLE = 0
|
||||
const ubyte MEMHF_RECYCLE = $0001
|
||||
const ubyte MEM_DID_NOTHING = $0000
|
||||
const long MEM_ALL_DONE = -1
|
||||
const ubyte MEM_TRY_AGAIN = $0001
|
||||
const ubyte NT_UNKNOWN = $0000
|
||||
const ubyte NT_TASK = $0001
|
||||
const ubyte NT_INTERRUPT = $0002
|
||||
const ubyte NT_DEVICE = $0003
|
||||
const ubyte NT_MSGPORT = $0004
|
||||
const ubyte NT_MESSAGE = $0005
|
||||
const ubyte NT_FREEMSG = $0006
|
||||
const ubyte NT_REPLYMSG = $0007
|
||||
const ubyte NT_RESOURCE = $0008
|
||||
const ubyte NT_LIBRARY = $0009
|
||||
const ubyte NT_MEMORY = $000a
|
||||
const ubyte NT_SOFTINT = $000b
|
||||
const ubyte NT_FONT = $000c
|
||||
const ubyte NT_PROCESS = $000d
|
||||
const ubyte NT_SEMAPHORE = $000e
|
||||
const ubyte NT_SIGNALSEM = $000f
|
||||
const ubyte NT_BOOTNODE = $0010
|
||||
const ubyte NT_KICKMEM = $0011
|
||||
const ubyte NT_GRAPHICS = $0012
|
||||
const ubyte NT_DEATHMESSAGE = $0013
|
||||
const ubyte NT_USER = $00fe
|
||||
const ubyte NT_EXTENDED = $00ff
|
||||
const ubyte PF_ACTION = $0003
|
||||
const ubyte PA_SIGNAL = $0000
|
||||
const ubyte PA_SOFTINT = $0001
|
||||
const ubyte PA_IGNORE = $0002
|
||||
const uword RTC_MATCHWORD = $4AFC
|
||||
const ubyte RTB_COLDSTART = 0
|
||||
const ubyte RTF_COLDSTART = $0001
|
||||
const ubyte RTB_SINGLETASK = 1
|
||||
const ubyte RTF_SINGLETASK = $0002
|
||||
const ubyte RTB_AFTERDOS = 2
|
||||
const ubyte RTF_AFTERDOS = $0004
|
||||
const ubyte RTB_AUTOINIT = 7
|
||||
const ubyte RTF_AUTOINIT = $0080
|
||||
const ubyte RTW_NEVER = $0000
|
||||
const ubyte RTW_COLDSTART = $0001
|
||||
const ubyte EOS = $0000
|
||||
const ubyte BELL = $0007
|
||||
const ubyte LF = $000a
|
||||
const ubyte CR = $000d
|
||||
const ubyte BS = $0008
|
||||
const ubyte DEL = $7F
|
||||
const ubyte TB_PROCTIME = 0
|
||||
const ubyte TF_PROCTIME = $0001
|
||||
const ubyte TB_ETASK = 3
|
||||
const ubyte TF_ETASK = $0008
|
||||
const ubyte TB_STACKCHK = 4
|
||||
const ubyte TF_STACKCHK = $0010
|
||||
const ubyte TB_EXCEPT = 5
|
||||
const ubyte TF_EXCEPT = $0020
|
||||
const ubyte TB_SWITCH = 6
|
||||
const ubyte TF_SWITCH = $0040
|
||||
const ubyte TB_LAUNCH = 7
|
||||
const ubyte TF_LAUNCH = $0080
|
||||
const ubyte TS_INVALID = $0000
|
||||
const ubyte SIGB_ABORT = 0
|
||||
const ubyte SIGF_ABORT = $0001
|
||||
const ubyte SIGB_CHILD = 1
|
||||
const ubyte SIGF_CHILD = $0002
|
||||
const ubyte SIGB_BLIT = 4
|
||||
const ubyte SIGF_BLIT = $0010
|
||||
const ubyte SIGB_SINGLE = 4
|
||||
const ubyte SIGF_SINGLE = $0010
|
||||
const ubyte SIGB_INTUITION = 5
|
||||
const ubyte SIGF_INTUITION = $0020
|
||||
const ubyte SIGB_NET = 7
|
||||
const ubyte SIGF_NET = $0080
|
||||
const ubyte SIGB_DOS = 8
|
||||
const uword SIGF_DOS = $0100
|
||||
const uword SYS_SIGALLOC = $0FFFF
|
||||
const uword SYS_TRAPALLOC = $08000
|
||||
const ubyte INCLUDE_VERSION = $002f
|
||||
const ubyte LIBRARY_MINIMUM = $0021
|
||||
const long ERR_OPENDEVICE = -1
|
||||
const ubyte MEM_BLOCKMASK = $0007
|
||||
const ubyte NL = $000a
|
||||
const ubyte TS_ADDED = $0001
|
||||
const ubyte TS_RUN = $0002
|
||||
const ubyte TS_READY = $0003
|
||||
const ubyte TS_WAIT = $0004
|
||||
const ubyte TS_EXCEPT = $0005
|
||||
const ubyte TS_REMOVED = $0006
|
||||
}
|
||||
;; End of auto-generated exec_lib.sfd
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,216 @@
|
||||
;; Auto-generated from icon_lib.sfd and icon_lib.i
|
||||
;; Library base: _IconBase in prog8: sys.IconBase
|
||||
;; Bank: 11
|
||||
;; Functions: 24
|
||||
|
||||
%import graphics
|
||||
%import intuition
|
||||
|
||||
icon {
|
||||
%option merge, no_symbol_prefixing
|
||||
extsub @bank 11 -54 = FreeFreeList(pointer freelist @A0)
|
||||
extsub @bank 11 -72 = AddFreeList(pointer freelist @A0, pointer mem @A1, long size @A2) -> bool @D0
|
||||
extsub @bank 11 -78 = GetDiskObject(str name @A0) -> ^^DiskObject @D0
|
||||
extsub @bank 11 -84 = PutDiskObject(str name @A0, ^^DiskObject diskobj @A1) -> bool @D0
|
||||
extsub @bank 11 -90 = FreeDiskObject(^^DiskObject diskobj @A0)
|
||||
extsub @bank 11 -96 = FindToolType(str toolTypeArray @A0, str typeName @A1) -> pointer @D0
|
||||
extsub @bank 11 -102 = MatchToolValue(str typeString @A0, str value @A1) -> bool @D0
|
||||
extsub @bank 11 -108 = BumpRevision(str newname @A0, str oldname @A1) -> str @D0
|
||||
extsub @bank 11 -114 = FreeAlloc(pointer free @A0, long len @A1, long k_type @A2) -> pointer @D0
|
||||
extsub @bank 11 -120 = GetDefDiskObject(long k_type @D0) -> ^^DiskObject @D0
|
||||
extsub @bank 11 -126 = PutDefDiskObject(^^DiskObject diskObject @A0) -> bool @D0
|
||||
extsub @bank 11 -132 = GetDiskObjectNew(str name @A0) -> ^^DiskObject @D0
|
||||
extsub @bank 11 -138 = DeleteDiskObject(str name @A0) -> bool @D0
|
||||
extsub @bank 11 -144 = FreeFree(pointer fl @A0, pointer address @A1)
|
||||
extsub @bank 11 -150 = DupDiskObjectA(^^DiskObject diskObject @A0, pointer tags @A1) -> ^^DiskObject @D0
|
||||
extsub @bank 11 -156 = IconControlA(^^DiskObject icon @A0, pointer tags @A1) -> long @D0
|
||||
extsub @bank 11 -162 = DrawIconStateA(^^graphics.RastPort rp @A0, ^^DiskObject icon @A1, str label @A2, long leftOffset @D0, long topOffset @D1, long state @D2, pointer tags @A3)
|
||||
extsub @bank 11 -168 = GetIconRectangleA(^^graphics.RastPort rp @A0, ^^DiskObject icon @A1, str label @A2, pointer rect @A3, pointer tags @A4) -> bool @D0
|
||||
extsub @bank 11 -174 = NewDiskObject(long k_type @D0) -> ^^DiskObject @D0
|
||||
extsub @bank 11 -180 = GetIconTagList(str name @A0, pointer tags @A1) -> ^^DiskObject @D0
|
||||
extsub @bank 11 -186 = PutIconTagList(str name @A0, ^^DiskObject icon @A1, pointer tags @A2) -> bool @D0
|
||||
extsub @bank 11 -192 = LayoutIconA(^^DiskObject icon @A0, ^^intuition.Screen screen @A1, pointer tags @A2) -> bool @D0
|
||||
extsub @bank 11 -198 = ChangeToSelectedIconColor(pointer cr @A0)
|
||||
extsub @bank 11 -204 = BumpRevisionLength(str newname @A0, str oldname @A1, long maxLength @D0) -> str @D0
|
||||
|
||||
; ---- struct definitions ----
|
||||
|
||||
struct DiskObject { ; total size: 38
|
||||
uword Magic ; 0
|
||||
uword Version ; 2
|
||||
ubyte[4] emb_do_Gadget ; 4
|
||||
ubyte Type ; 8
|
||||
ubyte Pad_byte ; 9
|
||||
pointer DefaultTool ; 10
|
||||
pointer ToolTypes ; 14
|
||||
long CurrentX ; 18
|
||||
long CurrentY ; 22
|
||||
pointer DrawerData ; 26
|
||||
pointer ToolWindow ; 30
|
||||
long StackSize ; 34
|
||||
}
|
||||
|
||||
; ---- constants ----
|
||||
const ubyte WORKBENCH_WORKBENCH_I = $0001
|
||||
const ubyte WBDISK = $0001
|
||||
const ubyte WBDRAWER = $0002
|
||||
const ubyte WBTOOL = $0003
|
||||
const ubyte WBPROJECT = $0004
|
||||
const ubyte WBGARBAGE = $0005
|
||||
const ubyte WBDEVICE = $0006
|
||||
const ubyte WBKICK = $0007
|
||||
const ubyte WBAPPICON = $0008
|
||||
const ubyte DDVM_BYDEFAULT = $0000
|
||||
const ubyte DDVM_BYICON = $0001
|
||||
const ubyte DDVM_BYNAME = $0002
|
||||
const ubyte DDVM_BYDATE = $0003
|
||||
const ubyte DDVM_BYSIZE = $0004
|
||||
const ubyte DDVM_BYTYPE = $0005
|
||||
const uword DDFLAGS_SHOWMASK = $0003
|
||||
const uword DDFLAGS_SHOWDEFAULT = $0000
|
||||
const uword DDFLAGS_SHOWICONS = $0001
|
||||
const uword DDFLAGS_SHOWALL = $0002
|
||||
const uword DDFLAGS_SORTMASK = $0300
|
||||
const uword DDFLAGS_SORTDEFAULT = $0000
|
||||
const uword DDFLAGS_SORTASC = $0100
|
||||
const uword DDFLAGS_SORTDESC = $0200
|
||||
const uword WB_DISKMAGIC = $e310
|
||||
const ubyte WB_DISKVERSION = $0001
|
||||
const ubyte WB_DISKREVISION = $0001
|
||||
const ubyte WB_DISKREVISIONMASK = $ff
|
||||
const uword GFLG_GADGBACKFILL = $0001
|
||||
const uword GADGBACKFILL = $0001
|
||||
const long NO_ICON_POSITION = $80000000
|
||||
const ubyte AM_VERSION = $0001
|
||||
const ubyte AMTYPE_APPWINDOW = $0007
|
||||
const ubyte AMTYPE_APPICON = $0008
|
||||
const ubyte AMTYPE_APPMENUITEM = $0009
|
||||
const ubyte AMTYPE_APPWINDOWZONE = $000a
|
||||
const ubyte AMCLASSICON_Open = $0000
|
||||
const ubyte AMCLASSICON_Copy = $0001
|
||||
const ubyte AMCLASSICON_Rename = $0002
|
||||
const ubyte AMCLASSICON_Information = $0003
|
||||
const ubyte AMCLASSICON_Snapshot = $0004
|
||||
const ubyte AMCLASSICON_UnSnapshot = $0005
|
||||
const ubyte AMCLASSICON_LeaveOut = $0006
|
||||
const ubyte AMCLASSICON_PutAway = $0007
|
||||
const ubyte AMCLASSICON_Delete = $0008
|
||||
const ubyte AMCLASSICON_FormatDisk = $0009
|
||||
const ubyte AMCLASSICON_EjectDisk = $000d
|
||||
const ubyte AMCLASSICON_EmptyTrash = $000a
|
||||
const ubyte AMCLASSICON_Selected = $000b
|
||||
const ubyte AMCLASSICON_Unselected = $000c
|
||||
const long WBA_Dummy = $8000a000
|
||||
const ubyte SCHMSTATE_TryCleanup = $0000
|
||||
const ubyte SCHMSTATE_Cleanup = $0001
|
||||
const ubyte SCHMSTATE_Setup = $0002
|
||||
const long WBF_DRAWERPOSMASK = $00000003
|
||||
const long WBF_DRAWERPOSFREE = $00000000
|
||||
const long WBF_DRAWERPOSHEAD = $00000001
|
||||
const long WBF_DRAWERPOSTAIL = $00000002
|
||||
const long WBF_BOUNDTEXTVIEW = $00000080
|
||||
const long WBF_OLDDATESFIRST = $00010000
|
||||
const ubyte WBO_NONE = $0000
|
||||
const ubyte WBO_DRAWER = $0001
|
||||
const ubyte WBO_ICON = $0002
|
||||
const ubyte ADZMACTION_Enter = $0000
|
||||
const ubyte ADZMACTION_Leave = $0001
|
||||
const ubyte ISMACTION_Unselect = $0000
|
||||
const ubyte ISMACTION_Select = $0001
|
||||
const ubyte ISMACTION_Ignore = $0002
|
||||
const ubyte ISMACTION_Stop = $0003
|
||||
const ubyte CPACTION_Begin = $0000
|
||||
const ubyte CPACTION_Copy = $0001
|
||||
const ubyte CPACTION_End = $0002
|
||||
const ubyte DLACTION_BeginDiscard = $0000
|
||||
const ubyte DLACTION_BeginEmptyTrash = $0001
|
||||
const ubyte DLACTION_DeleteContents = $0003
|
||||
const ubyte DLACTION_DeleteObject = $0004
|
||||
const ubyte DLACTION_End = $0005
|
||||
const ubyte TIACTION_Rename = $0000
|
||||
const ubyte TIACTION_RelabelVolume = $0001
|
||||
const ubyte TIACTION_NewDrawer = $0002
|
||||
const ubyte TIACTION_Execute = $0003
|
||||
const ubyte UPDATEWB_ObjectRemoved = $0000
|
||||
const ubyte UPDATEWB_ObjectAdded = $0001
|
||||
const long WBAPPICONA_SupportsOpen = $8000a001
|
||||
const long WBAPPICONA_SupportsCopy = $8000a002
|
||||
const long WBAPPICONA_SupportsRename = $8000a003
|
||||
const long WBAPPICONA_SupportsInformation = $8000a004
|
||||
const long WBAPPICONA_SupportsSnapshot = $8000a005
|
||||
const long WBAPPICONA_SupportsUnSnapshot = $8000a006
|
||||
const long WBAPPICONA_SupportsLeaveOut = $8000a007
|
||||
const long WBAPPICONA_SupportsPutAway = $8000a008
|
||||
const long WBAPPICONA_SupportsDelete = $8000a009
|
||||
const long WBAPPICONA_SupportsFormatDisk = $8000a00a
|
||||
const long WBAPPICONA_SupportsEjectDisk = $8000a09e
|
||||
const long WBAPPICONA_SupportsEmptyTrash = $8000a00b
|
||||
const long WBAPPICONA_PropagatePosition = $8000a00c
|
||||
const long WBAPPICONA_RenderHook = $8000a00d
|
||||
const long WBAPPICONA_NotifySelectState = $8000a00e
|
||||
const long WBAPPMENUA_CommandKeyString = $8000a00f
|
||||
const long WBAPPMENUA_GetKey = $8000a041
|
||||
const long WBAPPMENUA_UseKey = $8000a042
|
||||
const long WBAPPMENUA_GetTitleKey = $8000a04d
|
||||
const long WBOPENA_ArgLock = $8000a010
|
||||
const long WBOPENA_ArgName = $8000a011
|
||||
const long WBOPENA_Show = $8000a04b
|
||||
const long WBOPENA_ViewBy = $8000a04c
|
||||
const long WBCTRLA_IsOpen = $8000a012
|
||||
const long WBCTRLA_DuplicateSearchPath = $8000a013
|
||||
const long WBCTRLA_FreeSearchPath = $8000a014
|
||||
const long WBCTRLA_GetDefaultStackSize = $8000a015
|
||||
const long WBCTRLA_SetDefaultStackSize = $8000a016
|
||||
const long WBCTRLA_RedrawAppIcon = $8000a017
|
||||
const long WBCTRLA_GetProgramList = $8000a018
|
||||
const long WBCTRLA_FreeProgramList = $8000a019
|
||||
const long WBCTRLA_GetSelectedIconList = $8000a024
|
||||
const long WBCTRLA_FreeSelectedIconList = $8000a025
|
||||
const long WBCTRLA_GetOpenDrawerList = $8000a026
|
||||
const long WBCTRLA_FreeOpenDrawerList = $8000a027
|
||||
const long WBCTRLA_GetHiddenDeviceList = $8000a02a
|
||||
const long WBCTRLA_FreeHiddenDeviceList = $8000a02b
|
||||
const long WBCTRLA_AddHiddenDeviceName = $8000a02c
|
||||
const long WBCTRLA_RemoveHiddenDeviceName = $8000a02d
|
||||
const long WBCTRLA_GetTypeRestartTime = $8000a02f
|
||||
const long WBCTRLA_SetTypeRestartTime = $8000a030
|
||||
const long WBCTRLA_GetCopyHook = $8000a045
|
||||
const long WBCTRLA_SetCopyHook = $8000a046
|
||||
const long WBCTRLA_GetDeleteHook = $8000a047
|
||||
const long WBCTRLA_SetDeleteHook = $8000a048
|
||||
const long WBCTRLA_GetTextInputHook = $8000a049
|
||||
const long WBCTRLA_SetTextInputHook = $8000a04a
|
||||
const long WBCTRLA_AddSetupCleanupHook = $8000a04e
|
||||
const long WBCTRLA_RemSetupCleanupHook = $8000a04f
|
||||
const long WBCTRLA_SetGlobalFlags = $8000a082
|
||||
const long WBCTRLA_GetGlobalFlags = $8000a083
|
||||
const long WBCTRLA_GetDiskInfoHook = $8000a09f
|
||||
const long WBCTRLA_SetDiskInfoHook = $8000a0a0
|
||||
const long WBDZA_Left = $8000a01a
|
||||
const long WBDZA_RelRight = $8000a01b
|
||||
const long WBDZA_Top = $8000a01c
|
||||
const long WBDZA_RelBottom = $8000a01d
|
||||
const long WBDZA_Width = $8000a01e
|
||||
const long WBDZA_RelWidth = $8000a01f
|
||||
const long WBDZA_Height = $8000a020
|
||||
const long WBDZA_RelHeight = $8000a021
|
||||
const long WBDZA_Box = $8000a022
|
||||
const long WBDZA_Hook = $8000a023
|
||||
const long WBOBJA_Type = $8000a056
|
||||
const long WBOBJA_Left = $8000a057
|
||||
const long WBOBJA_Top = $8000a058
|
||||
const long WBOBJA_Width = $8000a059
|
||||
const long WBOBJA_Height = $8000a05a
|
||||
const long WBOBJA_State = $8000a05b
|
||||
const long WBOBJA_IsFake = $8000a05c
|
||||
const long WBOBJA_Name = $8000a05d
|
||||
const long WBOBJA_NameSize = $8000a05e
|
||||
const long WBOBJA_FullPath = $8000a05f
|
||||
const long WBOBJA_FullPathSize = $8000a060
|
||||
const long WBOBJA_IsLink = $8000a061
|
||||
const long WBOBJA_DrawerPath = $8000a062
|
||||
const long WBOBJA_DrawerPathSize = $8000a063
|
||||
const long WBOBJA_DrawerFlags = $8000a074
|
||||
const long WBOBJA_DrawerModes = $8000a075
|
||||
}
|
||||
;; End of auto-generated icon_lib.sfd
|
||||
@@ -0,0 +1,148 @@
|
||||
;; Auto-generated from iffparse_lib.sfd and iffparse_lib.i
|
||||
;; Library base: _IFFParseBase in prog8: sys.IFFParseBase
|
||||
;; Bank: 14
|
||||
;; Functions: 40
|
||||
|
||||
%import exec
|
||||
%import utility
|
||||
|
||||
iffparse {
|
||||
%option merge, no_symbol_prefixing
|
||||
|
||||
sub openlib() -> bool {
|
||||
sys.IFFParseBase = exec.OpenLibrary("iffparse.library", 0)
|
||||
return sys.IFFParseBase!=0
|
||||
}
|
||||
|
||||
sub closelib() {
|
||||
if sys.IFFParseBase!=0 {
|
||||
exec.CloseLibrary(sys.IFFParseBase)
|
||||
sys.IFFParseBase = 0
|
||||
}
|
||||
}
|
||||
|
||||
extsub @bank 14 -30 = AllocIFF() -> ^^IFFHandle @D0
|
||||
extsub @bank 14 -36 = OpenIFF(^^IFFHandle iff @A0, long rwMode @D0) -> long @D0
|
||||
extsub @bank 14 -42 = ParseIFF(^^IFFHandle iff @A0, long control @D0) -> long @D0
|
||||
extsub @bank 14 -48 = CloseIFF(^^IFFHandle iff @A0)
|
||||
extsub @bank 14 -54 = FreeIFF(^^IFFHandle iff @A0)
|
||||
extsub @bank 14 -60 = ReadChunkBytes(^^IFFHandle iff @A0, pointer buf @A1, long numBytes @D0) -> long @D0
|
||||
extsub @bank 14 -66 = WriteChunkBytes(^^IFFHandle iff @A0, pointer buf @A1, long numBytes @D0) -> long @D0
|
||||
extsub @bank 14 -72 = ReadChunkRecords(^^IFFHandle iff @A0, pointer buf @A1, long bytesPerRecord @D0, long numRecords @D1) -> long @D0
|
||||
extsub @bank 14 -78 = WriteChunkRecords(^^IFFHandle iff @A0, pointer buf @A1, long bytesPerRecord @D0, long numRecords @D1) -> long @D0
|
||||
extsub @bank 14 -84 = PushChunk(^^IFFHandle iff @A0, long k_type @D0, long id @D1, long size @D2) -> long @D0
|
||||
extsub @bank 14 -90 = PopChunk(^^IFFHandle iff @A0) -> long @D0
|
||||
extsub @bank 14 -102 = EntryHandler(^^IFFHandle iff @A0, long k_type @D0, long id @D1, long position @D2, ^^utility.Hook handler @A1, pointer object @A2) -> long @D0
|
||||
extsub @bank 14 -108 = ExitHandler(^^IFFHandle iff @A0, long k_type @D0, long id @D1, long position @D2, ^^utility.Hook handler @A1, pointer object @A2) -> long @D0
|
||||
extsub @bank 14 -114 = PropChunk(^^IFFHandle iff @A0, long k_type @D0, long id @D1) -> long @D0
|
||||
extsub @bank 14 -120 = PropChunks(^^IFFHandle iff @A0, pointer propArray @A1, long numPairs @D0) -> long @D0
|
||||
extsub @bank 14 -126 = StopChunk(^^IFFHandle iff @A0, long k_type @D0, long id @D1) -> long @D0
|
||||
extsub @bank 14 -132 = StopChunks(^^IFFHandle iff @A0, pointer propArray @A1, long numPairs @D0) -> long @D0
|
||||
extsub @bank 14 -138 = CollectionChunk(^^IFFHandle iff @A0, long k_type @D0, long id @D1) -> long @D0
|
||||
extsub @bank 14 -144 = CollectionChunks(^^IFFHandle iff @A0, pointer propArray @A1, long numPairs @D0) -> long @D0
|
||||
extsub @bank 14 -150 = StopOnExit(^^IFFHandle iff @A0, long k_type @D0, long id @D1) -> long @D0
|
||||
extsub @bank 14 -156 = FindProp(^^IFFHandle iff @A0, long k_type @D0, long id @D1) -> ^^StoredProperty @D0
|
||||
extsub @bank 14 -162 = FindCollection(^^IFFHandle iff @A0, long k_type @D0, long id @D1) -> ^^CollectionItem @D0
|
||||
extsub @bank 14 -168 = FindPropContext(^^IFFHandle iff @A0) -> ^^ContextNode @D0
|
||||
extsub @bank 14 -174 = CurrentChunk(^^IFFHandle iff @A0) -> ^^ContextNode @D0
|
||||
extsub @bank 14 -180 = ParentChunk(^^ContextNode contextNode @A0) -> ^^ContextNode @D0
|
||||
extsub @bank 14 -186 = AllocLocalItem(long k_type @D0, long id @D1, long ident @D2, long dataSize @D3) -> pointer @D0
|
||||
extsub @bank 14 -192 = LocalItemData(pointer localItem @A0) -> pointer @D0
|
||||
extsub @bank 14 -198 = SetLocalItemPurge(pointer localItem @A0, ^^utility.Hook purgeHook @A1)
|
||||
extsub @bank 14 -204 = FreeLocalItem(pointer localItem @A0)
|
||||
extsub @bank 14 -210 = FindLocalItem(^^IFFHandle iff @A0, long k_type @D0, long id @D1, long ident @D2) -> pointer @D0
|
||||
extsub @bank 14 -216 = StoreLocalItem(^^IFFHandle iff @A0, pointer localItem @A1, long position @D0) -> long @D0
|
||||
extsub @bank 14 -222 = StoreItemInContext(^^IFFHandle iff @A0, pointer localItem @A1, ^^ContextNode contextNode @A2)
|
||||
extsub @bank 14 -228 = InitIFF(^^IFFHandle iff @A0, long flags @D0, ^^utility.Hook streamHook @A1)
|
||||
extsub @bank 14 -234 = InitIFFasDOS(^^IFFHandle iff @A0)
|
||||
extsub @bank 14 -240 = InitIFFasClip(^^IFFHandle iff @A0)
|
||||
extsub @bank 14 -246 = OpenClipboard(long unitNumber @D0) -> pointer @D0
|
||||
extsub @bank 14 -252 = CloseClipboard(pointer clipHandle @A0)
|
||||
extsub @bank 14 -258 = GoodID(long id @D0) -> long @D0
|
||||
extsub @bank 14 -264 = GoodType(long k_type @D0) -> long @D0
|
||||
extsub @bank 14 -270 = IDtoStr(long id @D0, str buf @A0) -> str @D0
|
||||
|
||||
; ---- struct definitions ----
|
||||
|
||||
struct CollectionItem { ; total size: 12
|
||||
^^CollectionItem Next ; 0
|
||||
long Size ; 4
|
||||
pointer Data ; 8
|
||||
}
|
||||
|
||||
struct ContextNode { ; total size: 24
|
||||
^^exec.MinNode Succ ; 0
|
||||
^^exec.MinNode Pred ; 4
|
||||
long Id ; 8
|
||||
long Type ; 12
|
||||
long Size ; 16
|
||||
long Scan ; 20
|
||||
}
|
||||
|
||||
struct IFFHandle { ; total size: 12
|
||||
long Stream ; 0
|
||||
long Flags ; 4
|
||||
long Depth ; 8
|
||||
}
|
||||
|
||||
struct IFFStreamCmd { ; total size: 12
|
||||
long Command ; 0
|
||||
pointer Buf ; 4
|
||||
long NBytes ; 8
|
||||
}
|
||||
|
||||
struct StoredProperty { ; total size: 8
|
||||
long Size ; 0
|
||||
pointer Data ; 4
|
||||
}
|
||||
|
||||
; ---- constants ----
|
||||
const ubyte IFFF_READ = $0000
|
||||
const ubyte IFFF_WRITE = $0001
|
||||
const ubyte IFFF_FSEEK = $0002
|
||||
const ubyte IFFF_RSEEK = $0004
|
||||
const long IFFF_RESERVED = $FFFF0000
|
||||
const long IFFERR_EOF = -1
|
||||
const long IFFERR_EOC = -2
|
||||
const long IFFERR_NOSCOPE = -3
|
||||
const long IFFERR_NOMEM = -4
|
||||
const long IFFERR_READ = -5
|
||||
const long IFFERR_WRITE = -6
|
||||
const long IFFERR_SEEK = -7
|
||||
const long IFFERR_MANGLED = -8
|
||||
const long IFFERR_SYNTAX = -9
|
||||
const long IFFERR_NOTIFF = -10
|
||||
const long IFFERR_NOHOOK = -11
|
||||
const long IFF_RETURN2CLIENT = -12
|
||||
const long ID_FORM = $464f524d
|
||||
const long ID_LIST = $4c495354
|
||||
const long ID_CAT = $43415420
|
||||
const long ID_PROP = $50524f50
|
||||
const long ID_NULL = $20202020
|
||||
const long IFFLCI_PROP = $70726f70
|
||||
const long IFFLCI_COLLECTION = $636f6c6c
|
||||
const long IFFLCI_ENTRYHANDLER = $656e6864
|
||||
const long IFFLCI_EXITHANDLER = $65786864
|
||||
const ubyte IFFPARSE_SCAN = $0000
|
||||
const ubyte IFFPARSE_STEP = $0001
|
||||
const ubyte IFFPARSE_RAWSTEP = $0002
|
||||
const ubyte IFFSLI_ROOT = $0001
|
||||
const ubyte IFFSLI_TOP = $0002
|
||||
const ubyte IFFSLI_PROP = $0003
|
||||
const long IFFSIZE_UNKNOWN = -1
|
||||
const ubyte IFFCMD_INIT = $0000
|
||||
const ubyte IFFCMD_CLEANUP = $0001
|
||||
const ubyte IFFCMD_READ = $0002
|
||||
const ubyte IFFCMD_WRITE = $0003
|
||||
const ubyte IFFCMD_SEEK = $0004
|
||||
const ubyte IFFCMD_ENTRY = $0005
|
||||
const ubyte IFFCMD_EXIT = $0006
|
||||
const ubyte IFFCMD_PURGELCI = $0007
|
||||
const ubyte IFFF_RWBITS = $0001
|
||||
const ubyte IFFSCC_INIT = $0000
|
||||
const ubyte IFFSCC_CLEANUP = $0001
|
||||
const ubyte IFFSCC_READ = $0002
|
||||
const ubyte IFFSCC_WRITE = $0003
|
||||
const ubyte IFFSCC_SEEK = $0004
|
||||
}
|
||||
;; End of auto-generated iffparse_lib.sfd
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,151 @@
|
||||
;; Exec doubly linked lists - usage summary
|
||||
;;
|
||||
;; Purpose: this module is a super thin wrapper over the exec list
|
||||
;; headers and library routines. It exists for source code
|
||||
;; compatibility with other targets that supply their own lists.p8
|
||||
;; implementation. On amiga500 everything simply forwards to exec.library.
|
||||
;;
|
||||
;; Data structures (from Include_H/exec/nodes.h and exec/lists.h):
|
||||
;;
|
||||
;; A full Node is 14 bytes: Succ and Pred pointers at offsets 0 and 4,
|
||||
;; an ubyte Type at 8, a signed priority byte Pri at 9 and a Name
|
||||
;; string pointer at 10. A MinNode holds just the two link pointers
|
||||
;; (8 bytes). The list headers mirror this split: List consists of
|
||||
;; Head, Tail and TailPred pointers plus Type and Pad bytes (14 bytes),
|
||||
;; MinList has only the three pointers (12 bytes). This module aliases
|
||||
;; List/Node to the minimal variants; use FullNode when you need the
|
||||
;; Type/Pri/Name fields.
|
||||
;;
|
||||
;; Layout: an Exec list is a circular doubly linked list in which the
|
||||
;; header itself acts as the sentinel node - there are no separate
|
||||
;; head/tail marker pointers. The header's Tail field stays zero
|
||||
;; forever and serves as terminator: forward traversal via Succ ends
|
||||
;; when it reaches &Header.Tail, backward traversal via Pred ends when
|
||||
;; it reaches the header itself. The first real node's Pred points at
|
||||
;; the header, the last real node's Succ points at &Header.Tail.
|
||||
;;
|
||||
;; Creation and initialization:
|
||||
;; Place the list header in static memory or allocate it, then call
|
||||
;; init(listptr) once before any other use. init() is a thin wrapper
|
||||
;; around exec.NewList(), which sets Head = &Tail, Tail = 0 and
|
||||
;; TailPred = &Head. Nodes need no explicit setup beyond being
|
||||
;; cleared; fill in Type/Pri/Name as needed before using the routines
|
||||
;; below that depend on them. For MinList headers on very new
|
||||
;; Kickstarts there is also NewMinList (LVO -828), but NewList covers
|
||||
;; both variants because their layouts coincide.
|
||||
;;
|
||||
;; Empty test: the list is empty iff TailPred points back at the
|
||||
;; header itself (equivalently Head == &Tail); see is_empty().
|
||||
;;
|
||||
;; Operations (all resolve to exec.library LVO calls):
|
||||
;; - add_head / add_tail: link node at front / back of list
|
||||
;; (AddHead LVO -240, AddTail LVO -246).
|
||||
;; - insert(list, node, pred): links node after the given predecessor
|
||||
;; node anywhere in the list; pred = 0 means insert at head
|
||||
;; (Insert LVO -234).
|
||||
;; - enqueue(list, node): priority-sorted insertion using Pri, placed
|
||||
;; before the first lower-priority node so equal priorities come out
|
||||
;; FIFO. Requires full Nodes (Enqueue LVO -270).
|
||||
;; - remove(node): unlinks a node from whichever list it currently
|
||||
;; sits in; it must actually be linked into one (Remove LVO -252).
|
||||
;; - remove_head / remove_tail: unlink and return the first / last
|
||||
;; node, or null if empty; these give you queue and stack behaviour
|
||||
;; (RemHead LVO -258, RemTail LVO -264).
|
||||
;; - find_name(list, name): linear search over Name strings, returns
|
||||
;; matching node or null; requires full Nodes (FindName LVO -276).
|
||||
;;
|
||||
;; Concurrency warning: none of these routines arbitrate access to
|
||||
;; the list. If tasks or interrupts share a list you must serialize
|
||||
;; access yourself (Forbid/Permit, Disable/Enable, or semaphores).
|
||||
;;
|
||||
;; Allocator agnostic: the routines never allocate or free memory
|
||||
;; themselves, they only link the `pointer` values you pass in. Nodes
|
||||
;; and headers can come from static `[]` variables, `memory()` slabs,
|
||||
;; or any arena/bump allocator such as `arena_alloc(sizeof(MyNode))`
|
||||
;; as `^^MyNode` or `exec.AllocMem` on amiga. Just ensure the
|
||||
;; allocation is suitably aligned (long-aligned on m68k).
|
||||
;;
|
||||
;; Custom nodes: you can define your own node struct for use with the
|
||||
;; exec/lists routines and with `for node in mylist` loops. The only
|
||||
;; requirement is that the link pointers are the first fields at offset
|
||||
;; 0 (Succ at 0, Pred at 4 on 32-bit amiga). Minimal operations only
|
||||
;; need Succ/Pred; enqueue() and find_name() require the full
|
||||
;; Type/Pri/Name layout of exec.Node / lists.FullNode. Define the list
|
||||
;; header with your node type so `for`-iteration infers the correct
|
||||
;; type. Example:
|
||||
;;
|
||||
;; main {
|
||||
;; struct MyNode {
|
||||
;; ^^MyNode Succ ; must be first (offset 0)
|
||||
;; ^^MyNode Pred ; must be second (offset 4)
|
||||
;; ubyte Type ; include for FullNode compatibility if needed
|
||||
;; byte Pri
|
||||
;; str Name
|
||||
;; ubyte value ; your payload follows
|
||||
;; }
|
||||
;; struct MyList {
|
||||
;; ^^MyNode Head
|
||||
;; pointer Tail
|
||||
;; ^^MyNode TailPred
|
||||
;; }
|
||||
;; sub start() {
|
||||
;; ^^MyList mylist = [] ; zero-initialized header
|
||||
;; ^^MyNode n1 = [0, 0, 0, 0, 0, 11] ; Succ, Pred, Type, Pri, Name, value
|
||||
;; ^^MyNode n2 = [0, 0, 0, 0, 0, 22]
|
||||
;; exec.NewList(mylist as ^^exec.List) ; or lists.init(mylist as pointer)
|
||||
;; lists.add_tail(mylist as pointer, n1 as pointer)
|
||||
;; lists.add_tail(mylist as pointer, n2 as pointer)
|
||||
;; ; or directly: exec.AddTail(mylist as pointer, n1 as pointer)
|
||||
;; }
|
||||
;; }
|
||||
|
||||
%import exec
|
||||
|
||||
lists {
|
||||
%option merge, ignore_unused
|
||||
|
||||
alias Node = exec.MinNode
|
||||
alias List = exec.MinList
|
||||
alias FullNode = exec.Node
|
||||
|
||||
inline sub init(pointer listptr) {
|
||||
exec.NewList(listptr as ^^exec.List)
|
||||
}
|
||||
|
||||
inline sub is_empty(pointer listptr) -> bool {
|
||||
^^List lst = listptr as ^^List
|
||||
return lst.TailPred == (&lst.Head as ^^Node)
|
||||
}
|
||||
|
||||
inline sub add_head(pointer listptr, pointer node) {
|
||||
exec.AddHead(listptr, node)
|
||||
}
|
||||
|
||||
inline sub add_tail(pointer listptr, pointer node) {
|
||||
exec.AddTail(listptr, node)
|
||||
}
|
||||
|
||||
inline sub insert(pointer listptr, pointer node, pointer pred) {
|
||||
exec.Insert(listptr, node, pred)
|
||||
}
|
||||
|
||||
inline sub remove(pointer node) {
|
||||
exec.Remove(node)
|
||||
}
|
||||
|
||||
inline sub remove_head(pointer listptr) -> pointer {
|
||||
return exec.RemHead(listptr)
|
||||
}
|
||||
|
||||
inline sub remove_tail(pointer listptr) -> pointer {
|
||||
return exec.RemTail(listptr)
|
||||
}
|
||||
|
||||
inline sub enqueue(pointer listptr, pointer node) {
|
||||
exec.Enqueue(listptr, node)
|
||||
}
|
||||
|
||||
inline sub find_name(pointer listptr, str name) -> pointer {
|
||||
return exec.FindName(listptr, name)
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1 @@
|
||||
; TODO
|
||||
@@ -0,0 +1,109 @@
|
||||
;; Auto-generated from utility_lib.sfd and utility_lib.i
|
||||
;; Library base: _UtilityBase in prog8: sys.UtilityBase
|
||||
;; Bank: 9
|
||||
;; Functions: 43
|
||||
|
||||
%import exec
|
||||
|
||||
utility {
|
||||
%option merge, no_symbol_prefixing
|
||||
extsub @bank 9 -30 = FindTagItem(long tagVal @D0, pointer tagList @A0) -> ^^TagItem @D0
|
||||
extsub @bank 9 -36 = GetTagData(long tagValue @D0, long defaultVal @D1, pointer tagList @A0) -> long @D0
|
||||
extsub @bank 9 -42 = PackBoolTags(long initialFlags @D0, pointer tagList @A0, pointer boolMap @A1) -> long @D0
|
||||
extsub @bank 9 -48 = NextTagItem(pointer tagListPtr @A0) -> ^^TagItem @D0
|
||||
extsub @bank 9 -54 = FilterTagChanges(pointer changeList @A0, pointer originalList @A1, long apply @D0)
|
||||
extsub @bank 9 -60 = MapTags(pointer tagList @A0, pointer mapList @A1, long mapType @D0)
|
||||
extsub @bank 9 -66 = AllocateTagItems(long numTags @D0) -> ^^TagItem @D0
|
||||
extsub @bank 9 -72 = CloneTagItems(pointer tagList @A0) -> ^^TagItem @D0
|
||||
extsub @bank 9 -78 = FreeTagItems(pointer tagList @A0)
|
||||
extsub @bank 9 -84 = RefreshTagItemClones(pointer clone @A0, pointer original @A1)
|
||||
extsub @bank 9 -90 = TagInArray(long tagValue @D0, pointer tagArray @A0) -> bool @D0
|
||||
extsub @bank 9 -96 = FilterTagItems(pointer tagList @A0, pointer filterArray @A1, long logic @D0) -> long @D0
|
||||
extsub @bank 9 -102 = CallHookPkt(^^Hook hook @A0, pointer object @A2, pointer paramPacket @A1) -> long @D0
|
||||
extsub @bank 9 -120 = Amiga2Date(long seconds @D0, ^^ClockData result @A0)
|
||||
extsub @bank 9 -126 = Date2Amiga(^^ClockData date @A0) -> long @D0
|
||||
extsub @bank 9 -132 = CheckDate(^^ClockData date @A0) -> long @D0
|
||||
extsub @bank 9 -138 = SMult32(long arg1 @D0, long arg2 @D1) -> long @D0
|
||||
extsub @bank 9 -144 = UMult32(long arg1 @D0, long arg2 @D1) -> long @D0
|
||||
extsub @bank 9 -150 = SDivMod32(long dividend @D0, long divisor @D1) -> long @D0
|
||||
extsub @bank 9 -156 = UDivMod32(long dividend @D0, long divisor @D1) -> long @D0
|
||||
extsub @bank 9 -162 = Stricmp(str string1 @A0, str string2 @A1) -> long @D0
|
||||
extsub @bank 9 -168 = Strnicmp(str string1 @A0, str string2 @A1, long length @D0) -> long @D0
|
||||
extsub @bank 9 -174 = ToUpper(ubyte character @D0) -> ubyte @D0
|
||||
extsub @bank 9 -180 = ToLower(ubyte character @D0) -> ubyte @D0
|
||||
extsub @bank 9 -186 = ApplyTagChanges(pointer list @A0, pointer changeList @A1)
|
||||
extsub @bank 9 -198 = SMult64(long arg1 @D0, long arg2 @D1) -> long @D0
|
||||
extsub @bank 9 -204 = UMult64(long arg1 @D0, long arg2 @D1) -> long @D0
|
||||
extsub @bank 9 -210 = PackStructureTags(pointer pack @A0, pointer packTable @A1, pointer tagList @A2) -> long @D0
|
||||
extsub @bank 9 -216 = UnpackStructureTags(pointer pack @A0, pointer packTable @A1, pointer tagList @A2) -> long @D0
|
||||
extsub @bank 9 -222 = AddNamedObject(pointer nameSpace @A0, pointer object @A1) -> bool @D0
|
||||
extsub @bank 9 -228 = AllocNamedObjectA(str name @A0, pointer tagList @A1) -> pointer @D0
|
||||
extsub @bank 9 -234 = AttemptRemNamedObject(pointer object @A0) -> long @D0
|
||||
extsub @bank 9 -240 = FindNamedObject(pointer nameSpace @A0, str name @A1, pointer lastObject @A2) -> pointer @D0
|
||||
extsub @bank 9 -246 = FreeNamedObject(pointer object @A0)
|
||||
extsub @bank 9 -252 = NamedObjectName(pointer object @A0) -> str @D0
|
||||
extsub @bank 9 -258 = ReleaseNamedObject(pointer object @A0)
|
||||
extsub @bank 9 -264 = RemNamedObject(pointer object @A0, ^^exec.Message message @A1)
|
||||
extsub @bank 9 -270 = GetUniqueID() -> long @D0
|
||||
extsub @bank 9 -312 = VSNPrintf(str buffer @A0, long bufsize @D0, str fmt @A1, pointer data @A2) -> long @D0
|
||||
extsub @bank 9 -438 = Strncpy(str dst @A1, str src @A0, long size @D0) -> str @D0
|
||||
extsub @bank 9 -444 = Strncat(str dst @A1, str src @A0, long size @D0) -> str @D0
|
||||
extsub @bank 9 -450 = SDivMod64(long hi @D1, long lo @D0, long divisor @D2) -> long @D0
|
||||
extsub @bank 9 -456 = UDivMod64(long hi @D1, long lo @D0, long divisor @D2) -> long @D0
|
||||
|
||||
; ---- struct definitions ----
|
||||
|
||||
struct ClockData { ; total size: 14
|
||||
uword Sec ; 0
|
||||
uword Min ; 2
|
||||
uword Hour ; 4
|
||||
uword Mday ; 6
|
||||
uword Month ; 8
|
||||
uword Year ; 10
|
||||
uword Wday ; 12
|
||||
}
|
||||
|
||||
struct Hook { ; total size: 20
|
||||
^^exec.MinNode Succ ; 0
|
||||
^^exec.MinNode Pred ; 4
|
||||
pointer Entry ; 8
|
||||
pointer SubEntry ; 12
|
||||
pointer Data ; 16
|
||||
}
|
||||
|
||||
struct TagItem { ; total size: 8
|
||||
long Tag ; 0
|
||||
long Data ; 4
|
||||
}
|
||||
|
||||
; ---- constants ----
|
||||
const ubyte UTILITY_NAME_I = $0001
|
||||
const uword ANO_NameSpace = $0fa0
|
||||
const uword ANO_UserSpace = $0fa1
|
||||
const uword ANO_Priority = $0fa2
|
||||
const uword ANO_Flags = $0fa3
|
||||
const ubyte NSB_NODUPS = 0
|
||||
const ubyte NSF_NODUPS = $0001
|
||||
const ubyte NSB_CASE = 1
|
||||
const ubyte NSF_CASE = $0002
|
||||
const ubyte UTILITY_PACK_I = $0001
|
||||
const ubyte PSTB_SIGNED = 31
|
||||
const long PSTF_SIGNED = $80000000
|
||||
const ubyte PSTB_UNPACK = 30
|
||||
const long PSTF_UNPACK = $40000000
|
||||
const ubyte PSTB_PACK = 29
|
||||
const long PSTF_PACK = $20000000
|
||||
const ubyte PSTB_EXISTS = 26
|
||||
const long PSTF_EXISTS = $04000000
|
||||
const ubyte TAG_DONE = $0000
|
||||
const ubyte TAG_END = $0000
|
||||
const ubyte TAG_IGNORE = $0001
|
||||
const ubyte TAG_MORE = $0002
|
||||
const ubyte TAG_SKIP = $0003
|
||||
const long TAG_USER = $80000000
|
||||
const ubyte TAGFILTER_AND = $0000
|
||||
const ubyte TAGFILTER_NOT = $0001
|
||||
const ubyte MAP_REMOVE_NOT_FOUND = $0000
|
||||
const ubyte MAP_KEEP_NOT_FOUND = $0001
|
||||
}
|
||||
;; End of auto-generated utility_lib.sfd
|
||||
@@ -199,7 +199,7 @@ private fun compileMain(args: Array<String>): Boolean {
|
||||
System.err.println("Invalid -varsaddress value: $varsAddressStr")
|
||||
return false
|
||||
}
|
||||
val maxCliAddress = if(compilationTarget in setOf(Amiga500Target.NAME, Qemu68kTarget.NAME, VMTarget.NAME)) 0xFFFFFFFFu else 0xFFFFu
|
||||
val maxCliAddress = if(compilationTarget in setOf(Amiga500Target.NAME, Amiga1200Target.NAME, Qemu68kTarget.NAME, VMTarget.NAME)) 0xFFFFFFFFu else 0xFFFFu
|
||||
if(varsAddress!=null && varsAddress > maxCliAddress) {
|
||||
System.err.println("vars address must be valid integer 0..${maxCliAddress.toHex()}")
|
||||
return false
|
||||
@@ -214,7 +214,7 @@ private fun compileMain(args: Array<String>): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
if(compilationTarget in setOf(Amiga500Target.NAME, Qemu68kTarget.NAME)) {
|
||||
if(compilationTarget in setOf(Amiga500Target.NAME, Amiga1200Target.NAME, Qemu68kTarget.NAME)) {
|
||||
if(varsGolden || varsHighBank!=null || varsAddress!=null) {
|
||||
System.err.println("The -varsgolden/-varshigh/-varsaddress options are not available on the m68k target")
|
||||
return false
|
||||
|
||||
@@ -775,6 +775,7 @@ private fun createAssemblyAndAssemble(program: PtProgram,
|
||||
}
|
||||
compilerOptions.compTarget.name == Qemu68kTarget.NAME -> prog8.codegen.m68k.M68kCodeGenerator(retainSSAforIR)
|
||||
compilerOptions.compTarget.name == Amiga500Target.NAME -> prog8.codegen.m68k.M68kCodeGenerator(retainSSAforIR)
|
||||
compilerOptions.compTarget.name == Amiga1200Target.NAME -> prog8.codegen.m68k.M68kCodeGenerator(retainSSAforIR)
|
||||
compilerOptions.compTarget.name == VMTarget.NAME -> VmCodeGen(retainSSAforIR, irCallIds)
|
||||
else -> throw NotImplementedError("no code generator for cpu ${compilerOptions.compTarget.cpu}")
|
||||
}
|
||||
|
||||
@@ -5,10 +5,7 @@ import prog8.ast.expressions.*
|
||||
import prog8.ast.statements.*
|
||||
import prog8.ast.walk.IAstVisitor
|
||||
import prog8.code.core.*
|
||||
import prog8.code.target.Amiga500Target
|
||||
import prog8.code.target.C128Target
|
||||
import prog8.code.target.Cx16Target
|
||||
import prog8.code.target.VMTarget
|
||||
import prog8.code.target.*
|
||||
import prog8.compiler.builtinFunctionReturnTypes
|
||||
import java.io.CharConversionException
|
||||
import java.io.File
|
||||
@@ -1496,8 +1493,8 @@ internal class AstChecker(private val program: Program,
|
||||
}
|
||||
if(directive.args.any { it.string=="verafxmuls" } && options.compTarget.name != Cx16Target.NAME)
|
||||
err("verafx option is only valid on cx16 target")
|
||||
if(directive.args.any { it.string=="amiga_chipram" } && options.compTarget.name != Amiga500Target.NAME)
|
||||
err("amiga_chipram option is only valid on amiga500 target")
|
||||
if(directive.args.any { it.string=="amiga_chipram" } && options.compTarget.name != Amiga500Target.NAME && options.compTarget.name != Amiga1200Target.NAME)
|
||||
err("amiga_chipram option is only valid on amiga targets")
|
||||
}
|
||||
"%encoding" -> {
|
||||
if(directive.parent !is Module)
|
||||
|
||||
@@ -56,8 +56,9 @@ internal class M68kAstChecker(private val errors: IErrorReporter, private val ta
|
||||
}
|
||||
"%output" -> {
|
||||
val arg = directive.args.singleOrNull()?.string?.uppercase()
|
||||
if (arg != null && arg != "RAW" && arg != "ELF") {
|
||||
errors.err("output types other than 'raw' and 'elf' are not available on the m68k target", directive.position)
|
||||
val allowed = target.defaultOutputType.name
|
||||
if (arg != null && arg != allowed) {
|
||||
errors.err("output type '$arg' is not available on the ${target.name} target; only '${allowed.lowercase()}' is (which is also the default)", directive.position)
|
||||
}
|
||||
}
|
||||
"%option" -> {
|
||||
|
||||
@@ -5,6 +5,7 @@ import io.kotest.engine.spec.tempdir
|
||||
import io.kotest.matchers.shouldBe
|
||||
import io.kotest.matchers.shouldNotBe
|
||||
import io.kotest.matchers.string.shouldContain
|
||||
import prog8.code.target.Amiga1200Target
|
||||
import prog8.code.target.Amiga500Target
|
||||
import prog8.code.target.C64Target
|
||||
import prog8.code.target.Qemu68kTarget
|
||||
@@ -136,7 +137,7 @@ main {
|
||||
val errors = ErrorReporterForTests(keepMessagesAfterReporting = true)
|
||||
compileText(C64Target(), optimize = false, src, outputDir, writeAssembly = false, errors = errors) shouldBe null
|
||||
errors.errors.size shouldBe 1
|
||||
errors.errors[0] shouldContain "amiga_chipram option is only valid on amiga500 target"
|
||||
errors.errors[0] shouldContain "amiga_chipram option is only valid on amiga targets"
|
||||
}
|
||||
|
||||
test("amiga_chipram option on qemu68k target is rejected") {
|
||||
@@ -158,6 +159,33 @@ main {
|
||||
val errors = ErrorReporterForTests(keepMessagesAfterReporting = true)
|
||||
compileText(Qemu68kTarget(), optimize = false, src, outputDir, writeAssembly = false, errors = errors) shouldBe null
|
||||
errors.errors.size shouldBe 1
|
||||
errors.errors[0] shouldContain "amiga_chipram option is only valid on amiga500 target"
|
||||
errors.errors[0] shouldContain "amiga_chipram option is only valid on amiga targets"
|
||||
}
|
||||
|
||||
test("amiga_chipram option on amiga1200 target is accepted") {
|
||||
val src = """
|
||||
chipper {
|
||||
%option amiga_chipram
|
||||
|
||||
ubyte @shared init_var = 42
|
||||
ubyte @shared uninit_var
|
||||
long @shared slab_ptr = memory("chiper_slab", 16, 4)
|
||||
|
||||
sub chipram_sub() {
|
||||
init_var++
|
||||
}
|
||||
}
|
||||
|
||||
main {
|
||||
sub start() {
|
||||
chipper.chipram_sub()
|
||||
}
|
||||
}
|
||||
"""
|
||||
val result = compileText(Amiga1200Target(), optimize = false, src, outputDir, writeAssembly = false)
|
||||
result shouldNotBe null
|
||||
val blocks = result!!.compilerAst.allBlocks.toList()
|
||||
val chipramBlock = blocks.singleOrNull { "amiga_chipram" in it.options() }
|
||||
chipramBlock shouldNotBe null
|
||||
}
|
||||
})
|
||||
@@ -24,6 +24,7 @@ symboldumps:
|
||||
prog8c -daemon -target virtual import-all-virtual.p8 -dumpsymbols > source/_static/symboldumps/skeletons-virtual.txt
|
||||
prog8c -daemon -target qemu68k import-all-qemu68k.p8 -dumpsymbols > source/_static/symboldumps/skeletons-qemu68k.txt
|
||||
prog8c -daemon -target amiga500 import-all-amiga500.p8 -dumpsymbols > source/_static/symboldumps/skeletons-amiga500.txt
|
||||
prog8c -daemon -target amiga1200 import-all-amiga1200.p8 -dumpsymbols > source/_static/symboldumps/skeletons-amiga1200.txt
|
||||
|
||||
|
||||
# Catch-all target: route all unknown targets to Sphinx using the new
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
; all library modules for the amiga1200 compiler target
|
||||
|
||||
%import arexx
|
||||
%import buffers
|
||||
%import blitter
|
||||
%import copper
|
||||
%import iffparse
|
||||
%import icon
|
||||
%import compression
|
||||
%import coroutines
|
||||
%import custom
|
||||
%import conv
|
||||
%import floats
|
||||
%import lists
|
||||
%import lineclip
|
||||
%import math
|
||||
%import prog8_lib
|
||||
%import sorting
|
||||
%import strings
|
||||
%import syslib
|
||||
%import textio
|
||||
%import wavfile
|
||||
%import exec
|
||||
%import dos
|
||||
%import graphics
|
||||
%import intuition
|
||||
%import utility
|
||||
%import timer
|
||||
%import audio
|
||||
%import ptplayer
|
||||
File diff suppressed because it is too large.
Load diff
@@ -4760,4 +4760,3 @@ wavfile {
|
||||
parse_header (^^ubyte wav_data) -> bool
|
||||
}
|
||||
|
||||
|
||||
@@ -996,4 +996,3 @@ wavfile {
|
||||
parse_header (^^ubyte wav_data) -> bool
|
||||
}
|
||||
|
||||
|
||||
@@ -1103,4 +1103,3 @@ wavfile {
|
||||
parse_header (^^ubyte wav_data) -> bool
|
||||
}
|
||||
|
||||
|
||||
@@ -1676,4 +1676,3 @@ wavfile {
|
||||
parse_header (^^ubyte wav_data) -> bool
|
||||
}
|
||||
|
||||
|
||||
@@ -941,4 +941,3 @@ wavfile {
|
||||
parse_header (^^ubyte wav_data) -> bool
|
||||
}
|
||||
|
||||
|
||||
@@ -502,4 +502,3 @@ wavfile {
|
||||
parse_header (^^ubyte wav_data) -> bool
|
||||
}
|
||||
|
||||
|
||||
@@ -721,4 +721,3 @@ wavfile {
|
||||
parse_header (^^ubyte wav_data) -> bool
|
||||
}
|
||||
|
||||
|
||||
@@ -17,8 +17,9 @@ 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
|
||||
- 'pet32': the Commodore PET 4032
|
||||
- 'qemu68k': Qemu M68k simulator (experimental)
|
||||
- 'amiga500': Amiga 500 (experimental)
|
||||
- 'amiga1200': Amiga 1200 (experimental, 68020 CPU with optional FPU)
|
||||
- 'qemu68k': Qemu M68k simulator (experimental)
|
||||
- 'virtual': a builtin virtual machine (32-bit pointers, 16 MB memory)
|
||||
- custom targets via a separate configuration file (see :ref:`customizable_target`)
|
||||
|
||||
@@ -90,7 +91,7 @@ Pointer size
|
||||
The size of a pointer (memory address) depends on the target's CPU architecture:
|
||||
|
||||
- **6502-family targets** (c64, cx16, c128, pet32): **2 bytes** (16-bit address space, 64 KB)
|
||||
- **m68k targets** (amiga500, qemu68k): **4 bytes** (32-bit address space, 16 MB)
|
||||
- **m68k targets** (amiga500, amiga1200, qemu68k): **4 bytes** (32-bit address space, 16 MB)
|
||||
- **virtual target**: **4 bytes** (32-bit address space, 16 MB)
|
||||
|
||||
The ``pointer`` type keyword automatically takes the correct size for the target,
|
||||
|
||||
+80
-11
@@ -1,17 +1,86 @@
|
||||
%import textio
|
||||
%zeropage basicsafe
|
||||
|
||||
main {
|
||||
|
||||
struct Enemy {
|
||||
ubyte xpos, ypos
|
||||
uword health
|
||||
bool elite
|
||||
sub start() {
|
||||
uword @shared sharedvar = 42
|
||||
sharedvar = func(sharedvar + 99) + func(4444)
|
||||
}
|
||||
|
||||
sub start() {
|
||||
Enemy[4] enemies ; 4 Enemy instances in a contiguous block, initialized to zero
|
||||
enemies[2] = enemies[3]
|
||||
sys.memcopy(&enemies[3], &enemies[2], sizeof(Enemy))
|
||||
sub func(uword value) -> uword {
|
||||
value += 7
|
||||
return value*8
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
The above code for the amiga500 target currently compiles to:
|
||||
|
||||
|
||||
p8b_main.p8s_start:
|
||||
bsr run_global_inits
|
||||
; storeim.w #$2a,p8b_main.p8s_start.p8v_sharedvar
|
||||
move.w #42,p8b_main.p8s_start.p8v_sharedvar
|
||||
; loadm.w r1,p8b_main.p8s_start.p8v_sharedvar
|
||||
move.w p8b_main.p8s_start.p8v_sharedvar,p8_regfile+0
|
||||
; add.w r1,#$63
|
||||
add.w #99,p8_regfile+0
|
||||
; call p8b_main.p8s_func(p8v_value=r1.w):r2.w
|
||||
move.w p8_regfile+0,p8b_main.p8s_func.p8v_value
|
||||
bsr p8b_main.p8s_func
|
||||
move.w d0,p8_regfile+2
|
||||
; load.w r3,#$115c
|
||||
move.w #4444,p8_regfile+4
|
||||
; call p8b_main.p8s_func(p8v_value=r3.w):r4.w
|
||||
move.w p8_regfile+4,p8b_main.p8s_func.p8v_value
|
||||
bsr p8b_main.p8s_func
|
||||
move.w d0,p8_regfile+6
|
||||
; addr.w r2,r4
|
||||
add.w d0,p8_regfile+2
|
||||
; storem.w r2,p8b_main.p8s_start.p8v_sharedvar
|
||||
move.w p8_regfile+2,p8b_main.p8s_start.p8v_sharedvar
|
||||
; return
|
||||
rts
|
||||
; End of subroutine: p8b_main.p8s_start
|
||||
|
||||
p8b_main.p8s_func:
|
||||
; addim.w #7,p8b_main.p8s_func.p8v_value
|
||||
addq.w #7,p8b_main.p8s_func.p8v_value
|
||||
; loadm.w r5,p8b_main.p8s_func.p8v_value
|
||||
move.w p8b_main.p8s_func.p8v_value,p8_regfile+8
|
||||
; lsli.w r5,#3
|
||||
move.w p8_regfile+8,d0
|
||||
lsl.w #3,d0
|
||||
move.w d0,p8_regfile+8
|
||||
; returnr.w r5
|
||||
rts
|
||||
; End of subroutine: p8b_main.p8s_func
|
||||
|
||||
|
||||
|
||||
After the production register allocation, can we expect it to become something like:
|
||||
|
||||
p8b_main.p8s_start:
|
||||
bsr run_global_inits
|
||||
move.w #42,p8b_main.p8s_start.p8v_sharedvar
|
||||
move.w p8b_main.p8s_start.p8v_sharedvar,d0
|
||||
add.w #99,d0
|
||||
move.w d0,p8b_main.p8s_func.p8v_value
|
||||
bsr p8b_main.p8s_func
|
||||
move.w d0,d1 ; or maybe move.w d0,-(sp)
|
||||
move.w #4444,p8b_main.p8s_func.p8v_value
|
||||
bsr p8b_main.p8s_func
|
||||
add.w d0,d1
|
||||
move.w d1,p8b_main.p8s_start.p8v_sharedvar
|
||||
rts
|
||||
; End of subroutine: p8b_main.p8s_start
|
||||
|
||||
p8b_main.p8s_func:
|
||||
addq.w #7,p8b_main.p8s_func.p8v_value
|
||||
move.w p8b_main.p8s_func.p8v_value,d0
|
||||
lsl.w #3,d0
|
||||
rts ; directly return value that is already in d0
|
||||
; End of subroutine: p8b_main.p8s_func
|
||||
|
||||
|
||||
|
||||
*/
|
||||
Reference in new issue
Block a user