[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Advice on becoming a wizard

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 2
Thread images: 1

File: code-wizard-75240927.jpg (18KB, 339x190px) Image search: [Google]
code-wizard-75240927.jpg
18KB, 339x190px
I have successfully rewritten the 91 byte executable as provided in http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html in hexadecimal.

# ELF32 header (52 bytes)
7F 45 4C 46 # signature
01 01 01 00 # ELFCLASS32, ELF2LSB, EV_CURRENT (file version), ELFOSABI_NONE
00 00 00 00 00 00 00 00 # padding
02 00 # executable
03 00 # for Intel 80386 (also known as x86, x86-32 and IA-32)
01 00 00 00 # object file version (EV_CURRENT)
54 80 04 08 # entry point 0x08048054 = 0x08048000 + 0x34 + 0x20
34 00 00 00 # program header offset: right after ELF header, 52 bytes)
00 00 00 00 # section header offset: no section headers
00 00 00 00 # The Intel386 architecture defines no flags; so this is 0.
34 00 # ELF header size (52 bytes)
20 00 # Program header size (32 bytes)
01 00 # Program header count
00 00 # e_shentsize
00 00 # e_shnum
00 00 # e_shstrndx

# Program header for ELF32 (32 bytes)
01 00 00 00 # Loadable program segment
00 00 00 00 # Offset of that segment
00 80 04 08 # p_vaddr 0x08048000
00 80 04 08 # p_paddr 0x08048000
5B 00 00 00 # file size (91 bytes)
5B 00 00 00 # memory size (same as file size)
05 00 00 00 # p_flags = readable and executable
00 10 00 00 # p_align = 4096 bytes

# _start (7 bytes)
B3 2B 31 C0 40 CD 80


I understand everything except the last 7 bytes, which are assembly instructions.

My question is what book should I use to learn to write 64-bit instructions in hexadecimal.

I plan to write these programs in hexadecimal for practice:

1. true
2. false
3. cat
4. pwd (just print string that's on 2nd stack slot, right?)
5. h2b (convert my hex format to binary)
6. b2h (and back)
7. hd (display hex in canonical format)

Maybe some more little ones. Then I'm going to take on writing an assembler, just complete enough to start expanding and improving itself.

Do you think this is a good plan?

Then I'll try making a linker and BASIC compiler in my own assembly.

Is this good for job opportunities? Will it be nice to see on GitHub?
>>
>>60898481
You can convert the previous .hex file with this piece of shit script I wrote in 5 minutes but that worked since:

#include <stdio.h>

static int skipComment(void) {
int c;
while ((c = getchar()) != 0x0A && c != EOF);
return c;
}

int main(void) {
//freopen(NULL, "wb", stdout);
int c, b, n = 0; // character, corresponding byte, scanned hex char count
while ((c = getchar()) != EOF) {
if (c == '#') {
c = skipComment();
if (c == EOF) return 0;
}
if (c >= '0' && c <= '9') {
if (n == 0) {
b = (c - '0') * 16;
n = 1;
fprintf(stderr, "%c", c);
} else {
b += (c - '0');
n = 0;
fprintf(stderr, "%c ", c);
putchar(b);
}
} else if (c >= 'A' && c <= 'F') {
if (n == 0) {
b = (c - 'A' + 10) * 16;
fprintf(stderr, "%c", c);
n = 1;
} else {
b += (c - 'A' + 10);
fprintf(stderr, "%c ", c);
n = 0;
putchar(b);
}
} else {
// ignore
}
}
fprintf(stderr, "\n");
return 0;
}


Also, general advice on becoming a better programming and filling GitHub portfolio for finding a job (I'm just starting out, almost dropped out of uni but managed to get one-year academic vacation because I skipped too many lessons because I didn't like what they're teaching (C#) but I think I'm mature enough now to take it the ass now).
Thread posts: 2
Thread images: 1


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.