Like Tree55Likes

Need to know parameter format for a Call function?

This is a discussion on Need to know parameter format for a Call function? within the Tech Board forums, part of the Community Boards category; I'm actually an Assembly Language programmer but my question is to ask the format that C# uses to pass a ...

  1. #1
    Registered User
    Join Date
    Jul 2014
    Location
    Amarillo, Texas
    Posts
    104

    "CALL" subroutine passing a parameter format!

    I'm actually an Assembly Language programmer but my question is to ask the format that C# uses to pass a parameter to a subroutine when it is called. I wrote Advanced Data Access Method (ADAM) under DOS 16 bit way back in the early 1980s but have recently converted it to WINDOWS 32 bit. The way you access an ADAM file is to push the ADAM control block address onto the "STACK" and CALL the ADAM subroutine. I need to know what format C# uses to pass a parameter to a subroutine in order to make ADAM available to program developers. It is so much faster and easy to use than SQL that it should be available to program developers.

    Under WINDOWS, unlike under DOS, you can only have one ADAM file open at any given time. I guess I'm not surprised at how much crap Microsoft has placed between control of the hardware by programs with newer versions of WINDOWS. It is MicroSoft's goal to take over all PC programming so they are continuosly removing control from programs. Under WINDOWS, as far as I can tell, you can't acquire a chunk of memory and address it adequately like you can using DOS INT 21H. That's why you can only have one ADAM file open under WINDOWS.

    I was posting on the MASM 32 forum but the administrator is a jerk who thinks that DOS is something that should be done away with. When he asserted that under DOS you can't address more than a few K bytes of disk storage, I corrected him by saying that ADAM has the ability to address files of up to 4 Gigabytes of disk space. He immediately removed all of my posts and banned me from the forum. I am quite sure he has some sort of allegiance to MicroSoft. DOS wasn't even written by MicroSoft nor even Bill Gates. Gates bought it from GE way back when he got the contract from IBM to develop an Operating System for the PC.

    Ultimately I would like to take some SQL programs and convert them to ADAM to show how a real Access Method should have been written. If anyone on this board is interested let me know and we can discuss the project.

  2. #2
    Registered User
    Join Date
    Oct 2006
    Posts
    2,590
    I don't really understand why you want to combine assembly language with C#/.Net. To me, it seems like a fool's errand. If you really want to do this, you could write your assembly language as inline assembly in a C++/CLI project (if it will let you), to produce what they call a "mixed-mode" assembly, which contains some native and some managed code. You would then reference that assembly in your C# project.

    Another option would be to make a fully native Win32 DLL containing your code, and use P/Invoke to call a function in it.

    It still doesn't make sense to do that, because the C++ compiler has gotten so advanced (since the DOS days), that it can probably generate better machine code, from C++, than your hand-written assembly language. I'm not trying to start a fight or belittle your abilities in assembly language, but C and C++ compilers have come a long way in the last 20 years. In my opinion, it would be better to just write an optimized C++ function to do what you want with the file.

    You're likely to get some raised eyebrows, and perhaps even some unkind words, as a DOS programmer, when you start telling people how their access methods "should have" been written. Tread lightly here.
    Code:
    namespace life
    {
        const bool change = true;
    }

  3. #3
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,702
    >> Under WINDOWS, unlike under DOS, you can only have one ADAM file open at any given time.
    Why is that?

    gg

  4. #4
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,175
    You're claiming to have written a general purpose data storage and access system that's faster and easier to use than SQL? Something that thousands have programmers have worked at? Forgive me if I'm skeptical. You could cite some supporting documentation.
    If you understand what you're doing, you're not learning anything.

  5. #5
    Registered User
    Join Date
    Jul 2014
    Location
    Amarillo, Texas
    Posts
    104

    Need to know parameter format for a Call function?

    I wrote Advanced Data Access Metthod (ADAM) back in the 1980s in Assembly Language and have recently updated it to run on WINDOWS. It is so much faster and more efficient than SQL that I would like to make it available to program Developers. To Access an ADAM file you "Push" the address of an ADAM control block onto the "Stack" and issue a Call to the ADAM subroutine. What I need to know is how you pass the address of a paramater in C# so that a C# "Server can be written to access an ADAM file on a "Client/Server" system."

  6. #6
    Registered User
    Join Date
    Oct 2006
    Posts
    2,590
    P/Invoke should get you started.
    Code:
    namespace life
    {
        const bool change = true;
    }

  7. #7
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,306
    I note that you started a similiar thread in the C# forum. Are you also asking this for C, or did you merely forget that you have already asked in the C# forum?
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  8. #8
    Registered User
    Join Date
    Jul 2014
    Location
    Amarillo, Texas
    Posts
    104
    Quote Originally Posted by Codeplug View Post
    >> Under WINDOWS, unlike under DOS, you can only have one ADAM file open at any given time.
    Why is that?

    gg
    Because under Windows the memory that your program uses has to be defned at compile time rather than acquired at execution time like ADAM does under DOS. Granted, you can acquire as "Heap" under WINDOWS but you can't point the "Segment" registers at it like you can under DOS.

  9. #9
    Registered User
    Join Date
    Jul 2014
    Location
    Amarillo, Texas
    Posts
    104
    Quote Originally Posted by Elkvis View Post
    You're likely to get some raised eyebrows, and perhaps even some unkind words, as a DOS programmer, when you start telling people how their access methods "should have" been written. Tread lightly here.
    SQL is complicated to use and (I'll bet) ADAM is easier, faster, and more efficient to use. If someone wants to dispute that assertion, let's convert some software that uses SQL to use ADAM instead and do some testing. I would be glad to show the person or people who developped SQL how a real Access Method runs in case they believe that SQL is such a great thing.

    As for what I'm trying to do, it's been done from way before the PC was invented, "CALL' a subroutine from a program written in a high level language (which C# is) to do something that can be better done in Assembly Language.

  10. #10
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,306
    Quote Originally Posted by Will1
    SQL is complicated to use and (I'll bet) ADAM is easier, faster, and more efficient to use. If someone wants to dispute that assertion, let's convert some software that uses SQL to use ADAM instead and do some testing.
    My guess is that you are talking with respect to a specific set of use cases for which SQL and/or a relational database is not the best tool for the job. If not, then perhaps you should describe how "ADAM is easier, faster, and more efficient to use".

    Quote Originally Posted by Will1
    As for what I'm trying to do, it's been done from way before the PC was invented, "CALL' a subroutine from a program written in a high level language (which C# is) to do something that can be better done in Assembly Language.
    A quick search of the Web brings up this thread in another forum: Using Assembly Language with C#. The suggestion given is to "make an unmanaged C/C++ dll that contains your assembly code and that you P/Invoke against", which is related to the answer that Elkvis gave you when you asked this in the C programming forum here.
    itsme86 and Salem like this.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  11. #11
    Registered User
    Join Date
    Jul 2014
    Location
    Amarillo, Texas
    Posts
    104
    Quote Originally Posted by itsme86 View Post
    You're claiming to have written a general purpose data storage and access system that's faster and easier to use than SQL? Something that thousands have programmers have worked at? Forgive me if I'm skeptical. You could cite some supporting documentation.
    Like John Galt, I didn't see enough intelligence in the human race to make ADAM available so it has been in my position alone for about thirty years now. At my age (75) I probably don't have a lot of years left to observe the ignorance among the population of this planet so I've decided that maybe there are a few, a very few, people who deserve better than what is available to them so I'll make it available. If you want to see a demonstration of what it will do I'll be glad to send you a system that I wrote using it way back then and defy you to duplicate it with SQL.

  12. #12
    Registered User
    Join Date
    Jul 2014
    Location
    Amarillo, Texas
    Posts
    104
    Quote Originally Posted by laserlight View Post
    My guess is that you are talking with respect to a specific set of use cases for which SQL and/or a relational database is not the best tool for the job. If not, then perhaps you should describe how "ADAM is easier, faster, and more efficient to use".


    A quick search of the Web brings up this thread in another forum: Using Assembly Language with C#. The suggestion given is to "make an unmanaged C/C++ dll that contains your assembly code and that you P/Invoke against", which is related to the answer that Elkvis gave you when you asked this in the C programming forum here.
    THANKS! You use the term "relational database" but that is such a general term, covering any file that a program uses, that it is difficult to make a comparison. ADAM allows you to create and access a file using "Key" sequenced records (callled rows in SQL) containing fields (called columns in SQL) which contain the information that the program is designed to process. ADAM also has the ability to create and access data bases that contain entry sequenced records. Records can be fixed length or variable length. If you know of some other Access Method that is available on PCs please describe it.

    IBM has Virtual Storage Access Method (VSAM) on mainframe computers, that I believe is far superior to SQL, but they haven't made it available on PCs.

  13. #13
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,306
    Quote Originally Posted by Will1
    You use the term "relational database" but that is such a general term, covering any file that a program uses, that it is difficult to make a comparison.
    No, the term "relational database" refers specifically to a database in the context of a database system based on the relational model and relational algebra/calculus (the latter leading to the development and use of SQL).

    Quote Originally Posted by Will1
    ADAM allows you to create and access a file using "Key" sequenced records (callled rows in SQL) containing fields (called columns in SQL) which contain the information that the program is designed to process. ADAM also has the ability to create and access data bases that contain entry sequenced records. Records can be fixed length or variable length.
    How would it be easier than say, creating and accessing a table in a relational database?

    Quote Originally Posted by Will1
    IBM has Virtual Storage Access Method (VSAM) on mainframe computers, that I believe is far superior to SQL, but they haven't made it available on PCs.
    A file storage access method can be used by a database system's implementation. I think you're confusing it with the notion of SQL as a declarative language for abstracting relational algebra/calculus to define and manipulate a relational database. One could very well get rid of SQL and still have a relational database system with some other language for manipulating it, or perhaps just provide an interface for the given programming language. Of course, doing so means failing to take advantage of SQL as a lingua franca for manipulating relational databases, though that status is debatable given that each vendor has their own variant of SQL despite standardisation.
    Last edited by laserlight; 07-16-2014 at 12:27 PM.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  14. #14
    Registered User
    Join Date
    Oct 2006
    Posts
    2,590
    Quote Originally Posted by Will1 View Post
    You use the term "relational database" but that is such a general term, covering any file that a program uses
    That is completely and utterly false. A relational database is specifically a logical construct of a collection of tables with fields that reference (relate to) fields in other tables. The storage for the tables may be implemented as files, memory structures, or any number of other possible options.

    Quote Originally Posted by Will1 View Post
    ADAM allows you to create and access a file using "Key" sequenced records (callled rows in SQL) containing fields (called columns in SQL) which contain the information that the program is designed to process. ADAM also has the ability to create and access data bases that contain entry sequenced records. Records can be fixed length or variable length. If you know of some other Access Method that is available on PCs please describe it.
    It sounds to me like your ADAM would be a candidate for backend storage for a relational database. Each ADAM file might make a good backing store for a single RDBMS table. You could then add additional code in a layer on top of ADAM, that would handle the relationships between tables.

    Quote Originally Posted by Will1 View Post
    Because under Windows the memory that your program uses has to be defned at compile time rather than acquired at execution time like ADAM does under DOS.
    Another falsehood. Where did you get this idea?

    Quote Originally Posted by Will1 View Post
    Granted, you can acquire as "Heap" under WINDOWS but you can't point the "Segment" registers at it like you can under DOS.
    Segment registers are not accessible under any modern operating system, and that fact is quite irrelevant to application programmers. Many hardware platforms don't even have segment registers. Even more to the point, why would you need to? Learn to write modern software, and you'll be much better off. You seem to be stuck in a DOS mode of thinking in regard to programming. DOS programming (especially low level) concepts are largely irrelevant to modern programs.
    Code:
    namespace life
    {
        const bool change = true;
    }

  15. #15
    Registered User
    Join Date
    Jul 2014
    Location
    Amarillo, Texas
    Posts
    104
    Quote Originally Posted by laserlight View Post
    I note that you started a similiar thread in the C# forum. Are you also asking this for C, or did you merely forget that you have already asked in the C# forum?
    Just ignore the other post. I didn't notice that this thread had been posted when I posted that one.

Page 1 of 13 1234567891011 ... LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Function call Overhead and Function Call Stack
    By Alam Khan in forum C++ Programming
    Replies: 2
    Last Post: 04-26-2014, 09:28 AM
  2. Replies: 4
    Last Post: 10-03-2011, 07:30 AM
  3. Replies: 13
    Last Post: 08-24-2006, 01:22 AM
  4. Parameter in a function
    By cpluspluser in forum C++ Programming
    Replies: 2
    Last Post: 04-09-2003, 08:48 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21