Posts: 1,770
Threads: 55
Joined: Aug 2019
Reputation:
24
Okay, a new beta release with a *critical* fix and two interesting optimizations :!:
- ! The string parameters byVal (the default) in functions incorrecly managed causing crashes sometimes. Fixed.
- ! Some other bugs in the Intermediate code has been fixed. And string management a bit optimized (faster and less memory used)
- + Added a String.bas libray with MID$, LEFT$, RIGHT$, InStr and StrPos.
- * The ZX Basic preprocessor has been *entirely* rewritten (refactored). It now allows true multivariate macros as cpp does (Thus allowing function inlining, etc).
Please, test needed :!: The compiler has undergone *deep changes* with this update.
You can download (as always) from <!-- m --><a class="postlink" href="http://www.boriel.com/files/zxb">http://www.boriel.com/files/zxb</a><!-- m -->
Posts: 58
Threads: 5
Joined: Feb 2010
Reputation:
0
Great !
I'm going to try my ongoing projets with this version this night, I'll tell you if it doesn't work
Thanks !
Posts: 615
Threads: 49
Joined: Feb 2009
Reputation:
2
Me too. Currently a bit busy, but will test it with some of my code. if it will fail, I will cry ...
Posts: 58
Threads: 5
Joined: Feb 2010
Reputation:
0
First problem
Compiling this:
Code: DIM bufferx (0 to 4,0 to 5) as ubyte => {{10,0,0,0,0,0},_
{0,0,0,0,0,0},_
{0,0,0,0,0,0},_
{0,0,0,0,0,0},_
{0,0,0,0,0,0}}
Returns this:
> Executing: C:\Program Files (x86)\ConTEXT\ConExec.exe -i "C:\Program Files (x86)\Boriel Tm\ZX Basic Compiler\zxb.exe" -T -B -O 3 -S 24000 -a PRUEBA~1.bas
Generating LALR tables
PRUEBA~1.bas:1 Error: illegal preprocessor character '{'
> Execution finished.
I hope it's not a big thing.
Posts: 58
Threads: 5
Joined: Feb 2010
Reputation:
0
I have just noticed that 2 new files have appeared in the directory where the .bas file is:
parser.out
zxbasmpptab.py
Maybe it's related to the problem I had.
Posts: 1,770
Threads: 55
Joined: Aug 2019
Reputation:
24
apenao Wrote:I have just noticed that 2 new files have appeared in the directory where the .bas file is:
parser.out
zxbasmpptab.py
Maybe it's related to the problem I had. Nope, they are *rubbish*. I did include them by accident.
The bug is due to the new preprocessor which do not accept "unknown" characters. This is an easy fix. Fixing...
Posts: 1,770
Threads: 55
Joined: Aug 2019
Reputation:
24
Ok, please. Redownload new version 1.2.7-r2024 :roll:
<!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Archive#Latest_Development_Version">http://www.boriel.com/wiki/en/index.php ... nt_Version</a><!-- m -->
Posts: 615
Threads: 49
Joined: Feb 2009
Reputation:
2
But this test program (and a second one which I sent by PM) still suffer from this problem:
Code: FUNCTION scrAddress(x as uByte, y as uByte) as Uinteger
asm
;' This fn returns the address into HL of the screen address
;' x,y in character grid notation.
;' Original code was extracted by BloodBaz - Adapted for ZX BASiC by Britlion from Na_TH_AN's fourspriter
; x Arrives in A, y is in stack.
and 31
ld l,a
ld a,(IX+7) ; Y value
ld d,a
and 24
add a,64
ld h,a
ld a,d
and 7
rrca
rrca
rrca
or l
ld l,a
end asm
END FUNCTION
FUNCTION attrAddress(x as uByte, y as uByte) as uInteger
';; This function returns the memory address of the Character Position
';; x,y in the attribute screen memory.
';; Adapted from code by Jonathan Cauldwell - Adapted for ZX BASiC by Britlion from Na_TH_AN's fourspriter
asm
ld a,(IX+7) ;ypos
rrca
rrca
rrca ; Multiply by 32
ld l,a ; Pass to L
and 3 ; Mask with 00000011
add a,88 ; 88 * 256 = 22528 - start of attributes.
ld h,a ; Put it in the High Byte
ld a,l ; We get y value *32
and 224 ; Mask with 11100000
ld l,a ; Put it in L
ld a,(IX+5) ; xpos
add a,l ; Add it to the Low byte
ld l,a ; Put it back in L, and we're done. HL=Address.
end asm
END FUNCTION
sub putblock(x as Ubyte,y as ubyte,wid as ubyte,hgt as ubyte,adr as Uinteger)
dim scr,attribute as Uinteger
dim x1,y1 as Ubyte
dim a as Ubyte
poke uinteger @putblock1+7,wid
poke uinteger @putblock2+7,wid
for y1=0 to hgt-1
scr=scrAddress(x,y+y1)
for a=0 to 7
poke uinteger @putblock1+1,adr
poke uinteger @putblock1+4,scr
putblock1:
asm
ld hl,1
ld de,2
ld bc,3
ldir
end asm
adr=adr+wid
scr=scr+256
next a
next y1
attribute=attrAddress(x,y)
for y1=0 to hgt-1
poke uinteger @putblock2+1,adr
poke uinteger @putblock2+4,attribute
adr=adr+wid
attribute=attribute+32
putblock2:
asm
ld hl,4
ld de,5
ld bc,6
ldir
end asm
next y1
End sub
start:
putblock(0,18,8,6,0)
putblock(8,18,8,6,0)
putblock(16,18,8,6,0)
putblock(24,18,8,6,0)
putblock(24,12,8,6,0)
putblock(24,6,8,6,0)
putblock(24,0,8,6,0)
putblock(0,0,24,18,0)
pause 0
Posts: 58
Threads: 5
Joined: Feb 2010
Reputation:
0
boriel Wrote:Ok, please. Redownload new version 1.2.7-r2024 :roll:
<!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Archive#Latest_Development_Version">http://www.boriel.com/wiki/en/index.php ... nt_Version</a><!-- m -->
It compiles without problems my new project (that doesn't use inline assembler, just basic), but when I try to compile my other game (the one with the walking hat) I get this:
Quote:> Executing: C:\Program Files (x86)\ConTEXT\ConExec.exe -i "C:\Program Files (x86)\Boriel Tm\ZX Basic Compiler\zxb.exe" -T -B -O 3 -S 24000 -a GEB742~1.bas
Generating LALR tables
input.bas:38: warning: Empty loop
GEB742~1.bas:1154: Syntax Error. Unexpected token 'SUB' <ID>
GEB742~1.bas:1154: warning: Variable 'xd' declared as 'float'
GEB742~1.bas:1154: Syntax Error. Unexpected token 'as' <ID>
GEB742~1.bas:1154: illegal character ','
> Execution finished.
Posts: 1,770
Threads: 55
Joined: Aug 2019
Reputation:
24
Okay, please download 1.2.7r2028, just uploaded: <!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Archive#Latest_Development_Version">http://www.boriel.com/wiki/en/index.php ... nt_Version</a><!-- m -->
Hope this time it works! :roll: It's all related to the zxbpp module, not the compiler itself.
Posts: 1,770
Threads: 55
Joined: Aug 2019
Reputation:
24
apenao Wrote:boriel Wrote:Ok, please. Redownload new version 1.2.7-r2024 :roll:
<!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Archive#Latest_Development_Version">http://www.boriel.com/wiki/en/index.php ... nt_Version</a><!-- m -->
It compiles without problems my new project (that doesn't use inline assembler, just basic), but when I try to compile my other game (the one with the walking hat) I get this:
Quote:> Executing: C:\Program Files (x86)\ConTEXT\ConExec.exe -i "C:\Program Files (x86)\Boriel Tm\ZX Basic Compiler\zxb.exe" -T -B -O 3 -S 24000 -a GEB742~1.bas Your *new* project? Please, don't tell me you abandoned the Gentleman project:!: I was expecting it, to show off the compiler capabilities!
Quote:Generating LALR tables
Note: This message should not appear. It means it is recalculating compiling tables, takes time, and writes the parser.out trash temp file. *Fixed* :wink:
(I precalculate compiler tables and remove trash files when packaging the .msi installer file)
Posts: 58
Threads: 5
Joined: Feb 2010
Reputation:
0
boriel Wrote:Your *new* project? Please, don't tell me you abandoned the Gentleman project:!: I was expecting it, to show off the compiler capabilities!
No, I just put it on the side while finishing a game for the radastan's basic games compo. I didn't make it on time, but it's going quite well so I decided to go on with it for a while.
But I will go back with HTBACG, in fact some of the last features you included in the compiler (such as faster draw routine, bitwise logical operators) seems to be taylor-made for this game alone .)
Posts: 1,770
Threads: 55
Joined: Aug 2019
Reputation:
24
apenao Wrote:boriel Wrote:Your *new* project? Please, don't tell me you abandoned the Gentleman project:!: I was expecting it, to show off the compiler capabilities!
No, I just put it on the side while finishing a game for the radastan's basic games compo. I didn't make it on time, but it's going quite well so I decided to go on with it for a while.
But I will go back with HTBACG, in fact some of the last features you included in the compiler (such as faster draw routine, bitwise logical operators) seems to be taylor-made for this game alone .) Thx! 8)
Please, test the latest versiĆ³n (r2028) just uploaded!
Posts: 58
Threads: 5
Joined: Feb 2010
Reputation:
0
I just compiled it again (the Gentleman game) with the 2028 version and I get this:
Code: > Executing: C:\Program Files (x86)\ConTEXT\ConExec.exe -i "C:\Program Files (x86)\Boriel Tm\ZX Basic Compiler\zxb.exe" -T -B -O 3 -S 24000 -a GE2240~1.bas
input.bas:38: warning: Empty loop
GE2240~1.bas:1088: Syntax Error. Unexpected token 'SUB' <ID>
GE2240~1.bas:1088: warning: Variable 'xd' declared as 'float'
GE2240~1.bas:1088: Syntax Error. Unexpected token 'as' <ID>
GE2240~1.bas:1088: illegal character ','
> Execution finished.
The input.bas... line refers to an #include <sinclair.bas> sentence
The other stuff is related to my sprite routine (sprite2). It's the same I sent you a while ago, but if you need it again, tell me.
Posts: 1,770
Threads: 55
Joined: Aug 2019
Reputation:
24
Okay. This is another preprocessor issue. Can you send me your code by mail on in a priv. msg?
I can't reproduce it.
|