CS530.Chap2 - Systems Programming SDSU, CS530 Chapter 2 Guy...

Info iconThis preview shows pages 1–15. Sign up to view the full content.

View Full Document Right Arrow Icon
Systems Programming SDSU, CS530 Chapter 2 Guy E Leonard
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Overview • Basic Assembler Functions • Machine-Dependent Assembler Features • Machine-Independent Assembler Features • One-pass / Multi-pass Assemblers
Background image of page 2
Systems Programming: the Assembler Source Program Assembler Linker object code Loader executable program . . . 003600 . . . 103000 . . . 00C303 . . . 003030 . . . . . . 3030 . . . 3600 . . . 6390 . . . C303 . . . Main Memory
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Introduction to Assemblers Basic functions Translate source, mnemonic operation codes, to their machine language equivalent hex-codes Determine machine addresses to symbolic labels Machine dependant functions Determine machine instruction format and addressing modes Determine addresses of instructions and datums Machine independent functions Implement symbols, literals, program blocks, and control section Evaluate expressions
Background image of page 4
Assembler Directives No machine instructions/data generated Directs assembler to do work START END RESB RESW BYTE WORD BASE * LTORG ORG EQU USE CSECT EXTDEF EXTREF
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Object Code Format Header record Col 1 H Col 2-7 program name Col 8-13 starting address (hex) Col 14-19 length of object program in bytes (hex) Text record Col 1 T Col 2-7 starting address in this record (hex) Col 8-9 length of object code in this record in bytes (hex) Col 10-69 object code (69-10+1)/6=10 instructions End record Col 1 E Col 2-7 address of first executable instruction (hex)
Background image of page 6
Executable Program H ^ COPY ^ 001000 ^ 00107A T ^ 001000 ^ 1E ^ 141033 ^ 482039 ^ 001036 ^ 281030 ^ 301015 ^ 482061 ^ 3C1003 ^ 00102A ^ ... T ^ 00101E ^ 15 ^ 0C1036 ^ 482061 ^ 081044 ^ 4C0000 ^ 454F46 ^ 000003 ^ 000000 T ^ 002039 ^ 1E ^ 041030 ^ 001030 ^ E0205D ^ 30203F ^ D8205D ^ 281030 ^ T ^ 002057 ^ 1C ^ 101036 ^ 4C0000 ^ F1 ^ 001000 ^ 041030 ^ E02 079 ^ 302064 ^ T ^ 002073 ^ 07 ^ 382064 ^ 4C0000 ^ 05 E ^ 001000 Fig 2.3
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Example Program Reads records from input from address F1 Copies to output at address 05 Writes EOF to address 05 Finally, calls RSUB to return to the calling program (operating system)
Background image of page 8
Novel Features of Example Read Data until buffer full, or end of record, or end of file end of record marker is a null character (00 16 ) end of file marker is a zero-length record Nested subroutines (JSUB, RSUB) save link register prior to making nested jump restore link register prior to returning from nested jump
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Example of SIC Assy – fig 2.1
Background image of page 10
Assembler’s functions Convert mnemonic opcodes to their machine language equivalent hex-codes. Convert symbolic operands to their equivalent machine addresses. For each word, determine the instruction format, instruction address, addressing mode, then construct the machine instruction Convert data constants to internal machine numerical representations Construct the object program file and the assembly listing file
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Example of SIC Assy w/object code – fig 2.2
Background image of page 12
Assembling Instruction Challenge – Forward Reference ………… 65 1021 JSUB WRREC 482061 210 2061 WRREC LDX ZERO 041030 48 0 2061 8 1 1 5 opcode x address Forward reference: reference to a label that is defined later in the program
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Two Pass Assembler Pass 1 Assign addresses to all statements in the program Save the values assigned to all labels
Background image of page 14
Image of page 15
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/12/2012 for the course CS 530 taught by Professor Staff during the Spring '08 term at San Diego State.

Page1 / 53

CS530.Chap2 - Systems Programming SDSU, CS530 Chapter 2 Guy...

This preview shows document pages 1 - 15. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online