#pragma once

#include <common.h>

typedef struct {
    bool active;
    u8 byte;
    u8 value;
    u8 value_buffer;
    u8 start_delay;
    bool transferring;
    bool dma_waiting;
} dma_context;

typedef struct {
    dma_context ctx;
} dma_state;

void dma_save_state(dma_state*);
void dma_load_state(const dma_state*);

void dma_start(u8 start);
void dma_tick();

bool dma_transferring();