Using and improving Exbasic

Basic and Machine Language

Moderator: Moderators

Diddl
Vic 20 Afficionado
Posts: 425
Joined: Wed Jun 10, 2009 3:18 am

Post by Diddl »

Maybe we could implement many BASIC functions in a special FE3 version?


new functions could placed in another 8K bank and with a switcher we switch to this bank bevore executing.

BASIC has Token Table and a execute address table for each Basic Token. Additionally to the address we could make a bank table.
wimoos
Vic 20 Afficionado
Posts: 345
Joined: Tue Apr 14, 2009 8:15 am
Website: http://wimbasic.webs.com
Location: Netherlands
Occupation: farmer

FE3...ok, but

Post by wimoos »

I do not own an FE3 cartridge and so haven't got experience with it. Must look into FE3 on VICE.
Apart from the extra coding that is needed, what is the performance penalty for bank switching ?
wimoos
Vic 20 Afficionado
Posts: 345
Joined: Tue Apr 14, 2009 8:15 am
Website: http://wimbasic.webs.com
Location: Netherlands
Occupation: farmer

Mike SQR included

Post by wimoos »

I have uploaded a new version of WIMBASIC.ZIP that now includes the code for SQR from Mike.

SQR(14)*SQR(14)-14 now really is 0.

Wim.
Diddl
Vic 20 Afficionado
Posts: 425
Joined: Wed Jun 10, 2009 3:18 am

Re: FE3...ok, but

Post by Diddl »

wimoos wrote:Apart from the extra coding that is needed, what is the performance penalty for bank switching ?
You can switch a ROM Bank with one write statement. The slowest part is your 6502, the CPLD switches in 10ns.



If we choose mode RAM-2 we can switch BLK-5 without changing other RAM Blocks.

By setting Bit 3 of Register 1 we switch BLK 5 to another bank.

If code is running in Blk 5 a switching would make problems.

So we either have switching code in both banks (on same address) or we need a switcher in another Blk, maybe Block 0 (3KB RAM Expansion).

---

But bevore thinking about bank switching, we simply could use this free 3K RAM for extensions.

So not only FE3 user but also user who posses a 8KB + 3KB RAM extension could use it.



If
Leeeeee
soldering master
Posts: 396
Joined: Fri Apr 23, 2004 8:14 am

Post by Leeeeee »

and for the manual that I reworked (in Dutch though).
Can you post this somewhere? I've not been able to find it anywhere in any language.

Lee.
wimoos
Vic 20 Afficionado
Posts: 345
Joined: Tue Apr 14, 2009 8:15 am
Website: http://wimbasic.webs.com
Location: Netherlands
Occupation: farmer

manuals for exbasic

Post by wimoos »

My Dutch version, aimed for VIC20, is now available at

http://home.kpn.nl/oost4231/exbasic.pdf

There is a more elaborate version that I found later on

http://simon25.de/Commodore/CBM/EXBASIC ... L%20II.pdf

This one is in German, for CBM, but not specifically for VIC20.

Regards,

Wim.
Leeeeee
soldering master
Posts: 396
Joined: Fri Apr 23, 2004 8:14 am

Post by Leeeeee »

English version in .pdf and .txt is here though my crappy .pdf editor crashed on save and now crashes when I try to open the .pdf to fix some errors I spotted.

Anyone recommend a good, free WinXP compatable pdf editor?

Lee.
wimoos
Vic 20 Afficionado
Posts: 345
Joined: Tue Apr 14, 2009 8:15 am
Website: http://wimbasic.webs.com
Location: Netherlands
Occupation: farmer

Post by wimoos »

In my latest version I have now kicked out HARDCOPY in favor of UNNEW.

I was thinking about "computed GOTO/GOSUB", but this could also be achieved bij EXEC("GOTO"+STR$(<expr>))
And M=MOD(A,B) can also be had by M=B*FRAC(A/B)

What remains on my list to add is

- XOR
- A=$1B00:B=%10110
- clear a string array
- sort an array
- graphics module

Removing the commands for (fast) tape handling LOAD, VERIFY and SAVE should give a lot of space in BLK5, but I could work on extensions in $0400-$0FFF.

