Assemblers and Assembly Language |
Written by Harry Fairhead | |||||||
Friday, 03 May 2019 | |||||||
Page 3 of 3
Just Enough AbstractionWhat is really important here is that the move to a symbolic representation has once again distanced us from the machine code. Now we have something that looks quite sophisticated and is just one step away from the idea of a “variable”, a key concept in the development of all computer languages. You can start to forget about “addressing” and the physical hardware that makes the machine work. Instead you can start to think about creating variables – named units of storage – like PayRate that you can simply use in your program without any worry about where they are actually stored. The elaboration of the “variable” idea gave rise to the first high-level computer language – Fortran. Oddly assembly languages didn’t just take the totally abstract approach. Even today, if you want to use assembler then staying close to the machine’s hardware must be important to you. As a result assembly language programmers have found ways of making their products just abstract enough to make them easier to use but without reducing the efficiency of the program or the ability of the programmer to make things happen exactly as required. So, as well as direct symbolic addressing, most assembly languages have a whole range of different types of addressing that can be used to access data. For example, register relative addressing, as in:
means move the contents of the memory location who's address is given by adding 10 to the contents of the BX register, into register AX. Notice that the square brackets generally mean – the “address given by”. This sort of notation eventually developed into the high-level language concept of an array of variables. For example, you might write PayRate[10] to mean the 10th variable in the PayRate array which would translate more or less directly to [BX]+10. Oddly the concept of an array, or any sophisticated data structure, never caught on as part of an assembler – presumably because it was a step too far away from the hardware. Assemblers slowly developed additional features and one of the most powerful is the idea of the macro. A macro is simply a block of text that you can insert into a program by specifying its name. So if you keep using the same block of assembler you can save a lot of effort by defining a macro for it and using that. Of course things can get much more sophisticated. Macros soon developed parameters so you could write reusable blocks of code that could be customized when used. Today most assemblers are "macro" assemblers and they even come with lots of predefined macros that make assembler closer to a high level language. However the key fact is that to be an assembler it must be possible for the programmer to get back to the lowest possible level - the assembly language that is very close to the way the machine actually works. More InformationWhat Programmers Know
Contents
* Recently revised
Comments
or email your comment to: comments@i-programmer.info To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.
<ASIN:1886411972> <ASIN:0471375233> <ASIN:0789736136> <ASIN:1593270038> |
|||||||
Last Updated ( Saturday, 04 May 2019 ) |