ScholarQuill logoScholarQuillUniversity Notes
  • Notes
  • Past Papers
  • Blogs
  • Todo
Login
ScholarQuill logoScholarQuillUniversity Notes
Login
NotesPast PapersBlogsTodo
More
SubjectsDiscussionCGPA CalculatorGPA CalculatorStudent PortalCourse Outline
About
About usPrivacy PolicyReportContact
Notes
Past Papers
Blogs
Todo
Analytics
    Current Subject
    🧩
    Computer Organization and Assembly Language
    COMP3137
    Progress0 / 73 topics
    Topics
    1. Introduction to Computer Organization2. Assembly Language3. Comparison of Low-Level and High-Level Languages4. Register Types (16-bit): General Purpose and Special Purpose Registers5. Introduction and Usage of RAM6. Processor7. Registers8. System Bus9. Instruction Execution Cycle10. Assembly and Machine Language11. Assembler12. Linker and Link Libraries13. Programmer's View of a Computer System14. RISC and CISC Architecture15. Physical Address Calculation16. Basic Memory Organization17. CPU Organization18. Top Level View of Computer Function and Interconnection19. Assembler Instruction Cycle20. Execute Cycle21. Interrupts22. Interrupt Cycle23. Memory Connection24. Input/Output Connection25. CPU Connection26. MASM27. MIPS28. Defining Data in MASM Assembler29. Elements of Assembly Language30. Integer Constants31. Integer Expressions32. Real Number Constants33. Character Constants34. String Constants35. Reserved Words36. Identifiers37. Directives38. Instructions39. The NOP (No Operation) Instruction40. Adding and Subtracting Integer41. INC and DEC Instructions42. NEG Instruction43. How to Move Integer Number in Register44. Adding and Subtracting Numbers in Registers45. Declaration and Initialization of Variables46. Moving Data from Variable to Register47. Data Definition Statement48. BYTE and SBYTE Data49. WORD and SWORD Data50. Defining DWORD and SDWORD Data51. Knowledge about Different Data Types52. Operations, Array & Loops53. Division and Multiplication in Assembly54. Jumps Based on Specific Flags55. Jumps Based on Equality56. Simple Jump Statements57. Jumps Based on Specific Condition58. Code Examples59. Practice on MASM60. Procedures61. File Operations Procedures62. Labels in Procedures63. Stack64. Runtime Stack65. Conditional Control Flow Directives66. Compound Expressions67. Data Representation & Conversion68. Architecture69. Data Path70. Control Unit71. Critical Path72. General Principles of Pipelining73. Pipelined Y86 Implementations
    COMP3137›Knowledge about Different Data Types
    Computer Organization and Assembly LanguageTopic 51 of 73

    Knowledge about Different Data Types

    7 minread
    1,126words
    Intermediatelevel

    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 load past papers

    Click on Show Past Papers to see past papers.
    On This Page
      Reading Stats
      Est. reading time7 min
      Word count1,126
      Code examples0
      DifficultyIntermediate