home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
DRI-archive
/
roche
/
Z80OPS.TXT
< prev
Wrap
Internet Message Format
|
2009-12-11
|
3KB
From: "Arobase" <salle.arob...@ville-rochefort.fr>
Newsgroups: comp.os.cpm
Subject: Z80 to 8080 translation
Date: Fri, 14 Jun 2002 12:55:19 +0200
Organization: Salle multimΘdia
Lines: 143
Message-ID: <aecha9$rv$1@wanadoo.fr>
Reply-To: "Arobase" <salle.arob...@ville-rochefort.fr>
NNTP-Posting-Host: apoitiers-102-2-1-132.abo.wanadoo.fr
X-Trace: wanadoo.fr 1024051337 895 193.253.213.132 (14 Jun 2002 10:42:17 GMT)
X-Complaints-To: abuse@wanadoo.fr
NNTP-Posting-Date: 14 Jun 2002 10:42:17 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Z80OPS.txt
----------
"Request For Comments"
Sorry, group, but I am working on a Z-80 problem, and cannot
find my doc! (Maybe I should finally do some house cleaning?)
I need to translate in 8080 a program using the following Z-80
mnemonics:
1) DJNZ label
2) LDIR
3) LDDR
4) CPDR
5) RLC B
6) SBC HL,DE
7) SBC DE,HL
8) LD BC,(label)
9) LD DE,(label)
10) LD (label),DE
The only thing I found so far is a French translation of the
"Z-80 CPU Technical Manual". My favorite books by Alan Miller
are "somewhere" buried in my stuff.
Here is my first draft at solving the problem.
1) DJNZ label
decrement B-reg
jump "label" if not zero
so, this must be:
DCR B
JNZ label
2) LDIR
(DE) <-- (HL) ("symbolic operation" in Z-80 Manual)
DE <-- DE+1
HL <-- HL+1
BC <-- BC-1
Repeat until BC=0
so, this must be:
Loop1:
MOV D,H
MOV E,L
INX D
INX H
DCX B
JNZ Loop1
But when is a byte moved? Something is missing.
3) LDDR
(DE) <-- (HL)
DE <-- DE-1
HL <-- HL-1
BC <-- BC-1
Repeat until BC=0
so, this must be:
Loop1:
MOV D,H
MOV E,L
DCX D
DCX H
DCX B
JNZ Loop1
But, again, I don't see any byte moved. (Normally, in the 8080,
HL is used to "point" to a byte. So, there must be a "MOV A,M"
and "MOV M,A" somewhere. I think that the "(DE) <-- (HL)"
must be replaced by "A <-- (HL)" and "(DE) <-- A". What do
you think? And there is also the problem of the number of bytes
to move...)
4) CPDR
A <-- (HL)
HL <-- HL-1
BC <-- BC-1
Repeat until A = (HL) or BC = 0
so, this must be:
Loop1:
MOV A,M
DCX H
DCX B
???
since BC has just been decremented, we can jump if BC = 0
JZ Loop1
and, to compare A with (HL), we could use:
LXI label
CMP M
JC Loop1
5) RLC B
rotate left circular B-reg
???
6) SBC HL,DE
subtract with Carry
A <-- A-s-CY ("s is any of r,n") ???
7) SBC DE,HL
idem
8) LD BC,(label)
B-reg <-- (label+1) (or "HIGH (label)")
C-reg <-- (label) (or "LOW (label)")
so, this must be:
LXI H,label
MOV C,M
INX H
MOV B,M
9) LD DE,(label)
D-reg <-- (label+1)
E-reg <-- (label)
so, this must be:
LXI H,label
MOV E,M
INX H
MOV D,M
10) LD (label),DE
(label+1) <-- D-reg
(label) <-- E-reg
so, this must be:
LXI H,label
MOV M,E
INX M
MOV M,D
Of course, DJNZ and LDIR are pretty "standards" (in fact, the
BIOS of CP/M Plus has a function providing a
hardware-independent LDIR...), but I am concerned about the
accuracy of translation of the other opcodes.
Relevent comments appreciated.
Yours Sincerely,
"French Luser"
EOF