2015-09-18 02:56:07 -07:00
|
|
|
|
|
|
|
|
extern int write_to_coord(int x, int y, int x86_specifier);
|
|
|
|
|
extern int clear(int x86_specifier);
|
2015-09-20 23:57:20 -07:00
|
|
|
extern int rust_get_int();
|
|
|
|
|
void print_int(int, int);
|
2015-09-18 02:56:07 -07:00
|
|
|
|
|
|
|
|
void c_entry() {
|
|
|
|
|
write_to_coord(1,1, (0xf0 << 8) | 'm');
|
2015-09-20 23:57:20 -07:00
|
|
|
int from_rust = rust_get_int();
|
|
|
|
|
print_int(from_rust, 10);
|
2015-09-18 03:43:14 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void print_int(int input, int coord) {
|
|
|
|
|
#define k(x) (0xf0 << 8) | x
|
|
|
|
|
|
|
|
|
|
while (input > 0) {
|
|
|
|
|
int output = '0';
|
|
|
|
|
char s = input & 0xf;
|
|
|
|
|
if (s <= 9) {
|
|
|
|
|
output += s;
|
|
|
|
|
} else {
|
|
|
|
|
output = 'a' + (s - 10);
|
|
|
|
|
}
|
|
|
|
|
write_to_coord(15, coord, k(output));
|
|
|
|
|
input = input >> 4;
|
|
|
|
|
coord--;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
write_to_coord(15, coord--, k('x'));
|
|
|
|
|
write_to_coord(15, coord, k('0'));
|
2015-09-18 02:56:07 -07:00
|
|
|
}
|