BasEdit.NET
Moderator: Moderators
-
- Vic 20 Afficionado
- Posts: 360
- Joined: Tue Apr 14, 2009 8:15 am
- Website: http://wimbasic.webs.com
- Location: Netherlands
- Occupation: farmer
Suitable for Basic extensions ?
Can BasEdit.NET be customized so that it understands Basic extensions, such as WaterLoo Structured Basic or Exbasic ?
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic
Should be fairly easy, I maintain a token table for standard BASIC V2 and SuperExpander right now.
I think some basic extensions use 2 byte tokens, right? This would require some modifications in my code, but nothing too serious. Additionally I should take the opportunity to make these token tables user definable with some external files, so BasEdit is freely configurable for any basic extension.
Can you provide me with a token list for ExBasic / WimBasic / WaterLoo Structured Basic?
Code: Select all
aToken(128) = "end"
aToken(129) = "for"
aToken(130) = "next"
aToken(131) = "data"
aToken(132) = "input#"
...
Can you provide me with a token list for ExBasic / WimBasic / WaterLoo Structured Basic?
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
- Mike
- Herr VC
- Posts: 5134
- Joined: Wed Dec 01, 2004 1:57 pm
- Location: Munich, Germany
- Occupation: electrical engineer
Waterloo BASIC even uses 3 byte tokens.Schlowski wrote:I think some basic extensions use 2 byte tokens, right?

Code: Select all
IF := $F3 $FF $FF
CALL := $F4 $FF $FF
LOOP := $F5 $FF $FF
ENDLOOP := $F6 $FF $FF
UNTIL := $F7 $FF $FF
WHILE := $F8 $FF $FF
ELSEIF := $F9 $FF $FF
ELSE := $FA $FF $FF
ENDIF := $FB $FF $FF
PROC := $FC $FF $FF
ENDPROC := $FD $FF $FF
QUIT := $FE $FF $FF
For this mechanism to work correctly, all the new keywords (with the exception of CALL, and QUIT) need to be first in a line. The manual even states, that *all* commands should be written in separate lines - but that strict requirement can be restricted to the new commands indeed. The new IF variant is not anymore followed by THEN with a multi-line-if.
Waterloo BASIC still accepts the old IF token for backwards compatibility to programs written with CBM BASIC V2, but that one does not, and cannot commence a IF .. ELSEIF .. ELSE .. ENDIF. They're listed the same, and upon an edit, the old IF is converted into a new IF.
Finally, the manual also discourages the use of GOTO, and GOSUB, as they can confuse the new commands as well. But they shouldn't be anymore necessary then, anyway.

P.S.: For those who use the version of Waterloo BASIC included with Mega-Cart - SYS44444 does an OLD after reset.

