Previous Thread
Next Thread
Print Thread
Joined: Apr 2004
Posts: 1,555
J
judge Offline OP
Very Senior Member
OP Offline
Very Senior Member
J
Joined: Apr 2004
Posts: 1,555

Does someone have documentation fully describing the uPD7801 instruction set, especially the opcode -> instruction mapping?

We already have a datasheet describing the uPD78c05/uPD78c06 features and a global list of instructions plus cycle timings.

Joined: Dec 1999
Posts: 1,176
J
Very Senior Member
Offline
Very Senior Member
J
Joined: Dec 1999
Posts: 1,176
Hmm, I was looking for this the other day but only under the uPD78c06 name. Stuff for the uPD7801 is easy to find (e.g. here) but I thought they were too different for it to be useful.

Last edited by Justin; 02/12/08 11:22 AM.
Joined: Apr 2004
Posts: 1,555
J
judge Offline OP
Very Senior Member
OP Offline
Very Senior Member
J
Joined: Apr 2004
Posts: 1,555
Hah, that's actually just what I need.

That excel sheet matches what I currently have.

Joined: Jul 2004
Posts: 517
R
Senior Member
Offline
Senior Member
R
Joined: Jul 2004
Posts: 517
It sounds like you've got it under control now, but John Dyer (my source for info on the chip) just completed Chris Covell's opcode list.

Code:
-----------------------------------------------------------
      uCOM-87 Instruction set (uPD7800,uPD7801,uPD78C06)
-----------------------------------------------------------
xx   = Data    (Byte)
aa   = Address (Byte)
wa   = Offset  (Byte) Offset to V (vector "page" register)
bbaa = Address (Word)

00                          NOP     
01                          HLT     
02                          INX     SP
03                          DCX     SP
04 aa bb                    LXI     SP,bbaa
05 wa xx                    ANIW    wa,xx
06                          ----
07 xx                       ANI     A,xx
08                          RET     
09                          SIO     
0A                          MOV     A,B
0B                          MOV     A,C
0C                          MOV     A,D
0D                          MOV     A,E
0E                          MOV     A,H
0F                          MOV     A,L

10                          EX
11                          EXX
12                          INX     B   (BC)
13                          DCX     B   (BC)
14 aa bb                    LXI     B,bbaa
15 wa xx                    ORIW    wa,xx
16 xx                       XRI     A,xx
17 xx                       ORI     A,xx
18                          RETS    
19                          STM     
1A                          MOV     B,A
1B                          MOV     C,A
1C                          MOV     D,A
1D                          MOV     E,A
1E                          MOV     H,A
1F                          MOV     L,A

20 wa                       INRW    wa
21                          TABLE
22                          INX     D   (DE)
23                          DCX     D   (DE)
24 aa bb                    LXI     D,bbaa
25 wa xx                    GTIW    wa,xx
26 xx                       ADINC   A,xx
27 xx                       GTI     A,xx
28 wa                       LDAW    wa
29                          LDAX    B   (BC)
2A                          LDAX    D   (DE)
2B                          LDAX    H   (HL)
2C                          LDAX    D+  (DE)
2D                          LDAX    H+  (HL)
2E                          LDAX    D-  (DE)
2F                          LDAX    H-  (HL)

30 wa                       DCRW    wa
31                          BLOCK
32                          INX     H   (HL)
33                          DCX     H   (HL)
34 aa bb                    LXI     H,bbaa
35 wa xx                    LTIW    wa,xx
36 xx                       SUINB   A,xx
37 xx                       LTI     A,xx
38 wa                       STAW    wa
39                          STAX    B   (BC)
3A                          STAX    D   (DE)
3B                          STAX    H   (HL)
3C                          STAX    D+  (DE)
3D                          STAX    H+  (HL)
3E                          STAX    D-  (DE)
3F                          STAX    H-  (HL)

40                          ---
41                          INR     A
42                          INR     B
43                          INR     C
44 aa bb                    CALL    bbaa
45 wa xx                    ONIW    wa,xx
46 xx                       ADI     A,xx
47 xx                       ONI     A,xx

