Page 1 of 1

z80 BankSwitch reset/initialize

Posted: Thu Apr 27, 2017 6:03 pm
by Jpg3D
Hi spritesmind users.

i have searched for some documentation about z80 bank register. Because i'm implementing my own z80 sound driver.

After reading this helpfull document https://emu-docs.org/Genesis/gen-hw.txt i found that i only have to write one by one the 9 high bits of my window direction to the register's bit 0 and Boom! the bank switch should be done. My doubt is about the use of this register. As i have not found how to reset this register, i dont know if the index of the bits that i 'm going to write will be in the right offset. Starting at bit 15

Is there a way to "reset" or "initialize" this register so i'll be sure that my first write will be interpreted as the 15th bit?
Does resetting the z80 resets this register?

I dont know if i explained myself.
I hope you can help me with this little trouble because i want to show you some of my work when it's sufficiently developed.
Thank you.

Re: z80 BankSwitch reset

Posted: Thu Apr 27, 2017 6:12 pm
by Mask of Destiny
The bank register is a simple serial shift register. Each time you write to it a bit is shifted in as the new most significant bit, with the existing bits shifted to the right by one, with the old least significant bit getting shifted out entirely. Effectively, each time you write it's always the new bit 23. If you write 9 values in sequence, the first one will always end up being bit 15.

Re: z80 BankSwitch reset/initialize

Posted: Thu Apr 27, 2017 6:28 pm
by Jpg3D
Really thank you for your fast and clear answer. Now i fully understand how to use that register.