What big-endian meansQué significa big-endian
The 68000 stores the most significant byte of a multibyte value at the lowest address. A word contains two bytes and a longword contains four. Endianness describes their order in memory; it does not reverse the bits inside a byte or change the mathematical value.El 68000 almacena el byte más significativo de un valor multibyte en la dirección más baja. Una word contiene dos bytes y una longword contiene cuatro. El orden de bytes describe su posición en memoria; no invierte los bits dentro de un byte ni cambia el valor matemático.
The synthetic example below stores 0x12345678 at address 0x1000. Reading a byte, a word or a longword at that address produces different results because the read width changes. Establish the field's width before deciding whether its value looks plausible.El ejemplo didáctico siguiente almacena 0x12345678 en la dirección 0x1000. Leer un byte, una word o una longword en esa dirección produce resultados distintos porque cambia el tamaño de lectura. Determina el tamaño del campo antes de decidir si su valor parece plausible.
Address: 0x1000 0x1001 0x1002 0x1003
Byte: 12 34 56 78
byte @ 0x1000 = 0x12
word @ 0x1000 = 0x1234
longword @ 0x1000 = 0x12345678Decode bytes explicitlyDecodifica los bytes explícitamente
For two bytes, multiply the first by 256 and add the second. The bytes 01 F4 therefore represent 500 as an unsigned big-endian word. Interpreting them as little-endian gives 0xF401, or 62465. Neither the hex editor nor the file extension can tell you which interpretation the game intends; follow the code that reads the field.Para dos bytes, multiplica el primero por 256 y suma el segundo. Los bytes 01 F4 representan así 500 como word big-endian sin signo. Interpretarlos como little-endian da 0xF401, o 62465. Ni el editor hexadecimal ni la extensión del archivo indican qué interpretación utiliza el juego; sigue el código que lee el campo.
In JavaScript, DataView can make the byte order explicit. The false argument below means big-endian. Check that the requested bytes exist before reading an arbitrary resource. This example operates on a small synthetic buffer, not on a complete ROM parser.En JavaScript, DataView permite indicar explícitamente el orden. El argumento false significa big-endian. Comprueba que existen los bytes solicitados antes de leer un recurso arbitrario. Este ejemplo utiliza un búfer didáctico pequeño, no implementa un analizador completo de ROM.
const bytes = new Uint8Array([0x01, 0xf4]);
const view = new DataView(bytes.buffer);
const value = view.getUint16(0, false); // 500Signedness is a separate decisionEl signo es una decisión independiente
FF FE is 65534 as an unsigned 16-bit value and -2 as a signed two's-complement value. Both interpretations use the same big-endian ordering. Decide signedness from the consuming instructions and format, not from the presence of FF bytes alone.FF FE es 65534 como valor de 16 bits sin signo y -2 como valor con signo en complemento a dos. Ambas interpretaciones usan el mismo orden big-endian. Determina el signo a partir de las instrucciones que consumen el dato y del formato, no solo por la presencia de bytes FF.
MOVE.W into a data register changes its low 16 bits while leaving the upper 16 unchanged. MOVEA.W sign-extends into an address register. These instruction semantics can explain an unexpected register value even when you decoded the bytes correctly. Consult the instruction reference when following a pointer or arithmetic result.MOVE.W hacia un registro de datos cambia sus 16 bits inferiores y conserva los 16 superiores. MOVEA.W extiende el signo en un registro de dirección. Estas reglas pueden explicar un valor inesperado aunque hayas decodificado correctamente los bytes. Consulta la referencia de instrucciones al seguir un puntero o un resultado aritmético.
Pointers, alignment and file offsetsPunteros, alineación y offsets
A conventional absolute pointer encoded as 00 12 34 56 represents address 0x00123456. But a table might instead contain relative words, indices or banked addresses. Confirm the entry size, base address and any arithmetic before navigating to a destination.Un puntero absoluto convencional codificado como 00 12 34 56 representa la dirección 0x00123456. Pero una tabla puede contener palabras relativas, índices o direcciones bancadas. Confirma tamaño de entrada, dirección base y aritmética antes de ir al destino.
The original 68000 requires word and longword memory accesses at even addresses; a longword need not be aligned to a multiple of four. An odd word access causes an address error. A file can still contain unaligned multibyte data that software reads byte by byte. File layout and CPU access rules are related, but not identical.El 68000 original requiere direcciones pares para acceder a words y longwords en memoria; una longword no necesita alinearse a un múltiplo de cuatro. Un acceso a word en dirección impar causa un error de dirección. Un archivo puede contener datos multibyte desalineados que el programa lea byte a byte. La disposición del archivo y las reglas de acceso de CPU están relacionadas, pero no son idénticas.
Do not swap the whole ROMNo intercambies toda la ROM
Text strings and individual pixel bytes are not multibyte integers to reverse. Compressed streams and Z80 data can follow their own format. A Mega Drive ROM being used by a big-endian CPU does not make every embedded field a big-endian number.Las cadenas de texto y bytes individuales de píxeles no son enteros multibyte que debas invertir. Los flujos comprimidos y datos Z80 pueden seguir su propio formato. Que una ROM sea utilizada por una CPU big-endian no convierte cada campo interno en un número big-endian.
Before editing, identify the dump format and the exact field. Record its offset, width, signedness and interpretation, then overwrite only the intended bytes. Compare the result and test the affected behaviour. If the whole file seems swapped or interleaved, normalize a copy with a tool that understands that dump format instead of applying a blind byte reversal.Antes de editar, identifica el formato del volcado y el campo exacto. Registra offset, tamaño, signo e interpretación y sobrescribe solo los bytes previstos. Compara el resultado y prueba el comportamiento afectado. Si todo el archivo parece intercambiado o entrelazado, normaliza una copia con una herramienta que conozca ese formato en lugar de invertir bytes a ciegas.