Posts: 1,763
Threads: 55
Joined: Aug 2019
Reputation:
24
Hi,
I've been working very hard in fixing almost 10 obscure bugs in the -O2 and -O3 options. And they finally seems to be fixed. Apenao's game compiles with -O3 flawlessly and plays well (obviously, -O3 includes -O2 optimizations); but I need more testing. So anyone who has programs to test both -O2 and -O3, and check if it compiles and behaves as it does with no optimization at all.
If everything works ok, I expect the compiler will behave more intelligently than ever before. It's been ultra-hard ![Confused Confused](https://www.boriel.com/forum/images/smilies/confused.png) hock: :roll: but I hope it's worth the hassle.
You can download .zip or .tag.gz 1.2.5 files, or the MSI windows install: <!-- m --><a class="postlink" href="http://www.boriel.com/files/zxb/zxbasic-1.2.5r1513.msi">http://www.boriel.com/files/zxb/zxbasic-1.2.5r1513.msi</a><!-- m -->
Posts: 58
Threads: 5
Joined: Feb 2010
Reputation:
0
I'm going to try it now with other of my crap games, Avatar.
Thanks a lot for working so hard. You're achieving something so big in so little time it's incredible.
If you ever happen to visit the Ruins of Spanish Economy (hint: look inside my crap game) send my a message and I'll pay your effort in beers and prawns
Posts: 58
Threads: 5
Joined: Feb 2010
Reputation:
0
First: when I try to install the .msi , it still makes me uninstall manually the previous version.
Second: I tried to compile my previous program Avatar. It compiler ok without optimization and with -O 2, but with -O 3 I get this (and no compile):
Code: > Executing: C:\Archivos de programa\ConTEXT\ConExec.exe -i "C:\Archivos de programa\Boriel Tm\ZX Basic Compiler\zxb.exe" -T -B -a -O 3 -S 28000 avataro3.bas
avataro3.bas:27: warning: Function 'point' is never called and has been ignored
avataro3.bas:29: warning: Function 'screen' is never called and has been ignored
avataro3.bas:26: warning: Function 'input' is never called and has been ignored
avataro3.bas:22: warning: Function 'GetKey' is never called and has been ignored
avataro3.bas:59: warning: Function 'GetKeyScanCode' is never called and has been ignored
avataro3.bas:27: warning: Variable 'col' is never used
avataro3.bas:27: warning: Variable 'row' is never used
avataro3.bas:66: warning: Variable 'col' is never used
avataro3.bas:66: warning: Variable 'value' is never used
avataro3.bas:66: warning: Variable 'row' is never used
avataro3.bas:29: warning: Variable 'dest' is never used
avataro3.bas:29: warning: Variable 'source' is never used
avataro3.bas:29: warning: Variable 'length' is never used
avataro3.bas:41: warning: Variable 'scancode' is never used
Traceback (most recent call last):
File "zxb.py", line 255, in <module>
File "zxb.py", line 209, in main
File "optimizer.pyc", line 2066, in optimize
File "optimizer.pyc", line 1986, in initialize_memory
File "optimizer.pyc", line 1976, in get_labels
File "optimizer.pyc", line 1104, in __init__
optimizer.DuplicatedLabelError: Invalid mnemonic '__ATTR_END'
> Execution finished.
I'll send you my program.
Posts: 58
Threads: 5
Joined: Feb 2010
Reputation:
0
This is the program. This one does not use custom libraries or binary files so it's enough to post the code here.
Remember that it's best viewed with 3D glasses (well, not really, but I guess it wont be much worse either).
Code: #include <sinclair.bas>
#include <memcopy.bas>
#include <keys.bas>
memcopy (16384,50000,6912)
DIM seagull (0 to 18,0 to 7) AS uByte => {{ 0, 0, 0, 15, 24, 48, 32, 32} , _
{ 0, 0, 0, 7, 12, 24, 60, 39} , _
{ 0, 0, 0, 0,192, 64,200,156} , _
{ 0, 0, 0, 0,120,204,140,138} , _
{ 0, 0, 0, 0, 64, 72, 72, 72} , _
{ 0, 0,144,144,144,144,152,136} , _
{ 24, 60, 52, 63, 63, 60, 60, 60} , _
{ 0, 0, 0,224,192, 0, 0, 0} , _
{ 32, 39, 56, 49, 3, 14, 0, 0} , _
{ 32,176,146,156, 0, 0, 0, 0} , _
{ 52, 38,102, 68,124, 7, 0, 0} , _
{ 251, 1, 1, 9, 9, 15, 0, 0} , _
{ 104, 40, 62, 48, 0, 0, 0, 0} , _
{ 200, 76, 68, 64,112, 0, 0, 0} , _
{ 7, 1, 14, 31, 15, 0, 0, 0} , _
{ 198,251,123,135,254,252, 80,124} , _
{ 12, 16, 32, 33, 35, 38, 60, 0} , _
{ 88,104, 71, 77, 73, 75, 78, 0} , _
{ 0, 28, 52, 36, 60, 32,160, 0}}
DIM trashsmash (0 to 15,0 to 7) AS uByte => {{0,120, 72, 72,252,196,196, 0} , _
{ 0, 0,127,127, 24, 27, 27, 27} , _
{ 0, 0,193,193, 1,243,243, 51} , _
{ 0, 0,243,243,179, 27,251,248} , _
{ 0, 0,254,254, 0,246,247, 55} , _
{ 0, 0, 48, 48, 48, 48,240,240} , _
{ 27, 27, 27, 27, 3, 3, 0, 0} , _
{ 118,246,198, 96,103, 55, 0, 0} , _
{ 12, 12, 13, 3,255,254, 0, 0} , _
{ 118,230,192,128, 0, 0, 0, 0} , _
{ 48, 48, 0, 0, 0, 0, 0, 0} , _
{ 63, 33, 32, 63, 3, 35, 63, 0} , _
{ 0, 0,127, 73, 73,109,109, 0} , _
{ 0, 0, 63, 1, 63, 49, 63, 0} , _
{ 0, 0, 63, 32, 63, 3, 63, 0} , _
{ 32, 32, 63, 33, 33, 49, 49, 0}}
77 DIM MUSICA (0 to 291) AS Byte => {7,7,7,7,7,7,6,6,6,9,9,9,9,9,9,9,9,6,6,6,6,6,6,4,4,4,4,4,4,4,4,7,7,7,7,7,7,7,7,7,7,6,6,6,4,4,4,-1,-1,-1,-1,-1,-1,-1,-1,2,2,2,7,7,7,6,6,6,9,9,9,9,9,9,9,9,9,9,9,9,7,7,7,11,11,11,11,11,11,11,11,7,7,7,7,7,7,6,6,6,9,9,9,9,9,9,9,9,6,6,6,6,6,6,4,4,4,4,4,4, 4,4,7,7,7,7,7,7,7,7,7,7,6,6,6,4,4,4,-1,-1,-1,-1,-1,-1,-1,-1,2,2,2,7,7,7,6,6,6,9,9,9,9,9,9,9,9,9,9,9,9,7,7,7,11,11,11,11,11,11,11,11, 7,7,7,7,7,7,6,6,6,9,9,9,9,9,9,9,9,6,6,6,6,6,6,4,4,4,4,4,4,4,4,7,7,7,7,7,7,7,7,7,7,6,6,6,4,4,4,-1,-1,-1,-1,-1,-1,-1,-1,2,2,2, 7,7,7,6,6,6,9,9,9,9,9,9,9,9,9,9,9,9,7,7,7,11,11,11,11,11,11,11,11,7,7,7,7,7,7,6,6,6,9,9,9,9,9,9,9,9,6,6,6,6,6,6,4,4,4,4,4,4,4,4}
PRINT AT 17,11;PAPER 0;INK 7;FLASH 1;" STOP TAPE ";FLASH 0
PAUSE 1 : PAUSE 350
1 REM INICIO
PRINT INK 7;PAPER 0;AT 17,11;" ";AT 18,11;" ";AT 19,11;" ";INK 2;"S";INK 7;" START "
FOR MUSIC=0 TO 291:LET MUSIQUILLA= MUSICA(MUSIC):BEEP .05,MUSIQUILLA
IF MULTIKEYS(KEYS)<>0 THEN GOTO 99: END IF
IF MUSIC<145 THEN POKE Uinteger 23675, @trashsmash(0,0): PRINT AT 17,11;PAPER 0;INK 3;"\A";INK 4;"\B\C\D\E\F ";AT 18,11;INK 5;" \G\H\I\J\K";INK 3;"\L\M\N\O\P"
ELSE POKE Uinteger 23675, @seagull(0,0): PRINT AT 17,11;PAPER 0;INK 3;BRIGHT 1;"\A\B\C\D\E\F ";INK 7;BRIGHT 1;"\G";INK 2;"\H ";AT 18,11;INK 3;BRIGHT 0;"\I";BRIGHT 1;"\J";BRIGHT 0;"\K";BRIGHT 1;"\L";BRIGHT 0;"\M";BRIGHT 1;"\N";INK 7;BRIGHT 1;"\O\P";INK 4;BRIGHT 0;"\Q";BRIGHT 1;"\R";BRIGHT 0;"\S":END IF
NEXT
GOTO 1
99 CLS:RANDOMIZE
100 DIM udg (0 to 20,0 to 7) AS uByte => { { 166, 86, 132, 94, 151, 68, 170, 73} , _
{ 178, 53, 34, 113, 106, 33, 82, 121} , _
{ 0, 0, 73, 221, 119, 93, 245, 127} , _
{ 170, 85, 170, 85, 170, 85, 170, 85} , _
{ 22, 27, 7, 3, 3, 2, 7, 15} , _
{ 120, 208, 192, 128, 192, 64, 192, 240} , _
{ 0, 51, 17, 68, 109, 1, 108, 102} , _
{ 0, 116, 102, 18, 182, 128, 44, 108} , _
{ 106, 101, 34, 121, 234, 33, 82, 149} , _
{ 140, 77, 164, 78, 150, 68, 138, 94} , _
{ 255, 127, 63, 31, 15, 7, 3, 1} , _
{ 255, 254, 252, 248, 240, 224, 192, 128} , _
{ 24, 60, 66, 145, 153, 66, 60, 126} , _
{ 14, 17, 24, 52, 122, 126, 60, 24} , _
{ 102, 239, 253, 251, 126, 126, 60, 24} , _
{ 4, 127, 255, 132, 33, 255, 254, 32} , _
{ 126, 129, 129, 129, 129, 110, 24, 56} , _
{ 21, 138, 197, 98, 81, 220, 118, 214} , _
{ 80, 165, 73, 151, 61, 87, 245, 93} , _
{ 1, 3, 6, 13, 26, 53, 106, 213} , _
{ 128, 192, 224, 112, 184, 92, 174,87}}
110 POKE Uinteger 23675, @udg(0,0)
800 REM PANTALLA
PRINT AT 1,13;"______"
PRINT AT 2,10;"__\T\D\D\D\D\D\D\U__"
PRINT AT 3,8;"_\T\D\D\D\D\D\D\D\D\D\D\D\D\U_"
PRINT AT 4,6;"_\T\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\U_"
PRINT AT 5,4;"_\T\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\U_"
PRINT AT 6,3;"\T\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\U"
PRINT AT 7,2;"\T\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\U"
PRINT AT 8,1;"\T\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\U"
PRINT AT 9,0;"\T\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\U"
PRINT AT 10,0;"\R\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\S"
PRINT AT 11,0;"\::\R\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\S\::"
PRINT AT 12,0;"\::\::\R\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\S\::\::"
PRINT AT 13,0;"\K\::\::\R\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\S\::\::\L"
PRINT AT 14,1;"\::\::\::\C\R\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\S\C\::\::\::"
PRINT AT 15,1;"\K\::\::\::\::\C\R\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\D\S\C\::\::\::\::\L"
PRINT AT 16,2;"\::\::\::\::\::\::\C\R\D\D\D\D\D\D\D\D\D\D\D\D\S\C\::\::\::\::\::\::"
PRINT AT 17,2;"\K\::\::\::\::\::\::\::\C\C\R\D\D\D\D\D\D\S\C\C\::\::\::\::\::\::\::\L"
PRINT AT 18,3;"\K\::\::\::\::\::\::\::\::\::\C\C\C\C\C\C\::\::\::\::\::\::\::\::\::\L"
PRINT AT 19,4;"\K\::\::\::\::\::\::\::\::\::\::\::\::\::\::\::\::\::\::\::\::\::\::\L"
PRINT AT 20,5;"\K\::\::\::\::\::\::\::\::\::\::\::\::\::\::\::\::\::\::\::\::\L"
PRINT AT 21,7;"\K\::\::\::\::\::\::\::\::\::\::\::\::\::\::\::\::\L"
PRINT AT 22,9;"\K\::\::\::\::\::\::\::\::\::\::\::\::\L"
PRINT AT 23,11;"\K\::\::\::\::\::\::\::\::\L"
120 DIM atrib (0 to 23,0 to 31) AS uByte => { {40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40} , _
{40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40} , _
{40,40,40,40,40,40,40,40,40,40,40,40,40,32,32,32,32,32,32,40,40,40,40,40,40,40,40,40,40,40,40,40} , _
{40,40,40,40,40,40,40,40,40,40,32,32,32,32,32,32,32,32,32,32,32,32,40,40,40,40,40,40,40,40,40,40} , _
{40,40,40,40,40,40,40,40,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,40,40,40,40,40,40,40,40} , _
{40,40,40,40,40,40,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,40,40,40,40,40,40} , _
{40,40,40,40,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,40,40,40,40} , _
{40,40,40,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,40,40,40} , _
{40,40,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,40,40} , _
{40,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,40} , _
{4,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,4} , _
{46,4,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,4,40} , _
{46,46,4,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,4,40,40} , _
{46,46,46,4,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,4,40,40,40} , _
{40,46,46,46,4,4,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,4,4,40,40,40,40} , _
{40,46,46,46,46,46,4,4,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,4,4,40,40,40,40,40,40} , _
{40,40,46,46,46,46,46,46,4,4,32,32,32,32,32,32,32,32,32,32,32,32,4,4,40,40,40,40,40,40,40,40} , _
{40,40,46,46,46,46,46,46,46,46,4,4,4,32,32,32,32,32,32,4,4,4,40,40,40,40,40,40,40,40,40,40} , _
{40,40,40,46,46,46,46,46,46,46,46,46,46,4,4,4,4,4,4,40,40,40,40,40,40,40,40,40,40,40,40,40} , _
{40,40,40,40,46,46,46,46,46,46,46,46,46,46,46,46,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40} , _
{40,40,40,40,40,46,46,46,46,46,46,46,46,46,46,46,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40} , _
{40,40,40,40,40,40,40,46,46,46,46,46,46,46,46,46,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40} , _
{40,40,40,40,40,40,40,40,40,46,46,46,46,46,46,46,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40} , _
{40,40,40,40,40,40,40,40,40,40,40,46,46,46,46,46,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40}}
130 LET LIN=0: LET COL=0
FOR COLOR=0 TO 767: POKE (22528+COLOR), atrib(LIN,COL)
LET COL=COL+1: IF COL>31 THEN LET COL=0: LET LIN=LIN+1: END IF
NEXT
200 PRINT AT 23,0;PAPER 6;INK 2;"\N";PAPER 5;INK 2;" \O \P \Q"; AT 23,25;PAPER 5;INK 1;"\N \O \P \Q"
900 rem arboles
DIM ARBOL (0 TO 4 ,0 TO 1) AS ubyte => {{7,12} , _
{15,15} , _
{4,20} , _
{10,25} , _
{12,6} }
FOR ARB=0 TO 4
PRINT AT ARBOL (ARB,0), ARBOL (ARB,1);INK 4;PAPER 0;BRIGHT 1;"\G\H";AT ARBOL (ARB,0)+1, ARBOL(ARB,1);INK 2;PAPER 0;"\E\F"
NEXT
'PAUSE 1:PAUSE 0
rem tiempo
PRINT PAPER 1;INK 7;AT 20,6;"TIME "
333 LET RELOJX=INT(RND*10)+4: LET RELOJY=INT(RND*15)+10:IF ATTR(RELOJX,RELOJY)<>32 THEN GOTO 333:END IF
600 REM INICIALIZAR FLECHA
DIM TIEMPO AS UBYTE: LET TIEMPO=207
DIM PUNTERO AS UBYTE
LET PUNTERO=0
DIM FLECHA (0 TO 7,0 TO 2) AS UBYTE => {{0,0,0} ,_
{2,16,1} ,_
{4,32,2} ,_
{6,48,3} ,_
{25,200,4} ,_
{27,216,5} ,_
{29,232,6} ,_
{31,248,7}}
700 REM INICIALIZAR MARCADOR
LET CONTPIT=0
LET CONTENE=0
DIM BLOQUE AS UBYTE
DIM PUNT AS UBYTE
DIM MARCADOR (0 TO 7,0 TO 3) AS UBYTE => {{0,8,1,72} ,_
{16,8,2,40} ,_
{32,8,3,24} ,_
{48,8,4,16} ,_
{200,8,4,16} ,_
{216,8,3,24} ,_
{232,8,2,40} ,_
{248,8,1,72}}
850 REM INICIALIZAR PROTA
DIM PROTA (5) AS ubyte => {10,15,10,15,1,0}
1000 REM INICIALIZAR ENEMIGOS
DIM ENEMIGO (0 TO 4 ,0 TO 4) AS UBYTE => {{6,4,6,4,1} , _
{8,3,8,3,1} , _
{10,3,10,3,0} , _
{11,4,11,4,0} , _
{13,5,13,5,1} }
1100 REM INICIALIZAR PITUFOS
DIM PITUFO (0 TO 4 ,0 TO 4) AS UBYTE => {{6,27,6,27,1} , _
{8,28,8,28,0} , _
{10,27,10,27,0} , _
{11,28,11,28,1} , _
{13,26,13,26,1} }
1200 REM IMPRESION PROTA, ENEMIGOS Y PITUFOS
PLOT INK 3;PAPER 1;TIEMPO,24:DRAW INK 3;PAPER 1;0,7
PRINT AT PROTA(2),PROTA(3);PAPER 4;INK 0;"\D"
'LET PROT=PROTA(1)
'LET RESTP=PROT/2-INT (PROT/2)
IF PROTA(4)=1 THEN IF PROTA(5)=1 THEN PRINT AT PROTA(0),PROTA(1);INK 2;PAPER 4;"\B": END IF:END IF
IF PROTA(4)=1 THEN IF PROTA(5)=0 THEN PRINT AT PROTA(0),PROTA(1);INK 2;PAPER 4;"\A": END IF :END IF
IF PROTA(4)=0 THEN IF PROTA(5)=0 THEN PRINT AT PROTA(0),PROTA(1);INK 2;PAPER 4;"\J": END IF: END IF
IF PROTA(4)=0 THEN IF PROTA(5)=1 THEN PRINT AT PROTA(0),PROTA(1);INK 2;PAPER 4;"\I": END IF: END IF
FOR ENE=0 TO 4
'LET ENEM=ENEMIGO(ENE,1)
'LET RESTE=ENEM/2-INT (ENEM/2)
PRINT AT ENEMIGO (ENE,2),ENEMIGO (ENE,3);PAPER 4; INK 0;"\D" ':PAUSE 0
IF ENEMIGO(ENE,4)=0 THEN PRINT AT ENEMIGO (ENE,0),ENEMIGO (ENE,1);INVERSE 1;INK 4;PAPER 0;"\B" : END IF
IF ENEMIGO(ENE,4)<> 0 THEN PRINT AT ENEMIGO (ENE,0),ENEMIGO (ENE,1);INVERSE 1;INK 4;PAPER 0;"\A": END IF
'PRINT AT ENE,0;ENEMIGO (ENE,0);" ";ENEMIGO (ENE,1)/2;" ";ENEMIGO (ENE,2);" ";ENEMIGO (ENE,3)/2;" ";ENEM;" ";ENEM/2;" ";REST:PAUSE 0
NEXT
FOR PIT=0 TO 4
'LET REST=PITUFO (PIT,1)/2-INT (PITUFO(PIT,1)/2)
PRINT AT PITUFO (PIT,2),PITUFO (PIT,3);PAPER 4; INK 0;"\D" ':PAUSE 0
IF PITUFO(PIT,4)=0 THEN PRINT AT PITUFO (PIT,0),PITUFO (PIT,1);INK 1;PAPER 4;"\J" :END IF
IF PITUFO(PIT,4)<>0 THEN PRINT AT PITUFO (PIT,0),PITUFO (PIT,1);INK 1;PAPER 4;"\I": END IF
'PRINT AT PIT,20;PITUFO (PIT,0);" ";PITUFO (PIT,1)/2;" ";PITUFO (PIT,2);" ";PITUFO (PIT,3)/2;" ";REST:PAUSE 0
NEXT
PRINT PAPER 4;INK 0;AT RELOJX,RELOJY;"\M"
1500 REM ACTUALIZAR VALORES BACKUP
FOR BACK=0 TO 4
LET ENEMIGO (BACK,2)=ENEMIGO (BACK,0):LET ENEMIGO (BACK,3)=ENEMIGO (BACK,1):LET ENEMIGO(BACK,4)=ENEMIGO(BACK,4)+1:IF ENEMIGO(BACK,4)>1 THEN LET ENEMIGO(BACK,4)=0:END IF
LET PITUFO (BACK,2)=PITUFO (BACK,0):LET PITUFO (BACK,3)=PITUFO (BACK,1):LET PITUFO (BACK,4)=PITUFO(BACK,4)+1:IF PITUFO(BACK,4)>1 THEN LET PITUFO(BACK,4)=0:END IF
NEXT
LET PROTA(2)=PROTA(0): LET PROTA (3)=PROTA (1): LET PROTA(5)=PROTA(5)+1:IF PROTA(5)>1 THEN LET PROTA(5)=0:END IF
1250 REM MOVIMIENTO PROTA
IF MULTIKEYS (KEYO)<>0 THEN LET PROTA(1)=PROTA(1)-1 :LET PROTA(4)=0: END IF
IF MULTIKEYS (KEYP)<>0 THEN LET PROTA(1)=PROTA(1)+1 :LET PROTA (4)=1: END IF
IF MULTIKEYS (KEYQ)<>0 THEN LET PROTA(0)=PROTA(0)-1 : END IF
IF MULTIKEYS (KEYA)<>0 THEN LET PROTA(0)=PROTA(0)+1 : END IF
IF MULTIKEYS (KEYM)<>0 THEN GOSUB 5500: END IF
1300 REM ALEATORIO MOVIMIENTO
FOR MOX=0 TO 4':PAUSE 0
FOR MOY=0 TO 1
LET VALOR=INT (RND*3)-1:LET VALORB=INT (RND*3)-1
LET ENEMIGO (MOX,MOY)=ENEMIGO (MOX,MOY)+VALOR
LET PITUFO (MOX,MOY)=PITUFO (MOX,MOY)+VALORB
'IF VALOR<>0 THEN GOTO 1390: END IF
'IF VALORB<>0 THEN GOTO 1390: END IF
'PRINT AT MOX,0;ENEMIGO (MOX,0);" ";ENEMIGO (MOX,1)/2;" ";ENEMIGO (MOX,2);" ";ENEMIGO (MOX,3)/2;" ";REST:PAUSE 0
'PRINT AT MOX,12;PITUFO (MOX,0);" ";PITUFO (MOX,1)/2;" ";PITUFO (MOX,2);" ";PITUFO (MOX,3)/2;" ";REST:PAUSE 0
1390NEXT : NEXT
1400 REM COMPROBAR LIMITES
LET LIMPRO=ATTR(PROTA(0),PROTA(1))
IF LIMPRO=32 THEN GOTO 1410:ELSE LET PROTA (0)=PROTA(2):LET PROTA (1)=PROTA (3):END IF
1410FOR COMPLIM=0 TO 4
IF PROTA(0)=RELOJX AND PROTA(1)=RELOJY THEN LET TIEMPO=207:GOSUB 7000:END IF
'IF ENEMIGO(COMPLIM,1)<ENEMIGO (COMPLIM,3)THEN IF (ENEMIGO(COMPLIM,1)-INT (ENEMIGO(COMPLIN,1)/2=0 THEN LET LIMENE=ATTR(ENEMIGO(COMPLIM,0),INT (ENEMIGO(COMPLIM,1)/2)-1):ELSE LET LIMENE=ATTR(ENEMIGO(COMPLIM,0),INT (ENEMIGO(COMPLIM,1)/2)):END IF:END IF
'IF ENEMIGO(COMPLIM,1)>ENEMIGO (COMPLIM,3)THEN IF ENEMIGO(COMPLIM,1)-INT (ENEMIGO(COMPLIN,1)/2<>0 THEN LET LIMENE=ATTR(ENEMIGO(COMPLIM,0),INT (ENEMIGO(COMPLIM,1)/2)+1):ELSE LET LIMENE=ATTR(ENEMIGO(COMPLIM,0),INT (ENEMIGO(COMPLIM,1)/2)):END IF:END IF
LET LIMENE=ATTR(ENEMIGO (COMPLIM,0),ENEMIGO (COMPLIM,1))
LET LIMPIT=ATTR(PITUFO (COMPLIM,0),PITUFO (COMPLIM,1))
'PRINT AT COMPLIM,0;ENEMIGO (COMPLIM,0);" ";ENEMIGO (COMPLIM,1)/2;" ";ENEMIGO (COMPLIM,2);" ";ENEMIGO (COMPLIM,3)/2;" ";LIMENE:PAUSE 0
'PRINT AT COMPLIM,12;PITUFO (COMPLIM,0);" ";PITUFO (COMPLIM,1)/2;" ";PITUFO (COMPLIM,2);" ";PITUFO (COMPLIM,3)/2;" ";LIMPIT:PAUSE 0
IF LIMENE=32 THEN GOTO 1420: ELSE LET ENEMIGO (COMPLIM,0)=ENEMIGO (COMPLIM,2):LET ENEMIGO (COMPLIM,1)=ENEMIGO (COMPLIM,3):END IF
1420IF LIMPIT=32 THEN GOTO 1430:ELSE LET PITUFO (COMPLIM,0)=PITUFO (COMPLIM,2):LET PITUFO (COMPLIM,1)=PITUFO (COMPLIM,3):END IF
1430NEXT
1450 FOR CHOQUEX=0 TO 4
IF PITUFO(CHOQUEX,0)=PROTA(0) AND PITUFO(CHOQUEX,1)=PROTA(1) THEN LET CONTPIT=1:GOSUB 3000: END IF
IF ENEMIGO(CHOQUEX,0)=PROTA(0) AND ENEMIGO(CHOQUEX,1)=PROTA(1) THEN LET CONTENE=1:GOSUB 4000: END IF
'IF PITUFO (CHOQUEX,0)=ENEMIGO (CHOQUEX,0) AND PITUFO (CHOQUEX,1)=ENEMIGO (CHOQUEX,1) THEN LET CONTPIT=CONTPIT+1:LET CONTENE=CONTENE+1:GOSUB 3000:GOSUB 4000:END IF
NEXT
1505 REM PUNTOS
LET BLOQUE=INT (RND*8):IF BLOQUE=PUNTERO THEN LET PUNT=1: ELSE LET PUNT=INT (RND*3)-1: END IF
LET MARCADOR (BLOQUE,1)=MARCADOR(BLOQUE,1)+PUNT
IF MARCADOR (BLOQUE,1)<8 THEN LET MARCADOR(BLOQUE,1)=8:END IF
IF MARCADOR (BLOQUE,1)>MARCADOR(BLOQUE,3) THEN LET MARCADOR(BLOQUE,1)=MARCADOR(BLOQUE,3):END IF
GOSUB 5000
IF CONTENE>0 THEN LET CONTENE=CONTENE+1:END IF
IF CONTPIT>0 THEN LET CONTPIT=CONTPIT+1:END IF
IF CONTENE>9 THEN LET CONTENE=0:GOSUB 4200: END IF
IF CONTPIT>9 THEN LET CONTPIT=0:GOSUB 3200: END IF
IF CONTENE>0 THEN LET BLOQUE=INT (RND*4):LET MARCADOR(BLOQUE,1)=MARCADOR(BLOQUE,1)+1:END IF: GOSUB 5000
IF CONTPIT>0 THEN LET BLOQUE=INT (RND*4)+4:LET MARCADOR(BLOQUE,1)=MARCADOR(BLOQUE,1)+1:END IF: GOSUB 5000
LET TIEMPO=TIEMPO-1 :IF TIEMPO<80 THEN GOTO 8000 : END IF
IF TIEMPO<95 THEN PRINT AT 20,12;PAPER 2;INK 6;FLASH 1;"HURRY UP!": END IF
GOTO 1200
3000 DIM pitufina (0 to 20,0 to 7) AS uByte => { { 0, 0, 0, 1, 2, 4, 8, 16} , _
{ 7, 56, 192, 0, 0, 0, 0, 0} , _
{ 255, 0, 0, 0, 0, 0, 129, 126} , _
{ 0, 192, 32, 32, 32, 64, 128, 0} , _
{ 32, 32, 32, 64, 64, 64, 64, 64} , _
{ 0, 7, 0, 0, 3, 12, 16, 32} , _
{ 16, 255, 48, 192, 0, 3, 63, 192} , _
{ 248, 6, 1, 1, 8, 228, 50, 2} , _
{ 65, 70, 56, 32, 32, 32, 32, 64} , _
{ 192, 71, 65, 71, 33, 32, 32, 16} , _
{ 7, 232, 24, 11, 55, 48, 128, 104} , _
{ 0, 188, 16, 16, 200, 40, 36, 36} , _
{ 64, 0, 0, 16, 32, 32, 33, 33} , _
{ 145, 139, 136, 137, 137, 136, 150, 17} , _
{ 7, 128, 192, 62, 176, 192, 1, 254} , _
{ 4, 4, 10, 9, 17, 97, 129, 2} , _
{ 0, 0, 219, 218, 218, 154, 155, 0} , _
{ 0, 0, 117, 85, 87, 117, 85, 0} , _
{ 0, 0, 105, 109, 107, 105, 105, 0} , _
{ 0, 0, 119, 37, 37, 39, 37, 0} , _
{ 0, 0, 96, 64, 96, 32, 96,0}}
POKE Uinteger 23675, @pitufina(0,0)
PRINT AT 0,0;PAPER 5;INK 1;"\A\B\C\D";AT 1,0;"\E\F\G\H";AT 2,0;"\I\J\K\L";AT 3,0;"\M\N\O\P";AT 4,0;"\Q\R\S\T\U"
IF INT(RND*3)<2 THEN PRINT AT 0,4;PAPER 5;INK 1;INVERSE 1;" DNJIQUI DNJACA ":ELSE PRINT AT 0,4;PAPER 5;INK 1;INVERSE 1;" DNJOSCAZO! ": END IF
POKE Uinteger 23675, @udg(0,0)
IF CONTPIT>9 THEN GOTO 3150: END IF
IF PUNTERO>3 THEN LET PUNT=1:ELSE LET PUNT=-1:END IF
LET MARCADOR (PUNTERO,1)=MARCADOR(PUNTERO,1)+PUNT
IF MARCADOR (PUNTERO,1)<8 THEN LET MARCADOR(PUNTERO,1)=8:END IF
IF MARCADOR (PUNTERO,1)>MARCADOR(PUNTERO,3) THEN LET MARCADOR(PUNTERO,1)=MARCADOR(PUNTERO,3):END IF
GOSUB 5000
3150RETURN
3200 REM BORRADO PITUFINA
FOR L=0 TO 4: PRINT AT L,0;PAPER 5;" ";AT 0,4;PAPER 5;" ";AT 5,0;PAPER 5;" ":NEXT
'LET PROTA(0)=INT(RND*11)+4:LET PROTA (1)=15
RETURN
4000 REM WALTER
4100 DIM walter (0 to 20,0 to 7) AS uByte => { { 192, 128, 128, 143, 175, 239, 239, 239} , _
{ 0, 0, 127, 207, 207, 207, 207, 199} , _
{ 0, 192, 240, 254, 254, 254, 224, 192} , _
{ 31, 15, 15, 14, 12, 9, 2, 3} , _
{ 241, 240, 193, 227, 230, 224, 224, 225} , _
{ 131, 129, 128, 159, 254, 127, 255, 127} , _
{ 0, 192, 112, 128, 128, 192, 192, 224} , _
{ 3, 0, 0, 0, 0, 2, 3, 13} , _
{ 224, 224, 224, 224, 240, 240, 248, 248} , _
{ 127, 255, 127, 127, 63, 0, 0, 63} , _
{ 96, 112, 128, 0, 16, 24, 141, 15} , _
{ 5, 29, 63, 125, 125, 253, 253, 185} , _
{ 255, 253, 253, 0, 10, 123, 247, 255} , _
{ 31, 15, 135, 207, 239, 127, 255, 255} , _
{ 79, 15, 31, 255, 255, 255, 255, 255} , _
{ 193, 224, 224, 224, 224, 192, 192, 128} , _
{ 0, 0, 139, 138, 138, 171, 82, 0} , _
{ 0, 0, 209, 80, 80, 208, 92, 0} , _
{ 0, 0, 221, 145, 153, 145, 157, 0} , _
{ 0, 0, 192, 64, 128, 64, 64, 0} , _
{ 0, 0, 0, 0, 0, 0, 0,0}}
POKE Uinteger 23675, @walter(0,0)
PRINT AT 0,27;PAPER 6;"\A\B\C\D";AT 1,27;PAPER 6;"\E\F\G\H";AT 2,27;PAPER 6;"\I\J\K\L";AT 3,27;PAPER 6;"\M\N\O\P";AT 4,27;PAPER 6;"\Q\R\S\T"
IF INT(RND*3)=0 THEN PRINT AT 1,4;PAPER 0;INK 6;INVERSE 1;" SHOMER SHABBOS ":ELSE PRINT AT 1,4;PAPER 0;INK 6;INVERSE 1;"SHUT THE FUCK UP, DONNY": END IF
POKE Uinteger 23675, @udg(0,0)
IF CONTPIT>9 THEN GOTO 4150: END IF
IF PUNTERO<4 THEN LET PUNT=1:ELSE LET PUNT=-1:END IF
LET MARCADOR (PUNTERO,1)=MARCADOR(PUNTERO,1)+PUNT
IF MARCADOR (PUNTERO,1)<8 THEN LET MARCADOR(PUNTERO,1)=8:END IF
IF MARCADOR (PUNTERO,1)>MARCADOR(PUNTERO,3) THEN LET MARCADOR(PUNTERO,1)=MARCADOR(PUNTERO,3):END IF
GOSUB 5000
4150RETURN
4200FOR L=0 TO 4: PRINT AT L,27;PAPER 5;" ";AT 1,3;PAPER 5;" ______ ":NEXT
'LET PROTA(0)=INT(RND*11)+4:LET PROTA (1)=15
RETURN
5000 REM RAYAS
PAPER 5
PLOT OVER 1;INK MARCADOR(BLOQUE,2);MARCADOR(BLOQUE,0),MARCADOR(BLOQUE,1)
DRAW OVER 1;INK MARCADOR(BLOQUE,2);7,0
RETURN
5500REM PUNTERO
LET PHMENOS=FLECHA(PUNTERO,0)
LET ATPHM=ATTR(23,PHMENOS)
setattr (23,PHMENOS,ATPHM-8)
LET PUNTERO=PUNTERO+1:
IF PUNTERO>7 THEN LET PUNTERO=0: END IF
LET PH=FLECHA(PUNTERO,0)
LET ATPH=ATTR(23,PH)
setattr (23,PH,ATPH+8)
return
6000 REM PANTALLA
memcopy (50000,16384,6912)
RETURN
7000 PRINT AT 20,11;PAPER 1;INK 3;" "
LET RELOJX=INT(RND*10)+4: LET RELOJY=INT(RND*15)+10:IF ATTR(RELOJX,RELOJY)<>32 THEN GOTO 7000:END IF
RETURN
8000 REM FINAL
LET SCOENE=0: LET SCOPIT=0
PAUSE 500
PAPER 0:BORDER 0:CLS
POKE Uinteger 23675, @pitufina(0,0)
PRINT AT 0,0;PAPER 5;INK 1;"\A\B\C\D";AT 1,0;"\E\F\G\H";AT 2,0;"\I\J\K\L";AT 3,0;"\M\N\O\P";AT 4,0;"\Q\R\S\T\U"
IF INT(RND*3)<2 THEN PRINT AT 0,4;PAPER 5;INK 1;INVERSE 1;" DNJIQUI DNJACA ":ELSE PRINT AT 0,4;PAPER 5;INK 1;INVERSE 1;" DNJOSCAZO! ": END IF
POKE Uinteger 23675, @udg(0,0)
POKE Uinteger 23675, @walter(0,0)
PRINT AT 19,27;PAPER 6;"\A\B\C\D";AT 20,27;PAPER 6;"\E\F\G\H";AT 21,27;PAPER 6;"\I\J\K\L";AT 22,27;PAPER 6;"\M\N\O\P";AT 23,27;PAPER 6;"\Q\R\S\T"
IF INT(RND*3)=0 THEN PRINT AT 23,4;PAPER 0;INK 6;INVERSE 1;" SHOMER SHABBOS ":ELSE PRINT AT 23,4;PAPER 0;INK 6;INVERSE 1;"SHUT THE FUCK UP, DONNY": END IF
POKE Uinteger 23675, @udg(0,0)
LET K=INT (RND*9)+1
PRINT AT 17,0;INK 6;PAPER 0;"INVADERS SCORE:" ;AT 18,0;"POPULATION: ";MARCADOR(0,1)*K;AT 19,0;"WAR SHIPS: ";MARCADOR(1,1)*K;AT 20,0;"BLUE PEOPLE KILLED: ";MARCADOR(2,1)*K;AT 21,0;"BURNED TREES: ";MARCADOR(3,1)*K
PRINT AT 6,0;INK 1;PAPER 0;"BLUE PEOPLE SCORE:";AT 7,0;"NDJOSCAZOS: ";MARCADOR (4,1)*K;AT 8,0;"NDJASQUETES: ";MARCADOR(5,1)*K;AT 9,0;"NDJUSCULOS TRIFASICOS: ";MARCADOR (6,1)*K;AT 10,0;"NDJUMBER OF NDJOFFAS: ";MARCADOR(7,1)*K
FOR SCORE=0 TO 3
LET SCOENE=SCOENE+MARCADOR(SCORE,1)
LET SCOPIT=SCOPIT+MARCADOR(SCORE+4,1)
NEXT
IF SCOENE>SCOPIT THEN PRINT AT 13,1;INK 6;BRIGHT 1;FLASH 1;"INVADERS WIN!!! 'R' TO RESTART":ELSE PRINT AT 13,0;INK 1;BRIGHT 1;FLASH 1;"BLUE PEOPLE WIN ! 'R' TO RESTART": END IF
PAUSE 1:FOR A=0 TO 350:NEXT
88 IF MULTIKEYS(KEYR)=0 THEN GOTO 88: END IF
GOSUB 6000
PAUSE 200
GOTO 1
Posts: 1,763
Threads: 55
Joined: Aug 2019
Reputation:
24
apenao Wrote:First: when I try to install the .msi , it still makes me uninstall manually the previous version.
Second: I tried to compile my previous program Avatar. It compiler ok without optimization and with -O 2, but with -O 3 I get this (and no compile):
Code: >
optimizer.DuplicatedLabelError: Invalid mnemonic '__ATTR_END'
> Execution finished.
I'll send you my program. Most probably it's you have defined an __ATTR_END label which **CLASHES** with one defined in your basic program.
The namespaces for ZX BASIC is _* (_ prefixed) names. So should not use them. Anyway: in new versions, labels will be prefixed with ZX_BASIC. so _ATTR_END will be assembled as ZX_BASIC._ATTR_END
Update: I'm checking it. It seems I was wrong. :roll:
Posts: 1,763
Threads: 55
Joined: Aug 2019
Reputation:
24
Ok, I've uploaded new version 1.2.5-r1513b => <!-- m --><a class="postlink" href="http://www.boriel.com/files/zxb/zxbasic-1.2.5r1513b.msi">http://www.boriel.com/files/zxb/zxbasic-1.2.5r1513b.msi</a><!-- m -->
Please download and try now.
apenao Wrote:First: when I try to install the .msi , it still makes me uninstall manually the previous version. I have not such a problem. Did you put new files in the \Program Files\...\ZX Basic\ directory? If so, you should not :!:
Always work in your own home directory. If you want to use your library, do as in any other compiler:
#include "directory\file.bas"
instead of
#include <file.bas>
The < and > are used for compiler-included libraries, whilst " .. " are used for user libraries. This is almost standard to any compiler.
Otherwise, if you didn't place any file within ZX BASIC directory, I don't know what could it be...
Posts: 805
Threads: 135
Joined: Apr 2009
Reputation:
5
Now I know why we haven't heard from you in a few days, Boriel!
Looks like you've been busy. Wow.
I grabbed the very latest version and ran it and was told:
"Another version of this product is already installed. Installation of this version cannot continue. To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel."
It's a minor issue - but yes, I have to uninstall as well. No files in "C:\Program Files (x86)\Boriel Tm\ZX Basic Compiler" have been modified; and there are no extra files in there.
Uninstall and reinstall works fine with the msi though.
Posts: 1,763
Threads: 55
Joined: Aug 2019
Reputation:
24
Thanks for the feeback, britlion. Maybe it's I have upgraded the MSI package maker recently. I will investigate it.
Did you try to compile with -O3? (includes -O2)? Please, do so and check if the program behaves ok.
Posts: 58
Threads: 5
Joined: Feb 2010
Reputation:
0
Hi Boriel,
I've just downloaded the new .msi 1.2.5-r1513b and it compiles OK now. Unfortunatelly the game is still crap.
Thanks a lot for all your work.
Posts: 1,763
Threads: 55
Joined: Aug 2019
Reputation:
24
Ok: I understand the compiler is ok (even with -O3). So if there are no more bugs, let's release 1.2.5 stable and go for 1.2.6 with new features (e.g. The ones in the wishlist forum).
Posts: 805
Threads: 135
Joined: Apr 2009
Reputation:
5
My big program - a football manager upgrade (which is only partly done) compiles under both -O2 and -O3. That's the good news.
it works under -O2. It doesn't under -O3.
The 42 char routine breaks, and the graphics routine breaks as well.
I've attached the code. If you compile and run with no optimization, then O2, then O3, you'll see the difference.
Notice that it also takes almost 3 minutes to compile. That does seem to be a long time on a VERY up to date computer.
Posts: 1,763
Threads: 55
Joined: Aug 2019
Reputation:
24
Ok, Another fix :!:
The PRINT42 routine now compiles with -O3. I've also finally included in the library/ directory so
#include <print42.bas>
will be OK now, and it can be called with PRINT42, Print42, print42, etc....
I've also convert it to FASCALL. On any function:
Code: SUB FASTCALL MySub(param as Uinteger)
asm
; HL already contains param !
end sub
END SUB
So the initial POP/PUSH sequence can be removed. A FASTCALL function means the 1st parameter is passed on registers. FASTCALL is good for single parameter asm functions. ;-)
This is better explained in another thread.
Posts: 805
Threads: 135
Joined: Apr 2009
Reputation:
5
I think you mentioned that elsewhere; though when I put 42 char printing together, I didn't know that yet.
|