INTRODUCTION TO PROGRAMMING THE 8086

Size: px
Start display at page:

Download "INTRODUCTION TO PROGRAMMING THE 8086"

Transcription

1 SAMPLE HELLO WORLD PROGRAM The following example shows a program that displays the traditional Hello, world! message on the screen. It contains the essential ingredients of an assembly language application. TITLE Program Hello World by Andrew H. Andersen, Jr. PAGE 60,132 ; Written Andrew H. Andersen, Jr. ; Brookdale Community College ; ELEC 242 ; Assignment x.model SMALL ; Setup a Stack.STACK 2000H ;Define values for predefined data.data prnt equ 9 done equ 4c00h msg db Hello world db 0Dh,0Ah,0Ah, $ ; We could also reserve storage for use ; under program control ; This is where we state what we want done ; We begin with a Main Procedure declaration.code.startup ; Now we should load the Data Segment register mov ax,@data mov ds,ax ; This program uses an MS/DOS BIOS function ; to send a message to the screen mov ah,prnt lea dx,msg int 21h ;or mov dx,offset msg ; The following 2 statements return control ; back to DOS since we are finished fini: mov ax,done int 21h.exit end Page 1

2 Here is a brief description of the important lines in the program: Line 1 contains the Title directive; all remaining characters on the line are treated as comments as are all characters on line 4. The source code for this program was written in assembly language and must be assembled into machine language before it can run. This program is compatible with both the Microsoft and Borland assemblers. Segments are the building blocks of programs: The code segment is where program instructions are stored; the data segment contains all variables, and the stack segment contains the program s runtime stack. The stack is a special area of memory that the program uses when calling and returning from subroutines. The.model small directive indicates that the program uses a maximum of 64K of memory for code, and 64K of memory for data. The.stack directive sets aside 2000h (8192) bytes of stack space for the program. The.data directive indicates the beginning of the data segment where variables are stored. In the declaration of message, the assembler allocates a block of memory to hold the string containing Hello, world!, along with two bytes containing a ASCII sequence in MS/DOS for the newline character sequence (0Dh for Carriage Return and 0Ah for LineFeed). The $ is a required string terminator character for the MS/DOS Function 9 console output routine being used. The.code directive indicates the beginning of the code segment. This is where the executable instructions are located..startup is an MASM directive that identifies the starting point of the program. The first two statements in the code segment are used to initialize the address of the data segment into the DS register. The next two statements in the code segment initialize two register for the MS/DOS Print Function. The entry requirements are We must load the address of a string into the DX register. DX is used as an address pointer and required by the routine. The MS/DOS BIOS function number is placed in the AH register. INT 21H causes DOS to execute the function The last two executable statements (beginning with the label fini) is the normal MS/DOS process end statement. This causes the program to halt and return control to the operating system..exit is the MASM directive, which is usually near the end directive. The last line of the program contains the end directive. This is the last line of the program to be assembled. Anything placed in an asm file after the end directive will be ignored by the assembler. After creating the Hello World source code program with a text editor, we would save it with the name HELLO.ASM. We would then invoke the assembler with the command: ml /Fl hello.asm The assembler would create an HELLO.OBJ, HELLO.LST, and HELLO.EXE. Entering the command HELLO at the MS/DOS prompt would cause the program to execute and display the message on the CRT. Here are the contents of HELLO.LST Page 2

3 Microsoft (R) Macro Assembler Version /29/00 08:36:36 Program Hello World by Andrew H. Andersen, Jr. Page 1-1 TITLE Program Hello World by Andrew H. Andersen, Jr. PAGE 60,132 ; Written Andrew H. Andersen, Jr. ; Brookdale Community College ; COMP ; Assignment x.model SMALL ; Setup a Stack.STACK 2000H ;Define values for predefined data 0000.DATA = 0009 prnt equ 9 = 4C00 done equ 4c00h C 6C 6F 20 msg db Hello world 77 6F 72 6C B 0D 0A 0A 24 db 0Dh,0Ah,0Ah, $ 0000.CODE.startup ; We could also reserve storage for use ; under program control ; This is where we state what we want done ; We begin with a Main Procedure declaration ; Now we should load the Data Segment register 0017 B R mov ax,@data 001A 8E D8 mov ds,ax ; This program uses an MS/DOS BIOS function ; to send a message to the screen 001C B4 09 mov ah,prnt 001E 8D R lea dx,msg ;or mov dx,offset msg 0022 CD 21 int 21h 0024 B8 4C00 fini: mov ax,done 0027 CD 21 int 21h ; The following 2 statements return control ; back to DOS since we are finished.exit end Page 3

4 Microsoft (R) Macro Assembler Version /16/00 11:49:32 Program Hello World by Andrew H. Andersen, Jr. Symbols 2-1 Segments and Groups: N a m e Size Length Align Combine Class DGROUP GROUP _DATA Bit 000F Word Public DATA STACK Bit 2000 Para Stack STACK _TEXT Bit 002D Word Public CODE Microsoft (R) Macro Assembler Version /16/00 11:49:32 Program Hello World by Andrew H. Andersen, Jr. Symbols 3-1 Symbols: N a m e Type Value Number Number Number Number L Near 0000 Text Text Text Text Text DGROUP done Number 4C00h fini L Near 0024 _TEXT msg Byte 0000 _DATA prnt Number 0009h 0 Warnings 0 Errors In C, the Hello World program source code is much smaller, and might be like the following: /* Hello World Program Written by Andrew H. Andersen, Jr. */ #include #include <stdio.h> <string.h> char msg[] = Hello world ; main() { printf( %s\n\n,msg); return 0 } This program would be called HELLO.C After compiling we will have an object file. Although the source program length is shorter in C, the executable program created by a C compiler may be over 12 times larger than the assembler version (over 8000 bytes vs. less than 600 bytes) Page 4

5 WRITING ASSEMBLY LANGUAGE PROGRAMS We are all aware that the English Language has specific rules that must be observed. Assembly language statements also have rules, which must be observed if we wish to have our program assembled. The source line in an assembly language statement is analogous to a sentence. The assembler recognizes three types of source lines: instructions, directives, and control. The assembly language instruction and assembler directives may consist of up to four fields as follows: NAME: OPCODE OPERAND ;COMMENT Any number of blanks may separate the fields, but they must be separated by at least one delimiter. Each statement must appear on a single line, and is terminated with a. The maximum length of an assembly language statement is 128 characters. The characters that may be used in assembly language source statements are the letters of the alphabet, and the digits 0 through 9. Most of the other printable characters may be used, although some of these characters are reserved. In addition, any ASCII character may appear in a data string enclosed in a single quote. Both upper and lower case alphabetical characters may be used, and most assemblers treat uppercase and lowercase characters as the same. For instance Val and val are treated as the same label or name. When a program displays data strings enclosed in single quotes, they are printed exactly as they appear. Certain characters have special meaning to the assembler, and these characters are called Delimiters. The delimiter defines the end of a source code statement, a field, or a component of a field. There are some delimiters that are reserved for use with Macros. DELIMITERS CHARACTER MEANING USE blank 1 or more blanks field separator or terminator field single quotes enclose a data string ( ) parentheses delimit an expression RETURN statement terminator HT TAB field separator or symbol terminator ; semicolon indicate start of a comment : colon delimiter for labels NAME FIELD The name is optional, and for some assemblers a colon must follow the label in the Code segment. A label is a symbolic name used to refer to a memory address or value. The label may use any alphanumeric character, and the first character of a label should be alphabetical. The student should use labels of six characters or less excluding the colon. This is primarily to do with spacing of lines and characters when printing the lst file. There are restrictions for label names. A label should not be the same as a mnemonic. We may not use the label SUB for a subroutine label since SUB is the assembly language mnemonic for subtract, but we could use the label SUB1. If we use a mnemonic or a single character that is the same as a register, or any reserved characters, the Assembler will flag the statement, and print a error message. If the assembler encounters a semicolon in the beginning of the label field, it treats the entire line as a comment. Page 5

