#include #include #include "bignum.h" unsigned long values[] = { 123456789L, 12345678L, 1234567L, 123456L, 65536L, 65535L, 4294966190L, /* works, (2**32-1)-1105 */ 4294967295L, 665, 78, 1, 0 }; int main(void) { char i, j; unsigned long l = 123456789L; // 075bcd15, or 52501 + 256 * 1883 bignum(b); /* ulong_to_big(l, b); for(i=0; i<6; i++) printf("%02x ", b[i]); */ POKEW(19,0); for(i=0; i < (sizeof(values)) / (sizeof(long)); i++) { l = values[i]; printf("%lu: ", l); ulong_to_big(l, b); l = 666L; j = big_to_ulong(b, &l); printf("%d %lu\n", j, l); } printf("%d\n", PEEK(20)+256*PEEK(19)); hang: goto hang; }