Tuesday, October 7, 2008

MCS213 Report




Intel 8048


-The Intel 8048 microcontroller

-Intel's first microcontroller

-was used in the Magnavox Odyssey² video game console

-The 8048 is probably the most prominent member of Intel's MCS-48 family of microcontrollers.

-A 8048-family chip with UV EPROM, the 8749.

-This one is made by NEC.

-The 8048 has a Modified Harvard architecture, with internal or external program ROM and 64–256 bytes of internal (on-chip) RAM.

-Though the 8048 was eventually replaced by the very popular Intel 8051/8031, even at the turn of the millennium it remains quite popular, due to its low cost, wide availability, memory efficient one-byte instruction set, and mature development tools.

-Because of this it is much used in high-volume consumer electronics devices such as TV sets, TV remotes, toys, and other gadgets where cost-cutting is essential.




Intel 8051

-The Intel 8051 is a Harvard architecture

-single chip microcontroller which was developed by Intel in 1980 for use in embedded systems.

-Intel's original versions were popular in the 1980s and early 1990s
-8051-compatible devices manufactured by more than 20 independent manufacturers including Atmel, Infineon Technologies (formerly Siemens AG), Maxim Integrated Products (via its Dallas Semiconductor subsidiary), NXP (formerly Philips Semiconductor), Nuvoton (formerly Winbond), ST Microelectronics, Silicon Laboratories (formerly Cygnal), Texas Instruments and Cypress Semiconductor.

-Intel's official designation for the 8051 family of µCs is MCS 51.
http//www.wikipedia.com/

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:

#include
#define perkilo 25.5


/* Programmed by Harvey Losin *//* http://www.bikoy.com/harvey *//* webmaster@bikoy.com */
main()
{int kilo;
float amount;
clrscr();

printf("This program will ask the user to input the kilos");
printf("\n How many kilos of rice you want to buy?:");
scanf("%d",&kilo);
amount=perkilo*kilo;
printf("\nThe price per kilo of rice is P%d,perkilo");
printf("\nThe kilos of rice you bought is %d",kilo);
printf("\nYou will pay P%f",amount);
getch();
}

http://www.harveys.com/

Wednesday, October 1, 2008

Question # 5:

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



Answer:


The most recent assembler is the c++:


History



Many credit the origin of the name "C" as being a follow-on to APL (A Programming Language) and then BCPL, (B Computer Programming Language), or just plain "B" as it was most commonly called. APL was completely different in concept. With B, the original idea was to create machine code that was as closely identical to coding in assembly as possible, along with library functions for input/output, mathematical functions, etc. For the purists who thought it necessary to program in assembly to get full performance, it allowed the opportunity to program at a higher level and achieve better productivity. C is very similar to B, and while is not as efficient as B, it is available for a much greater variety of processors and platforms.



Stroustrup began work on C with Classes in 1979. The idea of creating a new language originated from Stroustrup's experience in programming for his Ph.D. thesis. Stroustrup found that Simula had features that were very helpful for large software development, but the language was too slow for practical use, while BCPL was fast but too low-level to be suitable for large software development. When Stroustrup started working in AT&T Bell Labs, he had the problem of analyzing the UNIX kernel with respect to distributed computing. Remembering his Ph.D. experience, Stroustrup set out to enhance the C language with Simula-like features. C was chosen because it is general-purpose, fast, portable and widely used. Besides C and Simula, some other languages which inspired him were ALGOL 68, Ada, CLU and ML. At first, the class, derived class, strong type checking, inlining, and default argument features were added to C via Cfront. The first commercial release occurred in October 1985.