6 OPCODE FIELD The opcode field must always contain a valid mnemonic or assembler directive. If it does not, the assembler will flag the statement and print an error message. All operands and assembler directives should begin at least one tab space from the left margin. OPERAND FIELD The operand field may contain a register name, data, or a label. If there is more than one operand required by the mnemonic, it must be separated by a comma. If the operand is data, it may be in binary, octal, decimal, hex, or ASCII. The numeric data type may be upper case or lower case. Binary data must be entered with no spaces, has a maximum of 8, 16, or 32 bits depending on the opcode, and a B as the last character, such as B. Octal data must be entered as a valid octal number up to 377Q for 8 bit data or Q for 16 bit data with no spaces depending on the opcode, and a Q as the character, such as 175Q. Decimal data is entered as a number up to 255 for 8 bit, 65,535 for 16 bit, or 4,294,967,296 for 32-bit unsigned data depending on the opcode. It may have no base designation or a D as the last digit of the number such a 37 or 37D. Hexadecimal data is entered as any valid hex number up to 0FFH for 8 bit, 0 FFFFH for 16 bit, or 0 FFFF FFFFH for 32-bit data depending on the opcode. It must have a number for the first digit and an H as the last digit of the number. When ASCII data is used in an operand, it must be enclosed in quotes. Whenever the $ is present in the operand field, it means the current address. In addition to specifying the number base in use, a valid operand could be a label with arithmetic or logical functions as part of the operand. OPERAND ARITHMETIC OPERATIONS OPERATION EXAMPLE EXPLANATION + LABEL+2 Address of LABEL + 2 bytes LABEL 1 Address 1 byte before LABEL * TOP*3 Equates to the value TOP times 3 / SIX/2 Equates to the value six divided by 2 or 3 NOT NOT TRUE the 1 s complement of TRUE AND WQ AND SE returns the value of label WQ AND SE OR WQ OR SE returns the value of label WQ OR SE XOR WQ XOR SE returns the value of label WQ XOR SE COMMENT FIELD The comment field must begin with a semicolon and may continue only until the end of the line. If it must continue on the next line, that line must begin with a semicolon. In the comments field the programmer should explain what events are taking place with that instruction or group of instructions. On line documentation is essential to enable the programmer or another individuals to determine what is happening. No programs will be accepted without proper documentation. Page 6

7 ASSEMBLER PSEUDO OPERATIONS A pseudo op is an assembler directive, and is located in the opcode field. Pseudo ops give instructions to the Assembler, and it may or may not generate machine code. Labels may be used to identify pseudo ops and most require operands. DATA ALLOCATION DIRECTIVES A variable is a symbolic name for a location in memory where some data are stored. A variable s offset is the distance from the beginning of the segment to the variable. A variable s name is automatically associated with its offset. An array is a group of sequential memory locations used for storage and whose address is represented by a symbolic name. The first element of the array is at the base address. Other elements of the array are accessed by adding an offset (the number of memory locations) to the base address. For example, if we declare an array containing four characters, the name alist identifies only the offset of the first character (A):.data mystring db This is a string mystring is a label or name. The purpose of the label is to associate a memory location in the data segment with user assigned name. This makes it easy for the programmer to access the data stored here. The DB directive instructs the assembler to reserve storage for data on a byte boundary. T is the first letter of the string, and is placed in the base address of mystring. The h is offset +1 or one byte after the T (the address of this memory location is mystring +1 byte). The character i is located at mystring+2 (the address of mystring plus two bytes), and so on for all characters in the string. The address of mystring is based on its location in the program. Address Contents mystring 54h mystring+1 68h mystring+2 69h mystring+3 73h mystring+4 20h And so on. In the table above, the numeric data is the hex value for the ASCII character. 20h is the ASCII character for a space. We use the following MASM data allocation directives to reserve storage on multiple byte boundaries. Different assemblers may us slightly different assembler directives. You should check the documentation for the proper declaration syntax. For MASM: Assember Directive Description Size DB Define byte 1 byte DW Define word 2 bytes DD Define doubleword 4 bytes DQ Define quadword 8 bytes DT Define tenbytes 10 bytes Page 7

8 DB The Define Byte directive is used to define memory storage of data on an 8 bit boundary. Labels are optional, but an operand is required. Multiple operand values may be entered in any acceptable format (numeric can be in binary, octal, decimal, or hex) and is separated by commas. Strings are enclosed in quotes. Unsigned integer values are in the range of 0 to 255 The following are examples of the DB directive: VALUE DB 100 ;DEFINE VALUE AS 100. VAL2 DB 10H ;DEFINE VAL2 AS 10 IN HEX. BINUM DB B ;DEFINE BINUM AS BINARY VALUE. MSG DB HELLO ;FIVE BYTE ASCII MESSAGE. NUM DB 1,2,3,4 ;DEFINE NUM AS THE FOUR BYTES ;1, 2, 3, AND 4 IN DECIMAL. INIT DB? ;INITIAL VALUE UNASSIGNED DUP The DUP operator, which is placed in the operand field, allows you to initialize storage to one or more multiple values. The DUP operator used with the DB directive is: NUM1 DB 80 DUP (20h) ;INITIALIZES 80 BYTES OF STORAGE TO ;20H, the ASCII value for a space VAL2 DB 5 DUP ( No ) ;DEFINE VAL2 AS NoNoNoNoNo DW The Define Word directive is similar to the Define Byte, except that it is used to define 16 bit data (A word) instead of 8 bit data. The syntax of the DW directive is similar to DB except that it stores the defined data on a word boundary. It is used to represent unsigned Integer values (0 to ) The DW format is: NUM1 DW 13H ;DEFINE NUM1 AS THE VALUE 0013H NUM2 DW 1000 ;DEFINE NUM2 AS THE VALUE 1000 CAL1 DW 256 * 2 ;ASSIGN THE VALUE 512 TO CAL1 BLANK DW 80 DUP (?) ;RESERVE 80 WORDS UNINITIALIZED BLANK DW 80 DUP (20H) ;RESERVE 80 WORDS OF SPACES (0020H) DD The Define DoubleWord directive is similar to DB and DW, except that it is used to define 32 bit data (A double word). The syntax of the DD directive is similar to DB except that it stores the defined data on a double word boundary. It is used to represent unsigned Integer values (0 to ) The DW format is: NUM1 DD 13H ;DEFINE NUM1 AS THE VALUE H DQ The Define QuadWord directive is similar to DB, except that it is used to define 64 bit data. Unsigned integer values range from 0 to (~1.8e19) The DW format is: NUM1 DQ 13H ;DEFINE NUM1 AS H Page 8

