R800 MULUB

Page 1/2
| 2

By GNF

Rookie (23)

GNF's picture

07-12-2014, 01:09

Hi,

Was just reading up on these two documents:
http://map.grauw.nl/resources/z80instr.php
and
http://www.msx.org/wiki/R800_Programming (Under caption New Commands)

Makes me wonder: Does MULUB A,(HL) exist?

When I follow Grauw's table for the bitfield encoding it should be:
MULUB A,r => ED C1+8*r
where r can be A, B, C, D, E, H, L or (HL).
Register bits value:
A = 7
B = 0
C = 1
D = 2
E = 3
H = 4
L = 5
(HL) = 6

So it should be: ED F1

On the wiki however I only see:
ED F9 MULUB A,A
ED C1 MULUB A,B
ED C9 MULUB A,C
ED D1 MULUB A,D
ED D9 MULUB A,E
ED E1 MULUB A,H
ED E9 MULUB A,L
ED C3 MULUW HL,BC
ED D3 MULUW HL,DE
ED E3 MULUW HL,HL
ED F3 MULUW HL,SP

GNF

Login or register to post comments

By ARTRAG

Enlighted (6564)

ARTRAG's picture

07-12-2014, 09:40

Interesting, if you post a test program (as BIN or COM file) I could run it on a real msx TR in R800 mode and report the results

By Grauw

Ascended (10146)

Grauw's picture

07-12-2014, 12:29

There’s a mistake in the r table on the MAP, (hl) is not supposed to be included there. I list (hl) separately everywhere because the timing is different. I’ll change it. Currently it incorrectly claims ld (hl),(hl) exists too which it doesn’t (at least officially).

That said, the rule you mention for the bitfield encoding is still true, although some instructions like IN and OUT (and maybe also MULUB) do not accept (hl). I don’t know if MULUB A,(HL) exists, or whether it works if it does. If I had to place a bet on it, I’d say no, but it needs to be tried Smile.

By GNF

Rookie (23)

GNF's picture

07-12-2014, 12:29

Hi Grauw,

I just encountered LD (HL),HL). Was supposed to be my next question Smile

What about:
LD (IX+oo),(HL)
LD (IY+oo),(HL)

Do those work?

GNF

By Grauw

Ascended (10146)

Grauw's picture

07-12-2014, 12:37

The opcode for LD (HL),(HL) would be 76, which is the opcode for HALT. The DD (ix) and FD (iy) prefixed versions probably also execute a HALT, or else are a no-op ("The Undocumented Z80 Documented" does not list it as HALT so maybe the latter).

By GNF

Rookie (23)

GNF's picture

07-12-2014, 12:36

@Grauw: If you are going to update the document, maybe you can consider replacing:
nn (16-bit value) with hhll, due to endianness
n with nn,
o with oo,
Makes for more readable bytecode.

GNF

By Grauw

Ascended (10146)

Grauw's picture

07-12-2014, 12:52

The n, o and nn are fairly standard notations, also used by Zilog in their documentation and elsewhere, so I won’t be changing them. If anything, I do write "nn" and "oo" in the opcode column, probably I should change them to be single-letter as well. (Edit: changed it now.)

I see your point about endianness but I don’t like deviating from nn or use anything that resembles “hl”, so the reader is just going to have to be aware that the Z80 is little-endian I guess. I’ll add a note to the nn entry in the legend at the bottom.

By GNF

Rookie (23)

GNF's picture

07-12-2014, 13:00

Just a suggestion Smile I found it to be somewhat confusing at first.

E.g.
LD (nn),HL => 22 nn nn

I find the John Vanderaart notation
LD (hhll),HL => 22 ll hh
to be more readable.

Thanx for the reply.

GNF

By hit9918

Prophet (2911)

hit9918's picture

07-12-2014, 15:38

The biggest pity is that EX DE,IX doesn't work. It would go in 10 cycles. push ix : pop de is 33 cycles.

About EXX is clear it cant exchange registers that fast, it got to be flipping one bit. One bit of the register addressing sheme.
Now I wonder whether the good old EX DE,HL of 8080 too works with such bittflip in register addressing! That EX DE,IX does not work is an indication.

Mhm and now I feel like the EX DE,HL always been a bit like an IX prefix for DE. Except that one always has to flip back with another EX DE,HL afterwards.

By Daemos

Paragon (1954)

Daemos's picture

07-12-2014, 15:52

引用:

I don’t know if MULUB A,(HL) exists, or whether it works if it does. If I had to place a bet on it, I’d say no, but it needs to be tried Smile.

I will give it a try. I bet it needs to be tried on real HW I will just write $EDF1 to a adress and call it. we willsee what happens

By Grauw

Ascended (10146)

Grauw's picture

07-12-2014, 16:06

hit9918 wrote:

The biggest pity is that EX DE,IX doesn't work. It would go in 10 cycles. push ix : pop de is 33 cycles.

Would’ve been nice, but don’t forget plain old ld:

    ld e,ixl
    ld d,ixh

20 cycles.

Page 1/2
| 2