Well, this is my first tutor so I hope its okay. As an overview throughout the tutor series, I will expand upon each of the steps shown in previous tutors so that you can learn to write RPGs, code 3d, or just about anything you want. I will give example code in TASM (inline assembler) and pascal. ---------------------------------------------------------------------------- By Blazing Scorpion HTTP://www.fortunecity.com/roswell/chupacabras/11/ Guten Tag! This lesson should teach you some basic assembly functions, why they are faster than Pascal, and how to use them to speed up our code. Well, first I should explain to you why assembly is important. When games were first programmed for the IBM-PC, programmers needed a way to tell the computer what to do without having to type in binary code (heh heh). From this need arose assembler, which is a very primitive language, and the foundation for all new languages. Assembler allows us to access the most primitive functions of the PC, and to access them fast. It is faster than pascal because pascal's procedures have to do many other things than just what you tell them, and many times they aren't the most efficient. In assembly, however, you tell the computer EXACTLY what you want, and that is all that it does. Pascal has an "inline" assembler, which you can access in your code. Okay, so how do we tell the compiler when we are programming in assembler. Simple, whenever we want to start programming in Pascal, we type the following: ASM {your assembly code goes in here} {you should also note that you don't need semicolons after each line} END; This is a block of assembly. It works the same as a Begin...End block, but allows you to use assembly and omit semicolons. Now what? Assembly uses its own variables called registers. Functions like "add" and "mul" use different registers. Common word (2 byte) size registers are AX, BX, CX, and DX. Each word register has 2 "sub" registers. For AX they would be AH (H means "high byte") and AL (L means low byte). Got all that? If you don't, read it a few times, and if all else fails, email me. So what good is all of this? Be patient. Let's learn how to perform a function. What if we wanted to assign a value into a variable? We can use the MOV function. Here is an example: ASM MOV AX,8 MOV CX,DX END; The first MOV would set the variable AX to 8. The next MOV sets CX to the value stored in DX. What if we wanted to add two numbers? ASM MOV AX,8 ADD AX,15 END; The MOV statement sets AX to 8. The ADD statement adds 15 to the 8 that was already in AX and then stores the sum in AX. Please note that "ADD 15,9" is an illegal statement because the function has nowhere to store the value. How does all of this pertain to our programming? I will explain this in the next chapter... Unfortunately, this is essential to understanding some of the code coming up soon. If you don't get it, try reading the next lesson. If all else fails, E-Mail me at "ted@totcon.com". Auf Viederzhen (sp?).