Basic Assembly Language Commands

Table of Contents

Addressing information
DEC
EX
EXX
INC
LD
NOP
Back to the lesson index


Addressing Information

When refering to memory there are serveral methods used to tell what part of memory is being talked about. These are called addressing methods because you can use them to find the "address" of the memory location in question.

Back to top


DEC

This is one of the most basic math operators. All it does is subtract one from a number. This is faster than the subtract instruction, so if this is all your program needs, you should let your program use this. The syntax for this command is as follows:
DEC ?
where ? is one of the following: IX, IY, BC, DE, HL, SP, A, B, C, D, E, H, L, (IX+d), (IY+d) where d = -128 to 127

Back to top


EX

This operand lets you swap the values of two registers or between a register and memory. The syntax is:
EX (SP), HL
EX (SP), IX
EX (SP), IY
EX AF, AF'
EX DE, HL
As shown, one of the forms of EX swaps AF with AF', which if you don't currently care about the flag register allows you to use two more registers called A' and F'. The hitch is that A' and F' have to be swapped with A and F to use what's in them, and because of this you can't use A and A' or F and F' at the same time.

Back to top


EXX

This useful command is similar to EX AF, AF', but uses different registers. The syntax is:
EXX
This will swap BC and BC', DE and DE', and HL and HL'. If you looked at EX yo know why this is useful, but the same hitch applies. There is also a new hitch, all 3 register pairs must be swapped at once. You can't just swap BC and BC' without swapping the other pairs as well.

Back to top


INC

This operation is similar to DEC, but instead of subtracting one, it adds one. It's syntax is:
INC ?
where ? is one of the following: IX, IY, BC, DE, HL, SP, A, B, C, D, E, H, L, (IX+d), (IY+d) where d = -128 to 127

Back to top


LD

This command stands for load, and is one of the most commonly used commands in any assembly language. It's equivalent on PCs is MOV. The syntax is:
LD I, A
LD A, I
LD R, A
LD A, R
LD (BC), ? In these 6 lines ? means A, B, C, D, E, H, L, 0-255, 0-65535,
LD (DE), ? BC, DE, HL, or SP and d is between -128 and 127.
LD (HL), ?
LD (#), ?
LD (IX+d), ?
LD (IY+d), ?

LD A, ? In these 7 lines ? means A, B, C, D, E, H, L, 0-255, (HL), (BC),
LD B, ? (DE), (SP), (IX+d), (IY+d), or (#) where d is -127 to 128 and # is
LD C, ? a location in the TI's memory.
LD D, ?
LD E, ?
LD H, ?
LD L, ?

LD BC, ? In these 4 lines ? means (HL), (BC), (DE), (SP), (IX+d), (IY+d), BC,
LD DE, ? DE, HL, SP, 0-65535 or (#) where d is -128 to 127 and # is an
LD HL, ? address in the calc's memory.
LD SP, ?
LD r, r' This command loads A, B, C, D, E, F, H, or L with A', B', C', D', E', F', H', or L'.
This command moves a byte or a word from memory to a register, from a register to memory, or from one register to another. It is one of the most frequently used commands. If you know whether the syntax LD r', r is valid,
mail me. Back to top

NOP

This command stands for No Op, or no operation. When the processor gets this command it does nothing for one clock cycle, then does the next command. This is used mostly for timing when writing to the display adaptor, and should not be used except as neccesary because except for the display adaptor it serves no useful purpose on the 82.

Back to top


Questions, comments, flames? Send them in!
If you need help (more simple or more technical) tell me and I'll send it to you by e-mail. Also, is there anything in specific you want to see examples of? Let me know!