From d01f307184268d2dc7a0da28dda296fda08bc4e6 Mon Sep 17 00:00:00 2001 From: Joerg Deckert Date: Mon, 28 Apr 2014 20:18:43 +0200 Subject: [PATCH] Administra: also build plexus administra binary from unified source --- flash/administra/admflash.spin | 247 +++++++++- lib/adm-sid.spin | 835 ++++++++++++++++++++------------- lib/glob-con.spin | 20 +- make.sh | 2 + 4 files changed, 748 insertions(+), 356 deletions(-) diff --git a/flash/administra/admflash.spin b/flash/administra/admflash.spin index a7e9831..2dd2f19 100644 --- a/flash/administra/admflash.spin +++ b/flash/administra/admflash.spin @@ -83,6 +83,7 @@ COG's : MANAGMENT 1 COG DCF receiver 1 COG Defines : __ADM_FAT enable FAT engine (sd card handling) + __ADM_FAT_EXT enable FAT extension for PLEXUS __ADM_HSS enable HSS synthesizer __ADM_HSS_PLAY enable HSS player (only with __ADM_HSS) __ADM_WAV enable WAV player @@ -162,20 +163,21 @@ Notizen : CON ''default defines (please anable to compile from GUI) -#define __ADM_FAT +'#define __ADM_FAT '#define __ADM_HSS '#define __ADM_HSS_PLAY '#define __ADM_WAV -#define __ADM_RTC +'#define __ADM_RTC '#define __ADM_COM ''other defines +'#define __ADM_FAT_EXT '#define __ADM_LAN -#define __ADM_SID +'#define __ADM_SID '#define __ADM_AYS -#define __ADM_PLX -#define __ADM_DCF -#define __ADM_BLT +'#define __ADM_PLX +'#define __ADM_DCF +'#define __ADM_BLT _CLKMODE = XTAL1 + PLL16X _XINFREQ = 5_000_000 @@ -349,7 +351,7 @@ OBJ num : "glob-numbers" 'Number Engine #endif #ifdef __ADM_PLX - com : "adm-plx" 'PlexBux + plx : "adm-plx" 'PlexBux #endif #ifdef __ADM_DCF dcf : "adm-dcf" 'DCF-77 @@ -420,8 +422,19 @@ PUB main | cmd,err 'chip: kommandointerpret gc#a_sdDmClr: sd_dmclr 'dir-marker löschen gc#a_sdDmPut: sd_dmput 'dir-marker status setzen gc#a_sdEOF: sd_eof 'eof abfragen +#ifdef __ADM_FAT_EXT + gc#a_sdPos: sd_pos 'Zeiger in Datei abfragen + gc#a_sdCopy: sd_copy 'Datei kopieren + gc#a_sdDirSize: sd_dirsize 'Dateigrösse ->ist quatsch +#endif '__ADM_FAT_EXT #endif '__ADM_FAT +' ---------------------------------------------- Bluetooth-FUNKTIONEN +#ifdef __ADM_BLT + gc#a_bltCommand_On: blt_setCommandMode + gc#a_bltCommand_Off: blt_setNormalMode +#endif '__ADM_BLT + ' ---------------------------------------------- COM-FUNKTIONEN #ifdef __ADM_COM gc#a_comInit: com_init @@ -429,12 +442,6 @@ PUB main | cmd,err 'chip: kommandointerpret gc#a_comRx: com_rx #endif '__ADM_COM -' ---------------------------------------------- Bluetooth-FUNKTIONEN -#ifdef __ADM_BLT - gc#a_bltCommand_On: blt_setCommandMode - gc#a_bltCommand_Off: blt_setNormalMode -#endif '__ADM_BLT - ' ---------------------------------------------- RTC-FUNKTIONEN #ifdef __ADM_RTC gc#a_rtcTest: rtc_test 'Test if RTC Chip is available @@ -524,6 +531,25 @@ PUB main | cmd,err 'chip: kommandointerpret gc#a_sfxStop: sfx_stop #endif '__ADM_HSS +' ---------------------------------------------- PLX-Funktionen +#ifdef __ADM_PLX + gc#a_plxRun: plx.run 'plx-bus freigeben + gc#a_plxHalt: plx.halt 'plx-bus anfordern + gc#a_plxIn: plx_in 'port einlesen + gc#a_plxOut: plx_out 'port ausgeben + gc#a_plxCh: plx_ch 'ad-wandler auslesen + gc#a_plxGetReg: plx_getReg 'poller-register lesen + gc#a_plxSetReg: plx_setReg 'poller-register setzen + gc#a_plxStart: plx.start 'i2c-dialog starten + gc#a_plxStop: plx.stop 'i2c-dialog beenden + gc#a_plxWrite: plx_write 'i2c byte senden + gc#a_plxRead: plx_read 'i2c byte empfangen + gc#a_plxPing: plx_ping 'abfrage ob device vorhanden ist + gc#a_plxSetAdr: plx_setAddr 'adressen adda/ports für poller setzen +' ---------------------------------------------- GAMEDEVICES + gc#a_Joy: joy_get 'Joystick abfragen (1 x 8bit Port) +#endif '__ADM_PLX + ' ---------------------------------------------- WAV-FUNKTIONEN #ifdef __ADM_WAV gc#a_sdwStart: sdw_start 'spielt wav-datei direkt von sd-card ab @@ -582,6 +608,9 @@ PUB main | cmd,err 'chip: kommandointerpret gc#a_s2_enableSynchronization: sid2.enableSynchronization(bus_getchar,bus_getchar,bus_getchar) ' ---------------------------------------------- SID Zusatzfunktionen + gc#a_s2_resetRegisters: sid2.resetRegisters + gc#a_s1_resetRegisters: sid1.resetRegisters + gc#a_s_beep: sid_beep gc#a_s_dmpreg: sid_dmpreg 'soundinformationen senden #endif '__ADM_SID @@ -658,6 +687,11 @@ PRI init_chip | err,i,j 'chip: initialisierung d com.start(gc#SER_RX,gc#SER_TX,0,com_baud) 'start the default serial interface #endif '__ADM_COM +#ifdef __ADM_PLX + plx.init 'defaultwerte setzen, poller-cog starten + plx.run 'plexbus freigeben (poller läuft) +#endif '__ADM_PLX + #ifdef __ADM_LAN 'LAN lan_started := false 'LAN noch nicht gestartet @@ -980,6 +1014,92 @@ VAR long dmarker[6] 'speicher für dir-marker +#ifdef __ADM_FAT_EXT + + byte copy_buffer[4002] 'Kopier-Puffer + +PRI sddmact(markernr) + + ifnot dmarker[markernr] == TRUE + sdfat.setDirCluster(dmarker[markernr]) + +PRI sd_dirsize 'Anzahl Einträge im aktuellen Verzeichnis +' sub_putlong(\sdfat.listSize) + +PRI sd_pos + sub_putlong(sdfat.getCharacterPosition) + +PRI sd_copy|laenge,schleife,rest,m,n,i,cpm,psm,e + cpm:=sub_getlong 'verzeichnismarker lesen (quelle) + psm:=sub_getlong 'verzeichnismarker lesen (ziel) + sub_getstr 'dateiname lesen @tbuff + + outa[LED_OPEN]~~ 'LED an + + dmarker[2] := cpm + sddmact(2) + + \sdfat.openFile(@tbuf, "R") + laenge:=\sdfat.listSize + \sdfat.closeFile + + schleife:=laenge/4000 + rest:=laenge-(schleife*4000) + + m:=0 + n:=0 + if schleife>0 'zu kopierende Datei größer 4001 Bytes?, ansonsten gleich zu Rest springen + repeat schleife 'Blöcke zu je 4001 Byte kopieren + dmarker[2] := cpm + sddmact(2) + + \sdfat.openFile(@tbuf2, "R") + \sdfat.setCharacterPosition(m) + \sdfat.readData(@copy_buffer, 4001) + + m:=\sdfat.getCharacterPosition-1 + \sdfat.closeFile + dmarker[2] := psm + sddmact(2) + + \sdfat.openFile(@tbuf, "W") + \sdfat.setCharacterPosition(m) + \sdfat.writeData(@copy_buffer, 4001) + + n:=\sdfat.getCharacterPosition + \sdfat.closeFile + if bus_getchar==1 + \sdfat.closeFile + sub_putlong(n) + return + sub_putlong(n) 'Kopierfortschritt zu Regnatix senden + + + '************und den Rest kopieren******************** + dmarker[2] := cpm + sddmact(2) + + \sdfat.openFile(@tbuf2, "R") + \sdfat.setCharacterPosition(m) + \sdfat.readData(@copy_buffer, rest) + +' m:=\sdfat.getCharacterPosition + \sdfat.closeFile + dmarker[2] := psm + sddmact(2) + + \sdfat.openFile(@tbuf, "W") + \sdfat.setCharacterPosition(n) + \sdfat.writeData(@copy_buffer, rest) + + 'n:=\sdfat.getCharacterPosition + \sdfat.closeFile + sub_putlong(-1) + + outa[LED_OPEN]~ 'LED aus + +#endif '__ADM_FAT_EXT + PRI sd_mount(mode) | err 'sdcard: sd-card mounten frida ''funktionsgruppe : sdcard ''funktion : eingelegtes volume mounten @@ -1373,7 +1493,6 @@ PRI sd_dmact|markernr 'sdcard: einen dir-marke else bus_putchar(sdfat#err_noError) - PRI sd_dmset|markernr 'sdcard: einen dir-marker setzen ''funktionsgruppe : sdcard ''funktion : ein ausgewählter dir-marker mit dem aktuellen verzeichnis setzen @@ -1845,6 +1964,10 @@ CON ''------------------------------------------------- SIDCog: DMP-Player-Funkt #ifdef __ADM_SID +DAT 'dummyroutine für getcogs + + noteTable word 16350, 17320, 18350, 19450, 20600, 21830, 23120, 24500, 25960, 27500, 29140, 30870 + VAR long sidreg1 'adresse register der sidcog 1 @@ -1973,6 +2096,33 @@ PRI sid_dmpreg 'sid: dmpregister senden bus_putchar(byte[@sidbuffer+24]) 'volume +PRI sid_beep | n + sid1.setVolume($0F) + sid2.setVolume($0F) + n := bus_getchar + if n==0 'normaler beep + sid1.play(0,7500,16,0,0,15,5) + sid2.play(0,7500,16,0,0,15,5) + waitcnt(cnt + 10_000_000) + sid1.noteOff(0) + sid2.noteOff(0) + sid1.play(0,11500,16,0,0,15,5) + sid2.play(0,11500,16,0,0,15,5) + waitcnt(cnt + 10_000_000) + sid1.noteOff(0) + sid2.noteOff(0) + else 'beep mit bestimmter tonhoehe + sid1.play(0,note2freq(n),16,0,0,15,5) + sid2.play(0,note2freq(n),16,0,0,15,5) + waitcnt(cnt + 1_000_000) + sid1.noteOff(0) + sid2.noteOff(0) + +PRI note2freq(note) | octave + octave := note/12 + note -= octave*12 + return (noteTable[note]>>(8-octave)) + CON ''------------------------------------------------- End of SID FUNCTIONS #endif ' __ADM_SID @@ -2240,6 +2390,75 @@ CON ''------------------------------------------------- End of DCF77 FUNCTIONS #endif ' __ADM_DCF +CON ''------------------------------------------------- PLX-Funktionen + +#ifdef __ADM_PLX + +PRI plx_in | addr 'port einlesen + + addr := bus_getchar + bus_putchar(plx.in(addr)) + +PRI plx_out | addr, data 'port ausgeben + + addr := bus_getchar + data := bus_getchar + plx.halt + plx.out(addr,data) + plx.run + +PRI plx_ch | addr, chan 'ad-wandler auslesen + + addr := bus_getchar + chan := bus_getchar + plx.ad_ch(addr,chan) + +PRI plx_getReg | reg 'poller-register lesen + + reg := bus_getchar + bus_putchar(plx.getreg(reg)) + +PRI plx_setReg | reg, data 'poller-register setzen + + reg := bus_getchar + data := bus_getchar + plx.setreg(reg,data) + +PRI plx_write | data, ack 'i2c byte senden + + data := bus_getchar + ack:=plx.write(data) + bus_putchar(ack) + +PRI plx_read | ack, data 'i2c byte empfangen + + ack := bus_getchar 'ack-bit + data:=plx.read(ack) + bus_putchar(data) + +PRI plx_ping | addr 'abfrage ob device vorhanden ist + + addr := bus_getchar + bus_putchar(plx.ping(addr)) + +PRI plx_setAddr | adda, ports 'adressen adda/ports für poller setzen + + adda := bus_getchar 'address adda + ports := bus_getchar 'address ports + plx.setadr(adda,ports) + +PRI joy_get | reg 'Joystick abfragen (1 x 8bit Port) + + reg:=bus_getchar '0-6 + if reg>3 and reg<7 + bus_putchar(!plx.getreg(reg)) + else + bus_putchar(plx.getreg(reg)) + +CON ''------------------------------------------------- End of DCF77 FUNCTIONS + +#endif '__ADM_PLX + CON ''------------------------------------------------- LAN-FUNKTIONEN #ifdef __ADM_LAN diff --git a/lib/adm-sid.spin b/lib/adm-sid.spin index 1372c4d..82ce735 100644 --- a/lib/adm-sid.spin +++ b/lib/adm-sid.spin @@ -1,6 +1,6 @@ -{{ +{ ┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ -│ SIDcog - SID/MOS8580 emulator V0.80 (C) 2010-02 Johannes Ahlebrand │ +│ SIDcog - SID/MOS8580 emulator v1.3 (C) 2012 Johannes Ahlebrand │ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ │ TERMS OF USE: Parallax Object Exchange License │ ├──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤ @@ -16,116 +16,315 @@ │COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, │ │ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. │ └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ -}} -{ - -11-07-2010-dr235 - änderung in setWaveform - -} -CON - PAL = 985248.0 - NTSC = 1022727.0 - MAXF = 1031000.0 - TRIANGLE = 16 - SAW = 32 - SQUARE = 64 - NOISE = 128 +Revision History +v0.7 (December 2009) - Initial release + +v0.8 (February 2010) - Added support for "combined waveforms" + - Optimized code + - Fixed bugs + +v1.0 (May 2011) - First OBEX release + - Added convenient API methods + +v1.2 (August 2011) - Increased ADSR accuracy (Almost perfect now; The famous ADSR bug isn't implemented though) + - Increased Noise accuracy (As close as we will get without decreasing the sample rate of SIDcog) + - Fixed a bug when no waveform was selected + - Decreased the "max cutoff frequency" a bit to fix aliasing issues + - Made some small optimizations + +v1.3 (April 2012) - Fixed a bug when noise + any other waveform was selected at the same time + - Calibrated the cutoff frequency to better match a real 8580 + - Cycle optimized code to "make room" for the point below  + - Increased resonance accuracy (replaced "4 step logaritmic lookup table" with "16 step bit linear multiplication") + - Increased ADSR accuracy a little bit more (the ADSR bug is still not implemented) + +} +CON PAL = 985248.0, NTSC = 1022727.0, MAXF = 1031000.0, TRIANGLE = 16, SAW = 32, SQUARE = 64, NOISE = 128 +#24, HBEAT C64_CLOCK_FREQ = PAL - ' ___ - CUTOFF_LIMIT = 1300' │ - LP_MAX_CUTOFF = 10' │ - BP_MAX_CUTOFF = 11' │ Don't alter these unless you know what you are doing. ;) - FILTER_OFFSET = 27' │ - DECAY_DIVIDE_REF = $6C6C6C6C' │ - NOISE_ADD = $979D21B5' │ - NOISE_ROTATE = 28' ___│ - -PUB start(right,left) + ' ___ + RESONANCE_OFFSET = 6' │ + RESONANCE_FACTOR = 5' │ + CUTOFF_LIMIT = 1100' │ + LP_MAX_CUTOFF = 11' │ Don't alter these constants unless you know what you are doing! + BP_MAX_CUTOFF = 10' │ + FILTER_OFFSET = 12' │ + START_LOG_LEVEL = $5d5d5d5d' │ + DECAY_DIVIDE_REF = $6C6C6C6C' │ + ENV_CAL_FACTOR = 545014038.181330' │ ENV_CAL_FACTOR = (MaxUint32 / SIDcogSampleFreq) / (1 / SidADSR_1secRomValue) + NOISE_ADD = %1010_1010_101<<23'│ ENV_CAL_FACTOR = (4294967295 / 30789 ) / (1 / 3907 ) = 545014038,181330 + NOISE_TAP = %100001 << 8' ___│ +LED_OPEN = HBEAT +PUB start(right, left) +' ┌──────────────────────────────────────────────────────────────┐ +' │ Starts SIDcog in a single cog │ +' ├──────────────────────────────────────────────────────────────┤ +' │ Returns a pointer to the first SID register in hub memory │ +' │ on success; otherwise returns 0. │ +' │ │ +' │ right - The pin to output the right channel to. 0 = Not used │ +' │ │ +' │ left - The pin to output the left channel to. 0 = Not used │ +' └──────────────────────────────────────────────────────────────┘ arg1 := $18000000 | left arg2 := $18000000 | right r1 := ((1<>3 +PUB setCutoff(cutoffValue) +' ┌──────────────────────────────────────────────────────────────┐ +' │ Sets the cutoff frequency of the filter │ +' ├──────────────────────────────────────────────────────────────┤ +' │ cutoffValue - The 12 bit cutoff frequency value to use. │ +' └──────────────────────────────────────────────────────────────┘ + byte[@Filter1] := cutoffValue&$07 + byte[@Filter2] := (cutoffValue&$07F8)>>3 -PUB setFilterMask(ch1,ch2,ch3) +PUB setFilterMask(ch1, ch2, ch3) +' ┌──────────────────────────────────────────────────────────────┐ +' │ Enable/Disable filtering on channels │ +' ├──────────────────────────────────────────────────────────────┤ +' │ ch1 - Enable/Disable filter on channel 1. (True/False) │ +' │ │ +' │ ch2 - Enable/Disable filter on channel 2. (True/False) │ +' │ │ +' │ ch3 - Enable/Disable filter on channel 3. (True/False) │ +' └──────────────────────────────────────────────────────────────┘ byte[@Filter3] := (byte[@Filter3]&$F0) | (ch1&1) | (ch2&2) | (ch3&4) -PUB setFilterType(lp,bp,hp) +PUB setFilterType(lp, bp, hp) +' ┌──────────────────────────────────────────────────────────────┐ +' │ Enable/Disable filter types │ +' ├──────────────────────────────────────────────────────────────┤ +' │ lp - Enable/Disable lowpass filter. (True/False) │ +' │ │ +' │ bp - Enable/Disable bandpass filter. (True/False) │ +' │ │ +' │ hp - Enable/Disable highpass filter. (True/False) │ +' └──────────────────────────────────────────────────────────────┘ byte[@volume] := (byte[@volume]&$0F) | (lp&16) | (bp&32) | (hp&64) -PUB enableRingmod(ch1,ch2,ch3) +PUB enableRingmod(ch1, ch2, ch3) +' ┌──────────────────────────────────────────────────────────────┐ +' │ Enable/Disable ring modulation on channels │ +' ├──────────────────────────────────────────────────────────────┤ +' │ ch1 - Enable/Disable ring modulation on ch 1. (True/False) │ +' │ │ +' │ ch2 - Enable/Disable ring modulation on ch 2. (True/False) │ +' │ │ +' │ ch3 - Enable/Disable ring modulation on ch 3. (True/False) │ +' ├──────────────────────────────────────────────────────────────┤ +' │- Channel 3 modulates channel 1 │ +' │ │ +' │- Channel 1 modulates channel 2 │ +' │ │ +' │- Channel 2 modulates channel 3 │ +' └──────────────────────────────────────────────────────────────┘ byte[@ch1_controlRegister] := (byte[@ch1_controlRegister]&$FB) | (ch1&4) byte[@ch2_controlRegister] := (byte[@ch2_controlRegister]&$FB) | (ch2&4) byte[@ch3_controlRegister] := (byte[@ch3_controlRegister]&$FB) | (ch3&4) -PUB enableSynchronization(ch1,ch2,ch3) +PUB enableSynchronization(ch1, ch2, ch3) +' ┌──────────────────────────────────────────────────────────────┐ +' │ Enable/Disable oscillator synchronization on channels │ +' ├──────────────────────────────────────────────────────────────┤ +' │ ch1 - Enable/Disable synchronization on ch 1. (True/False) │ +' │ │ +' │ ch2 - Enable/Disable synchronization on ch 2. (True/False) │ +' │ │ +' │ ch3 - Enable/Disable synchronization on ch 3. (True/False) │ +' ├──────────────────────────────────────────────────────────────┤ +' │- Channel 3 synchronizes channel 1 │ +' │ │ +' │- Channel 1 synchronizes channel 2 │ +' │ │ +' │- Channel 2 synchronizes channel 3 │ +' └──────────────────────────────────────────────────────────────┘ byte[@ch1_controlRegister] := (byte[@ch1_controlRegister]&$FD) | (ch1&2) byte[@ch2_controlRegister] := (byte[@ch2_controlRegister]&$FD) | (ch2&2) byte[@ch3_controlRegister] := (byte[@ch3_controlRegister]&$FD) | (ch3&2) -dat org 0 +DAT org 0 ' ' Assembly SID emulator ' @@ -134,14 +333,7 @@ SIDEMU mov dira, r1 mov ctrb, arg2 mov waitCounter, cnt add waitCounter, sampleRate -'----------------------------------------------------------- -mainLoop call #getRegisters - call #SID - call #filter - call #mixer - jmp #mainLoop -'----------------------------------------------------------- - + ' ' Read all SID-registers from hub memory and convert ' them to more convenient representations. @@ -160,23 +352,22 @@ getRegisters mov tempValue, par ' Read in first long '----------------------------------------------------------- mov arg1, selectedWaveform1 '| shr arg1, #8 '| - call #getDecay '| + call #getADSR '| mov decay1, r1 '| - shr arg1, #4 '| - call #getAttack '| + call #getADSR '| mov attack1, r1 '| Convert 4bit ADSR "presets" to their corresponding - shr arg1, #4 '| 32bit values using attack/decay tables. - call #getDecay '| + call #getADSR '| 32bit values using attack/decay tables. mov release1, r1 '| - mov sustain1, selectedWaveform1 '| - shl sustain1, #8 '| - andn sustain1, mask28bit '| + mov sustain1, arg1 '| + ror sustain1, #4 '| + or sustain1, arg1 '| + ror sustain1, #4 '| '----------------------------------------------------------- - shr selectedWaveform1, #4 ' Mask out waveform selection - and selectedWaveform1, #15 wz, wc + shr selectedWaveform1, #4 ' Mask out waveform selection + and selectedWaveform1, #15 '----------------------------------------------------------- - test controlRegister1, #1 wc - cmp envelopeState1, #2 wz + test controlRegister1, #1 wc + cmp envelopeState1, #2 wz if_z_and_c mov envelopeState1, #0 if_nz_and_nc mov envelopeState1, #2 @@ -197,23 +388,22 @@ getRegisters mov tempValue, par ' Read in first long '----------------------------------------------------------- mov arg1, selectedWaveform2 '| shr arg1, #8 '| - call #getDecay '| + call #getADSR '| mov decay2, r1 '| - shr arg1, #4 '| - call #getAttack '| + call #getADSR '| mov attack2, r1 '| Convert 4bit ADSR "presets" to their corresponding - shr arg1, #4 '| 32bit values using attack/decay tables. - call #getDecay '| + call #getADSR '| 32bit values using attack/decay tables. mov release2, r1 '| - mov sustain2, selectedWaveform2 '| - shl sustain2, #8 '| - andn sustain2, mask28bit '| + mov sustain2, arg1 '| + ror sustain2, #4 '| + or sustain2, arg1 '| + ror sustain2, #4 '| '----------------------------------------------------------- - shr selectedWaveform2, #4 ' Mask out waveform selection - and selectedWaveform2, #15 wz, wc + shr selectedWaveform2, #4 ' Mask out waveform selection + and selectedWaveform2, #15 '----------------------------------------------------------- - test controlRegister2, #1 wc - cmp envelopeState2, #2 wz + test controlRegister2, #1 wc + cmp envelopeState2, #2 wz if_z_and_c mov envelopeState2, #0 if_nz_and_nc mov envelopeState2, #2 @@ -234,23 +424,22 @@ getRegisters mov tempValue, par ' Read in first long '----------------------------------------------------------- mov arg1, selectedWaveform3 '| shr arg1, #8 '| - call #getDecay '| + call #getADSR '| mov decay3, r1 '| - shr arg1, #4 '| - call #getAttack '| + call #getADSR '| mov attack3, r1 '| Convert 4bit ADSR "presets" to their corresponding - shr arg1, #4 '| 32bit values using attack/decay tables. - call #getDecay '| + call #getADSR '| 32bit values using attack/decay tables. mov release3, r1 '| - mov sustain3, selectedWaveform3 '| - shl sustain3, #8 '| - andn sustain3, mask28bit '| + mov sustain3, arg1 '| + ror sustain3, #4 '| + or sustain3, arg1 '| + ror sustain3, #4 '| '----------------------------------------------------------- shr selectedWaveform3, #4 ' Mask out waveform selection - and selectedWaveform3, #15 wz, wc + and selectedWaveform3, #15 '----------------------------------------------------------- - test controlRegister3, #1 wc - cmp envelopeState3, #2 wz + test controlRegister3, #1 wc + cmp envelopeState3, #2 wz if_z_and_c mov envelopeState3, #0 if_nz_and_nc mov envelopeState3, #2 @@ -275,14 +464,8 @@ getRegisters mov tempValue, par ' Read in first long shr filterMode_Volume, #8 '| '----------------------------------------------------------- mov filterResonance,filterControl '| - and filterResonance,#$F0 '| - shr filterResonance,#5 '| - add filterResonance,#resTable '| Filter Resonance level (Ariba) - movs rdRes,filterResonance '| - nop '| -rdRes mov filterResonance,0-0 '| - -getRegisters_ret ret + and filterResonance,#$F0 '| Filter Resonance level + shr filterResonance,#4 '| ' ' Calculate sid samples channel 1-3 and store in out1-out3 @@ -293,262 +476,256 @@ getRegisters_ret ret '─────────────────────────────────────────────────────────── SID add phaseAccumulator1, frequency1 wc ' Add frequency value to phase accumulator 1 if_nc andn controlRegister2, #2 - test controlRegister2, #10 wz ' Sync oscilator 2 to oscilator 1 if sync = on + test controlRegister2, #10 wz ' Sync oscilator 2 to oscillator 1 if sync = on if_nz mov phaseAccumulator2, #0 ' Or reset counter 2 when bit 4 of control register is 1 '----------------------------------------------------------- add phaseAccumulator2, frequency2 wc if_nc andn controlRegister3, #2 - test controlRegister3, #10 wz ' Sync oscilator 3 to oscilator 2 if sync = on + test controlRegister3, #10 wz ' Sync oscilator 3 to oscillator 2 if sync = on if_nz mov phaseAccumulator3, #0 ' Or reset oscilator 3 when bit 4 of control register is 1 '----------------------------------------------------------- add phaseAccumulator3, frequency3 wc if_nc andn controlRegister1, #2 - test controlRegister1, #10 wz ' Sync oscilator 1 to oscilator 3 if sync = on + test controlRegister1, #10 wz ' Sync oscilator 1 to oscillator 3 if sync = on if_nz mov phaseAccumulator1, #0 ' Or reset oscilator 1 when bit 4 of control register is 1 '─────────────────────────────────────────────────────────── ' Waveform shaping channel 1 -> arg1 '─────────────────────────────────────────────────────────── -Triangle1 tjz selectedWaveform1, #Triangle2 - cmp selectedWaveform1, #1 wz - if_nz jmp #Saw1 - abs arg1, phaseAccumulator1 - max arg1, mask31bit - test controlRegister1, #4 wc '| - if_c test phaseAccumulator3, val31bit wc '| These 3 lines handles ring modulation - if_c xor arg1, mask32bit '| - shl arg1, #1 - jmp #Env_Attack1 -'----------------------------------------------------------- Saw1 cmp selectedWaveform1, #2 wz - if_z mov arg1, phaseAccumulator1 - if_z jmp #Env_Attack1 + mov arg1, phaseAccumulator1 + if_z jmp #Envelope1 +'----------------------------------------------------------- +Triangle1 cmp selectedWaveform1, #1 wz, wc + if_nz jmp #Square1 + shl arg1, #1 wc + if_c xor arg1, mask32bit + test controlRegister1, #4 wz '| + if_nz test phaseAccumulator3, val31bit wz '| These 3 lines handles ring modulation + if_nz xor arg1, mask32bit '| + jmp #Envelope1 '----------------------------------------------------------- Square1 cmp selectedWaveform1, #4 wz if_z sub pulseWidth1, phaseAccumulator1 wc ' C holds the pulse width modulated square wave if_z muxc arg1, mask32bit - if_z jmp #Env_Attack1 + if_z jmp #Envelope1 '----------------------------------------------------------- Noise1 cmp selectedWaveform1, #8 wz - if_nz jmp #Combined1 - mov tempValue, phaseAccumulator1 - and tempValue, mask28bit - sub tempValue, frequency1 wc - if_z_and_c ror noiseValue1, NOISE_ROTATE - if_z_and_c add noiseValue1, noiseAdd - if_z mov arg1, noiseValue1 - jmp #Env_Attack1 + if_nz jmp #Combined1 + and arg1, mask28bit + sub arg1, frequency1 wc + movi arg1, noiseValue1 + add arg1, noiseAddValue + if_nc jmp #Envelope1 + test noiseValue1, noiseTap wc + rcr noiseValue1, #1 + jmp #Envelope1 '----------------------------------------------------------- -Combined1 sub selectedWaveform1, #4 - mins selectedWaveform1, #0 +Combined1 test selectedWaveform1, #8 wz + sub selectedWaveform1, #4 + mins selectedWaveform1, #0 shl selectedWaveform1, #8 mov tempValue, phaseAccumulator1 shr tempValue, #24 add selectedWaveform1, tempValue add selectedWaveform1, combTableAddr - rdbyte arg1, selectedWaveform1 - shl arg1, #24 - + if_nc_and_z rdbyte arg1, selectedWaveform1 + if_nc_and_z shl arg1, #24 + if_c_or_nz mov arg1, val31bit '─────────────────────────────────────────────────────────── ' Envelope shaping channel 1 -> arg2 '─────────────────────────────────────────────────────────── -Env_Attack1 cmp envelopeState1, #0 wz - if_nz jmp #InitDecay1 +Envelope1 mov tempValue, decayDivideRef + shr tempValue, decayDivide1 + cmp envelopeLevel1, tempValue wc + tjnz envelopeState1, #Env_Dec1 nr +'----------------------------------------------------------- +Env_At1 if_nc cmpsub decayDivide1, #1 add envelopeLevel1, attack1 wc if_c mov envelopeLevel1, mask32bit if_c mov envelopeState1, #1 - mov decayDivide1, #0 jmp #Amplitude1 '----------------------------------------------------------- -InitDecay1 mov tempValue, decayDivideRef - shr tempValue, decayDivide1 - cmp envelopeLevel1, tempValue wc - if_c add decayDivide1, #1 -'----------------------------------------------------------- -Env_Decay1 cmp envelopeState1, #1 wz - if_nz jmp #Env_Release1 - shr decay1, decayDivide1 +Env_Dec1 if_c add decayDivide1, #1 + cmp startLogLevel, envelopeLevel1 wc + cmp envelopeState1, #1 wz + if_nz jmp #Rel1 + if_nc shr decay1, decayDivide1 sub envelopeLevel1, decay1 min envelopeLevel1, sustain1 wc jmp #Amplitude1 '----------------------------------------------------------- -Env_Release1 cmp envelopeState1, #2 wz - if_nz jmp #Amplitude1 - shr release1, decayDivide1 +Rel1 if_nc shr release1, decayDivide1 cmpsub envelopeLevel1, release1 '─────────────────────────────────────────────────────────── 'Calculate sample out1 = arg1 * arg2 (waveform * amplitude) '─────────────────────────────────────────────────────────── -Amplitude1 shr arg1, #16 - sub arg1, val15bit +Amplitude1 shr arg1, #14 + sub arg1, val17bit mov arg2, envelopeLevel1 - shr arg2, #22 + shr arg2, #24 call #multiply mov out1, r1 '─────────────────────────────────────────────────────────── ' Waveform shaping channel 2 -> arg1 '─────────────────────────────────────────────────────────── -Triangle2 tjz selectedWaveform2, #Triangle3 - cmp selectedWaveform2, #1 wz - if_nz jmp #Saw2 - abs arg1, phaseAccumulator2 - max arg1, mask31bit - test controlRegister2, #4 wc '| - if_c test phaseAccumulator1, val31bit wc '| These 3 lines handles ring modulation - if_c xor arg1, mask32bit '| - shl arg1, #1 - jmp #Env_Attack2 -'----------------------------------------------------------- Saw2 cmp selectedWaveform2, #2 wz - if_z mov arg1, phaseAccumulator2 - if_z jmp #Env_Attack2 + mov arg1, phaseAccumulator2 + if_z jmp #Envelope2 '----------------------------------------------------------- +Triangle2 cmp selectedWaveform2, #1 wz, wc + if_nz jmp #Square2 + shl arg1, #1 wc + if_c xor arg1, mask32bit + test controlRegister2, #4 wz '| + if_nz test phaseAccumulator1, val31bit wz '| These 3 lines handles ring modulation + if_nz xor arg1, mask32bit '| + jmp #Envelope2 +'----------------------------------------------------------- Square2 cmp selectedWaveform2, #4 wz if_z sub pulseWidth2, phaseAccumulator2 wc ' C holds the pulse width modulated square wave if_z muxc arg1, mask32bit - if_z jmp #Env_Attack2 + if_z jmp #Envelope2 '----------------------------------------------------------- -Noise2 cmp selectedWaveform2, #8 wz +Noise2 cmp selectedWaveform2, #8 wz if_nz jmp #Combined2 - mov tempValue, phaseAccumulator2 - and tempValue, mask28bit - sub tempValue, frequency2 wc - if_z_and_c ror noiseValue2, NOISE_ROTATE - if_z_and_c add noiseValue2, noiseAdd - if_z mov arg1, noiseValue2 - jmp #Env_Attack2 + and arg1, mask28bit + sub arg1, frequency2 wc + movi arg1, noiseValue2 + add arg1, noiseAddValue + if_nc jmp #Envelope2 + test noiseValue2, noiseTap wc + rcr noiseValue2, #1 + jmp #Envelope2 '----------------------------------------------------------- -Combined2 sub selectedWaveform2, #4 - mins selectedWaveform2, #0 +Combined2 test selectedWaveform2, #8 wz + sub selectedWaveform2, #4 + mins selectedWaveform2, #0 shl selectedWaveform2, #8 mov tempValue, phaseAccumulator2 shr tempValue, #24 add selectedWaveform2, tempValue add selectedWaveform2, combTableAddr - rdbyte arg1, selectedWaveform2 - shl arg1, #24 - + if_nc_and_z rdbyte arg1, selectedWaveform2 + if_nc_and_z shl arg1, #24 + if_c_or_nz mov arg1, val31bit '─────────────────────────────────────────────────────────── ' Envelope shaping channel 2 -> arg2 '─────────────────────────────────────────────────────────── -Env_Attack2 cmp envelopeState2, #0 wz - if_nz jmp #InitDecay2 +Envelope2 mov tempValue, decayDivideRef + shr tempValue, decayDivide2 + cmp envelopeLevel2, tempValue wc + tjnz envelopeState2, #Env_Dec2 nr +'----------------------------------------------------------- +Env_At2 if_nc cmpsub decayDivide2, #1 add envelopeLevel2, attack2 wc if_c mov envelopeLevel2, mask32bit if_c mov envelopeState2, #1 - mov decayDivide2, #0 jmp #Amplitude2 '----------------------------------------------------------- -InitDecay2 mov tempValue, decayDivideRef - shr tempValue, decayDivide2 - cmp envelopeLevel2, tempValue wc - if_c add decayDivide2, #1 -'----------------------------------------------------------- -Env_Decay2 cmp envelopeState2, #1 wz - if_nz jmp #Env_Release2 - shr decay2, decayDivide2 +Env_Dec2 if_c add decayDivide2, #1 + cmp startLogLevel,envelopeLevel2 wc + cmp envelopeState2, #1 wz + if_nz jmp #Rel2 + if_nc shr decay2, decayDivide2 sub envelopeLevel2, decay2 min envelopeLevel2, sustain2 wc jmp #Amplitude2 '----------------------------------------------------------- -Env_Release2 cmp envelopeState2, #2 wz - if_nz jmp #Amplitude2 - shr release2, decayDivide2 +Rel2 if_nc shr release2, decayDivide2 cmpsub envelopeLevel2, release2 '─────────────────────────────────────────────────────────── 'Calculate sample out2 = arg1 * arg2 (waveform * amplitude) '─────────────────────────────────────────────────────────── -Amplitude2 shr arg1, #16 - sub arg1, val15bit +Amplitude2 shr arg1, #14 + sub arg1, val17bit mov arg2, envelopeLevel2 - shr arg2, #22 + shr arg2, #24 call #multiply mov out2, r1 '─────────────────────────────────────────────────────────── ' Waveform shaping channel 3 -> arg1 '─────────────────────────────────────────────────────────── -Triangle3 tjz selectedWaveform3, #SID_ret - cmp selectedWaveform3, #1 wz - if_nz jmp #Saw3 - abs arg1, phaseAccumulator3 - max arg1, mask31bit - test controlRegister3, #4 wc '| - if_c test phaseAccumulator2, val31bit wc '| These 3 lines handles ring modulation - if_c xor arg1, mask32bit '| - shl arg1, #1 - jmp #Env_Attack3 -'----------------------------------------------------------- Saw3 cmp selectedWaveform3, #2 wz - if_z mov arg1, phaseAccumulator3 - if_z jmp #Env_Attack3 + mov arg1, phaseAccumulator3 + if_z jmp #Envelope3 '----------------------------------------------------------- +Triangle3 cmp selectedWaveform3, #1 wz, wc + if_nz jmp #Square3 + shl arg1, #1 wc + if_c xor arg1, mask32bit + test controlRegister3, #4 wz '| + if_nz test phaseAccumulator2, val31bit wz '| These 3 lines handles ring modulation + if_nz xor arg1, mask32bit '| + jmp #Envelope3 +'----------------------------------------------------------- Square3 cmp selectedWaveform3, #4 wz if_z sub pulseWidth3, phaseAccumulator3 wc ' C holds the pulse width modulated square wave if_z muxc arg1, mask32bit - if_z jmp #Env_Attack3 + if_z jmp #Envelope3 '----------------------------------------------------------- -Noise3 cmp selectedWaveform3, #8 wz - if_nz jmp #Combined3 - mov tempValue, phaseAccumulator3 - and tempValue, mask28bit - sub tempValue, frequency3 wc - if_z_and_c ror noiseValue3, NOISE_ROTATE - if_z_and_c add noiseValue3, noiseAdd - if_z mov arg1, noiseValue3 - jmp #Env_Attack3 +Noise3 cmp selectedWaveform3, #8 wz + if_nz jmp #Combined3 + and arg1, mask28bit + sub arg1, frequency3 wc + movi arg1, noiseValue3 + add arg1, noiseAddValue + if_nc jmp #Envelope3 + test noiseValue3, noiseTap wc + rcr noiseValue3, #1 + jmp #Envelope3 '----------------------------------------------------------- -Combined3 sub selectedWaveform3, #4 +Combined3 test selectedWaveform3, #8 wz + sub selectedWaveform3, #4 mins selectedWaveform3, #0 shl selectedWaveform3, #8 mov tempValue, phaseAccumulator3 shr tempValue, #24 add selectedWaveform3, tempValue add selectedWaveform3, combTableAddr - rdbyte arg1, selectedWaveform3 - shl arg1, #24 - + if_nc_and_z rdbyte arg1, selectedWaveform3 + if_nc_and_z shl arg1, #24 + if_c_or_nz mov arg1, val31bit + '─────────────────────────────────────────────────────────── ' Envelope shaping channel 3 -> arg2 '─────────────────────────────────────────────────────────── -Env_Attack3 cmp envelopeState3, #0 wz - if_nz jmp #InitDecay3 - add envelopeLevel3, attack3 wc - if_c mov envelopeLevel3, mask32bit - if_c mov envelopeState3, #1 - mov decayDivide3, #0 - jmp #Amplitude3 -'----------------------------------------------------------- -InitDecay3 mov tempValue, decayDivideRef - shr tempValue, decayDivide3 +Envelope3 mov tempValue, decayDivideRef + shr tempValue, decayDivide3 cmp envelopeLevel3, tempValue wc - if_c add decayDivide3, #1 + tjnz envelopeState3, #Env_Dec3 nr '----------------------------------------------------------- -Env_Decay3 cmp envelopeState3, #1 wz - if_nz jmp #Env_Release3 - shr decay3, decayDivide3 - sub envelopeLevel3, decay3 - min envelopeLevel3, sustain3 wc - jmp #Amplitude3 +Env_At3 if_nc cmpsub decayDivide3, #1 + add envelopeLevel3, attack3 wc + if_c mov envelopeLevel3, mask32bit + if_c mov envelopeState3, #1 + jmp #Amplitude3 +'----------------------------------------------------------- +Env_Dec3 if_c add decayDivide3, #1 + cmp startLogLevel, envelopeLevel3 wc + cmp envelopeState3, #1 wz + if_nz jmp #Rel3 + if_nc shr decay3, decayDivide3 + sub envelopeLevel3, decay3 + min envelopeLevel3, sustain3 wc + jmp #Amplitude3 '----------------------------------------------------------- -Env_Release3 cmp envelopeState3, #2 wz - if_nz jmp #Amplitude3 - shr release3, decayDivide3 - cmpsub envelopeLevel3, release3 +Rel3 if_nc shr release3, decayDivide3 + cmpsub envelopeLevel3, release3 '─────────────────────────────────────────────────────────── 'Calculate sample out3 = arg1 * arg2 (waveform * amplitude) '─────────────────────────────────────────────────────────── -Amplitude3 shr arg1, #16 - sub arg1, val15bit +Amplitude3 shr arg1, #14 + sub arg1, val17bit mov arg2, envelopeLevel3 - shr arg2, #22 + shr arg2, #24 call #multiply mov out3, r1 -SID_ret ret ' ' Handle multi-mode filtering @@ -564,23 +741,27 @@ filter mov ordinaryOutput, #0 '| test filterControl, #4 wc '| if_c add highPassFilter, out3 '| if_nc add ordinaryOutput, out3 '| -'----------------------------------------------------------- - mov tempValue, bandPassFilter '| - sar tempValue, filterResonance '| High pass filter - sub highPassFilter, tempValue '| +'----------------------------------------------------------- + mov arg2, filterResonance '| + add arg2, #RESONANCE_OFFSET '| + mov arg1, bandPassFilter '| + sar arg1, #RESONANCE_FACTOR '| + call #multiply '| High pass filter + sub highPassFilter, bandPassFilter '| + add highPassFilter, r1 '| sub highPassFilter, lowPassFilter '| '----------------------------------------------------------- mov arg1, highPassFilter '| sar arg1, #BP_MAX_CUTOFF '| mov arg2, filterCutoff '| Band pass filter - max arg2, maxCutoff - call #multiplyNS '| + max arg2, maxCutoff '| + call #multiply '| add bandPassFilter, r1 '| '----------------------------------------------------------- mov arg1, bandPassFilter '| sar arg1, #LP_MAX_CUTOFF '| mov arg2, filterCutoff '| Low pass filter - call #multiplyNS '| + call #multiply '| add lowPassFilter, r1 '| '----------------------------------------------------------- mov filterOutput, #0 '| @@ -590,7 +771,6 @@ filter mov ordinaryOutput, #0 '| if_c add filterOutput, bandPassFilter '| Low/Band/High pass filtering test filterMode_Volume, #64 wc '| if_c add filterOutput, highPassFilter '| -filter_ret ret ' ' Mix channels and update FRQA/FRQB PWM-values @@ -602,7 +782,7 @@ mixer mov arg1, filterOutput mins arg1, clipLevelLow '| mov arg2, filterMode_Volume '| Main volume adjustment and arg2, #15 '| - call #multiplyNS '| + call #multiply '| '----------------------------------------------------------- add r1, val31bit ' DC offset waitcnt waitCounter, sampleRate ' Wait until the right time to update @@ -611,69 +791,52 @@ mixer mov arg1, filterOutput mov tempValue, par add tempValue, #28 wrlong r1, tempValue '| Write the sample to hub ram -mixer_ret ret - + jmp #getRegisters + ' -' Get attack value r1 = attackTable[arg1] +' Get ADSR value r1 = attackTable[arg1] ' -getAttack mov arg2, arg1 - and arg1, #15 - add arg1, #ADSRTable - movs :indexed1, arg1 - mov arg1, arg2 +getADSR movs :indexed1, arg1 + andn :indexed1, #$1F0 + add :indexed1, #ADSRTable + shr arg1, #4 :indexed1 mov r1, 0 -getAttack_ret ret - -' -' Get decay value r1 = decayTable[arg1] -' -getDecay mov arg2, arg1 - and arg1, #15 - add arg1, #ADSRTable - movs :indexed2, arg1 - mov arg1, arg2 -:indexed2 mov r1, 0 -getDecay_ret ret +getADSR_ret ret ' ' Multiplication r1(I32) = arg1(I32) * arg2(I32) ' -multiply cmp arg1, arg2 wc 'If arg1 is less than arg2 C is set - if_c xor arg1, arg2 'Swap arguments - if_c xor arg2, arg1 - if_c xor arg1, arg2 -multiplyNS mov r1, #0 'Clear 32-bit product +multiply mov r1, #0 'Clear 32-bit product :multiLoop shr arg2, #1 wc, wz 'Half multiplyer and get LSB of it if_c add r1, arg1 'Add multiplicand to product on C shl arg1, #1 'Double multiplicand if_nz jmp #:multiLoop 'Check nonzero multiplier to continue multiplication -multiplyNS_ret multiply_ret ret ' ' Variables, tables, masks and reference values ' -ADSRTable long 68719476 '2 ms - long 17179870 '8 ms - long 8589934 '16 ms - long 5726622 '24 ms - long 3616814 '38 ms - long 2454268 '56 ms - long 2021160 '68 ms - long 1717986 '80 ms - long 1374390 '100 ms - long 549754 '250 ms - long 274876 '500 ms - long 171798 '800 ms - long 137438 '1 s - long 45812 '3 s - long 27486 '5 s - long 17180 '8 s - -resTable long 0,1,1,1,1,1,2,2 '(Ariba) - -'Masks and reference values +ADSRTable long trunc(ENV_CAL_FACTOR * (1.0 / 9.0 )) '2 ms + long trunc(ENV_CAL_FACTOR * (1.0 / 32.0 )) '8 ms + long trunc(ENV_CAL_FACTOR * (1.0 / 63.0 )) '16 ms + long trunc(ENV_CAL_FACTOR * (1.0 / 95.0 )) '24 ms + long trunc(ENV_CAL_FACTOR * (1.0 / 149.0 )) '38 ms + long trunc(ENV_CAL_FACTOR * (1.0 / 220.0 )) '56 ms + long trunc(ENV_CAL_FACTOR * (1.0 / 267.0 )) '68 ms + long trunc(ENV_CAL_FACTOR * (1.0 / 313.0 )) '80 ms + long trunc(ENV_CAL_FACTOR * (1.0 / 392.0 )) '100 ms + long trunc(ENV_CAL_FACTOR * (1.0 / 977.0 )) '250 ms + long trunc(ENV_CAL_FACTOR * (1.0 / 1954.0 )) '500 ms + long trunc(ENV_CAL_FACTOR * (1.0 / 3126.0 )) '800 ms + long trunc(ENV_CAL_FACTOR * (1.0 / 3907.0 )) '1 s + long trunc(ENV_CAL_FACTOR * (1.0 / 11720.0)) '3 s + long trunc(ENV_CAL_FACTOR * (1.0 / 19532.0)) '5 s + long trunc(ENV_CAL_FACTOR * (1.0 / 31251.0)) '8 s + +'Masks and reference values +startLogLevel long START_LOG_LEVEL +sustainAdd long $0f000000 mask32bit long $ffffffff mask31bit long $7fffffff mask28bit long $fffffff @@ -684,26 +847,33 @@ mask11bit long $7ff val31bit long $80000000 val28bit long $10000000 val27bit long $8000000 +val17bit long $20000 val16bit long $10000 -val15bit long $8000 clipLevelHigh long $8000000 clipLevelLow long-$8000000 -noiseAdd long NOISE_ADD 'Value to add to the noise generator every noise update filterOffset long FILTER_OFFSET decayDivideRef long DECAY_DIVIDE_REF maxCutoff long CUTOFF_LIMIT -sampleRate long 0 'clocks between samples ( ~31.250 khz ) +sampleRate long 0 'clocks between samples ( ~31.250 khz ) combTableAddr long 0 'Setup and subroutine parameters arg1 long 1 arg2 long 1 r1 long 1 - -'Sid variables -envelopeLevel1 long 1 -envelopeLevel2 long 1 -envelopeLevel3 long 1 + +'Sid variables +noiseAddValue long NOISE_ADD +noiseTap long NOISE_TAP +noiseValue1 long $ffffff +noiseValue2 long $ffffff +noiseValue3 long $ffffff +decayDivide1 long 0 +decayDivide2 long 0 +decayDivide3 long 0 +envelopeLevel1 res 1 +envelopeLevel2 res 1 +envelopeLevel3 res 1 controlRegister1 res 1 controlRegister2 res 1 controlRegister3 res 1 @@ -722,9 +892,6 @@ selectedWaveform3 res 1 envelopeState1 res 1 envelopeState2 res 1 envelopeState3 res 1 -noiseValue1 res 1 -noiseValue2 res 1 -noiseValue3 res 1 attack1 res 1 attack2 res 1 attack3 res 1 @@ -737,9 +904,6 @@ sustain3 res 1 release1 res 1 release2 res 1 release3 res 1 -decayDivide1 res 1 -decayDivide2 res 1 -decayDivide3 res 1 out1 res 1 out2 res 1 out3 res 1 @@ -758,7 +922,7 @@ waitCounter res 1 tempValue res 1 fit -dat +DAT combinedWaveforms file "adm-sid-combined-waveforms.bin" VAR @@ -789,7 +953,8 @@ VAR byte Filter1 byte Filter2 byte Filter3 - byte Volume + byte Volume + byte oldVolume long SIDSample - byte cog + long cog diff --git a/lib/glob-con.spin b/lib/glob-con.spin index 012e26e..4781fd7 100644 --- a/lib/glob-con.spin +++ b/lib/glob-con.spin @@ -141,17 +141,20 @@ A_BLT = %00000000_00000000_00001000_00000000 a_sdDmGet 'dir-marker status abfragen a_sdDmClr 'dir-marker löschen a_sdDmPut 'dir-marker status setzen - a_sdEOF '30 'eof abfragen - -' ---------------------------------------------- COM-FUNKTIONEN -#31, a_comInit - a_comTx - a_comRx '33 + a_sdEOF 'eof abfragen + a_sdPos 'zeiger in Datei abfragen + a_sdCopy 'Datei kopieren + a_sdDirSize '33 'Dateigrösse ->ist quatsch ' ---------------------------------------------- Bluetooth-Funktionen #35, a_bltCommand_On a_bltCommand_Off '36 +' ---------------------------------------------- COM-FUNKTIONEN +#37, a_comInit + a_comTx + a_comRx '39 + ' ---------------------------------------------- RTC-FUNKTIONEN #40, a_rtcTest 'Test if RTC Chip is available a_rtcGetSeconds 'Returns the current second (0 - 59) from the real time clock. @@ -306,7 +309,10 @@ A_BLT = %00000000_00000000_00001000_00000000 a_s2_enableSynchronization ' ---------------------------------------------- Zusatzfunktionen - a_s_dmpreg '196 'soundinformationen senden + a_s2_resetRegisters + a_s1_resetRegisters + a_s_beep + a_s_dmpreg '199 'soundinformationen senden ' ---------------------------------------------- AY-SOUNDFUNKTIONEN #200, a_ayStart diff --git a/make.sh b/make.sh index 9a6aff9..e3ed20e 100755 --- a/make.sh +++ b/make.sh @@ -58,6 +58,8 @@ ${BSTC} -L ${libpath} ${D} -D __ADM_FAT -D __ADM_AYS -b -O a flash/administra/ad mv admflash.binary ${sdsys}/admay.adm ${BSTC} -L ${libpath} ${D} -D __ADM_FAT -D __ADM_HSS -D __ADM_LAN -D __ADM_RTC -D __ADM_COM -b -O a flash/administra/admflash.spin mv admflash.binary ${sdsys}/admnet.adm +${BSTC} -L ${libpath} ${D} -D __ADM_FAT -D __ADM_FAT_EXT -D __ADM_RTC -D __ADM_SID -D __ADM_PLX -D __ADM_DCF -D __ADM_BLT -b -O a flash/administra/admflash.spin +mv admflash.binary ${sdsys}/plexus.adm ${BSTC} -L ${libpath} ${D} -b -O a system/bellatrix/bel-htext/htext.spin mv htext.binary ${sdsys}/htext.bel