Assembly Language Help

I know this proably not the right place to post this topic but I couldn't find anywhere else.
Basically I am developing a program for high school kids learning assembly language. I am developing it in Java but it has been over 10 years since I have ever done any assembly. I am working through good books and tutorials to refresh my mind. I have come to the example below and got stuck. can anyone spare 5 mins to explain ech line of the following to me in real simple terms. Duke dollars available.
Load R1,R8
add R1,16
Loadind R2,R1
add R1,8
loadind R3,R1
add R3,R2
sub R1,4
storeind R3,R1
Many thanks

It looks like an addition of operands on the heap of a 32bit processor.
R8 is a pointer to a heap which has the following format:   +-------+-------+-------+-------+-------+-------+-------+
   |       |       |       |       |   A   |   C   |   B   |
   +-------+-------+-------+-------+-------+-------+-------+
   R8    R8+4    R8+8    R8+12   R8+16   R8+20   R8+24What we want is to execute C=A+B.
Load R1,R8We are going to have R1 pointing on the place in the heap we are interested in. R8 is probably a register reserved for the heap, which should not be changed, so we copy it into R1.
add R1,16Move R1 pointer so that it points 16 bytes higher, where A is.
Loadind R2,R1Load the content of A (pointed by R1) into R2. Note that we are not interested here in the value of R1, but in the value pointed by R1, thus the "ind" for "indirect".
add R1,8Move the R1 pointer to point 8 bytes higher, where B is.
loadind R3,R1Load the content of B (pointed bt R1) into R3.
add R3,R2Add R2 to R3 (the result is stored into R3).
sub R1,4Move the R1 pointer to point 4 bytes lower, where C is.
storeind R3,R1Store the result into C.
Jerome.

