Using and improving Exbasic

Basic and Machine Language

Moderator: Moderators

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

Postby wimoos » Mon Feb 01, 2010 5:50 am

another of those obscure extentions


Well, its not that obscure. Please take a look at the PDFs that I referenced in previous posts. Exbasic was there on other and older CBM machines as well (each with their specifics of course). Also, there is much resemblence with the Level II Basic that is used on TRS-80.

(BUMP: Diddl)

Between Jan6 en Jan7, since I changed the announcement screen, I left the official Exbasic for what it is. So much for full compatibility. All these tokens...

The suggestions for the COLOR command: I'll include the EOR #$08 in a next version.

The SORT command: I was thinking about a solution like the qsort() function in C, where a callback routine for the comparison and a callback routine for the swap is used. So something like:

QSORT("A$(I)<A$(I+1)","SWAPA$(I),A$(I+1):SWAPB$(I),B$(I+1)")

but I haven't decided on it yet.

Regards,

Wim.
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic

User avatar
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Postby carlsson » Mon Feb 01, 2010 6:40 am

Hm, ok. At least those colour oriented commands must've been added for the VIC-20 version as the colour choice for PET and CBM-II was factory default: white, amber or green, but only one per computer. :-D
Anders Carlsson

Image Image Image Image Image

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

Postby Mike » Mon Feb 01, 2010 8:34 am

wimoos wrote:The SORT command: I was thinking about a solution like the qsort() function in C, where a callback routine for the comparison and a callback routine for the swap is used. So something like:

QSORT("A$(I)<A$(I+1)","SWAPA$(I),A$(I+1):SWAPB$(I),B$(I+1)")

but I haven't decided on it yet.

In that case, the SORT command not going to offer a performance increase over a dedicated subroutine, similar to that one I had posted. A lot of time will be wasted in "executing" the strings each time they're needed, i.e. finding where the variables are stored, and sending the comparison statement through FRMEVL. And BTW, Quicksort does not only compare, and swap elements that are neighbors.

Anyhow, taking a parameter to select between sorting in ascending, or descending order definitely is the right thing to do.

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

Postby wimoos » Mon Feb 01, 2010 12:59 pm

Not gaining the performance is exactly what is holding me back. I should look into a solution that comes halfway, like you said.
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic

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

Postby wimoos » Tue Feb 02, 2010 2:25 pm

New version of Wimbasic available.

It supports hexbased value entry: A=$1D00
This makes A=EVAL("$1D00") possible and thus supersedes DEC().
I removed DEC() and changed it for X=XOR(A,B).


Here's one for you: I tested the hexbased value entry and found that when the number ends in ..DEF it returns 0. First I thought it had to do with exponential notation, but I can't really explain. It's only when it ends in ..DEF ? What going on here ?

( :lol: I already figured it out :lol: )

Regards.
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic

User avatar
carlsson
Class of '6502
Posts: 5516
Joined: Wed Mar 10, 2004 1:41 am

Postby carlsson » Tue Feb 02, 2010 4:29 pm

I can hear Britney Spears from far away..

Tokenizer, token-tokenizer, it's the tokenizer
Oh, tokenizer, oh, it's the tokenizer baby,
It, it, it is, it, it, it's the tokenizer, tokenizer, tokenizer

:lol:
Anders Carlsson



Image Image Image Image Image

User avatar
Pedro Lambrini
Vic 20 Scientist
Posts: 1132
Joined: Mon Dec 01, 2008 11:36 am

Postby Pedro Lambrini » Tue Feb 02, 2010 4:47 pm

Is all this work on Exbasic simply an academic excercise (not to diminish your work!) or is there real benefits to using this instead of Basic 2.0? As I'm starting to write Basic programs after decades in the wilderness I'm just a little curious. :)
"...That of the Eastern tribe being like a multitude of colours as if a rainbow had settled upon its brow..." Daniels 1:3

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

Postby Mike » Wed Feb 03, 2010 2:02 am

Pedro Lambrini wrote:Is all this work on Exbasic simply an academic excercise (not to diminish your work!) or is there real benefits to using this instead of Basic 2.0? As I'm starting to write Basic programs after decades in the wilderness I'm just a little curious. :)

