quarta-feira, 6 de setembro de 2017

Jogos da Ultimate com teclas redefiníveis


Quem não se lembra da dor de cabeça que eram os jogos da Ultimate, que não só não permitiam que escolhêssemos as teclas, como as que vinham por defeito propositadamente aumentavam o nível de dificuldade dos jogos, ao mesmo tempo reduzindo a sua jogabilidade. Mas Robin Verhagen-Guest descobriu uma maneira de colocar a opção de redefinição de teclas:

I pressed pause in Spectaculator first, then loaded up a z80 snapshot. Then (still paused) I made a note of all the registers in the emulator debugger and dumped memory from $4000-$FFFF (the entire 48K RAM) to a .bin file. Then I found some free space filled with zeroes at $E000 (only potentially free at this point, although that turned out to hold true). Zeus lets you inject code into it's integrated emulator instantaneously at assembly time without having to load from virtual tape, so I loaded in my .bin file at $4000 using the import_bin directive. Then wrote a small asm entrypoint program at $E000, that sets the SP, registers and alt registers to the original values, and jumps to the original PC. Clicking Assemble Then Emulate ran the original, as yet unmodified game, in the Zeus emulator. Now Zeus has a built in disassembled called Diana, but it requires some effort to set up for a game-sized project - mostly identifying the parts that are data rather than opcodes. I didn't need to disassemble the whole game, so I took a shortcut. Somebody on WoS had already said there were only a handful of IN instructions to read the keyboard. The SpecEmu emulator has a debugger that lets you break on IN and OUT, and also reads or writes to a specific addresses. So I used that to find the key handler routines: one each for move/fire, pickup/drop and pause. I copied those very short routines into Zeus by hand (in the original.asm source file), and used the ORG directive to place them at the correct addresses. Because Zeus is brill, you can put breakpoints in the asm source file routines, and step through the source code while emulating in Zeus. This works because Zeus assembles in order from the top to bottom of the first file, following all the includes as it goes. There's nothing to stop you assembling different code to the same address twice (or in this case importing a binary then overlaying code afterwards). The last byte to get planted at an address always wins.

O processo é um pouco complicado, como se pode ver, mas o resultado é brilhante. Atic Atac foi o primeiro jogo a ser pirateado e pode aqui ser obtido.

Sem comentários:

Enviar um comentário