Phantomas Saga: Infinity (CEZ Team/ESP/Karoshi) - Sp/Ams/MSX
- Black Hole
- 64 bits

- Mensajes: 755
- Registrado: 25 Ago 2005 00:34
- Ubicación: Aluche, Madrid
My loader doesn't do anything really special. It mostly behaves as some Dinamic Software loaders, but I customized the code in order to being able to load different chunks of data into different memory locations in the same tape block, without a pause or pilot tone in between, mainly aimed to 128K multi-page loads (this isn't the case, but it's done in Columns).
Why RST 0h ??? Simply because it's 2 bytes shorter than JMP $0000. If the checksum (it's the same standard XOR checksum found in ROM) doesn't match, the computer resets itself. If I would have written a small routine printing "LOAD ERROR" on screen, you'd just get that instead of jumping to the game, since the decrunch routine would crash and it doesn't make any sense even bother to try. The game is not crypted, just packed. There wasn't any intention to do any copy protection (would be useless, since you get a TZX file from the web).
Neither the loading routine nor the decrunch routine use any undocumented Z80 opcode.
-------------------
Mi cargador no hace nada realmente especial. Se comporta sobre todo como algunos cargadores de Dinamic, pero el código está retocado para que sea capaz de cargar diferentes trozos de datos en diferentes posiciones de memoria dentro del mismo bloque de cinta, sin pausas o tonos guía intermedios, principalmente orientado a cargas de 128K multipaginadas (no es el caso, pero sí está hecho así en Columns).
¿Por qué RST 0h? Simplemente porque es 2 bytes más corto que JMP $0000. Si el checksum (es el mismo algoritmo de checksum con XOR que se encuentra en la ROM) no coincide, el ordenador se reinicia. Si hubiese escrito una pequeña rutina que imprimiese "ERROR DE CARGA" en pantalla, obtendrías eso en vez de saltar al juego, ya que la rutina descompresora se colgaría y no tendría sentido ni intentarlo. El juego no está encriptado, está simplemente comprimido. No hay intención de generar una protección anti-copia (sería inútil ya que tienes un fichero TZX en la web).
Ni la rutina de carga ni la de descompresión usan comandos Z80 no documentados.
Why RST 0h ??? Simply because it's 2 bytes shorter than JMP $0000. If the checksum (it's the same standard XOR checksum found in ROM) doesn't match, the computer resets itself. If I would have written a small routine printing "LOAD ERROR" on screen, you'd just get that instead of jumping to the game, since the decrunch routine would crash and it doesn't make any sense even bother to try. The game is not crypted, just packed. There wasn't any intention to do any copy protection (would be useless, since you get a TZX file from the web).
Neither the loading routine nor the decrunch routine use any undocumented Z80 opcode.
-------------------
Mi cargador no hace nada realmente especial. Se comporta sobre todo como algunos cargadores de Dinamic, pero el código está retocado para que sea capaz de cargar diferentes trozos de datos en diferentes posiciones de memoria dentro del mismo bloque de cinta, sin pausas o tonos guía intermedios, principalmente orientado a cargas de 128K multipaginadas (no es el caso, pero sí está hecho así en Columns).
¿Por qué RST 0h? Simplemente porque es 2 bytes más corto que JMP $0000. Si el checksum (es el mismo algoritmo de checksum con XOR que se encuentra en la ROM) no coincide, el ordenador se reinicia. Si hubiese escrito una pequeña rutina que imprimiese "ERROR DE CARGA" en pantalla, obtendrías eso en vez de saltar al juego, ya que la rutina descompresora se colgaría y no tendría sentido ni intentarlo. El juego no está encriptado, está simplemente comprimido. No hay intención de generar una protección anti-copia (sería inútil ya que tienes un fichero TZX en la web).
Ni la rutina de carga ni la de descompresión usan comandos Z80 no documentados.
-
Invitado
It was not a protection or processor incompatibility, but just a tape loading error. My changes showed to solve the problem by chance. With correct audio reproduction, the game loads as it is.na_th_an escribió:I'm sure he'll drop by here sooner or later and will reply you correctly.
Thank you for playing. Now we want a picture of your clone running the game![]()
Perhaps you may add a "tape loading error" message instead of restarting the machine, I've heard about the same problem on original spectrum too.
I will take a picture of the clone running the game
bye!
-
Invitado
-
Alessandro
Ciao! As you can read in the project history of the clone, I recently changed the AY-chip decoding scheme in order to make it fully compatible with the (poor) address decoding logic of the original 128K spectrum.
I used to decode the full address, but this will not work when the software does not deal with the official port addresses (which are $FFFD and $BFFD).
Infinity did not work with my previous hardware release because the sound routine performs one of the two OUT by means of the OUTI instruction, after loading the upper side address register (B) with $BF.
Unfortunately, the Z80 processor decrements the B register BEFORE actually performing the OUT, and not after. As a result, your game sends data to I/O address $BEFD instead of $BFFD. This is not noticeable because the standard I/O decoder simply ignores several address bits and activates the AY-chip anyway.
Needless to say, changing the value loaded in B to $C0 solved the problem on my previous hardware too.
Just as an information.
Bye!
Alessandro
I used to decode the full address, but this will not work when the software does not deal with the official port addresses (which are $FFFD and $BFFD).
Infinity did not work with my previous hardware release because the sound routine performs one of the two OUT by means of the OUTI instruction, after loading the upper side address register (B) with $BF.
Unfortunately, the Z80 processor decrements the B register BEFORE actually performing the OUT, and not after. As a result, your game sends data to I/O address $BEFD instead of $BFFD. This is not noticeable because the standard I/O decoder simply ignores several address bits and activates the AY-chip anyway.
Needless to say, changing the value loaded in B to $C0 solved the problem on my previous hardware too.
Just as an information.
Bye!
Alessandro
- na_th_an
- 256 bits

