BBC Basic Assembler

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

BBC Basic Assembler

Post 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?
Preppie
Posts: 58
Joined: Sat Aug 06, 2022 1:24 pm

Re: BBC Basic Assembler

Post 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 10192 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: 77
Joined: Tue Jun 01, 2021 12:00 am

Re: BBC Basic Assembler

Post 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!
Preppie
Posts: 58
Joined: Sat Aug 06, 2022 1:24 pm

Re: BBC Basic Assembler

Post 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.
Preppie
Posts: 58
Joined: Sat Aug 06, 2022 1:24 pm

Re: BBC Basic Assembler

Post by Preppie »

btw: I just checked XBAS and a similar gfx abbreviation works with that too.
Lardo Boffin
Posts: 302
Joined: Thu Oct 24, 2019 11:47 am

Re: BBC Basic Assembler

Post 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?
TC-01 + einSDein + TM-01 + TK-02 + gotek
Preppie
Posts: 58
Joined: Sat Aug 06, 2022 1:24 pm

Re: BBC Basic Assembler

Post 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.
retrogamer
Posts: 77
Joined: Tue Jun 01, 2021 12:00 am

Re: BBC Basic Assembler

Post 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 :)
Preppie
Posts: 58
Joined: Sat Aug 06, 2022 1:24 pm

Re: BBC Basic Assembler

Post 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.
Lardo Boffin
Posts: 302
Joined: Thu Oct 24, 2019 11:47 am

Re: BBC Basic Assembler

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