1 / 11

Assembly Language

Assembly Language. part 1. Some terminology. Assembly language: a low-level language that is a little more human-friendly than machine language assembler: a program that translates assembly language source code into executable form object code: machine language program (assembler output).

Thomas
Download Presentation

Assembly Language

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Assembly Language part 1

  2. Some terminology • Assembly language: a low-level language that is a little more human-friendly than machine language • assembler: a program that translates assembly language source code into executable form • object code: machine language program (assembler output)

  3. Types of assemblers • Resident assembler: an assembler written for its own platform, using the native instruction set • Cross assembler: assemble run on one platform to produce object code for another • Disassembler: program that attempts to recover source code from object code (not 100% successful)

  4. Assembly language instructions • Mnemonics: abbreviated words used instead of machine language hex code; • have one-to-one correspondence with underlying instruction • always possible to determine underlying machine language statement from assembly language mnemonic, but not vice-versa • Pseudo-ops: assembly language statements used mostly for data declaration; do not correspond to specific machine language instructions

  5. Pep/8 assembly language • General syntax notes: • one instruction per line of code • comments start with semicolon, continue until end of line • not case-sensitive • Spacing: • at least one space required after each instruction (mnemonic or pseudo-op) • otherwise doesn’t matter • last line of program must be .END pseudo-op

  6. Pep/8 Assembly Language • Mnemonic instruction format: • 2-6 letter instruction specifier (most or 3-4 letters) • operand specifier, usually followed by a comma and • 1-3 letter address mode specifier (most are 1) • Examples: LDA 0x0014,i ; load hex value 14 to A LDX 0x1110,d ; load data at address 1110 into x • Entire Pep/8 assembly language instruction set is printed on the inside front cover (and on page 191) of your textbook

  7. Pep/8 Assembly Language • Addressing mode specifiers: • i: immediate • d: direct • n: indirect • s: stack-relative • sf: stack-relative deferred • x: indexed • sx: stack-indexed • sxf: stack-indexed deferred

  8. Pep/8 Assembly Language • Unimplemented opcodes • instructions available at assembly language level, even though they are not (directly) available at the machine language level • represent operations handled by the operating system • They include: • NOPn: unary no operation trap • NOP: non-unary NOP • DECI: decimal input trap • DECO: decimal output trap • STRO: string output trap

  9. Pseudo-ops • .ADDRSS: used to crate labeled jump destinations • .ASCII: specifies char string • .BLOCK: allocates specified # of bytes, initializes whole set to zero • .BURN: used for OS configuration • .BYTE: allocates one byte; can specify hex or decimal content • .END: stop code • .EQUATE: equate symbol with literal value; like # define in C/C++ • .WORD: allocates one word of memory

  10. Example program 1 Comment ; Program example 1 CHARO 0x0010 ,d CHARO 0x0011 ,d CHARO 0x0012 ,d CHARO 0x0013 ,d CHARO 0X0014 ,d STOP .ASCII "Arrr!" .END Instructions: each outputs one character; starting address of program is 0000, and each instruction (except STOP) is 3 bytes long; STOP is one byte Data

  11. Object code & assembler output from program example 1

More Related