Page 1 of 2

BBC Basic Assembler

Posted: Fri Oct 21, 2022 8:29 pm
by Preppie
According to the manual you use square brackets to enter/exit an assembler routine, but the Einstein doesn't have square brackets???

Anyone know how to do this?

Re: BBC Basic Assembler

Posted: Fri Oct 21, 2022 10:19 pm
by Preppie
In my attempt to find a way of displaying a square bracket I stumbled across this:
20221021_220553[1].jpg
20221021_220553[1].jpg (3.57 MiB) Viewed 2782 times
Every gfx character has an associated command in BBC BASIC. I may have missed it but I couldn't find a reference to it in the manual, is this a known thing?

Will be great for creating 10 liners: https://gkanold.wixsite.com/homeputeriu ... -list-2022

Re: BBC Basic Assembler

Posted: Fri Oct 21, 2022 11:08 pm
by retrogamer
Not used BBC Basic on the Einstein so wasn't even aware assembly was possible in BASIC! Fascinating stuff.

I had presumed you can always assign any ASCII character (and therefore assign square brackets) to a function key using the KEY command in BASIC. CHR$(91) gives a '[', and CHR$(93) gives a ']'. See Annex A in the BBC BASIC Manual for a list of all the ASCII codes. Except BBC Basic doesn't seem to have the KEY command available in Xtal Basic!

My TC01 is put away at the moment, so am unable to experiment with this.

But I'm thinking PRINT CHR$(91) will give you a '[' on the screen you can then copy and save in your program. You just scroll over the character/s you wish to copy with the cursor control keys using SHIFT if necessary and then press ENTER to confirm. Remember SHIFT/INS inserts extra spaces to reposition characters if needed. Really useful for editing :)

This is probably not the best way to do this, but it should work!

Re: BBC Basic Assembler

Posted: Sat Oct 22, 2022 7:44 am
by Preppie
chr$(91)+(93) give left arrow and right arrow not square brackets.

I've printed all ascii on the screen and there's no square brackets.

Also, you can't edit in the same way as u do with xtal BASIC, you need to use the edit command to do a line at a time.

Re: BBC Basic Assembler

Posted: Sat Oct 22, 2022 7:56 am
by Preppie
btw: I just checked XBAS and a similar gfx abbreviation works with that too.

Re: BBC Basic Assembler

Posted: Sat Oct 22, 2022 9:29 am
by Lardo Boffin
I think you get square brackets with the 80 column card but that may be just a display font rather than an extra character set?

Re: BBC Basic Assembler

Posted: Sat Oct 22, 2022 10:52 am
by Preppie
I thought I'd tried this earlier but I must have done it wrong.

You are both right. The left and right arrows are transformed into square brackets in the special 80 col font, they can also be used instead of square brackets in BBC BASIC.

So I now have access to the inline assemble in BBC BASIC :)

This little journey also discovered (at least for me) a killer abbreviation system for the 10 line competition.

Re: BBC Basic Assembler

Posted: Sat Oct 22, 2022 11:17 pm
by retrogamer
Thanks for the information. This is most useful.

I was completely unaware of the differences with XBAS.

Consequently, I'm now intrigued to explore BBC BASIC on the Einstein :)

Re: BBC Basic Assembler

Posted: Sun Oct 23, 2022 8:37 am
by Preppie
I thought you could use this to throw in a bit of assembler to speed up certain areas of your basic programme but that's not how it works.

It's simply an assembler. So you need to assemble your code and save it then load it into your BASIC programme and use the USR command to run the code you wrote within a BASIC. You can use a bit of BASIC to alter flow of what's assembled but it's basically just an assembler. Still a nice addition if you don't have a dedicated assembler.

Be sure to save before RUNing, any incorrect code could cause the system to crash into MOS and you've lost all your code.

Re: BBC Basic Assembler

Posted: Sun Oct 23, 2022 9:30 am
by Lardo Boffin
If it is like the assembler in the original BBC BASIC on the BBC Micro then you should be able to assemble to a BASIC variable and then just call the variable to activate the code, once finished it should then return to BASIC.

So you could do something like:
DIM C% 300 (to reserve 300 bytes) and then
P% = C% (I think this is the system variable to determine where the code goes) and the code will assemble at the location of the variable C%
CALL C% (or Z80 equivalent)
The code is in effect assembled on demand and not saved / loaded separately. Ideal for small sections of code.