Thursday, October 9, 2008

FINAL QUESTION

Since not all MCS 213 students can try DEBUG commands because of the technical problems of our computers, search now any Turbo C program with assembly codes in it and run this in your PC. Check the result of your running C program.If the program produces the expected output, copy the Turbo C codes into your post and its result. YOu may do this by pressing Print Screen on your keyboard for the result of your program then, switch to Paint Brush and Paste. Resize the window and copy this to your post.


ANSWER:



main()


{
i = 0x0004;
_exit(0x0000);
_scanf(0x0194,&l_int_1);
if(i < i =" l_int_1;" l_char_1 =" 0x0004;" l_int_1 =" 0x0004;" k =" 0x0002;"> l_int_1) ? k : l_int_1)
{
case 0 :
if(i < i =" l_int_1;"> l_int_1)
{
if(l_char_1 == 0x0001)
{
_printf(0x01A3);
l_int_1 = 0x0004;
}
}
}
break;
case 22 :
_printf(0x01A7);
break;
case 19 :
_printf(0x01AA);
case -4 :
i = 0x0001;
break;
default :
i = 0x0000;
while(i < i =" i" k =" 0x0001;">

Tuesday, October 7, 2008

QUESTION # 5

Research in the net the most recent assembler. Describe its history, nature and applications. Evaluate this assembler from its predecessor.

Assembler
Compare with: Microassembler.
Typically a modern assembler creates object code by translating assembly instruction mnemonics into opcodes, and by resolving symbolic names for memory locations and other entities. The use of symbolic references is a key feature of assemblers, saving tedious calculations and manual address updates after program modifications. Most assemblers also include macro facilities for performing textual substitution—e.g., to generate common short sequences of instructions to run inline, instead of in a subroutine.
Assemblers are generally simpler to write than compilers for high-level languages, and have been available since the 1950s. Modern assemblers, especially for RISC based architectures, such as MIPS, Sun SPARC and HP PA-RISC, optimize instruction scheduling to exploit the CPU pipeline efficiently.
More sophisticated high-level assemblers provide language abstractions such as:
Advanced control structures
High-level procedure/function declarations and invocations
High-level abstract data types, including structures/records, unions, classes, and sets
Sophisticated macro processing
Object-Oriented features such as encapsulation, polymorphism, inheritance, interfaces .


Note that, in normal professional usage, the term assembler is often used ambiguously: It is frequently used to refer to an assembly language itself, rather than to the assembler utility. Thus: "CP/CMS was written in S/360 assembler" as opposed to "ASM-H was a widely-used S/370 assembler."


REFERENCE: WIKIPEDIA.ORG

Sunday, October 5, 2008

QUESTION #4

Justify what situations or applications programmers will rather use Assembly Languages than Higher Level Progamming Languages and vice versa.



When a stand-alone binary executable is required, i.e. one that must execute without recourse to the run-time components or libraries associated with a high-level language; this is perhaps the most common situation. These are embedded programs that store only a small amount of memory and the device is intended to do single purpose tasks. Such examples consist of telephones, automobile fuel and ignition systems, air-conditioning control systems, security systems, and sensors.
When interacting directly with the hardware, for example in device drivers.
When using processor-specific instructions not exploited by or available to the compiler. A common example is the bitwise rotation instruction at the core of many encryption algorithms.
Embedded systems.
When extreme optimization is required, e.g., in an inner loop in a processor-intensive algorithm. Some game programmers are experts at writing code that takes advantage of the capabilities of hardware features in systems enabling the games to run faster.
When a system with severe resource constraints (e.g., an embedded system) must be hand-coded to maximize the use of limited resources; but this is becoming less common as processor price/performance improves
When no high-level language exists, e.g., on a new or specialized processor
Real-time programs that need precise timing and responses, such as simulations, flight navigation systems, and medical equipment. (For example, in a fly-by-wire system, telemetry must be interpreted and acted upon within strict time constraints. Such systems must eliminate sources of unpredictable delays – such as may be created by interpreted languages, automatic garbage collection, paging operations, or preemptive multitasking. Some higher-level languages incorporate run-time components and operating system interfaces that can introduce such delays. Choosing assembly or lower-level languages for such systems gives the programmer greater visibility and control over processing details.)
When complete control over the environment is required (for example in extremely high security situations, where nothing can be taken for granted).
When writing computer viruses, bootloaders, certain device drivers, or other items very close to the hardware or low-level operating system.
When reverse-engineering existing binaries, which may or may not have originally been written in a high-level language, for example when cracking copy protection of proprietary software.
Reverse engineering and modification of video games (known as ROM Hacking), commonly done to games for Nintendo hardware such as the SNES and NES, is possible with a range of techniques, of which the most widely employed is altering the program code at the assembly language level.
Assembly language is still used for writing games and other software for graphing calculators.
Finally, compiler writers usually write software that generates assembly code, and should therefore be expert assembly language programmers themselves.

REFERENCE:
WIKIPEDIA.ORG