![]() |
ZXB errores mios de sintaxis o incompatible con SinclairBas? - Printable Version +- Forum (https://www.boriel.com/forum) +-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12) +--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11) +--- Thread: ZXB errores mios de sintaxis o incompatible con SinclairBas? (/showthread.php?tid=477) |
ZXB errores mios de sintaxis o incompatible con SinclairBas? - tachuelita - 07-22-2012 Hola a todos, gracias por recibirme en este foro. Sorry por escribir en español, intente' traducir mi texto con el traductor de Google pero confunde mas de lo que explica. Les cuento que estoy creando un TRACKER para el AY 3-8912 con zx boriel puramente en basic, para poder hacerle Musica y FX a mis juegos, claro que tambien para compartirlo (y aunque alguien me explique como compilar WYZ player, creo que tiene mucho mas mérito para mi, lo tomo como desafio propio). No es la primera vez que me sucede que alguna rutina no me funciona. Puntualmente en este TOPIC les dejare' las que mas me dieron problema y no entiendo donde esta mi error. Este "retazo" de rutina funciona con una doble tabla ascii alojada en memoria (50000) brindando 64 columnas a imprimir, para aprovechar mas pantalla. (si, ya se que en LIBRARY del compilador tengo programita que imprime en 64 col, que tampoco se como se usa, pero como dije, a mi me gusta el desafio: "hazlo tu mismo"... tambien se que esta' es bastante precaria a lo basic espectrumero, pero para mejorarla, necesito primero que nada que funcione) Code: 9550 '------------------------------ http://www.mediafire.com/?e1331ilv7wa7k42 el siguiente es el archivo .TAP generado por el compilador del codigo escrito arriba (se resetea) http://www.mediafire.com/?nubshu8qjaj1kwa ...y el .BIN que debe cargarse en la direccion 50000 con los graficos http://www.mediafire.com/?fwar9f2ly17hinm Gracias Boriel por devolverme a la vida, pues programar despierta en mi energias como solo la musica de BACH lo hace; gracias a todos, espero respuestas Re: ZXB errores mios de sintaxis o incompatible con Sinclair - boriel - 07-23-2012 Google translate (Spanish -> English) Hello everyone, thank you for this forum. Sorry for writing in Spanish, try to 'translate my text with the Google translator but confuses more than it explains. I tell them that I am creating a TRACKER for AY 3-8912 with zx boriel purely basic, to make music and FX to my games, of course also to share (and even someone explain how to compile WYZ player, I think it has much more worthwhile for me, I take it as a challenge of its own). Not the first time I happen to be a routine does not work. Specifically in this TOPIC fails them 'which gave me more problems and do not understand where my mistake. This "patch" routine works with double memory housed in ascii table (50000) providing 64 columns to print to take advantage of more screen. (Yes, I know that I have LIBRARY compiler software that prints in 64 cabbage, also not as used, but as I said, I like the challenge, "do it yourself" ... I also know that this' is precarious to espectrumero basic, but to improve it, I need first of all to work) Code: 9550 '------------------------------ http://www.mediafire.com/?e1331ilv7wa7k42 The following is the. TAP generated by the compiler of the code written above (reset) http://www.mediafire.com/?nubshu8qjaj1kwa ... And the. BIN to be loaded into the address 50000 with graphics http://www.mediafire.com/?fwar9f2ly17hinm Thanks for giving Boriel to life, because my energies awake schedule as only Bach's music does, thanks everyone, I hope answers Re: ZXB errores mios de sintaxis o incompatible con Sinclair - LCD - 07-24-2012 @Boriel: Please copy the sources next time directly without using a translator. Code: IF f = f = 0 OR 4 OR 8 OR f = f = 12 f = 16 THEN OR Code: POKE 23607.194 Code: IF z +1 <= LEN X THEN About the solution: Code: FOR z=0 TO LEN X$ STEP 2 Code: FOR z=0 TO LEN(X$)-1 STEP 2 And how about changing: Code: 9607 IF decimales > LEN X$ THEN Code: while LEN(X$)<decimales Re: ZXB errores mios de sintaxis o incompatible con Sinclair - tachuelita - 07-24-2012 Copio el codigo entero nuevamente, porque me equivoque al copiarlo en este if I copy the entire code again, because I'm wrong to copy this if Code: IF f=0 OR f=4 OR f=8 OR f=12 OR f=16 THEN CODE: Code: 9550 '+-----------------------------+ Re: ZXB errores mios de sintaxis o incompatible con Sinclair - tachuelita - 07-24-2012 Excelente LCD, hice los cambios que me indicaste y AHORA FUNCIONA. Pero me gustaria saber la razon por la cual mi codigo no funciona (ese simple IF THEN con su etiqueta). ??? Yo utilizo mucho este tipo de recursos. Tendria que ver o al menos saber los tipos de rutina que el compilador no admite. por lo pronto les mostrare los que no me funcionaron... Excellent LCD, I made the changes you indicated and NOW WORKS. But I would like to know the reason why my code does not work (that simple IF THEN with its label). ??? I use a lot of these resources. I would have to see or at least know the routine types that the compiler does not support. for now I'll show those that did not work ... GRACIAS !! THANKS !!! Re: ZXB errores mios de sintaxis o incompatible con Sinclair - LCD - 07-24-2012 the IF ... THEN was only a cosmetical change. The other change was to reduce the readed out string by one. The reason is that the index of variables (arrays and strings) in ZXBC starts with 0, not with 1. This is not a bug but a great feature. If you set the String base to 1 with compiler option --string-base=1, it would work as expected anyway with your posted code too. Re: ZXB errores mios de sintaxis o incompatible con Sinclair - boriel - 07-24-2012 @tachuelita, te traduzco lo que dice @LCD: ZX BASIC usa la numeración 0..n-1 para las cadenas. O sea, la primera letra de un String A$ sería A$(0), mientras que en el BASIC original del Spectrum es A$(1). Esto se hace por rendimiento. Pero puedes hacer que empiecen en 1, usando el parámetro --string-base=1. Para arrays sucede lo mismo, y puedes usar --array-base=1 para que empiecen en 1, como en el Sinclair BASIC. También ten en cuenta que cuando ZX BASIC evalúa una condición booleana en un IF, el resultado puede ser 0 (False) o <>0 (True). En el BASIC original de Sinclair siempre era 0 ó 1, aquí no, porque esto da más velocidad. No obstante, puedes forzar que siempre sean 0 ó 1, usando el flag de compilación --strict-bool a costa de un pequeño (mínimo) impacto en el rendimiento. Por último, si quieres despreocuparte de todo esto, puedes usar el flag --spectrum que activa todo lo de arriba a la vez para mayor compatibilidad. Re: ZXB errores mios de sintaxis o incompatible con Sinclair - tachuelita - 07-24-2012 Right, I don't know the compiler option --string-base=1 ... How do you apply? Now understand that my mistake was not having subtracted 1 to index of (x$). that's right? Anyway, I have to get used to start with zero index of the strings. I guess it has its advantages. Then, still posing routines that are not properly compiled. The next routine, try to copy a movie of frames at ATTR address on the screen. But The variable 'ymalo' ( " y " coordinate) does not work because it always stays at 0. i dont know why ![]() Code: '----------------------------------------- http://www.mediafire.com/?nl20ws5g09xhgh9 in this case I don't need upload the file attributes, because you can see the attr-movie-frames like a black window GRACIAS NUEVAMENTE!!! (me esta gustando esto de escribir en ingles, solo que no se si es la sintaxis correcta) Re: ZXB errores mios de sintaxis o incompatible con Sinclair - tachuelita - 07-24-2012 boriel Wrote:@tachuelita, te traduzco lo que dice @LCD: Gracias por traducir, me queda aun mas claro. --array-base=1 se coloca en el principio como (por ej) #include ? Quote:También ten en cuenta que cuando ZX BASIC evalúa una condición booleana en un IF, el resultado puede ser 0 (False) o <>0 (True). En el BASIC original de Sinclair siempre era 0 ó 1, aquí no, porque esto da más velocidad. No obstante, puedes forzar que siempre sean 0 ó 1, usando el flag de compilación --strict-bool a costa de un pequeño (mínimo) impacto en el rendimiento. No se lo que es una condición booleana, pero mas o menos me hago una idea. Me gustaria saber exactamente como funciona. Principalmente me gustaria saber como se programan en ZX BASIC las rutinas del Sinclair Basic, las cuales me llueven del mas alla'. Mas que me interesa optimizar el rendimiento, quiero meterme de lleno en ello. Estoy seguro que estoy desperdiciando un 60% o mas de los recursos de tu compilador. Quote:Por último, si quieres despreocuparte de todo esto, puedes usar el flag --spectrum que activa todo lo de arriba a la vez para mayor compatibilidad. bueno, tambien me interesa saber como activo este flag. ![]() Re: ZXB errores mios de sintaxis o incompatible con Sinclair - LCD - 07-24-2012 tachuelita Wrote:Right, I don't know the compiler option --string-base=1 ... How do you apply? To apply the compiler options, just call the compiler with this option... Code: zxb.exe "D:\temp.bas" -S 24200 -t "D:\output.tap" --string-base=1 Code: dim ymalo,xmalo,d,q,expd,pijota,codi,cod as Uinteger Re: ZXB errores mios de sintaxis o incompatible con Sinclair - tachuelita - 08-13-2012 Bien, gracias @LCD. Ahora no solo funciona este codigo, sino que gracias a: Code: dim x , y , x , blablabla as uinteger ![]() Aqui dejo mi codigo Code: '----------------------------------------- ...y u respectivo archivo:http://www.mediafire.com/?zzjclem28762neq la pelicula se puede mover con las teclas "o","p","q"."a" MUY AGRADECIDO SI ALGUIEN ME PUEDE CORREGIR EN EL ANTERIOR PARA OPTIMIZAR RECURSOS. Valga la redundancia, ya no tengo numeros negativos definiendo las variables como enteros, por lo que me vi obligado a trabajar con numeros altos y luego restar en el momento de imprimir: IF ymalo +d >127... PRINT AT ymalo+d-128,xmalo-128... - Esto hace que me surja la siguiente pregunta: como hago para utilizar numeros negativos (y que me funcione el codigo)?? Tambien necesito saber como hago para utilizar los numeros que estan despues de la coma en una variable, por ej: LET a= a + 0.02 - Como hago para que una variable soporte este tipo de valores? - Como hago para hacer etiquetas con nombres para las SUB-rutinas asi no depender del engorroso numero de linea del spectrum basic? -Hay alguna forma de PGINAR EN 128K desde el ZX BORIEL sin tener que recurrir al assembler? las paginaciones tienen que ser siempre de a 16kb? o puedo paginar en la direccion de memoria que se me antoje y con una longitud de 192bytes por ej? Re: ZXB errores mios de sintaxis o incompatible con Sinclair - tachuelita - 08-13-2012 PD: una pequenia "DEMO" funcionando (en paniales) de mi TT (TachTracker): http://www.mediafire.com/?238ea36a8pfg7uf keys: H = UP N = DOWN B = LEFT M = RIGHT A = OCTAVA UP Z = OCTAVA DOWN OCTAVA 8 only in CH1= DRUMS (like a general midi keyboard: Q=Kick, W=Snare, 7=HiHat Close, 6=HiHat Foot. estos 4 por ahora) S = TEMPO UP X = TEMPO DOWN D = SELECT HIGHER PATTERN C = SELECT LOWER PATTERN F = SLIDE OFF, SLIDE UP 1,2,3,4 SEMITONES V = SLIDE OFF, SLIDE DOWN 1,2,3,4 SEMITONES KEYBOARD: 2 3 5 6 7 9 0 q w e r t y u i o p 4 = CLEAN 8 = MUTE L = REFRESH PRINT PATTERN SPACE = PLAY J = STOP K = EDIT PATTERN SECUENCE (UP,DOWN=INC,DEC / LT,RT=MOVE / J = RETURN) 1 = RETURN TO BASIC Esta tiene cargada unos 4 de patterns de prueba, luego subo una version vacia. Si a alguien le parece que puede ser interesante hago un nuevo topic, subo el codigo de este TachTracker y el codigo TachPlayer a puro ZXBORIEL-BASIC, para poder utilizarlo. Yo ya pude incorporar musica en mi juego lo cual me tiene muy contento ![]() Hay cosas que tengo que corregir, por ejemplo necesito mejorar la rutina que hace los slides la cual me roba mas procesador de lo deseado, incluir mas sonidos de percusion y arreglar los ya existentes. Tambien incluir efectos de vibrato, acordes, (editor de instrumentos? seria muy hambicioso pero vale la pena para un futuro) etc... PERO POR SOBRETODO NECESITA UNA RUTINA DE IMPRESION DE PATTERN QUE SEA SUPER RAPIDA. PORQUE LA QUE TIENE ES MUUUUUUUUUUUY LENTA. Enjoy it! Re: ZXB errores mios de sintaxis o incompatible con Sinclair - boriel - 08-13-2012 tachuelita Wrote:- Esto hace que me surja la siguiente pregunta: como hago para utilizar numeros negativos (y que me funcione el codigo)?? Spanish: Utiliza el tipo "Integer". Todos los tipos que empiezan con el prefijo "U" son Unsigned (positivos). Tienes la lista completa de tipos aquí: <!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Types#Integers">http://www.boriel.com/wiki/en/index.php ... s#Integers</a><!-- m --> English: Use the "Integer" type. Types prefixed with "U" are Unsigned (positive). A detailed Type list is here: <!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Types#Integers">http://www.boriel.com/wiki/en/index.php ... s#Integers</a><!-- m --> tachuelita Wrote:Tambien necesito saber como hago para utilizar los numeros que estan despues de la coma en una variable, por ej: LET a= a + 0.02Spanish: Usa Fixed o Float. Float es el tipo nativo del Spectrum, y es más lento. Fixed es más rápido, pero su rango y precisión es menor: De -32768 a +32767, aproximadamente. Además, la "resolución" de decimales es bastante buena (aproximadamente 0.0001). Nuevamente mira la página de tipos. English: Use Fixed or Float. Float is the native Spectrum Float format, and it's slower. Fixed is faster, but its range and precision are not so good (it's less accurate). It ranges from -32768 to +32767 with a precision of 0.0001 aprox. Again, have a look at types page. teclita Wrote:- Como hago para hacer etiquetas con nombres para las SUB-rutinas asi no depender del engorroso numero de linea del spectrum basic?Spanish: Simplemente no uses números de linea. Puedes usar etiquetas poniendo la etiqueta seguida de dos puntos. English: Simply don't use line numbers. Use labels: just an identifier followed by a colon. Re: ZXB errores mios de sintaxis o incompatible con Sinclair - britlion - 08-13-2012 You might also want to look at tutorials: <!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Tutorials">http://www.boriel.com/wiki/en/index.php ... :Tutorials</a><!-- m --> (Google Tr ![]() Si potrebbe anche voler guardare tutorial. (Alcuni sono in spagnolo, ma google dovrebbe tradurre gli altri). <!-- m --><a class="postlink" href="http://www.boriel.com/wiki/en/index.php/ZX_BASIC:Tutorials">http://www.boriel.com/wiki/en/index.php ... :Tutorials</a><!-- m --> Re: ZXB errores mios de sintaxis o incompatible con Sinclair - tachuelita - 08-13-2012 Thanks @boriel, Thanks @britlion. Spaish: Me han sido de absoluta utilidad sus respuestas. Aun sigo con la duda, de como hacer para paginar trozos de ram en 128k. Me gustaria saber si hay alguna forma de paginar desde el ZXBoriel. Y si no la hay cual es el modus operandi en assembler. Planteo un burdo ejemplo de lo que quiero hacer, del modo en el cual programaba en mi vieja Spectrum +2 GRIS (rip): English: I have been absolutely useful answers. I'm still in doubt, how do to paginate in 128k ram chips. I would like to know if there are ways of paging from ZXBoriel. And if there is none which is the modus operandi in assembler. I raise a crude example of what I do, the way in which programming on my old Spectrum +2 GRAY (rip): Code: 1 REM ---- LOADER AND PAGINATE ----- COMO SIEMPRE GRACIAS !!! THANK YOU, AS ALWAYS !!! |