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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 273
» Latest member: Zilog_Z80A
» Forum threads: 962
» Forum posts: 6,053

Full Statistics

Online Users
There are currently 71 online users.
» 0 Member(s) | 70 Guest(s)
Google

Latest Threads
REPEAT UNTIL
Forum: Wishlist
Last Post: boriel
Yesterday, 03:28 PM
» Replies: 1
» Views: 13
Print color bug
Forum: Bug Reports
Last Post: Darkstar
10-11-2022, 06:57 PM
» Replies: 18
» Views: 987
SIN and COS functions hav...
Forum: Bug Reports
Last Post: boriel
08-17-2022, 06:49 AM
» Replies: 2
» Views: 511
Binary into asm
Forum: Help & Support
Last Post: Nando
08-11-2022, 12:10 PM
» Replies: 12
» Views: 1,698
Set Number Layout to xx.0...
Forum: Help & Support
Last Post: boriel
08-02-2022, 10:32 PM
» Replies: 1
» Views: 471
Using Beepola with ZX BAS...
Forum: How-To & Tutorials
Last Post: Nando
08-02-2022, 09:25 PM
» Replies: 12
» Views: 21,628
HRPrintFast
Forum: Help & Support
Last Post: boriel
07-25-2022, 12:06 PM
» Replies: 2
» Views: 548
Features breaking compila...
Forum: Core
Last Post: Ljg701
06-19-2022, 08:44 AM
» Replies: 1
» Views: 617
New Text Adventure game u...
Forum: Gallery
Last Post: RandomiserUsr
06-01-2022, 10:21 PM
» Replies: 0
» Views: 460
Testing a variable within...
Forum: Help & Support
Last Post: RandomiserUsr
03-25-2022, 09:59 PM
» Replies: 11
» Views: 4,128

 
  BASIC FROGGER
Posted by: maeloterkim - 10-04-2021, 10:14 PM - Forum: Gallery - Replies (5)

After all the hacking questions about the compiler i ended the game and is presented to bytemanicos contest

The game is BASIC FROGGER

Enjoy the attached file basicFrogg.tap



Attached Files
.tap   basicFrogg.tap (Size: 45.91 KB / Downloads: 5)
Print this item

  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

Print this item

  zx0 compression corruption on decompressing
Posted by: RandomiserUsr - 09-29-2021, 06:50 PM - Forum: Bug Reports - Replies (3)

Since zxbc.py 1.15.3-beta9 the following is causing screen corruption

dzx0Standard(@Pic1, 16384)

Pic1:
asm
incbin "pic1.scr.zx0"
end asm

The same thing happens for text uncompressing.

See attachments for all of the files.

The same code works fine on 1.15.2 stable

Thanks

.zip   zx0picbug.zip (Size: 2.75 KB / Downloads: 249)

Print this item

  is possible a variable goto or gosub?
Posted by: maeloterkim - 09-27-2021, 01:50 PM - Forum: Help & Support - Replies (3)

Hi

in the original  ZX spectrum basic you can do this

goto MyVariable  or gosub MyVariable  where this variable must be a line number

this way we can goto or gosub to diferents routines that are in diferents line numbers

but i tried this example with the compiler and says error: Syntax Error. Unexpected token 'MyRoutines' <ARRAY_ID>

This is the example you can try:


dim MyRoutines(2) as uInteger => {  @MyRoutine1, _    '' address of my routine 1
                                                       @MyRoutine2, _    '' address of my routine 2
                                                      @MyRoutine3 _    '' address of my routine 3
                                                  }
                               
dim myVariable as uByte = 1

gosub MyRoutines(myVariable)     '' you can try goto too


myLoop:
goto myLoop


MyRoutine1:
print "MyRoutine 1"
return                   

MyRoutine2:
print "MyRoutine 2"
return                   

MyRoutine3:
print "MyRoutine 3"
return       


Is possible do something like that without a lot of ifs ?


I think i found a solution

The solution i found is this:


dim MyRoutines(2) as uInteger => { @MyRoutine1, _ '' address of my routine 1
@MyRoutine2, _ '' address of my routine 2
@MyRoutine3 _ '' address of my routine 3
}

dim myVariable as uByte = 0


poke uInteger (@pokeGosub1 + 1), MyRoutines(myVariable)

pokeGosub1:
gosub MyRoutine1


myLoop:
goto myLoop


MyRoutine1:
print "MyRoutine 1"
return

MyRoutine2:
print "MyRoutine 2"
return

MyRoutine3:
print "MyRoutine 3"
return


I do a poke with the routine direction just before the gosub

maybe you can implement this with the compiler

this way the behaviour is more like the original ZX spectrum Smile

Print this item

  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

Print this item

  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?

Print this item

  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

Print this item

  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

Print this item

  It is possible to read the state of the flags with basic
Posted by: maeloterkim - 09-07-2021, 03:12 PM - Forum: Help & Support - Replies (2)

Hi  Smile

In assembler there is a register that have the state of the flags zero, carry , etc

It is possible to read the state of the flags ONLY WITH BASIC (NOT ASSEMBLER) or the state of the carry flag, zero flag etc

Print this item

  Is posible put a ubyte variable just after DIM
Posted by: maeloterkim - 09-04-2021, 02:17 PM - Forum: Help & Support - Replies (2)

Hi

Is posible put a ubyte variable just after DIM   WITHOUT ASSEMBLER  maybe with AT @  or something

Example:

Code:
DIM udg(1, 7) AS uByte => {{0,1,3,7,15,31,63,127}, _
                           {1,2,4,7,15,31,63,127}}

DIM myVariable as ubyte 

I WANT THIS VARIABLE VALUE JUST THE NEXT BYTE AT THE END OF LAST UDG DIM BYTE LIKE THIS

ADDRESS       1  2  3  4   5   6   7   8     9  10   11  12   13   14   15   16        17
VALUE         0  1  3  7  15  31  63  127    1   2   4    7   15   31   63   127    myVariable
              --------------------      DIM UDG  -------------------------------

Print this item