[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Something resembling GWBASIC's PLAY but not as powerful
- Subject: Something resembling GWBASIC's PLAY but not as powerful
- From: Steve Nickolas <lyricalnanoha@usotsuki.hoshinet.org>
- Date: Fri, 17 Jun 2011 16:32:49 +0200
- Cancel-lock: sha1:vDnTs19GrVDQe+7tJN/eq/UkHXE=
- Injection-info: mx04.eternal-september.org; posting-host="9lgKLALj8gN9hcDcrT2RUg"; logging-data="11559"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18alm8fbZEfdCB+ekmWnopSgwar+LvJu/w="
- Newsgroups: comp.sys.apple2
- Organization: A noiseless patient Spider
- User-agent: Alpine 2.00 (DEB 1167 2008-08-23)
- Xref: g2news2.google.com comp.sys.apple2:24071
This was a test for some backporting I'm considering doing. Since I don't
have the PLAY command which it uses exclusively for sound, I came up with
this (based on some code I saw at
http://eightbitsoundandfury.ld8.org/programming.html). The routine
mentioned there is relocated up two bytes so I can use 0300 and 0301 for
something else. Basically, it has a crude hex decoder, that uses a
slightly different set of values for A-F: ascii 58-63 (3A-3F). The sound
commands are basically the P/D values encoded this way (where the D is
relative to 'quarter' notes as they needed to be handled for the code I
was working on). And yes, it sounds a bit staccato compared to the
original version.
-uso.
10 GOSUB 60000
20 S$="5544<44044045544<44024044<45545544<4554802":GOSUB 60010
59999 END
60000 REM INSTALL SOUND ROUTINE
60001 P$=":=30<088=005<>0303?009<:=0?5:>02034<040360"
60002 FOR T=1 TO LEN(P$) STEP 2
60003 V=((ASC(MID$(P$,T,1))-48)*16)+(ASC(MID$(P$,T+1,1))-48)
60004 POKE 772+INT(T/2),V
60005 NEXT T
60006 RETURN
60010 REM PLAY SOUND
60011 FOR T=1 TO LEN(S$) STEP 3
60012 V=((ASC(MID$(P$,T,1))-48)*16)+(ASC(MID$(P$,T+1,1))-48)
60013 D=ASC(MID$(P$,T+2,1))-48
60014 POKE 770,V:POKE 771,255/D
60015 CALL 772
60016 NEXT T:RETURN