Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 258
» Latest member: manuelzo75
» Forum threads: 1,074
» Forum posts: 6,434

Full Statistics

Online Users
There are currently 414 online users.
» 0 Member(s) | 412 Guest(s)
Bing, Google

Latest Threads
.tap file code not execut...
Forum: Help & Support
Last Post: Zoran
04-28-2025, 10:59 AM
» Replies: 4
» Views: 184
Exit from more than one l...
Forum: Wishlist
Last Post: Duefectu
04-23-2025, 10:06 PM
» Replies: 3
» Views: 258
put small ASM programs li...
Forum: How-To & Tutorials
Last Post: Zoran
04-18-2025, 02:02 PM
» Replies: 6
» Views: 1,520
Creating +3 Menus - Loadi...
Forum: Help & Support
Last Post: merlinkv
04-16-2025, 02:08 PM
» Replies: 6
» Views: 512
Randomize not very random...
Forum: Help & Support
Last Post: Zoran
04-08-2025, 10:40 AM
» Replies: 4
» Views: 414
Scope rules
Forum: Bug Reports
Last Post: Zoran
04-04-2025, 09:46 AM
» Replies: 2
» Views: 286
Using constants not allow...
Forum: Bug Reports
Last Post: baltasarq
03-19-2025, 10:00 PM
» Replies: 8
» Views: 1,012
404 page not found
Forum: Documentation
Last Post: boriel
03-08-2025, 07:16 PM
» Replies: 5
» Views: 2,849
Spectrum keywords codes
Forum: Bug Reports
Last Post: boriel
03-08-2025, 11:00 AM
» Replies: 1
» Views: 394
ZXodus][Engine
Forum: ZX Basic Compiler
Last Post: boriel
02-19-2025, 11:43 PM
» Replies: 69
» Views: 213,422

 
  Color control codes
Posted by: LCD - 05-21-2009, 01:37 PM - Forum: ZX Basic Compiler - Replies (7)

Hallo boriel, you wrote, the control codes can be used like in BasIn, I tested it:

Code:
print at 0,0;"\{i7}\{p2}\{b1}Test"
works fine, but BasIn allows this too:
Code:
print at 0,0;"\{i7p2b1}Test"
which does not work. Is this a bug?

Quote:The escape sequences for control characters are as follows:
\{in}
Ink colour n, where n is in the range 0 to 7.
\{pn}
Paper colour n, where n is in the range 0 to 7.
\{bn}
Bright n, where n is 0 or 1.
\{fn}
Flash n, where n is 0 or 1.
Note: Control character escape sequences can be combined, so that for instance \{i6p1f1} is equivalent to \{i6}\{p1}\{f1} - flashing yellow ink on blue paper.

Btw: Release 1.2.1 is excellent. My latest test Program needed 8 Kb before, now it is only 4 Kb...

Print this item

  Version 1.2.1 released!
Posted by: boriel - 05-19-2009, 11:18 PM - Forum: ZX Basic Compiler - No Replies

Changes since 1.2.0

  • ! This version just fix a possible memory corruption (reported by britlion, thanks).
    But still needs more checking...
  • ! DIM f% = <value> was not allowed. Now it is.
  • Programs can now be re-runable without having to LOAD them again once returned to BASIC.
  • * Some little improvements on memory organization. Now all user-data (HEAP and VARs) are in a single contiguous block.
    This will make possible to implement SAVE "" DATA in the near future so a program can LOAD & SAVE data.

TO DO:
... Many things! Wink

Print this item

  Bug: String Slicing (*solved*)
Posted by: britlion - 05-19-2009, 07:42 PM - Forum: Bug Reports - Replies (7)

I think string slicing still has bugs in it. Not quite sure why this fails, but it produces code that runs briefly and crashes, running in Spectaculator:
(fails with or without the DIM statements, but crashes differently in each case)

Code:
DIM A$,p$ as string
DIM start,fin as integer

10 LET a$="This is a very long scrolly string that I am going to print"
20 LET start=1
30 LET fin=32
40 LET p$=a$(start TO fin)
50 LET start=start+1
60 LET fin=fin+1
70 IF fin>LEN a$ THEN LET fin=1  : END IF
80 IF start>LEN a$ THEN LET start=1 : END IF
90 PRINT AT 0,0;p$
100 IF start<fin THEN GO TO 40 : END IF
110 LET p$=a$(start TO )+a$( TO fin)
120 GO TO 50


Correcting the 1 to Zero (Since in compiled code the strings begin slicing at zero) has no effect other than change the way it crashes:

Code:
DIM A$,p$ as string
DIM start,fin as integer

10 LET a$="This is a very long scrolly string that I am going to print"
20 LET start=0
30 LET fin=31
40 LET p$=a$(start TO fin)
50 LET start=start+1
60 LET fin=fin+1
70 IF fin>LEN a$ THEN LET fin=0  : END IF
80 IF start>LEN a$ THEN LET start=0 : END IF
90 PRINT AT 0,0;p$
100 IF start<fin THEN GO TO 40 : END IF
110 LET p$=a$(start TO )+a$( TO fin)
120 GO TO 50

Print this item

  Making ZX Basic to work with Tommy Gun
Posted by: boriel - 05-17-2009, 12:47 PM - Forum: How-To & Tutorials - Replies (8)

Tommy Gun is a great Retro-develpment IDE.
As of version 0.9.39 it's author add some modifications so ZX Basic compiler will also work with this excellent IDE.

Just follow this steps:

  • Download & Install Tommy Gun (v. >= 0.9.39)
  • Download & Install ZX Basic .MSI version for Windows (see http://www.boriel.com/files/zxb)
  • On the Tommy Gun IDE Config options, go to Build Settings, and configure builder options as shown (ZX Basic already comes pre-configured):
    [Image: attachment.php?aid=298]
  • Save them, and you're done!


Only the remarked (in red) fields are necessary.

From now on, you have syntax highlighting and error line location. To go to an error line, just click on the compilation error message and the cursor will jump to the respective line automatically.

You might be interested in changing some command line options (to change output format, etc...). See command line options documentation for more info.



Attached Files
.png   Captura de pantalla de 2020-05-03 11-39-58.png (Size: 53.91 KB / Downloads: 1402)
Print this item

  Version 1.2.0 released!
Posted by: boriel - 05-12-2009, 12:06 AM - Forum: ZX Basic Compiler - No Replies

Changed from Version 1.1.9 to 1.2.0

  • ! Undeclared local variables caused a compiler error.
    They should just compile (like global ones do). Thanks, LCD.
  • ! String variables used in string slices where sometimes
    optimized (ignored). Thanks, LCD, again. Wink
  • ! ELSEIF constructions were not being compiled correctly.

TODO:
  • Bitwise instructions for AND, OR, XOR, NOT
  • CLEAR to fill memory areas
  • READ, DATA and RESTORE
  • SAVE & LOAD

Print this item

  optimised INCR & DECR variable
Posted by: LCD - 05-11-2009, 10:02 PM - Forum: Wishlist - Replies (2)

Because I also coded some stuff in AMOS on Amiga: How about optimised INCR and DECR commands for variables? This can be easyly optimised because Z80 knows INC and DEC commands, and variable=variable+1 is maybe much slower.
INCR variable incrases the value by one. This will be very handy, I think Smile.

Print this item

  STR problem (*solved*)
Posted by: LCD - 05-11-2009, 01:19 PM - Forum: Bug Reports - Replies (12)

Code:
SUB MeineRoutine(x as uinteger,y as uinteger,a$ as string)
IF a$="Test" THEN erg$="Es wurde nur getestet"
ELSE erg$=a$+str(x)+" "+str(y)
end if

PRINT erg$
END SUB

MeineRoutine(30,11,"Hallo")
Compiler claims "temp.bas:48: Error: Undefined label '_MeineRoutine_erg' Errors occured, compilation failed" (No line 48 defined)
I guess, this is a Problem with STR because this:
Code:
dim a as ubyte
a=20
print str(a)
Produces a code that crashes the Emulator

BTW: should POKE STRING adr,string$ work? I mean, if POKE UINTEGER works...

Print this item

  Memory Map
Posted by: LCD - 05-11-2009, 12:22 PM - Forum: Wishlist - Replies (9)

As mentioned on WOS:
A idea for the future version: How about the compiler generating a text file with memory map (not very complex... or with selectable level of detail) I think, something like:
25000-45678 : Main Program
45679-52111 : ASM: Label GRAPHICSDATA
52112-59876 : ASM: Label LevelData
59877-60521 : Variables
or:
25000 : Main Program
45679 : ASM: Label GRAPHICSDATA
52112 : ASM: Label LevelData
59877 : Variables
Level of Detail:
0=Only Program and Variables
1=like 0, but additionaly ASM Labels
2=like 1, but additionaly Basic Labels
3=like 2, but adresses of every used variable added (HiSoft Basic Compiler does this too, this will make it easier to alter or read variables of compiled programs from BASIC Loader for example)

Using a switch like -m level, -M "Filename.txt" or similar (I do not know how the parser works, maybe this can be joined into a single switch)
Memory map can then be parsed by the editor, or the user can check the details.

Print this item

  Found another bug (*solved*)
Posted by: LCD - 05-11-2009, 11:58 AM - Forum: Bug Reports - Replies (1)

Hi Boriel,

Code:
dim a$ as string

a$="This is a test"
print a$

print a$( to 4)
print a$(5 to)

This works, but
Code:
dim a$ as string

a$="This is a test"
print a$( to 4)
print a$(5 to)

This claims "Variable a never used" and compiler stops (version 1.1.9)

Edit: Btw: should POKE STRING adr,string$ and string$=PEEK STRING adr work?

Print this item

  Version 1.1.9 released!
Posted by: boriel - 05-09-2009, 08:56 PM - Forum: ZX Basic Compiler - No Replies

Changes from Version 1.1.7 to 1.1.9

  • ! Fixed a bug for constant string slicing, so
    "0909"(A TO B) now works. Thanks to britlion.
  • ! Expanded grammar to allow something like "0909"(f)
    or "0909"() which are also allowed in Sinclair Basic. Thanks to britlion.
  • ! When used expressions like "0909"(f) (like above) might corrupt
    HEAP memory, leading to a program crash. Fixed. Thanks, britlion Wink
  • ! Fixed a wrong number conversion (type CAST) from signed integers
    to floating point numbers which might cause wrong (random) results.
  • ! '%' suffix was being ignored.
  • ! Global string variables were not optimized unless declared
    with '$' suffix. Fixed.

TODO:
  • Bitwise instructions for AND, OR, XOR, NOT
  • CLEAR to fill memory areas
  • READ, DATA and RESTORE
  • SAVE & LOAD

Print this item