48 00                       SKIT    F0
48 01                       SKIT    FT
48 02                       SKIT    F1
48 03                       SKIT    F2
48 04                       SKIT    FS
48 0A                       SK      CY
48 0C                       SK      Z
48 0E                       PUSH    V
48 0F                       POP     V
48 10                       SKNIT   F0
48 11                       SKNIT   FT
48 12                       SKNIT   F1
48 13                       SKNIT   F2
48 14                       SKNIT   FS
48 1A                       SKN     CY
48 1C                       SKN     Z
48 1E                       PUSH    B   (BC)
48 1F                       POP     B   (BC)
48 20                       EI  
48 24                       DI  
48 2A                       CLC 
48 2B                       STC 
48 2C                       PEN
48 2D                       PEX
48 2E                       PUSH    D   (DE)
48 2F                       POP     D   (DE)
48 30                       RAL 
48 31                       RAR 
48 32                       RCL
48 33                       RCR
48 34                       SHAL
48 35                       SHAR
48 36                       SHCL
48 37                       SHCR
48 38                       RLD 
48 39                       RRD 
48 3C                       PER
48 3E                       PUSH    H   (HL)
48 3F                       POP     H   (HL)

49 xx                       MVIX    B,xx
4A xx                       MVIX    D,xx
4B xx                       MVIX    H,xx
4C 00....4C BF              IN      A,xx
4C C0                       MOV     A,PA
4C C1                       MOV     A,PB
4C C2                       MOV     A,PC
4C C3                       MOV     A,MK
4C C8                       MOV     A,S
4D 00....4D BF              OUT     xx
4D C0                       MOV     PA,A
4D C1                       MOV     PB,A
4D C2                       MOV     PC,A
4D C3                       MOV     MK,A
4D C4                       MOV     MB,A
4D C5                       MOV     MC,A
4D C6                       MOV     TM0,A
4D C7                       MOV     TM1,A
4D C8                       MOV     S,A
4E xx                       JRE     +offset xx
4F xx                       JRE     -offset (-xx)

50                          ---
51                          DCR     A
52                          DCR     B
53                          DCR     C
54 aa bb                    JMP     bbaa
55 wa xx                    OFFIW   wa,xx
56 xx                       ACI     xx
57 xx                       OFFI    A,xx
58 wa                       BIT     0,wa
59 wa                       BIT     1,wa
5A wa                       BIT     2,wa
5B wa                       BIT     3,wa
5C wa                       BIT     4,wa
5D wa                       BIT     5,wa
5E wa                       BIT     6,wa
5F wa                       BIT     7,wa

60 08-0F                    ANA     r,A     (r = V,A,B,C,D,E,H,L)
60 10-17                    XRA     r,A
60 18-1F                    ORA     r,A
60 20-27                    ADDNC   r,A
60 28-2F                    GTA     r,A
60 30-37                    SUBNB   r,A
60 38-3F                    LTA     r,A
60 40-47                    ADD     r,A
60 50-57                    ADC     r,A
60 60-67                    SUB     r,A
60 68-6F                    NEA     r,A
60 70-7F                    SUB     r,A
60 88-8F                    ANA     r,A
60 90-97                    XRA     r,A
60 98-9F                    ORA     r,A
60 A0-A7                    ADDNC   r,A
60 A8-AF                    GTA     r,A
60 B0-B7                    SUBNB   r,A
60 B8-BF                    LTA     r,A
60 C0-C7                    ADD     r,A
60 C8-CF                    ONA     r,A
60 D0-D7                    ADC     r,A
60 D8-DF                    OFFA    r,A
60 E0-E7                    SUB     r,A
60 E8-EF                    NEA     r,A
60 F0-F7                    SBB     r,A
60 F7-FE                    EQA     r,A

61                          DAA     
62                          RETI
63                          CALB

64 08-0F xx                 ANI     r,xx     (r = V,A,B,C,D,E,H,L)
64 10-17 xx                 XRI     r,xx
64 18-1F xx                 ORI     r,xx
64 20-27 xx                 ADINC   r,xx
64 28-2F xx                 GTI     r,xx
64 30-37 xx                 SUINB   r,xx
64 38-3F xx                 LTI     r,xx
64 40-47 xx                 ADI     r,xx
64 48-4F xx                 ONI     r,xx
64 50-57 xx                 ACI     r,xx
64 58-5F xx                 OFFI    r,xx
64 60-67 xx                 SUI     r,xx
64 68-6F xx                 NEI     r,xx
64 70-77 xx                 SBI     r,xx
64 78-7F xx                 EQI     r,xx

