RIP-Comm / clementine

Gameboy Advance emulator.
MIT License
49 stars 13 forks source link

Convert HEX values to BIN - Inconsistency in the format of numbers #35

Closed AlessandroGrassi99 closed 2 years ago

AlessandroGrassi99 commented 2 years ago

Many values are written in hexadecimal format (like 0x0B_00_00_00), and a few others in binary format (like 0b1110_1010_0000_0000_0000_0000_0111_1111). It would be useful to standardize all values in binary, for readability reasons.

However, I think it is better to close #33 first because it would allow the removal of many values.

FedericoBruzzone commented 2 years ago

I'll take this issue

FedericoBruzzone commented 2 years ago

Is it correct to also change the values of the instructions and conditions in binary? (e.g. 0x0 to 0b0000)

from alu_instruction.rs file: Immagine 2022-09-07 235402

from condition.rs file: Immagine 2022-09-08 010818

simo498 commented 2 years ago

I think in many cases hexadecimal is clearer than binary and vice versa. (ie: working with addresses in hex and working with bits/bitwise ops/masks in binary

FedericoBruzzone commented 2 years ago

I think like you.

But, to make all the code more readable, I would use hex in the parts as in these screenshots and bin in all other cases (also addresses).

Let's see what others say 👍

AlessandroGrassi99 commented 2 years ago

Is it correct to also change the values of the instructions and conditions in binary? (e.g. 0x0 to 0b0000)

from alu_instruction.rs file: Immagine 2022-09-07 235402

from condition.rs file: Immagine 2022-09-08 010818

Nope. In the case of ALU instructions are expressed in hexadecimal in the documentation.

The main work would be to translate the masks and of the (main) instructions. So mainly where bit manipulation and control is required.

FedericoBruzzone commented 2 years ago

I think this issue could be closed (with #41)