From: utzoo!decvax!decwrl!sun!megatest!fortune!hpda!hplabs!sri-unix!CC.Otken@utexas-20.arpa Newsgroups: net.micro.cpm Title: Subroutine to test for Z80 or 8080. Article-I.D.: sri-arpa.1348 Posted: Tue May 10 07:43:00 1983 Received: Fri May 13 04:00:29 1983 From: John Otken Quite a few people seem to be writing Z80 only code these days which could be bad news to some 8080/8085 CPUs. Well, here is a subroutine which exploits the subtle differences in 8080s and Z80s. ;; Z80 - Test for Z80 CPU. ; ; exit: (Zf) = set if Z80 processor ; BC, DE, HL unchanged ; Z80 xra a ; Clear parity flag ori 80h adi 81h ; Clear zero, set parity if Z80 jpo Z801 ; if 8080/8085 xra a ; Set zero Z801 ret A version of this might have gotten out with a typo in the ADI instr. Ignore it, this one is right. -------