64 88-8B xx                 ANI     r,xx     (r = PA,PB,PC,MK)
64 90-93 xx                 XRI     r,xx
64 98-9B xx                 ORI     r,xx
64 A0-A3 xx                 ADINC   r,xx
64 A8-AB xx                 GTI     r,xx
64 B0-B3 xx                 SUINB   r,xx
64 B8-BB xx                 LTI     r,xx
64 C0-C3 xx                 ADI     r,xx
64 C8-CB xx                 ONI     r,xx
64 D0-D3 xx                 ACI     r,xx
64 D8-DB xx                 OFFI    r,xx
64 E0-E3 xx                 SUI     r,xx
64 E8-EB xx                 NEI     r,xx
64 F0-F3 xx                 SBI     r,xx
64 F8-FB xx                 EQI     r,xx

65 wa xx                    NEIW    wa,xx
66 xx                       SUI     A,xx
67 xx                       NEI     A,xx
68 xx                       MVI     V,xx
69 xx                       MVI     A,xx
6A xx                       MVI     B,xx
6B xx                       MVI     C,xx
6C xx                       MVI     D,xx
6D xx                       MVI     E,xx
6E xx                       MVI     H,xx
6F xx                       MVI     L,xx

70 0E aa bb                 SSPD    bbaa
70 0F aa bb                 LSPD    bbaa
70 1E aa bb                 SBCD    bbaa
70 1F aa bb                 LBCD    bbaa
70 2E aa bb                 SDED    bbaa
70 2F aa bb                 LDED    bbaa
70 3E aa bb                 SHLD    bbaa
70 3F aa bb                 LHLD    bbaa

70 68 aa bb                 MOV     V,bbaa
70 69 aa bb                 MOV     A,bbaa
70 6A aa bb                 MOV     B,bbaa
70 6B aa bb                 MOV     C,bbaa
70 6C aa bb                 MOV     D,bbaa
70 6D aa bb                 MOV     E,bbaa
70 6E aa bb                 MOV     H,bbaa
70 6F aa bb                 MOV     L,bbaa

70 78 aa bb                 MOV     aabb,V
70 79 aa bb                 MOV     aabb,A
70 7A aa bb                 MOV     aabb,B
70 7B aa bb                 MOV     aabb,C
70 7C aa bb                 MOV     aabb,D
70 7D aa bb                 MOV     aabb,E
70 7E aa bb                 MOV     aabb,H
70 7F aa bb                 MOV     aabb,L

70 89-8F                    ANAX    rpa      (rpa = B,D,H,D+,H+,D-,H-)
70 91-97                    XRAX    rpa
70 99-9F                    ORAX    rpa
70 A1-A7                    ADDNCX  rpa
70 A9-AF                    GTAX    rpa
70 B1-B7                    SUBNBX  rpa
70 B9-BF                    LTAX    rpa
70 C1-C7                    ADDX    rpa
70 C9-CF                    ONAX    rpa
70 D1-D7                    ADCX    rpa
70 D9-DF                    OFFAX   rpa
70 E1-E7                    SUBX    rpa
70 EA-EF                    NEAX    rpa
70 F1-F7                    SBBX    rpa
70 F9-FF                    EQAX    rpa

71 wa xx                    MVIW    wa,xx
72                          SOFTI
73                          JB       

74 88                       ANAW    wa
74 90                       XRAW    wa
74 98                       ORAW    wa
74 A0                       ADDNCW  wa
74 A8                       GTAW    wa
74 B0                       SUBNBW  wa
74 B8                       LTAW    wa
74 C0                       ADDW    wa
74 C8                       ONAW    wa
74 D0                       ADCW    wa
74 D8                       OFFAW   wa
74 E0                       SUBW    wa
74 E8                       NEAW    wa
74 F0                       SBBW    wa
74 F8                       EQAW    wa

