FAQ  •  Register  •  Login

ZX Basic 1.4 (beta) is out

<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Wed Jan 29, 2014 5:14 pm

ZX Basic 1.4 (beta) is out

After almost a year (okay, only two month ;) ), a new version of ZX BASIC is out.
ZX BASIC 1.4 (not 2.x) is a huge step forward in terms of compiler design.
What to expect from this version? Nothing.
What? Nothing. ZX BASIC 1.4 is a huge refactor but tries to maintain 100% backward compatibility with previous releases.
Well, there are something you might expect: Bugs.
Please, if you want to help, at this moment, the best way is to recompile your old programs with this new version and report errors.
Another method is to generate --asm files with both 1.3.x and 1.4.x and compare (diff) them, to look for differences.

Okay, yes, there are things that have already improved:
  • ZX BASIC 1.4. corrects hidden bugs I've discovered on 1.3 (or which haven't happened because users don't use some BASIC features...)
    These bugs are hard to fix in the old version and will be there forever... But are already fixed in 1.4
  • ZX BASIC 1.4 already produces better code under some circumstances. Ej. @myArray(3, 4) only takes 2 asm instructions (hundreds of them before). Some POKE sentences also were not correctly optimized. They are now.
  • ZX BASIC 1.4 allows now nested scopes / functions (that is, declare a function / sub inside of another as in Pascal / C++ and some extended C compilers).
But other than that, stills the same.
The question is: OK, now I'm open to new features... and architectures (MSX, I'm looking at you). It's time to discuss then :twisted:

Download, as always, at the Download page.
<<

apenao

Posts: 58

Joined: Tue Feb 09, 2010 10:08 pm

Post Wed Jan 29, 2014 9:10 pm

Re: ZX Basic 1.4 (beta) is out