- Mensajes: 11874
- Registrado: 22 Abr 2005 13:25
- Contactar:
This is very interesting, man. I think you are doing a great work with your prototype. It's incredible to see such an enhaced ZX Spectrum in its design stages.
Don't doubt that, if this ever comes to production, I will be the first one to get one. A spectrum which loads from compact flash cards out of the box... that's just like a dream
Don't doubt that, if this ever comes to production, I will be the first one to get one. A spectrum which loads from compact flash cards out of the box... that's just like a dream
- na_th_an
- 256 bits

- Mensajes: 11874
- Registrado: 22 Abr 2005 13:25
- Contactar:
Thank you so much, man! I'm so delighted. It feels great seeing our game working in this awesome machine.
Congrats and keep up the good work!
@Karnevi: Vamos a tener que hacer una sección de comentarios, notas de prensa y apariciones de nuestros productos, aunque solo con el Sir Fred tendríamos para rellenar dos servidores
Congrats and keep up the good work!
@Karnevi: Vamos a tener que hacer una sección de comentarios, notas de prensa y apariciones de nuestros productos, aunque solo con el Sir Fred tendríamos para rellenar dos servidores
- EightBiter
- 128 bits

- Mensajes: 2983
- Registrado: 23 Dic 2004 18:27
- Ubicación: El Foro, Madrid, España
- Contactar:
- WYZ
- Site Admin