9 Equates Directive EQU The EQU directive is used to equate a symbolic name (or label) to another label or a value. You should make liberal use of labels and equate statements since they make the program easier to understand. Although the EQU statement may appear anywhere in a program, it is a good technique to place all the equate statements together in the DATA area. An example of the equate statement is: SIX EQU 6 COUNT EQU 25 NUM EQU 100H VAL2 EQU SIX VAL8 EQU SIX+2 Equal-Sign Directive = This is similar to the EQU, but is used as a redefinable equates. The value associated with the = may be reassigned during assembly. Like the EQU directive, it cannot change during program execution/ Examples are: count = maxlongint = 7FFF FFFFh ( ) minlongint = h ( ) maxunsignlongint = 0 FFFF FFFFh ( ) ORG The ORG directive is used to change the current address of a program to another address. It should be used in the beginning of the program, and is usually the last statement in the Equates Area. The addresses below 03FFH (4 groups of 256) are used to store the RESET and RESTART (vectored interrupt) and user defined vectored interrupt addresses. The programmer or operating system will usually load these addresses but they are not used to store source code. The ORG statement may be used at any point in the program, and may be used more than once. It could be used to define a hex lookup table for printing the ASCII value of single hex digits that begins at a specific address..data ORG 1000H HEXTBL DB DB DB ABCDE DB F END The END assembler directive identifies the last line of the source code program. Only one END statement may appear in a source code program as any statements after the end statement are ignored by the assembler. The END statement should be located in the OPCODE field, and labels and operands are optional when using simplified segment directives. Page 9

10 OFFSET Operator The OFFSET operator returns the offset of a memory location from the beginning of its segment. The destination operand must be a l6-bit register, as in the following example: mov si,offset addr ; SI points to addr SI points to addr because it contains its offset address. When the register contains an address that we wish to access,, we call it a pointer. This is a technique we will use later when we see how to access the contents of an array. In the following example, assume that bytesize is the first storage location in the data segment..data bytesize db 10h,25h,3h,4Fh wordsize dw 1000h,2000h,3000h.code mov di, offset bytesize ;DI points to address 0000 with respect to the ;base address of the data segment or DS:0000 mov bx, offset bytesize+1 ;BX points to the memory location bytesize+1 (0001) ;or DS:0001 mov si offset wordsize+2 ;SI points to the memory location DS:0006 PTR Operator The PTR operator forces an operand to a desired boundary. For instructions where the boundary of an operand might be ambiguous, the PTR operator can be used to define the operand s proper size in combination with the declared data size. For example, we might see: mov al,byte ptr Num1 mov si,word ptr Num2 mov eax,dword ptr listpointer When the size of an operand is not clear from the context of an instruction, you must make sure to use the PTR directive. Consider the following instruction, which would generate an operand must have size error message by the assembler: inc [si] In the previous instruction, the assembler cannot determine what size data SI is pointing to. By using the PTR operator, the assembler knows the data size. inc word ptr [si] The.MODEL is used to define the type of program being created. It automatically sets the default attribute for all procedures to either near or far. No. of Segments OS.model Data Code DOS Features tiny 1 1 Used for COM only, Data and Code combined small 1 1 Smallest EXE file medium 1 Multiple compact Multiple 1 large Multiple Multiple huge Multiple Multiple DOS/ Windows flat 1 1 Windows NT Uses normalized addressing Uses 32-bit addressing, Data and Code combined Page 10

11 There are two methods to do this with MASM. The Standard Segment Directives, which works with both older and newer versions of assemblers, and the Simplified Segment Directives, which only works with MASM 5 and higher. SEGMENT ENDS The 80x86 has different segments for the Stack, Data, and Code. Each of these three storage areas should be identified. Defines the end of the Segment. This must occur before the END directive STANDARD DIRECTIVE METHOD ML assembles and links in one command. If you install MASM on your home computer and you wish to edit and assemble files from your Floppy Disk, open AUTOEXEC.BAT with EDIT in C:\ and add the following to your PATH statement: C:\MASM611\BIN With MASM 6.11 and higher, the ML command assemble and links a.asm file ml hello.asm It produces a.obj file and a.exe file Option /Fl produces a source listing with an lst extension Option /Fm produces a map file with a map extension To produce both of these, type (with spaces) ml /Fl /Fm hello.asm PROCESSORS MASM supports a set of directives for selecting processors and coprocessors. Once you select a processor, you must use only the instruction set for that processor. The default is the 8086 processor. To enable a different processor modes and the additional instructions available on that processor, use the directives.186,.286,.386, and.486. The.286P,.386P, and.486p directives enable the instructions available only at higher privilege levels in addition to the normal instruction set for the given processor. Generally, you don t need privileged instructions unless you are writing operating-systems code or device drivers. STACK Segment The stack is the section of memory used for pushing or popping registers and storing the return address when a subroutine is called. The stack often holds temporary and local variables. If your main module is written in a high-level language, that language handles the details of creating a stack. Use the.stack directive only when you write a main module in assembly language. The.STACK directive creates a stack segment. By default, the assembler allocates 1K of memory for the stack. This size is sufficient for most small programs. To create a stack of a size other than the default size, give.stack a single numeric argument indicating stack size in bytes:.stack 2048 ; Setup 2K stack.stack 2000h ; Setup 2K stack exactly same as previous Page 11

12 DATA Segment Programs can contain both near and far data. In general, you should place important and frequently used data in the near data area, where data access is faster. This area can get crowded, however, because in 16-bit operating systems the total amount of all near data in all modules cannot exceed 64K. Therefore, you may want to place infrequently used or particularly large data items in a far data segment. The.DATA,.DATA?,.CONST,.FARDATA, and.fardata? directives create data segments. You can access the various segments within DGROUP without reloading segment registers (see Defining Segment Groups, later in this chapter). These five directives also prevent instructions from appearing in data segments by assuming CS to ERROR. Near Data Segments The.DATA directive creates a near data segment. This segment contains the frequently used data for your program. It can occupy up to 64K in MS-DOS or 512 megabytes under flat model in Windows NT. It is placed in a special group identified as DGROUP, which is also limited to 64K. When you use.model, the assembler automatically defines DGROUP for your near data segment. The segments in DGROUP form near data, which can normally be accessed directly through DS or SS. Far Data Segments The compact, large, and huge memory models use far data addresses by default. With these memory models, however, you can still construct data segments using.data,.data?, and.const. The effect of these directives does not change from one memory model to the next. They always contribute segments to the default data area, DGROUP, which has a total limit of 64K. When you use.fardata or.fardata? in the small and medium memory models, the assembler creates far data segments FAR_DATA and FAR_BSS, respectively. You can access variables with: mov ax, SEG farvar2 mov ds, ax Code Segment Whether you are writing a main module or a module to be called from another module, you can have both near and far code segments. This section explains how to use near and far code segments and how to use the directives and predefined equates that relate to code segments. Near Code Segments The small memory model is often the best choice for assembly programs that are not linked to modules in other languages, especially if you do not need more than 64K of code. This memory model defaults to near (two-byte) addresses for code and data, which makes the program run faster and use less memory. When you use.model and simplified segment directives, the.code directive in your program instructs the assembler to start a code segment. The next segment directive closes the previous segment; the END directive at the end of your program closes remaining segments. You can use the predefined to determine whether code pointers default to Page 12

