ZaneDubya / YCPU

An imaginary 16-bit cpu, with a complete specification, emulator, assembler, and disassembler, in C#.
24 stars 3 forks source link

Need clarification on segment size bits #19

Closed ghost closed 3 years ago

ghost commented 3 years ago

According to the docs, segment bits 0x00 would translate to (0x00 << 8) + 256 = 256:

https://github.com/ZaneDubya/YCPU/blob/d0a1248076e320e18cfdcfb085d06e38f3aec4de/Documentation/ycpu.txt#L958-L959

but this part of the docs says that 0x00 translates to size 0x10000:

https://github.com/ZaneDubya/YCPU/blob/d0a1248076e320e18cfdcfb085d06e38f3aec4de/Documentation/ycpu.txt#L980

also from the code it seems like 0x00 would translate to 0x10000 if I'm not mistaken:

https://github.com/ZaneDubya/YCPU/blob/d0a1248076e320e18cfdcfb085d06e38f3aec4de/Source/Libraries/YpsilonCPU/Emulation/Processor/Segment.cs#L154-L156

So, which one is correct?

ZaneDubya commented 3 years ago

@Naryosha Good morning!

The segment size should be 256 - 2^16, where 0 = 256 and $ff = $10000.

I am happy to merge a correction if you would like to propose one. Please also correct the values in 3.f.2. if you choose to submit something.

Thank you, and take care!

ZaneDubya commented 3 years ago

@Naryosha I see your PR, thank you for that! Are you using the included emulator or building your own or mix of both? :)

ghost commented 3 years ago

I'm building my own in Godot Engine because I might make a game out of it, and add some features like random bit flipping. I'm using the included emulator mostly as a reference.

ZaneDubya commented 3 years ago

Awesome! Do keep me updated :)