Spéech with the Quill and using Star commands Option p in menu

reminisce about bbc micro & electron games like chuckie egg, repton, elite & exileRelated forum: adventures


Post Reply
Rfairman
Posts: 29
Joined: Mon Jul 15, 2019 7:58 am
Contact:

Spéech with the Quill and using Star commands Option p in menu

Post by Rfairman » Mon Aug 12, 2019 3:25 pm

Does anyone have experience setting up Star Commands in the Quill. I am tryong to incorprate speech in a adventure game i am writing using Suoerior Software Speech! Program The command to use speech is *SAY. Or indirectly you use use OCSLI *SAY

User avatar
Yrrah2
Posts: 378
Joined: Tue Feb 06, 2007 6:06 pm
Location: Netherlands
Contact:

Re: Spéech with the Quill and using Star commands Option p in menu

Post by Yrrah2 » Mon Aug 12, 2019 4:22 pm

It has been a long while since I was busy with Quill.

But I think it should be possible.
You have to create a message number with the command you would like to use.
So you use the STAR command within quill and then de message number.
And this message number should be (I think) 'SAY hello'

The manual says :

Code: Select all

 STAR mesno.
	This action sends the commands contained within the message text to the command line 
	interpreter. This allows the program access to all '*' commands, and its main use is to load 
	sections of a multi-part adventure. If the message mesno. does not contain a '*' as the first 
	character then the action DONE is performed.
Never tried it though.

Cheers

Koen
Happy with my BBC Master
www.mybbcmaster.nl

User avatar
lurkio
Posts: 2147
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Spéech with the Quill and using Star commands Option p in menu

Post by lurkio » Mon Aug 12, 2019 5:01 pm

Yrrah2 wrote:
Mon Aug 12, 2019 4:22 pm
You have to create a message number with the command you would like to use.
So you use the STAR command within quill and then de message number.
Just thought I'd give this a quick go...

Yrrah2 wrote:
Mon Aug 12, 2019 4:22 pm
And this message number should be (I think) 'SAY hello'
I used *SAY hello -- i.e. I included the asterisk as per the manual.

I added a line to the FINI * entry in the Status table (in the tutorial game) so that the word "Congratulations" is spoken when you win the game.

Play online:

It basically works, but the drawback is that the *SAY command is actually printed on screen!:

1.png

Also, you have to make sure that your game database isn't so big that it overwrites the SPEECH program, which is resident in user RAM starting at &5500.

:idea:
Last edited by lurkio on Mon Aug 12, 2019 5:16 pm, edited 1 time in total.

User avatar
Yrrah2
Posts: 378
Joined: Tue Feb 06, 2007 6:06 pm
Location: Netherlands
Contact:

Re: Spéech with the Quill and using Star commands Option p in menu

Post by Yrrah2 » Mon Aug 12, 2019 6:35 pm

[EDITED]
Thought you could switch colours? Not quite sure.
Try the Speech Rom. Then you don't have to worry about the memory.

Speech!-1.03.rom
(8 KiB) Downloaded 1 time

You have to change the !BOOT file bit :

Code: Select all

*BASIC
*SPEECH
*SAY LOADING
*RUN RUNME2
Cheers

Koen
Last edited by Yrrah2 on Mon Aug 12, 2019 6:45 pm, edited 4 times in total.
Happy with my BBC Master
www.mybbcmaster.nl

User avatar
AndyF
Posts: 1270
Joined: Sat Feb 23, 2008 10:16 pm
Location: Derby
Contact:

Re: Spéech with the Quill and using Star commands Option p in menu

Post by AndyF » Mon Aug 12, 2019 8:55 pm

Untested (do it on a backup!) try if you can padding the command out with some spaces then edit the file or the disc directly to do a backspace or change the colours. I think it may try to screen out Teletext control codes although I've never really looked into this, it would be possible to stop it doing that though I guess.

Only slight caveat with using * commands is there is not really a memory check (as such) so its not impossible to overwrite your own data if said command does something, a good example here is being silly and with a database loaded trying to do a *compact :oops:
Andy

* NEW * The Jetset Willy and Manic Miner community :)

Adventure games ported across to the BBC (in progress) as soon as I can find some time!

User avatar
Dave Footitt
Posts: 800
Joined: Thu Jun 22, 2006 9:31 am
Location: Abandoned Uranium Workings
Contact:

Re: Spéech with the Quill and using Star commands Option p in menu

Post by Dave Footitt » Mon Aug 12, 2019 10:00 pm

Don't forget you can also write a very simple routine of your own in order to do the *SAY command, then JSR to it from the Quill.

You can put a phrase number in one of the flags then read that value in your custom routine.

User avatar
lurkio
Posts: 2147
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Spéech with the Quill and using Star commands Option p in menu

