Welcome, Guest |
You have to register before you can post on our site.
|
Online Users |
There are currently 425 online users. » 0 Member(s) | 423 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: 186
|
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,521
|
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,013
|
404 page not found
Forum: Documentation
Last Post: boriel
03-08-2025, 07:16 PM
» Replies: 5
» Views: 2,852
|
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,482
|
|
|
for without next error |
Posted by: maeloterkim - 10-10-2021, 02:22 PM - Forum: Help & Support
- Replies (3)
|
 |
Hi
I found that if i dont write a next in a for the compiler only says "error: Unexpected end of file"
pointing to the LAST LINE of the program
if i only have a few lines is "easy" to find the error
but if i have 2000 or more lines is a crazy thing to find the error
Can the compiler add a rule to search if every FOR have a NEXT and throw the error "for without next" ?
This way is more easy to find the error in a BIG program with a lot of lines
You can look the example code
''EXAMPLE CODE WITH EXPLAINED ERROR
dim example as uByte = 0
for example = 0 to 10
print example
'' THE NEXT MUST GO HERE IN LINE 9 but the compiler logically dont know that
'' BUT Can the compiler say "error: for without next"
'' instead of "19: error: Unexpected end of file" ?
'' because if we have 2000 or more lines
'' and we dont know what happens
'' is a crazy thing search that error
print "end of program"
|
|
|
not updating the DF CC variable |
Posted by: maeloterkim - 10-01-2021, 08:46 AM - Forum: Help & Support
- Replies (3)
|
 |
Hi
In the original ZX spectrum basic when you PRINT something the variable DF CC is updated with the screen position
for example the next program must print 16384 that is the first position of the screen
but the only answer always with every diferent position is 16448
this means that the print routine is not updating the DF CC variable like the original ROM
Is this a bug?
You can try this program and change the coordinates of the first print 0,0
Code: dim myScreen as uInteger
print at 0,0;
myScreen = peek (uInteger, 23684) '' 23684 = DFCC = Must be screen position after every print
print at 10,10; myScreen
|
|
|
DEFADD trick with ZX BASIC compiler? |
Posted by: maeloterkim - 09-22-2021, 07:45 PM - Forum: Help & Support
- Replies (1)
|
 |
Hi
In the normal basic of zx spectrum 48k there is a behaviour or trick like this
you can change the address of DEFADD variable
and after this you can copy bytes very fast Is like an assembler LDIR
I will explain more
you can have 2 variables A$ and B$ for example
every one of this variables can have 1000 bytes
when you do A$ = B$ the 1000 bytes of B$ are copied on A$
Normally DEFADD points to the beginning of the variables definitions
for example (invented numbers)
DEFADD_POINTER_ADDRESS ;;'' defadd initial definitions of variables
A$ begins on 30000 and have 1000 bytes of size
B$ begins on 32000 and have 1000 bytes of size
etc ...
The trick is that in BASIC we can change the DEFADD address and put any thing
for example we can do
CHANGED_DEFADD_POINTER_ADDRESS ;;'' CHANGED defadd initial definitions of variables
A$ begins on 16384 and have 256 bytes of size
B$ begins on 32000 and have 256 bytes of size
etc ...
This way we can do A$ = B$ and copy 256 very fast to the screen !!!
this is better explained here in spanish
https://blog.jafma.net/2020/03/16/effici...m-iv/#sp_5
and here in english
https://blog.jafma.net/2020/03/16/effici...m-iv/#en_5
and here a video in spanish explaining this trick
https://www.youtube.com/watch?v=VKJ2dePykdA
I tried this trick with compiled zx basic but is not working because seems
that string variables are not doing the same behavior that original ROM
|
|
|
Is there a list somewhere that explains how to optimize? |
Posted by: maeloterkim - 09-15-2021, 06:19 AM - Forum: Help & Support
- Replies (2)
|
 |
Hi
Is there a list somewhere that explains how to optimize?
i explain
Normally in compilers if you put the code in one way it is more efficient than if you put the code in another way
For example you can do
variable ++ or variable = variable + 1
or maybe if you use local variables it is more efficient than if you use global variables
perhaps the compiler translates with fewer bytes and more efficiently one way or another
Is there somewhere a recomended list of tricks to write a more efficient syntax that translates better to assembler
and uses less memory and fewer bytes?
|
|
|
warning: [W180] Unreachable code problem? |
Posted by: maeloterkim - 09-10-2021, 06:17 PM - Forum: Bug Reports
- Replies (5)
|
 |
Hi if i compile this, says
warning: [W180] Unreachable code
but i don't know why
the version is zxbasic-1.15.2
Code: ' EXAMPE UNRECHABLE CODE
declare sub mySub()
Dim myNumber As uByte
cls
myBucle:
for myNumber = 0 to 7
mySub()
next myNumber
goto myBucle
sub mySub()
end sub
|
|
|
why is there 2 halt on waitretrace macro? |
Posted by: maeloterkim - 09-09-2021, 06:02 PM - Forum: Help & Support
- Replies (1)
|
 |
why is there 2 halt on waitretrace macro?
i found in the library this waitretrace macro in the retrace.bas file
REM simple WaitRetrace macro
#ifndef waitretrace
#define waitretrace 'REM Retrace \
asm \
halt \
halt \
end asm
#endif
Is not better put only one halt for better timer control of the programmer?
if there was only one halt is more easy to control
with one halt we can do
waitretrace -> only 1 halt 1/50 seconds
2 halt -> 2/50seconds
waitretrace
waitretrace
N halt -> N/50seconds
for i = 1 to N
waitretrace
next i
|
|
|
|