Extended Basic ROM

Development tools discussion area.
User avatar
ChrisB
Posts: 26
Joined: Wed Oct 05, 2011 9:37 pm
Location: Surrey

Extended Basic ROM

Postby ChrisB » Mon Jun 19, 2017 10:26 pm

My friend Stuart (of pcBBC fame) wrote this in his youth. This weekend we managed to rip it off of the original disks and with the interest in BASIC V elsewhere here thought someone might be interested.

It is an extension ROM (that must be loaded into SWRAM) that added most of the BASIC V style syntax and commands to BASIC 2 including CASE, WHILE, multiline IF statements (including ELSEIF) built in help and more. Once loaded start with *EBASIC

ebasic.zip
(13.59 KiB) Downloaded 23 times


Notes:
  • This is provided as is with no support - no liability will be accepted for it's use or any errors within it.
  • It requires BASIC II on a BBC B as it's an extension to it - rather than a replacement for it. It won't work on a Master or with the tube.
  • Syntax may not be entirely BASIC V compatible. He didn't have an official spec/manual available, only an overview from a magazine article.
  • This is NOT token compatible with BASIC V - You'd need to spool the program in rather than load a program.
  • It should still load and execute existing tokenised BASIC II fine, but any new or edited code may be tokenised differently. For example I think it uses different tokens for IF, THEN and ELSE keywords so it can intercept them and do the multi-line stuff. As such code you write with it may not be BASIC II compatible, even if you use only official BASIC II syntax.
  • Extended graphics commands (CIRCLE, FILL etc) require Acorn GXR to do the work, as EBASIC just issues the required PLOT commands.
  • See the attached help text the extra or changed commands within it. Type HELP . for a full list

This lists what I believe to be the extra commands from the help file.
help.txt
(7.24 KiB) Downloaded 36 times

User avatar
Elminster
Posts: 1632
Joined: Wed Jun 20, 2012 8:09 am
Location: Essex, UK

Re: Extended Basic ROM

Postby Elminster » Mon Jun 19, 2017 11:43 pm

Interesting. Thanks. Yes I have certainly expressed an interest on getting working BASIC Extensions. Will look at this as soon as I can.

User avatar
Elminster
Posts: 1632
Joined: Wed Jun 20, 2012 8:09 am
Location: Essex, UK

Re: Extended Basic ROM

Postby Elminster » Mon Jun 19, 2017 11:49 pm

My thinking would be something like, write adv 6502 basic version (master basic v), spool it, exec it has in to a Beeb, and tweak as required. Then run basic v on Beeb or master. Shame doesn't work on tube.

User avatar
flaxcottage
Posts: 2770
Joined: Thu Dec 13, 2012 8:46 pm
Location: Derbyshire

Re: Extended Basic ROM

Postby flaxcottage » Tue Jun 20, 2017 7:32 am

Nice. =D>

I wonder how it compares to COMAL which I used on beebs BITD? Something else to investigate. :D
- John

Currently running Level 4 Econet with BBC B, BBC B+ 128K, Master 128K, 4Mb A3000, 4Mb A3020, 4Mb A4000, 4Mb A5000 dual FDD; UK101; HP41CX setup; Psion 3a, 3mx and 5mx; Z88; TI-58c, TI-59 and printer, HP-16C programmer's calculator

User avatar
sweh
Posts: 1841
Joined: Sat Mar 10, 2012 12:05 pm
Location: New York, New York
Contact:

Re: Extended Basic ROM

Postby sweh » Tue Jun 20, 2017 6:34 pm

Heh, I wonder how many basic extension ROMs people wrote.... this was mine :-)

https://sweh.spuddy.org/Beeb/Basic_Extensions/

Oh dear, all those matrix transformations... you could tell I was a maths student!
Rgds
Stephen

User avatar
Elminster
Posts: 1632
Joined: Wed Jun 20, 2012 8:09 am
Location: Essex, UK

Re: Extended Basic ROM

Postby Elminster » Tue Jun 20, 2017 8:12 pm

sweh wrote:Heh, I wonder how many basic extension ROMs people wrote.... this was mine :-)

https://sweh.spuddy.org/Beeb/Basic_Extensions/

Oh dear, all those matrix transformations... you could tell I was a maths student!


Does yours work on Master or Tube as well as Beeb?

User avatar
sweh
Posts: 1841
Joined: Sat Mar 10, 2012 12:05 pm
Location: New York, New York
Contact:

Re: Extended Basic ROM

Postby sweh » Tue Jun 20, 2017 10:45 pm

