From f02ad1de792213da0631175a3f8220b5a7ced52f Mon Sep 17 00:00:00 2001 From: minjaesong Date: Fri, 17 Apr 2026 17:28:03 +0900 Subject: [PATCH] minor spec change for Taud --- .idea/cody_history.xml | 133 ++++++++++++++++++ .idea/runConfigurations/AppLoader.xml | 17 +++ .idea/runConfigurations/TerranBASIC.xml | 16 +++ .idea/runConfigurations/TsvmEmulator.xml | 16 +++ terranmon.txt | 4 +- .../torvald/tsvm/peripheral/AudioAdapter.kt | 8 +- 6 files changed, 188 insertions(+), 6 deletions(-) create mode 100644 .idea/cody_history.xml create mode 100644 .idea/runConfigurations/AppLoader.xml create mode 100644 .idea/runConfigurations/TerranBASIC.xml create mode 100644 .idea/runConfigurations/TsvmEmulator.xml diff --git a/.idea/cody_history.xml b/.idea/cody_history.xml new file mode 100644 index 0000000..dfd1d5e --- /dev/null +++ b/.idea/cody_history.xml @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + <usage> + <list> + <option value="chat" /> + <option value="edit" /> + </list> + </usage> + </llm> + </llm> + </chat> + <chat> + <internalId value="f4e7338b-57d3-44e0-b1d9-04aa2dfb4bae" /> + <llm> + <llm> + <model value="anthropic/claude-3-5-sonnet-20240620" /> + <provider value="Anthropic" /> + <title value="Claude 3.5 Sonnet" /> + <usage> + <list> + <option value="chat" /> + <option value="edit" /> + </list> + </usage> + </llm> + </llm> + </chat> + <chat> + <internalId value="26ac815b-5db9-488b-be0b-ab174fbc5646" /> + <llm> + <llm> + <model value="anthropic/claude-3-5-sonnet-20240620" /> + <provider value="Anthropic" /> + <title value="Claude 3.5 Sonnet" /> + <usage> + <list> + <option value="chat" /> + <option value="edit" /> + </list> + </usage> + </llm> + </llm> + </chat> + <chat> + <internalId value="8ab39b26-cdda-4256-878f-e0416e66bbea" /> + <llm> + <llm> + <model value="anthropic/claude-3-5-sonnet-20240620" /> + <provider value="Anthropic" /> + <title value="Claude 3.5 Sonnet" /> + <usage> + <list> + <option value="chat" /> + <option value="edit" /> + </list> + </usage> + </llm> + </llm> + </chat> + <chat> + <internalId value="f79a288a-adc5-4d45-a069-4bf024d90236" /> + <llm> + <llm> + <model value="anthropic/claude-3-5-sonnet-20240620" /> + <provider value="Anthropic" /> + <title value="Claude 3.5 Sonnet" /> + <usage> + <list> + <option value="chat" /> + <option value="edit" /> + </list> + </usage> + </llm> + </llm> + </chat> + <chat> + <internalId value="20bc02fd-c6b5-4590-a00b-b7012a630ef4" /> + <llm> + <llm> + <model value="anthropic/claude-3-5-sonnet-20240620" /> + <provider value="Anthropic" /> + <title value="Claude 3.5 Sonnet" /> + <usage> + <list> + <option value="chat" /> + <option value="edit" /> + </list> + </usage> + </llm> + </llm> + </chat> + </list> + </chats> + <defaultLlm> + <llm> + <model value="anthropic/claude-3-5-sonnet-20240620" /> + <provider value="Anthropic" /> + <tags> + <list> + <option value="gateway" /> + <option value="accuracy" /> + <option value="recommended" /> + <option value="free" /> + </list> + </tags> + <title value="Claude 3.5 Sonnet" /> + <usage> + <list> + <option value="chat" /> + <option value="edit" /> + </list> + </usage> + </llm> + </defaultLlm> + </AccountData> + </list> + </accountData> + </component> +</project> \ No newline at end of file diff --git a/.idea/runConfigurations/AppLoader.xml b/.idea/runConfigurations/AppLoader.xml new file mode 100644 index 0000000..6389b7f --- /dev/null +++ b/.idea/runConfigurations/AppLoader.xml @@ -0,0 +1,17 @@ +<component name="ProjectRunConfigurationManager"> + <configuration default="false" name="AppLoader" type="Application" factoryName="Application" nameIsGenerated="true"> + <option name="ALTERNATIVE_JRE_PATH" value="21" /> + <option name="MAIN_CLASS_NAME" value="net.torvald.tsvm.AppLoader" /> + <module name="tsvm_executable" /> + <option name="VM_PARAMETERS" value="-ea --upgrade-module-path=lib/compiler-23.1.10.jar:lib/compiler-management-23.1.10.jar:lib/truffle-compiler-23.1.10.jar:lib/truffle-api-23.1.10.jar:lib/truffle-runtime-23.1.10.jar:lib/polyglot-23.1.10.jar:lib/collections-23.1.10.jar:lib/word-23.1.10.jar:lib/nativeimage-23.1.10.jar:lib/jniutils-23.1.10.jar -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI --add-exports=java.base/jdk.internal.misc=jdk.internal.vm.compiler" /> + <extension name="coverage"> + <pattern> + <option name="PATTERN" value="net.torvald.tsvm.*" /> + <option name="ENABLED" value="true" /> + </pattern> + </extension> + <method v="2"> + <option name="Make" enabled="true" /> + </method> + </configuration> +</component> \ No newline at end of file diff --git a/.idea/runConfigurations/TerranBASIC.xml b/.idea/runConfigurations/TerranBASIC.xml new file mode 100644 index 0000000..a21d936 --- /dev/null +++ b/.idea/runConfigurations/TerranBASIC.xml @@ -0,0 +1,16 @@ +<component name="ProjectRunConfigurationManager"> + <configuration default="false" name="TerranBASIC" type="Application" factoryName="Application" nameIsGenerated="true"> + <option name="MAIN_CLASS_NAME" value="net.torvald.tsvm.TerranBASIC" /> + <module name="TerranBASICexecutable" /> + <option name="VM_PARAMETERS" value="--upgrade-module-path=lib/compiler-23.1.10.jar:lib/compiler-management-23.1.10.jar:lib/truffle-compiler-23.1.10.jar:lib/truffle-api-23.1.10.jar:lib/truffle-runtime-23.1.10.jar:lib/polyglot-23.1.10.jar:lib/collections-23.1.10.jar:lib/word-23.1.10.jar:lib/nativeimage-23.1.10.jar:lib/jniutils-23.1.10.jar -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI --add-exports=java.base/jdk.internal.misc=jdk.internal.vm.compiler" /> + <extension name="coverage"> + <pattern> + <option name="PATTERN" value="net.torvald.tsvm.*" /> + <option name="ENABLED" value="true" /> + </pattern> + </extension> + <method v="2"> + <option name="Make" enabled="true" /> + </method> + </configuration> +</component> \ No newline at end of file diff --git a/.idea/runConfigurations/TsvmEmulator.xml b/.idea/runConfigurations/TsvmEmulator.xml new file mode 100644 index 0000000..629868f --- /dev/null +++ b/.idea/runConfigurations/TsvmEmulator.xml @@ -0,0 +1,16 @@ +<component name="ProjectRunConfigurationManager"> + <configuration default="false" name="TsvmEmulator" type="Application" factoryName="Application" nameIsGenerated="true"> + <option name="MAIN_CLASS_NAME" value="net.torvald.tsvm.TsvmEmulator" /> + <module name="tsvm_executable" /> + <option name="VM_PARAMETERS" value="-ea --upgrade-module-path=lib/compiler-23.1.10.jar:lib/compiler-management-23.1.10.jar:lib/truffle-compiler-23.1.10.jar:lib/truffle-api-23.1.10.jar:lib/truffle-runtime-23.1.10.jar:lib/polyglot-23.1.10.jar:lib/collections-23.1.10.jar:lib/word-23.1.10.jar:lib/nativeimage-23.1.10.jar:lib/jniutils-23.1.10.jar -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI --add-exports=java.base/jdk.internal.misc=jdk.internal.vm.compiler" /> + <extension name="coverage"> + <pattern> + <option name="PATTERN" value="net.torvald.tsvm.*" /> + <option name="ENABLED" value="true" /> + </pattern> + </extension> + <method v="2"> + <option name="Make" enabled="true" /> + </method> + </configuration> +</component> \ No newline at end of file diff --git a/terranmon.txt b/terranmon.txt index 3967d80..a14e2a5 100644 --- a/terranmon.txt +++ b/terranmon.txt @@ -2002,8 +2002,8 @@ Instrument bin: Registry for 256 instruments, formatted as: Uint16 Loop Start (can be smaller than Play Start) Uint16 Loop End Bit32 Flags - 0b h000 00pp - h: sample pointer high bit + 0b hhhh 00pp + h: sample pointer high bit (only the lowest bit is used, keep upper 3 bits unset) pp: loop mode. 0-no loop, 1-loop, 2-backandforth, 3-oneshot (ignores note length unless overridden by other notes) Bit16x24 Volume envelopes Byte 1: Volume diff --git a/tsvm_core/src/net/torvald/tsvm/peripheral/AudioAdapter.kt b/tsvm_core/src/net/torvald/tsvm/peripheral/AudioAdapter.kt index 0b88296..95ef4bb 100644 --- a/tsvm_core/src/net/torvald/tsvm/peripheral/AudioAdapter.kt +++ b/tsvm_core/src/net/torvald/tsvm/peripheral/AudioAdapter.kt @@ -1465,7 +1465,7 @@ class AudioAdapter(val vm: VM) : PeriBase(VM.PERITYPE_SOUND) { data class TaudInstVolEnv(var volume: Int, var offset: ThreeFiveMiniUfloat) data class TaudInst( - var samplePtr: Int, // 17-bit number + var samplePtr: Int, // 20-bit number var sampleLength: Int, var samplingRate: Int, var samplePlayStart: Int, @@ -1496,8 +1496,8 @@ class AudioAdapter(val vm: VM) : PeriBase(VM.PERITYPE_SOUND) { 10 -> sampleLoopEnd.toByte() 11 -> sampleLoopEnd.ushr(8).toByte() - 12 -> (samplePtr.ushr(16).and(1).shl(7) or loopMode.and(3)).toByte() - 13,14,15 -> -1 + 12 -> (samplePtr.ushr(16).and(15).shl(4) or loopMode.and(3)).toByte() + 13,14,15 -> 0 in 16..63 step 2 -> envelopes[(offset - 16) / 2].volume.toByte() in 17..63 step 2 -> envelopes[(offset - 17) / 2].offset.index.toByte() else -> throw InternalError("Bad offset $offset") @@ -1523,7 +1523,7 @@ class AudioAdapter(val vm: VM) : PeriBase(VM.PERITYPE_SOUND) { 11 -> { sampleLoopEnd = (sampleLoopEnd and 0x00ff) or (byte shl 8) } 12 -> { - samplePtr = if (byte and 0b1000_0000 != 0) samplePtr or 0x10000 + samplePtr = if (byte and 0b1111_0000 != 0) samplePtr or ((byte ushr 4) shl 16) else samplePtr and 0x0ffff loopMode = byte and 3 }