Curiosities

Findings

Things that turned up while taking the game apart and that, as far as we have been able to check, were not documented anywhere. Each one comes with the evidence behind it, so that anyone can verify it.


The cheater's punishment

In the binary, at address 0x7F94, there is this sentence:

POR QUE NO PRUEBAS SIN POKES

("Why don't you try it without pokes.") It is not a stray message or a debug string. The routine that uses it sits at 0x8B80, and it is part of the end-of-game sequence:

FINAL_JUEGO:
    ld a,(08f0dh)       ; avanza a la pantalla 28, la de victoria
    inc a
    ld (08f0dh),a
    call CARGA_MAPA     ; la carga como cualquier otra pantalla
    call VUELCA_BUFFER
    call INIT_PANTALLA  ; y la enciende

CASTIGO_TRAMPAS:
    ld a,(08f1eh)       ; bandera de tramposo
    cp 000h
    jp z,BUCLE_FINAL    ; si esta limpia, final normal
    ld hl,07f94h        ; si no: el reproche...
    ld de,019e0h        ; ...encima de la ultima linea del area de juego
    ld bc,00020h
    call 0005ch

In other words: you have cleared all 28 screens, you reach the victory screen with its «Aleluya, oh fray Arnulfo», and instead of letting you enjoy it the game writes the telling-off right on top of it. A punishment saved for the very end.

Which line it wipes out, exactly

We forced the end of the game in the emulator, once with the flag clear and once with it set by hand, and compared the last line of the play area:

legitimate ending:  ¿TE ATREUERAS CON "ALEHOP"?
with the cheat:     POR QUE NO PRUEBAS SIN POKES

The telling-off does not land in free space: it replaces exactly the line where the game invites you to play Alehop, the company's next title. The cheater has the invitation taken away.

Legitimate ending

Ending with the cheat flag set

And it never fires

We searched all four of the game's binaries for any instruction that writes to 0x8F1E, in every form: ld (0x8F1E),a, ld hl,0x8F1E, ld de,…, ld bc,…. The only reference in the whole game is the read at 0x8B80. No write, anywhere.

The flag is zero on a clean tape and stays zero with the game running, so the punishment never triggers.

And now the good part: they forgot to initialise it

The game's start-up initialises fifteen variables, one after another:

8F09 8F0A 8F0B 8F0C 8F0D 8F0E 8F11 8F12 8F13 8F14 8F17 8F18 8F19 8F1C 8F1D

One is missing. 0x8F1E is the only variable the game reads and never initialises, and it sits right next to 0x8F1C and 0x8F1D, which are initialised. That is precisely the one they skipped.

So why is it zero, then? Because the tape loads something there, and that something happens to be a zero. But it is not an initialisation: it is padding. The area 0x8F00-0x8FA0 comes filled with leftover bytes from the animation tables — you can recognise them because they alternate pattern values with colour bytes of the 0x04, 0x14, 0x34 kind — and out of those 160 bytes only three are zero. One of them, by pure chance, falls exactly on 0x8F1E.

That is: the punishment fails to fire by sheer luck. If the padding had left any other value there — and there was a 98% chance of that — the check would have come out non-zero and everybody who finished the game would see the telling-off, without having cheated at all.

So what we have here is not a clever trap but a lucky bug: they wrote the check, forgot to zero the variable, and the randomness of the padding saved them from having their own game insult every honest player.


A 1988 misprint

The only published cheat for Temptations appeared in MSX Book II (Paulisoft, Brazil, 1988), page 62, in a loader signed BY MBCF/88. It says:

POKE &HB4CC,0

It does nothing. In the game's binary, address 0xB4CC already holds a zero: the poke writes a zero over a zero.

The correct address is 0x84CC, which holds 0x3D — the DEC A instruction inside the routine that takes a life away:

QUITA_VIDA:
    ld a,(08f12h)   ; A = vidas actuales
    dec a           ; <-- 0x84CC. Poniendo 0x00 aqui (NOP), A no cambia
    cp 0ffh
    jp z,GAME_OVER
    ld (08f12h),a

In the dot-matrix type used in those books, 8 and B are almost the same glyph. We compared the printed character with the 8 in "88" and the B in "BLOAD" on the same page: it is an 8 that was badly scanned or badly typeset.

Verified in the emulator. We forced the routine to run with and without the patch:

  Lives before Lives after
Without the patch 9 8
With 0x84CC = 0x00 9 9

So the cheat published in 1988 had one digit wrong, and the good one is POKE &H84CC,0.


Why the water in level 4 is green

Level 4 is underwater: Fray Arnulfo turns into a fish, gravity disappears and you can swim freely. The interesting bit is how the background is done.

On the MSX video chip, the TMS9918, colour 0 is not black: it is transparent. Wherever a tile uses colour 0, what shows through is the backdrop colour, which is a single VDP register.

The game takes advantage of that. On entering level 4:

ENTRA_NIVEL4:
    call EMPIEZA_NIVEL
    ld a,00ch           ; color 12 = verde
    ld (0f3ebh),a       ; en el registro de color de fondo
    call 00062h         ; BIOS CHGCLR: aplicalo
    ld a,001h
    ld (08f11h),a       ; y enciende el modo flotar

