List of Listings


Chapter 1: Hello, World of Assembly Language

Listing 1-1: The Hello World Program.
Listing 1-2: Variable Declaration and Use.
Listing 1-3: Demonstration of MOV, ADD, and SUB Instructions.
Listing 1-4: Columnar Output Demonstration Using stdio.Puti32Size.
Listing 1-5: Demonstration of stdout.put Field Width Specification.
Listing 1-6: Demonstration of the stdin.getc() Routine.
Listing 1-7: stdin.getiX Example Code.
Listing 1-8: TRY..ENDTRY Example.
Listing 1-9: Nested TRY..ENDTRY Statements.
Listing 1-10: Improperly Exiting a TRY..ENDTRY Statement.
Listing 1-11: The TRY..ENDTRY UNPROTECTED Section.

Chapter 2: Data Representation

Listing 2-1: Decimal to Hexadecimal Conversion Program.
Listing 2-2: Hexadecimal to Decimal Conversion Program.
Listing 2-3: Variable-less Hexadecimal to Decimal Converter.
Listing 2-4: Demonstration of stdin.getd and stdout.putd.
Listing 2-5: AND, OR, XOR, and NOT Example.
Listing 2-6: AND, OR, XOR, and NOT Example.
Listing 2-7: Unsigned I/O.
Listing 2-8: Sign Extension Instructions.
Listing 2-9: Packing and Unpacking Date Data.
Listing 2-10: Character Input Sample.
Listing 2-11: stdin.get Character Input Sample.
Listing 2-12: Testing for End of Line Using Stdin.eoln.

Chapter 3: Memory Access and Organization

Listing 3-1: Demonstration of Address Expressions.

Chapter 4: Constants, Variables, and Data Types

Listing 4-1: Demonstration of the BOUND Instruction.
Listing 4-2: Demonstration of the INTO Instruction.
Listing 4-3: Data Alignment Program Rewritten Using CONST Definitions.
Listing 4-4: Demonstration of VAL Redefinition Using "?" Operator.
Listing 4-5: Pointer Constant Expressions in an HLA Program.
Listing 4-6: Uninitialized Pointer Demonstration.
Listing 4-7: Type-Unsafe Pointer Access Example.
Listing 4-8: Accessing the Length and Maximum Length Fields of a String.
Listing 4-9: Correct Way to Access Length and MaxStrLen Fields of a String.
Listing 4-10: Reading a String from the User.
Listing 4-11: Corrected Program That Reads a String from the User.
Listing 4-12: Reading a String from the User with stdin.a_gets.
Listing 4-13: Problem with String Assignment by Copying Pointers.
Listing 4-14: Copying Strings Using str.cpy.
Listing 4-15: Copying Strings Using str.a_cpy.
Listing 4-16: Demonstration of str.cat and str.a_cat Routines.

Chapter 5: Procedures and Units

Listing 5-1: Example of a Simple Procedure.
Listing 5-2: Program with an Unintended Infinite Loop.
Listing 5-3: Demonstration of Caller Register Preservation.
Listing 5-4: Demonstrating That Caller Preservation Need Not Save All Registers.
Listing 5-5: Demonstration of Global Scope.
Listing 5-6: Example of a Local Variable in a Procedure.
Listing 5-7: Local Variables Need Not Have Globally Unique Names.
Listing 5-8: Accessing Pass by Reference Parameters.
Listing 5-9: Recursive Quicksort Program.
Listing 5-10: Effect of Missing RET Instruction in a Procedure.
Listing 5-11: Effect of Popping Too Much Data off the Stack.
Listing 5-12: Print Procedure Implementation (Using Code Stream Parameters).
Listing 5-13: Demonstration of Value Parameters.
Listing 5-14: Manually Passing Parameters on the Stack.
Listing 5-15: Passing the Result of Some Arithmetic Expression as a Parameter.
Listing 5-16: Accessing a Reference Parameter
Listing 5-17: Passing an Array of Records by Referencing.
Listing 5-18: The stdlib.hhf Header File, as of 01/01/2000.
Listing 5-19: Example of a Simple HLA Unit.
Listing 5-20: Main Program That References External Objects.
Listing 5-21: Modified Main Program with Extrenal Declarations.
Listing 5-22: Correct Number1 Unit with External Declarations.