The README says it works with BASIC 4 on a Master, so I guess I must have tested with it BITD! Probably on a SEEVIC Master 'cos that was likely the only one I had access to :-)

I never tested with a Tube. I very much doubt it'll work with relocated BASIC ROMs because the hard-coded ROM call locations (15 functions) would change and break.
Rgds
Stephen

jregel
Posts: 61
Joined: Fri Dec 20, 2013 6:39 pm
Location: Gloucestershire

Re: Extended Basic ROM

Postby jregel » Wed Jun 21, 2017 7:11 am

Given that there are different ROMs that extend BASIC, did they all use the same method to add new commands (and if so, what's the method?). Is there specific functionality within BASIC and/or MOS for extending the language?
BBC Master Turbo
Retroclinic External Datacentre
VideoNuLA

pcbbc
Posts: 1
Joined: Wed Jun 21, 2017 2:23 pm

Re: Extended Basic ROM

Postby pcbbc » Wed Jun 21, 2017 3:41 pm

Can't comment on others code, but I would assume mostly by intercepting BRK errors. As paged ROMs automatically get a service call on every BRK (A=&06), but before control is passed to the current language (via BRK vector &202), that part is very easy.

So:
  1. BASIC performs a BRK with "Mistake" or "Syntax error" message when it encounters an invalid keyword.
  2. Extension ROM intercepts the error via the A=&06 service call, and checks if the error was triggered by an "extended" keyword.
  3. If it is, then the ROM performs the necessary extra processing (probably calling back into BASIC to do things like expression evaluation for any parameters) and then jumps back to BASIC (after clearing up the stack) to continue execution.

For my attempt, I also hook:
OSWORD = To intercept input of new program lines (OSWORD A=&00 Read Line) and tokenise the extended keywords.
OSWRCH = To intercept printing of tokens (during LIST etc) and replace them with the full keyword.

Kudos to sweh though for the B/B+/Master compatibility and implementing the graphics routines (not reliant on GXR).

On the Tube none of this would help you as you'd want your code to run on the Parasite, not the Host processor. But your job would be made quite a bit easier by being able to patch the copied language ROM code directly.

User avatar
Elminster
Posts: 1632
Joined: Wed Jun 20, 2012 8:09 am
Location: Essex, UK

Re: Extended Basic ROM

Postby Elminster » Wed Jun 21, 2017 4:01 pm

Thanks for that info.

I noticed today that if you install Acorns 6502 Adv BASIC V on the master it eats about 4k from the 44k hibasic gives you. Not sure how integrated ADV Basic is into a specific version of BASIC. It comes with 4.3 but usually I used 4.32 BASIC that auto relocated to TUBE (changes HIMEM to 0B00 without me doing anything)

User avatar
sweh
Posts: 1841
Joined: Sat Mar 10, 2012 12:05 pm
Location: New York, New York
Contact:

Re: Extended Basic ROM

Postby sweh » Wed Jun 21, 2017 11:14 pm

pcbbc wrote:Can't comment on others code, but I would assume mostly by intercepting BRK errors. As paged ROMs automatically get a service call on every BRK (A=&06), but before control is passed to the current language (via BRK vector &202), that part is very easy.

So:
  1. BASIC performs a BRK with "Mistake" or "Syntax error" message when it encounters an invalid keyword.
  2. Extension ROM intercepts the error via the A=&06 service call, and checks if the error was triggered by an "extended" keyword.
  3. If it is, then the ROM performs the necessary extra processing (probably calling back into BASIC to do things like expression evaluation for any parameters) and then jumps back to BASIC (after clearing up the stack) to continue execution.


Step 2 should involve checking that the current language is also BASIC (compare osbyte 252 to osbyte 187) to ensure it doesn't get called from WORD or other languages :-)

I also check for "No such variable" to create new functions.

But, yes, basically this.
[/quote]
Rgds
Stephen

jregel
Posts: 61
Joined: Fri Dec 20, 2013 6:39 pm
Location: Gloucestershire

Re: Extended Basic ROM

Postby jregel » Fri Jun 23, 2017 7:57 am

Very enlightening answers. Thanks.

In addition to the two ROMs mentioned here, can anyone think of others that extended BASIC? I think there's the ADDCOMM ROM by Vine Micros (which I assume works in a similar way?). Others?

Then there are other extensions that BASIC can use. I'm thinking here of things like the Acorn GXR which extended BASIC by adding new VDU commands. I guess this isn't strictly extending BASIC though(?).

I find it fascinating just how flexible the design of the Beeb is to allow so many different ways of expanding and extending the system.
BBC Master Turbo
Retroclinic External Datacentre
VideoNuLA

User avatar
Elminster
Posts: 1632
Joined: Wed Jun 20, 2012 8:09 am
Location: Essex, UK

Re: Extended Basic ROM

Postby Elminster » Fri Jun 23, 2017 8:42 am

jregel wrote:Very enlightening answers. Thanks.

In addition to the two ROMs mentioned here, can anyone think of others that extended BASIC? I think there's the ADDCOMM ROM by Vine Micros (which I assume works in a similar way?). Others?

Then there are other extensions that BASIC can use. I'm thinking here of things like the Acorn GXR which extended BASIC by adding new VDU commands. I guess this isn't strictly extending BASIC though(?).

I find it fascinating just how flexible the design of the Beeb is to allow so many different ways of expanding and extending the system.


There are some others


User avatar
Elminster
Posts: 1632
Joined: Wed Jun 20, 2012 8:09 am
Location: Essex, UK

Re: Extended Basic ROM

Postby Elminster » Wed Jun 28, 2017 1:40 pm

According the manual for Micropower Basic Extensions. That version works with BASIC I & II. It says is doesnt work with 6502 copro but then goes on to say there is a co pro version of the Extensions ROM about.

There are numours softcopy versiosn of Micropower's RM about but not come across one labelled for 6502.
Last edited by Elminster on Tue Jul 04, 2017 12:38 pm, edited 1 time in total.

User avatar
Elminster
Posts: 1632
Joined: Wed Jun 20, 2012 8:09 am
Location: Essex, UK

Re: Extended Basic ROM

Postby Elminster » Mon Jul 03, 2017 8:04 pm

Scan of MicroPower BASIC Externsions Manual
Attachments
BASIC_EXT_MicroPower.compressed.pdf
(3.71 MiB) Downloaded 23 times

jregel
Posts: 61
Joined: Fri Dec 20, 2013 6:39 pm
Location: Gloucestershire

Re: Extended Basic ROM

Postby jregel » Tue Jul 04, 2017 10:17 am

Thanks for posting the manual.

Looks like a really decent ROM. May need to have a play...
BBC Master Turbo
Retroclinic External Datacentre
VideoNuLA

Hedge
Posts: 16
Joined: Thu Feb 23, 2012 11:00 am

Re: Extended Basic ROM

Postby Hedge » Sat Jul 15, 2017 2:07 am

ChrisB wrote:My friend Stuart (of pcBBC fame) wrote this in his youth. This weekend we managed to rip it off of the original disks and with the interest in BASIC V elsewhere here thought someone might be interested.

It is an extension ROM (that must be loaded into SWRAM) that added most of the BASIC V style syntax and commands to BASIC 2 including CASE, WHILE, multiline IF statements (including ELSEIF) built in help and more. Once loaded start with *EBASIC

ebasic.zip

Notes:
  • This is provided as is with no support - no liability will be accepted for it's use or any errors within it.
  • It requires BASIC II on a BBC B as it's an extension to it - rather than a replacement for it. It won't work on a Master or with the tube.
  • Syntax may not be entirely BASIC V compatible. He didn't have an official spec/manual available, only an overview from a magazine article.
  • This is NOT token compatible with BASIC V - You'd need to spool the program in rather than load a program.
  • It should still load and execute existing tokenised BASIC II fine, but any new or edited code may be tokenised differently. For example I think it uses different tokens for IF, THEN and ELSE keywords so it can intercept them and do the multi-line stuff. As such code you write with it may not be BASIC II compatible, even if you use only official BASIC II syntax.
  • Extended graphics commands (CIRCLE, FILL etc) require Acorn GXR to do the work, as EBASIC just issues the required PLOT commands.
  • See the attached help text the extra or changed commands within it. Type HELP . for a full list

This lists what I believe to be the extra commands from the help file.
help.txt


A bit off topic but pcBBC was a very nice piece of coding by stuart

would he ever consider making his emulator pcBBC available to users of stardot?
I'm sure many people would be very interested

BBCB+64K
Posts: 221
Joined: Mon Mar 22, 2010 9:51 pm
Location: North Norfolk

Re: Extended Basic ROM

Postby BBCB+64K » Sun Jul 30, 2017 8:53 pm

I had a registered version of pcBBC BITD, it was one of the best BBC emulators for DOS.

Steve
My current setup...

BBC B+ 128k with external DataCentre with 2GB CF Card, 64MB ARM7TDMI Co-Processor and BeebOPL.


Return to “development tools”

Who is online

Users browsing this forum: No registered users and 1 guest