Segments and pseudo operations
Sponsored Links
This presentation is the property of its rightful owner.
1 / 10

Segments and Pseudo Operations PowerPoint PPT Presentation

  • Uploaded on
  • Presentation posted in: General

Segments and Pseudo Operations. Program Development. Format of the source code. Each line of code is divided into fields: Label Field Operation Field Operand Field Comment Field. Code and Data Segments. We can organize the code into blocks called segments

Download Presentation

Segments and Pseudo Operations

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript

Segments and Pseudo Operations

Program Development

Format of the source code

  • Each line of code is divided into fields:

    • Label Field

    • Operation Field

    • Operand Field

    • Comment Field

Code and Data Segments

  • We can organize the code into blocks called segments

  • Segments specify sections of code, data, and reserved areas of memory

  • Segments are useful for modularized program development


Pseudo-Instructions (1)

  • Pseudo-instructions are directives for the Assembler

  • We have already seen some of them

  • ORG - defines the absolute address of a segment

    ORG $9000 ;set origin of text segment to $9000

  • EQU - defines an equivalent symbol for a value

    ONE EQU $01

    PORTB EQU $1004

  • END – delimits the end of the assembly

  • RMB – stands for “reserve memory byte(s)”. It allocates a specified number of bytes.

    varname RMB 2

  • DS – stands for “define space”. It is the same as RMB

    varname DS 2

Pseudo Instructions (2)

  • FCB – stands for “form constant byte(s)”. It allocates byte(s) of storage with initialized values

    addrfirstval FCB $01,250,@373,%111001101

    FCB $23

  • DB – stands for define byte(s). It is the same as FCB

  • FDB – stands for “form double byte(s)”. It is a 16-bit version of FCB

    FDB $0001,$1234,$FFFA

  • DW – stands for “define word”. It is the same as FDB

  • FCC – stands for “form constant character(s)” and it is used to allocate and initialize memory for storage of a string

    addrfirstchar FCC “some string”

    FCC “Alarm 5A high!”


* program to drive a stepper motor

size equ 4

PORTB equ $1004 ;PB3-PB0 to stepper

org $9000

main ldaa #size

ldx #steps;address at which $05 is located

step ldab 0,x


stab PORTB; step the motor


bne step

bra main

stepsfcb 5,6,10,9;output sequence


fdb main


Pseudo Instructions (3)

  • FILL – sets a number of bytes to a specified value

    FILL $FF 16

  • ZMB – stands for “Zero Memory Bytes” and initialize a specified number of memory bytes to zero

    ZMB 16

  • BSZ – stands for “Block Store Zeros and it the same as ZMB

    BSZ 16

Assembly two-pass Process

  • For an assembler to understand labels and symbols, it must work through the source code twice . It follows as a two-pass process

  • After the first step the assembler build a “symbol table” that gives the address of each label and symbol.

Assembler options and preprocessor directives

  • Assembler options and preprocessor directives are assembler specific

  • Assembler options must occur at the beginning of the source code, and start in column one of the code with a $ sign.

  • The preprocessor directives follows the assembler options and begin with a %. The preprocessor directives tell the assembler to do something before beginning the assembly process%INCLUDE “d:\include\iolib.h”

  • Login