Using and improving Exbasic
Moderator: Moderators
-
- Vic 20 Afficionado
- Posts: 350
- Joined: Tue Apr 14, 2009 8:15 am
- Website: http://wimbasic.webs.com
- Location: Netherlands
- Occupation: farmer
Building Wimbasic
I have now built Wimbasic (based on the disassembled Exbasic).
I have gained approx. 60 bytes now, mainly by trimming the announcement screen, but also by:
- removing superfluous NOPs
- removing other code and data that is never touched
- rewriting pieces of code
Alongside I have fixed the following bugs:
- DUMP and MATRIX now print a sign as well
- DUMP no longer prints FN-hooks
- SPACE no longer bails out with SYNTAX error but with ILLEGAL QUANTITY error
- CEEK(x,C) works properly now
- changed ODF into OFF
- LETTER ON/OFF works properly now with different memory configurations
- Colorcodes for BORDER, GROUND, CURSOR and COKE are now accepted from 1 to 16 instead of 1 to 8
I will make this version available shortly, together with the source.
I will look into improving RENUM, but I am also thinking about kicking out commands that are probably never used, such as HARDCOPY.
Suggestions are appreciated.
Regards,
Wim.
I have gained approx. 60 bytes now, mainly by trimming the announcement screen, but also by:
- removing superfluous NOPs
- removing other code and data that is never touched
- rewriting pieces of code
Alongside I have fixed the following bugs:
- DUMP and MATRIX now print a sign as well
- DUMP no longer prints FN-hooks
- SPACE no longer bails out with SYNTAX error but with ILLEGAL QUANTITY error
- CEEK(x,C) works properly now
- changed ODF into OFF
- LETTER ON/OFF works properly now with different memory configurations
- Colorcodes for BORDER, GROUND, CURSOR and COKE are now accepted from 1 to 16 instead of 1 to 8
I will make this version available shortly, together with the source.
I will look into improving RENUM, but I am also thinking about kicking out commands that are probably never used, such as HARDCOPY.
Suggestions are appreciated.
Regards,
Wim.
Re: Building Wimbasic
You could expand WIM BASIC with all goods available in other extensions.wimoos wrote:Suggestions are appreciated.
On a FE3 you don't have problems with space. You have 8KB in BLK-5 and if this isn't enough you switch to another 8K into BLK-5. A intelligent bank switcher should make it possible like in a C64 Final Cartridge, where 128KB are used.
So you could make a WIM BASIC MINI for normal Eprom Cards and a Super WIM BASIC for FE3 User.
-
- Vic 20 Afficionado
- Posts: 350
- Joined: Tue Apr 14, 2009 8:15 am
- Website: http://wimbasic.webs.com
- Location: Netherlands
- Occupation: farmer
You can write A=DEC("900F"). The HEX$ function is also available.
Binary notation is not in there (yet), but could easily be added to DEC()
I myself was also thinking about XOR and MOD.
Shifting and rotation...hm...good thought.
If its the VIC chip you want to address, this can be done through VOLUME, PLAY and SOUND for audio and COLOR, GROUND, BORDER, etc. for screen.
How about sprites ?
Binary notation is not in there (yet), but could easily be added to DEC()
I myself was also thinking about XOR and MOD.
Shifting and rotation...hm...good thought.
If its the VIC chip you want to address, this can be done through VOLUME, PLAY and SOUND for audio and COLOR, GROUND, BORDER, etc. for screen.
How about sprites ?
The FE3 Wedge can evaluate HEX values preceeded by a $:
It looks nicer than DEC("1B00") for me
Code: Select all
A=$1B00:B=$22+$1A+345
A lot of code wouldn't be the problem. It is a speed problem ...carlsson wrote:Since the VIC chip doesn't have hardware sprites, I think it would be quite a lot of code to add software sprites to the Basic extention? Indeed you have Robert Hurst's SSS library which probably could be extended with a Basic frontend, but I don't know how large that one would be.
- Mike
- Herr VC
- Posts: 4870
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Robert's stack for itself is quite fast, witness Quikman, and Omega Fury. The later one easily sports more than a dozen sprites on screen, flicker-free.Diddl wrote:A lot of code wouldn't be the problem. It is a speed problem ...carlsson wrote:Indeed you have Robert Hurst's SSS library which probably could be extended with a Basic frontend, but I don't know how large that one would be.
But the surrounding program needs to be structured, and written with SSS in mind. The BASIC extension would require IRQ wedges, which take care of the movement of sprites (say, from A to B), so the BASIC program itself is relieved from that task - similar to SPRMOV in BASIC 7.0. The wedge would also manage page flips. Also, collision detection must be added. All in all quite demanding - and still rather a specialist application for a BASIC extension, IMO.
I had a few PM's exchanged with Robert regarding this very topic, but thus far we hadn't even settled at least on a stable BASIC API for SSS.
Michael
-
- Vic 20 Afficionado
- Posts: 350
- Joined: Tue Apr 14, 2009 8:15 am
- Website: http://wimbasic.webs.com
- Location: Netherlands
- Occupation: farmer
Wimbasic available
Wimbasic (not for FE3 yet) may be downloaded here: http://home.kpn.nl/oost4231/wimbasic.zip
That should be do-able along with the % prefix for binary values. It's juat a case of some new code and changing the address for the get value from BASIC line vector.The FE3 Wedge can evaluate HEX values preceeded by a $:It looks nicer than DEC("1B00") for meCode: Select all
A=$1B00:B=$22+$1A+345
It would also be a lot faster than performing DEC("1B00").
Lee.
- Mike
- Herr VC
- Posts: 4870
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Hi, Wim,
XOR also would read in two arguments, convert them to int, perform EOR on two bytes, and convert the result to float again.
One other candidate for improvement is SQR(), which easily can be sped up 4 times by applying Heron's algorithm.
Here's the source. I've added a rounding step at the beginning to counteract a subtle bug that might happen with some arguments:
Maybe that code is useful for you extending WimBASIC.
Greetings,
Michael
Some time ago, in another thread there had been a discussion about how to implement DIV(), and MOD() as functions of two arguments. This ultimately ended up with some source, but - unfortunately - no implementation thus far.wimoos wrote:[...]I myself was also thinking about XOR and MOD.[...]
XOR also would read in two arguments, convert them to int, perform EOR on two bytes, and convert the result to float again.
One other candidate for improvement is SQR(), which easily can be sped up 4 times by applying Heron's algorithm.
Here's the source. I've added a rounding step at the beginning to counteract a subtle bug that might happen with some arguments:
Code: Select all
.Sqrt
JSR $DC1B ; round FAC#1
JSR $DC2B ; check sign of FAC#1
BEQ Sqrt_03 ; =0? Then end immediately! (SQR(0)=0)
BPL Sqrt_00 ; continue, if positive, else
JMP $D248 ; flag ?ILLEGAL QUANTITY ERROR
.Sqrt_00
LDA $61
STA $FB ; remember exponent byte of argument
AND #$01
ORA #$80
STA $61 ; reduce argument X to range [0.5,2.0[
LDA #$04
STA $FC
LDX #Sqrt_04 MOD 256
LDY #Sqrt_04 DIV 256
JSR $DBD4 ; store FAC#1 (X: reduced argument) to Sqrt_04
LDA #$BC
LDY #$D9
BNE Sqrt_02 ; start with Y=1 as first approximation,
.Sqrt_01 ; and loop 4 times, calculating Y=(Y+X/Y)/2.0 each turn
LDX #Sqrt_05 MOD 256
LDY #Sqrt_05 DIV 256
JSR $DBD4 ; store FAC#1 (Y: intermediate result) to Sqrt_05
LDA #Sqrt_04 MOD 256
LDY #Sqrt_04 DIV 256
JSR $DB0F ; FAC#1 = X/Y
LDA #Sqrt_05 MOD 256
LDY #Sqrt_05 DIV 256
.Sqrt_02
JSR $D867 ; FAC#1 = Y+X/Y (=1+X on first entry)
DEC $61 ; divide FAC#1 by 2.0
DEC $FC
BNE Sqrt_01
LDA $FB ; calculate exponent of result
LSR A
ADC #$40
STA $61
.Sqrt_03
RTS
.Sqrt_04
EQUB 0:EQUB 0:EQUB 0:EQUB 0:EQUB 0
.Sqrt_05
EQUB 0:EQUB 0:EQUB 0:EQUB 0:EQUB 0
Greetings,
Michael
Last edited by Mike on Sat Jan 30, 2010 7:40 am, edited 1 time in total.
-
- Vic 20 Afficionado
- Posts: 350
- Joined: Tue Apr 14, 2009 8:15 am
- Website: http://wimbasic.webs.com
- Location: Netherlands
- Occupation: farmer