I want to introduce the basic ideas behind assembly language, and how it relates to your system. We also will examine the tools of the trade for the assembly language programmer and how to get the best out of them. Finally, you'll see some DOS batch files that will make the process of creating a finished program easier.
If you are completely new to assembly language and do not have much experience with the lower-levels of your PC, then some of the material here may be heavy going. Don't worry! I will be deliberately putting all this information together as you will often refer back to it, as you become more experienced. What may not be completely clear now will fall into place as you get more hands-on experience. For now, think of it as a quick tour round the factory.
These first three Chapters have covered the basics of the Assembler environment and has shown how you can use it for creating programs.You now have the ability to use Assemblers such as MASM and TASM and with the help of my examples you should be able to use both standard documentation and the assembler itself more effectively. The object module libraries will make your life easier when it comes to creating large programs involving several programming languages and help you to combine modules created by different compilers. The batch files I have included should help automate the process of setting up and using the assembler components
Now comes the beginning of your assembly language programming. Using such devices as loops and jumps.
Let's learn how to create our first real program, and then watch it execute under Codeview, seeing how it interacts with the system.
We have looked at different methods of controlling program flow, in order to combine these into useful programs. You have been taught about the flags in a CPU and the role they play in program control. You have seen how the JMP, CMP and Loop instructions construct branching and loops in assembly language. The result of all this is that you will be able to create programs which use the memory to store and operate data and to access important system information.
Introducing the layout of memory, the basic principles for addressing it, and the tools available for defining and controlling the memory fields. I will explain the concept of segment and offset. The result of all this is that you will be able to create programs which use the memory to store and operate data and to access important system information.
You looked at how a microprocessor calculates an effective address for objects located in different segments involving different registers, as well as the basic types of addressing. Those of you with MASM 6.x will love the simplified directives these newer versions offer. Templates for -COM and -EXE modules should add nicely to your "Tool-Box". Note that the -COM variant is preferable for programs that can be allocated within one segment. Now you know how the EQU directive allows meaningful names for constants, helping to improve readability. Using basic forms of addressing, you can now access objects located in different storage units - memory and registers.
Remembering the assertion from Nicklaus Wirth's statement in Chapter 4: Algorithms + data structures = programs Let's take some time now to look at data structures in more detail. Using the tools discussed in the previous Chapters, let's really create some useful data structures that reflect more closely the way information is used in the real world.
Now you have seen how the apparently unstructured way in which Assembler handles data and places the responsibility on the programmer to create his own structures. Nearly all data can be defined as a group of bytes, and we can manipulate them accordingly. You have seen how to define and process strings using a number of built-in string functions. While these tools provide almost unlimited flexibility, the price is a greater reliance on the programmer to maintain the integrity of the data, especially when compared to a strongly typed high-level language such as Pascal.
These next chapters will describe how to construct an assembly language program from separate parts, procedures and macros. Learn how to controll program flow when constructing such programs. I think soon we will look at another small macrolibrary. Remember that MACLIB.INC file?
You now have an insight into the structure of assembly language programs. We examined procedures and macros, as well as how information can be passed between them with parameters. Rounding it all off with a simple calculator Program.
These next chapters cover the basic notions of MS-DOS and shows how you can use DOS facilities from within programs written in assembly language. I will show you where to look for the most important system information and how this information is represented in the memory. You will become introduced to the most important tool for using the DOS service - the interrupts. To demonstrate using the DOS facilities, I have designed various small programs that you should be able to include in your routine work.
Having examined the services and information provided by the system software of the PC, you have seen how BIOS and DOS services interact. Using interrupt vectors has shown you how to activate these routines. Finally, I explained how to install your own interrupt handlers. You are now well equipped to move on and take control of all the system resources.
What? You don't believe me? Ok then, I will create more Chapters. Prepare to meet your keyboard.
Increasing your awareness of other keyboard types will help you program your own. Turning the NumLock LED on and off was so much fun. Let's have a look more into the BIOS data area for additional keyboard information fields. These next Chapters will examine the hardware interrupt 09h, software interrupt 16h and the functions of the universal DOS interrupt 21h which are related to the keyboard. Direct use of the keyboard hardware port is examined briefly. Three levels of access - low-level hardware, the BIOS and the DOS services, have distinct advantages.
You have seen how the greatest power, also the most difficult, is provide by low-level hardware access. This technique is dependant on the OS you are using. It is not hard to imagine a multi-user multi-tasking system (UNIX and OS/2 are not far off) prevent user programs from dealing directly with the hardware at all. Low-Level techniques create special software such as national keyboard drivers, terminal emulators or even security systems. You have seen how the BIOS service makes your programs more adaptable, while DOS services are most flexible. Using the DOS services means you can make your program hardware-independent. It is reasonable to expect programs that use the DOS services will work under any operating systems which support DOS applications.
We will begin our look into the disk storage units. Several important Tables like the Master Partition and Dos Volume Boot Sectors will be seen. Managing data on a disk can be done with either BIOS or DOS. Services provided by DOS make file access simpler. You will be introduced to a basic method of open and closing files. File Handlers are not so complicated as you may be lead to believe.
I will be creating more INT 21 pages to go along with Chapter 23. Not fully completed, Sorry. I do work alone and ask for your kind patience.
Direct any questions or Concerns to Royce Wise until we can locate Eddie. --3.23.06
![]()
Monday, December 04, 2000 01:39 PM US Mountain Standard Time