Presentation is loading. Please wait.

Presentation is loading. Please wait.

CPSC 110 - Pascal Brent M. Dingle Texas A&M University Chapter 1.

Similar presentations


Presentation on theme: "CPSC 110 - Pascal Brent M. Dingle Texas A&M University Chapter 1."— Presentation transcript:

1 CPSC 110 - Pascal Brent M. Dingle Texas A&M University Chapter 1

2 Here we will present some basic definitions and describe how to use DOS and the Turbo Pascal Environment. We will also look at a little history of Computer Science.

3 In the beginning… There were rocks and sticks. From that we now have computers. How that came to be will be discussed more in the next Chapter, for now we need to establish some basic skills and definitions.

4 Program, Software, Hardware A program is a set of instructions for a computer to follow. Software is a collection of programs used by a computer. Hardware is the actual physical machines that make up a computer installation.

5 Hardware – 5 Components Input devices Output devices CPU (central processing unit) Main memory Secondary memory

6 Input Devices An input device is any device that allows a person to communicate information to the computer. Mouse, keyboard, microphone, etc.

7 Output Devices An output device is anything that allows the computer to communicate information to the user. Monitor, printer, speaker, etc. Notice the book refers to monitors as display screens, video display terminals or VDTs. Do NOT confuse output devices with secondary memory !!!

8 CPU – Central Processing Unit This is where the real ‘brain’ of the computer is. Some examples of CPU’s are the 8086, 486 DX 2, Pentium II, Pentium III, etc. The CPU follows the instructions in a program and performs the necessary calculations.

9 Main Memory This is where the computer temporarily stores information needed to perform its operations. An example of this is RAM (random access memory). Think of it as ‘scratch paper’ (with each line and page numbered).

10 Secondary Memory (storage) Secondary memory is used for keeping a permanent record of information after (and before) the computer is used. Such information is stored in files. For example an MS-Word document is saved as a file, a program is saved as a file, a jpeg image is saved as a file, etc.

11 Secondary Memory (cont) Hard drives, floppy drives, tape drives and Read/Write CD-ROMS would be examples of secondary memory. Secondary Memory is also referred to as Auxiliary Memory or Auxiliary Storage. We will see more about memory later.

12 Hardware (continued) For most computers the CPU, main memory and secondary memory are placed together in some form of box. The CPU and main memory are generally placed on a motherboard. The secondary memory is now usually the hard disk drive, floppy disk drives and read/write CD-ROMS which ‘plug into’ the motherboard.

13 Hardware (continued 2) Notice in recent history we have increased the number and quantity of input and output devices – for example speakers and video recording devices. This has led to ‘cards’ being added to the motherboard, which allow the additional devices to be ‘plugged’ into the motherboard.

14 Software If it’s not hardware, then it’s software. Here we will be looking at: The Operating System Programs Data

15 Operating Systems You communicate to with the computer through the operating system. An operating system is really a program, but a specially designed one. DOS, Windows, UNIX, and Linux are all Operating systems. DOS stands for Disk Operating System.

16 Program A program is a set of instructions for the computer to follow.

17 Data The word data is often used in a variety of contexts. The general meaning of data is any information available to the computer. A more narrow usage of the word is in reference to the input to a program.

18 Programming Languages High-level languages Low-level languages

19 High level languages High level languages are designed to be easily read by humans and to make programs easier to write. Some examples are: Pascal, FORTRAN, BASIC, COBOL, C, Modula-2, Scheme and Ada.

20 High level languages (cont) High level language instructions are usually much more complicated than the CPU can immediately understand, however humans can usually figure them out quickly.

21 High level languages (cont 2) Most high level languages require a source code file to be created. A source code file is just a text file with a ‘special’ extension. For example the file: hello.pas is probably the source code file for a Pascal program that prints the message “hello.”

22 Low level languages Low level language instructions are easier for the CPU to understand than for humans to understand. Remember it this way: Computers think at a LOWER level than humans.

23 Low level languages (cont) An example of a low level language is assembly language. An instruction would look like: ADD X Y Z This would add the contents of memory address X and the contents of memory address Y and store the result at memory address Z. Obviously, right ? =)

24 Low level languages (cont 2) An even lower level language than assembly is machine language. In this language every instruction is a sequence of ones and zeros. For example the assembly command ADD X Y Z might be: 0110 1001 1010 1011 in machine language.

