Thread: Need to know parameter format for a Call function?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  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
    3,445
    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.
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

  3. #3
    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.

  4. #4
    Registered User
    Join Date
    Jul 2014
    Location
    Amarillo, Texas
    Posts
    104
    Quote Originally Posted by Elkvis View Post
    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.
    Elk - Sorry about the misunderstamding I've had with you. Now that I re-read the first Post on this thread, which you wrote, I realize that you probably gave me the best avice in that post that I've had so far. I guess the reason I didn't read that post thoroughly is because I felt you were criticizig Assembly Language and other posts distracted me. I apologize for being sarcastic. Assembly Language, like any language, is only as good as the person using it. I tried C many years ago (I think before WINDOWS was first released) and didn't like it. I liked the control of the computer that the DOS interrupts gave me. I'm an old mainframe Assembler Language programmer from way before the PC days so I never liked higher level languages. I'll grant you that C and C++ are far better languages than other high level languages but Assembly Language suits me far better. If I write a program for a computer I want the control that the DOS interrupts give me. If I program a computer, I want to "Program the Computer" if you know what I mean.

    It has been a chore making ADAM run under WINDOWS but I managed to make a very limited version of it run under WINDOWS. When I originally wrote ADAM, in the early 1980s using an IBM PCXT, I needed, what is called in mainframe lingo "Base" registers, and that is what the CS, DS, and ES are on a PC. WINDOWS won't let a program use them except in DOS mode. I used the DS: SI and ES: DI registers to communicate and pass data to and from a program that uses ADAM. I don't know why in HELL Microsoft wouldn't allow Assembly language to use the DS and ES registers under WINDOWS. Some people claim that it is because of "Protected Mode" but they are highly mis-informed. The mainframe has had "Protected Mode" ever since the 1960s and It didn't stop me from "Programming the Hardware" if you know what I mean.

    I really have little desire to help the ignorant populace of this planet but it appears that there are a few, a very few, (hopefully like you) who deserve better than those who govern this damned planet, including the USA, are giving us. Maybe you can help me make ADAM available, in a client/server environment, to programmers. Actually, I might be bettter off designing a server that runs DOS (version 6) and running the DOS version of ADAM. (The DOS version is capable of handling files up to 4 Gigabytes long.) I really don't want to learn C well enough to do the job but have, a few weeks ago, been diagnosed with cancer and don't know how much time I have left. Hopefully, for the benefit of the IS community, I have enough time to do it. You will note that I have little respect for the #%@hole people who are politicians. That very type of people have royally f#cked up this planet for a few thousand years now. Also, note that in my Webster's dicionary the word "scheming" is used in the definition of the word "politician."
    Last edited by Will1; 07-18-2014 at 12:21 PM.

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

    gg

  6. #6
    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.

  7. #7
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    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.
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

  8. #8
    Registered User
    Join Date
    Jul 2014
    Location
    Amarillo, Texas
    Posts
    104
    Quote Originally Posted by Elkvis View Post
    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.
    Exactly. SQL does have the ability to establish relationships but it is cumbersome and could be done more efficiently by a program.

    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.
    The reason they are not available under WINDOWS is because MicroSoft didn't want them to be available to applications programs. WINDOWS uses them otherwise it wouldn't be able to address 32 Gigabytes of memory. (more recently 64 Gigabytes) Microsoft is on a path to destroy any control of the hardware that now remains in applications programmers' hands like it did under DOS. One example of that is "Full Screen Mode" which MicroSoft did away with an applications programmer's ability to use in Windows 7. It allows the applications programmer full control of the monitor screen. It still can be used under WINDOWS XP. Anybody with any real intelligence can see MicroSoft's aim to take over all applications programming of PCs. Back in the late 1990s, when the courts attempted to put a leash on MicroSoft's ability to monopolize the PC program market, they didn't realize that MicroSoft could stop the competition by doing away with programs' ability to control the hardware. MicroSoft don't want a program, like I've written, that uses the full screen to run on newer versions of WINDOWS. I'll be glad to send a copy of a system that uses "Full Screen Mode" to anyone who has a desktop running WINDOWS XP or an older version of WINDOWS. (I do have a WINDOWS 7 version of the system but I had to drop the mouse and graphics support of it because MicroSoft did away with that function on WINDOWS 7.)

  9. #9
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    Quote Originally Posted by Will1 View Post
    The reason they are not available under WINDOWS is because MicroSoft didn't want them to be available to applications programs. WINDOWS uses them otherwise it wouldn't be able to address 32 Gigabytes of memory. (more recently 64 Gigabytes) Microsoft is on a path to destroy any control of the hardware that now remains in applications programmers' hands like it did under DOS. One example of that is "Full Screen Mode" which MicroSoft did away with an applications programmer's ability to use in Windows 7. It allows the applications programmer full control of the monitor screen. It still can be used under WINDOWS XP. Anybody with any real intelligence can see MicroSoft's aim to take over all applications programming of PCs. Back in the late 1990s, when the courts attempted to put a leash on MicroSoft's ability to monopolize the PC program market, they didn't realize that MicroSoft could stop the competition by doing away with programs' ability to control the hardware. MicroSoft don't want a program, like I've written, that uses the full screen to run on newer versions of WINDOWS. I'll be glad to send a copy of a system that uses "Full Screen Mode" to anyone who has a desktop running WINDOWS XP or an older version of WINDOWS. (I do have a WINDOWS 7 version of the system but I had to drop the mouse and graphics support of it because MicroSoft did away with that function on WINDOWS 7.)
    I think you're confused about a few things.

    1. Windows does not deny access to hardware. It simply abstracts it into a consistent interface, controlled by security privilege levels. All modern operating systems do this, including every open source system, including Linux, FreeBSD, and many others. If you want direct access to the hardware, write a driver that interfaces with windows in its driver subsystem or write your own OS kernel. Direct access to hardware by application programs threatens the stability of the system, and the security of the user's data. Imagine what could happen if any program could read raw data from the hard drive or intercept network traffic from the network adapter. It's would be stupid to permit that kind of activity from unprivileged applications.

    2. Microsoft does not want to monopolize all PC software. Why would they offer development tools and publish their API documentation if that was their intent? Your argument is ridiculous and reeks of trolling.

    3. Full screen mode is still available, although it's generally associated with DirectX and graphical applications, although a full screen text console could be made to work as a layer on top of DirectX.
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

  10. #10
    Gawking at stupidity
    Join Date
    Jul 2004
    Location
    Oregon, USA
    Posts
    3,218
    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.

  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 MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    Quote Originally Posted by Will1 View Post
    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.
    I'm sorry, I know this topic has been going on forever and Lord knows that I'm not going to read all of it but was anyone else astounded by the arrogance in this post?

    You don't see enough intelligence in the human race? Really? Like, really really?

    Edit : I also agree with phantom's above post about Windows being somehow better than open-source and free software. This isn't the 80's anymore. Linux is making a big comeback and it's for the best. The advent of more advanced graphical shells in tandem with Microsoft slowly collapsing under its own weight has helped to bring Linux back to the youth.
    Last edited by MutantJohn; 08-12-2014 at 11:48 AM.

  13. #13
    Registered User
    Join Date
    Jul 2014
    Location
    Amarillo, Texas
    Posts
    104
    [QUOTE=MutantJohn;1209465]I'm sorry, I know this topic has been going on forever and Lord knows that I'm not going to read all of it but was anyone else astounded by the arrogance in this post?[/QUOTE

    Look around, especialy at the kind of people that are being elected to go to Washington. They are typical hypocrites that take an oath to "Support and Defend" the Constitution of the US. I'll bet they haven't even take the time to read that short and straight forward document, let alone support it. Look at who elected them! What a bunch of idiots there are on this planet. Some brilliant men gave us the best prescription for governing free people and we are loosing it.

    You don't see enough intelligence in the human race? Really? Like, really really?
    REALLY!

    Edit : I also agree with phantom's above post about Windows being somehow better than open-source and free software. This isn't the 80's anymore. Linux is making a big comeback and it's for the best. The advent of more advanced graphical shells in tandem with Microsoft slowly collapsing under its own weight has helped to bring Linux back to the youth.
    I would tend to agree with you except that the processors that Intel and AMD are supplying us with are not programmer friendly. In case you didn't notice, Microsoft did away with "Full Screen Mode" in Windows7. If you downloaded and tried Pro Football Prophet (attached to post 146), I had to do away with the graphics and mouse support that previous versions had. When I write a program I want control of the hardware and the more control that is taken from me, the more I despise the modern operating systems, Linux included. Give me the kind of control that I had under DOS and I'll give you decent software. In case you didn't notice, this once greatest nation that ever existed on this planet is "slowly collapsing under its own weight," the weight of the debt that those idiots that were elected to go to Washington have given us. I have to apologize to the children of today and later generations for the mess that my generation have given to them.

    Will

  14. #14
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    Quote Originally Posted by Will1 View Post
    Quote Originally Posted by MutantJohn View Post
    I'm sorry, I know this topic has been going on forever and Lord knows that I'm not going to read all of it but was anyone else astounded by the arrogance in this post?
    Look around, especialy at the kind of people that are being elected to go to Washington. They are typical hypocrites that take an oath to "Support and Defend" the Constitution of the US. I'll bet they haven't even take the time to read that short and straight forward document, let alone support it. Look at who elected them! What a bunch of idiots there are on this planet. Some brilliant men gave us the best prescription for governing free people and we are loosing it.
    I see you post your location as Texas so I can't help but assume you refer to Obama. The only thing remotely close to directly violating the Constitution was the NSA spying on us but even then, I'm sure it was justified as no one ever reads the privacy agreements when they make an email account.

    Unless you're talking about the Republican party which has shown itself to be more of an antiquated dinosaur of a concept. Examples being, trying to sue Obama, failing like 50 times to repeal the Affordable Care Act and then subsequently causing a government shutdown in which they were still paid but other government workers were not.

    I agree with this country being on the decline and I believe most of it stems from the lack of wealth distribution which is a result of Reaganism. Turns out, the trickle down really is a trickle. You ever try to hydrate 300,000 people with a tiny stream? It doesn't work. Which is why I'm opting to lead the proletariat to overthrow the wealthy and quite literally devour them, should they refuse to yield.

    But even then, how dare you assume this accounts for all people in the country. And whatsmore, how dare you assume who should know what. The fathers of C and Unix did not create these things to dole them out to specific people they deemed worthy. Instead, they wanted this to be for everyone who was willing to learn it. The spread of knowledge is what makes humanity great!

    Sorry, that's just me being self-righteous. I'm arrogant as well. I regularly refer to myself as the King of the Beasts and sometimes the Demons, the inheritor of the Yawarakai-Te. I am the spirit of Lucifer himself reincarnated and sent to Earth to do things right this time around.

    I would tend to agree with you except that the processors that Intel and AMD are supplying us with are not programmer friendly. In case you didn't notice, Microsoft did away with "Full Screen Mode" in Windows7. If you downloaded and tried Pro Football Prophet (attached to post 146), I had to do away with the graphics and mouse support that previous versions had. When I write a program I want control of the hardware and the more control that is taken from me, the more I despise the modern operating systems, Linux included. Give me the kind of control that I had under DOS and I'll give you decent software. In case you didn't notice, this once greatest nation that ever existed on this planet is "slowly collapsing under its own weight," the weight of the debt that those idiots that were elected to go to Washington have given us. I have to apologize to the children of today and later generations for the mess that my generation have given to them.

    Will
    I'm not sure what you mean by the processors themselves not being programmer-friendly. Are you talking about using assembly directly? Because if so, I feel like the use of assembly is now only reserved for embedded programmers and then they probably just use straight C. I feel like in the industry now, the most low-level language is C and even then, there are few jobs using just C compared to those using Java or C# and it's because they are so high-level. I have a friend in game design who uses C# to generate binaries for like 16 different architectures using the same source code. Good luck doing that in assembly.

    But even then, have you never heard of valgrind? It comes with a lot of tools now including the ability to trace cache use and even track multithreaded code and possible conflicts. I mean, I wish I could directly control my CPUs cache but at the same time, it's not that hard to write code to use contiguous memory that's a perfect power of two in size. Writing performant code is still incredibly possible and is done so regularly.

    Either way, I just had to say what I needed to. You sound like a hardcore Windows programmer which I guess is cool but the days of assembly are near dead. If you truly did write code that's better than what's out there and you never distribute it then that's your choice. It was your choice not to help to further advance humanity and it is yours to make.

    KotB out.

  15. #15
    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."

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, 08:28 AM
  2. Replies: 4
    Last Post: 10-03-2011, 06:30 AM
  3. Replies: 13
    Last Post: 08-24-2006, 12:22 AM
  4. Parameter in a function
    By cpluspluser in forum C++ Programming
    Replies: 2
    Last Post: 04-09-2003, 07:48 PM