Similar Messages

  • Using C functions from IA-32 assembly language

    Is it possible to use 32-bit assembly language to call C functions in 64-bit linux?
    Background: I'm learning 32-bit AT&T syntax Linux assembly language programming. The only reason for 32-bit is that's what's covered in the book I have. Some simple examples assemble, link, and execute in Arch 64 using GNU either gcc or as + ld -- with no changes either to code or command line flags.
    The problem: I'm having trouble with C function calls. Even after replacing register names (e.g., edi -> rdi) and mnemonics (e.g., movl -> movq), I find that a program which calls printf and exit never prints anything, and never returns. Hence the question.
    I can post code if needed (it's on my other machine), but this is really more of a general question -- is it possible to call C functions in Arch 64 using 32-bit AT&T syntax, and if so, how.
    Thanks!

    Not even a typo, just confusion. The CPU is an Intel Core 2 Duo -- so it's actually x86-64.
    I realize that NASM is not GAS, but checking the NASM manual helped me figure out a few things about calling 64-bit C functions:
        http://www.nasm.us/doc/nasmdo11.html
    It took a while to figure out how to correctly call printf. The missing clue was here:
        http://www.mit.edu/~6.035/handouts-2007 … convention
    printf reads the number of variable arguments from %rax. In this example, printf is called with no variable arguments:
    # c_functions.s - Calls 64-bit C functions putchar, printf, and exit
    .section .data
    a:
    .byte 'a'
    newline:
    .byte '\n'
    hello:
    .asciz "hello, world\n"
    .section .text
    .globl main
    main:
    movq a, %rdi # used as argument for putchar
    call putchar
    movq newline, %rdi # used as argument for putchar
    call putchar
    movq $hello, %rdi # first argument for printf (i.e., the format string)
    movq $0, %rax # number of variable arguments for printf
    call printf
    movq $0, %rdi
    call exit
    For simplicity, I compiled and linked with gcc (in other words, I let gcc figure out how to properly call as and ld):
        gcc c_functions.s
    If I can figure out how to pass variable arguments to printf, I'll post that. Based on the MIT reference linked above, it sounds like those arguments would be passed in SSE registers.

  • Assembly language on Mac OS X

    I just purchased two books. The first is called "Write Great Code -- Volume 1: Understanding the Machine". It is not about assembly language in specific, just about understanding how computers work on a low level. The other is called "Assembly Language: Step-by-Step" by Jeff Duntemann. I've only read the introduction. It teaches assembly language for Intel-based computers (that's me!), but it also says that it's for DOS and Linux. However, I believe that the reason it says this is because it teaches using the NASM assembler, which, at the time this second edition of the book was published, was only available for DOS and Linux. However, they now have a Mac OS X version of NASM, and I've download it. So, here are my questions:
    1.) Given the information I just gave about this book, I want to make sure that the information and code in it will apply to Mac OS X. It certainly sounds like it will, and I understand that there may be minor differences, but I just want to make sure that I'm in the right ballpark here by using this book.
    2.) Since it teaches NASM, I'm assuming that NASM was the right assembler for me to download. I also just wanted to check and see if there's any other tools I should be downloading. The book mentions a NASM-IDE, but says that it's for DOS only. Is there anything else like this (or anything else at all) that I should obtain?
    3.) Does NASM need to be installed? I went to the NASM website and downloaded the newest version (2.08rc1) for Mac OS X, and it unzipped in my Downloads folder. I've opened the folder and it's a bunch of files that I can't recognize (no install or app files in other words -- just files like rdf2bin, rdf2com, idrdf, and so forth). Is there anything else I need to do? Should I move this folder somewhere? What else do I need to do to get started here? Where would I write my code? How would I run the code? As of right now I have no idea where to go from here, and as you can tell I know nothing about how all this works. Maybe the book will tell me more when I get to the first code sample in the book, but it doesn't look like it, so I just wanted to ask for any information that anyone has time to give about anything relating to getting starting with assembly language and NASM on Mac OS X.
    Thanks in advance for any help. I'd love to hear any input or recommendations on this subject, since it's something I really know nothing about, but you gotta start somewhere!

    Okay, so I found a site to guide me through the installation of NASM on Mac OS X, and it said that 2.08rc1 is a "release candidate" (thus the "rc" part -- yeah, I'm not too sharp), and that I should have downloaded the newest version that didn't have "rc" in it, so I went back and downloaded 2.07. Unlike with 2.08rc1, there wasn't a folder on the website for a Mac OS X version, just DOS and Linux and Win32 and whatnot, but the site that was guiding me said to download the file called nasm-2.07.tar.bz2 (or something like that), so that's what I did. It then gave me instructions for configuring and installing NASM via the terminal, and it worked great! I've compiled and installed NASM, so I've gotten that far, but the rest of my questions in the previous post still apply. For example, I still want to make sure the book I bought will be applicable to assembly language on Mac OS X. Also, I'd like to know if there is anything else (like the NASM-IDE I mentioned in the above post) that I should download. And, finally, I still don't know where to go from here to get started with coding assembly language (I mean, for example, I think I read in my book that you write the code in a text editor -- is that right? How's that work?). Any further input on any of this or anything from the previous post above would be greatly appreciated. Thanks!

  • Assembly language in X-Code

    I am currently taking assembly language for my undergrad. i have Xcode installed in my computer but i have no idea how to use the xcode for the assembly language. can anyone help me with that.

    Which assembly language are you referring to?
    The documentation from apple can be found here: http://developer.apple.com/library/mac/documentation/DeveloperTools/Reference/As sembler/Assembler.pdf.

  • ASSEMBLY LANGUAGE FILE TO .CLASS --- URGENT!!!!

    Can someone please tell me how to convert a MIPS assembly language file to a .class so I can run it in a JVM? It's URGENT (there's a bus about to hit me and the driver will only stop if I can tell him how to do this).

    Looking for real boobs? I have the best for you. Look
    at www.realandnatural.info you will find the largest
    archive on the net. Enjoy! =)You can't have read many of the posts here. We have quite a set of them ourselves.

  • Multi-language Help in a multi-language web app

    Hello!
    I had posted this on the RH HTML forum but removed that and
    posted here for a wider audience...
    ***Please note: this question is not specific to RH but is
    applicable now that RH 7 is unicode enabled. If you have experience
    that does not relate to RH, please share anyway!
    Once I have developed WebHelp (for example) in multiple
    languages, how do I connect the help files to the web application
    that the help is about? How does the correct language output get
    displayed? For example, the application (that the help documents)
    changes its interface based on browser language. Can the
    appropriate help content be displayed based on browser language?
    How is multi-language help generally implemented for an end user?
    And, equally important, how does context-sensitive help
    (mapping) work with multiple languages?
    I have never been involved in a multi-language development
    effort and so I have no experience to relate this to. Any guidance
    will be greatly (and gratefully
    ) appreciated!
    Kathy

    That's how our developers do it, but I just want to throw in
    one other detail. The help output for each language has to be in a
    separate directory. So if you have 5 languages, you'll have 5
    directories. It's up to the developers to code the app so it
    detects the browser language, then looks in the appropriate help
    directory when the user clicks your help link or icon.
    --Ben

  • Is it possible to use assembly language..?

    is it possible to use assembly language code with the packager for iphone?

    I hope we can write assembly language in XCode and not in packager for iphone. it supports flash and the script of flash AS3.0

  • Assembly Language in Xcode

    I am currently taking a Java course in college and it runs great in Xcode.
    I just found out today that I will have to take an assembly language course sometime next year. I talked to the genius at my local apple store and he said that assembly language will work in Xcode, but will be different for PPC and intel macs.
    However, he did not tell me how to start in assembly language in xcode. If anyone knows how please tell me and, if possible, supply some sample code for an intel mac so I can test it out.
    iBook G4 14 1.2GHz, 1.25GB, iMac Core Duo 17" 1.83GHz 1GB   Mac OS X (10.4.8)  

    There is "gas", the GNU Assembler. As a student, you can buy Borland's Turbo Assembler for $130. The more common Turbo C++, Turbo Delphi(s), and Turbo C# are now free.
    A MBP with Parallels will pretty much handle anything that will run on a PC. It would be an excellent choice for any programmer.
    Still, tele_player is correct. There is no way to tell what platform your assembly class may be using. Few people use assembly anymore and those that do are a little bonkers or just stubborn. You may find yourself learning assembly for the Z80, 68000, or IBM System/360. On the bright side, there are probably emulators for all of those that run on a modern Mac. On the downside, you may still have to submit your assignments on the lab machine.
    It is definitely an excellent course to take. There are not enough programmers who know assembly. You will really learn a lot about how a computer runs software and how to write software.

  • WHAT IS ASSEMBLY LANGUAGE?

    I know this isn't really related to java.
    What is assembly language? I've heard of it but I'm not sure what it is.

    Simply, it is a language that depends on the particular machine you program.
    High level languages like Java,Pascal, etc ... don't depend from the particualr machine where you program ... you have to run the java program .. or re-compile the Pascal program .... to obtain portability on a particular platform ....
    an assembly (asm) program is not portable ... (since the born of emulators)

  • HT201441 i have bought a second hand iphone 4s which is stilllinked to previous owners itunes ID.I cant get his details off him as he has his money and is blanking me. I can't get anything on the phone after setting up the language.HELP!!

    I cannot activatea second hand iphone 4s as i don't have previous owners itunes ID. I can't get anything on the phone after setting the language as its asking for activation. Please can anyone help ???? Ideally i would like to get it back to factory settings and start afresh but right now i would settle for anything. Should say i only have the phone and charger, no box so no details

    Unfortunately, the only one who can help is the previous owner.  Otherwise you will not be able to activate and use the phone.  Apple can't/won't help you with this either.

  • EJB query language help!!

    Hi all, I have been trying to run a ejb query on JBoss 4.0.5, using built in hypersonic db, For some strange reasons am able to fetch all objects from db without any where clause but if am using a where clause with an attribute name from the entitybean am unable to retrieve any results.
    I get an org.hibernate.QueryException, could not resolve property : "property name"
    My ejb query looks like this...
    SELECT template FROM TemplateSelect template WHERE template.template_name='Template_One'
    TemplateSelect is my entity bean class and I do have an attribute named template_name in my bean class.
    could any one please suggest me what could be wrong and also direct me to a good tutorial on ejb query language as well as I am fairly new to hibernate and ejb3 !
    tons of thanks in advance!
    pravin

    Hi Anuradha ,
    I'm afraid the query language does not support retrieving the date portion (i.e. truncating the time) from a date field.
    I propose you turn you named into a BETWEEN query taking two parameters one for the beginning of the day and another for the end of the day. Then your named query could look like:
    SELECT max(o.req_id) FROM requests o WHERE o.requestdate BETWEEN :start AND :end
    The following code creates two calendar instances for the current day, one for 00:00:00 and another for 23:59:59:
    Calendar start = Calendar.getInstance();
    start.set(Calendar.HOUR_OF_DAY, 0);
    start.set(Calendar.MINUTE, 0);
    start.set(Calendar.SECOND, 0);
    start.set(Calendar.MILLISECOND, 0);
    Calendar end = Calendar.getInstance();
    end.set(Calendar.HOUR_OF_DAY, 23);
    end.set(Calendar.MINUTE, 59);
    end.set(Calendar.SECOND, 59);
    end.set(Calendar.MILLISECOND, 999);
    Here is some sample code that creates a query instance for a named query called findMaxRequestPerDay and passes the Date of the above Calendar instance as actual parameter values. It assumes the named query is called findMaxRequestPerDay and the req_id field is a long:
    Query query = em.createNamedQuery("findMaxRequestPerDay");
    query.setParameter("start", start.getTime());
    query.setParameter("end", end.getTime());
    Long max = (Long)query.getSingleResult();
    I hope this helps.
    Regards Michael

  • Multilingual support - Arabic language help file

    Hi,
    I have to produce a help file (of probably close to 1000 topics) that must get translated into Arabic. Development wants a chm file. We have to send the file out to a 3rd-party translation house. I am pretty much locked into RoboHelp 7 for Word as an upgrade is not on the table.
    Is there some specific arabic character set I have to use to get the index and TOC to generate in arabic?
    Is there some setting or override so that numbered lists show up with the number on the right nargin (since Arabic is read right-to-left)? Word flips the list markers properly, but in the test CHM file we generated today, it appears on the left.
    Would multiple-language support work more easily in a different output format? If so, which one?
    ANY assistance will be greatly appreciated.
    thanks,
    Wendy

    Hi Wendy,
    Sadly, RoboHelp is not the tool to use for right-to-left conversions or help projects. A decision was made and has not yet been changed that bi-directional languages are simply too costly to implement against the expected return. I live in Israel and would love to use RoboHelp for Hebrew - I actually had a funny discussion with the development and sales teams on this one time (I've tried many times) in which I said - look, forget Israel - we're really small, but what about all the Arab countries - trust me, there are a lot of them.
    Bottom line - you can't accomplish this in RoboHelp without MAJOR luck and hacking. Other tools that DO allow you to produce help in Hebrew and/or Arabic are: Webworks, AuthorIT, Flare, and I believe Doc2Help...in other words - many competitors.
    I would love to work with Adobe to help bring this functionality to RoboHelp - and have offered. I hope some day they will make a marketing decision to implement this functionality.
    Sorry,
    Paula
    Paula R. Stern
    CEO, WritePoint Ltd.
    www.writepoint.com
    Adobe Community Professional / eHelp RoboHelp MVP / Macromedia Team Member / RoboGURU

  • Arabic Language Help

    Hi,
    On our Development server, We have installed Arabic Language. Our SAP Server is on ECC 6.0. It has got installed successfully.
    When we have logged in to the SAP using Arabic Language. And when we are clicking on F4 for help. The help is comming with the question marks (?????????????)
    Kindly provide your view to fix the same.
    Regards,
    Mohammed

    Hi,
    Please run the RSLANG20 report for all the languages (no only Arabic) selecting all the options (do not forget to set the force mode ON) and, after that, reset the CUA buffers and the dynpro buffers via writing /$CUA and /$DYN in the OK-Code field of each application server (its important to do it on each app.server).
    Br,
    Javier

  • ITunes having a weird language help apple!

    i have been asking around the internet about my problem with iTunes 9, i am a sony vaio windows vista user but i don't think this is a factor. My iTunes 9 is displaying weird characters/language when i am in the iTunes Store.
    http://i358.photobucket.com/albums/oo24/OWNAGEU/ryu-1.jpg
    http://i358.photobucket.com/albums/oo24/OWNAGEU/ryu.jpg
    its the top 10 songs and WAY MORE that look like that.
    PLEASE HELP!
    Thank You

    hmm, something happened with that above post. The problem that I am having is that when I have itunes playing music and the monitors go into sleep mode or the screensaver is up and I "wake" the computer back up, itunes cuts immediately (closes abruptly). Upon re-opening the program, (it opens immediately) there are no error messages or issues at all. This happens about 90% of the time. The rest of the time I will "wake" the monitors or interrupt the screen saver and itunes will function as normal.
    This was supposed to appear in the above post, but I guess it was cut out when I started listing all of the sys. info and sotware info.
    Any advice would be greatly appreciated as I will be DJ'ing a few parties this year and do not want the happening (the music cutting out).

  • Language Help Menu

    My iTunes software is in spanish; however, help from Help Menu is in english; what is wrong? how can i change the menu help language? thanks.

    I have the following structure in the bundle:
    Contents/Reosources
    en.lproj
    help.helpindex
    myapphelp.htm
    es.lproj
    help.helpindex
    myapphelp.htm
    In the code, I have this:
    JMenu helpMenu = new JMenu(MessageUtils.lookupMessage("menu.help"));
    helpMenu.setName(MessageUtils.lookupMessage("menu.help.name"));
    MenuListener menuListenerHelp=new MenuAdapter(helpMenu);
    helpMenu.addMenuListener(menuListenerHelp);
    if (!PlatformManagement.isMac())
    helpMenu.setMnemonic(MessageUtils.lookupMnemonic("menu.help.mnemonic"));
    inputMap.put(KeyStroke.getKeyStroke("alt "+MessageUtils.lookupMessage("menu.help.mnemonic")), helpMenu);
    helpAction = new HelpAction(this, "action.help");
    if (PlatformManagement.isMac()) {
    initMacHelpAccelerator(myframe.getRootPane(), helpAction);
    JTIMenuItem helpItem = new JTIMenuItem(helpAction);
    helpMenu.add(helpItem);

Maybe you are looking for

  • Trackpad is jittery in 10.4

    Oddly, it is fine in Windows XP. an external mouse looks fine. Basically it stalls, especially in the middle of the trackpad. If you use the edges of the trackpad it seems to work better, but still slightly jittery. I have ignore accidental trackpad

  • SQL unicode to XML using XMLForest

    I'm using XMLForest to retrieve some data from the db. One of the columns has unicode characters such as "Ă". I use XMLForest to read in this data, but the result turns this Ă into a "?". How do I keep the unicode format? I need to output this xml to

  • AC:U only available for shipping

    Anyone know why Assassin's Creed: Unity is only available for shipping on both the PS4 and X1 version? I know each store is gonna have like a zillion copies. Why can't I pre-order and select in-store pick up?

  • Bug/scaling issue with Adobe CC etc on 4K displays

    Hi, I'm an issue with Photoshop in particular, but it also happens with some other programs. My screen is 4K Ultra HD and because of this the menus etc. appear incredibly small at the side of the screen (see photo). This is the case with some other p

  • Portal with multiple layout !!!

    Hi, I've seen a lot of questions in this Newsgroup regarding the development of a portal containing multiple layouts, but no clear answers was given. If the only way to develop a portal with multiple layout is to not use the portal framework, please