Skip to content

Commit

Permalink
Add missing files
Browse files Browse the repository at this point in the history
  • Loading branch information
d3m3vilurr committed Aug 15, 2017
1 parent adcd1e2 commit 636b510
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/console.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#pragma once

void waitPressA();
void enablePrintProgress();
void disablePrintProgress();
void printProgress(uint32_t curr, uint32_t total);
41 changes: 41 additions & 0 deletions source/console.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#include <nds.h>
#include <stdio.h>
#include "console.h"

void waitPressA() {
iprintf("press <A>\n\n");
while(1) {
scanKeys();
if(keysDown() & KEY_A)
break;
swiWaitForVBlank();
}
scanKeys();
}

int percent(int c, int t) {
return c * 100 / t;
}

int printProgressFlag = 1;

void disablePrintProgress() {
printProgressFlag = 0;
}

void enablePrintProgress() {
printProgressFlag = 1;
}

void printProgress(uint32_t curr, uint32_t total) {
static int old = 100;
if (!printProgressFlag) {
return;
}
int pct = percent(curr, total);
if (pct % 5 == 0 && old != pct);
iprintf("\r %3d%%", pct);
old = pct;
}


14 changes: 14 additions & 0 deletions source/delay.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright 2014 Normmatt
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.

.arm
.global ioDelay
.type ioDelay STT_FUNC

@ioDelay ( u32 us )
ioDelay:
subs r0, #1
bgt ioDelay
bx lr

0 comments on commit 636b510

Please sign in to comment.