Kat
You could try compiling a simple program that uses structs and having a look at the assembly using something like Radare or objdump
Nomid Íkorni-Sciurus
Uhm... I'm not on linux
Kat
You should be
Nomid Íkorni-Sciurus
Kat
For this sort of work it's going to be a pain
Nomid Íkorni-Sciurus
I was using this tool to investigate different compilers and architectures
Kat
Is that Android?
Nomid Íkorni-Sciurus
Nope
Nomid Íkorni-Sciurus
https://godbolt.org/
Kat
What is it?
Nomid Íkorni-Sciurus
this is
Kat
Oh an online thing, cool.
Nomid Íkorni-Sciurus
it supports even D and Rust
Kat
Is there any reason you can't use Linux? For this sort of thing you're probably going to find it quite hard without it.
Nomid Íkorni-Sciurus
No particular reason at all, except there's a bug in the latest kernel for my cpu but it's been patched some months ago
Nomid Íkorni-Sciurus
I would like to start learning assembly, possibly of a 16- bit architecture and not higher (I heard that IA-32 and weird vector SIMD extensions are quite weird to get used to)
Nomid Íkorni-Sciurus
What can you suggest me? I have written some time ago a simple compiler and a vm for the chip-8
BinaryByter
Assembly isnt hard
BinaryByter
But learn NASM
Nomid Íkorni-Sciurus
Walter
/
Nomid Íkorni-Sciurus
no wait
Nomid Íkorni-Sciurus
nasm looks like a custom dialect not designed for a specific cpu
Nomid Íkorni-Sciurus
this is not what I was looking for
klimi
no wait
Mew nomid
Nomid Íkorni-Sciurus
I am not going to program in x86. I just want to have a reference of a 16 bit machine, possibly with a compiler to inspect the generated output
Nomid Íkorni-Sciurus
BinaryByter
why nasm?
Because gas has an... interesring syntax
BinaryByter
nasm looks like a custom dialect not designed for a specific cpu
Assembler is a custom dialect, not designed for a cpu
Nomid Íkorni-Sciurus
I'm not interested into fancy syntax
BinaryByter
And nasm is just as much of an assembler as any other assembler
BinaryByter
what you may be looking for is "how to code in binary"
BinaryByter
Enjoy dealing with elf headers :D
Nomid Íkorni-Sciurus
I'm not interested in it either
Nomid Íkorni-Sciurus
I'm not going to program in x86.
Dima
Enjoy dealing with elf headers :D
Elf.. 🧝‍♀️ LINK LINKER holy shit top 10 reveals since 1967
Nomid Íkorni-Sciurus
I want to compile a program in C for the 8086 and check the generated output, possibly with an ASM debugger. I'd like to learn how are some features compiled for a 16 bit architecture
BinaryByter
I dont see what holds you back
BinaryByter
g++ -c
BinaryByter
Also, whats the difference between a debugger and an asm debugger?
BinaryByter
MᏫᎻᎯᎷᎷᎬᎠ
.
BinaryByter
Everytime you post a useless ".", three kittens are sent to die
Nomid Íkorni-Sciurus
Also, whats the difference between a debugger and an asm debugger?
I'd like to step through the assembly and not the C code
BinaryByter
I'd like to step through the assembly and not the C code
Thats what you do when you debug your code, you know ^^
Nomid Íkorni-Sciurus
Thats what you do when you debug your code, you know ^^
ok, but I'm interested into inspecting the assembly code
Nomid Íkorni-Sciurus
for example
BinaryByter
ever tried using step and stepi on an executable that wasnt compiled with -g?
Nomid Íkorni-Sciurus
ever tried using step and stepi on an executable that wasnt compiled with -g?
I have used gdb but I don't remember if it can inspect data structures
Nomid Íkorni-Sciurus
how are structs rendered in x86?
Nomid Íkorni-Sciurus
how are certain things compiled?
BinaryByter
*slight cringe*
Nomid Íkorni-Sciurus
-.-"
BinaryByter
how are structs rendered in x86?
Do you know what a struct is?
BinaryByter
Its literally just a few variables back to back in ram
BinaryByter
(with some memory padding)
Nomid Íkorni-Sciurus
No, you have mistaken me
Nomid Íkorni-Sciurus
I know what a struct is, but how are fields passed to instructions, for examples?
Nomid Íkorni-Sciurus
If I have a function pointer in the struct X called "doSomething"
Nomid Íkorni-Sciurus
how do I CALL XXX it ?
BinaryByter
structs dont exist at asm level
Nomid Íkorni-Sciurus
structs dont exist at asm level
I know that's why I want to inspect how it works under the hood
BinaryByter
they use unicorns and black magic
Nomid Íkorni-Sciurus
I don't get what is your problem
BinaryByter
You dont get that struxts are handled JUST LIKE NORMAL VARIABLES
BinaryByter
there isnt anything special about them
Nomid Íkorni-Sciurus
ASM doesn't have variables
BinaryByter
It does, in a sense
BinaryByter
they are hidden away as pointer though
MᏫᎻᎯᎷᎷᎬᎠ
Why a class with deleted default constructor is trivial?!
MᏫᎻᎯᎷᎷᎬᎠ
Nomid Íkorni-Sciurus
they are hidden away as pointer though
Hm... let's make an example malloc stores pointers in the heap table So if I struct thing *mything = (struct thing *) malloc(sizeof(struct thing)) How do I reference mything's field in assembly?
BinaryByter
Trivial classes
you mean POD classes?
Liam
No, he means trivial default constructor
MᏫᎻᎯᎷᎷᎬᎠ
you mean POD classes?
https://www.geeksforgeeks.org/trivial-classes-c/amp/#aoh=15509201848123&amp_ct=1550920189997&referrer=https%3A%2F%2Fwww.google.com&amp_tf=From%20%251%24s