Questions tagged [machine-code]

Machine code is data that is directly fed into a microprocessor, being the only form that the processor is able to execute. It is the lowest possible level of abstraction, wherein all data is a raw binary stream. Machine code is barely readable by humans, which is why assembly is usually utilized instead.

Every processor or processor family has its own instruction set. This is a set of instructions the processor has been designed to execute. These instructions are binary codes and in general are not human readable, one would have to memorize the bit patterns. Assembly language is a human readable representation of the machine code where the assembly language mnemonics and following syntax attempt a one to one assembly language instruction to machine code instruction relationship. But assembly language has a fair amount of additional syntax that is not directly related to machine code or machine language.

https://en.wikipedia.org/wiki/Machine_code

The tag is used for questions related to machine code. Additional tags like and and others may also be used.

A tag specifying the architecture , , , , (and many others), is needed as the machine code for different architectures is not compatible, and the question will be difficult to answer without knowing the architecture.

766 questions
-1
votes
3 answers

Questions about working with machine language

I have a few questions about machine language: How to write machine language code? And is this actually done? What part of the architecture processes the machine language? (intel or amd chips? something else?) Does each machine have a different…
MalcolmX
  • 141
  • 7
-1
votes
1 answer

In ARM machine code, how is the offset encoded in SUB SP, SP, #36?

Edit: My concern is how ARM instruction is encoded. Let's examine below example: 194640: e92d40f0 push {r4, r5, r6, r7, lr} 194644: e24dd024 sub sp, sp, #36 ; 0x24 --> sp decrease 36 ~ 0x24 --> Is it calculated by e24dd024 &…
-1
votes
1 answer

Addresses in branches and jumps

In MIPS, to calculate the address of the new instruction in the case of branches, the offsets (shifted 16 bits) are added to the current PC. but to calculate the address of the new instruction in case of jumps, the current PC is replaced with the…
Mohamed
  • 129
  • 6
-1
votes
1 answer

How many bits are required to store MARIE's instruction set?

I know that MARIE's instruction set has 16-bit per instruction, given that there are 9 instructions, doesn't it make sense that 16*9 = 144bits are needed to store all of the instruction? But apparently its wrong, whats wrong with my reasoning and…
-1
votes
1 answer

how to I get Instruction hex code in x86?

section .data section .text global _start _start: mov eax, loop ; eax <- addr of loop mov ebx, new mov ecx, new mov esi, 2 loop: mov edx, [eax] ; edx <- instruction of loop, but not worked mov [ebx], edx add eax,…
김상엽
  • 15
  • 5
-1
votes
1 answer

How would I convert this assembly code to a hexadecimal form?

What is, MOV AX, 4512H MOV BX, 23AFH JMP NEXT ADD BH,AH NEXT: NOP in hexadecimal and how would I get there?
-1
votes
1 answer

How to encode POP instructions in 8086?

I'm trying to encode the following few instructions in 8086. I've learnt how the whole mod, reg, d, w and everything works. So, I can encode almost all the instructions like MOV [BX + 1234H], DS but I just cant seem to wrap my head around the PUSH…
dydx
  • 157
  • 15
-1
votes
2 answers

if (n!=0) n=0; v/s n=0; Which is more efficient and why?

While typing a program as a high level programmer, n = 0; looks more efficient and clean. But is n = 0; really more efficient than if (n != 0) n = 0;? when n is more likely to be 0. when n is less likely to be 0. when n is absolutely…
-1
votes
1 answer

Encode Instructions of Stack-based language to Bytecode

How can i encode in bytes a Language with instructions like "PUSH_k x" for an arbitrarily large x and k the number of bytes of x?
-1
votes
1 answer

Why are kilo, mega and giga - bytes named after "bytes", if they all have 10 of more bits when bytes have 8 bits?

I get why we have the number 1024 instead of 1000 to use the suffix "kilo" in computing (computer uses base 2, so 2 ^ 10, blah blah blah). So I get the kilo part, but why is it called a kilo - "byte"? To make a kilo - "byte", we need to use bits…
-1
votes
1 answer

Given the data path of the LC-3 (provided below), give a complete description of the STORE DIRECT instruction (ST SR, label), as follows

I've tried reading the book but I'm not sure exactly how to go about this. Anyone have an idea?
-1
votes
3 answers

One to one mapping translation in assembler

Assembly is a human readable language but it typically has a one to one relationship with the corresponding machine code. Therefore an assembler is said to perform isomorphic (one to one mapping) translation. I need to know what is meant by one…
gihansalith
  • 1,770
  • 5
  • 17
  • 21
-1
votes
2 answers

how do I figure out byte code for movq %rax, %rdi on osx?

I've taken a look at the ref.x86asm.net manual and while it has a lot of information, I can't really make heads or tails from it as I don't know how to interpret the registers. I'm using using 64 bit code and have a nearby line which lldb shows me…
Div
  • 130
  • 1
  • 14
-1
votes
1 answer

want to know how to write a machine code that run directly (without compiling)

I know about assembly language and machine code. A computer can usually execute programs written in its native machine language. Each instruction in this language is simple enough to be executed using a relatively small number of electronic…
-1
votes
1 answer

Tcl to MIPS Machine Code

I am trying to generate MIPS machine code out of Tcl script, however, up until now I haven't found any tools that can do that even to other processors. As fas as I know, Tcl has Tcl Assembly Language (TAL) which produces stack-based CISC, but this…
pakpik
  • 1