13 Far Code Segments When you need more than 64K of code, use the medium, large, or huge memory model to create far segments. The medium, large, and huge memory models use far code addresses by default. In the larger memory models, the assembler creates a different code segment for each module. If you use multiple code segments in the small, compact, or tiny model, the linker combines the.code segments for all modules into one segment. For far code segments, the assembler names each code segment MODNAME_TEXT, in which MODNAME is the name of the module. With near code, the assembler names every code segment _TEXT, causing the linker to concatenate these segments into one. You can override the default name by providing an argument after.code. (For a complete list of segment names generated by MASM, see Appendix E, Default Segment Names. ) With far code, a single module can contain multiple code segments. The.CODE directive takes an optional text argument that names the segment. For instance, the following example creates two distinct code segments, FIRST_TEXT and SECOND_TEXT..CODE FIRST.. ; First set of instructions here..code SECOND.. ; Second set of instructions here The easiest way to begin and end an MS-DOS program is to use the.startup and.exit directives in the main module. The main module contains the starting point and usually the termination point. You do not need these directives in a module called by another module. These directives make MS-DOS programs easy to maintain. They automatically generate code appropriate to the stack distance specified with.model. However, they do not apply to flat-model programs written for 32-bit operating systems. Thus, you should not use.startup or.exit in programs written for Windows NT. To start a program, place the.startup directive where you want execution to begin. Usually, this location immediately follows the.code directive:.code.startup.. ; Place executable code here..exit END Note that.exit generates executable code, while END does not. The END directive informs the assembler that it has reached the end of the module. All modules must end with the END directive whether you use simplified or full segments. Page 13

14 If you do not use.startup, you must give the starting address as an argument to the END directive. For example, the following fragment shows how to identify a program s starting instruction with the label start:.code start:.. ; Place executable code here. END start Only the END directive for the module with the starting instruction should have an argument. When.STARTUP is present, the assembler ignores any argument to END. Sometimes MASM generates a warning stating the address of end was ignored. Do not worry about this warning as it is generated because the.exit and end directives are adjacent. For the default NEARSTACK attribute,.startup points DS to DGROUP and sets SS:SP relative to DGROUP, generating the following code: Page 14

15 SIMPLIFIED SEGMENT DIRECTIVE METHOD Title Segment Example TOTAL.ASM by Andrew H. Andersen, Jr. Page 60,132 ;.MODEL SMALL.DATA ORG 7000H POINTS DB 16 DUP(?) ;save room for 16 data bytes SUM DB? ;save room for result (1 byte).code.startup TOTAL: MOV AX,7000H ;load address of data area MOV DS,AX ;init data segment register MOV AL,0 ;clear result MOV BL,16 ;init loop counter LEA SI,POINTS ;init data pointer ADDUP: ADD AL,[SI] ;add data value to result INC SI ;increment data pointer DEC BL ;decrement loop counter JNZ ADDUP ;jump if counter not zero MOV SUM,AL ;save sum MOV AH,04CH ;Normal MS-DOS progam end INT 21H ;Using MS-DOS.EXIT END TOTAL Microsoft (R) Macro Assembler Version /20/00 08:37:41 Segment Example TOTAL.ASM by Andrew H. Andersen, Jr. Page 1-1 Title Segment Example TOTAL.ASM by Andrew H. Andersen, Jr. Page 60,132 ;.MODEL SMALL 0000.DATA ORG 7000H [ POINTS DB 16 DUP(?) ;save room for 16 data bytes 00 ] SUM DB? ;save room for result (1 byte) 0000.CODE.STARTUP 0017 B TOTAL: MOV AX,7000H ;load address of data area 001A 8E D8 MOV DS,AX ;init data segment register 001C B0 00 MOV AL,0 ;clear result 001E B3 10 MOV BL,16 ;init loop counter D R LEA SI,POINTS ;init data pointer ADDUP: ADD AL,[SI] ;add data value to result INC SI ;increment data pointer 0027 FE CB DEC BL ;decrement loop counter F9 JNZ ADDUP ;jump if counter not zero 002B A R MOV SUM,AL ;save sum 002E B4 4C MOV AH,04CH ;Normal MS-DOS progam end 0030 CD 21 INT 21H ;Using MS-DOS.EXIT END TOTAL Page 15

16 Microsoft (R) Macro Assembler Version /20/00 08:37:41 Segment Example TOTAL.ASM by Andrew H. Andersen, Jr. Symbols 2-1 Segments and Groups: N a m e Size Length Align Combine Class DGROUP GROUP _DATA Bit 7011 Word Public DATA _TEXT Bit 0036 Word Public CODE Microsoft (R) Macro Assembler Version /20/00 08:37:41 Segment Example TOTAL.ASM by Andrew H. Andersen, Jr. Symbols 3-1 Symbols: N a m e Type Value Number Number Number Number L Near 0000 Text Text Text Text Text DGROUP ADDUP L Near 0024 _TEXT POINTS Byte 7000 _DATA SUM Byte 7010 _DATA TOTAL L Near 0017 _TEXT 1 Warnings 0 Errors Both versions of the program accomplish the same task. The second version allows the Assembler to perform some housekeeping chores for us. Let us briefly look at a sample line of output in the total.lst file contents and what it represents: 8000 B TOTAL: MOV AX,7000H ;load address of data area 8000 is the Hex address in memory for this instruction B8 is the Intel HEX code for MOV AX 7000H is the hex value of the data TOTAL is the Label field MOV is the Opcode AX,7000H is the operand ;load is the comment. The assembler generated the first three, and the programmer typed the last 4 in the source code file. Page 16

17 TITLE Program STANDARD.ASM written by Andrew H. Andersen, Jr. Page 60,132 ;*************************************************** ; ; Program number ; Program STANDARD.ASM ; Written by Andrew H. Andersen, Jr. ; Course - Section ; ; This program, ; ; We use the procedures Clrscr, Gotoxy, Writestring ; Readint, and Writeint from LIBRARY.LIB ; ;***************************************************.model small.stack 1000h.data row1 row2 row3 row4 row5 equ 0516h equ 0616h equ 0916h equ 0a16h equ 0b20h prompt1 db This program adds two decimal numbers,0 prompt2 db that you enter from the keyboard.,0 get1st db Enter the 1st number -->,0 get2nd db Enter the 2nd number -->,0 showans db The sum is -->,0.code ; Define proc used from library.lib ; the \ is continue form previous line extern Writeint:proc, Writestring:proc, \ Readint:proc, Gotoxy:proc,.startup main: mov ax,@data mov ds,ax Page 17

18 ;************ ; ; Define what happens here ; ;************ init: call Clr call SetCur ; the rest of main is placed here fini: mov ah,04ch ;standard MS/DOS Process End int 21h ; ALL PROCEDURES ARE HERE ; Clear the screen using MS/DOS Video BIOS Clr proc ; Clear Screen with 25 line scroll. ; The screen is blue and the text is yellow Clr mov ah, 6 ;The Video BIOS function mov al, 0 ;Scroll # of lines 0 = all mov cx, 0 ;row/col at top mov dx, 1950h ;row/col at bottom 24 & 79 mov bh, 1eh ;foreground/background colors int 10h endp SetCur proc ; Now set Cursor to row 5 column 30 on page 0 mov ah, 2 ;The BIOS function mov dx, 051eh ;row/column position mov bh, 0 ;video page no. 0 int 10h ;using Video BIOS ret SetCur endp.exit end Page 18

8. MACROS, Modules, and Mouse

8. MACROS, Modules, and Mouse 8. MACROS, Modules, and Mouse Background Macros, Modules and the Mouse is a combination of concepts that will introduce you to modular programming while learning how to interface with the mouse. Macros

More information

Faculty of Engineering Student Number:

Faculty of Engineering Student Number: Philadelphia University Student Name: Faculty of Engineering Student Number: Dept. of Computer Engineering Final Exam, First Semester: 2012/2013 Course Title: Microprocessors Date: 17/01//2013 Course No:

More information

ASSEMBLY LANGUAGE PROGRAMMING (6800) (R. Horvath, Introduction to Microprocessors, Chapter 6)

ASSEMBLY LANGUAGE PROGRAMMING (6800) (R. Horvath, Introduction to Microprocessors, Chapter 6) ASSEMBLY LANGUAGE PROGRAMMING (6800) (R. Horvath, Introduction to Microprocessors, Chapter 6) 1 COMPUTER LANGUAGES In order for a computer to be able to execute a program, the program must first be present

