C 64
Musik

Immer im Takt

Vollwertige Baß-Begleitung, gespielt von Ihrem C 64. Ohne komplizierte Eingaben. Das Programm »Bassist« errechnet die Schlagzeug- und Baßbegleitung selbst. Fetziger Sound vom Jazz bis hin zur Unterhaltungsmusik ist vorprogrammiert.

Jeder Amateurmusiker wird mit uns einer Meinung sein: Die Klangqualitäten des C 64 qualifizieren ihn als Rhythmus- und Begleitinstrument! Oft dürfte dies jedoch an der nicht ganz einfachen Programmierung des Sound-Chips gescheitert sein. »Bassist« befreit Sie vom Betriebssystem, indem er die Steuerung des Sound-Chips nach Ihren Eingaben vornimmt. Sie müssen lediglich die im Jazz und in der Unterhaltungsmusik üblichen Harmonie-Bezeichnungen eingeben, der Computer spielt den entsprechenden Baß und, wenn gewünscht, auch die Schlagzeugbegleitung dazu.

Das Programm ist menügesteuert und sagt dem Benutzer immer, was zu tun ist. Den Menüpunkt »Neuerfassen/Editieren« beendet man durch die Eingabe von »*«. Ansonsten kommt man immer mit der F1-Taste zurück ins Hauptmenü.

Programm-Aufbau:

Das Programm besteht aus zwei Teilen: einem Basic-Programm (Listing 1) und einem Maschinensprache-Programm (Listing 2). In diesem werden Interrupt-gesteuert die SID-Register bedient sowie einige zeitkritische Ton-Bestimmungen durchgeführt. Die Funktionsweise dieses Teils können Sie Listing 3, dem ausführlich dokumentierten Quellcode entnehmen.

SID-Tonerzeugungen

Um die Anschlagsdynamik eines Basses zu simulieren, werden der VCO-Nr.1 und VCO-Nr.2 mit unterschiedlichen Decay-Zeiten und unterschiedlichen Wellenformen angesteuert.

Für die Schlagzeugbegleitung wird VCO-Nr.3 benutzt.

Parameter-Einstellungen

Der Charakter eines Stückes wird wesentlich durch diese Einstellungen bestimmt:

  1. Stimmung: Die Stimmung kann um fünf Halbtöne in ⅙-Ton-Schritten verändert werden. (Anpassen an andere Instrumente oder Transponieren eines Stückes!)
  2. Tempo: Das Tempo ist von 30 bis 180 Schläge in der Minute einstellbar.
  3. Baß-Filter: Vom dunklen String-Bass bis zum hellen Elektro-Baß einstellbar.
  4. Baß-Noten: Diese Einstellung bestimmt, wie oft ¼-Noten beziehungsweise ½-Noten gespielt werden. Ist der Pfeil ganz links, werden alle ¼-Noten gespielt. Ganz rechts nur ½-Noten. Dazwischen je nach eingestellter Wahrscheinlichkeit.
  5. Baß-Linie: Eine gute Baß-Linie springt nicht sinnlos in einer Tonleiter herum. Vielmehr folgt sie einem Trend, der eine Zeitlang beibehalten wird und dann durch eine Wende wieder abgebrochen wird. Nur »Trend-Spiel« wird aber auch langweilig. Deshalb ist eine Mischung von »Trend« und »Zufall« (die hier einstellbar ist) für eine gelungene Baß-Linie nötig. Normalerweise wird man ziemlich viel »Trend« mit einem kleinen Schuß »Zufall« einstellen.
