-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
adcd1e2
commit 636b510
Showing
3 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|