More information

How To Use A Computer With A Screen On It (For A Powerbook)

How To Use A Computer With A Screen On It (For A Powerbook) page 44,100 TITLE ASMXMPLE Video equ 10h ;video functions interrupt number Keyboard equ 16h ;keyboard functions interrupt number DOS equ 21h ;call DOS interrupt number PrtSc equ 5h ;Print Screen Bios interrupt

More information

MACHINE ARCHITECTURE & LANGUAGE

MACHINE ARCHITECTURE & LANGUAGE in the name of God the compassionate, the merciful notes on MACHINE ARCHITECTURE & LANGUAGE compiled by Jumong Chap. 9 Microprocessor Fundamentals A system designer should consider a microprocessor-based

More information

King Fahd University of Petroleum and Minerals. College of Computer Science and Engineering. Computer Engineering Department COE 205

King Fahd University of Petroleum and Minerals. College of Computer Science and Engineering. Computer Engineering Department COE 205 King Fahd University of Petroleum and Minerals College of Computer Science and Engineering Computer Engineering Department COE 205 Computer Organization and Assembly Language Lab Manual Prepared By: Mr.

More information

PC Assembly Language. Paul A. Carter

PC Assembly Language. Paul A. Carter PC Assembly Language Paul A. Carter November 20, 2001 Copyright c 2001 by Paul Carter This may be reproduced and distributed in its entirety (including this authorship, copyright and permission notice),

More information

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer About the Tutorial Assembly language is a low-level programming language for a computer or other programmable device specific to a particular computer architecture in contrast to most high-level programming

More information

Informatica e Sistemi in Tempo Reale

Informatica e Sistemi in Tempo Reale Informatica e Sistemi in Tempo Reale Introduction to C programming Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 25, 2010 G. Lipari (Scuola Superiore Sant Anna)

More information

BCD (ASCII) Arithmetic. Where and Why is BCD used? Packed BCD, ASCII, Unpacked BCD. BCD Adjustment Instructions AAA. Example

BCD (ASCII) Arithmetic. Where and Why is BCD used? Packed BCD, ASCII, Unpacked BCD. BCD Adjustment Instructions AAA. Example BCD (ASCII) Arithmetic We will first look at unpacked BCD which means strings that look like '4567'. Bytes then look like 34h 35h 36h 37h OR: 04h 05h 06h 07h x86 processors also have instructions for packed

More information

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T)

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T) Unit- I Introduction to c Language: C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating

More information

ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER

ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER Pierre A. von Kaenel Mathematics and Computer Science Department Skidmore College Saratoga Springs, NY 12866 (518) 580-5292 [email protected] ABSTRACT This paper

More information

Assembly Language Tutorial

Assembly Language Tutorial Assembly Language Tutorial ASSEMBLY LANGUAGE TUTORIAL by tutorialspoint.com tutorialspoint.com i ABOUT THE TUTORIAL Assembly Programming Tutorial Assembly language is a low-level programming language for

More information

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program. Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to

More information

Quick Start Tutorial. Using the TASKING* Software Development Tools with the Intel 8x930 Family Evaluation Board

Quick Start Tutorial. Using the TASKING* Software Development Tools with the Intel 8x930 Family Evaluation Board Quick Start Tutorial Using the TASKING* Software Development Tools with the Intel 8x930 Family Evaluation Board This explains how to use the TASKING Microsoft* Windows*-based software development tools

More information

Z80 Instruction Set. Z80 Assembly Language

Z80 Instruction Set. Z80 Assembly Language 75 Z80 Assembly Language The assembly language allows the user to write a program without concern for memory addresses or machine instruction formats. It uses symbolic addresses to identify memory locations

More information

LC-3 Assembly Language

LC-3 Assembly Language LC-3 Assembly Language Programming and tips Textbook Chapter 7 CMPE12 Summer 2008 Assembly and Assembler Machine language - binary Assembly language - symbolic 0001110010000110 An assembler is a program

More information

Embedded x86 Programming: Protected Mode

Embedded x86 Programming: Protected Mode by JEAN GAREAU Embedded x86 Programming: Protected Mode The x86 architecture is ubiquitous on the desktop and is spilling over into embedded systems environments. This article begins a series designed

More information

2 ASCII TABLE (DOS) 3 ASCII TABLE (Window)

2 ASCII TABLE (DOS) 3 ASCII TABLE (Window) 1 ASCII TABLE 2 ASCII TABLE (DOS) 3 ASCII TABLE (Window) 4 Keyboard Codes The Diagram below shows the codes that are returned when a key is pressed. For example, pressing a would return 0x61. If it is

More information

A Tiny Guide to Programming in 32-bit x86 Assembly Language

A Tiny Guide to Programming in 32-bit x86 Assembly Language CS308, Spring 1999 A Tiny Guide to Programming in 32-bit x86 Assembly Language by Adam Ferrari, [email protected] (with changes by Alan Batson, [email protected] and Mike Lack, [email protected])

More information

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C Embedded Systems A Review of ANSI C and Considerations for Embedded C Programming Dr. Jeff Jackson Lecture 2-1 Review of ANSI C Topics Basic features of C C fundamentals Basic data types Expressions Selection

More information

The Hexadecimal Number System and Memory Addressing

The Hexadecimal Number System and Memory Addressing APPENDIX C The Hexadecimal Number System and Memory Addressing U nderstanding the number system and the coding system that computers use to store data and communicate with each other is fundamental to

More information

Computer Organization and Assembly Language

Computer Organization and Assembly Language Computer Organization and Assembly Language Lecture 8 - Strings and Arrays Introduction We already know that assembly code will execute significantly faster than code written in a higher-level language

More information

PROBLEMS (Cap. 4 - Istruzioni macchina)

PROBLEMS (Cap. 4 - Istruzioni macchina) 98 CHAPTER 2 MACHINE INSTRUCTIONS AND PROGRAMS PROBLEMS (Cap. 4 - Istruzioni macchina) 2.1 Represent the decimal values 5, 2, 14, 10, 26, 19, 51, and 43, as signed, 7-bit numbers in the following binary

More information

Lecture 7: Machine-Level Programming I: Basics Mohamed Zahran (aka Z) [email protected] http://www.mzahran.com

Lecture 7: Machine-Level Programming I: Basics Mohamed Zahran (aka Z) mzahran@cs.nyu.edu http://www.mzahran.com CSCI-UA.0201-003 Computer Systems Organization Lecture 7: Machine-Level Programming I: Basics Mohamed Zahran (aka Z) [email protected] http://www.mzahran.com Some slides adapted (and slightly modified)

More information

X86-64 Architecture Guide

