in reply to Re^3: Assembly language
in thread Assembly language

My mac has a 2.5 GHz Intel Core i5 processor, which I believe is 64bit. I would like to run a very simple script to add two numbers together and output the result. If assembly is fundamental, and machine code is the most fundamental, why would I have to download a program to run it? I do not want to download a program to be able to run it. There should be a way to access the processor directly (possibly through terminal) where I could write "000 101 100 ..." and have it output "101 001" (these numbers do not mean anything real)

Replies are listed 'Best First'.
Re^5: Assembly language
by karlgoethebier (Abbot) on Dec 15, 2019 at 13:19 UTC

    You may take a look at Xcode - if you really want to go over this bridge. A more comfortable alternative (smaller instruction set bla...) might be to buy an Arduino for little money and check out Atmel‘s Studio 7 - because the Arduino IDE accepts only this C/C++ subset as far as i remember. Unfortunately Studio 7 runs only on Windows. Therefore you will also need something like Parallels. Good luck and best regards, Karl

    Update: Lost + Found 😎

    «The Crux of the Biscuit is the Apostrophe»

    perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

      Arduino IDE accepts only this C/C++ subset

      Not true actually, although at times it seems the IDE tries to hide the fact that the tool chain is full on gcc. I use C++ including templates (although I've not used exceptions or RTTI) on Arduino Nanos and related 8 bit machines with 32 kBytes of code space and a couple of kBytes of RAM.

      I find the Setup() / Loop() structure of sketches a real PITA a lot of times because it forces the use of global variables when they should really not be needed. However full points to Arduino for using a real language for a simple cheap teaching machine.

      Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond

        Ah, you are right. My last Arduino project is about ten years ago when i helped my son with his high school graduation 🤪 Thanks and best regards, Karl

        «The Crux of the Biscuit is the Apostrophe»

        perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

Re^5: Assembly language
by harangzsolt33 (Deacon) on Dec 14, 2019 at 19:38 UTC

    It's fundamental in the sense that assembly doesn't translate into anything else. It is the lowest level machine language to give instructions to a processor. All the major tasks are broken down into the tiniest instructions. And they cannot be broken down into smaller pieces. It's like atoms. Atoms are the most fundamental building blocks of the world. And if you want to mix chemicals and do stuff, you probably need a science lab! But you might say, if they are the most fundamental, then why do I need a sciance lab? Why can't I just mix something in my backyard or in my hand? You can, but most chemical engineers don't do it that way.

    However, if you want to do it your way, in DOS, there's a program for that. It's called DEBUG.EXE. With this program, you can type your assembly code directly into the memory and run it. But I am not sure if Linux or OSX has a similar program. Most programmers, and I mean 99.99% of people type their assembly program in plain text and save it as a text file and then use an assembler to translate the code to machine language. Then they run the executable and watch it in action. Or they may load a debugger and use it to trace through the program to see how it works.

      All the major tasks are broken down into the tiniest instructions. And they cannot be broken down into smaller pieces.

      Whether that is true or not depends on the processor: Intel Microcode.

      Update: "... they cannot be broken down into smaller pieces. It's like atoms. Atoms are the most fundamental building blocks of the world." is wrong in a similar way: Subatomic particle.

      "then use an assembler" a few moments ago you said a compiler was required..

        oh, please...! :D