BBC Basic Assembler

Software discussion & Emulation
Preppie
Posts: 53
Joined: Sat Aug 06, 2022 1:24 pm

BBC Basic Assembler

Post by Preppie » Fri Oct 21, 2022 8:29 pm

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?

Preppie
Posts: 53
Joined: Sat Aug 06, 2022 1:24 pm

Re: BBC Basic Assembler

Post by Preppie » Fri Oct 21, 2022 10:19 pm

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 2644 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

retrogamer
Posts: 76
Joined: Tue Jun 01, 2021 12:00 am

Re: BBC Basic Assembler

Post by retrogamer » Fri Oct 21, 2022 11:08 pm

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!

Preppie
Posts: 53
Joined: Sat Aug 06, 2022 1:24 pm

Re: BBC Basic Assembler

Post by Preppie » Sat Oct 22, 2022 7:44 am

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.

Preppie
Posts: 53
Joined: Sat Aug 06, 2022 1:24 pm

Re: BBC Basic Assembler

Post by Preppie » Sat Oct 22, 2022 7:56 am

btw: I just checked XBAS and a similar gfx abbreviation works with that too.

Lardo Boffin
Posts: 296
Joined: Thu Oct 24, 2019 11:47 am

Re: BBC Basic Assembler

Post by Lardo Boffin » Sat Oct 22, 2022 9:29 am

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?
TC-01 + einSDein + TM-01 + TK-02 + gotek

Preppie
Posts: 53
Joined: Sat Aug 06, 2022 1:24 pm

Re: BBC Basic Assembler

Post by Preppie » Sat Oct 22, 2022 10:52 am

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.

retrogamer
Posts: 76
Joined: Tue Jun 01, 2021 12:00 am

Re: BBC Basic Assembler

Post by retrogamer » Sat Oct 22, 2022 11:17 pm

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 :)

Preppie
Posts: 53
Joined: Sat Aug 06, 2022 1:24 pm

Re: BBC Basic Assembler

Post by Preppie » Sun Oct 23, 2022 8:37 am

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.

Lardo Boffin
Posts: 296
Joined: Thu Oct 24, 2019 11:47 am

Re: BBC Basic Assembler

Post by Lardo Boffin » Sun Oct 23, 2022 9:30 am

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.
TC-01 + einSDein + TM-01 + TK-02 + gotek

Post Reply