Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
Site SearchSite Search   LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
VM reference document

 
Post new topic   Reply to topic    Forum Index -> ZBasic Language
Author Message
stevech



Joined: 23 Feb 2006
Posts: 657

Posted: 19 October 2006, 16:07 PM    Post subject: VM reference document Reply with quote

Perhaps few users would be interested, but it would be useful to have a brief document on the VM instruction set so we could look at how to arrange our programs to yield the most efficient VM code.
Back to top
mikep



Joined: 24 Sep 2005
Posts: 765
Location: Austin, TX

Posted: 19 October 2006, 16:33 PM    Post subject: Re: VM reference document Reply with quote

stevech wrote:
Perhaps few users would be interested, but it would be useful to have a brief document on the VM instruction set so we could look at how to arrange our programs to yield the most efficient VM code.

I think you are asking for two different things here. One is some kind of quick reference on VM instructions which is quite easy to create because listing files show the instructions set.

The other one is much harder and has more to do with writing good Basic code in the first place. Compare to programming in C - it is very easy to write poor performing code. However the corollary is not true - you can still write well-performing code without knowing the target platform - just let the compiler do its job. This should be just fine for most people.

Nevertheless your point is valid. What is needed is some best programming practices for ZBasic. As a starting point take a look at some of work I did on BasicX and the kinds of things I did to boost performance of poorly written code. Part 4 (section 4.4) of my six part treatise on BasicX internals (http://home.austin.rr.com/perks/micros/Articles/) and its virtual machine language is particularly relevant. If you read the whole set of articles you will see that I also document the BasicX instruction set and internal data structures (all without access to listing files or virtual machine source code).

To get you started here is one practical tip. To reduce RAM usage you should carefully organize expressions and sometimes it is better to separate a complex expression into multiple lines of code. Expressions are evaluated in RPN form and so it is helpful to keep the depth of the evaluation tree to a minimum. This is because the ZBasic instructions are defined using a stack-based language.
Back to top
dkinzer
Site Admin


Joined: 03 Sep 2005
Posts: 2499
Location: Portland, OR

Posted: 19 October 2006, 17:10 PM    Post subject: Re: VM reference document Reply with quote

stevech wrote:
[I]t would be useful to have a brief document on the VM instruction set [...]

That task is on the list of things to do. That said, I suspect that many users can read the listing and understand what's going on without much trouble, especially since the original source lines are interleaved. Also, since the ZBasic VM and the BasicX VM both employ the commonly used "stack machine" architecture, reading Mike's BasicX documents will be helpful in understanding the listing file.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> ZBasic Language Time synchro. with the server - Timezone/DST with your computer
Page 1 of 1

 


All content Copyright © 2005-2012 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group