| Electronics > Projects, Designs, and Technical Stuff |
| AY-3-8910 - can't write odd values to its registers? |
| << < (7/7) |
| nick_d:
The IN/OUT (C),reg instruction has always treated the port address as 16 bit, it's really kind of a misnomer since it acts as (BC),reg. Based on the mnemonic which only refers to C, it could have been an unintentional feature but I believe it is a reliable one which works on all Z80. I would have to check whether 8080/8085 have this instruction and if so what they do with A8-A15. It's the IN/OUT (immed),reg which is the funky one as discussed. The behaviour of putting A on the bus seems to be an accident even though many rely on the behaviour as mentioned in the thread. That's why the Z180, which uses a quarter of the 00-FF space for the internal peripherals, uses the (C),reg form unchanged but adds the IN0/OUT0 (immed),reg instructions to do the right thing in 16 bit IO spaces without breaking Z80 compatibility. I never use the original funky versions on the Z180! cheers, Nick |
| radiolistener:
--- Quote from: nick_d on February 28, 2019, 09:50:39 pm ---The behaviour of putting A on the bus seems to be an accident --- End quote --- no, this behavior is well known and works on all Z80 clones. --- Quote from: nick_d on February 28, 2019, 09:50:39 pm ---That's why the Z180, which uses a quarter of the 00-FF space for the internal peripherals, uses the (C),reg form unchanged but adds the IN0/OUT0 (immed),reg instructions to do the right thing in 16 bit IO spaces without breaking Z80 compatibility. I never use the original funky versions on the Z180! --- End quote --- hm, I also never used Z180, but one time I tried to use it's code on Z80 and it seems to work ok. So I think they should be byte-compatible. Do you know what is the opcode of IN0/OUT0? Just want to check how it corresponds to Z80 opcode... Found some doc for Z180, it claims that Z180 also uses register A for A15..A8, the same as Z80: https://www.wfms.org/sb180/z180qa.pdf --- Code: ---A) 8080 type instruction IN A,(n) OUT (n),A A15-A8 ←Acc --- End code --- It also claims that the new instructions IN0/OUT0 uses zero for A15..A8. These instructions was added for on-chip peripherals. --- Code: ---D) Z180 original instructions which force A15-A8 to 0 IN0 OUT0 OTIM OTIMR OTDM OTDMR TSTIO A15-A8 ←0 --- End code --- Very interesting what is opcode for IN0/OUT0, because all non-prefixed opcodes already used by Z80. So I think Z180 uses some unused prefix for these instructions Updated: found it in z180 emulator source code https://github.com/lgblgblgb/xep128/blob/master/z80ex/z180ex.c 0xED 0x08 : IN0 C,(n) 0xED 0x09 : OUT0 (n),C For Z80 these opcodes works as undocumented NOP :) |
| Navigation |
| Message Index |
| Previous page |