chore: version Zelda 1 port and engineering records

This commit is contained in:
Nilton Constantino
2026-11-16 15:22:13 +00:00
commit 6f2fa420c2
4282 changed files with 822198 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
**Estado atual:** teste concluído e ambos os toggles desativados a pedido do usuário.
A entrada da espada está aberta e o pacote inicial de bombas está ausente.
As capturas e a descrição abaixo documentam o teste anterior.
# Parede bombável — entrada da espada (teste temporário)
Exceção explicitamente autorizada: a abertura original da sala $77 fica coberta
por rocha até ser atingida por uma bomba. O pacote de teste à direita de Link
continua disponível uma vez por partida nova. A espada continua na mesma caverna.
Para testar: recolher o pacote, ir até a antiga entrada, encostar na parede
olhando para cima e usar D. Link alinhado em X=$40, Y=$5D coloca a bomba no ponto
($40,$4D). A entrada abre na detonação; depois é possível entrar normalmente.
Não é necessário ter espada. A explosão continua sem ferir Link.
Mecanismo permanente: `src/world/bombable_wall.pbs` usa a regra OW da ROM
UpdateRockWall/CheckTileObjWeaponCollision: somente bomba no estado $13,
midpoints +8, distância estritamente menor que $10 em ambos os eixos. Isso é
mais estreito que o limiar $18 de dano aos inimigos. A primeira bomba detonando
nos slots $10/$11 tem prioridade. O segredo usa o bit $80 do byte da sala,
independente do bit $10 de coleta da espada e dos três bits de mortes.
A descoberta permanece ao trocar de sala, voltar da caverna e usar Continue.
Partida nova limpa as flags. A camada visual, a colisão e a autorização da
entrada consultam o mesmo estado. O patch acompanha inventário e rolagem
vertical, usando os glyphs de rocha já existentes; nenhum asset/scene novo.
Remoção da montagem de teste:
- Desativar `ENABLE_BOMBABLE_SWORD_TEST` em
`src/stages/overworld_start/main.pbs` restaura a abertura normal.
- Desativar `ENABLE_TEMPORARY_BOMB` em `test_bomb.pbs` remove o pacote de teste.
- Manter o mecanismo genérico e as flags para as paredes legítimas futuras.
Validação: `validate_bomb_wall_rom.py` executa 121 casos do leaf 6502 real;
`generate_bomb_wall_fixture.py` produz testes fora de src, instalados apenas
temporariamente. A fixture verifica os casos nativos, flags independentes,
fases da bomba, prioridade de slot, fusível, entrada/caverna/espada/retorno,
Continue, partida nova, inventário e rolagens. `validate_bomb_wall_pixels.py`
compara cinco recortes 16×16 com os PNGs nativos, sem tolerância. Não há alegação
de emulação integral do jogo em lockstep. Capturas em `validation/`.
+612
View File
@@ -0,0 +1,612 @@
{
"entry_prg": 30315,
"threshold": 16,
"cases": [
[
-24,
-24,
false
],
[
-24,
-17,
false
],
[
-24,
-16,
false
],
[
-24,
-15,
false
],
[
-24,
-1,
false
],
[
-24,
0,
false
],
[
-24,
1,
false
],
[
-24,
15,
false
],
[
-24,
16,
false
],
[
-24,
17,
false
],
[
-24,
24,
false
],
[
-17,
-24,
false
],
[
-17,
-17,
false
],
[
-17,
-16,
false
],
[
-17,
-15,
false
],
[
-17,
-1,
false
],
[
-17,
0,
false
],
[
-17,
1,
false
],
[
-17,
15,
false
],
[
-17,
16,
false
],
[
-17,
17,
false
],
[
-17,
24,
false
],
[
-16,
-24,
false
],
[
-16,
-17,
false
],
[
-16,
-16,
false
],
[
-16,
-15,
false
],
[
-16,
-1,
false
],
[
-16,
0,
false
],
[
-16,
1,
false
],
[
-16,
15,
false
],
[
-16,
16,
false
],
[
-16,
17,
false
],
[
-16,
24,
false
],
[
-15,
-24,
false
],
[
-15,
-17,
false
],
[
-15,
-16,
false
],
[
-15,
-15,
true
],
[
-15,
-1,
true
],
[
-15,
0,
true
],
[
-15,
1,
true
],
[
-15,
15,
true
],
[
-15,
16,
false
],
[
-15,
17,
false
],
[
-15,
24,
false
],
[
-1,
-24,
false
],
[
-1,
-17,
false
],
[
-1,
-16,
false
],
[
-1,
-15,
true
],
[
-1,
-1,
true
],
[
-1,
0,
true
],
[
-1,
1,
true
],
[
-1,
15,
true
],
[
-1,
16,
false
],
[
-1,
17,
false
],
[
-1,
24,
false
],
[
0,
-24,
false
],
[
0,
-17,
false
],
[
0,
-16,
false
],
[
0,
-15,
true
],
[
0,
-1,
true
],
[
0,
0,
true
],
[
0,
1,
true
],
[
0,
15,
true
],
[
0,
16,
false
],
[
0,
17,
false
],
[
0,
24,
false
],
[
1,
-24,
false
],
[
1,
-17,
false
],
[
1,
-16,
false
],
[
1,
-15,
true
],
[
1,
-1,
true
],
[
1,
0,
true
],
[
1,
1,
true
],
[
1,
15,
true
],
[
1,
16,
false
],
[
1,
17,
false
],
[
1,
24,
false
],
[
15,
-24,
false
],
[
15,
-17,
false
],
[
15,
-16,
false
],
[
15,
-15,
true
],
[
15,
-1,
true
],
[
15,
0,
true
],
[
15,
1,
true
],
[
15,
15,
true
],
[
15,
16,
false
],
[
15,
17,
false
],
[
15,
24,
false
],
[
16,
-24,
false
],
[
16,
-17,
false
],
[
16,
-16,
false
],
[
16,
-15,
false
],
[
16,
-1,
false
],
[
16,
0,
false
],
[
16,
1,
false
],
[
16,
15,
false
],
[
16,
16,
false
],
[
16,
17,
false
],
[
16,
24,
false
],
[
17,
-24,
false
],
[
17,
-17,
false
],
[
17,
-16,
false
],
[
17,
-15,
false
],
[
17,
-1,
false
],
[
17,
0,
false
],
[
17,
1,
false
],
[
17,
15,
false
],
[
17,
16,
false
],
[
17,
17,
false
],
[
17,
24,
false
],
[
24,
-24,
false
],
[
24,
-17,
false
],
[
24,
-16,
false
],
[
24,
-15,
false
],
[
24,
-1,
false
],
[
24,
0,
false
],
[
24,
1,
false
],
[
24,
15,
false
],
[
24,
16,
false
],
[
24,
17,
false
],
[
24,
24,
false
]
],
"mismatches": 0
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

@@ -0,0 +1,20 @@
{
"native_collision_cases": 121,
"native_collision_mismatches": 0,
"guest_case_assertions": 242,
"guest_flags": "passed",
"guest_bomb_phases_and_slot_priority": "passed",
"guest_game_phases": 15,
"guest_game_verdict": "passed",
"pixel_patches": 5,
"pixel_differences": 0,
"diagnostics_files": 9,
"diagnostics": [],
"production_build_status": "SUCCESS",
"fixture_build": "d63a0c2b-ac87-45ba-bd5a-1194eaf7ffa2",
"fixture_removed_from_src": true,
"temporary_bomb_pickup_retained": true,
"temporary_sword_wall_enabled": true,
"starting_room_generator_idempotent": true,
"scope": "Direct GameFlow fixture and bounded native leaf execution. No full input playthrough/frame-lockstep claim."
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

+114
View File
@@ -0,0 +1,114 @@
# Stage da caverna inicial
A stage `@zelda1:stages/cave_start` usa `RoomLayoutOWCave0` da ROM local
verificada. Tem cenário e mapa de colisão próprios, conectados à abertura da
sala `$77` do overworld. HUD e viewport 256×240 continuam compartilhados em 1:1.
Para entrar, caminhe para cima na abertura da parede do primeiro mapa. Para
sair, caminhe para baixo pela abertura central do piso da caverna. Link retorna
à mesma porta. Parar nessa posição não provoca reentrada: é preciso sair da
célula e voltar, preservando a regra de `UndergroundExitType`.
## O que foi portado
- Layout e compressão das colunas da caverna, usando as tabelas do overworld.
- Paletas próprias da caverna e atributos de fundo equivalentes à sala `$44`.
- Colisão de terreno com os mesmos IDs e sondas NES do overworld.
- Gatilho alinhado da entrada em `(64,77)`; descida de 16 pixels, um pixel a
cada quatro ticks, com o corpo atrás dos pixels não transparentes do cenário.
- Posicionamento interno em `(112,221)`, olhando para cima, seguido da caminhada
forçada de 48 pixels até `(112,173)`, com a velocidade fracionária original.
- Saída inferior em `Y=221`; retorno a `(64,93)`, olhando para baixo, e subida
automática até `(64,77)` atrás do cenário, também um pixel a cada quatro ticks.
- Troca do scene bank antes da emissão de HUD e personagem, sem misturar os mapas.
A primeira espada agora é coletável e Link começa sem ela. A aquisição atualiza
`Items[0]`, apaga texto e item do piso, ergue a espada e faz o velho desaparecer.
A flag da sala impede respawn na mesma partida. Ver
[inventário e primeira aquisição](../../inventory/README.md).
O fogo permanece estático e o texto inicial aparece inteiro. Não há diálogo
progressivo ou som. As fogueiras agora causam dano; ver
[sistema de vida](../../life/README.md). Os waits de transferência PPU e cópia progressiva da
tela NES não são emulados: o cenário é trocado de uma vez.
## Organização
| Local | Responsabilidade |
| --- | --- |
| `src/stages/cave_start/` | Vínculo do scene bank 1, terreno e condição de saída |
| `src/stages/overworld_start/` | Terreno original e condição da entrada |
| `src/stage/flow.pbs` | Máquina de transição, posições forçadas e proteção contra reentrada |
| `src/stage/player_probe.pbs` | Sonda NES compartilhada, consultando a stage ativa |
| `src/scene/main.pbs` | Rebind da stage e câmera quando muda a tela |
| `src/link/` | Aplica as posições forçadas, mantém animação e desenha o corpo |
| `assets/tilesets/cave_start/` | 44 glyphs 8×8, paleta de sete cores |
| `assets/scenes/cave_start/` | Cena 32×30, fundo na camada 0 |
| `assets/characters/link_door/` | 68 poses 16×16 para prioridade atrás do cenário |
Os slots existentes foram preservados: Link 0, terreno do overworld 1 e HUD 2.
Terreno da caverna ocupa glyph slot 3; poses da porta, slot 4; aquisição, slot 5.
Scenes: overworld 0, caverna antes da coleta 1, com velho pós-coleta 2 e vazia 3. Link e espada continuam na camada 1; o HUD permanece na camada 0.
As poses da porta são derivadas dos sprites existentes: para cada posição e
fase, pixels são tornados transparentes onde o índice original de fundo NES é
diferente de zero. Isso reproduz a prioridade sprite/background nesse local,
sem confundir RGB preto com transparência. Não é uma alteração dos sprites de
caminhada usados durante o jogo normal.
## Proveniência
`room.json` registra hash da ROM, colunas, mapa de IDs antes de qualquer
composição visual, paletas NES, padrões decorativos e posições do texto.
`terrain.png` contém apenas o terreno; `room.png` acrescenta a decoração estática.
`room@3x.png` permite inspeção sem suavização. A colisão usa o primeiro mapa,
portanto os pixels do texto e das fogueiras não se tornam paredes.
`RoomLayoutOWCave0` está no offset PRG `89000`. A paleta vem de
`CaveBgPaletteRowsTransferBuf`, offset `107101`. Os atributos A/B da sala `$44`
selecionam, respectivamente, as linhas 3 e 2. O texto vem da primeira entrada
original de `PersonTextAddrs`, em `PersonText`; os controles de quebra de linha
são decodificados, sem redesenhar a fonte. O velho usa tile `$98` espelhado,
fogueiras `$5C` espelhado, espada `$20/$21`; as posições consideram o Y visível
do OAM. RGBs continuam aproximações digitais explícitas dos códigos NES.
Rotinas de referência consultadas nos fontes locais do disassembly:
[Z_05.asm](https://github.com/aldonunez/zelda1-disassembly/blob/master/src/Z_05.asm)
(`LayoutRoomOrCaveOW`, `CheckWarps`, `HandleWarpOW`, `InitMode_EnterRoom`,
`InitMode_WalkCave`, `CheckCaveEdge`),
[Z_01.asm](https://github.com/aldonunez/zelda1-disassembly/blob/master/src/Z_01.asm)
(`InitModeB_EnterCave_Bank5`, `SetUpCommonCaveObjects`, tabelas de animação e texto),
e [Z_07.asm](https://github.com/aldonunez/zelda1-disassembly/blob/master/src/Z_07.asm)
(`StepOutside`, `GetCollidingTileMoving`, `PlayerScreenEdgeBounds`).
## Regeneração e validação
```sh
python3 tools/prepare_cave.py
python3 tools/validate_cave.py
```
O gerador verifica a ROM, publica os assets preservando suas identidades e
regenera somente `src/stages/cave_start/room.generated.pbs`. As demais fontes
PBS são mantidas manualmente. Reexecutar com as mesmas entradas é idempotente;
edições manuais nos PNGs gerados são substituídas.
O validador executa a rotina 6502 de colisão com as colunas da caverna: 2.573
sondas coincidiram com o modelo do port. Depois compara 20 capturas reais do
Studio com os cenários extraídos e os sprites em posições/fases explícitas:
zero pixels diferentes. Inclui entrada, prioridade atrás do cenário, spawn,
caminhada forçada, paredes, retorno, repouso sem reentrada e segunda visita.
Resultado: `validation/results.json`.
As capturas são uma sequência contínua descrita em `CHECKPOINTS` de
`tools/validate_cave.py`, começando com uma sessão nova. O script compara os PNGs
salvos; não os recaptura. Algumas posições ficam um pixel antes/depois da grade
por carry/borrow do movimento fracionário, como `(65,133)` e `(111,173)`;
curvas usam as regras da grade, sem arredondar artificialmente essas posições.
As 20 capturas desta pasta registram a etapa anterior ao inventário, com
espada já disponível. A validação vigente da aquisição está em
`../../inventory/validation/results.json`.
Na etapa de conexão, build e pack passaram. Os 11 arquivos PBS envolvidos tiveram diagnostics
vazios. Isso não equivale a comparar a execução completa com um emulador NES.
Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

@@ -0,0 +1,42 @@
[
{
"name": "initial",
"frame": 1
},
{
"name": "menu-initial",
"frame": 2
},
{
"name": "outside-contact",
"frame": 3
},
{
"name": "collected-person",
"frame": 4
},
{
"name": "blink-hidden",
"frame": 5
},
{
"name": "blink-person",
"frame": 6
},
{
"name": "menu-collected",
"frame": 7
},
{
"name": "expired",
"frame": 8
},
{
"name": "revisit",
"frame": 9
},
{
"name": "new-game",
"frame": 10
}
]
Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

@@ -0,0 +1,55 @@
{
"pixel_checks": [
{
"name": "initial",
"different_pixels": 0
},
{
"name": "outside-contact",
"different_pixels": 0
},
{
"name": "collected-person",
"different_pixels": 0
},
{
"name": "blink-hidden",
"different_pixels": 0
},
{
"name": "blink-person",
"different_pixels": 0
},
{
"name": "expired",
"different_pixels": 0
},
{
"name": "revisit",
"different_pixels": 0
},
{
"name": "new-game",
"different_pixels": 0
},
{
"name": "menu-initial",
"different_pixels": 0
},
{
"name": "menu-collected",
"different_pixels": 0
}
],
"native_collision_probes": 2573,
"gameplay_assertions": [
"contact",
"sword ownership",
"room pickup bit",
"64-frame disappearance",
"menu pause",
"revisit",
"constant scene revision",
"constant inventory variant"
]
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

@@ -0,0 +1,18 @@
{
"production_build": "5e713d48-8d9c-480d-9d35-a9aa112751a8",
"native_pixel_checks": 10,
"native_collision_probes": 2573,
"legacy_glyphs_preserved": 44,
"scene_revision": 1,
"inventory_variant": 1,
"regeneration_unchanged_files": 1176,
"production_smoke": [
"new game",
"cave entry",
"sword pickup/lift",
"person disappears",
"inventory opens"
],
"temporary_bombs_enabled": false,
"user_memcard_written": false
}
+286
View File
@@ -0,0 +1,286 @@
{
"bank": 3,
"terrain_scene": 1,
"parts": [
{
"kind": 1,
"x": 120,
"y": 129,
"glyph": 44
},
{
"kind": 1,
"x": 128,
"y": 129,
"glyph": 45
},
{
"kind": 1,
"x": 120,
"y": 137,
"glyph": 46
},
{
"kind": 1,
"x": 128,
"y": 137,
"glyph": 47
},
{
"kind": 0,
"x": 72,
"y": 129,
"glyph": 48
},
{
"kind": 0,
"x": 80,
"y": 129,
"glyph": 49
},
{
"kind": 0,
"x": 72,
"y": 137,
"glyph": 50
},
{
"kind": 0,
"x": 80,
"y": 137,
"glyph": 51
},
{
"kind": 0,
"x": 168,
"y": 129,
"glyph": 48
},
{
"kind": 0,
"x": 176,
"y": 129,
"glyph": 49
},
{
"kind": 0,
"x": 168,
"y": 137,
"glyph": 50
},
{
"kind": 0,
"x": 176,
"y": 137,
"glyph": 51
},
{
"kind": 2,
"x": 124,
"y": 153,
"glyph": 52
},
{
"kind": 2,
"x": 124,
"y": 161,
"glyph": 53
},
{
"kind": 2,
"x": 48,
"y": 104,
"glyph": 54
},
{
"kind": 2,
"x": 56,
"y": 104,
"glyph": 55
},
{
"kind": 2,
"x": 64,
"y": 104,
"glyph": 56
},
{
"kind": 2,
"x": 72,
"y": 104,
"glyph": 57
},
{
"kind": 2,
"x": 88,
"y": 104,
"glyph": 58
},
{
"kind": 2,
"x": 96,
"y": 104,
"glyph": 59
},
{
"kind": 2,
"x": 104,
"y": 104,
"glyph": 60
},
{
"kind": 2,
"x": 112,
"y": 104,
"glyph": 61
},
{
"kind": 2,
"x": 120,
"y": 104,
"glyph": 62
},
{
"kind": 2,
"x": 128,
"y": 104,
"glyph": 63
},
{
"kind": 2,
"x": 136,
"y": 104,
"glyph": 64
},
{
"kind": 2,
"x": 144,
"y": 104,
"glyph": 65
},
{
"kind": 2,
"x": 152,
"y": 104,
"glyph": 57
},
{
"kind": 2,
"x": 168,
"y": 104,
"glyph": 55
},
{
"kind": 2,
"x": 176,
"y": 104,
"glyph": 64
},
{
"kind": 2,
"x": 192,
"y": 104,
"glyph": 61
},
{
"kind": 2,
"x": 200,
"y": 104,
"glyph": 64
},
{
"kind": 2,
"x": 64,
"y": 112,
"glyph": 59
},
{
"kind": 2,
"x": 72,
"y": 112,
"glyph": 66
},
{
"kind": 2,
"x": 80,
"y": 112,
"glyph": 64
},
{
"kind": 2,
"x": 88,
"y": 112,
"glyph": 60
},
{
"kind": 2,
"x": 96,
"y": 112,
"glyph": 62
},
{
"kind": 2,
"x": 104,
"y": 112,
"glyph": 67
},
{
"kind": 2,
"x": 120,
"y": 112,
"glyph": 55
},
{
"kind": 2,
"x": 128,
"y": 112,
"glyph": 59
},
{
"kind": 2,
"x": 136,
"y": 112,
"glyph": 68
},
{
"kind": 2,
"x": 144,
"y": 112,
"glyph": 62
},
{
"kind": 2,
"x": 160,
"y": 112,
"glyph": 55
},
{
"kind": 2,
"x": 168,
"y": 112,
"glyph": 69
},
{
"kind": 2,
"x": 176,
"y": 112,
"glyph": 54
},
{
"kind": 2,
"x": 184,
"y": 112,
"glyph": 57
},
{
"kind": 2,
"x": 192,
"y": 112,
"glyph": 70
}
],
"legacy_scenes_reserved": [
2,
3
]
}
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

@@ -0,0 +1,267 @@
{
"rom_sha256": "89232edf4f9b52e3cb872094bc78973de080befca2ddea893b6e936066514d4e",
"cave_probes_compared": 2573,
"probe_mismatches": 0,
"runtime_frames_compared": 20,
"checkpoints": [
{
"checkpoint": "initial",
"frames": 1,
"input": {},
"stage": 0,
"x": 120,
"y": 133,
"direction": "down",
"animation_phase": 0,
"door_step": -1,
"different_pixels": 0
},
{
"checkpoint": "approach_left",
"frames": 40,
"input": {
"left": true
},
"stage": 0,
"x": 65,
"y": 133,
"direction": "left",
"animation_phase": 1,
"door_step": -1,
"different_pixels": 0
},
{
"checkpoint": "door_ready",
"frames": 43,
"input": {
"up": true
},
"stage": 0,
"x": 64,
"y": 77,
"direction": "up",
"animation_phase": 0,
"door_step": -1,
"different_pixels": 0
},
{
"checkpoint": "door_start",
"frames": 1,
"input": {},
"stage": 0,
"x": 64,
"y": 77,
"direction": "up",
"animation_phase": 0,
"door_step": 0,
"different_pixels": 0
},
{
"checkpoint": "door_middle",
"frames": 32,
"input": {},
"stage": 0,
"x": 64,
"y": 85,
"direction": "up",
"animation_phase": 1,
"door_step": 8,
"different_pixels": 0
},
{
"checkpoint": "cave_spawn",
"frames": 31,
"input": {},
"stage": 1,
"x": 112,
"y": 221,
"direction": "up",
"animation_phase": 0,
"door_step": -1,
"different_pixels": 0
},
{
"checkpoint": "cave_walk_done",
"frames": 32,
"input": {},
"stage": 1,
"x": 112,
"y": 173,
"direction": "up",
"animation_phase": 1,
"door_step": -1,
"different_pixels": 0
},
{
"checkpoint": "cave_idle",
"frames": 12,
"input": {},
"stage": 1,
"x": 112,
"y": 173,
"direction": "up",
"animation_phase": 1,
"door_step": -1,
"different_pixels": 0
},
{
"checkpoint": "cave_left_wall",
"frames": 200,
"input": {
"left": true
},
"stage": 1,
"x": 32,
"y": 173,
"direction": "left",
"animation_phase": 1,
"door_step": -1,
"different_pixels": 0
},
{
"checkpoint": "cave_right_wall",
"frames": 200,
"input": {
"right": true
},
"stage": 1,
"x": 208,
"y": 173,
"direction": "right",
"animation_phase": 0,
"door_step": -1,
"different_pixels": 0
},
{
"checkpoint": "cave_center",
"frames": 72,
"input": {
"left": true
},
"stage": 1,
"x": 111,
"y": 173,
"direction": "left",
"animation_phase": 0,
"door_step": -1,
"different_pixels": 0
},
{
"checkpoint": "cave_exit_ready",
"frames": 36,
"input": {
"down": true
},
"stage": 1,
"x": 112,
"y": 221,
"direction": "down",
"animation_phase": 0,
"door_step": -1,
"different_pixels": 0
},
{
"checkpoint": "exit_start",
"frames": 1,
"input": {
"down": true
},
"stage": 0,
"x": 64,
"y": 93,
"direction": "down",
"animation_phase": 0,
"door_step": 16,
"different_pixels": 0
},
{
"checkpoint": "exit_middle",
"frames": 32,
"input": {},
"stage": 0,
"x": 64,
"y": 85,
"direction": "down",
"animation_phase": 1,
"door_step": 8,
"different_pixels": 0
},
{
"checkpoint": "exit_done",
"frames": 32,
"input": {},
"stage": 0,
"x": 64,
"y": 77,
"direction": "down",
"animation_phase": 1,
"door_step": -1,
"different_pixels": 0
},
{
"checkpoint": "exit_idle",
"frames": 24,
"input": {},
"stage": 0,
"x": 64,
"y": 77,
"direction": "down",
"animation_phase": 1,
"door_step": -1,
"different_pixels": 0
},
{
"checkpoint": "walk_away",
"frames": 6,
"input": {
"down": true
},
"stage": 0,
"x": 64,
"y": 85,
"direction": "down",
"animation_phase": 0,
"door_step": -1,
"different_pixels": 0
},
{
"checkpoint": "return_to_door",
"frames": 6,
"input": {
"up": true
},
"stage": 0,
"x": 64,
"y": 77,
"direction": "up",
"animation_phase": 0,
"door_step": 0,
"different_pixels": 0
},
{
"checkpoint": "reenter_start",
"frames": 1,
"input": {},
"stage": 0,
"x": 64,
"y": 77,
"direction": "up",
"animation_phase": 0,
"door_step": 0,
"different_pixels": 0
},
{
"checkpoint": "cave_again",
"frames": 96,
"input": {},
"stage": 1,
"x": 112,
"y": 173,
"direction": "up",
"animation_phase": 1,
"door_step": -1,
"different_pixels": 0
}
],
"scope": "Original collision leaf routine with cave column RAM; full-frame checkpoints of entry, cave walls, exit, idle without reentry and a second visit. Excludes full-game NES execution, video-copy waits and cave object interactions."
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

+128
View File
@@ -0,0 +1,128 @@
# Ciclo de combate da sala norte
Implementação sem som, mantendo os dados e regras da ROM fornecida.
- `src/world`: bytes de flags OW e histórico circular de seis salas.
- `src/enemies/octorok`: encontro, ciclo de spawn, mortos e pedras.
- `src/loot`: decisão de drops, duração, coleta e voo da fada.
- `src/link/beam.pbs`: único projétil da espada e dispersão.
- `src/combat_graphics`: composição nativa de itens, efeitos e contadores.
- `src/inventory`: quantidades, fila de rupias e vida; `src/hud` apresenta valores.
## Histórico e repopulação
Os três bits baixos do byte da sala guardam a contagem de mortos; `$07` significa
que todos foram derrotados. O bit `$10` de item coletado é preservado. O histórico
é um anel de seis inserções únicas: revisitar uma sala não a move para o fim.
Na entrada, a contagem é subtraída da população original. Uma sala com contagem
`$07` continua vazia enquanto estiver no histórico; depois de ser expulsa dele,
a contagem é limpa e a população volta. Mortes parciais continuam sendo subtraídas
mesmo quando a sala sai do histórico.
As mortes entram na contagem da visita ao terminar o efeito de morte. As flags
são gravadas na saída da sala. A morte de Link abandona as mortes ainda não
salvas dessa visita; o menu pós-morte limpa o histórico recente. Continue mantém
as flags já gravadas e o inventário. Uma nova partida limpa ambos.
A escolha de posições usa as quatro listas originais de nove células, conforme
a direção de entrada, rejeita terreno inválido e distância menor que `$22` em
ambos os eixos, e mantém SpawnCycle. A ROM calcula posições para nove slots mesmo
quando a população é menor; o coordenador faz o mesmo. As outras salas ainda
não implementadas não foram adicionadas apenas para acionar a repopulação.
## Drops e coleta
Os dados vêm de NoDropMonsterTypes, grupos, taxas e DropItemTable. O Octorok
vermelho usa o grupo 0: probabilidade `Random < $50` e ciclo de dez mortes que
seleciona coração, rupia ou fada. O contador global de mortes avança no golpe
fatal; o ciclo de drops avança depois do efeito de morte. Dez mortes sem dano
ativam o auxílio de cinco rupias, ou bombas quando a décima morte foi por bomba;
a morte número dezesseis sem dano força fada. Dano aceito em Link zera esses
contadores de ajuda, preservando o ciclo de dez. O jogo atual não oferece uso
de bombas; a regra de seleção e a quantidade coletável já estão previstas.
O objeto dura `$FF` decrementos, em frames alternados. Até o contador ficar
abaixo de `$F0`, ele pisca e não pode ser coletado. A colisão usa X de Link e
Y+3 com distância estritamente menor que 9. A espada ativa também pode coletar.
O item some ao sair da sala. Fadas voam sem colisão com terreno, com estados,
velocidade quantizada, mudanças de direção e limites do flyer da ROM.
Rupias usam Items[$26] como fila: uma é transferida para Items[$16] a cada dois
frames de atualização, com limite 255. Cinco rupias incrementam essa fila cinco
vezes, preservando o byte original. Bombas adicionam quatro até MaxBombs.
Coração e fada usam a aritmética de vida existente; fada cura três corações.
Rupias, chaves e bombas do HUD agora leem os slots reais. A formatação nativa
mantém `X0 `, `X23` ou `123`, sem alterar o HUD inicial.
## Pedra e projétil da espada
Uma pedra frontal contra o escudo de Link livre entra em ricochete. As quatro
direções leem os deslocamentos originais de ShotBounceWidths/Heights (incluindo
a sobreposição das tabelas) e terminam após distância `$20`, em 16 atualizações.
Dano traseiro continua passando por vida, recuo e imunidade. Uma pedra não
causa novo dano durante imunidade nem desaparece por esse contato ignorado.
A espada tenta criar o projétil ao passar do estado 2 para 3. Só existe um
projétil ativo, incluindo sua dispersão. O teste de vida da ROM é preservado:
nibbles de vida e capacidade iguais e fração >= `$80`, correspondente ao HUD
cheio. O disparo nasce 16px à frente, anda 3px por atualização e se dispersa
quando acerta inimigo ou chega ao limite. MoveShot não testa terreno para esse
projétil. A colisão esbelta conserva os offsets da rotina original, inclusive
a consulta à direção atual de Link. Os quatro cantos e a alternância de paletas
usam os patterns e atributos nativos. Sem vida cheia, o ataque normal continua.
## Extração e limites desta etapa
`python3 tools/prepare_combat.py` publica 30 patterns 8×8 no banco glyph 12,
extrai tabelas de drops e posições e gera as APIs de mapeamento. Odd sprite IDs
8×16 selecionam a tabela de background: o coração `$F3` usa patterns $1F20/$1F30.
O caminho de descritores de itens é executado por `nes_object_graphics.py`;
não se presume que o tile ou a paleta possam ser obtidos diretamente do ID.
A geração é idempotente. Há 13 bancos de glyph e 15 cenas, dentro dos slots atuais.
O encontro continua sendo dos Octoroks vermelhos da sala $67. Ainda não há outros
mapas, seletor de inventário, uso dos demais equipamentos, som ou save. Os slots
de objetos continuam adaptados ao encontro atual; não é uma emulação completa
do agendador NES nem uma afirmação de equivalência de todos os frames do jogo.
## Validação reproduzível
- `python3 tools/validate_combat_rom.py`: executa as rotinas 6502 originais com
um buffer de flags de teste: 240 entradas, 720 gravações e 12.800 seleções de
drops. GetRoomFlags fornece o buffer; criação de fada/destruição são fronteiras
de saída. `rom-validation.json` documenta o recorte e os endereços reais.
- `python3 tools/generate_combat_fixture.py`: produz a fixture isolada e seus
três módulos em `.tmp/combat-fixture`, sem instalá-la. Os casos vêm do oráculo
nativo. São 2.214 verificações de topo no guest, com verificações internas
adicionais de projétil, ricochete e integração das mortes. Todos passaram.
- Os casos são distribuídos em 93 frames: executá-los todos no Init excedia o
watchdog headless. Isso é propriedade do teste, não mudança no orçamento do
runtime. O frame de resultado codifica a contagem e exibe cada verificação.
- `python3 tools/validate_combat_captures.py`: quatro comparações pixel a pixel
sem diferença: HUD inicial, drops/contadores, quatro disparos/dispersões e
ricochetes em duas fases. Itens e efeitos são compostos com a CHR, paletas e
saída do código 6502. Também verifica evidências da sessão jogável.
Para repetir a fixture no Studio, adquirir o controle e fazer backup do main,
barrels e mains de Link/Octorok atuais. Instalar o main gerado; colocar o arquivo
loot-fixture no módulo loot e expor CombatFixture. Os templates de Link/Octorok
acessam estado privado: anexar seus corpos aos respectivos mains, com imports
necessários e LinkCombatChecks/EnemyCombatChecks temporariamente nos barrels.
Não deixar arquivos duplicados com as mesmas declarações. Após 93 frames, Select
alterna as duas folhas visuais. Restaurar todos os backups antes do build normal.
Os templates versionáveis ficam em `tools/fixtures/combat`.
A fixture foi removida e os mains/barrels restaurados. O build final e as
sequências exatas estão em `validation/runs.json`. Dezenove arquivos alterados
tiveram diagnostics vazios. Na sessão final, somente com controles normais:
obtenção da espada na caverna, ida ao norte, primeira morte pelo disparo, saída e
retorno para encontrar três inimigos, derrota dos restantes, coleta de coração,
aparecimento de fada e retorno à sala vazia, que continuou vazia após espera.
`validation/results.json` registra contagens reconhecidas nos sprites nativos.
Capturas anteriores da sala norte permanecem como histórico de etapas passadas.
Referências de interpretação: [histórico e gravação](https://github.com/aldonunez/zelda1-disassembly/blob/master/src/Z_05.asm),
[drops e ricochete](https://github.com/aldonunez/zelda1-disassembly/blob/master/src/Z_04.asm),
[projétil e sprites](https://github.com/aldonunez/zelda1-disassembly/blob/master/src/Z_07.asm),
[coleta, dano e rupias](https://github.com/aldonunez/zelda1-disassembly/blob/master/src/Z_01.asm).
Bytes, offsets e resultados são conferidos na ROM local; não houve consulta Java.
File diff suppressed because it is too large Load Diff
+287
View File
@@ -0,0 +1,287 @@
{
"rom_sha256": "89232edf4f9b52e3cb872094bc78973de080befca2ddea893b6e936066514d4e",
"drop_tables_prg": 77851,
"rates": [
80,
152,
104,
104
],
"groups": [
[
7,
8,
14,
4,
15,
35
],
[
33,
34,
13,
16,
19,
40,
42,
39,
22
],
[
9,
10,
3,
1,
18,
6,
11,
36,
48
]
],
"no_drop": [
93,
20,
21,
27,
28,
29,
23
],
"items": [
34,
24,
34,
24,
35,
24,
34,
34,
24,
24,
15,
24,
34,
24,
15,
34,
33,
24,
24,
24,
34,
0,
24,
33,
24,
34,
0,
24,
0,
34,
34,
34,
35,
24,
34,
35,
34,
34,
34,
24
],
"item_descriptors": {
"0": {
"tiles": [
52,
54
],
"attributes": [
0,
0
],
"sides": 1,
"x_separation": 8,
"animation_index": 0,
"frame": 0
},
"15": {
"tiles": [
50,
52
],
"attributes": [
0,
0
],
"sides": 1,
"x_separation": 8,
"animation_index": 0,
"frame": 0
},
"24": {
"tiles": [
50,
52
],
"attributes": [
0,
0
],
"sides": 1,
"x_separation": 8,
"animation_index": 0,
"frame": 0
},
"34": {
"tiles": [
243,
245
],
"attributes": [
0,
0
],
"sides": 1,
"x_separation": 8,
"animation_index": 0,
"frame": 0
},
"35": {
"tiles": [
80,
82
],
"attributes": [
0,
0
],
"sides": 1,
"x_separation": 8,
"animation_index": 0,
"frame": 0
},
"135": {
"tiles": [
82,
84
],
"attributes": [
0,
0
],
"sides": 1,
"x_separation": 8,
"animation_index": 0,
"frame": 0
},
"200": {
"tiles": [
32,
34
],
"attributes": [
0,
0
],
"sides": 1,
"x_separation": 8,
"animation_index": 0,
"frame": 0
},
"201": {
"tiles": [
130,
132
],
"attributes": [
0,
0
],
"sides": 2,
"x_separation": 8,
"animation_index": 0,
"frame": 0
},
"202": {
"tiles": [
48,
50
],
"attributes": [
0,
0
],
"sides": 1,
"x_separation": 8,
"animation_index": 0,
"frame": 0
}
},
"glyph_keys": {
"32": 0,
"33": 1,
"48": 2,
"49": 3,
"50": 4,
"51": 5,
"52": 6,
"53": 7,
"80": 8,
"81": 9,
"82": 10,
"83": 11,
"130": 12,
"131": 13,
"132": 14,
"133": 15,
"256": 16,
"257": 17,
"258": 18,
"259": 19,
"260": 20,
"261": 21,
"262": 22,
"263": 23,
"264": 24,
"265": 25,
"289": 26,
"292": 27,
"498": 28,
"499": 29
},
"native_palettes": [
[
15,
41,
39,
23
],
[
15,
2,
34,
48
],
[
15,
22,
39,
48
],
[
15,
12,
28,
44
],
[
15,
48,
0,
18
]
],
"bounce_table_prg": 66257,
"scope": "Native red Octorok combat, consumable drops, sword beam and HUD counters; no audio."
}
+12
View File
@@ -0,0 +1,12 @@
{
"history_cases": 240,
"save_cases": 720,
"drop_cases": 12800,
"mismatches": 0,
"entrypoints": {
"modify": "0x90b8",
"save": "0x90ef",
"drop": "0xb06a"
},
"scope": "Bounded original 6502 routines. GetRoomFlags supplies a test world-flags buffer; fairy setup and object destruction are exit boundaries. No full-game lockstep claim."
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

@@ -0,0 +1,268 @@
[
{
"status": "fulfilled",
"value": {
"file": "src/world/main.pbs",
"result": {
"status": "ok",
"value": {
"operation": "diagnostics",
"result": [],
"limitations": []
}
}
}
},
{
"status": "fulfilled",
"value": {
"file": "src/world/history.pbs",
"result": {
"status": "ok",
"value": {
"operation": "diagnostics",
"result": [],
"limitations": []
}
}
}
},
{
"status": "fulfilled",
"value": {
"file": "src/inventory/main.pbs",
"result": {
"status": "ok",
"value": {
"operation": "diagnostics",
"result": [],
"limitations": []
}
}
}
},
{
"status": "fulfilled",
"value": {
"file": "src/inventory/state.pbs",
"result": {
"status": "ok",
"value": {
"operation": "diagnostics",
"result": [],
"limitations": []
}
}
}
},
{
"status": "fulfilled",
"value": {
"file": "src/loot/main.pbs",
"result": {
"status": "ok",
"value": {
"operation": "diagnostics",
"result": [],
"limitations": []
}
}
}
},
{
"status": "fulfilled",
"value": {
"file": "src/loot/rules.pbs",
"result": {
"status": "ok",
"value": {
"operation": "diagnostics",
"result": [],
"limitations": []
}
}
}
},
{
"status": "fulfilled",
"value": {
"file": "src/loot/item.pbs",
"result": {
"status": "ok",
"value": {
"operation": "diagnostics",
"result": [],
"limitations": []
}
}
}
},
{
"status": "fulfilled",
"value": {
"file": "src/loot/fairy.pbs",
"result": {
"status": "ok",
"value": {
"operation": "diagnostics",
"result": [],
"limitations": []
}
}
}
},
{
"status": "fulfilled",
"value": {
"file": "src/combat_graphics/main.pbs",
"result": {
"status": "ok",
"value": {
"operation": "diagnostics",
"result": [],
"limitations": []
}
}
}
},
{
"status": "fulfilled",
"value": {
"file": "src/link/main.pbs",
"result": {
"status": "ok",
"value": {
"operation": "diagnostics",
"result": [],
"limitations": []
}
}
}
},
{
"status": "fulfilled",
"value": {
"file": "src/link/beam.pbs",
"result": {
"status": "ok",
"value": {
"operation": "diagnostics",
"result": [],
"limitations": []
}
}
}
},
{
"status": "fulfilled",
"value": {
"file": "src/link/sword.pbs",
"result": {
"status": "ok",
"value": {
"operation": "diagnostics",
"result": [],
"limitations": []
}
}
}
},
{
"status": "fulfilled",
"value": {
"file": "src/link/vitals.pbs",
"result": {
"status": "ok",
"value": {
"operation": "diagnostics",
"result": [],
"limitations": []
}
}
}
},
{
"status": "fulfilled",
"value": {
"file": "src/enemies/octorok/main.pbs",
"result": {
"status": "ok",
"value": {
"operation": "diagnostics",
"result": [],
"limitations": []
}
}
}
},
{
"status": "fulfilled",
"value": {
"file": "src/enemies/octorok/actor.pbs",
"result": {
"status": "ok",
"value": {
"operation": "diagnostics",
"result": [],
"limitations": []
}
}
}
},
{
"status": "fulfilled",
"value": {
"file": "src/enemies/octorok/rock.pbs",
"result": {
"status": "ok",
"value": {
"operation": "diagnostics",
"result": [],
"limitations": []
}
}
}
},
{
"status": "fulfilled",
"value": {
"file": "src/game/flow.pbs",
"result": {
"status": "ok",
"value": {
"operation": "diagnostics",
"result": [],
"limitations": []
}
}
}
},
{
"status": "fulfilled",
"value": {
"file": "src/scene/main.pbs",
"result": {
"status": "ok",
"value": {
"operation": "diagnostics",
"result": [],
"limitations": []
}
}
}
},
{
"status": "fulfilled",
"value": {
"file": "src/hud/main.pbs",
"result": {
"status": "ok",
"value": {
"operation": "diagnostics",
"result": [],
"limitations": []
}
}
}
}
]
Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

@@ -0,0 +1,5 @@
{
"oracle_assertions": 2190,
"top_level_assertions": 2214,
"batches": 93
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Some files were not shown because too many files have changed in this diff Show More