Sunday, October 5, 2008

Question in 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
#include
#include
#include
#include
#include

unsigned char buffer[3];
FILE *fd;
int handle;
fail(char *);
void pass(char *);
main(int argc,char *argv[])
{
int n;
if(argc!=3)
{
printf("\nFailpass Utility v1.0 Email: chingpongin@yahoo.co.in");
printf("\nEnable/Disable .EXE or .COM execution");
printf("\nsyntex failpass fail ");
printf("\n or");
printf("\n failpass pass ");
exit(2);
}
strupr(argv[1]);
n=strcmp(argv[1],"FAIL");
if(n==0)
{
fail(argv[2]);
exit(2);
}
n=strcmp(argv[1],"PASS");
if(n==0)
{
pass(argv[2]);
exit(2);
}
return 0;
}
fail(char *fname)
{
_chmod(fname,1,FA_ARCH);
fd=fopen(fname,"rb+");
if(fd==NULL)
{
printf("\nCann't open %s\n\n",fname);
exit(2);
}
fseek(fd,0,SEEK_SET);
fread(buffer,2,1,fd);
if(buffer[0]==0xcd)
if(buffer[1]==0x20)
{
fclose(fd);
printf("\n%s already protected...\n\n",fname);
exit(2);
}
fseek(fd,0,SEEK_END);
fwrite(buffer,2,1,fd);
fseek(fd,0,SEEK_SET);
buffer[0]=0xcd; /* don't take any PANGA with this line */
buffer[1]=0x20; /* don't take any PANGA with this line */
fwrite(buffer,2,1,fd);
fclose(fd);
return 0;
}
void pass(char *fname)
{
int xyz;
fd=fopen(fname,"rb+");
if(fd==NULL)
{
fclose(fd);
printf("\nCannot open file %s\n\n",fname);
exit(2);
}
fseek(fd,0,SEEK_SET);
fread(buffer,2,1,fd);
if(buffer[0]!=0xcd)
if(buffer[1]!=0x20)
{
fclose(fd);
printf("\n%s is NOT protected....\n\n",fname);
exit(2);
}
fseek(fd,-2,SEEK_END);
fread(buffer,2,1,fd);
fseek(fd,0,SEEK_SET);
fwrite(buffer,2,1,fd);
fclose(fd);
handle=open(fname,O_RDWR);
chsize(handle,(filelength(handle))-2);
close(handle);
}






Jiacler Y. Tanap

Wednesday, September 24, 2008

Qeustion #4

QUESTION #4: Justify what situations or applications programmers will rather use Assembly Languages than Higher Level Programming Languages and vice versa.

Answer:

The
typically used in a system's boot ROM(BIOS on IBM-compatible PC system)The Hard-coded assembly language .This low level code is to initialized and test the system hardware prior to booting the OS, and use among he other thing.
A certain level of hardware initialized 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.
The same is true of most boot loaders.
The system's portable code can then utilize these processor-specific components through a uniform interface.


Reference:
http://wikipedia.org/,
http://google.com/



Jiacler Y. Tanap

Thursday, September 18, 2008

Queation #3


Question #3:Research in the net what is the best assembler and why?


Answer:
In1990s alternative assemblers such as Borland TASM, the shareware assembler A86, and NASM began to take some of MASM's market share. However, two events in the late 1990s allowed MASM to retain much of its market share. First, Microsoft ceased selling MASM as a commercial product and began distributing it free of charge as part of the Driver development kit. Second, the MASM32 package and Iczelion's Win32 tutorials appeared, making Windows' application programming with MASM possible. Later in 2000, MASM 6.15 was released as p art of the Visual C++ Processor Pack, which is free. As a result, all versions of Visual C++ later than 6.0, included a version of MASM equal to the version of Visual C++. Later in Visual C++ 2005, a 64-bit version of MASM appeared

(file name is ml64.exe). Combined with the huge installed base of MASM users, these events helped stem the defection from MASM to other assemblers.

Today, MASM is still the most popular assembler, despite competition from new products such as NASM and Yasm, FASM, and HLA. There are several other assemblers which are either use MASM's syntax or are designed for Windows, including RosAsm, POASM, GoASM and JWasm. RosAsm is a monolithic assembler and IDE developed for but independent from the rectos project. It is distributed under the GPL licence. POASM comes with Palles C and is Freeware while JWasm is a open source fork of the open Wactom assembler.www.wikipedia.org

References:
  1. ^ a b Randall Hyde. "Which Assembler is the Best?". Retrieved on 2008-06-27.
  2. ^ "RosASM Homepage". Retrieved on 2008-06-27.
  3. ^ japheth (2008-06-21). "JWasm". Retrieved on 2008-06-27.
  4. ^ "RadASM". Retrieved on 2008-06-27.
  5. ^ "OllyDbg" (2008-05-24). Retrieved on 2008-06-27.
  6. ^ hutch. "hutch's home page". Retrieved on 2008-06-27.
  7. ^ "The Masm Forum". Retrieved on 2008-06-27.
  8. ^ "Easy Code". Retrieved on 2008-06-27.
  9. ^ "What is MASM". Retrieved on 2008-06-27.

Jiacler Y. Tanap

Tuesday, September 16, 2008

Question #2

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:
A motor controller is a device or group of devices that serves to govern in some predetermined manner the performance of an electronic Motor. A motor controller might include a usual done in Assembly Language or automatic means for starting and stopping the motor, selecting forward or reverse rotation, selecting and regulating the speed, regulating or limiting the torque, and protecting against overloads and faults. Motor controller in an MCC can be specified with a range of options such as separate control transformers, pilot lamps, control switches, extra control terminal blocks, various types of bi-metal and solid-state overload protection relays, or various classes of power fuses or types of circuit breakers. A motor control center can either be supplied ready for the customer to connect all field wiring, or can be an engineered assembly with internal control and interlocking wiring to a central control terminal panel board or programmable controller.www.wikipedia.com

Jiacler Y. Tanap




Wednesday, September 10, 2008

Qeuetion #1

Question #1: What topic(s) in MCS 213 do you find easy and/or difficult and why?

Answer: The topic that I have encountered that is easy to me in subject MCS213 is Conversion. I chose this topic because it is easy to understand, familiar and I read already the book regarding this topic before I take this subject. The instructor also teach or explain the topic in the easiest way.
But when it apply the conversion to the program it seems difficult to me.


Jiacler Y. Tanap