- Mensajes: 2356
- Registrado: 29 Dic 2004 21:17
- Ubicación: Cartagena (CT)
Código: Seleccionar todo
PSGOUT:
XOR A ;reg 0
LD DE,$FFBF
LD BC,$FFFD
LD HL,PSG_REG
LOOUT: OUT [C],A
LD B,E
OUTI
LD B,D
INC A
CP 13
JR NZ,LOOUT
OUT [C],A
LD A,[HL]
AND A
RET Z
LD B,E
OUT [C],A
XOR A
LD [PSG_REG+13],A
RET
I tried port change as you said and it seems to be all right. So you mean all the sound rutines I have seen are wrong because port is $BFFF but reg. B value must to be +1 in order to avoid this z80 OUT "trick"?Unfortunately, the Z80 processor decrements the B register BEFORE actually performing the OUT, and not after.
-
Alessandro
-
Alessandro
This is exactly what happened on my clone with the previous hardware release of the CPLD, where I had an "exact port decoding" to $BFFD and the only way to make it work was modifying the code as you see above: loading FFC0 in DE.WYZ escribió:I tried port change as you said and it seems to be all right. So you mean all the sound rutines I have seen are wrong because port is $BFFF but reg. B value must to be +1 in order to avoid this z80 OUT "trick"?Código: Seleccionar todo
PSGOUT: XOR A ;reg 0 LD DE,$FFC0
This happens only if you use OUTI, of course, since OUT won't change the B register, hence requires the correct value (no +1 offset).
I'm still investigating to see if this is a common Z80A behaviour or just related to my clone's processor, which is a genuine Zilog Z84C0020.
Bye!
-
Alessandro
More info: I also noted that realspec performs a "double out", probably for safety reasons: if you type-in a piece of code that writes to the $7FFD control register by means of OUTI, it will work for both $7FFD and $80FD values in BC register.
This may open a new issue since using OUTI for the other AY-chip register ($FFFD) may cause complications: if the programmer loads the "corrected value" in BC (00FD), this may crash the emulator (probably because he don't likes the OUT on 00FD).
However it's very unlikely that someone wll use OUTI to deal with the $FFFD register, since this is the address pointer of the internal AY register bank.
This is a picture of what I did to make infinity play sound on the previous hardware of the clone (now it's no longer needed). The left window shows the realspec debug panel with the original code, while on the right you see the hex-editor with the cursor over the modified byte. Addresses does not match because that is my snapshot image file, not real spectrum memory. http://www.zxbada.bbk.org/Immagine.gif
Bye!
This may open a new issue since using OUTI for the other AY-chip register ($FFFD) may cause complications: if the programmer loads the "corrected value" in BC (00FD), this may crash the emulator (probably because he don't likes the OUT on 00FD).
However it's very unlikely that someone wll use OUTI to deal with the $FFFD register, since this is the address pointer of the internal AY register bank.
This is a picture of what I did to make infinity play sound on the previous hardware of the clone (now it's no longer needed). The left window shows the realspec debug panel with the original code, while on the right you see the hex-editor with the cursor over the modified byte. Addresses does not match because that is my snapshot image file, not real spectrum memory. http://www.zxbada.bbk.org/Immagine.gif
Bye!
-
Alessandro
More more info: I've been talking to the realspec author. He said that the B-1 matter for OUTI is well known. The emulator performs a SINGLE OUT at B-1 (and this confirms that the behaviour on my clone is common to all Z80 processors).Alessandro escribió:More info: I also noted that realspec performs a "double out", probably for safety reasons
My misunderstanding about the double out was due to the fact that the perfect hardware emulation of spectrum ports made the $7FFD register reachable from a wide variety of addresses. In fact, the port decode logic is as follows:
0xxx xxxx xxxx xx0x = 0x7FFD
10xx xxxx xxxx xx0x = 0xBFFD
11xx xxxx xxxx xx0x = 0xFFFD
...making me think that the OUT was performed on both B and B-1 addresses.
Now there are no more doubt. OUTI should have B loaded with +1 offset. On the zx-spectrum, however, this is not really vital bacause of the poor port decoding logic. As you can see above, you can still load $BFFD on BC: you will address port at $BEFD, but bit A8 is ignored and the sound will come anyway
Bye!
-
Alessandro
Thanks. Now that I downgraded the decoding formula in the cpld, zx-badaloc is compatible with any software version. Loading B+1 is, however, a good practice (imho).WYZ escribió:Ok! btw I will load B+1 from now and our sound soft will be fully compatible with your hardware. Thanks Alessandro.
Also, if $C0FD works, it definitely confirms the fact: should the processor make the OUT at BC address without decrementing B first, the decoder would not activate the AY chip because $C0xx does not meet the requirements (A14 LOW) for $BFxx address.
Bye!
- Ivanzx
- 256 bits

- Mensajes: 4316
- Registrado: 20 Nov 2005 00:50
- Ubicación: Frankfurt, Germany
- Contactar:
- Ivanzx
- 256 bits

- Mensajes: 4316
- Registrado: 20 Nov 2005 00:50
- Ubicación: Frankfurt, Germany
- Contactar:
- Konamito
- 256 bits

- Mensajes: 6395
- Registrado: 01 Jun 2005 17:26
- Ubicación: Santa Cruz de Tenerife
- Contactar:
- Anjuel
- 256 bits

- Mensajes: 8771
- Registrado: 23 Dic 2004 16:36
- Ubicación: Torreznolandia
- Konamito
- 256 bits

- Mensajes: 6395
- Registrado: 01 Jun 2005 17:26
- Ubicación: Santa Cruz de Tenerife
- Contactar:
- Ivanzx
- 256 bits

- Mensajes: 4316
- Registrado: 20 Nov 2005 00:50
- Ubicación: Frankfurt, Germany
- Contactar:
y de propina!! el enlace de los foros de WoS en donde se habla de la musica de Phantomas Saga Infinity.
http://www.worldofspectrum.org/forums/s ... post128621
Hasta luego tropa
http://www.worldofspectrum.org/forums/s ... post128621
Hasta luego tropa
-
Alcoholics Anonymous
- 8 bits

- Mensajes: 14
- Registrado: 21 Mar 2006 08:07
- Ubicación: Canada
Hi all,
Since I spoke of it here I will just announce that the next version of splib is available in the z88dk cvs tree. I've created a topic at WOS http://www.worldofspectrum.org/forums/s ... hp?t=11729 that will contain some example programs that will double as bug-detectors and tutorials.
Only the spectrum version is available now, but the MSX1 version will be almost identical with the only difference being a different memory map and a different initialization function. It won't take long for it to appear; the CPC version will take longer as I have to rewrite many portions of the code.
splib2 was almost bug-free but I do not believe that to be the case this time, unfortunately, which is the main reason I will be supplying test programs to test all the new features. If you find a bug (likely especially in the near term), please let me know.
Since I spoke of it here I will just announce that the next version of splib is available in the z88dk cvs tree. I've created a topic at WOS http://www.worldofspectrum.org/forums/s ... hp?t=11729 that will contain some example programs that will double as bug-detectors and tutorials.
Only the spectrum version is available now, but the MSX1 version will be almost identical with the only difference being a different memory map and a different initialization function. It won't take long for it to appear; the CPC version will take longer as I have to rewrite many portions of the code.
splib2 was almost bug-free but I do not believe that to be the case this time, unfortunately, which is the main reason I will be supplying test programs to test all the new features. If you find a bug (likely especially in the near term), please let me know.
- na_th_an
- 256 bits

- Mensajes: 11874
- Registrado: 22 Abr 2005 13:25
- Contactar:
-
nekotika
- 8 bits

- Mensajes: 2
- Registrado: 28 Jul 2006 01:25
problemas compilando
Hola, perdonad la duda de novato:
He intentado compilar y ejecutar el codigo del infinity y del moggy, utilizando el z88dk y el splib, los ejemplos de la web de splib me funcionan perfectamente (genero el tap y lo cargo en spectaculator).
En el caso de infinity y moggy, la compilacion parece ir bien, pero el tap que genera luego no hace nada en el emulador, me sale moggy.bin y luego vuelve al basic.
No se que es lo que tengo que hacer para generar un .tzx o un .tap que funcionen.
La compilacion la hago asi:
C:\CVS\z88dk\work\moggy>zcc +zx -vn moggy.c -o moggy.bin -lndos -lsplib2 -create-app
He probado con el z88dk que subio nathan, y tambien el actual de la web, y nada de nada. Uso splib2 que es la que supongo ha utilizado para estos juegos.
Un saludo y felicidades por los dos juegos, son muy buenos.
He intentado compilar y ejecutar el codigo del infinity y del moggy, utilizando el z88dk y el splib, los ejemplos de la web de splib me funcionan perfectamente (genero el tap y lo cargo en spectaculator).
En el caso de infinity y moggy, la compilacion parece ir bien, pero el tap que genera luego no hace nada en el emulador, me sale moggy.bin y luego vuelve al basic.
No se que es lo que tengo que hacer para generar un .tzx o un .tap que funcionen.
La compilacion la hago asi:
C:\CVS\z88dk\work\moggy>zcc +zx -vn moggy.c -o moggy.bin -lndos -lsplib2 -create-app
He probado con el z88dk que subio nathan, y tambien el actual de la web, y nada de nada. Uso splib2 que es la que supongo ha utilizado para estos juegos.
Un saludo y felicidades por los dos juegos, son muy buenos.
- na_th_an
- 256 bits

- Mensajes: 11874
- Registrado: 22 Abr 2005 13:25
- Contactar:
Es que para que el juego funcione hace falta cargar más cosas que no vienen en el código. En el caso de Moggy hay que cargar las canciones hechas con el Wham aparte y la pantalla de fondo del menú. Si esos datos no están en memoria pues no funciona. En el caso de Infinity falta el player de música (cuyos fuentes no incluí porque no son míos), los datos de la música y tres pantallas comprimidas que también deben estar en memoria. Los .c solo generan la parte ejecutable del juego. El resto de los datos está "generado" de otra forma (como por ejemplo las pantallas comprimidas, o los datos de la música).
Si quieres hacer funcionar el tema una vez compilados, deberías cargar el juego original y luego, sin ejecutar, cargar los .bin o .tap con los archivos recién compilados. Creo recordar que moggy iba en 24000 y infinity en 32768. Si realmente estás interesado, cuando llegue a casa te genero dos TAP con los bytes que faltan para uno y para otro.
Me alegro de que te hayan gustado estos juegos
Si quieres hacer funcionar el tema una vez compilados, deberías cargar el juego original y luego, sin ejecutar, cargar los .bin o .tap con los archivos recién compilados. Creo recordar que moggy iba en 24000 y infinity en 32768. Si realmente estás interesado, cuando llegue a casa te genero dos TAP con los bytes que faltan para uno y para otro.
Me alegro de que te hayan gustado estos juegos
-
nekotika
- 8 bits

- Mensajes: 2
- Registrado: 28 Jul 2006 01:25
ahh, osea que simplemente me faltaba añadir cosas, pensaba que ya estaba todo incluido en el codigo.
Mi idea es hacer un juego para spectrum, y habia compilado los dos juegos para estar seguro de que el entorno funcionaba a la perfeccion. Pensaba que era algun problema de no saber generar el tap.
Pues entonces la duda que me queda es como montar un .tzx con su pantalla de carga mas el bin del juego, vamos la version final ya montadita para distribuir.
En cuanto a los juegos, la verdad es que sobretodo el infinity tiene una calidad en cuanto a graficos y sobretodo acabado profesional. Si alguien me hubiese dicho que era oficial me lo habria creido completamente. El unico pero que le achaco es que tambien iguala dificultad, y me parece que hoy dia ya no estoy para esas plataformas imposibles
Mi idea es hacer un juego para spectrum, y habia compilado los dos juegos para estar seguro de que el entorno funcionaba a la perfeccion. Pensaba que era algun problema de no saber generar el tap.
Pues entonces la duda que me queda es como montar un .tzx con su pantalla de carga mas el bin del juego, vamos la version final ya montadita para distribuir.
En cuanto a los juegos, la verdad es que sobretodo el infinity tiene una calidad en cuanto a graficos y sobretodo acabado profesional. Si alguien me hubiese dicho que era oficial me lo habria creido completamente. El unico pero que le achaco es que tambien iguala dificultad, y me parece que hoy dia ya no estoy para esas plataformas imposibles
- na_th_an
- 256 bits

- Mensajes: 11874
- Registrado: 22 Abr 2005 13:25
- Contactar:
Je je 
Para montar la cinta, lo que hago yo al menos es seguir el método tradicional que se hacía en los viejos tiempos
vas grabando los bloques uno detrás de otro...
Normalmente me hago un cargador muy sencillo que se encarga de cargar la pantalla de carga y luego el bloque de datos. Spectaculator tiene un emulador de cintas muy bueno y cambiar de cinta para cargar un bloque y luego meter otra para grabarlo es muy sencillo. Luego tienes además el ZX Block Editor (creo que era) para "limpiar" y reordenar un poco la cinta generada en el caso de que te equivoques y grabes mal un bloque.
Sin embargo, Infinity cuenta con un sistema de carga "turbo" que en lugar de cargar más rápido (a más baudios) haciendo la carga menos fiable, lo que hace es cargar el juego comprimido y descomprimirlo en memoria, con lo que ocupa menos en cinta y tarda menos en cargar. De eso se encargó black hole, yo la verdad no tengo ni idea de como se hacen estas cosas
Ánimo con el z88dk, a ver si nos sorprendes pronto con alguna joyita
Para montar la cinta, lo que hago yo al menos es seguir el método tradicional que se hacía en los viejos tiempos
Normalmente me hago un cargador muy sencillo que se encarga de cargar la pantalla de carga y luego el bloque de datos. Spectaculator tiene un emulador de cintas muy bueno y cambiar de cinta para cargar un bloque y luego meter otra para grabarlo es muy sencillo. Luego tienes además el ZX Block Editor (creo que era) para "limpiar" y reordenar un poco la cinta generada en el caso de que te equivoques y grabes mal un bloque.
Sin embargo, Infinity cuenta con un sistema de carga "turbo" que en lugar de cargar más rápido (a más baudios) haciendo la carga menos fiable, lo que hace es cargar el juego comprimido y descomprimirlo en memoria, con lo que ocupa menos en cinta y tarda menos en cargar. De eso se encargó black hole, yo la verdad no tengo ni idea de como se hacen estas cosas
Ánimo con el z88dk, a ver si nos sorprendes pronto con alguna joyita
- Ivanzx
- 256 bits

- Mensajes: 4316
- Registrado: 20 Nov 2005 00:50
- Ubicación: Frankfurt, Germany
- Contactar:
Eso hay que celebrarlo!!!!!! algun adelanto, vas a hacerlo en plan destroyer tu solo o con el equipo CEZ?!nekotika escribió:Mi idea es hacer un juego para spectrum
Mucha suerte con el proyecto, ah! y no no, tu dale un poco mas al Infinity, que veras que no es tan dificil, eso me parecio a mi pero le pillas el truco y en un par de dias seguro que ahi estas saliendo de la factoria.
Saludos!
- iforeve
- 128 bits

- Mensajes: 1812
- Registrado: 27 Jul 2005 13:23
- Ubicación: Sevilla
- Contactar:
- Konamito
- 256 bits

- Mensajes: 6395
- Registrado: 01 Jun 2005 17:26
- Ubicación: Santa Cruz de Tenerife
- Contactar:
El Infinity puede ser muy difícil al principio, pero tras varias partidas (una docena
) te llegas a memorizar el mapa y te planteas la estrategia de ataque: dejar el último cerrojo sin abrir lo más cerca de la salida. Luego es cuestión de cogerle el tranquillo a los dos tipos de salto y estudiar las rutinas de movimiento de los enemigos.
Yo me lo terminé cuando ya lo daba por imposible. Ánimo, que puedes lograrlo
Yo me lo terminé cuando ya lo daba por imposible. Ánimo, que puedes lograrlo