NCA&T COMP 375 - Machine Language (12 pages)

Previewing pages 1, 2, 3, 4 of 12 page document View the full content.
View Full Document

Machine Language



Previewing pages 1, 2, 3, 4 of actual document.

View the full content.
View Full Document
View Full Document

Machine Language

28 views


Pages:
12
School:
North Carolina A&T State University
Course:
Comp 375 - Computer Architecture and Organization

Unformatted text preview:

9 16 2008 Bunch of Bytes Machine Language Machine language is binary codes that the computer executes The computer fetches the instructions from memory and executes them COMP375 Computer Architecture and Organization Machine language for a square root program Assembler and Machine Instruction Format Assembler language is the easy way to write machine hi llanguage Each line of an assembler program generates one machine language instruction The assembler allows you to use variable names instead of numerical addresses and instruction mnemonics instead of numerical operation codes 8b 89 7d f8 45 45 f8 75 e0 f8 03 e2 89 8b 45 8b 45 f8 89 45 ec 8b 45 ec 45 e0 ba 00 00 00 00 f7 f8 d1 f8 89 45 ec 3b 45 f4 The general format for a machine language i t ti is instruction i Op code Operands The operands can be a memory address address a register or a value 1 9 16 2008 Op codes Data Location Each assembler instruction represents a numerical machine language opcode add cmp dec idiv jmp push sar 05 3B FF 7F 39 68 D0 Intel Assembler The Intel assembler allows you to use one mnemonic for different op codes There are several versions of the add instruction based on the size of the operands The assembler picks the correct op code Opcode Instruction 04 ib ADD AL imm8 05 iw ADD AX imm16 05 id ADD EAX imm32 80 0 ib ADD r m8 imm8 81 0 iwADD r m16 imm16 81 0 id ADD r m32 imm32 83 0 ib ADD r m16 imm8 83 0 ib ADD r m32 imm8 00 r ADD r m8 r8 01 r ADD r m16 r16 01 r ADD r m32 r32 02 r ADD r8 r m8 03 r ADD r16 r m16 03 r ADD r32 r m32 Register The data is in a CPU register Memory The data is in a location in RAM Immediate The data is part of the instruction Immediate data items are read only Mnemonic to Op Code Mapping Description ADD imm8 to AL ADD imm16 to AX ADD imm32 to EAX ADD imm8 to r m8 ADD imm16 to r m16 ADD imm32 to r m32 ADD sign extended ADD sign extended i ADD r8 to r m8 ADD r16 to r m16 ADD r32 to r m32 ADD r m8 to r8 ADD r m16 to r16 ADD r m32 to r32 Intel assembler uses the same



View Full Document

Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...
Login

Join to view Machine Language and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Machine Language and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?