home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1987 August
/
1987-08.d64
/
dyna-translator
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
4KB
|
110 lines
10 rem copyright 1987 compute! publications, inc. - all rights reserved
20 ln=8000
30 goto100
40 pokes+1,70:pokes+5,7:pokes+4,17:gosub60:return
50 pokes+1,6:pokes+5,9:pokes+4,33:gosub60:return
60 forj=1to25:next:forj=stos+5:pokej,0:next:return
70 getx$:ifx$=""then70
80 return
90 t$=str$(t):t$=right$(t$,len(t$)-1):return
100 poke53281,0:poke53280,0:printchr$(14)"
110 [153]"loadlist lenopyright 1987 len(NULL)(NULL)(NULL)(NULL)(NULL)val! (NULL)ub., right$nc."
120 [153][163]9)"atnll (NULL)ights (NULL)eserved"
130 [153]"cont(NULL)hat is the octave?":s[178]54272:[151]s[170]24,15:z$[178]""
140 [153]"left$it","print#0 thru 7cont","to indicate":[153],,"octave number."
150 [153],"print#(NULL)val(NULL)(NULL)(NULL)(NULL)cont","to indicate a rest.":[153],"print#(NULL)cont","to quit."
160 [153]z$"(NULL)iddle len begins octave 4, which runs upward to include ";
170 [153]"the peek above middle len. (NULL)he octave above is 5 and the octave "
180 [153]"below middle len is 3, etc.cont
190 gosub70:c$=x$:ifc$<>"q"then280
200 print"[147][197]nter [152][217][154] if you really want to quit."
210 gosub70:ifx$<>"y"thenprint"[147]":goto130
220 print"[147][212]he entry stage is complete."
230 print"[200]it [152][195][154] to cycle the music over and over.
240 [153]"atnny other key to play the music once each time it is called."
250 [141]70:l$[178]"0":h$[178]"0":u$[178]"0"
260 [139]x$[178]"c"[167]l$[178]"1"
270 [141]40:[137]830
280 c[178][197](c$):[139]c$[178][199](13)[167]:c$[178]"rest":l[178]0:h[178]0:[141]40:[137]410
290 [139]c$[179]"0"[176]c$[177]"7"[167][141]50:[137]190
300 [141]40:[153]"load"z$"on(NULL)ctave is"c
310 [153]"contvalnter the letter name of the note
320 print"followed by an '[152]s[154]' for a sharp or an '[152]f[154]'for a flat.
330 [153]"(NULL)eep all entries lower case.
340 input"[215]hat is the note";n$
350 forj=0to16:reada$,n:ifn$=a$then390
360 next:restore:gosub50
370 print"[208]lease enter:","[152]c,cs,df,d,ds,ef,e,f",,,"fs,g,gs,af,a,bf,or b[154]"
380 goto340
390 gosub40:x=asc(left$(n$,1)):x=x+128:w$=chr$(x):n$=w$+mid$(n$,2,1)
400 q=440*1.05946309^(n-10)*2^(c-4):v=q/.06096:h=int(v/256):l=int(v-(h*256))
410 print"[147]"z$"[214]alid entries are: [152]1,2,4,8,16,32,or 64[154]"
420 print"[152]1[154] for a whole note or rest."
430 print"[152]4[154] for a quarter note or rest."
440 print"[152]32[154] for a 32nd note or rest, etc."
450 print"[208]lace a period after the number to dot it. [196]otted notes";
460 print" are held half again as long as undotted notes.[154]"
470 printz$"[197]nter [152][196][154] to bypass the above process, so you calculate the";
480 print" [152]d[154]uration and place it directly in the created data statement."
490 print" [208]lease enter the note or rest value."
500 input u$:u=val(u$)
510 ifu$><"d"then570
520 print"[147][197]nter your calculated duration."
530 inputdr$
540 dr=val(dr$)
550 ifdr<0ordr>255thengosub50:goto520
560 goto620
570 forj=0to6:if2^j=uthen600
580 next
590 gosub50:goto490:rem reject
600 u=128/u:rem accept
610 ifright$(u$,1)="."thenu=u*1.5
620 gosub40:print"[147][200]ere is your note:"
630 print"[207]ctave "c$"[154][206]ote "n$"[154][214]alue ";
640 ifdrthenprint"[154][157][157][157][157][157][157][196]uration"dr:goto670
650 ifu$="1"thenprint"1":goto670
660 print"1/"u$
670 print"[154][200]it","[152][210][197][212][213][210][206][154]","to add the data line",,"to the program.
680 [153],"print#valcont","to erase this data.
690 print"[152]","[210][154]","to add a remark to",,,"the data line.
700 [141]70:d$[178]x$
710 [139]d$[178]"r"[176]d$[178][199](13)[167]740
720 [139]d$[178]"e"[167][141]40:[153]"load"z$:[140]:[137]130
730 [141]50:[153]"valnter print#(NULL)val(NULL)(NULL)(NULL)(NULL), val, or (NULL)cont":[137]700
740 [141]40:[141]40:t[178]l:[141]90:l$[178]t$
750 t[178]h:[141]90:h$[178]t$
760 [139]dr[167]u[178]dr
770 t[178]u:[141]90:u$[178]t$
780 [139]d$[179][177]"r"[167]830
790 [153]"load"z$"(NULL)aximum remark length 50 characters.
800 input"[215]hat is your remark";r$
810 iflen(r$)>49thengosub50:goto800
820 gosub40:r$=":rem "+r$
830 print"[147]"ln"data"l$","h$","u$;r$
840 print"[144]ln="ln+1;
850 ifc$="q"then print":goto880":goto870
860 print":goto130"
870 poke631,13:poke632,13:poke198,2:end
880 s=54272:print"[154][214]alue to multiply each note duration by 1[157][157][157]";
890 inputm
900 print"[215]ant music poked to [210][193][205]?"
910 gosub70:ifx$="y"thengosub960
920 print"[215]ant music file saved?":gosub70:ifx$="y"thengosub1020
930 end
940 datac,1,cs,2,df,2,d,3,ds,4,ef,4,e,5,es,6,f,6,fs,7,g,8
950 datags,9,af,9,a,10,as,11,bf,11,b,12
960 input"[154][193]ddress to poke music 40960[157][157][157][157][157][157][157]";b$:b=val(b$)
970 ifb<820orb>65535thengosub50:goto960
980 print"[154][196]ata is being poked":print"starting at line"b:j=b:gosub1090
990 gosub1010:pokej,l:pokej+1,h:pokej+2,u:j=j+3:ifu>0then990
1000 print"[197]nding address is"j:print"music is in memory.":restore:return
1010 readl,h,u:u=u*m:return
1020 input"[206]ame of saved file";nf$
1030 print"[147][193]ddress you want this file to load at later 40960[157][157][157][157][157][157][157]";
1040 input ad$:ad=val(ad$):ifad<819orad>65536thengosub50:goto1040
1050 hb=int(ad/256):lb=ad-256*hb:open2,8,2,"0:"+nf$+",p,w"
1060 print#2,chr$(lb);chr$(hb);:gosub1090
1070 gosub1010:print#2,chr$(l);chr$(h);chr$(u);:ifu>0then1070
1080 close2:print"[211]ave complete.":return
1090 fori=1to34:readu$:next:return