Replies: 7 comments 10 replies
-
Thanks for the great description of the ports! And for those notes :) Yes, I'm beginning to suspect that the Sequencer is right-top, since that's where the `Wakeup' signal comes in. I need to untangle more wires, which is what I'm doing now. :D |
Beta Was this translation helpful? Give feedback.
-
The labels used in my CPU port list come from Furrtek's schematic. I haven't updated them yet on that page, but we (Régis and I) have used more descriptive labels on the CPU symbol on page 3 in our schematics here (or I should say Régis' schematics, he did all of the work; I just reviewed it): For the clock inputs we are not sure yet, if those names make sense. The others you could update in your netlist picture. They make more sense than "FROM_CPU5". |
Beta Was this translation helpful? Give feedback.
-
Hey @ogamespec ,
There is a manual from Sharp: Another thing: I thought this could be helpful for understanding the ALU, if it is actually similar to the Z80's, which I don't know for sure: I'm trying to recreate the layout for all the cells: |
Beta Was this translation helpful? Give feedback.
-
Hello again 😃
Great, I'll add those findings to the Readme :)
According to the description the original Z80 uses a 4-bit ALU. What I see in the SM83 doesn't really look like a 4-bit "calculator" because its input and output are 8-bit values. I have a little bit left to put it in the simulation.
I'll see what's left of the chip :) If possible, it would be good to mark on the "locator" the places where you are interested in seeing the poly. I don't know if I have the patience to take pictures of the whole chip (about 800 shots), but I can do some small places :) |
Beta Was this translation helpful? Give feedback.
-
I noticed, the description about STOP mode, that you have copied from the 1996 Sharp Databook into sm83.md is not true for Game Boy. STOP mode on Game Boy disables the external crystal and the device is fully un-clocked. (The only exception can be the serial port, if it was put into slave mode. Then it can get a clock from the master device on the SCK pin.) Disabling of the external crystal oscillator is done by CPU pin T14. It is connected directly to the CK1 and CK2 pins. Therefore STOP mode can't be exited by timer interrupts. It can also not be exited by serial port, even though it can be externally clocked in slave mode. It can only be exited by joypad interrupt, when someone presses a button. I also did quite some testing on that. So it is not just theory. The crystal really is dead during STOP mode. About the IF register: Have you found any remnants of that? If not, then I would say, it was never there in the first place. I think Sharp has drawn it into the overview diagram of the CPU just for simplicity. In the Game Boy, this register is external to the CPU. You can find it on page 10 of our schematic, mapped onto address FF0F. In the top left corner of page 7 you can see the CPU_WAKEUP signal, which wakes the CPU from STOP mode. It is basically just OR'ing the four button pins P10-P13 together. The latch (AWOB) is always enabled (in transparent/bypass mode), when clocks are disabled. So BOGA_1MHz must be high in STOP mode; you can verify that at the top of page 6, by following BOGA_1MHz back to OSC_ENA. If OSC_ENA (CPU T14) is low, then BOGA is always high. There is nothing else that goes into CPU_WAKEUP, which could possibly wake the system up. |
Beta Was this translation helpful? Give feedback.
-
I will add here all the finds on the bottom I wrote about in Discord on the gbdev server.
|
Beta Was this translation helpful? Give feedback.
-
I was checking out your descriptions of the two unbonded pins in your HDL and I remembered that the Game Boy Color also had a NMI. So I was wondering if the LoadIR is also there. It turned out, directly next to the NMI pin is a pin called M1, which could stand for memory cycle 1, which would be somehow equivalent to LoadIR. Maybe it is exactly this pin. I know, you don't like to change signal names all the time. ;) I just wanted to let you know, in case you haven't seen this yet. |
Beta Was this translation helpful? Give feedback.
-
Hey, I noticed you tried to identify the CPU parts. Just wanted to give you my thoughts on that. Of course I could be wrong, but I strongly believe that the part in the upper left, that you suspect to be the sequencer, is actually the 4-bit ALU. It looks like it is made out of four similar vertical slices, one for each bit. The slices can't be perfectly identical because of the 0x66 and 0x99 comparators that may be in there for the DAA instruction. It also looks similar like the ALU in the Z80, but since it misses some functionality, like parity flag and stuff, it just looks similar, not identical. I suspect that they route simple register-to-memory LD instructions through the ALU as well, because the result at the top of the ALU is very close to the external data bus tri-state buffers. This would mean that the internal data bus(es) are organized a bit different compared to the Z80.
The sequencer logic could be in the top right, that you labeled "WTF?".
The bottom part are the register banks and most likely also a 16-bit incrementer/decrementer for PC and SP addresses, which can output it's result to the address lines to the right of the register bank. Contrary to some believe out there in the internet, I don't think that they have a 16-bit adder that can add anything else than +1 and -1 to an address. The required clock cycles needed by 16-bit ADD instructions are long enough so that those additions can be serialized through the regular 4-bit ALU. I've already implemented the CPU in that way and it works out well.
I'm very excited about your project and that we might finally have some schematics for the CPU soon. And I'd like to figure out if my assumptions described above are correct. I dreamed of this for soooo long. :)
Beta Was this translation helpful? Give feedback.
All reactions