You can see lesson in this course by clicking on respective buttons.
Lesson-1-Computer-Components-and-their-Working-at-Hardware Level
Lesson-2-Information-is-Bits-and-Context
Lesson-3-Program-Translation
Lesson-4-Processor-Operations
Lesson-5-Cache
Lesson-6-Heirarchy-of-Storage-Devices
Lesson-7-Operating-System-Manages-Hardwares
Lesson-8-System-Communicate-with-other-Systems-using-Network
Lesson 9 Data Formats and Arithmetic Operations for each Format
Lesson 10 Data Sizes
Lesson 11 Addressing and Bytes Ordering
Lesson 12 Information Storage: How information is stored in a machine (computer system)? You will have to explain “Data Format” from lesson 9, “Data Sizes” from lesson 10 and “Addressing and Byte Ordering” from lesson 11.
Lesson 13 Representing String in memory: How will a string be stored in memory
Lesson 14 Boolean Algebra
Lesson 15 Bit Level Operations
Lesson 16 Logical Operations
Lesson 17 Shift Operations
Lesson 18 Integer Representation
Lesson 19 Integer Arithmetic Operations
Lesson 20 Floating Point Number
Lesson 21 Pipeline
Lesson 22 CISC and RISC Architecture
Lesson 23 Address Modes
Lesson 24 Interrupt
Lesson 25 Memory and Cache Organization
Lesson 26 I/O techniques (Memory mapped and isolated I/O)
Lesson 27 Intel x80-86 and MIPS Architecture
Lesson 28 JUMP
Experiments
Experiment-1-Installation-Simulation-Tool
Experiment-2-Arithmetic-Operations
Experiment-3-Designing-5-Stage-Single-Cycle-Processor
Experiment-4-Loop
Experiment-5-Branches
Question: How would you print a capital A with red foreground and green background with no blinking property? write its assembly code.
Solution:
.data
char_to_print: .byte 'A'
attribute: .word 0x0000FF00 # Red foreground (0x00FF0000), Green background (0x0000FF00)
.text
.globl main
main:
# Load the character to print into register $a0
la $a0, char_to_print
# Load the attribute into register $a1
lw $a1, attribute
# Load the system call code for printing a character with attribute (assuming it's syscall code 93)
li $v0, 93
# Perform the system call
syscall
# Exit the program
li $v0, 10 # Exit syscall code
syscall
Question: Discuss different logical instruction in assembly language.
Logical instructions in assembly language operate on individual bits or groups of bits within data operands. They are commonly used for bitwise manipulation, logical operations, and setting or clearing specific bits in registers or memory. Here are some common logical instructions and their descriptions:
- AND (Bitwise AND):
- The AND instruction performs a bitwise AND operation between each pair of corresponding bits in two operands and stores the result in a destination operand.
- Syntax:
AND destination, source
- Example:
AND AX, BX
(Performs bitwise AND between AX and BX, storing the result in AX)
- OR (Bitwise OR):
- The OR instruction performs a bitwise OR operation between each pair of corresponding bits in two operands and stores the result in a destination operand.
- Syntax:
OR destination, source
- Example:
OR AX, BX
(Performs bitwise OR between AX and BX, storing the result in AX)
- XOR (Bitwise XOR):
- The XOR instruction performs a bitwise exclusive OR (XOR) operation between each pair of corresponding bits in two operands and stores the result in a destination operand.
- Syntax:
XOR destination, source
- Example:
XOR AX, BX
(Performs bitwise XOR between AX and BX, storing the result in AX)
- NOT (Bitwise NOT):
- The NOT instruction performs a bitwise negation operation on a single operand, complementing each bit in the operand.
- Syntax:
NOT operand
- Example:
NOT AX
(Performs bitwise negation on AX, complementing each bit in AX)
Question: Discuss different machine control instruction in assembly language.
Machine control instructions in assembly language are used to control the flow of execution, manipulate program status, and interact with the underlying hardware. These instructions include those for branching, subroutine calls, interrupts, and processor control. Here are some common machine control instructions and their descriptions:
- JMP (Jump):
- Loop
- Branch
- INT (Software Interrupt):
- INT generates a software interrupt, causing the CPU to transfer control to a specific interrupt handler routine.
- Syntax:
INT interrupt_number
- Example:
INT 21h
(Generates interrupt 21h, commonly used for system calls in DOS)
- HLT (Halt):
- HLT halts the CPU, causing it to enter a low-power state until an interrupt occurs or a hardware reset is triggered.
- Syntax:
HLT
- Example:
HLT
(Halts the CPU)
- NOP (No Operation):
- NOP performs no operation and is commonly used for padding or alignment purposes.
- Syntax:
NOP
- Example:
NOP
(Does nothing)
- CLI and STI (Clear and Set Interrupt Flag):
- CLI clears the Interrupt Flag (IF), disabling interrupts, while STI sets the Interrupt Flag, enabling interrupts.
- Syntax:
CLI
andSTI
Question: Discuss different program control instruction in assembly language.
Answer is same as above but program control instructions will be applied on high level instruction. While, machine control instruction will be applied on low level instructions. The difference is explained below in detail.
- Machine Control Instructions:
- Machine control instructions are low-level instructions that directly manipulate hardware resources and processor state.
- They are responsible for controlling the operation of the CPU and interacting with peripherals and system components.
- Examples of machine control instructions include instructions for branching, interrupt handling, processor state manipulation, and system calls.
- These instructions often have direct effects on the hardware, such as changing the state of CPU flags, modifying memory contents, or interacting with I/O devices.
- Machine control instructions are closely tied to the hardware architecture and may vary between different processor architectures and systems.
- Program Control Instructions:
- Program control instructions are higher-level instructions that control the flow of execution within a program or software application.
- They are responsible for implementing program logic, executing algorithms, and managing the flow of control between different parts of the program.
- Examples of program control instructions include instructions for branching, looping, subroutine calls, and conditional execution.
- These instructions primarily affect the execution flow within the program and are used to implement higher-level constructs such as loops, conditionals, and function calls.
- Program control instructions are independent of the underlying hardware architecture and are designed to facilitate software development and programming tasks.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.