943,804 Members | Top Members by Rank

Ad:
  • Assembly Discussion Thread
  • Unsolved
  • Views: 22164
  • Assembly RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Jan 28th, 2007
0

Re: writing a a program in machine code

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.
Last edited by Purple Avenger; Jan 28th, 2007 at 12:27 am.
Reputation Points: 31
Solved Threads: 0
Light Poster
Purple Avenger is offline Offline
49 posts
since Jan 2007
Apr 19th, 2007
0

Re: writing a a program in machine code

Click to Expand / Collapse  Quote originally posted by ang19 ...
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
Reputation Points: 10
Solved Threads: 1
Newbie Poster
Garni is offline Offline
8 posts
since Feb 2007
Apr 9th, 2009
0

Re: writing a a program in machine code

Click to Expand / Collapse  Quote originally posted by ang19 ...
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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
JW1234 is offline Offline
3 posts
since Mar 2009
Apr 9th, 2009
0

Re: writing a a program in machine code

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 !!!!!!!!!!!!)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
JW1234 is offline Offline
3 posts
since Mar 2009
Apr 10th, 2009
0

Re: writing a a program in machine code

Lets take a look at a simple MASM32 program. Avoided invoke and macros for clarity.
Assembly Syntax (Toggle Plain Text)
  1. .386
  2. .model flat, stdcall
  3.  
  4. MessageBoxA PROTO :DWORD,:DWORD,:DWORD,:DWORD
  5. ExitProcess PROTO :DWORD
  6.  
  7. includelib \masm32\lib\user32.lib
  8. includelib \masm32\lib\kernel32.lib
  9.  
  10. .data
  11. msg_title db "Title", 0
  12. msg_str db "Text.", 0
  13.  
  14. .code
  15. start:
  16.  
  17. push 0
  18. push offset msg_title
  19. push offset msg_str
  20. push 0
  21. call MessageBoxA
  22.  
  23. push 0
  24. call ExitProcess
  25.  
  26. end start

A brief C version.
Assembly Syntax (Toggle Plain Text)
  1. #include <windows.h>
  2.  
  3. int main()
  4. {
  5. MessageBox(0, "Text.", "Title", MB_OK);
  6. return(0);
  7. }

Now, something you might see in a disassembler(@'s are xx's)
Assembly Syntax (Toggle Plain Text)
  1. 5469746C6500
  2. 546578742E00
  3.  
  4. 6A00
  5. 6800xxxxxx
  6. 6806xxxxxx
  7. 6A00
  8. E8xxxxxxxx
  9. 6A00
  10. E8xxxxxxxx
  11.  
  12. FF25xxxxxxxx
  13. FF25xxxxxxxx
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.
Reputation Points: 888
Solved Threads: 114
Nearly a Posting Virtuoso
MosaicFuneral is offline Offline
1,270 posts
since Nov 2008
Apr 10th, 2009
0

Re: writing a a program in machine code

JW1234:

Binary code and machine code are the same thing.
Reputation Points: 874
Solved Threads: 352
Posting Maven
BestJewSinceJC is offline Offline
2,758 posts
since Sep 2008
Dec 15th, 2009
0
Re: writing a a program in machine code
notice how this problem didn't get solved,
knowledge of this kind has disappeared and if you want it you must look for it everywhere. but people spitting in your face and slandering your language of choice is a bit annoying.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
hamiltonham is offline Offline
1 posts
since Dec 2009
Oct 24th, 2010
0

Two part solution of Mach1ne c0de

First,
Determine exactly what this code does or is intended to do.

Re-write that application in a language that you do know-
Berkeley BASIC comes to mind
-since you say you don't want to use K&H.

Second,
Assemble your new code. -
THEN
With a good Hex editor such as MASM or TASM or the like,
Compare your new asmbly code with this older asmbly code

Do While:
Continue to revise your high(er) level language subrt'n
UNTIL: your new ASM code matches the old ASM code.

At this point you'll have
(1) An app which creates this piece of code,
(2) An app that you can read ! and modify ! for future changes.
(3) Some good tools in-which to work with,
and
(4) Some good knowledge of ...well,
of a lot of things ...

like - what to stay away from the next time.


Shift-Stop




Click to Expand / Collapse  Quote originally posted by ang19 ...
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
Last edited by Shift-Stop; Oct 24th, 2010 at 12:38 am. Reason: keyboard didn't spell what I wished
Reputation Points: 10
Solved Threads: 1
Newbie Poster
Shift-Stop is offline Offline
11 posts
since Oct 2010
Feb 8th, 2011
0
Re: writing a a program in machine code
is there a way to decompile windows xp without any programming experience or experteese
Reputation Points: 10
Solved Threads: 0
Newbie Poster
welshhotty2010 is offline Offline
1 posts
since Feb 2011
Feb 8th, 2011
0
Re: writing a a program in machine code
"is there a way to decompile windows xp without any programming experience or experteese"

You might be able to disassemble it with a program like IDA Pro, but there is virtually no way of recovering the C source code.
Reputation Points: 14
Solved Threads: 4
Junior Poster
mathematician is offline Offline
149 posts
since Nov 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Assembly Forum Timeline: Can't set the vga color palette entrees
Next Thread in Assembly Forum Timeline: Assembly Beginner. Fahrenheit to Celsius Problem.





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC