-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
117 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
//#include <stdio.h> | ||
//#define out( c ) putchar( c ) | ||
|
||
void | ||
out( char c ) { | ||
*((char*) 0x20000) = c; | ||
} | ||
|
||
void | ||
print( char* s ) { | ||
while (*s) | ||
out( *s++ ); | ||
} | ||
|
||
void | ||
println( char* s ) { | ||
print( s ); | ||
out( '\n' ); | ||
} | ||
|
||
char* | ||
int2str64u( unsigned long n, int radix, char* buf ) { | ||
char digits[] = "0123456789ABCDEF"; | ||
char* p = &buf[33]; | ||
unsigned long quo = n; | ||
|
||
*p-- = 0; | ||
|
||
while (quo >= radix) { | ||
*p-- = digits[(quo%radix)]; | ||
quo /= radix; | ||
} | ||
|
||
*p = digits[quo]; | ||
|
||
return p; | ||
} | ||
|
||
void | ||
main() { | ||
char buf[34]; | ||
|
||
println( int2str64u(0, 10, buf) ); | ||
println( int2str64u(123, 10, buf) ); | ||
println( int2str64u(0x12AB, 16, buf) ); | ||
println( int2str64u(2000000000, 10, buf) ); | ||
println( int2str64u(20000000000, 10, buf) ); | ||
println( int2str64u(0xF000000000000000, 16, buf) ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
|
||
Hex dump of section '.text': | ||
0x00010080 37010100 ef00c01c 73500000 00000000 7.......sP...... | ||
0x00010090 00000000 00000000 00000000 00000000 ................ | ||
0x000100a0 00000000 00000000 00000000 00000000 ................ | ||
0x000100b0 00000000 00000000 00000000 00000000 ................ | ||
0x000100c0 130101fe 233c8100 13040102 93070500 ....#<.......... | ||
0x000100d0 a307f4fe b7070200 0347f4fe 2380e700 .........G..#... | ||
0x000100e0 13000000 03348101 13010102 67800000 .....4......g... | ||
0x000100f0 130101fe 233c1100 23388100 13040102 ....#<..#8...... | ||
0x00010100 2334a4fe 6f00c001 833784fe 13871700 #4..o....7...... | ||
0x00010110 2334e4fe 83c70700 13850700 eff05ffa #4............_. | ||
0x00010120 833784fe 83c70700 e39007fe 13000000 .7.............. | ||
0x00010130 83308101 03340101 13010102 67800000 .0...4......g... | ||
0x00010140 130101fe 233c1100 23388100 13040102 ....#<..#8...... | ||
0x00010150 2334a4fe 033584fe eff09ff9 1305a000 #4...5.......... | ||
0x00010160 eff01ff6 13000000 83308101 03340101 .........0...4.. | ||
0x00010170 13010102 67800000 130101fa 233c8104 ....g.......#<.. | ||
0x00010180 13040106 233ca4fa 93870500 2334c4fa ....#<......#4.. | ||
0x00010190 232af4fa b7070100 03b78734 2334e4fc #*.........4#4.. | ||
0x000101a0 13878734 03378700 2338e4fc 93878734 ...4.7..#8.....4 | ||
0x000101b0 83c70701 230cf4fc 833784fa 93871702 ....#....7...... | ||
0x000101c0 2334f4fe 833784fb 2330f4fe 833784fe #4...7..#0...7.. | ||
0x000101d0 1387f7ff 2334e4fe 23800700 6f00c003 ....#4..#...o... | ||
0x000101e0 832744fb 033704fe 3377f702 833784fe .'D..7..3w...7.. | ||
0x000101f0 9386f7ff 2334d4fe 930604ff 3387e600 ....#4......3... | ||
0x00010200 034787fd 2380e700 832744fb 033704fe .G..#....'D..7.. | ||
0x00010210 b357f702 2330f4fe 832744fb 033704fe .W..#0...'D..7.. | ||
0x00010220 e370f7fc 833704fe 130704ff b307f700 .p...7.......... | ||
0x00010230 03c787fd 833784fe 2380e700 833784fe .....7..#....7.. | ||
0x00010240 13850700 03348105 13010106 67800000 .....4......g... | ||
0x00010250 130101fc 233c1102 23388102 13040104 ....#<..#8...... | ||
0x00010260 930784fc 13860700 9305a000 13050000 ................ | ||
0x00010270 eff09ff0 93070500 13850700 eff05fec .............._. | ||
0x00010280 930784fc 13860700 9305a000 1305b007 ................ | ||
0x00010290 eff09fee 93070500 13850700 eff05fea .............._. | ||
0x000102a0 930784fc 13860700 93050001 b7170000 ................ | ||
0x000102b0 1385b72a eff05fec 93070500 13850700 ...*.._......... | ||
0x000102c0 eff01fe8 930784fc 13860700 9305a000 ................ | ||
0x000102d0 b7973577 13850740 eff01fea 93070500 ..5w...@........ | ||
0x000102e0 13850700 eff0dfe5 930784fc 13860700 ................ | ||
0x000102f0 9305a000 b7079500 9387972f 1395b700 .........../.... | ||
0x00010300 eff09fe7 93070500 13850700 eff05fe3 .............._. | ||
0x00010310 930784fc 13860700 93050001 9307f0ff ................ | ||
0x00010320 1395c703 eff05fe5 93070500 13850700 ......_......... | ||
0x00010330 eff01fe1 13000000 83308103 03340103 .........0...4.. | ||
0x00010340 13010104 67800000 ....g... | ||
|
||
|
||
Hex dump of section '.rodata': | ||
0x00010348 30313233 34353637 38394142 43444546 0123456789ABCDEF | ||
0x00010358 00 . | ||
|