Download
assembly language n.
Skip this Video
Loading SlideShow in 5 Seconds..
Assembly Language PowerPoint Presentation
Download Presentation
Assembly Language

Assembly Language

545 Views Download Presentation
Download Presentation

Assembly Language

- - - - - - - - - - - - - - - - - - - - - - - - - - - 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