Home /
Expert Answers /
Computer Science /
a-describe-the-difference-between-assembly-language-and-high-level-language-list-5-arguments-for-pa747
(Solved): a) Describe the difference between assembly language and high-level language. List 5 arguments for ...
a) Describe the difference between assembly language and high-level language. List 5 arguments for each language. (10 marks) b) Consider the following C programs in Table Q.5(b). Write the first 3 output sequence of print statement of Arduino code 1. What mathematical logic you can develop to maintain the speed in the Arduino code 1 given Table Q.5(b). You are not allowed to change the variable data but you can change the mathematical logic at line 11 . (5 marks) Table Q.5(b): Arduino C programs
c) Consider the Arduino assembly code shown in Table Q.5(c). Explain each instruction by using Atmega328p Instruction set and predict the output of the volatile byte variables. Also list the total number of cycles used by assembly code instructions in the Table Q.5(c). (5 marks) (Total : 20 marks)
Table Q.5(c): Arduino Assembly Language Program Arduino Assembly Code volatile byte a=0; volatile byte b=0; volatile byte c=0; void setup(){ Serial.begin(9600); asm("CLR r25"); asm volatile("LDI rl6, 0x04 \ ""); 1 asm volatile("DEC rl6");1 asm volatile("STS (a), r16 1n") );2 Serial.print(" a="); Serial.println(a); asm("CLR rl7"); asm volatile("LDI r17, 0x06 \n"); 1 asm volatile("INC r17"); 1 asm volatile("STS (b), r17 \n"); 2 Serial.print("b="); Serial.println(b); asm volatile("SUB r17, r16"); 1 asm volatile("STS (c), rl 17ln") ); 2 Serial.print("c =" "); Serial.println(c); \} void loop( \{ \}
A) Difference between assembly language and high-level language:Assembly Language:Assembly language is a low-level programming language that is tailored to a given processor architecture. It represents machine instructions using mnemonic codes and symbols.Assembly language permits direct manipulation of hardware components and registers, providing precise control over hardware resources.Assembly language instructions are closely related to machine code instructions, which makes it efficient and provides fine-grained control over system resources.Assembly language lacks high-level abstractions such as functions, data structures, and complicated control flow elements. It necessitates the explicit management of low-level information.Platform-specific: Assembly language programmes are architecture-specific and must be rewritten or modified when targeting other hardware.High-Level Language:Abstraction and readability: High-level languages provide abstractions and syntax that are closer to human-readable code, making it easier to write and understand programs.Portability: High-level languages are designed to be platform-independent, allowing programs to run on different systems without major modifications.Rich libraries and tools: High-level languages have extensive libraries and tools that provide pre-built functions and frameworks, speeding up development time.Complex data structures and algorithms: High-level languages offer built-in data structures and algorithms, making it easier to handle complex computations and data manipulation.Rapid development: High-level languages enable faster development due to their high-level abstractions and the availability of libraries, resulting in shorter development cycles.