Hello,
I'm typing up a 'crib' sheet for my adventures with machine code. I'm just making sure I have my head around register addressing modes.
Is this a complete list of the more common load instructions (excluding the stack pointer & Index register instructions)? Also have I put everything in the right groups?
Thanks
Immediate Addressing
LD (HL),n
LD A,n
LD B,n
LD C,n
LD D,n
LD E,n
LD H,n
LD L,n
Register Addressing
LD r,r
Register Indirect Addressing
LD (ADDR),A
LD (BC),A
LD (DE),A
LD (HL),A
LD (HL),B
LD (HL),C
LD (HL),D
LD (HL),E
LD (HL),H
LD (HL),L
LD A,(ADDR)
LD A,(BC)
LD A,(DE)
LD A,(HL)
LD B,(HL)
LD C,(HL)
LD D,(HL)
LD E,(HL)
LD H,(HL)
LD L,(HL)
Extended Addressing
LD BC,(ADDR)
LD DE,(ADDR)
LD HL,(ADDR)
LD (ADDR),BC
LD (ADDR),DE
LD (ADDR),HE
LD BC,nn
LD DE,nn
LD HL,nn
Register Addressing Modes
- Ast A. Moore
- Rick Dangerous
- Posts: 2641
- Joined: Mon Nov 13, 2017 3:16 pm
Re: Register Addressing Modes
No, that’s Indirect addressing, I believe.
These three definitely belong to the Immediate Addressing group. The width of an instruction is irrelevant here. You’re still loading registers with values specified in the operand immediately.
LD (HL),n could possibly refer to Mixed Mode Addressing, though. The distinction is not very clear cut. In general, the Zilog documentation and, say, Rodnay Zaks don’t always agree on these definitions.
Every man should plant a tree, build a house, and write a ZX Spectrum game.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
- 1024MAK
- Bugaboo
- Posts: 3123
- Joined: Wed Nov 15, 2017 2:52 pm
- Location: Sunny Somerset in the U.K. in Europe
Re: Register Addressing Modes
To be fair, 6502 programming books make a big deal about addressing MODEs, but Z80 books, not so much. I think partly due to the different mnemonics that are used.
In summary, as with most things, there are as many "standards" as there are CPUs!
Have a read of the Wikipedia page!
Mark
In summary, as with most things, there are as many "standards" as there are CPUs!
Have a read of the Wikipedia page!
Mark
Standby alert
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
“There are four lights!”
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
- Einar Saukas
- Bugaboo
- Posts: 3118
- Joined: Wed Nov 15, 2017 2:48 pm
Re: Register Addressing Modes
I don't quite understand why you are doing it There are so many existing lists of Z80 instructions on Internet.
But if you want your list complete don't forget about undocumented instructions on halves of IX and IY aregisters.
LD IXH,N
LD IYL,N and so on
But if you want your list complete don't forget about undocumented instructions on halves of IX and IY aregisters.
LD IXH,N
LD IYL,N and so on
Re: Register Addressing Modes
Hi Ralf. I was just trying to get my head around addressing modes, and making sure everything was in the right section. Its just the way I learn stuff!
Re: Register Addressing Modes
LD (ADDR),A/LD A,(ADDR) should be in "Extended Addressing" according to this nomenclature. I'd say the term "Memory Indirect" is more descriptive, though.
Re: Register Addressing Modes
Memory Indirect would suggest a level of double indirection, in the same way that Register Indirect does. So if ADDR was 4000h and the value stored at 4000h was 8000h, the a memory indirect load would fetch the byte from 8000h. That's not something the Z80 supports. LD A, (ADDR) is just plain old indirect addressing (with the indirection stored immediately as part of the instruction).
Re: Register Addressing Modes
Ah yes, you're right of course. Please disregard my statement above.