In principle, you can express every program idea within BASIC 2.0.

BASIC extensions shine, where that algorithm either would run too slow in BASIC, or would need comparatively a lot of statements. If that function could be expressed with a short name, maybe with some parameters, BASIC extensions add this to the pool of available commands.

The speed advantage is there, because the same algorithm now is executed in machine language within the extension. The space advantage is a two-folded sword - within the BASIC listing you now only see the new command, with arguments as necessary. Of course the ML translation within the extension now needs space as well, typically in the same order is if the command had been expressed as subroutine within the BASIC program.

Some BASIC extensions try to be all-rounders, remedying many (sometimes only perceived) deficiencies of BASIC 2.0 regarding program flow structures (adding IF ... THEN ... ELSE, REPEAT ... UNTIL, DEF PROC, CALL: like Waterloo BASIC), easing screen manipulation, and sound (ExBASIC has some commands there), programming help (RENUMBER, AUTO, function keys: Programmers' Aid), or bitmapped graphics (Super Expander).

Others gain their usefulness by being specialised on a single task, but within small and compact code, like MINIGRAFIK does for hires graphics. :)

Greetings,

Michael

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

Postby wimoos » Wed Feb 03, 2010 2:03 am

Yes, I need a drink, academic of course, after all these hours...

But seriously, I keep two versions:

- one is Exbasic for VIC, with a lot of bugs fixed
- the other is Wimbasic, where I develop my own adaptions

If you need Exbasic.prg please let me know. I have regenerated a source file through disassembly, so in theory this can be assembled on a location other than $A000.

@Anders: it's 1983 ! Who is Britney Spears ?
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic

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

Bug in MAX() and MIN()

Postby wimoos » Sun Feb 07, 2010 11:13 am

Talk about academic...

In Exbasic, MIN() and MAX() are not recursive. That is, an expression like: A=MIN(4,MIN(8,9)) should give 4, but it gives 8.
Of course, in this case the error can be prevented by using: A=MIN(4,8,9).

But, when an expression like A=MIN(4,MAX(8,9)) is used, the result will be 9, where it should be 4. This can only be prevented by splitting it up in two statements.

In Wimbasic I have now solved this by keeping the running value, together with the operator, on the stack.

A working example could be: A=MAX(0,MIN(16,A)) to limit A in the range 0..16.


Regards,

Wim.
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic

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

New version available

Postby wimoos » Mon Feb 22, 2010 12:14 pm

A new version of Wimbasic is now available at

http://home.kpn.nl/oost4231/wimbasic.zip

I brought it back to 8131 bytes and this version contains the following improvements:

; FIXED MIN AND MAX TO BE RECURSIVE
; HELP SCROLLS ONE LINE INSTEAD OF FOUR
; PARAMETER CHECKING ON CEEK AND COKE (0..511)

Regards,

Wim.
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic

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

Postby Diddl » Mon Feb 22, 2010 12:46 pm

Thank you wimoos, wimbasic is great! :D

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

Full support for hexbased and binary entry

Postby wimoos » Thu Feb 25, 2010 4:04 pm

Found some more optimizations and I built in full support for hexbased and binary based value entry.

Wimbasic now can deal with the following expression:

X=XOR($4DEF,%1101)

Regards,

Wim.
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic

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

New version available

Postby wimoos » Fri Mar 12, 2010 1:49 am

This new version has more code improvements and the following fixes:

; FIXED DEEK AND CEEK TO BE RECURSIVE
; IMPROVED '.' HANDLING FOR GOTO, THEN, ELSE, RUN AND LIST

Regards,

Wim.
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic

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

Re: New version available

Postby Diddl » Fri Mar 12, 2010 2:27 am

wimoos wrote:This new version has more code improvements and the following fixes:

; FIXED DEEK AND CEEK TO BE RECURSIVE
; IMPROVED '.' HANDLING FOR GOTO, THEN, ELSE, RUN AND LIST

Regards,

Wim.


Could you explain more detailed about tthis improvements. Is this a better coding with same results or did you make a faster GOTO or another implementation?


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest