mohanson / gameboy

Full featured Cross-platform GameBoy emulator by Rust. Forever boys!.
MIT License
1.36k stars 79 forks source link

Ambiguous function names in src/memory.rs #5

Closed DarkKowalski closed 5 years ago

DarkKowalski commented 5 years ago

While I review your code in src/memory.rs, one thing makes me confused. There are two functions named as get_halfword and set_halfword. Literally, they are used to get half of a WORD length data from a specific memory address, or setting half of a WORD length data. In fact, they are designed as 16-bit version getter and setter for memory.

ARM64 and x86 family of CPU defined a WORD as 16 bits(2 bytes). Back to time of Intel 8080 and Zilog 80, a WORD stands for 8 bits. I have not found any LR35902 specifications, indicating that a WORD is 32 bits.

So I wonder if a correctly expressed version of those function names should be get_word(for widely used x86 and ARM standard) or get_dword(for 8080 and Z80 standard), the same for setter.

Thanks for your hard work.

mohanson commented 5 years ago

Thanks for you advices, I will change it in the next update