Import backup from 2004-08-02
This commit is contained in:
1 parent
07e8a0f4cf
commit
a50c2a1233
21 files changed
+766
-37
No files matched your search
@@ -0,0 +1,27 @@
|
||||
// asmfuncs.h
|
||||
// Author: Josh Holtrop
|
||||
// Created: 02/26/04
|
||||
// Modified: 07/11/04
|
||||
|
||||
#ifndef __HOS_ASMFUNCS__
|
||||
#define __HOS_ASMFUNCS__ __HOS_ASMFUNCS__
|
||||
|
||||
u32_t write_cr0(u32_t cr0);
|
||||
u32_t read_cr0();
|
||||
u32_t write_cr3(u32_t cr3);
|
||||
u32_t read_cr2();
|
||||
u32_t read_cr3();
|
||||
void writeCursorPosition(u32_t pos);
|
||||
u32_t getCursorPosition();
|
||||
void strcpy(char *dest, const char *src);
|
||||
void memcpy(void *dest, const void *src, u32_t n);
|
||||
void memcpyd(void *dest, const void *src, u32_t n);
|
||||
void *memset(void *buffer, int c, int num);
|
||||
void *memsetw(void *buffer, int c, int num);
|
||||
void *memsetd(void *buffer, int c, int num);
|
||||
u32_t strlen(const char *str);
|
||||
void invlpg_(u32_t addr);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
// conv.h
|
||||
// Author: Josh Holtrop
|
||||
// Date: 08/02/04
|
||||
|
||||
#include "conv.h"
|
||||
#include "hos_defines.h"
|
||||
|
||||
// BCD to string
|
||||
// returns number of characters generated before null terminator
|
||||
int bcdtoa(u32_t bcd, char *buf)
|
||||
{
|
||||
*buf++ = ((bcd & 0xF0) >> 4) + '0';
|
||||
*buf++ = (bcd & 0xF) + '0';
|
||||
*buf = 0;
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
// convert integer to hexadecimal string
|
||||
int itox(u32_t num, char *buf)
|
||||
{
|
||||
int s, i = 0;
|
||||
for (s = 28; s >= 0; s -= 4)
|
||||
{
|
||||
u32_t val = (num >> s) & 0xF;
|
||||
if (i || val || (!s))
|
||||
{
|
||||
val = (val > 9) ? (val + 'A' - 10) : (val + '0');
|
||||
buf[i++] = val;
|
||||
}
|
||||
}
|
||||
buf[i] = 0;
|
||||
return i - 1;
|
||||
}
|
||||
|
||||
|
||||
// convert signed integer to decimal string
|
||||
int itoa(int num, char *buf)
|
||||
{
|
||||
// 4,294,967,296
|
||||
int hitNum = 0, i = 0, mod, val;
|
||||
if (num < 0)
|
||||
{
|
||||
buf[i++] = '-';
|
||||
num = -num;
|
||||
}
|
||||
for (mod = 1000000000; mod >= 1; mod /= 10)
|
||||
{
|
||||
val = num / mod;
|
||||
num %= mod;
|
||||
if (val || (mod == 1))
|
||||
hitNum = 1;
|
||||
if (hitNum)
|
||||
{
|
||||
buf[i++] = val + '0';
|
||||
}
|
||||
}
|
||||
buf[i] = 0;
|
||||
return i - 1;
|
||||
}
|
||||
|
||||
|
||||
// convert an unsigned integer to decimal string
|
||||
int utoa(u32_t num, char *buf)
|
||||
{
|
||||
// 4,294,967,296
|
||||
int hitNum = 0, i = 0, mod, val;
|
||||
for (mod = 1000000000; mod >= 1; mod /= 10)
|
||||
{
|
||||
val = num / mod;
|
||||
num %= mod;
|
||||
if (val || (mod == 1))
|
||||
hitNum = 1;
|
||||
if (hitNum)
|
||||
{
|
||||
buf[i++] = val + '0';
|
||||
}
|
||||
}
|
||||
buf[i] = 0;
|
||||
return i - 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
// conv.h
|
||||
// Author: Josh Holtrop
|
||||
// Date: 08/02/04
|
||||
|
||||
#ifndef __HOS_CONV__
|
||||
#define __HOS_CONV__ __HOS_CONV__
|
||||
|
||||
#include "hos_defines.h"
|
||||
|
||||
int bcdtoa(u32_t bcd, char *buf);
|
||||
int itox(u32_t num, char *buf);
|
||||
int itoa(int num, char *buf);
|
||||
int utoa(u32_t num, char *buf);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user