Presentation is loading. Please wait.

Presentation is loading. Please wait.

Assembler CASE Tool.

Similar presentations


Presentation on theme: "Assembler CASE Tool."— Presentation transcript:

1 Assembler CASE Tool

2 COMPUTER(BC) INSTRUCTIONS
Basic Computer Instruction code format Memory-Reference Instructions (OP-code = 000 ~ 110) 12 11 I Opcode Address Register-Reference Instructions (OP-code = 111, I = 0) 15 12 11 Register operation Input-Output Instructions (OP-code =111, I = 1) 15 12 11 I/O operation

3 BASIC COMPUTER INSTRUCTIONS
Hex Code Symbol I = I = Description AND xxx 8xxx AND memory word to AC ADD xxx 9xxx Add memory word to AC LDA xxx Axxx Load AC from memory STA xxx Bxxx Store content of AC into memory BUN xxx Cxxx Branch unconditionally BSA xxx Dxxx Branch and save return address ISZ xxx Exxx Increment and skip if zero CLA Clear AC CLE Clear E CMA Complement AC CME Complement E CIR Circulate right AC and E CIL Circulate left AC and E INC Increment AC SPA Skip next instr. if AC is positive SNA Skip next instr. if AC is negative SZA Skip next instr. if AC is zero SZE Skip next instr. if E is zero HLT Halt computer INP F Input character to AC OUT F Output character from AC

4 MACHINE LANGUAGE Program
A list of instructions or statements for directing the computer to perform a required data processing task Various types of programming languages - Hierarchy of programming languages Machine-language - Binary code - Octal or hexadecimal code Assembly-language (Assembler) - Symbolic code High-level language (Compiler)

5 COMPARISON OF PROGRAMMING LANGUAGES
Machine Language COMPARISON OF PROGRAMMING LANGUAGES Binary Program to Add Two Numbers Hexa program Location Instruction Location Instruction Code 005 FFE9 Program with Symbolic OP-Code Assembly-Language Program Location Instruction Comments ORG 0 /Origin of program is location 0 LDA A /Load operand from location A ADD B /Add operand from location B STA C /Store sum in location C HLT /Halt computer A, DEC 83 /Decimal operand B, DEC -23 /Decimal operand C, DEC 0 /Sum stored in location C END /End of symbolic program LDA 004 Load 1st operand into AC ADD 005 Add 2nd operand to AC STA 006 Store sum in location 006 HLT Halt computer st operand FFE9 2nd operand (negative) Store sum here Fortran Program INTEGER A, B, C DATA A,83 / B,-23 C = A + B END

6 ASSEMBLY LANGUAGE Syntax of the BC assembly language
Each line is arranged in three columns called fields Label field - May be empty or may specify a symbolic address consists of up to 3 characters - Terminated by a comma Instruction field - Specifies a machine or a pseudo instruction - May specify one of * Memory reference instr. (MRI) MRI consists of two or three symbols separated by spaces. ADD OPR (direct address MRI) ADD PTR I (indirect address MRI) * Register reference or input-output instr. Non-MRI does not have an address part * Pseudo instr. with or without an operand Symbolic address used in the instruction field must be defined somewhere as a label Comment field - May be empty or may include a comment

7 PSEUDO-INSTRUCTIONS ORG N Hexadecimal number N is the memory loc.
Assembly Language PSEUDO-INSTRUCTIONS ORG N Hexadecimal number N is the memory loc. for the instruction or operand listed in the following line END Denotes the end of symbolic program DEC N Signed decimal number N to be converted to the binary HEX N Hexadecimal number N to be converted to the binary Example: Assembly language program to subtract two numbers MIN, SUB, DIF, ORG 100 LDA SUB CMA INC ADD MIN STA DIF HLT DEC 83 DEC -23 HEX 0 END / Origin of program is location 100 / Load subtrahend to AC / Complement AC / Increment AC / Add minuend to AC / Store difference / Halt computer / Minuend / Subtrahend / Difference stored here / End of symbolic program

8 TRANSLATION TO BINARY Assembly Language Hexadecimal Code
Symbolic Program Location Content FFE9 MIN, SUB, DIF, ORG 100 LDA SUB CMA INC ADD MIN STA DIF HLT DEC 83 DEC -23 HEX 0 END

9 ASSEMBLER - FIRST PASS -
Source Program - Symbolic Assembly Language Program Object Program - Binary Machine Language Program Two pass assembler 1st pass: generates a table that correlates all user defined (address) symbols with their binary equivalent value 2nd pass: binary translation First pass First pass LC := 0 Scan next line of code Set LC yes no no Label ORG yes yes Store symbol END in address- symbol table together with no Go to value of LC second pass Increment LC

10 ASSEMBLER - SECOND PASS -
Machine instructions are translated by means of table-lookup procedures; (1. Pseudo-Instruction Table, 2. MRI Table, 3. Non-MRI Table 4. Address Symbol Table) Second pass LC <- 0 Done Scan next line of code Set LC yes yes Pseudo yes no ORG END instr. no no DEC or yes no HEX MRI Convert operand Get operation code Valid to binary and set bits 2-4 no non-MRI and store instr. in location Search address- given by LC symbol table for yes binary equivalent of symbol address and set bits 5-16 Store binary Error in equivalent of line of yes no instruction code I in location given by LC Set Set first first bit to 1 bit to 0 Assemble all parts of binary instruction and Increment LC store in location given by LC

11 Assignment Construct Basic computer Assembler using C# windows application as following:


Download ppt "Assembler CASE Tool."

Similar presentations


Ads by Google