(R. Treichler/og)
A4 Anzahl ¼-Schläge pro Takt
AP Adresse des Assembler-Programms
AU Vergleichswert für HD zum Ausschalten im letzten Takt
AZ Switch für Anzählen
C$ = CHR$ (13)
DT, DS Disk-Track/Sektor
ER, ER$, ET, ES Disk-Error-Variablen
F aktuelle Frequenz
F() Frequenz-Tabelle für 1 Oktave
F1,F2 Eck-Frequenzen für Trend-Umkehr
F6 Frequenz-Faktor für plus ⅙-Ton
FA Frequenz-Faktor für Aufschlag
FK Frequenz-Konstante für Umrechnung auf SID-Werte
FL letzte gespielte Frequenz
FO Frequenz-Faktor für etwa plus ½ Oktave
FS Adresse »Frequenz« speichern
FU wie FK, aber korrigiert durch Parameter »Stimmung«
FW aktueller Frequenz-Wert für SID
H aktuelle Harmonie-Nummer
H4 ¼-Schlag-Nummer in aktueller Harmonie
HB Nummer der Harmonie, bis zu der wiederholt werden muß
HD Dauer der aktuellen Harmonie in ¼
HL letzte Harmonie
HM maximale Anzahl Harmonien
HN nächste Harmonie
HT totale Harmonien
HW Nummer der Harmonie zum Weiterfahren nach Wiederholungen
H$() Harmonie-Bezeichnungen
HA%() Akkord-eigene Töne als Bit-Muster
HD%() Harmonie-Dauer in ¼
bei Wiederholungen: Wiederholen »bis« Harmonie
HG%() Nummer Grundton
bei Wiederholungen: Wiederholen »von« Harmonie
HS%() Skala (0 = #-Skala, 1 = b-Skala)
I,J Laufvariablen
KP Schulter »keine Percussion«
L$, M0$...MN$ diverse Print-Strings (Striche etc).
MT$ Musik-Titel
N Nummer des Tones in Bit-Functions
P() Parameter
PN Parameter-Nummer
PR$ Print-String während Play-Time
PS$ Print-String für Skala-Striche bei Parametern
R Adresse im SID-Register
RB Adresse RUN-Switch »Bass« für IRQ-Programm
RP Adresse RUN-Switch »Percussion« für ASS-IRQ-Programm
S$() Ton-Bezeichnung für #- und b-Skala
SM() Skala-Masken für Bit-Muster generieren
SP() Skala-Pointer (enthält Grundton-Nummer für A...G)
T0%, T2%, T3%, T4% Zeiten (in 1/60-Sek) für Vor- und Hauptschläge
TA% aktive Ton-Nummer
TR% aktiver Trend (+/-1)
W Laufvariable für Wiederholungen
WA Anzahl Wiederholungen
X,Y,Z Zwischen-Speicher
X$,Z$ Zwischen-Speicher
Tabelle der Variablen in »Bassist«
10 rem *********+*
20 rem * bassist *
40 rem ***********
50 :
60 rem  (c) 1985, robert treichler,  fl-9497 triesenberg (f.tum liechtenstein)
70 :
80 poke53280,0:poke53281,0:printchr$(14)chr$(8)"{clr}"
90 ifz=0thenz=1:x$="":z$="":load"bass/irq",8,1:rem ass-prog.einlesen
100 :
101 rem definitionen & init.
102 :
200 hm=100:dimh$(hm),hd%(hm),ha%(hm),hs%(hm),hg%(hm),f(11),p(4,2)
205 dims$(12,1),sp(6),sm(11),x$(16)
210 rem func.f.bit-muster (y=bit-muster,z=grundton,n=nr.1/2-ton ueber grundton):
212 deffn bs(n)=yorsm(n+z+(n+z>11)*12):rem funct. set bit
214 deffn bc(n)=yand4095-sm(n+z+(n+z>11)*12):rem funct. clear bit
216 deffn bt(n)=yandsm(n+z+(n+z>11)*12):rem funct. test bit
220 f=110:fori=0to11:f(i)=f:f=f*1.059463094:sm(i)=2^i:next:rem frequ.+bit-mask.
230 fori=0to6:readsp(i):next:rem skala-pointers (a...g)
240 forj=0to1:fori=0to12:reads$(i,j):nexti,j:rem #- & b-skalen
250 fori=0to4:forj=0to2:readp(i,j):nextj,i:rem parameter
260 c$=chr$(13):r=54272:rem adr.sid-reg.
265 mn$="   < mit 'f1' zurueck ins Menue >"
266 m0$="       {CBM-@}{CBM-@}{CBM-@}{CBM-@}{CBM-@}{CBM-@}{CBM-@}{CBM-@}{CBM-@}{CBM-@}{CBM-@}{CBM-@}{CBM-@}{CBM-@}{CBM-@}{CBM-@}{CBM-@}{CBM-@}{CBM-@}{CBM-@}{CBM-@}{CBM-@}{CBM-@}{CBM-@}{CBM-@}"
267 m1$="       {CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}"
268 m2$="      {CBM-M} "
269 m3$="      {CBM-M}                         {CBM-G}"
270 ps$="  -{SHIFT-+}{SHIFT-*}{SHIFT-*}{SHIFT-+}{SHIFT-*}{SHIFT-*}{SHIFT-+}{SHIFT-*}{SHIFT-*}{SHIFT-+}{SHIFT-*}{SHIFT-*}{SHIFT-+}{SHIFT-*}{SHIFT-*}{SHIFT-+}{SHIFT-*}{SHIFT-*}{SHIFT-+}{SHIFT-*}{SHIFT-*}{SHIFT-+}{SHIFT-*}{SHIFT-*}{SHIFT-+}{SHIFT-*}{SHIFT-*}{SHIFT-+}{SHIFT-*}{SHIFT-*}{SHIFT-+}+"
275 l$="                                       "
280 fa=.943874:fk=6.378901:f6=1.019440644:fo=1.37:f1=150:f2=300:rem frequ.konst
290 ap=49152:fs=ap+22:rb=251:rp=252:rem adr.f.ass-prog
300 :
301 rem menue
302 :
310 gosub6950:z=32:print"{clr}{cyn}{down}{down}"m0$:printm3$
320 printm2$tab(13)"B A S S I S T"tab(z)"{CBM-G}":printm3$:printm1$:printm0$:printm3$
321 printm2$"1=Neueingabe/Editieren"tab(z)"{CBM-G}":printm3$
322 printm2$"2=Abspeichern auf Disk"tab(z)"{CBM-G}":printm3$
323 printm2$"3=Einlesen von Disk"tab(z)"{CBM-G}":printm3$
324 printm2$"4=Play Bass Solo"tab(z)"{CBM-G}":printm3$
325 printm2$"5=Play Bass+Schlagzeug"tab(z)"{CBM-G}":printm3$
326 printm2$"6=Parameter-Einstellung"tab(z)"{CBM-G}":printm3$
327 printm2$"7=Ende"tab(z)"{CBM-G}":printm3$:printm1$
330 getz$:ifz$<"1"orz$>"7"then330
340 z=val(z$):onzgosub8000,2000,3000,500,505,5000,900
350 poke198,0:goto300
390 end
500 :
501 rem play
502 :
504 kp=1:goto510
505 kp=0
510 print"{clr}     "mt$:print"{down}"mn$"{down}"
520 tr%=1:az=1:fl=0:h=0:h$(ht+1)=h$(1):pr$=""
525 au=hd%(ht)-a4+1:ifau<1thenau=1
530 gosub6900:gosub1800
540 forw=1towa:hb=-1:hn=1:h4=0
550 hl=h:h=hn:hn=h+1:ifh>htthen850
555 ifh<hlthenpr$="Wiederholung"
560 ifh>hl+1thenpr$="Ende Wiederholung"
570 ifhn=hb+1thenhn=hw:hb=-1
580 ifh$(hn)="w"thenhb=hd%(hn):hw=hn+1:hn=hg%(hn)
590 forhd=1tohd%(h):h4=h4+1:ifh4>a4thenh4=1
600 :
601 rem ton bestimmen
602 :
605 ifh$(h)="Pause"then630
610 ifw<waorh<ht orhd<authen640
620 ifhd=authenta%=hg%(h):goto680:rem letzter takt bass aushalten
630 ta%=12:fw=0:goto720:rem pause
640 if(h4and1)orhd=hd%(h)then650
645 ifrnd(0)<p(3,0)then630
650 ifhd=1andhg%(h)<>hg%(hl)thenta%=hg%(h):goto680:rem neue harmonie beginnt
660 ifhd<>hd%(h)orhg%(h)=hg%(hn)then670:rem es folgt keine neue harmonie
662 ifh$(hn)="Pause"thenta%=hg%(h):goto680:rem pause folgt
665 sysap+12,ha%(h),ha%(hn),hg%(h),hg%(hn),tr%,ta%:goto680:rem ueberg.ton suchen
670 ifrnd(0)<p(4,0)thensysap+15,ha%(h),ta%:goto680:rem zufalls-ton
675 sysap+9,ha%(h),tr%,ta%:rem nae.akkordeig.ton suchen
680 f=f(ta%):iff=florf*fo<flandf+f<>flthenf=f+f:rem frequ.
690 tr%=1+2*(f<fl):iff<f1thentr%=1:rem trend bestimmen
695 iff>f2thentr%=-1:rem ...dabei eckfrequ. beachten
700 :
701 rem ton ausgeben
702 :
710 fl=f:fw=f*fu:rem frequ.in sid-wert umrechnen
720 if(hd>1orh$(h)=h$(hl))andh4>1then800
730 ifazthengosub1500:az=0
740 ifpeek(fs)then740:rem warte bis letzter ton v.irq-rout.behandelt ...
750 ifpr$>""thenprint:print:printpr$:pr$=""
760 print:printh$(h)tab(9)": ";:rem ..erst dann harmonie-bez. ausgeben
800 sysap+6,h4,fw,fw*fa,s$(ta%,hs%(h)):rem ton mit bez. ->ass-prog
820 ifpeek(197)=4thenhd=hd%(h):hn=ht+1:w=wa:rem abbruch
830 nexthd:goto550
850 nextw:sysap+6,0,0,0,"":sysap+3:rem irq-rout. aus
890 fori=0to1500:next:return
900 :
901 rem ende
902 :
990 end
1300 :
1301 rem werte zu einer harmonie generieren
1302 :
1308 z=sp(asc(x$)-193):z$=mid$(x$,2,1):x=0
1310 ifz$="#"thenz=z+1:goto1335
1320 ifz$="b"thenz=z-1-(z<1)*12:x=1:goto1335
1330 ifz$<>" "thenx$=left$(x$,1)+" "+mid$(x$,2)
1332 ifz=3orz=8thenx=1:rem c- & f-skalen mit b (nicht #)
1335 h$(ht)=x$:hg%(ht)=z:hs%(ht)=x:rem bez./grundton/skala (# oder b)
1340 fori=0toht-1:ifh$(i)=x$theny=ha%(i):goto1400
1345 nexti:y=0
1350 y=fnbs(0)+fnbs(4)+fnbs(7):rem bit-muster f.grund-dreiklang
1355 fori=2tolen(x$):z$=mid$(x$,i,1)
1360 ifz$="m"theny=fnbc(4):y=fnbs(3):goto1399:rem moll
1365 ifz$="j"theny=fnbc(10):y=fnbs(11):goto1399:rem major
1370 ifz$="+"theny=fnbc(7):y=fnbs(8):goto1399:rem quinte +
1375 ifz$="-"theny=fnbc(7):y=fnbs(6):goto1399:rem quinte -
1380 ifz$="0"orz$="o"theny=fnbc(4):y=fnbs(3):y=fnbc(7):y=fnbs(6):rem vermindert
1382 ifz$="6"theny=fnbs(9):goto1399:rem sexte
1385 ifz$="7"then1398
1386 ifz$="9"then1397
1387 ifz$="1"then1396
1388 ifz$="3"then1395
1390 goto1399
1395 y=fnbs(9):rem 13-er
1396 y=fnbs(5):rem 11-er
1397 y=fnbs(2):rem  9-er
1398 iffnbt(11)=0theny=fnbs(10):rem 7-er, wenn nicht schon major-7
1399 nexti
1400 ha%(ht)=y:print:printx$tab(9)": ";
1410 fori=0to11:iffnbt(i)=0then1450
1420 prints$(i+z+(i+z>11)*12,x)" ";
1450 nexti:print:return
1500 :
1501 rem anzaehlen
1502 :
1510 sysap:rem init.irq-prog.
1511 print:print"Stimmton : "s$(ta%,hs%(h))
1512 pokerb,1:z=fw:fori=1toa4
1514 sysap+6,128,z,0,"":z=0:next
1515 ifpeek(fs)then1515
1516 print:print"Anzaehlen:";
1520 pokerp,1:fori=1toa4
1530 sysap+6,128,0,0,str$(i):next
1540 ifkpthenpokerp,0
1550 pr$=" ":return
1800 :
1801 rem frequ.umrechn.konst. & tempo rechnen/->ass.prog.
1802 :
1820 fu=fk*f6^p(0,0):t0%=0
1840 rem vorschlaege bei tempi<130 ->1/16-noten, wenn schneller ->1/8-triolen
1850 ifp(1,0)<130thenz=int(900/p(1,0)+.5):t2%=2*z:t3%=t2%+z:t4%=t3%+z:goto1870
1860 z=int(1200/p(1,0)+.5):t2%=z:t3%=t2%+z:t4%=t3%+z:goto1870
1870 poker+5,10+t4%/50:rem bass-decay aufgrund tempo
1880 sysap+18,t2%,t3%,t4%:return
1897 :
1898 rem ton -> sid
1899 :
2000 :
2001 rem abspeichern auf disk
2002 :
2010 print"{clr}{down}Abspeichern auf Disk"
2020 input"{down}{down}Musik-Titel";mt$
2030 gosub2700:iferthenreturn
2040 open2,8,2,mt$+",s,w":gosub2800:ifer=0then2050
2042 ifer<>63thenreturn
2044 print"{down}Ueberschreiben (j/n)? ";
2046 getz$:ifz$<>"j"andz$<>"n"then2046
2048 printz$:ifz$="n"then2090
2049 close2:print#15,"s0:"+mt$:goto2040
2050 print#2,ht;c$;a4;c$;wa:fori=0to4:print#2,p(i,0):next
2060 gosub2800:iferthenreturn
2070 fori=1toht:print#2,h$(i);c$;ha%(i);c$;hs%(i);c$;hg%(i);c$;hd%(i):nexti
2090 gosub2800:close2:close15:return
2600 :
2700 open15,8,15,"i0"
2800 input#15,er,er$,et,es:ifer=0thenreturn
2820 print:printer;er$;et;es:ifer<20orer=63thenreturn
2850 :
2900 close2:close15
2910 :
2950 print:print"{down}{down}<Taste druecken>":poke198,0
2960 getz$:ifz$=""then2960
2980 return
3000 :
3001 rem einlesen von disk
3002 :
3010 print"{clr}Titel eingeben oder 'Return' fuer":print"{down}Inhaltsverzeichnis{down}"
3020 mt$="":inputmt$:ifmt$>""then3040
3030 gosub3500:iferormt$=""thenreturn
3040 gosub2700:open2,8,2,"0:"+mt$+",s,r":gosub2800:iferthenreturn
3050 input#2,ht,a4,wa:fori=0to4:input#2,p(i,0):ifp(i,0)<p(i,1)thenp(i,0)=p(i,1)
3055 ifp(i,0)>p(i,2)thenp(i,0)=p(i,2)
3060 nexti:gosub2800:iferthenreturn
3065 print"{clr}"mt$"  :"str$(a4)"/4-Takt":print"{down}Harmonie  Dauer in 1/4{down}"
3070 fori=1toht:input#2,h$(i):z=asc(h$(i)+chr$(0)):ifz=87orz=208then3080:rem w+p
3075 ifz<193orz>199thenprint:print"*** File-Fehler ***":goto2900
3080 input#2,ha%(i),hs%(i),hg%(i),hd%(i)
3090 printh$(i)tab(12)hd%(i):nexti:fori=0to500:next:goto3900
3500 :
3510 gosub2700:iferthenreturn
3515 open2,8,2,"#":dt=18:ds=1
3520 print#15,"u1";2;0;dt;ds
3522 print"{clr}Inhalt:":print"{down}Nr Titel":print"{CBM-T}{CBM-T} {CBM-T}{CBM-T}{CBM-T}{CBM-T}{CBM-T}{down}"
3525 print#15,"b-p";2;0:get#2,z$:dt=asc(z$+chr$(0)):get#2,z$:ds=asc(z$+chr$(0))
3530 fori=0to7:print#15,"b-p";2;i*32+2
3540 get#2,z$:ifz$<>chr$(129)then3600
3550 get#2,z$,z$
3560 x$="":forj=1to16:get#2,z$:x$=x$+z$:next:z$(i)=x$:printi;x$
3600 next:print"{down}{down}{down}Taste druecken:{down}":print"Nr.0...7 = diesen Titel einlesen"
3610 print"'Space'  = weiter im Inhaltsverzeichnis"
3620 print"'f1'     = zurueck ins Menue"
3640 getz$:ifz$=""then3640
3650 ifz$=chr$(133)thenmt$="":goto3900
3660 ifz$=>"0"andz$<"8"thenmt$=z$(val(z$)):goto3900
3670 ifz$<>" "then3640
3680 ifdt<1ordt>35thenprint"{down}keine weiteren Titel":goto3640
3690 goto3520
3900 close2:close15:return
5000 :
5001 rem parameter aendern
5002 :
5020 print"{clr}Parameter-Einstellungen:"
5030 print"Nr. waehlen (1-5) und mit +/- aendern"
5100 print"{down}1)          {rvon}Stimmung{rvof} (a=220 Hz)"
5110 print"   e  f  f# g  g# a  a# b  c  c# d":printps$
5120 print"{down}{down}2) 30 45 60 {rvon}Tempo{rvof}   120   150   180":printps$
5130 print"{down}{down}3) dunkel   {rvon}Bass-Filter{rvof}       hell":printps$
5140 print"{down}{down}4) 1/4      {rvon}Bass-Noten{rvof}         1/2":printps$
5150 print"{down}{down}5) Trend    {rvon}Bass-Linie{rvof}      Zufall":printps$
5160 print"{down}{down}"mn$"{home}"
5165 :
5170 forpn=0to4:gosub5500:next
5180 gosub6900:pn=0:f=220
5190 gosub1800:sysap:sysap+6,0,f*fu,0,"":pokerb,1
5200 z=peek(197):ifz=4then5900
5210 ifz=56thenpn=0
5220 ifz=59thenpn=1
5230 ifz=8 thenpn=2
5240 ifz=11thenpn=3
5250 ifz=16thenpn=4
5290 ifz<>40andz<>43then5200
5300 i=(p(pn,2)-p(pn,1))/30:ifz=43theni=-i
5310 p(pn,0)=p(pn,0)+i
5320 ifp(pn,0)<p(pn,1)thenp(pn,0)=p(pn,1)
5330 ifp(pn,0)>p(pn,2)thenp(pn,0)=p(pn,2)
5400 :
5410 gosub5500:ifpn=0orpn=1then5190
5415 ifpn=2thenpoker+22,p(2,0)
5420 goto5200
5490 :
5500 print"{home}{down}":fori=0topn:print"{down}{down}{down}{down}";:next
5510 z=int(30/(p(pn,2)-p(pn,1))*(p(pn,0)-p(pn,1))+3.5)
5520 printleft$(l$,z)"^"left$(l$,35-z)
5530 return
5900 :
5910 sysap+3:return
6900 :
6901 rem init.sid-registers: bass=vco#1+2, perc=vco#3
6902 :
6910 gosub6950:poker+10,1:poker+12,8:rem vco#2
6920 poker+15,80:rem vco#3
6930 poker+22,p(2,0):poker+23,240+8+2+1:poker+24,16+15:rem filter & volume
6940 return
6950 fori=r+24torstep-1:pokei,0:next:return
8000 :
8001 rem neueingabe / editieren
8002 :
8100 ifht<1thenprint"{clr}Neueingabe":goto8150
8102 print"{clr}Neueingabe oder Editieren (n/e)?";
8105 getz$:ifz$=""then8105
8110 printz$:ifz$="n"then8150
8120 ifz$="e"thenhl=ht:goto8200
8130 goto8100
8150 hl=0:a4=4:wa=1
8200 ht=0:h=0
8210 print"{down}Anzahl 1/4 pro Takt  "a4:printtab(20)"{up}";:inputa4
8220 print"{down}Anzahl Gesamt-Wiederholungen  "wa:printtab(29)"{up}";:inputwa
8300 print"{clr}Harmoniefolge eingeben (*=Ende Eingaben){down}"
8305 print" p=Pause            w=Wiederholung{down}"
8310 print" A...H (oder a...h)  =Grund-Dreiklang"
8315 print" #=erhoeht          b=erniedrigt"
8320 print" j=major            m=moll"
8330 print" +=erhoehte Quint   -=erniedrigte Quint"
8340 print" o=vermindert       B=deutsches H"
8350 print" 6,7,9,11,13=Sext,Sept,None,usw."
8360 print"{down}Beispiele:"
8365 print" C    =C-Dur-Akkord"
8370 print" F#m9 =Fis-Moll-None-Akkord"
8380 print" Gb6/7=Ges-Sext/Sept-Akkord"
8390 print" Bb7j =Bes-major-Sept-Akkord{down}"
8400 x$="":hd=4:ifht<hlthenx$=h$(ht+1):hd=hd%(ht+1)
8410 print"{down}{down}Takt"right$("  "+str$(int(h/a4)+1),3)":   "x$:printtab(9)"{up}";
8420 inputx$:x=asc(x$+chr$(0))and127
8430 ifx=42then8900:rem * (ende)
8435 ifx=87then8500:rem w (wiederh.)
8440 ifx=72thenx=66:rem h wird b
8445 ifx=80thenht=ht+1:h$(ht)="Pause":goto8480:rem p (pause)
8450 ifx<65orx>71thenprint"{down}*** Fehler ***":goto8400
8460 x$=chr$(x+128)+mid$(x$,2)
8470 ht=ht+1:gosub1300
8480 print"{down}Dauer in 1/4  "hd:printtab(13)"{up}";:inputhd::h=h+hd
8490 hd%(ht)=hd:goto8400
8500 :
8501 rem wiederholungszeichen bearbeiten
8510 ifht=>hlthenhd=ht:hg%(ht+1)=1
8520 ht=ht+1:h$(ht)="w"
8530 print"{down}ab der wievielten Harmonie"
8535 print"soll wiederholt werden"
8537 print" "hg%(ht):print"{up}";:inputz:ifz>ht-2orz<1then8530
8538 hg%(ht)=z
8540 print"{down}bis (und mit) zur wievielten Harmonie"
8545 print"soll wiederholt werden ( letzte="ht-1")"
8550 print" "hd:print"{up}";:inputz:ifz=>ht orz<=hg%(ht)then8530
8560 hd%(ht)=z:goto8400
8900 :
8910 ifht<hlthenht=hl:rem exit, korr.ht wenn edit.
8920 return
9000 :
9100 :
9101 rem skala-pointers a,b,c,d,e,f,g
9102 :
9110 data0,2,3,5,7,8,10
9200 :
9201 rem # und b-skalen chromat.
9202 :
9210 data"A ","A#","B ","C ","C#","D ","D#","E ","F ","F#","G ","G#","\ "
9220 data"A ","Bb","B ","C ","Db","D ","Eb","E ","F ","Gb","G ","Ab","\ "
9400 :
9401 rem param. std/tiefst/hoechst-werte
9402 :
9410 data 15,0,30:rem stimmung (1/6-toene oberhalb 'e' ->'e'...'d')
9420 data105,30,180:rem tempo
9430 data15,0,30:rem bass-filter
9440 data.2,0,1:rem 1/4 - 1/2 noten
9450 data.2,0,1:rem trend - zufall
9480 :
50000 :
50001 rem save prog.
50002 :
50010 open15,8,15,"s0:bassist":gosub2800
50020 save"bassist",8:gosub2800:close15
50030 end
Listing 1. Das Basic-Programm »Bassist« geben Sie bitte mit dem Checksummer ein
PROGRAMM : BASS_IRQ       C000 C2C3
-----------------------------------
C000 : 4C 37 C0 4C 4D C0 4C 57   5C
C008 : C1 4C B1 C1 4C D2 C1 4C   8F
C010 : 88 C2 4C B0 C2 00 00 00   4F
C018 : 00 00 00 00 00 00 00 00   19
C020 : 00 00 00 00 00 00 00 00   21
C028 : 00 00 00 01 02 04 08 10   C9
C030 : 20 40 80 01 02 04 08 A9   64
C038 : 54 A2 C0 78 8D 14 03 8E   BF
C040 : 15 03 A9 00 85 FB 85 FC   89
C048 : 8D 16 C0 58 60 A9 31 A2   79
C050 : EA 4C 3B C0 A5 FB 05 FC   8F
C058 : F0 15 EE 22 C0 AD 22 C0   56
C060 : CD 1F C0 F0 10 CD 20 C0   7C
C068 : F0 2D CD 21 C0 F0 57 8D   92
C070 : 22 C0 4C 31 EA A9 00 8D   43
C078 : 23 C0 AD 15 C0 30 F3 F0   49
C080 : F1 29 01 D0 ED AD 12 D0   96
C088 : 69 DC B0 E6 A9 05 8D 23   A7
C090 : C0 20 0D C1 4C 72 C0 AD   93
C098 : 15 C0 30 D6 F0 D4 29 01   51
C0A0 : F0 05 A9 05 8D 23 C0 20   53
C0A8 : 0D C1 AD 15 C0 C9 02 B0   68
C0B0 : C1 AD 12 D0 69 C8 B0 BA   FC
C0B8 : AD 19 C0 AC 18 C0 F0 B2   68
C0C0 : 20 27 C1 4C 72 C0 A2 05   2F
C0C8 : AD 15 C0 29 01 F0 02 A2   3A
C0D0 : 08 8E 23 C0 20 0D C1 AD   CD
C0D8 : 17 C0 AC 16 C0 20 27 C1   6A
C0E0 : A9 00 8D 22 C0 8D 23 C0   B7
C0E8 : AE 15 C0 F0 1D 8D 16 C0   87
C0F0 : 8D 18 C0 AD C3 C2 F0 12   A9
C0F8 : A2 00 BD C3 C2 F0 06 20   8E
C100 : D2 FF E8 D0 F5 A9 20 20   93
C108 : D2 FF 4C 72 C0 A5 FC F0   4A
C110 : 15 AD 23 C0 F0 10 A9 80   14
C118 : 8D 12 D4 AD 23 C0 8D 13   2E
C120 : D4 A9 81 8D 12 D4 60 D0   C6
C128 : 07 A9 2A 20 D2 FF A9 FF   66
C130 : 30 24 A6 FB F0 20 A2 20   76
C138 : 8E 04 D4 A2 40 8E 0B D4   A0
C140 : 8D 00 D4 8C 01 D4 8D 07   8F
C148 : D4 8C 08 D4 A9 21 8D 04   E1
C150 : D4 A9 43 8D 0B D4 60 20   94
C158 : FD AE 20 9E B7 8E 1A C0   62
C160 : 20 B2 B1 A5 64 D0 02 A9   22
C168 : FF 8D 1B C0 A5 65 8D 1C   01
C170 : C0 20 B2 B1 A5 64 8D 1D   11
C178 : C0 A5 65 8D 1E C0 AD 16   E1
C180 : C0 F0 05 AD 15 C0 D0 F6   38
C188 : A2 04 BD 1A C0 9D 15 C0   AE
C190 : CA 10 F7 20 FD AE 20 9E   77
C198 : AD 20 A3 B6 AA A0 00 E8   96
C1A0 : CA F0 08 B1 22 99 C3 C2   9E
C1A8 : C8 D0 F5 A9 00 99 C3 C2   EC
C1B0 : 60 20 3F C2 8D 24 C0 8E   63
C1B8 : 25 C0 20 3F C2 8D 29 C0   EC
C1C0 : 20 3F C2 8D 2A C0 AD 29   94
C1C8 : C0 20 65 C2 F0 F8 20 59   54
C1D0 : C2 60 20 3F C2 8D 24 C0   5D
C1D8 : 8E 25 C0 20 3F C2 8D 26   BA
C1E0 : C0 8E 27 C0 20 3F C2 8D   EB
C1E8 : 28 C0 20 3F C2 8D 2A C0   23
C1F0 : 20 3F C2 8D 29 C0 20 3F   AA
C1F8 : C2 8D 1A C0 A9 FF 20 65   05
C200 : C2 D0 32 A9 02 20 65 C2   28
C208 : D0 2B A9 FD 20 65 C2 D0   72
C210 : 24 A9 04 20 65 C2 D0 1D   F8
C218 : AD 24 C0 2D 26 C0 8D 24   94
C220 : C0 AD 25 C0 2D 27 C0 8D   42
C228 : 25 C0 0D 24 C0 D0 0A AD   8B
C230 : 28 C0 8D 2A C0 20 59 C2   59
C238 : 60 AD 1A C0 4C C3 C1 20   38
C240 : FD AE 20 8B B0 85 49 84   73
C248 : 4A A5 0E F0 09 A0 00 B1   FF
C250 : 49 AA C8 B1 49 60 4C 99   53
C258 : AD A9 00 A8 91 49 AD 2A   5D
C260 : C0 C8 91 49 60 18 6D 2A   E3
C268 : C0 10 03 18 69 0C C9 0C   2A
C270 : 90 03 38 E9 0C 8D 2A C0   24
C278 : AA BD 2B C0 A0 00 E0 08   81
C280 : 90 02 A0 01 39 24 C0 60   D2
C288 : 20 3F C2 8D 24 C0 8E 25   77
C290 : C0 20 3F C2 20 75 C2 49   D4
C298 : FF 39 24 C0 99 24 C0 AD   6E
C2A0 : 12 D0 29 07 D0 02 A9 01   0B
C2A8 : 20 65 C2 F0 F9 4C 59 C2   36
C2B0 : 20 3F C2 8D 1F C0 20 3F   C9
C2B8 : C2 8D 20 C0 20 3F C2 8D   83
C2C0 : 21 C0 60                  D3
Listing 2. Das Maschinen-Programm »BASS/IRQ« steuert den SID. Bitte mit dem MSE eingeben.
                      ;
                      ;************
                      ;* bass/irq *
                      ;************
                      ;
                      ; 1985 robert treichler
                      ;         fl-9497 triesenberg, f.tum liechtenstein
                      ;
220:   c000                   *=   $c000
                      ;
                      ; aufrufe aus basic ---------------
                      ;
                      ; init    sys ap
                      ; exit    sys ap+3
                      ; para    sys ap+6,h4,fw,fw*fw,ton-bez.
                      ; trend   sys ap+9,ha%(h),tr%,ta%
                      ; hnext   sys ap+12,ha%(h),ha%(hn),hg%(h),hg%(hn),tr%,ta%
                      ; zufall  sys ap+15,ha%(h),ta%
                      ; tempo   sys ap+18,t2%.t3%,t4%
                      ;
       c000 4c 37 c0          jmp  init    ;irq-rout. ein
       c003 4c 4d c0          jmp  exit    ;irq-rout. aus
       c006 4c 57 c1          jmp  para    ;ton-parameter aus basic holen
       c009 4c b1 c1          jmp  trend   ;nae.akkordeig.ton suchen
       c00c 4c d2 c1          jmp  hnext   ;ueberg.ton zu nae.harm.suchen
       c00f 4c 88 c2          jmp  zufall  ;zufalls-ton ermitteln
       c012 4c b0 c2          jmp  tempo   ;tempo aus basic holen
                      ;
                      ; definitionen --------------------
                      ;
       c015 00       h4       .byt 0       ;nr. 1/4-schlag im takt
       c016 00 00    fs       .byt 0,0     ;frequenz hauptschlag
       c018 00 00    fv       .byt 0,0     ;frequenz vorschlag
       c01a 00 00 00 save     .byt 0,0,0,0,0 ;save h4,fs,fv
                      ;
       c01f 00       t2       .byt 0       ;zeit-inkrement (1.vors.)
       c020 00       t3       .byt 0       ;      do.      (2.vors.)
       c021 00       t4       .byt 0       ;      do.      (haupts.)
                      ;
       c022 00       timer    .byt 0       ;zeit-zaehler
                      ;
       c023 00       pc       .byt 0       ;perc. attack/decay
                      ;
       c024 00 00    ha       .byt 0,0     ;akkordeig.toene akt.harmonie (lb/hb)
       c026 00 00    hanx     .byt 0,0     ;akkordeig.toene naechste harmonie
       c028 00       hg       .byt 0       ;nr.grundton akt.harmonie
       c029 00       tr       .byt 0       ;trend +/-1 (1,255)
       c02a 00       ta       .byt 0       ;nr.akt.ton
                      ;
                      ;and-masken fuer 2er-potenzen
       c02b 01 02 04 mask     .byt 1,2,4,8,16,32,64,128  ;lb(bit0-7)
       c033 01 02 04          .byt 1,2,4,8  ;hb(bit8-11)
                      ;
       c037          rb       =    251     ;run bass
       c037          rp       =    252     ;run percussion
                      ;
       c037          sid      =    54272   ;sid-reg.adr
       c037          random   =    $d012   ;pseudo-random-wert
       c037          irqex    =    $ea31   ;irq-rout.exit
       c037          chkcom   =    $aefd   ;check komma
       c037          chrout   =    $ffd2   ;char-output
       c037          getbyt   =    $b79e   ;holt 1-byte-wert ->reg.x
       c037          getvar   =    $b08b   ;variable suchen
       c037          typerr   =    $ad99   ;type-mismatch-error
       c037          getpar   =    $b1b2   ;holt 16-bit-parameter ->$64/65
       c037          frmevl   =    $ad9e   ;bel.ausdruck auswerten
       c037          frestr   =    $b6a3   ;string-verwaltung
                      ;
                      ; programm ------------------------
                      ;
                      ; irq-routine einschalten
                      ;
       c037 a9 54    init     lda  #<irq
       c039 a2 c0             ldx  #>irq
       c03b 78       vektor   sei
       c03c 8d 14 03          sta  $0314
       c03f 8e 15 03          stx  $0315
       c042 a9 00             lda  #0
       c044 85 fb             sta  rb
       c046 85 fc             sta  rp
       c048 8d 16 c0          sta  fs
       c04b 58                cli
       c04c 60                rts
                      ;
                      ;irq-rout. aus
                      ;
       c04d a9 31    exit     lda  #<irqex
       c04f a2 ea             ldx  #>irqex
       c051 4c 3b c0          jmp  vektor
                      ;
                      ;irq-einsprung
                      ;
       c054 a5 fb    irq      lda  rb
       c056 05 fc             ora  rp
       c058 f0 15             beq  tim
       c05a ee 22 c0          inc  timer
       c05d ad 22 c0          lda  timer
       c060 cd 1f c0          cmp  t2      ;check intervall-zeiten
       c063 f0 10             beq  playt2
       c065 cd 20 c0          cmp  t3
       c068 f0 2d             beq  playt3
       c06a cd 21 c0          cmp  t4
       c06d f0 57             beq  playt4
       c06f 8d 22 c0 tim      sta  timer
       c072 4c 31 ea return   jmp  irqex
                      ;
       c075 a9 00    playt2   lda  #0      ;1.vorschlag
       c077 8d 23 c0          sta  pc
       c07a ad 15 c0          lda  h4      ;kein 1.vorschlag, wenn ...
       c07d 30 f3             bmi  return  ;...h4=neg.
       c07f f0 f1             beq  return  ;...oder h4=0
       c081 29 01             and  #1
       c083 d0 ed             bne  return  ;...oder schlag=ungerade
       c085 ad 12 d0          lda  random
       c088 69 dc             adc  #220
       c08a b0 e6             bcs  return  ;...oder random-exit
       c08c a9 05             lda  #5
       c08e 8d 23 c0          sta  pc      ;hi-hat kurz
       c091 20 0d c1          jsr  perc
       c094 4c 72 c0          jmp  return
                      ;
       c097 ad 15 c0 playt3   lda  h4      ;2.vorschlag
       c09a 30 d6             bmi  return  ;kein 2.vors.wenn h4=neg
       c09c f0 d4             beq  return  ;...oder h4=0
       c09e 29 01             and  #1
       c0a0 f0 05             beq  p310
       c0a2 a9 05             lda  #5      ;hi-hat kurz,wenn...
       c0a4 8d 23 c0          sta  pc      ;...schlag=ungerade
       c0a7 20 0d c1 p310     jsr  perc    ;...oder 1.vors.ausgefuehrt
       c0aa ad 15 c0          lda  h4
       c0ad c9 02             cmp  #2
       c0af b0 c1             bcs  return  ;bass-vorschlag nur bei #1
       c0b1 ad 12 d0          lda  random
       c0b4 69 c8             adc  #200
       c0b6 b0 ba             bcs  return  ;random-exit
       c0b8 ad 19 c0          lda  fv+1    ;bass-vorschlag
       c0bb ac 18 c0          ldy  fv
       c0be f0 b2             beq  return  ;ton noch nicht bereit
       c0c0 20 27 c1          jsr  bass
       c0c3 4c 72 c0          jmp  return
                      ;
       c0c6 a2 05    playt4   ldx  #5      ;1/4-hauptschlag
       c0c8 ad 15 c0          lda  h4
       c0cb 29 01             and  #1
       c0cd f0 02             beq  p410
       c0cf a2 08             ldx  #8
       c0d1 8e 23 c0 p410     stx  pc
       c0d4 20 0d c1          jsr  perc
       c0d7 ad 17 c0          lda  fs+1    ;bass-hauptschlag
       c0da ac 16 c0          ldy  fs
       c0dd 20 27 c1          jsr  bass
       c0e0 a9 00             lda  #0
       c0e2 8d 22 c0          sta  timer   ;reset timer
       c0e5 8d 23 c0          sta  pc      ;reset perc.byte
       c0e8 ae 15 c0          ldx  h4
       c0eb f0 1d             beq  p600
       c0ed 8d 16 c0          sta  fs      ;freigeben freq-loc. wenn h4>0
       c0f0 8d 18 c0          sta  fv
       c0f3 ad c3 c2          lda  string
       c0f6 f0 12             beq  p600
       c0f8 a2 00             ldx  #0      ;string ausdrucken
       c0fa bd c3 c2 p500     lda  string,x
       c0fd f0 06             beq  p550
       c0ff 20 d2 ff          jsr  chrout
       c102 e8                inx
       c103 d0 f5             bne  p500
       c105 a9 20    p550     lda  #32
       c107 20 d2 ff          jsr  chrout
       c10a 4c 72 c0 p600     jmp  return
                      ;
       c10d a5 fc    perc     lda  rp      ;evtl.percussion ->sid
       c10f f0 15             beq  percex  ;->keine perc.
       c111 ad 23 c0          lda  pc
       c114 f0 10             beq  percex  ;->keine perc.
       c116 a9 80             lda  #128
       c118 8d 12 d4          sta  sid+18  ;vco#3 noise+gate
       c11b ad 23 c0          lda  pc
       c11e 8d 13 d4          sta  sid+19  ;vco#3 attack/decay
       c121 a9 81             lda  #129
       c123 8d 12 d4          sta  sid+18
       c126 60       percex   rts
                      ;
       c127 d0 07    bass     bne  bass10  ;evtl.bass ->sid
       c129 a9 2a             lda  #42     ;timing-fehler
       c12b 20 d2 ff          jsr  chrout
       c12e a9 ff             lda  #$ff
       c130 30 24    bass10   bmi  bassex  ;pause
       c132 a6 fb             ldx  rb
       c134 f0 20             beq  bassex  ;->kein bass
       c136 a2 20             ldx  #32
       c138 8e 04 d4          stx  sid+4   ;vco#1 saegezahn+gate
       c13b a2 40             ldx  #64
       c13d 8e 0b d4          stx  sid+11  ;vco#2 rechteck+sync+gate
       c140 8d 00 d4          sta  sid     ;vco#1 frequenz
       c143 8c 01 d4          sty  sid+1
       c146 8d 07 d4          sta  sid+7   ;vco#2 frequenz
       c149 8c 08 d4          sty  sid+8
       c14c a9 21             lda  #33
       c14e 8d 04 d4          sta  sid+4
       c151 a9 43             lda  #67
       c153 8d 0b d4          sta  sid+11
       c156 60       bassex   rts
                      ;
                      ;ton-parameter aus basic holen
                      ;
       c157 20 fd ae para     jsr  chkcom
       c15a 20 9e b7          jsr  getbyt  ;h4
       c15d 8e 1a c0          stx  save
       c160 20 b2 b1          jsr  getpar  ;haupt-freq-wert
       c163 a5 64             lda  $64
       c165 d0 02             bne  par10
       c167 a9 ff             lda  #$ff    ;aus null wird $ff
       c169 8d 1b c0 par10    sta  save+1  ;   hb
       c16c a5 65             lda  $65
       c16e 8d 1c c0          sta  save+2  ;   lb
       c171 20 b2 b1
       c174 a5 64             lda  $64
       c176 8d 1d c0          sta  save+3  ;   hb
       c179 a5 65             lda  $65
       c17b 8d 1e c0          sta  save+4  ;   lb
       c17e ad 16 c0 par20    lda  fs      ;check freq-loc.frei
       c181 f0 05             beq  par40   ;ja
       c183 ad 15 c0          lda  h4
       c186 d0 f6             bne  par20   ;warten wenn h4>0
       c188 a2 04    par40    ldx  #4
       c18a bd 1a c0 par60    lda  save,x  ;param.uebertragen
       c18d 9d 15 c0          sta  h4,x
       c190 ca                dex
       c191 10 f7             bpl  par60
                      ;
       c193 20 fd ae          jsr  chkcom  ;string holen
       c196 20 9e ad          jsr  frmevl
       c199 20 a3 b6          jsr  frestr
       c19c aa                tax
       c19d a0 00             ldy  #0
       c19f e8                inx
       c1a0 ca       par80    dex          ;string uebertragen
       c1a1 f0 08             beq  par90   ;string zu ende
       c1a3 b1 22             lda  ($22),y
       c1a5 99 c3 c2          sta  string,y
       c1a8 c8                iny
       c1a9 d0 f5             bne  par80
       c1ab a9 00    par90    lda  #0      ;mit null abschliessen
       c1ad 99 c3 c2          sta  string,y
       c1b0 60                rts
                      ;
                      ;naechsten ton im trend suchen
                      ;
       c1b1 20 3f c2 trend    jsr  getint  ;hole bit-muster ha%()
                      ;
       c1b4 8d 24 c0          sta  ha      ;l.b.
       c1b7 8e 25 c0          stx  ha+1    ;h.b.
       c1ba 20 3f c2          jsr  getint  ;hole trend tr%
       c1bd 8d 29 c0          sta  tr
       c1c0 20 3f c2          jsr  getint  ;hole ton-nr. ta%
       c1c3 8d 2a c0 tre010   sta  ta
       c1c6 ad 29 c0 tre020   lda  tr      ;ta+tr->ta
       c1c9 20 65 c2          jsr  chkakk  ;check ob akkordeigen
       c1cc f0 f8             beq  tre020  ;nein ->loop
       c1ce 20 59 c2          jsr  putta   ;ta% absp.
       c1d1 60                rts
                      ;
                      ;uebergangston zu nae.harmonie suchen
                      ;
       c1d2 20 3f c2 hnext    jsr  getint  ;hole ha%(h)
       c1d5 8d 24 c0          sta  ha
       c1d8 8e 25 c0          stx  ha+1
       c1db 20 3f c2          jsr  getint  ;hole ha%(hn)
       c1de 8d 26 c0          sta  hanx
       c1e1 8e 27 c0          stx  hanx+1
       c1e4 20 3f c2          jsr  getint  ;hole hg%(h)
       c1e7 8d 28 c0          sta  hg
       c1ea 20 3f c2          jsr  getint  ;hole hg%(hn)
       c1ed 8d 2a c0          sta  ta      ;->wird ta
       c1f0 20 3f c2          jsr  getint  ;hole tr%
       c1f3 8d 29 c0          sta  tr
       c1f6 20 3f c2          jsr  getint  ;hole ta%
       c1f9 8d 1a c0          sta  save    ;ta% saven
                      ;1.var.  suche nachbar-ton v.nae.grundton, ...
                      ;..der akkordeigen zu akt.harmonie ist
       c1fc a9 ff             lda  #255    ;ta-1->ta (-1/2 ton)
       c1fe 20 65 c2          jsr  chkakk  ;check ob akkordeigen
       c201 d0 32             bne  hnexit  ;->ja, neuer ton gefunden
       c203 a9 02             lda  #2      ;ta+2->ta (+1/2 ton)
       c205 20 65 c2          jsr  chkakk  ;check ob akkordeigen
       c208 d0 2b             bne  hnexit  ;->ja, neuer ton gefunden
       c20a a9 fd             lda  #253    ;ta-3->ta (-1 ton)
       c20c 20 65 c2          jsr  chkakk  ;check ob akkordeigen
       c20f d0 24             bne  hnexit  ;->ja, neuer ton gefunden
       c211 a9 04             lda  #4      ;ta+4->ta (+1 ton)
       c213 20 65 c2          jsr  chkakk  ;check ob akkordeigen
       c216 d0 1d             bne  hnexit  ;->ja, neuer ton gefunden
                      ;2.var.  suche ton, der fuer beide harm. akkordeigen
       c218 ad 24 c0          lda  ha
       c21b 2d 26 c0          and  hanx
       c21e 8d 24 c0          sta  ha
       c221 ad 25 c0          lda  ha+1
       c224 2d 27 c0          and  hanx+1
       c227 8d 25 c0          sta  ha+1
       c22a 0d 24 c0          ora  ha      ;check ob gemeins.toene
       c22d d0 0a             bne  hne020  ;->ja
       c22f ad 28 c0          lda  hg      ;nein, grundton nehmen
       c232 8d 2a c0          sta  ta
       c235 20 59 c2 hnexit   jsr  putta   ;ta% absp.
       c238 60                rts
                      ;
       c239 ad 1a c0 hne020   lda  save    ;ta% holen und laut trend...
       c23c 4c c3 c1          jmp  tre010  ;...gemeins.akkord-ton suchen
                      ;
                      ;hole integer aus basic
                      ;
       c23f 20 fd ae getint   jsr  chkcom  ;komma
       c242 20 8b b0          jsr  getvar  ;var.suchen
       c245 85 49             sta  $49     ;var.adr. absp.
       c247 84 4a             sty  $4a
       c249 a5 0e             lda  $0e     ;check ob integer
       c24b f0 09             beq  geterr  ;->nein, error
       c24d a0 00             ldy  #0
       c24f b1 49             lda  ($49),y  ;var.wert holen
       c251 aa                tax          ;h.b. ->reg.x
       c252 c8                iny
       c253 b1 49             lda  ($49),y  ;l.b. ->reg.a
       c255 60                rts
                      ;
       c256 4c 99 ad geterr   jmp  typerr  ;error
                      ;
                      ;ta% als basic-integer-var. absp.
                      ;
       c259 a9 00    putta    lda  #0
       c25b a8                tay
       c25c 91 49             sta  ($49),y  ;h.b.
       c25e ad 2a c0          lda  ta
       c261 c8                iny
       c262 91 49             sta  ($49),y  ;l.b.
       c264 60                rts
                      ;
                      ;check ob ton nr.(ta)+reg.a  = akkordeigen
                      ;in  reg.a=inkr./dekr. auf ta
                      ;
       c265 18       chkakk   clc
       c266 6d 2a c0          adc  ta      ;ta+inkr/dekr ->ta
       c269 10 03             bpl  cak010  ;check ob ta im bereich 0...11
       c26b 18                clc
       c26c 69 0c             adc  #12     ;...sonst korrektur
       c26e c9 0c    cak010   cmp  #12
       c270 90 03             bcc  cakbit
       c272 38                sec
       c273 e9 0c             sbc  #12
                      ;
       c275 8d 2a c0 cakbit   sta  ta      ;bit f.akt.ton holen
       c278 aa                tax
       c279 bd 2b c0          lda  mask,x  ;and-maske holen
       c27c a0 00             ldy  #0
       c27e e0 08             cpx  #8      ;check ob l.b. oder h.b
       c280 90 02             bcc  cak030  ;->l.b.
       c282 a0 01             ldy  #1      ;h.b.
       c284 39 24 c0 cak030   and  ha,y    ;bit aus akt.harm.extrahieren
       c287 60                rts
                      ;
                      ; zufalls-ton ermitteln
                      ;
       c288 20 3f c2 zufall   jsr  getint  ;hole ha%(h)
       c28b 8d 24 c0          sta  ha      ;l.b.
       c28e 8e 25 c0          stx  ha+1    ;h.b.
       c291 20 3f c2          jsr  getint  ;hole ta%
       c294 20 75 c2          jsr  cakbit  ;bit f.akt.ton holen
       c297 49 ff             eor  #$ff    ;...und loeschen
       c299 39 24 c0          and  ha,y    ;...damit nicht nochmals
       c29c 99 24 c0          sta  ha,y    ;...gleicher ton kommt.
       c29f ad 12 d0          lda  random  ;zufalls-zahl + ta ->ta
       c2a2 29 07             and  #7
       c2a4 d0 02             bne  zuf030
       c2a6 a9 01    zuf020   lda  #1
       c2a8 20 65 c2 zuf030   jsr  chkakk  ;check ob akk.eigen
       c2ab f0 f9             beq  zuf020  ;->nein, weiter suchen
       c2ad 4c 59 c2          jmp  putta   ;ja, ta% als basic-var.absp.
                      ;
                      ; tempo aus basic holen
                      ;
       c2b0 20 3f c2 tempo    jsr  getint  ;hole t2% (1.vorschlag)
       c2b3 8d 1f c0          sta  t2
       c2b6 20 3f c2          jsr  getint  ;hole t3% (2.vorschlag)
       c2b9 8d 20 c0          sta  t3
       c2bc 20 3f c2          jsr  getint  ;hole t4% (1/4-hauptschlag)
       c2bf 8d 21 c0          sta  t4
       c2c2 60                rts
                      ;
       c2c3          string   =    *
Listing 3. Das Quellcode-Listing zu »BASS/IRQ«
PDF Diesen Artikel als PDF herunterladen
Mastodon Diesen Artikel auf Mastodon teilen
← Vorheriger ArtikelNächster Artikel →