# `sla`

[Z80 Documentation](https://asm-editor.specy.app/documentation/z80.md) › [Instructions](https://asm-editor.specy.app/documentation/z80/instruction.md)

Web page: https://asm-editor.specy.app/documentation/z80/instruction/sla

**Shift left arithmetic**

Category: Shifts and rotates

Shifts a register or memory byte left one bit, copying bit 7 to C and putting zero into bit 0.

Used in: [8-bit and 16-bit arithmetic, logic and bits](https://asm-editor.specy.app/learn/courses/z80/think-in-assembly/arithmetic-logic-and-bits.md) (Z80 assembly), [Multiply and divide, with the remainder](https://asm-editor.specy.app/learn/courses/z80/examples/multiply-and-divide.md) (Z80 assembly)

## Flags

| Flag | Effect |
| --- | --- |
| S | depends on the result |
| Z | depends on the result |
| H | always 0 |
| P/V | holds the parity of the result |
| N | always 0 |
| C | depends on the result |

## Forms

- `sla r` · 2 bytes · 8 cycles · Shifts `r` left one bit position. Copies bit 7 to the carry flag and puts a zero into bit 0.
  - `sla b`
  - `sla c`
  - `sla d`
  - `sla e`
  - `sla h`
  - `sla l`
  - `sla a`

- `sla (hl)` · 2 bytes · 15 cycles · Shifts (HL) left one bit position. Copies bit 7 to the carry flag and puts a zero into bit 0.

- `sla (ix+dd)` · 4 bytes · 23 cycles · Shifts the memory location pointed to by IX plus `dd` left one bit position. Copies bit 7 to the carry flag and puts a zero into bit 0.
  - `sla (ix+dd)`
  - `sla (iy+dd)`

## Undocumented

Zilog’s manual does not list these forms, but the Z80 runs them.

- `sla (ix+dd), r` · 4 bytes · 23 cycles · Shifts the memory location pointed to by IX plus `dd` left one bit position. Copies bit 7 to the carry flag and puts a zero into bit 0. Also stores the result in `r`.
  - `sla (ix+dd), b`
  - `sla (ix+dd), c`
  - `sla (ix+dd), d`
  - `sla (ix+dd), e`
  - `sla (ix+dd), h`
  - `sla (ix+dd), l`
  - `sla (ix+dd), a`
  - `sla (iy+dd), b`
  - `sla (iy+dd), c`
  - `sla (iy+dd), d`
  - `sla (iy+dd), e`
  - `sla (iy+dd), h`
  - `sla (iy+dd), l`
  - `sla (iy+dd), a`

## Operands

- `r`: An 8-bit register: `a`, `b`, `c`, `d`, `e`, `h` or `l`.
- [`(hl)`](https://asm-editor.specy.app/documentation/z80/registers/operand-hl.md): The byte in memory at the address stored in `hl`.
- [`(ix+dd)`](https://asm-editor.specy.app/documentation/z80/registers/operand-ix-dd.md): The byte in memory at `ix + dd`, where `dd` is a signed displacement from `-128` to `127`, for example `(ix+5)` or `(ix-3)`. `(iy+dd)` works the same way.

## Example

```z80
        .org 0x8000
        ld b, 3
        sla b
        halt
```
