How safe is to use undocumented Z80 instructions?

Página 1/2
| 2

Por Chardson

Champion (411)

imagem de Chardson

17-04-2007, 10:03

Hi all,

I was modifing a routine I found on the web to work with some programs I am doing. But my modifications needed more two 8 bit registers. So, to avoid a lot of pushs and pops, I was thinking about using IXl and IXh (specially because of their accumulator properties). But I was wondering if it would turn to be a big trouble, compatibility-wise.

At first, it appears to be pretty safe, since some Master System games (Codemasters') and even some MSX games/software uses it. But, as asking won't hurt none, how was your general experience with using those kind of instructions? Should I avoid them at all cost?

Thanks all!

Entrar ou registrar-se para comentar

Por multi

Expert (74)

imagem de multi

17-04-2007, 11:54

on the turbo-r cpu (R800) a lot of undocumented instructions are replaced to do nothing (NOP). i think all the new feature adding instructions with IX & IY do work though. so the instructions you mention would be safe to use on even a R800 cpu (although testing it to be a 100% sure would be better then trusting me...)

also the R800 has undocumented instructions, i think they are maybe some MUL or DIV like instructions, but never really took the time to get into them (think it is only 1, but it's a long time ago).

Por sjoerd

Hero (599)

imagem de sjoerd

17-04-2007, 12:16

On Z80 all undocumented instructions are safe.

Instructions using ixh, ixl, iyl and iyh are official instructions on R800, so no problem. But undocumented Z80 instructions like sll, out (c),0 and others don't work on R800. Don't know about set 7,(ix+0),b and the like on R800, but I don't think anybody uses those.

Por Chardson

Champion (411)

imagem de Chardson

17-04-2007, 23:14

Hmm, I haven't looked other undocumented instructions, but knowing that I can freely use IX and IY is very good! Thanks folks!

Por AuroraMSX

Paragon (1901)

imagem de AuroraMSX

21-04-2007, 11:27

Hi all,

I was modifing a routine I found on the web to work with some programs I am doing. But my modifications needed more two 8 bit registers. So, to avoid a lot of pushs and pops, I was thinking about using IXl and IXh (specially because of their accumulator properties). But I was wondering if it would turn to be a big trouble, compatibility-wise.And there's always the option to use the alternative register set - 100% documented and safe Smile

Por GhostwriterP

Hero (581)

imagem de GhostwriterP

21-04-2007, 11:52

At the point I start using ixh and ixl that alternative register set is also already in use.Big smile

Por AuroraMSX

Paragon (1901)

imagem de AuroraMSX

21-04-2007, 12:11

At the point I start using ixh and ixl that alternative register set is also already in use.Big smileBut you're not Chardson Tongue

Por nikodr

Paladin (747)

imagem de nikodr

21-04-2007, 14:42

Is there a command that can be used under basic that can switch from z80 to r800 mode ?If not then could someone post an assembly code that i could insert as data in a basic program and call it?(Actually i am just fooling around with turbo-r emulators on pc i do not have a real turbo-r0.

Por nikodr

Paladin (747)

imagem de nikodr

21-04-2007, 14:42

Sorry for double post!Please delete it....

Por NYYRIKKI

Enlighted (5741)

imagem de NYYRIKKI

21-04-2007, 15:22

@nikodr No, there is no internal command, but you can use this BASIC line in middle of your program:

8728 DEFUSR=39+PEEK(-2385)+PEEK(-2384)*256:IFUSR(0)THENLINE>1COPY0&H80F6OR384ALLYOURBASEAREBELONGTOUS!

Change number after "LINE>" like this:
0 = Z80 (ROM)
1 = R800 (ROM)
2 = R800 (DRAM)

If you type only this one line and save it with .COM extension you can use this program also in DOS.
Example:
SAVE"Z80.COM"
_SYSTEM
Z80

Por nikodr

Paladin (747)

imagem de nikodr

21-04-2007, 17:42

thanks will try it laterSmile
Regards

Página 1/2
| 2