Assembler for MacOSX 64bit Tutorial

Assembler for MacOSX 64bit Tutorial

Assembler for MacOSX 64bit Tutorial

Assembler programming is a very early form of software code, dating back as far as 1954, that sits, in the spectrum of computer language sophistication, between computer machine code and the compiled source codes of modern programming languages (which comparatively read like a story … good luck with Assembler stories … gobbleLITTLELESSgook?!), predating BASIC and FORTRAN. The Wikipedia page about compilers puts this in historical perspective β€œ

The first compiler was written by Grace Hopper, in 1952, for the A-0 programming language. The FORTRAN team led by John Backus at IBM is generally credited as having introduced the first complete compiler in 1957.

” Let’s see some information about Assembler, from Wikipedia, below.

An assembly language is a low-level programming language for a computer, or other programmable device, in which there is a very strong (generally one-to-one) correspondence between the language and the architecture’s machine code instructions. Each assembly language is specific to a particular computer architecture, in contrast to most high-level programming languages, which are generally portable across multiple architectures, but require interpreters or compiling.

Assembly language is converted into executable machine code by a utility program referred to as an assembler; the conversion process is referred to as assembly, or assembling the code.

Assembly language uses a mnemonic to represent each low-level machine operation or opcode. Some opcodes require one or more operands as part of the instruction, and most assemblers can take labels and symbols as operands to represent addresses and constants, instead of hard coding them into the program. Macro assemblers include a macroinstruction facility so that assembly language text can be pre-assigned to a name, and that name can be used to insert the text into other code. Many assemblers offer additional mechanisms to facilitate program development, to control the assembly process, and to aid debugging.

Our tutorial today builds on the previous Assember Primer Tutorial where we showed Hello World using Assembler in a 32bit Windows environment, but for today we move to a Mac laptop Terminal bash environment for 64bit and uses the great NASM Assembler.

The tutorial shows some simple Assembler code in action for the following pretty specific environment.

  • Operating System: Mac OS X Version 10.7.5
  • Xcode: Version 4.5.2 (4G2008a)
  • Model Name: MacBook Pro
  • Model Identifier: MacBookPro8,1
  • Processor Name: Intel Core i5
  • Processor Speed: 2.4 GHz
  • Number of Processors: 1
  • Total Number of Cores: 2

Several streamlining operations would be good for your own usage, such as making “ld” be in your path ( so that you don’t need to use the big long path used in this tutorial … arrived at this via … find / -name ‘ld’ 2> /dev/null ) and using more switches so that you don’t link to that default ./a.out etcetera etcetera. This is a very introductory tutorial, so please consult with the links below for more information, and it tends to be that with Assembler programming you need to know your environment and when seeking advice off the search engines, be careful to look for advice as much in common with your own environment as is feasibly possible. Hope you’ve enjoyed this tutorial, and will leave you with some links below. See you on the flip side. Won’t zip (though used zip for this tutorial … chortle, chortle), because we’ll be back here tomorrow. Chow. Be going now. See ya’ later alligator.

Link to Assembler information … from Wikipedia from which quote above comes.
Link to NASM SDK download website here which installs an Assembler compiler for 64bit Mac, amongst other platforms (thanks so much).
Link to downloadable Assembler programming source code which you can rename to helloworld.s inspired by the great tutorial Mac OS X 64 bit Assembly System Calls.


Previous Assember Primer Tutorial is shown below.

Assembler Primer Tutorial

Assembler Primer Tutorial

Assembler programming is a very early form of software code, dating back as far as 1954, that sits, in the spectrum of computer language sophistication, between computer machine code and the compiled source codes of modern programming languages (which comparatively read like a story … good luck with Assembler stories … gobbleLITTLELESSgook?!), predating BASIC and FORTRAN. The Wikipedia page about compilers puts this in historical perspective β€œ

The first compiler was written by Grace Hopper, in 1952, for the A-0 programming language. The FORTRAN team led by John Backus at IBM is generally credited as having introduced the first complete compiler in 1957.

” Let’s see some information about Assembler, from Wikipedia, below.

An assembly language is a low-level programming language for a computer, or other programmable device, in which there is a very strong (generally one-to-one) correspondence between the language and the architecture’s machine code instructions. Each assembly language is specific to a particular computer architecture, in contrast to most high-level programming languages, which are generally portable across multiple architectures, but require interpreters or compiling.

Assembly language is converted into executable machine code by a utility program referred to as an assembler; the conversion process is referred to as assembly, or assembling the code.

Assembly language uses a mnemonic to represent each low-level machine operation or opcode. Some opcodes require one or more operands as part of the instruction, and most assemblers can take labels and symbols as operands to represent addresses and constants, instead of hard coding them into the program. Macro assemblers include a macroinstruction facility so that assembly language text can be pre-assigned to a name, and that name can be used to insert the text into other code. Many assemblers offer additional mechanisms to facilitate program development, to control the assembly process, and to aid debugging.

The tutorial shows some simple Assembler code in action for a Hello World program after seeing some slides regarding the install of MASM 32bit compiler of Assembler code. Please take care if you go ahead installing MASM 32bit Assembler compiler, and, as mentioned several times with the install, do not proceed if there are even warning messages from the install, or, pretty obviously, if you do not have 32bit Windows as your operating system.

Link to Assembler information … from Wikipedia from which quote above comes.
Link to MASM32 SDK download website here which installs an Assembler compiler for 32bit Windows.
Link to downloadable Assembler programming source code which is word for word from Outputting Hello World in MASM using WIN32 Functions and rename to test.asm

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

This entry was posted in eLearning, Operating System, Tutorials and tagged , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>