Chapter 7: Low Level Control Structures

Listing 7-1: Displaying the Address of Statement Labels in a Program.
Listing 7-2: Initializing DWORD Variables with the Address of Statement Labels.
Listing 7-3: Using Register Indirect JMP Instructions.
Listing 7-4: Using Memory Indirect JMP Instructions.

Chapter 8: Files

Listing 8-1: A Simple File Output Program.
Listing 8-2: A Sample File Input Program.
Listing 8-3: Another Sample File Input Program.
Listing 8-4: Demonstration of the fileio.Append Routine.
Listing 8-5: fileio.eoln Demonstration Program.
Listing 8-6: Random Access File I/O Example.
Listing 8-7: Using fileio.truncate to Eliminate Old Data from a File.

Chapter 9: Advanced Arithmetic

Listing 9-1: Extended Precision Multiplication.
Listing 9-2: Unsigned 128/32-Bit Extended Precision Division.
Listing 9-3: Extended Precision Division.
Listing 9-4: 128-Bit Extended Precision Decimal Output Routine.
Listing 9-5: Extended Precision Hexadecimal Input.
Listing 9-6: Extended Precision Unsigned Decimal Input.
Listing 9-7: Mixed Mode FPU Arithmetic.
Listing 9-8: An HLA Program That Generates a Table of Sines.

Chapter 10: Macros and the HLA Compile Time Language

Listing 10-1: The CTL "Hello World" Program.
Listing 10-2: #WHILE..#ENDWHILE Demonstration.
Listing 10-3: Program Equivalent to the Code in Listing 10-2.
Listing 10-4: Simple Procedure Overloading Based on Operand Size.
Listing 10-5: Procedure Overloading Based on Operand Type.
Listing 10-6: Using the Number of Parameters to Resolve Overloaded Procedures.
Listing 10-7: Generating a SINE Look-up Table with the Compile Time Language.
Listing 10-8: Generating Case Conversion Tables with the Compile Time Language

Chapter 13: The MMX Instruction Set

Listing 13-1: HLA Standard Library cs.cpy Routine.
Listing 13-2: HLA Standard Library cs.difference Routine.
Listing 13-3: MMX Implementation of the HLA Standard Library str.upper Procedure.

Chapter 15: Mixed Language Programming

Listing 15-1: Using the @StaticName Compile Time Function.
Listing 15-2: Using the @Offset Compile Time Function.
Listing 15-3: Main HLA Program to Link with a MASM Program.
Listing 15-4: Calling a MASM Procedure from an HLA Program: MASM Module.
Listing 15-5: CalledFromDelphi.HLA Module Containing the Assembly Code.
Listing 15-6: DelphiEx1: Delphi Source Code That Calls an Assembly Procedure.
Listing 15-7: DelphiEx2: Pascal Code for Assembly Return Results Example.
Listing 15-8: ReturnBoolean: Demonstrates Returning a Byte Value in AL.
Listing 15-9: ReturnWord: Demonstrates Returning a Word Value in AX.
Listing 15-10: ReturnDWord: Demonstrates Returning a Dword Value in EAX.
Listing 15-11: ReturnPtr: Demonstrates Returning a 32-Bit Address in EAX.
Listing 15-12: ReturnReal: Demonstrates Returning a Real Value in ST0.
Listing 15-13: DelphiEx3: Sample Program That Demonstrates the Pascal Calling Convention.
Listing 15-14: UsesPascal: HLA Function the Previous Delphi/Kylix Code Will Call.
Listing 15-15: DelphiEx4: Using the register Calling Convention.
Listing 15-16: HLA Code to Support the DelphiEx4 Program.
Listing 15-17: DelphiEx5: Static Data and Delphi Public Symbols Demonstration.
Listing 15-18: HLA Code for DelphiEx5 Example.
Listing 15-19: Cex1: A Simple Example of a Call to an Assembly Function from C++.
Listing 15-20: RetHW.hla: Assembly Code That Cex1 Calls.




The Art of Assembly Language
The Art of Assembly Language
ISBN: 1593272073
EAN: 2147483647
Year: 2005
Pages: 246
Authors: Randall Hyde

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net