Re: S.A.M. Software Automated Mouth [message #371766] |
Sun, 05 August 2018 23:29 |
|
Originally posted by: inexorabletash
I poked around a bit with S.A.M. and ProDOS. If you grab the disk from Asimov and copy just the SAM file over, you can use the following mini version of "SAYIT" this from BASIC.SYSTEM:
10 PRINT CHR$ (4)"BLOAD SAM,A$4000"
30 SAM = 16384:SP = SAM + 9:PI = SAM + 10:ER = SAM + 11
35 EC = SAM + 12:RE = SAM + 13:BP = SAM + 14
40 SS = 60:PP = 72
50 POKE SP,SS: POKE PI,PP
55 FOR I = 0 TO 6: READ B: POKE 768 + I,B: NEXT
56 POKE EC,0: POKE RE,255: POKE BP,0
100 INPUT "> ";A$
110 GOSUB 500
120 GOTO 100
500 POKE BP,0
510 PRINT CHR$ (4)"PR#A$300": PRINT A$: PRINT CHR$ (4)"PR#0"
520 RETURN
1000 DATA 216,120,32,38,65,88,96
$4000, $4003 and $4006 are jumps to SAM routines; I haven't looked at the second two, and we'll just bypass the first. Then there is a data block:
SPEED = $4009
PITCH = $400A
ERROR = $400B (set after call if an error occurred)
ECHO = $400C (if set, echo to COUT)
REC = $400D (if set, reciter mode; else phoneme mode)
BUFPOS = $400E
STASH = $400F
BUFFER = $4010 ... $410F
.... and the character hook is at $4126.
The BASIC program above pokes a short ML relay into $300:
CLD ; Tell ProDOS this is a real handler
SEI ; Cargo culted from a HRCG example
JSR $4126 ; Call S.A.M.
CLI ; Cargo culted
RTS
This allows PR#A$300 to attach S.A.M., PR#0 to detach.
The BASIC program sets SPEED and PITCH with pokes like SAYIT does. It then sets up ECHO, REC, and BUFPOS like a call to $4000 would, but $4000 also hooks $36/37 which we don't want.
You can control ECHO and REC via control characters:
CHR$(5) - sets ECHO
CHR$(14) - clears ECHO
CHR$(20) - sets REC
CHR$(16) - clears REC
CHR$(13) - (i.e. carriage return) flush the buffer
REC is Reciter Mode. The S.A.M. manual on Asimov (which details a very different API, but the concepts are the same) describes it in detail. With Reciter Mode enabled, you can use english words and S.A.M. will infer phonemes using $MAGIC. With Reciter Mode disabled, you need to use explicit phonemes, e.g. CHR$(16);"AE4PUL TUX4 FOH4EH2ER4" (tables/examples in the manual)
(Adapting the real SAYIT should be trivial, I just wanted a stand-alone example.)
|
|
|
|
Re: S.A.M. Software Automated Mouth [message #371808 is a reply to message #371766] |
Tue, 07 August 2018 04:24 |
|
Originally posted by: James Davis
On Sunday, August 5, 2018 at 8:29:31 PM UTC-7, inexora...@gmail.com wrote:
> ...
> The BASIC program above pokes a short ML relay into $300:
>
> CLD ; Tell ProDOS this is a real handler
> SEI ; Cargo culted from a HRCG example
> JSR $4126 ; Call S.A.M.
> CLI ; Cargo culted
> RTS
>
> This allows PR#A$300 to attach S.A.M., PR#0 to detach.
This is very interesting! I did not know that one could redirect output to a memory address with PR# like this. Does this also work for redirecting input (IN#) from a memory address? I thought these commands were just for slot numbers. Cool!!
|
|
|
Re: S.A.M. Software Automated Mouth [message #371816 is a reply to message #371808] |
Tue, 07 August 2018 09:24 |
Steve Nickolas
Messages: 2036 Registered: October 2012
Karma: 0
|
Senior Member |
|
|
On Tue, 7 Aug 2018, James Davis wrote:
> On Sunday, August 5, 2018 at 8:29:31 PM UTC-7, inexora...@gmail.com wrote:
>> ...
>> The BASIC program above pokes a short ML relay into $300:
>>
>> CLD ; Tell ProDOS this is a real handler
>> SEI ; Cargo culted from a HRCG example
>> JSR $4126 ; Call S.A.M.
>> CLI ; Cargo culted
>> RTS
>>
>> This allows PR#A$300 to attach S.A.M., PR#0 to detach.
>
> This is very interesting! I did not know that one could redirect output to a memory address with PR# like this. Does this also work for redirecting input (IN#) from a memory address? I thought these commands were just for slot numbers. Cool!!
>
It does indeed.
I've used it with character generators.
-uso.
|
|
|
Re: S.A.M. Software Automated Mouth [message #371823 is a reply to message #371808] |
Tue, 07 August 2018 10:10 |
|
Originally posted by: Brian Patrie
On 2018-08-07 03:24, James Davis wrote:
> On Sunday, August 5, 2018 at 8:29:31 PM UTC-7, inexora...@gmail.com wrote:
>> ...
>> The BASIC program above pokes a short ML relay into $300:
>>
>> CLD ; Tell ProDOS this is a real handler
>> SEI ; Cargo culted from a HRCG example
>> JSR $4126 ; Call S.A.M.
>> CLI ; Cargo culted
>> RTS
>>
>> This allows PR#A$300 to attach S.A.M., PR#0 to detach.
>
> This is very interesting! I did not know that one could redirect output to a memory address with PR# like this. Does this also work for redirecting input (IN#) from a memory address? I thought these commands were just for slot numbers. Cool!!
Yes, it works for IN# as well. Note, though, that this is a ProDOS
BASIC (BASIC.system) thing; it doesn't work in DOS 3.3.
|
|
|