75 wa xx                    EQIW    wa,xx
76 xx                       SBI     A,xx
77 xx                       EQI     A,xx

78 aa...7F aa               CALF    (Opcode minus $70)aa

80                          CALT    0080
81                          CALT    0082
.
.
BE                          CALT    00FC
BF                          CALT    00FE

C0...DF                     JR      +offset (Opcode minus $C0)
E0...FF                     JR      -offset (-(Opcode minus $E0))
-----------------------------------------------------------

Joined: Apr 2004
Posts: 1,555
J
judge Offline OP
Very Senior Member
OP Offline
Very Senior Member
J
Joined: Apr 2004
Posts: 1,555
Hm, you can actually write to the V register??

Btw, 4D C9 is MOV TMM,A

Joined: Jul 2004
Posts: 517
R
Senior Member
Offline
Senior Member
R
Joined: Jul 2004
Posts: 517
Here's John Dyer's update, followed by a correction.

"The V register is called the "vector" register by nec but its actually
a
page register, which holds the address high byte which can be anywhere
in
the memory area of 64K
The instructions with 'W' in the mnemonic provide the low byte of the
address of the 256 byte block.

The opcode 4D C9 is illegal and not assigned, dunno what TMM refers to!"

"I regret to advise that I gave you some incorrect information regarding your queries on the 78C06 processor,
I was working from the 7800/7801 processor which is ALMOST identical, the instruction set is correct except
the V register has been hard-wired to high-byte FF and cannot be written to as you asked.

You will need to ignore any opcodes/instructions that read/write directly to the V register.

There has also been some minor changes to Port addressing, and changes to the on-board Timer
The opcode you mentioned is valid for access to the TMM register but my information on what
the register does is incomplete except that it relates to setting up the Timer.

These changes may make some parts of the disassembly incorrect, if so I am sorry, but
my experience and knowledge is limited to the 7801 processor."

Joined: Apr 2004
Posts: 1,555
J
judge Offline OP
Very Senior Member
OP Offline
Very Senior Member
J
Joined: Apr 2004
Posts: 1,555
Bit 2 switches timer counter increments between 8 and 128 cycles.
If ( TMM & 0x03 ) equals zero the TO output pin is swapped.

Does John Dyer have some programs I could test my upd7801 core with?

I've actually created a uPD7801, a uPD78C05 and a uPD78C06 core for mame. The uPD78C05/06 have working timers currecntly, serial i/o is not working because I could not test that. The uPD7801 has been entirely untested. I think the basic instruction set will work, just timers and serial i/o I suspect will be broken.

Joined: Jul 2004
Posts: 517
R
Senior Member
Offline
Senior Member
R
Joined: Jul 2004
Posts: 517
I just heard back from John Dyer about the upd7801:

"You would find it quite difficult to find programs for the 7801 as this
is a
microcontroller designed and used
for embedded/industrial applications, so no stand-alone software exists
that
I know of.

My own involvement with the 7801 began around 25 years ago (makes me
pretty
old huh!) when I was
working as a software developer for the local distributor of Sanyo
office
equipment. Sanyo were manufacturing
a range of electronic cash registers using the 7801 as the controller.
My
job was to develop an add-on board
with extra ports for comms etc and write the appropriate drivers.
There were no tools available except a very expensive nec development
system
well outside our budget, so
I wound up writing my own cross-assembler running under dos.
I later moved on to newer nec processors from the uPD7807, uPD7809 and
uPD
7810 families, which were all substantial
enhancements of the 7801 architecture."

Joined: Apr 2004
Posts: 1,555
J
judge Offline OP
Very Senior Member
OP Offline
Very Senior Member
J
Joined: Apr 2004
Posts: 1,555
I guess we should wait until we get some epoch super cassette vision dumps then.


Link Copied to Clipboard
Who's Online Now
6 members (Praxis, Fake Shemp, ted, Dam0, AJR, crazyc), 27 guests, and 3 robots.
Key: Admin, Global Mod, Mod
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Forum Statistics
Forums9
Topics8,974
Posts117,891
Members5,001
Most Online890
Jan 17th, 2020
Forum Host
These forums are hosted by www.retrogamesformac.com
Forum hosted by www.retrogamesformac.com