mirror of
https://github.com/Alvin-Zilverstand/bob16.git
synced 2026-11-22 13:03:02 +01:00
stuff
This commit is contained in:
1 parent
96cd1ac97d
commit
6dfe517094
33 files changed
+9970
-3177
No files matched your search
+20
-2
@@ -1,5 +1,10 @@
|
||||
int heap_used;
|
||||
#ifdef BOBC_WIDE
|
||||
int bit_masks[32] = {(-2147483647-1),1073741824,536870912,268435456,134217728,67108864,33554432,16777216,
|
||||
8388608,4194304,2097152,1048576,524288,262144,131072,65536,32768,16384,8192,4096,2048,1024,512,256,128,64,32,16,8,4,2,1};
|
||||
#else
|
||||
int bit_masks[16] = {-32768,16384,8192,4096,2048,1024,512,256,128,64,32,16,8,4,2,1};
|
||||
#endif
|
||||
int bit_weights[4] = {8,4,2,1};
|
||||
|
||||
int strlen(char *text) { int n; n = 0; while (text[n]) n++; return n; }
|
||||
@@ -8,12 +13,21 @@ int strcmp(char *a, char *b) {
|
||||
while (a[i] && a[i] == b[i]) i++;
|
||||
return a[i] - b[i];
|
||||
}
|
||||
void memcpy(int *dst, int *src, int count) {
|
||||
#ifdef BOBC_WIDE
|
||||
void memcpy(void *dst, void *src, int count) {
|
||||
int i; for (i = 0; i < count; i++) ((int *)dst)[i] = ((int *)src)[i];
|
||||
}
|
||||
void memset(void *dst, int value, int count) {
|
||||
int i; for (i = 0; i < count; i++) ((int *)dst)[i] = value;
|
||||
}
|
||||
#else
|
||||
void word_copy(int *dst, int *src, int count) {
|
||||
int i; for (i = 0; i < count; i++) dst[i] = src[i];
|
||||
}
|
||||
void memset(int *dst, int value, int count) {
|
||||
void word_fill(int *dst, int value, int count) {
|
||||
int i; for (i = 0; i < count; i++) dst[i] = value;
|
||||
}
|
||||
#endif
|
||||
void print(char *text) { int i; i = 0; while (text[i]) { bob_putc(text[i]); i++; } }
|
||||
void println(char *text) { print(text); bob_putc('\n'); }
|
||||
void decimal_negative(int number) {
|
||||
@@ -31,7 +45,11 @@ void print_dec(int number) {
|
||||
void print_hex(int number) {
|
||||
int nibble; int bit; int digit;
|
||||
print("0x");
|
||||
#ifdef BOBC_WIDE
|
||||
for (nibble = 0; nibble < 8; nibble++) {
|
||||
#else
|
||||
for (nibble = 0; nibble < 4; nibble++) {
|
||||
#endif
|
||||
digit = 0;
|
||||
for (bit = 0; bit < 4; bit++) {
|
||||
if (number & bit_masks[nibble * 4 + bit]) digit = digit + bit_weights[bit];
|
||||
|
||||
Reference in new issue
Block a user