Character ROM shadows and the Z80

Started by nikoniko, October 11, 2007, 11:31 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nikoniko

From Christian Johansson's great site:

QuoteThere are some things you can only do with the 8502 but not with the Z80. There is an NMI input on the Z80 but it is connected to ground so this means that you can't get interrupts to the Z80 when pressing RESTORE or from CIA #2. Furthermore, the I/O port registers at addresses 0 and 1 are 8502 specific so you can't change anything related to those bits when the Z80 is active, i.e. you can't decide if the CPU and the VIC should see color RAM from bank 0 or 1 (a little known feature), you can't use a Datassette, you can't detect if CAPS LOCK has been pressed and you can't switch out the character ROM shadow that by default exists in all 4 VIC banks on the C128. (On the C64 you always have character ROM shadow in two of the VIC banks and never in the other two but with the C128 with the 8502 active you can select if you want to have character ROM shadow in all four banks or in none of the banks.)
I understand that it would be impossible to disable char ROM shadowing while in Z80 mode, but if one turns it off from 8502 mode, then switches to the Z80, it will remain disabled, right?

airship

I went to that page and it didn't say anything like that there. I tried reading some of it out loud and I just sounded like the 'Swedish Chef on the Muppet Show.
Serving up content-free posts on the Interwebs since 1983.
History of INFO Magazine

wte

Quote from: airshipI went to that page and it didn't say anything like that there.
Use this deep link: http://folkvagn.commodore64.org/c128assembly.htm#Z80CPU

Quote from: airshipI tried reading some of it out loud and I just sounded like the 'Swedish Chef on the Muppet Show.
:hurra: Please send us a mp3 from your trials :lyssna:

regards WTE

hydrophilic

Quote from: nikonikoI understand that it would be impossible to disable char ROM shadowing while in Z80 mode, but if one turns it off from 8502 mode, then switches to the Z80, it will remain disabled, right?
I would assume the answer is yes.  I was gonna try it on my 128 to be sure but I don't have a Z80 assembler on floppy (that I trust) so I tried some test code in VICE...

Well that didn't work because the VICE monitor will disassemble IN and OUT mnemonics, but it won't assemble them (wtf?).  I tried some hand assembly and VICE just reset.  So I'm not sure what the problem is.  My first thought is something is wrong with my assembly, but it disassembles just fine and is extremely simple...

I'll get back to you if someone doesn't beat me to it.

Edit
OK, confirmed it works on a real C128.  My problem was not the code, but where I put it: my favorite $1300 region.  Well the problem is the Z80 sees color RAM at $1000 to $13FF when I/O is enabled. :förvånad:

Anyway I moved the code to $1400 and it works fine.  It just INCs the VIC border until you press STOP.  No char ROM for VIC (disabled by the 8502 first).

8502 code used:
*=$1300
SEI
LDA #$3E
STA $FF00
LDA 1
PHA
ORA #4
STA 1
JSR $FFD0
PLA
STA 1
CLI
RTS

Z80 code used:
*=$1400
LD BC,$D020
IN A,(BC)
INC A
OUT (BC),A
LD BC,$DC01
IN A,(BC)
OR A,A
JP M,$1400
JP $FFE0

The code at $FFd0 was modified to RTS instead of JMP $1100, while the code at $FFE0 was modified to JP $1400 instead of RST 0.