Post by lurkio » Tue Aug 13, 2019 9:32 am

Dave Footitt wrote:
Mon Aug 12, 2019 10:00 pm
Don't forget you can also write a very simple routine of your own in order to do the *SAY command, then JSR to it from the Quill.

You can put a phrase number in one of the flags then read that value in your custom routine.
The problem with that approach is that the messages, which are stored in RAM above &2600, are compressed. So your custom machine-code routine would have to know how to decompress them before passing them to the *SAY command.

:?:

EDIT: Or are you saying that you should store the "phrases" outside the Quill's database?
Last edited by lurkio on Tue Aug 13, 2019 11:37 am, edited 1 time in total.

User avatar
Dave Footitt
Posts: 800
Joined: Thu Jun 22, 2006 9:31 am
Location: Abandoned Uranium Workings
Contact:

Re: Spéech with the Quill and using Star commands Option p in menu

Post by Dave Footitt » Tue Aug 13, 2019 11:42 am

lurkio wrote:
Tue Aug 13, 2019 9:32 am
The problem with that approach is that the messages, which are stored in RAM above &2600, are compressed. So your custom machine-code routine would have to know how to decompress them before passing them to the *SAY command.
Rather I meant store the phrase in a flag as a number (which you can read easily) and decode that number to a phrase using a small lookup table:

Code: Select all

  LDA flag ; read one of the flags in Quill which you set from within Quill using eg LET
  ASL
  TAX
  LDA phraseTable,X
  STA &70
  LDA phraseTable+1,X
  STA &71
   
   ; &70/&71 now point to the phrase to say, pass this to OSCLI along with *SAY
   
   RTS

.phraseTable:
  EQUW one
  EQUW two
  ..

.one:
 EQUS "CONGRATULATIONS",0

.two:
 EQUS "SORRY",0
 
 
At least that works in my head, might be totally wrong in practice!

User avatar
lurkio
Posts: 2147
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Spéech with the Quill and using Star commands Option p in menu

Post by lurkio » Tue Aug 13, 2019 12:03 pm

Dave Footitt wrote:
Tue Aug 13, 2019 11:42 am
Rather I meant store the phrase in a flag as a number (which you can read easily) and decode that number to a phrase using a small lookup table
Thanks. Makes sense.

As I'm rubbish at assembler, could you explain why you've got an ASL instruction in the code, please?

:oops: :?:

User avatar
Dave Footitt
Posts: 800
Joined: Thu Jun 22, 2006 9:31 am
Location: Abandoned Uranium Workings
Contact:

Re: Spéech with the Quill and using Star commands Option p in menu

Post by Dave Footitt » Tue Aug 13, 2019 1:54 pm

lurkio wrote:
Tue Aug 13, 2019 12:03 pm
As I'm rubbish at assembler, could you explain why you've got an ASL instruction in the code, please?
The ASL shifts the accumulator left one bit, which has the effect of multiplying the contents by 2. Because the lookup table is a table of pointers to strings each of these are 2 bytes. So for eg phrase 2 (assuming we count from 0), you want the table offset to be 4:

Code: Select all

.phraseTable:

 EQUW one ; 2 bytes, offset 0
 EQUW two ; 2 bytes, offset 2
 EQUW three ; 2 bytes, offset 4
So we first load the zero-based phrase number into A, then multiply it by 2 before putting it into X to use as the table offset:

Code: Select all

LDA flagAddr
ASL A
TAX
Then simply get the 2 bytes from the table into &70/&71 ready for loading string data. I mean you could even include *SAY in there but it's a bit wasteful. I've terminated the strings with 13 now as I think that's what OSCLI expects but I can't remember:

Code: Select all

.one:
 EQUS "*SAY HELLO",13
.two:
 EQUS "*SAY GOODBYE",13
.three:
 EQUS "*SAY CONGRATULATIONS",13
 
Hope that helps!
Last edited by Dave Footitt on Tue Aug 13, 2019 2:02 pm, edited 2 times in total.

User avatar
Yrrah2
Posts: 378
Joined: Tue Feb 06, 2007 6:06 pm
Location: Netherlands
Contact:

Re: Spéech with the Quill and using Star commands Option p in menu

Post by Yrrah2 » Wed Aug 14, 2019 5:54 am

