ScholarQuill logoScholarQuillUniversity Notes
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
Study Tools
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
Contact
ScholarQuill logo
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
ScholarQuill logoScholarQuillUniversity Notes
Study PortalCOMP3137Knowledge Different Da…
Ctrl + K
Login
Explore
Search
Semester
Papers
CGPA
    COMP3137

    Computer Organization and Assembly Language

    Progress0 / 73 done
    Topics73
    1Introduction to Computer Organization2Assembly Language3Comparison of Low-Level and High-Level Languages
    4General Purpose and Special Purpose Registers5Introduction and Usage of RAM6Processor7Registers8System Bus9Instruction Execution Cycle10Assembly and Machine Language11Assembler12Linker and Link Libraries13Programmer's View of a Computer System14RISC and CISC Architecture15Physical Address Calculation16Basic Memory Organization17CPU Organization18Top Level View of Computer Function and Interconnection19Assembler Instruction Cycle20Execute Cycle21Interrupts22Interrupt Cycle23Memory Connection24Input/Output Connection25CPU Connection26MASM27MIPS28Defining Data in MASM Assembler29Elements of Assembly Language30Integer Constants31Integer Expressions32Real Number Constants33Character Constants34String Constants35Reserved Words36Identifiers37Directives38Instructions39The NOP (No Operation) Instruction40Adding and Subtracting Integer41INC and DEC Instructions42NEG Instruction43How to Move Integer Number in Register44Adding and Subtracting Numbers in Registers45Declaration and Initialization of Variables46Moving Data from Variable to Register47Data Definition Statement48BYTE and SBYTE Data49WORD and SWORD Data50Defining DWORD and SDWORD Data51Knowledge about Different Data Types52Operations, Array & Loops53Division and Multiplication in Assembly54Jumps Based on Specific Flags55Jumps Based on Equality56Simple Jump Statements57Jumps Based on Specific Condition58Code Examples59Practice on MASM60Procedures61File Operations Procedures62Labels in Procedures63Stack64Runtime Stack65Conditional Control Flow Directives66Compound Expressions67Data Representation & Conversion68Architecture69Data Path70Control Unit71Critical Path72General Principles of Pipelining73Pipelined Y86 Implementations
    7 min read
    Topic 51 of 73
    Topic Study Note Illustration
    51

    Knowledge about Different Data Types

    In assembly language programming, data types define how data is stored in memory and how it is interpreted. The data type determines the size , range ,...

    Knowledge About Different Data Types in Assembly Language

    In assembly language programming, data types define how data is stored in memory and how it is interpreted. The data type determines the size, range, and format of the data. In general, the term "data type" refers to whether the data is an integer, character, or something else, and whether it's signed or unsigned, for example.

    Here’s a breakdown of the most commonly used data types in assembly language, particularly focusing on the low-level types that directly map to machine-level operations.


    1. Bit (Individual Bit Data Type)

    • Size: 1 bit (the smallest unit of data).
    • Description: A bit is the smallest unit of data and can hold a value of either 0 or 1.
    • Use Case: While assembly languages don't often provide direct support for manipulating individual bits, you can still use bits for flags, toggles, or certain bitwise operations.

    2. Byte

    • Size: 8 bits (1 byte).
    • Range:
      • Unsigned Byte: 0 to 255 (decimal)
      • Signed Byte: -128 to 127 (decimal)
    • Description: A byte is 8 bits, and it is one of the most common data units. It can be used to store small integer values, characters, or even parts of larger data types.
    • Use Case:
      • Storing ASCII characters (each character is typically 1 byte).
      • Storing small values in ranges that fit within 0–255 for unsigned values or -128 to 127 for signed values.

    Examples:

    • Unsigned Byte (BYTE): Storing data like flags, or small non-negative numbers.
    • Signed Byte (SBYTE): Storing small signed integers, e.g., temperatures, sensor values.
    section .data
        byteValue DB 200  ; Unsigned byte with value 200
        signedByte DB -50 ; Signed byte with value -50
    

    3. Word

    • Size: 16 bits (2 bytes).
    • Range:
      • Unsigned Word: 0 to 65535 (decimal)
      • Signed Word: -32768 to 32767 (decimal)
    • Description: A word is 2 bytes, commonly used to store larger values than a byte can handle. It can be either signed or unsigned.
    • Use Case:
      • Storing small numbers or addresses (e.g., memory addresses in a 16-bit system).
      • Storing numerical values that fit within a 16-bit range.

    Examples:

    • Unsigned Word (WORD): Storing unsigned integers like counts or addresses.
    • Signed Word (SWORD): Storing signed integers like temperatures, small measurements, etc.
    section .data
        wordValue DW 5000  ; Unsigned word with value 5000
        signedWord DW -150 ; Signed word with value -150
    

    4. Double Word (DWORD)

    • Size: 32 bits (4 bytes).
    • Range:
      • Unsigned DWORD: 0 to 4,294,967,295 (decimal)
      • Signed DWORD: -2,147,483,648 to 2,147,483,647 (decimal)
    • Description: A double word is 4 bytes, and it can hold much larger numbers than a word or byte. It can represent both signed and unsigned 32-bit values.
    • Use Case:
      • Used when you need to store larger values (e.g., file sizes, memory addresses, counters).
      • Storing both signed and unsigned large integers.

    Examples:

    • Unsigned DWORD (DWORD): Storing large counts, sizes, or addresses.
    • Signed DWORD (SDWORD): Storing signed large values like temperature differences, large counters.
    section .data
        fileSize DD 4294967295   ; Unsigned DWORD for file size
        bankBalance DD -500      ; Signed DWORD for negative balance
    

    5. Quad Word (QWORD)

    • Size: 64 bits (8 bytes).
    • Range:
      • Unsigned QWORD: 0 to 18,446,744,073,709,551,615 (decimal)
      • Signed QWORD: -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 (decimal)
    • Description: A quad word is 8 bytes, and it can store very large integer values. This is commonly used in 64-bit systems, particularly for handling large integers.
    • Use Case:
      • Storing very large values like high-precision time stamps, large addresses, or high-range counters.

    Examples:

    • Unsigned QWORD (QWORD): Storing large values such as high-precision timestamps.
    • Signed QWORD (SQWORD): Storing very large signed numbers.
    section .data
        largeValue QWORD 123456789012345678  ; Unsigned QWORD
        largeNegative QWORD -98765432198765432  ; Signed QWORD
    

    6. Floating Point Types (REAL4, REAL8, REAL10)

    • REAL4 (Single Precision Floating Point):

      • Size: 32 bits (4 bytes).
      • Range: Approximately ±3.4E-38 to ±3.4E+38.
      • Description: Used for storing floating-point numbers (decimals) with single precision (a lower level of accuracy).
      • Use Case: Storing decimal numbers when memory is limited and high precision is not required (e.g., some scientific calculations, graphics).
    • REAL8 (Double Precision Floating Point):

      • Size: 64 bits (8 bytes).
      • Range: Approximately ±1.7E-308 to ±1.7E+308.
      • Description: Used for storing floating-point numbers with double precision (higher accuracy than REAL4).
      • Use Case: Used when higher precision is required in calculations, such as scientific or engineering applications.
    • REAL10 (Extended Precision Floating Point):

      • Size: 80 bits (10 bytes).
      • Range: Extremely large and small values with high precision.
      • Description: Used for extremely high precision, often used in financial calculations or some scientific applications.

    Examples:

    • REAL4: Storing single-precision floating-point numbers for calculations.
    • REAL8: Storing double-precision floating-point numbers for higher-accuracy calculations.
    section .data
        singlePrecision REAL4 3.14    ; 32-bit floating-point number
        doublePrecision REAL8 3.14159265358979  ; 64-bit floating-point number
    

    7. Character Data Types

    • CHAR: A character type typically stored in a byte. It holds individual characters.
      • Size: 8 bits (1 byte).
      • Description: A character type is usually represented by a single ASCII or Unicode character.
      • Use Case: Storing letters, symbols, or small strings in memory.
    section .data
        myChar DB 'A' ; Define a character in a byte
    
    • STRING: A sequence of characters stored in memory.
      • Size: Varies depending on the number of characters in the string (each character is 1 byte in ASCII).
      • Description: Strings are sequences of characters, often terminated by a null character (0x00), especially in C-style strings.
      • Use Case: Storing sequences of characters for output (e.g., messages) or input (e.g., user input).
    section .data
        myString DB "Hello, World!", 0 ; Define a null-terminated string
    

    8. Pointer (Address)

    • Size: Typically 4 bytes (in a 32-bit system) or 8 bytes (in a 64-bit system).
    • Description: A pointer is a data type used to store memory addresses.
    • Use Case: Pointers are crucial in assembly for working with memory locations and directly accessing data. They point to variables or other data structures in memory.
    section .data
        pointer DD offset myVar ; Define a pointer to a variable myVar
    

    9. Boolean Type

    • Size: Typically 1 byte (although only 1 bit is needed).
    • Description: A boolean represents a true or false value. In many assembly languages, booleans are just 1 or 0.
    • Use Case: Storing flags or conditions where only two states are possible (true/false, yes/no, 1/0).
    section .data
        flag DB 1 ; Boolean flag, 1 means true
    

    Summary of Common Data Types in Assembly Language

    Data Type Size (bits) Range (Decimal) Description
    Bit 1 bit 0 or
    ← Previous topic 50
    Defining DWORD and SDWORD Data
    Next topic 52 →
    Operations, Array & Loops

    Past Papers

    Open this section to view and download past papers

    Click on Show Past Papers to load available exam papers.

    Reading Progress
    0%
    7mremaining
    1.1kwords
    Intermediatelevel
    On This Page

    No headings found

    Study Toolkit

    Subject Portal

    Computer Organization and Assembly Language