-
- Vic 20 Afficionado
- Posts: 360
- Joined: Tue Apr 14, 2009 8:15 am
- Website: http://wimbasic.webs.com
- Location: Netherlands
- Occupation: farmer
tokens for WimBasic / Exbasic
Here it comes for WimBasic. For Exbasic XOR ==> DEC and UNNEW ==> HARDCOPY
Regards,
Wim.
; OFF $01
; RENUM $02
; FIND $03
; DEL $04
; AUTO $05
; DUMP $06
; VPLOT $07
; CALL $08
; BORDER $09
; EXEC $0a
; MERGE $0b
; HPLOT $0c
; DOKE $0d
; SPACE $0e
; INPUTLINE $0f
; SET $10
; KEY $11
; CURSOR $12
; COLOR $13
; SOUND $14
; PLAY $15
; VOLUME $16
; RESET $dc
; MEM $dd
; TRACE $de
; BASIC $df
; RESUME $E0
; LETTER $e1
; HELP $e2
; COKE $e3
; GROUND $e4
; MATRIX $e5
; DISPOSE $e6
; PRINT@ $e7
; HIMEM $e8
; UNNEW $e9
; INPUTFORM $ea
; LOCK $eb
; SWAP $ec
; USING $ed
; SEC $ee
ELSE $ef
ERROR $f0
; ROUND $f1
; DEEK $f2
; STRING$ $f3
; POINT $f4
; INSTR $f5
; CEEK $f6
; MIN $f7
; MAX $f8
; VARPTR $f9
; FRAC $fa
; ODD $fb
; XOR $fc
; HEX$ $fd
; EVAL $fe
Regards,
Wim.
; OFF $01
; RENUM $02
; FIND $03
; DEL $04
; AUTO $05
; DUMP $06
; VPLOT $07
; CALL $08
; BORDER $09
; EXEC $0a
; MERGE $0b
; HPLOT $0c
; DOKE $0d
; SPACE $0e
; INPUTLINE $0f
; SET $10
; KEY $11
; CURSOR $12
; COLOR $13
; SOUND $14
; PLAY $15
; VOLUME $16
; RESET $dc
; MEM $dd
; TRACE $de
; BASIC $df
; RESUME $E0
; LETTER $e1
; HELP $e2
; COKE $e3
; GROUND $e4
; MATRIX $e5
; DISPOSE $e6
; PRINT@ $e7
; HIMEM $e8
; UNNEW $e9
; INPUTFORM $ea
; LOCK $eb
; SWAP $ec
; USING $ed
; SEC $ee
ELSE $ef
ERROR $f0
; ROUND $f1
; DEEK $f2
; STRING$ $f3
; POINT $f4
; INSTR $f5
; CEEK $f6
; MIN $f7
; MAX $f8
; VARPTR $f9
; FRAC $fa
; ODD $fb
; XOR $fc
; HEX$ $fd
; EVAL $fe
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic
Ok, finally managed to implement different token sets. Loadable via BasEdit.Ini for the moment.
Had much fun with the multi-byte tokens and the Waterloo Basic speciality with the extra bytes and overlapping keywords END / ENDLOOP / ENDPROC / LOOP. I made some tests with Basic V7, Waterloo Basic and WimBasic and everything seems to be fine. But since this was a more heavy change in code than I initially thought there may be some issues left. So any test and feedback is welcome!
Following Basic tokenlists implemented:
Thanks to Boray for the link and Wimoos for the tokens for Exbasic/WimBasic.
Just insert the desired file in BasEdit.Ini:
Tokenfiles have the following structure:
Should be straightforward, just take a look at the samples.
Had much fun with the multi-byte tokens and the Waterloo Basic speciality with the extra bytes and overlapping keywords END / ENDLOOP / ENDPROC / LOOP. I made some tests with Basic V7, Waterloo Basic and WimBasic and everything seems to be fine. But since this was a more heavy change in code than I initially thought there may be some issues left. So any test and feedback is welcome!
Following Basic tokenlists implemented:
Code: Select all
TokenList_AtBasic.txt
TokenList_BasicV10.txt
TokenList_BasicV2.txt
TokenList_BasicV3.5.txt
TokenList_BasicV4.txt
TokenList_BasicV4_C64.txt
TokenList_BasicV7.txt
TokenList_ExbasicLevel2.txt
TokenList_SpeechBasicV2.7.txt
TokenList_SuperExpander.txt
TokenList_TurtleBasic.txt
TokenList_WaterlooBasic.txt
TokenList_WimBasic.txt
Just insert the desired file in BasEdit.Ini:
Code: Select all
TokenFile=TokenList_BasicV2.txt
Code: Select all
; blablabla - comment
#include <anytextfile> - include another file
end,$80 - keyword END, token $80 (=128)
endloop,$F6,2 - keyword ENDLOOP, token $F6 (=246), two additional bytes in PRG file, ignored on load, filled with $FF on write
-
- Vic 20 Afficionado
- Posts: 360
- Joined: Tue Apr 14, 2009 8:15 am
- Website: http://wimbasic.webs.com
- Location: Netherlands
- Occupation: farmer
And thank you for BasEdit! I found that link when researching to make the Plus/4 vs Vic-20 analysing in PRG Starter.Schlowski wrote: Thanks to Boray for the link
PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
Tokenizer updated - with all these basic extensions my simple tokenizer routine got hit by the complexity to distinguish LOAD from DLOAD, detect VERIFY and not verIFy but understand that A=AANDB means a=aANDb, i.e sometimes keywords are in the middle of words, sometimes not, etc.
I hope now my solution generates compatible files for all Basic extensions.
I hope now my solution generates compatible files for all Basic extensions.
Another update - Mike showed me an error concerning shifted chars, which looked ok but did not work in a program:
This did not work, one could press {shift-s} for an eternity, "OK!" would never be printed.
I had to add 96 to characters in the range from 97 to 127 resulting in 193 to 223, then everything runs fine.
Funny thing is that CHR$(97) results in the same character as CHR$(97+96).
POKE <> ASCII <> PETSCII <> TOKENCODE, thank god that Commodore did not care about UNICODE
Code: Select all
1GETA$:IFA$="{shift-s}"THENPRINT"OK!"
2GOTO1
I had to add 96 to characters in the range from 97 to 127 resulting in 193 to 223, then everything runs fine.
Funny thing is that CHR$(97) results in the same character as CHR$(97+96).
POKE <> ASCII <> PETSCII <> TOKENCODE, thank god that Commodore did not care about UNICODE