In 1983, the name of the language was changed from C with Classes to C++ (++ being the increment operator in C and C++). New features were added including virtual functions, function name and operator overloading, references, constants, user-controlled free-store memory control, improved type checking, and BCPL style single-line comments with two forward slashes (//). In 1985, the first edition of The C++ Programming Language was released, providing an important reference to the language, since there was not yet an official standard. In 1989, Release 2.0 of C++ was released. New features included multiple inheritance, abstract classes, static member functions, const member functions, and protected members. In 1990, The Annotated C++ Reference Manual was published. This work became the basis for the future standard. Late addition of features included templates, exceptions, namespaces, new casts, and a Boolean type.


As the C++ language evolved, a standard library also evolved with it. The first addition to the C++ standard library was the stream I/O library which provided facilities to replace the traditional C functions such as printf and scanf. Later, among the most significant additions to the standard library, was the Standard Template Library.



Nature



C++ provides more than 30 operators, covering basic arithmetic, bit manipulation, indirection, comparisons, logical operations and more. Almost all operators can be overloaded for user-defined types, with a few notable exceptions such as member access (. and .*). The rich set of overloadable operators is central to using C++ as a domain specific language. As a simple example, a class that represents a matrix could overload the multiplication (*) and other arithmetic operators, allowing it to be treated by application code similarly to the standard numerical types.:


matrix A, B;
matrix C = A * B;


The overloadable operators are also an essential part of many advanced C++ programming techniques, such as smart pointers.


Overloading an operator does not change the precedence of calculations involving the operator, nor does it change the number of operands that the operator uses (any operand may however be ignored).



C++ Templates support generic programming. Function (or method) templates and class templates are supported. C++ templates are implemented by expansion : at compile-time, there is a complete expansion of the function or class template. Template expansion is a very powerful concept that can lead to optimized code, and to policy-based template metaprogramming. However, with this power there is also a cost. The expansion may increase code size, since for each type using the template at compile time, a duplicate of the templatized code is made: one copy for each type. This is in contrast to template type erasure seen in other languages (Java programming language) where at compile-time the type is erased and a single template body is preserved.







http://www.answers.com/

Tuesday, September 23, 2008

Question # 4:

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


Answer:

Assembly language are generally very simple, unlike in a high-level language. Each instruction typically consists of an operation or opcode plus zero or more operands. Most instructions refer to a single value, or pair of values. Generally, an opcode is a symbolic name for a single executable machine language instruction. Operands can be either immediate (typically one byte values, coded in the instruction itself) or the addresses of data elsewhere in storage.


Most assemblers also support pseudo-operations, which are directives obeyed by the assembler at assembly time instead of the CPU at run time. (For example, pseudo-ops would be used to reserve storage areas and optionally set their initial contents.) Often the names of pseudo-ops start with a dot to distinguish them from machine instructions.


Most assemblers provide flexible symbol management, letting programmers manage different namespaces, automatically calculate offsets within data structures, and assign labels that refer to literal values or the result of simple computations performed by the assembler. Labels can also be used to initialize constants and variables with relocatable addresses.


Assembly languages, like most other computer languages, allow comments to be added to assembly source code that are ignored by the assembler. Good use of comments is even more important with assembly code than with higher-level languages.

http://www.wikipedia.com/

Wednesday, September 17, 2008

Tuesday, September 16, 2008

Question # 3:

Research in the net what is the best assembler and why.



Answer:
High-level assemblers is the best assembler because it can provide language abstractions such as:


1. Advanced control structures .


2. High-level procedure/function declarations and invocations .


3. High-level abstract data types, including structures/records, unions, classes, and sets .


4. Sophisticated macro processing .


5.Object-Oriented features such as encapsulation, polymorphism, inheritance, interfaces .





http://en.wikipedia.org/wiki/Assembly_language#Assembler

Question # 2:

Research in the net usual applications done in assembly language. Describe these applications briefly and cite the efficiency and effectiveness of these applications.


Answer:
Typical Application:
Hard-coded assembly language is typically used in a system's boot ROM(BIOS on IBM-compatible PC systems). This low-level code is used, among other things, to initialize and test the system hardware prior to booting the OS, and is stored in ROM. Once a certain level of hardware initialization has taken place, execution transfers to other code, typically written in higher level languages; but the code running immediately after power is applied is usually written in assembly language.

Many compilers render high-level languages into assembly first before fully compiling, allowing the assembly code to be viewed for debugging and optimization purposes. Relatively low-level languages, such as C, often provide special syntax to embed assembly language directly in the source code. Programs using such facilities, such as the Linux kernel, can then construct abstractions utilizing different assembly language on each hardware platform.

The system's portable code can then utilize these processor-specific components through a uniform interface.
Assembly language is also valuable in reverse engineering, since many programs are distributed only in machine code form, and machine code is usually easy to translate into assembly language and carefully examine in this form, but very difficult to translate into a higher-level language. Tools such as the Interactive Disassembler make extensive use of disassembly for such a purpose.

A particular niche that makes use of assembly language is the demoscene. Certain competitions require the contestants to restrict their creations to a very small size (e.g. 256B, 1KB, 4KB or 64 KB), and assembly language is the language of choice to achieve this goal.

When resources, particularly CPU-processing constrained systems, like the Amiga and the Commodore 64, are a concern, assembler coding is a must: optimized assembler code is written "by hand" and instructions are sequenced manually by the coders in an attempt to minimize the number of CPU cycles used; the CPU constraints are so great that every CPU cycle counts. However, using such techniques has enabled systems like the Commodore 64 to produce real-time 3D graphics with advanced effects, a feat which would be considered unlikely or even impossible for a system with a 0.99MHz processor.

http://en.wikipedia.org/wiki/Assembly_language#Assembly_language