One byte. With that, every transparent area of every tile goes from black to green all at once, and the whole level turns into the bottom of the sea without a single graphic having changed.


Four levels of seven screens, straight from the code

The structure of the game does not have to be guessed at. The routine that decides what happens when a screen is finished says it:

FIN_DE_PANTALLA:
    ld a,(08f0dh)       ; pantalla que se acaba de terminar
    cp 00dh             ; 13 -> entra al nivel 3
    jp z,ENTRA_NIVEL3
    cp 014h             ; 20 -> entra al nivel 4
    jp z,ENTRA_NIVEL4
    cp 01bh             ; 27 -> se acabo el juego
    jp z,FINAL_JUEGO
    cp 006h             ; 6  -> entra al nivel 2
    jp z,CEREMONIA_NIVEL
    jp CAMBIO_PANT_NORMAL

6, 13, 20 and 27. The cuts come every seven screens: 0-6, 7-13, 14-20, 21-27.


Leftovers from another build

Between 0xCA00 and 0xD000 there are 1,536 bytes the analysis does not claim. About 729 of them —0xCA00-0xCC10 and 0xCE00-0xCEC7— are real code: they disassemble cleanly and the routines make sense. But nothing calls them. The rest is tables and padding.

It is an earlier version of some routines, left behind in the binary. And it is worth a warning: a chunk disassembling coherently is no proof that it ever runs.


And the bytes nobody touches

642 bytes were left unexplained. They were settled by putting memory watchpoints on every one of them and playing a full game in the emulator, with infinite lives and the monk pushed against the right-hand edge, to run through all four levels up to screen 27.

Open questions

All 40,449 bytes sit in a named range and the listing gives the tape back byte for byte. That does not mean everything is known. What the listing itself treats as a guess is marked with (?), and this is what is still left that way.

Two ranges the listing still calls "unidentified"

grafdesc, at 0x5800–0x5CC0 (1,216 bytes), is described as "graphics data not identified yet", and the stretches of datos_juego left at 0x5FC0–0x79C0 and 0x7F80–0x8000 say "screen maps, tables" with the same doubt. Part of what is in there is known —make sanity knows the scoreboard template dumped to VRAM starts at 0x5FC0—, but the listing has not split it into named blocks yet. Until it does, those bytes have a place but no explanation.

Does a collision between two enemies kill too?

Collision is not computed: the game reads bit 5 of STATFL (0xF3E7), the sprite collision flag the VDP leaves. The player takes planes 0 and 1 and the enemies 6 to 13, which is why one hit kills. What has not been checked is whether two enemies overlapping each other also set that bit and kill the player without touching him.

Is it a flying mode?

0x8469 sets variable 0x8F11 to 1, and while it is 1, 0x812E calls 0x857A, which reads the joystick to move the player up and down at will. It was named "VUELO" (flying) for what the code does; it has not been seen on screen.

Does it write to the wrong slot?

At 0x885A, with IX already at 0x8F34, ld (ix+005h),000h writes 0x8F39, which is slot 5's X, not slot 4's. Whether that is a typo in the original or something is being missed is still undecided.

Sound effect 6

It is called OBJETO DESTRUIDO (object destroyed) because 0x89DD fires it when the target runs out of hits, and it lasts 28 frames. The name comes from who calls it, not from hearing it. Nor is it settled how long the channel C note it uses lasts: with the counter at 2 it takes one or two frames, depending on the carry WRTPSG leaves before the sbc at 0xDC86.

The projectile's cell (2,21)

When a projectile goes back to the stock it is parked at cell (2,21), which 0x8AA9 turns into VRAM 0x1AA2: exactly the first cell of the ammunition strip on the scoreboard. Since it then jumps to 0x89FC, each available projectile redraws its icon there. That this is the purpose, and not just any parking spot, is interpretation.

How much stack is lost when you run out of lives?

Quitting with CTRL+STOP loses 6 bytes of stack each time, counted instruction by instruction from 0x832A. Running out of lives does the same —the jp z at 0x84CF leaves a chain of CALLs without popping—, but those bytes are not counted. And the 33-byte cushion above the stack is the one observed in dumps, not a proven limit: nobody knows after how many games it would run out.

Where the 00/FF gaps come from

Several gaps alternate 00 at even addresses and FF —or EF— at odd ones, and no data format behaves like that. The hypothesis is uninitialised dynamic RAM on the machine the tape was mastered on —in its favour, they all end exactly on a page boundary—, but the bytes alone cannot prove it.

Leftovers of an earlier version

The dead block at 0xCA00 carries two copies in a row of the HL+=A routine and no longer has the shot template at 0x8CB8; the seven bytes of resto_epilogo_irq repeat the end of the interrupt routine, as if the effects engine had once hung off H.TIMI. Both fit an earlier version of the program, and neither can be proved from the bytes.

The sound player

The tempo is stored as 3000/(tempo*16), and 3000 is 50×60: that fits a tempo in quarter notes per minute at 50 Hz with sixteen units per quarter note, but it is a reading. The datos_psg tables (0xD5C8–0xD760) are given as note periods and envelopes without having been taken apart. And the dead entry at 0xD015 drops bit 7 of the channel number: what it was for cannot be known, because nothing calls that routine.