Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ZX Basic 1.4 (beta) is out
#1
After almost a year (okay, only two month Wink ), 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.
Reply
#2
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


Attached Files
.zip   ciclopes.zip (Size: 6.9 KB / Downloads: 949)
.zip   coches hector.zip (Size: 11.82 KB / Downloads: 899)
Reply
#3
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.
Reply
#4
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.


Attached Files
.zip   diving.zip (Size: 9.75 KB / Downloads: 918)
Reply
#5
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)
Reply
#6
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.


Attached Files
.zip   MARBELLA.zip (Size: 12.79 KB / Downloads: 925)
Reply
#7
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.
Reply
#8
Hello everyone.

Boriel, you come with good news! Big Grin

I'll try to compile any of my games tonight and tell you.
Reply
#9
Well, it did not work: :roll:

The hobbit compiles but does not work well.

Abydos not compile:


.png   RETROB ERR.PNG (Size: 11.26 KB / Downloads: 16,089)

Vade Retro not compile:


.png   VADE RETRO ERR.PNG (Size: 14.74 KB / Downloads: 16,102)

Retrobsesion II not compile:


.png   ABYDOS ERR.PNG (Size: 14.51 KB / Downloads: 16,095)
Reply
#10
Okay, new version: ZXBASIC 1.4.0s1773.
Try this and tell me, please :roll:
Reply
#11
Very nice! Big Grin

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
Reply
#12
Sorry, forgot to upload it. Try now: ZXBASIC 1.4.0s1779.
Reply
#13
anything new added.
I'm always on the chat or facebook.
Reply
#14
Ok, "Retrobsesion II" compiles and works perfectly Big Grin

Thanks !!
Reply
#15
I have re-compiled all the program I had previously tested and everything is working now.

Thanks Boriel Smile
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)