git.ucc.asn.au
/
uccvend-snackrom.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Stage without sha1.
[uccvend-snackrom.git]
/
ROM2
/
helpers.c
diff --git
a/ROM2/helpers.c
b/ROM2/helpers.c
index
ad52123
..
f336ae1
100644
(file)
--- a/
ROM2/helpers.c
+++ b/
ROM2/helpers.c
@@
-13,8
+13,6
@@
void delay(u16 ms) {
asm volatile ("ldx %0\n" :: "m" (ms) : "x");
asm volatile (
"delay_loop:\n"
asm volatile ("ldx %0\n" :: "m" (ms) : "x");
asm volatile (
"delay_loop:\n"
- " dex\n" /* 3 */
- " beq delay_out\n" /* 3 */
//" ldd #327\n" /* 3 */
" ldd #150\n" /* 3 */
"delay_inner_loop:\n" /* 15 cycles each */
//" ldd #327\n" /* 3 */
" ldd #150\n" /* 3 */
"delay_inner_loop:\n" /* 15 cycles each */
@@
-23,6
+21,8
@@
void delay(u16 ms) {
" subd #0x0001\n" /* 4 */
" bra delay_inner_loop\n" /* 3 */
"delay_inner_loop_end:\n"
" subd #0x0001\n" /* 4 */
" bra delay_inner_loop\n" /* 3 */
"delay_inner_loop_end:\n"
+ " dex\n" /* 3 */
+ " beq delay_out\n" /* 3 */
" bra delay_loop\n" /* 3 */
"delay_out:\n" ::: "x", "d");
/*" pulb\n"
" bra delay_loop\n" /* 3 */
"delay_out:\n" ::: "x", "d");
/*" pulb\n"
@@
-30,6
+30,12
@@
void delay(u16 ms) {
" pulx\n");*/
}
" pulx\n");*/
}
+u8 my_strlen(char* s) {
+ char *p = s;
+ while (*p) p++;
+ return p-s;
+}
+
void my_strncpy(char* dst, char* src, u8 max_size) {
u8 i;
for (i = 0; src[i] && i < max_size; i++) dst[i] = src[i];
void my_strncpy(char* dst, char* src, u8 max_size) {
u8 i;
for (i = 0; src[i] && i < max_size; i++) dst[i] = src[i];
@@
-50,3
+56,8
@@
void my_memcpy(char* dst, char* src, u8 size) {
u8 i = 0;
for (i = 0; i < size; i++) dst[i] = src[i];
}
u8 i = 0;
for (i = 0; i < size; i++) dst[i] = src[i];
}
+
+void my_memset(char* dst, u8 val, u16 count) {
+ char* c;
+ for (c = dst; c < dst+count; c++) *c = val;
+}
UCC
git Repository :: git.ucc.asn.au