Assembly language coding problems .

In summary: Machine code" is just a way of representing the instructions as ones and zeros. Assembly language is a set of instructions that a computer can understand.
  • #1
bengaltiger14
138
0
Assembly language coding problems...

Homework Statement



I am an electrical engineering student and have some HW problems. On the IAS system, what would machine code instruction look like to load the contents of memory address 2??

I came up with 00001001. Does this look correct?? Also, symbolic respresentation would be: LOAD MQ, M(0010)


Homework Equations





The Attempt at a Solution

 
Physics news on Phys.org
  • #2
So for those of us who don't understand what you are asking about, but are willing to help, could you please tell us what IAS is? I've coded a lot of assembly, but I'm unfamiliar with the term IAS. But it could be some new standard that I'm not familiar with yet.

And the title of your thread says "Assembly language" but you appear to be asking about a machine language byte. Those are not the same, correct?
 
  • #3


I must be using the same textbook; I am also unsure of this one. berkeman - IAS is a kind of computer that was completed in 1952 and is the prototype of all subsequent general purpose computers. It had a total of 21 instructions and 1000 words of 40 bits each for memory. Each word has a left and right instruction, 20 bits each, first 8 bits are the opcode (tells it to ADD, STOR, SUB, MUL, LOAD, etc) and last 12 bits are the address.

For the above question I came up with 000010010000000010 or LOAD reg(1), mem(2). According to the IAS instruction chart provided in the book, 00001001 is the opcode for "LOAD MQ,M(X) (transfer contents of memory location X to register MQ)". and the remaining 12 bits I assume should say "2" because that's what memory location we want?

Also, just for clarification, "machine code" refers to ones and zeros, and "Assembly Language" is using instructions like LOAD, ADD, etc?
 
  • #4


annika2450 said:
I must be using the same textbook; I am also unsure of this one. berkeman - IAS is a kind of computer that was completed in 1952 and is the prototype of all subsequent general purpose computers. It had a total of 21 instructions and 1000 words of 40 bits each for memory. Each word has a left and right instruction, 20 bits each, first 8 bits are the opcode (tells it to ADD, STOR, SUB, MUL, LOAD, etc) and last 12 bits are the address.

For the above question I came up with 000010010000000010 or LOAD reg(1), mem(2). According to the IAS instruction chart provided in the book, 00001001 is the opcode for "LOAD MQ,M(X) (transfer contents of memory location X to register MQ)". and the remaining 12 bits I assume should say "2" because that's what memory location we want?
You're missing a few bits. You have only 18, not 20, bits. It helps to group them in 4s to make it easier to read and count, e.g. 0000 1001 0000 0000 0010.

It's also possible that the question is referring to load the contents at location 2 into the accumulator: LOAD M(2).
Also, just for clarification, "machine code" refers to ones and zeros, and "Assembly Language" is using instructions like LOAD, ADD, etc?
Yeah.
 
  • #5


As an AI, I do not have the ability to solve coding problems or provide specific solutions. However, I can provide some general information about assembly language coding.

Assembly language is a low-level programming language that is used to write instructions that can be directly executed by a computer's processor. These instructions are known as machine code instructions and are represented by a series of binary numbers.

In the IAS (Institute for Advanced Study) system, a machine code instruction to load the contents of memory address 2 would typically consist of two parts: an opcode and an address. The opcode is the part of the instruction that specifies the operation to be performed, and the address specifies the location of the data to be loaded.

In the IAS system, the LOAD instruction has an opcode of 01, which would be represented in binary as 0001. The address of memory address 2 would be represented in binary as 0010. Therefore, the complete machine code instruction to load the contents of memory address 2 would be 00010010.

In symbolic representation, this instruction would be written as LOAD M(0010). This means "load the contents of memory address 2 into the accumulator (MQ)".

It is important to note that assembly language coding can vary depending on the specific system and architecture being used. So, the exact machine code instruction and symbolic representation may differ in other systems.
 

1. What is Assembly language coding?

Assembly language coding is a low-level programming language that is used to write programs for computers. It is a symbolic representation of the machine code instructions that the computer's processor can understand and execute.

2. Why is Assembly language coding important?

Assembly language coding is important because it allows programmers to have direct control over the computer's hardware and resources. It also allows for efficient and optimized code, making it useful for tasks that require high performance.

3. What are some common challenges in Assembly language coding?

Some common challenges in Assembly language coding include working with complex and specialized syntax, managing memory and registers, and debugging difficult errors due to the lack of high-level language features such as error handling.

4. How does Assembly language compare to other programming languages?

Assembly language is typically considered a low-level language, meaning it is closer to the computer's hardware and is less abstract than high-level languages like Java or Python. It is often used for tasks that require direct access to hardware resources or for optimizing performance.

5. What are some resources for learning Assembly language coding?

There are many online tutorials, books, and courses available for learning Assembly language coding. Some popular resources include "Introduction to Assembly Language Programming" by Sivarama P. Dandamudi, "Assembly Language Step-by-Step" by Jeff Duntemann, and online platforms such as Codecademy and Coursera.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
5
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Programming and Computer Science
4
Replies
122
Views
13K
  • Programming and Computer Science
Replies
5
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
14K
Replies
6
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
12
Views
5K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
6K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
10K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
2K
Back
Top