| | |
writing a a program in machine code
![]() |
•
•
Join Date: Jan 2007
Posts: 49
Reputation:
Solved Threads: 0
We had assemblers though. The SP0 wasn't all that obscure (in aerospace circles that is). Shuttle uses it, and the Navy's Harpoon missile is using them somewhere.
The DOS loader stuff isn't very obscure. Millions of copies of DOS 5 and later shipped.
Sometimes you simply can't get a commercial tool to produce what you need either. There's some hand assembled stuff in the guts of OS/2 because we couldn't get a compiler or assembler to spit out what was needed.
The DOS loader stuff isn't very obscure. Millions of copies of DOS 5 and later shipped.
Sometimes you simply can't get a commercial tool to produce what you need either. There's some hand assembled stuff in the guts of OS/2 because we couldn't get a compiler or assembler to spit out what was needed.
Last edited by Purple Avenger; Jan 28th, 2007 at 12:27 am.
•
•
Join Date: Feb 2007
Posts: 8
Reputation:
Solved Threads: 1
•
•
•
•
Hi have one querery regarding writing in machine code,
address- instruction
00000 001 10000
00001 010 10000
00010 100 10000
00011 110 10001
00100 111 00000
10000 000 00001
10001 000 11111
i dont know how to write a program in machine code, which adds up to the numbers stored in cell 11000 11001, 11010 and stores the sum in cell 11011.
any help would be much appreciated angela
for coding anything in machine code we need to stick to the processor what that is going to interpret the machine code. But still i have a doubt how u r going to run this file where u have the binaries. What is the OS u r going to rely up on. Make sure these things first.
OR u can do 1 thing, boot any system with ur own machine code. then dump this machine code in memory somewhere. Then move the processor registers like Iinstruction Pointers, Segment Register accourdingly. So that processor will start executing ur code. that all i can say 4 now.
thx,
Garni
•
•
Join Date: Mar 2009
Posts: 3
Reputation:
Solved Threads: 0
•
•
•
•
Hi have one querery regarding writing in machine code,
address- instruction
00000 001 10000
00001 010 10000
00010 100 10000
00011 110 10001
00100 111 00000
10000 000 00001
10001 000 11111
i dont know how to write a program in machine code, which adds up to the numbers stored in cell 11000 11001, 11010 and stores the sum in cell 11011.
any help would be much appreciated angela
This is not machine code this is BIANRY it is what assembly code is turned into, you need to be looking at how to learn ASSEMBLY LANGUAGE.
This can be written using a simple text editor like notepad and then with a suitable compiler like MASM or similar can be converted into an OBJECT file, this is then linked with a linker to produce an EXECUTABLE file if it is larger than 64K or a COM file if it is smaller than 64K
Cheers John
•
•
Join Date: Mar 2009
Posts: 3
Reputation:
Solved Threads: 0
This is what an 8086 assmebly language program looks like
.model small
.stack
.data
message db "Hello world, I'm learning Assembly !!!", "$"
.code
main proc <--- Start of program
mov ax,seg message <--- Message Seg to AX
mov ds,ax
mov ah,09 <--- I/O function
lea dx,message
int 21h <--- Execute & Return
mov ax,4c00h <--- Move 004Ch to register AX
int 21h <--- Execute Function & return
main endp
end main
John (no clues guessing what it does !!!!!!!!!!!!)
.model small
.stack
.data
message db "Hello world, I'm learning Assembly !!!", "$"
.code
main proc <--- Start of program
mov ax,seg message <--- Message Seg to AX
mov ds,ax
mov ah,09 <--- I/O function
lea dx,message
int 21h <--- Execute & Return
mov ax,4c00h <--- Move 004Ch to register AX
int 21h <--- Execute Function & return
main endp
end main
John (no clues guessing what it does !!!!!!!!!!!!)
Lets take a look at a simple MASM32 program. Avoided invoke and macros for clarity.
A brief C version.
Now, something you might see in a disassembler(@'s are xx's)
That right there would be 427 ones and zeros, not including another KB of padding, headers, and tables. So unless you're one hardcore programmer, coding in machine code is beyond the scope of convention.
P.S. No one uses binary while dealing with op-codes.
Assembly Syntax (Toggle Plain Text)
.386 .model flat, stdcall MessageBoxA PROTO :DWORD,:DWORD,:DWORD,:DWORD ExitProcess PROTO :DWORD includelib \masm32\lib\user32.lib includelib \masm32\lib\kernel32.lib .data msg_title db "Title", 0 msg_str db "Text.", 0 .code start: push 0 push offset msg_title push offset msg_str push 0 call MessageBoxA push 0 call ExitProcess end start
A brief C version.
Assembly Syntax (Toggle Plain Text)
#include <windows.h> int main() { MessageBox(0, "Text.", "Title", MB_OK); return(0); }
Now, something you might see in a disassembler(@'s are xx's)
Assembly Syntax (Toggle Plain Text)
5469746C6500 546578742E00 6A00 6800xxxxxx 6806xxxxxx 6A00 E8xxxxxxxx 6A00 E8xxxxxxxx FF25xxxxxxxx FF25xxxxxxxx
P.S. No one uses binary while dealing with op-codes.
"Jedenfalls bin ich überzeugt, daß der Alte nicht würfelt."
"I became very sensitive to what will happen to all this and all of us." -Two geniuses named Albert
"I became very sensitive to what will happen to all this and all of us." -Two geniuses named Albert
![]() |
Other Threads in the Assembly Forum
- Previous Thread: Performance issue in code
- Next Thread: help in`assembly project
| Thread Tools | Search this Thread |