Working on label mode, i.e. replacing all line numbers with labels and eliminating all unneded labels.
While creating these labels the source is split to single instructions per line where applicable and automatically indented a little bit for better reading.
In label mode detection of line numbers is replaced by detection of labels for syntax highlighting, this was a bit tricky but seems to be ok right now.
For the moment I'm concentrating on Basic V2, I will have to enhance the keyword files with some additional information like indentation, if a keyword follows a line number and if a line break is allowed after certain keywords. But before fiddling with enhanced Basics I want to be able to go back, i.e. generate from program in label mode a valid Basic V2 program.
Sample of what I have achieved so far:
Original source to Videopoker - this is the complete source, even in Basic V2 mode this is much easier to read and follow than on the VIC with 22x23 characters...

And this is what you get after a click on "Convert line# to labels" - this does not fit in one screen as breaking up the long lines results in 313 instead of 83 lines:

While creating these labels the source is split to single instructions per line where applicable and automatically indented a little bit for better reading.
In label mode detection of line numbers is replaced by detection of labels for syntax highlighting, this was a bit tricky but seems to be ok right now.
For the moment I'm concentrating on Basic V2, I will have to enhance the keyword files with some additional information like indentation, if a keyword follows a line number and if a line break is allowed after certain keywords. But before fiddling with enhanced Basics I want to be able to go back, i.e. generate from program in label mode a valid Basic V2 program.
Sample of what I have achieved so far:
Original source to Videopoker - this is the complete source, even in Basic V2 mode this is much easier to read and follow than on the VIC with 22x23 characters...

And this is what you get after a click on "Convert line# to labels" - this does not fit in one screen as breaking up the long lines results in 313 instead of 83 lines:

This sounds interesting indeed! 

PRG Starter - a VICE helper / Vic Software (Boray Gammon, SD2IEC music player, Vic Disk Menu, Tribbles, Mega Omega, How Many 8K etc.)
-
- Vic 20 Afficionado
- Posts: 360
- Joined: Tue Apr 14, 2009 8:15 am
- Website: http://wimbasic.webs.com
- Location: Netherlands
- Occupation: farmer
THEN in Exbasic/Wimbasic
Please note that in Exbasic and in Wimbasic, THEN can be omitted when this does not lead to ambiguity.
VICE; selfwritten 65asmgen; tasm; maintainer of WimBasic