X86-64 Architecture Guide X86-64 Architecture Guide For the code-generation project, we shall expose you to a simplified version of the x86-64 platform. Example Consider the following Decaf program: class Program { int foo(int

More information

The programming language C. sws1 1

The programming language C. sws1 1 The programming language C sws1 1 The programming language C invented by Dennis Ritchie in early 1970s who used it to write the first Hello World program C was used to write UNIX Standardised as K&C (Kernighan

More information

Exceptions in MIPS. know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine

Exceptions in MIPS. know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine 7 Objectives After completing this lab you will: know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine Introduction Branches and jumps provide ways to change

More information

Outline. Lecture 3. Basics. Logical vs. physical memory. 8086 physical memory. x86 byte ordering

Outline. Lecture 3. Basics. Logical vs. physical memory. 8086 physical memory. x86 byte ordering Outline Lecture 3 bout Memory ddressing memory Data types MOV instruction ddressing modes Instruction format Dr. Dimitrios S. Nikolopoulos SL/UIU Basics Logical vs. physical memory Memory in the x processors

More information

Introduction (C) 1992-1996 Microsoft Corporation. All rights reserved.

Introduction (C) 1992-1996 Microsoft Corporation. All rights reserved. Introduction Programmer's Guide Microsoft MASM Assembly-Language Development System Version 61 For MS-DOS and Windows Operating Systems Microsoft Corporation Information in this document is subject to

More information

1 The Java Virtual Machine

1 The Java Virtual Machine 1 The Java Virtual Machine About the Spec Format This document describes the Java virtual machine and the instruction set. In this introduction, each component of the machine is briefly described. This

More information

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2

Advanced Computer Architecture-CS501. Computer Systems Design and Architecture 2.1, 2.2, 3.2 Lecture Handout Computer Architecture Lecture No. 2 Reading Material Vincent P. Heuring&Harry F. Jordan Chapter 2,Chapter3 Computer Systems Design and Architecture 2.1, 2.2, 3.2 Summary 1) A taxonomy of

More information

Unpacked BCD Arithmetic. BCD (ASCII) Arithmetic. Where and Why is BCD used? From the SQL Server Manual. Packed BCD, ASCII, Unpacked BCD

Unpacked BCD Arithmetic. BCD (ASCII) Arithmetic. Where and Why is BCD used? From the SQL Server Manual. Packed BCD, ASCII, Unpacked BCD BCD (ASCII) Arithmetic The Intel Instruction set can handle both packed (two digits per byte) and unpacked BCD (one decimal digit per byte) We will first look at unpacked BCD Unpacked BCD can be either

More information

The x86 PC: Assembly Language, Design, and Interfacing 5 th Edition

The x86 PC: Assembly Language, Design, and Interfacing 5 th Edition Online Instructor s Manual to accompany The x86 PC: Assembly Language, Design, and Interfacing 5 th Edition Muhammad Ali Mazidi Janice Gillispie Mazidi Danny Causey Prentice Hall Boston Columbus Indianapolis

More information

Chapter 2: Elements of Java

Chapter 2: Elements of Java Chapter 2: Elements of Java Basic components of a Java program Primitive data types Arithmetic expressions Type casting. The String type (introduction) Basic I/O statements Importing packages. 1 Introduction

More information

Chapter 7 Assembly Language

Chapter 7 Assembly Language Chapter 7 Assembly Language Human-Readable Machine Language Computers like ones and zeros 0001110010000110 Humans like symbols ADD R6,R2,R6 increment index reg. Assembler is a program that turns symbols

More information

An Introduction to Assembly Programming with the ARM 32-bit Processor Family

An Introduction to Assembly Programming with the ARM 32-bit Processor Family An Introduction to Assembly Programming with the ARM 32-bit Processor Family G. Agosta Politecnico di Milano December 3, 2011 Contents 1 Introduction 1 1.1 Prerequisites............................. 2

More information

PART B QUESTIONS AND ANSWERS UNIT I

PART B QUESTIONS AND ANSWERS UNIT I PART B QUESTIONS AND ANSWERS UNIT I 1. Explain the architecture of 8085 microprocessor? Logic pin out of 8085 microprocessor Address bus: unidirectional bus, used as high order bus Data bus: bi-directional

More information

1 Classical Universal Computer 3

1 Classical Universal Computer 3 Chapter 6: Machine Language and Assembler Christian Jacob 1 Classical Universal Computer 3 1.1 Von Neumann Architecture 3 1.2 CPU and RAM 5 1.3 Arithmetic Logical Unit (ALU) 6 1.4 Arithmetic Logical Unit

More information

================================================================

================================================================ ==== ==== ================================================================ DR 6502 AER 201S Engineering Design 6502 Execution Simulator ================================================================

More information

13-1. This chapter explains how to use different objects.

13-1. This chapter explains how to use different objects. 13-1 13.Objects This chapter explains how to use different objects. 13.1. Bit Lamp... 13-3 13.2. Word Lamp... 13-5 13.3. Set Bit... 13-9 13.4. Set Word... 13-11 13.5. Function Key... 13-18 13.6. Toggle

More information

by Kip Irvine. Last update: 12/11/2003

by Kip Irvine. Last update: 12/11/2003 Loading and Executing a Child Process by Kip Irvine. Last update: 12/11/2003 MS-DOS has always taken a fairly straightforward approach to loading and executing programs. From the start, it was designed

More information

Chapter 7D The Java Virtual Machine

Chapter 7D The Java Virtual Machine This sub chapter discusses another architecture, that of the JVM (Java Virtual Machine). In general, a VM (Virtual Machine) is a hypothetical machine (implemented in either hardware or software) that directly

More information

MICROPROCESSOR. Exclusive for IACE Students www.iace.co.in iacehyd.blogspot.in Ph: 9700077455/422 Page 1

MICROPROCESSOR. Exclusive for IACE Students www.iace.co.in iacehyd.blogspot.in Ph: 9700077455/422 Page 1 MICROPROCESSOR A microprocessor incorporates the functions of a computer s central processing unit (CPU) on a single Integrated (IC), or at most a few integrated circuit. It is a multipurpose, programmable

More information

Moving from CS 61A Scheme to CS 61B Java

Moving from CS 61A Scheme to CS 61B Java Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you

More information

Number Representation

Number Representation Number Representation CS10001: Programming & Data Structures Pallab Dasgupta Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur Topics to be Discussed How are numeric data

More information

CPU Organization and Assembly Language

CPU Organization and Assembly Language COS 140 Foundations of Computer Science School of Computing and Information Science University of Maine October 2, 2015 Outline 1 2 3 4 5 6 7 8 Homework and announcements Reading: Chapter 12 Homework:

More information

Complete 8086 instruction set

Complete 8086 instruction set Page 1 of 53 Complete 8086 instruction set Quick reference: AAA AAD AAM AAS ADC ADD AND CALL CBW CLC CLD CLI CMC CMP CMPSB CMPSW CWD DAA DAS DEC DIV HLT IDIV IMUL IN INC INT INTO I JA JAE JB JBE JC JCXZ

More information

PIC Programming in Assembly. (http://www.mstracey.btinternet.co.uk/index.htm)

PIC Programming in Assembly. (http://www.mstracey.btinternet.co.uk/index.htm) PIC Programming in Assembly (http://www.mstracey.btinternet.co.uk/index.htm) Tutorial 1 Good Programming Techniques. Before we get to the nitty gritty of programming the PIC, I think now is a good time

More information

Variables, Constants, and Data Types

Variables, Constants, and Data Types Variables, Constants, and Data Types Primitive Data Types Variables, Initialization, and Assignment Constants Characters Strings Reading for this class: L&L, 2.1-2.3, App C 1 Primitive Data There are eight

More information

Computer Organization and Architecture

Computer Organization and Architecture Computer Organization and Architecture Chapter 11 Instruction Sets: Addressing Modes and Formats Instruction Set Design One goal of instruction set design is to minimize instruction length Another goal

More information

MICROPROCESSOR AND MICROCOMPUTER BASICS

MICROPROCESSOR AND MICROCOMPUTER BASICS Introduction MICROPROCESSOR AND MICROCOMPUTER BASICS At present there are many types and sizes of computers available. These computers are designed and constructed based on digital and Integrated Circuit

More information

So far we have considered only numeric processing, i.e. processing of numeric data represented

So far we have considered only numeric processing, i.e. processing of numeric data represented Chapter 4 Processing Character Data So far we have considered only numeric processing, i.e. processing of numeric data represented as integer and oating point types. Humans also use computers to manipulate

More information

Time Clock Import Setup & Use

Time Clock Import Setup & Use Time Clock Import Setup & Use Document # Product Module Category CenterPoint Payroll Processes (How To) This document outlines how to setup and use of the Time Clock Import within CenterPoint Payroll.

More information

Character Translation Methods

Character Translation Methods Supplement to: Irvine, Kip R. Assembly Language for Intel-Based Computers, 4th Edition. This file may be duplicated or printed for classroom use, as long as the author name, book title, and copyright notice

More information

First Bytes Programming Lab 2

First Bytes Programming Lab 2 First Bytes Programming Lab 2 This lab is available online at www.cs.utexas.edu/users/scottm/firstbytes. Introduction: In this lab you will investigate the properties of colors and how they are displayed

More information

64-Bit NASM Notes. Invoking 64-Bit NASM

64-Bit NASM Notes. Invoking 64-Bit NASM 64-Bit NASM Notes The transition from 32- to 64-bit architectures is no joke, as anyone who has wrestled with 32/64 bit incompatibilities will attest We note here some key differences between 32- and 64-bit

More information

JavaScript: Introduction to Scripting. 2008 Pearson Education, Inc. All rights reserved.

JavaScript: Introduction to Scripting. 2008 Pearson Education, Inc. All rights reserved. 1 6 JavaScript: Introduction to Scripting 2 Comment is free, but facts are sacred. C. P. Scott The creditor hath a better memory than the debtor. James Howell When faced with a decision, I always ask,

More information

Introduction to Java Applications. 2005 Pearson Education, Inc. All rights reserved.

Introduction to Java Applications. 2005 Pearson Education, Inc. All rights reserved. 1 2 Introduction to Java Applications 2.2 First Program in Java: Printing a Line of Text 2 Application Executes when you use the java command to launch the Java Virtual Machine (JVM) Sample program Displays

More information

CHAPTER 6 TASK MANAGEMENT

CHAPTER 6 TASK MANAGEMENT CHAPTER 6 TASK MANAGEMENT This chapter describes the IA-32 architecture s task management facilities. These facilities are only available when the processor is running in protected mode. 6.1. TASK MANAGEMENT

More information

C++ Language Tutorial

C++ Language Tutorial cplusplus.com C++ Language Tutorial Written by: Juan Soulié Last revision: June, 2007 Available online at: http://www.cplusplus.com/doc/tutorial/ The online version is constantly revised and may contain

More information

Altera Monitor Program

Altera Monitor Program Altera Monitor Program This tutorial presents an introduction to the Altera Monitor Program, which can be used to compile, assemble, download and debug programs for Altera s Nios II processor. The tutorial

More information

2011, The McGraw-Hill Companies, Inc. Chapter 3

2011, The McGraw-Hill Companies, Inc. Chapter 3 Chapter 3 3.1 Decimal System The radix or base of a number system determines the total number of different symbols or digits used by that system. The decimal system has a base of 10 with the digits 0 through

More information

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner. Handout 1 CS603 Object-Oriented Programming Fall 15 Page 1 of 11 Handout 1 Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner. Java

More information

Instruction Set Architecture (ISA)

Instruction Set Architecture (ISA) Instruction Set Architecture (ISA) * Instruction set architecture of a machine fills the semantic gap between the user and the machine. * ISA serves as the starting point for the design of a new machine

More information

a storage location directly on the CPU, used for temporary storage of small amounts of data during processing.

a storage location directly on the CPU, used for temporary storage of small amounts of data during processing. CS143 Handout 18 Summer 2008 30 July, 2008 Processor Architectures Handout written by Maggie Johnson and revised by Julie Zelenski. Architecture Vocabulary Let s review a few relevant hardware definitions:

More information

Traditional IBM Mainframe Operating Principles

Traditional IBM Mainframe Operating Principles C H A P T E R 1 7 Traditional IBM Mainframe Operating Principles WHEN YOU FINISH READING THIS CHAPTER YOU SHOULD BE ABLE TO: Distinguish between an absolute address and a relative address. Briefly explain

More information

MICROPROCESSOR BCA IV Sem MULTIPLE CHOICE QUESTIONS

MICROPROCESSOR BCA IV Sem MULTIPLE CHOICE QUESTIONS MICROPROCESSOR BCA IV Sem MULTIPLE CHOICE QUESTIONS 1) Which is the microprocessor comprises: a. Register section b. One or more ALU c. Control unit 2) What is the store by register? a. data b. operands

More information

Hardware and Software Requirements

Hardware and Software Requirements C Compiler Real-Time OS Simulator Training Evaluation Boards Installing and Using the Keil Monitor-51 Application Note 152 May 31, 2000, Munich, Germany by Keil Support, Keil Elektronik GmbH [email protected]

More information

MS Access: Advanced Tables and Queries. Lesson Notes Author: Pamela Schmidt

MS Access: Advanced Tables and Queries. Lesson Notes Author: Pamela Schmidt Lesson Notes Author: Pamela Schmidt Tables Text Fields (Default) Text or combinations of text and numbers, as well as numbers that don't require calculations, such as phone numbers. or the length set by

More information

We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share.

We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share. LING115 Lecture Note Session #4 Python (1) 1. Introduction As we have seen in previous sessions, we can use Linux shell commands to do simple text processing. We now know, for example, how to count words.

More information

A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc

A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc Other architectures Example. Accumulator-based machines A single register, called the accumulator, stores the operand before the operation, and stores the result after the operation. Load x # into acc

More information

Real Time Monitor. A Real-Time Windows Operator Interface. DDE Compliant. (for remote data display)

Real Time Monitor. A Real-Time Windows Operator Interface. DDE Compliant. (for remote data display) Real Time Monitor A Real-Time Windows Operator Interface DDE Compliant (for remote data display) TABLE OF CONTENTS 1. INTRODUCTION...1 1.1 INSTALLATION...2 1.2 FIRST START UP - DDE CONFIGURE...2 1.3 AUTO-STARTUP...2

More information

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives Introduction to Programming and Algorithms Module 1 CS 146 Sam Houston State University Dr. Tim McGuire Module Objectives To understand: the necessity of programming, differences between hardware and software,

More information

CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 20: Stack Frames 7 March 08

CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 20: Stack Frames 7 March 08 CS412/CS413 Introduction to Compilers Tim Teitelbaum Lecture 20: Stack Frames 7 March 08 CS 412/413 Spring 2008 Introduction to Compilers 1 Where We Are Source code if (b == 0) a = b; Low-level IR code

More information

High-speed image processing algorithms using MMX hardware

High-speed image processing algorithms using MMX hardware High-speed image processing algorithms using MMX hardware J. W. V. Miller and J. Wood The University of Michigan-Dearborn ABSTRACT Low-cost PC-based machine vision systems have become more common due to

More information

Topics. Parts of a Java Program. Topics (2) CS 146. Introduction To Computers And Java Chapter Objectives To understand:

Topics. Parts of a Java Program. Topics (2) CS 146. Introduction To Computers And Java Chapter Objectives To understand: Introduction to Programming and Algorithms Module 2 CS 146 Sam Houston State University Dr. Tim McGuire Introduction To Computers And Java Chapter Objectives To understand: the meaning and placement of

More information

Instruction Set Architecture. or How to talk to computers if you aren t in Star Trek

Instruction Set Architecture. or How to talk to computers if you aren t in Star Trek Instruction Set Architecture or How to talk to computers if you aren t in Star Trek The Instruction Set Architecture Application Compiler Instr. Set Proc. Operating System I/O system Instruction Set Architecture

More information

The string of digits 101101 in the binary number system represents the quantity

The string of digits 101101 in the binary number system represents the quantity Data Representation Section 3.1 Data Types Registers contain either data or control information Control information is a bit or group of bits used to specify the sequence of command signals needed for

More information

DATA ITEM DESCRIPTION

DATA ITEM DESCRIPTION DD Form 1664, APR 89 Previous editions are obsolete Page 1 of 4 Pages 135/123 DATA ITEM DESCRIPTION Form Approved OMB NO.0704-0188 Public reporting burden for collection of this information is estimated

More information

VB.NET Programming Fundamentals

VB.NET Programming Fundamentals Chapter 3 Objectives Programming Fundamentals In this chapter, you will: Learn about the programming language Write a module definition Use variables and data types Compute with Write decision-making statements

More information

COMPUTERS ORGANIZATION 2ND YEAR COMPUTE SCIENCE MANAGEMENT ENGINEERING JOSÉ GARCÍA RODRÍGUEZ JOSÉ ANTONIO SERRA PÉREZ

COMPUTERS ORGANIZATION 2ND YEAR COMPUTE SCIENCE MANAGEMENT ENGINEERING JOSÉ GARCÍA RODRÍGUEZ JOSÉ ANTONIO SERRA PÉREZ COMPUTERS ORGANIZATION 2ND YEAR COMPUTE SCIENCE MANAGEMENT ENGINEERING UNIT 1 - INTRODUCTION JOSÉ GARCÍA RODRÍGUEZ JOSÉ ANTONIO SERRA PÉREZ Unit 1.MaNoTaS 1 Definitions (I) Description A computer is: A

More information

Building Applications Using Micro Focus COBOL

Building Applications Using Micro Focus COBOL Building Applications Using Micro Focus COBOL Abstract If you look through the Micro Focus COBOL documentation, you will see many different executable file types referenced: int, gnt, exe, dll and others.

More information

Chapter 4: Computer Codes

Chapter 4: Computer Codes Slide 1/30 Learning Objectives In this chapter you will learn about: Computer data Computer codes: representation of data in binary Most commonly used computer codes Collating sequence 36 Slide 2/30 Data

More information

Using Debug 1 INTRODUCING DEBUG

Using Debug 1 INTRODUCING DEBUG Using Debug Copyright Prentice-Hall Publishing, 1999. All rights reserved B.1 Introducing Debug B.2 Debug Command Summary Command Parameters B.3 Individual Commands? (Help) A (Assemble) C (Compare) D (Dump)

More information

Lecture 3 Addressing Modes, Instruction Samples, Machine Code, Instruction Execution Cycle

Lecture 3 Addressing Modes, Instruction Samples, Machine Code, Instruction Execution Cycle Lecture 3 Addressing Modes, Instruction Samples, Machine Code, Instruction Execution Cycle Contents 3.1. Register Transfer Notation... 2 3.2. HCS12 Addressing Modes... 2 1. Inherent Mode (INH)... 2 2.

More information

Customer Support Management with Warranty Tracking and Call Center Billing Part #275. User Manual

Customer Support Management with Warranty Tracking and Call Center Billing Part #275. User Manual Customer Support Management with Warranty Tracking and Call Center Billing Part #275 User Manual Version 7.3 Information in this document is subject to change without notice and does not represent a commitment

More information

MACHINE INSTRUCTIONS AND PROGRAMS

MACHINE INSTRUCTIONS AND PROGRAMS CHAPTER 2 MACHINE INSTRUCTIONS AND PROGRAMS CHAPTER OBJECTIVES In this chapter you will learn about: Machine instructions and program execution, including branching and subroutine call and return operations

More information

Exercise 4 Learning Python language fundamentals

Exercise 4 Learning Python language fundamentals Exercise 4 Learning Python language fundamentals Work with numbers Python can be used as a powerful calculator. Practicing math calculations in Python will help you not only perform these tasks, but also

More information

Tips and Tricks SAGE ACCPAC INTELLIGENCE

Tips and Tricks SAGE ACCPAC INTELLIGENCE Tips and Tricks SAGE ACCPAC INTELLIGENCE 1 Table of Contents Auto e-mailing reports... 4 Automatically Running Macros... 7 Creating new Macros from Excel... 8 Compact Metadata Functionality... 9 Copying,

More information

8085 INSTRUCTION SET

8085 INSTRUCTION SET DATA TRANSFER INSTRUCTIONS Opcode Operand Description 8085 INSTRUCTION SET INSTRUCTION DETAILS Copy from source to destination OV Rd, Rs This instruction copies the contents of the source, Rs register

More information

Specifications of Paradox for Windows

Specifications of Paradox for Windows Specifications of Paradox for Windows Appendix A 1 Specifications of Paradox for Windows A IN THIS CHAPTER Borland Database Engine (BDE) 000 Paradox Standard Table Specifications 000 Paradox 5 Table Specifications

More information

SKP16C62P Tutorial 1 Software Development Process using HEW. Renesas Technology America Inc.

SKP16C62P Tutorial 1 Software Development Process using HEW. Renesas Technology America Inc. SKP16C62P Tutorial 1 Software Development Process using HEW Renesas Technology America Inc. 1 Overview The following tutorial is a brief introduction on how to develop and debug programs using HEW (Highperformance

More information

M6800. Assembly Language Programming

M6800. Assembly Language Programming M6800 Assembly Language Programming 1 3. MC6802 MICROPROCESSOR MC6802 microprocessor runs in 1MHz clock cycle. It has 64 Kbyte memory address capacity using 16-bit addressing path (A0-A15). The 8-bit data

More information

Appendix C: Keyboard Scan Codes

Appendix C: Keyboard Scan Codes Thi d t t d ith F M k 4 0 2 Appendix C: Keyboard Scan Codes Table 90: PC Keyboard Scan Codes (in hex) Key Down Up Key Down Up Key Down Up Key Down Up Esc 1 81 [ { 1A 9A, < 33 B3 center 4C CC 1! 2 82 ]

More information

Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas

Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas CS 110B - Rule Storage Classes Page 18-1 Attributes are distinctive features of a variable. Data type, int or double for example, is an attribute. Storage class is another attribute. There are four storage

More information

Modbus RTU Communications RX/WX and MRX/MWX

Modbus RTU Communications RX/WX and MRX/MWX 15 Modbus RTU Communications RX/WX and MRX/MWX In This Chapter.... Network Slave Operation Network Master Operation: RX / WX Network Master Operation: DL06 MRX / MWX 5 2 D0 Modbus Network Slave Operation

More information

Keil C51 Cross Compiler

Keil C51 Cross Compiler Keil C51 Cross Compiler ANSI C Compiler Generates fast compact code for the 8051 and it s derivatives Advantages of C over Assembler Do not need to know the microcontroller instruction set Register allocation

More information

Eventia Log Parsing Editor 1.0 Administration Guide

Eventia Log Parsing Editor 1.0 Administration Guide Eventia Log Parsing Editor 1.0 Administration Guide Revised: November 28, 2007 In This Document Overview page 2 Installation and Supported Platforms page 4 Menus and Main Window page 5 Creating Parsing

More information

Memory Systems. Static Random Access Memory (SRAM) Cell

Memory Systems. Static Random Access Memory (SRAM) Cell Memory Systems This chapter begins the discussion of memory systems from the implementation of a single bit. The architecture of memory chips is then constructed using arrays of bit implementations coupled

More information