Thanks for any comments on this.
wimoos
Vic 20 Afficionado
Posts: 345
Joined: Tue Apr 14, 2009 8:15 am
Website: http://wimbasic.webs.com
Location: Netherlands
Occupation: farmer

New version WimBasic

Post by wimoos »

I have uploaded a new version of WimBasic to http://home.kpn.nl/oost4231/wimbasic.zip

It is still less than 8kb. The differences from the previous version are:

- Removed HARDCOPY and added UNNEW
- Changed COKE to accept color no longer as required parameter. Per default it takes the value entered with CURSOR.
- Improved SWAP. Previously SWAP exchanged the 5 bytes of the values of the variables, no matter what. Didn't do type checking or take array elements into account (for strings and integer these are less than 5 bytes in length). Now it does type checking and adapts the number of bytes to exchange, depending on the type. It can now be safely used to swap string or integer array elements.

Regards,

Wim.
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: New version WimBasic

Post by Mike »

wimoos wrote:- [...] added UNNEW
That one can be expressed in a slightly more compact form by using the re-link routine of the BASIC interpreter: ;)

Code: Select all

.Old
 LDA #$01    ; set first link pointer to non-0 value
 TAY
 STA ($2B),Y
 JSR $C533   ; ** re-link BASIC program
 CLC         ; set pointer $2D/$2E to start of variables
 LDA $22     ; (AKA "end of program")
 ADC #$02
 STA $2D
 LDA $23
 ADC #$00
 STA $2E
 JSR $C659   ; CLR, reset TXTPTR
 JMP $C474   ; BASIC warm start
And another two bytes are saved, when you rename the command to "OLD".

Greetings,

Michael
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

It might also be feasible to replace BORDER, COLOR, CURSOR, and GROUND by a single COLOR command taking two parameters, as follows:

Code: Select all

COLOR <nr>,<value> with <nr> :=

0: background (value = 0..15)
1: foreground (value = 0..15; >=8 means multi-colour enable)
2: border     (value = 0..15; >=8 means reverse mode on)
3: auxiliary  (value = 0..15)
Changing the border value should EOR the value with 8, so reverse mode is off with values between 0, and 7.

When you implement a command to sort arrays, one very usable extension is to sort additional arrays alongside the first array, i.e.

SORT A$()[,B$(),...]

where A$() is sorted, and B$() is permuted in the same way as A$(). These additional arrays need not be the same type, but they must be the same size.

For an example of Quicksort in BASIC, I've posted one here.
Last edited by Mike on Mon Feb 01, 2010 3:47 am, edited 1 time in total.
Diddl
Vic 20 Afficionado
Posts: 425
Joined: Wed Jun 10, 2009 3:18 am

Post by Diddl »

Mike wrote:It might also be feasible to replace BORDER, COLOR, CURSOR, and GROUND by a single COLOR command taking two parameters, as follows:
maybe it would ...


... but I would like to see all Exbasic commands available in WimBasic. So it is compatible with Exbasic programs available. And maybe code it is more readable with good old exbasic commands.

An additional command is ok.
User avatar
Mike
Herr VC
Posts: 4816
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Post by Mike »

Diddl wrote:And maybe code it is more readable with good old exbasic commands.
From a quick glance I'd rather suspect the CURSOR command puts the cursor somewhere, and not change its colour. So much for readability. :? The redefined COLOR command is inspired from BASIC 3.5/7.0.
An additional command is ok.
With removing the HARDCOPY command, Wim already has taken the path in another direction. :twisted:
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Post by carlsson »

Excuse my ignorance, but is this a well known and used Basic extention? Can you point me to any programs that are written in Exbasic? I thought it was yet another of those obscure extentions with a nice set of commands, now revived for improved performance and possible future use.
Anders Carlsson

Image Image Image Image Image
Diddl
Vic 20 Afficionado
Posts: 425
Joined: Wed Jun 10, 2009 3:18 am

Post by Diddl »

carlsson wrote:Excuse my ignorance, but is this a well known and used Basic extention? Can you point me to any programs that are written in Exbasic? I thought it was yet another of those obscure extentions with a nice set of commands, now revived for improved performance and possible future use.
Exbasic Level II is well known on PET and CBM computers. Someone has ported it to VIC-20 and later to C-64.
Post Reply