Small code example

I have a project where I have to compile assembly code (i.e. mov ax,[bx] ) in java. I have my code read in each line and pick out the label, opcode and operands of each line and put them in an array of classes called lineInfo. Each class has line#,label,opcode, and operand in them...
but, my question is, how do I comile them ? I can't find any examples on the internet and i've done a ton of searching. If I can find one example I can work from there. Most searches for java and assembly or assembler reference the JVM :(
Hope someone will be able to point me in the right direction as I haven't had much luck researching this topic.
-Ben

You want to convert machine code to java code??
Sounds like you want a compiler/translator. ANTLR can handle this.....
See http://javadude.com/articles/antlrtut/
If your interested I will email* you my assignment http://www.cs.bham.ac.uk/~hxt/teaching/compilers-ext200506/ although it doesn't actually do the transaltion it does handle the lexical analysis and parsing.
* The deadline has yet to pass, hence I don't want to post it on a public forum.

Similar Messages

  • What this small code does? And how do I do it in Unicode.

    Hi.
    I got the following code and I really don't know what it does or even why. All I know It's not UC enabled ( since it's uxinf the type x).
    I was thinking I might be converting from ascii representation to text or something like that but I'm not that sure.
    FORM TRANSLATE_FIELD USING    STRING_TRAN
                         CHANGING STRING1.
      DATA: STRING(255),
             len1(3) type i,
             LEN(3)  TYPE I,
             NUM(3)  TYPE I,
             I(3)    TYPE I.
      DATA: C VALUE 'A',
            X TYPE X.
      FIELD-SYMBOLS:<fc> type c.
      STRING = STRING_TRAN.
      len1 = strlen( STRING ).
      LEN = 0.
      NUM = 0.
      while len < len1.
        i = STRING+len(3).
        move i to x.
        assign x to <fc> casting type c.
        move <fc> to c.
        MOVE C TO STRING1+NUM.
        len = len + 3.
        NUM = NUM + 1.
      endwhile.
    ENDFORM.                    " TRANSLATE_FIELD
    Thanks
    Ariel

    Hi.
    I want to make this small code UC enabled. Since there is a move of TYPE x into char this is not OK at the mopment.
    the problem is I don't really know or understand how to convert itr to UC enabled program.
    You can notice it takes clusters of 3 chars (bytes ?) long and convert them to char.
    For example 101 = e 100 = d 099 = c.... :-> 101099101 -> ece .
    Thanks
    Ariel

  • Beginner Question | The use of modulus in this simple code example.

    Hello everyone,
    I am just beginning to learn Java and have started reading "Java Programming for the absolute beginner". It is quite a old book but seems to be doing the trick, mainly.
    There is a code example which I follow mostly but the use of the modulus operator in the switch condition doesn't make sense to me, why is it used? Could someone shed some light on this for me?
    import java.util.Random;
    public class FortuneTeller {
      public static void main(String args[]) {
        Random randini = new Random();
        int fortuneIndex;
        String day;
        String[] fortunes = { "The world is going to end :-(.",
          "You will have a HORRIBLE day!",
          "You will stub your toe.",
          "You will find a shiny new nickel.",
          "You will talk to someone who has bad breath.",
          "You will get a hug from someone you love.",
          "You will remember that day for the rest of your life!",
          "You will get an unexpected phone call.",
          "Nothing significant will happen.",
          "You will bump into someone you haven't seen in a while.",
          "You will be publicly humiliated.",
          "You will find forty dollars.",
          "The stars will appear in the sky.",
          "The proper authorities will discover your secret.",
          "You will be mistaken for a god by a small country.",
          "You will win the lottery!",
          "You will change your name to \"Bob\" and move to Alaska.",
          "You will discover first hand that Bigfoot is real.",
          "You will succeed at everything you do.",
          "You will learn something new.",
          "Your friends will treat you to lunch.",
          "You will meet someone famous.",
          "You will be very bored.",
          "You will hear your new favorite song.",
          "Tomorrow... is too difficult to predict" };
        System.out.println("\nYou have awakened the Great Randini...");
        fortuneIndex = randini.nextInt(fortunes.length);
        switch (randini.nextInt(7) % 7) {   
          case 0:
            day = "Sunday";
            break;
          case 1:
            day = "Monday";
            break;
          case 2:
            day = "Tuesday";
            break;
          case 3:
            day = "Wednesday";
            break;
          case 4:
            day = "Thursday";
            break;
          case 5:
            day = "Friday";
            break;
          case 6:
            day = "Saturday";
            break;
          default:
            day = "Tomorrow";
        System.out.println("I, the Great Randini, know all!");
        System.out.println("I see that on " + day);
        System.out.println("\n" + fortunes[fortuneIndex]);
        System.out.println("\nNow, I must sleep...");
    }

    randini.nextInt(7) % 7randini.nextInt(7) returns a value in the range 0 <= x < 7, right? (Check the API!) And:
    0 % 7 == 0
    1 % 7 == 1
    2 % 7 == 2
    3 % 7 == 3
    4 % 7 == 4
    5 % 7 == 5
    6 % 7 == 6Looks like superfluous code to me. Maybe originally they wrote:
    randini.nextInt() % 7Note this code has problems, because, for example -1 % 7 == -1

  • Event-related scrambling rule type - Code example?

    Hi experts,
    I am currently working on an SAP TDMS project which requires me to develop some event-related scrambling rules. As this type of rule doesn't have parameters I'm having trouble understanding how to access the data. I tried to find an example in the forums and searching the internet but I wasn't successful.
    Any help will be much appreciated.
    Thank you.
    Kindest regards,
    Bruno Esperança
    Edited by: Rob Burbank on Feb 3, 2012 9:37 AM

    Hi Rupam!
    Yes, I am using TDMS 3.0.
    Thank you very much for your e-mail.
    I did not find standard package TDSAD. However, I did find include CNV_MBT_TDSAD_ADDR_SCRAM1 which has the code example for an event-related rule.
    Nonetheless, I do have a small concern. This rule was designed to be used by more than one table. Thus, there is a piece of code in the beginning which determines the object (table) that is currently being converted.
      IF g_wa_name IS INITIAL.
    * get receiver structure name of the current conv. obj.:
    *    CONCATENATE g_dmc_cobj_guid ' = ''' g_dmc_cobj_guid_val
    *      '''' INTO g_where_clause_dmc_cobj.
        CONCATENATE g_dmc_cobj_guid ' = ''' _GUID_COBJ
          '''' INTO g_where_clause_dmc_cobj.
        SELECT SINGLE (g_dmc_cobj_rcontainer) FROM (g_dmc_cobj_tabname)
            INTO g_dmc_cobj_rcontainer_into WHERE (g_where_clause_dmc_cobj).
        CONCATENATE g_dmc_stree_container ' = '''
          g_dmc_cobj_rcontainer_into''''
          ' AND' g_dmc_stree_seqnum ' = ''' g_dmc_stree_seqnum_val''''
          ' AND' g_dmc_stree_struclevel ' = ''' g_dmc_stree_struclevel_val
          '''' INTO g_where_clause_dmc_stree.
        SELECT SINGLE (g_dmc_stree_guid) FROM (g_dmc_stree_tabname)
            INTO g_dmc_stree_guid_into WHERE (g_where_clause_dmc_stree).
        CONCATENATE g_dmc_struct_stree ' = ''' g_dmc_stree_guid_into
             '''' INTO g_where_clause.
        SELECT SINGLE (g_dmc_struct_ident) FROM (g_dmc_struct_tabname)
            INTO g_structname WHERE (g_where_clause).
    *  select single ident from dmc_struct into g_structname
    *    where stree = ( select GUID FROM dmc_stree WHERE container =
    *  ( select RCONTAINER FROM dmc_cobj WHERE guid = _guid_cobj )
    *      AND seqnum = '0001' AND struclevel = '01' ).
        CONCATENATE '_WA_' g_structname INTO g_wa_name.
        ASSIGN (g_wa_name) TO <g_wa_name>.
      ENDIF.
    As you can see this has some selects in it, and I'm affraid these selects might be executed for each record of each table. So, in a performance point of view, this might not be so good...
    Is there a reason why I shouldn't use one rule per table, and therefore disregard this piece of code?
    Thank you very much!
    Bruno
    EDIT:
    From what I understood from the code, this is a code example if I assume I'm scrambling table ADRC:
    ASSIGN ('_WA_R_ADRC') TO <g_wa_name>.
    ASSIGN COMPONENT 'NAME1' OF STRUCTURE <g_wa_name> TO <g_name1>.
    Does this make sense to you?
    Thanks.

  • C# Code Example for Configuring SQL 2005 Reporting Services?

    I have found the MSDN articles describing the classes, public methods, etc. for configuring SQL Server 2005 Reporting Services via WMI. I need to initially configure them and just do this:
    - Report Server Virtual Directory
    - Windows Service Identity
    - Web Service Identity
    - Database Setup
    - Email Settings
    - Execution Account
    Is there a C# code example that already exists putting together all of this? I didn't want to reinvent the wheel if I didn't need to.
    -Ed

    Jin,
    Thanks so much! This is great! Your work is awesome!
    I have a couple of issues that came up...
    1) CreateVirtualDirectory.vbs creates the virtual directory for the Report Server just fine. Now how do I distinguish a script to create the virtual directory for the Report Manager?
    2) I decided to go ahead and use what you did for scripting CreateApplicationPool (using http://msdn.microsoft.com/en-us/library/ms155349(SQL.90).aspx). I found the syntax is wrong here when I kept getting an error, so I put PowerShell on the server and pulled the following info:
    Name       : CreateApplicationPool
    MemberType : Method
    Definition : System.Management.ManagementBaseObject CreateApplicationPool(System.String Name, System.Boolean UseBuiltIn
                 Account, System.String Account, System.String Password)
    However, I'd like to use "NT Authority\NetworkService" or "Network Service" as the account (which is an option for the Builtin accounts when I us RSConfigTool.exe). This is the syntax I used:
    objInParam.Properties_.Item(
    "Name") = "ReportServer"
    objInParam.Properties_.Item("UseBuiltInAccount") = true
    objInParam.Properties_.Item("Account") = "NT Authority\NetworkService"
    objInParam.Properties_.Item("Password") = ""
    But I always get an error with a negative number for the HRESULT.
    Any ideas?-Ed

  • [code] does not work correctly, cannot post code example.

    Hi, I tried to do a code example, but HTML tags inside java quoted strings were intereperted. Like the <IMG> tag and the <H1> tag..
    How do I prevent this????
    Re: How to post an audio file in JSP or servlet

    OK, it was the IMG and H1 tags....
    Looks like I can embed an image though <img src="http://www.oracle.com/admin/images/ocom/oralogo_small.gif">

  • Need code example for dynamicly changing UI Propertey

    Hello,
    Can someone show me a simple code example that does the following:
    A view which contains a button and a label.
    Each press on the button changes the color (or other visible property) of the label.
    But note: Don't bind the property to the Context for that, I want to do it through the doModifyView method.

    hi Roy Cohen,
    I think u r not looking for the visibility property they have mentioned.
    I think u r looking for a procedure to change the way the element looks..is it..
    The problem is if u want any change to be visible when the button is pressed u can only change the length or the width.There is no option to change the semantic color or whatever.
    To change the size u can try this code
    IWDInputField in = (IWDInputField)view.getElement("<element name>");
    in.setWidth(some value which is set when the button is pressed);
    Is this wat u r looking for?
    Jus mention it if there is something  else.
    Regards
    Bharathwaj

  • I need code example for server act as client and vice versa

    Hi all,
    I want code example for performing both server and clients using RMI. I mean Server will act as client and client will act as server. So a single program will act as both client and server .
    Please give example, it will helpful to complete my project. I am struggling in this stage. Its like peer to peer action.
    Thanks & Regards
    R.Ragupathi

    1. The tutorial shows you how to do cleint/server.
    2. Search on the topic "callback" to see how cleint and server roles can be reversed.

  • Embedding images in excel cells-please provide code examples

    I need to create excel worksheet and embed an image in a cell. After looking at the POI javadoc and examples, I cannot figure out how to embed the image in a cell, only in the sheet. Does POI support this? I have also been looking a using Jexcel and would like to know if Jexcel supports this? If anyone has answers, please provide code examples.
    thanks

    I need to create excel worksheet and embed an image in a cell. After looking at the POI javadoc and examples, I cannot figure out how to embed the image in a cell, only in the sheet. Does POI support this? I have also been looking a using Jexcel and would like to know if Jexcel supports this? If anyone has answers, please provide code examples.
    thanks

  • ABAP Code example using "GENERATE DYNPRO"

    I am looking for ABAP code example who use the "Generate dynpro" dynamic generation of dynpro at runtime under SAP 4.6C version.
    Best regards,

    We have some programs that do:
    form %view.
    data: anz type i,
          prog like sy-repid.
      prog = sy-repid.
      perform init_download(rsaqexce).
      case %tab.
      when 'G00'.
        perform generate_view_dynpro(rsaqexce)
                using prog text-grl.
        describe table %g00 lines anz.
        tview100-lines = anz.
        perform init_view(rsaqexce) tables %g00 using tview100.
        call screen 100.
        perform reset_view_dynpro(rsaqexce).
      when others.
        message s860(aq).
      endcase.
    endform.
    I think they were copied from existing SAP programs. In any event, look at the relevant forms in program rsaqexce.
    And as Rich noted, SAP doesn't recommend this.
    Rob

  • Code Example connection to MS Exchange

    Hi
    Has anyone got a link to a code example showing how to log into an account on MS Exchange server
    I am trying to log in and read emails from my student account that is on a ms exchange server but am having little luck.
    Could someone give me a couple of good links where i can get some helpful information.
    Thanks very much

    hi
    i am sitting with the same problem, if you find anything please let me know. thanx

  • Need Code Example

    Can someone please show me a code example of how to use RS_EXTERNAL_SELSCREEN_STATUS function.
    I want to delete "Create delivery in background" pushbutton from report vl10h.

    This is the example given in the FM documentation.
    Example
    Example for calling RS_EXTERNAL_SELSCREEN_STATUS:
    PROGRAM SAPDBxyz DEFINING DATABASE xyz.
    FORM INIT.
    CALL FUNCTION 'RS_EXTERNAL_SELSCREEN_STATUS'
    EXPORTING P_FB = 'TEST_EXTERNAL_STATUS'.
    ENDFORM.
    Example for function module that sets the status:
    FUNCTION TEST_EXTERNAL_STATUS.
    ""Local interface:
    *" IMPORTING
    *" P_SUBMIT_MODE
    *" TABLES
    *" P_EXCLUDE STRUCTURE RSEXFCODE
    *" EXCEPTIONS
    *" NO_ACTION
    IF P_SUBMIT_MODE NE SPACE.
    RAISE NO_ACTION.
    ENDIF.
    SET PF-STATUS 'TEST' EXCLUDING P_EXCLUDE.
    SET TITLEBAR 'TST'.
    ENDFUNCTION.
    INITIALIZATION.
    CUA *
    IMPORT T185V FROM MEMORY
    ID SD_COND_MEM_01. "JAY
    RV13B-KVEWE = 'B'.
    RV13B-KOTABNR = '001'.
    CALL FUNCTION 'RS_SUBMIT_INFO'
    IMPORTING
    P_SUBMIT_INFO = RSSUBINFO.
    IF NOT RSSUBINFO-MODE_NORML IS INITIAL.
    TITEL = T185V-CTITEL.
    CALL FUNCTION 'RV_CONDITION_GET_CUA_REPO'
    EXPORTING
    PFKEY_I = 'BSELE'
    TITLE_I = TITEL
    PAR1_I = T185V-PARA1
    PAR2_I = T185V-PARA2
    PAR3_I = T185V-PARA3
    PAR4_I = T185V-PARA4
    TABLES
    EXCL_I = AUSSCHLUSS.
    CALL FUNCTION 'RS_EXTERNAL_SELSCREEN_STATUS'
    EXPORTING
    P_FB = 'RV_CONDITION_SET_CUA_REPO'.
    ENDIF.

  • Save Large Value code example

    I am trying to import the above example into my APEX online workspace, the file is upload ok and the install application portion of the import completes.
    The import supporting objects however hangs....
    Is anyone else encountering this problem?
    When i log back into the APEX workspace the application is visible but i can't seem to find the apex_save_large.js file in the shared components???
    when i click on the save value or retrieve values in the sample form nothing happens....

    Hello,
    I'll look into the install issues, I've never seen it but I'll look again.
    the $a() functions are included in the apex_save_large.js and will be included in the standard js files in a future version.
    $x() is the new format of html_GetElement() so if your in a 2.0 instance just add
    function $x(pNd){return html_GetElement(pNd);}
    ver 2.2 should be fine.
    Is this by design? If so, what are the reasons that it appears there instead of in the static files area.Developer Error and when I get my hands on that lazy guy he's gonna hear about it :)
    When I have a second I'll fix it and get a new version uploaded to the code examples page.
    I added a link to the js file here http://apex.oracle.com/pls/otn/f?p=27916:5
    (hint for digging files out of workspace images adding this real quick to a page &lt;a href="#WORKSPACE_IMAGES#filename.js">filename.js&lt;/a>)
    Carl

  • Code example for virtual list view control

    I'm writing a client (C++) application to access an LDAP directory (that supports virtual lists), and I'm trying to make use of the virtual list view control to "page" my results. However, I'm having trouble getting the code to work correctly. Can anyone provide a C++ code example?
    Thanks in advance.

    I think I've found my problem with writing this code.
    Unless I'm mistaken, the Netscape SDK for C appears to be incomplete. After an LDAP search operation, I believe there should be a way to parse the virtual list response control for a context id. Then, I would return this context id to the directory server in subsequent Virtual List View controls (which I'd send via LDAP search calls). However, the concept of context id in VLV search controls doesn't appear to exist in the Netscape SDK for C.

  • Code example using interface controller ?

    Hi, guys:
    I have a question.
    In CRM UI, I need to integrate one component with another component, and I want to pass the value from 1st component to 2nd component using interface controller. Does any one who have done this before and have a code example?
    Really appreciate!
    Eric

    Hi Eric,
    Refer:
    [http://forums.sdn.sap.com/thread.jspa?threadID=2014259|http://forums.sdn.sap.com/thread.jspa?threadID=2014259]
    [http://forums.sdn.sap.com/thread.jspa?threadID=1909625|http://forums.sdn.sap.com/thread.jspa?threadID=1909625]
    Regards,
    Leon

Maybe you are looking for

  • Activate Discontinue Data in MRP4

    Hai Techies, Could you please advice me how to activate the discontinue data, Follow up material, effectivity out of date in MRP4 screen for MM. Does it have any MPR setting to be done in IMG Or is it available as default for all SAP ECC 6.0 Thanking

  • No ocijdbc8 Error (RH71,ORA816,JDK1.3)

    I meet same ploblem when change any element for connect remote db: Exception in thread "main" java.lang.UnsatisfiedLinkError: no ocijdbc8 in java.l ibrary.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1312) at java.lang.Runtime.loadLibra

  • A thought on brush rotation

    Apparently, it's not nearly as easy as it should be to rotate a brush. I appreciate that jitters exist, as well as "manual" rotation, but what I feel would be possibly most helpful would be to link rotation to the mouse wheel... Just saying.

  • Preinstalled officeXP lost

    All, I had to reinsatll XP on my T60 but lost the microsoft office XP suite application. I only backed up IBMTOOLS folder which does not backup the office suite. So how i can get the product key and the office suite which came pre installed restored

  • Tricky query optimisation

    Hi all, our task is to develop a new application based on the data model of an old application. As the old application must remain available and running, no changes are possible to the tune the database! (currently running on 9.2.0.7) We've put toget