I've added this new page to detail the progress of my Electron Sequencer. The sequencer will be used to trigger my SynTomII, SynBal and SynClap modules I completed a few years ago. I have already built a Raspberry Pi sequencer but since I unpacked my Acorn machines I thought I'd create a sequencer that is of the same time period as that of the SynDrum sound effects. The hardware setup has been detailed on the Acorn Revival 2019 page but to summarise it'll consist of an Electron with a Plus 1, a E2P second processor, Dual User Ports and a Pegasus Disc Interface. If I don't bother with a Save/Load function the DIsc Inteface can be removed. Possibly this is a sledgehammer to crack a nut but it'll be an interesting exercise.

There is still one circuit board to make, the SynDrum interface board which will include sixteen channel LED's to help with testing - it's quieter!. Most of the content here will be the progress of the program, I'll be programing in BASIC/Assembly language for the second processor which I'm very much a novice so it'll be a bit of a learning experience.

I'm going to break down the program into a number of elements so I can concentrate on just one at a time and build up from there. I've started this process by making sure I can read and write data between the second processor and the User Ports. In time I'll implement the following functionality:

  • Extend the write outputs from 8 to 16 bits (Channels).
  • Add a simple text based input system for sequence data.
  • Add some sort of display to follow the steps.
  • Add trigger output pulse width - fixed or variable.
  • Add play/stop keys.
  • Add sequence direction.
  • Add a simple text based tempo setting.
  • Look into using the Plus 1 analogue inputs to make tempo settings by potentiometer.
  • Add SAVing and LOADing of data
  • Put the program in an EPROM?

  • I may even add a short video or two as the sequencer takes shape.

    The Interface Board
    The interface board simply plugs into the User Port ports using ribbon cable and provides signal buffering and channel/step indications. I am using a 74C244 non-invering buffer but I may change this to 74C240 inverting buffer depending what data sense works for me in the program.

    The Software
    I will slowly build up the software functions based on the list above and will add some notes to the listing to help aid understanding and my memory. Please remember that a second processor and dual user ports are required.

    10 REM (2020)
    11 IF HIMEM <&8000 THEN 12 ELSE 20
    12 PRINT"Switch on your Electron 2nd processor"
    13 END
    20 DIM Q% 100
    30 P%=Q%
    40 [OPT 0
    Note: Sets how much memory just above LOMEM to reserve for assembling the program. In this case 101 bytes.

    50 .init LDA #&93
    60 LDX #&B3
    70 LDY #&FF
    80 JSR &FFF4
    90 LDA #&93
    100 LDX #&B2
    110 LDY #&FF
    120 JSR &FFF4
    130 RTS
    Note: When called this initialises both ports to write out data.

    140 .write LDY &6000
    150 LDA #&93
    160 LDX #&B1
    170 JSR &FFF4
    180 LDY &6001
    190 LDA #&93
    200 LDX #&B0
    210 JSR &FFF4
    220 RTS
    Note: When called this writes data from memory locations &6000 and &6001 out to the ports - I'll need to look at the Electron memory map to see if I can use a couple of locations below PAGE so re-allocation won't be required in the future.

    230 .zero LDY #&0
    240 LDA #&93
    250 LDX #&B1
    260 JSR &FFF4
    270 LDY #&0
    280 LDA #&93
    290 LDX #&B0
    300 JSR &FFF4
    310 RTS
    320 ]
    330 NEXT
    Note: When called this puts all user port outputs to zero.

    340 CALL init:CALL zero
    Note: Intialise the ports and puts all outputs to zero.

    340 MODE 0
    350 @%=&00004
    360 VDU19,0,4;0;
    370 VDU23,1,0;0;0;0;
    380 PROCdeclare
    390 PROCdeclare1
    400 PROCscreen
    410 PROCkeys
    420 END
    Note: Sets the screen mode, sets the tabs, switches of the cursor, changes the screen background colour, declares the variables, draws the screen layout, and goes in to Editing mode.

    430 DEFPROCstep
    440 IF S>16 S=0
    450 S=S+1
    460 IF S=1 a1%=K1+K2+K3+K4+K5+K6+K7+K8
    470 IF S=1 b1%=K9+K10+K11+K12+K13+K14+K15+K16
    480 IF S=2 a2%=K1+K2+K3+K4+K5+K6+K7+K8
    490 IF S=2 b2%=K9+K10+K11+K12+K13+K14+K15+K16
    500 IF S=3 a3%=K1+K2+K3+K4+K5+K6+K7+K8
    510 IF S=3 b3%=K9+K10+K11+K12+K13+K14+K15+K16
    520 IF S=4 a4%=K1+K2+K3+K4+K5+K6+K7+K8
    530 IF S=4 b4%=K9+K10+K11+K12+K13+K14+K15+K16
    540 IF S=5 a5%=K1+K2+K3+K4+K5+K6+K7+K8
    550 IF S=5 b5%=K9+K10+K11+K12+K13+K14+K15+K16
    560 IF S=6 a6%=K1+K2+K3+K4+K5+K6+K7+K8
    570 IF S=6 b6%=K9+K10+K11+K12+K13+K14+K15+K16
    580 IF S=7 a7%=K1+K2+K3+K4+K5+K6+K7+K8
    590 IF S=7 b7%=K9+K10+K11+K12+K13+K14+K15+K16
    600 IF S=8 a8%=K1+K2+K3+K4+K5+K6+K7+K8
    610 IF S=8 b8%=K9+K10+K11+K12+K13+K14+K15+K16
    620 IF S=9 a9%=K1+K2+K3+K4+K5+K6+K7+K8
    630 IF S=9 b9%=K9+K10+K11+K12+K13+K14+K15+K16
    640 IF S=10 a10%=K1+K2+K3+K4+K5+K6+K7+K8
    650 IF S=10 b10%=K9+K10+K11+K12+K13+K14+K15+K16
    660 IF S=11 a11%=K1+K2+K3+K4+K5+K6+K7+K8
    670 IF S=11 b11%=K9+K10+K11+K12+K13+K14+K15+K16
    680 IF S=12 a12%=K1+K2+K3+K4+K5+K6+K7+K8
    690 IF S=12 b12%=K9+K10+K11+K12+K13+K14+K15+K16
    700 IF S=13 a13%=K1+K2+K3+K4+K5+K6+K7+K8
    710 IF S=13 b13%=K9+K10+K11+K12+K13+K14+K15+K16
    720 IF S=14 a14%=K1+K2+K3+K4+K5+K6+K7+K8
    730 IF S=14 b14%=K9+K10+K11+K12+K13+K14+K15+K16
    740 IF S=15 a15%=K1+K2+K3+K4+K5+K6+K7+K8
    750 IF S=15 b15%=K9+K10+K11+K12+K13+K14+K15+K16
    760 IF S=16 a16%=K1+K2+K3+K4+K5+K6+K7+K8
    770 IF S=16 b16%=K9+K10+K11+K12+K13+K14+K15+K16
    780 IF S=1 PRINTTAB(11,5) K1 K2 K3 K4 K5 K6 K7 K8 K9 K10 K11 K12 K13 K14 K15 K16
    790 IF S=2 PRINTTAB(11,6) K1 K2 K3 K4 K5 K6 K7 K8 K9 K10 K11 K12 K13 K14 K15 K16
    800 IF S=3 PRINTTAB(11,7) K1 K2 K3 K4 K5 K6 K7 K8 K9 K10 K11 K12 K13 K14 K15 K16
    810 IF S=4 PRINTTAB(11,8) K1 K2 K3 K4 K5 K6 K7 K8 K9 K10 K11 K12 K13 K14 K15 K16
    820 IF S=5 PRINTTAB(11,9) K1 K2 K3 K4 K5 K6 K7 K8 K9 K10 K11 K12 K13 K14 K15 K16
    830 IF S=6 PRINTTAB(11,10) K1 K2 K3 K4 K5 K6 K7 K8 K9 K10 K11 K12 K13 K14 K15 K16
    840 IF S=7 PRINTTAB(11,11) K1 K2 K3 K4 K5 K6 K7 K8 K9 K10 K11 K12 K13 K14 K15 K16
    850 IF S=8 PRINTTAB(11,12) K1 K2 K3 K4 K5 K6 K7 K8 K9 K10 K11 K12 K13 K14 K15 K16
    860 IF S=9 PRINTTAB(11,13) K1 K2 K3 K4 K5 K6 K7 K8 K9 K10 K11 K12 K13 K14 K15 K16
    870 IF S=10 PRINTTAB(11,14) K1 K2 K3 K4 K5 K6 K7 K8 K9 K10 K11 K12 K13 K14 K15 K16
    880 IF S=11 PRINTTAB(11,15) K1 K2 K3 K4 K5 K6 K7 K8 K9 K10 K11 K12 K13 K14 K15 K16
    890 IF S=12 PRINTTAB(11,16) K1 K2 K3 K4 K5 K6 K7 K8 K9 K10 K11 K12 K13 K14 K15 K16
    900 IF S=13 PRINTTAB(11,17) K1 K2 K3 K4 K5 K6 K7 K8 K9 K10 K11 K12 K13 K14 K15 K16
    910 IF S=14 PRINTTAB(11,18) K1 K2 K3 K4 K5 K6 K7 K8 K9 K10 K11 K12 K13 K14 K15 K16
    920 IF S=15 PRINTTAB(11,19) K1 K2 K3 K4 K5 K6 K7 K8 K9 K10 K11 K12 K13 K14 K15 K16
    930 IF S=16 PRINTTAB(11,20) K1 K2 K3 K4 K5 K6 K7 K8 K9 K10 K11 K12 K13 K14 K15 K16
    935 IF S=16 PRINTTAB(14,5)"                           "
    940 IF S=16 PROCgo
    950 PROCkeys
    960 ENDPROC
    970 DEFPROCkeys
    980 PROCdeclare
    981 PRINTTAB(3,24) "        "
    990 PRINTTAB(3,26) "                          "
    1000 PRINTTAB(14,5)"                           "
    1010 IF INKEY(-67) PROCgo
    1020 IF INKEY(-34) K1=1 ELSE IF K1=1 THEN K1=1 ELSE K1=0
    1030 IF INKEY(-35) K2=2 ELSE IF K2=2 THEN K2=2 ELSE K2=0
    1040 IF3INKEY(-52) K3=4 ELSE IF K3=4 THEN K3=4 ELSE K3=0
    1050 IF INKEY(-36) K4=8 ELSE IF K4=8 THEN K4=8 ELSE K4=0
    1060 IF INKEY(-69) K5=16 ELSE IF K5=16 THEN K5=16 ELSE K5=0
    1070 IF INKEY(-54) K6=32 ELSE IF K6=32 THEN K6=32 ELSE K6=0
    1080 IF INKEY(-38) K7=64 ELSE IF K7=64 THEN K7=64 ELSE K7=0
    1090 IF INKEY(-55) K8=128 ELSE IF K8=128 THEN K8=128 ELSE K8=0
    1100 IF INKEY(-82) K9=1 ELSE IF K9=1 THEN K9=1 ELSE K9=0
    1110 IF INKEY(-51) K10=2 ELSE IF K10=2 THEN K10=2 ELSE K10=0
    1120 IF INKEY(-68) K11=4 ELSE IF K11=4 THEN K11=4 ELSE K11=0
    1130 IF INKEY(-84) K12=8 ELSE IF K12=8 THEN K12=8 ELSE K12=0
    1140 IF INKEY(-85) K13=16 ELSE IF K13=16 THEN K13=16 ELSE K13=0
    1150 IF INKEY(-70) K14=32 ELSE IF K14=32 THEN K14=32 ELSE K14=0
    1160 IF INKEY(-71) K15=64 ELSE IF K15=64 THEN K15=64 ELSE K15=0
    1170 IF INKEY(-87) K16=128 ELSE IF K16=128 THEN K16=128 ELSE K16=0
    1180 IF INKEY(-74) PROCstep
    1190 IF K1=1 PRINTTAB(14,5)"T"
    1200 IF K2=2 PRINTTAB(18,5)"T"
    1210 IF K3=4 PRINTTAB(22,5)"T"
    1220 IF K4=8 PRINTTAB(26,5)"T"
    1230 IF K5=16 PRINTTAB(30,5)"T"
    1240 IF K6=32 PRINTTAB(34,5)"T"
    1250 IF K7=64 PRINTTAB(38,5)"T"
    1260 IF K8=128 PRINTTAB(42,5)"T"
    1270 IF K9=1 PRINTTAB(46,5)"T"
    1280 IF K10=2 PRINTTAB(50,5)"T"
    1290 IF K11=4 PRINTTAB(54,5)"T"
    1300 IF K12=8 PRINTTAB(58,5)"T"
    1310 IF K13=16 PRINTTAB(62,5)"T"
    1320 IF K14=32 PRINTTAB(66,5)"T"
    1330 IF K15=64 PRINTTAB(70,5)"T"
    1340 IF K16=128 PRINTTAB(74,5)"T"
    1350 GOTO 1010
    1360 ENDPROC
    Note: Data input - scans the keyboard, single steps through each step, each key pressed indicates a 'T' below the channel number, stores the value for each key press and displays the selections on the screen. Press the SPACE bar at any time to come out of Editing mode. When exiting "Editing" options are given to control the sequencer - Forward, Reverse and Random and Stop. You can also re-enter Editing Mode.

    The keys used are:

    BITS 1 TO 8 - W,E,R,T,Y,U,I,O
    BIT 9 TO 16 - S,D,F,G,H,J,K
    Move to next step - RETURN
    To enter Editing - 9
    To exit Editing - SPACE
    To start the sequence in the Forward direction - 1
    To start the sequence in the Reverse direction - 2
    To start the sequence in a Random direction - 3
    To stop the sequence - 4

    1370 DEFPROCgo
    1380 PRINTTAB(3,26) "(1) FORWARD"
    1390 PRINTTAB(17,26) "(2) REVERSE"
    1400 PRINTTAB(31,26) "(3) RANDOM"
    1410 PRINTTAB(44,26) "(4) STOP"
    1420 PRINTTAB(55,26) "(9) EDIT"
    1430 IF INKEY(-49) PROCforward
    1440 IF INKEY(-50) PROCback
    1450 IF INKEY(-18) PROCrandom
    1460 IF INKEY(-39) S=0:PROCkeys
    1470 GOTO 1430
    1480 ENDPROC
    1490 DEFPROCforward
    1500 PROCst1:PROCst2:PROCst3:PROCst4:PROCst5:PROCst6:PROCst7: PROCst8:PROCst9:PROCst10:PROCst11:PROCst12:PROCst13:PROCst14: PROCst15:PROCst16
    1510 GOTO 1500
    1520 ENDPROC
    1530 DEFPROCback
    1540 PROCst16:PROCst15:PROCst14:PROCst13:PROCst12:PROCst11: PROCst10:PROCst9:PROCst8:PROCst7:PROCst6:PROCst5:PROCst4: PROCst3:PROCst2:PROCst1
    1550 GOTO 1540
    1560 ENDPROC
    1570 DEFPROCrandom
    1580 X=RND(16)
    1590 IF X=1 PROCst1
    1600 IF X=2 PROCst2
    1610 IF X=3 PROCst3
    1620 IF X=4 PROCst4
    1630 IF X=5 PROCst5
    1640 IF X=6 PROCst6
    1650 IF X=7 PROCst7
    1660 IF X=8 PROCst8
    1670 IF X=9 PROCst9
    1680 IF X=10 PROCst10
    1690 IF X=11 PROCst11
    1700 IF X=12 PROCst12
    1710 IF X=13 PROCst13
    1720 IF X=14 PROCst14
    1730 IF X=15 PROCst15
    1740 IF X=16 PROCst16
    1750 GOTO 1580
    1760 ENDPROC
    Note: Start sequence menu.

    1770 DEFPROCst1
    1780 ?&6000=a1%
    1790 ?&6001=b1%
    1800 PRINTTAB(3,26) "STEP 01"
    1810 PROCpulse
    1820 PROCtempo
    1830 IF INKEY(-19) PROCgo
    1840 ENDPROC
    1850 DEFPROCst2
    1860 ?&6000=a2%
    1870 ?&6001=b2%
    1880 PRINTTAB(3,26) "STEP 02"
    1890 PROCpulse
    1900 PROCtempo
    1910 IF INKEY(-19) PROCgo
    1920 ENDPROC
    1930 DEFPROCst3
    1940 ?&6000=a3%
    1950 ?&6001=b3%
    1960 PRINTTAB(3,26) "STEP 03"
    1970 PROCpulse
    1980 PROCtempo
    1990 IF INKEY(-19) PROCgo
    2000 ENDPROC
    2010 DEFPROCst4
    2020 ?&6000=a4%
    2030 ?&6001=b4%
    2040 PRINTTAB(3,26) "STEP 04"
    2050 PROCpulse
    2060 PROCtempo
    2070 IF INKEY(-19) PROCgo
    2080 ENDPROC
    2090 DEFPROCst5
    2100 ?&6000=a5%
    2110 ?&6001=b5%
    2120 PRINTTAB(3,26) "STEP 05"
    2130 PROCpulse
    2140 PROCtempo
    2150 IF INKEY(-19) PROCgo
    2160 ENDPROC
    2170 DEFPROCst6
    2180 ?&6000=a6%
    2190 ?&6001=b6%
    2200 PRINTTAB(3,26) "STEP 06"
    2210 PROCpulse
    2220 PROCtempo
    2230 IF INKEY(-19) PROCgo
    2240 ENDPROC
    2250 DEFPROCst7
    2260 ?&6000=a7%
    2270 ?&6001=b7%
    2280 PRINTTAB(3,26) "STEP 07"
    2290 PROCpulse
    2300 PROCtempo
    2310 IF INKEY(-19) PROCgo
    2320 ENDPROC
    2330 DEFPROCst8
    2340 ?&6000=a8%
    2350 ?&6001=b8%
    2360 PRINTTAB(3,26) "STEP 08"
    2370 PROCpulse
    2380 PROCtempo
    2390 IF INKEY(-19) PROCgo
    2400 ENDPROC
    2410 DEFPROCst9
    2420 ?&6000=a9%
    2430 ?&6001=b9%
    2440 PRINTTAB(3,26) "STEP 09"
    2450 PROCpulse
    2460 PROCtempo
    2470 IF INKEY(-19) PROCgo
    2480 ENDPROC
    2490 DEFPROCst10
    2500 ?&6000=a10%
    2510 ?&6001=b10%
    2520 PRINTTAB(3,26) "STEP 10"
    2530 PROCpulse
    2540 PROCtempo
    2550 IF INKEY(-19) PROCgo
    2560 ENDPROC
    2570 DEFPROCst11
    2580 ?&6000=a11%
    2590 ?&6001=b11%
    2600 PRINTTAB(3,26) "STEP 11"
    2610 PROCpulse
    2620 PROCtempo
    2630 IF INKEY(-19) PROCgo
    2640 ENDPROC
    2650 DEFPROCst12
    2660 ?&6000=a12%
    2670 ?&6001=b12%
    2680 PRINTTAB(3,26) "STEP 12"
    2690 PROCpulse
    2700 PROCtempo
    2710 IF INKEY(-19) PROCgo
    2720 ENDPROC
    2730 DEFPROCst13
    2740 ?&6000=a13%
    2750 ?&6001=b13%
    2760 PRINTTAB(3,26) "STEP 13"
    2770 PROCpulse
    2780 PROCtempo
    2790 IF INKEY(-19) PROCgo
    2800 ENDPROC
    2810 DEFPROCst14
    2820 ?&6000=a14%
    2830 ?&6001=b14%
    2840 PRINTTAB(3,26) "STEP 14"
    2850 PROCpulse
    2860 PROCtempo
    2870 IF INKEY(-19) PROCgo
    2880 ENDPROC
    2890 DEFPROCst15
    2900 ?&6000=a15%
    2910 ?&6001=b15%
    2920 PRINTTAB(3,26) "STEP 15"
    2930 PROCpulse
    2940 PROCtempo
    2950 IF INKEY(-19) PROCgo
    2960 ENDPROC
    2970 DEFPROCst16
    2980 ?&6000=a16%
    2990 ?&6001=b16%
    3000 PRINTTAB(3,26) "STEP 16"
    3010 PROCpulse
    3020 PROCtempo
    3030 IF INKEY(-19) PROCgo
    3040 ENDPROC
    Note: 16 Step Trigger sequence

    3050 DEF PROCtempo
    3060 NOW=TIME
    3080 ENDPROC
    Note: This sets the tempo. It is fixed at the moment but will be made varialble.

    3090 DEF PROCpulse
    3100 CALL write
    3110 FOR A=0 TO 30:NEXT
    3120 CALL zero
    3130 ENDPROC
    Note: This pulses the outputs. The pulse width will be set to around 5mS.

    3140 DEFPROCdeclare
    3150 K1=0:K2=0:K3=0:K4=0:K5=0:K6=0:K7=0:K8=0
    3160 K9=0:K10=0:K11=0:K12=0:K13=0:K14=0:K15=0:K16=0
    3170 ENDPROC
    3180 DEFPROCdeclare1
    3190 a1%=0:b1%=0:a2%=0:b2%=0:a3%=0:b3%=0:a4%=0:b4%=0:a5%=0: b5%=0:a6%=0:b6%=0:a7%=0:b7%=0:a8%=0:b8%=0
    3200 a9%=0:b9%=0:a10%=0:b10%=0:a11%=0:b11%=0:a12%=0: b12%=0:a13%=0:b13%=0:a14%=0:b14%=0:a15%=0:b15%=0:a16%=0:b16%=0
    3210 S=0
    3220 ENDPROC
    Note: Declares the variables and sets them to 0.

    3230 DEFPROCscreen
    3250 PRINTTAB(14,2) "W","E","R","T","Y","U","I","O","S","D","F","G","H","J","K","L"
    3260 PRINTTAB(14,3) "1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16"
    3270 PRINTTAB(3,2) "KEY I/P"
    3280 PRINTTAB(3,3) "CHANNEL"
    3290 PRINTTAB(3,5) "STEP 01"
    3300 PRINTTAB(3,6) "STEP 02"
    3310 PRINTTAB(3,7) "STEP 03"
    3320 PRINTTAB(3,8) "STEP 04"
    3330 PRINTTAB(3,9) "STEP 05"
    3340 PRINTTAB(3,10) "STEP 06"
    3350 PRINTTAB(3,11) "STEP 07"
    3360 PRINTTAB(3,12) "STEP 08"
    3370 PRINTTAB(3,13) "STEP 09"
    3380 PRINTTAB(3,14) "STEP 10"
    3390 PRINTTAB(3,15) "STEP 11"
    3400 PRINTTAB(3,16) "STEP 12"
    3410 PRINTTAB(3,17) "STEP 13"
    3420 PRINTTAB(3,18) "STEP 14"
    3430 PRINTTAB(3,19) "STEP 15"
    3440 PRINTTAB(3,20) "STEP 16"
    3450 PRINTTAB(28,30) " (2020)"
    3460 ENDPROC
    Note: Draws the basic screen layout.

    Note: As the sequencer functionality grows so these PROCedures will change and hopefully with improvments in their efficiency.

    I have completed the first six bullet points and I know what I'm going to do with the tempo function. I intend to use the Plus 1 analogue port to attach a potentiomenter to control the time delay between steps. This is how the software currently works:

    On starting the program you are immediately put in Editing mode which looks like this.

    The keys W to O, channels 1 to 8 and S to L, channels 9 to 16 are used to enter the trigger points. When a key is pressed a "T" is displayed below the corresponding channel number, on pressing ENTER the data for the first step is entered and you are ready to enter the next steps data. Continue until all the steps are filled at which point the program will switch to Play mode.

    The Play options will appear on the screen, these are play Forward, Play Reverse and Play Random. Selecting one of these options with the keyboard numbers 1 to 3 will start the sequence and the Step count will be displayed. Pressing the number 4 will stop the sequence and will return you to the Play screen where upon you can make another selection.

    Pressing 9 will return you to Editing mode at step 1.

    There are two 'nice to have' functions I have not implentented yet and they are: being able to toggle the "T" on and off and to scroll down to a patricular step to edit. At the moment you have to re-enter the data at least down to the step you want to change. Pressing the SPACE will take you straight to Play mode.