Answer the question
In order to leave comments, you need to log in
How to run machine code?
Do not write in assembler, but write machine code and run it.
Probably there will be questions "why" and "for what" - after all, there is an assembler or si. The answer is simple - just for fun.
By the way, you need to run the code in Linux (debian)
Answer the question
In order to leave comments, you need to log in
Put dosbox
Write your code in any hex editor.
Save with com extension
Run.
On linux without dosbox you will also need to learn how to build an ELF executable.
$ cat > hello.S <<'EOF'
.data
.Lhello:
.ascii "Hello, world\n"
.text
.global _start
_start:
movl $1, %ebx
leal .Lhello, %ecx
movl $13, %edx
movl $4, %eax
int $0x80
movl $1, %eax
xorl %ebx, %ebx
int $0x80
EOF
$ gcc -m32 hello.S -nostdlib -o hello
$ ./hello
Hello, world
$
.text
.global _start
_start:
.incbin "code"
.text
.global _start
_start:
.byte 0xbb, 0x01, 0x00, 0x00, 0x00, 0x8d, 0x0d, 0xb8,
.byte 0x80, 0x04, 0x08, 0xba, 0x0d, 0x00, 0x00, 0x00,
.byte 0xb8, 0x04, 0x00, 0x00, 0x00, 0xcd, 0x80, 0xb8,
.byte 0x01, 0x00, 0x00, 0x00, 0x31, 0xdb, 0xcd, 0x80,
.byte 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, 0x77,
.byte 0x6f, 0x72, 0x6c, 0x64, 0x0a
My friend, even the most stubborn arduists no longer think of this! At least they write in assembler, but more often in a normal high-level language.
And under Peck, writing on mashcodes is pure BDSM!
Assembler is the same machine code, only using instructions that are accessible to human understanding, which in turn are simply "converted" into machine code, and for different processors in different "numbers". So, of course, you can open intel's documentation on processor opcodes, and start sculpting your creation in the editor using numbers, but you will quickly get tired of this, because. you will constantly forget what the previous line meant. Man, however, is not a digital device, but uses a system of symbols for a long time. Thus, it is much easier for people to understand each other using a symbolic system, and not a system of numbers.
Read: www.intel.com/content/dam/www/public/us/en/document...
I think the same thing exists in the public domain for AMD, ARM, AVR and other types of processors.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question