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
  • Satisfactory Essays

    code program

    • 317 Words
    • 2 Pages

    (Compilation screenshot) - Insert here a screenshot of the result of compiling the above source code: NetBeans IDE 7.3.1 compiles but it did not go to the screen so I could see it, this is why I sent you a message yesterday to let you know this. But the program did run without any problems.…

    • 317 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Intro the Programming

    • 386 Words
    • 5 Pages

    In general terms, a program that is broken into smaller units of code, such as methods, is known as a(n) _______.…

    • 386 Words
    • 5 Pages
    Satisfactory Essays
  • Good Essays

    it320 assignment 1-3

    • 1779 Words
    • 8 Pages

    1. Which of the following is true about 1 bit? (C. Represents one binary digit)…

    • 1779 Words
    • 8 Pages
    Good 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
  • Powerful Essays

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

    • 463 Words
    • 2 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
  • 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
  • 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
  • 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

    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
  • 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