So hello there, I am jOkkmOkk from dhc-crew, and to start with, dhc is a active demogroup that got banned from POUET because of ex. daemon from our group who spammed around with childish behaviour, so we kicked him off, hiring new coders and wiping off all the stuff he put us in during these days.
As a small tribute, I would like to present to you a small "demo-effect" with just a flickering screen in different colors. Nothing too important. It is going to be done in .286 assembler, and you can use FASM, NASM or any preferable assembler compiler. So, let's go..!
First of all, we would like to start at an adress. I am often using 0x100 as starting adress so let's go with that. Type "org 0x100"
to define that we start at that adress, like this;
Nothing much is gonna happen when you compile this, so let's move along. Now we want to enter the infamous "Mode-X"
, and we can do so by typing;
command followed by "ax,13h"
is simply a command which lets us head into "Mode 13", and "int 10h"
is simply a interrupt to do what is in ax (accumulator register)
Your still with me? Awesome!
If you compile this now, everything that happens is that it goes into VGA mode, so what we will do now is to add some awesome pixels, and we are going to do this by entering what I call drawmode, this is to add the code;
Now here is a small scheme that we have when entering this "draw mode", and im just giving you the most simple ones;
CX = X
DX = Y
AL = Color
That's simple, eh?
Now... Make a loop, you can simple do this by typing
Or you can give your loop a somewhat more creative name.
Why are we making a loop, you ask? Well because now we are going to do the simplest of the most simple, and that is to draw!
Type this into you code or copy this snippet;
Yes sir, this is the source code for our effect! Now what does it do?
Let me explain...
I already explained the "Loop1:" part, yeah, all this is doing is giving us the opportunity to loop a snippet of code.
Now "inc cx"
, will just increase the CX value, remember CX = X, this meaning taking a step to the right. When it comes to pixel 359, all to the right, it will begin to the left again a row down."stosb"
is a command I use to display what we do, that is if any changes happened in the "background", call stosb or int 10h to see the changes. Hard to explain, but in short words, it simple stores a byte.
Now, "cmp cx, 64000"
is a easy one, what it will do is comparing if X = 64000. Remember that I said that it will start a row down. And in VGA mode, 64000 is the the bottom right of the screen, this is that it just checks if X is at the bottom right."jne loop1"
is also something very easy. JNE stands for "Jump if Not Equal" and will jump to specified value, this is "Loop1" if CX is not equal to 64000. In other words, it will continue to draw until it is at the bottom right corner.
Also "inc al"
is placed under the "jne loop1"
which means that it will increase the color by one. This happens when CX = 64000.
And at last, I guess you know this one."jmp loop1"
means just to jump back to the loop.
The good thing is that you will not run into some overflow error if CX or AL in these cases goes beyond it's limits. The registers will just reset. That is if you now compile and run this, you should see the screen smoothly increase into all kinds of colors, and when the colors reaches it's limits, they will just start all over.
So yeah, I don't know if anyone will get any use of this tutorial, but anyhow I hope I cleared up the basics. If there is any questions, just ask and I will try to anwser them.
And to conclude, here is the full source once again. Try to experiment with different values and stuff! Best luck to you, and show me your effects and stuff you make!
This should compile to as small as around 15 - 25 bytes.
Thank you so much for reading this small tutorial!