Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
About constants
#5
boriel Wrote:Thank you for your interest. I will fill in the documentation as soon as possible. If you can use subversion (or tortoiseSVN for windows) I encourage you to try de alpha developing version. Just clock on the zxbasic directory with your File Explorer and do a SVN Update. Currently 3 new features are in the alpha version:
  1. If you specify an optimization level like, zxb -O2 program.bas then unused functions won't be compiled Wink
  2. You can start arrays by default with lower bound 1 (the default is 0): DIM a(10) is the same as DIM a(0 TO 10). If you want them like in Sinclair Basic, use zxb --option-base=1
  3. The print, DRAW, PLOT and CIRCLE routines has been slightly optimized (they use attributes in a more efficient way).
I did not used tortoiseSVN yet, but will try this, currently started the download. The new features sounds great. Not using ROM Routines for DRAW, PLOT and CIRCLE means the Coordinate range for Y 0 to 191, excellent! I pointed Website Watcher to the directory of ZX Basic, so I will be informed if anything changes, as I run it every day. But it would be nice to have a changelog to see what was changed from previous version.

Quote:Yes, a macro is faster than a procedure/function, but takes more memory. Use it only for very simple functions (like the square example above). Macros can have more than one line. Look in library/retrace.bas

ZX BASIC supports FUNCTIONS and procedures (SUB). Declared variables (with DIM) in them are local. In fact SCREEN$, POINT and ATTR are implemented this way. Function calls uses the STD_CALL convention (used in most compilers today). You can see the library of high-level functions in the library/ directory to see how functions are implemented (some of them use inline ASM).

To use a function from the library (e.g. SCREEN$), use #include directive:
Code:
#include <screen.bas>

For functions/subs that use only 1 or none parameters you can use the FASTCALL convention (parameteres are passed in the registers). This is VERY internal Wink so please, ask me more if interested.
Aha, include them... good to know. I guess, it is possible to include any other ZXBasic programm too. I was about to ask it... It sounds well developed. I'm now much more encouraged to use your program often.


Quote:Binary numbers here are written either %0111 or 0111b Wink
Sounds logical after all. Good to know, even if I prefer to use % and $ for binary and Hex.

Quote:Is HiSoft BASIC available today for FREE? I would like to try it.
Yes, you can download it with the instruction from here:
<!-- m --><a class="postlink" href="http://www.worldofspectrum.org/infoseekid.cgi?id=0008249">http://www.worldofspectrum.org/infoseek ... id=0008249</a><!-- m -->
I'm using the debugged version in 48K Basic running on real Hardware.
Also Uschi is a very good compiler (german): <!-- m --><a class="postlink" href="http://www.worldofspectrum.org/infoseekid.cgi?id=0008927">http://www.worldofspectrum.org/infoseek ... id=0008927</a><!-- m -->, even if limited to integer and not accepting strings, but very fast.
Other compilers are not that good because they include the complete compiler runtimes.

Quote:You can embed your PLOT routine this way:
Code:
SUB FASTCALL myplot(x AS UBYTE, y AS UBYTE)
    ASM
    pop hl ' HL gets the return address
    ex (sp),hl ' HL now contains the X parameter (in H register)
    ' Now A register contains Y
    ' and H register contains X
    ' ASM includes must be included within asm scope
#include "myplot.asm"
     END ASM
END SUB

Aha, I think, I now know how it works, very clever!!! Thank you.
Quote:Note: ZX BASIC is (by now), case sensitive. This means that for your function and variables, MYVARIABLE and myvariable refers to diferent variables.
I did not noticed that yet, because all my variables are lower case, but thank you for the warning :-).
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)