Using and improving Exbasic
Moderator: Moderators
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.
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.
-
- Vic 20 Afficionado
- Posts: 347
- Joined: Tue Apr 14, 2009 8:15 am
- Website: http://wimbasic.webs.com
- Location: Netherlands
- Occupation: farmer
FE3...ok, but
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 ?
Apart from the extra coding that is needed, what is the performance penalty for bank switching ?
-
- Vic 20 Afficionado
- Posts: 347
- Joined: Tue Apr 14, 2009 8:15 am
- Website: http://wimbasic.webs.com
- Location: Netherlands
- Occupation: farmer
Mike SQR included
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.
SQR(14)*SQR(14)-14 now really is 0.
Wim.
Re: FE3...ok, but
You can switch a ROM Bank with one write statement. The slowest part is your 6502, the CPLD switches in 10ns.wimoos wrote:Apart from the extra coding that is needed, what is the performance penalty for bank switching ?
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
-
- Vic 20 Afficionado
- Posts: 347
- Joined: Tue Apr 14, 2009 8:15 am
- Website: http://wimbasic.webs.com
- Location: Netherlands
- Occupation: farmer
manuals for exbasic
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.
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.
-
- Vic 20 Afficionado
- Posts: 347
- Joined: Tue Apr 14, 2009 8:15 am
- Website: http://wimbasic.webs.com
- Location: Netherlands
- Occupation: farmer
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.
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.
-
- Vic 20 Afficionado
- Posts: 347
- Joined: Tue Apr 14, 2009 8:15 am
- Website: http://wimbasic.webs.com
- Location: Netherlands
- Occupation: farmer
New version WimBasic
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.
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
- Mike
- Herr VC
- Posts: 4840
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Re: New version WimBasic
That one can be expressed in a slightly more compact form by using the re-link routine of the BASIC interpreter:wimoos wrote:- [...] added UNNEW
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
Greetings,
Michael
- Mike
- Herr VC
- Posts: 4840
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
It might also be feasible to replace BORDER, COLOR, CURSOR, and GROUND by a single COLOR command taking two parameters, as follows:
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.
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)
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.
maybe it would ...Mike wrote:It might also be feasible to replace BORDER, COLOR, CURSOR, and GROUND by a single COLOR command taking two parameters, as follows:
... 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.
- Mike
- Herr VC
- Posts: 4840
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
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.Diddl wrote:And maybe code it is more readable with good old exbasic commands.
With removing the HARDCOPY command, Wim already has taken the path in another direction.An additional command is ok.
Exbasic Level II is well known on PET and CBM computers. Someone has ported it to VIC-20 and later to C-64.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.