I have been compiling some old code and I have found a problem in one of the "games" I did some months ago (code can be found in the gallery forum, it's the "cicloples y Saturno game"

I try to compile with these parameters: -T -B -S 32768 -a %F.bas
and I get this warnings and error codes:
  Code:
> Executing: C:\Spectrum\Mis documentos\Archivos de programa\ConTEXT\ConExec.exe -i "C:\Program Files (x86)\Boriel Tm\ZX Basic Compiler\zxb.exe" -T -B -S 32768 -a CI7E9E~1.bas

attr.bas:96: warning: FUNCTION 'attraddr' declared as FASTCALL with 2 parameters
input.bas:38: warning: Empty loop
alloc.bas:73: warning: FUNCTION 'reallocate' declared as FASTCALL with 2 parameters
Traceback (most recent call last):
  File "zxb.py", line 348, in <module>
  File "zxb.py", line 262, in main
  File "ply\yacc.pyc", line 263, in parse
  File "ply\yacc.pyc", line 710, in parseopt
  File "zxbparser.pyc", line 3025, in p_abs
NameError: global name 'is_unsigned' is not defined
> Execution finished.


It does compile ok with 1.3.0.s979

Strangely, the other game i did in that time "coches" compiles ok in both the previous and the new versions. They both share most of the code, but I included the "doublesizeprint" routine from the library in the game that doesn't compile. So it might be worth checking that first.

I'll upload the code in a while.

Edit: uploading code and dependent files
Attachments
coches hector.zip
This is the one that compiles OK, just in case its needed
(11.82 KiB) Downloaded 289 times
ciclopes.zip
This doesn't compile in the new versión, but does in a previous one
(6.9 KiB) Downloaded 340 times
<<

apenao

Posts: 58

Joined: Tue Feb 09, 2010 10:08 pm

Post Wed Jan 29, 2014 9:24 pm

Re: ZX Basic 1.4 (beta) is out

I tried again with the Double Size Print routine in the library, this is the code:

  Code:
CLS
doubleSizePrintChar(0,0,145)
 
doubleSizePrint(10,0,"Hello World")


STOP

SUB doubleSizePrintChar(y AS UBYTE, x AS UBYTE, thingToPrint AS UBYTE)
' Prints a single character double sized.
' Takes X and Y values as character positions, like print.
' takes an ascii code value for a character.
' By Britlion, 2012.
 
ASM
LD A,(IX+5)    ;' Y value
CP 22
JP NC, doubleSizePrintCharEnd
 
;' A=y value
LD E,A
AND 24          ; calculate
OR 64          ; screen
LD H,A          ; address
LD A,E          ; FOR
AND 7          ; row
OR a          ; Y
RRA
RRA
RRA
RRA
LD E,A
 
LD A,(IX+7)    ;' X Value
CP 30
JP NC, doubleSizePrintCharEnd
 
ADD A,E         ;' correct address for column value. (add it in)
LD L,A
EX DE,HL      ;' Save it in DE
 
LD A,(IX+9)    ;'Character
 
CP 164       ;' > UDG "U" ?
JP NC, doubleSizePrintCharEnd
 
CP 32        ;' < space+1?
JP C, doubleSizePrintCharEnd
 
CP 144       ;' >144?
JP NC, doubleSizePrintCharUDGAddress
 
LD L,A
LD H,0
 
ADD HL,HL
ADD HL,HL
ADD HL,HL   ;' multiply by 8.
LD BC,(23606)   ;' Chars
ADD HL,BC    ;' Hl -> Character data.
EX DE,HL   ;' DE -> character data, HL-> screen address.
JP doubleSizePrintCharRotateLoopCharStart
 
doubleSizePrintCharUDGAddress:
LD HL,(23675)    ;'UDG address
SUB 144
ADD A,A         ;multiply by 8.
ADD A,A
ADD A,A
ADD A,L
LD L,A
 
JR NC, doubleSizePrintCharUDGAddressNoCarry
INC H
doubleSizePrintCharUDGAddressNoCarry:
 
;' At this point HL -> Character data in UDG block.
EX DE,HL ;' DE -> character data, HL-> screen address.
 
doubleSizePrintCharRotateLoopCharStart:
LD C,2 ;' 2 character rows.
doubleSizePrintCharRotateLoopCharRowLoopOuter:
LD b,4 ;' 4 source bytes to count through per character row.
doubleSizePrintCharRotateLoopCharRowLoopInner:
   PUSH BC
 
   LD A,(DE) ;' Grab a bitmap.
   PUSH DE
 
   LD B,4
   LD C,A ; Copy BYTE so we can put two into the big version.
   doubleSizePrintCharRotateLoop1:
      RRA  ; one bit into carry
      RR E ; one bit into result
      RR C ; same bit into carry again
      RR E ; duplicated bit into result
   DJNZ doubleSizePrintCharRotateLoop1
 
   LD B,4
   doubleSizePrintCharRotateLoop2:
       RRA
       RR D ; Other register FOR other half of big 16 bit line.
       RR C
       RR D
   DJNZ doubleSizePrintCharRotateLoop2
 
   LD (HL),D   ;' Output first byte
   INC HL   ;' Move right
   LD (HL),E   ;' Second half.
   DEC HL   ;' Move left
   INC H   ;' Move down
   LD (HL),D   ;' Output second row (copy of first), first byte.
   INC HL   ;' Move right
   LD (HL),E   ; Output second row, second BYTE
   DEC HL   ; Move left
   INC H   ; Move down.
   POP DE
   INC DE
   POP BC
DJNZ doubleSizePrintCharRotateLoopCharRowLoopInner
; CALL __DECY+2    ;'Jump into the DRAW next_line_down routine, at a convenient point (accounting for the INC H above)
; Can't seem to call to this at the moment! Here in longhand form:
 
ld a, h
AND 7
jr nz, doubleSizePrintCharRotateNextCharRow
ld a, l
add a, 32
ld l, a
jr c, doubleSizePrintCharRotateNextCharRow
ld a, h
SUB 8
ld h, a
 
doubleSizePrintCharRotateNextCharRow:
 
DEC C
JR NZ, doubleSizePrintCharRotateLoopCharRowLoopOuter
 
doubleSizePrintCharEnd:
END ASM
END SUB
 
SUB doubleSizePrint(y AS UBYTE, x AS UBYTE, thingToPrint$ AS STRING)
'Uses doubleSizePrintChar subroutine to print a string.
'By Britlion, 2012
 
   DIM n AS UBYTE
   FOR n=0 TO LEN thingToPrint - 1
      doubleSizePrintChar(y,x,CODE thingToPrint$(n) )
      x=x+2
   NEXT n
END SUB


It compiles ok and Works in the previous versión. In the new versión, it compiles ok (doesn't show any warning or message) but doesn't work (at least in my emulator, Specemu). It shows just one character and then freeze.
<<

apenao

Posts: 58

Joined: Tue Feb 09, 2010 10:08 pm

Post Wed Jan 29, 2014 9:36 pm

Re: ZX Basic 1.4 (beta) is out

Another "anormality" found.
In my old crap game "Steroids Sports: Diving", it compiles and Works ok with my previous versión. In the new versión, it compiles and Works just to the point I use the "Print64" routine from the library. At this moment, it starts writting a lot of garbage in the screen (in 64 columns) when it should be writting just a number (well, 3 different numbers) in a small box.
Attachments
diving.zip
(9.75 KiB) Downloaded 288 times
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Wed Jan 29, 2014 10:58 pm

Re: ZX Basic 1.4 (beta) is out

Thanks a lot, @apenao
At this moment, all the bugs except the one in print64 (the last case) has been fixed.
Please Download and try... :roll:
I'll be fixing the last one, meanwhile...
UPDATE: I'ts fixed now. Please download 1.4.0s1754 (in the link above)
<<

apenao

Posts: 58

Joined: Tue Feb 09, 2010 10:08 pm

Post Thu Jan 30, 2014 4:52 pm

Re: ZX Basic 1.4 (beta) is out

I have checked a couple of things this morning while on work (don't tell my boss) and it seems ok now, but this night I want to make more test because I tried to compile (with the new versión) one of the demonstration programs included with ZXBC and it didn't work. I'll post later when I do the checkings.


P.S. Boriel here goes the program I told you yesterday. It's lacking a game inside but I won't give up in finishing it some day. I am very interested in the posibility of a spectranet support for ZXBC.
Attachments
MARBELLA.zip
(12.79 KiB) Downloaded 296 times
<<

apenao

Posts: 58

Joined: Tue Feb 09, 2010 10:08 pm

Post Thu Jan 30, 2014 5:14 pm

Re: ZX Basic 1.4 (beta) is out

I have done 3 test involving some of the programs in the example folder included with ZXBC:

Pong doesn't compile. It returns a long list of warnings.
Scroll doesn't compile (but it does not compile in 1.3 versión either)
Spfill compiles but it behaves incorrectly (doesn't fill with the expected pattern, while it behaves correctly if compiled with the 1.3 versión).

Others, like clock or freregustav are working OK.
<<

JBGV

Posts: 65

Joined: Wed Feb 16, 2011 6:12 am

Post Thu Jan 30, 2014 6:33 pm

Re: ZX Basic 1.4 (beta) is out

Hello everyone.

Boriel, you come with good news! :D

I'll try to compile any of my games tonight and tell you.
<<

JBGV

Posts: 65

Joined: Wed Feb 16, 2011 6:12 am

Post Thu Jan 30, 2014 9:31 pm

Re: ZX Basic 1.4 (beta) is out

Well, it did not work: :roll:

The hobbit compiles but does not work well.

Abydos not compile:

ABYDOS ERR.PNG
ABYDOS ERR.PNG (14.51 KiB) Viewed 11116 times


Vade Retro not compile:

VADE RETRO ERR.PNG
VADE RETRO ERR.PNG (14.74 KiB) Viewed 11116 times


Retrobsesion II not compile:

RETROB ERR.PNG
RETROB ERR.PNG (11.26 KiB) Viewed 11116 times
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Fri Jan 31, 2014 12:18 am

Re: ZX Basic 1.4 (beta) is out

Okay, new version: ZXBASIC 1.4.0s1773.
Try this and tell me, please :roll:
<<

JBGV

Posts: 65

Joined: Wed Feb 16, 2011 6:12 am

Post Fri Jan 31, 2014 5:58 am

Re: ZX Basic 1.4 (beta) is out

Very nice! :D

Compile and run all except Retrobsesion, that keeps on giving the same error.

It is the oldest of all, when I programmed it used this:

1.2.8.758 zxb --org=28000 MAPA140e.bas -T -B -a --heap=2000
<<

boriel

Site Admin

Posts: 1463

Joined: Wed Nov 01, 2006 6:18 pm

Location: Santa Cruz de Tenerife, Spain

Post Fri Jan 31, 2014 8:50 am

Re: ZX Basic 1.4 (beta) is out

Sorry, forgot to upload it. Try now: ZXBASIC 1.4.0s1779.
<<

ardentcrest

Posts: 94

Joined: Fri Oct 11, 2013 5:19 pm

Post Fri Jan 31, 2014 7:31 pm

Re: ZX Basic 1.4 (beta) is out

anything new added.
I'm always on the chat or facebook.
<<

JBGV

Posts: 65

Joined: Wed Feb 16, 2011 6:12 am

Post Fri Jan 31, 2014 10:19 pm

Re: ZX Basic 1.4 (beta) is out

Ok, "Retrobsesion II" compiles and works perfectly :D

Thanks !!
<<

apenao

Posts: 58

Joined: Tue Feb 09, 2010 10:08 pm

Post Fri Jan 31, 2014 11:40 pm

Re: ZX Basic 1.4 (beta) is out

I have re-compiled all the program I had previously tested and everything is working now.

Thanks Boriel :)
Next

Return to ZX Basic Compiler

Who is online

Users browsing this forum: No registered users and 2 guests

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin for Free Forums/DivisionCore.

phpBB SEO