Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
New beta release 1.2.7r1866
#1
Okay, a new beta release with a fix and two interesting optimizations :!:
  • ! The optimizer could hang under rare circumstances. Fixed.
  • ! The csrlin() routine had a bug reporting sometimes the wrong position (this also affected Input() library which uses it). Fixed.

  • + Every BEEP command always took 21 bytes. Now it only takes 11 bytes and it's faster (good for sound effects) if only constant numbers are used. So beep <num1>, <num2> is much optimized.
  • DRAW routine has been improved for speed. Now it's 200% faster (aprox.) and takes only 150 bytes more.
  • PLOT, DRAW & CIRCLE now uses SCREEN_ADD positioning => you can "DRAW" at part of the memory pointed by this internal variable.

To do:
  • If several constant beeps (BEEP <num1>, <num2>) are specified one after another, they will be "compressed" and played with a beep sequencer. So every beep in the sequence takes only 4 bytes.
  • A new library routine is in preparation: polyline, which draws a sequence of lines to coords Xn, Yn:
    Code:
    REM A list of coords (Unsigned Bytes)
    DIM CoordList(10, 2) as UByte = { {1, 1}, {3, 100}, {20, 80}, ... _
                            ... ' More coord lists
                         {128, 189}}

    REM Draws a polilyne of 10 coordinates, taking coord 0 as the 1st one
    REM The 2nd 0 is mondatory, but useless here.
    PolyLine(10, @CoordList(0, 0))
  • UBound and LBound soon to come (for getting the Upper and Lower bound of arrays).
    Code:
    DIM a(2 To 5, 1 TO 8) as Byte

    PRINT Ubound(a, 1) : REM prints 2
    PRINT LBound(a, 2) : REM prints 8
  • Variable parameters function calls, like in FreeBasic or C
    Code:
    Function Avg(n as uByte, ...)
        ...
    End Function

    PRINT Avg(3, 2.5, 3.6, 7.8)
    PRINT Avg(5, 1, 4, 5, 7, 9)
    This way, function AVG can receive any numbers of parameters of any type.
Meanwhile, you can download 1.2.7-r1866 here, as always: <!-- m --><a class="postlink" href="http://www.boriel.com/files/zxb">http://www.boriel.com/files/zxb</a><!-- m -->
Reply
#2
Downloading now!

Some nice changes there, and some interesting stuff for the future. Variable-parameter function calls will be potentially very useful, I'm sure!
Reply
#3
Seems to be working fine, although I do get a "input.bas:38: warning: Empty loop" message every time I compile my code. Is that anything to worry about? Smile
Reply
#4
LTee Wrote:Seems to be working fine, although I do get a "input.bas:38: warning: Empty loop" message every time I compile my code. Is that anything to worry about? Smile
It is just a warning, not a error. Its just saying: Your code does not do anything.
If you make a procedure and do not use it, you will get warnings too, because procedures that are not used, are a waste of time and ressources. :mrgreen:

@Boriel: Any example how SCREEN_ADD can be used?
------------------------------------------------------------
http://lcd-one.da.ru redirector is dead
Visit my http://members.inode.at/838331/index.html home page!
Reply
#5
LCD Wrote:
LTee Wrote:Seems to be working fine, although I do get a "input.bas:38: warning: Empty loop" message every time I compile my code. Is that anything to worry about? Smile
It is just a warning, not a error. Its just saying: Your code does not do anything.
That's right! Idea But here the loop is necessary to wait for a key press in the input loop. :roll: I will put a #pragma option to disable warnings an the like if you expect them and know your code is OK.
LCD Wrote:If you make a procedure and do not use it, you will get warnings too, because procedures that are not used, are a waste of time and ressources. :mrgreen:
Yes, but even more: if the computer warns you about unused functions & procedures it also means it won't compile them in the final program to save space :wink: This way, when you include a .BAS library unused functions won't be included. I also will put a #pragma to disable warnings on this. Even more, to reduce compile time, i'm thinking in creaing .obj / .lib files. What do you think?
Quote:@Boriel: Any example how SCREEN_ADD can be used?
SCREEN_ADDR is defined in the <cls.asm> module, and included by default if PRINT, PLOT, CIRCLE, DRAW are used since all of them use this var (the cls.asm routine is fast and really small, just two LDIR sequences, so including it worths the hassle). To use SCREEN_ADDR, you can create your own function or macro. I was thinking in defining it in a .BAS library, like a simple macro (better than a function), but the macro processor zxbpp.py is not ready for that then :oops: So a Fasctall Function is enough:
Code:
SUB FASTCALL SetScreenAddr(x AS Uinteger)
    ASM
    ld (SCREEN_ADDR), hl
    END ASM
END SUB
A very simple function indeed! Since Fastcall functions gets their 1st argument directly in HL, we're done with a single asm line. Anyway, this feature is *really* beta, and untested. Confusedhock: So I expect it to fail when SCREEN_ADDR != defaul 16384 value.
+2 and newer Spectrum models can map the SCREEN output to another location with an OUT to 7FFDh So you can draw there and use it.
You can also draw in another hidden RAM location and later dump it with a memcopy / memove (see .BAS library).
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)