It is currently Thu Oct 19, 2017 3:00 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Sun Aug 07, 2016 6:09 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19103
Location: NE Indiana, USA (NTSC)
or: Making the the Sega Master System and the PC Master Race System speak the same language

First, there was the Intel 8008, a microprocessor commissioned by Datapoint to run its programmable dumb terminals. Two years later, Intel refactored the design into the 8080 but kept it similar enough to that source code could be translated. Later on, Intel released a revision of the 8080 called 8085, a variant with depletion-mode transistors (to run with only ground and +5 V) and built-in serial ports that powered the Digital VT102 terminal.

At the same time as the 8085's release, Zilog cloned the 8080 as the Z80, with a few more features. Zilog's official syntax differed from Intel's, likely in part for the same reason that Sony's SPC700 syntax differs from that of its Rockwell 65C02 predecessor: fear of a lawsuit that would have been the Oracle v. Google of the times.

While part of Intel was working on iAPX 432, another part was working on a further refactor of the 8086 to compete with the Z80 and 68000. This too included the 8008 and 8080/8085 instruction sets as subsets, allowing translation of assembly language source code with no loss (nor gain) in runtime efficiency. But again, the opcodes were renumbered.

The Z80 contains several 8-bit registers (A, B, C, D, E, H, L), plus three dedicated 16-bit pointer registers (IX, IY, and SP). Several pairs of 8-bit registers can be paired to act as additional pointer registers (BC, DE, HL).

The 8086 contains eight 16-bit registers (AX, BX, CX, DX, SI, DI, BP, and SP), plus an instruction pointer and four segment registers. The top or bottom half of each X register could also be used as 8-bit, like half of a Z80 register: AX is AH and AL, etc.

So now my question: Which 8086 register corresponds to each 8080/Z80 register? How did the 8086 assembler map register names when translating 8080 assembly language?


Top
 Profile  
 
PostPosted: Sun Aug 07, 2016 8:50 am 
Offline

Joined: Mon Apr 01, 2013 11:17 pm
Posts: 437
tepples wrote:
So now my question: Which 8086 register corresponds to each 8080/Z80 register?

From what I've been able to gather, this is the default mapping:

AL = A
CH = B
CL = C
DH = D
DL = E
BH = H
BL = L

AX = PSW/AF
CX = BC
DX = DE
BX = HL
SP = SP
SI = IX
DI = IY

This mapping requires all accesses of PSW/AF to be wrapped with some combination of LAHF/SAHF/XCHG. The Z80 string instructions would also need to be wrapped with some XCHG instructions to appropriately translate to their 8086 counterparts.

tepples wrote:
How did the 8086 assembler map register names when translating 8080 assembly language?

Some translators weren't assemblers. (In my quick search, I didn't come across any 8086 assemblers that accept 8080 assembly input, but I didn't look too hard.)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group