25 High versus Low The important thing you need to keep straight is that Pascal is a high level language and machine code is a low level language. So you might wonder how the computer understands high level languages…

26 Compilers For the computer to understand a high level language, such as Pascal, the high level source code must be translated into low level object code by a compiler.

27 DOS DOS stands for Disk Operating System You should become familiar with some of the DOS commands as YOU WILL BE QUIZZED/TESTED on THEM.

28 DOS – capital and lowercase DOS is NOT case sensitive – that means it does not care if you use capital or lowercase letters. The filename Howdy.paS, HOWDY.PAS, and howdy.pas are all the same to DOS.

29 DOS Commands - Format format a: will format the disk in drive a:

30 DOS Commands – dir dir will display the contents (files and subdirectories) of the current directory. dir a:\ will display the contents of the root directory of drive a: dir a: will display the contents of the current directory of drive a:

31 DOS Commands – changing drives If the current prompt is: a:\> then the current drive is a: To change to drive c: type: c: and press enter. The prompt will change to: c:\> (assuming the current directory of c is the root directory)

32 DOS Commands – type type howdy.pas will display the contents of the file named howdy.pas (if it exists in the current directory)

33 DOS Commands – copy copy oldfile.pas newfile.pas will copy the contents of oldfile.pas into the file newfile.pas (notice newfile.pas may be overwritten)

34 DOS Commands – CTRL-C Pressing CTRL-C while a DOS program is running should stop the program.

35 DOS Commands – erase erase dumbfile.pas will erase the file dumbfile.pas from the current directory (assuming it exists). The more common command to do this today is del. For example: del dumfile.pas would also erase the file dumfile.pas from the current directory.

36 DOS Commands – rename rename badname.pas newname.pas will rename the file badname.pas to newname.pas. The move command does something similar. For example you could also say: move badname.pas newname.pas and achieve the same effect – with some subtle differences.

37 DOS Commands – diskcopy diskcopy a: b: would copy ALL the contents of the disk in drive a: to the disk in drive b: This of course assumes the two disks are the same ‘size’ (i.e. you could not copy an entire hard drive onto a 3.5” floppy).

38 DOS Commands – diskcomp diskcomp a: b: will tell you if two disks are identical in content. This is useful after you have done a diskcopy.

39 DOS Wildcards The asterisk (*) and the question mark (?) act as wildcard characters in DOS. The * represents zero to many characters. The question mark represents 1 character.

40 DOS Wildcards – usage If you wanted to copy all the files with the.pas extension in the current directory of the c: drive to the a: drive you could type: copy c:*.pas a:

41 DOS Wildcards – usage If you had the files: bob1.pas, bob2.pas, bob3.pas and bob5.txt and you wanted to copy all 3 of the pascal files to the a: drive you could type copy 3 times, or you could type: copy bob?.pas a:

42 Directories DOS directories are tree structured, this implies a hierarchical relationship among directories. The top, or main directory, of a drive is the root directory. DOS directories may contain files and/or subdirectories.

43 DOS – directory commands mkdir (or just md) rmdir (or just rd) cd

44 DOS Commands – mkdir mkdir newdir creates a new directory named newdir. md newdir also creates a new directory named newdir.

45 DOS Commands – rmdir rmdir olddir removes the directory named olddir. rd olddir also removes the directory named olddir.

46 DOS Commands – cd cd prints the current directory path. cd \ takes you to the root directory of the current drive. cd mydir takes you into the subdirectory named mydir

47 Full Path Name A full path name is a list of directories you would pass through in going from the root directory to the file. If the drive letter is known it IS part of the full path name. (do not be misled by the textbook) The full path name ends with the filename.

48 Relative Path Name A relative path name is a list of directories to a file relative to the current directory. The relative path name ends with the filename.

49 Going up directories The directory named “..” is the directory above the current. So to move up a directory type: cd..

50 Using the Turbo Pascal Environment Please refer to the handout given in class and ATTEND THE LABS ! You will be quizzed/tested on how to use DOS and the Turbo Environment – so be prepared.


Download ppt "CPSC 110 - Pascal Brent M. Dingle Texas A&M University Chapter 1."

Similar presentations


Ads by Google