Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » Machine code (assembly language) HELP!
Closed Thread
Old 12-09-2005, 07:52 AM   #1 (permalink)
 
Newb Techie

Join Date: Dec 2005

Posts: 1

Outkazt

Default Machine code (assembly language) HELP!

Hello. I am really confused.

I am trying to help my son do his assignment on machine code and it is making no sense to me or him. Was wondering if somebody here would be kind enough to shead some light on the subject!

He has to write a program in the machine language to compute the sum of 4 numbers stored in memory addresses A1, A2, A3, A4. The program should first introduce 4 hexadecimal numbers in 2Â’s complement notation in the corresponding memory cells and the result of the addition should be stored at memory location A5.

Then it must be tested with floating point numbers and negative numbers.

The testing isn't so hard, it's just the actual code!! We are both stumpted!

Appreciate any advice on this if anyone is kind enough to offer a helping hand!

Kind Regards
Outkazt is offline  
Old 12-13-2005, 10:01 AM   #2 (permalink)
office politics's Avatar
 
It's all just 1s and 0s

Join Date: Jan 2004

Location: in the lab

Posts: 4,410

office politics will become famous soon enough

Default

when i was in school writing machine code, they forced me to create a flowchart before starting to write every program. Then, I'd write my code following the flowchart. I suggest you & your boy follow this practice. If you get stuck on a piece of code post it and we'll try to help you out.
office politics is offline  
Old 12-13-2005, 04:46 PM   #3 (permalink)
Chankama's Avatar
 
Monster Techie

Join Date: Jan 2005

Location: Canada

Posts: 1,522

Chankama will become famous soon enough

Default

Well are you "sure" you mean "machine language"? There is a difference between machine language and "assembly language".

Assembly language is a more "user friendly" representation of machine code. In assembly language, what you write consists of commands like "mov, rts, bra", etc. (move, return, branch, etc.)

Where as, machine code consists of 0's and 1's only.

It's been a while since I've written machine code, but, the best way to do is write the assembly code first, and then goto and figure out the equivalent machine opcode from the manual and write that in after.

So to write "machine code", the best way to do it is in 2 phases. 1) Assembly and then 2) machine.
Chankama is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On