|
- Forum - iziBasic
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 257
Sujet n° 1461 |
Converting from SmallBasic to Izibasic |
le 08/10/2006 @ 05:35 par trent
|
Hello, I have been programming in "Basic" for years and just can't figure out how to convert my existing programs into Izibasic. My programs mostly just write to the screen using "Print" and "input" statements. I see no way to do this in Izibasic. I have read the PDF documentation and looked through the sample files but none of them really just write to the screen etc. Can someone point me in the right direction ? Thanks. -trent-
|
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 11 -------- le 19/10/2006 @ 09:21 par Dave O\'Brien
visiteur |
Hi Trent, welcome to iziBasic. Yes, it has a few idiosyncrasies that you're running into now, but those are usually easy to learn or work around.
Labels can't include reserved words, and "done" may be reserved. An easy way to avoid this is to preface your labels with an underscore, like this:
gosub _done
_done: <put subroutine code here return
For variables, you can either use the built-in predefined variables A-Z and A$-Z$, or you can use your own custom-name variables, which must be marked with special characters: - numeric variables start and end with a percent sign (e.g. %choice%) - string variables start with % and end with $ (e.g. %choice$)
Before you use custom-name variables, you must declare them with a DIM statement at the start of your code, just below the compiler directives.
Hope this helps! |
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 12 -------- le 19/10/2006 @ 12:23 par trent
visiteur |
Hi Dave, Thanks for your help. I Just need to clarify something here. Variables can be single letters a through z for numbers or A$ through Z$, for letters,is that right ? -trent-
|
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 13 -------- le 19/10/2006 @ 18:30 par aldweb
visiteur |
Thank you Dave for your very clear explanations to trent.
Yes, [iziBasic] has a few idiosyncrasies that you're running into now, but those are usually easy to learn or work around.
This is right: iziBasic, just like any implementation of a BASIC language has its specificities. Some are wanted, because I wanted to have iziBasic quite close from the BASIC implementations on computers of the 1980's as I believe Basic was "easy" ("izi" from iziBasic sounds like "easy" when pronounced in French) to use and understand at that time. Others (Dave's other post) are less likely to be so much wanted. They are part of the way I developed the iziBasic compiler and runtime at execution time.
Labels can't include reserved words, and "done" may be reserved. An easy way to avoid this is to preface your labels with an underscore
In "done" DO is a reserved word (page 20 of user manual). In iziBasic, the syntax analysis of the source code goes from left to right, from top to bottom, in one single pass, stopping at the first letter giving a full reserved word. This was quicker to develop but resulting to this side effect. Prefetching with an underscore solves the side effect, so no big deal. trent, would you have checked page 17 of the user manual, you would have found the answer by yourself.
For variables, you can either use the built-in predefined variables A-Z and A$-Z$, or you can use your own custom-name variables Pages 10 and 20 of the same user manual explain this topic.
Variables can be single letters a through z for numbers or A$ through Z$, for letters,is that right ? This is right (page 10 of user manual), for variables reserved by default in memory, no need to declare them. Other variables indeed need to be declared with the DIM statement (page 20).
Cheers, aldweb
|
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 14 -------- le 19/10/2006 @ 18:32 par aldweb
visiteur |
Let's add that the memory organization of the iziBasic virtual machine (runtime) is explained in appendix #9, page 102 of the user manual.
Cheers, aldweb
|
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 15 -------- le 19/10/2006 @ 19:04 par aldweb
visiteur |
Reading back what I wrote, I have the feeling that I could hurt you, dear trent, by always writing where in the user manual the information is... just like if you were asking before reading.
So please let me just make it clear: my only objective is to help you finding your way in the manual, as a reference, that's all. Questions are always welcome, this forum is clearly ment to help people getting started.
Cheers, aldweb
|
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 16 -------- le 20/10/2006 @ 02:10 par Trent
visiteur |
Hi Dave, I've been reading my programming books about the DIM statement and Arrays and darned if I can figure out how that applies to my variable names. I just want to use variable names like: c$ htpt, ltpt,ltst, htst, plt, pht, slt, sht. Could you give me an example of how to use the DIM statement for these ? These are all variables that I already use in an existing program I wrote in Basic and they run fine in Tiny Basic, GW-basic, MSbasic, Turbo Basic etc. Ie; Input "Enter the low temperature of the Primary Transmitter ";ltpt Gosh, this is like having to learn programming from the start. That is why I haven't learned C or Pascal etc. Everything I needed to do was easily done in plain old basic without Arrays etc. Just plain and simple code. None of my Color calls work either ie: color 15,4 etc. And the Izibasic documentation doesn't address that at all that I can see. I guess the main problem with the Izibasic doc's is that their are not many examples for the kind of old fashioned programming that I do. If I could find examples then I could convert my code without having to bother you and Aldweb all the time. The pre-buy documentation for Izibasic says that it workes with existing basic and Tiny basic etc. I had hoped it would be a drop in for my programs so I could get them on my Palm Zire 72. The Tiny Basic was OK but it lacked ease of moving code from Desktop to PDA etc. Anyway, thanks for listening to me venting, and I will keep trying. Thanks in advance. -trent-
|
|
|
Warning: A non-numeric value encountered in /web5/aldweb/www/aldweb_com/www/thread.php on line 497
Réponse n° 17 -------- le 20/10/2006 @ 15:54 par aldweb
visiteur |
Hello Trent,
I just want to use variable names like: c$ htpt, ltpt,ltst, htst, plt, pht, slt, sht. c$ is auto-defined, this is a one letter variable For the other variables, use: 1. if they are numeric variables
DIM %htpt%, %ltpt%, %ltst%, %htst%, %plt%, %pht%, %slt%, %sht% 2. if they are string variables
DIM %htpt$, %ltpt$, %ltst$, %htst$, %plt$, %pht$, %slt$, %sht$
Then:
Input "Enter the low temperature of the Primary Transmitter ",%ltpt% or
Input "Enter the low temperature of the Primary Transmitter ",%ltpt$
None of my Color calls work either ie: color 15,4 etc. Color of text and background is not implemented in the basic Console mode. The COLOR statement, used in Graphics mode, takes only one parameter, the frontcolor of the pen. Would you wish to write some text with specific front and back-colors, use the GPRINT statement.
Gosh, this is like having to learn programming from the start. I am sorry you get this feeling. But I am really hoping that once you will get used to coding with iziBasic, you will read back this thread saying... "well, that wasn't that hard."
I guess the main problem with the Izibasic doc's is that their are not many examples for the kind of old fashioned programming that I do. Did you look at the Console sample source codes provided in the iziBasic package? This is usually a good way to understand the differences between the iziBasic dialect and other Basic dialects...
The pre-buy documentation for Izibasic says that it workes with existing basic and Tiny basic etc. I never wrote such a thing. What I precisely wrote as a presentation of this compiler was: "As its name also states it, iziBasic uses the BASIC high level and very easy to learn development language, a customized subset of it to be precise."
Keep the good work, you are close to succeeding. If that could be helpuf to you, maybe drop me one of your source codes (confidentiality guaranteed), a small one please, so that I "convert" it. Then, reading it, might help you getting started faster.
Cheers, aldweb
|
|
|
sujet actif
sujet clos
Important!
Nouveau message -
Rectifier message
Clôturer sujet
Remonter
|
|