Preview

Program Using Assembly Language

Good Essays
Open Document
Open Document
701 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Program Using Assembly Language
; This is example of mixing C code and assembly

; this file demonstrates following:
; - declaring stdcall procedure, using pure assembly (fasm_stdcall_avg)
; - declaring stdcall procedure, using FASM standard macros (fasm_stdcall_avg2)
; - declaring ccall procedure, using pure assembly (fasm_ccall_avg)
; - declaring ccall procedure, using FASM standard macros (fasm_stdcall_avg2)
; - calling stdcall procedure defined with C (c_stdcall_display in access_c)
; - calling ccall procedure defined with C (c_ccall_display in access_c)
; - access data defined with C (c_int in access_c)

; definitions of macros we use include 'win32a.inc'

format MS COFF

;-----------------------------------------------------------------------------
; declarations

; declare procedures as public, so C code can use them
; public names must be "decorated" by prepending "_".
; stdcall procedure names must be be also decorated by "@" and size of arguments at the end public fasm_stdcall_avg as '_fasm_stdcall_avg@8' public fasm_stdcall_avg2 as '_fasm_stdcall_avg2@8' public fasm_ccall_avg as '_fasm_ccall_avg' public fasm_ccall_avg2 as '_fasm_ccall_avg2' public access_c as '_access_c'

; declare our data as public, so we can access it in C code public fasm_string as '_fasm_string'

; declare C procedures as extern, so we can access it here extrn '_c_stdcall_display@8' as c_stdcall_display extrn '_c_ccall_display' as c_ccall_display extrn '_printf' as printf

; declare C data as extern, so we can access it here extrn '_c_int' as c_int:dword

; code section section '.text' code readable executable

;-----------------------------------------------------------------------------
; declare "fasm_stdcall_avg" using pure assembly
; this computes average value of two unsigned numbers fasm_stdcall_avg: ; create stack frame

You May Also Find These Documents Helpful

  • Good Essays

    Programing Problems

    • 721 Words
    • 3 Pages

    IT 210 13 Programming Problems Pseudocode for chapter 2 checkpoint Frank T. Hartman IT 210 13 Programming Problems Pseudocode for chapter 2 checkpoint Frank T. Hartman Programming Problem 1 Main Module Declare SalesAmount As Real Declare CommissionRate As Real Declare CommissionEarned…

    • 721 Words
    • 3 Pages
    Good Essays
  • Good Essays

    Is411 Study Guide

    • 2595 Words
    • 11 Pages

    Procedure – a written statement describing the steps required to implement a process. Procedures are technical steps taken to achieve policy goals (how-to document)…

    • 2595 Words
    • 11 Pages
    Good Essays
  • Good Essays

    c. Modify the program of Part b so that at the option of the user, it displays…

    • 300 Words
    • 2 Pages
    Good Essays
  • Powerful Essays

    required. Ability to use air tools, power tools and hand tools is required. Experience in assembly…

    • 463 Words
    • 2 Pages
    Powerful Essays
  • Better Essays

    It325 Assignment 7

    • 1251 Words
    • 6 Pages

    Within each process the statements are executed sequentially, but statements from different processes can be interleaved in any order that's consistent with the constraints imposed by the semaphores. When answering the questions below assume that once execution begins, the processes will be allowed to run until all 3 processes are stuck in a wait() statement, at which point execution is halted.…

    • 1251 Words
    • 6 Pages
    Better Essays
  • Good Essays

    c Codes

    • 14476 Words
    • 58 Pages

    Find Area and perimeter of circle in c code. This c program makes a contrasting concept that how a return statement can return more than one value. Usually in C programming we make a call by value. This means that in general you cannot alter the actual arguments. But if desired, it can always be achieved through a call by reference. Using a call by reference intelligently we can make a function return more than one value at a time, which is not possible ordinarily. This is shown in the c program find area and perimeter of circle given below.…

    • 14476 Words
    • 58 Pages
    Good Essays
  • Powerful Essays

    Compiler Construction

    • 2658 Words
    • 11 Pages

    Brainstorm each of the variables in the decision you want the decision tree to help you make. Write them down on a sheet of paper, or in the margin of your main sheet.…

    • 2658 Words
    • 11 Pages
    Powerful Essays
  • Good Essays

    2. Create a program that determines If the input age is qualified to vote or not. Qualifying age is 18, If not (else), print” too young!”…

    • 1323 Words
    • 6 Pages
    Good Essays
  • Satisfactory Essays

    programming problem

    • 980 Words
    • 5 Pages

    Complete the programming problems 1 and 2 as described below. DO NOT COMPLETE THE PROBLEMS FROM THE TEXT…

    • 980 Words
    • 5 Pages
    Satisfactory Essays
  • Satisfactory Essays

    c ++ program

    • 252 Words
    • 1 Page

    In the statement cin >> y;, y can only be an int or a double variable.…

    • 252 Words
    • 1 Page
    Satisfactory Essays
  • Satisfactory Essays

    ghjasgskjsxk

    • 4020 Words
    • 17 Pages

    bhsbkjbkjbaskjbkjsakjshajhbjhasb hsahkjhasjkhkjha aihljah hsalhcalkhclkah haskihalkhlkhc sdjhvkjgsi shdfh sjgvhsjh jhvkj hjdvh jsdf svhhvk s hhkjs f shiofhoi syoiufe iydoi siufewiuoiheafiuh v ifyei esfy oswf woiyfosie fvi si u…

    • 4020 Words
    • 17 Pages
    Satisfactory Essays
  • Powerful Essays

    THUMB Tutorial

    • 7539 Words
    • 27 Pages

    This document is made to teach those who want to learn assembly for the ARM7-Thumb mode. In this document I shall teach the components more on a need-to-know basis.…

    • 7539 Words
    • 27 Pages
    Powerful Essays
  • Good Essays

    Gate: X86 and Accumulator

    • 1607 Words
    • 7 Pages

    10) Let the contents of C register be 00000000. The contents of C register after execution of…

    • 1607 Words
    • 7 Pages
    Good Essays
  • Powerful Essays

    C Program

    • 2161 Words
    • 9 Pages

    // This file is a good place to add code for any additional processing that is…

    • 2161 Words
    • 9 Pages
    Powerful Essays
  • Powerful Essays

    None

    • 885 Words
    • 4 Pages

    usage such as execution and execution by steps and programming of these processors will be…

    • 885 Words
    • 4 Pages
    Powerful Essays

Related Topics