So what if I'm correct, you make the messages you want to speak with *SAY are placed in the machine code memory.
I don't know what Rfairman wants, but would it me neater that you can *SAY a message from the messages from Quill?
So that you give in Quill the JSR (if I'm correct) command for the machine code with a message number so *SAY is been executed from the machine code with the message to be spoken from the Quill database.

Or am I talking rubbish now?
Happy with my BBC Master
www.mybbcmaster.nl

User avatar
Dave Footitt
Posts: 800
Joined: Thu Jun 22, 2006 9:31 am
Location: Abandoned Uranium Workings
Contact:

Re: Spéech with the Quill and using Star commands Option p in menu

Post by Dave Footitt » Wed Aug 14, 2019 7:00 am

Yes that's correct - I'll quit being lazy and just copy in a full program :D Note that you don't actually need &70/&71 since OSCLI expects its parameters in the X and Y registers. Don't forget to have the Speech ROM installed :D

This can be loaded in, then called from within the Quill by:

Code: Select all

JSR 0 11
Program code follows (BeebAsm format):

Code: Select all

ORG &B00
GUARD &C00
OSCLI = &FFF7

.start:
 LDA #2 ; This can load any Quill flag (located at &500 - &540)
 ASL A
 TAX
 LDA phraseTable+1,X
 TAY
 LDA phraseTable,X
 TAX
 JSR OSCLI
 RTS

.phraseTable:
 EQUW one
 EQUW two
 EQUW three
 EQUW four

.one:
 EQUS "SAY HELLO",13

.two:
 EQUS "SAY GOODBYE",13

.three:
 EQUS "SAY YOU DIED",13

.four:
 EQUS "SAY CONGRATULATIONS",13

.end:
 PRINT "Bytes used: ",end-start
 SAVE  "phrase",start,end

User avatar
lurkio
Posts: 2147
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Spéech with the Quill and using Star commands Option p in menu

Post by lurkio » Wed Aug 14, 2019 8:27 am

Yrrah2 wrote:
Wed Aug 14, 2019 5:54 am
So what if I'm correct, you make the messages you want to speak with *SAY are placed in the machine code memory.
Yes, that's how Dave's code works.

Yrrah2 wrote:
Wed Aug 14, 2019 5:54 am
would it me neater that you can *SAY a message from the messages from Quill? So that you give in Quill the JSR (if I'm correct) command for the machine code with a message number so *SAY is been executed from the machine code with the message to be spoken from the Quill database.
That would be ideal, but, as I said above, the messages in the Quill database aren't in plain text -- they're compressed. So Dave's custom machine-code routine would have to be modified to first decompress the message from the Quill database before *SAYing it. That's a bit more complicated than Dave's current solution.

:idea:

Rfairman
Posts: 29
Joined: Mon Jul 15, 2019 7:58 am
Contact:

Re: Spéech with the Quill and using Star commands Option p in menu

Post by Rfairman » Wed Aug 14, 2019 10:20 am

Hi lurkio
Can i be cheeky and ask for the Database file for Quill that you used to test speech

thanks a lot

richard fairman

User avatar
lurkio
Posts: 2147
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Spéech with the Quill and using Star commands Option p in menu

Post by lurkio » Wed Aug 14, 2019 10:38 am

Rfairman wrote:
Wed Aug 14, 2019 10:20 am
Hi lurkio
Can i be cheeky and ask for the Database file for Quill that you used to test speech
Sure. You should be able to get the disc-image that contains the Quill database file if you copy the “Play online” link in my first post in this thread and then edit the link by deleting everything from the beginning of the link up to and including the "=" character (that’s just before the second “http”). So everything from the second “http” onwards will give you a link to the .SSD disc-image that you’re looking for.

:idea:
Last edited by lurkio on Wed Aug 14, 2019 10:39 am, edited 1 time in total.

Rfairman
Posts: 29
Joined: Mon Jul 15, 2019 7:58 am
Contact:

Re: Spéech with the Quill and using Star commands Option p in menu

Post by Rfairman » Wed Aug 14, 2019 1:13 pm

Thanks have down downloaded ssd
regards
Richard Fairman

User avatar
lurkio
Posts: 2147
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Spéech with the Quill and using Star commands Option p in menu

Post by lurkio » Wed Aug 14, 2019 11:34 pm

Dave Footitt wrote:
Wed Aug 14, 2019 7:00 am
... a full program ... OSCLI expects its parameters in the X and Y registers ... This can be loaded in, then called from within the Quill by:

Code: Select all

JSR 0 11
Program code follows (BeebAsm format): ...
Here's the code in Beeb assembler format. See below. This runs and assembles in BeebEm in Model B mode. Note that a peculiarity of the SPEECH code is that you have to include the asterisk in the command, so OSCLI "SAY HELLO" gives a "Bad command" error but OSCLI "*SAY HELLO" works.

Code: Select all

   10 oscli = &FFF7
   20 FORO=0TO3STEP3
   30 P%=&B00
   40 [
   50 OPT O
   60 .start:
   70  LDA &50A ; This can load any Quill flag (located at &500 - &540)
   80  ASL A
   90  TAX
  100  LDA phraseTable+1,X
  110  TAY
  120  LDA phraseTable,X
  130  TAX
  140  JSR oscli
  150  RTS
  160 .phraseTable:
  170  EQUW one
  180  EQUW two
  190  EQUW three
  200  EQUW four
  210 .one:
  220  EQUS "*SAY HUUUUUUUNNGGRREEEEEEEEEEEEEEE"+CHR$13
  230 .two:
  240  EQUS "*SPEAK AA1AA1AA2AA2AA3AA3AA4AA4AA5AA5AA6AA6AA7AA8AE8NNNNN8ZH8ZH8/H8"+CHR$13
  250 .three:
  260  EQUS "*SAY YOU DIED"+CHR$13
  270 .four:
  280  EQUS "*SAY CONGRATULATIONS"+CHR$13
  290 .end
  300 ]
  310 NEXT
  320 PRINT "Bytes used: ";STR$~(end-start)
  330 REM *SAVE MC B00+<length>

Play online:
:idea:
Last edited by lurkio on Thu Aug 15, 2019 2:56 pm, edited 3 times in total.

Rfairman
Posts: 29
Joined: Mon Jul 15, 2019 7:58 am
Contact:

Re: Spéech with the Quill and using Star commands Option p in menu

Post by Rfairman » Thu Aug 15, 2019 6:38 pm

Thanks for that
I'm not familiar with assembly code How does JSR 0 11 in the * fini section point to the subroutine * say congratulations in the machine code
Please be patient
Regards
Richard Fairman

User avatar
lurkio
Posts: 2147
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Spéech with the Quill and using Star commands Option p in menu

Post by lurkio » Thu Aug 15, 2019 7:15 pm

Rfairman wrote:
Thu Aug 15, 2019 6:38 pm
I'm not familiar with assembly code How does JSR 0 11 in the * fini section point to the subroutine * say congratulations in the machine code
The short answer is that it doesn't (strictly speaking)!

Have a look at the status table in the Quill database for the tutorial game: it's the file DBD4 on the .SSD disc-image in the "Play online" link in my previous post.

In the status table, one of the entries for "FINI *" puts a value of 3 in flag number 10. The command in the status table is as follows:

Code: Select all

LET 10 3
Then the "JSR 0 11" tells Quill to jump to our custom machine-code routine at memory-address &0B00 because in hexadecimal &0B is equivalent to eleven (11) in decimal, and &00 is obviously equivalent to zero. (Yes, it might seem a bit backwards to put the zero before the eleven!)

The machine-code routine looks at memory-address &50A, which is where Quill stored the value of flag 10. The value is 3, which indicates that it's the fourth phrase (because to get to phrase 3 we start counting from 0 rather than from 1) which needs to be spoken: *SAY CONGRATULATIONS

This might all seem rather complicated if you don't know machine code. Have a look at some of the introductory books about machine code and assembly language, here:
There's a nice remastered PDF of the Birnbaum book here:
:idea:
Last edited by lurkio on Fri Aug 16, 2019 10:05 am, edited 4 times in total.

Rfairman
Posts: 29
Joined: Mon Jul 15, 2019 7:58 am
Contact:

Re: Spéech with the Quill and using Star commands Option p in menu

Post by Rfairman » Fri Aug 16, 2019 11:39 am

sorry to hassle you again Can i ask you for a copy of the assembler listing I' ve cut and pasted as text and transferred to my bbc b via a ssd. I can *type the program and the listing appears but cannot chain it or use it with the basic editor i have on rom I understand the setting of the flag and jsr to the subroutine so would like to add and use my own phrases
regards
richard fairman

User avatar
lurkio
Posts: 2147
Joined: Tue Apr 09, 2013 11:30 pm
Location: Doomawangara
Contact:

Re: Spéech with the Quill and using Star commands Option p in menu

Post by lurkio » Fri Aug 16, 2019 12:24 pm

Rfairman wrote:
Fri Aug 16, 2019 11:39 am
Can i ask you for a copy of the assembler listing
It's in the file named PHRASES on the .SSD in the "Play online" link in this previous post.
Rfairman wrote:
Fri Aug 16, 2019 11:39 am
I' ve cut and pasted as text and transferred to my bbc b via a ssd. I can *type the program and the listing appears but cannot chain it or use it with the basic editor
Try this:

Code: Select all

*EXEC <filename>
:idea:

Rfairman
Posts: 29
Joined: Mon Jul 15, 2019 7:58 am
Contact:

Re: Spéech with the Quill and using Star commands Option p in menu

Post by Rfairman » Fri Aug 16, 2019 12:57 pm

thanks i was looking at the wrong ssd
regards
\richard

Post Reply