DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   Assembly (http://www.daniweb.com/forums/forum125.html)
-   -   writing a a program in machine code (http://www.daniweb.com/forums/thread13919.html)

ang19 Nov 12th, 2004 8:14 am
writing a a program in machine code
 
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

mikeandike22 Nov 12th, 2004 6:52 pm
Re: writing a a program in machine code
 
i have one question. why would you want to write a program in machine code? I mean now with such advanced programming languages from c++ to even java is there any point to learning java.

sivaramanNainar Jan 23rd, 2007 3:42 am
Re: writing a a program in machine code
 
Hi you can write the Machine Code. Instead of writing mnemonics you can write opcodes in asm files , like
db 0aeh ;equal to far jmp instructions. Hope this will help u...

mathematician Jan 23rd, 2007 12:47 pm
Re: writing a a program in machine code
 
If you are that much of a masochist, you would have to get hold of the technical reference manual(s) for your processor, and look up how assembly language instructions are encoded into machine code.

Short of writing an operating system for a brand new model of computer, without any possibility of cross assembly, I can't imagine why anybody would want to do it.

Ancient Dragon Jan 23rd, 2007 6:22 pm
Re: writing a a program in machine code
 
Do universities teach that any more? I thought writing programs in machine code went out in the early 1960s, before punch cards were invented.

jbennet Jan 23rd, 2007 6:28 pm
Re: writing a a program in machine code
 
my dad used punchcards still at uni during the late 70's lol

Colin Mac Jan 24th, 2007 10:07 am
Re: writing a a program in machine code
 
There are valid reasons why someone would want to write a program in machine code, though I can't myself see why anyone would need to deal in binary. Anyhow, you can hand assemble code by swapping mneumonics with their opcodes, which are mainly giving in hex.

Ancient Dragon Jan 25th, 2007 12:03 pm
Re: writing a a program in machine code
 
Quote:

Originally Posted by Colin Mac (Post 305658)
There are valid reasons why someone would want to write a program in machine code

Only two I can think of
1) academic purposes

2) on obscure os that does not have an assembler

Purple Avenger Jan 27th, 2007 7:10 pm
Re: writing a a program in machine code
 
Quote:

Originally Posted by Ancient Dragon (Post 306252)
Only two I can think of
1) academic purposes

2) on obscure os that does not have an assembler

Patches are frequently applied in machine code. NASA's procurement process for Space Shuttle flight software had the vendor providing a "signed off" image. Subsequent fixes after image sign off were applied as machine code patches. I had 20 words of patch space to work with in the Shuttle's SP0 cockpit display processor. Split 8 here and 12 over there. A reassemply/recertification of the load image to collect them up together was too economically painful to think about. We did hex patches.

Obviously debuggers and such need to do it when they implement the ability to alter code on the fly, and OS internals often do a bit of it when applying patches to known broken apps before allowing them to execute. DOS 5 and later for example, patch the in memory image of applications built with a buggy version of the Rational Systems DOS extender before giving them control.

Ancient Dragon Jan 27th, 2007 7:16 pm
Re: writing a a program in machine code
 
Quote:

Originally Posted by Purple Avenger (Post 307254)
Patches are frequently applied in machine code. NASA's procurement process for Space Shuttle flight software had the vendor providing a "signed off" image. Subsequent fixes after image sign off were applied as machine code patches. I had 20 words of patch space to work with in the Shuttle's SP0 cockpit display processor. Split 8 here and 12 over there. A reassemply/recertification of the load image to collect them up together was too economically painful to think about. We did hex patches.

You proved my second reason (obscure os) -- not many people have the opportunity to program for a space shuttle. :)


All times are GMT -4. The time now is 2:14 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC