oam timings passing.
This commit is contained in:
24
lib/dma.c
24
lib/dma.c
@ -8,23 +8,31 @@
|
||||
static dma_context ctx;
|
||||
|
||||
void dma_start(u8 start) {
|
||||
ctx.start_delay = 1;
|
||||
ctx.value_buffer = start;
|
||||
ctx.dma_waiting = true;
|
||||
}
|
||||
|
||||
void dma_begin() {
|
||||
ctx.active = true;
|
||||
ctx.byte = 0;
|
||||
ctx.start_delay = 2;
|
||||
ctx.value = start;
|
||||
ctx.transferring = false;
|
||||
ctx.value = ctx.value_buffer;
|
||||
ctx.dma_waiting = false;
|
||||
}
|
||||
|
||||
void dma_tick() {
|
||||
ctx.transferring = false;
|
||||
|
||||
if (ctx.start_delay) {
|
||||
ctx.start_delay--;
|
||||
} else if(ctx.dma_waiting) {
|
||||
dma_begin();
|
||||
}
|
||||
|
||||
if (!ctx.active) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctx.start_delay) {
|
||||
ctx.start_delay--;
|
||||
return;
|
||||
}
|
||||
ctx.transferring = true;
|
||||
u8 data = 0;
|
||||
u16 addr = (ctx.value << 8) | ctx.byte;
|
||||
@ -45,7 +53,7 @@ void dma_tick() {
|
||||
}
|
||||
|
||||
bool dma_transferring() {
|
||||
return ctx.transferring && ctx.active;
|
||||
return ctx.transferring;// && ctx.active;
|
||||
}
|
||||
|
||||
void dma_save_state(dma_state* state) {
|
||||
|
Reference in New Issue
Block a user