|
These topics come from my own programming experiences. I have written them all by my selve, so if you have questions, do not mind to mail me.
The basics of VGA-programming (like a moving star screen)
The general idea behind VGA programming is simple. Your monitor presents a screen by printing pixel by pixel from the left to the right from your screen, and then RETRACES (horizontal retrace) back to the left to print the next line form the left to the right, until the last screen line is printed. The next time the monitor wants to refresh your screen it will need a VERTICAL RETRACE to begin at the left-upper corner.
Now take the horizontal moving star screen for example...
This vertical retrace takes a certain time, which you will need to recalculate your stars and print them in the VGA's memory. After the vertical retrace your monitor will present the new screen.
The reason why you should do this in the monitor's vertical retrace is that otherwise you will see your program recalculating the stars. This will not give a flicker free screen! And another thing is that your stars won't move much faster on a pentium as on a 386 machine, because the speed depends on the monitor.
Here is how you should wait for the start of a vertical retrace:
mov dx,3dah ;wait for vertical retrace vrt: in al,dx ;wait for end test al,8 jnz vrt novrt: in al,dx ;wait for start test al,8 jz novrt
So a horizontal moving star_screen code could look like this
hierheen: wait for vertical retrace delete old stars ;the speed of this program code should print the new ones ;always fit in the vertical retrace time ;no matter how slow the computer is (it ;should run perfectly on a 386 machine!) jump hierheen
Note: from my VGA programming experience I have experienced that changing a certain color register with a BIOS function like function 10h, subfunction 10h from int10h, will automatically include the "wait for vertical retrace"-code. So the horizontal moving star-screen code could look like this too:
hierheenII: change a certain color register with BIOS delete old stars print the new ones jmp hierheenIIIf you did NOT understand the part about what your monitor does etc... just keep in mind:
A programming example of VGA-programming is available now! It is a Moving StarScreen, download it NOW!
How to make your own boot code (DOS will really recognize your disk!):
When your computer starts up it will do a self-test and then tries to load the bootsector (512 bytes) of your harddrive/floppy disk in the memory at 0000h:7C00h, and jumps to 0000h:7C00h. You should make a 512 byte long code, but the last word of the 512 bytes should be AA55h because otherwise your computer will not detect that this is a valid bootsector code. The offset 7C00h will make it difficult to jump or access variables, because a normal .COM file will think it will start at offset 100h. To solve this problem you could use "ORG" in your code. Example:
(.COM file) org 100h ;for stacks (NOT used in this program!) jmp verder org 7C3Eh ;!!! the +3Eh is expained in *1 verder: .. . . ;your code... ... . .. . org 7DFEh dw AA55h ;Valid-bootsector-code indentifier *1 The structure of the Bootsector From HELPPC 2.0 by David Jurgens Offset Size Description 00 3 bytes jump to executable code 03 8 bytes OEM name and version 0B 1 word bytes per sector 0D 1 byte sectors per cluster (allocation unit size) 0E 1 word number of reserved sectors (starting at 0) 10 1 byte number of FAT's on disk 11 1 word number of root directory entries (directory size) 13 1 word number of total sectors (0 if partition > 32Mb) 15 1 byte media descriptor byte (see MEDIA DESCRIPTOR) 16 1 word sectors per FAT 18 1 word sectors per track (DOS 3.0+) 1A 1 word number of heads (DOS 3.0+) 1C 1 word number of hidden sectors (DOS 3.0+) 20 1 dword (DOS 4+) number of sectors if offset 13 was 0 24 1 byte (DOS 4+) physical drive number 25 1 byte (DOS 4+) reserved 26 1 byte (DOS 4+) signature byte (29h) 27 4 bytes (DOS 4+) volume serial number 2B 11 bytes (DOS 4+) volume label 36 8 bytes (DOS 4+) reserved
Now you should copy 450 bytes of this .COM file beginning at 7B00h and put this in the first sector (the bootsector) of your floppy disk(/HARDDRIVE???(not recommended, it will no longer be a DOS startup system)) at the offset 3Eh. Use my bootsector writing utility! If you refuse to use my utility you should write the following bytes to the bootsector at the offset 0000h:
db EBh ;JMP RELATIVE instruction db 3Ch ;JMP to +003Ch db 90h ;NOP instruction (do nothing), important ;because if this is not 90h then DOS ;will NOT recognize your disk (This is a standard code for MS-DOS Formatted disks)
You should now have a valid bootdisk.
This is how you can make your own Quick Boot routine...
IMPORTANT NOTES:
This is only what you should do to make it work, the next time I will update this page (for you: soon I hope) I will add my source code and compiled files that are needed to make a Quick boot to this page. Now you may try to make them yourself, without an example (MUCH MORE FUN!!!)!
Do you know a nice subject that can be added to this page, please let me know by
sending E-mail to [email protected]